ceea10b213ed773b2ff3a652d0fcbc0bb90f1289
6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Prints the page header (duh)
14 require_once(SM_PATH
. 'functions/strings.php');
15 require_once(SM_PATH
. 'functions/html.php');
16 require_once(SM_PATH
. 'functions/imap_mailbox.php');
17 require_once(SM_PATH
. 'functions/global.php');
19 /* Always set up the language before calling these functions */
20 function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
21 global $squirrelmail_language;
23 if ( !sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION
) ) {
26 global $theme_css, $custom_css, $pageheader_sent;
28 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' .
29 "\n\n" . html_tag( 'html' ,'' , '', '', '' ) . "\n<head>\n";
31 if ( !isset( $custom_css ) ||
$custom_css == 'none' ) {
32 if ($theme_css != '') {
33 echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$theme_css\" />";
36 echo '<link rel="stylesheet" type="text/css" href="' .
37 $base_uri . 'themes/css/'.$custom_css.'" />';
40 if ($squirrelmail_language == 'ja_JP') {
41 echo "<!-- \xfd\xfe -->\n";
42 echo '<meta http-equuiv="Content-type" content="text/html; charset=euc-jp">' . "\n";
46 do_hook('generic_header');
49 echo "\n<title>$title</title>$xtra\n";
51 /* work around IE6's scrollbar bug */
53 <style type="text/css">
55 /* avoid stupid IE6 bug with frames and scrollbars */
57 voice-family: "\"}\"";
58 voice-family: inherit;
59 width: expression(document.documentElement.clientWidth - 30);
68 /* this is used to check elsewhere whether we should call this function */
69 $pageheader_sent = TRUE;
72 function makeInternalLink($path, $text, $target='') {
73 sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION
);
75 $target = " target=\"$target\"";
77 return '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
80 function displayInternalLink($path, $text, $target='') {
81 echo makeInternalLink($path, $text, $target);
84 function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
86 global $hide_sm_attributions, $PHP_SELF, $frame_top,
87 $compose_new_win, $compose_width, $compose_height,
88 $attachemessages, $provider_name, $provider_uri,
89 $javascript_on, $default_use_mdn, $mdn_user_support;
91 sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION
);
92 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION
);
93 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
94 if ($qmark = strpos($module, '?')) {
95 $module = substr($module, 0, $qmark);
97 if (!isset($frame_top)) {
102 $compose_uri = $base_uri.'src/compose.php?mailbox='.urlencode($mailbox).'&attachedmessages=true&session='."$session";
104 $compose_uri = $base_uri.'src/compose.php?newmessage=1';
111 case 'src/read_body.php':
114 // compose in new window code
115 if ($compose_new_win == '1') {
116 if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
117 $compose_width = '640';
119 if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
120 $compose_height = '550';
122 $js .= "function comp_in_new(comp_uri) {\n".
123 " if (!comp_uri) {\n".
124 ' comp_uri = "'.$compose_uri."\";\n".
126 ' var newwin = window.open(comp_uri' .
128 '"width='.$compose_width. ',height='.$compose_height.
129 ',scrollbars=yes,resizable=yes");'."\n".
133 // javascript for sending read receipts
134 if($default_use_mdn && $mdn_user_support) {
135 $js .= 'function sendMDN() {'."\n".
136 " mdnuri=window.location+'&sendreceipt=1'; ".
137 "var newwin = window.open(mdnuri,'right');".
141 // if any of the above passes, add the JS tags too.
143 $js = "\n".'<script language="JavaScript" type="text/javascript">' .
144 "\n<!--\n" . $js . "// -->\n</script>\n";
147 displayHtmlHeader ('SquirrelMail', $js);
150 case 'src/compose.php':
151 $js = '<script language="JavaScript" type="text/javascript">' .
153 "function checkForm() {\n".
154 "var f = document.forms.length;\n".
157 "while( pos == -1 && i < f ) {\n".
158 "var e = document.forms[i].elements.length;\n".
160 "while( pos == -1 && j < e ) {\n".
161 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
168 "if( pos >= 0 ) {\n".
169 "document.forms[i-1].elements[pos].focus();\n".
175 $onload = 'onload="checkForm();"';
176 displayHtmlHeader ('SquirrelMail', $js);
180 $js = '<script language="JavaScript" type="text/javascript">' .
182 "function checkForm() {\n".
183 "var f = document.forms.length;\n".
186 "while( pos == -1 && i < f ) {\n".
187 "var e = document.forms[i].elements.length;\n".
189 "while( pos == -1 && j < e ) {\n".
190 "if ( document.forms[i].elements[j].type == 'text' " .
191 "|| document.forms[i].elements[j].type == 'password' ) {\n".
198 "if( pos >= 0 ) {\n".
199 "document.forms[i-1].elements[pos].focus();\n".
204 if ($compose_new_win == '1') {
205 if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
206 $compose_width = '640';
208 if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
209 $compose_height = '550';
211 $js .= "function comp_in_new(comp_uri) {\n".
212 " if (!comp_uri) {\n".
213 ' comp_uri = "'.$compose_uri."\";\n".
215 ' var newwin = window.open(comp_uri' .
217 '"width='.$compose_width. ',height='.$compose_height.
218 ',scrollbars=yes,resizable=yes");'."\n".
222 $js .= "// -->\n". "</script>\n";
224 $onload = 'onload="checkForm();"';
225 displayHtmlHeader ('SquirrelMail', $js);
230 /* do not use JavaScript */
231 displayHtmlHeader ('SquirrelMail');
235 echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n";
236 /** Here is the header and wrapping table **/
237 $shortBoxName = imap_utf7_decode_local(
238 readShortMailboxName($mailbox, $delimiter));
239 if ( $shortBoxName == 'INBOX' ) {
240 $shortBoxName = _("INBOX");
242 echo "<a name=\"pagetop\"></a>\n"
243 . html_tag( 'table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"' ) ."\n"
244 . html_tag( 'tr', '', '', $color[9] ) ."\n"
245 . html_tag( 'td', '', 'left' ) ."\n";
246 if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) {
247 echo ' ' . _("Current Folder") . ": <b>$shortBoxName </b>\n";
252 . html_tag( 'td', '', 'right' ) ."<b>\n";
253 displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top);
256 . html_tag( 'tr', '', '', $color[4] ) ."\n"
257 . html_tag( 'td', '', 'left' ) ."\n";
258 $urlMailbox = urlencode($mailbox);
259 echo makeComposeLink('src/compose.php?mailbox='.$urlMailbox);
260 echo " \n";
261 displayInternalLink ('src/addressbook.php', _("Addresses"), 'right');
262 echo " \n";
263 displayInternalLink ('src/folders.php', _("Folders"), 'right');
264 echo " \n";
265 displayInternalLink ('src/options.php', _("Options"), 'right');
266 echo " \n";
267 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
268 echo " \n";
269 displayInternalLink ('src/help.php', _("Help"), 'right');
270 echo " \n";
275 . html_tag( 'td', '', 'right' ) ."\n";
276 if (!isset($provider_uri)) $provider_uri= 'http://www.squirrelmail.org/';
277 if (!isset($provider_name)) $provider_name= 'SquirrelMail';
278 echo ($hide_sm_attributions ?
' ' :
279 '<a href="'.$provider_uri.'" target="_blank">'.$provider_name.'</a>');
285 /* blatently copied/truncated/modified from the above function */
286 function compose_Header($color, $mailbox) {
288 global $javascript_on;
291 * Locate the first displayable form element (only when JavaScript on)
294 global $delimiter, $base_uri, $PHP_SELF, $data_dir, $username;
296 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
299 case 'src/search.php':
300 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
301 $onload = "onload=\"document.forms[$pos].elements[2].focus();\"";
302 displayHtmlHeader (_("Compose"));
305 $js = '<script language="JavaScript" type="text/javascript">' .
307 "function checkForm() {\n".
308 "var f = document.forms.length;\n".
311 "while( pos == -1 && i < f ) {\n".
312 "var e = document.forms[i].elements.length;\n".
314 "while( pos == -1 && j < e ) {\n".
315 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
322 "if( pos >= 0 ) {\n".
323 "document.forms[i-1].elements[pos].focus();\n".
328 $onload = 'onload="checkForm();"';
329 displayHtmlHeader (_("Compose"), $js);
334 displayHtmlHeader(_("Compose"));
338 echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n";