+ $_SESSION["wa_current_user"]->last_act = time();
+ }
+}
+//============================================================================
+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 . "/includes/errors.inc");
+// colect all error msgs
+set_error_handler('error_handler' /*, errtypes */);
+
+include_once($path_to_root . "/includes/current_user.inc");
+include_once($path_to_root . "/frontaccounting.php");
+include_once($path_to_root . "/admin/db/security_db.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");
+include_once($path_to_root . "/includes/prefs/sysprefs.inc");
+
+include_once($path_to_root . "/includes/hooks.inc");
+//
+// include all extensions hook files.
+//
+foreach ($installed_extensions as $ext)
+{
+ if (file_exists($path_to_root.'/'.$ext['path'].'/hooks.php'))
+ include_once($path_to_root.'/'.$ext['path'].'/hooks.php');
+}
+
+/*
+ Uncomment the setting below when using FA on shared hosting
+ to avoid unexpeced session timeouts.
+ Make sure this directory exists and is writable!
+*/
+// ini_set('session.save_path', dirname(__FILE__).'/../tmp/');
+
+ini_set('session.gc_maxlifetime', 36000); // 10hrs
+
+hook_session_start(@$_POST["company_login_name"]);
+
+$Session_manager = new SessionManager();
+$Session_manager->sessionStart('FA'.md5(dirname(__FILE__)));
+
+// this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks
+header("Cache-control: private");
+
+include_once($path_to_root . "/config.php");
+get_text_init();
+
+// Page Initialisation
+if (!isset($_SESSION['language']) || !method_exists($_SESSION['language'], 'set_language'))
+{
+ $l = array_search_value($dflt_lang, $installed_languages, 'code');
+ $_SESSION['language'] = new language($l['name'], $l['code'], $l['encoding'],
+ (isset($l['rtl']) && $l['rtl'] === true) ? 'rtl' : 'ltr');
+}
+
+$_SESSION['language']->set_language($_SESSION['language']->code);