X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fpage_header.php;h=0228eebaeaad43af77be2a932f006cde2a365fc0;hb=1977ab5587905d225c6288141b82f7a6e3d29d02;hp=96656a0f4e2e28fcb23063b8b360aebd724c6556;hpb=85f4ce5273946c73ef3b879d02440b547ec21d71;p=squirrelmail.git diff --git a/functions/page_header.php b/functions/page_header.php index 96656a0f..1311893e 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -3,503 +3,371 @@ /** * page_header.php * - * Copyright (c) 1999-2002 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * * Prints the page header (duh) * - * $Id$ + * @copyright 1999-2010 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package squirrelmail */ -require_once('../functions/strings.php'); -require_once('../functions/imap_utf7_decode_local.php'); -require_once('../functions/html.php'); -require_once('../class/html.class.php'); - -/* Always set up the language before calling these functions */ -function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) { +/** Include required files from SM */ +include_once(SM_PATH . 'functions/imap_mailbox.php'); - global $theme_css, $custom_css, $base_uri; - - echo '' . - "\n\n\n\n"; +/** + * Output a SquirrelMail page header, from to + * Always set up the language before calling these functions. + * + * Since 1.5.1 function sends http headers. Function should be called + * before any output is started. + * @param string title the page title, default SquirrelMail. + * @param string xtra extra HTML to insert into the header + * @param bool do_hook whether to execute hooks, default true + * @param bool frames generate html frameset doctype (since 1.5.1) + * @return void + */ +function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE, $frames = FALSE ) { + global $squirrelmail_language, $sTemplateID, $oErrorHandler, $oTemplate; - if ( !isset( $custom_css ) || $custom_css == 'none' ) { - if ($theme_css != '') { - echo ""; - } - } else { - echo ''; + if ( !sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) { + global $base_uri; } - -// if ($do_hook) { -// do_hook("generic_header"); -// } - - echo "\n$title$xtra\n\n"; -} + global $custom_css, $pageheader_sent, $theme, $theme_default, $text_direction, + $default_fontset, $chosen_fontset, $default_fontsize, $chosen_fontsize, + $chosen_theme, $chosen_theme_path, $user_themes, $user_theme_default; -function initPage () { - $page = new html(); - $page->addChild('',''); - $page->addChild('HTML'); - return $page; -} + /* add no cache headers here */ +//FIXME: should change all header() calls in SM core to use $oTemplate->header()!! + $oTemplate->header('Pragma: no-cache'); // http 1.0 (rfc1945) + $oTemplate->header('Cache-Control: private, no-cache, no-store'); // http 1.1 (rfc2616) -function initHead ($title = 'SquirrelMail', $session=false) { - global $use_css, $compose_new_win, $compose_width, $compose_height, - $base_uri; + // don't show version as a security measure + //$oTemplate->header('X-Powered-By: SquirrelMail/' . SM_VERSION, FALSE); + $oTemplate->header('X-Powered-By: SquirrelMail', FALSE); - if ($session != false) { - $compose_uri = 'src/compose.php?mailbox='. urlencode($mailbox).'&attachedmessages=true&session='."$session"; - } else { - $compose_uri = 'src/compose.php?newmessage=1'; - $session = 0; - } + $oTemplate->assign('frames', $frames); + $oTemplate->assign('lang', $squirrelmail_language); + $header_tags = ''; - $head = new html('head'); - $head->addChild('title', $title); -// if ($use_css) { -// $head->addChild('link','','','','', -// array('REL' => 'stylesheet', 'TYPE' => 'text/css', -// 'HREF' => $base_uri .'/css/read_body.css')); -// } - if ($compose_new_win == '1') { - if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) { - $compose_width = '640'; - } - if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) { - $compose_height = '550'; - } - $js = "function comp_in_new(comp_uri) {\n". - " if (comp_uri =='') {\n". - ' comp_uri = "'.$base_uri.$compose_uri."\";\n". - ' }'. "\n". - ' var newwin = window.open(comp_uri' . - ', "_blank",'. - '"width='.$compose_width. ',height='.$compose_height. - '",scrollbars="yes",resizable="yes");'."\n". - "}\n\n"; - - - $head->scriptAdd($js); - - $js = 'function sendMDN() {'."\n". - "mdnuri=window.location+'&sendreceipt=1';". - "var newwin = window.open(mdnuri,'right');". - "\n}\n\n"; - $head->scriptAdd($js); - } - return $head; -} + $header_tags .= "\n"; -function initBody($color, $javascript='') { - global $use_css; - - if (!$use_css) { - $body = new html('body','','','','', - array('bgcolor' => $color[4], 'text' => $color[8], 'link' => $color[7], - 'vlink' => $color[7], 'alink' => $color[7]), $javascript); - } else { - $body = new html('body','','','','','',$javascript); - } - return $body; -} + $used_fontset = (!empty($chosen_fontset) ? $chosen_fontset : $default_fontset); + $used_fontsize = (!empty($chosen_fontsize) ? $chosen_fontsize : $default_fontsize); + $used_theme = !isset($chosen_theme) && $user_theme_default != 'none' && is_dir($chosen_theme) && is_readable($chosen_theme)? $user_themes[$user_theme_default]['PATH'].'/default.css' : $chosen_theme_path; + + /** + * Stylesheets are loaded in the following order: + * 1) All stylesheets provided by the template. Normally, these are + * stylsheets in templates/