Empty commit

This commit is contained in:
Git 2012-03-16 08:00:25 +00:00
parent df1f5ef22c
commit ef884a3426
8 changed files with 146 additions and 8 deletions

View File

@ -1116,7 +1116,7 @@ function delete_torrent($ID, $GroupID=0) {
$Cache->decrement('stats_torrent_count');
$DB->query("SELECT COUNT(ID) FROM torrents WHERE GroupID='$GroupID' AND flags <> 1");
$DB->query("SELECT COUNT(ID) FROM torrents WHERE GroupID='$GroupID'");
list($Count) = $DB->next_record();
if($Count == 0) {

View File

@ -28,6 +28,46 @@
?>
<div class="thin">
<div class="sidebar">
<?
$DB->query("SELECT lc.UserID,
SUM(lc.Points),
um.Username,
ui.Donor,
ui.Warned,
um.Enabled, um.PermissionID FROM library_contest AS lc JOIN users_main AS um ON um.ID=lc.UserID JOIN users_info AS ui ON ui.UserID=um.ID GROUP BY lc.UserID ORDER BY SUM(lc.Points) DESC LIMIT 10");
$Contest = $DB->to_array();
?>
<div class="box">
<div class="head colhead_dark"><strong><a href="index.php?action=library_scoreboard">Library Contest Scoreboard</a></strong></div>
<div class="center pad">
<table>
<tr class="colhead">
<td><strong>Place</strong></td>
<td><strong>Username</strong></td>
<td><strong>Points</strong></td>
</tr>
<?
$i = 1;
foreach ($Contest as $Contestant) {
list($UserID, $Uploads, $Username, $Donor, $Warned, $Enabled, $PermissionID) = $Contestant;
$Class = ($i%2 == 0) ? 'a':'b';
$Num = $i;
?>
<tr class="row<?=$Class?>">
<td><strong><?=$Num?></td>
<td><?=format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID)?></td>
<td><?=number_format($Uploads)?></td>
</tr>
<?
$i++;
}
?>
</table>
</div>
<div class="center">
<i><a href="forums.php?action=viewthread&threadid=151451">Announcement</a></i>
</div>
</div>
<?
$FeaturedAlbum = $Cache->get_value('featured_album');
if($FeaturedAlbum === false) {

View File

@ -99,8 +99,23 @@ function generate_tag_table($Caption, $Tag, $Details, $Limit, $ShowVotes=true, $
?>
<h3>Top <?=$Limit.' '.$Caption?>
<small>
<?
switch($Limit) {
case 100: ?>
- [<a href="top10.php?type=tags&details=<?=$Tag?>">Top 10</a>]
- [Top 100]
- [<a href="top10.php?type=tags&amp;limit=250&amp;details=<?=$Tag?>">Top 250</a>]
<? break;
case 250: ?>
- [<a href="top10.php?type=tags&details=<?=$Tag?>">Top 10</a>]
- [<a href="top10.php?type=tags&amp;limit=100&amp;details=<?=$Tag?>">Top 100</a>]
- [Top 250]
<? break;
default: ?>
- [Top 10]
- [<a href="top10.php?type=tags&amp;limit=100&amp;details=<?=$Tag?>">Top 100</a>]
- [<a href="top10.php?type=tags&amp;limit=250&amp;details=<?=$Tag?>">Top 250</a>]
<? } ?>
</small>
</h3>
<table class="border">

View File

@ -24,7 +24,7 @@
} else {
// error out on invalid requests (before caching)
if(isset($_GET['details'])) {
if(in_array($_GET['details'], array('day','week','overall','snatched','data','seeded'))) {
if(in_array($_GET['details'], array('day','week','overall','snatched','data','seeded','month','year'))) {
$Details = $_GET['details'];
} else {
error(404);
@ -174,6 +174,36 @@
generate_torrent_table('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit);
}
if($Details=='all' || $Details=='month') {
if (!$TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum)) {
$Query = $BaseQuery.' WHERE ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'".sqltime()."' - INTERVAL 1 MONTH
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastMonth = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_month_'.$Limit.$WhereSum,$TopTorrentsActiveLastMonth,3600*6);
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Month', 'month', $TopTorrentsActiveLastMonth, $Limit);
}
if($Details=='all' || $Details=='year') {
if (!$TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum)) {
$Query = $BaseQuery.' WHERE ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'".sqltime()."' - INTERVAL 1 YEAR
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastYear = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_year_'.$Limit.$WhereSum,$TopTorrentsActiveLastYear,3600*6);
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Year', 'year', $TopTorrentsActiveLastYear, $Limit);
}
if($Details=='all' || $Details=='overall') {
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!
@ -252,8 +282,23 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
<h3>Top <?=$Limit.' '.$Caption?>
<? if(empty($_GET['advanced'])){ ?>
<small>
<?
switch($Limit) {
case 100: ?>
- [<a href="top10.php?details=<?=$Tag?>">Top 10</a>]
- [Top 100]
- [<a href="top10.php?type=torrents&amp;limit=250&amp;details=<?=$Tag?>">Top 250</a>]
<? break;
case 250: ?>
- [<a href="top10.php?details=<?=$Tag?>">Top 10</a>]
- [<a href="top10.php?type=torrents&amp;limit=100&amp;details=<?=$Tag?>">Top 100</a>]
- [Top 250]
<? break;
default: ?>
- [Top 10]
- [<a href="top10.php?type=torrents&amp;limit=100&amp;details=<?=$Tag?>">Top 100</a>]
- [<a href="top10.php?type=torrents&amp;limit=250&amp;details=<?=$Tag?>">Top 250</a>]
<? } ?>
</small>
<? } ?>
</h3>

View File

@ -101,8 +101,23 @@ function generate_user_table($Caption, $Tag, $Details, $Limit) {
?>
<h3>Top <?=$Limit.' '.$Caption;?>
<small>
<?
switch($Limit) {
case 100: ?>
- [<a href="top10.php?type=users&details=<?=$Tag?>">Top 10</a>]
- [Top 100]
- [<a href="top10.php?type=users&amp;limit=250&amp;details=<?=$Tag?>">Top 250</a>]
<? break;
case 250: ?>
- [<a href="top10.php?type=users&details=<?=$Tag?>">Top 10</a>]
- [<a href="top10.php?type=users&amp;limit=100&amp;details=<?=$Tag?>">Top 100</a>]
- [Top 250]
<? break;
default: ?>
- [Top 10]
- [<a href="top10.php?type=users&amp;limit=100&amp;details=<?=$Tag?>">Top 100</a>]
- [<a href="top10.php?type=users&amp;limit=250&amp;details=<?=$Tag?>">Top 250</a>]
<? } ?>
</small>
</h3>
<table class="border">

View File

@ -101,7 +101,6 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
LEFT JOIN torrents_lossymaster_approved AS lma on lma.TorrentID=t.ID
LEFT JOIN torrents_logs_new AS tln ON tln.TorrentID=t.ID
WHERE t.GroupID='".db_string($GroupID)."'
AND flags != 1
GROUP BY t.ID
ORDER BY t.Remastered ASC, (t.RemasterYear <> 0) DESC, t.RemasterYear ASC, t.RemasterTitle ASC, t.RemasterRecordLabel ASC, t.RemasterCatalogueNumber ASC, t.Media ASC, t.Format, t.Encoding, t.ID");

View File

@ -95,16 +95,32 @@ function header_link($SortKey,$DefaultWay="DESC") {
$SearchWhere[]='('.implode(' OR ', $Cats).')';
}
if(!isset($_GET['tags_type'])) {
$_GET['tags_type'] = '1';
}
if(!empty($_GET['tags'])) {
$Tags = explode(',',$_GET['tags']);
$TagList = array();
foreach($Tags as $Tag) {
$Tag = trim(str_replace('.','_',$Tag));
if(empty($Tag)) { continue; }
$TagList[]="tg.TagList LIKE '%".db_string($Tag)."%'";
if($Tag[0] == '!') {
$Tag = ltrim(substr($Tag,1));
if(empty($Tag)) { continue; }
$TagList[]="CONCAT(' ',tg.TagList,' ') NOT LIKE '% ".db_string($Tag)." %'";
} else {
$TagList[]="CONCAT(' ',tg.TagList,' ') LIKE '% ".db_string($Tag)." %'";
}
}
if(!empty($TagList)) {
$SearchWhere[]='('.implode(' OR ', $TagList).')';
if(isset($_GET['tags_type']) && $_GET['tags_type'] != 1) {
$_GET['tags_type'] = '0';
$SearchWhere[]='('.implode(' OR ', $TagList).')';
} else {
$_GET['tags_type'] = '1';
$SearchWhere[]='('.implode(' AND ', $TagList).')';
}
}
}
@ -132,6 +148,12 @@ function header_link($SortKey,$DefaultWay="DESC") {
$ExtraWhere = 'AND xfu.active=1 AND xfu.Remaining=0';
$From = "xbt_files_users AS xfu JOIN torrents AS t ON t.ID=xfu.fid";
break;
case 'contest':
$Time = 'unix_timestamp(t.Time)';
$UserField = 't.UserID';
$ExtraWhere = " AND t.ID IN (SELECT TorrentID FROM library_contest WHERE UserID = ".$UserID.")";
$From = "torrents AS t";
break;
case 'leeching':
if(!check_paranoia('leeching', $User['Paranoia'], $UserClass, $UserID)) { error(403); }
$Time = '(unix_timestamp(now()) - xfu.timespent)';
@ -143,7 +165,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
if ((empty($_GET['filter']) || $_GET['filter'] != 'perfectflac') && !check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) { error(403); }
$Time = 'unix_timestamp(t.Time)';
$UserField = 't.UserID';
$ExtraWhere = 'AND flags!=1';
$ExtraWhere = '';
$From = "torrents AS t";
break;
case 'downloaded':
@ -322,7 +344,9 @@ function header_link($SortKey,$DefaultWay="DESC") {
<tr>
<td class="label"><strong>Tags:</strong></td>
<td>
<input type="text" name="tags" size="60" value="<?form('tags')?>" />
<input type="text" name="tags" size="60" title="Use !tag to exclude tag" value="<?form('tags')?>" />&nbsp;
<input type="radio" name="tags_type" id="tags_type0" value="0" <?selected('tags_type',0,'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1" <?selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
</td>
</tr>

View File

@ -229,7 +229,7 @@ function check_paranoia_here($Setting) {
$DB->query("SELECT SUM(Points) FROM library_contest WHERE UserID = ".$UserID);
list($LibraryUploads) = $DB->next_record();
?>
<li>Library Points: <?=number_format($LibraryUploads)?></li>
<li>Library Points: <?=number_format($LibraryUploads)?> [<a href="torrents.php?type=contest&userid=<?=$UserID?>">View</a>]</li>
<? } ?>
</ul>
</div>