use a container div for padding + handle_db_errors function
This commit is contained in:
parent
d17de45965
commit
b161bbcf1b
79
install.php
79
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,6 +68,7 @@ date_default_timezone_set('UTC');
|
||||
<?php if(false) { ?>
|
||||
<div id="installer">
|
||||
<h1>Install Error</h1>
|
||||
<div class="container">
|
||||
<p>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.</p>
|
||||
@ -72,6 +76,7 @@ date_default_timezone_set('UTC');
|
||||
want to visit <a href="http://localhost/">the local web server</a>.<br/><br/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: none;">
|
||||
<PLAINTEXT>
|
||||
<?php }
|
||||
@ -207,6 +212,7 @@ function ask_questions() { // {{{
|
||||
<div id="installer">
|
||||
<h1>Shimmie Installer</h1>
|
||||
|
||||
<div class="container">
|
||||
$warn_msg
|
||||
$err_msg
|
||||
|
||||
@ -267,7 +273,7 @@ function ask_questions() { // {{{
|
||||
Drivers can generally be downloaded with your OS package manager;
|
||||
for Debian / Ubuntu you want php5-pgsql, php5-mysql, or php5-sqlite.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
EOD;
|
||||
} // }}}
|
||||
@ -290,11 +296,13 @@ function create_tables() { // {{{
|
||||
print <<<EOD
|
||||
<div id="installer">
|
||||
<h1>Shimmie Installer</h1>
|
||||
<div class="container">
|
||||
<h3>Warning: The Database schema is not empty!</h3>
|
||||
<p>Please ensure that the database you are installing Shimmie with is empty before continuing.</p>
|
||||
<p>Once you have emptied the database of any tables, please hit 'refresh' to continue.</p>
|
||||
<br/><br/>
|
||||
</div>
|
||||
</div>
|
||||
EOD;
|
||||
exit(2);
|
||||
}
|
||||
@ -362,28 +370,9 @@ EOD;
|
||||
$db->commit();
|
||||
}
|
||||
catch(PDOException $e) {
|
||||
print <<<EOD
|
||||
<div id="installer">
|
||||
<h1>Shimmie Installer</h1>
|
||||
<h3>Database Error:</h3>
|
||||
<p>An error occured while trying to create the database tables necessary for Shimmie.</p>
|
||||
<p>Please check and ensure that the database configuration options are all correct.</p>
|
||||
<p>{$e->getMessage()}</p>
|
||||
</div>
|
||||
EOD;
|
||||
exit(3);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
print <<<EOD
|
||||
<div id="installer">
|
||||
<h1>Shimmie Installer</h1>
|
||||
<h3>Unknown Error:</h3>
|
||||
<p>An unknown error occured while trying to create the database tables necessary for Shimmie.</p>
|
||||
<p>Please check the server log files for more information.</p>
|
||||
<p>{$e->getMessage()}</p>
|
||||
</div>
|
||||
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 <<<EOD
|
||||
<div id="installer">
|
||||
<h1>Shimmie Installer</h1>
|
||||
<h3>Database Error:</h3>
|
||||
<p>An error occured while trying to insert data into the database.</p>
|
||||
<p>Please check and ensure that the database configuration options are all correct.</p>
|
||||
<p>{$e->getMessage()}</p>
|
||||
</div>
|
||||
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 <<<EOD
|
||||
<div id="installer">
|
||||
<h1>Shimmie Installer</h1>
|
||||
<h3>Unknown Error:</h3>
|
||||
<p>An unknown error occured while trying to insert data into the database.</p>
|
||||
<p>Please check the server log files for more information.</p>
|
||||
<p>{$e->getMessage()}</p>
|
||||
</div>
|
||||
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 <<<EOD
|
||||
<div id="installer">
|
||||
<h1>Shimmie Installer</h1>
|
||||
<div class="container">
|
||||
<h3>Unknown Error:</h3>
|
||||
<p>{$errorMessage1}</p>
|
||||
<p>{$errorMessage1Extra}</p>
|
||||
<p>{$errorMessage2}</p>
|
||||
</div>
|
||||
</div>
|
||||
EOD;
|
||||
exit($exitCode);
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user