267 |
267 |
}
|
268 |
268 |
error_reporting(E_ALL);
|
269 |
269 |
$sStarttime = array_sum(explode(" ", microtime()));
|
|
270 |
if (!defined('MAX_DATETIME')) { define('MAX_DATETIME', ((2**31)-1)); }
|
270 |
271 |
/* -------------------------------------------------------- */
|
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();
|
272 |
278 |
// *** initialize Exception handling
|
273 |
279 |
if(!function_exists('globalExceptionHandler')) {
|
274 |
280 |
include(__DIR__.'/globalExceptionHandler.php');
|
... | ... | |
312 |
318 |
define('DOCUMENT_ROOT', preg_replace('/'.preg_quote(str_replace('\\', '/', WB_REL), '/').'$/', '', str_replace('\\', '/', WB_PATH)));
|
313 |
319 |
$_SERVER['DOCUMENT_ROOT'] = DOCUMENT_ROOT;
|
314 |
320 |
}
|
315 |
|
// activate Autoloader
|
316 |
|
if (!class_exists('\bin\CoreAutoloader')) {
|
317 |
|
include __DIR__.'/CoreAutoloader.php';
|
318 |
|
}
|
319 |
|
\bin\CoreAutoloader::doRegister(['acp' => ADMIN_DIRECTORY]);
|
|
321 |
// add Namespace 'acp' to Autoloader
|
|
322 |
\bin\CoreAutoloader::addNamespace('acp', ADMIN_DIRECTORY);
|
320 |
323 |
|
321 |
|
if (class_exists('database')) {
|
322 |
|
// sanitize $_SERVER['HTTP_REFERER']
|
323 |
|
SanitizeHttpReferer(WB_URL);
|
324 |
|
date_default_timezone_set('UTC');
|
325 |
|
// register TWIG autoloader ---
|
326 |
|
$sTmp = dirname(dirname(__FILE__)).'/include/Sensio/Twig/lib/Twig/Autoloader.php';
|
327 |
|
if (!class_exists('Twig_Autoloader') && is_readable($sTmp)){
|
328 |
|
include $sTmp;
|
329 |
|
Twig_Autoloader::register();
|
330 |
|
}
|
331 |
|
// register PHPMailer autoloader ---
|
332 |
|
$sTmp = dirname(dirname(__FILE__)).'/include/phpmailer/PHPMailerAutoload.php';
|
333 |
|
if (!function_exists('PHPMailerAutoload') && is_readable($sTmp)) {
|
334 |
|
include $sTmp;
|
335 |
|
}
|
336 |
|
// Create database class
|
337 |
|
$database = new database();
|
|
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();
|
338 |
341 |
|
339 |
|
// activate frontend OutputFilterApi (initialize.php)
|
340 |
|
if (is_readable(WB_PATH .'/modules/output_filter/OutputFilterApi.php')) {
|
341 |
|
if (!function_exists('OutputFilterApi')) {
|
342 |
|
include WB_PATH .'/modules/output_filter/OutputFilterApi.php';
|
|
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!');
|
343 |
349 |
}
|
344 |
|
} else {
|
345 |
|
throw new RuntimeException('missing mandatory global OutputFilterApi!');
|
346 |
|
}
|
347 |
|
// Get website settings (title, keywords, description, header, and footer)
|
348 |
|
$sql = 'SELECT `name`, `value` FROM `'.TABLE_PREFIX.'settings`';
|
349 |
|
if (($get_settings = $database->query($sql))) {
|
350 |
|
$x = 0;
|
351 |
|
while ($setting = $get_settings->fetchRow(MYSQLI_ASSOC)) {
|
352 |
|
$setting_name = strtoupper($setting['name']);
|
353 |
|
$setting_value = $setting['value'];
|
354 |
|
if ($setting_value == 'false') {
|
355 |
|
$setting_value = false;
|
|
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++;
|
356 |
365 |
}
|
357 |
|
if ($setting_value == 'true') {
|
358 |
|
$setting_value = true;
|
|
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');
|
359 |
397 |
}
|
360 |
|
defined($setting_name) ? '' : define($setting_name, $setting_value);
|
361 |
|
$x++;
|
362 |
398 |
}
|
363 |
|
} else {
|
364 |
|
die($database->get_error());
|
365 |
|
}
|
366 |
|
if (!$x) {
|
367 |
|
throw new RuntimeException('no settings found');
|
368 |
|
}
|
369 |
|
defined('DO_NOT_TRACK') ? '' : define('DO_NOT_TRACK', (isset($_SERVER['HTTP_DNT'])));
|
370 |
|
ini_set('display_errors', ((defined('DEBUG') && (DEBUG==true)) ?'1':'0'));
|
371 |
399 |
|
372 |
|
defined('DEBUG') ? '' : define('DEBUG', false);
|
373 |
|
$string_file_mode = defined('STRING_FILE_MODE') ? STRING_FILE_MODE : '0644';
|
374 |
|
defined('OCTAL_FILE_MODE') ? '' : define('OCTAL_FILE_MODE', (int) octdec($string_file_mode));
|
375 |
|
$string_dir_mode = defined('STRING_DIR_MODE') ? STRING_DIR_MODE : '0755';
|
376 |
|
defined('OCTAL_DIR_MODE') ? '' : define('OCTAL_DIR_MODE', (int) octdec($string_dir_mode));
|
377 |
|
// $sSecMod = (defined('SECURE_FORM_MODULE') && SECURE_FORM_MODULE != '') ? '.'.SECURE_FORM_MODULE : '';
|
378 |
|
// $sSecMod = WB_PATH.'/framework/SecureForm'.$sSecMod.'.php';
|
379 |
|
// require_once($sSecMod);
|
380 |
|
if (!defined('WB_INSTALL_PROCESS')) {
|
381 |
|
// get CAPTCHA and ASP settings
|
382 |
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_captcha_control`';
|
383 |
|
if (($get_settings = $database->query($sql)) &&
|
384 |
|
($setting = $get_settings->fetchRow(MYSQLI_ASSOC))
|
|
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
|
385 |
415 |
) {
|
386 |
|
defined('ENABLED_CAPTCHA') ? '' : define('ENABLED_CAPTCHA', (bool) ($setting['enabled_captcha'] == '1'));
|
387 |
|
defined('ENABLED_ASP') ? '' : define('ENABLED_ASP', (bool) ($setting['enabled_asp'] == '1'));
|
388 |
|
defined('CAPTCHA_TYPE') ? '' : define('CAPTCHA_TYPE', $setting['captcha_type']);
|
389 |
|
defined('ASP_SESSION_MIN_AGE') ? '' : define('ASP_SESSION_MIN_AGE', (int) $setting['asp_session_min_age']);
|
390 |
|
defined('ASP_VIEW_MIN_AGE') ? '' : define('ASP_VIEW_MIN_AGE', (int) $setting['asp_view_min_age']);
|
391 |
|
defined('ASP_INPUT_MIN_AGE') ? '' : define('ASP_INPUT_MIN_AGE', (int) $setting['asp_input_min_age']);
|
|
416 |
define('LANGUAGE', strtoupper($_GET['lang']));
|
|
417 |
$_SESSION['LANGUAGE']=LANGUAGE;
|
392 |
418 |
} else {
|
393 |
|
throw new RuntimeException('CAPTCHA-Settings not found');
|
|
419 |
if (isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
|
|
420 |
define('LANGUAGE', $_SESSION['LANGUAGE']);
|
|
421 |
} else {
|
|
422 |
define('LANGUAGE', DEFAULT_LANGUAGE);
|
|
423 |
}
|
394 |
424 |
}
|
395 |
|
}
|
396 |
|
|
397 |
|
// Start a session
|
398 |
|
if (!defined('SESSION_STARTED')) {
|
399 |
|
session_name(APP_NAME.'-sid');
|
400 |
|
@session_start();
|
401 |
|
define('SESSION_STARTED', true);
|
402 |
|
}
|
403 |
|
if (defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started'])) {
|
404 |
|
$_SESSION['session_started'] = time();
|
405 |
|
}
|
406 |
|
// Get users language
|
407 |
|
if (
|
408 |
|
isset($_GET['lang']) AND
|
409 |
|
$_GET['lang'] != '' AND
|
410 |
|
!is_numeric($_GET['lang']) AND
|
411 |
|
strlen($_GET['lang']) == 2
|
412 |
|
) {
|
413 |
|
define('LANGUAGE', strtoupper($_GET['lang']));
|
414 |
|
$_SESSION['LANGUAGE']=LANGUAGE;
|
415 |
|
} else {
|
416 |
|
if (isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
|
417 |
|
define('LANGUAGE', $_SESSION['LANGUAGE']);
|
418 |
|
} else {
|
419 |
|
define('LANGUAGE', DEFAULT_LANGUAGE);
|
|
425 |
$sCachePath = dirname(__DIR__).'/temp/cache/';
|
|
426 |
if (!file_exists($sCachePath)) {
|
|
427 |
if (!mkdir($sCachePath, 0777, true)) { $sCachePath = dirname(__DIR__).'/temp/'; }
|
420 |
428 |
}
|
421 |
|
}
|
422 |
|
$sCachePath = dirname(__DIR__).'/temp/cache/';
|
423 |
|
if (!file_exists($sCachePath)) {
|
424 |
|
if (!mkdir($sCachePath, 0777, true)) { $sCachePath = dirname(__DIR__).'/temp/'; }
|
425 |
|
}
|
426 |
|
// Load Language file(s)
|
427 |
|
$sCurrLanguage = '';
|
428 |
|
$slangFile = WB_PATH.'/languages/EN.php';
|
429 |
|
if (is_readable($slangFile)) {
|
430 |
|
require $slangFile;
|
431 |
|
$sCurrLanguage ='EN';
|
432 |
|
}
|
433 |
|
if ($sCurrLanguage != DEFAULT_LANGUAGE) {
|
434 |
|
$slangFile = WB_PATH.'/languages/'.DEFAULT_LANGUAGE.'.php';
|
|
429 |
// Load Language file(s)
|
|
430 |
$sCurrLanguage = '';
|
|
431 |
$slangFile = WB_PATH.'/languages/EN.php';
|
435 |
432 |
if (is_readable($slangFile)) {
|
436 |
433 |
require $slangFile;
|
437 |
|
$sCurrLanguage = DEFAULT_LANGUAGE;
|
|
434 |
$sCurrLanguage ='EN';
|
438 |
435 |
}
|
439 |
|
}
|
440 |
|
if ($sCurrLanguage != LANGUAGE) {
|
441 |
|
$slangFile = WB_PATH.'/languages/'.LANGUAGE.'.php';
|
442 |
|
if (is_readable($slangFile)) {
|
443 |
|
require $slangFile;
|
|
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 |
}
|
444 |
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);
|
445 |
475 |
}
|
446 |
|
$oTrans = Translate::getInstance();
|
447 |
|
$oTrans->initialize(array('EN', DEFAULT_LANGUAGE, LANGUAGE), $sCachePath); // 'none'
|
448 |
|
// Get users timezone
|
449 |
|
if (isset($_SESSION['TIMEZONE'])) {
|
450 |
|
define('TIMEZONE', $_SESSION['TIMEZONE']);
|
451 |
|
} else {
|
452 |
|
define('TIMEZONE', DEFAULT_TIMEZONE);
|
453 |
|
}
|
454 |
|
// Get users date format
|
455 |
|
if (isset($_SESSION['DATE_FORMAT'])) {
|
456 |
|
define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
|
457 |
|
} else {
|
458 |
|
define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
|
459 |
|
}
|
460 |
|
// Get users time format
|
461 |
|
if (isset($_SESSION['TIME_FORMAT'])) {
|
462 |
|
define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
|
463 |
|
} else {
|
464 |
|
define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
|
465 |
|
}
|
466 |
|
// Set Theme dir
|
467 |
|
define('THEME_URL', WB_URL.'/templates/'.DEFAULT_THEME);
|
468 |
|
define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);
|
469 |
|
// extended wb_settings
|
470 |
|
define('EDIT_ONE_SECTION', false);
|
471 |
|
define('EDITOR_WIDTH', 0);
|
472 |
|
}
|
initialize.php:: activation of CoreAutoloader modified.