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

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

@ -91,14 +91,20 @@
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,11 +139,15 @@
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("
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); $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);
} }
} }

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,7 +245,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 * 6); $Cache->cache_value('genre_tags', $GenreTags, 3600 * 6);
} }

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,7 +176,7 @@
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);
@ -181,10 +184,12 @@
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);
@ -203,7 +208,9 @@
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
@ -225,7 +232,9 @@
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
@ -250,9 +259,12 @@
$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
@ -277,9 +289,12 @@
$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
@ -300,7 +315,9 @@
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
@ -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
@ -346,7 +365,9 @@
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
@ -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'])) { ?>

View File

@ -174,7 +174,7 @@ function compare($X, $Y) {
<? 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) . '"';