From: hickert Date: Mon, 15 Oct 2007 07:38:22 +0000 (+0000) Subject: Udpated message handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=15b80e33c5191577bdb9f2b0fa646619e7ee52bf;p=gosa.git Udpated message handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7543 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_log.inc b/include/class_log.inc index af687c39e..d9c3565f0 100644 --- a/include/class_log.inc +++ b/include/class_log.inc @@ -150,7 +150,7 @@ class log { }else{ $db = mysql_select_db($server['DB'],$con); if(!$db){ - @print_red(sprintf(_("Could not select database %s on server %s. Server says :%s"),$server['DB'],$server['SERVER'],mysql_error($con))); + print_red(sprintf(_("Could not select database %s on server %s. Server says :%s"),$server['DB'],$server['SERVER'],mysql_error($con))); }else{ /* Create mysql syntax */ diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index 8d6d63334..505d47fc7 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -21,20 +21,32 @@ class msg_dialog $i_type = INFO_DIALOG; } - $this->i_ID = preg_replace("/[^0-9]*/","",microtime()); - $this->s_Title = $s_title; - $this->s_Message = $s_message; - $this->i_Type = $i_type; - $this->a_Trace = debug_backtrace(); - if(!isset($_SESSION['msg_dialogs'])){ - $_SESSION['msg_dialogs'] = array(); + if((!isset($_SESSION['errorsAlreadyPosted'])) || !is_array($_SESSION['errorsAlreadyPosted'])){ + $_SESSION['errorsAlreadyPosted'] = array(); } - if($this->i_Type == FATAL_ERROR_DIALOG){ - restore_error_handler(); - error_reporting(E_ALL); - echo $this->execute(); - }else{ - $_SESSION['msg_dialogs'][] = $this; + + if(!isset($_SESSION['errorsAlreadyPosted'][$s_title.$s_message])){ + $_SESSION['errorsAlreadyPosted'][$s_title.$s_message] = 0; + } + $_SESSION['errorsAlreadyPosted'][$s_title.$s_message]++; + + if($_SESSION['errorsAlreadyPosted'][$s_title.$s_message] <=1 ){ + + $this->i_ID = preg_replace("/[^0-9]*/","",microtime()); + $this->s_Title = $s_title; + $this->s_Message = $s_message; + $this->i_Type = $i_type; + $this->a_Trace = debug_backtrace(); + if(!isset($_SESSION['msg_dialogs'])){ + $_SESSION['msg_dialogs'] = array(); + } + if($this->i_Type == FATAL_ERROR_DIALOG){ + restore_error_handler(); + error_reporting(E_ALL); + echo $this->execute(); + }else{ + $_SESSION['msg_dialogs'][] = $this; + } } } diff --git a/include/functions.inc b/include/functions.inc index 600e91034..b244a0896 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -1011,114 +1011,28 @@ function print_red() $string= preg_replace ("/%s/", $array[$i], $string, 1); } - if((!isset($_SESSION['errorsAlreadyPosted'])) || !is_array($_SESSION['errorsAlreadyPosted'])){ - $_SESSION['errorsAlreadyPosted'] = array(); - } - /* If DEBUGLEVEL is set, we're in web mode, use textual output in the other case... */ - if (isset($_SESSION['DEBUGLEVEL'])){ - - if($_SESSION['LastError'] == $string){ - - if((!isset($_SESSION['errorsAlreadyPosted'][$string]))){ - $_SESSION['errorsAlreadyPosted'][$string] = 1; - } - $_SESSION['errorsAlreadyPosted'][$string]++; - - }else{ - if($string !== NULL){ - if (preg_match("/"._("LDAP error:")."/", $string)){ - $addmsg= _("Problems with the LDAP server mean that you probably lost the last changes. Please check your LDAP setup for possible errors and try again."); - $img= "images/error.png"; - } else { - if (!preg_match('/[.!?]$/', $string)){ - $string.= "."; - } - $string= preg_replace('/
/', ' ', $string); - $img= "images/warning.png"; - $addmsg= _("Please check your input and fix the error. Press 'OK' to close this message box."); - } - - msg_dialog::display($addmsg, $string,ERROR_DIALOG); - - return; -/* - if(isset($_SESSION['errors']) && strlen($_SESSION['errors'])==0) { - - if(preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])){ - - $_SESSION['errors'].= " - -
-
"; - $hide = "hide(\"e_layer\");hide(\"e_layer2\");hide(\"e_layer3\");"; - }else{ - - $_SESSION['errors'].= " -
-
"; - $hide = "hide(\"e_layer\");hide(\"e_layer2\");"; - } - - $_SESSION['errors'].= " -
". - "". - "

"._("An error occurred while processing your request"). - "

$string

$addmsg

"; - + if($string !== NULL){ + if (preg_match("/"._("LDAP error:")."/", $string)){ + $addmsg= _("Problems with the LDAP server mean that you probably lost the last changes. Please check your LDAP setup for possible errors and try again."); + } else { + if (!preg_match('/[.!?]$/', $string)){ + $string.= "."; } - */ - }else{ - return; + $string= preg_replace('/
/', ' ', $string); + $addmsg= _("Please check your input and fix the error. Press 'OK' to close this message box."); } - $_SESSION['errorsAlreadyPosted'][$string] = 1; - + msg_dialog::display($addmsg, $string,ERROR_DIALOG); + return; + }else{ + return; } } else { echo "Error: $string\n"; } - $_SESSION['LastError'] = $string; }