r3732 init.php: consider missing config file a E_MISCONFIGURED type of exception
authorDenis Ovsienko <infrastation@yandex.ru>
Thu, 3 Jun 2010 15:58:38 +0000 (15:58 +0000)
committerDenis Ovsienko <infrastation@yandex.ru>
Thu, 3 Jun 2010 15:58:38 +0000 (15:58 +0000)
printException(): handle the case

inc/exceptions.php
inc/init.php

index 27d2886c1d8866cd4481d28e1dd5037661aca56f..0926991a19d4c4086fd8034a2011c4e2daf479f9 100644 (file)
@@ -205,12 +205,22 @@ function printException($e)
                case E_NOT_AUTHENTICATED:
                        header ('WWW-Authenticate: Basic realm="' . getConfigVar ('enterprise') . ' RackTables access"');
                        header ("HTTP/1.1 401 Unauthorized");
+               case E_MISCONFIGURED:
                        header ('Content-Type: text/html; charset=UTF-8');
                        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
                        echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'."\n";
-                       echo "<head><title>Not authenticated</title>\n";
-                       printPageHeaders();
-                       echo '</head><body><h2>This system requires authentication. You should use a username and a password.</h2></body></html>';
+                       $msgheader = array
+                       (
+                               E_NOT_AUTHENTICATED => 'Not authenticated',
+                               E_MISCONFIGURED => 'Configuration error',
+                       );
+                       $msgbody = array
+                       (
+                               E_NOT_AUTHENTICATED => '<h2>This system requires authentication. You should use a username and a password.</h2>',
+                               E_MISCONFIGURED => '<h2>Configuration error</h2><br>' . $e->getMessage(),
+                       );
+                       echo '<head><title>' . $msgheader[$e->getCode()] . '</title>';
+                       echo '</head><body>' . $msgbody[$e->getCode()] . '</body></html>';
                        return;
                default:
                }
index 069213209d25b18bfc9ad8f1cf6f3bea62e74742..534dc82088e0cd2ab47030879decc79d8bfd7ea7 100644 (file)
@@ -62,9 +62,9 @@ else
        throw new Exception
        (
                "Database connection parameters are read from inc/secret.php file, " .
-               "which cannot be found.\nYou probably need to complete the installation " .
+               "which cannot be found.<br>You probably need to complete the installation " .
                "procedure by following <a href='install.php'>this link</a>.",
-               E_INTERNAL
+               E_MISCONFIGURED
        );
 }