Empty commit

This commit is contained in:
Git 2011-10-30 08:00:11 +00:00
parent d052d1df50
commit 070c899f89
9 changed files with 96 additions and 30 deletions

View File

@ -37,6 +37,7 @@ class CACHE extends Memcache {
private $PersistentKeys = array(
'stats_*',
'percentiles_*',
'top10tor_*'
);
public $CanClear = false;

View File

@ -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."));
}
}
}

View File

@ -1,8 +1,9 @@
<?
$Where = array();
if(!empty($_GET['advanced']) && check_perms('site_advanced_top10')) {
$Details = 'all';
$Limit = 10;
$Where = array();
if($_GET['tags']) {
$Tags = explode(',', str_replace(".","_",trim($_GET['tags'])));
@ -20,8 +21,6 @@
}
}
$Where = implode(' AND ', $Where);
} else {
// error out on invalid requests (before caching)
if(isset($_GET['details'])) {
@ -38,7 +37,7 @@
$Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;
$Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10;
}
$Filtered = !empty($Where);
show_header('Top '.$Limit.' Torrents');
?>
<div class="thin">
@ -83,6 +82,42 @@
<?
}
// default setting to have them shown
$DisableFreeTorrentTop10 = (isset($LoggedUser['DisableFreeTorrentTop10']) ? $LoggedUser['DisableFreeTorrentTop10'] : 0);
// did they just toggle it?
if(isset($_GET['freeleech'])) {
// what did they choose?
$NewPref = ($_GET['freeleech'] == 'hide') ? 1 : 0;
// Pref id different
if ($NewPref != $DisableFreeTorrentTop10) {
$DisableFreeTorrentTop10 = $NewPref;
update_site_options($LoggedUser['ID'], array('DisableFreeTorrentTop10' => $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 .= '&amp;';
$FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName;
?>
<div style="text-align: right;">
<a href="top10.php?<?=$FreeleechToggleQuery?>">[<?=ucfirst($FreeleechToggleName)?> Freeleech in Top 10]</a>
</div>
<?
$Where = implode(' AND ', $Where);
$WhereSum = (empty($Where)) ? '' : md5($Where);
$BaseQuery = "SELECT
t.ID,
@ -117,7 +152,7 @@
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->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;
?>
<h3>Top <?=$Limit.' '.$Caption?>
<? if(empty($_GET['advanced'])){ ?>
@ -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.= "<a href='torrents.php?id=$GroupID&amp;torrentid=$TorrentID' title='View Torrent'>$GroupName</a>";

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -1,6 +1,13 @@
<?
authorize();
$DB->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');
?>

View File

@ -268,7 +268,7 @@
<strong><a href="collage.php?id=<?=$CollageID?>"><?=$CollageName?></a></strong> (<?=$NewTorrentCount?> new torrent<?=($NewTorrentCount==1?'':'s')?>)
</span>&nbsp;
<span style="float:right;">
<a href="#" onclick="$('#discog_table_<?=$CollageID?>').toggle(); this.innerHTML=(this.innerHTML=='[Hide]'?'[Show]':'[Hide]'); return false;"><?=$ShowAll?'[Show]':'[Hide]'?></a>&nbsp;&nbsp;&nbsp;<a href="#" onclick="CollageSubscribe(<?=$CollageID?>); return false;" id="subscribelink<?=$CollageID?>">[Unsubscribe]</a>
<a href="#" onclick="$('#discog_table_<?=$CollageID?>').toggle(); this.innerHTML=(this.innerHTML=='[Hide]'?'[Show]':'[Hide]'); return false;"><?=$ShowAll?'[Show]':'[Hide]'?></a>&nbsp;&nbsp;&nbsp;[<a href="userhistory.php?action=catchup_collages&auth=<?=$LoggedUser['AuthKey']?>&collageid=<?=$CollageID?>">Catch up</a>]&nbsp;&nbsp;&nbsp;<a href="#" onclick="CollageSubscribe(<?=$CollageID?>); return false;" id="subscribelink<?=$CollageID?>">[Unsubscribe]</a>
</span>
</td>
</tr>

View File

@ -76,13 +76,19 @@
<? } ?>
</tr>
<?
foreach ($Tokens as $Token) {
$GroupIDs[] = $Token['GroupID'];
}
$Artists = get_artists($GroupIDs);
$i = true;
foreach ($Tokens as $Token) {
$i = !$i;
list($TorrentID, $GroupID, $Time, $Expired, $Downloaded, $Name, $Format, $Encoding) = $Token;
$ArtistName = display_artists(get_artist($GroupID));
$Name = "<a href=\"torrents.php?torrentid=$TorrentID\">$Name</a>";
$ArtistName = display_artists($Artists[$GroupID]);
if($ArtistName) {
$Name = $ArtistName."<a href=\"torrents.php?torrentid=$TorrentID\">$Name</a>";
$Name = $ArtistName.$Name;
}
if($Format && $Encoding) {
$Name.=' ['.$Format.' / '.$Encoding.']';