thomascube
2008-09-18 7dfb1fba5001299300736e6b5d95d9400575e3e7
commit | author | age
4e17e6 1 <?php
T 2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/error.inc                                               |
6  |                                                                       |
7  | This file is part of the RoundCube Webmail client                     |
8c72e3 8  | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland                 |
30233b 9  | Licensed under the GNU GPL                                            |
4e17e6 10  |                                                                       |
T 11  | PURPOSE:                                                              |
12  |   Display error message page                                          |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16  +-----------------------------------------------------------------------+
17
18  $Id$
19
20 */
21
22
23 // browser is not compatible with this application
8c72e3 24 if ($ERROR_CODE==409) {
4e17e6 25   $user_agent = $GLOBALS['HTTP_SERVER_VARS']['HTTP_USER_AGENT'];
T 26   $__error_title = 'Your browser does not suit the requirements for this application';
27   $__error_text = <<<EOF
28 <i>Supported browsers:</i><br />
29 &raquo; &nbsp;Netscape 7+<br />
30 &raquo; &nbsp;Microsoft Internet Explorer 6+<br />
31 &raquo; &nbsp;Mozilla Firefox 1.0+<br />
32 &raquo; &nbsp;Opera 8.0+<br />
33 &raquo; &nbsp;Safari 1.2+<br />
34 <br />
35 &raquo; &nbsp;JavaScript enabled<br />
a95e0e 36 &raquo; &nbsp;Support for XMLHTTPRequest<br />
4e17e6 37
T 38 <p><i>Your configuration:</i><br />
39 $user_agent</p>
40 EOF;
8c72e3 41 }
4e17e6 42
T 43 // authorization error
8c72e3 44 else if ($ERROR_CODE==401) {
4e17e6 45   $__error_title = "AUTHORIZATION FAILED";
T 46   $__error_text  = "Could not verify that you are authorized to access this service!<br />\n".
47                    "Please contact your server-administrator.";
8c72e3 48 }
4e17e6 49   
T 50 // failed request (wrong step in URL)
8c72e3 51 else if ($ERROR_CODE==404) {
4e17e6 52   $__error_title = "REQUEST FAILED/FILE NOT FOUND";
89406f 53   $request_url = htmlentities($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
4e17e6 54   $__error_text  = <<<EOF
T 55 The requested page was not found!<br />
56 Please contact your server-administrator.
57
58 <p><i>Failed request:</i><br />
59 http://$request_url</p>
60 EOF;
8c72e3 61 }
4e17e6 62
8b0fff 63 // database connection error
8c72e3 64 else if ($ERROR_CODE==601)
T 65 {
66   $__error_title = "CONFIGURATION ERROR";
67   $__error_text  =  nl2br($ERROR_MESSAGE) . "<br />Please read the INSTALL instructions!";
68 }
69
70 // database connection error
71 else if ($ERROR_CODE==603) {
8b0fff 72   $__error_title = "DATABASE ERROR: CONNECTION FAILED!";
8c72e3 73   $__error_text  =  "Unable to connect to the database!<br />Please contact your server-administrator.";
T 74 }
4e17e6 75
T 76 // system error
8c72e3 77 else {
4e17e6 78   $__error_title = "SERVICE CURRENTLY NOT AVAILABLE!";
T 79   $__error_text  = "Please contact your server-administrator.";
e170b4 80
4e17e6 81   if (($CONFIG['debug_level'] & 4) && $ERROR_MESSAGE)
T 82     $__error_text = $ERROR_MESSAGE;
83   else
c45eb5 84     $__error_text = sprintf('Error No. [0x%04X]', $ERROR_CODE);
8c72e3 85 }
4e17e6 86
T 87
88 // compose page content
89
90 $__page_content = <<<EOF
91 <div>
92 <h3 class="error-title">$__error_title</h3>
93 <p class="error-text">$__error_text</p>
94 </div>
95 EOF;
96
97
98
8c72e3 99 if ($OUTPUT && $OUTPUT->template_exists('error')) {
4c6b66 100   $OUTPUT->reset();
47124c 101   $OUTPUT->send('error');
8c72e3 102 }
4e17e6 103
T 104
105 // print system error page
106 print <<<EOF
107 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
108 <html xmlns="http://www.w3.org/1999/xhtml"><head>
109 <title>RoundCube|Mail : ERROR $ERROR_CODE</title>
110 <link rel="stylesheet" type="text/css" href="program/style.css" />
111 </head>
112 <body>
113
114 <table border="0" cellsapcing="0" cellpadding="0" width="100%" height="80%"><tr><td align="center">
115
116 $__page_content
117
118 </td></tr></table>
119
120 </body>
121 </html>
122 EOF;
123
8c72e3 124 exit;
5349b7 125 ?>