upgrade new version plugin Recent Threads
latestthreads.php
PHP Code:
<?php
// Dont change for future reference.
if (!defined('TS_P_VERSION'))
{
define('TS_P_VERSION', '1.2.0 by Keiichi');
}
// Security Check.
if (!defined('IN_PLUGIN_SYSTEM'))
{
die("<font face='verdana' size='2' color='darkred'><b>Error!</b> Direct initialization of this file is not allowed.</font>");
}
// BEGIN Plugin: lastXforumposts
include_once(INC_PATH.'/readconfig_forumcp.php');
$_res_lt_query = sql_query("SELECT fp.fid,f.fid FROM ".TSF_PREFIX."forumpermissions fp LEFT JOIN ".TSF_PREFIX."forums f ON (fp.fid=f.pid) WHERE (fp.canview = 'no' OR fp.cansearch = 'no') AND fp.gid = ".sqlesc(($CURUSER ? $CURUSER['usergroup'] : UC_USER)));
if (mysql_num_rows($_res_lt_query) > 0)
{
while ($notin = mysql_fetch_assoc($_res_lt_query))
$uf[] = 0+$notin['fid'];
$unsearchforums = implode(',', $uf);
}
$_res_lt_query = sql_query("SELECT fid,password FROM ".TSF_PREFIX."forums WHERE password != ''");
if (mysql_num_rows($_res_lt_query) > 0)
{
while ($notin = mysql_fetch_assoc($_res_lt_query))
{
if (ts_get_array_cookie("forumpass", $notin['fid']) != md5($CURUSER['id'].$notin['password']))
{
$uf2[] = 0+$notin['fid'];
}
}
if (count($uf2) > 0)
{
if ($unsearchforums)
$unsearchforums .= ','.implode(',', $uf2);
else
$unsearchforums = implode(',', $uf2);
}
}
if($unsearchforums) $where_sql = " AND t.fid NOT IN ($unsearchforums)";
$_res_lt_query = sql_query("SELECT t.tid, t.iconid, t.subject, t.dateline, t.uid, t.username, t.replies, t.lastpost, t.lastposter, t.lastposteruid, t.views FROM ".TSF_PREFIX."threads t WHERE 1=1 {$where_sql} ORDER BY t.lastpost DESC LIMIT 0, ".$i_post_limit);
{
$latestthreads = '
<!-- begin lastXforumposts -->
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td class="subheader" width="1%"></td>
<td class="subheader" align="left" width="50%">'.$lang->index['topictitle'].'</td>
<td class="subheader" align="center" width="30%">'.$lang->index['lastposter'].'</td>
<td class="subheader" align="center" width="5%">'.$lang->index['replies'].'</td>
<td class="subheader" align="center" width="5%">'.$lang->index['views'].'</td>
</tr>';
while($thread = mysql_fetch_assoc($_res_lt_query))
{
$latestthreads .= '
<tr>
<td align="left"><img src="./tsf_forums/images/icons/icon'.$thread['iconid'].'.gif" border="0" class="inlineimg">
<td align="left"><strong><style="padding-top: 6px;"><a href="'.$BASEURL.'/tsf_forums/showthread.php?tid='.$thread['tid'].'" alt="'.htmlspecialchars_uni($thread['subject']).'" title="'.htmlspecialchars_uni($thread['subject']).'">'.cutename(htmlspecialchars_uni($thread['subject']), 50).'</a></strong><br> '.sprintf($lang->index['by'], '<a href="'.$BASEURL.'/userdetails.php?id='.$thread['uid'].'">'.$thread['username'].'</a>' ).'<br />'.my_datee($dateformat, $thread['dateline']).' '.my_datee($timeformat, $thread['dateline']).'</td>
<td align="right">'.my_datee($dateformat, $thread['lastpost']).' '.my_datee($timeformat, $thread['lastpost']).'<br /> '.sprintf($lang->index['by'], '<a href="'.$BASEURL.'/userdetails.php?id='.$thread['lastposteruid'].'">'.$thread['lastposter'].'</a>' ).' <a href="./tsf_forums/showthread.php?tid='.$thread['tid'].'&page=last"><img src="./tsf_forums/images/lastpost.gif" class="inlineimg" border="0" alt="'.$lang->index['last'].'" title="'.$lang->index['last'].'"></a></td>
<td align="center"><strong>'.ts_nf($thread['replies']).'</strong></td>
<td align="center"><strong>'.ts_nf($thread['views']).'</strong></td>
</tr>';
}
$latestthreads .= '</table><!-- end lastXforumposts -->';
}
// END Plugin: lastXforumposts
?>