PHP Code:
<?php
/*
+------------------------------------------------
| TBDev.net BitTorrent Tracker PHP
| =============================================
| by CoLdFuSiOn
| (c) 2003 - 2009 TBDev.Net
| http://www.tbdev.net
| =============================================
| svn: http://sourceforge.net/projects/tbdevnet/
| Licence Info: GPL
+------------------------------------------------
| $Date$
| $Revision$
| $Author$
| $URL$
+------------------------------------------------
*/
ob_start("ob_gzhandler");
require_once("include/bittorrent.php");
require_once "include/user_functions.php";
require_once "include/bbcode_functions.php";
require_once "include/pager_functions.php";
require_once "include/torrenttable_functions.php";
require_once "include/html_functions.php";
require_once "include/bt_client_functions.php";
function ratingpic($num) {
global $TBDEV;
$r = round($num * 2) / 2;
if ($r < 1 || $r > 5)
return;
return "<img src=\"{$TBDEV['pic_base_url']}{$r}.gif\" border=\"0\" alt=\"rating: $num / 5\" />";
}
dbconn(false);
loggedinorreturn();
$lang = array_merge( load_language('global'), load_language('details') );
if (!isset($_GET['id']) || !is_valid_id($_GET['id']))
stderr("{$lang['details_user_error']}", "{$lang['details_bad_id']}");
$id = (int)$_GET["id"];
if (isset($_GET["hit"]))
{
mysql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
/* if ($_GET["tocomm"])
header("Location: {$TBDEV['baseurl']}/details.php?id=$id&page=0#startcomments");
elseif ($_GET["filelist"])
header("Location: {$TBDEV['baseurl']}/details.php?id=$id&filelist=1#filelist");
elseif ($_GET["toseeders"])
header("Location: {$TBDEV['baseurl']}/peerlist.php?id=$id#seeders");
elseif ($_GET["todlers"])
header("Location: {$TBDEV['baseurl']}/peerlist.php?id=$id#leechers");
else */
header("Location: {$TBDEV['baseurl']}/details.php?id=$id");
exit();
}
if(@$_GET['del']) {
$if = mysql_query("SELECT * FROM `comments` WHERE `id` = '" .$_GET['del']. "'");
if(mysql_num_rows($if) == FALSE) {
refresh("details.php?id={$_GET['id']}",0);
} else {
mysql_query("DELETE FROM `comments` WHERE `id` = '" .$_GET['del']. "'");
alert('נמחק בהצלחה');
refresh("details.php?id={$_GET['id']}",0);
}
}
$s = htmlentities(@$row['name'], ENT_QUOTES );
$upload_details = mysql_fetch_assoc(mysql_query("SELECT * FROM `torrents` WHERE `id` = '" .$_GET['id']. "'"));
$get_upload_date = @get_date(@$upload_details['added']);
$uploader_details = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '" .$upload_details['owner']. "'"));
$rank_details = mysql_fetch_assoc(mysql_query("SELECT * FROM `Levels` WHERE `id` = '" .$uploader_details['class']. "'"));
$cat_details = mysql_fetch_assoc(mysql_query("SELECT * FROM `categories` WHERE `id` = '" .$upload_details['category']. "'"));
if($upload_details['banned'] == "yes") {
$HTMLOUT .= "אינך יכול לצפות בדף זה.<br />יתכן וטורנט זה נמחק/נאסר לשימוש.";
} else {
$upped = userupload($uploader_details['id']);
$downed = userdownload($uploader_details['id']);
$ratio = userratio($uploader_details['id']);
$join_date = get_date($uploader_details['added']);
$file_size = mksize($upload_details['size']);
$p_reseed = $_GET['id'];
$secureGET = intval($upload_details['owner']);
$queryM = mysql_query("SELECT COUNT(id) as countit FROM forum_messeges WHERE userid = '{$secureGET}'");
$getRow = mysql_fetch_assoc($queryM);
$r = @mysql_query("SELECT * FROM `torrents` WHERE id=$id") or sqlerr();
$torrent = @mysql_fetch_assoc($r) or stderr("שגיאה", "האשכול אינו קיים.");
if(@$upload_details['owner'] == $CURUSER['id'] || @$CURUSER['class'] >= UC_MODERATOR) {
@$getid = $_GET['id'];
$edit = " | <a href='edit.php?id={$getid}'>ערוך העלאה</a>";
} else {
$edit = "";
}
$descccc = format_comment($upload_details['descr']);
if( preg_match( "/<center>/i", $descccc ) )
$pStyle = "style='text-align: center;'";
else
$pStyle = null;
$descccc = preg_replace( "/<center>/i", "", $descccc );
$descccc = preg_replace( "/<\/center>/i", "", $descccc );
$str_download_title = cut_download($upload_details['name']);
preg_match('/<img.+src=[\'"](?P<src>.+?)[\'"].*>/i', $descccc, $image);
$descccc = str_replace( $image['src'], "", $descccc );
// NEW DESIGN
$HTMLOUT .= "
<div style='float: right;width: 100%;margin: 5px 0 0 0;'>
<form method='post'>
<input name='reseed' type='submit' class='myButton' value='בקש ריסיד' />
</form>
";
$HTMLOUT .= "
<form method='post'>
<input name='treport' type='submit' class='myButton' value='דווח' />
</form>
";
if($CURUSER['class'] >= UC_MODERATOR || $CURUSER['username'] == $uploader_details['username'] ) {
$HTMLOUT .=" <a href='edit.php?id={$p_reseed}'><input type='submit' class='myButton' value='ערוך טורנט' /></a>";
}
$r = mysql_fetch_assoc(mysql_query("SELECT * FROM `torrents` WHERE `id`='".$_GET['id']."'"));
if($r['isdouble'] == 1) {
$color = "backgrond:gold;";
}elseif($r['isdouble'] == 2) {
$color = "background:lightblue;";
}elseif($r['isdouble'] == 3) {
$color = "background:purple;";
} else {
$color = "";
}
$HTMLOUT .="
</div>
<div id='details_new'>
<div style='background: url({$image['src']});opacity: 0.5;display: block;width: 900px;height: 380px;-webkit-filter: blur(10px); -moz-filter: blur(3px); -o-filter: blur(3px); -ms-filter: blur(3px); filter: blur(3px);background-size: cover; background-position: center center;'></div>
<div class='content'>
<img src='{$image['src']}' alt='upload_photo' />
<div style='width: 635px;float: right;'>
<div id='title_upload' style='{$color}float: right;'>
{$str_download_title}
</div>
<div style='clear: both;'></div>
<p class='text' {$pStyle}>
{$descccc}
</p>
<table cellpadding='0' cellspacing='0' style='margin: 13px 7px 0 0;'>
<tr>
<td id='uploader_up'>
<table cellpadding='0' cellspacing='0' style='margin: 0 3px 0 0;'>
<tr>
<td>
";
if(!empty($uploader_details['avatar']))
{
if($upload_details['anon'] <= 0)
{
$avatar = "<img src='{$uploader_details['avatar']}' alt='uploader_photo' />";
}
else
{
$avatar = "<img src='http://www.hungtienjsc.com.vn/cdn/hungtien/Images/no-avatar-male.jpg' alt='uploader_photo' />";
}
}
else
{
$avatar = "";
}
$HTMLOUT .= "
{$avatar}
</td>
<td style='padding: 0 5px 0 0;'>
";
if($upload_details['anon'] <= 0)
{
$det = "<a href='userdetails.php?id={$uploader_details['id']}' style='font-weight: bold;font-family: tahoma;font-size: 15px;color: {$rank_details['color']};'>{$uploader_details['username']}</a><br />
<span style='color: #a2a2a2'>{$uploader_details['subtitle']}</span>";
}
else{
if($CURUSER['class'] >= UC_MODERATOR) {
$anon = "(".$uploader_details['username'].")";
} else {
$anon = "";
}
$det = "<h3>אנונימי $anon</h3>";
}
$HTMLOUT .= "
{$det}
</td>
</tr>
</table>
</td>
<td id='info_up'>
<table cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td align='right' style='padding: 0 5px 0 0;'>
<a href=\"http://downland.in/uploaders_details.php?id=".$_GET['id']."&up=".$_GET['id']."\" onclick=\"window.open(this.href, 'mywin','width=500,height=500'); return false;\" style='color: #FFF;'>מעלים: <strong>{$upload_details['seeders']}</strong></a>,
<a href=\"http://downland.in/uploaders_details.php?id=".$_GET['id']."&down=".$_GET['id']."\" onclick=\"window.open(this.href, 'mywin','width=500,height=500'); return false;\" style='color: #FFF;'>מורידים: <strong>{$upload_details['leechers']}</strong></a>,
<a href=\"http://downland.in/uploaders_details.php?id=".$_GET['id']."&done=".$_GET['id']."\" onclick=\"window.open(this.href, 'mywin','width=500,height=500'); return false;\" style='color: #FFF;'>סיימו להוריד: <strong>{$upload_details['times_completed']}</strong></a>.<br />
גודל הקובץ: <strong>{$file_size}</strong>, קטגוריה: <strong>{$cat_details['name']}</strong>.
</td>
<td align='left'>
<a href='http://downland.in/download.php?torrent={$_GET['id']}'>
<img src='images/download_up.png' alt='download_up' />
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
<table style='float:right;width:100%;margin: 0 0 25px 0;'>
<tr style='background: #323232;'>
<td width='20%' style='padding: 4px;font-weight: bold;font-size: 13px;' valign='top'>
<a style='color: #FFF;'>
קבצים <img src='images/plus.png' id='filesplus' alt='' /> <img src='images/minus.png' id='filesminus' alt='' />
</a>
</td>
<td style='padding: 4px;'>
<table cellpadding='0' cellspacing='0' width='100%' style='border: 1px solid #000;'>
<tr>
<td width='85%' class='bg-table' style='border-right: 1px solid #000;border-left: 1px solid #000;border-bottom: 1px solid #000;'>
שם הקובץ
</td>
<td width='15%' class='bg-table' style='border-right: 1px solid #000;border-left: 1px solid #000;border-bottom: 1px solid #000;'>
גודל
</td>
</tr>
";
$getfiles = mysql_query("SELECT * FROM `files` WHERE `torrent` = '" .$_GET['id']. "'");
while($ro = mysql_fetch_assoc($getfiles)) {
$size = mksize($ro['size']);
$HTMLOUT .= "
<tr class='filesnames'>
<td style='background: #383838;padding: 4px;' width='85%'>
{$ro['filename']}
</td>
<td style='background: #383838;padding: 4px;' width='15%'>
<span dir='ltr'>{$size}</span>
</td>
</tr>
";
}
$HTMLOUT .= "
</table>
</td>
</tr>
</table>
";
if(isset($_POST['reseed'])) {
$user_id = $CURUSER['id'];
$t_id = $p_reseed;
$check = mysql_query("SELECT * FROM `torrents` WHERE `seeders` = '0' AND `id` = '" .$p_reseed. "'");
if(mysql_num_rows($check) == TRUE) {
$check_exist = mysql_query("SELECT * FROM `reseed` WHERE `userid` = '" .$user_id. "' AND `detid` = '" .$t_id. "'");
if(mysql_num_rows($check_exist) == FALSE) {
$p = $_GET['id'];
talert('הבקשה נשלחה בהצלחה !');
$url = "http://downland.in/details.php?id=$p";
$msg = "
שלום ,
בקשת ריסיד בוצעה על הטורנט שהעלת ($url) .
אנא שתף את הטורנט מחדש או מצא פיתרון חלופי .
המשך יום מצויין !
";
mysql_query("INSERT INTO `messages`(`sender`, `receiver`, `added`, `subject`, `msg`, `unread`, `poster`) VALUES ('6','" .$uploader_details['id']. "',".date(time()).",'בקשת ריסיד בוצעה על הטורנט שהעלת - היכנס !','".$msg."','yes','6')");
mysql_query("INSERT INTO `reseed` (`userid`, `detid`, `active`, `date`, `staffid`) VALUES ('" .$CURUSER['id']. "', '{$p_reseed}', '0', '".time()."', '0');");
} else {
talert('בקשתך לריסיד כבר נשלחה');
}
} else {
talert('אינך יכול לשלוח בקשת ריסיד לטורנט זה');
}
}
if(isset($_POST['treport'])) {
$check = mysql_query("SELECT * FROM `treport` WHERE `detid` = '".$_GET['id']."' AND `userid` = '".$CURUSER['id']."'");
if(mysql_num_rows($check) == TRUE) {
talert('אינך יכול לדווח שוב על טורנט זה');
} else {
mysql_query("INSERT INTO `treport` (`userid`,`detid`,`date`,`active`,`uploader`) VALUES ('" .$CURUSER['id']. "','" .$_GET['id']. "','" .time(). "','1','" .$upload_details['owner']. "')");
talert('דווח בהצלחה!');
}
}
$count = 1;
$PageNumber = @$_GET['page'];
if($PageNumber == NULL) $PageNumber = 1;
$PerPage = 10;
$First_limit = $PerPage * $PageNumber - $PerPage;
$Limit = $First_limit;
$select_comments = mysql_query("SELECT * FROM `comments` WHERE `torrent` = '" .$_GET['id']. "' ORDER BY `id` ASC LIMIT " .$Limit. ", " .$PerPage. "");
while($row = @mysql_fetch_assoc($select_comments)) {
$get_date = get_date($row['added']);
$get_user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '" .$row['user']. "'"));
$get_level = mysql_fetch_assoc(mysql_query("SELECT * FROM `Levels` WHERE `id` = '" .$get_user['class']. "'"));
$secureGET1 = intval($get_user['id']);
$queryM1 = mysql_query("SELECT COUNT(id) as countitagain FROM forum_messeges WHERE userid = '{$secureGET1}'");
$getRow1 = mysql_fetch_assoc($queryM1);
$upped = userupload($get_user['id']);
$downed = userdownload($get_user['id']);
$points = number_format($get_user['points']);
$userratio = userratio($get_user['id']);
$factor = number_format($get_user['factor']);
$CommentNumber = $count + ($PerPage * ($PageNumber - 1));
$HTMLOUT .= "
<div class='forum_build'>
<div class='tile_new_forum'>
<div style='float: right;'>
תגובה #$CommentNumber
</div>
<div style='float: left;'>
$get_date
";
if($CURUSER['class'] >= UC_MODERATOR || $CURUSER['username'] == $get_user["username"]) {
$HTMLOUT .= " | <a href='details.php?id={$_GET['id']}&del={$row['id']}'' style='color: #aeaeae;'>מחק תגובה</a> | <a href='details.php?id={$_GET['id']}&edit={$row['id']}' style='color: #aeaeae;'>ערוך תגובה</a>";
}
$HTMLOUT .= "
</div>
</div>
<div style='float: right;width: 200px;border-left: 1px dashed #666;word-wrap:break-word;min-height: 250px;padding: 4px;'>
";
if(!empty($get_user['avatar']))
{
$avatar = "<img src='{$get_user['avatar']}' width='110' height='100' style='box-shadow: 0 0 4px #000;margin: 10px 0 10px 0;' alt='' />";
}
else
{
$avatar = "<br />";
}
if($get_user['enabled'] == 'no') {
$get_user['username'] = "<s>".$get_user['username']."</s>";
}
if($get_user['ssubtitle'] == 0) {
$ssubtitle = "<br /><span style='color: {$get_user['scolor']};font-size: 11px;float: right;width: 100%;'>{$get_user['ssubtitle']}</span>";
}else {
$ssubtitle = "";
}
$HTMLOUT .= "
<div style='width: 100%;text-align: center;'>
<a href='userdetails.php?id={$get_user['id']}' style='color: {$get_level['color']};font-size: 16px;font-weight: bold;'>{$get_user['username']}</a><br />
<span style='color: #FFF;font-size: 13px;'>{$get_user['subtitle']}</span>
{$ssubtitle}
{$avatar}
</div>
";
$HTMLOUT .= "
<div class='block_user'>
<strong>הודעות</strong>: {$getRow1['countitagain']}
</div>
<div class='block_user'>
<strong>העלאה</strong>: <span style='direction: ltr;'>{$upped}</span>
</div>
<div class='block_user'>
<strong>הורדה</strong>: <span style='direction: ltr;'>{$downed}</span>
</div>
<div class='block_user'>
<strong>נקודות</strong>: {$points}
</div>
<div class='block_user'>
<strong>יחס</strong>: {$userratio}
</div>
<div class='block_user'>
<strong>פקטור שעתי</strong>: <span style='color: orange;'>+{$factor}</span>
</div>
</div>
<div style='float: right;border-right: 1px dashed #111;width: 680px;word-wrap:break-word;padding: 4px;min-height: 250px;'>
";
if(isset($_GET['edit']) && $_GET['edit'] == $row['id'])
{
if($CURUSER['class'] >= UC_MODERATOR || $CURUSER['username'] == $get_user["username"]) {
$HTMLOUT .="<form method='post'><textarea name='editTXT' rows='10' style='width:500px;'>".$row['text']."</textarea>";
$HTMLOUT .= "<input style='margin-right:-1px;' type='submit' name='editSub' value='ערוך הודעה' /></form>";
}
}
else
{
$HTMLOUT .= "<span style='float: right;padding: 5px 0;word-wrap:break-word;width: 680px;'>";
$HTMLOUT .= format_comment($row['text']);
$HTMLOUT .= "</span>";
if($row['editedby'] != "0" && $row['editedat'] != "0") {
$edittime = get_date($row['editedat']);
$edituser = get_user_by_id($row['editedby']);
$HTMLOUT .= "<br /><span style='font-size:9px;float: right;width: 100%;'>נערך על ידי: {$edituser}, בתאריך: {$edittime}</span>";
}
}
if(!empty($get_user['signature'])) {
$ugsn = format_comment($get_user['signature']);
$HTMLOUT .= "<div style='border-top: 1px solid #686868;width: 100%;min-height: 60px;margin: 5px 0 0 0;padding: 7px 0 0 0;float: right;'>
{$ugsn}
</div>
";
}
$HTMLOUT .= "
</div>
</div>
";
$count++;
}
$HTMLOUT .= "
<div style='float:right;width: 100%;margin: 10px 0 0 0;'>
";
$All = mysql_query("SELECT * FROM `comments` WHERE `torrent` = '" .$_GET['id']. "'");
$Rows = mysql_num_rows($All);
$Pmore = $Rows % $PerPage == 0 ? 0 : 1;
$P = ((int)$Rows / $PerPage) + $Pmore ;
$HTMLOUT .= "<a href='details.php?id={$_GET['id']}&page=1' style='color:#131313;font-weight: bold;padding: 4px;background: #dcdcdc;'>1</a>";
for($q=2; $q <= $P; $q++){
$HTMLOUT .= " | <a href='details.php?id={$_GET['id']}&page={$q}' style='color:#131313;font-weight: bold;padding: 4px;background: #dcdcdc;'>{$q}</a>";
}
$HTMLOUT .= "
</div>
<form method='post'>
<table style='margin: 15px 0 0 0;float: right;'>
<tr>
<td style='background-color:white;color:black;'><textarea name='com' rows='3' style='width:893px;'></textarea></td>
</tr>
<tr>
<td><input type='submit' name='publish' value='פרסם הודעה' style='margin: 5px auto;width: 200px;padding: 4px;background: #FFF;color: #000;font-weight: bold;border-radius: 3px;' /></td>
</tr>
</table>
</form>
";
if(isset($_POST['publish'])) {
$com = $_POST['com'];
if($com == "<br>" || empty($com)) {
alert('אינך יכול להגיב הודעה ריקה');
} else {
mysql_query("INSERT INTO `comments` (`user`,`torrent`,`added`,`text`,`ori_text`,`editedby`,`editedat`)
VALUES ('" .$CURUSER['id']. "','" .$_GET['id']. "','" .time(). "','" .$com. "','" .$com. "','0','0')");
alert('התגובה פורסמה בהצלחה');
header("Location: {$TBDEV['baseurl']}/details.php?id=$id");
}
}
if(isset($_POST['editSub']))
{
$editTXT = $_POST['editTXT'];
if($editTXT == "<br>" || empty($editTXT)) {
alert('אנא מלא את שדה ההודעה.');
} else {
mysql_query("UPDATE `comments` SET `text` = '" .$editTXT. "',`editedby` = '" .$CURUSER['id']. "',`editedat` = '" .time(). "' WHERE `id` = '" .$_GET['edit']. "'");
alert('ההודעה נערכה בהצלחה');
refresh("details.php?id={$_GET['id']}",0);
}
}
}
///////////////////////// HTML OUTPUT ////////////////////////////
print stdhead("{$upload_details['name']}") . $HTMLOUT . stdfoot();
?>