Seditio Source
Root |
./othercms/b2evolution_7.2.3/inc/_init_base.inc.php
<?php
/**
 * This file initializes everything BUT the blog!
 *
 * It is useful when you want to do very customized templates!
 * It is also called by more complete initializers.
 *
 * This file is part of the evoCore framework - {@link http://evocore.net/}
 * See also {@link https://github.com/b2evolution/b2evolution}.
 *
 * @license GNU GPL v2 - {@link http://b2evolution.net/about/gnu-gpl-license}
 *
 * @copyright (c)2003-2020 by Francois Planque - {@link http://fplanque.com/}
 * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
 * Parts of this file are copyright (c)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}.
 *
 * @package evocore
 */
if( !defined('EVO_CONFIG_LOADED') ) die( 'Please, do not access this page directly.' );

/**
 * @global boolean Are we running on Command Line Interface instead of a web request?
 */
$is_cli = empty($_SERVER['SERVER_SOFTWARE']) ? true : false;
$is_web = ! $is_cli;
// echo ($is_cli ? 'cli' : 'web' );


if( $maintenance_mode )
{
// Maintenance mode with a conf switch
   
header('HTTP/1.0 503 Service Unavailable');
    echo
'<h1>503 Service Unavailable</h1>';
    die(
'The site is temporarily down for maintenance.' );
}
elseif(
file_exists( $conf_path.'imaintenance.html' ) )
{
// Maintenance mode with a file - "imaintenance.html" with an "i" prevents access to the site but NOT to install
   
header('HTTP/1.0 503 Service Unavailable');
   
readfile( $conf_path.'imaintenance.html' );
    die();
}

if( ! empty(
$access_control_allow_origin ) )
{    
// Allow access from origin if it is enabled in config:
   
header( 'Access-Control-Allow-Origin: '.$access_control_allow_origin );
}

/**
 * Absolute Unix timestamp for server
 * @global int $servertimenow
 */
$servertimenow = time();


/**
 * Security check for older PHP versions
 * Contributed by counterpoint / MAMBO team
 */
{
   
$protects = array( '_REQUEST', '_GET', '_POST', '_COOKIE', '_FILES', '_SERVER', '_ENV', 'GLOBALS', '_SESSION' );
    foreach(
$protects as $protect )
    {
        if(  
in_array( $protect, array_keys($_REQUEST) )
            ||
in_array( $protect, array_keys($_GET) )
            ||
in_array( $protect, array_keys($_POST) )
            ||
in_array( $protect, array_keys($_COOKIE) )
            ||
in_array( $protect, array_keys($_FILES) ) )
        {
            require_once
$inc_path.'/_core/_misc.funcs.php';
           
bad_request_die( 'Unacceptable params.' );
        }
    }
}

/**
 * Request/Transaction name, used for performance monitoring.
 */
$request_transaction_name = '';


if( !
$config_is_done )
{
// base config is not done!
   
$error_title = 'Base configuration is not done!';
   
$error_message = 'Base configuration is not done! (see /conf/_basic_config.php)';
}
elseif( !isset(
$locales[$default_locale] ) )
{
   
$error_title = 'The default locale does not exist!';
   
$error_message = 'The default locale '.var_export( $default_locale, true ).' does not exist! (see /conf/_locales.php)';
}
if( isset(
$error_message ) )
{
// error & exit
   
require dirname(__FILE__).'/../skins_adm/conf_error.main.php';
}


/**
 * Class loader.
 */
require_once $inc_path.'_core/_class_loader.funcs.php';


/**
 * Locale related functions
 */
require_once $inc_path.'locales/_locale.funcs.php';


/**
 * Miscellaneous functions
 */
require_once $inc_path.'_core/_misc.funcs.php';


/**
 * Parameter handling functions
 */
load_funcs( '_core/_param.funcs.php' );


/**
 * Debug message log for debugging only (initialized here).
 *
 * @global Log|Log_noop $Debuglog
 */
if( $debug )
{
   
load_class( '_core/model/_log.class.php', 'Log' );
   
$Debuglog = new Log();
}
else
{
   
load_class( '_core/model/_log.class.php', 'Log_noop' );
   
$Debuglog = new Log_noop();
}


/**
 * System log
 */
load_class( 'tools/model/_syslog.class.php', 'Syslog' );


