forum_get($forum_id);
if (!check_class($forum_info['forum_class']) || !check_class($forum_info['parent_class']) || !$forum_info['forum_parent'])
{
header("Location:".e_PLUGIN."forum/forum.php");
exit;
}
if (!$FORUM_VIEW_START) {
if (file_exists(THEME."forum_viewforum_template.php"))
{
require_once(THEME."forum_viewforum_template.php");
}
else if (file_exists(THEME."forum_template.php"))
{
require_once(THEME."forum_template.php");
}
else
{
require_once(e_PLUGIN."forum/templates/forum_viewforum_template.php");
}
}
$forum_info['forum_name'] = $tp->toHTML($forum_info['forum_name'], TRUE, 'no_hook, emotes_off');
$forum_info['forum_description'] = $tp->toHTML($forum_info['forum_description'], TRUE, 'no_hook');
$_forum_name = (substr($forum_info['forum_name'], 0, 1) == "*" ? substr($forum_info['forum_name'], 1) : $forum_info['forum_name']);
define("e_PAGETITLE", LAN_01." / ".$_forum_name);
define("MODERATOR", $forum_info['forum_moderators'] != "" && check_class($forum_info['forum_moderators']));
$modArray = $forum->forum_getmods($forum_info['forum_moderators']);
$message = "";
if (MODERATOR)
{
if ($_POST)
{
require_once(e_PLUGIN."forum/forum_mod.php");
$message = forum_thread_moderate($_POST);
}
}
$member_users = $sql->db_Select("online", "*", "online_location REGEXP('forum_viewforum.php.$forum_id') AND online_user_id!='0' ");
$guest_users = $sql->db_Select("online", "*", "online_location REGEXP('forum_viewforum.php.$forum_id') AND online_user_id='0' ");
$users = $member_users+$guest_users;
require_once(HEADERF);
$text='';
if ($message)
{
$ns->tablerender("", $message, array('forum_viewforum', 'msg'));
}
$topics = $forum->forum_get_topic_count($forum_id);
if ($topics > $view)
{
$pages = ceil($topics/$view);
}
else
{
$pages = FALSE;
}
if ($pages)
{
if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== FALSE || strpos($FORUM_VIEW_END, 'THREADPAGES') !== FALSE)
{
$parms = "{$topics},{$view},{$thread_from},".e_SELF.'?'.$forum_id.'.[FROM],off';
$THREADPAGES = LAN_316." ".$tp->parseTemplate("{NEXTPREV={$parms}}");
}
}
if (check_class($forum_info['forum_postclass']) && check_class($forum_info['parent_postclass']))
{
$NEWTHREADBUTTON = "".IMAGE_newthread."";
}
if(substr($forum_info['forum_name'], 0, 1) == "*")
{
$forum_info['forum_name'] = substr($forum_info['forum_name'], 1);
$container_only = true;
}
else
{
$container_only = false;
}
if(substr($forum_info['sub_parent'], 0, 1) == "*")
{
$forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1);
}
$forum->set_crumb(); // set $BREADCRUMB (and $BACKLINK)
$FORUMTITLE = $forum_info['forum_name'];
//$MODERATORS = LAN_404.": ".$forum_info['forum_moderators'];
$MODERATORS = LAN_404.": ".implode(", ", $modArray);
$BROWSERS = $users." ".($users == 1 ? LAN_405 : LAN_406)." (".$member_users." ".($member_users == 1 ? LAN_407 : LAN_409).", ".$guest_users." ".($guest_users == 1 ? LAN_408 : LAN_410).")";
$ICONKEY = "
".IMAGE_new_small." |
".LAN_79." |
".IMAGE_nonew_small." |
".LAN_80." |
".IMAGE_sticky_small." |
".LAN_202." |
".IMAGE_announce_small." |
".LAN_396." |
".IMAGE_new_popular_small." |
".LAN_79." ".LAN_395." |
".IMAGE_nonew_popular_small." |
".LAN_80." ".LAN_395." |
".IMAGE_stickyclosed_small." |
".LAN_203." |
".IMAGE_closed_small." |
".LAN_81." |
";
$SEARCH = "
";
if(check_class($forum_info['forum_postclass']))
{
$PERMS = LAN_204." - ".LAN_206." - ".LAN_208;
}
else
{
$PERMS = LAN_205." - ".LAN_207." - ".LAN_209;
}
$sticky_threads = 0;
$stuck = FALSE;
$reg_threads = 0;
$unstuck = FALSE;
$thread_list = $forum->forum_get_topics($forum_id, $thread_from, $view);
$sub_list = $forum->forum_getsubs($forum_id);
//print_a($sub_list);
$gen = new convert;
$SUBFORUMS = "";
if(is_array($sub_list))
{
$newflag_list = $forum->forum_newflag_list();
$sub_info = "";
foreach($sub_list as $sub)
{
$sub_info .= parse_sub($sub);
}
$SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END;
}
if (count($thread_list) )
{
foreach($thread_list as $thread_info) {
$idArray[] = $thread_info['thread_id'];
}
$inList = '('.implode(',', $idArray).')';
foreach($thread_list as $thread_info) {
if ($thread_info['thread_s']) {
$sticky_threads ++;
}
if ($sticky_threads > 0 && !$stuck && $pref['forum_hilightsticky'])
{
if($FORUM_IMPORTANT_ROW)
{
$forum_view_forum .= $FORUM_IMPORTANT_ROW;
}
else
{
$forum_view_forum .= "
";
}
$stuck = TRUE;
}
if (!$thread_info['thread_s'])
{
$reg_threads ++;
}
if ($reg_threads == "1" && !$unstuck && $stuck)
{
if($FORUM_NORMAL_ROW)
{
$forum_view_forum .= $FORUM_NORMAL_ROW;
}
else
{
$forum_view_forum .= "
";
}
$unstuck = TRUE;
}
$forum_view_forum .= parse_thread($thread_info);
}
}
else
{
$forum_view_forum .= "
";
}
$sql->db_Select("forum", "*", "forum_parent !=0 AND forum_class!='255' ");
$FORUMJUMP = forumjump();
$TOPLINK = "".LAN_02."";
if($container_only)
{
$FORUM_VIEW_START = ($FORUM_VIEW_START_CONTAINER ? $FORUM_VIEW_START_CONTAINER : $FORUM_VIEW_START);
$FORUM_VIEW_END = ($FORUM_VIEW_END_CONTAINER ? $FORUM_VIEW_END_CONTAINER : $FORUM_VIEW_END);
$forum_view_forum = "";
}
$forum_view_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_START);
$forum_view_end = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_END);
if ($pref['forum_enclose'])
{
$ns->tablerender($pref['forum_title'], $forum_view_start.$forum_view_subs.$forum_view_forum.$forum_view_end, array('forum_viewforum', 'main1'));
}
else
{
echo $forum_view_start.$forum_view_forum.$forum_view_end;
}
echo "";
require_once(FOOTERF);
function parse_thread($thread_info)
{
global $forum, $tp, $FORUM_VIEW_FORUM, $gen, $pref, $forum_id, $menu_pref;
$text = "";
$VIEWS = $thread_info['thread_views'];
$REPLIES = $thread_info['thread_total_replies'];
if ($REPLIES)
{
$lastpost_datestamp = $gen->convert_date($thread_info['thread_lastpost'], 'forum');
$tmp = explode(".", $thread_info['thread_lastuser'], 2);
if($thread_info['lastpost_username'])
{
$LASTPOST = "".$thread_info['lastpost_username']."";
}
else
{
if($tmp[1])
{
$LASTPOST = $tp->toHTML($tmp[1]);
}
else
{
$LASTPOST = FORLAN_19;
}
}
$LASTPOST .= "
".$lastpost_datestamp;
}
else
{
$REPLIES = LAN_317;
$LASTPOST = " - ";
}
$newflag = FALSE;
if (USER)
{
if ($thread_info['thread_lastpost'] > USERLV && !preg_match("#\b".$thread_info['thread_id']."\b#", USERVIEWED))
{
$newflag = TRUE;
}
}
$THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum');
$ICON = ($newflag ? IMAGE_new : IMAGE_nonew);
if ($REPLIES >= $pref['forum_popular'] && $REPLIES != "None") {
$ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
}
$THREADTYPE = '';
if ($thread_info['thread_s'] == 1)
{
$ICON = ($thread_info['thread_active'] ? IMAGE_sticky : IMAGE_stickyclosed);
$THREADTYPE = '['.LAN_202.']
';
}
elseif($thread_info['thread_s'] == 2)
{
$ICON = IMAGE_announce;
$THREADTYPE = '['.LAN_396.']
';
}
elseif(!$thread_info['thread_active'])
{
$ICON = IMAGE_closed;
}
$thread_name = strip_tags($tp->toHTML($thread_info['thread_name'], false, 'no_hook, emotes_off'));
if (strtoupper($THREADTYPE) == strtoupper(substr($thread_name, 0, strlen($THREADTYPE)))) {
$thread_name = substr($thread_name, strlen($THREADTYPE));
}
if ($pref['forum_tooltip']) {
$thread_thread = strip_tags($tp->toHTML($thread_info['thread_thread'], true, 'no_hook'));
$tip_length = ($pref['forum_tiplength'] ? $pref['forum_tiplength'] : 400);
if (strlen($thread_thread) > $tip_length) {
$thread_thread = substr($thread_thread, 0, $tip_length)." ".$menu_pref['newforumposts_postfix'];
}
$thread_thread = str_replace("'", "'", $thread_thread);
$title = "title='".$thread_thread."'";
} else {
$title = "";
}
$THREADNAME = "{$thread_name}";
$pages = ceil(($REPLIES+1)/$pref['forum_postspage']);
if ($pages > 1)
{
if($pages > 6)
{
for($a = 0; $a <= 2; $a++)
{
$PAGES .= $PAGES ? " " : "";
$PAGES .= "".($a+1)."";
}
$PAGES .= " ... ";
for($a = $pages-3; $a <= $pages-1; $a++)
{
$PAGES .= $PAGES ? " " : "";
$PAGES .= "".($a+1)."";
}
}
else
{
for($a = 0; $a <= ($pages-1); $a++)
{
$PAGES .= $PAGES ? " " : "";
$PAGES .= "".($a+1)."";
}
}
$PAGES = LAN_316." [ ".$PAGES." ]";
}
else
{
$PAGES = "";
}
if (MODERATOR)
{
$thread_id = $thread_info['thread_id'];
$ADMIN_ICONS = "
";
}
$text .= "