426 |
426 |
$_SESSION['session_started'] = time();
|
427 |
427 |
}
|
428 |
428 |
// Get users language
|
|
429 |
$sLang = $oRequest->issetParam('lang');
|
429 |
430 |
if (
|
430 |
|
($sLang = $oRequest->issetParam('lang')) == null ||
|
|
431 |
!$sLang ||
|
431 |
432 |
!preg_match('/^([a-z]{2})(?:[\-_]([a-z]{2})(?:[\-_]([a-z\-_]{2,8}))?)?$/i', $sLang, $aMatches)
|
432 |
433 |
) {
|
433 |
434 |
if (isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
|
... | ... | |
437 |
438 |
}
|
438 |
439 |
} else {
|
439 |
440 |
$sLang = strtoupper($aMatches[1]);
|
440 |
|
define('LANGUAGE', $slang);
|
|
441 |
define('LANGUAGE', $sLang);
|
441 |
442 |
$_SESSION['LANGUAGE'] = $sLang;
|
442 |
|
// // strtoupper() is deprecated and for backward compatibility only!
|
443 |
|
// $sLang = strtoupper($oRequest->getParam('lang', FILTER_CALLBACK, [
|
444 |
|
// new \bin\requester\filter\CoreFilters(['default'=>'en', 'seperator'=>'-']),
|
445 |
|
// 'FILTER_LANGUAGE_CODE'
|
446 |
|
// ]));
|
447 |
|
// define('LANGUAGE', $slang);
|
448 |
|
// $_SESSION['LANGUAGE'] = $sLang;
|
449 |
443 |
}
|
450 |
|
$sCachePath = dirname(__DIR__).'/temp/cache/';
|
451 |
|
if (!file_exists($sCachePath)) {
|
452 |
|
if (!mkdir($sCachePath, 0777, true)) { $sCachePath = dirname(__DIR__).'/temp/'; }
|
453 |
|
}
|
|
444 |
unset($sLang);
|
454 |
445 |
// Load Language file(s)
|
455 |
446 |
$sCurrLanguage = '';
|
456 |
447 |
$slangFile = WB_PATH.'/languages/EN.php';
|
... | ... | |
471 |
462 |
require $slangFile;
|
472 |
463 |
}
|
473 |
464 |
}
|
474 |
|
// activate Translate --------------------------------------------------------------------
|
475 |
|
$oTrans = Translate::getInstance();
|
476 |
|
$oTrans->initialize(array('EN', DEFAULT_LANGUAGE, LANGUAGE), $sCachePath); // 'none'
|
477 |
465 |
// activate SecureTokens -----------------------------------------------------------------
|
478 |
466 |
$oApp = (object) [
|
479 |
467 |
'oRequester' => $oRequest,
|
... | ... | |
486 |
474 |
];
|
487 |
475 |
\bin\SecureTokens::getInstance($oApp);
|
488 |
476 |
\bin\SecureTokens::checkFTAN();
|
|
477 |
// activate Translate --------------------------------------------------------------------
|
|
478 |
$sCachePath = dirname(__DIR__).'/temp/cache/';
|
|
479 |
if (!file_exists($sCachePath)) {
|
|
480 |
if (!mkdir($sCachePath, 0777, true)) { $sCachePath = dirname(__DIR__).'/temp/'; }
|
|
481 |
}
|
|
482 |
$oTrans = Translate::getInstance();
|
|
483 |
$oTrans->initialize(array('EN', DEFAULT_LANGUAGE, LANGUAGE), $sCachePath); // 'none'
|
489 |
484 |
// ---------------------------------------------------------------------------------------
|
490 |
485 |
// Get users timezone
|
491 |
486 |
if (isset($_SESSION['TIMEZONE'])) {
|
little typo fix in initialize.php