Removed a lot of the warnings generated when PHP has all warnings enabled.
[squirrelmail.git] / functions / page_header.php
1 <?php
2 /**
3 ** page_header.php
4 **
5 ** Prints the page header (duh)
6 **
7 ** $Id$
8 **/
9
10 session_start();
11
12 $page_header_php = true;
13
14 if (!isset($prefs_php))
15 include ("../functions/prefs.php");
16 if (!isset($i18n_php))
17 include ("../functions/i18n.php");
18 if (!isset($plugin_php))
19 include ("../functions/plugin.php");
20
21 // Check to see if gettext is installed
22 set_up_language(getPref($data_dir, $username, "language"));
23
24 // This is done to ensure that the character set is correct.
25 if ($default_charset != "")
26 header ("Content-Type: text/html; charset=$default_charset");
27
28 function displayHtmlHeader ($title="SquirrelMail") {
29 global $theme_css;
30
31 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
32 echo "\n\n";
33 echo "<HTML>\n";
34 echo "<HEAD>\n";
35 if ($theme_css != "") {
36 printf ('<LINK REL="stylesheet" TYPE="text/css" HREF="%s">',
37 $theme_css);
38 echo "\n";
39 }
40
41 do_hook ("generic_header");
42
43 echo "<TITLE>$title</TITLE>\n";
44 echo "</HEAD>\n\n";
45 }
46
47 function displayInternalLink ($path, $text, $target="") {
48 global $base_uri;
49
50 if ($target != "")
51 $target = " target=\"$target\"";
52
53 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
54 }
55
56 function displayPageHeader($color, $mailbox) {
57 displayHtmlHeader ();
58
59 printf('<BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">',
60 $color[8], $color[4], $color[7], $color[7], $color[7]);
61 echo "\n\n";
62
63 /** Here is the header and wrapping table **/
64 $shortBoxName = readShortMailboxName($mailbox, ".");
65 $shortBoxName = sqStripSlashes($shortBoxName);
66 echo "<A NAME=pagetop></A>\n";
67 echo "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n";
68 echo " <TR BGCOLOR=\"$color[9]\">\n";
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";
72 echo " <div align=right>" . _("Current Folder") . ": <B>$shortBoxName&nbsp;</B></div>\n";
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";
78 echo " <TD ALIGN=left WIDTH=\"99%\">\n";
79 $urlMailbox = urlencode($mailbox);
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";
88 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), "right");
89 echo "&nbsp;&nbsp;\n";
90 displayInternalLink ("src/help.php", _("Help"), "right");
91 echo "&nbsp;&nbsp;\n";
92
93 do_hook("menuline");
94
95 echo " </TD><TD ALIGN=right nowrap WIDTH=\"1%\">\n";
96 echo " <A HREF=\"http://www.squirrelmail.org/\" TARGET=\"_top\">SquirrelMail</A>\n";
97 echo " </TD>\n";
98 echo " </TR>\n";
99 echo "</TABLE>\n\n";
100 }
101 ?>