<?php
+if (!isset($path_to_root) || 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");
function set_language($code)
{
+ global $comp_path;
+
if (isset($_SESSION['languages'][$code]) &&
$_SESSION['language'] != $_SESSION['languages'][$code])
{
- $_SESSION['language'] = $_SESSION['languages'][$code];
- redirect("");
+
+ // flush cache as we can use several languages in one account
+ flush_dir($comp_path.'/'.user_company().'/js_cache');
+ $_SESSION['language'] = $_SESSION['languages'][$code];
+ reload_page("");
}
}
}
+session_name('FrontAccounting');
session_start();
// this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks
header("Cache-control: private");
get_text::set_language($lang->code, $lang->encoding);
//get_text::add_domain("wa", $path_to_root . "/lang");
get_text::add_domain($lang->code, $path_to_root . "/lang");
+// Unnecessary for ajax calls.
+// Due to bug in php 4.3.10 for this version set globally in php.ini
+ini_set('default_charset', $_SESSION['language']->encoding);
if (!function_exists("_"))
{
get_text::set_var($key,$value);
}
-function redirect($msg)
+function reload_page($msg)
{
// header("Location: $_SERVER['PHP_SELF']."");
// exit;