Some altered error handling - there was still hard-coded output hanging over from before

git-svn-id: file:///svn/phpbb/trunk@5899 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames 2006-05-12 19:43:25 +00:00
parent 22ada4e282
commit aa42a83b9e

View file

@ -446,40 +446,46 @@ class module
* Output an error message * Output an error message
* If skip is true, return and continue execution, else exit * If skip is true, return and continue execution, else exit
* @todo Really should change the caption based on $skip and calling code at some point * @todo Really should change the caption based on $skip and calling code at some point
* @todo This needs testing with a large dataset that generates multiple errors
*/ */
function error($error, $line, $file, $skip = false) function error($error, $line, $file, $skip = false)
{ {
global $lang, $db; global $lang, $db, $template;
if (!$skip)
{
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>';
echo '<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />';
echo '</head>';
echo '<body id="errorpage">';
echo '<div id="wrap">';
echo ' <div id="page-header">';
echo ' </div>';
echo ' <div id="page-body">';
echo ' <div class="panel">';
echo ' <span class="corners-top"><span></span></span>';
echo ' <div id="content">';
echo ' <h1>' . $lang['INST_ERR_FATAL'] . '</h1>';
}
echo ' <p>' . $lang['INST_ERR_FATAL'] . "</p>\n";
echo ' <p>' . basename($file) . ' [ ' . $line . " ]</p>\n";
echo ' <p><b>' . $error . "</b></p>\n";
if ($skip) if ($skip)
{ {
$template->assign_block_vars('checks', array(
'S_LEGEND' => true,
'LEGEND' => $lang['INST_ERR_FATAL'],
));
$template->assign_block_vars('checks', array(
'TITLE' => basename($file) . ' [ ' . $line . ' ]',
'RESULT' => '<b style="color:red">' . $error . '</b>',
));
return; return;
} }
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>';
echo '<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />';
echo '</head>';
echo '<body id="errorpage">';
echo '<div id="wrap">';
echo ' <div id="page-header">';
echo ' </div>';
echo ' <div id="page-body">';
echo ' <div class="panel">';
echo ' <span class="corners-top"><span></span></span>';
echo ' <div id="content">';
echo ' <h1>' . $lang['INST_ERR_FATAL'] . '</h1>';
echo ' <p>' . $lang['INST_ERR_FATAL'] . "</p>\n";
echo ' <p>' . basename($file) . ' [ ' . $line . " ]</p>\n";
echo ' <p><b>' . $error . "</b></p>\n";
echo ' </div>'; echo ' </div>';
echo ' <span class="corners-bottom"><span></span></span>'; echo ' <span class="corners-bottom"><span></span></span>';
echo ' </div>'; echo ' </div>';
@ -505,21 +511,34 @@ class module
*/ */
function db_error($error, $sql, $line, $file, $skip = false) function db_error($error, $sql, $line, $file, $skip = false)
{ {
global $lang, $db; global $lang, $db, $template;
$this->page_header();
echo ' <h2 style="color:red;text-align:center">' . $lang['INST_ERR_FATAL'] . "</h2>\n";
echo ' <p>' . $lang['INST_ERR_FATAL_DB'] . "</p>\n";
echo ' <p>' . basename($file) . ' [ ' . $line . " ]</p>\n";
echo ' <p>SQL : ' . $sql . "</p>\n";
echo ' <p><b>' . $error . "</b></p>\n";
if ($skip) if ($skip)
{ {
$template->assign_block_vars('checks', array(
'S_LEGEND' => true,
'LEGEND' => $lang['INST_ERR_FATAL'],
));
$template->assign_block_vars('checks', array(
'TITLE' => basename($file) . ' [ ' . $line . ' ]',
'RESULT' => '<b style="color:red">' . $error . '</b><br />&#187; SQL:' . $sql,
));
return; return;
} }
$template->set_filenames(array(
'body' => 'install_error.html')
);
$this->page_header();
$this->generate_navigation();
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['INST_ERR_FATAL_DB'],
'MESSAGE_BODY' => '<p>' . basename($file) . ' [ ' . $line . ' ]</p><p>SQL : ' . $sql . '</p><p><b>' . $error . '</b></p>',
));
$db->sql_close(); $db->sql_close();
$this->page_footer(); $this->page_footer();
exit; exit;