Fixed some bugs with account activation, especially if you're a half-logged-in vegetable.
authorDan
Wed, 06 Jan 2010 02:02:51 -0500
changeset 1206 50f6c144ec68
parent 1205 c922ef08167a
child 1207 044b0062e3bf
Fixed some bugs with account activation, especially if you're a half-logged-in vegetable.
includes/common.php
includes/functions.php
includes/sessions.php
plugins/SpecialUserFuncs.php
--- a/includes/common.php	Wed Jan 06 01:18:19 2010 -0500
+++ b/includes/common.php	Wed Jan 06 02:02:51 2010 -0500
@@ -400,9 +400,6 @@
   
   profiler_log('Checked for (and ran, if applicable) preloader');
   
-  // All checks passed! Start the main components up.  
-  $session->start();
-  
   // Add all of our built in special pages
   foreach ( array('SpecialUserFuncs', 'SpecialPageFuncs', 'SpecialAdmin', 'SpecialCSS', 'SpecialUpDownload', 'SpecialSearch', 'PrivateMessages', 'SpecialGroups', 'SpecialLog') as $plugin )
   {
@@ -414,6 +411,9 @@
   }
   profiler_log('Added special pages');
   
+  // All checks passed! Start the main components up.  
+  $session->start();
+  
   // This is where plugins will want to add pages from 1.1.x on out. You can still add
   // pages at base_classes_initted but the titles won't be localized. This is because
   // the session manager has to be started before localization will work in the user's
--- a/includes/functions.php	Wed Jan 06 01:18:19 2010 -0500
+++ b/includes/functions.php	Wed Jan 06 02:02:51 2010 -0500
@@ -974,9 +974,10 @@
 
   if ( @ob_get_status() )
     ob_end_clean();
-
-  $paths->cpage['name'] = $t;
-  $template->tpl_strings['PAGE_NAME'] = $t;
+  
+  global $output;
+
+  $output->set_title($t);
   $template->header();
   echo $p;
   $template->footer();
@@ -1401,7 +1402,8 @@
       '1.1.4'  => 'Caoineag alpha 4',
       '1.1.5'  => 'Caoineag alpha 5',
       '1.1.6'  => 'Caoineag beta 1',
-      '1.1.7'  => 'Caoineag beta 2'
+      '1.1.7'  => 'Caoineag beta 2',
+      '1.1.8'  => 'Caoineag beta 3',
     );
   $version = enano_version();
   if ( isset($names[$version]) )
--- a/includes/sessions.php	Wed Jan 06 01:18:19 2010 -0500
+++ b/includes/sessions.php	Wed Jan 06 02:02:51 2010 -0500
@@ -440,11 +440,11 @@
     
     if ( $strict )
     {
-      return $namespace == 'Special' && in_array($page_id, array('CSS', 'Login', 'Logout', 'LangExportJSON'));
+      return $namespace == 'Special' && in_array($page_id, array('CSS', 'Login', 'Logout', 'LangExportJSON', 'ActivateAccount'));
     }
     else
     {
-      return $namespace == 'Admin' || ($namespace == 'Special' && in_array($page_id, array('CSS', 'Login', 'Logout', 'Administration')));
+      return $namespace == 'Admin' || ($namespace == 'Special' && in_array($page_id, array('CSS', 'Login', 'Logout', 'Administration', 'LangExportJSON', 'ActivateAccount')));
     }
   }
   
@@ -2264,12 +2264,13 @@
       $new_key = md5(AESCrypt::randkey());
       $this->sql('UPDATE ' . table_prefix . 'users SET account_active = 1, activation_key = \'' . $new_key . '\' WHERE username=\''.$db->escape($user).'\' AND activation_key=\''.$db->escape($key).'\';');
       $this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary) VALUES(\'security\', \'activ_good\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($user).'\', \''.$_SERVER['REMOTE_ADDR'].'\')');
+      return true;
     }
     else
     {
       $this->sql('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,edit_summary) VALUES(\'security\', \'activ_bad\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($user).'\', \''.$_SERVER['REMOTE_ADDR'].'\')');
+      return false;
     }
-    return $r;
   }
   
   /**
--- a/plugins/SpecialUserFuncs.php	Wed Jan 06 01:18:19 2010 -0500
+++ b/plugins/SpecialUserFuncs.php	Wed Jan 06 02:02:51 2010 -0500
@@ -1299,7 +1299,7 @@
     die_friendly($lang->get('userfuncs_activate_err_badlink_title'), '<p>' . $lang->get('userfuncs_activate_err_badlink_body') . '</p>');
   }
   $s = $session->activate_account(str_replace('_', ' ', $user), $key);
-  if ( $s > 0 )
+  if ( $s )
   {
     die_friendly($lang->get('userfuncs_activate_success_title'), '<p>' . $lang->get('userfuncs_activate_success_body') . '</p>');
   }