Project

General

Profile

« Previous | Next » 

Revision 2124

Added by darkviper over 9 years ago

! /framework/initialize +
! /framework/WbAutoloader abbreviation list moved to initialize; added method getAbbreviations()

View differences:

initialize.php
114 114
 * Read DB settings from configuration file
115 115
 * @return array
116 116
 * @throws RuntimeException
117
 * 
117
 *
118 118
 */
119 119
    function initReadSetupFile()
120 120
    {
......
122 122
        initCheckValidCaller(array('save.php','index.php','config.php','upgrade-script.php'));
123 123
        $aCfg = array();
124 124

  
125
        $sSetupFile = dirname(dirname(__FILE__)).'/setup.ini.php';
125
        $sSetupFile = dirname(__DIR__).'/setup.ini.php';
126 126
        if(is_readable($sSetupFile)) {
127 127
            $aCfg = parse_ini_file($sSetupFile, true);
128 128
            if (!isset($aCfg['Constants']) || !isset($aCfg['DataBase'])) {
......
218 218
/* ***************************************************************************************
219 219
 * Start initialization                                                                  *
220 220
 ****************************************************************************************/
221
// reset global output buffering
222
    while (ob_get_level()) { ob_end_clean(); }
221 223
// test for existing and active old config.php
222 224
    if (defined('TABLE_PREFIX')) { /** TODO */ }
223
// initialize debug evaluation values ---	
225
// set system defaults
226
    date_default_timezone_set('UTC');
227

  
228
// initialize debug evaluation values ---
224 229
    $starttime = array_sum(explode(" ",microtime()));
225 230
    $iPhpDeclaredClasses = sizeof(get_declared_classes());
226 231
    $sDbConnectType = 'url'; // depending from class WbDatabase it can be 'url' or 'dsn'
......
241 246
    initSetInstallPathConstants();
242 247
    initSanitizeHttpReferer(WB_URL);
243 248
// register WB basic autoloader ---
244
    $sTmp = dirname(__FILE__).'/WbAutoloader.php';
249
    $sTmp = __DIR__.'/WbAutoloader.php';
245 250
    if(!class_exists('WbAutoloader')){
246 251
        include($sTmp);
247 252
    }
248
    WbAutoloader::doRegister(array(ADMIN_DIRECTORY=>'a', 'modules'=>'m', 'templates'=>'t', 'include'=>'i'));
253
    WbAutoloader::doRegister( array(
254
        'a' => trim(str_replace('\\', '/',ADMIN_DIRECTORY), '/'),
255
        'm' => 'modules',
256
        't' => 'templates',
257
        'i' => 'include',
258
        'v' => 'vendor'
259
    ));
260
//    WbAutoloader::doRegister(array(ADMIN_DIRECTORY=>'a', 'modules'=>'m', 'templates'=>'t', 'include'=>'i'));
249 261
// instantiate and initialize adaptor for temporary registry replacement ---
250 262
    $oReg = WbAdaptor::getInstance();
251 263
    $oReg->getWbConstants();
252 264
// register TWIG autoloader ---
253
    $sTmp = dirname(dirname(__FILE__)).'/include/Sensio/Twig/lib/Twig/Autoloader.php';
265
    $sTmp = dirname(__DIR__).'/include/Sensio/Twig/lib/Twig/Autoloader.php';
254 266
    if(!class_exists('Twig_Autoloader') && is_readable($sTmp)) {
255 267
        include($sTmp);
256
    	Twig_Autoloader::register();
268
        Twig_Autoloader::register();
257 269
    }
258 270
// register PHPMailer autoloader ---
259
    $sTmp = $oReg->AppPath.'include/phpmailer/PHPMailerAutoload.php';
271
    $sTmp = dirname(__DIR__).'include/phpmailer/PHPMailerAutoload.php';
260 272
    if (!function_exists('PHPMailerAutoload') && is_readable($sTmp)) {
261 273
        require($sTmp);
262 274
    }
263 275
// aktivate exceptionhandler ---
264 276
    if(!function_exists('globalExceptionHandler')) {
265
        include(dirname(__FILE__).'/globalExceptionHandler.php');
277
        include(__DIR__.'/globalExceptionHandler.php');
266 278
    }
267 279
// ---------------------------
268 280
// get Database connection data from configuration
......
334 346
    }
335 347
// get/set server timezone ---
336 348
    if(!defined('SERVER_TIMEZONE')) { define('SERVER_TIMEZONE', "UTC"); }
337
    date_default_timezone_set( SERVER_TIMEZONE );
338 349
    if(!defined('MAX_TIME')) { define('MAX_TIME', (pow(2, 31)-1)); } // 32-Bit Timestamp of 19 Jan 2038 03:14:07 GMT
339 350
    $sTmp = (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] != '') ? $_SERVER['HTTP_DNT'] : '0';
340 351
    if(!defined('DO_NOT_TRACK')) { define('DO_NOT_TRACK', ($sTmp[0] == '1')); }
......
342 353
    if(!defined('TIMEZONE')) { define('TIMEZONE', (isset($_SESSION['TIMEZONE']) ? $_SESSION['TIMEZONE'] : DEFAULT_TIMEZONE)); }
343 354
    if(!defined('DATE_FORMAT')) { define('DATE_FORMAT', (isset($_SESSION['DATE_FORMAT']) ? $_SESSION['DATE_FORMAT'] : DEFAULT_DATE_FORMAT)); }
344 355
    if(!defined('TIME_FORMAT')) { define('TIME_FORMAT', (isset($_SESSION['TIME_FORMAT']) ? $_SESSION['TIME_FORMAT'] : DEFAULT_TIME_FORMAT)); }
345
// set Theme directory --- 
356
// set Theme directory ---
346 357
    if(!defined('THEME_URL')) { define('THEME_URL',  WB_URL.'/templates/'.DEFAULT_THEME); }
347 358
    if(!defined('THEME_PATH')) { define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME); }
348 359
    if(!defined('THEME_REL')) { define('THEME_REL',  WB_REL.'/templates/'.DEFAULT_THEME); }
......
394 405
    }
395 406
    $_SESSION['LANGUAGE'] = LANGUAGE;
396 407
// activate translations / load language definitions
397
/** begin of deprecated part || will be replaced by class Translate **/	
408
/** begin of deprecated part || will be replaced by class Translate **/
398 409
// Load Language file
399 410
    if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
400 411
        $sMsg = 'Error loading language file '.LANGUAGE.', please check configuration';
......
408 419
    $oReg->getWbConstants();
409 420
// load and activate new global translation table
410 421
    $oTrans = Translate::getInstance();
411
/* initializise Translate old style */
422
/* initializise Translate old style *************************************************** */
412 423
    $oTrans->initialize(
413 424
        'en',
414 425
        (defined('DEFAULT_LANGUAGE') ? DEFAULT_LANGUAGE : ''),
......
417 428
//        (Translate::CACHE_DISABLED|Translate::KEEP_MISSING),
418 429
        (DEBUG ? Translate::CACHE_DISABLED|Translate::KEEP_MISSING : 0)
419 430
    );
420
/* initializise Translate new style */
431
/* initializise Translate new style *************************************************** */
421 432
/*
422 433
    $oTrans->initialize(
423 434
        new TranslateAdaptorWbOldStyle,

Also available in: Unified diff