+$_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");
+include_once($path_to_root . "/includes/main.inc");
+
+// Ajax communication object
+$Ajax = new Ajax();
+
+// js/php validation rules container
+$Validate = array();
+// bindings for editors
+$Editors = array();
+// page help. Currently help for function keys.
+$Pagehelp = array();
+
+$Refs = new references();
+
+// 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();
+
+html_cleanup($_GET);
+html_cleanup($_POST);
+html_cleanup($_REQUEST);
+
+// logout.php is the only page we should have always
+// accessable regardless of access level and current login status.
+if (strstr($_SERVER['PHP_SELF'], 'logout.php') == false){
+
+ login_timeout();
+
+ if (!$_SESSION["wa_current_user"]->logged_in())
+ {
+ // Show login screen
+ if (!isset($_POST["user_name_entry_field"]) or $_POST["user_name_entry_field"] == "")