includes/common.php
changeset 1099 73abd46f5148
parent 1088 3b25a59dacd1
child 1109 c424a15a1656
equal deleted inserted replaced
1098:be6cfe79128c 1099:73abd46f5148
   379     eval($cmd);
   379     eval($cmd);
   380   }
   380   }
   381   
   381   
   382   profiler_log('Finished base_classes_initted hook');
   382   profiler_log('Finished base_classes_initted hook');
   383   
   383   
   384   // For special and administration pages, sometimes there is a "preloader" function that must be run
       
   385   // before the session manager and/or path manager get the init signal. Call it here.  
       
   386   $p = RenderMan::strToPageId($paths->get_pageid_from_url());
       
   387   if( ( $p[1] == 'Admin' || $p[1] == 'Special' ) && function_exists('page_'.$p[1].'_'.$p[0].'_preloader'))
       
   388   {
       
   389     call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
       
   390   }
       
   391   
       
   392   profiler_log('Checked for preloader');
       
   393   
       
   394   // One quick security check...
   384   // One quick security check...
   395   if ( !is_valid_ip($_SERVER['REMOTE_ADDR']) )
   385   if ( !is_valid_ip($_SERVER['REMOTE_ADDR']) )
   396   {
   386   {
   397     die('SECURITY: spoofed IP address: ' . htmlspecialchars($_SERVER['REMOTE_ADDR']));
   387     die('SECURITY: spoofed IP address: ' . htmlspecialchars($_SERVER['REMOTE_ADDR']));
   398   }
   388   }
   399 
   389   
       
   390   // For special and administration pages, sometimes there is a "preloader" function that must be run
       
   391   // before the session manager and/or path manager get the init signal. Call it here.
       
   392   $title = get_title(true);
       
   393   list($page_id, $namespace) = RenderMan::strToPageID($title);
       
   394   list($page_id_top) = explode('/', $page_id);
       
   395   $fname = "page_{$namespace}_{$page_id_top}_preloader";
       
   396   if( ( $namespace == 'Admin' || $namespace == 'Special' ) && function_exists($fname))
       
   397   {
       
   398     call_user_func($fname);
       
   399   }
       
   400   
       
   401   profiler_log('Checked for (and ran, if applicable) preloader');
       
   402   
   400   // All checks passed! Start the main components up.  
   403   // All checks passed! Start the main components up.  
   401   $session->start();
   404   $session->start();
   402   
   405   
   403   // Add all of our built in special pages
   406   // Add all of our built in special pages
   404   foreach ( array('SpecialUserFuncs', 'SpecialPageFuncs', 'SpecialAdmin', 'SpecialCSS', 'SpecialUpDownload', 'SpecialSearch', 'PrivateMessages', 'SpecialGroups', 'SpecialLog') as $plugin )
   407   foreach ( array('SpecialUserFuncs', 'SpecialPageFuncs', 'SpecialAdmin', 'SpecialCSS', 'SpecialUpDownload', 'SpecialSearch', 'PrivateMessages', 'SpecialGroups', 'SpecialLog') as $plugin )
   421     eval($cmd);
   424     eval($cmd);
   422   }
   425   }
   423   
   426   
   424   profiler_log('Ran session_started hook');
   427   profiler_log('Ran session_started hook');
   425   
   428   
   426   $paths->init();
   429   $paths->init($title);
   427   
   430   
   428   // setup output format
   431   // setup output format
   429   if ( defined('ENANO_OUTPUT_FORMAT') )
   432   if ( defined('ENANO_OUTPUT_FORMAT') )
   430     $class = 'Output_' . ENANO_OUTPUT_FORMAT;
   433     $class = 'Output_' . ENANO_OUTPUT_FORMAT;
   431   else
   434   else