Empty commit

This commit is contained in:
Git 2013-07-13 08:00:46 +00:00
parent 633a1b6b43
commit 8f5fb0f429
31 changed files with 780 additions and 513 deletions

View File

@ -294,6 +294,10 @@ function close() {
}
}
/*
* returns an integer with the number of rows found
* returns a string if the number of rows found exceeds MAXINT
*/
function record_count() {
if ($this->QueryID) {
return mysqli_num_rows($this->QueryID);

View File

@ -21,7 +21,10 @@
);
die();
}
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
$DB->query("
SELECT Username
FROM users_main
WHERE ID = '$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
@ -31,11 +34,11 @@
//$ArtistList = Bookmarks::all_bookmarks('artist', $UserID);
$DB->query('
$DB->query("
SELECT ag.ArtistID, ag.Name
FROM bookmarks_artists AS ba
INNER JOIN artists_group AS ag ON ba.ArtistID = ag.ArtistID
WHERE ba.UserID = '.$UserID);
WHERE ba.UserID = $UserID");
$ArtistList = $DB->to_array();

View File

@ -16,7 +16,10 @@ function compare($X, $Y) {
if (!is_number($UserID)) {
error(404);
}
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
$DB->query("
SELECT Username
FROM users_main
WHERE ID = '$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];

View File

@ -19,7 +19,10 @@
if (isset($_GET['topicid']) && is_number($_GET['topicid'])) {
$ThreadID = $_GET['topicid'];
} elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
$DB->query("SELECT TopicID FROM forums_posts WHERE ID = $_GET[postid]");
$DB->query("
SELECT TopicID
FROM forums_posts
WHERE ID = $_GET[postid]");
list($ThreadID) = $DB->next_record();
if ($ThreadID) {
//Redirect postid to threadid when necessary.
@ -84,7 +87,7 @@
list($CatalogueID,$CatalogueLimit) = Format::catalogue_limit($Page, $PerPage, THREAD_CATALOGUE);
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
if (!$Catalogue = $Cache->get_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID)) {
if (!$Catalogue = $Cache->get_value("thread_$ThreadID"."_catalogue_$CatalogueID")) {
$DB->query("
SELECT
p.ID,
@ -99,12 +102,12 @@
LIMIT $CatalogueLimit");
$Catalogue = $DB->to_array(false, MYSQLI_ASSOC);
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
$Cache->cache_value('thread_'.$ThreadID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
$Cache->cache_value("thread_$ThreadID"."_catalogue_$CatalogueID", $Catalogue, 0);
}
}
$Thread = Format::catalogue_select($Catalogue, $Page, $PerPage, THREAD_CATALOGUE);
if ($_GET['updatelastread'] != '0') {
if ($_GET['updatelastread'] !== '0') {
$LastPost = end($Thread);
$LastPost = $LastPost['ID'];
reset($Thread);
@ -260,11 +263,11 @@
'authorId' => (int) $AuthorID,
'authorName' => $Username,
'paranoia' => $Paranoia,
'artist' => ($Artist == 1),
'donor' => ($Donor == 1),
'warned' => ($Warned != '0000-00-00 00:00:00'),
'artist' => ($Artist === '1'),
'donor' => ($Donor === '1'),
'warned' => ($Warned !== '0000-00-00 00:00:00'),
'avatar' => $Avatar,
'enabled' => (($Enabled == 2) ? false : true),
'enabled' => (($Enabled === '2') ? false : true),
'userTitle' => $UserTitle
),

View File

@ -5,14 +5,12 @@
$Note = $_POST['note'];
if (empty($FriendID) || empty($Type) || empty($ID)) {
echo json_encode(array("status" => "error", "response" => "Error."));
echo json_encode(array('status' => 'error', 'response' => 'Error.'));
die();
}
// Make sure the recipient is on your friends list and not some random dude.
$DB->query("
SELECT
f.FriendID,
u.Username
SELECT f.FriendID, u.Username
FROM friends AS f
RIGHT JOIN users_enable_recommendations AS r
ON r.ID = f.FriendID AND r.Enable = 1
@ -22,7 +20,7 @@
AND f.FriendID = '$FriendID'");
if (!$DB->has_results()) {
echo json_encode(array("status" => "error", "response" => "Not on friend list."));
echo json_encode(array('status' => 'error', 'response' => 'Not on friend list.'));
die();
}
@ -33,27 +31,35 @@
$Article = 'a';
switch ($Type) {
case 'torrent':
$Link = "torrents.php?id=".$ID;
$DB->query("SELECT Name FROM torrents_group WHERE ID = '$ID'");
$Link = "torrents.php?id=$ID";
$DB->query("
SELECT Name
FROM torrents_group
WHERE ID = '$ID'");
break;
case 'artist':
$Article = "an";
$Link = "artist.php?id=".$ID;
$DB->query("SELECT Name FROM artists_group WHERE ArtistID = '$ID'");
$Article = 'an';
$Link = "artist.php?id=$ID";
$DB->query("
SELECT Name
FROM artists_group
WHERE ArtistID = '$ID'");
break;
case 'collage':
$Link = "collages.php?id=".$ID;
$DB->query("SELECT Name FROM collages WHERE ID = '$ID'");
$Link = "collages.php?id=$ID";
$DB->query("
SELECT Name
FROM collages
WHERE ID = '$ID'");
break;
}
list($Name) = $DB->next_record();
$Subject = $LoggedUser['Username'] . " recommended you $Article " . $Type . "!";
$Body = $LoggedUser['Username'] . " recommended you the ".$Type." [url=https://".SSL_SITE_URL."/$Link]$Name".'[/url].';
$Subject = $LoggedUser['Username'] . " recommended you $Article $Type!";
$Body = $LoggedUser['Username'] . " recommended you the $Type [url=https://".SSL_SITE_URL."/$Link]$Name".'[/url].';
if (!empty($Note)) {
$Body = $Body . "\n\n". $Note;
$Body = "$Body\n\n$Note";
}
Misc::send_pm($FriendID, $LoggedUser['ID'], $Subject, $Body);
echo json_encode(array("status" => "success", "response" => "Sent!"));
echo json_encode(array('status' => 'success', 'response' => 'Sent!'));
die();

View File

@ -5,7 +5,7 @@
function error_out($reason = '') {
$error = array('status' => 'failure');
if ($reason != '')
if ($reason !== '')
$error['reason'] = $reason;
print $error;
die();
@ -41,11 +41,12 @@ function error_out($reason = '') {
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
}
$ViewingOwn = ($UserID == $LoggedUser['ID']);
$ViewingOwn = ($UserID === $LoggedUser['ID']);
$ShowUnread = ($ViewingOwn && (!isset($_GET['showunread']) || !!$_GET['showunread']));
$ShowGrouped = ($ViewingOwn && (!isset($_GET['group']) || !!$_GET['group']));
if ($ShowGrouped) {
$sql = 'SELECT
$sql = '
SELECT
SQL_CALC_FOUND_ROWS
MAX(p.ID) AS ID
FROM forums_posts AS p
@ -73,17 +74,19 @@ function error_out($reason = '') {
AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\')
AND (l.PostID<t.LastPostID OR l.PostID IS NULL))';
}
$sql .= '
$sql .= "
GROUP BY t.ID
ORDER BY p.ID DESC LIMIT '.$Limit;
ORDER BY p.ID DESC
LIMIT $Limit";
$PostIDs = $DB->query($sql);
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();
if ($Results > $PerPage * ($Page - 1)) {
$DB->set_query_id($PostIDs);
$PostIDs = $DB->collect('ID');
$sql = 'SELECT
$sql = "
SELECT
p.ID,
p.AddedTime,
p.Body,
@ -102,16 +105,20 @@ function error_out($reason = '') {
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
JOIN forums_topics AS t ON t.ID = p.TopicID
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.ID IN ('.implode(',',$PostIDs).')
LEFT JOIN forums_last_read_topics AS l ON l.UserID = $UserID AND l.TopicID = t.ID
WHERE p.ID IN (".implode(',', $PostIDs).')
ORDER BY p.ID DESC';
$Posts = $DB->query($sql);
}
} else {
$sql = 'SELECT
$sql = '
SELECT
SQL_CALC_FOUND_ROWS';
if ($ShowGrouped) {
$sql.=' * FROM (SELECT';
$sql .= '
*
FROM (
SELECT';
}
$sql .= '
p.ID,
@ -123,11 +130,11 @@ function error_out($reason = '') {
p.TopicID,
t.Title,
t.LastPostID,';
if ($UserID == $LoggedUser['ID']) {
if ($UserID === $LoggedUser['ID']) {
$sql .= '
l.PostID AS LastRead,';
}
$sql .= '
$sql .= "
t.IsLocked,
t.IsSticky
FROM forums_posts as p
@ -136,25 +143,29 @@ function error_out($reason = '') {
LEFT JOIN users_main AS ed ON ed.ID = p.EditedUserID
JOIN forums_topics AS t ON t.ID = p.TopicID
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['Class'];
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['Class'];
if (!empty($RestrictedForums)) {
$sql.='
AND f.ID NOT IN (\''.$RestrictedForums.'\')';
$sql .= "
AND f.ID NOT IN ('$RestrictedForums')";
}
$sql .= ')';
$sql .= '
)';
if (!empty($PermittedForums)) {
$sql.='
OR f.ID IN (\''.$PermittedForums.'\')';
$sql .= "
OR f.ID IN ('$PermittedForums')";
}
$sql .= ')';
$sql .= '
)';
if ($ShowUnread) {
$sql .= '
AND ((t.IsLocked=\'0\' OR t.IsSticky=\'1\') AND (l.PostID<t.LastPostID OR l.PostID IS NULL)) ';
AND ((t.IsLocked = \'0\' OR t.IsSticky = \'1\')
AND (l.PostID < t.LastPostID OR l.PostID IS NULL)
) ';
}
$sql .= '
@ -163,13 +174,15 @@ function error_out($reason = '') {
if ($ShowGrouped) {
$sql .= '
) AS sub
GROUP BY TopicID ORDER BY ID DESC';
GROUP BY TopicID
ORDER BY ID DESC';
}
$sql.=' LIMIT '.$Limit;
$sql .= "
LIMIT $Limit";
$Posts = $DB->query($sql);
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();
$DB->set_query_id($Posts);
@ -183,8 +196,8 @@ function error_out($reason = '') {
'threadTitle' => $ThreadTitle,
'lastPostId' => (int) $LastPostID,
'lastRead' => (int) $LastRead,
'locked' => $Locked == 1,
'sticky' => $Sticky == 1,
'locked' => $Locked === '1',
'sticky' => $Sticky === '1',
'addedTime' => $AddedTime,
'body' => $Text->full_format($Body),
'bbbody' => $Body,

View File

@ -72,8 +72,10 @@
}
}
$DB->query("
INSERT INTO artists_alias(ArtistID, Name, Redirect, UserID)
VALUES ($ArtistID, '$DBAliasName', $Redirect, ".$LoggedUser['ID'].')');
INSERT INTO artists_alias
(ArtistID, Name, Redirect, UserID)
VALUES
($ArtistID, '$DBAliasName', $Redirect, ".$LoggedUser['ID'].')');
$AliasID = $DB->inserted_id();
$DB->query("
@ -82,7 +84,7 @@
WHERE ArtistID = $ArtistID");
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
Misc::write_log("The alias $AliasID ($DBAliasName) was added to the artist $ArtistID (".db_string($ArtistName).") by user ".$LoggedUser['ID'].' ('.$LoggedUser['Username'].')');
Misc::write_log("The alias $AliasID ($DBAliasName) was added to the artist $ArtistID (".db_string($ArtistName).') by user '.$LoggedUser['ID'].' ('.$LoggedUser['Username'].')');
}
header('Location: '.$_SERVER['HTTP_REFERER']);
?>

View File

@ -27,8 +27,10 @@
SQL template:
SELECT
CASE
WHEN t.Format='MP3' AND t.Encoding='V0 (VBR)' THEN 1
WHEN t.Format='MP3' AND t.Encoding='V2 (VBR)' THEN 2
WHEN t.Format = 'MP3' AND t.Encoding = 'V0 (VBR)'
THEN 1
WHEN t.Format = 'MP3' AND t.Encoding = 'V2 (VBR)'
THEN 2
ELSE 100
END AS Rank,
t.GroupID,
@ -47,12 +49,12 @@
*/
if (
!isset($_REQUEST['artistid']) ||
!isset($_REQUEST['preference']) ||
!is_number($_REQUEST['preference']) ||
!is_number($_REQUEST['artistid']) ||
$_REQUEST['preference'] > 2 ||
count($_REQUEST['list']) == 0
!isset($_REQUEST['artistid'])
|| !isset($_REQUEST['preference'])
|| !is_number($_REQUEST['preference'])
|| !is_number($_REQUEST['artistid'])
|| $_REQUEST['preference'] > 2
|| count($_REQUEST['list']) == 0
) {
error(0);
}
@ -66,23 +68,29 @@
$ArtistID = $_REQUEST['artistid'];
$Preference = $Preferences[$_REQUEST['preference']];
$DB->query("SELECT Name FROM artists_group WHERE ArtistID='$ArtistID'");
$DB->query("
SELECT Name
FROM artists_group
WHERE ArtistID = '$ArtistID'");
list($ArtistName) = $DB->next_record(MYSQLI_NUM, false);
$DB->query("SELECT GroupID, Importance FROM torrents_artists WHERE ArtistID='$ArtistID'");
$DB->query("
SELECT GroupID, Importance
FROM torrents_artists
WHERE ArtistID = '$ArtistID'");
if (!$DB->has_results()) {
error(404);
}
$Releases = $DB->to_array('GroupID', MYSQLI_ASSOC, false);
$GroupIDs = array_keys($Releases);
$SQL = "SELECT CASE ";
$SQL = 'SELECT CASE ';
foreach ($_REQUEST['list'] as $Priority => $Selection) {
if (!is_number($Priority)) {
continue;
}
$SQL .= "WHEN ";
$SQL .= 'WHEN ';
switch ($Selection) {
case '00': $SQL .= "t.Format = 'MP3' AND t.Encoding = 'V0 (VBR)'"; break;
case '01': $SQL .= "t.Format = 'MP3' AND t.Encoding = 'APX (VBR)'"; break;
@ -114,7 +122,9 @@
}
$SQL .= " THEN $Priority ";
}
$SQL .= "ELSE 100 END AS Rank,
$SQL .= "
ELSE 100
END AS Rank,
t.GroupID,
t.ID AS TorrentID,
t.Media,
@ -132,7 +142,10 @@
$Collector = new TorrentsDL($DownloadsQ, $ArtistName);
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('GroupID')) {
$Artists = Artists::get_artists($GroupIDs);
$TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', array_keys($GroupIDs)).")", false);
$TorrentFilesQ = $DB->query("
SELECT TorrentID, File
FROM torrents_files
WHERE TorrentID IN (".implode(',', array_keys($GroupIDs)).')', false);
if (is_int($TorrentFilesQ)) {
// Query failed. Let's not create a broken zip archive
foreach ($GroupIDs as $GroupID) {
@ -153,9 +166,9 @@
if ($Releases[$GroupID]['Importance'] == 1) {
$ReleaseTypeName = $ReleaseTypes[$Download['ReleaseType']];
} else if ($Releases[$GroupID]['Importance'] == 2) {
$ReleaseTypeName = "Guest Appearance";
$ReleaseTypeName = 'Guest Appearance';
} else if ($Releases[$GroupID]['Importance'] == 3) {
$ReleaseTypeName = "Remixed By";
$ReleaseTypeName = 'Remixed By';
}
$Collector->add_file($TorrentFile, $Download, $ReleaseTypeName);
unset($Download);

View File

@ -9,21 +9,39 @@
}
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE Label='Artist notifications' AND UserID='$LoggedUser[ID]' ORDER BY ID LIMIT 1");
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE Label = 'Artist notifications'
AND UserID = '$LoggedUser[ID]'
ORDER BY ID
LIMIT 1");
} else {
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE ID='$Notify[ID]'");
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE ID = '$Notify[ID]'");
}
list($ID,$Artists) = $DB->next_record(MYSQLI_NUM, FALSE);
$DB->query("SELECT Name FROM artists_alias WHERE ArtistID = '$ArtistID' AND Redirect=0");
while (list($Alias) = $DB->next_record(MYSQLI_NUM, FALSE)) {
while (stripos($Artists, '|'.$Alias.'|') !== false) {
$Artists = str_ireplace('|'.$Alias.'|', '|', $Artists);
list($ID, $Artists) = $DB->next_record(MYSQLI_NUM, false);
$DB->query("
SELECT Name
FROM artists_alias
WHERE ArtistID = '$ArtistID'
AND Redirect = 0");
while (list($Alias) = $DB->next_record(MYSQLI_NUM, false)) {
while (stripos($Artists, "|$Alias|") !== false) {
$Artists = str_ireplace("|$Alias|", '|', $Artists);
}
}
if ($Artists == '|') {
$DB->query("DELETE FROM users_notify_filters WHERE ID=$ID");
$DB->query("
DELETE FROM users_notify_filters
WHERE ID = $ID");
} else {
$DB->query("UPDATE users_notify_filters SET Artists='".db_string($Artists)."' WHERE ID='$ID'");
$DB->query("
UPDATE users_notify_filters
SET Artists = '".db_string($Artists)."'
WHERE ID = '$ID'");
}
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);

View File

@ -1,4 +1,4 @@
<?
<?php
/****************************************************************
*--------------[ Rename artist ]-----------------------------*
* This page handles the backend of the 'rename artist' *
@ -33,7 +33,10 @@
error(403);
}
$DB->query("SELECT Name FROM artists_group WHERE ArtistID='$ArtistID'");
$DB->query("
SELECT Name
FROM artists_group
WHERE ArtistID = '$ArtistID'");
if (!$DB->has_results()) {
error(404);
}
@ -61,31 +64,55 @@
if (!$TargetAliasID || $TargetAliasID == $OldAliasID) {
// no merge, just rename
$DB->query("
INSERT INTO artists_alias (ArtistID, Name, Redirect, UserID)
VALUES ($ArtistID, '".db_string($NewName)."', '0', '$LoggedUser[ID]')");
INSERT INTO artists_alias
(ArtistID, Name, Redirect, UserID)
VALUES
($ArtistID, '".db_string($NewName)."', '0', '$LoggedUser[ID]')");
$TargetAliasID = $DB->inserted_id();
$DB->query("UPDATE artists_alias SET Redirect='$TargetAliasID' WHERE AliasID='$OldAliasID'");
$DB->query("UPDATE artists_group SET Name='".db_string($NewName)."' WHERE ArtistID='$ArtistID'");
$DB->query("
UPDATE artists_alias
SET Redirect = '$TargetAliasID'
WHERE AliasID = '$OldAliasID'");
$DB->query("
UPDATE artists_group
SET Name = '".db_string($NewName)."'
WHERE ArtistID = '$ArtistID'");
$DB->query("SELECT GroupID FROM torrents_artists WHERE AliasID='$OldAliasID'");
$DB->query("
SELECT GroupID
FROM torrents_artists
WHERE AliasID = '$OldAliasID'");
$Groups = $DB->collect('GroupID');
$DB->query("UPDATE IGNORE torrents_artists SET AliasID='$TargetAliasID' WHERE AliasID='$OldAliasID'");
$DB->query("DELETE FROM torrents_artists WHERE AliasID='$OldAliasID'");
$DB->query("
UPDATE IGNORE torrents_artists
SET AliasID = '$TargetAliasID'
WHERE AliasID = '$OldAliasID'");
$DB->query("
DELETE FROM torrents_artists
WHERE AliasID = '$OldAliasID'");
if (!empty($Groups)) {
foreach ($Groups as $GroupID) {
$Cache->delete_value('groups_artists_'.$GroupID); // Delete group artist cache
$Cache->delete_value("groups_artists_$GroupID"); // Delete group artist cache
Torrents::update_hash($GroupID);
}
}
$DB->query("SELECT RequestID FROM requests_artists WHERE AliasID='$OldAliasID'");
$DB->query("
SELECT RequestID
FROM requests_artists
WHERE AliasID = '$OldAliasID'");
$Requests = $DB->collect('RequestID');
$DB->query("UPDATE IGNORE requests_artists SET AliasID='$TargetAliasID' WHERE AliasID='$OldAliasID'");
$DB->query("DELETE FROM requests_artists WHERE AliasID='$OldAliasID'");
$DB->query("
UPDATE IGNORE requests_artists
SET AliasID = '$TargetAliasID'
WHERE AliasID = '$OldAliasID'");
$DB->query("
DELETE FROM requests_artists
WHERE AliasID = '$OldAliasID'");
if (!empty($Requests)) {
foreach ($Requests as $RequestID) {
$Cache->delete_value('request_artists_'.$RequestID); // Delete request artist cache
$Cache->delete_value("request_artists_$RequestID"); // Delete request artist cache
Requests::update_sphinx_requests($RequestID);
}
}
@ -96,67 +123,98 @@
UPDATE artists_alias
SET Redirect = '$TargetAliasID', ArtistID = '$TargetArtistID'
WHERE AliasID = '$OldAliasID'");
$DB->query("UPDATE artists_alias SET Redirect='0' WHERE AliasID='$TargetAliasID'");
$DB->query("
UPDATE artists_alias
SET Redirect = '0'
WHERE AliasID = '$TargetAliasID'");
if ($ArtistID != $TargetArtistID) {
$DB->query("UPDATE artists_alias SET ArtistID='$TargetArtistID' WHERE ArtistID='$ArtistID'");
$DB->query("DELETE FROM artists_group WHERE ArtistID='$ArtistID'");
$DB->query("
UPDATE artists_alias
SET ArtistID = '$TargetArtistID'
WHERE ArtistID = '$ArtistID'");
$DB->query("
DELETE FROM artists_group
WHERE ArtistID = '$ArtistID'");
} else {
$DB->query("UPDATE artists_group SET Name='".db_string($NewName)."' WHERE ArtistID='$ArtistID'");
$DB->query("
UPDATE artists_group
SET Name = '".db_string($NewName)."'
WHERE ArtistID = '$ArtistID'");
}
$DB->query("SELECT GroupID FROM torrents_artists WHERE AliasID='$OldAliasID'");
$DB->query("
SELECT GroupID
FROM torrents_artists
WHERE AliasID = '$OldAliasID'");
$Groups = $DB->collect('GroupID');
$DB->query("
UPDATE IGNORE torrents_artists
SET AliasID = '$TargetAliasID', ArtistID = '$TargetArtistID'
WHERE AliasID = '$OldAliasID'");
$DB->query("DELETE FROM torrents_artists WHERE AliasID='$OldAliasID'");
$DB->query("
DELETE FROM torrents_artists
WHERE AliasID = '$OldAliasID'");
if (!empty($Groups)) {
foreach ($Groups as $GroupID) {
$Cache->delete_value('groups_artists_'.$GroupID);
$Cache->delete_value("groups_artists_$GroupID");
Torrents::update_hash($GroupID);
}
}
$DB->query("SELECT RequestID FROM requests_artists WHERE AliasID='$OldAliasID'");
$DB->query("
SELECT RequestID
FROM requests_artists
WHERE AliasID = '$OldAliasID'");
$Requests = $DB->collect('RequestID');
$DB->query("
UPDATE IGNORE requests_artists
SET AliasID = '$TargetAliasID', ArtistID = '$TargetArtistID'
WHERE AliasID = '$OldAliasID'");
$DB->query("DELETE FROM requests_artists WHERE AliasID='$OldAliasID'");
$DB->query("
DELETE FROM requests_artists
WHERE AliasID = '$OldAliasID'");
if (!empty($Requests)) {
foreach ($Requests as $RequestID) {
$Cache->delete_value('request_artists_'.$RequestID);
$Cache->delete_value("request_artists_$RequestID");
Requests::update_sphinx_requests($RequestID);
}
}
if ($ArtistID != $TargetArtistID) {
$DB->query("SELECT GroupID FROM torrents_artists WHERE ArtistID='$ArtistID'");
$DB->query("
SELECT GroupID
FROM torrents_artists
WHERE ArtistID = '$ArtistID'");
$Groups = $DB->collect('GroupID');
$DB->query("
UPDATE IGNORE torrents_artists
SET ArtistID = '$TargetArtistID'
WHERE ArtistID = '$ArtistID'");
$DB->query("DELETE FROM torrents_artists WHERE ArtistID='$ArtistID'");
$DB->query("
DELETE FROM torrents_artists
WHERE ArtistID = '$ArtistID'");
if (!empty($Groups)) {
foreach ($Groups as $GroupID) {
$Cache->delete_value('groups_artists_'.$GroupID);
$Cache->delete_value("groups_artists_$GroupID");
Torrents::update_hash($GroupID);
}
}
$DB->query("SELECT RequestID FROM requests_artists WHERE ArtistID='$ArtistID'");
$DB->query("
SELECT RequestID
FROM requests_artists
WHERE ArtistID = '$ArtistID'");
$Requests = $DB->collect('RequestID');
$DB->query("
UPDATE IGNORE requests_artists
SET ArtistID = '$TargetArtistID'
WHERE ArtistID = '$ArtistID'");
$DB->query("DELETE FROM requests_artists WHERE ArtistID='$ArtistID'");
$DB->query("
DELETE FROM requests_artists
WHERE ArtistID = '$ArtistID'");
if (!empty($Requests)) {
foreach ($Requests as $RequestID) {
$Cache->delete_value('request_artists_'.$RequestID);
$Cache->delete_value("request_artists_$RequestID");
Requests::update_sphinx_requests($RequestID);
}
}
@ -164,16 +222,19 @@
}
// Clear torrent caches
$DB->query("SELECT GroupID FROM torrents_artists WHERE ArtistID='$ArtistID'");
$DB->query("
SELECT GroupID
FROM torrents_artists
WHERE ArtistID = '$ArtistID'");
while (list($GroupID) = $DB->next_record()) {
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value("torrents_details_$GroupID");
}
$Cache->delete_value('artist_'.$ArtistID);
$Cache->delete_value('artist_'.$TargetArtistID);
$Cache->delete_value('artists_requests_'.$TargetArtistID);
$Cache->delete_value('artists_requests_'.$ArtistID);
$Cache->delete_value("artist_$ArtistID");
$Cache->delete_value("artist_$TargetArtistID");
$Cache->delete_value("artists_requests_$TargetArtistID");
$Cache->delete_value("artists_requests_$ArtistID");
header('Location: artist.php?id='.$TargetArtistID);
header("Location: artist.php?id=$TargetArtistID");
?>

View File

@ -5,26 +5,29 @@
error(403);
}
$UserID = $_GET['userid'];
$Sneaky = ($UserID != $LoggedUser['ID']);
$Sneaky = ($UserID !== $LoggedUser['ID']);
if (!is_number($UserID)) {
error(404);
}
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
$DB->query("
SELECT Username
FROM users_main
WHERE ID = '$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
}
$Sneaky = ($UserID != $LoggedUser['ID']);
$Sneaky = ($UserID !== $LoggedUser['ID']);
//$ArtistList = Bookmarks::all_bookmarks('artist', $UserID);
$DB->query('
$DB->query("
SELECT ag.ArtistID, ag.Name
FROM bookmarks_artists AS ba
INNER JOIN artists_group AS ag ON ba.ArtistID = ag.ArtistID
WHERE ba.UserID = '.$UserID.'
ORDER BY ag.Name');
WHERE ba.UserID = $UserID
ORDER BY ag.Name");
$ArtistList = $DB->to_array();
@ -59,7 +62,7 @@
<?
$Row = 'a';
foreach ($ArtistList as $Artist) {
$Row = ($Row == 'a') ? 'b' : 'a';
$Row = ($Row === 'a') ? 'b' : 'a';
list($ArtistID, $Name) = $Artist;
?>
<tr class="row<?=$Row?> bookmark_<?=$ArtistID?>">
@ -78,7 +81,7 @@
$Notify = $DB->next_record(MYSQLI_ASSOC);
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
}
if (stripos($Notify['Artists'], '|'.$Name.'|') === false) {
if (stripos($Notify['Artists'], "|$Name|") === false) {
?>
<a href="artist.php?action=notify&amp;artistid=<?=$ArtistID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Notify of new uploads</a>
<?

View File

@ -8,7 +8,10 @@
if (!is_number($UserID)) {
error(404);
}
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
$DB->query("
SELECT Username
FROM users_main
WHERE ID = '$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];

View File

@ -24,10 +24,22 @@
case 'remove_snatched':
authorize();
$DB->query("CREATE TEMPORARY TABLE snatched_groups_temp (GroupID int PRIMARY KEY)");
$DB->query("INSERT INTO snatched_groups_temp SELECT DISTINCT GroupID FROM torrents AS t JOIN xbt_snatched AS s ON s.fid=t.ID WHERE s.uid='$LoggedUser[ID]'");
$DB->query("DELETE b FROM bookmarks_torrents AS b JOIN snatched_groups_temp AS s USING(GroupID) WHERE b.UserID='$LoggedUser[ID]'");
$Cache->delete_value('bookmarks_group_ids_' . $UserID);
$DB->query("
CREATE TEMPORARY TABLE snatched_groups_temp
(GroupID int PRIMARY KEY)");
$DB->query("
INSERT INTO snatched_groups_temp
SELECT DISTINCT GroupID
FROM torrents AS t
JOIN xbt_snatched AS s ON s.fid = t.ID
WHERE s.uid = '$LoggedUser[ID]'");
$DB->query("
DELETE b
FROM bookmarks_torrents AS b
JOIN snatched_groups_temp AS s
USING(GroupID)
WHERE b.UserID = '$LoggedUser[ID]'");
$Cache->delete_value("bookmarks_group_ids_$UserID");
header('Location: bookmarks.php');
die();
break;
@ -40,11 +52,11 @@
case 'torrents':
require(SERVER_ROOT.'/sections/bookmarks/edit_torrents.php');
break;
default : error(404);
default:
error(404);
}
break;
case 'view':
if (empty($_REQUEST['type'])) {
$_REQUEST['type'] = 'torrents';
@ -57,7 +69,7 @@
require(SERVER_ROOT.'/sections/bookmarks/artists.php');
break;
case 'collages':
$_GET['bookmarks'] = 1;
$_GET['bookmarks'] = '1';
require(SERVER_ROOT.'/sections/collages/browse.php');
break;
case 'requests':
@ -68,6 +80,7 @@
error(404);
}
break;
default:
error(404);
}

View File

@ -1,4 +1,4 @@
<?
<?php
authorize();
if (!Bookmarks::can_bookmark($_GET['type'])) {
@ -17,12 +17,15 @@
DELETE FROM $Table
WHERE UserID = '".$LoggedUser['ID']."'
AND $Col = '".db_string($_GET['id'])."'");
$Cache->delete_value('bookmarks_'.$Type.'_'.$UserID);
$Cache->delete_value("bookmarks_$Type"."_$UserID");
if ($Type === 'torrent') {
$Cache->delete_value('bookmarks_group_ids_' . $UserID);
$Cache->delete_value("bookmarks_group_ids_$UserID");
} elseif ($Type === 'request') {
$DB->query("SELECT UserID FROM $Table WHERE $Col='".db_string($_GET['id'])."'");
$DB->query("
SELECT UserID
FROM $Table
WHERE $Col = '".db_string($_GET['id'])."'");
$Bookmarkers = $DB->collect('UserID');
$SS->UpdateAttributes('requests requests_delta', array('bookmarker'), array($_GET['id'] => array($Bookmarkers)), true);
}

View File

@ -1,4 +1,4 @@
<?
<?php
ini_set('max_execution_time', 600);
set_time_limit(0);
@ -16,13 +16,16 @@ function compare($X, $Y) {
if (!is_number($UserID)) {
error(404);
}
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
$DB->query("
SELECT Username
FROM users_main
WHERE ID = '$UserID'");
list($Username) = $DB->next_record();
} else {
$UserID = $LoggedUser['ID'];
}
$Sneaky = $UserID != $LoggedUser['ID'];
$Sneaky = $UserID !== $LoggedUser['ID'];
$Title = $Sneaky ? "$Username's bookmarked torrents" : 'Your bookmarked torrents';
// Loop through the result set, building up $Collage and $TorrentTable
@ -64,7 +67,7 @@ function compare($X, $Y) {
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if ($GroupYear > 0) {
$DisplayName = $DisplayName . " [$GroupYear]";
$DisplayName = "$DisplayName [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
@ -75,12 +78,12 @@ function compare($X, $Y) {
ob_start();
if (count($Torrents) > 1 || $GroupCategoryID == 1) {
// Grouped torrents
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1);
?>
<tr class="group discog<?=$SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collape all groups on this page."></a>
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event);" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collape all groups on this page."></a>
</div>
</td>
<td class="center">
@ -115,12 +118,17 @@ function compare($X, $Y) {
}
$SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
if ($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
if (
$Torrent['RemasterTitle'] != $LastRemasterTitle
|| $Torrent['RemasterYear'] != $LastRemasterYear
|| $Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel
|| $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber
|| $FirstUnknown
|| $Torrent['Media'] != $LastMedia
) {
$EditionID++;
?>
<tr class="group_torrent groupid_<?=$GroupID?> edition<?=$SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
<tr class="group_torrent groupid_<?=$GroupID?> edition<?=$SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1 ? ' hidden' : '')?>">
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=Torrents::edition_string($Torrent, $Group)?></strong></td>
</tr>
<?
@ -131,7 +139,7 @@ function compare($X, $Y) {
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
?>
<tr class="group_torrent torrent_row groupid_<?=$GroupID?> edition_<?=$EditionID?><?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
<tr class="group_torrent torrent_row groupid_<?=$GroupID?> edition_<?=$EditionID?><?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1 ? ' hidden' : '')?>">
<td colspan="3">
<span>[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
<? if (Torrents::can_use_token($Torrent)) { ?>
@ -158,9 +166,9 @@ function compare($X, $Y) {
if ($Torrent['IsSnatched']) {
$DisplayName .= ' ' . Format::torrent_label('Snatched!');
}
if ($Torrent['FreeTorrent'] == '1') {
if ($Torrent['FreeTorrent'] === '1') {
$DisplayName .= ' ' . Format::torrent_label('Freeleech!');
} elseif ($Torrent['FreeTorrent'] == '2') {
} elseif ($Torrent['FreeTorrent'] === '2') {
$DisplayName .= ' ' . Format::torrent_label('Neutral leech!');
} elseif ($Torrent['PersonalFL']) {
$DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
@ -212,7 +220,7 @@ function compare($X, $Y) {
}
$DisplayName .= $GroupName;
if ($GroupYear > 0) {
$DisplayName = $DisplayName . " [$GroupYear]";
$DisplayName = "$DisplayName [$GroupYear]";
}
?>
<li class="image_group_<?=$GroupID?>">
@ -229,7 +237,7 @@ function compare($X, $Y) {
}
$CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25;
$CollageCovers = isset($LoggedUser['CollageCovers']) ? (int)$LoggedUser['CollageCovers'] : 25;
$CollagePages = array();
for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
$Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
@ -257,7 +265,7 @@ function compare($X, $Y) {
<? } ?>
</div>
</div>
<? if (count($TorrentList) == 0) { ?>
<? if (count($TorrentList) === 0) { ?>
<div class="box pad" align="center">
<h2>You have not bookmarked any torrents.</h2>
</div>
@ -271,7 +279,9 @@ function compare($X, $Y) {
<div class="head"><strong>Stats</strong></div>
<ul class="stats nobullet">
<li>Torrents: <?=$NumGroups?></li>
<? if (count($ArtistCount) > 0) { ?> <li>Artists: <?=count($ArtistCount)?></li> <? } ?>
<? if (count($ArtistCount) > 0) { ?>
<li>Artists: <?=count($ArtistCount)?></li>
<? } ?>
</ul>
</div>
<div class="box box_tags">
@ -305,7 +315,7 @@ function compare($X, $Y) {
</div>
<div class="main_column">
<?
if ($CollageCovers != 0) { ?>
if ($CollageCovers !== 0) { ?>
<div id="coverart" class="box">
<div class="head" id="coverhead"><strong>Cover art</strong></div>
<ul class="collage_images" id="collage_page0">
@ -321,11 +331,11 @@ function compare($X, $Y) {
<span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;">&lt;&lt; First</a> | </span>
<span id="prevpage" class="invisible"><a href="#" id="prevpage" class="pageslink" onclick="collageShow.prevPage(); return false;">&lt; Prev</a> | </span>
<? for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? ' selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><?=($CollageCovers * $i + 1)?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></a><?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?></span>
<span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i === 0) ? ' selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><?=($CollageCovers * $i + 1)?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></a><?=(($i !== ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?></span>
<? } ?>
<span id="nextbar" class="<?=(($NumGroups / $CollageCovers > 5) ? 'hidden' : '')?>"> | </span>
<span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;">Next &gt;</a></span>
<span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>"> | <a href="#" id="lastpage" class="pageslink" onclick="collageShow.page(<?=(ceil($NumGroups / $CollageCovers) - 1)?>, this); return false;">Last &gt;&gt;</a></span>
<span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) === 2 ? 'invisible' : '')?>"> | <a href="#" id="lastpage" class="pageslink" onclick="collageShow.page(<?=(ceil($NumGroups / $CollageCovers) - 1)?>, this); return false;">Last &gt;&gt;</a></span>
</div>
<script type="text/javascript">
collageShow.init(<?=json_encode($CollagePages)?>);

View File

@ -23,7 +23,11 @@
$NumComments = Collages::get_comment_count($CollageID);
if (isset($_GET['postid']) && is_number($_GET['postid']) && $NumComments > TORRENT_COMMENTS_PER_PAGE) {
$DB->query("SELECT COUNT(ID) FROM collages_comments WHERE CollageID = $CollageID AND ID <= $_GET[postid]");
$DB->query("
SELECT COUNT(ID)
FROM collages_comments
WHERE CollageID = $CollageID
AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record();
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $PostNum);
} else {
@ -42,11 +46,14 @@
//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);
$DB->query("SELECT Name FROM collages WHERE ID='$CollageID'");
$DB->query("
SELECT Name
FROM collages
WHERE ID = '$CollageID'");
list($Name) = $DB->next_record();
// Start printing
View::show_header('Comments for collage '.$Name, 'comments,bbcode');
View::show_header("Comments for collage $Name", 'comments,bbcode');
?>
<div class="thin">
<div class="header">
@ -80,7 +87,7 @@
<span style="float: left;"><a href="#post<?=$PostID?>">#<?=$PostID?></a>
<?=Users::format_username($AuthorID, true, true, true, true, true)?> <?=time_diff($AddedTime)?>
<? if (!$ThreadInfo['IsLocked']) { ?> - <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a><? }
if ($AuthorID == $LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>');" class="brackets">Edit</a><? }
if ($AuthorID === $LoggedUser['ID'] || check_perms('site_moderate_forums')) { ?> - <a href="#post<?=$PostID?>" onclick="Edit_Form('<?=$PostID?>');" class="brackets">Edit</a><? }
if (check_perms('site_moderate_forums')) { ?> - <a href="#post<?=$PostID?>" onclick="Delete('<?=$PostID?>');" class="brackets">Delete</a> <? } ?>
</span>
<span id="bar<?=$PostID?>" style="float: right;">
@ -102,7 +109,8 @@
</td>
</tr>
</table>
<? }
<?
}
if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
if ($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {

View File

@ -95,7 +95,7 @@
$SQL .= "%'";
}
if (isset($_GET['tags_type']) && $_GET['tags_type'] == 0) { // Any
if (isset($_GET['tags_type']) && $_GET['tags_type'] === '0') { // Any
$_GET['tags_type'] = 0;
} else { // All
$_GET['tags_type'] = 1;
@ -103,7 +103,7 @@
if (!empty($Tags)) {
$SQL.= " AND (TagList LIKE '%";
if ($_GET['tags_type'] == 0) {
if ($_GET['tags_type'] === '0') {
$SQL .= implode("%' OR TagList LIKE '%", $Tags);
} else {
$SQL .= implode("%' AND TagList LIKE '%", $Tags);
@ -125,12 +125,15 @@
if (!check_paranoia('collagecontribs', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$DB->query("SELECT DISTINCT CollageID FROM collages_torrents WHERE UserID = $UserID");
$DB->query("
SELECT DISTINCT CollageID
FROM collages_torrents
WHERE UserID = $UserID");
$CollageIDs = $DB->collect('CollageID');
if (empty($CollageIDs)) {
$SQL .= " AND 0";
} else {
$SQL .= " AND c.ID IN(".db_string(implode(',', $CollageIDs)).")";
$SQL .= " AND c.ID IN(".db_string(implode(',', $CollageIDs)).')';
}
} else {
if (!check_paranoia('collages', $User['Paranoia'], $UserClass, $UserID)) {
@ -145,7 +148,7 @@
$SQL .= " AND CategoryID IN(".db_string(implode(',', $Categories)).')';
}
if ($_GET['action'] == 'mine') {
if ($_GET['action'] === 'mine') {
$SQL = $BaseSQL;
$SQL .= "
AND c.UserID = '".$LoggedUser['ID']."'
@ -201,8 +204,8 @@
<tr id="search_name_description">
<td class="label">Search in:</td>
<td>
<input type="radio" name="type" value="c.name" <? if ($Type == 'c.name') { echo 'checked="checked" '; } ?>/> Names&nbsp;&nbsp;
<input type="radio" name="type" value="description" <? if ($Type == 'description') { echo 'checked="checked" '; } ?>/> Descriptions
<input type="radio" name="type" value="c.name" <? if ($Type === 'c.name') { echo 'checked="checked" '; } ?>/> Names&nbsp;&nbsp;
<input type="radio" name="type" value="description" <? if ($Type === 'description') { echo 'checked="checked" '; } ?>/> Descriptions
</td>
</tr>
<tr id="order_by">
@ -210,12 +213,12 @@
<td>
<select name="order_by" class="ft_order_by">
<? foreach ($OrderVals as $Cur) { ?>
<option value="<?=$Cur?>"<? if (isset($_GET['order_by']) && $_GET['order_by'] == $Cur || (!isset($_GET['order_by']) && $Cur == 'Time')) { echo ' selected="selected"'; } ?>><?=$Cur?></option>
<option value="<?=$Cur?>"<? if (isset($_GET['order_by']) && $_GET['order_by'] === $Cur || (!isset($_GET['order_by']) && $Cur === 'Time')) { echo ' selected="selected"'; } ?>><?=$Cur?></option>
<? } ?>
</select>
<select name="order_way" class="ft_order_way">
<? foreach ($WayVals as $Cur) { ?>
<option value="<?=$Cur?>"<? if (isset($_GET['order_way']) && $_GET['order_way'] == $Cur || (!isset($_GET['order_way']) && $Cur == 'Descending')) { echo ' selected="selected"'; } ?>><?=$Cur?></option>
<option value="<?=$Cur?>"<? if (isset($_GET['order_way']) && $_GET['order_way'] === $Cur || (!isset($_GET['order_way']) && $Cur === 'Descending')) { echo ' selected="selected"'; } ?>><?=$Cur?></option>
<? } ?>
</select>
</td>
@ -244,7 +247,7 @@
AND Deleted = '0'");
$CollageCount = $DB->record_count();
if ($CollageCount == 1) {
if ($CollageCount === 1) {
list($CollageID) = $DB->next_record();
?>
<a href="collages.php?id=<?=$CollageID?>" class="brackets">Personal collage</a>
@ -278,7 +281,7 @@
echo $Pages;
?>
</div>
<? if (count($Collages) == 0) { ?>
<? if (count($Collages) === 0) { ?>
<div class="box pad" align="center">
<? if ($BookmarkView) { ?>
<h2>You have not bookmarked any collages.</h2>
@ -304,7 +307,7 @@
$Row = 'a'; // For the pretty colours
foreach ($Collages as $Collage) {
list($ID, $Name, $NumTorrents, $TagList, $CategoryID, $UserID, $Subscribers, $Updated) = $Collage;
$Row = ($Row == 'a') ? 'b' : 'a';
$Row = ($Row === 'a') ? 'b' : 'a';
$TorrentTags = new Tags($TagList);
//Print results

View File

@ -1,4 +1,4 @@
<?
<?php
ini_set('max_execution_time', 600);
//~~~~~~~~~~~ Main collage page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
@ -18,12 +18,15 @@ function compare($X, $Y) {
error(0);
}
$Data = $Cache->get_value('collage_'.$CollageID);
$Data = $Cache->get_value("collage_$CollageID");
if ($Data) {
list($K, list($Name, $Description, , , $CommentList, $Deleted, $CollageCategoryID, $CreatorID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers)) = each($Data);
} else {
$DB->query("SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser, Updated, Subscribers FROM collages WHERE ID='$CollageID'");
$DB->query("
SELECT Name, Description, UserID, Deleted, CategoryID, Locked, MaxGroups, MaxGroupsPerUser, Updated, Subscribers
FROM collages
WHERE ID = '$CollageID'");
if ($DB->has_results()) {
list($Name, $Description, $CreatorID, $Deleted, $CollageCategoryID, $Locked, $MaxGroups, $MaxGroupsPerUser, $Updated, $Subscribers) = $DB->next_record();
$TorrentList = '';
@ -33,20 +36,23 @@ function compare($X, $Y) {
}
}
if ($Deleted == '1') {
header('Location: log.php?search=Collage+'.$CollageID);
if ($Deleted === '1') {
header("Location: log.php?search=Collage+$CollageID");
die();
}
if ($CollageCategoryID == 0 && !check_perms('site_collages_delete')) {
if (!check_perms('site_collages_personal') || $CreatorID != $LoggedUser['ID']) {
if ($CollageCategoryID === '0' && !check_perms('site_collages_delete')) {
if (!check_perms('site_collages_personal') || $CreatorID !== $LoggedUser['ID']) {
$PreventAdditions = true;
}
}
//Handle subscriptions
if (($CollageSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) === false) {
$DB->query("SELECT CollageID FROM users_collage_subs WHERE UserID = '$LoggedUser[ID]'");
$DB->query("
SELECT CollageID
FROM users_collage_subs
WHERE UserID = '$LoggedUser[ID]'");
$CollageSubscriptions = $DB->collect(0);
$Cache->cache_value('collage_subs_user_'.$LoggedUser['ID'], $CollageSubscriptions, 0);
}
@ -58,9 +64,13 @@ function compare($X, $Y) {
if (in_array($CollageID, $CollageSubscriptions)) {
$Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']);
}
$DB->query("UPDATE users_collage_subs SET LastVisit=NOW() WHERE UserID = ".$LoggedUser['ID']." AND CollageID=$CollageID");
$DB->query("
UPDATE users_collage_subs
SET LastVisit = NOW()
WHERE UserID = ".$LoggedUser['ID']."
AND CollageID = $CollageID");
if ($CollageCategoryID == array_search(ARTIST_COLLAGE, $CollageCats)) {
if ($CollageCategoryID === array_search(ARTIST_COLLAGE, $CollageCats)) {
include(SERVER_ROOT.'/sections/collages/artist_collage.php');
} else {
include(SERVER_ROOT.'/sections/collages/torrent_collage.php');

View File

@ -18,24 +18,31 @@
// Get number of pages
// $Pages = number of pages in the thread
// $Page = which page the post is on
$DB->query("SELECT
$DB->query("
SELECT
CollageID,
CEIL(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Pages,
CEIL(SUM(IF(ID <= '$PostID', 1, 0)) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page
FROM collages_comments
WHERE CollageID=(SELECT CollageID FROM collages_comments WHERE ID='$PostID')
WHERE CollageID = (
SELECT CollageID
FROM collages_comments
WHERE ID = '$PostID'
)
GROUP BY CollageID");
list($CollageID, $Pages, $Page) = $DB->next_record();
$DB->query("DELETE FROM collages_comments WHERE ID='$PostID'");
$DB->query("
DELETE FROM collages_comments
WHERE ID = '$PostID'");
$Cache->delete_value('collage_'.$CollageID);
$Cache->increment_value('collage_comments_'.$CollageID, -1);
$Cache->delete_value("collage_$CollageID");
$Cache->increment_value("collage_comments_$CollageID", -1);
//We need to clear all subsequential catalogues as they've all been bumped with the absence of this post
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
$Cache->delete_value('collage_comments_'.$CollageID.'_catalogue_'.$i);
$Cache->delete_value("collage_comments_$CollageID"."_catalogue_$i");
}
?>

View File

@ -26,8 +26,10 @@
SQL template:
SELECT
CASE
WHEN t.Format='MP3' AND t.Encoding='V0 (VBR)' THEN 1
WHEN t.Format='MP3' AND t.Encoding='V2 (VBR)' THEN 2
WHEN t.Format = 'MP3' AND t.Encoding = 'V0 (VBR)'
THEN 1
WHEN t.Format = 'MP3' AND t.Encoding = 'V2 (VBR)'
THEN 2
ELSE 100
END AS Rank,
t.GroupID,
@ -47,12 +49,12 @@
*/
if (
!isset($_REQUEST['collageid']) ||
!isset($_REQUEST['preference']) ||
!is_number($_REQUEST['preference']) ||
!is_number($_REQUEST['collageid']) ||
$_REQUEST['preference'] > 2 ||
count($_REQUEST['list']) == 0
!isset($_REQUEST['collageid'])
|| !isset($_REQUEST['preference'])
|| !is_number($_REQUEST['preference'])
|| !is_number($_REQUEST['collageid'])
|| $_REQUEST['preference'] > 2
|| count($_REQUEST['list']) === 0
) {
error(0);
}
@ -66,16 +68,19 @@
$CollageID = $_REQUEST['collageid'];
$Preference = $Preferences[$_REQUEST['preference']];
$DB->query("SELECT Name FROM collages WHERE ID='$CollageID'");
$DB->query("
SELECT Name
FROM collages
WHERE ID = '$CollageID'");
list($CollageName) = $DB->next_record(MYSQLI_NUM, false);
$SQL = "SELECT CASE ";
$SQL = 'SELECT CASE ';
foreach ($_REQUEST['list'] as $Priority => $Selection) {
if (!is_number($Priority)) {
continue;
}
$SQL .= "WHEN ";
$SQL .= 'WHEN ';
switch ($Selection) {
case '00': $SQL .= "t.Format = 'MP3' AND t.Encoding = 'V0 (VBR)'"; break;
case '01': $SQL .= "t.Format = 'MP3' AND t.Encoding = 'APX (VBR)'"; break;
@ -107,7 +112,9 @@
}
$SQL .= " THEN $Priority ";
}
$SQL .= "ELSE 100 END AS Rank,
$SQL .= "
ELSE 100
END AS Rank,
t.GroupID,
t.ID AS TorrentID,
t.Media,
@ -126,7 +133,10 @@
while (list($Downloads, $GroupIDs) = $Collector->get_downloads('GroupID')) {
$Artists = Artists::get_artists($GroupIDs);
$TorrentFilesQ = $DB->query("SELECT TorrentID, File FROM torrents_files WHERE TorrentID IN (".implode(',', array_keys($GroupIDs)).")", false);
$TorrentFilesQ = $DB->query("
SELECT TorrentID, File
FROM torrents_files
WHERE TorrentID IN (".implode(',', array_keys($GroupIDs)).')', false);
if (is_int($TorrentFilesQ)) {
// Query failed. Let's not create a broken zip archive
foreach ($GroupIDs as $GroupID) {

View File

@ -4,12 +4,15 @@
error(0);
}
$DB->query("SELECT Name, UserID, CategoryID FROM collages WHERE ID='$CollageID'");
$DB->query("
SELECT Name, UserID, CategoryID
FROM collages
WHERE ID = '$CollageID'");
list($Name, $UserID, $CategoryID) = $DB->next_record();
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
if ($CategoryID === '0' && $UserID !== $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
if ($CategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) {
if ($CategoryID !== array_search(ARTIST_COLLAGE, $CollageCats)) {
error(403);
}
@ -29,7 +32,7 @@
$Artists = $DB->to_array('ArtistID', MYSQLI_ASSOC);
View::show_header('Manage collage '.$Name, 'jquery-ui,jquery.tablesorter.min,sort');
View::show_header("Manage collage $Name", 'jquery-ui,jquery.tablesorter.min,sort');
?>
@ -54,7 +57,7 @@
</table>
<div class="drag_drop_save hidden">
<input type="button" name="submit" value="Save All Changes" title="Save your changes." class="save_sortable_collage" />
<input type="button" name="submit" value="Save All Changes" title="Save your changes" class="save_sortable_collage" />
</div>
<table id="manage_collage_table">
<thead>
@ -68,7 +71,6 @@
</thead>
<tbody>
<?
$Number = 0;
foreach ($Artists as $Artist) {
$Number++;

View File

@ -7,12 +7,15 @@
error(404);
}
$DB->query("SELECT UserID, CategoryID FROM collages WHERE ID='$CollageID'");
$DB->query("
SELECT UserID, CategoryID
FROM collages
WHERE ID = '$CollageID'");
list($UserID, $CategoryID) = $DB->next_record();
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
if ($CategoryID === '0' && $UserID !== $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
if ($CategoryID != array_search(ARTIST_COLLAGE, $CollageCats)) {
if ($CategoryID !== array_search(ARTIST_COLLAGE, $CollageCats)) {
error(403);
}
@ -21,12 +24,18 @@
error(404);
}
if ($_POST['submit'] == 'Remove') {
$DB->query("DELETE FROM collages_artists WHERE CollageID='$CollageID' AND ArtistID='$ArtistID'");
if ($_POST['submit'] === 'Remove') {
$DB->query("
DELETE FROM collages_artists
WHERE CollageID = '$CollageID'
AND ArtistID = '$ArtistID'");
$Rows = $DB->affected_rows();
$DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'");
$Cache->delete_value('artists_collages_'.$ArtistID);
$Cache->delete_value('artists_collages_personal_'.$ArtistID);
$DB->query("
UPDATE collages
SET NumTorrents = NumTorrents - $Rows
WHERE ID = '$CollageID'");
$Cache->delete_value("artists_collages_$ArtistID");
$Cache->delete_value("artists_collages_personal_$ArtistID");
} elseif (isset($_POST['drag_drop_collage_sort_order'])) {
@parse_str($_POST['drag_drop_collage_sort_order'], $Series);
@ -40,9 +49,12 @@
}
}
$SQL = 'INSERT INTO collages_artists (ArtistID, Sort, CollageID) VALUES '
. implode(', ', $SQL)
. ' ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
$SQL = '
INSERT INTO collages_artists
(ArtistID, Sort, CollageID)
VALUES
' . implode(', ', $SQL) . '
ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
$DB->query($SQL);
}
@ -59,5 +71,5 @@
AND ArtistID = '$ArtistID'");
}
$Cache->delete_value('collage_'.$CollageID);
header('Location: collages.php?action=manage_artists&collageid='.$CollageID);
$Cache->delete_value("collage_$CollageID");
header("Location: collages.php?action=manage_artists&collageid=$CollageID");

View File

@ -7,9 +7,12 @@
error(404);
}
$DB->query("SELECT UserID, CategoryID FROM collages WHERE ID='$CollageID'");
$DB->query("
SELECT UserID, CategoryID
FROM collages
WHERE ID = '$CollageID'");
list($UserID, $CategoryID) = $DB->next_record();
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
if ($CategoryID === '0' && $UserID !== $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
@ -19,13 +22,19 @@
error(404);
}
if ($_POST['submit'] == 'Remove') {
$DB->query("DELETE FROM collages_torrents WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
if ($_POST['submit'] === 'Remove') {
$DB->query("
DELETE FROM collages_torrents
WHERE CollageID = '$CollageID'
AND GroupID = '$GroupID'");
$Rows = $DB->affected_rows();
$DB->query("UPDATE collages SET NumTorrents=NumTorrents-$Rows WHERE ID='$CollageID'");
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_collages_'.$GroupID);
$Cache->delete_value('torrent_collages_personal_'.$GroupID);
$DB->query("
UPDATE collages
SET NumTorrents = NumTorrents - $Rows
WHERE ID = '$CollageID'");
$Cache->delete_value("torrents_details_$GroupID");
$Cache->delete_value("torrent_collages_$GroupID");
$Cache->delete_value("torrent_collages_personal_$GroupID");
} elseif (isset($_POST['drag_drop_collage_sort_order'])) {
@parse_str($_POST['drag_drop_collage_sort_order'], $Series);
@ -39,9 +48,12 @@
}
}
$SQL = 'INSERT INTO collages_torrents (GroupID, Sort, CollageID) VALUES '
. implode(', ', $SQL)
. ' ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
$SQL = '
INSERT INTO collages_torrents
(GroupID, Sort, CollageID)
VALUES
' . implode(', ', $SQL) . '
ON DUPLICATE KEY UPDATE Sort = VALUES (Sort)';
$DB->query($SQL);
}
@ -51,8 +63,12 @@
if (!is_number($Sort)) {
error(404);
}
$DB->query("UPDATE collages_torrents SET Sort='$Sort' WHERE CollageID='$CollageID' AND GroupID='$GroupID'");
$DB->query("
UPDATE collages_torrents
SET Sort = '$Sort'
WHERE CollageID = '$CollageID'
AND GroupID = '$GroupID'");
}
$Cache->delete_value('collage_'.$CollageID);
header('Location: collages.php?action=manage&collageid='.$CollageID);
$Cache->delete_value("collage_$CollageID");
header("Location: collages.php?action=manage&collageid=$CollageID");

View File

@ -1,4 +1,4 @@
<?
<?php
authorize();
include(SERVER_ROOT.'/classes/validate.class.php');
@ -13,11 +13,17 @@
// Get a collage name and make sure it's unique
$name = $LoggedUser['Username']."'s personal collage";
$P['name'] = db_string($name);
$DB->query("SELECT ID FROM collages WHERE Name='".$P['name']."'");
$DB->query("
SELECT ID
FROM collages
WHERE Name = '".$P['name']."'");
$i = 2;
while ($DB->has_results()) {
$P['name'] = db_string($name." no. $i");
$DB->query("SELECT ID FROM collages WHERE Name='".$P['name']."'");
$P['name'] = db_string("$name no. $i");
$DB->query("
SELECT ID
FROM collages
WHERE Name = '".$P['name']."'");
$i++;
}
}
@ -25,8 +31,13 @@
$Err = $Val->ValidateForm($_POST);
if ($P['category'] == '0') {
$DB->query("SELECT COUNT(ID) FROM collages WHERE UserID='$LoggedUser[ID]' AND CategoryID='0' AND Deleted='0'");
if ($P['category'] === '0') {
$DB->query("
SELECT COUNT(ID)
FROM collages
WHERE UserID = '$LoggedUser[ID]'
AND CategoryID = '0'
AND Deleted = '0'");
list($CollageCount) = $DB->next_record();
if (($CollageCount >= $LoggedUser['Permissions']['MaxCollages']) || !check_perms('site_collages_personal')) {
$Err = 'You may not create a personal collage.';
@ -36,11 +47,14 @@
}
if (!$Err) {
$DB->query("SELECT ID,Deleted FROM collages WHERE Name='$P[name]'");
$DB->query("
SELECT ID, Deleted
FROM collages
WHERE Name = '$P[name]'");
if ($DB->has_results()) {
list($ID, $Deleted) = $DB->next_record();
if ($Deleted) {
$Err = "That collection already exists but needs to be recovered; please <a href=\"staffpm.php\">contact</a> the staff team!";
$Err = 'That collection already exists but needs to be recovered; please <a href="staffpm.php">contact</a> the staff team!';
} else {
$Err = "That collection already exists: <a href=\"/collages.php?id=$ID\">$ID</a>.";
}
@ -70,14 +84,14 @@
}
$TagList = implode(' ', $TagList);
$DB->query("INSERT INTO collages
$DB->query("
INSERT INTO collages
(Name, Description, UserID, TagList, CategoryID)
VALUES
('$P[name]', '$P[description]', $LoggedUser[ID], '$TagList', '$P[category]')");
$CollageID = $DB->inserted_id();
$Cache->delete_value('collage_'.$CollageID);
Misc::write_log("Collage ".$CollageID." (".$_POST['name'].") was created by ".$LoggedUser['Username']);
header('Location: collages.php?id='.$CollageID);
$Cache->delete_value("collage_$CollageID");
Misc::write_log("Collage $CollageID (".$_POST['name'].') was created by '.$LoggedUser['Username']);
header("Location: collages.php?id=$CollageID");
?>

View File

@ -7,10 +7,13 @@
error(404);
}
$DB->query("SELECT Name, CategoryID, UserID FROM collages WHERE ID='$CollageID'");
$DB->query("
SELECT Name, CategoryID, UserID
FROM collages
WHERE ID = '$CollageID'");
list($Name, $CategoryID, $UserID) = $DB->next_record(MYSQLI_NUM, false);
if (!check_perms('site_collages_delete') && $UserID != $LoggedUser['ID']) {
if (!check_perms('site_collages_delete') && $UserID !== $LoggedUser['ID']) {
error(403);
}
@ -19,23 +22,35 @@
error('You must enter a reason!');
}
$DB->query("SELECT GroupID FROM collages_torrents WHERE CollageID='$CollageID'");
$DB->query("
SELECT GroupID
FROM collages_torrents
WHERE CollageID = '$CollageID'");
while (list($GroupID) = $DB->next_record()) {
$Cache->delete_value('torrents_details_'.$GroupID);
$Cache->delete_value('torrent_collages_'.$GroupID);
$Cache->delete_value('torrent_collages_personal_'.$GroupID);
$Cache->delete_value("torrents_details_$GroupID");
$Cache->delete_value("torrent_collages_$GroupID");
$Cache->delete_value("torrent_collages_personal_$GroupID");
}
//Personal collages have CategoryID 0
if ($CategoryID == 0) {
$DB->query("DELETE FROM collages WHERE ID='$CollageID'");
$DB->query("DELETE FROM collages_torrents WHERE CollageID='$CollageID'");
$DB->query("DELETE FROM collages_comments WHERE CollageID='$CollageID'");
if ($CategoryID === '0') {
$DB->query("
DELETE FROM collages
WHERE ID = '$CollageID'");
$DB->query("
DELETE FROM collages_torrents
WHERE CollageID = '$CollageID'");
$DB->query("
DELETE FROM collages_comments
WHERE CollageID = '$CollageID'");
} else {
$DB->query("UPDATE collages SET Deleted = '1' WHERE ID='$CollageID'");
$DB->query("
UPDATE collages
SET Deleted = '1'
WHERE ID = '$CollageID'");
}
Misc::write_log("Collage $CollageID ($Name) was deleted by ".$LoggedUser['Username'].': '.$Reason);
Misc::write_log("Collage $CollageID ($Name) was deleted by ".$LoggedUser['Username'].": $Reason");
$Cache->delete_value('collage_'.$CollageID);
$Cache->delete_value("collage_$CollageID");
header('Location: collages.php');

View File

@ -33,7 +33,7 @@
LIMIT $Limit";
$Log = $DB->query($sql);
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($NumResults) = $DB->next_record();
$TotalMatches = $NumResults;
$DB->set_query_id($Log);

View File

@ -28,7 +28,7 @@
$DB->query($sql);
$Donations = $DB->to_array(false,MYSQLI_NUM);
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();
if (empty($_GET['search']) && !isset($_GET['page']) && !$DonationTimeline = $Cache->get_value('donation_timeline')) {

View File

@ -9,7 +9,9 @@
if (!empty($_POST['invitekey']) && check_perms('users_edit_invites')) {
authorize();
$DB->query("DELETE FROM invites WHERE InviteKey='".db_string($_POST['invitekey'])."'");
$DB->query("
DELETE FROM invites
WHERE InviteKey = '".db_string($_POST['invitekey'])."'");
}
if (!empty($_GET['search'])) {
@ -29,12 +31,15 @@
FROM invites as i
JOIN users_main AS um ON um.ID = i.InviterID ";
if ($Search) {
$sql .= "WHERE i.Email LIKE '%$Search%' ";
$sql .= "
WHERE i.Email LIKE '%$Search%' ";
}
$sql .= "ORDER BY i.Expires DESC LIMIT $Limit";
$sql .= "
ORDER BY i.Expires DESC
LIMIT $Limit";
$RS = $DB->query($sql);
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();
$DB->set_query_id($RS);
@ -78,7 +83,7 @@
<?
$Row = 'b';
while (list($UserID, $IP, $InviteKey, $Expires, $Email) = $DB->next_record()) {
$Row = ($Row == 'b') ? 'a' : 'b';
$Row = $Row === 'b' ? 'a' : 'b';
?>
<tr class="row<?=$Row?>">
<td><?=Users::format_username($UserID, true, true, true, true)?></td>

View File

@ -38,7 +38,8 @@
i.Donor,
i.Warned,
i.JoinDate,
( SELECT COUNT(h1.UserID)
(
SELECT COUNT(h1.UserID)
FROM users_history_ips AS h1
WHERE h1.IP = m.IP
) AS Uses,
@ -54,7 +55,8 @@
ii.Donor,
ii.Warned,
ii.JoinDate,
( SELECT COUNT(h2.UserID)
(
SELECT COUNT(h2.UserID)
FROM users_history_ips AS h2
WHERE h2.IP = im.IP
) AS InviterUses
@ -68,9 +70,11 @@
} else {
$RS .= " i.JoinDate > '".time_minus(3600 * 24 * 3)."'";
}
$RS .= " ORDER BY i.Joindate DESC LIMIT $Limit";
$RS .= "
ORDER BY i.Joindate DESC
LIMIT $Limit";
$QueryID = $DB->query($RS);
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();
$DB->set_query_id($QueryID);
?>
@ -104,7 +108,7 @@
</tr>
<?
while (list($UserID, $IP, $IPCC, $Email, $Username, $PermissionID, $Uploaded, $Downloaded, $Enabled, $Donor, $Warned, $Joined, $Uses, $InviterID, $InviterIP, $InviterIPCC, $InviterEmail, $InviterUsername, $InviterPermissionID, $InviterUploaded, $InviterDownloaded, $InviterEnabled, $InviterDonor, $InviterWarned, $InviterJoined, $InviterUses) = $DB->next_record()) {
$Row = ($IP == $InviterIP) ? 'a' : 'b';
$Row = $IP === $InviterIP ? 'a' : 'b';
?>
<tr class="row<?=$Row?>">
<td><?=Users::format_username($UserID, true, true, true, true)?><br /><?=Users::format_username($InviterID, true, true, true, true)?></td>

View File

@ -27,7 +27,7 @@
AND m.Enabled = '1'
ORDER BY i.RatioWatchEnds ASC
LIMIT $Limit");
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();
$DB->query("
SELECT COUNT(UserID)
@ -63,7 +63,7 @@
</tr>
<?
while (list($UserID, $Username, $Uploaded, $Downloaded, $PermissionID, $Enabled, $Donor, $Warned, $Joined, $RatioWatchEnds, $RatioWatchDownload, $RequiredRatio) = $DB->next_record()) {
$Row = ($Row == 'b') ? 'a' : 'b';
$Row = $Row === 'b' ? 'a' : 'b';
?>
<tr class="row<?=$Row?>">
@ -83,8 +83,11 @@
<div class="linkbox">
<? echo $Pages; ?>
</div>
<? } else { ?>
<?
} else { ?>
<h2 align="center">There are currently no users on ratio watch.</h2>
<? }
<?
}
View::show_footer();
?>

View File

@ -108,7 +108,7 @@
) AS i ON j.Date = i.Date
ORDER BY j.Date DESC
LIMIT $Limit");
$DB->query("SELECT FOUND_ROWS()");
$DB->query('SELECT FOUND_ROWS()');
list($Results) = $DB->next_record();
View::show_header('User Flow');