Release 2.3.0
[fa-stable.git] / includes / session.inc
index 72ff7cdb129d9c8ed128ac4f3dd03741a6838919..f98c97b284d6188c55e940bff51ab84a762a3ac4 100644 (file)
@@ -168,6 +168,10 @@ if (!isset($path_to_root))
 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");
@@ -177,6 +181,8 @@ 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");
+
 /*
        Uncomment the setting below when using FA on shared hosting
        to avoid unexpeced session timeouts.
@@ -206,15 +212,6 @@ if (!isset($_SESSION['language']) || !method_exists($_SESSION['language'], 'set_
 
 $_SESSION['language']->set_language($_SESSION['language']->code);
 
-include_once($path_to_root . "/includes/hooks.inc");
-
-$Hooks = array();
-// include current langauge related $Hooks object if locale file exists
-if (file_exists($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc"))
-{
-       include_once($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc");
-       $Hooks[] = new Hooks();
-}
 
 include_once($path_to_root . "/includes/access_levels.inc");
 include_once($path_to_root . "/version.php");
@@ -236,15 +233,13 @@ $Refs = new references();
 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();
 
 html_cleanup($_GET);
 html_cleanup($_POST);
 html_cleanup($_REQUEST);
+html_cleanup($_SERVER);
 
 // logout.php is the only page we should have always 
 // accessable regardless of access level and current login status.
@@ -287,6 +282,8 @@ if (strstr($_SERVER['PHP_SELF'], 'logout.php') == false){
        if (!$_SESSION["wa_current_user"]->old_db)
                include_once($path_to_root . '/company/'.user_company().'/installed_extensions.php');
 
+       install_hooks();
+
        if (!isset($_SESSION["App"])) {
                $_SESSION["App"] = new front_accounting();
                $_SESSION["App"]->init();