process_locales(); if ($USER_DETAILS['attempt_failed']) { $attemps = bold($USER_DETAILS['attempt_failed']); $attempip = bold($USER_DETAILS['attempt_ip']); $attempdate = bold(zbx_date2str(S_CUSER_ERROR_DATE_FORMAT, $USER_DETAILS['attempt_clock'])); $error_msg = array($attemps, SPACE . S_CUSER_ERROR_FAILED_LOGIN_ATTEMPTS, SPACE . S_CUSER_ERROR_LAST_FAILED_ATTEMPTS . SPACE, $attempip, SPACE . S_ON_SMALL . SPACE, $attempdate); error(new CSpan($error_msg)); } } else { $USER_DETAILS = array('alias' => ZBX_GUEST_USER, 'userid' => 0, 'lang' => 'en_gb', 'type' => '0', 'node' => array('name' => '- unknown -', 'nodeid' => 0)); } include_once 'include/locales/en_gb.inc.php'; process_locales(); set_zbx_locales(); // INIT MB Strings if it's available init_mbstrings(); /* //Require MB strings, otherwise show warning page. if(!isset($show_setup) && !isset($show_warning) && !init_mbstrings()){ $_REQUEST['warning_msg'] = S_ZABBIX.SPACE.ZABBIX_VERSION.SPACE.S_REQUIRE_MB_STRING_MODULE; $show_warning = true; } //*/ // Ajax - do not need warnings or Errors if ((isset($DENY_GUI) || isset($show_setup) || isset($show_warning)) && PAGE_TYPE_HTML != detect_page_type()) { header('Ajax-response: false'); exit; } //--- if (isset($DENY_GUI)) { unset($show_warning);
/** * Initialize translations. */ protected function initLocales() { init_mbstrings(); $defaultLocales = array('C', 'POSIX', 'en', 'en_US', 'en_US.UTF-8', 'English_United States.1252', 'en_GB', 'en_GB.UTF-8'); if (function_exists('bindtextdomain')) { // initializing gettext translations depending on language selected by user $locales = zbx_locale_variants(CWebUser::$data['lang']); $locale_found = false; foreach ($locales as $locale) { // since LC_MESSAGES may be unavailable on some systems, try to set all of the locales // and then revert some of them back putenv('LC_ALL=' . $locale); putenv('LANG=' . $locale); putenv('LANGUAGE=' . $locale); setlocale(LC_TIME, $locale); if (setlocale(LC_ALL, $locale)) { $locale_found = true; CWebUser::$data['locale'] = $locale; break; } } // reset the LC_CTYPE locale so that case transformation functions would work correctly // it is also required for PHP to work with the Turkish locale (https://bugs.php.net/bug.php?id=18556) // WARNING: this must be done before executing any other code, otherwise code execution could fail! // this will be unnecessary in PHP 5.5 setlocale(LC_CTYPE, $defaultLocales); if (!$locale_found && CWebUser::$data['lang'] != 'en_GB' && CWebUser::$data['lang'] != 'en_gb') { error('Locale for language "' . CWebUser::$data['lang'] . '" is not found on the web server. Tried to set: ' . implode(', ', $locales) . '. Unable to translate Zabbix interface.'); } bindtextdomain('frontend', 'locale'); bind_textdomain_codeset('frontend', 'UTF-8'); textdomain('frontend'); } // reset the LC_NUMERIC locale so that PHP would always use a point instead of a comma for decimal numbers setlocale(LC_NUMERIC, $defaultLocales); // should be after locale initialization require_once $this->getRootDir() . '/include/translateDefines.inc.php'; }
/** * Initilaize translations. */ protected function initLocales() { init_mbstrings(); if (function_exists('bindtextdomain')) { // initializing gettext translations depending on language selected by user $locales = zbx_locale_variants(CWebUser::$data['lang']); $locale_found = false; foreach ($locales as $locale) { putenv('LC_ALL=' . $locale); putenv('LANG=' . $locale); putenv('LANGUAGE=' . $locale); if (setlocale(LC_ALL, $locale)) { $locale_found = true; CWebUser::$data['locale'] = $locale; break; } } if (!$locale_found && CWebUser::$data['lang'] != 'en_GB' && CWebUser::$data['lang'] != 'en_gb') { error('Locale for language "' . CWebUser::$data['lang'] . '" is not found on the web server. Tried to set: ' . implode(', ', $locales) . '. Unable to translate Zabbix interface.'); } bindtextdomain('frontend', 'locale'); bind_textdomain_codeset('frontend', 'UTF-8'); textdomain('frontend'); } // should be after locale initialization require_once $this->getRootDir() . '/include/translateDefines.inc.php'; // numeric Locale to default setlocale(LC_NUMERIC, array('C', 'POSIX', 'en', 'en_US', 'en_US.UTF-8', 'English_United States.1252', 'en_GB', 'en_GB.UTF-8')); }