/** * Get current langcode from session or set the default langcode * Also set current private LangID and currentLanguage * */ private static function _getCurrentLanguage() { $lngCode = self::getGetLngCode(); if (rad_config::getParam('lang.location_show') and !empty($lngCode) and in_array(self::getGetLngCode(), array_keys(self::$allLanguages))) { self::$currentLanguage = self::getGetLngCode(); } elseif (rad_config::getParam('lang.location_show') and !empty($lngCode) and !in_array(self::getGetLngCode(), array_keys(self::$allLanguages))) { /*Page not exists!*/ header(rad_config::getParam('header.404')); self::$currentLanguage = strlen(rad_session::getVar('currlang')) ? rad_session::getVar('currlang') : rad_config::getParam('lang.default'); //rad_input::redirect(rad_input::makeURL('alias='.rad_config::getParam('alias.404'))); } elseif (rad_session::getVar('currlang')) { self::$currentLanguage = rad_session::getVar('currlang'); } else { self::$currentLanguage = rad_config::getParam('lang.default'); } rad_session::setVar('currlang', self::$currentLanguage); if (rad_session::getVar('contentLng')) { self::$maincontentID = (int) rad_session::getVar('contentLng'); } $user = rad_session::$user; if (isset($user->u_id) and $user->u_id) { $paramsobject = rad_session::$user_params; self::$maincontentID = $paramsobject->_get('contentLng', self::$maincontentID); } if (!count(self::$allLanguages)) { throw new rad_exception('Languages in database not found! Please, insert any languages and try again!', 17134); } self::$langID = self::$allLanguages[self::$currentLanguage]->lng_id; self::$cacheLngValues[self::$langID] = array(); }