SQL :
In backend/functions. php Look for:
Add after:
Search:
Add after:
End page before? > add:
In announce. PHP Look for:
Add after:
Search:
Replace with:
Search:
Add Before:
Search:
Change to:
Search:
Add after:
In account. PHP Look for:
Add after:
In account-Details. php Look for:
Add after:
In torrents-Details. PHP Search:
Add after:
languages/english.php/
Snatched file optimization save as snatched.php
CREATE TABLE IF NOT EXISTS `snatched` (
`sid` int(11) unsigned NOT NULL auto_increment,
`tid` int(11) unsigned NOT NULL default '0',
`uid` int(11) unsigned NOT NULL default '0',
`stime` int(11) unsigned NOT NULL default '0',
`utime` int(11) unsigned NOT NULL default '0',
`ltime` int(11) unsigned NOT NULL default '0',
`uload` bigint(20) unsigned NOT NULL default '0',
`dload` bigint(20) unsigned NOT NULL default '0',
`completed` enum('0','1') NOT NULL default '0',
`hnr` enum('no','yes') NOT NULL default 'no',
PRIMARY KEY (`sid`),
UNIQUE KEY `tid_uid` (`tid`,`uid`),
KEY `completed` (`completed`),
KEY `tid` (`tid`),
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;In backend/functions. php Look for:
SQL_Query_exec("DELETE FROM reports WHERE votedfor = $id AND type = 'torrent'");Add after:
SQL_Query_exec("DELETE FROM `snatched` WHERE `tid` = '$id'");Search:
SQL_Query_exec("DELETE FROM pollanswers WHERE userid = $userid");Add after:
SQL_Query_exec("DELETE FROM `snatched` WHERE `uid` = '$userid'");End page before? > add:
function seedtime($ts = 0)
{
$days = floor($ts / 86400);
$hours = floor($ts / 3600 ) % 24;
$mins = floor($ts / 60) % 60;
$secs = $ts % 60;
return sprintf( '%d days, %d hours, %d minutes, %d seconds...', $days, $hours, $mins, $secs);
}In announce. PHP Look for:
$ret = SQL_Query_exec("INSERT INTO peers (connectable, torrent, peer_id, ip, passkey, port, uploaded, downloaded, to_go, started, last_action, seeder, userid, client) VALUES ('$connectable', $torrentid, " . sqlesc($peer_id) . ", " . sqlesc($ip) . ", " . sqlesc($passkey) . ", $port, $uploaded, $downloaded, $left, '".get_date_time()."', '".get_date_time()."', '$seeder', '$userid', " . sqlesc($agent) . ")");
Add after:
if ( ($MEMBERSONLY) && (($seeder == 'no' && $torrent['freeleech'] == 0)) ) {
SQL_Query_exec("INSERT INTO `snatched` (`uid`, `tid`, `stime`, `utime`) VALUES ('$userid', '$torrentid', '".gmtime()."', '".gmtime()."') ON DUPLICATE KEY UPDATE `utime` = '" . gmtime() . "'");
}Search:
if ( $MEMBERSONLY )
SQL_Query_exec("INSERT INTO completed (userid, torrentid, date) VALUES ($userid, $torrentid, '".get_date_time()."')");Replace with:
if ( $MEMBERSONLY )
{
SQL_Query_exec("INSERT INTO completed (userid, torrentid, date) VALUES ($userid, $torrentid, '".get_date_time()."')");
SQL_Query_exec("UPDATE LOW_PRIORITY `snatched` SET `completed` = '1' WHERE `tid` = '$torrentid' AND `uid` = '$userid' AND `utime` = '" . gmtime() . "'");
}Search:
$upthis = max(0, $uploaded - $self["uploaded"]);Add Before:
$elapsed = ($self['seeder'] == 'yes') ? $site_config['announce_interval'] - floor(($self['ez'] - time()) / 60) : 0;Search:
if (($upthis > 0 || $downthis > 0) && is_valid_id($userid))Change to:
if (($upthis > 0 || $downthis > 0 || $elapsed > 0) && is_valid_id($userid))Search:
SQL_Query_exec("UPDATE users SET uploaded = uploaded + $upthis, downloaded = downloaded + $downthis WHERE id=$userid") or err("Tracker error: Unable to update stats");
Add after:
SQL_Query_exec("UPDATE LOW_PRIORITY `snatched` SET `uload` = `uload` + '$upthis', `dload` = `dload` + '$downthis', `utime` = '".gmtime()."', `ltime` = `ltime` + '$elapsed' WHERE `tid` = '$torrentid' AND `uid` = '$userid'");
In account. PHP Look for:
<?php print("<a href='mailbox.php'><b>".T_("YOUR_MESSAGES")."</b></a>");?>Add after:
|
<?php print("<a href='snatched.php'><b>".T_("YOUR_SNATCHLIST")."</b></a>");?>In account-Details. php Look for:
<?php echo T_("AGE"); ?>: <?php echo htmlspecialchars($user["age"])?><br />Add after:
<?php if ($CURUSER["edit_users"]=="yes" && $CURUSER["class"] > $user["class"]) { ?>
<div style="margin-bottom:3px"><a href="snatched.php?uid=<?php echo $user["id"]?>"><?php echo "<input type='submit' value='".T_("SNATCHLIST")."'>"; ?></a></div>
<?php } ?>In torrents-Details. PHP Search:
echo "[<a href='torrents-edit.php?id=$row[id]&returnto=" . urlencode($_SERVER["REQUEST_URI"]) . "'><b>".T_("EDIT_TORRENT")."</b></a>]";Add after:
echo " <a href=snatched.php?tid=$row[id]><input type='submit' value='".T_("SNATCHLIST")."'></a> ";languages/english.php/
//===| Snatchlist
$LANG["SNATCHLIST"] = "Snatchlist";
$LANG["YOUR_SNATCHLIST"] = "Your Snatchlist";
$LANG["SNATCHLIST_FOR"] = "Snatchlist For:";
$LANG["LAST_ACTION"] = "Last Action";
$LANG["SEED_TIME"] = "Seed Time";
$LANG["GO_TO_YOUR_PROFILE"] = "Go to Your Profile";
$LANG["GO_TO_USER_ACCOUNT"] = "Go to User Account";
$LANG["HNR"] = "<font color=#FF1200><b>H</b><small>&</small><b>R</b></font>";
$LANG["SNATCHED_MESSAGE"] = "This page displays the details to all downloaded torrents, completed or not.";
$LANG["NO_USER_WITH_ID"] = "There is no user with ID: ";
$LANG["NO_TORRENT_WITH_ID"] = "There is no torrent with ID: ";
$LANG["REGISTERED_MEMBERS_TO_TORRENT"] = "Registered Members To Torrent:";
$LANG["NO_PERMISSION"] = "You don't have permission for this action!";
$LANG["T_L_OR_E"] = "Local or External";
$LANG["LOCAL_TORRENT"] = "Local Torrent";
$LANG["EXTERNAL_TORRENT"] = "External Torrent";
$LANG["FREE"] = "Free";Snatched file optimization save as snatched.php
<?php
error_reporting(E_ALL ^ E_NOTICE);
error_reporting(1);
require_once('backend/functions.php');
dbconn();
loggedinonly();
$tid = ( int ) $_GET['tid'];
$uid = ( int ) $_GET['uid'];
$id = ( int ) $_GET['id'];
if ($id != 0)
$uid = ( int ) $_GET['id'];
if ($tid == 0 && $uid == 0)
$uid = (int) $CURUSER['id'];
if ($tid > 0) {
$count_tid = get_row_count('snatched', 'WHERE `tid` = \'' . $tid . '\'');
$type = "torrent";
$count_uid = 0;
} else {
$count_uid = get_row_count('snatched', 'WHERE `uid` = \'' . $uid . '\'');
$type = "user";
$count_tid = 0;
}
//===| for debug...
$debug = 0;
if ($debug) {
$title1 = sprintf(T_("SNATCHLIST_FOR"), " Debug");
stdhead($title1);
begin_frame($title1);
$qry1 = "SELECT
users.id,
users.username,
users.class,
snatched.uid as uid,
snatched.tid as tid,
snatched.uload,
snatched.dload,
snatched.stime,
snatched.utime,
snatched.ltime,
snatched.completed,
completed.date,
(
SELECT seeder
FROM peers
WHERE torrent = tid AND userid = uid LIMIT 1
) AS seeding
FROM
snatched
INNER JOIN users ON snatched.uid = users.id
INNER JOIN torrents ON snatched.tid = torrents.id
LEFT JOIN completed ON snatched.tid = completed.torrentid AND snatched.uid = completed.userid
WHERE
users.status = 'confirmed' AND
torrents.banned = 'no' AND snatched.tid = '$tid' $limit";
?>
<div align="center"><b>Type: <?php echo $type; ?></b></div>
<div align="center"><b>Torrent ID: <?php echo $tid; ?></b></div>
<div align="center"><b>UserID: <?php echo $uid; ?></b></div>
<div align="center"><b>Torrent Count: <?php echo $count_tid; ?></b></div>
<div align="center"><b>User Count: <?php echo $count_uid; ?></b></div>
<div align="left"><b>Query: </b><?php echo $qry1; ?></div>
<?php
end_frame();
}
if ($type == 'torrent') {
//===| Start Torrents Snatched
if ($count_tid > 0) {
$torrent = SQL_Query_exec("SELECT `name` FROM `torrents` WHERE `id` = '$tid'");
$torrents = mysql_fetch_row($torrent);
$title = "".T_("REGISTERED_MEMBERS_TO_TORRENT")." ".htmlspecialchars($torrents[0])."";
stdhead($title);
begin_frame($title);
$perpage = 50;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count_tid, 'snatched.php?tid='.$tid.' &');
$qry = "SELECT
users.id,
users.username,
users.class,
snatched.uid as uid,
snatched.tid as tid,
snatched.uload,
snatched.dload,
snatched.stime,
snatched.utime,
snatched.ltime,
snatched.completed,
snatched.hnr,
(
SELECT seeder
FROM peers
WHERE torrent = tid AND userid = uid LIMIT 1
) AS seeding
FROM
snatched
INNER JOIN users ON snatched.uid = users.id
INNER JOIN torrents ON snatched.tid = torrents.id
WHERE
users.status = 'confirmed' AND
torrents.banned = 'no' AND snatched.tid = '$tid'
ORDER BY stime DESC $limit";
$res = SQL_Query_exec($qry);
print("<div style='margin-top:10px; margin-bottom:5px'>[<a href=torrents-details.php?id=$tid><b>".T_("BACK_TO_TORRENT")."</b></a>]</div>");
if ($count_tid > $perpage) {
echo ($pagertop);
}
if (mysql_num_rows($res) > 0):
?>
<table border="0" class="table_table" cellpadding="4" cellspacing="0" width="100%">
<tr>
<th class="table_head" align="left"><?php echo T_("USERNAME"); ?></th>
<th class="table_head"><?php echo T_("UPLOADED"); ?></th>
<th class="table_head"><?php echo T_("DOWNLOADED"); ?></th>
<th class="table_head"><?php echo T_("RATIO"); ?></th>
<th class="table_head"><?php echo T_("ADDED"); ?></th>
<th class="table_head"><?php echo T_("LAST_ACTION"); ?></th>
<th class="table_head"><img src="images/seedtime.png" border="0" title="<?php echo T_("SEED_TIME"); ?>"></th>
<th class="table_head"><img src="images/check.png" border="0" title="<?php echo T_("COMPLETED"); ?>"></th>
<th class="table_head"><img src="images/seed.gif" border="0" title="<?php echo T_("SEEDING"); ?>"></th>
<th class="table_head"><?php echo T_("HNR"); ?></th>
</tr>
<?php
while ($row = mysql_fetch_row($res)):
if ($row[6] > 0) {
$ratio = number_format($row[5] / $row[6], 2);
} else {
$ratio = "---";
}
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
$startdate = utc_to_tz(get_date_time($row[7]));
$lastaction = utc_to_tz(get_date_time($row[8]));
if ($row[11] != "yes") {
$hnr = "<font color=#27B500><b>".T_("NO")."</b></font>";
} else {
$hnr = "<font color=#FF1200><b>".T_("YES")."</b></font>";
}
if ($row[12] != "yes") {
$seed = "<font color=#FF1200><b>".T_("NO")."</b></font>";
} else {
$seed = "<font color=#27B500><b>".T_("YES")."</b></font>";
}
?>
<tr align="center">
<td class="table_col1" align="left"><a href="account-details.php?id=<?php echo $row[0]; ?>"><?php echo "<b>".$row[1]."</b>"; ?></a></td>
<td class="table_col2"><font color="#27B500"><?php echo mksize($row[5]); ?></font></td>
<td class="table_col1"><font color="#FF1200"><?php echo mksize($row[6]); ?></font></td>
<td class="table_col2"><?php echo $ratio; ?></td>
<td class="table_col2"><?php echo date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($startdate)); ?></td>
<td class="table_col1"><?php echo date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($lastaction)); ?></td>
<td class="table_col1"><?php echo ($row[9]) ? mkprettytime($row[9]) : '---'; ?></td>
<td class="table_col2"><?php echo ($row[10]) ? "<font color=#0080FF><b>".T_("YES")."</b></font>" : "<b>".T_("NO")."</b>"; ?></td>
<td class="table_col1"><?php echo $seed; ?></td>
<td class="table_col2"><?php echo $hnr; ?></td>
</tr>
<?php endwhile; ?>
</table>
<?php
if ($count_tid > $perpage) {
echo ($pagerbottom);
}
print("<div style='margin-top:5px; margin-bottom:10px' align='right'>[<a href=torrents-details.php?id=$tid><b>".T_("BACK_TO_TORRENT")."</b></a>]</div>");
endif;
end_frame();
stdfoot();
die;
} else {
if ($tid >= 1) {
$torrent = SQL_Query_exec("SELECT `name` FROM `torrents` WHERE `id` = '$tid'");
$torrents = mysql_fetch_row($torrent);
$ttitle = "".T_("SNATCHLIST_FOR")." ".htmlspecialchars($torrents[0])."";
if ($torrents[0] == '') {
$ttitle = "".T_("NO_TORRENT_WITH_ID")." $tid";
}
stdhead($ttitle);
begin_frame($ttitle);
?>
<div style="margin-top:10px; margin-bottom:10px" align="center"><font size="2"><?php echo T_("NOTHING_FOUND"); ?>.</font></div>
<div style="margin-bottom:10px" align="center">[<?php echo "<a href=torrents-details.php?id=$tid>"; ?><b><?php echo T_("BACK_TO_TORRENT"); ?></b></a>]
</div>
<?php
end_frame();
stdfoot();
die;
}
}
//===| End Torrents Snatched
} else {
//===| Start Users Snatched
if ($count_uid > 0) {
$user = SQL_Query_exec("SELECT `username` FROM `users` WHERE `id` = '$uid'");
$users = mysql_fetch_row($user);
$title = "".T_("SNATCHLIST_FOR")." ".htmlspecialchars($users[0])."";
$title2 = "".T_("SNATCHLIST_FOR")." ".$users[0]."";
stdhead($title);
begin_frame($title2);
if (($CURUSER["control_panel"] == "no") && $CURUSER["id"] != $uid) {
echo "<div style='margin-top:10px; margin-bottom:10px' align='center'><font size='2' color='red'><b>".T_("NO_PERMISSION")."</b></font></div>";
end_frame();
stdfoot();
die;
}
$perpage = 50;
list($pagertop, $pagerbottom, $limit) = pager($perpage, $count_uid, 'snatched.php?uid='.$uid.' &');
$qry = "SELECT
snatched.tid as tid,
torrents.name,
snatched.uload,
snatched.dload,
snatched.stime,
snatched.utime,
snatched.ltime,
snatched.completed,
snatched.hnr,
(
SELECT seeder
FROM peers
WHERE torrent = tid AND userid = $uid LIMIT 1
) AS seeding
FROM
snatched
INNER JOIN users ON snatched.uid = users.id
INNER JOIN torrents ON snatched.tid = torrents.id
WHERE
users.status = 'confirmed' AND
torrents.banned = 'no' AND snatched.uid = '$uid'
ORDER BY stime DESC $limit";
$res = SQL_Query_exec($qry);
if ($uid == $CURUSER["id"]) {
print("<div style='margin-top:20px; margin-bottom:20px' align='center'><font size='2'>".T_("SNATCHED_MESSAGE")."</font></div>");
}
if ($uid != $CURUSER["id"])
print("<div style='margin-top:10px; margin-bottom:5px'>[<a href=account-details.php?id=$uid><b>".T_("GO_TO_USER_ACCOUNT")."</b></a>]</div>");
if ($count_uid > $perpage) {
echo $pagertop;
}
if (mysql_num_rows($res) > 0):
?>
<table border="0" class="table_table" cellpadding="4" cellspacing="0" width="100%">
<tr>
<th class="table_head" align="left"><?php echo T_("TORRENT_NAME"); ?></th>
<?php if ($site_config["ALLOWEXTERNAL"]) { ?>
<th class="table_head"><img src="images/t_le.png" border="0" title="<?php echo T_("T_L_OR_E"); ?>"></th>
<?php } ?>
<th class="table_head"><?php echo T_("UPLOADED"); ?></th>
<th class="table_head"><?php echo T_("DOWNLOADED"); ?></th>
<th class="table_head"><?php echo T_("RATIO"); ?></th>
<th class="table_head"><?php echo T_("ADDED"); ?></th>
<th class="table_head"><?php echo T_("LAST_ACTION"); ?></th>
<th class="table_head"><img src="images/seedtime.png" border="0" title="<?php echo T_("SEED_TIME"); ?>"></th>
<th class="table_head"><img src="images/check.png" border="0" title="<?php echo T_("COMPLETED"); ?>"></th>
<th class="table_head"><img src="images/seed.gif" border="0" title="<?php echo T_("SEEDING"); ?>"></th>
<th class="table_head"><?php echo T_("HNR"); ?></th>
</tr>
<?php
while ($row = mysql_fetch_row($res)):
$startdate = utc_to_tz(get_date_time($row[4]));
$lastaction = utc_to_tz(get_date_time($row[5]));
$query = SQL_Query_exec("SELECT external, freeleech FROM torrents WHERE id = $row[0]");
$result = mysql_fetch_row($query);
if ($result[0] == "yes") {
$type = "<img src='images/t_extern.png' border='0' title='".T_("EXTERNAL_TORRENT")."'>";
} else {
$type = "<img src='images/t_local.png' border='0' title='".T_("LOCAL_TORRENT")."'>";
}
if ($result[1] == 1) {
$freeleech = "<img src='images/free.gif' border='0' title='".T_("FREE")."'>";
} else {
$freeleech = "";
}
if ($row[3] > 0) {
$ratio = number_format($row[2] / $row[3], 2);
} else {
$ratio = "---";
}
$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
if ($row[8] != "yes") {
$hnr = "<font color=#27B500><b>".T_("NO")."</b></font>";
} else {
$hnr = "<font color=#FF1200><b>".T_("YES")."</b></font>";
}
if ($row[9] != "yes") {
$seed = "<font color=#FF1200><b>".T_("NO")."</b></font>";
} else {
$seed = "<font color=#27B500><b>".T_("YES")."</b></font>";
}
$maxchar = 35; //===| cut name length
$smallname = htmlspecialchars(CutName($row[1], $maxchar));
?>
<tr align="center">
<?php echo("<td class='ttable_col1' align='left' nowrap='nowrap'>".(count($expandrows)?"<a href=\"javascript: klappe_torrent('t".$row['0']."')\"><img border=\"0\" src=\"".$site_config["SITEURL"]."/images/plus.gif\" id=\"pict".$row['0']."\" alt=\"Show/Hide\" class=\"showthecross\" /></a>":"")."<a title=\"".$row["1"]."\" href=\"torrents-details.php?id=".$row['0']."&hit=1\"><b>$smallname</b></a> $freeleech</td>"); ?>
<?php if ($site_config["ALLOWEXTERNAL"]) { ?>
<td class="table_col2" align="center"><?php echo $type; ?></td>
<?php } ?>
<td class="table_col1"><font color="#27B500"><?php echo mksize($row[2]); ?></font></td>
<td class="table_col2"><font color="#FF1200"><?php echo mksize($row[3]); ?></font></td>
<td class="table_col1"><?php echo $ratio; ?></td>
<td class="table_col2"><?php echo date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($startdate)); ?></td>
<td class="table_col1"><?php echo date('d.M.Y H:i', sql_timestamp_to_unix_timestamp($lastaction)); ?></td>
<td class="table_col2"><?php echo ($row[6]) ? mkprettytime($row[6]) : '---'; ?></td>
<td class="table_col1"><?php echo ($row[7]) ? "<font color=#0080FF><b>".T_("YES")."</b></font>" : "<b>".T_("NO")."</b>"; ?></td>
<td class="table_col2"><?php echo $seed; ?></td>
<td class="table_col1"><?php echo $hnr; ?></td>
</tr>
<?php endwhile; ?>
</table>
<?php
if ($count_uid > $perpage) {
echo $pagerbottom;
}
if ($uid != $CURUSER["id"])
print("<div style='margin-top:5px; margin-bottom:10px' align='right'>[<a href=account-details.php?id=$uid><b>".T_("GO_TO_USER_ACCOUNT")."</b></a>]</div>");
endif;
end_frame();
stdfoot();
die;
} else, {
$user = SQL_Query_exec("SELECT `username` FROM `users` WHERE `id` = '$uid'");
$users = mysql_fetch_row($user);
$title = "".T_("SNATCHLIST_FOR")." ".htmlspecialchars($users[0])."";
if ($users[0] == '') {
$title = "".T_("NO_USER_WITH_ID")." $uid";
}
$title2 = "".T_("SNATCHLIST_FOR")." ".$users[0]."";
if ($users[0] == '') {
$title2 = "".T_("NO_USER_WITH_ID")." $uid";
}
stdhead($title);
begin_frame($title2);
if (($CURUSER["control_panel"] == "no") && $CURUSER["id"] != $uid) {
echo "<div style='margin-top:10px; margin-bottom:10px' align='center'><font size='2' color='red'><b>".T_("NO_PERMISSION")."</b></font></div>";
end_frame();
stdfoot();
die;
}
echo "<div style='margin-top:10px; margin-bottom:10px' align='center'><font size='2'>".T_("NOTHING_FOUND").".</font></div>";
if (mysql_num_rows($user) > 0) {
if ($uid != $CURUSER["id"]) {
print("<div style='margin-bottom:10px' align='center'>[<a href=account-details.php?id=$uid><b>".T_("GO_TO_USER_ACCOUNT")."</b></a>]</div>");
} else {
print("<div style='margin-bottom:10px' align='center'>[<a href=account.php><b>".T_("GO_TO_YOUR_PROFILE")."</b></a>]</div>");
}
}
end_frame();
stdfoot();
}
//}
?>