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

@ -14,7 +14,7 @@
if ($ForumCats === false) { if ($ForumCats === false) {
$DB->query("SELECT ID, Name FROM forums_categories"); $DB->query("SELECT ID, Name FROM forums_categories");
$ForumCats = array(); $ForumCats = array();
while (list($ID, $Name) = $DB->next_record()) { while (list($ID, $Name) = $DB->next_record()) {
$ForumCats[$ID] = $Name; $ForumCats[$ID] = $Name;
} }
$Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache. $Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache.
@ -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

@ -56,8 +56,8 @@
$Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes); $Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes);
// Update the paired cache keys for "people who liked" // Update the paired cache keys for "people who liked"
// First update this album's paired votes. If this keys is magically not set, // First update this album's paired votes. If this keys is magically not set,
// our life just got a bit easier. We're only tracking paired votes on upvotes. // our life just got a bit easier. We're only tracking paired votes on upvotes.
if ($Type == 'Up') { if ($Type == 'Up') {
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true); $VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true);
if ($VotePairs !== false) { if ($VotePairs !== false) {
@ -135,15 +135,15 @@
} }
$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
// First update this album's paired votes. If this keys is magically not set, // First update this album's paired votes. If this keys is magically not set,
// our life just got a bit easier. We're only tracking paired votes on upvotes. // our life just got a bit easier. We're only tracking paired votes on upvotes.
if ($Type == 'Up') { if ($Type == 'Up') {
$VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true); $VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true);
if ($VotePairs !== false) { if ($VotePairs !== false) {

View File

@ -8,8 +8,12 @@
$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('
$GenreTags = $DB->collect('Name'); SELECT Name
FROM tags
WHERE TagType=\'genre\'
ORDER BY Name');
$GenreTags = $DB->collect('Name');
$Cache->cache_value('genre_tags', $GenreTags, 3600 * 24); $Cache->cache_value('genre_tags', $GenreTags, 3600 * 24);
} }

View File

@ -808,7 +808,7 @@ function compare($X, $Y) {
</td> </td>
<td> <td>
<span id="vote_count_<?=$RequestID?>"><?=$Votes?></span> <span id="vote_count_<?=$RequestID?>"><?=$Votes?></span>
<? if (check_perms('site_vote')) { ?> <? if (check_perms('site_vote')) { ?>
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
&nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a> &nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a>
<? } ?> <? } ?>

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

@ -33,7 +33,7 @@
$UserClass = $Perms['Class']; $UserClass = $Perms['Class'];
if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID)) if (!check_paranoia('torrentcomments', $UserInfo['Paranoia'], $UserClass, $UserID))
error(403); error(403);
} else { } else {
$UserID = $LoggedUser['ID']; $UserID = $LoggedUser['ID'];
$Username = $LoggedUser['Username']; $Username = $LoggedUser['Username'];
$Self = true; $Self = true;

View File

@ -73,32 +73,38 @@
$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',
LastPostTime = '".sqltime()."' LastPostTime = '".sqltime()."'
WHERE ID = '$ForumID'"); WHERE ID = '$ForumID'");
$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');
} }
} }
@ -36,7 +36,7 @@
<h3>Subject</h3> <h3>Subject</h3>
<input type="text" class="required" name="subject" size="95" value="<?=(!empty($Subject) ? $Subject : '')?>" /><br /> <input type="text" class="required" name="subject" size="95" value="<?=(!empty($Subject) ? $Subject : '')?>" /><br />
<h3>Body</h3> <h3>Body</h3>
<textarea id="body" class="required" name="body" cols="95" rows="10" onkeyup="resize('body')"><?=(!empty($Body) ? $Body : '')?></textarea> <textarea id="body" class="required" name="body" cols="95" rows="10" onkeyup="resize('body')"><?=(!empty($Body) ? $Body : '')?></textarea>
</div> </div>
<div id="preview" class="hidden"></div> <div id="preview" class="hidden"></div>
<div id="buttons" class="center"> <div id="buttons" class="center">

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

