Empty commit

This commit is contained in:
Git 2013-05-30 08:00:30 +00:00
parent b7ca8d3cf6
commit b8d11cc6b0
22 changed files with 320 additions and 211 deletions

View File

@ -66,7 +66,7 @@ public static function blacklisted($Url, $ShowError = true) {
foreach (self::$Blacklist as &$Value) { foreach (self::$Blacklist as &$Value) {
if (stripos($Url, $Value)) { if (stripos($Url, $Value)) {
$ParsedUrl = parse_url($Url); $ParsedUrl = parse_url($Url);
if($ShowError) { if ($ShowError) {
error($ParsedUrl['host'] . ' is not an allowed image host. Please use a different host.'); error($ParsedUrl['host'] . ' is not an allowed image host. Please use a different host.');
} }
return true; return true;

View File

@ -50,7 +50,10 @@
$Forums = $DB->to_array('ID', MYSQLI_ASSOC, false); $Forums = $DB->to_array('ID', MYSQLI_ASSOC, false);
foreach ($Forums as $ForumID => $Forum) { foreach ($Forums as $ForumID => $Forum) {
if (count($Forum['SpecificRules'])) { if (count($Forum['SpecificRules'])) {
$DB->query("SELECT ThreadID FROM forums_specific_rules WHERE ForumID = ".$ForumID); $DB->query("
SELECT ThreadID
FROM forums_specific_rules
WHERE ForumID = $ForumID");
$ThreadIDs = $DB->collect('ThreadID'); $ThreadIDs = $DB->collect('ThreadID');
$Forums[$ForumID]['SpecificRules'] = $ThreadIDs; $Forums[$ForumID]['SpecificRules'] = $ThreadIDs;
} }

View File

@ -135,10 +135,10 @@
} }
$Cache->cache_value('votes_'.$GroupID, $GroupVotes); $Cache->cache_value('votes_'.$GroupID, $GroupVotes);
$DB->query(" $DB->query('
UPDATE torrents_votes UPDATE torrents_votes
SET Total = GREATEST(0, Total - 1), SET Total = GREATEST(0, Total - 1),
Score = IFNULL(binomial_ci(GREATEST(0,Ups".($Type == 'Up' ? '-1' : '')."),GREATEST(0, Total)),0)". Score = IFNULL(binomial_ci(GREATEST(0, Ups'.($Type == 'Up' ? '-1' : '').'),GREATEST(0, Total)), 0)'.
($Type == 'Up' ? ', Ups = GREATEST(0, Ups - 1)' : '')." ($Type == 'Up' ? ', Ups = GREATEST(0, Ups - 1)' : '')."
WHERE GroupID=$GroupID"); WHERE GroupID=$GroupID");
// Update paired cache keys // Update paired cache keys

View File

@ -8,7 +8,11 @@
$GenreTags = $Cache->get_value('genre_tags'); $GenreTags = $Cache->get_value('genre_tags');
if (!$GenreTags) { if (!$GenreTags) {
$DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name'); $DB->query('
SELECT Name
FROM tags
WHERE TagType=\'genre\'
ORDER BY Name');
$GenreTags = $DB->collect('Name'); $GenreTags = $DB->collect('Name');
$Cache->cache_value('genre_tags', $GenreTags, 3600 * 24); $Cache->cache_value('genre_tags', $GenreTags, 3600 * 24);
} }

View File

@ -4,7 +4,7 @@
* $_GET['filter'] determines which torrents should be shown and can be empty/all (default), uploaded, snatched or seeding * $_GET['filter'] determines which torrents should be shown and can be empty/all (default), uploaded, snatched or seeding
* $_GET['target'] further filters which transcodes one would like to do and can be empty/any (default), v0, v2, 320 or all * $_GET['target'] further filters which transcodes one would like to do and can be empty/any (default), v0, v2, 320 or all
* Here, 'any' means that at least one of the formats V0, V2 and 320 is missing and 'all' means that all of them are missing. * Here, 'any' means that at least one of the formats V0, V2 and 320 is missing and 'all' means that all of them are missing.
* 'v0' etc mean that this specific format is missing (but others might be present). * 'v0', etc. mean that this specific format is missing (but others might be present).
* *
* Furthermore, there's $_GET['userid'] which allows to see the page as a different user would see it (specifically relevant for uploaded/snatched/seeding). * Furthermore, there's $_GET['userid'] which allows to see the page as a different user would see it (specifically relevant for uploaded/snatched/seeding).
*/ */
@ -304,7 +304,7 @@ function transcode_parse_groups($Groups) {
foreach ($Group['Editions'] as $RemIdent => $Edition) { foreach ($Group['Editions'] as $RemIdent => $Edition) {
// TODO: point to the correct FLAC (?) // TODO: point to the correct FLAC (?)
$FlacID = array_search(true, $Edition['FlacIDs']); $FlacID = array_search(true, $Edition['FlacIDs']);
$DisplayName = $ArtistNames . '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$FlacID.'#torrent'.$FlacID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName = $ArtistNames . "<a href=\"torrents.php?id=$GroupID&amp;torrentid=$FlacID#torrent$FlacID\" title=\"View Torrent\">$GroupName</a>";
if ($GroupYear > 0) { if ($GroupYear > 0) {
$DisplayName .= " [$GroupYear]"; $DisplayName .= " [$GroupYear]";
} }
@ -315,7 +315,7 @@ function transcode_parse_groups($Groups) {
$DisplayName .= ' ' . Format::torrent_label('Snatched!'); $DisplayName .= ' ' . Format::torrent_label('Snatched!');
} }
?> ?>
<tr<?=$Edition['FLACIsSnatched'] ? ' class="snatched_torrent"' : ''?>> <tr<?=($Edition['FLACIsSnatched'] ? ' class="snatched_torrent"' : '')?>>
<td> <td>
<span class="torrent_links_block"> <span class="torrent_links_block">
<a href="torrents.php?action=download&amp;id=<?=$Edition['FlacID']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a> <a href="torrents.php?action=download&amp;id=<?=$Edition['FlacID']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a>
@ -324,9 +324,9 @@ function transcode_parse_groups($Groups) {
<div class="torrent_info"><?=$Edition['EditionName']?></div> <div class="torrent_info"><?=$Edition['EditionName']?></div>
<div class="tags"><?=$TorrentTags->format('better.php?action=transcode&tags=')?></div> <div class="tags"><?=$TorrentTags->format('better.php?action=transcode&tags=')?></div>
</td> </td>
<td><strong <?=isset($Edition['MP3s']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><strong <?=(isset($Edition['MP3s']['V2 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO')?></strong></td>
<td><strong <?=isset($Edition['MP3s']['V0 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><strong <?=(isset($Edition['MP3s']['V0 (VBR)']) ? 'class="important_text_alt">YES' : 'class="important_text">NO')?></strong></td>
<td><strong <?=isset($Edition['MP3s']['320']) ? 'class="important_text_alt">YES' : 'class="important_text">NO'?></strong></td> <td><strong <?=(isset($Edition['MP3s']['320']) ? 'class="important_text_alt">YES' : 'class="important_text">NO')?></strong></td>
</tr> </tr>
<? <?
} }

View File

@ -73,8 +73,8 @@
$DB->query(" $DB->query("
UPDATE forums UPDATE forums
SET SET
NumPosts = NumPosts+1, NumPosts = NumPosts + 1,
NumTopics = NumTopics+1, NumTopics = NumTopics + 1,
LastPostID = '$PostID', LastPostID = '$PostID',
LastPostAuthorID = '".$LoggedUser['ID']."', LastPostAuthorID = '".$LoggedUser['ID']."',
LastPostTopicID = '$TopicID', LastPostTopicID = '$TopicID',
@ -84,21 +84,27 @@
$DB->query(" $DB->query("
UPDATE forums_topics UPDATE forums_topics
SET SET
NumPosts = NumPosts+1, NumPosts = NumPosts + 1,
LastPostID = '$PostID', LastPostID = '$PostID',
LastPostAuthorID = '".$LoggedUser['ID']."', LastPostAuthorID = '".$LoggedUser['ID']."',
LastPostTime = '".sqltime()."' LastPostTime = '".sqltime()."'
WHERE ID = '$TopicID'"); WHERE ID = '$TopicID'");
if (isset($_POST['subscribe'])) { if (isset($_POST['subscribe'])) {
$DB->query("INSERT INTO users_subscriptions VALUES ($LoggedUser[ID], $TopicID)"); $DB->query("
INSERT INTO users_subscriptions
VALUES ($LoggedUser[ID], $TopicID)");
$Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']); $Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']);
} }
//auto subscribe //auto subscribe
/* /*
if (check_perms('users_mod')) { if (check_perms('users_mod')) {
$DB->query("SELECT SubscriberID FROM subscribed_forums WHERE ForumID = '$ForumID' AND SubscriberID != '$LoggedUser[ID]'"); $DB->query("
SELECT SubscriberID
FROM subscribed_forums
WHERE ForumID = '$ForumID'
AND SubscriberID != '$LoggedUser[ID]'");
while (list($SubscriberID) = $DB->next_record()) { while (list($SubscriberID) = $DB->next_record()) {
$DB->query("INSERT INTO users_subscriptions VALUES ($SubscriberID, $TopicID)"); $DB->query("INSERT INTO users_subscriptions VALUES ($SubscriberID, $TopicID)");
// $DB->query("INSERT INTO forums_last_read_topics // $DB->query("INSERT INTO forums_last_read_topics
@ -118,9 +124,11 @@
$Answers = array(); $Answers = array();
$Votes = array(); $Votes = array();
//This can cause polls to have answer ids of 1 3 4 if the second box is empty //This can cause polls to have answer IDs of 1 3 4 if the second box is empty
foreach ($_POST['answers'] as $i => $Answer) { foreach ($_POST['answers'] as $i => $Answer) {
if ($Answer == '') { continue; } if ($Answer == '') {
continue;
}
$Answers[$i + 1] = $Answer; $Answers[$i + 1] = $Answer;
$Votes[$i + 1] = 0; $Votes[$i + 1] = 0;
} }
@ -131,26 +139,30 @@
error('You cannot create a poll with greater than 25 answers.'); error('You cannot create a poll with greater than 25 answers.');
} }
$DB->query('INSERT INTO forums_polls (TopicID, Question, Answers) VALUES (\''.$TopicID.'\',\''.db_string($Question).'\',\''.db_string(serialize($Answers)).'\')'); $DB->query("
$Cache->cache_value('polls_'.$TopicID, array($Question,$Answers,$Votes,'0000-00-00 00:00:00','0'), 0); INSERT INTO forums_polls
(TopicID, Question, Answers)
VALUES
('$TopicID', '".db_string($Question)."', '".db_string(serialize($Answers))."')");
$Cache->cache_value('polls_'.$TopicID, array($Question, $Answers, $Votes, '0000-00-00 00:00:00', '0'), 0);
if ($ForumID == STAFF_FORUM) { if ($ForumID == STAFF_FORUM) {
send_irc("PRIVMSG ".ADMIN_CHAN." :!mod Poll created by ".$LoggedUser['Username'].': "'.$Question.'" https://'.SSL_SITE_URL.'/forums.php?action=viewthread&threadid='.$TopicID); send_irc('PRIVMSG '.ADMIN_CHAN.' :!mod Poll created by '.$LoggedUser['Username'].": \"$Question\" https://".SSL_SITE_URL.'/forums.php?action=viewthread&threadid='.$TopicID);
} }
} }
//if cache exists modify it, if not, then it will be correct when selected next, and we can skip this block // if cache exists modify it, if not, then it will be correct when selected next, and we can skip this block
if ($Forum = $Cache->get_value('forums_'.$ForumID)) { if ($Forum = $Cache->get_value('forums_'.$ForumID)) {
list($Forum,,,$Stickies) = $Forum; list($Forum,,,$Stickies) = $Forum;
//Remove the last thread from the index // Remove the last thread from the index
if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) { if (count($Forum) == TOPICS_PER_PAGE && $Stickies < TOPICS_PER_PAGE) {
array_pop($Forum); array_pop($Forum);
} }
if ($Stickies > 0) { if ($Stickies > 0) {
$Part1 = array_slice($Forum, 0, $Stickies, true); //Stickies $Part1 = array_slice($Forum, 0, $Stickies, true); // Stickies
$Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE - $Stickies - 1, true); //Rest of page $Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE - $Stickies - 1, true); // Rest of page
} else { } else {
$Part1 = array(); $Part1 = array();
$Part3 = $Forum; $Part3 = $Forum;

View File

@ -3,7 +3,7 @@
if (empty($Return)) { if (empty($Return)) {
$ToID = $_GET['to']; $ToID = $_GET['to'];
if ($ToID == $LoggedUser['ID']) { if ($ToID == $LoggedUser['ID']) {
error("You cannot start a conversation with yourself!"); error('You cannot start a conversation with yourself!');
header('Location: inbox.php'); header('Location: inbox.php');
} }
} }

View File

@ -27,7 +27,10 @@
error(403); error(403);
} }
$DB->query("SELECT Username FROM users_main WHERE ID='$ToID'"); $DB->query("
SELECT Username
FROM users_main
WHERE ID='$ToID'");
list($ComposeToUsername) = $DB->next_record(); list($ComposeToUsername) = $DB->next_record();
if (!$ComposeToUsername) { if (!$ComposeToUsername) {
error(404); error(404);
@ -36,108 +39,164 @@
// $TypeLink is placed directly in the <textarea> when composing a PM // $TypeLink is placed directly in the <textarea> when composing a PM
switch ($Type) { switch ($Type) {
case "user" : case 'user':
$DB->query("SELECT Username FROM users_main WHERE ID=".$ThingID); $DB->query("
SELECT Username
FROM users_main
WHERE ID=$ThingID");
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No user with the reported ID found"; $Error = 'No user with the reported ID found';
} else { } else {
list($Username) = $DB->next_record(); list($Username) = $DB->next_record();
$TypeLink = "the user [user]".$Username."[/user]"; $TypeLink = "the user [user]{$Username}[/user]";
$Subject = "User Report: ".display_str($Username); $Subject = 'User Report: '.display_str($Username);
} }
break; break;
case "request" : case 'request':
case "request_update" : case 'request_update':
$DB->query("SELECT Title FROM requests WHERE ID=".$ThingID); $DB->query("
SELECT Title
FROM requests
WHERE ID=$ThingID");
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No request with the reported ID found"; $Error = 'No request with the reported ID found';
} else { } else {
list($Name) = $DB->next_record(); list($Name) = $DB->next_record();
$TypeLink = "the request [url=https://".SSL_SITE_URL."/requests.php?action=view&amp;id=".$ThingID."]".display_str($Name)."[/url]"; $TypeLink = 'the request [url=https://'.SSL_SITE_URL."/requests.php?action=view&amp;id=$ThingID]".display_str($Name).'[/url]';
$Subject = "Request Report: ".display_str($Name); $Subject = 'Request Report: '.display_str($Name);
} }
break; break;
case "collage" : case 'collage':
$DB->query("SELECT Name FROM collages WHERE ID=".$ThingID); $DB->query("
SELECT Name
FROM collages
WHERE ID=$ThingID");
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No collage with the reported ID found"; $Error = 'No collage with the reported ID found';
} else { } else {
list($Name) = $DB->next_record(); list($Name) = $DB->next_record();
$TypeLink = "the collage [url=https://".SSL_SITE_URL."/collage.php?id=".$ThingID."]".display_str($Name)."[/url]"; $TypeLink = 'the collage [url=https://'.SSL_SITE_URL."/collage.php?id=$ThingID]".display_str($Name).'[/url]';
$Subject = "Collage Report: ".display_str($Name); $Subject = 'Collage Report: '.display_str($Name);
} }
break; break;
case "thread" : case 'thread':
$DB->query("SELECT Title FROM forums_topics WHERE ID=".$ThingID); $DB->query("
SELECT Title
FROM forums_topics
WHERE ID=$ThingID");
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No forum thread with the reported ID found"; $Error = 'No forum thread with the reported ID found';
} else { } else {
list($Title) = $DB->next_record(); list($Title) = $DB->next_record();
$TypeLink = "the forum thread [url=https://".SSL_SITE_URL."/forums.php?action=viewthread&amp;threadid=".$ThingID."]".display_str($Title)."[/url]"; $TypeLink = 'the forum thread [url=https://'.SSL_SITE_URL."/forums.php?action=viewthread&amp;threadid=$ThingID]".display_str($Title).'[/url]';
$Subject = "Forum Thread Report: ".display_str($Title); $Subject = 'Forum Thread Report: '.display_str($Title);
} }
break; break;
case "post" : case 'post':
if (isset($LoggedUser['PostsPerPage'])) { if (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage']; $PerPage = $LoggedUser['PostsPerPage'];
} else { } else {
$PerPage = POSTS_PER_PAGE; $PerPage = POSTS_PER_PAGE;
} }
$DB->query("SELECT p.ID, p.Body, p.TopicID, (SELECT COUNT(ID) FROM forums_posts WHERE forums_posts.TopicID = p.TopicID AND forums_posts.ID<=p.ID) AS PostNum FROM forums_posts AS p WHERE ID=".$ThingID); $DB->query("
SELECT
p.ID,
p.Body,
p.TopicID,
( SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = p.TopicID
AND forums_posts.ID<=p.ID
) AS PostNum
FROM forums_posts AS p
WHERE ID=$ThingID");
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No forum post with the reported ID found"; $Error = 'No forum post with the reported ID found';
} else { } else {
list($PostID,$Body,$TopicID,$PostNum) = $DB->next_record(); list($PostID, $Body, $TopicID, $PostNum) = $DB->next_record();
$TypeLink = "this [url=https://".SSL_SITE_URL."/forums.php?action=viewthread&amp;threadid=".$TopicID."&amp;post=".$PostNum."#post".$PostID."]forum post[/url]"; $TypeLink = 'this [url=https://'.SSL_SITE_URL."/forums.php?action=viewthread&amp;threadid=$TopicID&amp;post=$PostNum#post$PostID]forum post[/url]";
$Subject = "Forum Post Report: Post ID #".display_str($PostID); $Subject = 'Forum Post Report: Post ID #'.display_str($PostID);
} }
break; break;
case "requests_comment" : case 'requests_comment':
$DB->query("SELECT rc.RequestID, rc.Body, (SELECT COUNT(ID) FROM requests_comments WHERE ID <= ".$ThingID." AND requests_comments.RequestID = rc.RequestID) AS CommentNum FROM requests_comments AS rc WHERE ID=".$ThingID); $DB->query("
SELECT
rc.RequestID,
rc.Body,
( SELECT COUNT(ID)
FROM requests_comments
WHERE ID <= $ThingID
AND requests_comments.RequestID = rc.RequestID
) AS CommentNum
FROM requests_comments AS rc
WHERE ID=$ThingID");
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No request comment with the reported ID found"; $Error = 'No request comment with the reported ID found';
} else { } else {
list($RequestID, $Body, $PostNum) = $DB->next_record(); list($RequestID, $Body, $PostNum) = $DB->next_record();
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE); $PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
$TypeLink = "this [url=https://".SSL_SITE_URL."/requests.php?action=view&amp;id=".$RequestID."&amp;page=".$PageNum."#post".$ThingID."]request comment[/url]"; $TypeLink = 'this [url=https://'.SSL_SITE_URL."/requests.php?action=view&amp;id=$RequestID&amp;page=$PageNum#post$ThingID]request comment[/url]";
$Subject = "Request Comment Report: ID #".display_str($ThingID); $Subject = 'Request Comment Report: ID #'.display_str($ThingID);
} }
break; break;
case "torrents_comment" : case 'torrents_comment':
$DB->query("SELECT tc.GroupID, tc.Body, (SELECT COUNT(ID) FROM torrents_comments WHERE ID <= ".$ThingID." AND torrents_comments.GroupID = tc.GroupID) AS CommentNum FROM torrents_comments AS tc WHERE ID=".$ThingID); $DB->query("
SELECT
tc.GroupID,
tc.Body,
( SELECT COUNT(ID)
FROM torrents_comments
WHERE ID <= $ThingID
AND torrents_comments.GroupID = tc.GroupID
) AS CommentNum
FROM torrents_comments AS tc
WHERE ID=$ThingID");
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No torrent comment with the reported ID found"; $Error = 'No torrent comment with the reported ID found';
} else { } else {
list($GroupID, $Body, $PostNum) = $DB->next_record(); list($GroupID, $Body, $PostNum) = $DB->next_record();
$PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE); $PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE);
$TypeLink = "this [url=https://".SSL_SITE_URL."/torrents.php?id=".$GroupID."&amp;page=".$PageNum."#post".$ThingID."]torrent comment[/url]"; $TypeLink = 'this [url=https://'.SSL_SITE_URL."/torrents.php?id=$GroupID&amp;page=$PageNum#post$ThingID]torrent comment[/url]";
$Subject = "Torrent Comment Report: ID #".display_str($ThingID); $Subject = 'Torrent Comment Report: ID #'.display_str($ThingID);
} }
break; break;
case "collages_comment" : case 'collages_comment':
$DB->query("SELECT cc.CollageID, cc.Body, (SELECT COUNT(ID) FROM collages_comments WHERE ID <= ".$ThingID." AND collages_comments.CollageID = cc.CollageID) AS CommentNum FROM collages_comments AS cc WHERE ID=".$ThingID); $DB->query("
SELECT
cc.CollageID,
cc.Body,
( SELECT COUNT(ID)
FROM collages_comments
WHERE ID <= $ThingID
AND collages_comments.CollageID = cc.CollageID
) AS CommentNum
FROM collages_comments AS cc
WHERE ID=$ThingID");
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
$Error = "No collage comment with the reported ID found"; $Error = 'No collage comment with the reported ID found';
} else { } else {
list($CollageID, $Body, $PostNum) = $DB->next_record(); list($CollageID, $Body, $PostNum) = $DB->next_record();
$PerPage = POSTS_PER_PAGE; $PerPage = POSTS_PER_PAGE;
$PageNum = ceil($PostNum / $PerPage); $PageNum = ceil($PostNum / $PerPage);
$TypeLink = "this [url=https://".SSL_SITE_URL."/collage.php?action=comments&amp;collageid=".$CollageID."&amp;page=".$PageNum."#post".$ThingID."]collage comment[/url]"; $TypeLink = 'this [url=https://'.SSL_SITE_URL."/collage.php?action=comments&amp;collageid=$CollageID&amp;page=$PageNum#post$ThingID]collage comment[/url]";
$Subject = "Collage Comment Report: ID #".display_str($ThingID); $Subject = 'Collage Comment Report: ID #'.display_str($ThingID);
} }
break; break;
default: default:
error("Incorrect type"); error('Incorrect type');
break; break;
} }
if (isset($Error)) { if (isset($Error)) {
error($Error); error($Error);
} }
$DB->query("SELECT r.Reason FROM reports AS r WHERE r.ID = $ReportID"); $DB->query("
SELECT r.Reason
FROM reports AS r
WHERE r.ID = $ReportID");
list($Reason) = $DB->next_record(); list($Reason) = $DB->next_record();
$Body = "You reported $TypeLink for the reason:\n[quote]".$Reason."[/quote]"; $Body = "You reported $TypeLink for the reason:\n[quote]{$Reason}[/quote]";
?> ?>
<div class="thin"> <div class="thin">
@ -166,7 +225,6 @@
</div> </div>
</form> </form>
</div> </div>
<? <?
View::show_footer(); View::show_footer();
?> ?>

View File

@ -1,4 +1,4 @@
<? <?php
/* /*
* Yeah, that's right, edit and new are the same place again. * Yeah, that's right, edit and new are the same place again.
@ -89,12 +89,16 @@
} }
} }
$Tags = implode(", ", $Request['Tags']); $Tags = implode(', ', $Request['Tags']);
} }
} }
if ($NewRequest && !empty($_GET['artistid']) && is_number($_GET['artistid'])) { if ($NewRequest && !empty($_GET['artistid']) && is_number($_GET['artistid'])) {
$DB->query("SELECT Name FROM artists_group WHERE artistid = ".$_GET['artistid']." LIMIT 1"); $DB->query("
SELECT Name
FROM artists_group
WHERE artistid = ".$_GET['artistid']."
LIMIT 1");
list($ArtistName) = $DB->next_record(); list($ArtistName) = $DB->next_record();
$ArtistForm = array( $ArtistForm = array(
1 => array(array('name' => trim($ArtistName))), 1 => array(array('name' => trim($ArtistName))),
@ -103,7 +107,9 @@
); );
} elseif ($NewRequest && !empty($_GET['groupid']) && is_number($_GET['groupid'])) { } elseif ($NewRequest && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
$ArtistForm = Artists::get_artist($_GET['groupid']); $ArtistForm = Artists::get_artist($_GET['groupid']);
$DB->query("SELECT tg.Name, $DB->query("
SELECT
tg.Name,
tg.Year, tg.Year,
tg.ReleaseType, tg.ReleaseType,
tg.WikiImage, tg.WikiImage,
@ -118,11 +124,11 @@
} }
} }
View::show_header(($NewRequest ? "Create a request" : "Edit a request"), 'requests'); View::show_header(($NewRequest ? 'Create a request' : 'Edit a request'), 'requests');
?> ?>
<div class="thin"> <div class="thin">
<div class="header"> <div class="header">
<h2><?=($NewRequest ? "Create a request" : "Edit a request")?></h2> <h2><?=($NewRequest ? 'Create a request' : 'Edit a request')?></h2>
</div> </div>
<div class="box pad"> <div class="box pad">
@ -132,7 +138,7 @@
<input type="hidden" name="requestid" value="<?=$RequestID?>" /> <input type="hidden" name="requestid" value="<?=$RequestID?>" />
<? } ?> <? } ?>
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="action" value="<?=$NewRequest ? 'takenew' : 'takeedit'?>" /> <input type="hidden" name="action" value="<?=($NewRequest ? 'takenew' : 'takeedit')?>" />
</div> </div>
<table class="layout"> <table class="layout">
@ -239,9 +245,13 @@
<? <?
$GenreTags = $Cache->get_value('genre_tags'); $GenreTags = $Cache->get_value('genre_tags');
if (!$GenreTags) { if (!$GenreTags) {
$DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name'); $DB->query('
SELECT Name
FROM tags
WHERE TagType=\'genre\'
ORDER BY Name');
$GenreTags = $DB->collect('Name'); $GenreTags = $DB->collect('Name');
$Cache->cache_value('genre_tags', $GenreTags, 3600*6); $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
} }
?> ?>
<select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" > <select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" >

View File

@ -1073,6 +1073,7 @@ function next_hour() {
AND Status = 'Open' AND Status = 'Open'
AND AssignedToUser IS NULL"); AND AssignedToUser IS NULL");
} }
/*************************************************************************\ /*************************************************************************\
//--------------Run twice per month -------------------------------------// //--------------Run twice per month -------------------------------------//

View File

@ -98,7 +98,7 @@
// did they just toggle it? // did they just toggle it?
if (isset($_GET['freeleech'])) { if (isset($_GET['freeleech'])) {
// what did they choose? // what did they choose?
$NewPref = ($_GET['freeleech'] == 'hide') ? 1 : 0; $NewPref = (($_GET['freeleech'] == 'hide') ? 1 : 0);
// Pref id different // Pref id different
if ($NewPref != $DisableFreeTorrentTop10) { if ($NewPref != $DisableFreeTorrentTop10) {
@ -114,31 +114,33 @@
// The link should say the opposite of the current setting // The link should say the opposite of the current setting
$FreeleechToggleName = ($DisableFreeTorrentTop10 ? 'show' : 'hide'); $FreeleechToggleName = ($DisableFreeTorrentTop10 ? 'show' : 'hide');
$FreeleechToggleQuery = Format::get_url(array('freeleech')); $FreeleechToggleQuery = Format::get_url(array('freeleech', 'groups'));
if (!empty($FreeleechToggleQuery)) if (!empty($FreeleechToggleQuery))
$FreeleechToggleQuery .= '&amp;'; $FreeleechToggleQuery .= '&amp;';
$FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName; $FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName;
$GroupByToggleQuery = "&amp;groups="; $GroupByToggleName = ($_GET['groups'] == "show" ? 'hide' : 'show');
$GroupBy = ""; $GroupByToggleQuery = Format::get_url(array('freeleech', 'groups'));
$GroupBySum = "";
if(isset($_GET['groups']) && $_GET['groups'] == "show") { if (!empty($GroupByToggleQuery))
$GroupBy = " GROUP BY g.ID "; $GroupByToggleQuery .= '&amp;';
$GroupByToggleQuery .= 'groups=' . $GroupByToggleName;
$GroupBySum = '';
$GroupBy = '';
if ($_GET['groups'] == 'show') {
$GroupBy = ' GROUP BY g.ID ';
$GroupBySum = md5($GroupBy); $GroupBySum = md5($GroupBy);
$GroupByToggleQuery .= "hide";
$GroupByToggleName = "Show Top Torrents";
} else {
$GroupByToggleQuery .= "show";
$GroupByToggleName = "Show Top Groups";
} }
?> ?>
<div style="text-align: right;" class="linkbox"> <div style="text-align: right;" class="linkbox">
<a href="top10.php?<?=$FreeleechToggleQuery?>" class="brackets"><?=ucfirst($FreeleechToggleName)?> freeleech in Top 10</a> <a href="top10.php?<?=$FreeleechToggleQuery?>" class="brackets"><?=ucfirst($FreeleechToggleName)?> freeleech in Top 10</a>
<? if(check_perms("users_mod")) { ?> <? if (check_perms('users_mod')) { ?>
<a href="top10.php?<?=$GroupByToggleQuery?>" class="brackets"><?=ucfirst($GroupByToggleName)?></a> <a href="top10.php?<?=$GroupByToggleQuery?>" class="brackets"><?=ucfirst($GroupByToggleName)?> top groups</a>
<? } ?> <? } ?>
</div> </div>
<? <?
@ -149,7 +151,8 @@
} else { } else {
$WhereSum = ''; $WhereSum = '';
} }
$BaseQuery = "SELECT $BaseQuery = '
SELECT
t.ID, t.ID,
g.ID, g.ID,
g.Name, g.Name,
@ -173,23 +176,25 @@
g.ReleaseType, g.ReleaseType,
t.Size t.Size
FROM torrents AS t FROM torrents AS t
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID "; LEFT JOIN torrents_group AS g ON g.ID = t.GroupID';
if ($Details=='all' || $Details=='day') { if ($Details == 'all' || $Details == 'day') {
$TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum); $TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastDay === false) { if ($TopTorrentsActiveLastDay === false) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
$DayAgo = time_minus(86400); $DayAgo = time_minus(86400);
$Query = $BaseQuery.' WHERE t.Seeders>0 AND '; $Query = $BaseQuery.' WHERE t.Seeders>0 AND ';
if (!empty($Where)) { $Query .= $Where.' AND '; } if (!empty($Where)) {
$Query .= $Where.' AND ';
}
$Query .= " $Query .= "
t.Time>'$DayAgo' t.Time>'$DayAgo'
$GroupID $GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;"; LIMIT $Limit;";
$DB->query($Query); $DB->query($Query);
$TopTorrentsActiveLastDay = $DB->to_array(false, MYSQLI_NUM); $TopTorrentsActiveLastDay = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveLastDay,3600*2); $Cache->cache_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastDay, 3600 * 2);
$Cache->clear_query_lock('top10'); $Cache->clear_query_lock('top10');
} else { } else {
$TopTorrentsActiveLastDay = false; $TopTorrentsActiveLastDay = false;
@ -197,13 +202,15 @@
} }
generate_torrent_table('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit); generate_torrent_table('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
} }
if ($Details=='all' || $Details=='week') { if ($Details == 'all' || $Details == 'week') {
$TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum); $TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastWeek === false) { if ($TopTorrentsActiveLastWeek === false) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
$WeekAgo = time_minus(604800); $WeekAgo = time_minus(604800);
$Query = $BaseQuery.' WHERE '; $Query = $BaseQuery.' WHERE ';
if (!empty($Where)) { $Query .= $Where.' AND '; } if (!empty($Where)) {
$Query .= $Where.' AND ';
}
$Query .= " $Query .= "
t.Time>'$WeekAgo' t.Time>'$WeekAgo'
$GroupBy $GroupBy
@ -211,7 +218,7 @@
LIMIT $Limit;"; LIMIT $Limit;";
$DB->query($Query); $DB->query($Query);
$TopTorrentsActiveLastWeek = $DB->to_array(false, MYSQLI_NUM); $TopTorrentsActiveLastWeek = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveLastWeek,3600*6); $Cache->cache_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastWeek, 3600 * 6);
$Cache->clear_query_lock('top10'); $Cache->clear_query_lock('top10');
} else { } else {
$TopTorrentsActiveLastWeek = false; $TopTorrentsActiveLastWeek = false;
@ -220,12 +227,14 @@
generate_torrent_table('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit); generate_torrent_table('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit);
} }
if ($Details=='all' || $Details=='month') { if ($Details == 'all' || $Details == 'month') {
$TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum); $TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastMonth === false) { if ($TopTorrentsActiveLastMonth === false) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery.' WHERE '; $Query = $BaseQuery.' WHERE ';
if (!empty($Where)) { $Query .= $Where.' AND '; } if (!empty($Where)) {
$Query .= $Where.' AND ';
}
$Query .= " $Query .= "
t.Time>'".sqltime()."' - INTERVAL 1 MONTH t.Time>'".sqltime()."' - INTERVAL 1 MONTH
$GroupBy $GroupBy
@ -233,7 +242,7 @@
LIMIT $Limit;"; LIMIT $Limit;";
$DB->query($Query); $DB->query($Query);
$TopTorrentsActiveLastMonth = $DB->to_array(false, MYSQLI_NUM); $TopTorrentsActiveLastMonth = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveLastMonth,3600*6); $Cache->cache_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastMonth, 3600 * 6);
$Cache->clear_query_lock('top10'); $Cache->clear_query_lock('top10');
} else { } else {
$TopTorrentsActiveLastMonth = false; $TopTorrentsActiveLastMonth = false;
@ -242,17 +251,20 @@
generate_torrent_table('Most Active Torrents Uploaded in the Past Month', 'month', $TopTorrentsActiveLastMonth, $Limit); generate_torrent_table('Most Active Torrents Uploaded in the Past Month', 'month', $TopTorrentsActiveLastMonth, $Limit);
} }
if ($Details=='all' || $Details=='year') { if ($Details == 'all' || $Details == 'year') {
$TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum); $TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastYear === false) { if ($TopTorrentsActiveLastYear === false) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Seeders>200 in order to speed up this query. You should remove it! // IMPORTANT NOTE - we use WHERE t.Seeders>200 in order to speed up this query. You should remove it!
$Query = $BaseQuery.' WHERE '; $Query = $BaseQuery.' WHERE ';
if ($Details=='all' && !$Filtered) { if ($Details == 'all' && !$Filtered) {
$Query .= 't.Seeders>=200 AND '; $Query .= 't.Seeders>=200 AND ';
if (!empty($Where)) { $Query .= $Where.' AND '; } if (!empty($Where)) {
$Query .= $Where.' AND ';
}
} elseif (!empty($Where)) {
$Query .= $Where.' AND ';
} }
elseif (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= " $Query .= "
t.Time>'".sqltime()."' - INTERVAL 1 YEAR t.Time>'".sqltime()."' - INTERVAL 1 YEAR
$GroupBy $GroupBy
@ -260,7 +272,7 @@
LIMIT $Limit;"; LIMIT $Limit;";
$DB->query($Query); $DB->query($Query);
$TopTorrentsActiveLastYear = $DB->to_array(false, MYSQLI_NUM); $TopTorrentsActiveLastYear = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveLastYear,3600*6); $Cache->cache_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastYear, 3600 * 6);
$Cache->clear_query_lock('top10'); $Cache->clear_query_lock('top10');
} else { } else {
$TopTorrentsActiveLastYear = false; $TopTorrentsActiveLastYear = false;
@ -269,7 +281,7 @@
generate_torrent_table('Most Active Torrents Uploaded in the Past Year', 'year', $TopTorrentsActiveLastYear, $Limit); generate_torrent_table('Most Active Torrents Uploaded in the Past Year', 'year', $TopTorrentsActiveLastYear, $Limit);
} }
if ($Details=='all' || $Details=='overall') { if ($Details == 'all' || $Details == 'overall') {
$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum); $TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveAllTime === false) { if ($TopTorrentsActiveAllTime === false) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
@ -277,16 +289,19 @@
$Query = $BaseQuery; $Query = $BaseQuery;
if ($Details=='all' && !$Filtered) { if ($Details=='all' && !$Filtered) {
$Query .= " WHERE t.Seeders>=500 "; $Query .= " WHERE t.Seeders>=500 ";
if (!empty($Where)) { $Query .= ' AND '.$Where; } if (!empty($Where)) {
$Query .= ' AND '.$Where;
}
} elseif (!empty($Where)) {
$Query .= ' WHERE '.$Where;
} }
elseif (!empty($Where)) { $Query .= ' WHERE '.$Where; }
$Query .= " $Query .= "
$GroupBy $GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;"; LIMIT $Limit;";
$DB->query($Query); $DB->query($Query);
$TopTorrentsActiveAllTime = $DB->to_array(false, MYSQLI_NUM); $TopTorrentsActiveAllTime = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveAllTime,3600*6); $Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveAllTime, 3600 * 6);
$Cache->clear_query_lock('top10'); $Cache->clear_query_lock('top10');
} else { } else {
$TopTorrentsActiveAllTime = false; $TopTorrentsActiveAllTime = false;
@ -295,19 +310,21 @@
generate_torrent_table('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit); generate_torrent_table('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit);
} }
if (($Details=='all' || $Details=='snatched') && !$Filtered) { if (($Details == 'all' || $Details == 'snatched') && !$Filtered) {
$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum); $TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsSnatched === false) { if ($TopTorrentsSnatched === false) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery; $Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; } if (!empty($Where)) {
$Query .= ' WHERE '.$Where;
}
$Query .= " $Query .= "
$GroupBy $GroupBy
ORDER BY t.Snatched DESC ORDER BY t.Snatched DESC
LIMIT $Limit;"; LIMIT $Limit;";
$DB->query($Query); $DB->query($Query);
$TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM); $TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsSnatched,3600*6); $Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSnatched, 3600 * 6);
$Cache->clear_query_lock('top10'); $Cache->clear_query_lock('top10');
} else { } else {
$TopTorrentsSnatched = false; $TopTorrentsSnatched = false;
@ -316,7 +333,7 @@
generate_torrent_table('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit); generate_torrent_table('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit);
} }
if (($Details=='all' || $Details=='data') && !$Filtered) { if (($Details == 'all' || $Details == 'data') && !$Filtered) {
$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum); $TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsTransferred === false) { if ($TopTorrentsTransferred === false) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
@ -324,7 +341,9 @@
$Query = $BaseQuery; $Query = $BaseQuery;
if ($Details=='all') { if ($Details=='all') {
$Query .= " WHERE t.Snatched>=100 "; $Query .= " WHERE t.Snatched>=100 ";
if (!empty($Where)) { $Query .= ' AND '.$Where; } if (!empty($Where)) {
$Query .= ' AND '.$Where;
}
} }
$Query .= " $Query .= "
$GroupBy $GroupBy
@ -332,7 +351,7 @@
LIMIT $Limit;"; LIMIT $Limit;";
$DB->query($Query); $DB->query($Query);
$TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM); $TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsTransferred,3600*6); $Cache->cache_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsTransferred, 3600 * 6);
$Cache->clear_query_lock('top10'); $Cache->clear_query_lock('top10');
} else { } else {
$TopTorrentsTransferred = false; $TopTorrentsTransferred = false;
@ -341,19 +360,21 @@
generate_torrent_table('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit); generate_torrent_table('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit);
} }
if (($Details=='all' || $Details=='seeded') && !$Filtered) { if (($Details == 'all' || $Details == 'seeded') && !$Filtered) {
$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum); $TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsSeeded === false) { if ($TopTorrentsSeeded === false) {
if ($Cache->get_query_lock('top10')) { if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery; $Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; } if (!empty($Where)) {
$Query .= ' WHERE '.$Where;
}
$Query .= " $Query .= "
$GroupBy $GroupBy
ORDER BY t.Seeders DESC ORDER BY t.Seeders DESC
LIMIT $Limit;"; LIMIT $Limit;";
$DB->query($Query); $DB->query($Query);
$TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM); $TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsSeeded,3600*6); $Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSeeded, 3600 * 6);
$Cache->clear_query_lock('top10'); $Cache->clear_query_lock('top10');
} else { } else {
$TopTorrentsSeeded = false; $TopTorrentsSeeded = false;
@ -369,7 +390,7 @@
// generate a table based on data from most recent query to $DB // generate a table based on data from most recent query to $DB
function generate_torrent_table($Caption, $Tag, $Details, $Limit) { function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
global $LoggedUser,$Categories,$ReleaseTypes; global $LoggedUser,$Categories,$ReleaseTypes,$GroupBy;
?> ?>
<h3>Top <?=$Limit.' '.$Caption?> <h3>Top <?=$Limit.' '.$Caption?>
<? if (empty($_GET['advanced'])) { ?> <? if (empty($_GET['advanced'])) { ?>
@ -469,7 +490,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
// append extra info to torrent title // append extra info to torrent title
$ExtraInfo = ''; $ExtraInfo = '';
$AddExtra = ''; $AddExtra = '';
if(empty($GroupBy)) { if (empty($GroupBy)) {
if ($Format) { if ($Format) {
$ExtraInfo.= $Format; $ExtraInfo.= $Format;
$AddExtra = ' / '; $AddExtra = ' / ';

View File

@ -131,8 +131,8 @@ function compare($X, $Y) {
<div class="box box_image box_image_albumart box_albumart"><!-- .box_albumart deprecated --> <div class="box box_image box_image_albumart box_albumart"><!-- .box_albumart deprecated -->
<div class="head"> <div class="head">
<strong><?=(count($CoverArt) > 0 ? 'Covers (' . (count($CoverArt) + 1) . ')' : 'Cover')?></strong> <strong><?=(count($CoverArt) > 0 ? 'Covers (' . (count($CoverArt) + 1) . ')' : 'Cover')?></strong>
<? if(count($CoverArt) > 0) { <? if (count($CoverArt) > 0) {
if(empty($LoggedUser['ShowExtraCovers'])) { if (empty($LoggedUser['ShowExtraCovers'])) {
for ($Index = 0; $Index <= count($CoverArt); $Index++) { ?> for ($Index = 0; $Index <= count($CoverArt); $Index++) { ?>
<span id="cover_controls_<?=($Index)?>"<?=($Index > 0 ? ' style="display: none;"' : '')?>> <span id="cover_controls_<?=($Index)?>"<?=($Index > 0 ? ' style="display: none;"' : '')?>>
<? if ($Index == count($CoverArt)) { ?> <? if ($Index == count($CoverArt)) { ?>
@ -154,8 +154,8 @@ function compare($X, $Y) {
<span> <span>
<a class="brackets show_all_covers" href="#">Hide</a> <a class="brackets show_all_covers" href="#">Hide</a>
</span> </span>
<? } <? }
}?> } ?>
</div> </div>
<? <?
$Index = 0; $Index = 0;
@ -167,16 +167,16 @@ function compare($X, $Y) {
<? } else { ?> <? } else { ?>
<p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$GroupCategoryID - 1]?>" alt="<?=$Categories[$GroupCategoryID - 1]?>" title="<?=$Categories[$GroupCategoryID - 1]?>" width="220" height="220" border="0" /></p> <p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$GroupCategoryID - 1]?>" alt="<?=$Categories[$GroupCategoryID - 1]?>" title="<?=$Categories[$GroupCategoryID - 1]?>" width="220" height="220" border="0" /></p>
<? <?
} }
$Index++; $Index++;
?> ?>
</div> </div>
<? foreach ($CoverArt as $Cover) { <? foreach ($CoverArt as $Cover) {
list($ImageID, $Image, $Summary, $AddedBy) = $Cover; list($ImageID, $Image, $Summary, $AddedBy) = $Cover;
?> ?>
<div id="cover_div_<?=$Index?>" <?=empty($LoggedUser['ShowExtraCovers']) ? 'style="display: none;"' : ""?>> <div id="cover_div_<?=$Index?>" <?=(empty($LoggedUser['ShowExtraCovers']) ? 'style="display: none;"' : '')?>>
<p align="center"> <p align="center">
<? if(empty($LoggedUser['ShowExtraCovers'])) { <? if (empty($LoggedUser['ShowExtraCovers'])) {
$Src = 'src="" data-gazelle-temp-src="' . ImageTools::process($Image, true) . '"'; $Src = 'src="" data-gazelle-temp-src="' . ImageTools::process($Image, true) . '"';
} else { } else {
$Src = 'src="' . ImageTools::process($Image, true) . '"'; $Src = 'src="' . ImageTools::process($Image, true) . '"';