diff --git a/gazelle.sql b/gazelle.sql
index 39ead1c3..7a602756 100644
--- a/gazelle.sql
+++ b/gazelle.sql
@@ -1042,6 +1042,7 @@ CREATE TABLE `users_freeleeches` (
`Time` datetime NOT NULL,
`Expired` tinyint(1) NOT NULL DEFAULT '0',
`Downloaded` bigint(20) NOT NULL DEFAULT '0',
+ `Uses` int(10) NOT NULL DEFAULT '1',
PRIMARY KEY (`UserID`,`TorrentID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1433,7 +1434,7 @@ CREATE TABLE `xbt_files_users` (
`uid` int(11) NOT NULL,
`active` tinyint(1) NOT NULL,
`announced` int(11) NOT NULL,
- `completed` int(11) NOT NULL,
+ `completed` tinyint(1) NOT NULL DEFAULT '0',
`downloaded` bigint(20) NOT NULL,
`remaining` bigint(20) NOT NULL,
`uploaded` bigint(20) NOT NULL,
@@ -1445,16 +1446,13 @@ CREATE TABLE `xbt_files_users` (
`connectable` tinyint(4) NOT NULL DEFAULT '1',
`peer_id` binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
`fid` int(11) NOT NULL,
- `ipa` int(12) unsigned NOT NULL,
`mtime` int(11) NOT NULL,
`ip` varchar(15) NOT NULL DEFAULT '',
PRIMARY KEY (`peer_id`,`fid`),
KEY `remaining_idx` (`remaining`),
KEY `fid_idx` (`fid`),
KEY `mtime_idx` (`mtime`),
- KEY `uid` (`uid`),
- KEY `downloaded` (`downloaded`),
- KEY `active` (`active`)
+ KEY `uid_active` (`uid`,`active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `xbt_scrape_log` (
diff --git a/sections/collages/collage.php b/sections/collages/collage.php
index 32bffd0a..12bcd74b 100644
--- a/sections/collages/collage.php
+++ b/sections/collages/collage.php
@@ -298,7 +298,7 @@ function compare($X, $Y){
}
$DisplayName .= $GroupName;
if($GroupYear>0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
- if($GroupVanityHouse) { $DisplayName .= ' [VH]'; }
+ //if($GroupVanityHouse) { $DisplayName .= ' [VH]'; }
?>
diff --git a/sections/torrents/download.php b/sections/torrents/download.php
index c1b7e2aa..1e5c39d5 100644
--- a/sections/torrents/download.php
+++ b/sections/torrents/download.php
@@ -107,7 +107,7 @@
if (!in_array($TorrentID, $TokenTorrents)) {
$DB->query("INSERT INTO users_freeleeches (UserID, TorrentID, Time) VALUES ($UserID, $TorrentID, NOW())
- ON DUPLICATE KEY UPDATE Time=VALUES(Time), Expired=FALSE");
+ ON DUPLICATE KEY UPDATE Time=VALUES(Time), Expired=FALSE, Uses=Uses+1");
$DB->query("UPDATE users_main SET FLTokens = FLTokens - 1 WHERE ID=$UserID");
// Fix for downloadthemall messing with the cached token count
diff --git a/sections/user/user.php b/sections/user/user.php
index ee03f845..45004fc0 100644
--- a/sections/user/user.php
+++ b/sections/user/user.php
@@ -512,11 +512,11 @@ function check_paranoia_here($Setting) {
if (check_paranoia_here('seeding+')) {
- $DB->query("SELECT COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.remaining=0");
+ $DB->query("SELECT COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.active=1 AND x.remaining=0");
list($Seeding) = $DB->next_record();
}
if (check_paranoia_here('leeching+')) {
- $DB->query("SELECT COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.remaining>0");
+ $DB->query("SELECT COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.active=1 AND x.remaining>0");
list($Leeching) = $DB->next_record();
}
?>
diff --git a/sections/userhistory/token_history.php b/sections/userhistory/token_history.php
index ae7b23b0..f530da67 100644
--- a/sections/userhistory/token_history.php
+++ b/sections/userhistory/token_history.php
@@ -48,6 +48,7 @@
f.Time,
f.Expired,
f.Downloaded,
+ f.Uses,
g.Name,
t.Format,
t.Encoding
@@ -74,6 +75,7 @@
| Expired |
if (check_perms('users_mod')) { ?>
Downloaded |
+ Tokens Used |
} ?>
@@ -85,7 +87,7 @@
$i = true;
foreach ($Tokens as $Token) {
$i = !$i;
- list($TorrentID, $GroupID, $Time, $Expired, $Downloaded, $Name, $Format, $Encoding) = $Token;
+ list($TorrentID, $GroupID, $Time, $Expired, $Downloaded, $Uses, $Name, $Format, $Encoding) = $Token;
$Name = "$Name";
$ArtistName = display_artists($Artists[$GroupID]);
if($ArtistName) {
@@ -102,6 +104,7 @@
if (check_perms('users_mod')) { ?>
=get_size($Downloaded)?> |
+ =$Uses?> |
} ?>
}