X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Flang%2Flanguage.php;h=0727222cd09a6338c3ea56ec0c82977815a0bea3;hb=8864b1ec0fd3321e510511ef22614bc36845540e;hp=62866f0b0279564036e144e42a07576351652d18;hpb=e3b48984f41047ad16201ff1e757af02d228d79e;p=fa-stable.git diff --git a/includes/lang/language.php b/includes/lang/language.php index 62866f0b..0727222c 100644 --- a/includes/lang/language.php +++ b/includes/lang/language.php @@ -9,8 +9,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_to_root'])) - die(_("Restricted access")); +// Prevent register_globals vulnerability +if (isset($_GET['path_to_root']) || isset($_POST['path_to_root'])) + die("Restricted access"); include_once($path_to_root . "/lang/installed_languages.inc"); include_once($path_to_root . "/includes/lang/gettext.php"); @@ -36,7 +37,6 @@ class language return "lang/" . $this->code; } - function get_current_language_dir() { $lang = $_SESSION['language']; @@ -46,9 +46,9 @@ class language function set_language($code) { global $comp_path, $path_to_root; - - if (isset($_SESSION['languages'][$code]) && - $_SESSION['language'] != $_SESSION['languages'][$code]) + + $changed = $_SESSION['language']->code != $code; + if (isset($_SESSION['languages'][$code]) && $changed) { // flush cache as we can use several languages in one account flush_dir($comp_path.'/'.user_company().'/js_cache'); @@ -57,6 +57,17 @@ class language // check id file exists only once for session $_SESSION['language']->is_locale_file = file_exists($locale); } + + $lang = $_SESSION['language']; + get_text::set_language($lang->code, $lang->encoding); + get_text::add_domain($lang->code, $path_to_root . "/lang"); + + // Necessary for ajax calls. Due to bug in php 4.3.10 for this + // version set globally in php.ini + ini_set('default_charset', $lang->encoding); + + if (isset($_SESSION['App']) && $changed) + $_SESSION['App']->init(); // refresh menu } /** @@ -106,26 +117,6 @@ function _set($key,$value) get_text::set_var($key,$value); } -function reload_page($msg) -{ - global $Ajax; -// header("Location: $_SERVER['PHP_SELF'].""); -// exit; - echo ""; - echo ""; - echo "Changing Languages"; - echo ''; - echo ''; - echo ''; - echo '
'; - if ($msg != "") - echo $msg . " " . $_SERVER['PHP_SELF']; - echo "
"; - echo ""; - echo ""; - $Ajax->redirect($_SERVER['PHP_SELF']); -} - if (!function_exists("_")) { function _($text)