b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.9) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _main.inc.php

Documentation is available at _main.inc.php

  1. <?php
  2. /**
  3.  * This file initializes everything BUT the blog!
  4.  *
  5.  * It is useful when you want to do very customized templates!
  6.  * It is also called by more complete initializers.
  7.  *
  8.  * This file is part of the evoCore framework - {@link http://evocore.net/}
  9.  * See also {@link http://sourceforge.net/projects/evocms/}.
  10.  *
  11.  * @copyright (c)2003-2006 by Francois PLANQUE - {@link http://fplanque.net/}
  12.  *  Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  13.  *  Parts of this file are copyright (c)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}.
  14.  *
  15.  *  {@internal License choice
  16.  *  - If you have received this file as part of a package, please find the license.txt file in
  17.  *    the same folder or the closest folder above for complete license terms.
  18.  *  - If you have received this file individually (e-g: from http://cvs.sourceforge.net/viewcvs.py/evocms/)
  19.  *    then you must choose one of the following licenses before using the file:
  20.  *    - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  21.  *    - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  22.  *  }}}
  23.  *
  24.  *  {@internal Open Source relicensing agreement:
  25.  *  Daniel HAHLER grants Francois PLANQUE the right to license
  26.  *  Daniel HAHLER's contributions to this file and the b2evolution project
  27.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  28.  *
  29.  *  PROGIDISTRI S.A.S. grants Francois PLANQUE the right to license
  30.  *  PROGIDISTRI S.A.S.'s contributions to this file and the b2evolution project
  31.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  32.  *
  33.  *  Matt FOLLETT grants Francois PLANQUE the right to license
  34.  *  Matt FOLLETT's contributions to this file and the b2evolution project
  35.  *  under any OSI approved OSS license (http://www.opensource.org/licenses/).
  36.  *  }}}
  37.  *
  38.  * @package evocore
  39.  *
  40.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  41.  * @author fplanque: Francois PLANQUE
  42.  * @author blueyed: Daniel HAHLER
  43.  * @author mfollett: Matt FOLLETT.
  44.  * @author mbruneau: Marc BRUNEAU / PROGIDISTRI
  45.  *
  46.  *  {@internal Below is a list of former authors whose contributions to this file have been
  47.  *             either removed or redesigned and rewritten anew:
  48.  *             - t3dworld
  49.  *             - tswicegood
  50.  *  }}}
  51.  *
  52.  * @version $Id: _main.inc.php,v 1.41.2.6 2006/12/01 01:57:49 fplanque Exp $
  53.  */
  54. if!defined('EVO_CONFIG_LOADED') ) die'Please, do not access this page directly.' );
  55.  
  56.  
  57. if$maintenance_mode )
  58. {
  59.     header('HTTP/1.0 503 Service Unavailable');
  60.     echo '<h1>503 Service Unavailable</h1>';
  61.     die'The site is temporarily down for maintenance.' );
  62. }
  63.  
  64.  
  65. /**
  66.  * Prevent double loading since require_once won't work in all situations
  67.  * on windows when some subfolders have caps :(
  68.  * (Check it out on static page generation)
  69.  */
  70. ifdefined'EVO_MAIN_INIT' ) )
  71. {
  72.     return;
  73. }
  74. define'EVO_MAIN_INIT'true );
  75.  
  76.  
  77. /**
  78.  * Security check for older PHP versions
  79.  * Contributed by counterpoint / MAMBO team
  80.  */
  81. $protects array'_REQUEST''_GET''_POST''_COOKIE''_FILES''_SERVER''_ENV''GLOBALS''_SESSION' );
  82. foreach$protects as $protect )
  83. {
  84.     if(  in_array$protectarray_keys($_REQUEST) )
  85.         || in_array$protectarray_keys($_GET) )
  86.         || in_array$protectarray_keys($_POST) )
  87.         || in_array$protectarray_keys($_COOKIE) )
  88.         || in_array$protectarray_keys($_FILES) ) )
  89.     {
  90.         bad_request_die'Unacceptable params.' );
  91.     }
  92. }
  93. /*
  94.  * fp> Alternatively we might want to kill all auto registered globals this way:
  95.  * dh> "Alternatively"? AFAICS the above does not protect us against register_globals!
  96.  * TODO: testing
  97.  *
  98. $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET);
  99. if (isset( $_SESSION )) array_unshift ( $superglobals , $_SESSION );
  100. if (ini_get('register_globals') && !$this->mosConfig_register_globals)
  101. {
  102.     foreach ( $superglobals as $superglobal )
  103.     {
  104.         foreach ( $superglobal as $key => $value)
  105.         {
  106.             unset( $GLOBALS[$key]);
  107.         }
  108.     }
  109. }
  110. */
  111.  
  112. /**
  113.  * Load logging class
  114.  */
  115. require_once dirname(__FILE__).'/_misc/_log.class.php';
  116. /**
  117.  * Debug message log for debugging only (initialized here).
  118.  *
  119.  * If {@link $debug} is off, it will be re-instantiated of class {@link Log_noop} after loading config
  120.  * and perform no operations.
  121.  * @global Log|Log_noop$Debuglog 
  122.  */
  123. $Debuglog new Log'note' );
  124.  
  125. /**
  126.  * Info & error message log for end user (initialized here)
  127.  * @global Log $Messages 
  128.  */
  129. $Messages new Log'error' );
  130.  
  131.  
  132. /**
  133.  * Start timer:
  134.  */
  135. require_once dirname(__FILE__).'/_misc/_timer.class.php';
  136. $Timer new Timer('total');
  137.  
  138. $Timer->start'main.inc' );
  139.  
  140. /**
  141.  * Load base + advanced configuration:
  142.  */
  143. // Note: this should have been done before coming here...
  144. // require_once dirname(__FILE__).'/_config.php';
  145.  
  146.  
  147. /**
  148.  * Sets various arrays and vars, also $app_name!
  149.  *
  150.  * Needed before the error messages.
  151.  */
  152. require_once dirname(__FILE__).'/_vars.inc.php';
  153.  
  154.  
  155. if!$config_is_done )
  156. // base config is not done!
  157.     $error_message 'Base configuration is not done! (see /conf/_basic_config.php)';
  158. }
  159. elseif!isset$locales[$default_locale) )
  160. {
  161.     $error_message 'The default locale '.var_export$default_localetrue ).' does not exist! (see /conf/_locales.php)';
  162. }
  163. ifisset$error_message ) )
  164. // error & exit
  165.     require dirname(__FILE__).'/_conf_error.inc.php';
  166. }
  167.  
  168. if!$debug )
  169. {
  170.     $Debuglog new Log_noop'note' );
  171. }
  172.  
  173.  
  174. /**
  175.  * Miscellaneous functions
  176.  */
  177. require_once dirname(__FILE__).'/_misc/_misc.funcs.php';
  178.  
  179.  
  180. /**
  181.  * Connect to DB
  182.  */
  183. require_once dirname(__FILE__).'/_connect_db.inc.php';
  184.  
  185.  
  186. /**
  187.  * Load settings class
  188.  */
  189. require_once $model_path.'settings/_generalsettings.class.php';
  190. require_once $model_path.'users/_usersettings.class.php';
  191. /**
  192.  * Interface to general settings
  193.  *
  194.  * Keep this below the creation of the {@link $DB DB object}, because it checks for the
  195.  * correct db_version and catches "table does not exist" errors, providing a link to the
  196.  * install script.
  197.  *
  198.  * @global GeneralSettings $Settings 
  199.  */
  200. $Settings new GeneralSettings();
  201. /**
  202.  * Interface to user settings
  203.  *
  204.  * @global UserSettings $UserSettings 
  205.  */
  206. $UserSettings new UserSettings();
  207.  
  208.  
  209. /**
  210.  * Absolute Unix timestamp for server
  211.  * @global int $servertimenow 
  212.  */
  213. $servertimenow time();
  214.  
  215. $time_difference $Settings->get('time_difference');
  216.  
  217. /**
  218.  * Corrected Unix timestamp to match server timezone
  219.  * @global int $localtimenow 
  220.  */
  221. $localtimenow $servertimenow $time_difference;
  222.  
  223.  
  224. /**
  225.  * The Hit class
  226.  */
  227. require_once $model_path.'sessions/_hit.class.php';
  228. /**
  229.  * @global Hit The Hit object
  230.  */
  231. $Hit new Hit();
  232.  
  233.  
  234. /**
  235.  * The Session class.
  236.  * It has to be instantiated before the "SessionLoaded" hook.
  237.  */
  238. require_once $model_path.'sessions/_session.class.php';
  239. /**
  240.  * @global Session The Session object
  241.  */
  242. $Session new Session();
  243.  
  244.  
  245. /**
  246.  * Plugins init.
  247.  * This is done quite early here to give an early hook ("SessionLoaded") to plugins (though it might also be moved just after $DB init when there is reason for a hook there).
  248.  * The {@link dnsbl_antispam_plugin} is an example that uses this to check the user's IP against a list of DNS blacklists.
  249.  */
  250. require_once dirname(__FILE__).'/_misc/_plugins.class.php';
  251. /**
  252.  * @global Plugins The Plugin management object
  253.  */
  254. $Plugins new Plugins();
  255.  
  256.  
  257. // NOTE: it might be faster (though more bandwidth intensive) to spit cached pages (CachePageContent event) than to look into blocking the request (SessionLoaded event).
  258. $Plugins->trigger_event'SessionLoaded' );
  259.  
  260.  
  261. // Trigger a page content caching plugin. This would either return the cached content here or start output buffering
  262. ifempty($generating_static) )
  263. {
  264.     if$Session->get'core.no_CachePageContent' ) )
  265.     // The event is disabled for this request:
  266.         $Session->delete('core.no_CachePageContent');
  267.         $Debuglog->add'Skipping CachePageContent event, because of core.no_CachePageContent setting.''plugins' );
  268.     }
  269.     elseif( ( $get_return $Plugins->trigger_event_first_true'CachePageContent' ) ) // Plugin responded to the event
  270.             && isset($get_return['data']) ) ) // cached content returned
  271.     {
  272.         echo $get_return['data'];
  273.         // Note: we should not use debug_info() here, because the plugin has probably sent a Content-Length header.
  274.         exit;
  275.     }
  276. }
  277.  
  278.  
  279. // TODO: we need an event hook here for the transport_optimizer_plugin, which must get called, AFTER another plugin might have started an output buffer for caching already.
  280. //       Plugin priority is no option, because CachePageContent is a trigger_event_first_true event, for obvious reasons.
  281. //       Name?
  282. //       This must not be exactly here, but before any output.
  283.  
  284.  
  285. /**
  286.  * Load Request class
  287.  */
  288. require_once dirname(__FILE__).'/_misc/_request.class.php';
  289. /**
  290.  * Debug message log for debugging only (initialized here)
  291.  * @global Request $Request 
  292.  */
  293. $Request new Request$Messages );
  294.  
  295.  
  296. if!isset$use_html_checker ) ) $use_html_checker 1}
  297.  
  298.  
  299. /**
  300.  * Includes:
  301.  */
  302. require_once $model_path.'dataobjects/_dataobjectcache.class.php';
  303. require_once $model_path.'generic/_genericelement.class.php';
  304. require_once $model_path.'generic/_genericcache.class.php';
  305. require_once $model_path.'collections/_blog.class.php';
  306. require_once $model_path.'collections/_blog.funcs.php';
  307. require_once $model_path.'collections/_category.funcs.php';
  308. require_once $model_path.'items/_item.funcs.php';
  309. require_once $model_path.'users/_user.funcs.php';
  310. require_once $inc_path.'_misc/_resultsel.class.php';
  311. require_once $inc_path.'_misc/_template.funcs.php';    // function to be called from templates
  312. require_once $model_path.'files/_filecache.class.php';
  313. require_once $model_path.'files/_file.class.php';
  314. require_once $model_path.'files/_filerootcache.class.php';
  315. require_once $model_path.'files/_filetype.class.php';
  316. require_once $model_path.'files/_filetypecache.class.php';
  317. require_once $model_path.'items/_itemcache.class.php';
  318. require_once $model_path.'items/_itemtype.class.php';
  319. require_once $model_path.'items/_itemtypecache.class.php';
  320. require_once $model_path.'items/_link.class.php';
  321. require_once $model_path.'items/_linkcache.class.php';
  322. require_once $model_path.'users/_usercache.class.php';
  323. require_once $model_path.'comments/_comment.funcs.php';
  324. if$use_html_checker require_once $inc_path.'_misc/_htmlchecker.class.php'}
  325. require_once $model_path.'items/_item.funcs.php';
  326. require_once $inc_path.'_misc/_pingback.funcs.php';
  327. require_once $model_path.'skins/_skin.funcs.php';
  328. require_once $inc_path.'_misc/_trackback.funcs.php';
  329. require_once $inc_path.'_misc/ext/_xmlrpc.php';
  330. require_once $inc_path.'_misc/ext/_xmlrpcs.php';
  331. require_once $model_path.'comments/_commentlist.class.php';
  332. require_once $model_path.'items/_itemlist.class.php';
  333.  
  334.  
  335. /**
  336.  * Optionally include obsolete functions
  337.  */
  338. iffile_exists($inc_path.'_misc/_obsolete092.php') )
  339. {
  340.     include_once $inc_path.'_misc/_obsolete092.php';
  341. }
  342.  
  343.  
  344. // Object caches init (we're asking plugins that provide the "CacheObjects" event here first):
  345. $Plugins->get_object_from_cacheplugin_or_create'FileRootCache' );
  346. $Plugins->get_object_from_cacheplugin_or_create'FiletypeCache' );
  347. $Plugins->get_object_from_cacheplugin_or_create'GroupCache''& new DataObjectCache( \'Group\', true, \'T_groups\', \'grp_\', \'grp_ID\', \'grp_name\' )' );
  348. $Plugins->get_object_from_cacheplugin_or_create'ItemTypeCache''& new ItemTypeCache( \'ptyp_\', \'ptyp_ID\' )' );
  349. $Plugins->get_object_from_cacheplugin_or_create'ItemStatusCache''& new GenericCache( \'GenericElement\', true, \'T_itemstatuses\', \'pst_\', \'pst_ID\' )' );
  350.  
  351. // Caches that are not meant to be loaded in total:
  352. $BlogCache new BlogCache();
  353. $FileCache new FileCache();
  354. $ItemCache new ItemCache();
  355. $LinkCache new LinkCache();
  356. $UserCache new UserCache();
  357.  
  358.  
  359. require_once $model_path.'sessions/_hitlog.funcs.php';     // referer logging
  360. require_once dirname(__FILE__).'/_misc/_form.funcs.php';
  361. require_once dirname(__FILE__).'/_misc/_form.class.php';
  362. require_once $model_path.'items/_itemquery.class.php';
  363. require_once dirname(__FILE__).'/_misc/ext/_swfcharts.php';
  364. /**
  365.  * Icon Legend
  366.  */
  367. require_once dirname(__FILE__).'/_misc/_iconlegend.class.php';
  368. $IconLegend new IconLegend();
  369.  
  370.  
  371. /**
  372.  * Locale selection:
  373.  */
  374. $Debuglog->add'default_locale from conf: '.$default_locale'locale' );
  375.  
  376. $Debuglog->add'default_locale from DB: '.$default_locale'locale' );
  377.  
  378. $default_locale locale_from_httpaccept()// set default locale by autodetect
  379. $Debuglog->add'default_locale from HTTP_ACCEPT: '.$default_locale'locale' );
  380.  
  381. if( ($locale_from_get param'locale''string'NULLtrue ))
  382.         && $locale_from_get != $default_locale
  383.         && isset$locales[$locale_from_get) )
  384. {
  385.     $default_locale $locale_from_get;
  386.     $Debuglog->add'Overriding locale from REQUEST: '.$default_locale'locale' );
  387. }
  388.  
  389.  
  390. /**
  391.  * Activate default locale:
  392.  */
  393. locale_activate$default_locale );
  394.  
  395.  
  396. /*
  397.  * Login procedure: {{{
  398.  */
  399. if!isset($login_required) )
  400. {
  401.     $login_required false;
  402. }
  403.  
  404.  
  405. $login NULL;
  406. $pass NULL;
  407. $pass_md5 NULL;
  408.  
  409. ifisset($_POST['login'&& isset($_POST['pwd') )
  410. // Trying to log in with a POST
  411.     $login $_POST['login'];
  412.     $pass $_POST['pwd'];
  413.     unset($_POST['pwd'])// password will be hashed below
  414. }
  415. elseifisset($_GET['login') )
  416. // Trying to log in with a GET; we might only provide a user here.
  417.     $login $_GET['login'];
  418.     $pass = isset($_GET['pwd']$_GET['pwd''';
  419.     unset($_GET['pwd'])// password will be hashed below
  420. }
  421.  
  422. $Debuglog->add'login: '.var_export($logintrue)'login' );
  423. $Debuglog->add'pass: '.empty($pass'' 'not' ).' empty''login' );
  424.  
  425. // either 'login' (normal) or 'redirect_to_backoffice' may be set here. This also helps to display the login form again, if either login or pass were empty.
  426. $login_action $Request->param_arrayindex'login_action' );
  427.  
  428. ifempty($login_action|| (empty($login&& empty($pass)) )
  429. // User is trying to login right now
  430.     $Debuglog->add'User is trying to log in.''login' );
  431.  
  432.     $login strtolower(strip_tags(get_magic_quotes_gpc(stripslashes($login$login));
  433.     $pass strip_tags(get_magic_quotes_gpc(stripslashes($pass$pass);
  434.     $pass_md5 md5$pass );
  435.  
  436.     header_nocache();
  437.     // echo 'Trying to log in right now...';
  438.  
  439.     $Plugins->trigger_event'LoginAttempt'array'login' => $login'pass' => $pass'pass_md5' => $pass_md5 ) );
  440.  
  441.     if$Messages->count('login_error') )
  442.     // A plugin has thrown a login error..
  443.         // Do nothing, the error will get displayed in the login form..
  444.     }
  445.     else
  446.     // Check login and password
  447.     ifuser_pass_ok$login$pass_md5true ) )
  448.     // Login failed
  449.         $Debuglog->add'user_pass_ok() returned false!''login' );
  450.  
  451.         // This will cause the login screen to "popup" (again)
  452.         $Messages->addT_('Wrong login/password.')'login_error' );
  453.     }
  454.     else
  455.     // Login succeeded, set cookies
  456.         $Debuglog->add'User successfully logged in with username and password...''login');
  457.         // set the user from the login that succeeded
  458.         $current_User $UserCache->get_by_login($login);
  459.         // save the user for later hits
  460.         $Session->set_User$current_User );
  461.  
  462.         // Remove deprecated cookies:
  463.         // We do not use $cookie_user / $cookie_pass (would be set in _obsolete092.php), because it
  464.         //  does not harm really (cookies time out) and would allow to set arbitrary cookies through
  465.         //  register_globals!
  466.         ifisset($_COOKIE['cookie'.$instance_name.'user']) )
  467.             setcookie'cookie'.$instance_name.'user'''200000000$cookie_path$cookie_domain );
  468.         ifisset($_COOKIE['cookie'.$instance_name.'pass']) )
  469.             setcookie'cookie'.$instance_name.'pass'''200000000$cookie_path$cookie_domain );
  470.     }
  471. }
  472. elseif$Session->has_User(/* logged in */
  473.     && /* No login param given or the same as current user: */
  474.     empty($login|| ( ( $tmp_User $UserCache->get_by_ID($Session->user_ID) ) && $login == $tmp_User->login ) ) )
  475. /* if the session has a user assigned to it:
  476.      * User was not trying to log in, but he was already logged in:
  477.      */
  478.     // get the user ID from the session and set up the user again
  479.     $current_User $UserCache->get_by_ID$Session->user_ID );
  480.  
  481.     $Debuglog->add'Was already logged in... ['.$current_User->get('login').']''login' );
  482. }
  483. else
  484. // The Session has no user or $login is given (and differs from current user), allow alternate authentication through Plugin:
  485.     if( ($event_return $Plugins->trigger_event_first_true'AlternateAuthentication' ))
  486.         && $Session->has_User()  # the plugin should have attached the user to $Session
  487.     )
  488.     {
  489.         $Debuglog->add'User has been authenticated through plugin #'.$event_return['plugin_ID'].' (AlternateAuthentication)''login' );
  490.         $current_User $UserCache->get_by_ID$Session->user_ID );
  491.     }
  492.     elseif$login_required )
  493.     /*
  494.          * ---------------------------------------------------------
  495.          * User was not logged in at all, but login is required
  496.          * ---------------------------------------------------------
  497.          */
  498.         // echo ' NOT logged in...';
  499.         $Debuglog->add'NOT logged in... (did not try)''login' );
  500.  
  501.         $Messages->addT_('You must log in!')'login_error' );
  502.     }
  503. }
  504. unset($pass);
  505.  
  506.  
  507. // Check if the user needs to be validated, but is not yet:
  508. ifempty($current_User)
  509.         && $current_User->validated
  510.         && $Settings->get('newusers_mustvalidate')
  511.         && $Request->param('action''string'''!= 'logout' )
  512. {
  513.     if$action != 'req_validatemail' && $action != 'validatemail' )
  514.     // we're not in that action already:
  515.         $action 'req_validatemail'// for login.php
  516.         $Messages->addsprintf/* TRANS: %s gets replaced by the user's email address */ T_('You must validate your email address (%s) before you can log in.')$current_User->dget('email') )'login_error' );
  517.     }
  518. }
  519. else
  520. // Trigger plugin event that allows the plugins to re-act on the login event:
  521.     ifempty($current_User) )
  522.     {
  523.         $Plugins->trigger_event'AfterLoginAnonymousUser'array() );
  524.     }
  525.     else
  526.     {
  527.         $Plugins->trigger_event'AfterLoginRegisteredUser'array() );
  528.  
  529.         ifempty($login_action) )
  530.         // We're coming from the Login form and need to redirect to the requested page:
  531.             if$login_action == 'redirect_to_backoffice' )
  532.             // user pressed the "Log into backoffice!" button
  533.                 $redirect_to $admin_url;
  534.             }
  535.             else
  536.             {
  537.                 param'redirect_to''string'$baseurl );
  538.                 if$redirect_to != $baseurl )
  539.                 // taken from param, decode:
  540.                     $redirect_to str_replace('&amp;''&'$redirect_to);
  541.                 }
  542.             }
  543.  
  544.             header_redirect$redirect_to );
  545.             exit();
  546.         }
  547.     }
  548. }
  549.  
  550. // If there are "login_error" messages, they trigger the login form at the end of this file.
  551.  
  552. /* Login procedure }}} */
  553.  
  554.  
  555. /**
  556.  * The Sessions class
  557.  */
  558. require_once $model_path.'sessions/_sessions.class.php';
  559. /**
  560.  * @global Sessions The Sessions object
  561.  */
  562. $Sessions new Sessions();
  563.  
  564.  
  565. /**
  566.  * User locale selection:
  567.  */
  568. ifis_logged_in(&& $current_User->get('locale'!= $current_locale
  569.         && !$locale_from_get )
  570. // change locale to users preference
  571.     /*
  572.      * User locale selection:
  573.      * TODO: this should get done before instantiating $current_User, because we already use T_() there...
  574.      */
  575.     locale_activate$current_User->get('locale') );
  576.     if$current_locale == $current_User->get('locale') )
  577.     {
  578.         $default_locale $current_locale;
  579.         $Debuglog->add'default_locale from user profile: '.$default_locale'locale' );
  580.     }
  581.     else
  582.     {
  583.         $Debuglog->add'locale from user profile could not be activated: '.$current_User->get('locale')'locale' );
  584.     }
  585. }
  586.  
  587.  
  588. // Init charset handling:
  589. init_charsets$current_charset );
  590.  
  591.  
  592. /**
  593.  * Load the icons
  594.  *
  595.  * Note: we can't do this earlier because need the users locale set there ({@link T_()})
  596.  */
  597. require_once $conf_path.'_icons.php';
  598.  
  599.  
  600. // Display login errors (and form). This uses $io_charset, so it's at the end.
  601.  
  602. if$Messages->count'login_error' ) )
  603. {
  604.     header_nocache();
  605.  
  606.     require $htsrv_path.'login.php';
  607.     exit();
  608. }
  609.  
  610. $Timer->pause'main.inc');
  611.  
  612.  
  613. /**
  614.  * Load hacks file if it exists
  615.  */
  616. iffile_exists($conf_path.'hacks.php') )
  617. {
  618.     $Timer->resume'hacks.php' );
  619.     include_once $conf_path.'hacks.php';
  620.     $Timer->pause'hacks.php' );
  621. }
  622.  
  623.  
  624. /*
  625.  * $Log: _main.inc.php,v $
  626.  * Revision 1.41.2.6  2006/12/01 01:57:49  fplanque
  627.  * security compliance
  628.  *
  629.  * Revision 1.41.2.5  2006/11/12 01:20:35  fplanque
  630.  * reverted "bleh" (and put back the pingback display funcs)
  631.  *
  632.  * Revision 1.41.2.4  2006/11/04 19:54:51  fplanque
  633.  * Reinjected old Log blocks. Removing them from CVS was a bad idea -- especially since Daniel has decided branch 1.9 was his HEAD...
  634.  *
  635.  * Revision 1.41  2006/08/05 17:26:25  blueyed
  636.  * oops
  637.  *
  638.  * Revision 1.40  2006/08/05 17:21:01  blueyed
  639.  * Fixed header_redirect handling: do not replace &amp; with & generally, but only when taken from request params.
  640.  *
  641.  * Revision 1.39  2006/07/31 16:38:09  blueyed
  642.  * Allow ->get_by_name() for GroupCache (again!)!
  643.  *
  644.  * Revision 1.38  2006/07/24 01:25:05  blueyed
  645.  * Removed all "@include" occurrences
  646.  *
  647.  * Revision 1.37  2006/07/24 01:09:30  blueyed
  648.  * Using "@" is always bad, especially when including files, as it suppresses errors therein.
  649.  *
  650.  * Revision 1.36  2006/07/14 00:15:33  blueyed
  651.  * TODO
  652.  *
  653.  * Revision 1.35  2006/07/04 23:38:10  blueyed
  654.  * Validate email: admin user (#1) has an extra button to validate him/herself through the form; store multiple req_validatemail keys in the user's session.
  655.  *
  656.  * Revision 1.34  2006/07/02 21:53:30  blueyed
  657.  * time difference as seconds instead of hours; validate user#1 on upgrade; bumped new_db_version to 9300.
  658.  *
  659.  * Revision 1.33  2006/06/30 22:58:13  blueyed
  660.  * Abstracted charset conversation, not much tested.
  661.  *
  662.  * Revision 1.32  2006/06/19 21:13:52  blueyed
  663.  * todo comment
  664.  *
  665.  * Revision 1.31  2006/06/19 21:06:55  blueyed
  666.  * Moved ETag- and GZip-support into transport optimizer plugin.
  667.  *
  668.  * Revision 1.30  2006/06/19 20:59:37  fplanque
  669.  * noone should die anonymously...
  670.  *
  671.  * Revision 1.29  2006/06/19 16:58:11  fplanque
  672.  * minor
  673.  *
  674.  * Revision 1.26  2006/06/13 21:49:14  blueyed
  675.  * Merged from 1.8 branch
  676.  *
  677.  * Revision 1.25  2006/06/01 19:00:07  fplanque
  678.  * no message
  679.  *
  680.  * Revision 1.24  2006/05/28 22:36:47  blueyed
  681.  * Abstracted DB connect into single file.
  682.  *
  683.  * Revision 1.23  2006/05/19 17:03:58  blueyed
  684.  * locale activation fix from v-1-8, abstraction of setting DB connection charset
  685.  *
  686.  * Revision 1.22  2006/05/14 17:59:59  blueyed
  687.  * "try/catch" SET NAMES (Thanks, bodo)
  688.  *
  689.  * Revision 1.21  2006/05/12 22:46:23  blueyed
  690.  *
  691.  * Revision 1.19  2006/05/04 10:18:41  blueyed
  692.  * Added Session property to skip page content caching event.
  693.  *
  694.  * Revision 1.18  2006/05/03 01:53:42  blueyed
  695.  * Encode subject in mails correctly (if mbstrings is available)
  696.  *
  697.  * Revision 1.17  2006/05/02 05:46:08  blueyed
  698.  * fix
  699.  *
  700.  * Revision 1.16  2006/04/29 01:24:04  blueyed
  701.  * More decent charset support;
  702.  * unresolved issues include:
  703.  *  - front office still forces the blog's locale/charset!
  704.  *  - if there's content in utf8, it cannot get displayed with an I/O charset of latin1
  705.  *
  706.  * Revision 1.15  2006/04/24 20:52:30  fplanque
  707.  * no message
  708.  *
  709.  * Revision 1.14  2006/04/22 02:36:38  blueyed
  710.  * Validate users on registration through email link (+cleanup around it)
  711.  *
  712.  * Revision 1.13  2006/04/21 17:05:08  blueyed
  713.  * cleanup
  714.  *
  715.  * Revision 1.12  2006/04/20 22:24:07  blueyed
  716.  * plugin hooks cleanup
  717.  *
  718.  * Revision 1.11  2006/04/19 20:13:48  fplanque
  719.  * do not restrict to :// (does not catch subdomains, not even www.)
  720.  *
  721.  * Revision 1.9  2006/04/18 19:28:34  fplanque
  722.  * mambo idea
  723.  *
  724.  * Revision 1.8  2006/04/18 14:18:03  fplanque
  725.  * security fix
  726.  *
  727.  * Revision 1.7  2006/04/14 19:25:31  fplanque
  728.  * evocore merge with work app
  729.  *
  730.  * Revision 1.6  2006/04/06 17:21:34  blueyed
  731.  * Fixed login procedure for https-admin_url: the login form now POSTs to itself and we redirect to the target url after successful login
  732.  *
  733.  * Revision 1.5  2006/03/24 19:40:49  blueyed
  734.  * Only use absolute URLs if necessary because of used <base/> tag. Added base_tag()/skin_base_tag(); deprecated skinbase()
  735.  *
  736.  * Revision 1.4  2006/03/12 23:08:53  fplanque
  737.  * doc cleanup
  738.  *
  739.  * Revision 1.3  2006/03/05 23:53:54  blueyed
  740.  * If we have login_error Messages, do not login the user.
  741.  *
  742.  * Revision 1.2  2006/03/01 01:07:43  blueyed
  743.  * Plugin(s) polishing
  744.  *
  745.  * Revision 1.1  2006/02/23 21:11:55  fplanque
  746.  * File reorganization to MVC (Model View Controller) architecture.
  747.  * See index.hml files in folders.
  748.  * (Sorry for all the remaining bugs induced by the reorg... :/)
  749.  *
  750.  * Revision 1.87  2006/02/13 20:20:09  fplanque
  751.  * minor / cleanup
  752.  *
  753.  * Revision 1.86  2006/02/12 14:26:37  blueyed
  754.  * Fixed and enhanced login form (log into backoffice)
  755.  *
  756.  * Revision 1.85  2006/02/10 22:08:07  fplanque
  757.  * Various small fixes
  758.  *
  759.  * Revision 1.84  2006/02/03 21:58:05  fplanque
  760.  * Too many merges, too little time. I can hardly keep up. I'll try to check/debug/fine tune next week...
  761.  *
  762.  * Revision 1.83  2006/02/01 21:36:51  blueyed
  763.  * Trigger CacheObject event
  764.  *
  765.  * Revision 1.80  2006/01/26 23:08:36  blueyed
  766.  * Plugins enhanced.
  767.  *
  768.  * Revision 1.79  2006/01/22 20:52:24  blueyed
  769.  * Documented movin $Plugins/$Session init up.
  770.  *
  771.  * Revision 1.78  2006/01/12 21:55:13  blueyed
  772.  * Fix
  773.  *
  774.  * Revision 1.76  2006/01/02 19:43:57  fplanque
  775.  * just a little new year cleanup
  776.  *
  777.  * Revision 1.75  2005/12/30 20:13:40  fplanque
  778.  * UI changes mostly (need to double check sync)
  779.  *
  780.  * Revision 1.73  2005/12/22 23:13:40  blueyed
  781.  * Plugins' API changed and handling optimized
  782.  *
  783.  * Revision 1.72  2005/12/14 19:36:16  fplanque
  784.  * Enhanced file management
  785.  *
  786.  * Revision 1.71  2005/12/12 19:21:22  fplanque
  787.  * big merge; lots of small mods; hope I didn't make to many mistakes :]
  788.  *
  789.  * Revision 1.70  2005/11/25 15:02:00  blueyed
  790.  * $GroupCache: tell him about the name field. This allows to use get_by_name().
  791.  *
  792.  * Revision 1.68  2005/11/24 00:28:18  blueyed
  793.  * Include _vars.inc.php before _conf_error.inc.php!
  794.  *
  795.  * Revision 1.67  2005/11/18 22:28:30  blueyed
  796.  * Fix case for FileCache
  797.  *
  798.  * Revision 1.66  2005/11/14 18:23:13  blueyed
  799.  * Remove experimental memcache support.
  800.  *
  801.  * Revision 1.65  2005/11/09 02:54:42  blueyed
  802.  * Moved inclusion of _file.funcs.php to _misc.funcs.php, because at least bytesreable() gets used in debug_info()
  803.  *
  804.  * Revision 1.64  2005/11/08 15:21:55  blueyed
  805.  * Fix $Debuglog-init when !$debug. We create it now first of class Log and after loading the config it gets re-instantiated of class Log_noop when !$debug. This allows to use $Debuglog during config loading with $debug enabled.
  806.  *
  807.  * Revision 1.63  2005/11/07 18:34:38  blueyed
  808.  * Added class Log_noop, a no-operation implementation of class Log, which gets used if $debug is false.
  809.  *
  810.  * Revision 1.62  2005/11/07 03:27:42  blueyed
  811.  * Use $Session to display a note about already logged in User (because $current_User does not get auto-set if 'login' param is given)
  812.  *
  813.  * Revision 1.61  2005/11/07 03:10:57  blueyed
  814.  * Allow $login to override already logged in user
  815.  *
  816.  * Revision 1.60  2005/11/03 18:23:44  fplanque
  817.  * minor
  818.  *
  819.  * Revision 1.59  2005/11/02 20:11:19  fplanque
  820.  * "containing entropy"
  821.  *
  822.  * Revision 1.58  2005/10/31 23:40:47  blueyed
  823.  * Remove deprecated user/pass cookies
  824.  *
  825.  * Revision 1.57  2005/10/31 06:46:08  blueyed
  826.  * Fix Debuglog for login procedure
  827.  *
  828.  * Revision 1.56  2005/10/31 06:13:03  blueyed
  829.  * Finally merged my work on $Session in.
  830.  *
  831.  * Revision 1.55  2005/10/27 15:25:03  fplanque
  832.  * Normalization; doc; comments.
  833.  *
  834.  * Revision 1.54  2005/10/26 22:42:38  mfollett
  835.  * Modified user retrieval process from using user cookie and password cookie to using session key and session ID to retrieve user information from the sessions table
  836.  *
  837.  * Revision 1.53  2005/10/13 22:17:30  blueyed
  838.  * Moved include of _misc.funcs.inc.php to _main.inc.php
  839.  *
  840.  * Revision 1.52  2005/10/11 19:28:57  blueyed
  841.  * Added decent error message if tables do not exist yet (not installed).
  842.  *
  843.  */
  844. ?>

Documentation generated on Tue, 18 Dec 2007 22:48:30 +0100 by phpDocumentor 1.4.0