X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fpage_header.php;h=aff1feb391eef1e8830b06e01c4cf0ce53db2303;hb=1cbd87548bd63a925cb3d4ce025ae40b616b7c64;hp=1581db79543e1f6227821327bfda80ce8b624702;hpb=5810acfad0da5329c455285d6c70f49efc34871d;p=squirrelmail.git diff --git a/functions/page_header.php b/functions/page_header.php index 1581db79..aff1feb3 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -46,7 +46,7 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE $header_tags = ''; - $header_tags .= "\n"; + $header_tags .= "\n"; $used_fontset = (!empty($chosen_fontset) ? $chosen_fontset : $default_fontset); $used_fontsize = (!empty($chosen_fontsize) ? $chosen_fontsize : $default_fontsize); @@ -103,13 +103,27 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE * recommendations and switch to unicode. */ $header_tags .= "\n"; - $header_tags .= '' . "\n"; + $header_tags .= '' . "\n"; } if ($do_hook) { - // NOTE! plugins here must assign output to template - // and NOT echo anything directly!! + // NOTE! plugins here MUST assign output to template + // and NOT echo anything directly!! A common + // approach is if a plugin decides it needs to + // put something at page-top after the standard + // SM page header, to dynamically add itself to + // the page_header_bottom and/or compose_header_bottom + // hooks for the current page request. See + // the Sent Confirmation v1.7 or Restrict Senders v1.2 + // plugins for examples of this approach. global $null; + ob_start(); do_hook('generic_header', $null); + $output = ob_get_contents(); + ob_end_clean(); + // plugin authors can debug their errors with one of the following: + //sm_print_r($output); + //echo $output; + if (!empty($output)) trigger_error('A plugin on the "generic_header" hook has attempted to output directly to the browser', E_USER_ERROR); } $header_tags .= $xtra; @@ -182,7 +196,7 @@ function displayInternalLink($path, $text, $target='') { * @return void */ -function displayPageHeader($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') { +function displayPageHeader($color, $mailbox='', $sHeaderJs='', $sBodyTagJs = '') { global $reply_focus, $hide_sm_attributions, $frame_top, $provider_name, $provider_uri, $startMessage, @@ -316,6 +330,8 @@ function compose_Header($color, $mailbox, $sHeaderJs='', $sOnload = '') { $aAttribs = array('text' => $color[8], 'bgcolor' => $color[4], 'link' => $color[7], 'vlink' => $color[7], 'alink' => $color[7]); + + // this is template-safe (see create_body() function) echo create_body($sOnload, $class, $aAttribs); global $null;