diff --git a/install.php b/install.php index c3dc4fdb..595a2e79 100644 --- a/install.php +++ b/install.php @@ -37,6 +37,9 @@ date_default_timezone_set('UTC'); border: 1px solid black; border-radius: 16px; } + #installer > .container { + padding: 5px; + } #installer A { text-decoration: none; } @@ -65,12 +68,14 @@ date_default_timezone_set('UTC');
Shimmie needs to be run via a web server with PHP support -- you - appear to be either opening the file from your hard disk, or your - web server is mis-configured and doesn't know how to handle PHP files.
-If you've installed a web server on your desktop PC, you probably
- want to visit the local web server.
-
Shimmie needs to be run via a web server with PHP support -- you + appear to be either opening the file from your hard disk, or your + web server is mis-configured and doesn't know how to handle PHP files.
+If you've installed a web server on your desktop PC, you probably
+ want to visit the local web server.
+
An error occured while trying to create the database tables necessary for Shimmie.
-Please check and ensure that the database configuration options are all correct.
-{$e->getMessage()}
- -EOD; - exit(3); - } - catch (Exception $e) { - print <<An unknown error occured while trying to create the database tables necessary for Shimmie.
-Please check the server log files for more information.
-{$e->getMessage()}
- -EOD; - exit(4); + handle_db_errors(TRUE, "An error occurred while trying to create the database tables necessary for Shimmie.", $e->getMessage(), 3); + } catch (Exception $e) { + handle_db_errors(FALSE, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 4); } } // }}} @@ -399,31 +388,11 @@ function insert_defaults() { // {{{ } $db->commit(); } - catch(PDOException $e) - { - print <<An error occured while trying to insert data into the database.
-Please check and ensure that the database configuration options are all correct.
-{$e->getMessage()}
- -EOD; - exit(5); + catch(PDOException $e) { + handle_db_errors(TRUE, "An error occurred while trying to insert data into the database.", $e->getMessage(), 5); } - catch (Exception $e) - { - print <<An unknown error occured while trying to insert data into the database.
-Please check the server log files for more information.
-{$e->getMessage()}
- -EOD; - exit(6); + catch (Exception $e) { + handle_db_errors(FALSE, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 6); } } // }}} @@ -498,6 +467,22 @@ EOD; } echo "\n"; } // }}} + +function handle_db_errors(/*bool*/ $isPDO, /*str*/ $errorMessage1, /*str*/ $errorMessage2, /*int*/ $exitCode) { + $errorMessage1Extra = ($isPDO ? "Please check and ensure that the database configuration options are all correct." : "Please check the server log files for more information."); + print <<{$errorMessage1}
+{$errorMessage1Extra}
+{$errorMessage2}
+