* Forgot to make $identity global -- bug fixed
[squirrelmail.git] / functions / page_header.php
CommitLineData
59177427 1<?php
3302d0d4 2 /**
a09387f4 3 ** page_header.php
3302d0d4 4 **
5 ** Prints the page header (duh)
6 **
245a6892 7 ** $Id$
3302d0d4 8 **/
9
f435778e 10 if (defined('page_header_php'))
11 return;
12 define('page_header_php', true);
2a32fc83 13
f435778e 14 include('../src/validate.php');
15 include("../functions/prefs.php");
f435778e 16 include("../functions/plugin.php");
44139266 17
03ff39b2 18 // Check to see if gettext is installed
ebab5342 19 $headers_sent=set_up_language(getPref($data_dir, $username, "language"));
d30d79f2 20
e8816411 21 // This is done to ensure that the character set is correct.
ebab5342 22 // But first checks whether we have already sent headers
23 // with charset when we were setting up the user language.
24 // Otherwise user ends up with the default charset overriding
25 // his selected one.
26 if (!$headers_sent && $default_charset != "")
e8816411 27 header ("Content-Type: text/html; charset=$default_charset");
28
a3ab54ab 29 function displayHtmlHeader ($title="SquirrelMail") {
8df1c96e 30 global $theme_css;
31
2a833d72 32 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
33 echo "\n\n";
34 echo "<HTML>\n";
35 echo "<HEAD>\n";
8df1c96e 36 if ($theme_css != "") {
37 printf ('<LINK REL="stylesheet" TYPE="text/css" HREF="%s">',
38 $theme_css);
39 echo "\n";
40 }
7b086a80 41
42 do_hook ("generic_header");
43
04632dbc 44 echo "<TITLE>$title</TITLE>\n";
2a833d72 45 echo "</HEAD>\n\n";
46 }
47
5bbe20e4 48 function displayInternalLink ($path, $text, $target="") {
49 global $base_uri;
50
51 if ($target != "")
52 $target = " target=\"$target\"";
d68a3926 53
5bbe20e4 54 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
55 }
56
f8f9bed9 57 function displayPageHeader($color, $mailbox) {
67a42d95 58 displayHtmlHeader ();
2a833d72 59
60 printf('<BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">',
61 $color[8], $color[4], $color[7], $color[7], $color[7]);
761d149e 62 echo "\n\n";
2a833d72 63
3302d0d4 64 /** Here is the header and wrapping table **/
65 $shortBoxName = readShortMailboxName($mailbox, ".");
390372b4 66 echo "<A NAME=pagetop></A>\n";
761d149e 67 echo "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n";
68 echo " <TR BGCOLOR=\"$color[9]\">\n";
5bbe20e4 69 echo " <TD ALIGN=left WIDTH=\"30%\"><b>\n";
70 displayInternalLink ("src/signout.php", _("Sign Out"), "_top");
71 echo " </b></TD><TD ALIGN=right WIDTH=\"70%\">\n";
88c81396 72 echo " <div align=right>" . _("Current Folder") . ": <B>$shortBoxName&nbsp;</B></div>\n";
761d149e 73 echo " </TD>\n";
74 echo " </TR>\n";
75 echo "</TABLE>\n\n";
76 echo "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n";
77 echo " <TR>\n";
776c7431 78 echo " <TD ALIGN=left WIDTH=\"99%\">\n";
d76f6440 79 $urlMailbox = urlencode($mailbox);
5bbe20e4 80 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), "right");
81 echo "&nbsp;&nbsp;\n";
82 displayInternalLink ("src/addressbook.php", _("Addresses"), "right");
83 echo "&nbsp;&nbsp;\n";
84 displayInternalLink ("src/folders.php", _("Folders"), "right");
85 echo "&nbsp;&nbsp;\n";
86 displayInternalLink ("src/options.php", _("Options"), "right");
87 echo "&nbsp;&nbsp;\n";
8d455c73 88 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), "right");
89 echo "&nbsp;&nbsp;\n";
d68a3926 90 displayInternalLink ("src/help.php", _("Help"), "right");
5bbe20e4 91 echo "&nbsp;&nbsp;\n";
7b086a80 92
93 do_hook("menuline");
94
776c7431 95 echo " </TD><TD ALIGN=right nowrap WIDTH=\"1%\">\n";
fb3b73a8 96 echo " <A HREF=\"http://www.squirrelmail.org/\" TARGET=\"_blank\">SquirrelMail</A>\n";
761d149e 97 echo " </TD>\n";
98 echo " </TR>\n";
99 echo "</TABLE>\n\n";
3302d0d4 100 }
101?>