1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-25 01:25:57 +02:00

Moved config, images vars to arrays and various other fixes

git-svn-id: file:///svn/phpbb/trunk@237 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen
2001-05-03 22:10:23 +00:00
parent df716e1e83
commit aa8a051a98
16 changed files with 437 additions and 362 deletions

View File

@@ -23,6 +23,9 @@
include('extension.inc');
include('common.'.$phpEx);
$pagetype = "viewforum";
$page_title = "View Forum - $forum_name";
//
// Obtain which forum id is required
//
@@ -35,21 +38,10 @@ else
$forum_id = ($HTTP_GET_VARS['forum']) ? $HTTP_GET_VARS['forum'] : $HTTP_POST_VARS['forum'];
}
$pagetype = "viewforum";
$page_title = "View Forum - $forum_name";
//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id, $session_length);
init_userprefs($userdata);
//
// End session management
//
// Check if the user has acutally sent a forum ID with his/her request
// Check if the user has actually 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, f.forum_topics, u.username, u.user_id
@@ -63,21 +55,31 @@ else
error_die(GENERAL_ERROR, "You have reached this page in error, please go back and try again");
}
//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id, $session_length);
init_userprefs($userdata);
//
// End session management
//
if(!$result = $db->sql_query($sql))
{
error_die(SQL_QUERY, "Couldn't obtain forums information.", __LINE__, __FILE__);
}
// If the query doesn't return any rows this
// isn't a valid forum. Inform the user.
if(!$total_rows = $db->sql_numrows($result))
{
error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again.");
}
//
// Add checking for private forums here!!
//
// 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(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again.");
}
$forum_row = $db->sql_fetchrowset($result);
if(!$forum_row)
@@ -89,17 +91,15 @@ $forum_name = stripslashes($forum_row[0]["forum_name"]);
$topics_count = $forum_row[0]["forum_topics"];
for($x = 0; $x < $db->sql_numrows($result); $x++)
{
if($x > 0)
$forum_moderators .= ", ";
$forum_moderators .= "<a href=\"profile.$phpEx?mode=viewprofile&user_id=".$forum_row[$x]["user_id"]."\">".$forum_row[$x]["username"]."</a>";
if($x > 0)
$forum_moderators .= ", ";
$forum_moderators .= "<a href=\"profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$forum_row[$x]["user_id"]."\">".$forum_row[$x]["username"]."</a>";
}
include('includes/page_header.'.$phpEx);
if(!isset($start))
{
$start = 0;
$start = 0;
}
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time
@@ -109,97 +109,128 @@ $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as i
LEFT JOIN " . USERS_TABLE . " u2 ON p.poster_id = u2.user_id
WHERE t.forum_id = '$forum_id'
ORDER BY topic_time DESC
LIMIT $start, $topics_per_page";
LIMIT $start, ".$board_config['topics_per_page'];
if(!$t_result = $db->sql_query($sql))
{
error_die(SQL_QUERY, "Couldn't obtain topic information.", __LINE__, __FILE__);
}
$total_topics = $db->sql_numrows();
$total_topics = $db->sql_numrows($t_result);
//
// Post URL generation for
// templating vars
//
$post_new_topic_url = "posting.".$phpEx."?mode=newtopic&".POST_FORUM_URL."=$forum_id";
$template->assign_vars(array(
"U_POST_NEW_TOPIC" => $post_new_topic_url));
//
// Dump out the page header
//
include('includes/page_header.'.$phpEx);
//
// Okay, lets dump out the page ...
//
if($total_topics)
{
$topic_rowset = $db->sql_fetchrowset($t_result);
for($x = 0; $x < $total_topics; $x++)
{
$topic_title = stripslashes($topic_rowset[$x]["topic_title"]);
$topic_id = $topic_rowset[$x]["topic_id"];
$replies = $topic_rowset[$x]["topic_replies"];
if($replies > $posts_per_page)
{
$goto_page = "&nbsp;&nbsp;&nbsp;(<img src=\"images/posticon.gif\">$l_gotopage: ";
$times = 1;
for($i = 0; $i < ($replies + 1); $i += $posts_per_page)
{
if($times > 4)
{
if(($i + $posts_per_page) >= ($replies + 1))
{
$goto_page.=" ... <a href=\"viewtopic.$phpEx?".POST_TOPIC_URL."=".$topic_id."&start=$i\">$times</a>";
}
}
$topic_rowset = $db->sql_fetchrowset($t_result);
for($x = 0; $x < $total_topics; $x++)
{
$topic_title = stripslashes($topic_rowset[$x]["topic_title"]);
$topic_id = $topic_rowset[$x]["topic_id"];
$replies = $topic_rowset[$x]["topic_replies"];
if($replies > $board_config['posts_per_page'])
{
$goto_page = "&nbsp;&nbsp;&nbsp;(<img src=\"".$images['posticon']."\">$l_gotopage: ";
$times = 1;
for($i = 0; $i < ($replies + 1); $i += $board_config['posts_per_page'])
{
if($times > 4)
{
if(($i + $board_config['posts_per_page']) >= ($replies + 1))
{
$goto_page.=" ... <a href=\"viewtopic.$phpEx?".POST_TOPIC_URL."=".$topic_id."&start=$i\">$times</a>";
}
}
else
{
if($times != 1)
{
$goto_page.= ", ";
}
$goto_page.= "<a href=\"viewtopic.$phpEx?".POST_TOPIC_URL."=".$topic_id."&start=$i\">$times</a>";
}
$times++;
}
$goto_page.= ")";
}
else
{
if($times != 1)
{
$goto_page.= ", ";
}
$goto_page.= "<a href=\"viewtopic.$phpEx?".POST_TOPIC_URL."=".$topic_id."&start=$i\">$times</a>";
}
$times++;
}
$goto_page.= ")";
}
else
{
$goto_page = "";
}
$topic_poster = stripslashes($topic_rowset[$x]["username"]);
$views = $topic_rowset[$x]["topic_views"];
$last_post_time = create_date($date_format, $topic_rowset[$x]["post_time"], $sys_timezone);
$last_post_user = $topic_rowset[$x]["user2"];
$folder_img = "<img src=\"images/folder.gif\">";
$template->assign_block_vars(
"topicrow", array("FORUM_ID" => $forum_id,
"TOPIC_ID" => $topic_id,
"FOLDER" => $folder_img,
"TOPIC_POSTER" => "<a href=\"profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$topic_rowset[$x]["user_id"]."\">".$topic_poster."</a>",
"GOTO_PAGE" => $goto_page,
"REPLIES" => $replies,
"TOPIC_TITLE" => $topic_title,
"VIEWS" => $views,
"LAST_POST" => $last_post_time . "<br />$l_by <a href=\"profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$topic_rowset[$x]["id2"]."\">" . $last_post_user ."</a>"));
}
{
$goto_page = "";
}
$count = 1;
$next = $start + $topics_per_page;
if($topics_count > $topics_per_page)
{
if($next < $topics_count)
{
$pagination = "<a href=\"viewforum.$phpEx?forum_id=$forum_id&start=$next\">$l_nextpage</a> | ";
}
for($x = 0; $x < $topics_count; $x++)
{
if(!($x % $topics_per_page))
{
if($x == $start)
{
$pagination .= "$count";
}
else
{
$pagination .= " <a href=\"viewforum.$phpEx?".POST_FORUM_URL."=$forum_id&start=$x\">$count</a> ";
}
$count++;
if(!($count % 20))
{
$pagination .= "<br>";
}
}
}
}
$template->assign_vars(array("PAGINATION" => $pagination));
$template->pparse("body");
$folder_img = "<img src=\"".$images['folder']."\">";
$view_topic_url = "viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id."&".$replies;
$topic_poster = stripslashes($topic_rowset[$x]["username"]);
$topic_poster_profile_url = "profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$topic_rowset[$x]["user_id"];
$last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$x]["post_time"], $board_config['default_timezone']);
$last_post_user = $topic_rowset[$x]["user2"];
$last_post_profile_url = "profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$topic_rowset[$x]["id2"];
$views = $topic_rowset[$x]["topic_views"];
$template->assign_block_vars("topicrow", array(
"FORUM_ID" => $forum_id,
"TOPIC_ID" => $topic_id,
"FOLDER" => $folder_img,
"TOPIC_POSTER" => $topic_poster,
"U_TOPIC_POSTER_PROFILE" => $topic_poster_profile_url,
"GOTO_PAGE" => $goto_page,
"REPLIES" => $replies,
"TOPIC_TITLE" => $topic_title,
"VIEWS" => $views,
"LAST_POST_TIME" => $last_post_time,
"LAST_POST_USER" => $last_post_user,
"U_VIEW_TOPIC" => $view_topic_url,
"U_LAST_POST_USER_PROFILE" => $last_post_profile_url));
}
$count = 1;
$next = $start + $board_config['topics_per_page'];
if($topics_count > $board_config['topics_per_page'])
{
if($next < $topics_count)
{
$pagination = "<a href=\"viewforum.$phpEx?".POST_FORUM_URL."=$forum_id&start=$next\">$l_nextpage</a> | ";
}
for($x = 0; $x < $topics_count; $x++)
{
if(!($x % $board_config['topics_per_page']))
{
if($x == $start)
{
$pagination .= "$count";
}
else
{
$pagination .= " <a href=\"viewforum.$phpEx?".POST_FORUM_URL."=$forum_id&start=$x\">$count</a> ";
}
$count++;
if(!($count % 20))
{
$pagination .= "<br>";
}
}
}
}
$template->assign_vars(array(
"PAGINATION" => $pagination));
$template->pparse("body");
}
else
{