59177427 |
1 | <?php |
2ba13803 |
2 | |
35586184 |
3 | /** |
4 | * display_messages.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 | * This contains all messages, including information, error, and just |
10 | * about any other message you can think of. |
11 | * |
12 | * $Id$ |
13 | */ |
3302d0d4 |
14 | |
c94b297c |
15 | /** |
16 | * Find out where squirrelmail lives and try to be smart about it. |
17 | * The only problem would be when squirrelmail lives in directories |
18 | * called "src", "functions", or "plugins", but people who do that need |
19 | * to be beaten with a steel pipe anyway. |
20 | * |
21 | * @return the base uri of squirrelmail installation. |
22 | */ |
399846ea |
23 | function sqm_baseuri(){ |
24 | global $base_uri, $PHP_SELF; |
c94b297c |
25 | /** |
26 | * If it is in the session, just return it. |
27 | */ |
399846ea |
28 | if (isset($base_uri)){ |
29 | return $base_uri; |
30 | } |
31 | $dirs = array("|src/.*|", "|plugins/.*|", "|functions/.*|"); |
32 | $repl = array("", "", ""); |
33 | $base_uri = preg_replace($dirs, $repl, $PHP_SELF); |
34 | return $base_uri; |
35 | } |
36 | |
ec5b189b |
37 | function error_username_password_incorrect() { |
1cf38f19 |
38 | global $frame_top, $color; |
76b684a5 |
39 | /* XXX: Should really not start the HTML before this, or close off more |
40 | cleanly. */ |
2ba13803 |
41 | |
d03f3582 |
42 | if (!isset($frame_top)) { |
43 | $frame_top = '_top'; |
44 | } |
45 | |
35586184 |
46 | echo '<BR>'. |
76b684a5 |
47 | '<TABLE COLS=1 WIDTH="75%" BORDER="0" BGCOLOR="' . $color[4] . '" ALIGN=CENTER>'. |
26f277a6 |
48 | '<TR BGCOLOR="' . $color[0] . '">'. |
ec5b189b |
49 | '<TH>' . _("ERROR") . '</TH>'. |
50 | '</TR>' . |
51 | '<TR><TD>'. |
52 | '<CENTER><BR>' . _("Unknown user or password incorrect.") . |
399846ea |
53 | '<BR><A HREF="' . sqm_baseuri() . '"login.php" TARGET='. |
54 | $frame_top.'>' . _("Click here to try again") . |
ec5b189b |
55 | '</A>.</CENTER>'. |
56 | '</TD></TR>'. |
2ba13803 |
57 | '</TABLE>'. |
58 | '</BODY></HTML>'; |
ec5b189b |
59 | } |
2ba13803 |
60 | |
ec5b189b |
61 | function general_info($motd, $org_logo, $version, $org_name, $color) { |
b6d8d08d |
62 | |
63 | echo '<BR>'. |
76b684a5 |
64 | "<TABLE COLS=1 WIDTH=\"80%\" CELLSPACING=0 CELLPADDING=2 BORDER=\"0\" ALIGN=CENTER><TR><TD BGCOLOR=\"$color[9]\">". |
65 | '<TABLE COLS=1 WIDTH="100%" CELLSPACING=0 CELLPADDING=3 BORDER="0" BGCOLOR="' . $color[4] . '" ALIGN=CENTER>'. |
b6d8d08d |
66 | '<TR>' . |
67 | "<TD BGCOLOR=\"$color[0]\">" . |
68 | '<B><CENTER>'; |
ec5b189b |
69 | printf (_("Welcome to %s's WebMail system"), $org_name); |
b6d8d08d |
70 | echo '</CENTER></B>'. |
71 | '<TR><TD BGCOLOR="' . $color[4] . '">'. |
76b684a5 |
72 | '<TABLE COLS=2 WIDTH="90%" CELLSPACING=0 CELLPADDING=3 BORDER="0" align="center">'. |
b6d8d08d |
73 | '<TR>'. |
74 | '<TD BGCOLOR="' . $color[4] . '"><CENTER>'; |
ec5b189b |
75 | if ( strlen($org_logo) > 3 ) { |
b6d8d08d |
76 | echo "<IMG SRC=\"$org_logo\">"; |
ec5b189b |
77 | } else { |
b6d8d08d |
78 | echo "<B>$org_name</B>"; |
3302d0d4 |
79 | } |
b6d8d08d |
80 | echo '<BR><CENTER>'; |
ec5b189b |
81 | printf (_("Running SquirrelMail version %s (c) 1999-2001."), $version); |
b6d8d08d |
82 | echo '</CENTER><BR>'. |
83 | '</CENTER></TD></TR><TR>' . |
84 | '<TD BGCOLOR="' . $color[4] . '">' . |
85 | $motd. |
86 | '</TD>'. |
87 | '</TR>'. |
88 | '</TABLE>'. |
89 | '</TD></TR>'. |
90 | '</TABLE>'. |
91 | '</TD></TR></TABLE>'; |
ec5b189b |
92 | } |
3302d0d4 |
93 | |
ec5b189b |
94 | function error_message($message, $mailbox, $sort, $startMessage, $color) { |
95 | $urlMailbox = urlencode($mailbox); |
b6d8d08d |
96 | |
97 | echo '<BR>'. |
76b684a5 |
98 | "<TABLE COLS=1 WIDTH=\"70%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
b6d8d08d |
99 | '<TR>'. |
100 | "<TD BGCOLOR=\"$color[0]\">". |
101 | "<FONT COLOR=\"$color[2]\"><B><CENTER>" . _("ERROR") . '</CENTER></B></FONT>'. |
102 | '</TD></TR><TR><TD>'. |
103 | "<CENTER><BR>$message<BR>\n". |
104 | '<BR>'. |
399846ea |
105 | "<A HREF=\"" . sqm_baseuri() |
106 | . "right_main.php?sort=$sort&startMessage=$startMessage" |
107 | . "&mailbox=$urlMailbox\">"; |
ec5b189b |
108 | printf (_("Click here to return to %s"), $mailbox); |
b6d8d08d |
109 | echo '</A>.'. |
110 | '</TD></TR>'. |
111 | '</TABLE>'; |
ec5b189b |
112 | } |
aa4c3749 |
113 | |
ec5b189b |
114 | function plain_error_message($message, $color) { |
9be8198d |
115 | echo "<br><TABLE COLS=1 WIDTH=\"70%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
b6d8d08d |
116 | '<TR>'. |
117 | "<TD BGCOLOR=\"$color[0]\">". |
118 | "<FONT COLOR=\"$color[2]\"><B><CENTER>" . _("ERROR") . '</CENTER></B></FONT>'. |
119 | '</TD></TR><TR><TD>'. |
120 | "<CENTER><BR>$message". |
121 | '</CENTER>'. |
122 | '</TD></TR>'. |
123 | '</TABLE>'; |
ec5b189b |
124 | } |
b6d8d08d |
125 | |
9be8198d |
126 | function logout_error( $errString, $errTitle = '' ) { |
127 | |
128 | GLOBAL $frame_top, $org_logo, $org_name, $org_logo_width, $org_logo_height, |
c94b297c |
129 | $hide_sm_attributions, $version, $DOCUMENT_ROOT; |
399846ea |
130 | $base_uri = sqm_baseuri(); |
c94b297c |
131 | include_once($DOCUMENT_ROOT . $base_uri . 'functions/page_header.php' ); |
9be8198d |
132 | if ( !isset( $org_logo ) ) { |
133 | // Don't know yet why, but in some accesses $org_logo is not set. |
c94b297c |
134 | include( $DOCUMENT_ROOT . $base_uri . 'config/config.php' ); |
9be8198d |
135 | } |
136 | /* Display width and height like good little people */ |
137 | $width_and_height = ''; |
138 | if (isset($org_logo_width) && is_int($org_logo_width) && $org_logo_width>0) { |
139 | $width_and_height = " WIDTH=\"$org_logo_width\""; |
140 | } |
141 | if (isset($org_logo_height) && is_int($org_logo_height) && $org_logo_height>0) { |
142 | $width_and_height .= " HEIGHT=\"$org_logo_height\""; |
143 | } |
144 | |
145 | if (!isset($frame_top) || $frame_top == '' ) { |
146 | $frame_top = '_top'; |
147 | } |
148 | |
149 | if ( !isset( $color ) ) { |
150 | $color = array(); |
151 | $color[0] = '#DCDCDC'; /* light gray TitleBar */ |
152 | $color[1] = '#800000'; /* red */ |
153 | $color[2] = '#CC0000'; /* light red Warning/Error Messages */ |
154 | $color[3] = '#A0B8C8'; /* green-blue Left Bar Background */ |
155 | $color[4] = '#FFFFFF'; /* white Normal Background */ |
156 | $color[5] = '#FFFFCC'; /* light yellow Table Headers */ |
157 | $color[6] = '#000000'; /* black Text on left bar */ |
158 | $color[7] = '#0000CC'; /* blue Links */ |
159 | $color[8] = '#000000'; /* black Normal text */ |
160 | $color[9] = '#ABABAB'; /* mid-gray Darker version of #0 */ |
161 | $color[10] = '#666666'; /* dark gray Darker version of #9 */ |
162 | $color[11] = '#770000'; /* dark red Special Folders color */ |
163 | $color[12] = '#EDEDED'; |
164 | $color[15] = '#002266'; /* (dark blue) Unselectable folders */ |
165 | } |
166 | |
167 | if ( $errTitle == '' ) { |
168 | $errTitle = $errString; |
169 | } |
170 | set_up_language($squirrelmail_language, true); |
171 | displayHtmlHeader( $errTitle ); |
172 | |
173 | echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n\n" . |
174 | '<CENTER>'. |
175 | "<IMG SRC=\"$org_logo\" ALT=\"" . sprintf(_("%s Logo"), $org_name) . |
176 | "\"$width_and_height><BR>\n". |
177 | ( $hide_sm_attributions ? '' : |
178 | '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n". |
179 | ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) . |
180 | "<table cellspacing=1 cellpadding=0 bgcolor=\"$color[1]\" width=\"70%\"><tr><td>". |
181 | "<TABLE COLS=1 WIDTH=\"100%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
182 | "<TR><TD BGCOLOR=\"$color[0]\">". |
183 | "<FONT COLOR=\"$color[2]\"><B><CENTER>" . _("ERROR") . |
184 | '</CENTER></B></FONT></TD></TR>'. |
185 | '<TR><TD><CENTER>' . $errString . '</CENTER></TD></TR>'. |
186 | "<TR><TD BGCOLOR=\"$color[0]\">". |
187 | "<FONT COLOR=\"$color[2]\"><B><CENTER>". |
c94b297c |
188 | '<a href="' . $base_uri . 'src/login.php" target="' . |
189 | $frame_top . '">' . |
9be8198d |
190 | _("Go to the login page") . "</a></CENTER></B></FONT>". |
191 | '</TD></TR>'. |
192 | '</TABLE></td></tr></table></body></html>'; |
193 | } |
194 | |
195 | ?> |