function setSystemLanguage($sys_language_uid) { if (is_numeric($sys_language_uid)) { if (!is_array($this->defaultLanguageArray)) { mslib_befe::setDefaultSystemLanguage(); } $language_code = mslib_befe::getLanguageIso2ByLanguageUid($sys_language_uid); if ($language_code != '') { $language_code = strtolower($language_code); $this->lang = $language_code; $this->LLkey = $language_code; /* if ($language_code=='en') { // default because otherwise some locallang.xml have a language node default and also en, very annoying if it uses en, since we want it to use the default which must be english $this->LLkey='default'; } */ $this->config['config']['language'] = $language_code; $GLOBALS['TSFE']->config['config']['language'] = $language_code; $GLOBALS['TSFE']->config['config']['sys_language_uid'] = $sys_language_uid; $GLOBALS['TSFE']->sys_language_uid = $sys_language_uid; $this->sys_language_uid = $sys_language_uid; $GLOBALS['TSFE']->sys_language_content = $this->sys_language_uid; $GLOBALS['TSFE']->config['config']['locale_all'] = $this->pi_getLL('locale_all'); setlocale(LC_TIME, $GLOBALS['TSFE']->config['config']['locale_all']); } } }
/** * Init Function: here all the needed configuration values are stored in class variables * @param array $conf : configuration array from TS * @return void */ function construct($conf) { $this->conf = $conf; $this->pi_setPiVarDefaults(); $this->pi_USER_INT_obj = 1; $this->pi_initPIflexForm(); require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.mslib_fe.php'; require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.mslib_befe.php'; $this->HTTP_HOST = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'); // Get the vhost full path (example: /var/www/html/domain.com/public_html/my_cms/) $this->DOCUMENT_ROOT = PATH_site; // Get the vhost full path to multishop (example: /var/www/html/domain.com/public_html/my_cms/typo3conf/ext/multishop/) $this->DOCUMENT_ROOT_MS = PATH_site . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey); // Get the vhost full path to TYPO3 (example: /var/www/html/domain.com/public_html/my_cms/typo3/) $this->DOCUMENT_ROOT_TYPO3 = PATH_site . TYPO3_mainDir; // Get the site full URL (example: http://domain.com/my_cms/) $this->FULL_HTTP_URL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); // Get the multishop full URL (example: http://domain.com/my_cms/typo3/ext/multishop/ or http://domain.com/my_cms/typo3conf/ext/multishop/) $this->FULL_HTTP_URL_MS = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey); // Get the full URL (example: http://domain.com/my_cms/typo3/) $this->FULL_HTTP_URL_TYPO3 = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir; $this->get = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET(); $this->post = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST(); $this->server = array(); $this->server['HTTP_ACCEPT_LANGUAGE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE'); $this->server['HTTP_USER_AGENT'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT'); $this->server['HTTP_REFERER'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_REFERER'); if (!$this->server['HTTP_ACCEPT_LANGUAGE']) { $this->server['HTTP_ACCEPT_LANGUAGE'] = 'en'; } $this->server['DOCUMENT_ROOT'] = $this->DOCUMENT_ROOT; $this->server['REQUEST_URI'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI'); $this->server['REDIRECT_URL'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REDIRECT_URL'); $this->server['QUERY_STRING'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('QUERY_STRING'); if ($_SERVER['HTTP_X_FORWARDED_FOR']) { // For passing through the IP-address of the client, through reverse proxy server $this->REMOTE_ADDR = $_SERVER['HTTP_X_FORWARDED_FOR']; $this->server['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $this->REMOTE_ADDR = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'); $this->server['REMOTE_ADDR'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE_ADDR'); } $this->server['HTTP_HOST'] = mslib_befe::strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY')); $tmp = explode("?", $this->server['REQUEST_URI']); $this->server['REQUEST_URI'] = $tmp[0]; $this->server['REQUEST_URI'] = preg_replace("/^\\//is", '', $this->server['REQUEST_URI']); // load language cookie for the backend $this->cookie = $GLOBALS['TSFE']->fe_user->getKey('ses', 'tx_multishop_cookie'); // if (!isset($this->cookie['multishop_admin_language']) and !isset($this->post['multishop_admin_language'])) $this->post['multishop_admin_language']=''; if (isset($this->post['multishop_admin_language']) and $this->post['multishop_admin_language'] != $this->cookie['multishop_admin_language']) { if ($this->post['multishop_admin_language'] == 'default') { $this->post['multishop_admin_language'] = ''; } $this->cookie['multishop_admin_language'] = $this->post['multishop_admin_language']; $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_multishop_cookie', $this->cookie); $GLOBALS['TSFE']->storeSessionData(); } if ($this->server['HTTP_REFERER'] and !$this->cookie['HTTP_REFERER']) { $host = @parse_url($this->server['HTTP_REFERER']); if (is_array($host) and mslib_befe::strtolower($host['host']) != $this->server['HTTP_HOST']) { $this->cookie['HTTP_REFERER'] = $this->server['HTTP_REFERER']; $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_multishop_cookie', $this->cookie); $GLOBALS['TSFE']->storeSessionData(); } } $this->cookie = $GLOBALS['TSFE']->fe_user->getKey('ses', 'tx_multishop_cookie'); if (strlen($this->cookie['multishop_admin_language']) == 2) { $this->customLang = $this->cookie['multishop_admin_language']; } // able to change language by get parameters if (strlen($this->get['language']) == 2) { $this->customLang = $this->get['language']; } if ($this->customLang) { $this->LLkey = $this->customLang; $this->config['config']['language'] = $this->customLang; $GLOBALS['TSFE']->config['config']['language'] = $this->customLang; $sys_language_uid = mslib_befe::getSysLanguageUidByIsoString($this->customLang); if (!$sys_language_uid) { // try by flag $sys_language_uid = mslib_befe::getSysLanguageUidByFlagString($this->customLang); //echo $sys_language_uid; //die(); } if ($sys_language_uid) { $GLOBALS['TSFE']->config['config']['sys_language_uid'] = $sys_language_uid; $GLOBALS['TSFE']->sys_language_uid = $sys_language_uid; } } if (!$this->LLkey) { $this->LLkey = 'default'; } if (!$GLOBALS['TSFE']->config['config']['locale_all']) { $GLOBALS['TSFE']->config['config']['locale_all'] = $this->pi_getLL('locale_all'); } $this->lang = $GLOBALS['TSFE']->config['config']['language']; setlocale(LC_TIME, $GLOBALS['TSFE']->config['config']['locale_all']); // In TYPO3 7.6.5 suddenly caused buggy calculations, because the dot is returned as a comma. Below line is added to force numeric to be in default system locale. setlocale(LC_NUMERIC, 'en_US.UTF-8'); $this->sys_language_uid = $GLOBALS['TSFE']->config['config']['sys_language_uid']; if (!isset($this->sys_language_uid)) { $this->sys_language_uid = 0; } $this->LOCAL_LANG_loaded = 0; $this->pi_loadLL(); // Preload additional languages $preloadLanguagesArray = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['preloadAdditionalLanguages'])) { $params = array('preloadLanguagesArray' => &$preloadLanguagesArray); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/class.tx_multishop_pi1.php']['preloadAdditionalLanguages'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } if (count($preloadLanguagesArray)) { $tempLLkey = $this->LLkey; foreach ($preloadLanguagesArray as $item) { $this->LLkey = $item; $this->LOCAL_LANG_loaded = 0; $this->pi_loadLL(); } $this->LLkey = $tempLLkey; } mslib_befe::setDefaultSystemLanguage(); // load language cookie for the backend eof // disabled the code so developer can work with config.absRefPrefix too /* if (!$GLOBALS['TSFE']->config['config']['baseURL']) { echo 'config.baseURL='.$this->FULL_HTTP_URL.' is not set yet. Please go to the TYPO3 template setup field editor and add it.'; die(); } */ // setting coming from typoscript or from flexform if ($this->conf['method']) { $this->method = $this->conf['method']; } else { $this->method = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'method', 'sDEFAULT'); } // shop pid $this->shop_pid = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'page_uid', 'sDEFAULT'); if (!$this->shop_pid and $this->conf['shop_pid'] > 0) { $this->shop_pid = $this->conf['shop_pid']; } if (!$this->shop_pid) { $this->shop_pid = $GLOBALS["TSFE"]->id; } // shop pid eof $this->admin_group = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'admin_group', 'sDEFAULT'); // var for the tabbed navigation menu $this->maxDELIMITED = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'maxDELIMITED', 's_listing'); // Autoloader works great in TYPO3 4.7.7. But in TYPO3 4.5.X the invalid namespace classes are not autoloaded so lets load it manually then too // PHP Fatal error: Access to undeclared static property: t3lib_autoloader::$classNameToFileMapping in /shopcvs/skeleton/typo3_src-4.7.5/t3lib/class.t3lib_autoloader.php on line 151 if (!class_exists('Cache_Lite')) { require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'res/Cache_Lite-1.7.16/Cache/Lite.php'; } require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.mslib_payment.php'; require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'pi1/classes/class.tx_mslib_catalog.php'; }