Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        framework
5
 * @package         initialize
6
 * @author          WebsiteBaker Project
7
 * @copyright       Ryan Djurovich
8
 * @copyright       WebsiteBaker Org. e.V.
9
 * @link            http://websitebaker.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.3
12
 * @requirements    PHP 5.3.6 and higher
13
 * @version         $Id: initialize.php 22 2017-10-10 13:55:59Z Manuela $
14
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/framework/initialize.php $
15
 * @lastmodified    $Date: 2017-10-10 15:55:59 +0200 (Tue, 10 Oct 2017) $
16
 *
17
 */
18
// $aPhpFunctions = get_defined_functions();
19
/**
20
 * sanitize $_SERVER['HTTP_REFERER']
21
 * @param string $sWbUrl qualified startup URL of current application
22
 */
23
function SanitizeHttpReferer($sWbUrl = WB_URL)
24
{
25
    $sTmpReferer = '';
26
    if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != '') {
27
        define('ORG_REFERER', ($_SERVER['HTTP_REFERER'] ?: ''));
28
        $aRefUrl = parse_url($_SERVER['HTTP_REFERER']);
29
        if ($aRefUrl !== false) {
30
            $aRefUrl['host'] = isset($aRefUrl['host']) ? $aRefUrl['host'] : '';
31
            $aRefUrl['path'] = isset($aRefUrl['path']) ? $aRefUrl['path'] : '';
32
            $aRefUrl['fragment'] = isset($aRefUrl['fragment']) ? '#'.$aRefUrl['fragment'] : '';
33
            $aWbUrl = parse_url(WB_URL);
34
            if ($aWbUrl !== false) {
35
                $aWbUrl['host'] = isset($aWbUrl['host']) ? $aWbUrl['host'] : '';
36
                $aWbUrl['path'] = isset($aWbUrl['path']) ? $aWbUrl['path'] : '';
37
                if (strpos($aRefUrl['host'].$aRefUrl['path'], $aWbUrl['host'].$aWbUrl['path']) !== false) {
38
                    $aRefUrl['path'] = preg_replace('#^'.$aWbUrl['path'].'#i', '', $aRefUrl['path']);
39
                    $sTmpReferer = WB_URL.$aRefUrl['path'].$aRefUrl['fragment'];
40
                }
41
                unset($aWbUrl);
42
            }
43
            unset($aRefUrl);
44
        }
45
    }
46
    $_SERVER['HTTP_REFERER'] = $sTmpReferer;
47
}
48
/**
49
 * makePhExp
50
 * @param array list of names for placeholders
51
 * @return array reformatted list
52
 * @description makes an RegEx-Expression for preg_replace() of each item in $aList
53
 *              Example: from 'TEST_NAME' it mades '/\[TEST_NAME\]/s'
54
 */
55
function makePhExp($sList)
56
{
57
    $aList = func_get_args();
58
//    return preg_replace('/^(.*)$/', '/\[$1\]/s', $aList);
59
    return preg_replace('/^(.*)$/', '[$1]', $aList);
60
}
61

    
62
/**
63
 * Read DB settings from configuration file
64
 * @return array
65
 * @throws RuntimeException
66
 *
67
 */
68
function initReadSetupFile()
69
{
70
// check for valid file request. Becomes more stronger in next version
71
//    initCheckValidCaller(array('save.php','index.php','config.php','upgrade-script.php'));
72
    $aCfg = array();
73
    $sSetupFile = dirname(dirname(__FILE__)).'/setup.ini.php';
74
    if(is_readable($sSetupFile) && !defined('WB_URL')) {
75
        $aCfg = parse_ini_file($sSetupFile, true);
76
        if (!isset($aCfg['Constants']) || !isset($aCfg['DataBase'])) {
77
            throw new InvalidArgumentException('configuration missmatch in setup.ini.php');
78
        }
79
        foreach($aCfg['Constants'] as $key=>$value) {
80
            switch($key):
81
                case 'DEBUG':
82
                    $value = filter_var($value, FILTER_VALIDATE_BOOLEAN);
83
                    if(!defined('DEBUG')) { define('DEBUG', $value); }
84
                    break;
85
                case 'WB_URL': // << case is set deprecated
86
                case 'AppUrl':
87
                    $value = trim(str_replace('\\', '/', $value), '/');
88
                    if(!defined('WB_URL')) { define('WB_URL', $value); }
89
                    break;
90
                case 'ADMIN_DIRECTORY': // << case is set deprecated
91
                case 'AcpDir':
92
                    $value = trim(str_replace('\\', '/', $value), '/');
93
                    if(!defined('ADMIN_DIRECTORY')) { define('ADMIN_DIRECTORY', $value); }
94
                    break;
95
                default:
96
                    if(!defined($key)) { define($key, $value); }
97
                    break;
98
            endswitch;
99
        }
100
    }
101
    return $aCfg;
102
//      throw new RuntimeException('unable to read setup.ini.php');
103
}
104
/**
105
 * Set constants for system/install values
106
 * @throws RuntimeException
107
 */
108
function initSetInstallWbConstants($aCfg)
109
{
110
    if (sizeof($aCfg)) {
111
        foreach($aCfg['Constants'] as $key=>$value) {
112
            switch($key):
113
                case 'DEBUG':
114
                    $value = filter_var($value, FILTER_VALIDATE_BOOLEAN);
115
                    if(!defined('DEBUG')) { define('DEBUG', $value); }
116
                    break;
117
                case 'WB_URL': // << case is set deprecated
118
                case 'AppUrl':
119
                    $value = trim(str_replace('\\', '/', $value), '/');
120
                    if(!defined('WB_URL')) { define('WB_URL', $value); }
121
                    break;
122
                case 'ADMIN_DIRECTORY': // << case is set deprecated
123
                case 'AcpDir':
124
                    $value = trim(str_replace('\\', '/', $value), '/');
125
                    if(!defined('ADMIN_DIRECTORY')) { define('ADMIN_DIRECTORY', $value); }
126
                    if(!preg_match('/xx[a-z0-9_][a-z0-9_\-\.]+/i', 'xx'.ADMIN_DIRECTORY)) {
127
                        throw new RuntimeException('Invalid admin-directory: ' . ADMIN_DIRECTORY);
128
                    }
129
                    break;
130
                default:
131
                    if(!defined($key)) { define($key, $value); }
132
                    break;
133
            endswitch;
134
        }
135
    }
136
    if(!defined('WB_PATH')){ define('WB_PATH', dirname(__DIR__)); }
137
    if(!defined('ADMIN_URL')){ define('ADMIN_URL', rtrim(WB_URL, '/\\').'/'.ADMIN_DIRECTORY); }
138
    if(!defined('ADMIN_PATH')){ define('ADMIN_PATH', WB_PATH.'/'.ADMIN_DIRECTORY); }
139
    if(!defined('WB_REL')){
140
        $x1 = parse_url(WB_URL);
141
        define('WB_REL', (isset($x1['path']) ? $x1['path'] : ''));
142
    }
143
    if(!defined('ADMIN_REL')){ define('ADMIN_REL', WB_REL.'/'.ADMIN_DIRECTORY); }
144
    if(!defined('DOCUMENT_ROOT')) {
145
        define('DOCUMENT_ROOT', preg_replace('/'.preg_quote(str_replace('\\', '/', WB_REL), '/').'$/', '', str_replace('\\', '/', WB_PATH)));
146
        $_SERVER['DOCUMENT_ROOT'] = DOCUMENT_ROOT;
147
    }
148
    if(!defined('TMP_PATH')){ define('TMP_PATH', WB_PATH.'/temp'); }
149

    
150
    if (defined('DB_TYPE'))
151
    {
152
    // import constants for compatibility reasons
153
        $db = array();
154
        if (defined('DB_TYPE'))      { $db['type']         = DB_TYPE; }
155
        if (defined('DB_USERNAME'))  { $db['user']         = DB_USERNAME; }
156
        if (defined('DB_PASSWORD'))  { $db['pass']         = DB_PASSWORD; }
157
        if (defined('DB_HOST'))      { $db['host']         = DB_HOST; }
158
        if (defined('DB_PORT'))      { $db['port']         = DB_PORT; }
159
        if (defined('DB_NAME'))      { $db['name']         = DB_NAME; }
160
        if (defined('DB_CHARSET'))   { $db['charset']      = DB_CHARSET; }
161
        if (defined('TABLE_PREFIX')) { $db['table_prefix'] = TABLE_PREFIX; }
162
    } else {
163
        foreach($aCfg['DataBase'] as $key=>$value) {
164
            switch($key):
165
                case 'type':
166
                    if(!defined('DB_TYPE')) { define('DB_TYPE', $value); }
167
                    break;
168
                case 'user':
169
                    if(!defined('DB_USERNAME')) { define('DB_USERNAME', $value); }
170
                    break;
171
                case 'pass':
172
                    if(!defined('DB_PASSWORD')) { define('DB_PASSWORD', $value); }
173
                    break;
174
                case 'host':
175
                    if(!defined('DB_HOST')) { define('DB_HOST', $value); }
176
                    break;
177
                case 'port':
178
                    if(!defined('DB_PORT')) { define('DB_PORT', $value); }
179
                    break;
180
                case 'name':
181
                    if(!defined('DB_NAME')) { define('DB_NAME', $value); }
182
                    break;
183
                case 'charset':
184
                    if(!defined('DB_CHARSET')) { define('DB_CHARSET', $value); }
185
                    break;
186
                default:
187
                    $key = strtoupper($key);
188
                    if(!defined($key)) { define($key, $value); }
189
                    break;
190
            endswitch;
191
        }
192
    }
193
}
194

    
195
/**
196
 * WbErrorHandler()
197
 *
198
 * @param mixed $iErrorCode
199
 * @param mixed $sErrorText
200
 * @param mixed $sErrorFile
201
 * @param mixed $iErrorLine
202
 * @return
203
 */
204
function WbErrorHandler($iErrorCode, $sErrorText, $sErrorFile, $iErrorLine)
205
{
206
     if (!(error_reporting() & $iErrorCode) || ini_get('log_errors') == 0) {
207
        return false;
208
    }
209
    $bRetval = false;
210
    $sErrorLogFile = ini_get ('error_log');
211
    if (!is_writeable($sErrorLogFile)){return false;}
212
    $sErrorType = E_NOTICE ;
213
    $aErrors = array(
214
        E_USER_DEPRECATED   => 'E_USER_DEPRECATED',
215
        E_USER_NOTICE       => 'E_USER_NOTICE',
216
        E_USER_WARNING      => 'E_USER_WARNING',
217
        E_DEPRECATED        => 'E_DEPRECATED',
218
        E_NOTICE            => 'E_NOTICE',
219
        E_WARNING           => 'E_WARNING',
220
        E_CORE_WARNING      => 'E_CORE_WARNING',
221
        E_COMPILE_WARNING   => 'E_COMPILE_WARNING',
222
        E_STRICT            => 'E_STRICT',
223
        E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
224
    );
225
    if (array_key_exists($iErrorCode, $aErrors)) {
226
        $sErrorType = $aErrors[$iErrorCode];
227
        $bRetval = true;
228
    }
229
    $aBt= debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
230
    $x = sizeof($aBt) -1;
231
    $iSize = $x < 0 ? 0 : ($x <= 2 ? $x : 2);
232
    $sEntry = date('c').' '.'['.$sErrorType.'] '.str_replace(dirname(__DIR__), '', $sErrorFile).':['.$iErrorLine.'] '
233
            . ' from '.str_replace(dirname(__DIR__), '', $aBt[$iSize]['file']).':['.$aBt[$iSize]['line'].'] '
234
            . (isset($aBt[$iSize]['class']) ? $aBt[$iSize]['class'].$aBt[$iSize]['type'] : '').$aBt[$iSize]['function'].' '
235
            . '"'.$sErrorText.'"'.PHP_EOL;
236
    file_put_contents($sErrorLogFile, $sEntry, FILE_APPEND);
237
    return $bRetval;
238
}
239
/**
240
 * create / recreate a admin object
241
 * @param string $section_name (default: '##skip##')
242
 * @param string $section_permission (default: 'start')
243
 * @param bool $auto_header (default: true)
244
 * @param bool $auto_auth (default: true)
245
 * @return \admin
246
 */
247
function newAdmin($section_name= '##skip##', $section_permission = 'start', $auto_header = true, $auto_auth = true)
248
{
249
    if (isset($GLOBALS['admin']) && $GLOBALS['admin'] instanceof admin) {
250
        unset($GLOBALS['admin']);
251
        usleep(10000);
252
    }
253
    return new admin($section_name, $section_permission, $auto_header, $auto_auth);
254
}
255

    
256
/* ***************************************************************************************
257
 * Start initialization                                                                  *
258
 ****************************************************************************************/
259
    // Stop execution if PHP version is too old
260
    // PHP less then 5.6.0 is prohibited ---
261
    if (version_compare(PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION, '5.6.0', '<')) {
262
        $sMsg = '<p style="color: #ff0000;">WebsiteBaker is not able to run with PHP-Version less then 5.6.0!!<br />'
263
              . 'Please change your PHP-Version to any kind from 5.6.0 and up!<br />'
264
              . 'If you have problems to solve that, ask your hosting provider for it.<br  />'
265
              . 'The very best solution is the use of PHP-7.0 and up</p>';
266
        die($sMsg);
267
    }
268
    error_reporting(E_ALL);
269
    $sStarttime = array_sum(explode(" ", microtime()));
270
    if (!defined('MAX_DATETIME')) { define('MAX_DATETIME', ((2**31)-1)); }
271
    /* -------------------------------------------------------- */
272
    if ( !defined('WB_PATH')) { define('WB_PATH', dirname(__DIR__)); }
273
// activate Autoloader
274
    if (!class_exists('\bin\CoreAutoloader')) {
275
        include __DIR__.'/CoreAutoloader.php';
276
    }
277
    \bin\CoreAutoloader::doRegister();
278
    // *** initialize Exception handling
279
    if(!function_exists('globalExceptionHandler')) {
280
        include(__DIR__.'/globalExceptionHandler.php');
281
    }
282
    // *** initialize Error handling
283
    $sErrorLogFile = dirname(__DIR__).'/var/logs/php_error.log.php';
284
    $sErrorLogPath = dirname($sErrorLogFile);
285

    
286
    if (!file_exists($sErrorLogFile)) {
287
        $sTmp = '<?php die(\'illegal file access\'); ?>'
288
              . 'created: ['.date('c').']'.PHP_EOL;
289
        if (false === file_put_contents($sErrorLogFile, $sTmp, FILE_APPEND)) {
290
            throw new Exception('unable to create logfile \'/var/logs/php_error.log.php\'');
291
        }
292
    }
293
    if (!is_writeable($sErrorLogFile)) {
294
        throw new Exception('not writeable logfile \'/var/logs/php_error.log.php\'');
295
    }
296
    ini_set('log_errors', 1);
297
    ini_set ('error_log', $sErrorLogFile);
298

    
299
// activate errorhandler *****************************************************************
300
    set_error_handler('WbErrorHandler', -1 );
301
    defined('SYSTEM_RUN') ? '' : define('SYSTEM_RUN', true);
302
// load configuration ---
303
    $aCfg = initReadSetupFile();
304
    initSetInstallWbConstants($aCfg);
305
// ---------------------------
306
// get Database connection data from configuration
307
    defined('ADMIN_DIRECTORY') ? '' : define('ADMIN_DIRECTORY', 'admin');
308
    if (!preg_match('/xx[a-z0-9_][a-z0-9_\-\.]+/i', 'xx'.ADMIN_DIRECTORY)) {
309
        throw new RuntimeException('Invalid admin-directory: ' . ADMIN_DIRECTORY);
310
    }
311
    defined('ADMIN_URL') ? '' : define('ADMIN_URL', WB_URL.'/'.ADMIN_DIRECTORY);
312
    defined('ADMIN_PATH') ? '' : define('ADMIN_PATH', WB_PATH.'/'.ADMIN_DIRECTORY);
313
    if ( !defined('WB_REL')){
314
        $x1 = parse_url(WB_URL);
315
        define('WB_REL', (isset($x1['path']) ? $x1['path'] : ''));
316
    }
317
    if ( !defined('DOCUMENT_ROOT')) {
318
        define('DOCUMENT_ROOT', preg_replace('/'.preg_quote(str_replace('\\', '/', WB_REL), '/').'$/', '', str_replace('\\', '/', WB_PATH)));
319
        $_SERVER['DOCUMENT_ROOT'] = DOCUMENT_ROOT;
320
    }
321
// add Namespace 'acp' to Autoloader
322
    \bin\CoreAutoloader::addNamespace('acp', ADMIN_DIRECTORY);
323

    
324
    if (class_exists('database')) {
325
        // sanitize $_SERVER['HTTP_REFERER']
326
        SanitizeHttpReferer(WB_URL);
327
        date_default_timezone_set('UTC');
328
        // register TWIG autoloader ---
329
        $sTmp = dirname(dirname(__FILE__)).'/include/Sensio/Twig/lib/Twig/Autoloader.php';
330
        if (!class_exists('Twig_Autoloader') && is_readable($sTmp)){
331
            include $sTmp;
332
            Twig_Autoloader::register();
333
        }
334
    // register PHPMailer autoloader ---
335
        $sTmp = dirname(dirname(__FILE__)).'/include/phpmailer/PHPMailerAutoload.php';
336
        if (!function_exists('PHPMailerAutoload') && is_readable($sTmp)) {
337
            include $sTmp;
338
        }
339
        // Create database class
340
        $database = new database();
341

    
342
        // activate frontend OutputFilterApi (initialize.php)
343
        if (is_readable(WB_PATH .'/modules/output_filter/OutputFilterApi.php')) {
344
            if (!function_exists('OutputFilterApi')) {
345
                include WB_PATH .'/modules/output_filter/OutputFilterApi.php';
346
            }
347
        } else {
348
            throw new RuntimeException('missing mandatory global OutputFilterApi!');
349
        }
350
        // Get website settings (title, keywords, description, header, and footer)
351
        $sql = 'SELECT `name`, `value` FROM `'.TABLE_PREFIX.'settings`';
352
        if (($get_settings = $database->query($sql))) {
353
            $x = 0;
354
            while ($setting = $get_settings->fetchRow(MYSQLI_ASSOC)) {
355
                $setting_name  = strtoupper($setting['name']);
356
                $setting_value = $setting['value'];
357
                if ($setting_value == 'false') {
358
                    $setting_value = false;
359
                }
360
                if ($setting_value == 'true') {
361
                    $setting_value = true;
362
                }
363
                defined($setting_name) ? '' : define($setting_name, $setting_value);
364
                $x++;
365
            }
366
        } else {
367
            die($database->get_error());
368
        }
369
        if (!$x) {
370
            throw new RuntimeException('no settings found');
371
        }
372
        defined('DO_NOT_TRACK') ? '' : define('DO_NOT_TRACK', (isset($_SERVER['HTTP_DNT'])));
373
        ini_set('display_errors', ((defined('DEBUG') && (DEBUG==true)) ?'1':'0'));
374

    
375
        defined('DEBUG') ? '' : define('DEBUG', false);
376
        $string_file_mode = defined('STRING_FILE_MODE') ? STRING_FILE_MODE : '0644';
377
        defined('OCTAL_FILE_MODE') ? '' : define('OCTAL_FILE_MODE', (int) octdec($string_file_mode));
378
        $string_dir_mode = defined('STRING_DIR_MODE') ? STRING_DIR_MODE : '0755';
379
        defined('OCTAL_DIR_MODE')  ? '' : define('OCTAL_DIR_MODE',  (int) octdec($string_dir_mode));
380
    //    $sSecMod = (defined('SECURE_FORM_MODULE') && SECURE_FORM_MODULE != '') ? '.'.SECURE_FORM_MODULE : '';
381
    //    $sSecMod = WB_PATH.'/framework/SecureForm'.$sSecMod.'.php';
382
    //    require_once($sSecMod);
383
        if (!defined('WB_INSTALL_PROCESS')) {
384
        // get CAPTCHA and ASP settings
385
            $sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_captcha_control`';
386
            if (($get_settings = $database->query($sql)) &&
387
                ($setting = $get_settings->fetchRow(MYSQLI_ASSOC))
388
            ) {
389
                defined('ENABLED_CAPTCHA')     ? '' : define('ENABLED_CAPTCHA',     (bool) ($setting['enabled_captcha'] == '1'));
390
                defined('ENABLED_ASP')         ? '' : define('ENABLED_ASP',         (bool) ($setting['enabled_asp'] == '1'));
391
                defined('CAPTCHA_TYPE')        ? '' : define('CAPTCHA_TYPE',        $setting['captcha_type']);
392
                defined('ASP_SESSION_MIN_AGE') ? '' : define('ASP_SESSION_MIN_AGE', (int) $setting['asp_session_min_age']);
393
                defined('ASP_VIEW_MIN_AGE')    ? '' : define('ASP_VIEW_MIN_AGE',    (int) $setting['asp_view_min_age']);
394
                defined('ASP_INPUT_MIN_AGE')   ? '' : define('ASP_INPUT_MIN_AGE',   (int) $setting['asp_input_min_age']);
395
            } else {
396
                throw new RuntimeException('CAPTCHA-Settings not found');
397
            }
398
        }
399

    
400
        // Start a session
401
        if (!defined('SESSION_STARTED')) {
402
            session_name(APP_NAME.'-sid');
403
            @session_start();
404
            define('SESSION_STARTED', true);
405
        }
406
        if (defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started'])) {
407
            $_SESSION['session_started'] = time();
408
        }
409
        // Get users language
410
        if (
411
            isset($_GET['lang']) AND
412
            $_GET['lang'] != '' AND
413
            !is_numeric($_GET['lang']) AND
414
            strlen($_GET['lang']) == 2
415
        ) {
416
            define('LANGUAGE', strtoupper($_GET['lang']));
417
            $_SESSION['LANGUAGE']=LANGUAGE;
418
        } else {
419
            if (isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
420
                define('LANGUAGE', $_SESSION['LANGUAGE']);
421
            } else {
422
                define('LANGUAGE', DEFAULT_LANGUAGE);
423
            }
424
        }
425
        $sCachePath = dirname(__DIR__).'/temp/cache/';
426
        if (!file_exists($sCachePath)) {
427
            if (!mkdir($sCachePath, 0777, true)) { $sCachePath = dirname(__DIR__).'/temp/'; }
428
        }
429
        // Load Language file(s)
430
        $sCurrLanguage = '';
431
        $slangFile = WB_PATH.'/languages/EN.php';
432
        if (is_readable($slangFile)) {
433
            require $slangFile;
434
            $sCurrLanguage ='EN';
435
        }
436
        if ($sCurrLanguage != DEFAULT_LANGUAGE) {
437
            $slangFile = WB_PATH.'/languages/'.DEFAULT_LANGUAGE.'.php';
438
            if (is_readable($slangFile)) {
439
                require $slangFile;
440
                $sCurrLanguage = DEFAULT_LANGUAGE;
441
            }
442
        }
443
        if ($sCurrLanguage != LANGUAGE) {
444
            $slangFile = WB_PATH.'/languages/'.LANGUAGE.'.php';
445
            if (is_readable($slangFile)) {
446
                require $slangFile;
447
            }
448
        }
449
        $oTrans = Translate::getInstance();
450
        $oTrans->initialize(array('EN', DEFAULT_LANGUAGE, LANGUAGE), $sCachePath); // 'none'
451
        // Get users timezone
452
        if (isset($_SESSION['TIMEZONE'])) {
453
            define('TIMEZONE', $_SESSION['TIMEZONE']);
454
        } else {
455
            define('TIMEZONE', DEFAULT_TIMEZONE);
456
        }
457
        // Get users date format
458
        if (isset($_SESSION['DATE_FORMAT'])) {
459
            define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
460
        } else {
461
            define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
462
        }
463
        // Get users time format
464
        if (isset($_SESSION['TIME_FORMAT'])) {
465
            define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
466
        } else {
467
            define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
468
        }
469
        // Set Theme dir
470
        define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
471
        define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
472
        // extended wb_settings
473
        define('EDIT_ONE_SECTION', false);
474
        define('EDITOR_WIDTH', 0);
475
    }
(27-27/28)