From aa42a83b9e881b8a98d2681323be831777817c11 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Fri, 12 May 2006 19:43:25 +0000 Subject: [PATCH] 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 --- phpBB/install/index.php | 87 +++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 530fae7bf2..742137f541 100755 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -446,40 +446,46 @@ class module * Output an error message * 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 This needs testing with a large dataset that generates multiple errors */ function error($error, $line, $file, $skip = false) { - global $lang, $db; - - if (!$skip) - { - echo ''; - echo ''; - echo ''; - echo ''; - echo '' . $lang['INST_ERR_FATAL'] . ''; - echo ''; - echo ''; - echo ''; - echo '
'; - echo ' '; - echo '
'; - echo '
'; - echo ' '; - echo '
'; - echo '

' . $lang['INST_ERR_FATAL'] . '

'; - } - - echo '

' . $lang['INST_ERR_FATAL'] . "

\n"; - echo '

' . basename($file) . ' [ ' . $line . " ]

\n"; - echo '

' . $error . "

\n"; + global $lang, $db, $template; 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' => '' . $error . '', + )); + return; } + echo ''; + echo ''; + echo ''; + echo ''; + echo '' . $lang['INST_ERR_FATAL'] . ''; + echo ''; + echo ''; + echo ''; + echo '
'; + echo ' '; + echo '
'; + echo '
'; + echo ' '; + echo '
'; + echo '

' . $lang['INST_ERR_FATAL'] . '

'; + echo '

' . $lang['INST_ERR_FATAL'] . "

\n"; + echo '

' . basename($file) . ' [ ' . $line . " ]

\n"; + echo '

' . $error . "

\n"; echo '
'; echo ' '; echo '
'; @@ -505,21 +511,34 @@ class module */ function db_error($error, $sql, $line, $file, $skip = false) { - global $lang, $db; - - $this->page_header(); - - echo '

' . $lang['INST_ERR_FATAL'] . "

\n"; - echo '

' . $lang['INST_ERR_FATAL_DB'] . "

\n"; - echo '

' . basename($file) . ' [ ' . $line . " ]

\n"; - echo '

SQL : ' . $sql . "

\n"; - echo '

' . $error . "

\n"; + global $lang, $db, $template; 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' => '' . $error . '
» SQL:' . $sql, + )); + 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' => '

' . basename($file) . ' [ ' . $line . ' ]

SQL : ' . $sql . '

' . $error . '

', + )); + $db->sql_close(); $this->page_footer(); exit;