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 | } |
7e156b3d |
31 | $dirs = array('|src/.*|', '|plugins/.*|', '|functions/.*|'); |
32 | $repl = array('', '', ''); |
399846ea |
33 | $base_uri = preg_replace($dirs, $repl, $PHP_SELF); |
34 | return $base_uri; |
35 | } |
36 | |
7e156b3d |
37 | /** |
38 | * Find out the top REAL path of the squirrelmail installation. |
39 | * |
40 | * @return the real installation directory of squirrelmail. |
41 | */ |
42 | |
43 | function sqm_topdir(){ |
44 | $topdir = ''; |
45 | /** |
46 | * $levels is just to avoid a potential infinite loop in case |
47 | * things are REALLY broken. Shouldn't really ever happen. |
48 | */ |
49 | $levels = 0; |
50 | while (!(is_dir("$topdir/functions") && is_dir("$topdir/src")) |
51 | && $levels < 10){ |
52 | $topdir .= '../'; |
53 | $levels++; |
54 | } |
55 | return $topdir; |
56 | } |
57 | |
ec5b189b |
58 | function error_username_password_incorrect() { |
1cf38f19 |
59 | global $frame_top, $color; |
76b684a5 |
60 | /* XXX: Should really not start the HTML before this, or close off more |
61 | cleanly. */ |
2ba13803 |
62 | |
d03f3582 |
63 | if (!isset($frame_top)) { |
64 | $frame_top = '_top'; |
65 | } |
66 | |
35586184 |
67 | echo '<BR>'. |
76b684a5 |
68 | '<TABLE COLS=1 WIDTH="75%" BORDER="0" BGCOLOR="' . $color[4] . '" ALIGN=CENTER>'. |
26f277a6 |
69 | '<TR BGCOLOR="' . $color[0] . '">'. |
ec5b189b |
70 | '<TH>' . _("ERROR") . '</TH>'. |
71 | '</TR>' . |
c9062c05 |
72 | '<TR><TD ALIGN="center">'. |
73 | '<BR>' . _("Unknown user or password incorrect.") . |
399846ea |
74 | '<BR><A HREF="' . sqm_baseuri() . '"login.php" TARGET='. |
75 | $frame_top.'>' . _("Click here to try again") . |
c9062c05 |
76 | '</A>.'. |
ec5b189b |
77 | '</TD></TR>'. |
2ba13803 |
78 | '</TABLE>'. |
79 | '</BODY></HTML>'; |
ec5b189b |
80 | } |
2ba13803 |
81 | |
ec5b189b |
82 | function error_message($message, $mailbox, $sort, $startMessage, $color) { |
83 | $urlMailbox = urlencode($mailbox); |
b6d8d08d |
84 | |
85 | echo '<BR>'. |
c9062c05 |
86 | "<TABLE WIDTH=\"70%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
b6d8d08d |
87 | '<TR>'. |
c9062c05 |
88 | "<TD BGCOLOR=\"$color[0]\" ALIGN=\"center\">". |
89 | "<FONT COLOR=\"$color[2]\"><B>" . _("ERROR") . '</B></FONT>'. |
90 | '</TD></TR><TR><TD ALIGN="center">'. |
91 | "<BR>$message<BR>\n". |
b6d8d08d |
92 | '<BR>'. |
399846ea |
93 | "<A HREF=\"" . sqm_baseuri() |
90d3887e |
94 | . "src/right_main.php?sort=$sort&startMessage=$startMessage" |
399846ea |
95 | . "&mailbox=$urlMailbox\">"; |
ec5b189b |
96 | printf (_("Click here to return to %s"), $mailbox); |
b6d8d08d |
97 | echo '</A>.'. |
98 | '</TD></TR>'. |
99 | '</TABLE>'; |
ec5b189b |
100 | } |
aa4c3749 |
101 | |
ec5b189b |
102 | function plain_error_message($message, $color) { |
c9062c05 |
103 | echo "<br><TABLE WIDTH=\"70%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
b6d8d08d |
104 | '<TR>'. |
c9062c05 |
105 | "<TD BGCOLOR=\"$color[0]\" ALIGN=\"center\">". |
106 | "<FONT COLOR=\"$color[2]\"><B>" . _("ERROR") . '</B></FONT>'. |
107 | '</TD></TR><TR><TD ALIGN="center">'. |
108 | "<BR>$message". |
b6d8d08d |
109 | '</TD></TR>'. |
110 | '</TABLE>'; |
ec5b189b |
111 | } |
b6d8d08d |
112 | |
9be8198d |
113 | function logout_error( $errString, $errTitle = '' ) { |
1f05436e |
114 | global $frame_top, $org_logo, $org_name, $org_logo_width, $org_logo_height, |
35185c82 |
115 | $hide_sm_attributions, $version, $squirrelmail_language; |
116 | |
399846ea |
117 | $base_uri = sqm_baseuri(); |
7e156b3d |
118 | $topdir = sqm_topdir(); |
119 | include_once( "$topdir/functions/page_header.php" ); |
9be8198d |
120 | if ( !isset( $org_logo ) ) { |
121 | // Don't know yet why, but in some accesses $org_logo is not set. |
7e156b3d |
122 | include( "$topdir/config/config.php" ); |
9be8198d |
123 | } |
124 | /* Display width and height like good little people */ |
125 | $width_and_height = ''; |
126 | if (isset($org_logo_width) && is_int($org_logo_width) && $org_logo_width>0) { |
127 | $width_and_height = " WIDTH=\"$org_logo_width\""; |
128 | } |
129 | if (isset($org_logo_height) && is_int($org_logo_height) && $org_logo_height>0) { |
130 | $width_and_height .= " HEIGHT=\"$org_logo_height\""; |
131 | } |
132 | |
133 | if (!isset($frame_top) || $frame_top == '' ) { |
134 | $frame_top = '_top'; |
135 | } |
136 | |
137 | if ( !isset( $color ) ) { |
138 | $color = array(); |
139 | $color[0] = '#DCDCDC'; /* light gray TitleBar */ |
140 | $color[1] = '#800000'; /* red */ |
141 | $color[2] = '#CC0000'; /* light red Warning/Error Messages */ |
142 | $color[3] = '#A0B8C8'; /* green-blue Left Bar Background */ |
143 | $color[4] = '#FFFFFF'; /* white Normal Background */ |
144 | $color[5] = '#FFFFCC'; /* light yellow Table Headers */ |
145 | $color[6] = '#000000'; /* black Text on left bar */ |
146 | $color[7] = '#0000CC'; /* blue Links */ |
147 | $color[8] = '#000000'; /* black Normal text */ |
148 | $color[9] = '#ABABAB'; /* mid-gray Darker version of #0 */ |
149 | $color[10] = '#666666'; /* dark gray Darker version of #9 */ |
150 | $color[11] = '#770000'; /* dark red Special Folders color */ |
151 | $color[12] = '#EDEDED'; |
152 | $color[15] = '#002266'; /* (dark blue) Unselectable folders */ |
153 | } |
154 | |
155 | if ( $errTitle == '' ) { |
156 | $errTitle = $errString; |
157 | } |
158 | set_up_language($squirrelmail_language, true); |
1f05436e |
159 | |
160 | displayHtmlHeader( $errTitle, '', false ); |
161 | |
9be8198d |
162 | echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n\n" . |
163 | '<CENTER>'. |
164 | "<IMG SRC=\"$org_logo\" ALT=\"" . sprintf(_("%s Logo"), $org_name) . |
165 | "\"$width_and_height><BR>\n". |
166 | ( $hide_sm_attributions ? '' : |
167 | '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n". |
168 | ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) . |
169 | "<table cellspacing=1 cellpadding=0 bgcolor=\"$color[1]\" width=\"70%\"><tr><td>". |
c9062c05 |
170 | "<TABLE WIDTH=\"100%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
171 | "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=\"center\">". |
172 | "<FONT COLOR=\"$color[2]\"><B>" . _("ERROR") . |
173 | '</B></FONT></TD></TR>'. |
174 | '<TR><TD ALIGN="center">' . $errString . '</TD></TR>'. |
175 | "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=\"center\">". |
176 | "<FONT COLOR=\"$color[2]\"><B>". |
c94b297c |
177 | '<a href="' . $base_uri . 'src/login.php" target="' . |
178 | $frame_top . '">' . |
c9062c05 |
179 | _("Go to the login page") . "</a></B></FONT>". |
9be8198d |
180 | '</TD></TR>'. |
1f05436e |
181 | '</TABLE></td></tr></table></center></body></html>'; |
9be8198d |
182 | } |
183 | |
6a6ce0a3 |
184 | ?> |