diff --git a/phpBB/db.php b/phpBB/db.php index 3f37068919..951235eabe 100644 --- a/phpBB/db.php +++ b/phpBB/db.php @@ -37,6 +37,10 @@ switch($dbms) break; } + +// Setup what template to use. Currently just use default +$template = new Template("./templates/Default", "keep"); + // Make the database connection. $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false); if(!$db) @@ -59,7 +63,7 @@ $userdata = Array(); $sql = "SELECT * FROM ".CONFIG_TABLE." WHERE selected = 1"; if(!$result = $db->sql_query($sql)) { - error_die($db, QUERY_ERROR); + error_die($db, SQL_CONNECT); } else { @@ -110,7 +114,4 @@ if (!$user_logged_in) } } -// Setup what template to use. Currently just use default -$template = new Template("./templates/Default", "keep"); - ?> diff --git a/phpBB/functions/error.php b/phpBB/functions/error.php index 6b53da1838..f8182335f2 100644 --- a/phpBB/functions/error.php +++ b/phpBB/functions/error.php @@ -25,6 +25,11 @@ function error_die($db, $error_code = "", $error_msg = "") { global $template, $phpEx; + + if(!$template->get("overall_header")) + { + include('page_header.'.$phpEx); + } if(!$error_msg) { switch($error_code) diff --git a/phpBB/functions/functions.php b/phpBB/functions/functions.php index 941ccd0e22..5d660f8db9 100644 --- a/phpBB/functions/functions.php +++ b/phpBB/functions/functions.php @@ -76,39 +76,51 @@ function get_newest_user($db) function make_jumpbox($db, $phpEx) { - $boxstring = "
"; diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 03368d71b8..b11ae6143f 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -30,27 +30,36 @@ include('functions/functions.'.$phpEx); include('functions/error.'.$phpEx); include('db.'.$phpEx); +// Check if the user has acutally sent a forum ID with his/her request +// If not give them a nice error page. if(isset($forum_id)) { $sql = "SELECT f.forum_type, f.forum_name - FROM ".FORUMS_TABLE." f - WHERE forum_id = '$forum_id'"; + FROM ".FORUMS_TABLE." f + WHERE forum_id = '$forum_id'"; } else { - error_die($db, "You have reached this page in error, please go back and try again"); + error_die($db, "", "You have reached this page in error, please go back and try again"); } if(!$result = $db->sql_query($sql)) { error_die($db, QUERY_ERROR); } -$total_rows = $db->sql_numrows($result); + +// If the query dosan't return any rows this isn't a valid forum. Inform the user. +if(!$total_rows = $db->sql_numrows($result)) +{ + error_die($db, "", "The forum you selected does not exist. Please go back and try again."); +} + $forum_row = $db->sql_fetchrowset($result); if(!$forum_row) { error_die($db, QUERY_ERROR); } + $forum_name = stripslashes($forum_row[0]["forum_name"]); $forum_moderators = "james"; $pagetype = "viewforum";