PHP Code:
<?php
/*
************************************************
*==========[TS Special Edition v.5.6]==========*
************************************************
* Special Thanks To *
* DrNet - wWw.SpecialCoders.CoM *
* Vinson - wWw.Decode4u.CoM *
* MrDecoder - wWw.Fearless-Releases.CoM *
* Fynnon - wWw.BvList.CoM *
*==============================================*
* by lateam *
* *
* *
************************************************
*/
// Dont change for future reference.
if (!defined('TS_P_VERSION'))
{
define('TS_P_VERSION', '1.1 by xam');
}
// 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>");
}
function quick_replace_tags($s)
{
$simple_search = array(
"/\[b\]((\s|.)+?)\[\/b\]/is",
"#\[size=(xx-small|x-small|small|medium|large|x-large|xx-large)\](.*?)\[/size\]#si",
"#\[align=(left|center|right|justify)\](.*?)\[/align\]#si",
"/\[i\]((\s|.)+?)\[\/i\]/is",
"/\[h\]((\s|.)+?)\[\/h\]/is",
"/\[u\]((\s|.)+?)\[\/u\]/is",
"/\[img\]((http|https):\/\/[^\s'\"<>]+(\.(jpg|gif|png)))\[\/img\]/is",
"/\[img=((http|https):\/\/[^\s'\"<>]+(\.(gif|jpg|png)))\]/is",
"/\[color=([a-zA-Z]+)\]((\s|.)+?)\[\/color\]/is",
"/\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\]((\s|.)+?)\[\/color\]/is",
"/\[url=([^()<>\s]+?)\]((\s|.)+?)\[\/url\]/is",
"/\[url\]([^()<>\s]+?)\[\/url\]/is",
"/(\A|[^=\]'\"a-zA-Z0-9])((http|ftp|https|ftps|irc):\/\/[^()<>\s]+)/i"
);
$simple_replace = "\\1";
$s = preg_replace ($simple_search, $simple_replace, $s);
$s = str_replace(array("\n","\r"), "", $s);
$s = addslashes($s);
return $s;
}
$lang->load('browse');
// BEGIN Plugin: torrents
//define('SKIP_CACHE_MESSAGE', true);
//require_once(INC_PATH.'/functions_cache2.php');
//if (!($torrents=cache_check2('torrents')))
//{
$lt_query = sql_query('SELECT t.id,t.name,t.size,t.descr,t.offensive,t.added,t.seeders,t.leechers,t.category,t.numfiles,t.owner,t.anonymous,t.ts_external,t.times_completed,t.t_image,c.vip FROM torrents t LEFT JOIN categories c ON t.category = c.id WHERE t.visible = \'yes\' AND t.banned=\'no\' AND t_image != \'\' ORDER BY added DESC LIMIT 0,'.$i_torrent_limit);
if(mysql_num_rows($lt_query) > 0)
{
$torrents = '<!-- begin lastXforumposts -->
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td class="thead" align="left" style="padding: 10px 0 0 0;"> '.$lang->browse['t_name'].'</td>
<td class="thead" align="center" style="padding: 10px 0 0 0;"><img src="'.$BASEURL.'/'.$pic_base_url.'/down1.gif" border="0" class="inlineimg"></td>
<td class="thead" align="center" style="padding: 10px 0 0 0;"><img src="'.$BASEURL.'/'.$pic_base_url.'/files.gif" border="0" class="inlineimg"></td>
<td class="thead" align="center" style="padding: 10px 0 0 0;"><img src="'.$BASEURL.'/'.$pic_base_url.'/comments.gif" border="0" class="inlineimg"></td>
<td class="thead" align="center" style="padding: 10px 0 0 0;"><img src="'.$BASEURL.'/'.$pic_base_url.'/seeders.gif" border="0" class="inlineimg"></td>
<td class="thead" align="center" style="padding: 10px 0 0 0;"><img src="'.$BASEURL.'/'.$pic_base_url.'/leechers.gif" border="0" class="inlineimg"></td>
<td class="thead" align="center" style="padding: 10px 0 0 0;">'.$lang->global['size'].' </td>
<td class="thead" align="center" style="padding: 10px 0 0 0;"> '.$lang->global['snatched'].'</td>
</tr>
';
$count=0;
while($row = mysql_fetch_assoc($lt_query))
{
if ($usergroups['canviewviptorrents'] != 'yes' && $row['vip'] == 'yes') continue;
elseif ($row['offensive'] == 'yes' && preg_match('#E0#is', $CURUSER['options'])) continue;
$seolink = ts_seo($row['id'], $row['name'], 's');
$cdesc = htmlspecialchars_uni($c['cat_desc']);
$seolink2 = ts_seo($row['id'],$row['name'],'s');
$seolink3 = ts_seo($row['id'],$row['name'],'d');
$fullname = $javascriptname = htmlspecialchars_uni($row['name']);
$javascriptname = str_replace("'", "\'", $javascriptname);
$torrent_files = '<b>'.($row['numfiles'] > 1 ? '<a href="'.$BASEURL.'/details.php?id='.$row['id'].'&tab=filelist">' : '').ts_nf($row['numfiles']).($row['numfiles'] > 1 ? '</a>' : '').'</b>';
$torrent_comments = ($row['comments'] > 0 ? '<a href="'.$BASEURL.'/details.php?id='.$row['id'].'&tab=comments">' : '').'<b>'.ts_nf($row['comments']).'</b>'.($row['comments'] > 0 ? '</a>' : '');
$torrent_download_link = (!$is_bookmark_page ? '<a href="'.$seolink3.'" title="'.$downloadinfo.'" alt="'.$downloadinfo.'" /><img src="'.$BASEURL.'/'.$pic_base_url.'dl.gif"></a>' : '<a href="'.$BASEURL.'/bookmarks.php?torrentid='.$torrents['id'].'&action=delete" title="" alt="" /><img src="'.$BASEURL.'/'.$pic_base_url.'delete.gif"></a>');
$torrent_snatched = ($row['ts_external'] == 'no' && $row['times_completed'] > 0 && $usergroups['cansnatch'] == 'yes' ? sprintf($lang->browse['info3'], '<a href="'.$BASEURL.'/viewsnatches.php?id='.$row['id'].'"><b>'.ts_nf($row['times_completed']).'</b></a>') : sprintf($lang->browse['info3'], '<b>'.ts_nf($row['times_completed']).'</b>'));
$added = my_datee($dateformat, $row['added']).' '.my_datee($timeformat, $row['added']);
$show_latesttorrent_contents = '<table><tr>'.($row['t_image'] ? '<td rowspan=2><img src='.htmlspecialchars_uni($row['t_image']).' border=0 height=150 width=150 /></td>' : '').'<td class=none valign=top><b>'.$lang->index['name'].':</b> '.$javascriptname.'<br /><b>'.$lang->index['size'].':</b> '.mksize($row['size']).'<br /><b>'.$lang->index['uploaddat'].':</b> '.$added.'<br /><b>'.$lang->index['seeders'].':</b> '.ts_nf($row['seeders']).'<br /><b>'.$lang->index['leechers'].':</b> '.ts_nf($row['leechers']).'<br />'.cutename(quick_replace_tags($row['descr']), 170).'</tr></td></table>';
$torrents .='
<tr><td align="left">';
$torrents .= $_title_bracket.' <a href="'.$seolink.'" onmouseover="ddrivetip(\''.$show_latesttorrent_contents.'\', 500)" onmouseout="hideddrivetip()">'.cutename($row['name'], 30).'</a>';
$torrents .='</td>';
$torrents .='<td align="center">'.$torrent_download_link.'</td>';
$torrents .='<td align="center">'.$torrent_files.'</td>';
$torrents .='<td align="center">'.$torrent_comments.'</td>';
$torrents .='<td align="center">'.ts_nf($row['seeders']).'</td>';
$torrents .='<td align="center">'.ts_nf($row['leechers']).'</td>';
$torrents .='<td align="center">'.mksize($row['size']).'</td>';
$torrents .='<td align="center">'.$torrent_snatched.'</td>';
}
$torrents .= ' </tr></table>
</div><!-- end torrents -->';
//cache_save2('torrents', $torrents);
}
//}
// END Plugin: torrents
?>