diff --git a/classes/class_cache.php b/classes/class_cache.php index d6f6fd2a..cde26a0d 100644 --- a/classes/class_cache.php +++ b/classes/class_cache.php @@ -37,6 +37,7 @@ class CACHE extends Memcache { private $PersistentKeys = array( 'stats_*', 'percentiles_*', + 'top10tor_*' ); public $CanClear = false; diff --git a/sections/schedule/index.php b/sections/schedule/index.php index fd996f17..f7af7e85 100644 --- a/sections/schedule/index.php +++ b/sections/schedule/index.php @@ -684,7 +684,7 @@ function next_hour() { foreach($DeleteNotes as $UserID => $MessageInfo){ $Singular = ($MessageInfo['Count'] == 1) ? true : false; - send_pm($UserID,0,db_string($MessageInfo['Count'].' of your torrents '.($Singular?'has':'have').' been deleted for inactivity'), db_string(($Singular?'One':'Some').' of you torrents '.($Singular?'was':'were').' deleted for being unseeded. Since '.($Singular?'it':'they').' didn\'t break any rules (we hope), you can feel free to re-upload '.($Singular?'it':'them').'.\n\nThe following torrent'.($Singular?' was':'s were').' deleted:'.$MessageInfo['Msg'])); + send_pm($UserID,0,db_string($MessageInfo['Count'].' of your torrents '.($Singular?'has':'have').' been deleted for inactivity'), db_string(($Singular?'One':'Some').' of your uploads '.($Singular?'has':'have').' been deleted for being unseeded. Since '.($Singular?'it':'they').' didn\'t break any rules (we hope), please feel free to re-upload '.($Singular?'it':'them').".\n\nThe following torrent".($Singular?' was':'s were').' deleted:'.$MessageInfo['Msg'])); } unset($DeleteNotes); @@ -913,7 +913,7 @@ function next_hour() { $TorrentAlerts[$UserID]['Count']++; } foreach($TorrentAlerts as $UserID => $MessageInfo){ - send_pm($UserID, 0, db_string('Unseeded torrent notification'), db_string($MessageInfo['Count']." of your upload".($MessageInfo['Count']>1?'s':'')." will be deleted for inactivity soon. Unseeded torrents are deleted after 4 weeks. If you still have the files, you can seed your uploads by ensuring the torrents are in your client and that they aren't stopped. You can view the time that a torrent has been unseeded by clicking on the torrent description line and looking for the \"Last active\" time. For more information, please go [url=/wiki.php?action=article&id=663]here[/url].\n\nThe following torrent".($MessageInfo['Count']>1?'s':'')." will be removed for inactivity:".$MessageInfo['Msg']."\n\nIf you no longer wish to recieve these notifications, please disable them in your profile settings.")); + send_pm($UserID, 0, db_string('Unseeded torrent notification'), db_string($MessageInfo['Count']." of your upload".($MessageInfo['Count']>1?'s':'')." will be deleted for inactivity soon. Unseeded torrents are deleted after 4 weeks. If you still have the files, you can seed your uploads by ensuring the torrents are in your client and that they aren't stopped. You can view the time that a torrent has been unseeded by clicking on the torrent description line and looking for the \"Last active\" time. For more information, please go [url=http://what.cd/wiki.php?action=article&id=663]here[/url].\n\nThe following torrent".($MessageInfo['Count']>1?'s':'')." will be removed for inactivity:".$MessageInfo['Msg']."\n\nIf you no longer wish to recieve these notifications, please disable them in your profile settings.")); } } } diff --git a/sections/top10/torrents.php b/sections/top10/torrents.php index 219ccc6a..73c09118 100644 --- a/sections/top10/torrents.php +++ b/sections/top10/torrents.php @@ -1,8 +1,9 @@
@@ -83,6 +82,42 @@ $DisableFreeTorrentTop10)); + } +} + +// Modify the Where query +if ($DisableFreeTorrentTop10) { + $Where[] = "t.FreeTorrent='0'"; +} + +// The link should say the opposite of the current setting +$FreeleechToggleName = ($DisableFreeTorrentTop10 ? 'show' : 'hide'); +$FreeleechToggleQuery = get_url(array('freeleech')); + +if (!empty($FreeleechToggleQuery)) + $FreeleechToggleQuery .= '&'; + +$FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName; + +?> +
+ [ Freeleech in Top 10] +
+query($Query); - $TopTorrentsActiveLastDay = $DB->to_array(); + $TopTorrentsActiveLastDay = $DB->to_array(false, MYSQLI_NUM); $Cache->cache_value('top10tor_day_'.$Limit.$WhereSum,$TopTorrentsActiveLastDay,3600*2); } generate_torrent_table('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit); @@ -132,7 +167,7 @@ ORDER BY (t.Seeders + t.Leechers) DESC LIMIT $Limit;"; $DB->query($Query); - $TopTorrentsActiveLastWeek = $DB->to_array(); + $TopTorrentsActiveLastWeek = $DB->to_array(false, MYSQLI_NUM); $Cache->cache_value('top10tor_week_'.$Limit.$WhereSum,$TopTorrentsActiveLastWeek,3600*6); } generate_torrent_table('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit); @@ -142,53 +177,62 @@ if (!$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum)) { // IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it! $Query = $BaseQuery; - if (!empty($Where)) { $Query .= ' WHERE '.$Where; } - elseif ($Details=='all') { $Query .= " WHERE t.Seeders>500 "; } + if ($Details=='all' && !$Filtered) { + $Query .= " WHERE t.Seeders>=500 "; + if (!empty($Where)) { $Query .= ' AND '.$Where; } + } + elseif (!empty($Where)) { $Query .= ' WHERE '.$Where; } $Query .= " ORDER BY (t.Seeders + t.Leechers) DESC LIMIT $Limit;"; $DB->query($Query); - $TopTorrentsActiveAllTime = $DB->to_array(); + $TopTorrentsActiveAllTime = $DB->to_array(false, MYSQLI_NUM); $Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum,$TopTorrentsActiveAllTime,3600*6); } generate_torrent_table('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit); } -if(($Details=='all' || $Details=='snatched') && empty($Where)) { +if(($Details=='all' || $Details=='snatched') && !$Filtered) { if (!$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum)) { $Query = $BaseQuery; + if (!empty($Where)) { $Query .= ' WHERE '.$Where; } $Query .= " ORDER BY t.Snatched DESC LIMIT $Limit;"; $DB->query($Query); - $TopTorrentsSnatched = $DB->to_array(); + $TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM); $Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum,$TopTorrentsSnatched,3600*6); } generate_torrent_table('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit); } -if(($Details=='all' || $Details=='data') && empty($Where)) { +if(($Details=='all' || $Details=='data') && !$Filtered) { if (!$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum)) { // IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it! $Query = $BaseQuery; - if ($Details=='all') { $Query .= " WHERE t.Snatched>100 "; } + if ($Details=='all') { + $Query .= " WHERE t.Snatched>=100 "; + if (!empty($Where)) { $Query .= ' AND '.$Where; } + } $Query .= " ORDER BY Data DESC LIMIT $Limit;"; $DB->query($Query); - $TopTorrentsTransferred = $DB->to_array(); + $TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM); $Cache->cache_value('top10tor_data_'.$Limit.$WhereSum,$TopTorrentsTransferred,3600*6); } generate_torrent_table('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit); } -if(($Details=='all' || $Details=='seeded') && empty($Where)) { +if(($Details=='all' || $Details=='seeded') && !$Filtered) { if (!$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum)) { - $Query = $BaseQuery." + $Query = $BaseQuery; + if (!empty($Where)) { $Query .= ' WHERE '.$Where; } + $Query .= " ORDER BY t.Seeders DESC LIMIT $Limit;"; $DB->query($Query); - $TopTorrentsSeeded = $DB->to_array(); + $TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM); $Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum,$TopTorrentsSeeded,3600*6); } generate_torrent_table('Best Seeded Torrents', 'seeded', $TopTorrentsSeeded, $Limit); @@ -201,7 +245,7 @@ // generate a table based on data from most recent query to $DB function generate_torrent_table($Caption, $Tag, $Details, $Limit) { - global $LoggedUser,$Categories; + global $LoggedUser,$Categories,$Debug; ?>

Top @@ -236,6 +280,10 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) { return; } $Rank = 0; + foreach ($Details as $Detail) { + $GroupIDs[] = $Detail[1]; + } + $Artists = get_artists($GroupIDs); foreach ($Details as $Detail) { list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$TorrentTags, @@ -249,10 +297,9 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) { // generate torrent's title $DisplayName=''; - $Artists = get_artist($GroupID); - if(!empty($Artists)) { - $DisplayName = display_artists($Artists, true, true); + if(!empty($Artists[$GroupID])) { + $DisplayName = display_artists($Artists[$GroupID], true, true); } $DisplayName.= "$GroupName"; diff --git a/sections/torrents/download.php b/sections/torrents/download.php index c7115121..3707d318 100644 --- a/sections/torrents/download.php +++ b/sections/torrents/download.php @@ -94,7 +94,7 @@ // Let the tracker know about this if (!update_tracker('add_token', array('info_hash' => rawurlencode($InfoHash), 'userid' => $UserID))) { - error("An error has occured. Please try again."); + error("An error has occured while trying to register your token. This is most often caused by tracker problems. Please try again when the tracker is up. If the tracker is currently working, it may just be under heavy load, so please try again."); } // We need to fetch and check this again here because of people diff --git a/sections/user/takeedit.php b/sections/user/takeedit.php index fabe369d..2b815ddc 100644 --- a/sections/user/takeedit.php +++ b/sections/user/takeedit.php @@ -190,6 +190,11 @@ $Options['DisableSmileys'] = (!empty($_POST['disablesmileys']) ? 1 : 0); $Options['DisableAvatars'] = (!empty($_POST['disableavatars']) ? 1 : 0); + +if(isset($LoggedUser['DisableFreeTorrentTop10'])) { + $Options['DisableFreeTorrentTop10'] = $LoggedUser['DisableFreeTorrentTop10']; +} + if(!empty($_POST['hidetypes'])) { foreach($_POST['hidetypes'] as $Type) { $Options['HideTypes'][] = (int) $Type; diff --git a/sections/user/user.php b/sections/user/user.php index 1ddc8ac6..536bf6cf 100644 --- a/sections/user/user.php +++ b/sections/user/user.php @@ -86,13 +86,13 @@ m.Enabled, m.Paranoia, m.Invites, - m.FLTokens, m.Title, m.torrent_pass, m.can_leech, i.JoinDate, i.Info, i.Avatar, + m.FLTokens, i.Country, i.Donor, i.Warned, @@ -111,7 +111,7 @@ header("Location: log.php?search=User+".$UserID); } - list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $Enabled, $Paranoia, $Invites, $FLTokens, $CustomTitle, $torrent_pass, $DisableLeech, $JoinDate, $Info, $Avatar, $Country, $Donor, $Warned, $ForumPosts, $InviterID, $DisableInvites, $InviterName, $RatioWatchEnds, $RatioWatchDownload) = $DB->next_record(MYSQLI_NUM, array(9,11)); + list($Username, $Email, $LastAccess, $IP, $Class, $Uploaded, $Downloaded, $RequiredRatio, $Enabled, $Paranoia, $Invites, $CustomTitle, $torrent_pass, $DisableLeech, $JoinDate, $Info, $Avatar, $FLTokens, $Country, $Donor, $Warned, $ForumPosts, $InviterID, $DisableInvites, $InviterName, $RatioWatchEnds, $RatioWatchDownload) = $DB->next_record(MYSQLI_NUM, array(9,11)); } // Image proxy CTs diff --git a/sections/userhistory/catchup_collages.php b/sections/userhistory/catchup_collages.php index 7b73961a..7d0101c8 100644 --- a/sections/userhistory/catchup_collages.php +++ b/sections/userhistory/catchup_collages.php @@ -1,6 +1,13 @@ query("UPDATE users_collage_subs SET LastVisit = NOW() WHERE UserID = ".$LoggedUser['ID']); +if ($_REQUEST['collageid'] && is_number($_REQUEST['collageid'])) { + $Where = ' AND CollageID = '.$_REQUEST['collageid']; +} else { + $Where = ''; +} + +$DB->query("UPDATE users_collage_subs SET LastVisit = NOW() WHERE UserID = ".$LoggedUser['ID'].$Where); $Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']); + header('Location: userhistory.php?action=subscribed_collages'); ?> diff --git a/sections/userhistory/subscribed_collages.php b/sections/userhistory/subscribed_collages.php index b744e591..afc0cbca 100644 --- a/sections/userhistory/subscribed_collages.php +++ b/sections/userhistory/subscribed_collages.php @@ -268,7 +268,7 @@ ( new torrent)   -    [Unsubscribe] +    [Catch up]   [Unsubscribe] diff --git a/sections/userhistory/token_history.php b/sections/userhistory/token_history.php index 3156756f..26fc681c 100644 --- a/sections/userhistory/token_history.php +++ b/sections/userhistory/token_history.php @@ -76,13 +76,19 @@ $Name"; + $ArtistName = display_artists($Artists[$GroupID]); if($ArtistName) { - $Name = $ArtistName."$Name"; + $Name = $ArtistName.$Name; } if($Format && $Encoding) { $Name.=' ['.$Format.' / '.$Encoding.']';