Empty commit

This commit is contained in:
Git 2013-11-17 08:00:47 +00:00
parent 34916842a0
commit ba28852df5
79 changed files with 390 additions and 383 deletions

View File

@ -627,7 +627,7 @@ public static function get_leaderboard_position($UserID) {
SELECT Position
FROM (
SELECT d.UserID, @RowNum := @RowNum + 1 AS Position
FROM users_donor_ranks d
FROM users_donor_ranks AS d
ORDER BY TotalRank DESC
) l
WHERE UserID = '$UserID'");

View File

@ -47,7 +47,7 @@ public static function get_thread_info($ThreadID, $Return = true, $SelectiveCach
p.EditedUserID,
p.EditedTime,
ed.Username
FROM forums_posts as p
FROM forums_posts AS p
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
WHERE p.TopicID = '$ThreadID'
AND p.ID = '" . $ThreadInfo['StickyPostID'] . "'");
@ -169,7 +169,7 @@ public static function get_forums() {
t.IsSticky AS Sticky
FROM forums AS f
JOIN forums_categories AS fc ON fc.ID = f.CategoryID
LEFT JOIN forums_topics as t ON t.ID = f.LastPostTopicID
LEFT JOIN forums_topics AS t ON t.ID = f.LastPostTopicID
GROUP BY f.ID
ORDER BY fc.Sort, fc.Name, f.CategoryID, f.Sort");
$Forums = G::$DB->to_array('ID', MYSQLI_ASSOC, false);
@ -234,15 +234,15 @@ public static function get_last_read($Forums) {
CEIL(
(
SELECT
COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = l.TopicID
AND forums_posts.ID<=l.PostID
COUNT(p.ID)
FROM forums_posts AS p
WHERE p.TopicID = l.TopicID
AND p.ID <= l.PostID
)/$PerPage
) AS Page
FROM forums_last_read_topics AS l
WHERE TopicID IN(" . implode(',', $TopicIDs) . ") AND
UserID='" . G::$LoggedUser['ID'] . "'");
WHERE l.TopicID IN(" . implode(',', $TopicIDs) . ") AND
l.UserID='" . G::$LoggedUser['ID'] . "'");
$LastRead = G::$DB->to_array('TopicID', MYSQLI_ASSOC);
G::$DB->set_query_id($QueryID);
} else {

View File

@ -207,9 +207,9 @@ public static function create_thread($ForumID, $AuthorID, $Title, $PostBody) {
array_pop($Forum);
}
G::$DB->query("
SELECT f.IsLocked, f.IsSticky, f.NumPosts
FROM forums_topics AS f
WHERE f.ID ='$TopicID'");
SELECT IsLocked, IsSticky, NumPosts
FROM forums_topics
WHERE ID ='$TopicID'");
list($IsLocked, $IsSticky, $NumPosts) = G::$DB->next_record();
$Part1 = array_slice($Forum, 0, $Stickies, true); //Stickys
$Part2 = array(

View File

@ -387,9 +387,9 @@ public function load_collage_subscriptions() {
$QueryID = G::$DB->get_query_id();
G::$DB->query("
SELECT COUNT(DISTINCT s.CollageID)
FROM users_collage_subs as s
JOIN collages as c ON s.CollageID = c.ID
JOIN collages_torrents as ct on ct.CollageID = c.ID
FROM users_collage_subs AS s
JOIN collages AS c ON s.CollageID = c.ID
JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE s.UserID = " . G::$LoggedUser['ID'] . "
AND ct.AddedOn > s.LastVisit
AND c.Deleted = '0'");

View File

@ -26,8 +26,8 @@ public static function get_permissions($PermissionID) {
if (empty($Permission)) {
$QueryID = G::$DB->get_query_id();
G::$DB->query("
SELECT p.Level AS Class, p.Values as Permissions, p.Secondary, p.PermittedForums
FROM permissions AS p
SELECT Level AS Class, `Values` AS Permissions, Secondary, PermittedForums
FROM permissions
WHERE ID='$PermissionID'");
$Permission = G::$DB->next_record(MYSQLI_ASSOC, array('Permissions'));
G::$DB->set_query_id($QueryID);
@ -53,9 +53,9 @@ public static function get_permissions_for_user($UserID, $CustomPermissions = fa
if ($CustomPermissions === false) {
$QueryID = G::$DB->get_query_id();
G::$DB->query('
SELECT um.CustomPermissions
FROM users_main AS um
WHERE um.ID = '.((int)$UserID));
SELECT CustomPermissions
FROM users_main
WHERE ID = ' . (int)$UserID);
list($CustomPermissions) = G::$DB->next_record(MYSQLI_NUM, false);
G::$DB->set_query_id($QueryID);
}

View File

@ -205,7 +205,7 @@ public static function get_votes_array($RequestID) {
rv.UserID,
rv.Bounty,
u.Username
FROM requests_votes as rv
FROM requests_votes AS rv
LEFT JOIN users_main AS u ON u.ID = rv.UserID
WHERE rv.RequestID = $RequestID
ORDER BY rv.Bounty DESC");

View File

@ -80,9 +80,9 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
$QueryID = G::$DB->get_query_id();
G::$DB->query("
SELECT
g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType, g.VanityHouse, g.WikiImage, g.CategoryID
FROM torrents_group AS g
WHERE g.ID IN ($IDs)");
ID, Name, Year, RecordLabel, CatalogueNumber, TagList, ReleaseType, VanityHouse, WikiImage, CategoryID
FROM torrents_group
WHERE ID IN ($IDs)");
while ($Group = G::$DB->next_record(MYSQLI_ASSOC, true)) {
$NotFound[$Group['ID']] = $Group;
@ -98,7 +98,7 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
ID, GroupID, Media, Format, Encoding, RemasterYear, Remastered, RemasterTitle,
RemasterRecordLabel, RemasterCatalogueNumber, Scene, HasLog, HasCue, LogScore,
FileCount, FreeTorrent, Size, Leechers, Seeders, Snatched, Time, ID AS HasFile
FROM torrents AS t
FROM torrents
WHERE GroupID IN ($IDs)
ORDER BY GroupID, Remastered, (RemasterYear != 0) DESC, RemasterYear, RemasterTitle,
RemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding, ID");
@ -399,14 +399,14 @@ public static function delete_group($GroupID) {
// Get a count of how many groups or requests use the artist ID
G::$DB->query("
SELECT COUNT(ag.ArtistID)
FROM artists_group as ag
FROM artists_group AS ag
LEFT JOIN requests_artists AS ra ON ag.ArtistID = ra.ArtistID
WHERE ra.ArtistID IS NOT NULL
AND ag.ArtistID = '$ArtistID'");
list($ReqCount) = G::$DB->next_record();
G::$DB->query("
SELECT COUNT(ag.ArtistID)
FROM artists_group as ag
FROM artists_group AS ag
LEFT JOIN torrents_artists AS ta ON ag.ArtistID = ta.ArtistID
WHERE ta.ArtistID IS NOT NULL
AND ag.ArtistID = '$ArtistID'");

View File

@ -41,8 +41,8 @@ public static function revision_history($Table = '', $PageID = 0, $BaseURL = '')
Summary,
Time,
UserID
FROM $Table AS wiki
WHERE wiki.PageID = $PageID
FROM $Table
WHERE PageID = $PageID
ORDER BY RevisionID DESC");
?>
<table cellpadding="6" cellspacing="1" border="0" width="100%" class="border">

View File

@ -120,6 +120,12 @@ Long SQL queries shall be separated on multiple lines.
Short SQL queries may be on a single line.
All SQL keywords shall be uppercase.
Aliases shall be used to refer to any columns whenever multiple tables are
joined in an SQL query. They shall be using the `tbl_name AS alias_name`
syntax. No table aliases shall be used for single-table queries.
The primary SQL keywords should be at the same indentation level unless
part of a JOIN or other complex statement.
@ -128,7 +134,7 @@ Use indents as appropriate to aid readability.
The SQL keywords `JOIN`, `RIGHT JOIN`, `LEFT JOIN` must be indented once from
the `SELECT` statement.
The SQL keyword `AND` must be indented once from the `WHILE` (and similar)
The SQL keyword `AND` must be indented once from the `WHERE` (and similar)
statements.
The "not equal to" operator `!=` must be used instead of the alternative

View File

@ -39,18 +39,18 @@
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
FROM forums_topics AS t
WHERE t.ForumID = '$ForumID'
ORDER BY t.IsSticky DESC, t.LastPostTime DESC
ID,
Title,
AuthorID,
IsLocked,
IsSticky,
NumPosts,
LastPostID,
LastPostTime,
LastPostAuthorID
FROM forums_topics
WHERE ForumID = '$ForumID'
ORDER BY IsSticky DESC, LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false);
if ($Page == 1) {
@ -106,15 +106,15 @@
l.PostID,
CEIL(
(
SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = l.TopicID
AND forums_posts.ID <= l.PostID
SELECT COUNT(p.ID)
FROM forums_posts AS p
WHERE p.TopicID = l.TopicID
AND p.ID <= l.PostID
) / $PerPage
) AS Page
FROM forums_last_read_topics AS l
WHERE TopicID IN(".implode(', ', array_keys($Forum)).')
AND UserID = \''.$LoggedUser['ID'].'\'');
WHERE l.TopicID IN(".implode(', ', array_keys($Forum)).')
AND l.UserID = \''.$LoggedUser['ID'].'\'');
// Turns the result set into a multi-dimensional array, with
// forums_last_read_topics.TopicID as the key.

View File

@ -20,13 +20,17 @@
SELECT
l.TopicID,
l.PostID,
CEIL(( SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = l.TopicID
AND forums_posts.ID <= l.PostID) / $PerPage) AS Page
CEIL(
(
SELECT COUNT(p.ID)
FROM forums_posts AS p
WHERE p.TopicID = l.TopicID
AND p.ID <= l.PostID
) / $PerPage
) AS Page
FROM forums_last_read_topics AS l
WHERE TopicID IN(".implode(',', $TopicIDs).")
AND UserID='$LoggedUser[ID]'");
WHERE l.TopicID IN(".implode(',', $TopicIDs).")
AND l.UserID='$LoggedUser[ID]'");
$LastRead = $DB->to_array('TopicID', MYSQLI_ASSOC);
} else {
$LastRead = array();

View File

@ -96,7 +96,7 @@
p.Body,
p.EditedUserID,
p.EditedTime
FROM forums_posts as p
FROM forums_posts AS p
WHERE p.TopicID = '$ThreadID'
AND p.ID != '".$ThreadInfo['StickyPostID']."'
LIMIT $CatalogueLimit");

View File

@ -75,7 +75,7 @@
// Get messages
$DB->query("
SELECT SentDate, SenderID, Body, ID
FROM pm_messages AS m
FROM pm_messages
WHERE ConvID = '$ConvID'
ORDER BY ID");

View File

@ -94,9 +94,9 @@ function check_paranoia_here($Setting) {
WHERE r.FillerID = $UserID");
list($RequestsFilled, $TotalBounty) = $DB->next_record();
$DB->query("
SELECT COUNT(rv.RequestID), SUM(rv.Bounty)
FROM requests_votes AS rv
WHERE rv.UserID = $UserID");
SELECT COUNT(RequestID), SUM(Bounty)
FROM requests_votes
WHERE UserID = $UserID");
list($RequestsVoted, $TotalSpent) = $DB->next_record();
$DB->query("
@ -120,9 +120,9 @@ function check_paranoia_here($Setting) {
if (check_paranoia_here('artistsadded')) {
$DB->query("
SELECT COUNT(ta.ArtistID)
FROM torrents_artists AS ta
WHERE ta.UserID = $UserID");
SELECT COUNT(ArtistID)
FROM torrents_artists
WHERE UserID = $UserID");
list($ArtistsAdded) = $DB->next_record();
} else {
$ArtistsAdded = 0;
@ -204,10 +204,10 @@ function check_paranoia_here($Setting) {
if (check_paranoia_here(array('collagecontribs', 'collagecontribs+'))) {
$DB->query("
SELECT COUNT(DISTINCT CollageID)
SELECT COUNT(DISTINCT ct.CollageID)
FROM collages_torrents AS ct
JOIN collages ON CollageID = ID
WHERE Deleted = '0'
JOIN collages AS c ON ct.CollageID = c.ID
WHERE c.Deleted = '0'
AND ct.UserID = '$UserID'");
list($NumCollageContribs) = $DB->next_record();
}

View File

@ -84,7 +84,7 @@ function error_out($reason = '') {
l.PostID AS LastRead,
t.IsLocked,
t.IsSticky
FROM forums_posts as p
FROM forums_posts AS p
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
@ -122,7 +122,7 @@ function error_out($reason = '') {
$SQL .= "
t.IsLocked,
t.IsSticky
FROM forums_posts as p
FROM forums_posts AS p
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID

View File

@ -14,9 +14,9 @@
}
$DB->query("
SELECT ag.ArtistID
FROM artists_group AS ag
WHERE ag.Name LIKE '$Artist2Name'");
SELECT ArtistID
FROM artists_group
WHERE Name LIKE '$Artist2Name'");
list($Artist2ID) = $DB->next_record();
if (!empty($Artist2ID)) { // artist was found in the database
@ -25,7 +25,7 @@
$DB->query("
SELECT s1.SimilarID
FROM artists_similar AS s1
JOIN artists_similar AS s2 ON s1.SimilarID = s2.SimilarID
JOIN artists_similar AS s2 ON s1.SimilarID = s2.SimilarID
WHERE s1.ArtistID = '$Artist1ID'
AND s2.ArtistID = '$Artist2ID'");
list($SimilarID) = $DB->next_record();

View File

@ -17,7 +17,7 @@
$Join = '';
$All = true;
} else {
$Join = 'JOIN xbt_snatched as x ON x.fid = tfi.TorrentID AND x.uid = '.$LoggedUser['ID'];
$Join = 'JOIN xbt_snatched AS x ON x.fid = tfi.TorrentID AND x.uid = '.$LoggedUser['ID'];
$All = false;
}

View File

@ -17,7 +17,7 @@
$Join = '';
$All = true;
} else {
$Join = "JOIN xbt_snatched as x ON x.fid = tbf.TorrentID AND x.uid = ".$LoggedUser['ID'];
$Join = "JOIN xbt_snatched AS x ON x.fid = tbf.TorrentID AND x.uid = ".$LoggedUser['ID'];
$All = false;
}

View File

@ -46,16 +46,16 @@
$DB->query("
CREATE TEMPORARY TABLE temp_sections_better_snatch
SELECT
t.GroupID,
GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList,
GroupID,
GROUP_CONCAT(Encoding SEPARATOR ' ') AS EncodingList,
CRC32(CONCAT_WS(
' ', Media, Remasteryear, Remastertitle,
Remasterrecordlabel, Remastercataloguenumber)
) AS RemIdent
FROM torrents AS t
WHERE t.GroupID IN(".implode(',', $SnatchedGroupIDs).")
AND t.Format IN ('FLAC', 'MP3')
GROUP BY t.GroupID, RemIdent");
FROM torrents
WHERE GroupID IN (".implode(',', $SnatchedGroupIDs).")
AND Format IN ('FLAC', 'MP3')
GROUP BY GroupID, RemIdent");
$DB->query("
SELECT GroupID

View File

@ -17,7 +17,7 @@
$Join = '';
$All = true;
} else {
$Join = "JOIN xbt_snatched as x ON x.fid = tbt.TorrentID AND x.uid = ".$LoggedUser['ID'];
$Join = "JOIN xbt_snatched AS x ON x.fid = tbt.TorrentID AND x.uid = ".$LoggedUser['ID'];
$All = false;
}

View File

@ -34,16 +34,16 @@
$DB->query("
CREATE TEMPORARY TABLE temp_sections_better_upload
SELECT
t.GroupID,
GROUP_CONCAT(t.Encoding SEPARATOR ' ') AS EncodingList,
GroupID,
GROUP_CONCAT(Encoding SEPARATOR ' ') AS EncodingList,
CRC32(CONCAT_WS(
' ', Media, Remasteryear, Remastertitle,
Remasterrecordlabel, Remastercataloguenumber)
) AS RemIdent
FROM torrents AS t
WHERE t.GroupID IN(".implode(',', $UploadedGroupIDs).")
AND t.Format IN ('FLAC', 'MP3')
GROUP BY t.GroupID, RemIdent");
FROM torrents
WHERE GroupID IN (".implode(',', $UploadedGroupIDs).")
AND Format IN ('FLAC', 'MP3')
GROUP BY GroupID, RemIdent");
$DB->query("
SELECT GroupID

View File

@ -26,10 +26,10 @@
$Edits = $Cache->get_value($Type.'_edits_'.$PostID);
if (!is_array($Edits)) {
$DB->query("
SELECT ce.EditUser, ce.EditTime, ce.Body
FROM comments_edits AS ce
SELECT EditUser, EditTime, Body
FROM comments_edits
WHERE Page = '$Type' AND PostID = $PostID
ORDER BY ce.EditTime DESC");
ORDER BY EditTime DESC");
$Edits = $DB->to_array();
$Cache->cache_value($Type.'_edits_'.$PostID, $Edits, 0);
}

View File

@ -37,18 +37,18 @@
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
FROM forums_topics AS t
WHERE t.ForumID = '$ForumID'
ORDER BY t.Ranking = 0, t.Ranking ASC, t.IsSticky DESC, t.LastPostTime DESC
ID,
Title,
AuthorID,
IsLocked,
IsSticky,
NumPosts,
LastPostID,
LastPostTime,
LastPostAuthorID
FROM forums_topics
WHERE ForumID = '$ForumID'
ORDER BY Ranking = 0, Ranking ASC, IsSticky DESC, LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post
$Forum = $DB->to_array('ID', MYSQLI_ASSOC, false);
@ -175,15 +175,15 @@
l.TopicID,
l.PostID,
CEIL((
SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = l.TopicID
AND forums_posts.ID <= l.PostID
SELECT COUNT(p.ID)
FROM forums_posts AS p
WHERE p.TopicID = l.TopicID
AND p.ID <= l.PostID
) / $PerPage
) AS Page
FROM forums_last_read_topics AS l
WHERE TopicID IN(".implode(', ', array_keys($Forum)).')
AND UserID = \''.$LoggedUser['ID'].'\'');
WHERE l.TopicID IN (".implode(', ', array_keys($Forum)).')
AND l.UserID = \''.$LoggedUser['ID'].'\'');
// Turns the result set into a multi-dimensional array, with
// forums_last_read_topics.TopicID as the key.

View File

@ -24,8 +24,8 @@
SELECT
p.Body,
t.ForumID
FROM forums_posts as p
JOIN forums_topics as t on p.TopicID = t.ID
FROM forums_posts AS p
JOIN forums_topics AS t ON p.TopicID = t.ID
WHERE p.ID='$PostID'");
list($Body, $ForumID) = $DB->next_record(MYSQLI_NUM);

View File

@ -53,15 +53,15 @@
t.ForumID,
CEIL(
(
SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = p.TopicID
AND forums_posts.ID <= '$PostID'
SELECT COUNT(p2.ID)
FROM forums_posts AS p2
WHERE p2.TopicID = p.TopicID
AND p2.ID <= '$PostID'
) / " . POSTS_PER_PAGE . "
) AS Page
FROM forums_posts as p
JOIN forums_topics as t on p.TopicID = t.ID
JOIN forums as f ON t.ForumID = f.ID
FROM forums_posts AS p
JOIN forums_topics AS t ON p.TopicID = t.ID
JOIN forums AS f ON t.ForumID = f.ID
WHERE p.ID = '$PostID'");
list($OldBody, $AuthorID, $TopicID, $ForumID, $Page) = $DB->next_record();

View File

@ -42,15 +42,15 @@
t.ForumID,
f.MinClassWrite,
CEIL((
SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = p.TopicID
AND forums_posts.ID <= '$PostID'
SELECT COUNT(p2.ID)
FROM forums_posts AS p2
WHERE p2.TopicID = p.TopicID
AND p2.ID <= '$PostID'
) / ".POSTS_PER_PAGE."
) AS Page
FROM forums_posts as p
JOIN forums_topics as t on p.TopicID = t.ID
JOIN forums as f ON t.ForumID = f.ID
FROM forums_posts AS p
JOIN forums_topics AS t ON p.TopicID = t.ID
JOIN forums AS f ON t.ForumID = f.ID
WHERE p.ID = '$PostID'");
list($OldBody, $AuthorID, $TopicID, $IsLocked, $ForumID, $MinClassWrite, $Page) = $DB->next_record();

View File

@ -102,7 +102,7 @@
p.EditedUserID,
p.EditedTime,
ed.Username
FROM forums_posts as p
FROM forums_posts AS p
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
WHERE p.TopicID = '$ThreadID'
AND p.ID != '".$ThreadInfo['StickyPostID']."'

View File

@ -10,8 +10,8 @@
$UserInfo = Users::user_info($UserID);
$DB->query("
SELECT p.Body, t.ForumID
FROM forums_posts as p
JOIN forums_topics as t on p.TopicID = t.ID
FROM forums_posts AS p
JOIN forums_topics AS t ON p.TopicID = t.ID
WHERE p.ID = '$PostID'");
list($PostBody, $ForumID) = $DB -> next_record();
View::show_header('Warn User');

View File

@ -74,7 +74,7 @@
// Get messages
$DB->query("
SELECT SentDate, SenderID, Body, ID
FROM pm_messages AS m
FROM pm_messages
WHERE ConvID = '$ConvID'
ORDER BY ID");
?>

View File

@ -23,7 +23,7 @@
$DB->query("
SELECT
m.Body
FROM pm_messages as m
FROM pm_messages AS m
JOIN pm_conversations_users AS u ON m.ConvID=u.ConvID
WHERE m.ID='$PostID'
AND u.UserID=".$LoggedUser['ID']);

View File

@ -32,8 +32,8 @@
$DB->query("
INSERT INTO tpc_temp
SELECT t2.*
FROM torrents_peerlists t1
JOIN torrents_peerlists_compare t2
FROM torrents_peerlists AS t1
JOIN torrents_peerlists_compare AS t2
USING(TorrentID)
WHERE t1.Seeders != t2.Seeders
OR t1.Leechers != t2.Leechers

View File

@ -13,8 +13,8 @@
uq.Date,
(
SELECT COUNT(1)
FROM staff_answers
WHERE QuestionID = uq.ID
FROM staff_answers AS sa
WHERE sa.QuestionID = uq.ID
) AS Responses
FROM user_questions AS uq
WHERE uq.ID NOT IN

View File

@ -103,13 +103,13 @@
p.ID,
p.Body,
p.TopicID,
( SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = p.TopicID
AND forums_posts.ID<=p.ID
( SELECT COUNT(p2.ID)
FROM forums_posts AS p2
WHERE p2.TopicID = p.TopicID
AND p2.ID <= p.ID
) AS PostNum
FROM forums_posts AS p
WHERE ID=$ThingID");
WHERE p.ID = $ThingID");
if (!$DB->has_results()) {
$Error = 'No forum post with the reported ID found';
} else {
@ -121,7 +121,7 @@
case 'comment':
$DB->query("
SELECT 1
FROM comments AS c
FROM comments
WHERE ID = $ThingID");
if (!$DB->has_results()) {
$Error = 'No comment with the reported ID found';
@ -139,9 +139,9 @@
}
$DB->query("
SELECT r.Reason
FROM reports AS r
WHERE r.ID = $ReportID");
SELECT Reason
FROM reports
WHERE ID = $ReportID");
list($Reason) = $DB->next_record();
$Body = "You reported $TypeLink for the reason:\n[quote]{$Reason}[/quote]";

View File

@ -168,24 +168,25 @@
p.ID,
p.Body,
p.TopicID,
( SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = p.TopicID
AND forums_posts.ID <= p.ID
(
SELECT COUNT(p2.ID)
FROM forums_posts AS p2
WHERE p2.TopicID = p.TopicID
AND p2.ID <= p.ID
) AS PostNum
FROM forums_posts AS p
WHERE ID = $ThingID");
WHERE p.ID = $ThingID");
if (!$DB->has_results()) {
echo 'No forum post with the reported ID found';
} else {
list($PostID, $Body, $TopicID, $PostNum) = $DB->next_record();
echo "<a href=\"forums.php?action=viewthread&amp;threadid=$TopicID&amp;post=$PostNum#post$PostID\">FORUM POST</a>";
echo "<a href=\"forums.php?action=viewthread&amp;threadid=$TopicID&amp;post=$PostNum#post$PostID\">FORUM POST ID #$PostID</a>";
}
break;
case 'comment':
$DB->query("
SELECT 1
FROM comments AS c
FROM comments
WHERE ID = $ThingID");
if (!$DB->has_results()) {
echo 'No comment with the reported ID found';

View File

@ -154,11 +154,11 @@
<?
$DB->query("
SELECT u.Username,
COUNT(LastPostAuthorID) as Trashed
FROM forums_topics as f
LEFT JOIN users_main as u on u.id = LastPostAuthorID
WHERE ForumID = 12
GROUP BY LastPostAuthorID
COUNT(f.LastPostAuthorID) as Trashed
FROM forums_topics AS f
LEFT JOIN users_main AS u ON u.ID = f.LastPostAuthorID
WHERE f.ForumID = 12
GROUP BY f.LastPostAuthorID
ORDER BY Trashed DESC
LIMIT 30");
$Results = $DB->to_array();

View File

@ -46,13 +46,13 @@
SELECT
p.ID,
p.TopicID,
( SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = p.TopicID
AND forums_posts.ID <= p.ID
( SELECT COUNT(p2.ID)
FROM forums_posts AS p2
WHERE p2.TopicID = p.TopicID
AND p2.ID <= p.ID
) AS PostNum
FROM forums_posts AS p
WHERE ID = $ID");
WHERE p.ID = $ID");
list($PostID, $TopicID, $PostNum) = $DB->next_record();
$Link = "forums.php?action=viewthread&threadid=$TopicID&post=$PostNum#post$PostID";
break;

View File

@ -270,11 +270,11 @@
<?
$DB->query("
SELECT
r.Type,
COUNT(r.ID) AS Count
FROM reportsv2 AS r
WHERE r.Status = 'New'
GROUP BY r.Type");
Type,
COUNT(ID) AS Count
FROM reportsv2
WHERE Status = 'New'
GROUP BY Type");
$Current = $DB->to_array();
if (!empty($Current)) {
?>

View File

@ -391,12 +391,12 @@
//1. See if each artist given already exists and if it does, grab the ID.
$DB->query("
SELECT
aa.ArtistID,
aa.AliasID,
aa.Name,
aa.Redirect
FROM artists_alias AS aa
WHERE aa.Name = '".db_string($Artist['name'])."'");
ArtistID,
AliasID,
Name,
Redirect
FROM artists_alias
WHERE Name = '".db_string($Artist['name'])."'");
while (list($ArtistID, $AliasID, $AliasName, $Redirect) = $DB->next_record(MYSQLI_NUM, false)) {
if (!strcasecmp($Artist['name'], $AliasName)) {
@ -457,14 +457,14 @@
//Get a count of how many groups or requests use the artist ID
$DB->query("
SELECT COUNT(ag.ArtistID)
FROM artists_group as ag
FROM artists_group AS ag
LEFT JOIN requests_artists AS ra ON ag.ArtistID = ra.ArtistID
WHERE ra.ArtistID IS NOT NULL
AND ag.ArtistID = '$ArtistID'");
list($ReqCount) = $DB->next_record();
$DB->query("
SELECT COUNT(ag.ArtistID)
FROM artists_group as ag
FROM artists_group AS ag
LEFT JOIN torrents_artists AS ta ON ag.ArtistID = ta.ArtistID
WHERE ta.ArtistID IS NOT NULL
AND ag.ArtistID = '$ArtistID'");

View File

@ -572,7 +572,7 @@ function next_hour() {
INSERT INTO users_torrent_history_snatch (UserID, NumSnatches)
SELECT xs.uid, COUNT(DISTINCT xs.fid)
FROM xbt_snatched AS xs
JOIN torrents on torrents.ID = xs.fid
JOIN torrents AS t ON t.ID = xs.fid
GROUP BY xs.uid");
// Get the fraction of snatched torrents seeded for at least 72 hours this week
@ -864,8 +864,8 @@ function next_hour() {
//------------- Demote users --------------------------------------------//
sleep(10);
$DB->query('
SELECT um.ID
FROM users_main AS um
SELECT ID
FROM users_main
WHERE PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
AND Uploaded / Downloaded < 0.95
OR PermissionID IN('.POWER.', '.ELITE.', '.TORRENT_MASTER.')
@ -889,8 +889,8 @@ function next_hour() {
echo "demoted 2\n";
$DB->query('
SELECT um.ID
FROM users_main AS um
SELECT ID
FROM users_main
WHERE PermissionID IN('.MEMBER.', '.POWER.', '.ELITE.', '.TORRENT_MASTER.')
AND Uploaded / Downloaded < 0.65');
echo "demoted 3\n";
@ -1363,7 +1363,7 @@ function next_hour() {
$DB->query("
SELECT ID
FROM users_main AS um
JOIN users_info AS ui on ui.UserID = um.ID
JOIN users_info AS ui ON ui.UserID = um.ID
WHERE um.Enabled = '1'
AND ui.DisableInvites = '0'
AND ((um.PermissionID = ".POWER."

View File

@ -6,9 +6,9 @@
SELECT
i.SupportFor,
p.DisplayStaff
FROM users_info as i
JOIN users_main as m ON m.ID = i.UserID
JOIN permissions as p ON p.ID = m.PermissionID
FROM users_info AS i
JOIN users_main AS m ON m.ID = i.UserID
JOIN permissions AS p ON p.ID = m.PermissionID
WHERE i.UserID = ".$LoggedUser['ID']
);
list($SupportFor, $DisplayStaff) = $DB->next_record();

View File

@ -5,9 +5,9 @@
SELECT
i.SupportFor,
p.DisplayStaff
FROM users_info as i
JOIN users_main as m ON m.ID = i.UserID
JOIN permissions as p ON p.ID = m.PermissionID
FROM users_info AS i
JOIN users_main AS m ON m.ID = i.UserID
JOIN permissions AS p ON p.ID = m.PermissionID
WHERE i.UserID = '.$LoggedUser['ID']
);
list($SupportFor, $DisplayStaff) = $DB->next_record();

View File

@ -6,9 +6,9 @@
SELECT
i.SupportFor,
p.DisplayStaff
FROM users_info as i
JOIN users_main as m ON m.ID = i.UserID
JOIN permissions as p ON p.ID = m.PermissionID
FROM users_info AS i
JOIN users_main AS m ON m.ID = i.UserID
JOIN permissions AS p ON p.ID = m.PermissionID
WHERE i.UserID = ".$LoggedUser['ID']
);
list($SupportFor, $DisplayStaff) = $DB->next_record();

View File

@ -23,7 +23,7 @@
// the right level
$DB->query("
SELECT m.Message, c.Level, c.UserID
FROM staff_pm_messages as m
FROM staff_pm_messages AS m
JOIN staff_pm_conversations AS c ON m.ConvID = c.ID
WHERE m.ID = '$PostID'");
list($Message, $Level, $UserID) = $DB->next_record(MYSQLI_NUM);

View File

@ -10,9 +10,9 @@
SELECT
i.SupportFor,
p.DisplayStaff
FROM users_info as i
JOIN users_main as m ON m.ID = i.UserID
JOIN permissions as p ON p.ID = m.PermissionID
FROM users_info AS i
JOIN users_main AS m ON m.ID = i.UserID
JOIN permissions AS p ON p.ID = m.PermissionID
WHERE i.UserID = ".$LoggedUser['ID']
);
list($SupportFor, $DisplayStaff) = $DB->next_record();

View File

@ -187,8 +187,8 @@
SELECT
m.ID,
m.Username
FROM permissions as p
JOIN users_main as m ON m.PermissionID = p.ID
FROM permissions AS p
JOIN users_main AS m ON m.PermissionID = p.ID
WHERE p.DisplayStaff = '1'
ORDER BY p.Level DESC, m.Username ASC"
);
@ -206,9 +206,9 @@
SELECT
m.ID,
m.Username
FROM users_info as i
JOIN users_main as m ON m.ID = i.UserID
JOIN permissions as p ON p.ID = m.PermissionID
FROM users_info AS i
JOIN users_main AS m ON m.ID = i.UserID
JOIN permissions AS p ON p.ID = m.PermissionID
WHERE p.DisplayStaff != '1'
AND i.SupportFor != ''
ORDER BY m.Username ASC

View File

@ -28,7 +28,7 @@
i.InviteKey,
i.Expires,
i.Email
FROM invites as i
FROM invites AS i
JOIN users_main AS um ON um.ID = i.InviterID ";
if ($Search) {
$sql .= "

View File

@ -7,10 +7,10 @@
<div class="thin">
<?
$DB->query("
SELECT m.ID
FROM users_main AS m
WHERE m.CustomPermissions != ''
AND m.CustomPermissions != 'a:0:{}'");
SELECT ID
FROM users_main
WHERE CustomPermissions != ''
AND CustomPermissions != 'a:0:{}'");
if ($DB->has_results()) {
?>
<table width="100%">

View File

@ -58,7 +58,7 @@
FromIP,
ToIP,
Reason
FROM ip_bans AS i ";
FROM ip_bans ";
if (!empty($_REQUEST['notes'])) {
$sql .= "WHERE Reason LIKE '%".db_string($_REQUEST['notes'])."%' ";

View File

@ -12,8 +12,8 @@
d.Comment,
d.UserID,
d.Time
FROM do_not_upload as d
LEFT JOIN users_main AS um ON um.ID=d.UserID
FROM do_not_upload AS d
LEFT JOIN users_main AS um ON um.ID=d.UserID
ORDER BY d.Sequence");
?>
<div class="header">

View File

@ -9,7 +9,7 @@
$Where = "";
if (!empty($_POST['email'])) {
$Email = db_string($_POST['email']);
$Where .= " WHERE eb.Email LIKE '%$Email%'";
$Where .= " WHERE Email LIKE '%$Email%'";
}
if (!empty($_POST['comment'])) {
$Comment = db_string($_POST['comment']);
@ -18,19 +18,19 @@
} else {
$Where .= " WHERE";
}
$Where .= " eb.Comment LIKE '%$Comment%'";
$Where .= " Comment LIKE '%$Comment%'";
}
$DB->query("
SELECT
SQL_CALC_FOUND_ROWS
eb.ID,
eb.UserID,
eb.Time,
eb.Email,
eb.Comment
FROM email_blacklist AS eb
ID,
UserID,
Time,
Email,
Comment
FROM email_blacklist
$Where
ORDER BY eb.Time DESC
ORDER BY Time DESC
LIMIT $Limit");
$Results = $DB->to_array(false, MYSQLI_ASSOC, false);
$DB->query('SELECT FOUND_ROWS()');

View File

@ -12,13 +12,13 @@
$DB->query("
SELECT
eb.ID,
eb.UserID,
eb.Time,
eb.Email,
eb.Comment
FROM email_blacklist AS eb
WHERE eb.Email LIKE '%$Search%'");
ID,
UserID,
Time,
Email,
Comment
FROM email_blacklist
WHERE Email LIKE '%$Search%'");
$EmailResults = $DB->to_array(false, MYSQLI_ASSOC, false);

View File

@ -14,16 +14,16 @@
$DB->query('
SELECT
l.ID,
l.IP,
l.UserID,
l.LastAttempt,
l.Attempts,
l.BannedUntil,
l.Bans
FROM login_attempts AS l
WHERE l.BannedUntil > "'.sqltime().'"
ORDER BY l.BannedUntil ASC');
ID,
IP,
UserID,
LastAttempt,
Attempts,
BannedUntil,
Bans
FROM login_attempts
WHERE BannedUntil > "'.sqltime().'"
ORDER BY BannedUntil ASC');
?>
<div class="thin">
<div class="header">

View File

@ -65,12 +65,12 @@
<?
$DB->query('
SELECT
n.ID,
n.Title,
n.Body,
n.Time
FROM news AS n
ORDER BY n.Time DESC');// LIMIT 20
ID,
Title,
Body,
Time
FROM news
ORDER BY Time DESC');// LIMIT 20
while (list($NewsID, $Title, $Body, $NewsTime) = $DB->next_record()) {
?>
<div class="box vertical_space news_post">

View File

@ -25,9 +25,9 @@
$TagName = Misc::sanitize_tag($_POST['newtag']);
$DB->query("
SELECT t.ID
FROM tags AS t
WHERE t.Name LIKE '$TagName'");
SELECT ID
FROM tags
WHERE Name LIKE '$TagName'");
list($TagID) = $DB->next_record();
if ($TagID) {

View File

@ -25,16 +25,16 @@
t1.TreeID,
t1.TreeLevel,
( SELECT
t2.TreePosition
t2.TreePosition
FROM invite_tree AS t2
WHERE TreeID=t1.TreeID
AND TreeLevel=t1.TreeLevel
AND t2.TreePosition>t1.TreePosition
ORDER BY TreePosition
WHERE t2.TreeID = t1.TreeID
AND t2.TreeLevel = t1.TreeLevel
AND t2.TreePosition > t1.TreePosition
ORDER BY t2.TreePosition
LIMIT 1
) AS MaxPosition
FROM invite_tree AS t1
WHERE t1.UserID=$UserID");
WHERE t1.UserID = $UserID");
list ($TreePosition, $TreeID, $TreeLevel, $MaxPosition) = $DB->next_record();
if (!$MaxPosition) {
$MaxPosition = 1000000;

View File

@ -24,9 +24,9 @@
$TagName = Misc::get_alias_tag($TagName);
// Check DB for tag matching name
$DB->query("
SELECT t.ID
FROM tags AS t
WHERE t.Name LIKE '$TagName'");
SELECT ID
FROM tags
WHERE Name LIKE '$TagName'");
list($TagID) = $DB->next_record();
if (!$TagID) { // Tag doesn't exist yet - create tag

View File

@ -33,14 +33,14 @@
// Get a count of how many groups or requests use this artist ID
$DB->query("
SELECT ag.ArtistID
FROM artists_group as ag
FROM artists_group AS ag
LEFT JOIN requests_artists AS ra ON ag.ArtistID = ra.ArtistID
WHERE ra.ArtistID IS NOT NULL
AND ag.ArtistID = $ArtistID");
$ReqCount = $DB->record_count();
$DB->query("
SELECT ag.ArtistID
FROM artists_group as ag
FROM artists_group AS ag
LEFT JOIN torrents_artists AS ta ON ag.ArtistID = ta.ArtistID
WHERE ta.ArtistID IS NOT NULL
AND ag.ArtistID = $ArtistID");

View File

@ -15,11 +15,11 @@
$DB->query("
SELECT
SQL_CALC_FOUND_ROWS
ud.UserID,
ud.Time
FROM users_downloads AS ud
WHERE ud.TorrentID = '$TorrentID'
ORDER BY ud.Time DESC
UserID,
Time
FROM users_downloads
WHERE TorrentID = '$TorrentID'
ORDER BY Time DESC
LIMIT $Limit");
$UserIDs = $DB->collect('UserID');
$Results = $DB->to_array('UserID', MYSQLI_ASSOC);

View File

@ -92,11 +92,11 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
t.ID AS HasFile
FROM torrents AS t
LEFT JOIN torrents_bad_tags AS tbt ON tbt.TorrentID = t.ID
LEFT JOIN torrents_bad_folders AS tbf on tbf.TorrentID = t.ID
LEFT JOIN torrents_bad_files AS tfi on tfi.TorrentID = t.ID
LEFT JOIN torrents_cassette_approved AS ca on ca.TorrentID = t.ID
LEFT JOIN torrents_lossymaster_approved AS lma on lma.TorrentID = t.ID
LEFT JOIN torrents_lossyweb_approved AS lwa on lwa.TorrentID = t.ID
LEFT JOIN torrents_bad_folders AS tbf ON tbf.TorrentID = t.ID
LEFT JOIN torrents_bad_files AS tfi ON tfi.TorrentID = t.ID
LEFT JOIN torrents_cassette_approved AS ca ON ca.TorrentID = t.ID
LEFT JOIN torrents_lossymaster_approved AS lma ON lma.TorrentID = t.ID
LEFT JOIN torrents_lossyweb_approved AS lwa ON lwa.TorrentID = t.ID
LEFT JOIN torrents_logs_new AS tln ON tln.TorrentID = t.ID
WHERE t.GroupID = '".db_string($GroupID)."'
GROUP BY t.ID
@ -180,9 +180,9 @@ function is_valid_torrenthash($Str) {
function torrenthash_to_torrentid($Str) {
global $Cache, $DB;
$DB->query("
SELECT t.ID
FROM torrents AS t
WHERE HEX(t.info_hash) = '".db_string($Str)."'");
SELECT ID
FROM torrents
WHERE HEX(info_hash) = '".db_string($Str)."'");
$TorrentID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
if ($TorrentID) {
return $TorrentID;
@ -193,9 +193,9 @@ function torrenthash_to_torrentid($Str) {
function torrenthash_to_groupid($Str) {
global $Cache, $DB;
$DB->query("
SELECT t.GroupID
FROM torrents AS t
WHERE HEX(t.info_hash) = '".db_string($Str)."'");
SELECT GroupID
FROM torrents
WHERE HEX(info_hash) = '".db_string($Str)."'");
$GroupID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
if ($GroupID) {
return $GroupID;
@ -206,9 +206,9 @@ function torrenthash_to_groupid($Str) {
function torrentid_to_groupid($TorrentID) {
global $Cache, $DB;
$DB->query("
SELECT t.GroupID
FROM torrents AS t
WHERE t.ID = '".db_string($TorrentID)."'");
SELECT GroupID
FROM torrents
WHERE ID = '".db_string($TorrentID)."'");
$GroupID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
if ($GroupID) {
return $GroupID;

View File

@ -56,7 +56,7 @@
IF(t.RemasterYear=0,tg.Year,t.RemasterYear) AS Year,
tg.Name,
t.Size
FROM torrents as t
FROM torrents AS t
JOIN torrents_group AS tg ON t.GroupID=tg.ID
$SQL
GROUP BY TorrentID");

View File

@ -15,11 +15,11 @@
$Result = $DB->query("
SELECT
SQL_CALC_FOUND_ROWS
xs.uid,
xs.tstamp
FROM xbt_snatched AS xs
WHERE xs.fid = '$TorrentID'
ORDER BY xs.tstamp DESC
uid,
tstamp
FROM xbt_snatched
WHERE fid = '$TorrentID'
ORDER BY tstamp DESC
LIMIT $Limit");
$Results = $DB->to_array('uid', MYSQLI_ASSOC);

View File

@ -52,16 +52,16 @@
} elseif (empty($Properties) && !empty($_GET['requestid']) && is_number($_GET['requestid'])) {
$DB->query('
SELECT
r.ID AS RequestID,
r.CategoryID,
r.Title AS Title,
r.Year,
r.RecordLabel,
r.CatalogueNumber,
r.ReleaseType,
r.Image
FROM requests AS r
WHERE r.ID = '.$_GET['requestid']);
ID AS RequestID,
CategoryID,
Title AS Title,
Year,
RecordLabel,
CatalogueNumber,
ReleaseType,
Image
FROM requests
WHERE ID = '.$_GET['requestid']);
list($Properties) = $DB->to_array(false, MYSQLI_BOTH);
$UploadForm = $Categories[$Properties['CategoryID'] - 1];
@ -95,17 +95,17 @@
$DB->query('
SELECT
d.Name,
d.Comment,
d.Time
FROM do_not_upload as d
ORDER BY d.Sequence');
Name,
Comment,
Time
FROM do_not_upload
ORDER BY Sequence');
$DNU = $DB->to_array();
list($Name, $Comment, $Updated) = reset($DNU);
reset($DNU);
$DB->query('SELECT MAX(Time) FROM do_not_upload');
list($Updated) = $DB->next_record();
$DB->query("
SELECT IF(MAX(t.Time) < '$Updated' OR MAX(t.Time) IS NULL, 1, 0)
FROM torrents AS t
SELECT IF(MAX(Time) IS NULL OR MAX(Time) < '$Updated', 1, 0)
FROM torrents
WHERE UserID = ".$LoggedUser['ID']);
list($NewDNU) = $DB->next_record();
$HideDNU = check_perms('torrents_hide_dnu') && !$NewDNU;

View File

@ -444,16 +444,16 @@
if ($Properties['GroupID']) {
$DB->query("
SELECT
tg.id,
tg.WikiImage,
tg.WikiBody,
tg.RevisionID,
tg.Name,
tg.Year,
tg.ReleaseType,
tg.TagList
FROM torrents_group AS tg
WHERE tg.id = ".$Properties['GroupID']);
ID,
WikiImage,
WikiBody,
RevisionID,
Name,
Year,
ReleaseType,
TagList
FROM torrents_group
WHERE id = ".$Properties['GroupID']);
if ($DB->has_results()) {
// Don't escape tg.Name. It's written directly to the log table
list($GroupID, $WikiImage, $WikiBody, $RevisionID, $Properties['Title'], $Properties['Year'], $Properties['ReleaseType'], $Properties['TagList']) = $DB->next_record(MYSQLI_NUM, array(4));
@ -508,12 +508,12 @@
// The album hasn't been uploaded. Try to get the artist IDs
$DB->query("
SELECT
aa.ArtistID,
aa.AliasID,
aa.Name,
aa.Redirect
FROM artists_alias AS aa
WHERE aa.Name = '".db_string($Artist['name'])."'");
ArtistID,
AliasID,
Name,
Redirect
FROM artists_alias
WHERE Name = '".db_string($Artist['name'])."'");
if ($DB->has_results()) {
while (list($ArtistID, $AliasID, $AliasName, $Redirect) = $DB->next_record(MYSQLI_NUM, false)) {
if (!strcasecmp($Artist['name'], $AliasName)) {

View File

@ -1,8 +1,4 @@
<?php
/**********************************************************************
*>>>>>>>>>>>>>>>>>>>>>>>>>>> User search <<<<<<<<<<<<<<<<<<<<<<<<<<<<*
* Best viewed with a wide screen monitor *
**********************************************************************/
<?
if (!empty($_GET['search'])) {
if (preg_match('/^'.IP_REGEX.'$/', $_GET['search'])) {
$_GET['ip'] = $_GET['search'];
@ -219,7 +215,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
} else {
$SQL .= "
(
SELECT COUNT(uid)
SELECT COUNT(xs.uid)
FROM xbt_snatched AS xs
WHERE xs.uid = um1.ID
) AS Snatches,";

View File

@ -127,7 +127,7 @@ function checked($Checked) {
</div>
<div class="main_column">
<div>
<input type="hidden" name="action" value="takeedit" />
<input type="hidden" name="action" value="take_edit" />
<input type="hidden" name="userid" value="<?=$UserID?>" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
</div>
@ -739,9 +739,9 @@ function checked($Checked) {
</tr>
<?
$DB->query("
SELECT COUNT(ta.ArtistID)
FROM torrents_artists AS ta
WHERE ta.UserID = $UserID");
SELECT COUNT(ArtistID)
FROM torrents_artists
WHERE UserID = $UserID");
list($ArtistsAdded) = $DB->next_record();
?>
<tr id="para_artistsadded_tr">

View File

@ -42,8 +42,8 @@
case 'edit':
include('edit.php');
break;
case 'takeedit':
include('takeedit.php');
case 'take_edit':
include('take_edit.php');
break;
case 'invitetree':
include(SERVER_ROOT.'/sections/user/invitetree.php');
@ -51,11 +51,11 @@
case 'invite':
include('invite.php');
break;
case 'takeinvite':
include('takeinvite.php');
case 'take_invite':
include('take_invite.php');
break;
case 'deleteinvite':
include('deleteinvite.php');
case 'delete_invite':
include('delete_invite.php');
break;
case 'sessions':
include('sessions.php');

View File

@ -88,7 +88,7 @@
Downloaded,
JoinDate,
LastAccess
FROM users_main as um
FROM users_main AS um
LEFT JOIN users_info AS ui ON ui.UserID = um.ID
WHERE ui.Inviter = '$UserID'
ORDER BY $OrderBy $CurrentSort");
@ -144,7 +144,7 @@
</div>
<div class="box pad">
<form class="send_form" name="invite" action="user.php" method="post">
<input type="hidden" name="action" value="takeinvite" />
<input type="hidden" name="action" value="take_invite" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%">
@ -194,7 +194,7 @@
<tr class="row<?=$Row?>">
<td><?=display_str($Email)?></td>
<td><?=time_diff($Expires)?></td>
<td><a href="user.php?action=deleteinvite&amp;invite=<?=$InviteKey?>&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Are you sure you want to delete this invite?');">Delete invite</a></td>
<td><a href="user.php?action=delete_invite&amp;invite=<?=$InviteKey?>&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Are you sure you want to delete this invite?');">Delete invite</a></td>
</tr>
<? } ?>
</table>

View File

@ -128,10 +128,10 @@
}
$DB->query("
SELECT m.ID, m.Paranoia
FROM users_main AS m
WHERE m.Username IN ('" . implode("', '", $EscapedUsernames) . "')
AND m.ID != $LoggedUser[ID]");
SELECT ID, Paranoia
FROM users_main
WHERE Username IN ('" . implode("', '", $EscapedUsernames) . "')
AND ID != $LoggedUser[ID]");
while (list($UserID, $Paranoia) = $DB->next_record()) {
$Paranoia = unserialize($Paranoia);
if (!in_array('notifications', $Paranoia)) {

View File

@ -12,9 +12,9 @@
list($UserID, $Username, $PermissionID) = array_values(Users::user_info($_REQUEST['userid']));
$DB->query("
SELECT u.CustomPermissions
FROM users_main AS u
WHERE u.ID='$UserID'");
SELECT CustomPermissions
FROM users_main
WHERE ID='$UserID'");
list($Customs)=$DB->next_record(MYSQLI_NUM, false);

View File

@ -525,7 +525,7 @@
if ($DisableAvatar != $Cur['DisableAvatar'] && check_perms('users_disable_any')) {
$UpdateSet[] = "DisableAvatar = '$DisableAvatar'";
$EditSummary[] = "avatar status changed";
$EditSummary[] = 'avatar privileges ' . ($DisableAvatar ? 'disabled' : 'enabled');
$HeavyUpdates['DisableAvatar'] = $DisableAvatar;
if (!empty($UserReason)) {
Misc::send_pm($UserID, 0, 'Your avatar privileges have been disabled', "Your avatar privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url].');
@ -551,13 +551,13 @@
Misc::send_pm($UserID, 0, 'Your invite privileges have been disabled', "Your invite privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url].');
}
}
$EditSummary[] = 'invites status changed';
$EditSummary[] = 'invites privileges ' . ($DisableInvites ? 'disabled' : 'enabled');
$HeavyUpdates['DisableInvites'] = $DisableInvites;
}
if ($DisablePosting != $Cur['DisablePosting'] && check_perms('users_disable_posts')) {
$UpdateSet[] = "DisablePosting = '$DisablePosting'";
$EditSummary[] = 'posting status changed';
$EditSummary[] = 'posting privileges ' . ($DisablePosting ? 'disabled' : 'enabled');
$HeavyUpdates['DisablePosting'] = $DisablePosting;
if (!empty($UserReason)) {
Misc::send_pm($UserID, 0, 'Your forum posting privileges have been disabled', "Your forum posting privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url].');
@ -566,7 +566,7 @@
if ($DisableForums != $Cur['DisableForums'] && check_perms('users_disable_posts')) {
$UpdateSet[] = "DisableForums = '$DisableForums'";
$EditSummary[] = 'forums status changed';
$EditSummary[] = 'forums privileges ' . ($DisableForums ? 'disabled' : 'enabled');
$HeavyUpdates['DisableForums'] = $DisableForums;
if (!empty($UserReason)) {
Misc::send_pm($UserID, 0, 'Your forum privileges have been disabled', "Your forum privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url].');
@ -575,7 +575,7 @@
if ($DisableTagging != $Cur['DisableTagging'] && check_perms('users_disable_any')) {
$UpdateSet[] = "DisableTagging = '$DisableTagging'";
$EditSummary[] = 'tagging status changed';
$EditSummary[] = 'tagging privileges ' . ($DisableTagging ? 'disabled' : 'enabled');
$HeavyUpdates['DisableTagging'] = $DisableTagging;
if (!empty($UserReason)) {
Misc::send_pm($UserID, 0, 'Your tagging privileges have been disabled', "Your tagging privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url].');
@ -584,7 +584,7 @@
if ($DisableUpload != $Cur['DisableUpload'] && check_perms('users_disable_any')) {
$UpdateSet[] = "DisableUpload = '$DisableUpload'";
$EditSummary[] = 'upload status changed';
$EditSummary[] = 'upload privileges ' . ($DisableUpload ? 'disabled' : 'enabled');
$HeavyUpdates['DisableUpload'] = $DisableUpload;
if ($DisableUpload == 1) {
Misc::send_pm($UserID, 0, 'Your upload privileges have been disabled', "Your upload privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url].');
@ -593,7 +593,7 @@
if ($DisableWiki != $Cur['DisableWiki'] && check_perms('users_disable_any')) {
$UpdateSet[] = "DisableWiki = '$DisableWiki'";
$EditSummary[] = 'wiki status changed';
$EditSummary[] = 'wiki privileges ' . ($DisableWiki ? 'disabled' : 'enabled');
$HeavyUpdates['DisableWiki'] = $DisableWiki;
$HeavyUpdates['site_edit_wiki'] = 0;
if (!empty($UserReason)) {
@ -604,7 +604,7 @@
if ($DisablePM != $Cur['DisablePM'] && check_perms('users_disable_any')) {
$UpdateSet[] = "DisablePM = '$DisablePM'";
$EditSummary[] = 'PM status changed';
$EditSummary[] = 'PM privileges ' . ($DisablePM ? 'disabled' : 'enabled');
$HeavyUpdates['DisablePM'] = $DisablePM;
if (!empty($UserReason)) {
Misc::send_pm($UserID, 0, 'Your PM privileges have been disabled', "Your PM privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url].');
@ -613,7 +613,7 @@
if ($DisableIRC != $Cur['DisableIRC'] && check_perms('users_disable_any')) {
$UpdateSet[] = "DisableIRC = '$DisableIRC'";
$EditSummary[] = 'IRC status changed';
$EditSummary[] = 'IRC privileges ' . ($DisableIRC ? 'disabled' : 'enabled');
$HeavyUpdates['DisableIRC'] = $DisableIRC;
if (!empty($UserReason)) {
Misc::send_pm($UserID, 0, 'Your IRC privileges have been disabled', "Your IRC privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url]. This loss of privileges does not affect the ability to join and talk to staff in '.BOT_DISABLED_CHAN.'.');
@ -622,7 +622,7 @@
if ($DisableRequests != $Cur['DisableRequests'] && check_perms('users_disable_any')) {
$UpdateSet[] = "DisableRequests = '$DisableRequests'";
$EditSummary[] = 'request status changed';
$EditSummary[] = 'request privileges ' . ($DisableRequests ? 'disabled' : 'enabled');
$HeavyUpdates['DisableRequests'] = $DisableRequests;
if (!empty($UserReason)) {
Misc::send_pm($UserID, 0, 'Your request privileges have been disabled', "Your request privileges have been disabled. The reason given was: $UserReason. If you would like to discuss this, please join ".BOT_DISABLED_CHAN.' on our IRC network. Instructions can be found [url='.site_url().'wiki.php?action=article&amp;name=IRC+-+How+to+join]here[/url].');

View File

@ -308,9 +308,9 @@ function check_paranoia_here($Setting) {
if (check_paranoia_here('requestsvoted_count') || check_paranoia_here('requestsvoted_bounty')) {
$DB->query("
SELECT COUNT(rv.RequestID), SUM(rv.Bounty)
FROM requests_votes AS rv
WHERE rv.UserID = $UserID");
SELECT COUNT(RequestID), SUM(Bounty)
FROM requests_votes
WHERE UserID = $UserID");
list($RequestsVoted, $TotalSpent) = $DB->next_record();
$DB->query("
SELECT COUNT(r.ID), SUM(rv.Bounty)
@ -334,9 +334,9 @@ function check_paranoia_here($Setting) {
if (check_paranoia_here('artistsadded')) {
$DB->query("
SELECT COUNT(ta.ArtistID)
FROM torrents_artists AS ta
WHERE ta.UserID = $UserID");
SELECT COUNT(ArtistID)
FROM torrents_artists
WHERE UserID = $UserID");
list($ArtistsAdded) = $DB->next_record();
} else {
$ArtistsAdded = 0;

View File

@ -118,13 +118,13 @@
$ueQuery = $DB->query("
SELECT
ue.UserID,
Username,
um.Username,
ue.Time,
ue.IP
FROM users_history_emails AS ue, users_main
FROM users_history_emails AS ue, users_main AS um
WHERE ue.Email = '".db_string($Values['Email'])."'
AND UserID != $UserID
AND ID = UserID");
AND ue.UserID != $UserID
AND um.ID = ue.UserID");
while (list($UserID2, $Time, $IP) = $DB->next_record()) { ?>
</tr>
<tr>

View File

@ -76,7 +76,7 @@
l.PostID AS LastRead,
t.IsLocked,
t.IsSticky
FROM forums_posts as p
FROM forums_posts AS p
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
@ -115,7 +115,7 @@
$sql .= "
t.IsLocked,
t.IsSticky
FROM forums_posts as p
FROM forums_posts AS p
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
LEFT JOIN users_info AS ui ON ui.UserID = p.AuthorID
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID

View File

@ -42,12 +42,12 @@
<?
$DB->query("
SELECT
w.Revision,
w.Title,
w.Author,
w.Date
FROM wiki_revisions AS w
WHERE w.ID='$ArticleID'
Revision,
Title,
Author,
Date
FROM wiki_revisions
WHERE ID = '$ArticleID'
ORDER BY Revision DESC");
while (list($Revision, $Title, $AuthorID, $Date) = $DB->next_record()) { ?>
<tr>

View File

@ -11,15 +11,15 @@
$OrderVals = array('Title', 'Created', 'Edited');
$WayVals = array('Ascending', 'Descending');
$TypeTable = array('Title'=>'w.Title', 'Body'=>'w.Body');
$OrderTable = array('Title'=>'w.Title', 'Created'=>'w.ID', 'Edited'=>'w.Date');
$TypeTable = array('Title'=>'Title', 'Body'=>'Body');
$OrderTable = array('Title'=>'Title', 'Created'=>'ID', 'Edited'=>'Date');
$WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC');
// What are we looking for? Let's make sure it isn't dangerous.
$Search = db_string(trim($_GET['search']));
if (!in_array($Type, array('w.Title', 'w.Body'))) {
$Type = 'w.Title';
if (!in_array($Type, array('Title', 'Body'))) {
$Type = 'Title';
}
// Break search string down into individual words
@ -27,7 +27,7 @@
$Type = $TypeTable[$_GET['type']];
if (!$Type) {
$Type = 'w.Title';
$Type = 'Title';
}
$Order = $OrderTable[$_GET['order']];
@ -43,12 +43,12 @@
$SQL = "
SELECT
SQL_CALC_FOUND_ROWS
w.ID,
w.Title,
w.Date,
w.Author
FROM wiki_articles AS w
WHERE w.MinClassRead <= '".$LoggedUser['EffectiveClass']."'";
ID,
Title,
Date,
Author
FROM wiki_articles
WHERE MinClassRead <= '".$LoggedUser['EffectiveClass']."'";
if ($Search != '') {
$SQL .= " AND $Type LIKE '%";
$SQL .= implode("%' AND $Type LIKE '%", $Words);
@ -89,8 +89,8 @@
<tr>
<td class="label"><strong>Search in:</strong></td>
<td>
<label><input type="radio" name="type" value="Title" <? if ($Type == 'w.Title') { echo 'checked="checked" '; } ?>/> Title</label>
<label><input type="radio" name="type" value="Body" <? if ($Type == 'w.Body') { echo 'checked="checked" '; } ?>/> Body</label>
<label><input type="radio" name="type" value="Title" <? if ($Type == 'Title') { echo 'checked="checked" '; } ?>/> Title</label>
<label><input type="radio" name="type" value="Body" <? if ($Type == 'Body') { echo 'checked="checked" '; } ?>/> Body</label>
</td>
<td class="label"><strong>Order by:</strong></td>
<td>

View File

@ -12,14 +12,14 @@
$sql = "
SELECT
SQL_CALC_FOUND_ROWS
w.ID,
w.Title,
w.Date,
w.Author
FROM wiki_articles AS w
WHERE w.MinClassRead <= '".$LoggedUser['EffectiveClass']."'";
ID,
Title,
Date,
Author
FROM wiki_articles
WHERE MinClassRead <= '".$LoggedUser['EffectiveClass']."'";
if ($Letter !== '1') {
$sql .= " AND LEFT(w.Title,1) = '".db_string($Letter)."'";
$sql .= " AND LEFT(Title,1) = '".db_string($Letter)."'";
} else {
$Letter = 'All';
}