<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| Modified by PHP-Fusion SF Group
| Copyright © 2007 by SF
| http://www.rus-phpfusion.com/
+----------------------------------------------------*/
include "../maincore.php";
include FORUM."subheader.php";
if ($settings_forum['show_panel'] == 1){
	require_once BASEDIR."side_left.php";
}
if (file_exists(INFUSIONS."forum_threads_list_panel/locale/".$settings['locale'].".php")) {
	include INFUSIONS."forum_threads_list_panel/locale/".$settings['locale'].".php";
} else {
	include INFUSIONS."forum_threads_list_panel/locale/English.php";
}

if (!iMEMBER) fallback("../../index.php");

if (!isset($lastvisited) || !isNum($lastvisited)) $lastvisited = time();

opentable("<a href='index.php'>".$settings_forum['forumname']."</a> | ".$locale['028']."</td>\n");
$result = dbquery(
	"SELECT tp.*, tf.* FROM ".$db_prefix."posts tp
	INNER JOIN ".$db_prefix."forums tf USING(forum_id)
	WHERE ".groupaccess('forum_access')." AND tp.post_datestamp>'$lastvisited'"
);
$rows = dbrows($result);
if ($rows != 0) {
	if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
	$result = dbquery(
		"SELECT tp.*, tf.*, tu.user_id,user_name FROM ".$db_prefix."posts tp
		INNER JOIN ".$db_prefix."forums tf USING(forum_id)
		LEFT JOIN ".$db_prefix."users tu ON tp.post_author=tu.user_id
		WHERE ".groupaccess('forum_access')." AND tp.post_datestamp>'$lastvisited' ORDER BY post_datestamp ASC LIMIT $rowstart,20"
	);
echo "<table border='0' cellspacing='0' cellpadding='0' width='100%'

class='tbl-border'>
<tr>
<td>
<table border='0' cellspacing='1' cellpadding='0' width='100%'>
<tr>
<td style='text-align:center;' class='tbl2'>&nbsp;</td>
<td style='text-align:center;' class='tbl2'><b>".$locale['ftl120']."</b></td>
<td style='text-align:center;' class='tbl2'><b>".$locale['ftl121']."</b></td>
<td style='text-align:center;' class='tbl2' width='100'><b>".$locale['ftl124']."</b></td>
<td style='text-align:center;' class='tbl2' width='120'><b>".$locale['ftl108']."</b></td>";

while ($data = dbarray($result)) {

echo "<tr>
<td style='text-align:center;' class='tbl1'><img alt='' border='0' src='".THEME."forum/folder.gif'></td>
<td class='tbl1'><a href='".BASEDIR."forum/viewforum.php?forum_id=".$data['forum_id']."&amp;forum_cat=".$data['forum_cat']."'>".$data['forum_name']."</a></td>
<td class='tbl1'><a href='".BASEDIR."forum/viewthread.php?forum_id=".$data['forum_id']."&amp;thread_id=".$data['thread_id']."&amp;pid=".$data['post_id']."#post_".$data['post_id']."'>".$data['post_subject']."</a></td>
<td style='text-align:center;' class='tbl1'><a href='".BASEDIR."profile.php?lookup=".$data['post_author']."'>".$data['user_name']."</a></td>
<td style='text-align:center;' class='tbl1'>".showdate("forumdate",$data['post_datestamp'])."</td>
</tr>";
}
	echo "</table><tr>\n<td align='center' colspan='5' class='tbl1'>".sprintf($locale['039'], $rows)."</td>\n</tr>\n</table>\n";
} else {
	echo "<center><br>".sprintf($locale['039'], $rows)."<br><br></center>\n";
}
if ($rows > 20) echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,20,$rows,3)."\n</div>\n";
closetable();
if ($settings_forum['show_panel'] == 1){
	require_once BASEDIR."side_right.php";
}
include FORUM."footer.php";
?>