<?php
#$Id: viewForum.inc.php,v 1.20 2006/09/06 15:58:48 ryan Exp $
class viewForumClass {
function createLogin(){
$allow_pm = $this->core->forumConfig["allow_pm"];
if ($_COOKIE[PXL]){
list($username) = $this->core->db->fetch("select username from users where user_id = '$this->user_id'");
$this->asst = "<b>" . $this->textArray['Logged in as'] . " $username </b>";
$text = "<a href=\"users.php?action=view&user_id=$this->user_id\">" . $this->textArray['My Profile'] . "</a> | ";
if ($allow_pm == 1){
list($new) = $this->core->db->fetch("select count(pm_id) from forums_pm where view = '0' and user_id = '$this->user_id' and deleted = '0'");
$text .= "<a href=\"forums.php?action=pm&subaction=inbox\">$new " . $this->textArray['New'] . " " . $this->textArray['Messages'] . "</a> |";
}
$text .= " <a href=\"forums.php?action=search&asst=1\">" . $this->textArray['New'] . " " . ucfirst($this->textArray['posts']) . "</a> |";
$text .= " <a href=\"javascript:goToURL('users.php?action=login')\">" . $this->textArray['Logout'] . "</a>";
$this->login = $text;
}
else {
$url = $_SERVER[REQUEST_URI];
$this->login = "<a href=users.php?action=login&url=$url>" . $this->textArray['Login'] . "</a> | <a href=\"users.php?action=signup\">" . $this->textArray['Register Here'] . "</a> | <a href=\"users.php?action=password\">" . $this->textArray['Lost Password'] . "</a>";
}
}
function viewAllForums(){
$siteName = $this->core->config["siteName"];
$text = "<p class=\"padding\"><table cellpadding=\"0\" cellspacing=\"0\" id=\"forumBox-border\">";
$text .= "<tr><td colspan=5><table id=\"blankBox\" cellpadding=\"0\" cellspacing=\"0\">";
$text .= "<tr><td id=\"smallText\">" . $this->asst . "</td><td id=\"smallText-right\">" . $this->login . "</td></tr>";
$text .= "</table></td></tr>";
$text .= "<tr><td id=\"forumTitle1\" colspan=\"2\" >" . $this->textArray['Forum'] . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Topics'] . "</td>";
$text .= "<td id=\"forumTitle1-center\">" . ucfirst($this->textArray['posts']) . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Last Post'] . "</td></tr>";
$result = $this->core->db->query("select cat_id, name from forums_cat where comments != '1' order by ord");
while(list($cat_id, $cat_name) = $this->core->db->fetch_row($result)){
$cat_name = stripslashes($cat_name);
$cc = $this->forumCat($cat_id);
if ($cc != ''){
$text .= "<tr><td id=\"forumTitle1\" colspan=\"5\"><a class=forumTitleLink href=\"forums.php?cat_id=$cat_id\">$cat_name</a></td></tr>";
$text .= $cc;
}
}
$text .= "</table></p>";
$title = "$siteName " . $this->textArray['Forums'];
$insert = $text;
include("$this->templates/files/box.tpl.php");
$pm = $this->core->newPM();
$text .= "<p class=\"padding\"><table cellpadding=\"0\" cellspacing=\"0\" id=\"blankBox\"><tr><td id=\"smallText\">$pm</td></tr></table></p>";
$text .= $this->subBox();
$this->body = $text;
}
function viewCat(){
$cat_id = $_GET['cat_id'];
$siteName = $this->core->config["siteName"];
list($name, $comments) = $this->core->db->fetch("select name, comments from forums_cat where cat_id = '$cat_id'");
if ($comments != '0'){ header("Location: error.php?error=403"); exit(); }
$name = stripslashes($name);
$text = "<p class=\"padding\"><div id=\"forumHeader1\"><a href=\"forums.php\">$siteName " . $this->textArray['Forums'] . "</a> -> $name</div>";
$text .= "<table id=\"blankBox\" cellpadding=\"0\" cellspacing=\"0\">";
$text .= "<tr><td id=\"smallText\">" . $this->asst . "</td><td id=\"smallText-right\">" . $this->login . "</td></tr>";
$text .= "</table>";
$text .= "<table cellpadding=\"0\" cellspacing=\"0\" id=\"forumBox-border\">";
$text .= "<tr><td id=\"forumTitle1\" colspan=\"2\">" . $this->textArray['Forum'] . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Topics'] . "</td>";
$text .= "<td id=\"forumTitle1-center\">" . ucfirst($this->textArray['posts']) . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Last Post'] . "</td></tr>";
$text .= $this->forumCat($cat_id);
$text .= "</table></p>";
$pm = $this->core->newPM();
$text .= "<p class=\"padding\"><table cellpadding=\"0\" cellspacing=\"0\" id=\"blankBox\"><tr><td id=\"smallText\">$pm</td></tr></table></p>";
$text .= $this->subBox(); $this->title = $name; $this->body = $text;
}
function forumCat($cat_id){
$result1 = $this->core->db->query("select f.forum_id, f.name, f.fdescription, f.posts, f.topics, p.topic_id, p.post_id, p.date, u.username, u.user_id from forums_forums f left join forums_posts p on f.post_id = p.post_id left join users u on p.user_id = u.user_id where f.cat_id = '$cat_id' order by f.ord");
$x=1;
list($temp) = $this->core->db->fetch("select templast from forums_session where sess_id = '$_COOKIE[PXLF]'");
while(list($forum_id, $name, $desc, $posts, $topics, $topic_id, $post_id, $date, $user, $post_user_id) = $this->core->db->fetch_row($result1)){
$secure = $this->security->forumSecure($forum_id, 0, 0);
if ($secure == 1){
$mods = '';
$result2 = $this->core->db->query("select u.username, u.user_id from forums_mod m, users u where u.user_id = m.user_id and m.forum_id = '$forum_id'");
while(list($username, $user_id) = $this->core->db->fetch_row($result2)){
$mods .= "<a href=\"users.php?action=view&user_id=$user_id\">$username</a>, ";
}
if ($x == 1){ $class="forumCell"; $center="forumCell-center";$x++; }
else { $class="forumCell-alt"; $center="forumCell-alt-center"; $x=1; }
$name = stripslashes($name);
$desc = stripslashes($desc);
$icon = $this->findIcon(0, 0, 0, $temp, $date);
$text .= "<tr><td id=\"$center\">$icon</td>";
$text .= "<td id=\"$class\"><p id=\"forumLarge-bold\"><a href=\"forums.php?forum_id=$forum_id\">$name</a></p>$desc<br>";
if ($mods != ''){ $text .= $this->textArray['Moderators'] . ": " . substr($mods, 0, -2); }
$text .= "</td>";
$text .= "<td id=\"$center\">$topics</td><td id=\"$center\">$posts</td>";
$text .= "<td id=\"$class\">";
if ($date != '' && $date != '0'){
$date = $this->core->global->getTime($date);
$text .= "<div id=\"smallText\">" . date($this->core->db->dbCall("dateFormat") . " H:i", $date) . "<br>" . $this->textArray['by'] . " <a href=\"users.php?action=view&user_id=$post_user_id\">$user</a>";
$text .= " <a href=\"forums.php?forum_id=$forum_id&topic_id=$topic_id&post_id=$post_id#$post_id\"><img src=\"images/view_last_post.gif\" width=\"16\" height=\"16\" alt='" . $this->textArray['View'] . " " . $this->textArray['Last Post'] . "' border=\"0\"></a></div>";
}
else { $text .= "<div id=\"smallText\">" . $this->textArray["No"] . " " . ucfirst($this->textArray["posts"]) . "</div>"; }
$text .= "</td></tr>";
}
}
return $text;
}
function subBox($flag=''){
$text = "<p class=padding><table cellpadding=\"0\" cellspacing=\"0\" width=100%>";
$time = time() - 900;
$time = $this->core->global->getTime($time, 1);
$result = $this->core->db->query("select user_id from forums_session where last > '$time' and gone != '1'");
$total = $this->core->db->num_rows($result);
list($posts) = $this->core->db->fetch("select count(post_id) from forums_posts");
list($users) = $this->core->db->fetch("select count(user_id) from users");
list($last_user_id, $last_user_name) = $this->core->db->fetch("select user_id, username from users where actkey is null order by user_id desc limit 0,1");
$guests=0;
$members=0;
$hidden=0;
$member_list = ucfirst($this->textArray['members']) . " " . ucfirst($this->textArray['Online']) . ": ";
while(list($user_id) = $this->core->db->fetch_row($result)){
if ($user_id == '0'){ $guests++; }
else {
list($username, $view_online) = $this->core->db->fetch("select username, view_online from users where user_id = '$user_id'");
if ($view_online == 1){ $members++; $member_list .= "<a href=\"users.php?action=view&user_id=$user_id\">$username</a>, "; }
else { $hidden++; }
}
}
if ($members == 0){ $member_list .= $this->textArray['None'] . " "; }
$text .= "<tr><td id=\"forumTitle1\" colspan=\"2\">" . $this->textArray['Who is'] . " " . ucfirst($this->textArray['online']) . "</td></tr>";
$text .= "<tr><td id=\"boxCell\" colspan=\"2\">" . $this->textArray['In total'] . " $users " . $this->textArray['users'] . " " . $this->textArray['have posted'] . " $posts " . $this->textArray['posts'];
$text .= " <a href=\"users.php?action=view&user_id=$last_user_id\">$last_user_name</a> " . $this->textArray['is our newest user'];
if (!$_COOKIE["PXL"]){ $text .= "<br>" . $this->textArray['More forums/posts may be visible if you login']; }
$text .= "</td></tr>";
if ($total == 1){ $text .= "<tr><td id=\"boxCell\" colspan=\"2\">" . $this->textArray['Currently there is'] . " $total " . $this->textArray['user'] . " " . $this->textArray['online'] . "."; }
else { $text .= "<tr><td id=\"boxCell\" colspan=\"2\">" . $this->textArray['Currently there are'] . " $total " . $this->textArray['users'] . " " . $this->textArray['online'] . "."; }
$text .= " $members " . $this->textArray['members'] . ", $hidden " . $this->textArray['hidden'] . ", $guests " . $this->textArray['guests'] . ".<br>";
$text .= substr($member_list, 0, -2) . "</td></tr>";
$text .= "<tr><td id=\"forumTitle1\" colspan=\"2\"></td></tr>";
if (!$_COOKIE[PXL]){
$text .= "<tr><td id=\"boxCell\">";
$text .= "<form method=\"post\" action=\"forums.php?action=search\"><input type=\"hidden\" name=\"confirm\" value=\"1\">";
$text .= $this->textArray['Search'] . " " . $this->textArray['Forums'] . ": <input type=\"text\" name=\"keywords\" value='' size=\"18\">";
$text .= "<br><input type=\"submit\" class=\"submit\" value='" . $this->textArray['Search'] . "'></form></td>";
$text .= "<td id=\"boxCell-right\">";
$text .= "<form method=\"post\" action=\"users.php?action=login\"><input type=\"hidden\" name=\"confirm\" value=\"1\">";
$text .= "<input type=\"hidden\" name=\"url\" value='$_SERVER[REQUEST_URI]'>";
$text .= "<input type=\"hidden\" name=\"remember\" value=\"on\">";
$text .= $this->textArray['Login'] . ":";
$text .= "<input type=\"text\" name=\"username\" size=\"8\" value=\"" . $this->textArray['Username'] . "\"> <input type=\"password\" name=\"password\" size=\"8\">";
$text .= "<br><input type=\"submit\" class=\"submit\" value='" . $this->textArray['Login'] . "'></form></td>";
$text .= "</tr>";
}
else {
$text .= "<tr><td id=\"boxCell\" colspan=2>";
$text .= "<form method=\"post\" action=\"forums.php?action=search\"><input type=\"hidden\" name=\"confirm\" value=\"1\">";
$text .= $this->textArray['Search'] . " " . $this->textArray['Forums'] . ": <input type=\"text\" name=\"keywords\" value='' size=\"18\">";
$text .= " <input type=\"submit\" class=\"submit\" value='" . $this->textArray['Search'] . "'></form></td>";
$text .= "</tr>";
}
$text .= "</table></p>";
$title = $this->textArray['Forum'] . " " . $this->textArray['Options'];
$insert = $text;
include("$this->templates/files/box.tpl.php");
return $text;
}
function findIcon($sticky, $locked, $posts, $temp, $last_date){
$image = "images/";
if ($sticky == 1){
$image .= "sticky";
$alt = $this->textArray["Sticky"];
}
else if ($locked == 1){
$image .= "locked";
$alt = $this->textArray["Locked"];
}
else if ($posts >= $this->core->forumConfig["popular_threshold"]){
$image .= "hot";
$alt = $this->textArray["Hot"];
}
else {
$image .= "topic";
$alt = $this->textArray["Topic"];
}
if ($temp < $last_date){
$image .= "_new";
$alt = $this->textArray['New'] . " " . $alt;
}
$icon = "<img src=" . $image . ".gif alt='$alt' border=0>";
return $icon;
}
function viewPost(){
$posts_per_page = $this->core->db->dbCall("posts_per_page", "forums_config");
list($comment_type) = $this->core->db->fetch("select comment_type from forums_forums where forum_id = '$_GET[forum_id]'");
if ($comment_type != 0){
list($comment_id) = $this->core->db->fetch("select comment_id from forums_topics where topic_id = '$_GET[topic_id]'");
$this->core->sendToComment($comment_type, $comment_id, $_GET[post_id]);
}
else {
list($count) = $this->core->db->fetch("select posts from forums_topics where topic_id = '$_GET[topic_id]'");
$count++;
list($prev) = $this->core->db->fetch("select count(post_id) from forums_posts where topic_id = '$_GET[topic_id]' and post_id < '$_GET[post_id]'");
$prev = $prev/$posts_per_page;
if (substr_count($prev, ".") > 0){
$prev = substr($prev, 0, strpos($prev, "."));
}
$limit = $prev*$posts_per_page;
$_GET['limit'] = $limit;
$this->viewTopic();
}
}
function searchResults(){
$topics_per_page = $this->core->db->dbCall("topics_per_page", "forums_config");
$posts_per_page = $this->core->db->dbCall("posts_per_page", "forums_config");
$siteName = $this->core->db->dbCall("siteName");
$dateFormat = $this->core->db->dbCall("dateFormat");
if ($_GET['limit']){ $limit = $_GET['limit']; }
else { $limit = 0; }
list($rows) = $this->core->db->fetch("select rows from forums_search_control where search_id = '$_GET[search_id]'");
$result = $this->core->db->query("select s.forum_id, s.topic_id, s.title, s.user_id, s.posts, s.`reads`, s.last_post_id, s.last_post_date, s.last_post_user_id, u.username, u2.username, f.name, t.sticky, t.locked from forums_search s, users u, users u2, forums_forums f, forums_topics t where s.search_id = '$_GET[search_id]' and s.topic_id = t.topic_id and f.forum_id = s.forum_id and u2.user_id = s.user_id and u.user_id = s.last_post_user_id order by s.last_post_date desc limit $limit, $topics_per_page");
list($temp) = $this->core->db->fetch("select templast from forums_session where sess_id = '$_COOKIE[PXLF]'");
$text = "<div id=\"forumHeader1\"><a href=forums.php>$siteName " . $this->textArray['Forums'] . "</a> -> " . $this->textArray['Search Results'] . "</div>";
$text .= "<table id=\"blankBox\" cellpadding=\"0\" cellspacing=\"0\">";
$text .= "<tr><td id=\"smallText\">" . $this->asst . "</td><td id=\"smallText-right\">" . $this->login . "</td></tr>";
$text .= "</table>";
$text .= "<table id=\"forumBox-border\" cellpadding=\"0\" cellspacing=\"0\">";
$text .= "<tr><td id=\"forumTitle1\">" . $this->textArray['Topic'] . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Forum'] . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Replies'] . "</td>";
$text .= "<td id=\"forumTitle1-center\">" . $this->textArray['Reads'] . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Author'] . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Last Post'] . "</td></tr>";
$more = $this->core->pageTab($limit, $rows, "forums.php?action=search&search_id=$_GET[search_id]", $topics_per_page);
if ($rows > 0){ $text .= "<tr><td id=\"paging\" colspan=\"7\">$more</td></tr>"; }
$x=1;
while(list($forum_id, $topic_id, $title, $user_id, $posts, $reads, $last_post_id, $last_date, $last_user_id, $last_user_name, $username, $forum_name, $sticky, $locked) = $this->core->db->fetch_row($result)){
$more2='';
if ($posts > $posts_per_page){
$more2 = " <span id=\"smallText\"> Page :";
$b=1;
for($x=0; $x < $posts; $x += $posts_per_page){
$more2 .= " <a href=\"forums.php?forum_id=$_GET[forum_id]&topic_id=$topic_id&limit=$x\">$b</a> ";
$b++;
}
$more2 .= "</span>";
}
$posts--;
$last_date = $this->core->global->getTime($last_date);
$last_post = "<div id=\"smallText\">" . date($dateFormat . " H:i", $last_date) . "<br>";
$last_post .= $this->textArray['by'] . " <a href=\"users.php?action=view&user_id=$last_user_id\">$last_user_name</a>";
$last_post .= " <a href=\"forums.php?forum_id=$forum_id&topic_id=$topic_id&post_id=$last_post_id\"><img src=\"images/view_last_post.gif\" width=\"16\" height=\"16\" alt='" . $this->textArray['View'] . " " . $this->textArray['Last Post'] . "' border=\"0\"></a></div>";
$title = stripslashes($title);
if ($x == 1){ $class = "forumCell"; $center = "forumCell-center"; $x++; }
else { $class = "forumCell-alt"; $center = "forumCell-alt-center"; $x=1; }
//$icon = $this->findIcon($sticky, $locked, $posts, $temp, $last_date);
//$text .= "<tr><td id=\"$class\">$icon</td><td id=\"$class\"><a href=\"forums.php?forum_id=$forum_id&topic_id=$topic_id\">$title</a> $more2</td>";
$text .= "<tr><td id=\"$class\"><a href=\"forums.php?forum_id=$forum_id&topic_id=$topic_id\">$title</a> $more2</td>";
$text .= "<td id=\"$class\"><a href=\"forums.php?forum_id=$forum_id\">$forum_name</a></td><td id=\"$center\">$posts</td><td id=\"$center\">$reads</td>";
$text .= "<td id=\"$center\"><a href=\"users.php?action=view&user_id=$user_id\">$username</a></td>";
$text .= "<td id=\"$class\">$last_post</td></tr>";
}
if ($rows > 0){ $text .= "<tr><td id=\"paging\" colspan=\"7\">$more</td></tr>"; }
else { $text .= "<tr><td id=\"attn\" colspan=\"7\">" . $this->textArray['No Results Found'] . "</td></tr>"; }
$text .= "</table><p>";
$text .= $this->subBox();
$this->body = $text;
}
function viewForumPoll($forum_poll_id, $locked){
list($poll_text, $total) = $this->core->db->fetch("select forum_poll_text, total from forums_polls where forum_poll_id = '$forum_poll_id'");
list($check) = $this->core->db->fetch("select count(forum_poll_user_id) from forums_polls_users where forum_poll_id = '$forum_poll_id' and user_id = '$this->user_id'");
$text = "<p class=\"padding\"><table id=\"forumPoll\" cellpadding=\"0\" cellspacing=\"0\">";
$result = $this->core->db->query("select option_id, option_text, option_results from forums_poll_results where forum_poll_id = '$forum_poll_id'") or die(mysql_error());
if ($_COOKIE['PXL'] && $check == 0 && $locked != "1"){
$text .= "<form method=\"post\" action=\"forums.php?action=vote\">";
$text .= "<input type=\"hidden\" name=\"forum_poll_id\" value=\"$forum_poll_id\">";
while(list($id, $option, $results) = $this->core->db->fetch_row($result)){
$option = stripslashes($option);
$text .= "<tr><td id=\"forumCell-option\"><input type=\"radio\" value=\"$id\" name=\"options\"></td><td id=\"forumCell-bold\"> $option </td></tr>";
}
$text .= "<tr><td id=\"forumCell-center\" colspan=\"2\"><input type=\"submit\" class=\"submit\" value='" . $this->textArray['Vote'] . "'></td></tr></form>";
}
else {
$s = $total/100;
$barColor = $this->core->db->dbCall("barColor");
while(list($id, $option, $results) = $this->core->db->fetch_row($result)){
$option = stripslashes($option);
if ($s > 0){
$perc = ($results / $s);
$width = $perc * 2;
$perc = round($perc);
}
else {
$perc = "0";
$width = "0";
}
$text .= "<tr><td id=\"forumCell-bold\">$option : </td>";
$text .= "<td id=\"forumCell\"><img src=\"images/$barColor.gif\" alt='$results' width=\"$width\" height=\"10\"> ($perc%) ($results)</td></tr>";
}
$text .= "<tr><td id=\"forumCell\" colspan=\"2\" >" . $this->textArray['Total'] . " " . $this->textArray['Votes'] . ": $total</td></tr>";
}
$text .= "</table></p>";
$title = "<div align=left> $poll_text</div>";
$insert = $text;
include("$this->templates/files/box.tpl.php");
$text .= "<br>";
return $text;
}
function viewTopic(){
$posts_per_page = $this->core->db->dbCall("posts_per_page", "forums_config");
$siteName = $this->core->db->dbCall("siteName");
$c = $this->security->forumSecure($_GET['forum_id'], 0, 1);
$admin = $this->security->forumSecure($_GET['forum_id'], 1, 0);
if ($c == 2){ $this->body = $this->core->login(0, "forums.php?forum_id=$_GET[forum_id]&topic_id=$_GET[topic_id]&post_id=$_GET[post_id]#$_GET[post_id]"); }
else {
if ($_COOKIE["PXL"]){ $adminFun = $this->security->forumAdmin($_GET['forum_id']); }
else { $adminFun = 0; }
$allow_edit = $this->core->db->dbCall("edit_post", "forums_config");
list($cat_name, $cat_id, $forum_name) = $this->core->db->fetch("select c.name, c.cat_id, f.name from forums_forums f, forums_cat c where c.cat_id = f.cat_id and f.forum_id = '$_GET[forum_id]'");
$cat_name = stripslashes($cat_name);
$forum_name = stripslashes($forum_name);
$dateFormat = $this->core->db->dbCall("dateFormat");
if ($_GET['limit'] == ''){ $limit = 0; }
else {$limit = $_GET['limit']; }
list($topic_name, $reads, $sticky, $locked, $posts, $topic_date, $forum_poll_id) = $this->core->db->fetch("select p.title, t.`reads`, t.sticky, t.locked, t.posts, t.date, t.forum_poll_id from forums_topics t, forums_posts p where t.topic_id = '$_GET[topic_id]' and t.post_id = p.post_id");
list($next_topic) = $this->core->db->fetch("select topic_id from forums_topics where forum_id = '$_GET[forum_id]' and date > '$topic_date' order by date asc limit 0,1");
list($prev_topic) = $this->core->db->fetch("select topic_id from forums_topics where forum_id = '$_GET[forum_id]' and date < '$topic_date' order by date desc limit 0,1");
if (!$topic_name || !$forum_name){ header("Location: error.php?error=403"); exit(); }
$topic_name = stripslashes($topic_name);
$this->title = $topic_name;
$text .= "<script language=javascript>";
$text .= "MM_preloadImages('images/add_topic_over.gif', 'images/add_reply_over.gif', 'images/website_over.gif', 'images/email_user_over.gif', 'images/user_profile_over.gif', 'images/quote_over.gif', 'images/edit_over.gif', 'images/pm_over.gif', 'images/ignore_over.gif');";
$text .= "</script>";
$key = $this->core->key;
$lockForm = "<a href=\"forums.php?action=admin&subaction=lock&topic_id=$_GET[topic_id]&forum_id=$_GET[forum_id]&auth=$key\">";
if ($locked == 1){ $lockForm .= $this->textArray['Unlock'] . "</a>"; }
else { $lockForm .= $this->textArray['Lock'] . "</a>"; }
require_once("includes/formscript.inc.php");
$text .= $formScript;
if ($this->noShow != "1" && $comment_id != 0){
if ($adminFun == 1){
$text .= "<table id=\"forumBox\" cellpadding=\"0\" cellspacing=\"0\">";
$text .= "<tr><td id=\"forumTitle1\" colspan=\"2\">" . $this->textArray['Admin Functions'] . "</td></tr>";
$text .= "<tr><td id=\"boxCell\">$lockForm</td></tr>";
$text .= "</table>";
}
}
else if ($this->noShow != "1"){
$text .= "<div id=\"forumHeader1\"><a name=\"top\"><a href=\"forums.php\">$siteName " . $this->textArray['Forums'] . "</a> -> <a href=\"forums.php?cat_id=$cat_id\">$cat_name</a> -> <a href=\"forums.php?forum_id=$_GET[forum_id]\">$forum_name</a> -> $topic_name </div>";
$text .= "<table id=\"blankBox\" cellpadding=\"0\" cellspacing=\"0\">";
$text .= "<tr><td id=\"smallText\">" . $this->asst . "</td><td id=\"smallText-right\">" . $this->login . "</td></tr>";
$text .= "</table>";
$pager .= "<table id=\"blankBox\" cellpadding=\"0\" cellspacing=\"0\">";
$pager .= "<tr><td id=\"smallText\">";
if ($prev_topic != ''){ $pager .= "<a href=\"forums.php?forum_id=$_GET[forum_id]&topic_id=$prev_topic\">"; }
$pager .= "<img src=\"images/prev_arrow.gif\" alt='" . $this->textArray['Previous'] . " " . $this->textArray['Topic'] . "' border=\"0\">" . $this->textArray['Previous'] . " " . $this->textArray['Topic'] . "";
if ($prev_topic != ''){ $pager .= "</a>"; }
$pager .= " - ";
if ($next_topic != ''){ $pager .= "<a href=\"forums.php?forum_id=$_GET[forum_id]&topic_id=$next_topic\">"; }
$pager .= "" . $this->textArray['Next'] . " " . $this->textArray['Topic'] . " <img src=\"images/next_arrow.gif\" border=\"0\" alt='" . $this->textArray['Next'] . " " . $this->textArray['Topic'] . "'>";
if ($next_topic != ''){ $pager .= "</a>"; }
$pager .= "</td>";
$pager .= "<td id=\"smallText-center\">" . $this->core->newPM() . "</td>";
$pager .= "<td id=\"smallText-right\">";
if ($posts > $posts_per_page){
$postTab = $this->core->forumPostTab($limit, $posts, "forums.php?forum_id=$_GET[forum_id]&topic_id=$_GET[topic_id]", $posts_per_page);
$pager .= $postTab;
}
$pager .= "</td></tr></table>";
$text .= $pager;
if ($adminFun == 1){
$text .= "<p class=\"padding\"><table id=\"forumBox\" cellpadding=\"0\" cellspacing=\"0\">";
$text .= "<tr><td id=\"forumTitle1\" colspan=\"2\">" . $this->textArray['Admin Functions'] . "</td></tr>";
$stickyForm = "<a href=\"forums.php?action=admin&subaction=sticky&topic_id=$_GET[topic_id]&forum_id=$_GET[forum_id]&auth=$key\">";
if ($sticky == 1){ $stickyForm .= $this->textArray['Make'] . " " . $this->textArray['Un-Sticky'] . "</a>"; }
else { $stickyForm .= $this->textArray['Make'] . " " . $this->textArray['Sticky'] . "</a>"; }
$moveForm = "<form method=\"post\" action=\"forums.php?action=admin&subaction=move&topic_id=$_GET[topic_id]\"><select name=\"forum_id\"><option value=''></option>";
$moveResult = $this->core->db->query("select forum_id, name from forums_forums where forum_id != '$_GET[forum_id]' order by cat_id, ord");
while(list($f_id, $f_name) = $this->core->db->fetch_row($moveResult)){
$moveForm .= "<option value=\"$f_id\">$f_name</option>";
}
$moveForm .= "</select> <input class=\"submit\" type=\"submit\" value='" . $this->textArray['Move'] . "'></form>";
$text .= "<tr><td id=\"boxCell\">$lockForm | $stickyForm</td><td id=\"boxCell-right\">$moveForm</td></tr>";
$text .= "</table></p>";
}
}
if ($forum_poll_id != "0"){ $text .= $this->viewForumPoll($forum_poll_id, $locked); }
$text .= "<div id=\"forumBox\"><div id=\"forumTitle1-noborder\">";
if ($admin == 1 && $this->noShow != 1){
$text .= "<span onMouseOver=\"style.cursor='pointer'; MM_swapImage('addTopic', '', 'images/add_topic_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('forums.php?action=post&forum_id=$_GET[forum_id]')><img src=images/add_topic.gif name=addTopic alt='" . $this->textArray['Add Topic'] . "' border=0 > " . $this->textArray['Add Topic'] . "</span>";
if ($locked != 1){ $text .= " <span onMouseOver=\"style.cursor='pointer'; MM_swapImage('reply', '', 'images/add_reply_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('forums.php?action=post&forum_id=$_GET[forum_id]&topic_id=$_GET[topic_id]&post_id=777555xxx777')><img src=images/add_reply.gif name=reply alt='" . $this->textArray['Reply'] . "' border=0> " . $this->textArray['Post'] . " " . $this->textArray['Reply'] . "</span>"; }
else { $text .= "<img src=\"images/lock.gif\" alt='" . $this->textArray['Topic'] . " " . $this->textArray['Locked'] . "' border=\"0\">" . $this->textArray['Topic'] . " " . $this->textArray['Locked'] . ""; }
}
$text .= "</div></div>";
$ignoreList = array();
if ($_COOKIE[PXL]){
$result = $this->core->db->query("select ignore_user_id from forums_ignore where user_id = '$this->user_id'");
while(list($ignore_id) = $this->core->db->fetch_row($result)){
$ignoreList[] = "$ignore_id";
}
}
$allow_pm = $this->core->db->dbCall("allow_pm", "forums_config");
$allow_flags = $this->core->db->dbCall("allow_flags", "forums_config");
$allow_imood = $this->core->db->dbCall("allow_imood", "forums_config");
if ($this->noShow == 1){ $showSort = "desc"; }
else { $showSort = "asc"; }
$result = $this->core->db->query("select p.file, p.post_id, u.user_id, u.username, u.regdate, u.sig, u.attach_sig, r.rank_name, r.rank_image, u.posts, u.imood, a.file, u.remote_avatar, u.website, u.loc, u.view_online, s.last, p.title, p.post, p.date, p.ip_addr, t.post_id, f.flag_name, f.flag_file, u.imood, p.file_downloads from (forums_posts p, users u, forums_topics t) left join forums_session s on s.user_id = u.user_id left join forums_ranks r on u.rank = r.rank_id left join forums_flags f on f.flag_id = u.flag_id left join forums_avatars a on a.av_id = u.av_id where u.user_id = p.user_id and p.topic_id = '$_GET[topic_id]' and t.topic_id = p.topic_id order by p.post_id $showSort limit $limit, $posts_per_page");
$i=1;
$x=1;
while(list($file, $post_id, $user_id, $username, $regdate, $sig1, $attach_sig, $rank, $rank_image, $posts1, $imood, $av_id, $remote_avatar, $website, $loc, $view_online, $last, $title, $post, $post_date, $ip_addr, $topic_post, $flag_name, $flag_file, $imood, $download) = $this->core->db->fetch_row($result)){
$editCheck = 0;
$p_id = $post_id;
if ($i == 1){ $p1_id = $post_id; }
if ($x == 1){ $class="forumCell"; $f150="forumCell-150"; $right="forumCell-right"; $noborderright="forumCell-noborder-right"; $noborder="forumCell-noborder"; $x++; }
else { $class="forumCell-alt"; $f150="forumCell-alt-150"; $right="forumCell-alt-right"; $noborderright="forumCell-alt-noborder-right"; $noborder="forumCell-alt-noborder"; $x=1; }
$online=0;
$sig='';
$title = stripslashes($title);
$post = stripslashes($post);
if ($file != ''){ $post .= "<br>" . str_replace("XXX", $post_id, str_replace("PPP", $download, $file)); }
$post_date = $this->core->global->getTime($post_date);
$post_date = date($dateFormat . " H:i", $post_date);
$regdate = $this->core->global->getTime($regdate);
$regdate = date($dateFormat, $regdate);
if ($loc != ''){ $loc = stripslashes($loc) . "<br>"; }
if ($attach_sig == 1 && $sig1 != '' && $this->noShow != 1){ $sig = "<hr width=\"250\" align=\"left\">" . stripslashes($sig1); }
if ($imood != ''){ $imood = $this->textArray['I\'m Feeling'] . "...<br><img src=\"http://www.imood.com/query.cgi?email=" . $imood . "&type=1&trans=1\" alt=\"Imood\" border=\"0\">"; }
if (!$rank || $rank == '' || $rank == "0"){ list($rank, $rank_image) = $this->core->db->fetch("select rank_name, rank_image from forums_ranks where rank_min < '$posts1' and rank_spec != '1' order by rank_min desc limit 0,1"); }
$avatar = '';
if ($av_id != ''){
//if (is_file("images/avatars/$av_id")){
$avatar = "<img src=\"images/avatars/$av_id\" alt='" . $this->textArray['Avatar'] . "' border=\"0\">";
}
else if ($remote_avatar != ''){ $avatar = "<img src=\"$remote_avatar\" alt='" . $this->textArray['Avatar'] . "' border=\"0\">"; }
$online = "<img src=\"images/user_offline.gif\" alt='" . ucfirst($this->textArray['user']) . " " . $this->textArray['Offline'] . "' border=\"0\"> ";
if ($view_online == 1){
$time = $this->core->global->getTime(time(), 1) - 300;
if ($last > $time){ $online = "<img src=\"images/user_online.gif\" alt='" . ucfirst($this->textArray['user']) . " " . $this->textArray['Online'] . "' border=\"0\"> "; }
}
if ($website != ''){ $website = " <span onMouseOver=\"style.cursor='pointer'; MM_swapImage('website" . $i . "', '', 'images/website_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURLNew('$website')><img src=images/website.gif name=website" . $i . " alt='" . $this->textArray['Website'] . "' border=0></span>"; }
$text .= "<table id=\"forumBox-border\" cellpadding=\"0\" cellspacing=\"0\">";
$text .= "<tr><td id=\"$f150\" nowrap=\"nowrap\"><a name=\"#$post_id\"></a><span id=\"bold\">$username</span>";
if (!in_array($user_id, $ignoreList)){
if ($this->noShow != 1){
if ($user_id != '1'){
$text .= "<span id=\"smallText\"><br>$rank<br>";
if ($rank_image != ''){ $text .= "<img src=images/other/" . $rank_image . " alt='$rank' border=0><br>"; }
$text .= "$avatar<br>" . $this->textArray['Joined'] . ": $regdate<br>$loc" . ucfirst($this->textArray['posts']) . ": $posts1</span>";
}
if ($allow_imood == 1 && $imood != ''){ $text .= "<span class=small><br><br>" . $imood . "</span>"; }
if ($allow_flags == 1 && $flag_name != '' && $flag_file != ''){
$text .= "<p align=center><img src=images/flags/$flag_file alt='$flag_name' border=0></p>";
}
}
$text .= "</td><td id=\"$class\" style=\"word-wrap: break-word\"><span id=\"smallText\">Posted: $post_date Subject: $title</span><br><hr>$post<br>$sig";
$text .= "</td></tr>";
if ($this->noShow != 1){
$text .= "<tr>";
$text .= "<td id=\"$class\">";
if ($locked != 1 && $admin == 1){ $text .= " <span onMouseOver=\"style.cursor='pointer'; MM_swapImage('quote" . $i . "', '', 'images/quote_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('forums.php?action=post&forum_id=$_GET[forum_id]&topic_id=$_GET[topic_id]"e_id=$post_id')><img src=images/quote.gif name=quote" . $i . " alt='" . $this->textArray['Quote'] . "' border=0>" . $this->textArray['Quote'] . "</span> "; }
if ($adminFun == 0 && $allow_edit == 1){ if ($user_id == $this->user_id){ $editCheck = 1; } }
if ($editCheck == 1 || $adminFun == 1){ $text .= " <span onMouseOver=\"style.cursor='pointer'; MM_swapImage('edit" . $i . "', '', 'images/edit_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('forums.php?action=edit&post_id=$post_id&forum_id=$_GET[forum_id]&topic_id=$_GET[topic_id]')><img src=images/edit.gif name=edit" . $i . " alt='" . $this->textArray['Edit'] . " " . $this->textArray['Post'] . "' border=0>" . $this->textArray['Edit'] . " " . $this->textArray['Post'] . "</span>"; }
//$text .= "<span id=\"bold\"></span>";
$text .= "</td><td id=\"$class\"><table cellpadding=\"0\" cellspacing=\"0\" id=\"blankBox\"><tr>";
$text .= "<td id=\"$noborder\">";
if ($user_id != '1'){
$text .= "$online $website ";
if ($this->user_id != $user_id){ $text .= " <span onMouseOver=\"style.cursor='pointer'; MM_swapImage('email" . $i . "', '', 'images/email_user_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('users.php?action=email&user_id=$user_id')><img src=images/email_user.gif name=email" . $i . " alt='" . $this->textArray['Email'] . " " . ucfirst($this->textArray['user']) . "' border=0></span>"; }
if ($this->user_id != $user_id && $allow_pm == 1){ $text .= " <span onMouseOver=\"style.cursor='pointer'; MM_swapImage('pm" . $i . "', '', 'images/pm_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('forums.php?action=pm&user_id=$user_id')><img src=images/pm.gif name=pm" . $i . " alt='" . $this->textArray['PM'] . " " . ucfirst($this->textArray['user']) . "' border=0></span>"; }
$text .= " <span onMouseOver=\"style.cursor='pointer'; MM_swapImage('profile" . $i . "', '', 'images/user_profile_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('users.php?action=view&user_id=$user_id')><img src=images/user_profile.gif name=profile" . $i . " alt='" . $this->textArray['User Profile'] . "' border=0></span>";
if ($this->user_id != $user_id && $this->user_id){ $text .= " <span onMouseOver=\"style.cursor='pointer'; MM_swapImage('ignore" . $i . "', '', 'images/ignore_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=confirmIgnore('forums.php?action=ignore&ignore_id=$user_id&forum_id=$_GET[forum_id]&topic_id=$_GET[topic_id]&post_id=$post_id#$post_id')><img src=images/ignore.gif name=ignore" . $i . " alt='" . $this->textArray['Ignore'] . " " . ucfirst($this->textArray['user']) . "' border=0></span>"; }
}
if ($adminFun == 1){
$ip = $ip_addr;
require_once("includes/formscript.inc.php");
$text .= $formScript;
$reportMod = "<a href=javascript:confirmDelete('forums.php?action=admin&subaction=delete&post_id=$post_id&auth=$key')>";
if ($post_id == $topic_post){ $reportMod .= $this->textArray['Delete Topic'] . "</a>"; }
else { $reportMod .= $this->textArray['Delete Post'] . "</a>"; }
}
else {
$ip = $this->textArray['Logged'];
$reportMod = "<div class=\"attn\" id=\"$post_id\" style=\"display:none\">" . $this->textArray['Post Reported'] . "</div><a href=javascript:reportPost('$post_id')>" . $this->textArray['Report Post to Moderator'] . "</a>";
}
$text .= "</td><td id=\"$noborderright\"><span id=\"smallText\"> $reportMod | IP: $ip | <a href=\"#top\">" . $this->textArray['Back to Top'] . "</a></span></td></tr>";
$text .= "</table></tr></td></td></tr>";
}
}
else {
$text .= "</td><td id=\"$class\" style=\"word-wrap: break-word\"><span id=\"attn\">" . ucfirst($this->textArray['user']) . " " . $this->textArray['Ignored'] . "</span> ";
$text .= "<a href=\"#top\">" . $this->textArray['Back to Top'] . "</a>";
$text .= "</td></tr>";
//$text .= "<tr><td id=\"$class\"><span id=\"bold\"></span></td><td id=\"$class\"> </td></tr>";
}
$text .= "<tr><td id=\"forumTitle1-thin\" colspan=\"2\"></td></tr></table>";
$i++;
}
$text .= "<div id=\"forumBox\"><div id=\"forumTitle1-noborder\">";
if ($admin == 1 && $this->noShow != 1){
$text = str_replace("&post_id=777555xxx777", "&post_id=$p1_id", $text);
$text .= "<span onMouseOver=\"style.cursor='pointer'; MM_swapImage('addTopic1', '', 'images/add_topic_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('forums.php?action=post&forum_id=$_GET[forum_id]')><img src=images/add_topic.gif name=addTopic1 alt='" . $this->textArray['Add Topic'] . "' border=0 > " . $this->textArray['Add Topic'] . "</span>";
if ($locked != 1){ $text .= " <span onMouseOver=\"style.cursor='pointer'; MM_swapImage('reply1', '', 'images/add_reply_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('forums.php?action=post&forum_id=$_GET[forum_id]&topic_id=$_GET[topic_id]&post_id=$p_id')><img src=images/add_reply.gif name=reply1 alt='" . $this->textArray['Reply'] . "' border=0> " . $this->textArray['Post'] . " " . $this->textArray['Reply'] . "</span>"; }
else { $text .= "<img src=\"images/lock.gif\" alt='" . $this->textArray['Topic'] . " " . $this->textArray['Locked'] . "' border=\"0\">" . $this->textArray['Topic'] . " " . $this->textArray['Locked'] . ""; }
}
$text .= "</div></div>";
if ($this->noShow != 1){
$text .= $pager;
if ($_COOKIE['PXL']){
list($count) = $this->core->db->fetch("select count(forum_notify_id) from forums_notify where user_id = '$this->user_id' and topic_id = '$_GET[topic_id]'");
if ($count == 0){ $toggleImage = "images/toggle-off.gif"; }
else { $toggleImage = "images/toggle-on.gif"; }
$text .= "<div id=\"blankBox\"><div id=\"boxCell\"><a href=\"javascript:monitorToggle('forums.php?action=monitort&topic_id=$_GET[topic_id]', 'toggle')\"><img src=$toggleImage name=toggle border=0></a> " . $this->textArray['Monitor'] . " " . $this->textArray['Topic'] . "</div></div>";
}
$hold = $text;
if ($admin == 1 && $locked != 1 && $this->core->db->dbCall("quick_reply", "forums_config") == 1){
$text = "<div align=left>";
require_once("includes/formscript.inc.php");
$text .= $formScript;
$text .= "<script language=\"JavaScript\" src=\"includes/post.js\"></script>";
$text .= "<form method=\"post\" action=\"forums.php?action=post&forum_id=$_GET[forum_id]&topic_id=$_GET[topic_id]\" name=\"forum\" onsubmit=\"return validateForm(this)\">";
$text .= "<input type=\"hidden\" name=\"confirm\" value=\"1\">";
$text .= "<input type=\"hidden\" name=\"topic_id \"value=\"$_GET[topic_id]\">";
$text .= "<input type=\"hidden\" name=\"forum_id\" value=\"$_GET[forum_id]\">";
$text .= "<input type=\"hidden\" name=\"notify\" value=\"1\">";
$text .= "<textarea id='post' name=\"post\" cols=\"60%\" rows=\"15\" wrap=virtual></textarea>";
$text .= "<br><br>";
$text .= "<input type=\"submit\" name=\"submit\" value='" . $this->textArray['Submit'] . " " . $this->textArray['Post'] . "' class=\"submit\"></form> ";
$text .= "<script Language=JavaScript>";
$text .= "function validateForm(theForm)";
$text .= "{";
$text .= " if (!validRequired(theForm.post,'" . $this->textArray['Post'] . "'))";
$text .= " return false;";
$text .= " return true;";
$text .= "}";
$text .= "</script>";
$text .= "</div>"; $insert = $text;
$title = $this->textArray["Quick Reply"];
include("$this->templates/files/box.tpl.php");
$quick = $text;
}
$text = $hold . $quick;
$text .= $this->subBox();
}
$this->body = $text;
}
}
function viewForum(){
$c = $this->security->forumSecure($_GET['forum_id'], 0, 1);
$admin = $this->security->forumSecure($_GET['forum_id'], 1, 0);
if ($c == 2){ $this->body = $this->core->login(0, "forums.php?forum_id=$_GET[forum_id]"); }
else {
$topics_per_page = $this->core->db->dbCall("topics_per_page", "forums_config");
$posts_per_page = $this->core->db->dbCall("posts_per_page", "forums_config");
$siteName = $this->core->db->dbCall("siteName");
$dateFormat = $this->core->db->dbCall("dateFormat");
if ($_GET['limit'] && $_GET['limit'] != ''){ $limit = $_GET['limit']; }
else { $limit = 0; }
list($cat_name, $cat_id, $forum_name, $topics, $comment_type) = $this->core->db->fetch("select c.name, c.cat_id, f.name, f.topics, f.comment_type from forums_cat c, forums_forums f where f.forum_id = '$_GET[forum_id]' and f.cat_id = c.cat_id");
if ($comment_type != '0'){ header("Location: error.php?error=403"); }
$cat_name = stripslashes($cat_name);
$forum_name = stripslashes($forum_name);
$this->title = $forum_name;
list($num_of_sticky) = $this->core->db->fetch("select count(topic_id) from forums_topics where sticky = '1' and forum_id = '$_GET[forum_id]'");
if ($num_of_sticky < $limit || !$num_of_sticky || $num_of_sticky == 0){
$limit1 = $limit - $num_of_sticky;
$result = $this->core->db->query("select t.topic_id, p.title, p.date, u.user_id, u.username, t.`reads`, t.last_post_id, t.posts, t.locked, t.sticky, u2.user_id, u2.username, p2.date, t.forum_poll_id from forums_topics t, forums_posts p, users u, users u2, forums_posts p2 where t.forum_id = '$_GET[forum_id]' and p.post_id = t.post_id and p.user_id = u.user_id and t.sticky != '1' and t.last_post_id = p2.post_id and p2.user_id = u2.user_id and t.forum_poll_id != '-1' order by p2.date desc limit $limit1, $topics_per_page") or die(mysql_error());
}
else {
$checkFlag=1;
$result = $this->core->db->query("select t.topic_id, p.title, p.date, u.user_id, u.username, t.`reads`, t.last_post_id, t.posts, t.locked, t.sticky, u2.user_id, u2.username, p2.date, t.forum_poll_id from forums_topics t, forums_posts p, users u, users u2, forums_posts p2 where t.forum_id = '$_GET[forum_id]' and p.post_id = t.post_id and p.user_id = u.user_id and t.sticky = '1' and t.last_post_id = p2.post_id and p2.user_id = u2.user_id and t.forum_poll_id != '-1' order by p2.date desc limit $limit, $topics_per_page") or die(mysql_error());
//$rows = $this->core->db->num_rows($result);
}
$rows = $this->core->db->num_rows($result);
list($temp) = $this->core->db->fetch("select templast from forums_session where sess_id = '$_COOKIE[PXLF]'");
$text = "<p class=\"padding\"><table cellpadding=\"0\" cellspacing=\"0\" id=\"blankBox\">";
$text .= "<script language=\"javascript\">";
$text .= "MM_preloadImages('images/add_topic_over.gif');";
$text .= "</script>";
$text .= "<tr>";
$text .= "<td id=\"forumLarge\"><a href=\"forums.php\">$siteName " . $this->textArray['Forums'] . "</a> -> <a href=\"forums.php?cat_id=$cat_id\">$cat_name</a> -> $forum_name </td>";
$text .= "<td id=\"forumLarge-right\">";
if ($admin == 1){ $text .= "<span onMouseOver=\"style.cursor='pointer'; MM_swapImage('addTopic', '', 'images/add_topic_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('forums.php?action=post&forum_id=$_GET[forum_id]')><img src=images/add_topic.gif name=addTopic alt='" . $this->textArray['Add Topic'] . "' border=0 ><b> " . $this->textArray['Add Topic'] . "</b></span>"; }
$text .= "</td></tr>";
$text .= "<tr><td colspan=2><table id=\"blankBox\" cellpadding=\"0\" cellspacing=\"0\">";
$text .= "<tr><td id=\"smallText\">" . $this->asst . "</td><td id=\"smallText-right\">" . $this->login . "</td></tr>";
$text .= "</table></td></tr>";
$text .= "<tr><td id=\"smallText\" colspan=\"2\">" . $this->core->newPM() . "</td></tr>";
$text .= "</table></p>";
$text .= "<p class=\"padding\"><table cellpadding=\"0\" cellspacing=\"0\" id=\"forumBox-border\">";
$text .= "<tr><td id=\"forumTitle1\" colspan=\"2\">" . $this->textArray['Topics'] . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Replies'] . "</td>";
$text .= "<td id=\"forumTitle1-center\">" . $this->textArray['Reads'] . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Author'] . "</td><td id=\"forumTitle1-center\">" . $this->textArray['Last Post'] . "</td></tr>";
if ($rows != 0){
$more = $this->core->pageTab($limit, $topics, "forums.php?forum_id=$_GET[forum_id]", $topics_per_page);
$text .= "<tr><td id=\"paging\" colspan=\"6\">$more</td></tr>";
$x=1;
while(list($topic_id, $title, $date, $user_id, $username, $reads, $last_post_id, $posts, $locked, $sticky, $last_user_id, $last_username, $last, $poll_id) = $this->core->db->fetch_row($result)){
$more2='';
if ($posts > $posts_per_page){
$more2 = " <span id=\"smallText\"> Page :";
$b=1;
for($xx=0; $xx < $posts; $xx += $posts_per_page){
$more2 .= " <a href=\"forums.php?forum_id=$_GET[forum_id]&topic_id=$topic_id&limit=$xx\">$b</a> ";
$b++;
}
$more2 .= "</span>";
}
$posts--;
$last_date = $this->core->global->getTime($last);
$last_post = "<div id=\"smallText\">" . date($dateFormat . " H:i", $last_date) . "<br>";
$last_post .= $this->textArray['by'] . " <a href=\"users.php?action=view&user_id=$last_user_id\">$last_username</a>";
$last_post .= " <a href=\"forums.php?forum_id=$_GET[forum_id]&topic_id=$topic_id&post_id=$last_post_id\"><img src=images/view_last_post.gif width=16 height=16 alt='" . $this->textArray['View'] . " " . $this->textArray['Last Post'] . "' border=0></a></div>";
if ($poll_id != 0){ $poll = "<img src=\"images/survey.gif\" border=\"0\" alt='" . $this->textArray['Survey'] . "'>"; }
else { $poll = ''; }
$title = stripslashes($title);
if ($x == 1){ $class="forumCell"; $center="forumCell-center";$x++; }
else { $class="forumCell-alt"; $center="forumCell-alt-center";$x=1; }
$icon = $this->findIcon($sticky, $locked, $posts, $temp, $last);
$text .= "<tr><td id=\"$class\">$icon</td><td id=\"$class\">$poll<a href=forums.php?forum_id=$_GET[forum_id]&topic_id=$topic_id>$title</a> $more2</td>";
$text .= "<td id=\"$center\">$posts</td><td id=\"$center\">$reads</td>";
$text .= "<td id=\"$center\"><a href=users.php?action=view&user_id=$user_id>$username</a></td>";
$text .= "<td id=\"$class\">$last_post</td></tr>";
}
if ($rows < $topics_per_page && isset($checkFlag)){
$num = $topics_per_page - $rows;
$result = $this->core->db->query("select t.topic_id, p.title, p.date, u.user_id, u.username, t.`reads`, t.last_post_id, t.posts, t.locked, t.sticky, u2.user_id, u2.username, p2.date, t.forum_poll_id from forums_topics t, forums_posts p, users u, users u2, forums_posts p2 where t.forum_id = '$_GET[forum_id]' and p.post_id = t.post_id and p.user_id = u.user_id and t.sticky != '1' and t.last_post_id = p2.post_id and p2.user_id = u2.user_id and t.forum_poll_id != '-1' order by p2.date desc limit 0, $num") or die(mysql_error());
while(list($topic_id, $title, $date, $user_id, $username, $reads, $last_post_id, $posts, $locked, $sticky, $last_user_id, $last_username, $last, $poll_id) = $this->core->db->fetch_row($result)){
$more2='';
if ($posts > $posts_per_page){
$more2 = " <font size=-2> Page :";
$b=1;
for($xx=0; $xx < $posts; $xx += $posts_per_page){
$more2 .= " <a href=forums.php?forum_id=$_GET[forum_id]&topic_id=$topic_id&limit=$xx>$b</a> ";
$b++;
}
$more2 .= "</font>";
}
$posts--;
$last_date = $this->core->global->getTime($last);
$last_post = "<div class=small>" . date($dateFormat . " H:i", $last_date) . "<br>";
$last_post .= $this->textArray['by'] . " <a href=users.php?action=view&user_id=$last_user_id>$last_username</a>";
$last_post .= " <a href=forums.php?forum_id=$_GET[forum_id]&topic_id=$topic_id&post_id=$last_post_id><img src=images/view_last_post.gif width=16 height=16 alt='" . $this->textArray['View'] . " " . $this->textArray['Last Post'] . "' border=0></a></div>";
if ($poll_id != 0){ $poll = "<img src=images/survey.gif border=0 alt='" . $this->textArray['Survey'] . "'>"; }
else { $poll = ''; }
$title = stripslashes($title);
if ($x == 1){ $class="forumCell"; $center="forumCell-center";$x++; }
else { $class="forumCell-alt"; $center="forumCell-alt-center";$x=1; }
$icon = $this->findIcon($sticky, $locked, $posts, $temp, $last);
$text .= "<tr><td id=\"$class\">$icon</td><td id=\"$class\">$poll<a href=\"forums.php?forum_id=$_GET[forum_id]&topic_id=$topic_id\">$title</a> $more2</td>";
$text .= "<td id=\"$center\">$posts</td><td id=\"$center\">$reads</td>";
$text .= "<td id=\"$center\"><a href=users.php?action=view&user_id=$user_id>$username</a></td>";
$text .= "<td id=\"$class\">$last_post</td></tr>";
}
}
$text .= "<tr><td id=\"paging\" colspan=\"6\">$more</td></tr>";
}
else {
$text .= "<tr><td colspan=\"6\" align=\"center\"><span id=\"attn\"><br>" . $this->textArray["No Results Found"] . "<br><br></span></td></tr>";
}
$text .= "<tr><td id=\"forumTitle1-topborder\" colspan=\"6\">";
if ($admin == 1){ $text .= "<span onMouseOver=\"style.cursor='pointer'; MM_swapImage('addTopic1', '', 'images/add_topic_over.gif',1)\" onMouseOut=\"MM_swapImgRestore()\" onClick=goToURL('forums.php?action=post&forum_id=$_GET[forum_id]')><img src=\"images/add_topic.gif\" name=\"addTopic1\" alt='" . $this->textArray['Add Topic'] . "' border=0 ><b> " . $this->textArray['Add Topic'] . "</b></span>"; }
$text .= "</td></tr>";
$text .= "</table>";
if ($_COOKIE['PXL']){
list($count) = $this->core->db->fetch("select count(forum_notify_id) from forums_notify where user_id = '$this->user_id' and forum_id = '$_GET[forum_id]'");
if ($count == 0){ $toggleImage = "images/toggle-off.gif"; }
else { $toggleImage = "images/toggle-on.gif"; }
$text .= "<div id=\"blankBox\"><div id=\"boxCell\"><a href=\"javascript:monitorToggle('forums.php?action=monitor&forum_id=$_GET[forum_id]', 'toggle')\"><img src=$toggleImage name=toggle border=0></a> " . $this->textArray['Monitor'] . " " . $this->textArray['Forum'] . "</div></div>";
}
$text .= $this->subBox();
$this->body = $text;
}
}
}
?>