From: Janusz Dobrowolski Date: Thu, 22 May 2008 09:34:56 +0000 (+0000) Subject: Earlier error handler binding. X-Git-Tag: v2.4.2~19^2~2059 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=2dc462a7fa1972d04b569fb7156747c59bf6d069;p=fa-stable.git Earlier error handler binding. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1ac3eb17..d1d86dbd 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,13 @@ Legend: ! -> Note $ -> Affected files +22-May-2008 Janusz Dobrowolski +! Error handler switching moved to session.inc for early error catching +$ /includes/main.inc + /includes/session.inc +! Cosmetic cleanup + /js/utils.js + 18-May-2008 Janusz Dobrowolski # Added explicit ob_end_flush() on shutdown needed for php5 $ /includes/main.inc diff --git a/includes/main.inc b/includes/main.inc index b63a86cc..be80677f 100644 --- a/includes/main.inc +++ b/includes/main.inc @@ -14,23 +14,12 @@ include_once($path_to_root . "/admin/db/users_db.inc"); include_once($path_to_root . "/includes/ui/ui_view.inc"); - function output_html($text) - { - global $before_box; - return in_ajax() ? fmt_errors() : ($before_box.fmt_errors().$text); - } - function page($title, $no_menu=false, $is_index=false, $onload="", $js="") { global $path_to_root; $hide_menu = $no_menu; - // intercept all output to destroy it in case of ajax call - register_shutdown_function('ob_end_flush'); - ob_start('output_html',0); - // colect all error msgs - set_error_handler('error_handler' /*, errtypes */); include($path_to_root . "/includes/page/header.inc"); diff --git a/includes/session.inc b/includes/session.inc index ee1ac295..b7efb189 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -9,6 +9,12 @@ | by Joe Hunt Consulting | \--------------------------------------------------*/ + function output_html($text) + { + global $before_box; + return in_ajax() ? fmt_errors() : ($before_box.fmt_errors().$text); + } + if (!isset($path_to_root)) { $path_to_root = "."; @@ -108,6 +114,13 @@ exit; } } + include_once("ajax.inc"); + $Ajax =& new Ajax(); + // intercept all output to destroy it in case of ajax call + register_shutdown_function('ob_end_flush'); + ob_start('output_html',0); + // colect all error msgs + set_error_handler('error_handler' /*, errtypes */); if (isset($_POST["user_name_entry_field"])) { @@ -130,9 +143,6 @@ }*/ //---------------------------------------------------------------------------------------- - include_once("ajax.inc"); - - $Ajax =& new Ajax(); check_page_security($page_security); diff --git a/js/utils.js b/js/utils.js index 7c071c33..746fb77b 100644 --- a/js/utils.js +++ b/js/utils.js @@ -52,24 +52,7 @@ false // do not disable caching ); } -/* // calls form validation function - // - JsHttpRequest.validate= function(submit) { - JsHttpRequest.query( - 'POST '+window.location.toString(), // backend - this.formValues('_validate_form'), - // Function is called when an answer arrives. - function(result, errors) { - if (result) { - window.location = result; - } else - return false; - return true; - }, - false - ); - } -*/ // returns input field values submitted when form button 'name' is pressed + // returns input field values submitted when form button 'name' is pressed // JsHttpRequest.formValues = function(inp) { @@ -162,4 +145,3 @@ function goBack() { else window.history.go(-1); } - \ No newline at end of file