X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_msg_dialog.inc;h=505d47fc7b412bb77c4a673042f69f364a7e6e75;hb=387a8ff163da84a9885feaa4fb936031c93eebf5;hp=1d5a81d6664f711c10b8fa70c6f30ed956e5a2be;hpb=0460a1f33319461589b0a9f5501710a53a3b7a4b;p=gosa.git diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index 1d5a81d66..505d47fc7 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -1,9 +1,10 @@ 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(!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; + } } - $_SESSION['msg_dialogs'][] = $this; } public static function display($s_title,$s_message,$i_type = INFO_DIALOG) @@ -43,16 +62,36 @@ class msg_dialog public function execute() { - $smarty = get_smarty(); - $smarty->assign("s_Trace",print_a($this->a_Trace,TRUE)); - $smarty->assign("i_Type",$this->i_Type); - $smarty->assign("s_Message",$this->s_Message); - $smarty->assign("s_Title",$this->s_Title); - $smarty->assign("i_ID",$this->i_ID); - $smarty->assign("frame",false); - $smarty->assign("JS",$_SESSION['js']); - $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])); - return($smarty->fetch(get_template_path('msg_dialog.tpl'))); + if($this->i_Type == FATAL_ERROR_DIALOG) { + $display = + " + + GOsa startup failed + + + +
+ {t}Error{/t} + + Fatal Error - GOsa execution abortet - ".$this->s_Title."
+ ".$this->s_Message."

+ "._("Please fix the above error and reload the page.")." +
"; + return($display);; + }else{ + + $smarty = get_smarty(); + $smarty->assign("s_Trace",print_a($this->a_Trace,TRUE)); + $smarty->assign("i_Type",$this->i_Type); + $smarty->assign("s_Message",$this->s_Message); + $smarty->assign("s_Title",$this->s_Title); + $smarty->assign("i_ID",$this->i_ID); + $smarty->assign("frame",false); + $smarty->assign("JS",$_SESSION['js']); + $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])); + return($smarty->fetch(get_template_path('msg_dialog.tpl'))); + } }