+}
+
+//-----------------------------------------------------------------------------
+// Removing magic quotes from nested arrays/variables
+//
+function strip_quotes($data)
+{
+ if(get_magic_quotes_gpc()) {
+ if(is_array($data)) {
+ foreach($data as $k => $v) {
+ $data[$k] = strip_quotes($data[$k]);
+ }
+ } else
+ return stripslashes($data);
+ }
+ return $data;
+}
+
+//============================================================================
+if (!isset($path_to_root))
+{
+ $path_to_root = ".";
+}
+
+// Prevent register_globals vulnerability
+if (isset($_GET['path_to_root']) || isset($_POST['path_to_root']))
+ die("Restricted access");
+
+include_once($path_to_root . "/frontaccounting.php");
+include_once($path_to_root . "/includes/current_user.inc");
+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/ui/ui_msgs.inc");
+
+/*
+ Make sure this directory exists and is writable!
+// $session_save_path = dirname(__FILE__).'/../tmp/';
+*/
+
+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::init();
+
+// Page Initialisation
+if (!isset($_SESSION['languages']))
+{
+ language::load_languages(); // sets also default $_SESSION['language']
+}
+
+language::set_language($_SESSION['language']->code);
+
+include_once($path_to_root . "/config.php");
+include_once($path_to_root . "/includes/main.inc");
+
+$Ajax =& new Ajax();
+
+// intercept all output to destroy it in case of ajax call
+register_shutdown_function('end_flush');
+ob_start('output_html',0);
+
+// colect all error msgs
+set_error_handler('error_handler' /*, errtypes */);
+
+if (!isset($_SESSION["wa_current_user"]))
+ $_SESSION["wa_current_user"] = new current_user();
+set_global_connection();
+
+if (!$_SESSION["wa_current_user"]->logged_in())
+{
+ // Show login screen
+ if (!isset($_POST["user_name_entry_field"]) or $_POST["user_name_entry_field"] == "")