diff --git a/classes/image_tools.class.php b/classes/image_tools.class.php index afa9ad4c..b42a2fc3 100644 --- a/classes/image_tools.class.php +++ b/classes/image_tools.class.php @@ -66,7 +66,7 @@ public static function blacklisted($Url, $ShowError = true) { foreach (self::$Blacklist as &$Value) { if (stripos($Url, $Value)) { $ParsedUrl = parse_url($Url); - if($ShowError) { + if ($ShowError) { error($ParsedUrl['host'] . ' is not an allowed image host. Please use a different host.'); } return true; diff --git a/sections/ajax/forum/index.php b/sections/ajax/forum/index.php index 65d3002e..5bb791ec 100644 --- a/sections/ajax/forum/index.php +++ b/sections/ajax/forum/index.php @@ -14,7 +14,7 @@ if ($ForumCats === false) { $DB->query("SELECT ID, Name FROM forums_categories"); $ForumCats = array(); - while (list($ID, $Name) = $DB->next_record()) { + while (list($ID, $Name) = $DB->next_record()) { $ForumCats[$ID] = $Name; } $Cache->cache_value('forums_categories', $ForumCats, 0); //Inf cache. @@ -50,7 +50,10 @@ $Forums = $DB->to_array('ID', MYSQLI_ASSOC, false); foreach ($Forums as $ForumID => $Forum) { 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'); $Forums[$ForumID]['SpecificRules'] = $ThreadIDs; } diff --git a/sections/ajax/takevote.php b/sections/ajax/takevote.php index d45dbd89..4bd4200c 100644 --- a/sections/ajax/takevote.php +++ b/sections/ajax/takevote.php @@ -56,8 +56,8 @@ $Cache->cache_value('voted_albums_'.$LoggedUser['ID'], $UserVotes); // Update the paired cache keys for "people who liked" - // 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. + // 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. if ($Type == 'Up') { $VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true); if ($VotePairs !== false) { @@ -135,15 +135,15 @@ } $Cache->cache_value('votes_'.$GroupID, $GroupVotes); - $DB->query(" + $DB->query(' UPDATE torrents_votes 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)' : '')." WHERE GroupID=$GroupID"); // Update paired cache keys - // 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. + // 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. if ($Type == 'Up') { $VotePairs = $Cache->get_value('vote_pairs_'.$GroupID, true); if ($VotePairs !== false) { diff --git a/sections/ajax/upload.php b/sections/ajax/upload.php index 3a5b0960..8adbf2b4 100644 --- a/sections/ajax/upload.php +++ b/sections/ajax/upload.php @@ -8,8 +8,12 @@ $GenreTags = $Cache->get_value('genre_tags'); if (!$GenreTags) { - $DB->query('SELECT Name FROM tags WHERE TagType=\'genre\' ORDER BY Name'); - $GenreTags = $DB->collect('Name'); + $DB->query(' + SELECT Name + FROM tags + WHERE TagType=\'genre\' + ORDER BY Name'); + $GenreTags = $DB->collect('Name'); $Cache->cache_value('genre_tags', $GenreTags, 3600 * 24); } diff --git a/sections/artist/artist.php b/sections/artist/artist.php index 0e2ba1dd..e5e29aa4 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -808,7 +808,7 @@ function compare($X, $Y) { - +    + diff --git a/sections/better/transcode_beta.php b/sections/better/transcode_beta.php index a3908001..cddc63cf 100644 --- a/sections/better/transcode_beta.php +++ b/sections/better/transcode_beta.php @@ -4,7 +4,7 @@ * $_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 * 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). */ @@ -304,7 +304,7 @@ function transcode_parse_groups($Groups) { foreach ($Group['Editions'] as $RemIdent => $Edition) { // TODO: point to the correct FLAC (?) $FlacID = array_search(true, $Edition['FlacIDs']); - $DisplayName = $ArtistNames . ''.$GroupName.''; + $DisplayName = $ArtistNames . "$GroupName"; if ($GroupYear > 0) { $DisplayName .= " [$GroupYear]"; } @@ -315,7 +315,7 @@ function transcode_parse_groups($Groups) { $DisplayName .= ' ' . Format::torrent_label('Snatched!'); } ?> - > + > DL @@ -324,9 +324,9 @@ function transcode_parse_groups($Groups) {
format('better.php?action=transcode&tags=')?>
- YES' : 'class="important_text">NO'?> - YES' : 'class="important_text">NO'?> - YES' : 'class="important_text">NO'?> + YES' : 'class="important_text">NO')?> + YES' : 'class="important_text">NO')?> + YES' : 'class="important_text">NO')?> query(" UPDATE forums SET - NumPosts = NumPosts+1, - NumTopics = NumTopics+1, - LastPostID = '$PostID', - LastPostAuthorID = '".$LoggedUser['ID']."', - LastPostTopicID = '$TopicID', - LastPostTime = '".sqltime()."' + NumPosts = NumPosts + 1, + NumTopics = NumTopics + 1, + LastPostID = '$PostID', + LastPostAuthorID = '".$LoggedUser['ID']."', + LastPostTopicID = '$TopicID', + LastPostTime = '".sqltime()."' WHERE ID = '$ForumID'"); $DB->query(" UPDATE forums_topics SET - NumPosts = NumPosts+1, - LastPostID = '$PostID', - LastPostAuthorID = '".$LoggedUser['ID']."', - LastPostTime = '".sqltime()."' + NumPosts = NumPosts + 1, + LastPostID = '$PostID', + LastPostAuthorID = '".$LoggedUser['ID']."', + LastPostTime = '".sqltime()."' WHERE ID = '$TopicID'"); 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']); } //auto subscribe /* 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()) { $DB->query("INSERT INTO users_subscriptions VALUES ($SubscriberID, $TopicID)"); // $DB->query("INSERT INTO forums_last_read_topics @@ -118,9 +124,11 @@ $Answers = 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) { - if ($Answer == '') { continue; } + if ($Answer == '') { + continue; + } $Answers[$i + 1] = $Answer; $Votes[$i + 1] = 0; } @@ -131,26 +139,30 @@ 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)).'\')'); - $Cache->cache_value('polls_'.$TopicID, array($Question,$Answers,$Votes,'0000-00-00 00:00:00','0'), 0); + $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); 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)) { 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) { array_pop($Forum); } if ($Stickies > 0) { - $Part1 = array_slice($Forum, 0, $Stickies, true); //Stickies - $Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE - $Stickies - 1, true); //Rest of page + $Part1 = array_slice($Forum, 0, $Stickies, true); // Stickies + $Part3 = array_slice($Forum, $Stickies, TOPICS_PER_PAGE - $Stickies - 1, true); // Rest of page } else { $Part1 = array(); $Part3 = $Forum; diff --git a/sections/inbox/compose.php b/sections/inbox/compose.php index a1e1529f..db887cb7 100644 --- a/sections/inbox/compose.php +++ b/sections/inbox/compose.php @@ -3,7 +3,7 @@ if (empty($Return)) { $ToID = $_GET['to']; if ($ToID == $LoggedUser['ID']) { - error("You cannot start a conversation with yourself!"); + error('You cannot start a conversation with yourself!'); header('Location: inbox.php'); } } @@ -36,7 +36,7 @@

Subject


Body

- +
diff --git a/sections/reports/compose.php b/sections/reports/compose.php index a512a7ce..39964e71 100644 --- a/sections/reports/compose.php +++ b/sections/reports/compose.php @@ -27,7 +27,10 @@ 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(); if (!$ComposeToUsername) { error(404); @@ -36,108 +39,164 @@ // $TypeLink is placed directly in the