X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fpage_header.php;h=5a294420550a218f04f40dfdac2fc1fd174e061d;hb=6299388d0054b5e185ff3bda48a82c22455a521d;hp=621b55d1225425ed4cd446391bfea18c25a63f04;hpb=04f8889b98523298d035f39378bc7e12f0a642bf;p=squirrelmail.git diff --git a/functions/page_header.php b/functions/page_header.php index 621b55d1..5a294420 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -41,34 +41,40 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = true } else { echo ''; } - echo "\n\n" . html_tag( 'html' ,'' , '', '', 'lang="'.$squirrelmail_language.'"' ) . "\n\n"; + echo "\n" . html_tag( 'html' ,'' , '', '', 'lang="'.$squirrelmail_language.'"' ) . + "\n\n"; + /* + * Add closing / to link and meta elements only after switching to xhtml 1.0 Transitional. + * It is not compatible with html 4.01 Transitional + */ if ( !isset( $custom_css ) || $custom_css == 'none' ) { if ($theme_css != '') { - echo ""; + echo ""; } } else { echo ''; + $base_uri . 'themes/css/'.$custom_css.'">'; } + echo ''; + if ($squirrelmail_language == 'ja_JP') { /* - * force correct detection of charset, when browser does not follow + * force correct detection of charset, when browser does not follow * http content-type and tries to detect charset from page content. * Shooting of browser's creator can't be implemented in php. - * We might get rid of it, if we follow http://www.w3.org/TR/japanese-xml/ + * We might get rid of it, if we follow http://www.w3.org/TR/japanese-xml/ * recommendations and switch to unicode. - */ + */ echo "\n"; - echo '' . "\n"; + echo '' . "\n"; } - if ($do_hook) { do_hook('generic_header'); } - echo "\n$title$xtra\n"; + echo "$title\n$xtra\n"; /* work around IE6's scrollbar bug */ echo <<' . - "\n\n\n"; - } - - displayHtmlHeader ('SquirrelMail', $js); - $onload = $xtra; - break; - case 'src/compose.php': - $js = '\n"; - $onload = 'onload="checkForm();"'; - displayHtmlHeader ('SquirrelMail', $js); - break; - - default: - $js = '\n"; - - $onload = 'onload="checkForm();"'; - displayHtmlHeader ('SquirrelMail', $js); - break; - + if( $javascript_on || strpos($sHeaderJs, 'new_js_autodetect_results.value') ) { + $sJsBlock = '' ."\n"; + if ($sHeaderJs) { + $sJsBlock .= "\n\n"; } - } else { + displayHtmlHeader ('SquirrelMail', $sJsBlock); + } else { /* do not use JavaScript */ displayHtmlHeader ('SquirrelMail'); - $onload = ''; + $sBodyTagJs = ''; } - echo "\n\n"; + echo "\n\n"; + /** Here is the header and wrapping table **/ $shortBoxName = htmlspecialchars(imap_utf7_decode_local( readShortMailboxName($mailbox, $delimiter))); @@ -341,6 +195,8 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) { : html_tag( 'td', '', 'left' ) ) . "\n"; $urlMailbox = urlencode($mailbox); + $startMessage = (int)$startMessage; + echo makeComposeLink('src/compose.php?mailbox='.$urlMailbox.'&startMessage='.$startMessage); echo "  \n"; displayInternalLink ('src/addressbook.php', _("Addresses")); @@ -361,9 +217,12 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) { if (!$hide_sm_attributions) { echo html_tag( 'td', '', 'right' ) ."\n"; - if (!isset($provider_uri)) $provider_uri= 'http://www.squirrelmail.org/'; - if (!isset($provider_name)) $provider_name= 'SquirrelMail'; - echo ''.$provider_name.''; + if (empty($provider_uri)) { + echo 'SquirrelMail'; + } else { + if (empty($provider_name)) $provider_name= 'SquirrelMail'; + echo ''.$provider_name.''; + } echo "\n"; } echo " \n". @@ -376,75 +235,30 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) { * * @param array color the array of theme colors * @param string mailbox the current mailbox name to display + * @param string sHeaderJs javascipt code to be inserted in a script block in the header + * @param string sBodyTagJs js events to be inserted in the body tag * @return void */ -function compose_Header($color, $mailbox) { - +function compose_Header($color, $mailbox, $sHeaderJs='', $sBodyTagJs = 'onload="checkForm();"') { global $javascript_on; - /* * Locate the first displayable form element (only when JavaScript on) */ if($javascript_on) { - global $base_uri, $PHP_SELF, $data_dir, $username; - - $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 ); - - switch ( $module ) { - case 'src/search.php': - $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1; - $onload = "onload=\"document.forms[$pos].elements[2].focus();\""; - displayHtmlHeader (_("Compose")); - break; - default: - $js = '\n"; - $onload = 'onload="checkForm();"'; - displayHtmlHeader (_("Compose"), $js); - break; + if ($sHeaderJs) { + $sJsBlock = "\n\n"; + } else { + $sJsBlock = ''; } + $sJsBlock .= "\n" . '' ."\n"; + displayHtmlHeader (_("Compose"), $sJsBlock); } else { /* javascript off */ displayHtmlHeader(_("Compose")); $onload = ''; } - - echo "\n\n"; + echo "\n\n"; } - -?> +?> \ No newline at end of file