Project

General

Profile

« Previous | Next » 

Revision 33

Added by Manuela almost 7 years ago

initialize.php section 'Get users language' corrected

View differences:

branches/main/admin/interface/version.php
44 44
if (!defined('VERSION_LOADED')) {
45 45
    $sInfo = '
46 46
        VERSION  = "2.11.0-RC1"
47
        REVISION = "32"
47
        REVISION = "33"
48 48
        SP       = ""
49 49
    ';
50 50
    foreach (parse_ini_string($sInfo) as $item=>$value) {
branches/main/framework/initialize.php
425 425
        if (defined('ENABLED_ASP') && ENABLED_ASP && !isset($_SESSION['session_started'])) {
426 426
            $_SESSION['session_started'] = time();
427 427
        }
428
        // Get users language
429
        $sLang = $oRequest->issetParam('lang');
430
        if (
431
            !$sLang ||
432
            !preg_match('/^([a-z]{2})(?:[\-_]([a-z]{2})(?:[\-_]([a-z\-_]{2,8}))?)?$/i', $sLang, $aMatches)
433
        ) {
434
            if (isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
435
                define('LANGUAGE', $_SESSION['LANGUAGE']);
428
// Get users language --------------------------------------------------------------------
429
        $sLang = $oRequest->getParam('lang');
430
        $aMatches = [];
431
        $sPattern = '/^\s*([a-z]{2})(?:[\-_]([a-z]{2})(?:[\-_]([a-z\-_]{2,8}))?)?[\s_\-]*$/i';
432
        if ($sLang && preg_match($sPattern, $sLang, $aMatches)) {
433
            $sLang = strtoupper($aMatches[1]);
434
            define('LANGUAGE', $sLang);
435
            $_SESSION['LANGUAGE'] = $sLang;
436
        } else {
437
            if (isset($_SESSION['LANGUAGE']) && preg_match($sPattern, $_SESSION['LANGUAGE'], $aMatches)) {
438
                define('LANGUAGE', strtoupper($aMatches[1]));
436 439
            } else {
437 440
                define('LANGUAGE', DEFAULT_LANGUAGE);
438 441
            }
439
        } else {
440
            $sLang = strtoupper($aMatches[1]);
441
            define('LANGUAGE', $sLang);
442
            $_SESSION['LANGUAGE'] = $sLang;
443 442
        }
444
        unset($sLang);
445
        // Load Language file(s)
443
        unset($sLang, $sPattern, $aMatches);
444
// Load Language file(s) -----------------------------------------------------------------
446 445
        $sCurrLanguage = '';
447 446
        $slangFile = WB_PATH.'/languages/EN.php';
448 447
        if (is_readable($slangFile)) {

Also available in: Unified diff