@ -19,7 +19,7 @@
header('Location: reports.php?action=report&type=request_update&id='.$ID); header('Location: reports.php?action=report&type=request_update&id='.$ID);
die(); die();
} }
$Reason = '[b]Year[/b]: '.$_POST['year'].".\n\n"; $Reason = '[b]Year[/b]: '.$_POST['year'].".\n\n";
// If the release type is somehow invalid, return "Not given"; otherwise, return the release type. // If the release type is somehow invalid, return "Not given"; otherwise, return the release type.
$Reason .= '[b]Release type[/b]: '.((empty($_POST['releasetype']) || !is_number($_POST['releasetype']) || $_POST['releasetype'] == 0) ? 'Not given' : $ReleaseTypes[$_POST['releasetype']]).". \n\n"; $Reason .= '[b]Release type[/b]: '.((empty($_POST['releasetype']) || !is_number($_POST['releasetype']) || $_POST['releasetype'] == 0) ? 'Not given' : $ReleaseTypes[$_POST['releasetype']]).". \n\n";
$Reason .= '[b]Additional comments[/b]: '.$_POST['comment']; $Reason .= '[b]Additional comments[/b]: '.$_POST['comment'];

View File

@ -308,7 +308,7 @@
<?=($First ? '' : '<br />')?> <?=($First ? '' : '<br />')?>
<?=$ExtraLinkName?> <?=$ExtraLinkName?>
<a href="torrents.php?action=download&amp;id=<?=$ExtraID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a> <a href="torrents.php?action=download&amp;id=<?=$ExtraID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a>
uploaded by <a href="user.php?id=<?=$ExtraUploaderID?>"><?=$ExtraUploaderName?></a> <?=time_diff($ExtraTime)?> <a href="#" onclick="Switch(<?=$ReportID?>, <?=$TorrentID?>, <?=$ExtraID?>); return false;" class="brackets">Switch</a> uploaded by <a href="user.php?id=<?=$ExtraUploaderID?>"><?=$ExtraUploaderName?></a> <?=time_diff($ExtraTime)?> <a href="#" onclick="Switch(<?=$ReportID?>, <?=$TorrentID?>, <?=$ExtraID?>); return false;" class="brackets">Switch</a>
<? <?
$First = false; $First = false;
} }

View File

@ -466,7 +466,7 @@
<?=($First ? '' : '<br />')?> <?=($First ? '' : '<br />')?>
<?=$ExtraLinkName?> <?=$ExtraLinkName?>
<a href="torrents.php?action=download&amp;id=<?=$ExtraID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a> <a href="torrents.php?action=download&amp;id=<?=$ExtraID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets">DL</a>
uploaded by <a href="user.php?id=<?=$ExtraUploaderID?>"><?=$ExtraUploaderName?></a> <?=time_diff($ExtraTime)?> <a href="#" onclick="Switch(<?=$ReportID?>, <?=$TorrentID?>, <?=$ExtraID?>); return false;" class="brackets">Switch</a> uploaded by <a href="user.php?id=<?=$ExtraUploaderID?>"><?=$ExtraUploaderName?></a> <?=time_diff($ExtraTime)?> <a href="#" onclick="Switch(<?=$ReportID?>, <?=$TorrentID?>, <?=$ExtraID?>); return false;" class="brackets">Switch</a>
<? <?
$First = false; $First = false;
} }

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,36 +107,38 @@
); );
} 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("
tg.Year, SELECT
tg.ReleaseType, tg.Name,
tg.WikiImage, tg.Year,
GROUP_CONCAT(t.Name SEPARATOR ', '), tg.ReleaseType,
tg.CategoryID tg.WikiImage,
FROM torrents_group AS tg GROUP_CONCAT(t.Name SEPARATOR ', '),
JOIN torrents_tags AS tt ON tt.GroupID=tg.ID tg.CategoryID
JOIN tags AS t ON t.ID=tt.TagID FROM torrents_group AS tg
WHERE tg.ID = ".$_GET['groupid']); JOIN torrents_tags AS tt ON tt.GroupID=tg.ID
JOIN tags AS t ON t.ID=tt.TagID
WHERE tg.ID = ".$_GET['groupid']);
if (list($Title, $Year, $ReleaseType, $Image, $Tags, $CategoryID) = $DB->next_record()) { if (list($Title, $Year, $ReleaseType, $Image, $Tags, $CategoryID) = $DB->next_record()) {
$GroupID = trim($_REQUEST['groupid']); $GroupID = trim($_REQUEST['groupid']);
} }
} }
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">
<form action="" method="post" id="request_form" onsubmit="Calculate();"> <form action="" method="post" id="request_form" onsubmit="Calculate();">
<div> <div>
<? if (!$NewRequest) { ?> <? if (!$NewRequest) { ?>
<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">
@ -147,7 +153,7 @@
<td> <td>
<select id="categories" name="type" onchange="Categories()"> <select id="categories" name="type" onchange="Categories()">
<? foreach (Misc::display_array($Categories) as $Cat) { ?> <? foreach (Misc::display_array($Categories) as $Cat) { ?>
<option value="<?=$Cat?>"<?=(!empty($CategoryName) && ($CategoryName == $Cat) ? ' selected="selected"' : '')?>><?=$Cat?></option> <option value="<?=$Cat?>"<?=(!empty($CategoryName) && ($CategoryName == $Cat) ? ' selected="selected"' : '')?>><?=$Cat?></option>
<? } ?> <? } ?>
</select> </select>
</td> </td>
@ -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('
$GenreTags = $DB->collect('Name'); SELECT Name
$Cache->cache_value('genre_tags', $GenreTags, 3600*6); FROM tags
WHERE TagType=\'genre\'
ORDER BY Name');
$GenreTags = $DB->collect('Name');
$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

@ -638,7 +638,7 @@
</td> </td>
<td class="nobr"> <td class="nobr">
<span id="vote_count_<?=$RequestID?>"><?=number_format($VoteCount)?></span> <span id="vote_count_<?=$RequestID?>"><?=number_format($VoteCount)?></span>
<? if (!$IsFilled && check_perms('site_vote')) { ?> <? if (!$IsFilled && check_perms('site_vote')) { ?>
&nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a> &nbsp;&nbsp; <a href="javascript:Vote(0, <?=$RequestID?>)" class="brackets"><strong>+</strong></a>
<? } ?> <? } ?>
</td> </td>

View File

@ -113,7 +113,7 @@
} }
}*/ }*/
//WEB has no ripping log. Ditto Vinyl - Actually ditto everything but CD //WEB has no ripping log. Ditto Vinyl - Actually ditto everything but CD
//$WEBOverride = ((strpos($MediaList, 'WEB') !== false) && $Media == "WEB"); //$WEBOverride = ((strpos($MediaList, 'WEB') !== false) && $Media == "WEB");
//$VinylOverride = ((strpos($MediaList, 'Vinyl') !== false) && $Media == "Vinyl"); //$VinylOverride = ((strpos($MediaList, 'Vinyl') !== false) && $Media == "Vinyl");
//if ($Format == 'FLAC' && $LogCue && !$WEBOverride && !$VinylOverride) { //if ($Format == 'FLAC' && $LogCue && !$WEBOverride && !$VinylOverride) {

