X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=class%2Ferror.class.php;h=aabea017f17294f5552fcd255b4b4b1fed0f8f11;hp=7eba7966bec50d37c571f398d0dc96939c0ccd1f;hb=81de00c0eba6c2f4aebcfdd24124be99a3996871;hpb=bda07b93ab2b94665bb7647a0694dbdd60aba2af;ds=sidebyside diff --git a/class/error.class.php b/class/error.class.php index 7eba7966..aabea017 100644 --- a/class/error.class.php +++ b/class/error.class.php @@ -43,6 +43,7 @@ class ErrorHandler { $this->TemplateName = $sTemplateFile; $this->Template =& $oTemplate; $this->aErrors = array(); + $this->header_sent = false; } /** @@ -53,6 +54,26 @@ class ErrorHandler { $this->TemplateFile = $sTemplateFile; } + /** + * Sets if the page header is already sent + * @since 1.5.1 + */ + function HeaderSent() { + $this->header_sent = true; + } + + /** + * Sets the error template + * @since 1.5.1 + */ + function AssignDelayedErrors(&$aDelayedErrors) { + $aErrors = array_merge($this->aErrors,$aDelayedErrors); + $this->aErrors = $aErrors; + $this->Template->assign('aErrors',$this->aErrors); + $aDelayedErrors = false; + } + + /** * Custom Error handler (set with set_error_handler() ) * @private @@ -172,6 +193,10 @@ class ErrorHandler { // Show the error immediate in case of fatal errors if ($iType == SQM_ERROR) { + if (!$this->header_sent) { + // replace this with template that can be assigned + displayHtmlHeader(_("Error"),'',false); + } $this->DisplayErrors(); exit(_("Terminating SquirrelMail due to a fatal error")); }