59177427 |
1 | <?php |
2ba13803 |
2 | |
35586184 |
3 | /** |
4 | * display_messages.php |
5 | * |
76911253 |
6 | * Copyright (c) 1999-2003 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$ |
d6c32258 |
13 | * @package squirrelmail |
35586184 |
14 | */ |
3302d0d4 |
15 | |
c94b297c |
16 | /** |
17 | * Find out where squirrelmail lives and try to be smart about it. |
18 | * The only problem would be when squirrelmail lives in directories |
19 | * called "src", "functions", or "plugins", but people who do that need |
20 | * to be beaten with a steel pipe anyway. |
21 | * |
d6c32258 |
22 | * @return string the base uri of squirrelmail installation. |
c94b297c |
23 | */ |
399846ea |
24 | function sqm_baseuri(){ |
25 | global $base_uri, $PHP_SELF; |
c94b297c |
26 | /** |
27 | * If it is in the session, just return it. |
28 | */ |
399846ea |
29 | if (isset($base_uri)){ |
30 | return $base_uri; |
31 | } |
7e156b3d |
32 | $dirs = array('|src/.*|', '|plugins/.*|', '|functions/.*|'); |
33 | $repl = array('', '', ''); |
399846ea |
34 | $base_uri = preg_replace($dirs, $repl, $PHP_SELF); |
35 | return $base_uri; |
36 | } |
37 | |
ec5b189b |
38 | function error_message($message, $mailbox, $sort, $startMessage, $color) { |
39 | $urlMailbox = urlencode($mailbox); |
b6d8d08d |
40 | |
fd2611e9 |
41 | $string = '<tr><td ALIGN="center">' . $message . '</td></tr>'."\n". |
42 | '<tr><td ALIGN="center">'. |
43 | '<A HREF="' . sqm_baseuri() |
90d3887e |
44 | . "src/right_main.php?sort=$sort&startMessage=$startMessage" |
fd2611e9 |
45 | . "&mailbox=$urlMailbox\">" . |
46 | sprintf (_("Click here to return to %s"), $mailbox) . |
47 | '</A></td></tr>'; |
48 | error_box($string, $color); |
ec5b189b |
49 | } |
aa4c3749 |
50 | |
ec5b189b |
51 | function plain_error_message($message, $color) { |
fd2611e9 |
52 | error_box($message, $color); |
ec5b189b |
53 | } |
b6d8d08d |
54 | |
9be8198d |
55 | function logout_error( $errString, $errTitle = '' ) { |
1f05436e |
56 | global $frame_top, $org_logo, $org_name, $org_logo_width, $org_logo_height, |
35185c82 |
57 | $hide_sm_attributions, $version, $squirrelmail_language; |
58 | |
399846ea |
59 | $base_uri = sqm_baseuri(); |
26f9a94a |
60 | |
61 | include_once( SM_PATH . 'functions/page_header.php' ); |
9be8198d |
62 | if ( !isset( $org_logo ) ) { |
63 | // Don't know yet why, but in some accesses $org_logo is not set. |
26f9a94a |
64 | include( SM_PATH . 'config/config.php' ); |
9be8198d |
65 | } |
66 | /* Display width and height like good little people */ |
67 | $width_and_height = ''; |
e16cb07b |
68 | if (isset($org_logo_width) && is_numeric($org_logo_width) && $org_logo_width>0) { |
9be8198d |
69 | $width_and_height = " WIDTH=\"$org_logo_width\""; |
70 | } |
e16cb07b |
71 | if (isset($org_logo_height) && is_numeric($org_logo_height) && $org_logo_height>0) { |
9be8198d |
72 | $width_and_height .= " HEIGHT=\"$org_logo_height\""; |
73 | } |
74 | |
75 | if (!isset($frame_top) || $frame_top == '' ) { |
76 | $frame_top = '_top'; |
77 | } |
78 | |
79 | if ( !isset( $color ) ) { |
80 | $color = array(); |
81 | $color[0] = '#DCDCDC'; /* light gray TitleBar */ |
82 | $color[1] = '#800000'; /* red */ |
83 | $color[2] = '#CC0000'; /* light red Warning/Error Messages */ |
9be8198d |
84 | $color[4] = '#FFFFFF'; /* white Normal Background */ |
9be8198d |
85 | $color[7] = '#0000CC'; /* blue Links */ |
86 | $color[8] = '#000000'; /* black Normal text */ |
9be8198d |
87 | } |
88 | |
89 | if ( $errTitle == '' ) { |
90 | $errTitle = $errString; |
91 | } |
92 | set_up_language($squirrelmail_language, true); |
1f05436e |
93 | |
94 | displayHtmlHeader( $errTitle, '', false ); |
95 | |
9be8198d |
96 | echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n\n" . |
4cbcaebd |
97 | '<CENTER>'; |
98 | |
99 | if (isset($org_logo) && ($org_logo != '')) { |
100 | echo "<IMG SRC=\"$org_logo\" ALT=\"" . sprintf(_("%s Logo"), $org_name) . |
101 | "\"$width_and_height><BR>\n"; |
102 | } |
103 | echo ( $hide_sm_attributions ? '' : |
9be8198d |
104 | '<SMALL>' . sprintf (_("SquirrelMail version %s"), $version) . "<BR>\n". |
105 | ' ' . _("By the SquirrelMail Development Team") . "<BR></SMALL>\n" ) . |
106 | "<table cellspacing=1 cellpadding=0 bgcolor=\"$color[1]\" width=\"70%\"><tr><td>". |
c9062c05 |
107 | "<TABLE WIDTH=\"100%\" BORDER=\"0\" BGCOLOR=\"$color[4]\" ALIGN=CENTER>". |
108 | "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=\"center\">". |
109 | "<FONT COLOR=\"$color[2]\"><B>" . _("ERROR") . |
110 | '</B></FONT></TD></TR>'. |
111 | '<TR><TD ALIGN="center">' . $errString . '</TD></TR>'. |
112 | "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=\"center\">". |
113 | "<FONT COLOR=\"$color[2]\"><B>". |
c94b297c |
114 | '<a href="' . $base_uri . 'src/login.php" target="' . |
115 | $frame_top . '">' . |
c9062c05 |
116 | _("Go to the login page") . "</a></B></FONT>". |
9be8198d |
117 | '</TD></TR>'. |
1f05436e |
118 | '</TABLE></td></tr></table></center></body></html>'; |
9be8198d |
119 | } |
120 | |
fd2611e9 |
121 | function error_box($string, $color) { |
b6c283c4 |
122 | global $pageheader_sent; |
123 | |
124 | $err = _("ERROR"); |
125 | |
126 | /* check if the page header has been sent; if not, send it! */ |
127 | if(!isset($pageheader_sent) && !$pageheader_sent) { |
128 | /* include this just to be sure */ |
129 | include_once( SM_PATH . 'functions/page_header.php' ); |
130 | displayHtmlHeader('SquirrelMail: '.$err); |
131 | $pageheader_sent = TRUE; |
132 | echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\">\n\n"; |
133 | } |
134 | |
36ec6865 |
135 | echo ' <table width="100%" cellpadding="1" cellspacing="0" align="center"'.' border="0" bgcolor="'.$color[9].'">'; |
136 | echo ' <tr><td>'; |
137 | echo ' <table width="100%" cellpadding="0" cellspacing="0" align="center" border="0" bgcolor="'.$color[4].'">'; |
138 | echo ' <tr><td ALIGN="center" bgcolor="'.$color[0].'">'; |
472e7acb |
139 | echo ' <font color="' . $color[2].'"><b>' . $err . ':</b></font>'; |
36ec6865 |
140 | echo ' </td></tr>'; |
141 | echo ' <tr><td>'; |
142 | echo ' <table cellpadding="1" cellspacing="5" align="center" border="0">'; |
143 | echo ' <tr>' . html_tag( 'td', $string."\n", 'left') |
144 | . '</tr>'; |
145 | echo ' </table>'; |
146 | echo ' </table></td></tr>'; |
147 | echo ' </table>'; |
148 | echo ' </td></tr>'; |
fd2611e9 |
149 | } |
6a6ce0a3 |
150 | ?> |