MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
-set_global_connection();
function set_global_connection()
{
}
elseif (!isset($support_obj))
{
- trigger_error("get_text not initialized !". endl.
+ trigger_error("get_text not initialized !". '\n'.
"Please call get_text::init() before calling ".
- "any get_text function !" . endl , E_USER_ERROR);
+ "any get_text function !" . '\n' , E_USER_ERROR);
}
return $support_obj;
}
}
function raise_error($str) {
- //echo "$str";
+// echo "$str";
return 1;
}
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
-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");
return "lang/" . $this->code;
}
-
function get_current_language_dir()
{
$lang = $_SESSION['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');
// 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
}
/**
get_text::set_var($key,$value);
}
-function reload_page($msg)
-{
- global $Ajax;
-// header("Location: $_SERVER['PHP_SELF']."");
-// exit;
- echo "<html>";
- echo "<head>";
- echo "<title>Changing Languages</title>";
- echo '<meta http-equiv="refresh" content="0;url=' . $_SERVER['PHP_SELF'] . '">';
- echo '</head>';
- echo '<body>';
- echo '<div>';
- if ($msg != "")
- echo $msg . " " . $_SERVER['PHP_SELF'];
- echo "</div>";
- echo "</body>";
- echo "</html>";
- $Ajax->redirect($_SERVER['PHP_SELF']);
-}
-
if (!function_exists("_"))
{
function _($text)
include_once($path_to_root . "/includes/lang/language.php");
include_once($path_to_root . "/config_db.php");
include_once($path_to_root . "/includes/ajax.inc");
+include_once($path_to_root . "/includes/main.inc");
+include_once($path_to_root . "/includes/ui/ui_msgs.inc");
/*
Make sure this directory exists and is writable!
// this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks
header("Cache-control: private");
+get_text::init();
+
// Page Initialisation
if (!isset($_SESSION['languages']))
{
- language::load_languages();
+ language::load_languages(); // sets also default $_SESSION['language']
}
-$lang = $_SESSION['language'];
-
-// get_text support
-get_text::init();
-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");
-
-// Necessary 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);
+language::set_language($_SESSION['language']->code);
include_once($path_to_root . "/config.php");
$Ajax =& new Ajax();
-include_once($path_to_root . "/includes/main.inc");
+//include_once($path_to_root . "/includes/main.inc");
-include_once($path_to_root . "/includes/ui/ui_msgs.inc");
+//include_once($path_to_root . "/includes/ui/ui_msgs.inc");
// intercept all output to destroy it in case of ajax call
register_shutdown_function('ob_end_flush');
if (!isset($_SESSION["wa_current_user"]))
$_SESSION["wa_current_user"] = new current_user();
+set_global_connection();
if (!$_SESSION["wa_current_user"]->logged_in())
{
login_fail();
}
$lang = $_SESSION['language'];
- get_text::set_language($lang->code, $lang->encoding);
+ language::set_language($_SESSION['language']->code);
}
}
+if (!isset($_SESSION["App"])) {
+ $_SESSION["App"] = new front_accounting();
+ $_SESSION["App"]->init();
+}
// Run with debugging messages for the system administrator(s) but not anyone else
/*if (in_array(15, $security_groups[$_SESSION["AccessLevel"]])) {
ini_set('xdebug.auto_trace',1);
include_once("includes/session.inc");
- if (!isset($_SESSION["App"]))
- $_SESSION["App"] = new front_accounting();
$app = &$_SESSION["App"];
if (isset($_GET['application']))
$app->selected_application = $_GET['application'];