Cleaning and bug-fix. Added base uri to read mail.
[squirrelmail.git] / functions / page_header.php
1 <?php
2
3 /**
4 * page_header.php
5 *
6 * Copyright (c) 1999-2002 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 * $Id$
12 */
13
14 // Always set up the language before calling these functions
15 function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
16
17 global $theme_css;
18
19 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
20 "\n\n<HTML>\n<HEAD>\n";
21
22 if ($theme_css != '') {
23 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">\n";
24 }
25
26 if( $do_hook ) {
27 do_hook ("generic_header");
28 }
29
30 echo "<title>$title</title>$xtra</head>\n\n";
31 }
32
33 function displayInternalLink($path, $text, $target='') {
34 global $base_uri;
35
36 if ($target != '') {
37 $target = " target=\"$target\"";
38 }
39
40 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
41 }
42
43 function displayPageHeader($color, $mailbox) {
44 global $delimiter, $hide_sm_attributions;
45 displayHtmlHeader ();
46
47 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" onLoad='if ( ( document.forms.length > 0 ) && ( document.forms[0].elements[0].type == \"text\" ) ) { document.forms[0].elements[0].focus(); }'>\n\n";
48
49 /** Here is the header and wrapping table **/
50 $shortBoxName = readShortMailboxName($mailbox, $delimiter);
51 echo "<A NAME=pagetop></A>\n"
52 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
53 . " <TR BGCOLOR=\"$color[9]\" >\n"
54 . " <TD ALIGN=left>\n"
55 . ' ' . _("Current Folder") . ": <B>$shortBoxName&nbsp;</B>\n"
56 . " </TD>\n"
57 . " <TD ALIGN=right><b>\n";
58 displayInternalLink ('src/signout.php', _("Sign Out"), '_top');
59 echo " </b></TD>\n"
60 . " </TR>\n"
61 . " <TR BGCOLOR=\"$color[4]\">\n"
62 . " <TD ALIGN=left>\n";
63 $urlMailbox = urlencode($mailbox);
64 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
65 echo "&nbsp;&nbsp;\n";
66 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
67 echo "&nbsp;&nbsp;\n";
68 displayInternalLink ("src/folders.php", _("Folders"), 'right');
69 echo "&nbsp;&nbsp;\n";
70 displayInternalLink ("src/options.php", _("Options"), 'right');
71 echo "&nbsp;&nbsp;\n";
72 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
73 echo "&nbsp;&nbsp;\n";
74 displayInternalLink ("src/help.php", _("Help"), 'right');
75 echo "&nbsp;&nbsp;\n";
76
77 do_hook("menuline");
78
79 echo " </TD><TD ALIGN=right>\n";
80 echo ($hide_sm_attributions ? '&nbsp;' :
81 "<A HREF=\"http://www.squirrelmail.org/\" TARGET=\"_blank\">SquirrelMail</A>\n");
82 echo " </TD>\n".
83 " </TR>\n".
84 "</TABLE>\n\n";
85 }
86
87 ?>