mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-13 21:26:28 +02:00
Viewforum works, and error die outputs nice, templated, errors
git-svn-id: file:///svn/phpbb/trunk@37 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@ -37,6 +37,10 @@ switch($dbms)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Setup what template to use. Currently just use default
|
||||||
|
$template = new Template("./templates/Default", "keep");
|
||||||
|
|
||||||
// Make the database connection.
|
// Make the database connection.
|
||||||
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
|
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
|
||||||
if(!$db)
|
if(!$db)
|
||||||
@ -59,7 +63,7 @@ $userdata = Array();
|
|||||||
$sql = "SELECT * FROM ".CONFIG_TABLE." WHERE selected = 1";
|
$sql = "SELECT * FROM ".CONFIG_TABLE." WHERE selected = 1";
|
||||||
if(!$result = $db->sql_query($sql))
|
if(!$result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
error_die($db, QUERY_ERROR);
|
error_die($db, SQL_CONNECT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -110,7 +114,4 @@ if (!$user_logged_in)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup what template to use. Currently just use default
|
|
||||||
$template = new Template("./templates/Default", "keep");
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -25,6 +25,11 @@
|
|||||||
function error_die($db, $error_code = "", $error_msg = "")
|
function error_die($db, $error_code = "", $error_msg = "")
|
||||||
{
|
{
|
||||||
global $template, $phpEx;
|
global $template, $phpEx;
|
||||||
|
|
||||||
|
if(!$template->get("overall_header"))
|
||||||
|
{
|
||||||
|
include('page_header.'.$phpEx);
|
||||||
|
}
|
||||||
if(!$error_msg)
|
if(!$error_msg)
|
||||||
{
|
{
|
||||||
switch($error_code)
|
switch($error_code)
|
||||||
|
@ -76,26 +76,29 @@ function get_newest_user($db)
|
|||||||
|
|
||||||
function make_jumpbox($db, $phpEx)
|
function make_jumpbox($db, $phpEx)
|
||||||
{
|
{
|
||||||
|
|
||||||
$boxstring = "
|
$boxstring = "
|
||||||
<FORM ACTION=\"viewforum.$phpEx\" METHOD=\"GET\">
|
<FORM ACTION=\"viewforum.$phpEx\" METHOD=\"GET\">
|
||||||
|
Jump to:
|
||||||
<SELECT NAME=\"forum_id\"><OPTION VALUE=\"-1\">Select Forum</OPTION>
|
<SELECT NAME=\"forum_id\"><OPTION VALUE=\"-1\">Select Forum</OPTION>
|
||||||
";
|
";
|
||||||
$sql = "SELECT cat_id, cat_title FROM ".CATEGORIES_TABLE." ORDER BY cat_order";
|
$sql = "SELECT cat_id, cat_title FROM ".CATEGORIES_TABLE." ORDER BY cat_order";
|
||||||
$result = $db->sql_query($sql);
|
if($result = $db->sql_query($sql))
|
||||||
|
{
|
||||||
if($total_cats = $db->sql_numrows($result))
|
if($total_cats = $db->sql_numrows($result))
|
||||||
{
|
{
|
||||||
|
$cat_rows = $db->sql_fetchrowset($result);
|
||||||
for($x = 0; $x < $total_cats; $x++)
|
for($x = 0; $x < $total_cats; $x++)
|
||||||
{
|
{
|
||||||
$boxstring .= "<OPTION VALUE=\"-1\"> </OPTION>\n";
|
$boxstring .= "<OPTION VALUE=\"-1\"> </OPTION>\n";
|
||||||
$boxstring .= "<OPTION VALUE=\"-1\">".stripslashes($cat_rows[$x]["cat_title"])."</OPTION>\n";
|
$boxstring .= "<OPTION VALUE=\"-1\">".stripslashes($cat_rows[$x]["cat_title"])."</OPTION>\n";
|
||||||
$boxstring .= "<OPTION VALUE=\"-1\">----------------</OPTION>\n";
|
$boxstring .= "<OPTION VALUE=\"-1\">----------------</OPTION>\n";
|
||||||
$cat_rows = $db->sql_fetchrowset($result);
|
|
||||||
$f_sql = "SELECT forum_name, forum_id FROM ".FORUMS_TABLE."
|
$f_sql = "SELECT forum_name, forum_id FROM ".FORUMS_TABLE."
|
||||||
WHERE cat_id = ". $cat_rows[$x]["cat_id"] . " ORDER BY forum_id";
|
WHERE cat_id = ". $cat_rows[$x]["cat_id"] . " ORDER BY forum_id";
|
||||||
if($f_result = $db->sql_query($f_sql))
|
if($f_result = $db->sql_query($f_sql))
|
||||||
{
|
{
|
||||||
if($total_forums = $db->sql_numrows($f_result)) {
|
if($total_forums = $db->sql_numrows($f_result))
|
||||||
|
{
|
||||||
$f_rows = $db->sql_fetchrowset($f_result);
|
$f_rows = $db->sql_fetchrowset($f_result);
|
||||||
for($y = 0; $y < $total_forums; $y++)
|
for($y = 0; $y < $total_forums; $y++)
|
||||||
{
|
{
|
||||||
@ -104,12 +107,21 @@ function make_jumpbox($db, $phpEx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$boxstring .= "<option value=\"-1\">Error!</option>\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$boxstring .= "<option value=\"-1\">No Forums to Jump to</option>\n";
|
$boxstring .= "<option value=\"-1\">No Forums to Jump to</option>\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$boxstring .= "<option value=\"-1\">Cat Error</option>\n";
|
||||||
|
}
|
||||||
$boxstring .= "</SELECT>\n<br><INPUT TYPE=\"SUBMIT\" VALUE=\"Jump\"></FORM>";
|
$boxstring .= "</SELECT>\n<br><INPUT TYPE=\"SUBMIT\" VALUE=\"Jump\"></FORM>";
|
||||||
|
|
||||||
return($boxstring);
|
return($boxstring);
|
||||||
|
@ -30,6 +30,8 @@ include('functions/functions.'.$phpEx);
|
|||||||
include('functions/error.'.$phpEx);
|
include('functions/error.'.$phpEx);
|
||||||
include('db.'.$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))
|
if(isset($forum_id))
|
||||||
{
|
{
|
||||||
$sql = "SELECT f.forum_type, f.forum_name
|
$sql = "SELECT f.forum_type, f.forum_name
|
||||||
@ -38,19 +40,26 @@ if(isset($forum_id))
|
|||||||
}
|
}
|
||||||
else
|
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))
|
if(!$result = $db->sql_query($sql))
|
||||||
{
|
{
|
||||||
error_die($db, QUERY_ERROR);
|
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);
|
$forum_row = $db->sql_fetchrowset($result);
|
||||||
if(!$forum_row)
|
if(!$forum_row)
|
||||||
{
|
{
|
||||||
error_die($db, QUERY_ERROR);
|
error_die($db, QUERY_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$forum_name = stripslashes($forum_row[0]["forum_name"]);
|
$forum_name = stripslashes($forum_row[0]["forum_name"]);
|
||||||
$forum_moderators = "<a href=\"profile.$phpEx?mode=viewprofile&user_id=1\">james</a>";
|
$forum_moderators = "<a href=\"profile.$phpEx?mode=viewprofile&user_id=1\">james</a>";
|
||||||
$pagetype = "viewforum";
|
$pagetype = "viewforum";
|
||||||
|
Reference in New Issue
Block a user