diff --git a/classes/class_torrent_form.php b/classes/class_torrent_form.php index d3cc8539..16f12688 100644 --- a/classes/class_torrent_form.php +++ b/classes/class_torrent_form.php @@ -186,7 +186,7 @@ function music_form($GenreTags) { $LossywebApproved = $Torrent['LossywebApproved']; global $ReleaseTypes; ?> - +
NewTorrent) { ?> @@ -383,7 +383,7 @@ function show() { - @@ -395,7 +395,7 @@ function show() { @@ -524,7 +524,7 @@ function show() { - /> + /> @@ -720,7 +720,7 @@ function audiobook_form() {

Contains information like the track listing, a review, a link to Discogs or MusicBrainz, etc.

- + - > + >
Artist(s):
Catalogue number: /> + />

This is for the catalogue number of the release.

Scene: - /> + />
Release description (optional): diff --git a/sections/ajax/forum/forum.php b/sections/ajax/forum/forum.php index 6aba9c6a..c8686d5a 100644 --- a/sections/ajax/forum/forum.php +++ b/sections/ajax/forum/forum.php @@ -27,7 +27,7 @@ $PerPage = POSTS_PER_PAGE; } -list($Page,$Limit) = Format::page_limit(TOPICS_PER_PAGE); +list($Page, $Limit) = Format::page_limit(TOPICS_PER_PAGE); //---------- Get some data to start processing @@ -37,16 +37,17 @@ list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID); } if (!isset($Forum) || !is_array($Forum)) { - $DB->query("SELECT - t.ID, - t.Title, - t.AuthorID, - t.IsLocked, - t.IsSticky, - t.NumPosts, - t.LastPostID, - t.LastPostTime, - t.LastPostAuthorID + $DB->query(" + SELECT + t.ID, + t.Title, + t.AuthorID, + t.IsLocked, + t.IsSticky, + t.NumPosts, + t.LastPostID, + t.LastPostTime, + t.LastPostAuthorID FROM forums_topics AS t WHERE t.ForumID = '$ForumID' ORDER BY t.IsSticky DESC, t.LastPostTime DESC @@ -65,11 +66,11 @@ // Make sure they're allowed to look at the page if (!check_perms('site_moderate_forums')) { if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) { - json_die("failure", "unsufficient permissions to view page"); + json_die("failure", "insufficient permissions to view page"); } } if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRead'] > $LoggedUser['Class']) { - json_die("failure", "unsufficient permissions to view page"); + json_die("failure", "insufficient permissions to view page"); } $ForumName = display_str($Forums[$ForumID]['Name']); @@ -82,7 +83,7 @@ ); } -$Pages=Format::get_pages($Page,$Forums[$ForumID]['NumTopics'],TOPICS_PER_PAGE,9); +$Pages = Format::get_pages($Page, $Forums[$ForumID]['NumTopics'], TOPICS_PER_PAGE, 9); if (count($Forum) == 0) { print @@ -138,7 +139,7 @@ 'lastAuthorName' => $LastAuthorName == null ? '' : $LastAuthorName, 'lastReadPage' => $LastRead[$TopicID]['Page'] == null ? 0 : (int) $LastRead[$TopicID]['Page'], 'lastReadPostId' => $LastRead[$TopicID]['PostID'] == null ? 0 : (int) $LastRead[$TopicID]['PostID'], - 'read' => $Read == "read" + 'read' => $Read == 'read' ); } diff --git a/sections/ajax/inbox/inbox.php b/sections/ajax/inbox/inbox.php index 8bf6316b..fe66262a 100644 --- a/sections/ajax/inbox/inbox.php +++ b/sections/ajax/inbox/inbox.php @@ -79,7 +79,7 @@ $CurURL = "inbox.php?".$CurURL."&"; } -$Pages = Format::get_pages($Page,$NumResults,MESSAGES_PER_PAGE,9); +$Pages = Format::get_pages($Page, $NumResults, MESSAGES_PER_PAGE, 9); $JsonMessages = array(); while (list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $ForwardedName, $SenderID, $Username, $Donor, $Warned, $Enabled, $Date) = $DB->next_record()) { diff --git a/sections/ajax/request.php b/sections/ajax/request.php index e5c5915d..7d524499 100644 --- a/sections/ajax/request.php +++ b/sections/ajax/request.php @@ -203,6 +203,7 @@ 'title' => $Title, 'year' => (int) $Year, 'image' => $Image, + 'bbDescription' => $Description, 'description' => $Text->full_format($Description), 'musicInfo' => $JsonMusicInfo, 'catalogueNumber' => $CatalogueNumber, diff --git a/sections/ajax/userhistory/post_history.php b/sections/ajax/userhistory/post_history.php index c692ee68..9bf235dd 100644 --- a/sections/ajax/userhistory/post_history.php +++ b/sections/ajax/userhistory/post_history.php @@ -39,6 +39,7 @@ function error_out($reason = '') { if ($LoggedUser['CustomForums']) { unset($LoggedUser['CustomForums']['']); $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0)); + $PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1)); } $ViewingOwn = ($UserID == $LoggedUser['ID']); $ShowUnread = ($ViewingOwn && (!isset($_GET['showunread']) || !!$_GET['showunread'])); @@ -56,7 +57,7 @@ function error_out($reason = '') { $sql .= ' LEFT JOIN forums AS f ON f.ID = t.ForumID WHERE p.AuthorID = '.$UserID.' - AND ((f.MinClassRead <= '.$LoggedUser['EffectiveClass']; + AND ((f.MinClassRead <= '.$LoggedUser['Class']; if (!empty($RestrictedForums)) { $sql.=' AND f.ID NOT IN (\''.$RestrictedForums.'\')'; @@ -137,12 +138,19 @@ function error_out($reason = '') { JOIN forums AS f ON f.ID = t.ForumID LEFT JOIN forums_last_read_topics AS l ON l.UserID = '.$UserID.' AND l.TopicID = t.ID WHERE p.AuthorID = '.$UserID.' - AND f.MinClassRead <= '.$LoggedUser['EffectiveClass']; + AND ((f.MinClassRead <= '.$LoggedUser['Class']; if (!empty($RestrictedForums)) { $sql.=' AND f.ID NOT IN (\''.$RestrictedForums.'\')'; } + $sql .= ')'; + + if (!empty($PermittedForums)) { + $sql.=' + OR f.ID IN (\''.$PermittedForums.'\')'; + } + $sql .= ')'; if ($ShowUnread) { $sql.=' diff --git a/sections/artist/artist.php b/sections/artist/artist.php index 12fa23b5..cdc6399a 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -452,7 +452,7 @@ function compare($X, $Y) {
- - + @@ -608,7 +608,7 @@ function compare($X, $Y) { - + @@ -673,7 +673,7 @@ function compare($X, $Y) { $First = false; } - $FontSize = (ceil((((($Score - 2)/$Max - 2) * 4)))) + 8; + $FontSize = (ceil((((($Score - 2) / $Max - 2) * 4)))) + 8; ?>
  • @@ -947,7 +947,7 @@ function require(file, callback) { @@ -967,7 +967,7 @@ function require(file, callback) { -
    # +
    # - Quote @@ -977,7 +977,7 @@ function require(file, callback) { - Delete
    -
    +
    Report +} ?>
    $CollageCovers) { ?> - diff --git a/sections/comments/artistcomments.php b/sections/comments/artistcomments.php index 7dd5a3a0..01d8df9a 100644 --- a/sections/comments/artistcomments.php +++ b/sections/comments/artistcomments.php @@ -26,7 +26,7 @@ $DB->query("SELECT FOUND_ROWS()"); list($Results) = $DB->next_record(); -$Pages=Format::get_pages($Page,$Results,$PerPage, 11); +$Pages = Format::get_pages($Page, $Results, $PerPage, 11); $DB->set_query_id($Comments); $GroupIDs = $DB->collect('GroupID'); diff --git a/sections/comments/requestcomments.php b/sections/comments/requestcomments.php index 04b8ca77..515ba7a4 100644 --- a/sections/comments/requestcomments.php +++ b/sections/comments/requestcomments.php @@ -29,28 +29,29 @@ $Header = 'Request comments made by ' . ($Self ? 'you' : Users::format_username($UserID, false, false, false)); } -$Comments = $DB->query("SELECT - SQL_CALC_FOUND_ROWS - rc.AuthorID, - r.ID as RequestID, - r.Title, - rc.ID as PostID, - rc.Body, - rc.AddedTime, - rc.EditedTime, - rc.EditedUserID as EditorID -FROM requests as r - JOIN requests_comments as rc ON rc.RequestID = r.ID - $ExtraJoin -$Conditions -GROUP BY rc.ID -ORDER BY rc.AddedTime DESC -LIMIT $Limit;"); +$Comments = $DB->query(" + SELECT + SQL_CALC_FOUND_ROWS + rc.AuthorID, + r.ID as RequestID, + r.Title, + rc.ID as PostID, + rc.Body, + rc.AddedTime, + rc.EditedTime, + rc.EditedUserID as EditorID + FROM requests as r + JOIN requests_comments as rc ON rc.RequestID = r.ID + $ExtraJoin + $Conditions + GROUP BY rc.ID + ORDER BY rc.AddedTime DESC + LIMIT $Limit;"); $Count = $DB->record_count(); $DB->query("SELECT FOUND_ROWS()"); list($Results) = $DB->next_record(); -$Pages=Format::get_pages($Page,$Results,$PerPage, 11); +$Pages = Format::get_pages($Page, $Results, $PerPage, 11); View::show_header($Title,'bbcode'); $DB->set_query_id($Comments); @@ -97,4 +98,4 @@ query("SELECT +$Comments = $DB->query(" + SELECT SQL_CALC_FOUND_ROWS tc.AuthorID, t.ID, @@ -52,7 +53,7 @@ $DB->query("SELECT FOUND_ROWS()"); list($Results) = $DB->next_record(); -$Pages=Format::get_pages($Page,$Results,$PerPage, 11); +$Pages = Format::get_pages($Page, $Results, $PerPage, 11); $DB->set_query_id($Comments); $GroupIDs = $DB->collect('GroupID'); diff --git a/sections/forums/forum.php b/sections/forums/forum.php index eab175cd..749a5368 100644 --- a/sections/forums/forum.php +++ b/sections/forums/forum.php @@ -154,7 +154,7 @@ diff --git a/sections/forums/search.php b/sections/forums/search.php index 683348ba..03d26fb5 100644 --- a/sections/forums/search.php +++ b/sections/forums/search.php @@ -104,9 +104,9 @@ diff --git a/sections/forums/thread.php b/sections/forums/thread.php index 61345a7e..89dcdcbd 100644 --- a/sections/forums/thread.php +++ b/sections/forums/thread.php @@ -205,7 +205,7 @@ @@ -236,7 +236,7 @@ $Votes[$i] = 0; } } - $Cache->cache_value('polls_'.$ThreadID, array($Question,$Answers,$Votes,$Featured,$Closed), 0); + $Cache->cache_value('polls_'.$ThreadID, array($Question, $Answers, $Votes, $Featured, $Closed), 0); } if (!empty($Votes)) { @@ -290,7 +290,7 @@ 0) { ?> -
  • (Blank) (%)
  • +
  • (Blank) (%)
  • diff --git a/sections/friends/friends.php b/sections/friends/friends.php index daaedb4d..3bccd18f 100644 --- a/sections/friends/friends.php +++ b/sections/friends/friends.php @@ -94,7 +94,7 @@
  • - + + } ?>
    Search in: - /> + /> - /> + />
    diff --git a/sections/inbox/inbox.php b/sections/inbox/inbox.php index 5ad5db24..65142e73 100644 --- a/sections/inbox/inbox.php +++ b/sections/inbox/inbox.php @@ -83,7 +83,7 @@ $CurURL = "inbox.php?".$CurURL."&"; } -$Pages=Format::get_pages($Page,$NumResults,MESSAGES_PER_PAGE,9); +$Pages = Format::get_pages($Page, $NumResults, MESSAGES_PER_PAGE, 9); echo $Pages; ?> @@ -167,7 +167,7 @@
        diff --git a/sections/log/index.php b/sections/log/index.php index 48805ecd..bcde3705 100644 --- a/sections/log/index.php +++ b/sections/log/index.php @@ -17,7 +17,7 @@ Search for: - /> + />   @@ -29,7 +29,7 @@ LOG_ENTRIES_PER_PAGE) { ?> @@ -98,15 +98,15 @@ $UserID = 0; $User = ''; $URL = ''; - if ($MessageParts[$i + 1] == "user") { + if ($MessageParts[$i + 1] == 'user') { $i++; if (is_numeric($MessageParts[$i + 1])) { $UserID = $MessageParts[++$i]; } - $URL = "user $UserID ".'('.substr($MessageParts[++$i],1,-1).")"; - } elseif (in_array($MessageParts[$i - 1], array('deleted','uploaded','edited','created','recovered'))) { + $URL = "user $UserID ".'('.substr($MessageParts[++$i], 1, -1).")"; + } elseif (in_array($MessageParts[$i - 1], array('deleted', 'uploaded', 'edited', 'created', 'recovered'))) { $User = $MessageParts[++$i]; - if (substr($User,-1) == ':') { + if (substr($User, -1) == ':') { $User = substr($User, 0, -1); $Colon = true; } @@ -120,37 +120,37 @@ $DB->set_query_id($Log); $URL = $Usernames[$User] ? ''.$User."".($Colon ? ':' : '') : $User; } - $Message = $Message." by ".$URL; + $Message = "$Message by $URL"; break; case "uploaded": if ($Color === false) { $Color = 'green'; } - $Message = $Message." ".$MessageParts[$i]; + $Message = $Message.' '.$MessageParts[$i]; break; case "deleted": if ($Color === false || $Color === 'green') { $Color = 'red'; } - $Message = $Message." ".$MessageParts[$i]; + $Message = $Message.' '.$MessageParts[$i]; break; case "edited": if ($Color === false) { $Color = 'blue'; } - $Message = $Message." ".$MessageParts[$i]; + $Message = $Message.' '.$MessageParts[$i]; break; case "un-filled": if ($Color === false) { $Color = ''; } - $Message = $Message." ".$MessageParts[$i]; + $Message = $Message.' '.$MessageParts[$i]; break; case "marked": if ($i == 1) { $User = $MessageParts[$i - 1]; if (!isset($Usernames[$User])) { - $DB->query("SELECT ID FROM users_main WHERE Username = _utf8 '".$User."' COLLATE utf8_bin"); + $DB->query("SELECT ID FROM users_main WHERE Username = _utf8 '$User' COLLATE utf8_bin"); list($UserID) = $DB->next_record(); $Usernames[$User] = $UserID ? $UserID : ''; $DB->set_query_id($Log); @@ -173,10 +173,10 @@ } break; default: - $Message = $Message." ".$MessageParts[$i]; + $Message = $Message.' '.$MessageParts[$i]; } } - $Row = ($Row == 'a') ? 'b' : 'a'; + $Row = (($Row == 'a') ? 'b' : 'a'); ?> diff --git a/sections/register/index.php b/sections/register/index.php index f4e5609c..bc156abd 100644 --- a/sections/register/index.php +++ b/sections/register/index.php @@ -81,12 +81,12 @@ $Enabled = '0'; } - $ipcc = Tools::geoip($_SERVER['REMOTE_ADDR']); + $IPcc = Tools::geoip($_SERVER['REMOTE_ADDR']); $DB->query("INSERT INTO users_main (Username,Email,PassHash,torrent_pass,IP,PermissionID,Enabled,Invites,Uploaded,ipcc) VALUES - ('".db_string(trim($_POST['username']))."','".db_string($_POST['email'])."','".db_string(Users::make_crypt_hash($_POST['password']))."','".db_string($torrent_pass)."','".db_string($_SERVER['REMOTE_ADDR'])."','".$Class."','".$Enabled."','".STARTING_INVITES."', '524288000', '$ipcc')"); + ('".db_string(trim($_POST['username']))."','".db_string($_POST['email'])."','".db_string(Users::make_crypt_hash($_POST['password']))."','".db_string($torrent_pass)."','".db_string($_SERVER['REMOTE_ADDR'])."','".$Class."','".$Enabled."','".STARTING_INVITES."', '524288000', '$IPcc')"); $UserID = $DB->inserted_id(); @@ -122,9 +122,10 @@ // Manage invite trees, delete invite if ($InviterID !== NULL) { - $DB->query("SELECT - TreePosition, TreeID, TreeLevel - FROM invite_tree WHERE UserID='$InviterID'"); + $DB->query(" + SELECT TreePosition, TreeID, TreeLevel + FROM invite_tree + WHERE UserID='$InviterID'"); list($InviterTreePosition, $TreeID, $TreeLevel) = $DB->next_record(); // If the inviter doesn't have an invite tree @@ -133,28 +134,33 @@ $DB->query("SELECT MAX(TreeID)+1 FROM invite_tree"); list($TreeID) = $DB->next_record(); - $DB->query("INSERT INTO invite_tree - (UserID, InviterID, TreePosition, TreeID, TreeLevel) + $DB->query(" + INSERT INTO invite_tree + (UserID, InviterID, TreePosition, TreeID, TreeLevel) VALUES ('$InviterID', '0', '1', '$TreeID', '1')"); $TreePosition = 2; $TreeLevel = 2; } else { - $DB->query("SELECT - TreePosition + $DB->query(" + SELECT TreePosition FROM invite_tree WHERE TreePosition>'$InviterTreePosition' - AND TreeLevel<='$TreeLevel' - AND TreeID='$TreeID' + AND TreeLevel<='$TreeLevel' + AND TreeID='$TreeID' ORDER BY TreePosition LIMIT 1"); list($TreePosition) = $DB->next_record(); if ($TreePosition) { - $DB->query("UPDATE invite_tree SET TreePosition=TreePosition+1 WHERE TreeID='$TreeID' AND TreePosition>='$TreePosition'"); + $DB->query(" + UPDATE invite_tree + SET TreePosition=TreePosition+1 + WHERE TreeID='$TreeID' + AND TreePosition>='$TreePosition'"); } else { - $DB->query("SELECT - TreePosition+1 + $DB->query(" + SELECT TreePosition+1 FROM invite_tree WHERE TreeID='$TreeID' ORDER BY TreePosition DESC @@ -164,22 +170,22 @@ $TreeLevel++; // Create invite tree record - $DB->query("INSERT INTO invite_tree - (UserID, InviterID, TreePosition, TreeID, TreeLevel) VALUES - ('$UserID', '$InviterID', '$TreePosition', '$TreeID', '$TreeLevel')"); + $DB->query(" + INSERT INTO invite_tree (UserID, InviterID, TreePosition, TreeID, TreeLevel) + VALUES ('$UserID', '$InviterID', '$TreePosition', '$TreeID', '$TreeLevel')"); } } else { // No inviter (open registration) $DB->query("SELECT MAX(TreeID) FROM invite_tree"); list($TreeID) = $DB->next_record(); $TreeID++; $InviterID = 0; - $TreePosition=1; - $TreeLevel=1; + $TreePosition = 1; + $TreeLevel = 1; } include(SERVER_ROOT.'/classes/class_templates.php'); - $TPL=NEW TEMPLATE; + $TPL = NEW TEMPLATE; $TPL->open(SERVER_ROOT.'/templates/new_registration.tpl'); $TPL->set('Username',$_REQUEST['username']); @@ -189,7 +195,7 @@ Misc::send_email($_REQUEST['email'],'New account confirmation at '.SITE_NAME,$TPL->get(),'noreply'); Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass)); - $Sent=1; + $Sent = 1; } diff --git a/sections/reports/ajax_resolve_report.php b/sections/reports/ajax_resolve_report.php index 09510d86..6b9e9b63 100644 --- a/sections/reports/ajax_resolve_report.php +++ b/sections/reports/ajax_resolve_report.php @@ -11,7 +11,7 @@ list($Type) = $DB->next_record(); if (!check_perms('admin_reports')) { if (check_perms('site_moderate_forums')) { - if (!in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) { + if (!in_array($Type, array('artist_comment', 'collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) { ajax_error(); } } elseif (check_perms('project_team')) { @@ -21,11 +21,12 @@ } } -$DB->query("UPDATE reports - SET Status='Resolved', - ResolvedTime='".sqltime()."', - ResolverID='".$LoggedUser['ID']."' - WHERE ID='".db_string($ReportID)."'"); +$DB->query(" + UPDATE reports + SET Status='Resolved', + ResolvedTime='".sqltime()."', + ResolverID='".$LoggedUser['ID']."' + WHERE ID='".db_string($ReportID)."'"); $Channels = array(); @@ -35,7 +36,7 @@ $Cache->decrement('num_update_reports'); } -if (in_array($Type, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) { +if (in_array($Type, array('artist_comment', 'collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) { $Channels[] = '#forumreports'; $Cache->decrement('num_forum_reports'); } @@ -45,7 +46,7 @@ list($Remaining) = $DB->next_record(); foreach ($Channels as $Channel) { - send_irc("PRIVMSG $Channel :Report $ReportID resolved by ".preg_replace("/^(.{2})/", "$1·", $LoggedUser['Username'])." on site (".(int)$Remaining." remaining)."); + send_irc("PRIVMSG $Channel :Report $ReportID resolved by ".preg_replace("/^(.{2})/", "$1·", $LoggedUser['Username']).' on site ('.(int)$Remaining.' remaining).'); } $Cache->delete_value('num_other_reports'); diff --git a/sections/reports/takereport.php b/sections/reports/takereport.php index 188c5d47..a0ff32fc 100644 --- a/sections/reports/takereport.php +++ b/sections/reports/takereport.php @@ -13,85 +13,136 @@ $Short = $_POST['type']; $Type = $Types[$Short]; $ID = $_POST['id']; -if ($Short == "request_update") { +if ($Short == 'request_update') { if (empty($_POST['year']) || !is_number($_POST['year'])) { error('Year must be specified.'); header('Location: reports.php?action=report&type=request_update&id='.$ID); 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. - $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]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']; } else { $Reason = $_POST['reason']; } switch ($Short) { - case "request" : - case "request_update" : + case 'request' : + case 'request_update' : $Link = 'requests.php?action=view&id='.$ID; break; - case "user" : + case 'user' : $Link = 'user.php?id='.$ID; break; - case "collage" : + case 'collage' : $Link = 'collages.php?id='.$ID; break; - case "thread" : + case 'thread' : $Link = 'forums.php?action=viewthread&threadid='.$ID; break; - case "post" : - $DB->query("SELECT p.ID, 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=".$ID); + case 'post' : + $DB->query(" + SELECT + p.ID, + 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=".$ID); list($PostID,$TopicID,$PostNum) = $DB->next_record(); - $Link = "forums.php?action=viewthread&threadid=".$TopicID."&post=".$PostNum."#post".$PostID; + $Link = 'forums.php?action=viewthread&threadid='.$TopicID.'&post='.$PostNum.'#post'.$PostID; break; - case "requests_comment" : - $DB->query("SELECT rc.RequestID, rc.Body, (SELECT COUNT(ID) FROM requests_comments WHERE ID <= ".$ID." AND requests_comments.RequestID = rc.RequestID) AS CommentNum FROM requests_comments AS rc WHERE ID=".$ID); + case 'requests_comment' : + $DB->query(" + SELECT + rc.RequestID, + rc.Body, + ( SELECT COUNT(ID) + FROM requests_comments + WHERE ID <= $ID + AND requests_comments.RequestID = rc.RequestID + ) AS CommentNum + FROM requests_comments AS rc + WHERE ID=".$ID); list($RequestID, $Body, $PostNum) = $DB->next_record(); $PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE); - $Link = "requests.php?action=view&id=".$RequestID."&page=".$PageNum."#post".$ID.""; + $Link = 'requests.php?action=view&id='.$RequestID.'&page='.$PageNum.'#post'.$ID; break; - case "torrents_comment" : - $DB->query("SELECT tc.GroupID, tc.Body, (SELECT COUNT(ID) FROM torrents_comments WHERE ID <= ".$ID." AND torrents_comments.GroupID = tc.GroupID) AS CommentNum FROM torrents_comments AS tc WHERE ID=".$ID); + case 'torrents_comment' : + $DB->query(" + SELECT + tc.GroupID, + tc.Body, + ( SELECT COUNT(ID) + FROM torrents_comments + WHERE ID <= $ID + AND torrents_comments.GroupID = tc.GroupID + ) AS CommentNum + FROM torrents_comments AS tc + WHERE ID=".$ID); list($GroupID, $Body, $PostNum) = $DB->next_record(); $PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE); - $Link = "torrents.php?id=".$GroupID."&page=".$PageNum."#post".$ID; + $Link = 'torrents.php?id='.$GroupID.'&page='.$PageNum.'#post'.$ID; break; - case "artist_comment" : - $DB->query("SELECT ac.ArtistID, ac.Body, (SELECT COUNT(ID) FROM artist_comments WHERE ID <= ".$ID." AND artist_comments.ArtistID = ac.ArtistID) AS CommentNum FROM artist_comments AS ac WHERE ID=".$ID); + case 'artist_comment' : + $DB->query(" + SELECT + ac.ArtistID, + ac.Body, + ( SELECT COUNT(ID) + FROM artist_comments + WHERE ID <= $ID + AND artist_comments.ArtistID = ac.ArtistID + ) AS CommentNum + FROM artist_comments AS ac + WHERE ID=".$ID); list($ArtistID, $Body, $PostNum) = $DB->next_record(); $PageNum = ceil($PostNum / TORRENT_COMMENTS_PER_PAGE); - $Link = "artist.php?id=".$ArtistID."&page=".$PageNum."#post".$ID; + $Link = 'artist.php?id='.$ArtistID.'&page='.$PageNum.'#post'.$ID; break; - case "collages_comment" : - $DB->query("SELECT cc.CollageID, cc.Body, (SELECT COUNT(ID) FROM collages_comments WHERE ID <= ".$ID." AND collages_comments.CollageID = cc.CollageID) AS CommentNum FROM collages_comments AS cc WHERE ID=".$ID); + case 'collages_comment' : + $DB->query(" + SELECT + cc.CollageID, + cc.Body, + ( SELECT COUNT(ID) + FROM collages_comments + WHERE ID <= $ID + AND collages_comments.CollageID = cc.CollageID + ) AS CommentNum + FROM collages_comments AS cc + WHERE ID=".$ID); list($CollageID, $Body, $PostNum) = $DB->next_record(); $PerPage = POSTS_PER_PAGE; $PageNum = ceil($PostNum / $PerPage); - $Link = "collage.php?action=comments&collageid=".$CollageID."&page=".$PageNum."#post".$ID; + $Link = 'collage.php?action=comments&collageid='.$CollageID.'&page='.$PageNum.'#post'.$ID; break; } -$DB->query("INSERT INTO reports - (UserID, ThingID, Type, ReportedTime, Reason) - VALUES - (".db_string($LoggedUser['ID']).", ".$ID." , '".$Short."', '".sqltime()."', '".db_string($Reason)."')"); +$DB->query(' + INSERT INTO reports + (UserID, ThingID, Type, ReportedTime, Reason) + VALUES + ('.db_string($LoggedUser['ID']).", $ID , '$Short', '".sqltime()."', '".db_string($Reason)."')"); $ReportID = $DB->inserted_id(); $Channels = array(); -if ($Short == "request_update") { - $Channels[] = "#requestedits"; +if ($Short == 'request_update') { + $Channels[] = '#requestedits'; $Cache->increment('num_update_reports'); } if (in_array($Short, array('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment'))) { - $Channels[] = "#forumreports"; - + $Channels[] = '#forumreports'; + } foreach ($Channels as $Channel) { - send_irc("PRIVMSG ".$Channel." :".$ReportID." - ".$LoggedUser['Username']." just reported a ".$Short.": https://".SSL_SITE_URL."/".$Link." : ".strtr($Reason, "\n", " ")); + send_irc("PRIVMSG $Channel :$ReportID - ".$LoggedUser['Username']." just reported a $Short: https://".SSL_SITE_URL."/$Link : ".strtr($Reason, "\n", ' ')); } $Cache->delete_value('num_other_reports'); diff --git a/sections/requests/request.php b/sections/requests/request.php index 4e439408..6b079fb5 100644 --- a/sections/requests/request.php +++ b/sections/requests/request.php @@ -410,7 +410,7 @@ - + Bounty @@ -473,7 +473,7 @@ } //Get the cache catalogue -$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE); +$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE); //---------- Get some data to start processing @@ -481,11 +481,11 @@ $Catalogue = Requests::get_comment_catalogue($RequestID, $CatalogueID); //This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue -$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)%THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true); +$Thread = array_slice($Catalogue, ((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE), TORRENT_COMMENTS_PER_PAGE, true); ?> @@ -515,7 +515,7 @@ - Delete
    -
    +
    Report $CatName) { /> + } ?> @@ -339,7 +339,7 @@ foreach ($Categories as $CatKey => $CatName) { /> - + @@ -351,7 +351,7 @@ foreach ($Categories as $CatKey => $CatName) { /> - + @@ -363,7 +363,7 @@ foreach ($Categories as $CatKey => $CatName) { /> - + diff --git a/sections/staffpm/staff_inbox.php b/sections/staffpm/staff_inbox.php index b0e96bff..446d7a39 100644 --- a/sections/staffpm/staff_inbox.php +++ b/sections/staffpm/staff_inbox.php @@ -72,7 +72,7 @@ } else { $CurURL = 'staffpm.php?'.$CurURL.'&'; } -$Pages=Format::get_pages($Page,$NumResults,MESSAGES_PER_PAGE,9); +$Pages = Format::get_pages($Page, $NumResults, MESSAGES_PER_PAGE, 9); $Row = 'a'; diff --git a/sections/tools/data/registration_log.php b/sections/tools/data/registration_log.php index d5829578..316f32a3 100644 --- a/sections/tools/data/registration_log.php +++ b/sections/tools/data/registration_log.php @@ -87,7 +87,7 @@ ?> diff --git a/sections/tools/data/service_stats.php b/sections/tools/data/service_stats.php index 7df07b84..f5232e45 100644 --- a/sections/tools/data/service_stats.php +++ b/sections/tools/data/service_stats.php @@ -123,7 +123,7 @@ CAS/Update (Success) 0 && $MemStats['cas_hits'] / ($MemStats['cas_hits'] + $MemStats['cas_misses']) < 0.7) { echo ' class="invalid" title="More than 30% of the issued CAS commands were unnecessarily wasting time and resources." '; } elseif ($MemStats['cas_hits'] == 0) { echo ' class="notice" title="Disable CAS with the -C parameter and save resources since it is not used." '; } ?>>Cache: - ( 0) { echo number_format(($MemStats['cas_hits'] / ($MemStats['cas_hits'] + $MemStats['cas_misses'])) * 100, 3); } else { echo '0.000'; }?>%) + ( 0) { echo number_format(($MemStats['cas_hits'] / ($MemStats['cas_hits'] + $MemStats['cas_misses'])) * 100, 3); } else { echo '0.000'; } ?>%) Database: diff --git a/sections/tools/data/upscale_pool.php b/sections/tools/data/upscale_pool.php index f47a4217..24c3a9cf 100644 --- a/sections/tools/data/upscale_pool.php +++ b/sections/tools/data/upscale_pool.php @@ -6,28 +6,34 @@ define('USERS_PER_PAGE', 50); list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE); -$RS = $DB->query("SELECT - SQL_CALC_FOUND_ROWS - m.ID, - m.Username, - m.Uploaded, - m.Downloaded, - m.PermissionID, - m.Enabled, - i.Donor, - i.Warned, - i.JoinDate, - i.RatioWatchEnds, - i.RatioWatchDownload, - m.RequiredRatio +$RS = $DB->query(" + SELECT + SQL_CALC_FOUND_ROWS + m.ID, + m.Username, + m.Uploaded, + m.Downloaded, + m.PermissionID, + m.Enabled, + i.Donor, + i.Warned, + i.JoinDate, + i.RatioWatchEnds, + i.RatioWatchDownload, + m.RequiredRatio FROM users_main AS m - LEFT JOIN users_info AS i ON i.UserID=m.ID + LEFT JOIN users_info AS i ON i.UserID=m.ID WHERE i.RatioWatchEnds != '0000-00-00 00:00:00' - AND m.Enabled = '1' - ORDER BY i.RatioWatchEnds ASC LIMIT $Limit"); + AND m.Enabled = '1' + ORDER BY i.RatioWatchEnds ASC + LIMIT $Limit"); $DB->query("SELECT FOUND_ROWS()"); list($Results) = $DB->next_record(); -$DB->query("SELECT COUNT(UserID) FROM users_info WHERE BanDate != '0000-00-00 00:00:00' AND BanReason = '2'"); +$DB->query(" + SELECT COUNT(UserID) + FROM users_info + WHERE BanDate != '0000-00-00 00:00:00' + AND BanReason = '2'"); list($TotalDisabled) = $DB->next_record(); $DB->set_query_id($RS); @@ -38,7 +44,7 @@
    @@ -56,7 +62,7 @@ Lifespan next_record()) { + while (list($UserID, $Username, $Uploaded, $Downloaded, $PermissionID, $Enabled, $Donor, $Warned, $Joined, $RatioWatchEnds, $RatioWatchDownload, $RequiredRatio) = $DB->next_record()) { $Row = ($Row == 'b') ? 'a' : 'b'; ?> @@ -66,7 +72,7 @@ - $Uploaded) { echo Format::get_size(($Downloaded * $RequiredRatio) - $Uploaded);}?> + $Uploaded) { echo Format::get_size(($Downloaded * $RequiredRatio) - $Uploaded);} ?> diff --git a/sections/tools/data/user_flow.php b/sections/tools/data/user_flow.php index 20179523..c40c7104 100644 --- a/sections/tools/data/user_flow.php +++ b/sections/tools/data/user_flow.php @@ -112,7 +112,7 @@ diff --git a/sections/tools/managers/eb.php b/sections/tools/managers/eb.php index d466f335..2489107c 100644 --- a/sections/tools/managers/eb.php +++ b/sections/tools/managers/eb.php @@ -6,15 +6,17 @@ list ($Page, $Limit) = Format::page_limit(EMAILS_PER_PAGE); View::show_header('Manage email blacklist'); -$DB->query("SELECT - SQL_CALC_FOUND_ROWS - eb.ID, - eb.UserID, - eb.Time, - eb.Email, - eb.Comment +$DB->query(" + SELECT + SQL_CALC_FOUND_ROWS + eb.ID, + eb.UserID, + eb.Time, + eb.Email, + eb.Comment FROM email_blacklist AS eb - ORDER BY eb.Time DESC LIMIT $Limit"); + ORDER BY eb.Time DESC + LIMIT $Limit"); $Results = $DB->to_array(false, MYSQLI_ASSOC, false); $DB->query("SELECT FOUND_ROWS()"); list ($NumResults) = $DB->next_record(); @@ -48,7 +50,7 @@ - @@ -68,7 +70,7 @@ - +