# HG changeset patch
# User Dan
# Date 1204864070 18000
# Node ID 340c81fdd350345ea0b702fbfe059f006cb0bc4b
# Parent 2cb1c8a6d3db6fe48a2d2fe0f1f4d585da876bfd
Fixed session validation bug in upgrade script; fixed non-object reference in template_nodb
diff -r 2cb1c8a6d3db -r 340c81fdd350 includes/sessions.php
--- a/includes/sessions.php Thu Mar 06 23:04:45 2008 -0500
+++ b/includes/sessions.php Thu Mar 06 23:27:50 2008 -0500
@@ -1267,9 +1267,18 @@
}
if($ip != $row['source_ip'])
{
+ // Special exception for 1.1.x upgrade - the 1.1.3 upgrade changes the size of the column and this is what validate_session
+ // expects, but if the column size hasn't changed yet just check the first 10 digits of the IP.
+ $fail = true;
+ if ( defined('IN_ENANO_UPGRADE') )
+ {
+ if ( installer_enano_version() == '1.1.3' )
+ $fail = false;
+ }
// Failed IP address check
// echo '(debug) $session->validate_session: IP address mismatch
';
- return false;
+ if ( $fail )
+ return false;
}
// Do the password validation
diff -r 2cb1c8a6d3db -r 340c81fdd350 includes/template.php
--- a/includes/template.php Thu Mar 06 23:04:45 2008 -0500
+++ b/includes/template.php Thu Mar 06 23:27:50 2008 -0500
@@ -2202,10 +2202,13 @@
$q_loc = '' . ( is_object($db) ? "{$db->num_queries} SQL" : 'Queries: N/A' ) . '';
$dbg = $t_loc;
$dbg_long = $t_loc_long;
- if ( $session->user_level >= USER_LEVEL_ADMIN )
+ if ( is_object($session) )
{
- $dbg .= " | $q_loc";
- $dbg_long .= " | $q_loc";
+ if ( $session->user_level >= USER_LEVEL_ADMIN )
+ {
+ $dbg .= " | $q_loc";
+ $dbg_long .= " | $q_loc";
+ }
}
$t = str_replace('[[EnanoPoweredLink]]', 'Powered by Enano', $t);
$t = str_replace('[[EnanoPoweredLinkLong]]', 'Website engine powered by Enano', $t);
diff -r 2cb1c8a6d3db -r 340c81fdd350 install/upgrade.php
--- a/install/upgrade.php Thu Mar 06 23:04:45 2008 -0500
+++ b/install/upgrade.php Thu Mar 06 23:27:50 2008 -0500
@@ -101,6 +101,8 @@
if ( !$session->user_logged_in )
{
$result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_MEMBER);
+ echo 'Session manager returned error:' . '
' . print_r($result, true) . ''; + exit(); } $result = $session->login_without_crypto($_POST['username'], $_POST['password'], false, USER_LEVEL_ADMIN); if ( $result['success'] ) @@ -121,11 +123,11 @@ if ( isset($result) ) { - echo 'Session manager returned error: ' . $result['error'] . ''; + echo 'Session manager returned error:' . '
' . print_r($result, true) . ''; } ?> -
You need an active admin session to continue.
+You need user_logged_in ) echo 'to be logged in and have '; ?>an active admin session to continue.
Username:
Password: