b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.8) [ 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.22.2.10 2006/12/02 02:41:27 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'3600;
  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. /**
  280.  * Load Request class
  281.  */
  282. require_once dirname(__FILE__).'/_misc/_request.class.php';
  283. /**
  284.  * Debug message log for debugging only (initialized here)
  285.  * @global Request $Request 
  286.  */
  287. $Request new Request$Messages );
  288.  
  289.  
  290. if!isset$use_html_checker ) ) $use_html_checker 1}
  291.  
  292.  
  293. /**
  294.  * Includes:
  295.  */
  296. require_once $model_path.'dataobjects/_dataobjectcache.class.php';
  297. require_once $model_path.'generic/_genericelement.class.php';
  298. require_once $model_path.'generic/_genericcache.class.php';
  299. require_once $model_path.'collections/_blog.class.php';
  300. require_once $model_path.'collections/_blog.funcs.php';
  301. require_once $model_path.'collections/_category.funcs.php';
  302. require_once $model_path.'items/_item.funcs.php';
  303. require_once $model_path.'users/_user.funcs.php';
  304. require_once $inc_path.'_misc/_resultsel.class.php';
  305. require_once $inc_path.'_misc/_template.funcs.php';    // function to be called from templates
  306. require_once $model_path.'files/_filecache.class.php';
  307. require_once $model_path.'files/_file.class.php';
  308. require_once $model_path.'files/_filerootcache.class.php';
  309. require_once $model_path.'files/_filetype.class.php';
  310. require_once $model_path.'files/_filetypecache.class.php';
  311. require_once $model_path.'items/_itemcache.class.php';
  312. require_once $model_path.'items/_itemtype.class.php';
  313. require_once $model_path.'items/_itemtypecache.class.php';
  314. require_once $model_path.'items/_link.class.php';
  315. require_once $model_path.'items/_linkcache.class.php';
  316. require_once $model_path.'users/_usercache.class.php';
  317. require_once $model_path.'comments/_comment.funcs.php';
  318. if$use_html_checker require_once $inc_path.'_misc/_htmlchecker.class.php'}
  319. require_once $model_path.'items/_item.funcs.php';
  320. require_once $inc_path.'_misc/_pingback.funcs.php';
  321. require_once $inc_path.'_misc/_ping.funcs.php';
  322. require_once $model_path.'skins/_skin.funcs.php';
  323. require_once $inc_path.'_misc/_trackback.funcs.php';
  324. require_once $inc_path.'_misc/ext/_xmlrpc.php';
  325. require_once $inc_path.'_misc/ext/_xmlrpcs.php';
  326. require_once $model_path.'comments/_commentlist.class.php';
  327. require_once $model_path.'items/_itemlist.class.php';
  328.  
  329.  
  330. /**
  331.  * Optionally include obsolete functions
  332.  */
  333. iffile_exists($inc_path.'_misc/_obsolete092.php') )
  334. {
  335.     include_once $inc_path.'_misc/_obsolete092.php';
  336. }
  337.  
  338.  
  339. // Object caches init (we're asking plugins that provide the "CacheObjects" event here first):
  340. $Plugins->get_object_from_cacheplugin_or_create'FileRootCache' );
  341. $Plugins->get_object_from_cacheplugin_or_create'FiletypeCache' );
  342. $Plugins->get_object_from_cacheplugin_or_create'GroupCache''& new DataObjectCache( \'Group\', true, \'T_groups\', \'grp_\', \'grp_ID\', \'grp_name\' )' );
  343. $Plugins->get_object_from_cacheplugin_or_create'ItemTypeCache''& new ItemTypeCache( \'ptyp_\', \'ptyp_ID\' )' );
  344. $Plugins->get_object_from_cacheplugin_or_create'ItemStatusCache''& new GenericCache( \'GenericElement\', true, \'T_itemstatuses\', \'pst_\', \'pst_ID\' )' );
  345.  
  346. // Caches that are not meant to be loaded in total:
  347. $BlogCache new BlogCache();
  348. $FileCache new FileCache();
  349. $ItemCache new ItemCache();
  350. $LinkCache new LinkCache();
  351. $UserCache new UserCache();
  352.  
  353.  
  354. require_once $model_path.'sessions/_hitlog.funcs.php';     // referer logging
  355. require_once dirname(__FILE__).'/_misc/_form.funcs.php';
  356. require_once dirname(__FILE__).'/_misc/_form.class.php';
  357. require_once $model_path.'items/_itemquery.class.php';
  358. require_once dirname(__FILE__).'/_misc/ext/_swfcharts.php';
  359. /**
  360.  * Icon Legend
  361.  */
  362. require_once dirname(__FILE__).'/_misc/_iconlegend.class.php';
  363. $IconLegend new IconLegend();
  364.  
  365.  
  366. /**
  367.  * Locale selection:
  368.  */
  369. $Debuglog->add'default_locale from conf: '.$default_locale'locale' );
  370.  
  371. $Debuglog->add'default_locale from DB: '.$default_locale'locale' );
  372.  
  373. $default_locale locale_from_httpaccept()// set default locale by autodetect
  374. $Debuglog->add'default_locale from HTTP_ACCEPT: '.$default_locale'locale' );
  375.  
  376. if( ($locale_from_get param'locale''string'NULLtrue ))
  377.         && $locale_from_get != $default_locale
  378.         && isset$locales[$locale_from_get) )
  379. {
  380.     $default_locale $locale_from_get;
  381.     $Debuglog->add'Overriding locale from REQUEST: '.$default_locale'locale' );
  382. }
  383.  
  384.  
  385. /**
  386.  * Activate default locale:
  387.  */
  388. locale_activate$default_locale );
  389.  
  390.  
  391. /*
  392.  * Login procedure: {{{
  393.  */
  394. if!isset($login_required) )
  395. {
  396.     $login_required false;
  397. }
  398.  
  399.  
  400. $login NULL;
  401. $pass NULL;
  402. $pass_md5 NULL;
  403.  
  404. ifisset($_POST['login'&& isset($_POST['pwd') )
  405. // Trying to log in with a POST
  406.     $login $_POST['login'];
  407.     $pass $_POST['pwd'];
  408.     unset($_POST['pwd'])// password will be hashed below
  409. }
  410. elseifisset($_GET['login') )
  411. // Trying to log in with a GET; we might only provide a user here.
  412.     $login $_GET['login'];
  413.     $pass = isset($_GET['pwd']$_GET['pwd''';
  414.     unset($_GET['pwd'])// password will be hashed below
  415. }
  416.  
  417. $Debuglog->add'login: '.var_export($logintrue)'login' );
  418. $Debuglog->add'pass: '.empty($pass'' 'not' ).' empty''login' );
  419.  
  420. // 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.
  421. $login_action $Request->param_arrayindex'login_action' );
  422.  
  423. ifempty($login_action|| (empty($login&& empty($pass)) )
  424. // User is trying to login right now
  425.     $Debuglog->add'User is trying to log in.''login' );
  426.  
  427.     $login strtolower(strip_tags(get_magic_quotes_gpc(stripslashes($login$login));
  428.     $pass strip_tags(get_magic_quotes_gpc(stripslashes($pass$pass);
  429.     $pass_md5 md5$pass );
  430.  
  431.     header_nocache();
  432.     // echo 'Trying to log in right now...';
  433.  
  434.     $Plugins->trigger_event'LoginAttempt'array'login' => $login'pass' => $pass'pass_md5' => $pass_md5 ) );
  435.  
  436.     if$Messages->count('login_error') )
  437.     // A plugin has thrown a login error..
  438.         // Do nothing, the error will get displayed in the login form..
  439.     }
  440.     else
  441.     // Check login and password
  442.     ifuser_pass_ok$login$pass_md5true ) )
  443.     // Login failed
  444.         $Debuglog->add'user_pass_ok() returned false!''login' );
  445.  
  446.         // This will cause the login screen to "popup" (again)
  447.         $Messages->addT_('Wrong login/password.')'login_error' );
  448.     }
  449.     else
  450.     // Login succeeded, set cookies
  451.         $Debuglog->add'User successfully logged in with username and password...''login');
  452.         // set the user from the login that succeeded
  453.         $current_User $UserCache->get_by_login($login);
  454.         // save the user for later hits
  455.         $Session->set_User$current_User );
  456.  
  457.         // Remove deprecated cookies:
  458.         // We do not use $cookie_user / $cookie_pass (would be set in _obsolete092.php), because it
  459.         //  does not harm really (cookies time out) and would allow to set arbitrary cookies through
  460.         //  register_globals!
  461.         setcookie'cookie'.$instance_name.'user'''200000000$cookie_path$cookie_domain );
  462.         setcookie'cookie'.$instance_name.'pass'''200000000$cookie_path$cookie_domain );
  463.     }
  464. }
  465. elseif$Session->has_User(/* logged in */
  466.     && /* No login param given or the same as current user: */
  467.     empty($login|| ( ( $tmp_User $UserCache->get_by_ID($Session->user_ID) ) && $login == $tmp_User->login ) ) )
  468. /* if the session has a user assigned to it:
  469.      * User was not trying to log in, but he was already logged in:
  470.      */
  471.     // get the user ID from the session and set up the user again
  472.     $current_User $UserCache->get_by_ID$Session->user_ID );
  473.  
  474.     $Debuglog->add'Was already logged in... ['.$current_User->get('login').']''login' );
  475. }
  476. else
  477. // The Session has no user or $login is given (and differs from current user), allow alternate authentication through Plugin:
  478.     if( ($event_return $Plugins->trigger_event_first_true'AlternateAuthentication' ))
  479.         && $Session->has_User()  # the plugin should have attached the user to $Session
  480.     )
  481.     {
  482.         $Debuglog->add'User has been authenticated through plugin #'.$event_return['plugin_ID'].' (AlternateAuthentication)''login' );
  483.         $current_User $UserCache->get_by_ID$Session->user_ID );
  484.     }
  485.     elseif$login_required )
  486.     /*
  487.          * ---------------------------------------------------------
  488.          * User was not logged in at all, but login is required
  489.          * ---------------------------------------------------------
  490.          */
  491.         // echo ' NOT logged in...';
  492.         $Debuglog->add'NOT logged in... (did not try)''login' );
  493.  
  494.         $Messages->addT_('You must log in!')'login_error' );
  495.     }
  496. }
  497. unset($pass);
  498.  
  499.  
  500. // Check if the user needs to be validated, but is not yet:
  501. ifempty($current_User)
  502.         && $current_User->validated
  503.         && $Settings->get('newusers_mustvalidate')
  504.         && $Request->param('action''string'''!= 'logout' )
  505. {
  506.     if$action != 'req_validatemail' && $action != 'validatemail' )
  507.     // we're not in that action already:
  508.         $action 'req_validatemail'// for login.php
  509.         $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' );
  510.     }
  511. }
  512. else
  513. // Trigger plugin event that allows the plugins to re-act on the login event:
  514.     ifempty($current_User) )
  515.     {
  516.         $Plugins->trigger_event'AfterLoginAnonymousUser'array() );
  517.     }
  518.     else
  519.     {
  520.         $Plugins->trigger_event'AfterLoginRegisteredUser'array() );
  521.  
  522.         ifempty($login_action) )
  523.         // We're coming from the Login form and need to redirect to the requested page:
  524.             param'redirect_to''string'$baseurl );
  525.  
  526.             if$login_action == 'redirect_to_backoffice' )
  527.             // user pressed the "Log into backoffice!" button
  528.                 $redirect_to $admin_url;
  529.             }
  530.  
  531.             header_redirect$redirect_to );
  532.             exit();
  533.         }
  534.     }
  535. }
  536.  
  537. // If there are "login_error" messages, they trigger the login form at the end of this file.
  538.  
  539. /* Login procedure }}} */
  540.  
  541.  
  542. /**
  543.  * The Sessions class
  544.  */
  545. require_once $model_path.'sessions/_sessions.class.php';
  546. /**
  547.  * @global Sessions The Sessions object
  548.  */
  549. $Sessions new Sessions();
  550.  
  551.  
  552. /**
  553.  * User locale selection:
  554.  */
  555. ifis_logged_in(&& $current_User->get('locale'!= $current_locale
  556.         && !$locale_from_get )
  557. // change locale to users preference
  558.     /*
  559.      * User locale selection:
  560.      * TODO: this should get done before instantiating $current_User, because we already use T_() there...
  561.      */
  562.     locale_activate$current_User->get('locale') );
  563.     if$current_locale == $current_User->get('locale') )
  564.     {
  565.         $default_locale $current_locale;
  566.         $Debuglog->add'default_locale from user profile: '.$default_locale'locale' );
  567.     }
  568.     else
  569.     {
  570.         $Debuglog->add'locale from user profile could not be activated: '.$current_User->get('locale')'locale' );
  571.     }
  572. }
  573.  
  574.  
  575. /**
  576.  * @global string The INPUT/OUTPUT charset (from the locale MESSAGES). MAY be overriden in _blog_main.inc.php.
  577.  */
  578. $io_charset locale_charset(false);
  579.  
  580.  
  581. // Check and adjust $evo_charset if needed:
  582. ifempty($evo_charset) )
  583. // Internal encoding follows INPUT/OUTPUT encoding:
  584.     $evo_charset $io_charset;
  585. }
  586. elseif$evo_charset != $io_charset )
  587. // we have to convert for I/O, which requires mbstrings extension
  588.     iffunction_exists('mb_convert_encoding') )
  589.     {
  590.         $Debuglog->add'$evo_charset differs from $io_charset, but mbstrings does not seem to be installed.'array('errors','locale') );
  591.         $evo_charset $io_charset// we cannot convert I/O to internal charset
  592.     }
  593.     else
  594.     // check if the encodings are supported:
  595.         iffunction_exists('mb_list_encodings') ) // PHP5
  596.         {
  597.             $mb_encodings mb_list_encodings();
  598.         }
  599.         else
  600.         {
  601.             $mb_encodings NULL;
  602.         }
  603.  
  604.         ifisset($mb_encodings&& in_arraystrtoupper($io_charset)$mb_encodings ) )
  605.         {
  606.             $Debuglog->add'Cannot I/O convert because I/O charset ['.$io_charset.'] is not in mb_list_encodings()!'array('errors','locale') );
  607.             $evo_charset $io_charset;
  608.         }
  609.         elseifisset($mb_encodings&& in_arraystrtoupper($evo_charset)$mb_encodings ) )
  610.         {
  611.             $Debuglog->add'Cannot I/O convert because $evo_charset='.$evo_charset.' is not in mb_list_encodings()!'array('errors','locale') );
  612.             $evo_charset $io_charset;
  613.         }
  614.         else
  615.         {
  616.             mb_http_output$io_charset );
  617.             ob_start'mb_output_handler' )// NOTE: this will send a Content-Type header by itself for "text/..."
  618.             $mb_output_handler_started true// remember it for _blog_main.inc.php
  619.         }
  620.         unset($mb_encodings);
  621.     }
  622. }
  623.  
  624. // Tell mbstrings what the internal encoding is:
  625. iffunction_exists('mb_internal_encoding') )
  626. {
  627.     mb_internal_encoding$evo_charset );
  628. }
  629.  
  630. ifempty($db_config['connection_charset']) )
  631. // Set encoding for MySQL connection (not overriding explicitely set one):
  632.   $DB->set_connection_charset$evo_charsettrue );
  633. }
  634.  
  635. $Debuglog->add'evo_charset (_main.inc.php): '.$evo_charset'locale' );
  636. $Debuglog->add'io_charset (_main.inc.php): '.$io_charset'locale' );
  637.  
  638.  
  639. /**
  640.  * Load the icons
  641.  *
  642.  * Note: we can't do this earlier because need the users locale set there ({@link T_()})
  643.  */
  644. require_once $conf_path.'_icons.php';
  645.  
  646.  
  647. // Display login errors (and form). This uses $io_charset, so it's at the end.
  648.  
  649. if$Messages->count'login_error' ) )
  650. {
  651.     header_nocache();
  652.  
  653.     require $htsrv_path.'login.php';
  654.     exit();
  655. }
  656.  
  657.  
  658. $Timer->pause'main.inc');
  659.  
  660.  
  661. /**
  662.  * Load hacks file if it exists
  663.  */
  664. iffile_exists($conf_path.'hacks.php') )
  665. {
  666.     $Timer->resume'hacks.php' );
  667.     include_once $conf_path.'hacks.php';
  668.     $Timer->pause'hacks.php' );
  669. }
  670.  
  671.  
  672. /*
  673.  nolog */
  674. ?>

Documentation generated on Tue, 18 Dec 2007 23:18:52 +0100 by phpDocumentor 1.4.0