View File

@ -5,7 +5,7 @@
authorize(); authorize();
if ($_POST['action'] != 'takenew' && $_POST['action'] != 'takeedit') { if ($_POST['action'] != 'takenew' && $_POST['action'] != 'takeedit') {
error(0); error(0);
} }

View File

@ -1072,6 +1072,7 @@ function next_hour() {
WHERE Date < NOW() - INTERVAL 1 MONTH WHERE Date < NOW() - INTERVAL 1 MONTH
AND Status = 'Open' AND Status = 'Open'
AND AssignedToUser IS NULL"); AND AssignedToUser IS NULL");
} }
/*************************************************************************\ /*************************************************************************\

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,47 +151,50 @@
} else { } else {
$WhereSum = ''; $WhereSum = '';
} }
$BaseQuery = "SELECT $BaseQuery = '
t.ID, SELECT
g.ID, t.ID,
g.Name, g.ID,
g.CategoryID, g.Name,
g.wikiImage, g.CategoryID,
g.TagList, g.wikiImage,
t.Format, g.TagList,
t.Encoding, t.Format,
t.Media, t.Encoding,
t.Scene, t.Media,
t.HasLog, t.Scene,
t.HasCue, t.HasLog,
t.LogScore, t.HasCue,
t.RemasterYear, t.LogScore,
g.Year, t.RemasterYear,
t.RemasterTitle, g.Year,
t.Snatched, t.RemasterTitle,
t.Seeders, t.Snatched,
t.Leechers, t.Seeders,
((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data, t.Leechers,
g.ReleaseType, ((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data,
t.Size g.ReleaseType,
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,56 +131,56 @@ 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)) { ?>
<a class="brackets prev_cover" data-gazelle-prev-cover="<?=($Index - 1)?>" href="#">Prev</a> <a class="brackets prev_cover" data-gazelle-prev-cover="<?=($Index - 1)?>" href="#">Prev</a>
<a class="brackets show_all_covers" href="#">Show all</a> <a class="brackets show_all_covers" href="#">Show all</a>
<span class="brackets next_cover">Next</span> <span class="brackets next_cover">Next</span>
<? } elseif ($Index > 0) { ?> <? } elseif ($Index > 0) { ?>
<a class="brackets prev_cover" data-gazelle-prev-cover="<?=($Index - 1)?>" href="#">Prev</a> <a class="brackets prev_cover" data-gazelle-prev-cover="<?=($Index - 1)?>" href="#">Prev</a>
<a class="brackets show_all_covers" href="#">Show all</a> <a class="brackets show_all_covers" href="#">Show all</a>
<a class="brackets next_cover" data-gazelle-next-cover="<?=($Index + 1)?>" href="#">Next</a> <a class="brackets next_cover" data-gazelle-next-cover="<?=($Index + 1)?>" href="#">Next</a>
<? } elseif ($Index == 0 && count($CoverArt) > 0) { ?> <? } elseif ($Index == 0 && count($CoverArt) > 0) { ?>
<span class="brackets prev_cover">Prev</span> <span class="brackets prev_cover">Prev</span>
<a class="brackets show_all_covers" href="#">Show all</a> <a class="brackets show_all_covers" href="#">Show all</a>
<a class="brackets next_cover" data-gazelle-next-cover="<?=($Index + 1)?>" href="#">Next</a> <a class="brackets next_cover" data-gazelle-next-cover="<?=($Index + 1)?>" href="#">Next</a>
<? } ?> <? } ?>
</span>
<? }
} else { ?>
<span>
<a class="brackets show_all_covers" href="#">Hide</a>
</span> </span>
<? } <? }
} else { ?> } ?>
<span>
<a class="brackets show_all_covers" href="#">Hide</a>
</span>
<? }
}?>
</div> </div>
<? <?
$Index = 0; $Index = 0;
?> ?>
<div id="covers"> <div id="covers">
<div id="cover_div_<?=$Index?>"> <div id="cover_div_<?=$Index?>">
<? if ($WikiImage != '') { ?> <? if ($WikiImage != '') { ?>
<p align="center"><img style="max-width: 220px;" src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$AltName?>" onclick="lightbox.init('<?=ImageTools::process($WikiImage)?>',220);" /></p> <p align="center"><img style="max-width: 220px;" src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$AltName?>" onclick="lightbox.init('<?=ImageTools::process($WikiImage)?>',220);" /></p>
<? } 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) . '"';
} }
?> ?>
<img id="cover_<?=$Index?>" style="max-width: 220px;" <?=$Src?> alt="<?=$Summary?>" onclick="lightbox.init('<?=ImageTools::process($Image)?>',220);" /> <img id="cover_<?=$Index?>" style="max-width: 220px;" <?=$Src?> alt="<?=$Summary?>" onclick="lightbox.init('<?=ImageTools::process($Image)?>',220);" />
</p> </p>

View File

@ -49,7 +49,7 @@
$N['Media'] = explode('|', substr($N['Media'], 1, -1)); $N['Media'] = explode('|', substr($N['Media'], 1, -1));
$N['Users'] = explode('|', substr($N['Users'], 1, -1)); $N['Users'] = explode('|', substr($N['Users'], 1, -1));
$Usernames = ''; $Usernames = '';
foreach ($N['Users'] as $UserID) { foreach ($N['Users'] as $UserID) {
$UserInfo = Users::user_info($UserID); $UserInfo = Users::user_info($UserID);
$Usernames .= $UserInfo['Username'] . ', '; $Usernames .= $UserInfo['Username'] . ', ';
@ -101,8 +101,8 @@
<p class="min_padding">Comma-separated list &mdash; e.g. <em>Pink Floyd, Led Zeppelin, Neil Young</em></p> <p class="min_padding">Comma-separated list &mdash; e.g. <em>Pink Floyd, Led Zeppelin, Neil Young</em></p>
<input type="checkbox" name="excludeva<?=$i?>" id="excludeva_<?=$N['ID']?>"<? if ($N['ExcludeVA'] == '1') { echo ' checked="checked"';} ?> /> <input type="checkbox" name="excludeva<?=$i?>" id="excludeva_<?=$N['ID']?>"<? if ($N['ExcludeVA'] == '1') { echo ' checked="checked"';} ?> />
<label for="excludeva_<?=$N['ID']?>">Exclude Various Artists releases</label> <label for="excludeva_<?=$N['ID']?>">Exclude Various Artists releases</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label"><strong>One of these users</strong></td> <td class="label"><strong>One of these users</strong></td>
<td> <td>

View File

@ -141,7 +141,7 @@ function($Matches) {
if (strlen($ParanoiaString) == 0) { if (strlen($ParanoiaString) == 0) {
$Paranoia = array(); $Paranoia = array();
} else { } else {
$Paranoia = $CustomParanoia; $Paranoia = $CustomParanoia;
} }
} else { } else {
$Paranoia = unserialize($Paranoia); $Paranoia = unserialize($Paranoia);