| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * page_header.php |
| 5 | * |
| 6 | * Copyright (c) 1999-2005 The SquirrelMail Project Team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * Prints the page header (duh) |
| 10 | * |
| 11 | * @version $Id$ |
| 12 | * @package squirrelmail |
| 13 | */ |
| 14 | |
| 15 | /** Include required files from SM */ |
| 16 | require_once(SM_PATH . 'functions/strings.php'); |
| 17 | require_once(SM_PATH . 'functions/html.php'); |
| 18 | require_once(SM_PATH . 'functions/imap_mailbox.php'); |
| 19 | require_once(SM_PATH . 'functions/global.php'); |
| 20 | |
| 21 | /** |
| 22 | * Output a SquirrelMail page header, from <!doctype> to </head> |
| 23 | * Always set up the language before calling these functions. |
| 24 | * |
| 25 | * @param string title the page title, default SquirrelMail. |
| 26 | * @param string xtra extra HTML to insert into the header |
| 27 | * @param bool do_hook whether to execute hooks, default true |
| 28 | * @param bool frames generate html frameset doctype (since 1.5.1) |
| 29 | * @return void |
| 30 | */ |
| 31 | function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = true, $frames = false ) { |
| 32 | global $squirrelmail_language; |
| 33 | |
| 34 | if ( !sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION) ) { |
| 35 | global $base_uri; |
| 36 | } |
| 37 | global $theme_css, $custom_css, $pageheader_sent; |
| 38 | |
| 39 | if ($frames) { |
| 40 | echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">'; |
| 41 | } else { |
| 42 | echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'; |
| 43 | } |
| 44 | echo "\n" . html_tag( 'html' ,'' , '', '', 'lang="'.$squirrelmail_language.'"' ) . |
| 45 | "<head>\n<meta name=\"robots\" content=\"noindex,nofollow\">\n"; |
| 46 | |
| 47 | /* |
| 48 | * Add closing / to link and meta elements only after switching to xhtml 1.0 Transitional. |
| 49 | * It is not compatible with html 4.01 Transitional |
| 50 | */ |
| 51 | if ( !isset( $custom_css ) || $custom_css == 'none' ) { |
| 52 | if ($theme_css != '') { |
| 53 | echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$theme_css\">"; |
| 54 | } |
| 55 | } else { |
| 56 | echo '<link rel="stylesheet" type="text/css" href="' . |
| 57 | $base_uri . 'themes/css/'.$custom_css.'">'; |
| 58 | } |
| 59 | |
| 60 | if ($squirrelmail_language == 'ja_JP') { |
| 61 | /* |
| 62 | * force correct detection of charset, when browser does not follow |
| 63 | * http content-type and tries to detect charset from page content. |
| 64 | * Shooting of browser's creator can't be implemented in php. |
| 65 | * We might get rid of it, if we follow http://www.w3.org/TR/japanese-xml/ |
| 66 | * recommendations and switch to unicode. |
| 67 | */ |
| 68 | echo "<!-- \xfd\xfe -->\n"; |
| 69 | echo '<meta http-equiv="Content-type" content="text/html; charset=euc-jp">' . "\n"; |
| 70 | } |
| 71 | |
| 72 | if ($do_hook) { |
| 73 | do_hook('generic_header'); |
| 74 | } |
| 75 | |
| 76 | echo "<title>$title</title>\n$xtra\n"; |
| 77 | |
| 78 | /* work around IE6's scrollbar bug */ |
| 79 | echo <<<ECHO |
| 80 | <style type="text/css"> |
| 81 | <!-- |
| 82 | /* avoid stupid IE6 bug with frames and scrollbars */ |
| 83 | body { |
| 84 | voice-family: "\"}\""; |
| 85 | voice-family: inherit; |
| 86 | width: expression(document.documentElement.clientWidth - 30); |
| 87 | } |
| 88 | --> |
| 89 | </style> |
| 90 | |
| 91 | ECHO; |
| 92 | |
| 93 | echo "\n</head>\n\n"; |
| 94 | |
| 95 | /* this is used to check elsewhere whether we should call this function */ |
| 96 | $pageheader_sent = TRUE; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Given a path to a SquirrelMail file, return a HTML link to it |
| 101 | * |
| 102 | * @param string path the SquirrelMail file to link to |
| 103 | * @param string text the link text |
| 104 | * @param string target the target frame for this link |
| 105 | */ |
| 106 | function makeInternalLink($path, $text, $target='') { |
| 107 | sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION); |
| 108 | if ($target != '') { |
| 109 | $target = " target=\"$target\""; |
| 110 | } |
| 111 | |
| 112 | // This is an inefficient hook and is only used by |
| 113 | // one plugin that still needs to patch this code, |
| 114 | // plus if we are templat-izing SM, visual hooks |
| 115 | // are not needed. However, I am leaving the code |
| 116 | // here just in case we find a good (non-visual?) |
| 117 | // use for the internal_link hook. |
| 118 | // |
| 119 | //$hooktext = do_hook_function('internal_link',$text); |
| 120 | //if ($hooktext != '') |
| 121 | // $text = $hooktext; |
| 122 | |
| 123 | return '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>'; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Same as makeInternalLink, but echoes it too |
| 128 | */ |
| 129 | function displayInternalLink($path, $text, $target='') { |
| 130 | echo makeInternalLink($path, $text, $target); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Outputs a complete SquirrelMail page header, starting with <!doctype> and |
| 135 | * including the default menu bar. Uses displayHtmlHeader and takes |
| 136 | * JavaScript and locale settings into account. |
| 137 | * |
| 138 | * @param array color the array of theme colors |
| 139 | * @param string mailbox the current mailbox name to display |
| 140 | * @param string xtra extra html code to add |
| 141 | * @param bool session |
| 142 | * @return void |
| 143 | */ |
| 144 | function displayPageHeader($color, $mailbox, $xtra='', $session=false) { |
| 145 | |
| 146 | global $hide_sm_attributions, $PHP_SELF, $frame_top, |
| 147 | $compose_new_win, $compose_width, $compose_height, |
| 148 | $provider_name, $provider_uri, $startMessage, |
| 149 | $javascript_on, $default_use_mdn, $mdn_user_support; |
| 150 | |
| 151 | sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION ); |
| 152 | sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION ); |
| 153 | $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 ); |
| 154 | if ($qmark = strpos($module, '?')) { |
| 155 | $module = substr($module, 0, $qmark); |
| 156 | } |
| 157 | if (!isset($frame_top)) { |
| 158 | $frame_top = '_top'; |
| 159 | } |
| 160 | |
| 161 | if ($session) { |
| 162 | $compose_uri = $base_uri.'src/compose.php?mailbox='.urlencode($mailbox).'&attachedmessages=true&session='."$session"; |
| 163 | } else { |
| 164 | $compose_uri = $base_uri.'src/compose.php?newmessage=1'; |
| 165 | $session = 0; |
| 166 | } |
| 167 | |
| 168 | if( $javascript_on || strpos($xtra, 'new_js_autodetect_results.value') ) { |
| 169 | |
| 170 | switch ( $module ) { |
| 171 | case 'src/read_body.php': |
| 172 | $js =''; |
| 173 | |
| 174 | // compose in new window code |
| 175 | if ($compose_new_win == '1') { |
| 176 | if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) { |
| 177 | $compose_width = '640'; |
| 178 | } |
| 179 | if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) { |
| 180 | $compose_height = '550'; |
| 181 | } |
| 182 | $js .= "function comp_in_new_form(comp_uri, button, myform) {\n". |
| 183 | ' if (!comp_uri) {'."\n". |
| 184 | ' comp_uri = "'.$compose_uri."\";\n". |
| 185 | ' }'. "\n". |
| 186 | ' comp_uri += "&" + button.name + "=1";'."\n". |
| 187 | ' for ( var i=0; i < myform.elements.length; i++ ) {'."\n". |
| 188 | ' if ( myform.elements[i].type == "checkbox" && myform.elements[i].checked )'."\n". |
| 189 | ' comp_uri += "&" + myform.elements[i].name + "=1";'."\n". |
| 190 | ' }'."\n". |
| 191 | ' var newwin = window.open(comp_uri' . |
| 192 | ', "_blank",'. |
| 193 | '"width='.$compose_width. ',height='.$compose_height. |
| 194 | ',scrollbars=yes,resizable=yes,status=yes");'."\n". |
| 195 | "}\n\n"; |
| 196 | $js .= "function comp_in_new(comp_uri) {\n". |
| 197 | " if (!comp_uri) {\n". |
| 198 | ' comp_uri = "'.$compose_uri."\";\n". |
| 199 | ' }'. "\n". |
| 200 | ' var newwin = window.open(comp_uri' . |
| 201 | ', "_blank",'. |
| 202 | '"width='.$compose_width. ',height='.$compose_height. |
| 203 | ',scrollbars=yes,resizable=yes,status=yes");'."\n". |
| 204 | "}\n\n"; |
| 205 | } |
| 206 | |
| 207 | // javascript for sending read receipts |
| 208 | if($default_use_mdn && $mdn_user_support) { |
| 209 | $js .= 'function sendMDN() {'."\n". |
| 210 | " mdnuri=window.location+'&sendreceipt=1'; ". |
| 211 | "var newwin = window.open(mdnuri,'right');". |
| 212 | "\n}\n\n"; |
| 213 | } |
| 214 | |
| 215 | // if any of the above passes, add the JS tags too. |
| 216 | if($js) { |
| 217 | $js = "\n".'<script language="JavaScript" type="text/javascript">' . |
| 218 | "\n<!--\n" . $js . "// -->\n</script>\n"; |
| 219 | } |
| 220 | |
| 221 | displayHtmlHeader ('SquirrelMail', $js); |
| 222 | $onload = $xtra; |
| 223 | break; |
| 224 | case 'src/compose.php': |
| 225 | $js = '<script language="JavaScript" type="text/javascript">' . |
| 226 | "\n<!--\n" . |
| 227 | "function checkForm() {\n"; |
| 228 | |
| 229 | global $action, $reply_focus; |
| 230 | if (strpos($action, 'reply') !== FALSE && $reply_focus) |
| 231 | { |
| 232 | if ($reply_focus == 'select') $js .= "document.forms['compose'].body.select();}\n"; |
| 233 | else if ($reply_focus == 'focus') $js .= "document.forms['compose'].body.focus();}\n"; |
| 234 | else if ($reply_focus == 'none') $js .= "}\n"; |
| 235 | } |
| 236 | // no reply focus also applies to composing new messages |
| 237 | else if ($reply_focus == 'none') |
| 238 | { |
| 239 | $js .= "}\n"; |
| 240 | } |
| 241 | else |
| 242 | $js .= "var f = document.forms.length;\n". |
| 243 | "var i = 0;\n". |
| 244 | "var pos = -1;\n". |
| 245 | "while( pos == -1 && i < f ) {\n". |
| 246 | "var e = document.forms[i].elements.length;\n". |
| 247 | "var j = 0;\n". |
| 248 | "while( pos == -1 && j < e ) {\n". |
| 249 | "if ( document.forms[i].elements[j].type == 'text' ) {\n". |
| 250 | "pos = j;\n". |
| 251 | "}\n". |
| 252 | "j++;\n". |
| 253 | "}\n". |
| 254 | "i++;\n". |
| 255 | "}\n". |
| 256 | "if( pos >= 0 ) {\n". |
| 257 | "document.forms[i-1].elements[pos].focus();\n". |
| 258 | "}\n". |
| 259 | "}\n"; |
| 260 | |
| 261 | $js .= "// -->\n". |
| 262 | "</script>\n"; |
| 263 | $onload = 'onload="checkForm();"'; |
| 264 | displayHtmlHeader ('SquirrelMail', $js); |
| 265 | break; |
| 266 | |
| 267 | case 'src/right_main.php': |
| 268 | global $fancy_index_highlite; |
| 269 | if (!$fancy_index_highlite) { |
| 270 | $js = ''; |
| 271 | } else //{ putting braces around this block creats strange PHP errors |
| 272 | // following code graciously borrowed from |
| 273 | // phpMyAdmin project at: |
| 274 | // http://www.phpmyadmin.net |
| 275 | $js = <<<EOS |
| 276 | /** |
| 277 | * This array is used to remember mark status of rows in browse mode |
| 278 | */ |
| 279 | var marked_row = new Array; |
| 280 | |
| 281 | |
| 282 | /* |
| 283 | * (un)Checks checkbox for the row that the current table cell is in |
| 284 | * when it gets clicked. |
| 285 | * |
| 286 | * @param string the name of the checkbox that should be (un)checked |
| 287 | */ |
| 288 | function row_click(chkboxName) { |
| 289 | chkbox = document.getElementById(chkboxName); |
| 290 | if (chkbox) { |
| 291 | chkbox.checked = (chkbox.checked ? false : true); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | |
| 296 | |
| 297 | /* |
| 298 | * Sets/unsets the pointer and marker in browse mode |
| 299 | * |
| 300 | * @param object the table row |
| 301 | * @param integer the row number |
| 302 | * @param string the action calling this script (over, out or click) |
| 303 | * @param string the default background color |
| 304 | * @param string the color to use for mouseover |
| 305 | * @param string the color to use for marking a row |
| 306 | * |
| 307 | * @return boolean whether pointer is set or not |
| 308 | */ |
| 309 | function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor) |
| 310 | { |
| 311 | var theCells = null; |
| 312 | |
| 313 | // 1. Pointer and mark feature are disabled or the browser can't get the |
| 314 | // row -> exits |
| 315 | if ((thePointerColor == '' && theMarkColor == '') |
| 316 | || typeof(theRow.style) == 'undefined') { |
| 317 | return false; |
| 318 | } |
| 319 | |
| 320 | // 2. Gets the current row and exits if the browser can't get it |
| 321 | if (typeof(document.getElementsByTagName) != 'undefined') { |
| 322 | theCells = theRow.getElementsByTagName('td'); |
| 323 | } |
| 324 | else if (typeof(theRow.cells) != 'undefined') { |
| 325 | theCells = theRow.cells; |
| 326 | } |
| 327 | else { |
| 328 | return false; |
| 329 | } |
| 330 | |
| 331 | // 3. Gets the current color... |
| 332 | var rowCellsCnt = theCells.length; |
| 333 | var domDetect = null; |
| 334 | var currentColor = null; |
| 335 | var newColor = null; |
| 336 | // 3.1 ... with DOM compatible browsers except Opera that does not return |
| 337 | // valid values with "getAttribute" |
| 338 | if (typeof(window.opera) == 'undefined' |
| 339 | && typeof(theCells[0].getAttribute) != 'undefined') { |
| 340 | currentColor = theCells[0].getAttribute('bgcolor'); |
| 341 | domDetect = true; |
| 342 | } |
| 343 | // 3.2 ... with other browsers |
| 344 | else { |
| 345 | currentColor = theCells[0].style.backgroundColor; |
| 346 | domDetect = false; |
| 347 | } // end 3 |
| 348 | |
| 349 | // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it |
| 350 | if (currentColor.indexOf("rgb") >= 0) |
| 351 | { |
| 352 | var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1, |
| 353 | currentColor.indexOf(')')); |
| 354 | var rgbValues = rgbStr.split(","); |
| 355 | currentColor = "#"; |
| 356 | var hexChars = "0123456789ABCDEF"; |
| 357 | for (var i = 0; i < 3; i++) |
| 358 | { |
| 359 | var v = rgbValues[i].valueOf(); |
| 360 | currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | // 4. Defines the new color |
| 365 | // 4.1 Current color is the default one |
| 366 | if (currentColor == '' |
| 367 | || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) { |
| 368 | if (theAction == 'over' && thePointerColor != '') { |
| 369 | newColor = thePointerColor; |
| 370 | } |
| 371 | else if (theAction == 'click' && theMarkColor != '') { |
| 372 | newColor = theMarkColor; |
| 373 | marked_row[theRowNum] = true; |
| 374 | // deactivated onclick marking of the checkbox because it's also executed |
| 375 | // when an action (clicking on the checkbox itself) on a single item is |
| 376 | // performed. Then the checkbox would get deactived, even though we need |
| 377 | // it activated. Maybe there is a way to detect if the row was clicked, |
| 378 | // and not an item therein... |
| 379 | //document.getElementById('msg[' + theRowNum + ']').checked = true; |
| 380 | } |
| 381 | } |
| 382 | // 4.1.2 Current color is the pointer one |
| 383 | else if (currentColor.toLowerCase() == thePointerColor.toLowerCase() |
| 384 | && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) { |
| 385 | if (theAction == 'out') { |
| 386 | newColor = theDefaultColor; |
| 387 | } |
| 388 | else if (theAction == 'click' && theMarkColor != '') { |
| 389 | newColor = theMarkColor; |
| 390 | marked_row[theRowNum] = true; |
| 391 | //document.getElementById('msg[' + theRowNum + ']').checked = true; |
| 392 | } |
| 393 | } |
| 394 | // 4.1.3 Current color is the marker one |
| 395 | else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) { |
| 396 | if (theAction == 'click') { |
| 397 | newColor = (thePointerColor != '') |
| 398 | ? thePointerColor |
| 399 | : theDefaultColor; |
| 400 | marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum]) |
| 401 | ? true |
| 402 | : null; |
| 403 | //document.getElementById('msg[' + theRowNum + ']').checked = false; |
| 404 | } |
| 405 | } // end 4 |
| 406 | |
| 407 | // 5. Sets the new color... |
| 408 | if (newColor) { |
| 409 | var c = null; |
| 410 | // 5.1 ... with DOM compatible browsers except Opera |
| 411 | if (domDetect) { |
| 412 | for (c = 0; c < rowCellsCnt; c++) { |
| 413 | theCells[c].setAttribute('bgcolor', newColor, 0); |
| 414 | } // end for |
| 415 | } |
| 416 | // 5.2 ... with other browsers |
| 417 | else { |
| 418 | for (c = 0; c < rowCellsCnt; c++) { |
| 419 | theCells[c].style.backgroundColor = newColor; |
| 420 | } |
| 421 | } |
| 422 | } // end 5 |
| 423 | |
| 424 | return true; |
| 425 | } // end of the 'setPointer()' function |
| 426 | EOS; |
| 427 | //} putting braces around this block creats strange PHP errors |
| 428 | $js = "\n".'<script language="JavaScript" type="text/javascript">' . |
| 429 | "\n<!--\n" . $js; |
| 430 | if ($compose_new_win == '1') { |
| 431 | if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) { |
| 432 | $compose_width = '640'; |
| 433 | } |
| 434 | if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) { |
| 435 | $compose_height = '550'; |
| 436 | } |
| 437 | $js .= "\n\nfunction comp_in_new(comp_uri) {\n". |
| 438 | " if (!comp_uri) {\n". |
| 439 | ' comp_uri = "'.$compose_uri."\";\n". |
| 440 | ' }'. "\n". |
| 441 | ' var newwin = window.open(comp_uri' . |
| 442 | ', "_blank",'. |
| 443 | '"width='.$compose_width. ',height='.$compose_height. |
| 444 | ',scrollbars=yes,resizable=yes,status=yes");'."\n". |
| 445 | "}\n\n"; |
| 446 | } |
| 447 | $js .= $xtra . "\n\n// -->\n</script>\n"; |
| 448 | $onload = ''; |
| 449 | displayHtmlHeader ('SquirrelMail', $js); |
| 450 | break; |
| 451 | |
| 452 | default: |
| 453 | $js = '<script language="JavaScript" type="text/javascript">' . |
| 454 | "\n<!--\n" . |
| 455 | "function checkForm() {\n". |
| 456 | "var f = document.forms.length;\n". |
| 457 | "var i = 0;\n". |
| 458 | "var pos = -1;\n". |
| 459 | "while( pos == -1 && i < f ) {\n". |
| 460 | "var e = document.forms[i].elements.length;\n". |
| 461 | "var j = 0;\n". |
| 462 | "while( pos == -1 && j < e ) {\n". |
| 463 | "if ( document.forms[i].elements[j].type == 'text' " . |
| 464 | "|| document.forms[i].elements[j].type == 'password' ) {\n". |
| 465 | "pos = j;\n". |
| 466 | "}\n". |
| 467 | "j++;\n". |
| 468 | "}\n". |
| 469 | "i++;\n". |
| 470 | "}\n". |
| 471 | "if( pos >= 0 ) {\n". |
| 472 | "document.forms[i-1].elements[pos].focus();\n". |
| 473 | "}\n". |
| 474 | "$xtra\n". |
| 475 | "}\n"; |
| 476 | |
| 477 | if ($compose_new_win == '1') { |
| 478 | if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) { |
| 479 | $compose_width = '640'; |
| 480 | } |
| 481 | if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) { |
| 482 | $compose_height = '550'; |
| 483 | } |
| 484 | $js .= "function comp_in_new(comp_uri) {\n". |
| 485 | " if (!comp_uri) {\n". |
| 486 | ' comp_uri = "'.$compose_uri."\";\n". |
| 487 | ' }'. "\n". |
| 488 | ' var newwin = window.open(comp_uri' . |
| 489 | ', "_blank",'. |
| 490 | '"width='.$compose_width. ',height='.$compose_height. |
| 491 | ',scrollbars=yes,resizable=yes,status=yes");'."\n". |
| 492 | "}\n\n"; |
| 493 | |
| 494 | } |
| 495 | $js .= "// -->\n". "</script>\n"; |
| 496 | |
| 497 | $onload = 'onload="checkForm();"'; |
| 498 | displayHtmlHeader ('SquirrelMail', $js); |
| 499 | break; |
| 500 | |
| 501 | } |
| 502 | } else { |
| 503 | /* do not use JavaScript */ |
| 504 | displayHtmlHeader ('SquirrelMail'); |
| 505 | $onload = ''; |
| 506 | } |
| 507 | |
| 508 | echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n"; |
| 509 | /** Here is the header and wrapping table **/ |
| 510 | $shortBoxName = htmlspecialchars(imap_utf7_decode_local( |
| 511 | readShortMailboxName($mailbox, $delimiter))); |
| 512 | if ( $shortBoxName == 'INBOX' ) { |
| 513 | $shortBoxName = _("INBOX"); |
| 514 | } |
| 515 | echo "<a name=\"pagetop\"></a>\n" |
| 516 | . html_tag( 'table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"' ) ."\n" |
| 517 | . html_tag( 'tr', '', '', $color[9] ) ."\n" |
| 518 | . html_tag( 'td', '', 'left' ) ."\n"; |
| 519 | if ( $shortBoxName <> '' && strtolower( $shortBoxName ) <> 'none' ) { |
| 520 | echo ' ' . _("Current Folder") . ": <b>$shortBoxName </b>\n"; |
| 521 | } else { |
| 522 | echo ' '; |
| 523 | } |
| 524 | echo " </td>\n" |
| 525 | . html_tag( 'td', '', 'right' ) ."<b>\n"; |
| 526 | displayInternalLink ('src/signout.php', _("Sign Out"), $frame_top); |
| 527 | echo "</b></td>\n" |
| 528 | . " </tr>\n" |
| 529 | . html_tag( 'tr', '', '', $color[4] ) ."\n" |
| 530 | . ($hide_sm_attributions ? html_tag( 'td', '', 'left', '', 'colspan="2"' ) |
| 531 | : html_tag( 'td', '', 'left' ) ) |
| 532 | . "\n"; |
| 533 | $urlMailbox = urlencode($mailbox); |
| 534 | echo makeComposeLink('src/compose.php?mailbox='.$urlMailbox.'&startMessage='.$startMessage); |
| 535 | echo " \n"; |
| 536 | displayInternalLink ('src/addressbook.php', _("Addresses")); |
| 537 | echo " \n"; |
| 538 | displayInternalLink ('src/folders.php', _("Folders")); |
| 539 | echo " \n"; |
| 540 | displayInternalLink ('src/options.php', _("Options")); |
| 541 | echo " \n"; |
| 542 | displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search")); |
| 543 | echo " \n"; |
| 544 | displayInternalLink ('src/help.php', _("Help")); |
| 545 | echo " \n"; |
| 546 | |
| 547 | do_hook('menuline'); |
| 548 | |
| 549 | echo " </td>\n"; |
| 550 | |
| 551 | if (!$hide_sm_attributions) |
| 552 | { |
| 553 | echo html_tag( 'td', '', 'right' ) ."\n"; |
| 554 | if (empty($provider_uri)) { |
| 555 | echo '<a href="about.php">SquirrelMail</a>'; |
| 556 | } else { |
| 557 | if (empty($provider_name)) $provider_name= 'SquirrelMail'; |
| 558 | echo '<a href="'.$provider_uri.'" target="_blank">'.$provider_name.'</a>'; |
| 559 | } |
| 560 | echo "</td>\n"; |
| 561 | } |
| 562 | echo " </tr>\n". |
| 563 | "</table><br />\n\n"; |
| 564 | } |
| 565 | |
| 566 | /** |
| 567 | * Blatantly copied/truncated/modified from displayPageHeader. |
| 568 | * Outputs a page header specifically for the compose_in_new popup window |
| 569 | * |
| 570 | * @param array color the array of theme colors |
| 571 | * @param string mailbox the current mailbox name to display |
| 572 | * @return void |
| 573 | */ |
| 574 | function compose_Header($color, $mailbox) { |
| 575 | |
| 576 | global $javascript_on; |
| 577 | |
| 578 | /* |
| 579 | * Locate the first displayable form element (only when JavaScript on) |
| 580 | */ |
| 581 | if($javascript_on) { |
| 582 | global $base_uri, $PHP_SELF, $data_dir, $username; |
| 583 | |
| 584 | $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 ); |
| 585 | |
| 586 | switch ( $module ) { |
| 587 | case 'src/search.php': |
| 588 | $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1; |
| 589 | $onload = "onload=\"document.forms[$pos].elements[2].focus();\""; |
| 590 | displayHtmlHeader (_("Compose")); |
| 591 | break; |
| 592 | default: |
| 593 | $js = '<script language="JavaScript" type="text/javascript">' . |
| 594 | "\n<!--\n" . |
| 595 | "function checkForm() {\n"; |
| 596 | |
| 597 | global $action, $reply_focus; |
| 598 | if (strpos($action, 'reply') !== FALSE && $reply_focus) |
| 599 | { |
| 600 | if ($reply_focus == 'select') $js .= "document.forms['compose'].body.select();}\n"; |
| 601 | else if ($reply_focus == 'focus') $js .= "document.forms['compose'].body.focus();}\n"; |
| 602 | else if ($reply_focus == 'none') $js .= "}\n"; |
| 603 | } |
| 604 | // no reply focus also applies to composing new messages |
| 605 | else if ($reply_focus == 'none') |
| 606 | { |
| 607 | $js .= "}\n"; |
| 608 | } |
| 609 | else |
| 610 | $js .= "var f = document.forms.length;\n". |
| 611 | "var i = 0;\n". |
| 612 | "var pos = -1;\n". |
| 613 | "while( pos == -1 && i < f ) {\n". |
| 614 | "var e = document.forms[i].elements.length;\n". |
| 615 | "var j = 0;\n". |
| 616 | "while( pos == -1 && j < e ) {\n". |
| 617 | "if ( document.forms[i].elements[j].type == 'text' ) {\n". |
| 618 | "pos = j;\n". |
| 619 | "}\n". |
| 620 | "j++;\n". |
| 621 | "}\n". |
| 622 | "i++;\n". |
| 623 | "}\n". |
| 624 | "if( pos >= 0 ) {\n". |
| 625 | "document.forms[i-1].elements[pos].focus();\n". |
| 626 | "}\n". |
| 627 | "}\n"; |
| 628 | $js .= "// -->\n". |
| 629 | "</script>\n"; |
| 630 | $onload = 'onload="checkForm();"'; |
| 631 | displayHtmlHeader (_("Compose"), $js); |
| 632 | break; |
| 633 | } |
| 634 | } else { |
| 635 | /* javascript off */ |
| 636 | displayHtmlHeader(_("Compose")); |
| 637 | $onload = ''; |
| 638 | } |
| 639 | |
| 640 | echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n"; |
| 641 | } |
| 642 | |
| 643 | ?> |