/**
 * Info & error message log for end user (initialized here)
 * @global Log $Messages
 */
load_class( '_core/model/_messages.class.php', 'Messages' );
$Messages = new Messages();


/*
 * Start timer:
 */
load_class( '_core/model/_timer.class.php', 'Timer' );
$Timer = new Timer('total');
$Timer->resume( '_init_base' );
$Timer->resume( 'first_flush' );
$Timer->resume( '_MAIN.inc' );



// the weekdays and the months..
$weekday[0] = NT_('Sunday');
$weekday[1] = NT_('Monday');
$weekday[2] = NT_('Tuesday');
$weekday[3] = NT_('Wednesday');
$weekday[4] = NT_('Thursday');
$weekday[5] = NT_('Friday');
$weekday[6] = NT_('Saturday');

// the weekdays short form (typically 3 letters)
// TRANS: abbrev. for Sunday
$weekday_abbrev[0] = NT_('Sun');
// TRANS: abbrev. for Monday
$weekday_abbrev[1] = NT_('Mon');
// TRANS: abbrev. for Tuesday
$weekday_abbrev[2] = NT_('Tue');
// TRANS: abbrev. for Wednesday
$weekday_abbrev[3] = NT_('Wed');
// TRANS: abbrev. for Thursday
$weekday_abbrev[4] = NT_('Thu');
// TRANS: abbrev. for Friday
$weekday_abbrev[5] = NT_('Fri');
// TRANS: abbrev. for Saturday
$weekday_abbrev[6] = NT_('Sat');

// the weekdays even shorter form (typically 1 letter)
// TRANS: abbrev. for Sunday
$weekday_letter[0] = NT_(' S ');
// TRANS: abbrev. for Monday
$weekday_letter[1] = NT_(' M ');
// TRANS: abbrev. for Tuesday
$weekday_letter[2] = NT_(' T ');
// TRANS: abbrev. for Wednesday
$weekday_letter[3] = NT_(' W ');
// TRANS: abbrev. for Thursday
$weekday_letter[4] = NT_(' T  ');
// TRANS: abbrev. for Friday
$weekday_letter[5] = NT_(' F ');
// TRANS: abbrev. for Saturday
$weekday_letter[6] = NT_(' S  ');

// the months
$month['00'] = '\?\?';    // This can happen when importing junk dates from WordPress
$month['01'] = NT_('January');
$month['02'] = NT_('February');
$month['03'] = NT_('March');
$month['04'] = NT_('April');
// TRANS: space at the end only to differentiate from short form. You don't need to keep it in the translation.
$month['05'] = NT_('May ');
$month['06'] = NT_('June');
$month['07'] = NT_('July');
$month['08'] = NT_('August');
$month['09'] = NT_('September');
$month['10'] = NT_('October');
$month['11'] = NT_('November');
$month['12'] = NT_('December');

// the months short form (typically 3 letters)
// TRANS: abbrev. for January
$month_abbrev['01'] = NT_('Jan');
// TRANS: abbrev. for February
$month_abbrev['02'] = NT_('Feb');
// TRANS: abbrev. for March
$month_abbrev['03'] = NT_('Mar');
// TRANS: abbrev. for April
$month_abbrev['04'] = NT_('Apr');
// TRANS: abbrev. for May
$month_abbrev['05'] = NT_('May');
// TRANS: abbrev. for June
$month_abbrev['06'] = NT_('Jun');
// TRANS: abbrev. for July
$month_abbrev['07'] = NT_('Jul');
// TRANS: abbrev. for August
$month_abbrev['08'] = NT_('Aug');
// TRANS: abbrev. for September
$month_abbrev['09'] = NT_('Sep');
// TRANS: abbrev. for October
$month_abbrev['10'] = NT_('Oct');
// TRANS: abbrev. for November
$month_abbrev['11'] = NT_('Nov');
// TRANS: abbrev. for December
$month_abbrev['12'] = NT_('Dec');


/**
 * Load modules.
 *
 * This initializes table name aliases and is required before trying to connect to the DB.
 */
load_class( '_core/model/_module.class.php', 'Module' );
foreach(
$modules as $module )
{
    require_once
$inc_path.$module.'/_'.$module.'.init.php';
}

$Timer->pause( '_init_base' );

?>