'".$lastvisited."'");
if (isset($_COOKIE['ep_posts']))
{
$readed= explode(".", $COOKIE['ep_posts']);
} else $readed = array();
while ($posts = dbarray($r_posts))
{
if (!in_array($posts['post_id'], $readed)) $p .= ".".$posts['post_id'];
}
$readed_posts = implode(".", $readed);
$readed_posts .= $p;
setcookie("ep_posts", $readed_posts, (time() + 3600*3), "/", "", "0");
redirect("index.php");
}
// panele
$table = "panels_forum";
require_once BASEDIR."side_left.php";
include LOCALE.LOCALESET."forum/main.php";
if (!isset($lastvisited) || !isNum($lastvisited)) $lastvisited = time();
$threads_per_page = 20;
if (!FUSION_QUERY || !$forum_id || !isNum($forum_id)) fallback("index.php");
$result = dbquery(
"SELECT f.*, f2.forum_name AS forum_cat_name
FROM ".$db_prefix."forums f
LEFT JOIN ".$db_prefix."forums f2 ON f.forum_cat=f2.forum_id
WHERE f.forum_id='".$forum_id."'"
);
if (dbrows($result)) {
$data = dbarray($result);
if (!checkgroup($data['forum_access']) || !$data['forum_cat']) fallback("index.php");
} else {
fallback("index.php");
}
$can_post = checkgroup($data['forum_posting']);
$caption = $data['forum_cat_name']." | ".$data['forum_name'];
opentable($locale['450']);
echo "
\n";
$rows = dbrows(dbquery("SELECT * FROM ".$db_prefix."threads WHERE forum_id='$forum_id' AND thread_sticky='0'"));
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
if ($rows > $threads_per_page) {
echo "
".makePageNav($rowstart,20,$rows,3,FUSION_SELF."?forum_id=$forum_id&")."
\n";
}
echo "
".$locale['451']."
".$locale['452']."
".$locale['453']."
".$locale['454']."
".$locale['404']."
\n";
if ($rowstart == 0) {
$result = dbquery(
"SELECT ".$db_prefix."threads.*, tu1.user_name as user_author, tu2.user_name as user_lastuser FROM ".$db_prefix."threads
LEFT JOIN ".$db_prefix."users tu1 ON ".$db_prefix."threads.thread_author = tu1.user_id
LEFT JOIN ".$db_prefix."users tu2 ON ".$db_prefix."threads.thread_lastuser = tu2.user_id
WHERE forum_id='$forum_id' AND thread_sticky='1' ORDER BY thread_lastpost DESC"
);
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
if (iMEMBER)
{
$new_posts=0;
$result1 = dbquery("SELECT post_id from ".$db_prefix."posts WHERE thread_id='".$data['thread_id']."' AND post_datestamp>'".$lastvisited."'");
$r = array();
if (isset($_COOKIE['ep_posts'])) {
$r = explode(".", $_COOKIE['ep_posts']);
}
while ($d = dbarray($result1))
{
if (!in_array($d['post_id'], $r)) {$new_posts = mysql_num_rows($result1); break;}
}
unset($d);
unset($r);
unset($result1);
} else $new_posts=0;
$thread_replies = $data['thread_replies'];
if ($data['thread_locked']) {
echo "\n ";
} else {
if ($new_posts > 0 && $new_posts < 20) {
$folder = " ";
} else if ($new_posts >= 20) {
$folder = " ";
} else {
$folder = " ";
}
echo " \n$folder ";
}
$reps = $data['thread_replies']+1;
$reps = ceil($reps / $threads_per_page);
$threadsubject = "".$data['thread_subject']." ";
if ($reps > 1) {
$ctr = 0; $ctr2 = 1; $pages = "";
while ($ctr2 <= $reps) {
$pnum = "$ctr2 ";
$pages = $pages.$pnum; $ctr = $ctr + $threads_per_page; $ctr2++;
}
$threadsubject .= " - (".$locale['412'].trim($pages).")";
}
echo "
$threadsubject
".$data['user_author']."
".$data['thread_views']."
".$thread_replies."
".showdate("forumdate", $data['thread_lastpost'])."
".$locale['406']."".$data['user_lastuser']."
\n";
}
$threadcount = dbrows($result);
} else {
$threadcount = 0;
}
}
if ($rows != 0) {
$result = dbquery(
"SELECT ".$db_prefix."threads.*, tu1.user_name as user_author, tu2.user_name as user_lastuser FROM ".$db_prefix."threads
LEFT JOIN ".$db_prefix."users tu1 ON ".$db_prefix."threads.thread_author = tu1.user_id
LEFT JOIN ".$db_prefix."users tu2 ON ".$db_prefix."threads.thread_lastuser = tu2.user_id
WHERE forum_id='$forum_id' AND thread_sticky='0' ORDER BY thread_lastpost DESC LIMIT $rowstart,20"
);
$numrows = dbrows($result);
while ($data = dbarray($result)) {
if (iMEMBER)
{
$new_posts=0;
$result1 = dbquery("SELECT post_id from ".$db_prefix."posts WHERE thread_id='".$data['thread_id']."' AND post_datestamp>'".$lastvisited."'");
$r = array();
if (isset($_COOKIE['ep_posts'])) {
$r = explode(".", $_COOKIE['ep_posts']);
}
while ($d = dbarray($result1))
{
if (!in_array($d['post_id'], $r)) {$new_posts = mysql_num_rows($result1); break;}
}
unset($d);
unset($r);
unset($result1);
} else $new_posts=0;
$thread_replies = $data['thread_replies'];
if ($data['thread_locked']) {
echo "\n ";
} else {
if ($new_posts > 0 && $new_posts < 20) {
$folder = " ";
} else if ($new_posts >= 20) {
$folder = " ";
} else {
$folder = " ";
}
echo " \n$folder ";
}
$reps = $data['thread_replies']+1;
$reps = ceil($reps / $threads_per_page);
$threadsubject = "".$data['thread_subject']." ";
if ($reps > 1) {
$ctr = 0; $ctr2 = 1; $pages = "";
while ($ctr2 <= $reps) {
$pnum = "$ctr2 ";
$pages = $pages.$pnum; $ctr = $ctr + $threads_per_page; $ctr2++;
}
$threadsubject .= " - (".$locale['412'].trim($pages).")";
}
echo "$threadsubject
".$data['user_author']."
".$data['thread_views']."
".$thread_replies."
".showdate("forumdate", $data['thread_lastpost'])."
".$locale['406']."".$data['user_lastuser']."
\n";
}
} else {
if ($threadcount == 0) {
echo "\n".$locale['455']." \n \n";
}
}
echo "
\n";
if ($rows > $threads_per_page) {
echo "
".makePageNav($rowstart,20,$rows,3,FUSION_SELF."?forum_id=$forum_id&")."
\n";
}
$forum_list = ""; $current_cat = "";
$result = dbquery(
"SELECT f.forum_id, f.forum_name, f2.forum_name AS forum_cat_name
FROM ".$db_prefix."forums f
INNER JOIN ".$db_prefix."forums f2 ON f.forum_cat=f2.forum_id
WHERE ".groupaccess('f.forum_access')." AND f.forum_cat!='0' ORDER BY f2.forum_order ASC, f.forum_order ASC"
);
while ($data2 = dbarray($result)) {
if ($data2['forum_cat_name'] != $current_cat) {
if ($current_cat != "") $forum_list .= "\n";
$current_cat = $data2['forum_cat_name'];
$forum_list .= "\n";
}
$sel = ($data2['forum_id'] == $data['forum_id'] ? " selected" : "");
$forum_list .= "".$data2['forum_name']." \n";
}
$forum_list .= " \n";
echo "
".$locale['540']."
$forum_list \n";
if (iMEMBER && $can_post) {
echo "
\n";
}
echo "
\n";
echo "
- ".$locale['456']."(
- ".$locale['457']." )
- ".$locale['458']."
- ".$locale['459']."
- ".$locale['460']."
\n";
closetable();
echo "\n";
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>