some more fixes to solve the vhost problem (icy cold here in the freeze)
[squirrelmail.git] / functions / page_header.php
CommitLineData
59177427 1<?php
7350889b 2
35586184 3/**
4 * page_header.php
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 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
43fdb2a4 14include_once('../functions/strings.php');
15
35586184 16// Always set up the language before calling these functions
a07cd1a4 17function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE ) {
692155b7 18
2c21ef20 19 global $theme_css, $custom_css, $base_uri;
20
8f1ba72b 21 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">' .
22 "\n\n<HTML>\n<HEAD>\n";
2c21ef20 23
a714cb95 24 if ( !isset( $custom_css ) || $custom_css == 'none' ) {
692155b7 25 if ($theme_css != '') {
26 echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">\n";
27 }
8f1ba72b 28 } else {
2c21ef20 29 echo '<LINK REL="stylesheet" TYPE="text/css" HREF="' .
30 $base_uri . "themes/css/$custom_css\">\n";
8f1ba72b 31 }
32
33 if( $do_hook ) {
34 do_hook ("generic_header");
35 }
36
37 echo "<title>$title</title>$xtra</head>\n\n";
a07cd1a4 38}
39
40function displayInternalLink($path, $text, $target='') {
41 global $base_uri;
42
43 if ($target != '') {
44 $target = " target=\"$target\"";
45 }
46
47 echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
48}
49
50function displayPageHeader($color, $mailbox) {
715225af 51
52 global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF;
53
a07cd1a4 54 displayHtmlHeader ();
55
715225af 56 $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
57
58 /*
59 Locate the first displayable form element
60 */
61 switch ( $module ) {
62 case 'src/search.php':
63 $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
64 $onload = "onLoad=\"document.forms[$pos].elements[2].focus();\"";
65 break;
66 default:
67 echo '
68<script language="JavaScript">
69<!--
70function checkForm() {
71
72 var f = document.forms.length;
73 var i = 0;
74 var pos = -1;
75 while( pos == -1 && i < f ) {
76 var e = document.forms[i].elements.length;
77 var j = 0;
78 while( pos == -1 && j < e ) {
79 if ( document.forms[i].elements[j].type == \'text\' ) {
80 pos = j;
81 }
82 j++;
83 }
84 i++;
85 }
86 if( pos >= 0 ) {
715225af 87 document.forms[i-1].elements[pos].focus();
88 }
89
90}
91-->
92</script>
93 ';
94 $onload = "onLoad=\"checkForm();\"";
95 break;
96
97 }
98
99 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\" $onload>\n\n";
a07cd1a4 100
101 /** Here is the header and wrapping table **/
102 $shortBoxName = readShortMailboxName($mailbox, $delimiter);
103 echo "<A NAME=pagetop></A>\n"
104 . "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 WIDTH=\"100%\" CELLSPACING=0 CELLPADDING=2>\n"
105 . " <TR BGCOLOR=\"$color[9]\" >\n"
106 . " <TD ALIGN=left>\n"
107 . ' ' . _("Current Folder") . ": <B>$shortBoxName&nbsp;</B>\n"
108 . " </TD>\n"
109 . " <TD ALIGN=right><b>\n";
110 displayInternalLink ('src/signout.php', _("Sign Out"), '_top');
111 echo " </b></TD>\n"
112 . " </TR>\n"
113 . " <TR BGCOLOR=\"$color[4]\">\n"
114 . " <TD ALIGN=left>\n";
115 $urlMailbox = urlencode($mailbox);
116 displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
117 echo "&nbsp;&nbsp;\n";
118 displayInternalLink ("src/addressbook.php", _("Addresses"), 'right');
119 echo "&nbsp;&nbsp;\n";
120 displayInternalLink ("src/folders.php", _("Folders"), 'right');
121 echo "&nbsp;&nbsp;\n";
122 displayInternalLink ("src/options.php", _("Options"), 'right');
123 echo "&nbsp;&nbsp;\n";
124 displayInternalLink ("src/search.php?mailbox=$urlMailbox", _("Search"), 'right');
125 echo "&nbsp;&nbsp;\n";
126 displayInternalLink ("src/help.php", _("Help"), 'right');
127 echo "&nbsp;&nbsp;\n";
128
129 do_hook("menuline");
130
131 echo " </TD><TD ALIGN=right>\n";
132 echo ($hide_sm_attributions ? '&nbsp;' :
826b7f71 133 "<A HREF=\"http://www.squirrelmail.org/\" TARGET=\"_blank\">SquirrelMail</A>\n");
a07cd1a4 134 echo " </TD>\n".
135 " </TR>\n".
136 "</TABLE>\n\n";
137}
2ba13803 138
43fdb2a4 139?>