From: kink Date: Mon, 9 Jun 2003 14:39:15 +0000 (+0000) Subject: Make sure we have a HTML-header already outputted before we send X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b6c283c4680e052f27b8c3a08189bb35b753a7b7;p=squirrelmail.git Make sure we have a HTML-header already outputted before we send the error message. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4991 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/display_messages.php b/functions/display_messages.php index a517984a..e5520ffa 100644 --- a/functions/display_messages.php +++ b/functions/display_messages.php @@ -137,19 +137,31 @@ function logout_error( $errString, $errTitle = '' ) { } function error_box($string, $color) { - echo ' '; - echo ' '; - echo '
'; - echo ' '; - echo ' '; - echo '
'; - echo ' ' . _("ERROR") . ':'; - echo '
'; - echo ' '; - echo ' ' . html_tag( 'td', $string."\n", 'left') - . ''; - echo '
'; - echo '
'; - echo ' '; + global $pageheader_sent; + + $err = _("ERROR"); + + /* check if the page header has been sent; if not, send it! */ + if(!isset($pageheader_sent) && !$pageheader_sent) { + /* include this just to be sure */ + include_once( SM_PATH . 'functions/page_header.php' ); + displayHtmlHeader('SquirrelMail: '.$err); + $pageheader_sent = TRUE; + echo "\n\n"; + } + + echo ' ' + . ' ' + . '
' + . ' ' + . ' ' + . '
' + . ' ' . $err . ':' + . '
' + . ' ' + . ' ' . html_tag( 'td', $string."\n", 'left') . '' + . '
' + . '
' + . ' '; } ?> diff --git a/functions/page_header.php b/functions/page_header.php index 05915145..c3355305 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -23,7 +23,7 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE if ( !sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) { global $base_uri; } - global $theme_css, $custom_css; + global $theme_css, $custom_css, $pageheader_sent; echo '' . "\n\n" . html_tag( 'html' ,'' , '', '', '' ) . "\n\n"; @@ -64,6 +64,9 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ECHO; echo "\n\n\n"; + + /* this is used to check elsewhere whether we should call this function */ + $pageheader_sent = TRUE; } function makeInternalLink($path, $text, $target='') {