. ***********************************************************************/ function output_html($text) { global $before_box, $Ajax, $messages; // Fatal errors are not send to error_handler, // so we must check the output if ($text && preg_match('/\bFatal error(<.*?>)?:(.*)/i', $text, $m)) { $Ajax->aCommands = array(); // Don't update page via ajax on errors $text = preg_replace('/\bFatal error(<.*?>)?:(.*)/i','', $text); $messages[] = array(E_ERROR, $m[2], null, null); } $Ajax->run(); return in_ajax() ? fmt_errors() : ($before_box.fmt_errors().$text); } //----------------------------------------------------------------------------- // 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; } function check_page_security($page_security) { } //============================================================================ 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/current_user.inc"); include_once($path_to_root . "/includes/lang/language.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"); session_name('FAinstall'); session_start(); // this is to fix the "back-do-you-want-to-refresh" issue - thanx PHPFreaks header("Cache-control: private"); include_once($path_to_root . "/config.default.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']) ? 'rtl' : 'ltr'); } $_SESSION['language']->set_language($_SESSION['language']->code); 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(); // 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(); $SysPrefs = &$_SESSION['SysPrefs']; // POST vars cleanup needed for direct reuse. // We quote all values later with db_escape() before db update. $_POST = strip_quotes($_POST); ?>