e48bf2a0a8e26b65f99a3d9255f1a34a12567575
6 * Copyright (c) 1999-2002 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');
18 /* Always set up the language before calling these functions */
19 function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
21 global $theme_css, $custom_css, $base_uri;
23 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
24 "\n\n<HTML>\n<HEAD>\n";
26 if ( !isset( $custom_css ) ||
$custom_css == 'none' ) {
27 if ($theme_css != '') {
28 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">";
31 echo '<LINK REL="stylesheet" TYPE="text/css" HREF="' .
32 $base_uri . 'themes/css/'.$custom_css.'">';
36 do_hook("generic_header");
39 echo "\n<title>$title</title>$xtra</head>\n\n";
43 function displayInternalLink($path, $text, $target='') {
47 $target = " target=\"$target\"";
49 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
52 function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
54 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top,
55 $compose_new_win, $username, $datadir, $compose_width, $compose_height,
56 $attachemessages, $session;
58 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
59 if ($qmark = strpos($module, '?')) {
60 $module = substr($module, 0, $qmark);
62 if (!isset($frame_top)) {
66 if ($session != false) {
67 $compose_uri = $base_uri.'src/compose.php?mailbox='. urlencode($mailbox).'&attachedmessages=true&session='."$session";
69 $compose_uri = $base_uri.'src/compose.php?newmessage=1';
74 case 'src/read_body.php':
76 if ($compose_new_win == '1') {
77 if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
78 $compose_width = '640';
80 if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
81 $compose_height = '550';
83 $js .= "\n".'<script language="JavaScript" type="text/javascript">' .
85 $js .= "function comp_in_new(comp_uri) {\n".
86 " if (!comp_uri) {\n".
87 ' comp_uri = "'.$compose_uri."\";\n".
89 ' var newwin = window.open(comp_uri' .
91 '"width='.$compose_width. ',height='.$compose_height.
92 ',scrollbars=yes,resizable=yes");'."\n".
96 $js .= 'function sendMDN() {'."\n".
97 "mdnuri=window.location+'&sendreceipt=1';".
98 "var newwin = window.open(mdnuri,'right');".
105 displayHtmlHeader ('Squirrelmail', $js);
108 case 'src/compose.php':
109 $js = '<script language="JavaScript" type="text/javascript">' .
111 "function checkForm() {\n".
112 "var f = document.forms.length;\n".
115 "while( pos == -1 && i < f ) {\n".
116 "var e = document.forms[i].elements.length;\n".
118 "while( pos == -1 && j < e ) {\n".
119 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
126 "if( pos >= 0 ) {\n".
127 "document.forms[i-1].elements[pos].focus();\n".
133 $onload = "onLoad=\"checkForm();\"";
134 displayHtmlHeader ('Squirrelmail', $js);
138 $js = '<script language="JavaScript" type="text/javascript">' .
140 "function checkForm() {\n".
141 "var f = document.forms.length;\n".
144 "while( pos == -1 && i < f ) {\n".
145 "var e = document.forms[i].elements.length;\n".
147 "while( pos == -1 && j < e ) {\n".
148 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
155 "if( pos >= 0 ) {\n".
156 "document.forms[i-1].elements[pos].focus();\n".
161 if ($compose_new_win == '1') {
162 if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
163 $compose_width = '640';
165 if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
166 $compose_height = '550';
168 $js .= "function comp_in_new(comp_uri) {\n".
169 " if (!comp_uri) {\n".
170 ' comp_uri = "'.$compose_uri."\";\n".
172 ' var newwin = window.open(comp_uri' .
174 '"width='.$compose_width. ',height='.$compose_height.
175 ',scrollbars=yes,resizable=yes");'."\n".
179 $js .= "// -->\n". "</script>\n";
182 $onload = "onLoad=\"checkForm();\"";
183 displayHtmlHeader ('Squirrelmail', $js);
188 echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n";
189 /** Here is the header and wrapping table **/
190 $shortBoxName = imap_utf7_decode_local(
191 readShortMailboxName($mailbox, $delimiter));
192 if ( $shortBoxName == 'INBOX' ) {
193 $shortBoxName = _("INBOX");
195 echo "<a name=\"pagetop\"></a>\n"
196 . html_tag( 'table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"' ) ."\n"
197 . html_tag( 'tr', '', '', $color[9] ) ."\n"
198 . html_tag( 'td', '', 'left' ) ."\n";
199 if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) {
200 echo ' ' . _("Current Folder") . ": <b>$shortBoxName </b>\n";
205 . html_tag( 'td', '', 'right' ) ."<b>\n";
206 displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top);
209 . html_tag( 'tr', '', '', $color[4] ) ."\n"
210 . html_tag( 'td', '', 'left' ) ."\n";
211 $urlMailbox = urlencode($mailbox);
212 if ($compose_new_win == '1') {
213 echo "<a href=\"javascript:void(0)\" onclick=\"comp_in_new()\">". _("Compose"). '</a>';
216 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
218 echo " \n";
219 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
220 echo " \n";
221 displayInternalLink ("src/folders.php", _("Folders"), 'right');
222 echo " \n";
223 displayInternalLink ("src/options.php", _("Options"), 'right');
224 echo " \n";
225 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
226 echo " \n";
227 displayInternalLink ("src/help.php", _("Help"), 'right');
228 echo " \n";
233 . html_tag( 'td', '', 'right' ) ."\n";
234 echo ($hide_sm_attributions ?
' ' :
235 '<a href="http://www.squirrelmail.org/" target="_blank">SquirrelMail</a>');
241 /* blatently copied/truncated/modified from the above function */
242 function compose_Header($color, $mailbox) {
244 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, $frame_top, $compose_new_win;
247 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
248 if (!isset($frame_top)) {
253 Locate the first displayable form element
256 case 'src/search.php':
257 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
258 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
259 displayHtmlHeader (_("Compose"));
262 $js = '<script language="JavaScript" type="text/javascript">' .
264 "function checkForm() {\n".
265 "var f = document.forms.length;\n".
268 "while( pos == -1 && i < f ) {\n".
269 "var e = document.forms[i].elements.length;\n".
271 "while( pos == -1 && j < e ) {\n".
272 "if ( document.forms[i].elements[j].type == 'text' ) {\n".
279 "if( pos >= 0 ) {\n".
280 "document.forms[i-1].elements[pos].focus();\n".
285 $onload = "onLoad=\"checkForm();\"";
286 displayHtmlHeader (_("Compose"), $js);
291 echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n";