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: 1px solid black;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
}
|
}
|
||||||
|
#installer > .container {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
#installer A {
|
#installer A {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@ -65,6 +68,7 @@ date_default_timezone_set('UTC');
|
|||||||
<?php if(false) { ?>
|
<?php if(false) { ?>
|
||||||
<div id="installer">
|
<div id="installer">
|
||||||
<h1>Install Error</h1>
|
<h1>Install Error</h1>
|
||||||
|
<div class="container">
|
||||||
<p>Shimmie needs to be run via a web server with PHP support -- you
|
<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
|
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>
|
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/>
|
want to visit <a href="http://localhost/">the local web server</a>.<br/><br/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div style="display: none;">
|
<div style="display: none;">
|
||||||
<PLAINTEXT>
|
<PLAINTEXT>
|
||||||
<?php }
|
<?php }
|
||||||
@ -207,6 +212,7 @@ function ask_questions() { // {{{
|
|||||||
<div id="installer">
|
<div id="installer">
|
||||||
<h1>Shimmie Installer</h1>
|
<h1>Shimmie Installer</h1>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
$warn_msg
|
$warn_msg
|
||||||
$err_msg
|
$err_msg
|
||||||
|
|
||||||
@ -267,7 +273,7 @@ function ask_questions() { // {{{
|
|||||||
Drivers can generally be downloaded with your OS package manager;
|
Drivers can generally be downloaded with your OS package manager;
|
||||||
for Debian / Ubuntu you want php5-pgsql, php5-mysql, or php5-sqlite.
|
for Debian / Ubuntu you want php5-pgsql, php5-mysql, or php5-sqlite.
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
EOD;
|
EOD;
|
||||||
} // }}}
|
} // }}}
|
||||||
@ -290,11 +296,13 @@ function create_tables() { // {{{
|
|||||||
print <<<EOD
|
print <<<EOD
|
||||||
<div id="installer">
|
<div id="installer">
|
||||||
<h1>Shimmie Installer</h1>
|
<h1>Shimmie Installer</h1>
|
||||||
|
<div class="container">
|
||||||
<h3>Warning: The Database schema is not empty!</h3>
|
<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>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>
|
<p>Once you have emptied the database of any tables, please hit 'refresh' to continue.</p>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
EOD;
|
EOD;
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
@ -362,28 +370,9 @@ EOD;
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
catch(PDOException $e) {
|
catch(PDOException $e) {
|
||||||
print <<<EOD
|
handle_db_errors(TRUE, "An error occurred while trying to create the database tables necessary for Shimmie.", $e->getMessage(), 3);
|
||||||
<div id="installer">
|
} catch (Exception $e) {
|
||||||
<h1>Shimmie Installer</h1>
|
handle_db_errors(FALSE, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 4);
|
||||||
<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);
|
|
||||||
}
|
}
|
||||||
} // }}}
|
} // }}}
|
||||||
|
|
||||||
@ -399,31 +388,11 @@ function insert_defaults() { // {{{
|
|||||||
}
|
}
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
catch(PDOException $e)
|
catch(PDOException $e) {
|
||||||
{
|
handle_db_errors(TRUE, "An error occurred while trying to insert data into the database.", $e->getMessage(), 5);
|
||||||
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 (Exception $e)
|
catch (Exception $e) {
|
||||||
{
|
handle_db_errors(FALSE, "An unknown error occurred while trying to insert data into the database.", $e->getMessage(), 6);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
} // }}}
|
} // }}}
|
||||||
|
|
||||||
@ -498,6 +467,22 @@ EOD;
|
|||||||
}
|
}
|
||||||
echo "\n";
|
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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user