Empty commit

This commit is contained in:
Git 2013-05-05 08:00:31 +00:00
parent 68fa26b2db
commit d002af2f86
76 changed files with 1504 additions and 959 deletions

View File

@ -252,7 +252,9 @@ static public function display_name (array &$ExtendedArtists, array &$Artists, $
} elseif (count($Artists) > 0) {
$DisplayName = Artists::display_artists(array('1'=>$Artists), true, false);
}
if ($VanityHouse) $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]';
if ($VanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
return $DisplayName;
}

View File

@ -63,7 +63,7 @@
'users_give_donor' => 'Can give donor access.',
'users_warn' => 'Can warn users.',
'users_disable_users' => 'Can disable users.',
'users_disable_posts' => 'Can disable users\' posting rights.',
'users_disable_posts' => 'Can disable users\' posting privileges.',
'users_disable_any' => 'Can disable any users\' rights.',
'users_delete_users' => 'Can delete users.',
'users_view_invites' => 'Can view who user has invited.',
@ -193,7 +193,7 @@ function permissions_form() { ?>
<? display_perm('users_give_donor', 'Can give donor access.'); ?>
<? display_perm('users_warn', 'Can warn users.'); ?>
<? display_perm('users_disable_users', 'Can disable users.'); ?>
<? display_perm('users_disable_posts', 'Can disable users\' posting rights.'); ?>
<? display_perm('users_disable_posts', 'Can disable users\' posting privileges.'); ?>
<? display_perm('users_disable_any', 'Can disable any users\' rights.'); ?>
<? display_perm('users_delete_users', 'Can delete anyone\'s account'); ?>
<? display_perm('users_view_invites', 'Can view who user has invited'); ?>

View File

@ -1,11 +1,10 @@
<?
include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT;
if (!$News = $Cache->get_value('news')) {
$DB->query("SELECT
$DB->query("
SELECT
ID,
Title,
Body,
@ -27,14 +26,16 @@
}
if (($Blog = $Cache->get_value('blog')) === false) {
$DB->query("SELECT
$DB->query("
SELECT
b.ID,
um.Username,
b.Title,
b.Body,
b.Time,
b.ThreadID
FROM blog AS b LEFT JOIN users_main AS um ON b.UserID=um.ID
FROM blog AS b
LEFT JOIN users_main AS um ON b.UserID=um.ID
ORDER BY Time DESC
LIMIT 20");
$Blog = $DB->to_array();

View File

@ -1,13 +1,16 @@
<?
if (($GroupIDs = $Cache->get_value('better_single_groupids')) === false) {
$DB->query("SELECT t.ID AS TorrentID,
$DB->query("
SELECT
t.ID AS TorrentID,
t.GroupID AS GroupID
FROM xbt_files_users AS x
JOIN torrents AS t ON t.ID=x.fid
WHERE t.Format='FLAC'
GROUP BY x.fid
HAVING COUNT(x.uid) = 1
ORDER BY t.LogScore DESC, t.Time ASC LIMIT 30");
ORDER BY t.LogScore DESC, t.Time ASC
LIMIT 30");
$GroupIDs = $DB->to_array('GroupID');
$Cache->cache_value('better_single_groupids', $GroupIDs, 30 * 60);

View File

@ -31,7 +31,8 @@
//$ArtistList = Bookmarks::all_bookmarks('artist', $UserID);
$DB->query('SELECT ag.ArtistID, ag.Name
$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);

View File

@ -22,7 +22,8 @@
//This variable contains all our lovely forum data
if (!$Forums = $Cache->get_value('forums_list')) {
$DB->query("SELECT
$DB->query("
SELECT
f.ID,
f.CategoryID,
f.Name,
@ -81,7 +82,8 @@ function get_forum_info($ForumID) {
global $DB, $Cache;
$Forum = $Cache->get_value('ForumInfo_'.$ForumID);
if (!$Forum) {
$DB->query("SELECT
$DB->query("
SELECT
Name,
MinClassRead,
MinClassWrite,

View File

@ -10,6 +10,9 @@
$DB->query("SELECT Status FROM reportsv2 WHERE ID=".$_GET['id']);
list($Status) = $DB->next_record();
if (isset($Status)) {
$DB->query("UPDATE reportsv2 SET Status='New', ResolverID = 0 WHERE ID=".$_GET['id']);
$DB->query("
UPDATE reportsv2
SET Status='New', ResolverID = 0
WHERE ID=".$_GET['id']);
}
?>

View File

@ -7,10 +7,14 @@
error(0);
}
$DB->query("UPDATE reportsv2 SET Status='New' WHERE ID=".$_GET['id']." AND Status <> 'Resolved'");
$DB->query("
UPDATE reportsv2
SET Status='New'
WHERE ID=".$_GET['id']."
AND Status <> 'Resolved'");
if ($DB->affected_rows() > 0) {
//Win
} else {
echo 'You just tried to grab a resolved or non existent report!';
echo 'You just tried to grab a resolved or non-existent report!';
}
?>

View File

@ -4,8 +4,9 @@
$UserID = $LoggedUser['ID'];
if(empty($_GET['type'])) { $Section = 'inbox'; }
else {
if (empty($_GET['type'])) {
$Section = 'inbox';
} else {
$Section = $_GET['type']; // either 'inbox' or 'sentbox'
}
if (!in_array($Section, array('inbox', 'sentbox'))) {
@ -22,7 +23,8 @@
$Sort = empty($_GET['sort']) || $_GET['sort'] != "unread" ? "Date DESC" : "cu.Unread = '1' DESC, DATE DESC";
$sql = "SELECT
$sql = "
SELECT
SQL_CALC_FOUND_ROWS
c.ID,
c.Subject,

View File

@ -11,7 +11,11 @@
$UserID = $LoggedUser['ID'];
$DB->query("SELECT InInbox, InSentbox FROM pm_conversations_users WHERE UserID='$UserID' AND ConvID='$ConvID'");
$DB->query("
SELECT InInbox, InSentbox
FROM pm_conversations_users
WHERE UserID='$UserID'
AND ConvID='$ConvID'");
if ($DB->record_count() == 0) {
print json_encode(array('status' => 'failure'));
die();
@ -27,7 +31,8 @@
}
// Get information on the conversation
$DB->query("SELECT
$DB->query("
SELECT
c.Subject,
cu.Sticky,
cu.UnRead,
@ -36,10 +41,12 @@
FROM pm_conversations AS c
JOIN pm_conversations_users AS cu ON c.ID=cu.ConvID
LEFT JOIN users_main AS um ON um.ID=cu.ForwardedTo
WHERE c.ID='$ConvID' AND UserID='$UserID'");
WHERE c.ID='$ConvID'
AND UserID='$UserID'");
list($Subject, $Sticky, $UnRead, $ForwardedID, $ForwardedName) = $DB->next_record();
$DB->query("SELECT um.ID, Username
$DB->query("
SELECT um.ID, Username
FROM pm_messages AS pm
JOIN users_main AS um ON um.ID=pm.SenderID
WHERE pm.ConvID='$ConvID'");
@ -56,13 +63,21 @@
if ($UnRead == '1') {
$DB->query("UPDATE pm_conversations_users SET UnRead='0' WHERE ConvID='$ConvID' AND UserID='$UserID'");
$DB->query("
UPDATE pm_conversations_users
SET UnRead='0'
WHERE ConvID='$ConvID'
AND UserID='$UserID'");
// Clear the caches of the inbox and sentbox
$Cache->decrement('inbox_new_'.$UserID);
}
// Get messages
$DB->query("SELECT SentDate, SenderID, Body, ID FROM pm_messages AS m WHERE ConvID='$ConvID' ORDER BY ID");
$DB->query("
SELECT SentDate, SenderID, Body, ID
FROM pm_messages AS m
WHERE ConvID='$ConvID'
ORDER BY ID");
$JsonMessages = array();
while (list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) {
@ -83,7 +98,7 @@
'status' => 'success',
'response' => array(
'convId' => (int) $ConvID,
'subject' => $Subject.($ForwardedID > 0 ? ' (Forwarded to '.$ForwardedName.')':''),
'subject' => $Subject.($ForwardedID > 0 ? " (Forwarded to $ForwardedName)" : ''),
'sticky' => $Sticky == 1,
'messages' => $JsonMessages
)

View File

@ -1,6 +1,4 @@
<?
if (!check_perms('site_torrents_notify')) {
json_die("failure");
}
@ -8,15 +6,22 @@
define('NOTIFICATIONS_PER_PAGE', 50);
list($Page,$Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
$Results = $DB->query("SELECT SQL_CALC_FOUND_ROWS unt.TorrentID, unt.UnRead, unt.FilterID, unf.Label, t.GroupID
$Results = $DB->query("
SELECT SQL_CALC_FOUND_ROWS
unt.TorrentID,
unt.UnRead,
unt.FilterID,
unf.Label,
t.GroupID
FROM users_notify_torrents AS unt
JOIN torrents AS t ON t.ID = unt.TorrentID
LEFT JOIN users_notify_filters AS unf ON unf.ID = unt.FilterID
WHERE unt.UserID=$LoggedUser[ID]".
((!empty($_GET['filterid']) && is_number($_GET['filterid']))
? " AND unf.ID='$_GET[filterid]'"
: "")."
ORDER BY TorrentID DESC LIMIT $Limit");
: '')."
ORDER BY TorrentID DESC
LIMIT $Limit");
$GroupIDs = array_unique($DB->collect('GroupID'));
$DB->query('SELECT FOUND_ROWS()');
@ -26,7 +31,10 @@
$TorrentGroups = Torrents::get_groups($GroupIDs);
$TorrentGroups = $TorrentGroups['matches'];
$DB->query("UPDATE users_notify_torrents SET UnRead='0' WHERE UserID=".$LoggedUser['ID']);
$DB->query("
UPDATE users_notify_torrents
SET UnRead='0'
WHERE UserID=".$LoggedUser['ID']);
$Cache->delete_value('notifications_new_'.$LoggedUser['ID']);
}
@ -58,7 +66,9 @@
extract(Torrents::array_group($GroupInfo)); // all group data
$TorrentInfo = $GroupInfo['Torrents'][$TorrentID];
if ($Result['UnRead'] == 1) $NumNew++;
if ($Result['UnRead'] == 1) {
$NumNew++;
}
$JsonNotifications[] = array(
'torrentId' => (int) $TorrentID,

View File

@ -314,13 +314,13 @@
$VoteCount = count($RequestVotes['Voters']);
if ($CategoryID == 0) {
$CategoryName = "Unknown";
$CategoryName = 'Unknown';
} else {
$CategoryName = $Categories[$CategoryID - 1];
}
$JsonArtists = array();
if ($CategoryName == "Music") {
if ($CategoryName == 'Music') {
$ArtistForm = get_request_artists($RequestID);
$JsonArtists = array_values($ArtistForm);
}
@ -350,9 +350,9 @@
'logCue' => $LogCue,
'isFilled' => ($TorrentID > 0),
'fillerId' => (int) $FillerID,
'fillerName' => $FillerName == 0 ? "" : $FillerName,
'fillerName' => $FillerName == 0 ? '' : $FillerName,
'torrentId' => (int) $TorrentID,
'timeFilled' => $TimeFilled == 0 ? "" : $TimeFilled
'timeFilled' => $TimeFilled == 0 ? '' : $TimeFilled
);
}
json_die("success", array(

View File

@ -8,7 +8,8 @@
$Results = $Cache->get_value('torrent_comments_'.$GroupID);
if ($Results === false) {
$DB->query("SELECT
$DB->query("
SELECT
COUNT(c.ID)
FROM torrents_comments as c
WHERE c.GroupID = '$GroupID'");
@ -17,7 +18,11 @@
}
if (isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
$DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $_GET[postid]");
$DB->query("
SELECT COUNT(ID)
FROM torrents_comments
WHERE GroupID = $GroupID
AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record();
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
} else {
@ -33,7 +38,8 @@
// Cache catalogue from which the page is selected, allows block caches and future ability to specify posts per page
$Catalogue = $Cache->get_value('torrent_comments_'.$GroupID.'_catalogue_'.$CatalogueID);
if ($Catalogue === false) {
$DB->query("SELECT
$DB->query("
SELECT
c.ID,
c.AuthorID,
c.AddedTime,

View File

@ -20,7 +20,8 @@
if ($Details == 'all' || $Details == 'ut') {
if (!$TopUsedTags = $Cache->get_value('topusedtag_'.$Limit)) {
$DB->query("SELECT
$DB->query("
SELECT
t.ID,
t.Name,
COUNT(tt.GroupID) AS Uses,
@ -40,7 +41,8 @@
if ($Details == 'all' || $Details == 'ur') {
if (!$TopRequestTags = $Cache->get_value('toprequesttag_'.$Limit)) {
$DB->query("SELECT
$DB->query("
SELECT
t.ID,
t.Name,
COUNT(r.RequestID) AS Uses,
@ -59,7 +61,8 @@
if ($Details == 'all' || $Details == 'v') {
if (!$TopVotedTags = $Cache->get_value('topvotedtag_'.$Limit)) {
$DB->query("SELECT
$DB->query("
SELECT
t.ID,
t.Name,
COUNT(tt.GroupID) AS Uses,

View File

@ -2,7 +2,6 @@
$Available = array(
'access_request',
'access_state',
'user_stats_ratio',
'user_stats_torrent',
'user_stats_comumnity',
@ -48,7 +47,11 @@
require(SERVER_ROOT.'/classes/class_mysql.php');
$DB = new DB_MYSQL;
}
$DB->query("SELECT AppID, Token, State, Time, Access FROM api_users WHERE UserID='$UserID' LIMIT 1"); //int, no db_string
$DB->query("
SELECT AppID, Token, State, Time, Access
FROM api_users
WHERE UserID='$UserID'
LIMIT 1"); //int, no db_string
$User = $DB->to_array('AppID',MYSQLI_ASSOC);
$Cache->cache_value('api_users_'.$UserID, $User, 0);
}

View File

@ -1,12 +1,16 @@
<?
authorize();
if(!check_perms('torrents_edit')) { error(403); }
if (!check_perms('torrents_edit')) {
error(403);
}
$ArtistID = $_POST['artistid'];
$Redirect = $_POST['redirect'];
$AliasName = Artists::normalise_artist_name($_POST['name']);
$DBAliasName = db_string($AliasName);
if(!$Redirect) { $Redirect = 0; }
if (!$Redirect) {
$Redirect = 0;
}
if (!is_number($ArtistID) || !($Redirect === 0 || is_number($Redirect)) || !$ArtistID) {
error(0);
@ -24,7 +28,10 @@
* 3. For foo, there's two, same ArtistID, diff names, no redirect
*/
$DB->query("SELECT AliasID, ArtistID, Name, Redirect FROM artists_alias WHERE Name = '".$DBAliasName."'");
$DB->query("
SELECT AliasID, ArtistID, Name, Redirect
FROM artists_alias
WHERE Name = '".$DBAliasName."'");
if ($DB->record_count()) {
while (list($CloneAliasID, $CloneArtistID, $CloneAliasName, $CloneRedirect) = $DB->next_record(MYSQLI_NUM, false)) {
if (!strcasecmp($CloneAliasName, $AliasName)) {
@ -34,7 +41,10 @@
if ($CloneAliasID) {
if ($ArtistID == $CloneArtistID && $Redirect == 0) {
if ($CloneRedirect != 0) {
$DB->query("UPDATE artists_alias SET ArtistID='".$ArtistID."', Redirect=0 WHERE AliasID='".$CloneAliasID."'");
$DB->query("
UPDATE artists_alias
SET ArtistID='".$ArtistID."', Redirect=0
WHERE AliasID='".$CloneAliasID."'");
Misc::write_log("Redirection for the alias $CloneAliasID ($DBAliasName) for the artist $ArtistID was removed by user $LoggedUser[ID] ($LoggedUser[Username])");
} else {
error('No changes were made as the target alias did not redirect anywhere.');
@ -58,15 +68,15 @@
$Redirect = $FoundRedirect;
}
}
$DB->query("INSERT INTO artists_alias(ArtistID, Name, Redirect, UserID)
VALUES
(".$ArtistID.", '".$DBAliasName."', ".$Redirect.", ".$LoggedUser['ID'].")");
$DB->query("
INSERT INTO artists_alias(ArtistID, Name, Redirect, UserID)
VALUES ($ArtistID, '$DBAliasName', $Redirect, ".$LoggedUser['ID'].')');
$AliasID = $DB->inserted_id();
$DB->query("SELECT Name FROM artists_group 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

@ -2,7 +2,9 @@
header('Content-type: application/x-suggestions+json');
require('classes/ajax_start.php');
if(empty($_GET['name'])) { die('["",[],[],[]]'); }
if (empty($_GET['name'])) {
die('["",[],[],[]]');
}
$FullName = rawurldecode($_GET['name']);
@ -20,7 +22,8 @@
$DB=NEW DB_MYSQL; //Load the database wrapper
}
$Limit = (($KeySize === $MaxKeySize) ? 250 : 10);
$DB->query("SELECT
$DB->query("
SELECT
a.ArtistID,
a.Name,
SUM(t.Snatched) AS Snatches

View File

@ -1,9 +1,11 @@
<?
authorize();
if (!check_perms('torrents_edit')) { error(403); }
if (!check_perms('torrents_edit')) {
error(403);
}
if (!empty($_POST['newartistid']) && !empty($_POST['newartistname'])) {
error("Please enter a valid artist ID number or a valid artist name.");
error('Please enter a valid artist ID number or a valid artist name.');
}
$ArtistID = (int)$_POST['artistid'];
$NewArtistID = (int)$_POST['newartistid'];
@ -47,7 +49,8 @@
$Requests = $DB->collect('RequestID');
$DB->query("SELECT DISTINCT UserID FROM bookmarks_artists WHERE ArtistID = $ArtistID");
$BookmarkUsers = $DB->collect('UserID');
$DB->query("SELECT DISTINCT ct.CollageID
$DB->query("
SELECT DISTINCT ct.CollageID
FROM collages_torrents AS ct
JOIN torrents_artists AS ta ON ta.GroupID = ct.GroupID
WHERE ta.ArtistID = $ArtistID");
@ -70,18 +73,27 @@
$NewArtistBookmarks = implode(',',$NewArtistBookmarks);
// Merge all of this artist's aliases onto the new artist
$DB->query("UPDATE artists_alias SET ArtistID = $NewArtistID WHERE ArtistID = $ArtistID");
$DB->query("
UPDATE artists_alias
SET ArtistID = $NewArtistID
WHERE ArtistID = $ArtistID");
// Update the torrent groups, requests, and bookmarks
$DB->query("UPDATE IGNORE torrents_artists SET ArtistID = $NewArtistID
$DB->query("
UPDATE IGNORE torrents_artists
SET ArtistID = $NewArtistID
WHERE ArtistID = $ArtistID
AND GroupID NOT IN ($NewArtistGroups)");
$DB->query("DELETE FROM torrents_artists WHERE ArtistID = $ArtistID");
$DB->query("UPDATE IGNORE requests_artists SET ArtistID = $NewArtistID
$DB->query("
UPDATE IGNORE requests_artists
SET ArtistID = $NewArtistID
WHERE ArtistID = $ArtistID
AND RequestID NOT IN ($NewArtistRequests)");
$DB->query("DELETE FROM requests_artists WHERE ArtistID = $ArtistID");
$DB->query("UPDATE IGNORE bookmarks_artists SET ArtistID = $NewArtistID
$DB->query("
UPDATE IGNORE bookmarks_artists
SET ArtistID = $NewArtistID
WHERE ArtistID = $ArtistID
AND UserID NOT IN ($NewArtistBookmarks)");
$DB->query("DELETE FROM bookmarks_artists WHERE ArtistID = $ArtistID");
@ -118,7 +130,7 @@
// Delete the old artist
$DB->query("DELETE FROM artists_group WHERE ArtistID = $ArtistID");
Misc::write_log("The artist ".$ArtistID." (".$ArtistName.") was made into a non-redirecting alias of artist ".$NewArtistID." (".$NewArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")");
Misc::write_log("The artist $ArtistID ($ArtistName) was made into a non-redirecting alias of artist $NewArtistID ($NewArtistName) by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].')');
header("Location: artist.php?action=edit&artistid=$NewArtistID");
} else {

View File

@ -10,17 +10,21 @@
authorize();
$ArtistID = $_GET['artistid'];
if(!is_number($ArtistID) || empty($ArtistID)) { error(0); }
if (!is_number($ArtistID) || empty($ArtistID)) {
error(0);
}
if(!check_perms('site_delete_artist') || !check_perms('torrents_delete')) { error(403); }
if (!check_perms('site_delete_artist') || !check_perms('torrents_delete')) {
error(403);
}
View::show_header('Artist deleted');
$DB->query('SELECT Name FROM artists_group WHERE ArtistID='.$ArtistID);
list($Name) = $DB->next_record();
$DB->query('SELECT tg.Name,
tg.ID
$DB->query('
SELECT tg.Name, tg.ID
FROM torrents_group AS tg
LEFT JOIN torrents_artists AS ta ON ta.GroupID=tg.ID
WHERE ta.ArtistID='.$ArtistID);
@ -47,8 +51,8 @@
<?
}
$DB->query('SELECT r.Title,
r.ID
$DB->query('
SELECT r.Title, r.ID
FROM requests AS r
LEFT JOIN requests_artists AS ra ON ra.RequestID=r.ID
WHERE ra.ArtistID='.$ArtistID);
@ -78,7 +82,9 @@
if ($Count == 0) {
Artists::delete_artist($ArtistID);
?>
<div class="thin">Artist deleted!</div>
<div class="thin box pad">
Artist "<?=$Name?>" deleted!
</div>
<?
}
View::show_footer();?>

View File

@ -11,10 +11,13 @@
************************************************************************/
$ArtistID = $_GET['artistid'];
if(!is_number($ArtistID)) { error(0); }
if (!is_number($ArtistID)) {
error(0);
}
// Get the artist name and the body of the last revision
$DB->query("SELECT
$DB->query("
SELECT
Name,
Image,
Body,
@ -98,11 +101,18 @@
<?
$DB->query("SELECT AliasID, Name, UserID, Redirect FROM artists_alias WHERE ArtistID='$ArtistID'");
while (list($AliasID, $AliasName, $User, $Redirect) = $DB->next_record(MYSQLI_NUM, true)) {
if($AliasName == $Name) { $DefaultRedirectID = $AliasID; }
if ($AliasName == $Name) {
$DefaultRedirectID = $AliasID;
}
?>
<li><span title="Alias ID"><?=$AliasID?></span>. <span title="Alias name"><?=$AliasName?></span>
<? if($User) { ?> <a href="user.php?id=<?=$User?>" title="Alias creator" class="brackets">User</a> <?}
if($Redirect) { ?> (writes redirect to <span title="Target alias ID"><?=$Redirect?></span>)<? } ?>
<li>
<span title="Alias ID"><?=$AliasID?></span>. <span title="Alias name"><?=$AliasName?></span>
<? if ($User) { ?>
<a href="user.php?id=<?=$User?>" title="Alias creator" class="brackets">User</a>
<? }
if ($Redirect) { ?>
(writes redirect to <span title="Target alias ID"><?=$Redirect?></span>)
<? } ?>
<a href="artist.php?action=delete_alias&amp;aliasid=<?=$AliasID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" title="Delete this alias" class="brackets">X</a>
</li>
<? }

View File

@ -12,7 +12,9 @@
************************************************************************/
$ArtistID = $_GET['artistid'];
if(!is_number($ArtistID)) { error(0); }
if (!is_number($ArtistID)) {
error(0);
}
include(SERVER_ROOT.'/classes/class_wiki.php'); // Wiki class
$Wiki = new WIKI('wiki_artists', $ArtistID, "artist.php?id=$ArtistID");
@ -21,7 +23,7 @@
$DB->query("SELECT Name FROM artists_group WHERE ArtistID='$ArtistID'");
list($Name) = $DB->next_record(MYSQLI_NUM, true);
View::show_header("Revision history for ".$Name); // Set title
View::show_header("Revision history for $Name"); // Set title
// Start printing form
?>

View File

@ -41,7 +41,7 @@
error(0);
}
if ($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed.');
error('Your posting privileges have been removed.');
}
$ArtistID = $_POST['artistid'];
@ -49,11 +49,19 @@
error(404);
}
$DB->query("SELECT CEIL((SELECT COUNT(ID)+1 FROM artist_comments AS ac WHERE ac.ArtistID='" . db_string($ArtistID) . "')/" . TORRENT_COMMENTS_PER_PAGE . ") AS Pages");
$DB->query("
SELECT
CEIL((
SELECT COUNT(ID)+1
FROM artist_comments AS ac
WHERE ac.ArtistID='" . db_string($ArtistID) . "'
)/" . TORRENT_COMMENTS_PER_PAGE . "
) AS Pages");
list($Pages) = $DB->next_record();
$DB->query("INSERT INTO artist_comments (ArtistID,AuthorID,AddedTime,Body) VALUES (
'" . db_string($ArtistID) . "', '" . db_string($LoggedUser['ID']) . "','" . sqltime() . "','" . db_string($_POST['body']) . "')");
$DB->query("
INSERT INTO artist_comments (ArtistID,AuthorID,AddedTime,Body)
VALUES ('" . db_string($ArtistID) . "', '" . db_string($LoggedUser['ID']) . "','" . sqltime() . "','" . db_string($_POST['body']) . "')");
$PostID = $DB->inserted_id();
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
@ -113,12 +121,17 @@
}
// Get topicid, forumid, number of pages
$DB->query("SELECT
$DB->query("
SELECT
ArtistID,
CEIL(COUNT(ac.ID)/" . TORRENT_COMMENTS_PER_PAGE . ") AS Pages,
CEIL(SUM(IF(ac.ID<=" . $_GET['postid'] . ",1,0))/" . TORRENT_COMMENTS_PER_PAGE . ") AS Page
FROM artist_comments AS ac
WHERE ac.ArtistID=(SELECT ArtistID FROM artist_comments WHERE ID=" . $_GET['postid'] . ")
WHERE ac.ArtistID=(
SELECT ArtistID
FROM artist_comments
WHERE ID=" . $_GET['postid'] . "
)
GROUP BY ac.ArtistID");
list($ArtistID, $Pages, $Page) = $DB->next_record();
@ -152,7 +165,8 @@
}
// Mainly
$DB->query("SELECT
$DB->query("
SELECT
ac.Body,
ac.AuthorID,
ac.ArtistID,
@ -161,7 +175,11 @@
WHERE ac.ID='" . db_string($_POST['post']) . "'");
list($OldBody, $AuthorID, $ArtistID, $AddedTime) = $DB->next_record();
$DB->query("SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page FROM artist_comments WHERE ArtistID = $ArtistID AND ID <= $_POST[post]");
$DB->query("
SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page
FROM artist_comments
WHERE ArtistID = $ArtistID
AND ID <= $_POST[post]");
list($Page) = $DB->next_record();
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
@ -172,7 +190,9 @@
}
// Perform the update
$DB->query("UPDATE artist_comments SET
$DB->query("
UPDATE artist_comments
SET
Body = '" . db_string($_POST['body']) . "',
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
EditedTime = '" . sqltime() . "'
@ -193,7 +213,8 @@
));
$Cache->commit_transaction(0);
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
$DB->query("
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('artist', " . db_string($_POST['post']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
// This gets sent to the browser, which echoes it in place of the old body

View File

@ -25,25 +25,44 @@
$ArtistID = $_POST['artistid'];
$NewName = Artists::normalise_artist_name($_POST['name']);
if(!$ArtistID || !is_number($ArtistID)) { error(404); }
if (!$ArtistID || !is_number($ArtistID)) {
error(404);
}
if(!check_perms('torrents_edit')) { error(403); }
if (!check_perms('torrents_edit')) {
error(403);
}
$DB->query("SELECT Name FROM artists_group WHERE ArtistID='$ArtistID'");
if($DB->record_count()==0) { error(404); }
if ($DB->record_count() == 0) {
error(404);
}
list($OldName) = $DB->next_record(MYSQLI_NUM, false);
if($OldName == $NewName) { error('The new name is identical to the old name.'); }
if ($OldName == $NewName) {
error('The new name is identical to the old name.');
}
$DB->query("SELECT AliasID FROM artists_alias WHERE Name='".db_string($OldName)."' AND ArtistID='$ArtistID'");
$DB->query("
SELECT AliasID
FROM artists_alias
WHERE Name='".db_string($OldName)."'
AND ArtistID='$ArtistID'");
list($OldAliasID) = $DB->next_record(MYSQLI_NUM, false);
if(!$OldAliasID) { error('Could not find old alias ID'); }
if (!$OldAliasID) {
error('Could not find old alias ID');
}
$DB->query("SELECT AliasID, ArtistID FROM artists_alias WHERE name LIKE '".db_string($NewName, true)."'");
$DB->query("
SELECT AliasID, ArtistID
FROM artists_alias
WHERE name LIKE '".db_string($NewName, true)."'");
list($TargetAliasID, $TargetArtistID) = $DB->next_record(MYSQLI_NUM, false);
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]')");
$DB->query("
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'");
@ -73,7 +92,10 @@
$TargetArtistID = $ArtistID;
} else { // Merge stuff
$DB->query("UPDATE artists_alias SET Redirect='$TargetAliasID',ArtistID='$TargetArtistID' WHERE AliasID='$OldAliasID'");
$DB->query("
UPDATE artists_alias
SET Redirect='$TargetAliasID', ArtistID='$TargetArtistID'
WHERE AliasID='$OldAliasID'");
$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'");
@ -84,7 +106,10 @@
$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("
UPDATE IGNORE torrents_artists
SET AliasID='$TargetAliasID', ArtistID='$TargetArtistID'
WHERE AliasID='$OldAliasID'");
$DB->query("DELETE FROM torrents_artists WHERE AliasID='$OldAliasID'");
if (!empty($Groups)) {
foreach ($Groups as $GroupID) {
@ -95,7 +120,10 @@
$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("
UPDATE IGNORE requests_artists
SET AliasID='$TargetAliasID', ArtistID='$TargetArtistID'
WHERE AliasID='$OldAliasID'");
$DB->query("DELETE FROM requests_artists WHERE AliasID='$OldAliasID'");
if (!empty($Requests)) {
foreach ($Requests as $RequestID) {
@ -107,7 +135,10 @@
if ($ArtistID != $TargetArtistID) {
$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("
UPDATE IGNORE torrents_artists
SET ArtistID='$TargetArtistID'
WHERE ArtistID='$ArtistID'");
$DB->query("DELETE FROM torrents_artists WHERE ArtistID='$ArtistID'");
if (!empty($Groups)) {
foreach ($Groups as $GroupID) {
@ -118,7 +149,10 @@
$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("
UPDATE IGNORE requests_artists
SET ArtistID='$TargetArtistID'
WHERE ArtistID='$ArtistID'");
$DB->query("DELETE FROM requests_artists WHERE ArtistID='$ArtistID'");
if (!empty($Requests)) {
foreach ($Requests as $RequestID) {

View File

@ -20,23 +20,26 @@
if ($Length != 'verbal') {
$Time = ((int)$Length) * (7 * 24 * 60 * 60);
Tools::warn_user($UserID, $Time, "$URL - ". $Reason);
$Subject = "You have received a warning";
$Subject = 'You have received a warning';
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this artist comment.[/url]\n\n" . $PrivateMessage;
$WarnTime = time_plus($Time);
$AdminComment = date("Y-m-d").' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $URL - $Reason\n\n";
$AdminComment = date('Y-m-d').' - Warned until '.$WarnTime.' by '.$LoggedUser['Username']."\nReason: $URL - $Reason\n\n";
} else {
$Subject = "You have received a verbal warning";
$Subject = 'You have received a verbal warning';
$PrivateMessage = "You have received a verbal warning for [url=$URL]this post.[/url]\n\n" . $PrivateMessage;
$AdminComment = date("Y-m-d") . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
$AdminComment = date('Y-m-d') . ' - Verbally warned by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
}
$DB->query("INSERT INTO users_warnings_forums (UserID, Comment) VALUES('$UserID', '" . db_string($AdminComment) . "')
$DB->query("
INSERT INTO users_warnings_forums (UserID, Comment)
VALUES('$UserID', '" . db_string($AdminComment) . "')
ON DUPLICATE KEY UPDATE Comment = CONCAT('" . db_string($AdminComment) . "', Comment)");
Tools::update_user_notes($UserID,$AdminComment);
Misc::send_pm($UserID, $LoggedUser['ID'], $Subject, $PrivateMessage);
// Mainly
$DB->query("SELECT
$DB->query("
SELECT
ac.Body,
ac.AuthorID,
ac.ArtistID,
@ -45,11 +48,17 @@
WHERE ac.ID='$PostID'");
list($OldBody, $AuthorID, $ArtistID, $AddedTime) = $DB->next_record();
$DB->query("SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page FROM artist_comments WHERE ArtistID = $ArtistID AND ID <= $PostID");
$DB->query("
SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page
FROM artist_comments
WHERE ArtistID = $ArtistID
AND ID <= $PostID");
list($Page) = $DB->next_record();
// Perform the update
$DB->query("UPDATE artist_comments SET
$DB->query("
UPDATE artist_comments
SET
Body = '" . db_string($Body) . "',
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
EditedTime = '" . sqltime() . "'
@ -62,8 +71,9 @@
$Cache->update_row($_POST['key'], array('ID' => $_POST['postid'], 'AuthorID' => $AuthorID, 'AddedTime' => $AddedTime, 'Body' => $Body, 'EditedUserID' => db_string($LoggedUser['ID']), 'EditedTime' => sqltime(), 'Username' => $LoggedUser['Username']));
$Cache->commit_transaction(0);
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('artist', " . db_string($_POST['postid']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
$DB->query("
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('artist', " . db_string($_POST['postid']) . ', ' . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
header("Location: artist.php?id=$ArtistID&postid=$PostID#post$PostID");
?>

View File

@ -9,7 +9,9 @@
error(404);
}
if(!check_perms('site_edit_wiki')) { error(403); }
if (!check_perms('site_edit_wiki')) {
error(403);
}
// Variables for database input
$UserID = $LoggedUser['ID'];
@ -22,7 +24,9 @@
if ($_GET['action'] == 'revert') { // if we're reverting to a previous revision
authorize();
$RevisionID=$_GET['revisionid'];
if(!is_number($RevisionID)) { error(0); }
if (!is_number($RevisionID)) {
error(0);
}
} else { // with edit, the variables are passed with POST
$Body = db_string($_POST['body']);
$Summary = db_string($_POST['summary']);
@ -36,18 +40,22 @@
// Insert revision
if (!$RevisionID) { // edit
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
$DB->query("
INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
VALUES ('$ArtistID', '$Body', '$Image', '$UserID', '$Summary', '".sqltime()."')");
} else { // revert
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
$DB->query("
INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
SELECT '$ArtistID', Body, Image, '$UserID', 'Reverted to revision $RevisionID', '".sqltime()."'
FROM wiki_artists WHERE RevisionID='$RevisionID'");
FROM wiki_artists
WHERE RevisionID='$RevisionID'");
}
$RevisionID = $DB->inserted_id();
// Update artists table (technically, we don't need the RevisionID column, but we can use it for a join which is nice and fast)
$DB->query("UPDATE artists_group
$DB->query("
UPDATE artists_group
SET
". (isset($VanityHouse) ? "VanityHouse='$VanityHouse'," : '') ."
RevisionID='$RevisionID'

View File

@ -11,7 +11,12 @@
error(404);
}
$DB->query("SELECT SimilarID FROM artists_similar_votes WHERE SimilarID='$SimilarID' AND UserID='$UserID' AND Way='$Way'");
$DB->query("
SELECT SimilarID
FROM artists_similar_votes
WHERE SimilarID='$SimilarID'
AND UserID='$UserID'
AND Way='$Way'");
if ($DB->record_count() == 0) {
if ($Way == 'down') {
$Score = 'Score-100';
@ -20,8 +25,13 @@
} else { // Nothing is impossible!
$Score = 'Score';
}
$DB->query("UPDATE artists_similar_scores SET Score=$Score WHERE SimilarID='$SimilarID'");
$DB->query("INSERT iNTO artists_similar_votes (SimilarID, UserID, Way) VALUES ('$SimilarID', '$UserID', '$Way')");
$DB->query("
UPDATE artists_similar_scores
SET Score=$Score
WHERE SimilarID='$SimilarID'");
$DB->query("
INSERT INTO artists_similar_votes (SimilarID, UserID, Way)
VALUES ('$SimilarID', '$UserID', '$Way')");
$Cache->delete_value('artist_'.$ArtistID); // Delete artist cache
}
header('Location: '.$_SERVER['HTTP_REFERER']);

View File

@ -9,7 +9,8 @@
$UserID = (int) $_POST['userid'];
$Key = (int) $_POST['key'];
$UserInfo = Users::user_info($UserID);
$DB -> query("SELECT
$DB -> query("
SELECT
ac.Body,
ac.AddedTime
FROM artist_comments AS ac

View File

@ -8,8 +8,8 @@
}
if(!empty($_GET['filter']) && $_GET['filter'] == "all") {
$Join = "";
if (!empty($_GET['filter']) && $_GET['filter'] == 'all') {
$Join = '';
$All = true;
} else {
$Join = "JOIN xbt_snatched as x ON x.fid=tfi.TorrentID AND x.uid = ".$LoggedUser['ID'];
@ -17,7 +17,12 @@
}
View::show_header('Torrents with bad file names');
$DB->query("SELECT tfi.TorrentID, t.GroupID FROM torrents_bad_files AS tfi JOIN torrents AS t ON t.ID = tfi.TorrentID ".$Join." ORDER BY tfi.TimeAdded ASC");
$DB->query("
SELECT tfi.TorrentID, t.GroupID
FROM torrents_bad_files AS tfi
JOIN torrents AS t ON t.ID = tfi.TorrentID
$Join
ORDER BY tfi.TimeAdded ASC");
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
foreach ($TorrentsInfo as $Torrent) {
$GroupIDs[] = $Torrent['GroupID'];
@ -57,8 +62,12 @@
$DisplayName = '';
}
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
if ($GroupYear > 0) {
$DisplayName.=" [$GroupYear]";
}
if ($ReleaseType > 0) {
$DisplayName.=' ['.$ReleaseTypes[$ReleaseType].']';
}
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
if ($ExtraInfo) {

View File

@ -9,7 +9,7 @@
if (!empty($_GET['filter']) && $_GET['filter'] == "all") {
$Join = "";
$Join = '';
$All = true;
} else {
$Join = "JOIN xbt_snatched as x ON x.fid=tbf.TorrentID AND x.uid = ".$LoggedUser['ID'];
@ -17,7 +17,12 @@
}
View::show_header('Torrents with bad folder names');
$DB->query("SELECT tbf.TorrentID, t.GroupID FROM torrents_bad_folders AS tbf JOIN torrents AS t ON t.ID = tbf.TorrentID ".$Join." ORDER BY tbf.TimeAdded ASC");
$DB->query("
SELECT tbf.TorrentID, t.GroupID
FROM torrents_bad_folders AS tbf
JOIN torrents AS t ON t.ID = tbf.TorrentID
$Join
ORDER BY tbf.TimeAdded ASC");
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
foreach ($TorrentsInfo as $Torrent) {
$GroupIDs[] = $Torrent['GroupID'];
@ -57,8 +62,12 @@
$DisplayName = '';
}
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
if ($GroupYear > 0) {
$DisplayName.=" [$GroupYear]";
}
if ($ReleaseType > 0) {
$DisplayName.=' ['.$ReleaseTypes[$ReleaseType].']';
}
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
if ($ExtraInfo) {

View File

@ -27,7 +27,7 @@
AND ((t.LogScore = '100' AND t.Media = 'CD')
OR t.Media != 'CD')
AND tg.CategoryID = 1
AND x.uid='$UserID'");
AND x.uid='$UserID'" . ($SeedingOnly ? ' AND x.active = 1 AND x.remaining = 0' : ''));
$SnatchedTorrentIDs = array_fill_keys($DB->collect('fid'), true);
$SnatchedGroupIDs = array_unique($DB->collect('GroupID'));
@ -115,7 +115,9 @@
);
foreach ($TorrentGroups as $Editions) {
foreach ($Editions as $Edition) {
if($Edition['FlacID'] == 0) { continue; } // no FLAC in this edition
if ($Edition['FlacID'] == 0) { // no FLAC in this edition
continue;
}
$edition_miss = 0; //number of transcodes missing in this edition
foreach ($Encodings as $Encoding) {
if (!isset($Edition['Formats'][$Encoding])) {
@ -180,7 +182,7 @@
}
$DisplayName = $ArtistNames . '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$Edition['FlacID'].'#torrent'.$Edition['FlacID'].'" title="View Torrent">'.$GroupName.'</a>';
if ($GroupYear > 0) {
$DisplayName .= " [".$GroupYear."]";
$DisplayName .= " [$GroupYear]";
}
if ($ReleaseType > 0) {
$DisplayName .= " [".$ReleaseTypes[$ReleaseType]."]";

View File

@ -8,8 +8,8 @@
}
if(!empty($_GET['filter']) && $_GET['filter'] == "all") {
$Join = "";
if (!empty($_GET['filter']) && $_GET['filter'] == 'all') {
$Join = '';
$All = true;
} else {
$Join = "JOIN xbt_snatched as x ON x.fid=tbt.TorrentID AND x.uid = ".$LoggedUser['ID'];
@ -17,7 +17,12 @@
}
View::show_header('Torrents with bad tags');
$DB->query("SELECT tbt.TorrentID, t.GroupID FROM torrents_bad_tags AS tbt JOIN torrents AS t ON t.ID = tbt.TorrentID ".$Join." ORDER BY tbt.TimeAdded ASC");
$DB->query("
SELECT tbt.TorrentID, t.GroupID
FROM torrents_bad_tags AS tbt
JOIN torrents AS t ON t.ID = tbt.TorrentID
$Join
ORDER BY tbt.TimeAdded ASC");
$TorrentsInfo = $DB->to_array('TorrentID', MYSQLI_ASSOC);
foreach ($TorrentsInfo as $Torrent) {
$GroupIDs[] = $Torrent['GroupID'];
@ -58,8 +63,12 @@
$DisplayName = '';
}
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'#torrent'.$TorrentID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
if ($GroupYear > 0) {
$DisplayName.=" [$GroupYear]";
}
if ($ReleaseType > 0) {
$DisplayName.=' ['.$ReleaseTypes[$ReleaseType].']';
}
$ExtraInfo = Torrents::torrent_info($Torrents[$TorrentID]);
if ($ExtraInfo) {

View File

@ -140,10 +140,10 @@
}
$DisplayName = $ArtistNames . '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$Edition['FlacID'].'#torrent'.$Edition['FlacID'].'" title="View Torrent">'.$GroupName.'</a>';
if ($GroupYear > 0) {
$DisplayName .= " [".$GroupYear."]";
$DisplayName .= " [$GroupYear]";
}
if ($ReleaseType > 0) {
$DisplayName .= " [".$ReleaseTypes[$ReleaseType]."]";
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
}
if ($Edition['IsSnatched']) {
$DisplayName .= ' ' . Format::torrent_label('Snatched!');

View File

@ -37,7 +37,7 @@ function transcode_init_sphql() {
->order_by('RAND()')
->limit(0, TORRENTS_PER_PAGE, TORRENTS_PER_PAGE);
if (in_array($_GET['target'], array('v0', 'v2', '320'))) {
// v0/v2/320 is missing
// V0/V2/320 is missing
$SphQL->where_match('!'.$_GET['target'], 'encoding', false);
} elseif ($_GET['target'] == 'all') {
// all transcodes are missing
@ -73,19 +73,34 @@ function transcode_parse_groups($Groups) {
if (!isset($TorrentGroups[$GroupID]['Editions'][$RemIdent])) {
if ($Torrent['Remastered'] && $Torrent['RemasterYear'] != 0) {
$EditionName = $Torrent['RemasterYear'];
$AddExtra = " - ";
if($Torrent['RemasterRecordLabel']) { $EditionName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']); $AddExtra=' / '; }
if($Torrent['RemasterCatalogueNumber']) { $EditionName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
if($Torrent['RemasterTitle']) { $EditionName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
$AddExtra = ' - ';
if ($Torrent['RemasterRecordLabel']) {
$EditionName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']);
$AddExtra = ' / ';
}
if ($Torrent['RemasterCatalogueNumber']) {
$EditionName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']);
$AddExtra = ' / ';
}
if ($Torrent['RemasterTitle']) {
$EditionName .= $AddExtra.display_str($Torrent['RemasterTitle']);
$AddExtra = ' / ';
}
$EditionName .= $AddExtra.display_str($Torrent['Media']);
} else {
$AddExtra = " / ";
$AddExtra = ' / ';
if (!$Torrent['Remastered']) {
$EditionName = "Original Release";
if($Group['RecordLabel']) { $EditionName .= $AddExtra.$Group['RecordLabel']; $AddExtra=' / '; }
if($Group['CatalogueNumber']) { $EditionName .= $AddExtra.$Group['CatalogueNumber']; $AddExtra=' / '; }
$EditionName = 'Original Release';
if ($Group['RecordLabel']) {
$EditionName .= $AddExtra.$Group['RecordLabel'];
$AddExtra = ' / ';
}
if ($Group['CatalogueNumber']) {
$EditionName .= $AddExtra.$Group['CatalogueNumber'];
$AddExtra = ' / ';
}
} else {
$EditionName = "Unknown Release(s)";
$EditionName = 'Unknown Release(s)';
}
$EditionName .= $AddExtra.display_str($Torrent['Media']);
}
@ -128,7 +143,8 @@ function transcode_parse_groups($Groups) {
unset($SphQL, $SphQLResult, $Results);
} elseif (in_array($_GET['filter'], array('snatched', 'seeding'))) {
// Read all snatched/seeding torrents
$DB->query("SELECT t.GroupID, x.fid
$DB->query("
SELECT t.GroupID, x.fid
FROM ".($_GET['filter'] == 'seeding' ? 'xbt_files_users' : 'xbt_snatched')." AS x
JOIN torrents AS t ON t.ID=x.fid
JOIN torrents_group AS tg ON tg.ID = t.GroupID
@ -136,7 +152,7 @@ function transcode_parse_groups($Groups) {
AND (t.LogScore = '100' OR t.Media != 'CD')
AND tg.CategoryID = 1
AND x.uid='$UserID'
".($_GET['filter'] == 'seeding' ? "AND x.active=1 AND x.Remaining=0" : ""));
".($_GET['filter'] == 'seeding' ? 'AND x.active=1 AND x.Remaining=0' : ''));
$Debug->set_flag('SELECTed ' . $_GET['filter'] . ' torrents');
$Snatched = $DB->to_array();
$Debug->set_flag('Received data from DB');
@ -290,10 +306,10 @@ function transcode_parse_groups($Groups) {
$FlacID = array_search(true, $Edition['FlacIDs']);
$DisplayName = $ArtistNames . '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$FlacID.'#torrent'.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
if ($GroupYear > 0) {
$DisplayName .= " [".$GroupYear."]";
$DisplayName .= " [$GroupYear]";
}
if ($ReleaseType > 0) {
$DisplayName .= " [".$ReleaseTypes[$ReleaseType]."]";
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
}
if ($Edition['FLACIsSnatched']) {
$DisplayName .= ' ' . Format::torrent_label('Snatched!');

View File

@ -104,7 +104,9 @@
);
foreach ($TorrentGroups as $Editions) {
foreach ($Editions as $Edition) {
if($Edition['FlacID'] == 0) { continue; } // no FLAC in this edition
if ($Edition['FlacID'] == 0) { // no FLAC in this edition
continue;
}
$edition_miss = 0; //number of transcodes missing in this edition
foreach ($Encodings as $Encoding) {
if (!isset($Edition['Formats'][$Encoding])) {
@ -159,10 +161,10 @@
}
$DisplayName = $ArtistNames . '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$Edition['FlacID'].'#torrent'.$Edition['FlacID'].'" title="View Torrent">'.$GroupName.'</a>';
if ($GroupYear > 0) {
$DisplayName .= " [".$GroupYear."]";
$DisplayName .= " [$GroupYear]";
}
if ($ReleaseType > 0) {
$DisplayName .= " [".$ReleaseTypes[$ReleaseType]."]";
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
}
$DisplayName .= ' ['.$Edition['Medium'].']';

View File

@ -4,7 +4,9 @@
authorize();
if (!Bookmarks::can_bookmark($_GET['type'])) { error(404); }
if (!Bookmarks::can_bookmark($_GET['type'])) {
error(404);
}
$Feed = new FEED;
$Text = new TEXT;
@ -16,46 +18,66 @@
error(0);
}
$DB->query("SELECT UserID FROM $Table WHERE UserID='$LoggedUser[ID]' AND $Col='".db_string($_GET['id'])."'");
$DB->query("
SELECT UserID
FROM $Table
WHERE UserID='$LoggedUser[ID]'
AND $Col='".db_string($_GET['id'])."'");
if ($DB->record_count() == 0) {
if ($Type === 'torrent') {
$DB->query('SELECT MAX(Sort) FROM `bookmarks_torrents` WHERE UserID =' . $LoggedUser['ID']);
list($Sort) = $DB->next_record();
if (!$Sort) $Sort = 0;
$Sort += 1;
$DB->query("INSERT IGNORE INTO $Table
(UserID, $Col, Time, Sort)
VALUES
('$LoggedUser[ID]', '".db_string($_GET['id'])."', '".sqltime()."', $Sort)");
$DB->query("
INSERT IGNORE INTO $Table (UserID, $Col, Time, Sort)
VALUES ('$LoggedUser[ID]', '".db_string($_GET['id'])."', '".sqltime()."', $Sort)");
} else {
$DB->query("INSERT IGNORE INTO $Table
(UserID, $Col, Time)
VALUES
('$LoggedUser[ID]', '".db_string($_GET['id'])."', '".sqltime()."')");
$DB->query("
INSERT IGNORE INTO $Table (UserID, $Col, Time)
VALUES ('$LoggedUser[ID]', '".db_string($_GET['id'])."', '".sqltime()."')");
}
$Cache->delete_value('bookmarks_'.$Type.'_'.$LoggedUser['ID']);
if ($Type == 'torrent') {
$Cache->delete_value('bookmarks_group_ids_' . $UserID);
$GroupID = (int) $_GET['id'];
$DB->query("SELECT Name, Year, WikiBody, TagList FROM torrents_group WHERE ID = '$GroupID'");
$DB->query("
SELECT Name, Year, WikiBody, TagList
FROM torrents_group
WHERE ID = '$GroupID'");
list($GroupTitle, $Year, $Body, $TagList) = $DB->next_record();
$TagList = str_replace('_','.',$TagList);
$DB->query("SELECT ID, Format, Encoding, HasLog, HasCue, LogScore, Media, Scene, FreeTorrent, UserID FROM torrents WHERE GroupID = '$GroupID'");
$DB->query("
SELECT ID, Format, Encoding, HasLog, HasCue, LogScore, Media, Scene, FreeTorrent, UserID
FROM torrents
WHERE GroupID = '$GroupID'");
// RSS feed stuff
while ($Torrent = $DB->next_record()) {
$Title = $GroupTitle;
list($TorrentID, $Format, $Bitrate, $HasLog, $HasCue, $LogScore, $Media, $Scene, $Freeleech, $UploaderID) = $Torrent;
$Title .= " [".$Year."] - ";
$Title .= " [$Year] - ";
$Title .= $Format." / ".$Bitrate;
if ($HasLog == "'1'") { $Title .= " / Log"; }
if ($HasLog) { $Title .= " / ".$LogScore.'%'; }
if ($HasCue == "'1'") { $Title .= " / Cue"; }
if ($HasLog == "'1'") {
$Title .= " / Log";
}
if ($HasLog) {
$Title .= " / ".$LogScore.'%';
}
if ($HasCue == "'1'") {
$Title .= " / Cue";
}
$Title .= " / ".trim($Media);
if ($Scene == "1") { $Title .= " / Scene"; }
if ($Freeleech == "1") { $Title .= " / Freeleech!"; }
if ($Freeleech == "2") { $Title .= " / Neutral leech!"; }
if ($Scene == '1') {
$Title .= " / Scene";
}
if ($Freeleech == '1') {
$Title .= " / Freeleech!";
}
if ($Freeleech == '2') {
$Title .= " / Neutral leech!";
}
$UploaderInfo = Users::user_info($UploaderID);
$Item = $Feed->item($Title,

View File

@ -6,7 +6,9 @@
}
$UserID = $_GET['userid'];
$Sneaky = ($UserID != $LoggedUser['ID']);
if(!is_number($UserID)) { error(404); }
if (!is_number($UserID)) {
error(404);
}
$DB->query("SELECT Username FROM users_main WHERE ID='$UserID'");
list($Username) = $DB->next_record();
} else {
@ -17,7 +19,8 @@
//$ArtistList = Bookmarks::all_bookmarks('artist', $UserID);
$DB->query('SELECT ag.ArtistID, ag.Name
$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.'
@ -62,11 +65,16 @@
<tr class="row<?=$Row?> bookmark_<?=$ArtistID?>">
<td>
<a href="artist.php?id=<?=$ArtistID?>"><?=$Name?></a>
<span style="float: right">
<span style="float: right;">
<?
if (check_perms('site_torrents_notify')) {
if (($Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID'])) === false) {
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE UserID='$LoggedUser[ID]' AND Label='Artist notifications' LIMIT 1");
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE UserID='$LoggedUser[ID]'
AND Label='Artist notifications'
LIMIT 1");
$Notify = $DB->next_record(MYSQLI_ASSOC);
$Cache->cache_value('notify_artists_'.$LoggedUser['ID'], $Notify, 0);
}

View File

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

View File

@ -31,7 +31,9 @@ function has_bookmarked($Type, $ID) {
function all_bookmarks($Type, $UserID = false) {
global $DB, $Cache, $LoggedUser;
if ($UserID === false) { $UserID = $LoggedUser['ID']; }
if ($UserID === false) {
$UserID = $LoggedUser['ID'];
}
$CacheKey = 'bookmarks_'.$Type.'_'.$UserID;
if (($Bookmarks = $Cache->get_value($CacheKey)) === FALSE) {
list($Table, $Col) = bookmark_schema($Type);

View File

@ -1,7 +1,9 @@
<?
authorize();
if (!Bookmarks::can_bookmark($_GET['type'])) { error(404); }
if (!Bookmarks::can_bookmark($_GET['type'])) {
error(404);
}
$Type = $_GET['type'];
@ -11,7 +13,10 @@
error(0);
}
$DB->query("DELETE FROM $Table WHERE UserID='".$LoggedUser['ID']."' AND $Col='".db_string($_GET['id'])."'");
$DB->query("
DELETE FROM $Table
WHERE UserID='".$LoggedUser['ID']."'
AND $Col='".db_string($_GET['id'])."'");
$Cache->delete_value('bookmarks_'.$Type.'_'.$UserID);
if ($Type === 'torrent') {

View File

@ -66,7 +66,9 @@ function compare($X, $Y) {
if ($GroupYear > 0) {
$DisplayName = $DisplayName . " [$GroupYear]";
}
if ($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
// Start an output buffer, so we can store this output in $TorrentTable

View File

@ -19,7 +19,7 @@
</div>
<?
} else {
if(!isset($_POST["accept"])) {
if (!isset($_POST['accept'])) {
?>
<div class="thin">
<div class="header">
@ -51,13 +51,13 @@
</div>
<?
} else {
$nick = $LoggedUser["Username"];
$nick = $LoggedUser['Username'];
$nick = preg_replace('/[^a-zA-Z0-9\[\]\\`\^\{\}\|_]/', '', $nick);
if (strlen($nick) == 0) {
$nick = "WhatGuest????";
$nick = 'WhatGuest????';
} else {
if (is_numeric(substr($nick, 0, 1))) {
$nick = "_" . $nick;
$nick = '_' . $nick;
}
}
?>

View File

@ -1,11 +1,13 @@
<?
authorize();
if(empty($_POST['collageid']) || !is_number($_POST['collageid']) || $_POST['body']==='' || !isset($_POST['body'])) { error(0); }
if (empty($_POST['collageid']) || !is_number($_POST['collageid']) || $_POST['body'] === '' || !isset($_POST['body'])) {
error(0);
}
$CollageID = $_POST['collageid'];
if ($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed'); // Should this be logged?
error('Your posting privileges have been removed'); // Should this be logged?
}
$DB->query("INSERT INTO collages_comments

View File

@ -146,8 +146,12 @@ function compare($X, $Y) {
}
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if ($GroupYear > 0) { $DisplayName = $DisplayName. ' ['. $GroupYear .']';}
if ($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
if ($GroupYear > 0) {
$DisplayName = "$DisplayName [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
$SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();

View File

@ -1,13 +1,19 @@
<?php
$CollageID = $_GET['collageid'];
if(!is_number($CollageID)) { error(0); }
if (!is_number($CollageID)) {
error(0);
}
$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')) { error(403); }
if ($CategoryID == 0 && $UserID != $LoggedUser['ID'] && !check_perms('site_collages_delete')) {
error(403);
}
$DB->query("SELECT ct.GroupID,
$DB->query("
SELECT
ct.GroupID,
um.ID,
um.Username,
ct.Sort,
@ -70,7 +76,7 @@
<th style="width: 15%"><span>Artist</span></th>
<th><span>Torrent</span></th>
<th style="width: 1%"><span>User</span></th>
<th style="width:1%; text-align: right" class="nobr"><span><abbr title="Modify an individual row.">Tweak</abbr></span></th>
<th style="width: 1%; text-align: right;" class="nobr"><span><abbr title="Modify an individual row.">Tweak</abbr></span></th>
</tr>
</thead>
<tbody>
@ -93,7 +99,9 @@
}
$TorrentLink = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
$GroupYear = $GroupYear > 0 ? $GroupYear : '';
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
}
$AltCSS = $Number % 2 === 0 ? 'rowa' : 'rowb';
?>

View File

@ -13,11 +13,11 @@
} else {
$DB->query("UPDATE collages SET Deleted = '0' WHERE ID=$CollageID");
$Cache->delete_value('collage_'.$CollageID);
Misc::write_log("Collage ".$CollageID." was recovered by ".$LoggedUser['Username']);
Misc::write_log("Collage $CollageID was recovered by ".$LoggedUser['Username']);
header("Location: collages.php?id=$CollageID");
}
}
View::show_header("Collage recovery!");
View::show_header('Collage recovery!');
?>
<div class="thin center">
<div class="box" style="width: 600px; margin: 0px auto;">

View File

@ -16,7 +16,19 @@
$PostID = $_POST['post'];
// Mainly
$DB->query("SELECT cc.Body, cc.UserID, cc.CollageID, (SELECT COUNT(ID) FROM collages_comments WHERE ID <= ".$PostID." AND collages_comments.CollageID = cc.CollageID) FROM collages_comments AS cc WHERE cc.ID='$PostID'");
$DB->query("
SELECT
cc.Body,
cc.UserID,
cc.CollageID,
(
SELECT COUNT(ID)
FROM collages_comments
WHERE ID <= $PostID
AND collages_comments.CollageID = cc.CollageID
)
FROM collages_comments AS cc
WHERE cc.ID='$PostID'");
list($OldBody, $AuthorID, $CollageID, $PostNum) = $DB->next_record();
// Make sure they aren't trying to edit posts they shouldn't
@ -29,7 +41,9 @@
}
// Perform the update
$DB->query("UPDATE collages_comments SET
$DB->query("
UPDATE collages_comments
SET
Body = '$Body'
WHERE ID='$PostID'");
@ -40,8 +54,9 @@
$CatalogueID = floor((POSTS_PER_PAGE * $PageNum - POSTS_PER_PAGE) / THREAD_CATALOGUE);
$Cache->delete_value('collage_'.$CollageID.'_catalogue_'.$CatalogueID);
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('collages', ".$PostID.", ".$UserID.", '".sqltime()."', '".db_string($OldBody)."')");
$DB->query("
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('collages', $PostID, $UserID, '".sqltime()."', '".db_string($OldBody)."')");
// This gets sent to the browser, which echoes it in place of the old body
echo $Text->full_format($_POST['body']);

View File

@ -7,7 +7,7 @@
if (!is_number($ThreadID)) {
error(404);
}
if(!check_perms("site_moderate_forums")) {
if (!check_perms('site_moderate_forums')) {
$DB->query("SELECT ForumID FROM forums_topics WHERE ID = $ThreadID");
list($ForumID) = $DB->next_record();
if (!in_array($ForumID, $ForumsRevealVoters)) {
@ -24,7 +24,10 @@
$Answers[] = $NewOption;
$Answers = serialize($Answers);
$DB->query("UPDATE forums_polls SET Answers = '".db_string($Answers)."' WHERE TopicID = ".$ThreadID);
$DB->query("
UPDATE forums_polls
SET Answers = '".db_string($Answers)."'
WHERE TopicID = ".$ThreadID);
$Cache->delete_value('polls_'.$ThreadID);
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);

View File

@ -1,17 +1,23 @@
<?
authorize();
if(!isset($_GET['forumid']) || ($_GET['forumid']!='all' && !is_number($_GET['forumid']))) { error(403); }
if (!isset($_GET['forumid']) || ($_GET['forumid'] != 'all' && !is_number($_GET['forumid']))) {
error(403);
}
if ($_GET['forumid'] == 'all') {
$DB->query("UPDATE users_info SET CatchupTime=NOW() WHERE UserID=$LoggedUser[ID]");
$DB->query("
UPDATE users_info
SET CatchupTime=NOW()
WHERE UserID=$LoggedUser[ID]");
$Cache->delete_value('user_info_'.$LoggedUser['ID']);
header('Location: forums.php');
} else {
// Insert a value for each topic
$DB->query("INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
SELECT '$LoggedUser[ID]', ID, LastPostID FROM
forums_topics
$DB->query("
INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
SELECT '$LoggedUser[ID]', ID, LastPostID
FROM forums_topics
WHERE (LastPostTime>'".time_minus(3600 * 24 * 30)."' OR IsSticky='1')
AND ForumID = ".$_GET['forumid']."
ON DUPLICATE KEY UPDATE PostID=LastPostID");

View File

@ -4,7 +4,6 @@
$NewVote = $_GET['vote'];
if (is_number($ThreadID) && is_number($NewVote)) {
if (!check_perms("site_moderate_forums")) {
$DB->query("SELECT ForumID FROM forums_topics WHERE ID = $ThreadID");
list($ForumID) = $DB->next_record();
@ -13,7 +12,11 @@
}
}
$DB->query("UPDATE forums_polls_votes SET Vote = ".$NewVote." WHERE TopicID = ".$ThreadID." AND UserID = ".$LoggedUser['ID']);
$DB->query("
UPDATE forums_polls_votes
SET Vote = $NewVote
WHERE TopicID = $ThreadID
AND UserID = ".$LoggedUser['ID']);
$Cache->delete_value('polls_'.$ThreadID);
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);

View File

@ -1,7 +1,9 @@
<?
authorize();
// Quick SQL injection check
if(!isset($_GET['postid']) || !is_number($_GET['postid'])) { error(0); }
if (!isset($_GET['postid']) || !is_number($_GET['postid'])) {
error(0);
}
$PostID = $_GET['postid'];
// Make sure they are moderators
@ -10,7 +12,8 @@
}
// Get topicid, forumid, number of pages
$DB->query("SELECT
$DB->query("
SELECT
TopicID,
ForumID,
CEIL(COUNT(p.ID)/".POSTS_PER_PAGE.") AS Pages,
@ -18,7 +21,11 @@
StickyPostID
FROM forums_posts AS p
JOIN forums_topics AS t ON t.ID=p.TopicID
WHERE p.TopicID=(SELECT TopicID FROM forums_posts WHERE ID='$PostID')
WHERE p.TopicID=(
SELECT TopicID
FROM forums_posts
WHERE ID='$PostID'
)
GROUP BY t.ID");
list($TopicID, $ForumID, $Pages, $Page, $StickyPostID) = $DB->next_record();
@ -30,22 +37,50 @@
$DB->query("SELECT MAX(ID) FROM forums_posts WHERE TopicID='$TopicID'");
list($LastID) = $DB->next_record();
$DB->query("UPDATE forums AS f, forums_topics AS t SET f.NumPosts=f.NumPosts-1, t.NumPosts=t.NumPosts-1 WHERE f.ID='$ForumID' AND t.ID='$TopicID'");
$DB->query("
UPDATE forums AS f, forums_topics AS t
SET f.NumPosts=f.NumPosts-1, t.NumPosts=t.NumPosts-1
WHERE f.ID='$ForumID' AND t.ID='$TopicID'");
if ($LastID < $PostID) { // Last post in a topic was removed
$DB->query("SELECT p.AuthorID, u.Username, p.AddedTime FROM forums_posts AS p LEFT JOIN users_main AS u ON u.ID = p.AuthorID WHERE p.ID='$LastID'");
$DB->query("
SELECT p.AuthorID, u.Username, p.AddedTime
FROM forums_posts AS p
LEFT JOIN users_main AS u ON u.ID = p.AuthorID
WHERE p.ID='$LastID'");
list($LastAuthorID, $LastAuthorName, $LastTime) = $DB->next_record();
$DB->query("UPDATE forums_topics SET LastPostID='$LastID', LastPostAuthorID='$LastAuthorID', LastPostTime='$LastTime' WHERE ID='$TopicID'");
$DB->query("SELECT
t.ID, t.Title, t.LastPostID, t.LastPostTime, t.LastPostAuthorID, u.Username
$DB->query("
UPDATE forums_topics
SET
LastPostID='$LastID',
LastPostAuthorID='$LastAuthorID',
LastPostTime='$LastTime'
WHERE ID='$TopicID'");
$DB->query("
SELECT
t.ID,
t.Title,
t.LastPostID,
t.LastPostTime,
t.LastPostAuthorID,
u.Username
FROM forums_topics AS t
LEFT JOIN users_main AS u ON u.ID = t.LastPostAuthorID
WHERE ForumID='$ForumID' AND t.ID<>'$TopicID'
ORDER BY LastPostID DESC LIMIT 1");
ORDER BY LastPostID DESC
LIMIT 1");
list($LastTopicID, $LastTopicTitle, $LastTopicPostID, $LastTopicPostTime, $LastTopicAuthorID, $LastTopicAuthorName) = $DB->next_record(MYSQLI_BOTH, false);
if ($LastID < $LastTopicPostID) { // Topic is no longer the most recent in its forum
$DB->query("UPDATE forums SET LastPostTopicID='$LastTopicID', LastPostID='$LastTopicPostID', LastPostAuthorID='$LastTopicAuthorID', LastPostTime='$LastTopicPostTime' WHERE ID='$ForumID' AND LastPostTopicID='$TopicID'");
$DB->query("
UPDATE forums
SET
LastPostTopicID='$LastTopicID',
LastPostID='$LastTopicPostID',
LastPostAuthorID='$LastTopicAuthorID',
LastPostTime='$LastTopicPostTime'
WHERE ID='$ForumID'
AND LastPostTopicID='$TopicID'");
$UpdateArrayForums = array(
'NumPosts' => '-1',
'LastPostID' => $LastTopicPostID,
@ -54,7 +89,14 @@
'LastPostTopicID' => $LastTopicID,
'Title' => $LastTopicTitle);
} else { // Topic is still the most recent in its forum
$DB->query("UPDATE forums SET LastPostID='$LastID', LastPostAuthorID='$LastAuthorID', LastPostTime='$LastTime' WHERE ID='$ForumID' AND LastPostTopicID='$TopicID'");
$DB->query("
UPDATE forums
SET
LastPostID='$LastID',
LastPostAuthorID='$LastAuthorID',
LastPostTime='$LastTime'
WHERE ID='$ForumID'
AND LastPostTopicID='$TopicID'");
$UpdateArrayForums = array(
'NumPosts' => '-1',
'LastPostID' => $LastID,

View File

@ -1,6 +1,6 @@
<?
authorize();
if(!check_perms("site_moderate_forums")) {
if (!check_perms('site_moderate_forums')) {
error(404);
}
@ -14,7 +14,7 @@
error(403);
}
$DB->query("SELECT Answers FROM forums_polls WHERE TopicID = ".$ThreadID);
$DB->query("SELECT Answers FROM forums_polls WHERE TopicID = $ThreadID");
if ($DB->record_count() < 1) {
error(404);
}
@ -24,11 +24,17 @@
unset($Answers[$PollOption]);
$Answers = serialize($Answers);
$DB->query("UPDATE forums_polls SET Answers = '".db_string($Answers)."' WHERE TopicID = ".$ThreadID);
$DB->query("DELETE FROM forums_polls_votes WHERE Vote = ".$PollOption." AND TopicID = ".$ThreadID);
$DB->query("
UPDATE forums_polls
SET Answers = '".db_string($Answers)."'
WHERE TopicID = $ThreadID");
$DB->query("
DELETE FROM forums_polls_votes
WHERE Vote = $PollOption
AND TopicID = $ThreadID");
$Cache->delete_value('polls_'.$ThreadID);
header("Location: forums.php?action=viewthread&threadid=".$ThreadID);
header('Location: forums.php?action=viewthread&threadid='.$ThreadID);
} else {
error(404);

View File

@ -15,12 +15,17 @@
if (!empty($_POST['add']) || (!empty($_POST['del']))) {
if (!empty($_POST['add'])) {
if (is_number($_POST['new_thread'])) {
$DB->query("INSERT INTO forums_specific_rules (ForumID, ThreadID) VALUES (".$ForumID.", ".$_POST['new_thread'].")");
$DB->query("
INSERT INTO forums_specific_rules (ForumID, ThreadID)
VALUES ($ForumID, ".$_POST['new_thread'].')');
}
}
if (!empty($_POST['del'])) {
if (is_number($_POST['threadid'])) {
$DB->query("DELETE FROM forums_specific_rules WHERE ForumID = ".$ForumID." AND ThreadID = ".$_POST['threadid']);
$DB->query("
DELETE FROM forums_specific_rules
WHERE ForumID = $ForumID
AND ThreadID = ".$_POST['threadid']);
}
}
$Cache->delete_value('forums_list');

View File

@ -15,13 +15,19 @@
//Now if we have IDs' we run the query
if (!empty($TopicIDs)) {
$DB->query("SELECT
$DB->query("
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(ID)
FROM forums_posts
WHERE forums_posts.TopicID = l.TopicID
AND forums_posts.ID<=l.PostID
)/$PerPage) AS Page
FROM forums_last_read_topics AS l
WHERE TopicID IN(".implode(',',$TopicIDs).") AND
UserID='$LoggedUser[ID]'");
WHERE TopicID IN(".implode(',',$TopicIDs).")
AND UserID='$LoggedUser[ID]'");
$LastRead = $DB->to_array('TopicID', MYSQLI_ASSOC);
} else {
$LastRead = array();
@ -74,8 +80,12 @@
$Read = 'read';
}
/* Removed per request, as distracting
if($Locked) { $Read .= "_locked"; }
if($Sticky) { $Read .= "_sticky"; }
if ($Locked) {
$Read .= "_locked";
}
if ($Sticky) {
$Read .= "_sticky";
}
*/
?>
<tr class="row<?=$Row?>">

View File

@ -1,16 +1,28 @@
<?
authorize();
if(!check_perms('forums_polls_moderate')) { error(403,true); }
if(!isset($_POST['topicid']) || !is_number($_POST['topicid'])) { error(0,true); }
if (!check_perms('forums_polls_moderate')) {
error(403,true);
}
if (!isset($_POST['topicid']) || !is_number($_POST['topicid'])) {
error(0,true);
}
$TopicID = $_POST['topicid'];
//Currently serves as a Featured Toggle
if (!list($Question,$Answers,$Votes,$Featured,$Closed) = $Cache->get_value('polls_'.$TopicID)) {
$DB->query("SELECT Question, Answers, Featured, Closed FROM forums_polls WHERE TopicID='".$TopicID."'");
$DB->query("
SELECT Question, Answers, Featured, Closed
FROM forums_polls
WHERE TopicID='".$TopicID."'");
list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
$Answers = unserialize($Answers);
$DB->query("SELECT Vote, COUNT(UserID) FROM forums_polls_votes WHERE TopicID='$TopicID' AND Vote <> '0' GROUP BY Vote");
$DB->query("
SELECT Vote, COUNT(UserID)
FROM forums_polls_votes
WHERE TopicID='$TopicID'
AND Vote <> '0'
GROUP BY Vote");
$VoteArray = $DB->to_array(false, MYSQLI_NUM);
$Votes = array();
@ -30,13 +42,19 @@
if (!$Featured || $Featured == '0000-00-00 00:00:00') {
$Featured = sqltime();
$Cache->cache_value('polls_featured',$TopicID,0);
$DB->query('UPDATE forums_polls SET Featured=\''.sqltime().'\' WHERE TopicID=\''.$TopicID.'\'');
$DB->query('
UPDATE forums_polls
SET Featured=\''.sqltime().'\'
WHERE TopicID=\''.$TopicID.'\'');
}
}
if (isset($_POST['close'])) {
$Closed = !$Closed;
$DB->query('UPDATE forums_polls SET Closed=\''.$Closed.'\' WHERE TopicID=\''.$TopicID.'\'');
$DB->query('
UPDATE forums_polls
SET Closed=\''.$Closed.'\'
WHERE TopicID=\''.$TopicID.'\'');
}
$Cache->cache_value('polls_'.$TopicID, array($Question,$Answers,$Votes,$Featured,$Closed), 0);

View File

@ -13,7 +13,8 @@
error(404);
}
$DB->query("SELECT
$DB->query("
SELECT
CEIL(COUNT(ID)/".POSTS_PER_PAGE.") AS Pages,
CEIL(SUM(IF(ID<=$PostID,1,0))/".POSTS_PER_PAGE.") AS Page
FROM forums_posts
@ -23,9 +24,15 @@
if ($DB->record_count()) {
list($Pages,$Page) = $DB->next_record();
if ($Delete) {
$DB->query("UPDATE forums_topics SET StickyPostID = 0 WHERE ID = ".$ThreadID);
$DB->query("
UPDATE forums_topics
SET StickyPostID = 0
WHERE ID = $ThreadID");
} else {
$DB->query("UPDATE forums_topics SET StickyPostID = ".$PostID." WHERE ID = ".$ThreadID);
$DB->query("
UPDATE forums_topics
SET StickyPostID = $PostID
WHERE ID = $ThreadID");
}
$Cache->delete_value('thread_'.$ThreadID.'_info');
$ThisCatalogue = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE);

View File

@ -43,7 +43,7 @@
$Body = $_POST['body'];
if ($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed');
error('Your posting privileges have been removed');
}
$TopicID = $_POST['thread'];
@ -51,26 +51,45 @@
$ForumID = $ThreadInfo['ForumID'];
$SQLTime = sqltime();
if(!check_forumperm($ForumID)) { error(403); }
if(!check_forumperm($ForumID, 'Write') || $LoggedUser['DisablePosting'] || $ThreadInfo['IsLocked'] == "1" && !check_perms('site_moderate_forums')) { error(403); }
if (!check_forumperm($ForumID)) {
error(403);
}
if (!check_forumperm($ForumID, 'Write') || $LoggedUser['DisablePosting'] || $ThreadInfo['IsLocked'] == '1' && !check_perms('site_moderate_forums')) {
error(403);
}
if (isset($_POST['subscribe'])) {
$DB->query("INSERT IGNORE INTO users_subscriptions VALUES ($LoggedUser[ID], '".db_string($TopicID)."')");
$DB->query("
INSERT IGNORE INTO users_subscriptions
VALUES ($LoggedUser[ID], '".db_string($TopicID)."')");
$Cache->delete_value('subscriptions_user_'.$LoggedUser['ID']);
}
//Now lets handle the special case of merging posts, we can skip bumping the thread and all that fun
if ($ThreadInfo['LastPostAuthorID'] == $LoggedUser['ID'] && ((!check_perms('site_forums_double_post') && !in_array($ForumID, $ForumsDoublePost)) || isset($_POST['merge']))) {
//Get the id for this post in the database to append
$DB->query("SELECT ID, Body FROM forums_posts WHERE TopicID='$TopicID' AND AuthorID='".$LoggedUser['ID']."' ORDER BY ID DESC LIMIT 1");
$DB->query("
SELECT ID, Body
FROM forums_posts
WHERE TopicID='$TopicID'
AND AuthorID='".$LoggedUser['ID']."'
ORDER BY ID DESC
LIMIT 1");
list($PostID, $OldBody) = $DB->next_record(MYSQLI_NUM, false);
//Edit the post
$DB->query("UPDATE forums_posts SET Body = CONCAT(Body,'"."\n\n".db_string($Body)."'), EditedUserID = '".$LoggedUser['ID']."', EditedTime = '".$SQLTime."' WHERE ID='$PostID'");
$DB->query("
UPDATE forums_posts
SET
Body = CONCAT(Body,'"."\n\n".db_string($Body)."'),
EditedUserID = '".$LoggedUser['ID']."',
EditedTime = '$SQLTime'
WHERE ID='$PostID'");
//Store edit history
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('forums', ".$PostID.", ".$LoggedUser['ID'].", '".$SQLTime."', '".db_string($OldBody)."')");
$DB->query("
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('forums', $PostID, ".$LoggedUser['ID'].", '$SQLTime', '".db_string($OldBody)."')");
$Cache->delete_value("forums_edits_$PostID");
//Get the catalogue it is in
@ -102,26 +121,31 @@
//Now we're dealing with a normal post
} else {
//Insert the post into the posts database
$DB->query("INSERT INTO forums_posts (TopicID, AuthorID, AddedTime, Body)
VALUES ('$TopicID', '".$LoggedUser['ID']."', '".$SQLTime."', '".db_string($Body)."')");
$DB->query("
INSERT INTO forums_posts (TopicID, AuthorID, AddedTime, Body)
VALUES ('$TopicID', '".$LoggedUser['ID']."', '$SQLTime', '".db_string($Body)."')");
$PostID = $DB->inserted_id();
//This updates the root index
$DB->query("UPDATE forums SET
$DB->query("
UPDATE forums
SET
NumPosts = NumPosts+1,
LastPostID = '$PostID',
LastPostAuthorID = '".$LoggedUser['ID']."',
LastPostTopicID = '$TopicID',
LastPostTime = '".$SQLTime."'
LastPostTime = '$SQLTime'
WHERE ID = '$ForumID'");
//Update the topic
$DB->query("UPDATE forums_topics SET
$DB->query("
UPDATE forums_topics
SET
NumPosts = NumPosts+1,
LastPostID = '$PostID',
LastPostAuthorID = '".$LoggedUser['ID']."',
LastPostTime = '".$SQLTime."'
LastPostTime = '$SQLTime'
WHERE ID = '$TopicID'");
//if cache exists modify it, if not, then it will be correct when selected next, and we can skip this block
@ -147,7 +171,16 @@
//Never know if we get a page full of stickies...
if ($Stickies < TOPICS_PER_PAGE || $ThreadInfo['IsSticky'] == 1) {
//Pull the data for the thread we're bumping
$DB->query("SELECT f.AuthorID, f.IsLocked, f.IsSticky, f.NumPosts, ISNULL(p.TopicID) AS NoPoll FROM forums_topics AS f LEFT JOIN forums_polls AS p ON p.TopicID=f.ID WHERE f.ID ='$TopicID'");
$DB->query("
SELECT
f.AuthorID,
f.IsLocked,
f.IsSticky,
f.NumPosts,
ISNULL(p.TopicID) AS NoPoll
FROM forums_topics AS f
LEFT JOIN forums_polls AS p ON p.TopicID=f.ID
WHERE f.ID ='$TopicID'");
list($AuthorID,$IsLocked,$IsSticky,$NumPosts,$NoPoll) = $DB->next_record();
$Part2 = array($TopicID => array(
'ID' => $TopicID,
@ -172,8 +205,12 @@
$Part1 = array();
$Part3 = $Forum;
}
if (is_null($Part1)) { $Part1 = array(); }
if (is_null($Part3)) { $Part3 = array(); }
if (is_null($Part1)) {
$Part1 = array();
}
if (is_null($Part3)) {
$Part3 = array();
}
if ($ThreadInfo['IsSticky'] == 1) {
$Forum = $Part2 + $Part1 + $Part3; //Merge it
} else {

View File

@ -33,18 +33,20 @@
$DoPM = isset($_POST['pm']) ? $_POST['pm'] : 0;
// Mainly
$DB->query("SELECT
$DB->query("
SELECT
p.Body,
p.AuthorID,
p.TopicID,
t.IsLocked,
t.ForumID,
f.MinClassWrite,
CEIL((SELECT COUNT(ID)
CEIL((
SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = p.TopicID
AND forums_posts.ID <= '$PostID')/".POSTS_PER_PAGE.")
AS Page
AND forums_posts.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
@ -60,7 +62,7 @@
error(403,true);
}
if ($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed.', true);
error('Your posting privileges have been removed.', true);
}
if ($DB->record_count() == 0) {
error(404,true);
@ -69,14 +71,16 @@
// Send a PM to the user to notify them of the edit
if ($UserID != $AuthorID && $DoPM) {
$PMSubject = 'Your post #'.$PostID.' has been edited';
$PMurl = 'https://'.NONSSL_SITE_URL.'/forums.php?action=viewthread&postid='.$PostID.'#post'.$PostID;
$ProfLink = '[url=https://'.NONSSL_SITE_URL.'/user.php?id='.$UserID.']'.$LoggedUser['Username'].'[/url]';
$PMurl = 'https://'.SSL_SITE_URL.'/forums.php?action=viewthread&postid='.$PostID.'#post'.$PostID;
$ProfLink = '[url=https://'.SSL_SITE_URL.'/user.php?id='.$UserID.']'.$LoggedUser['Username'].'[/url]';
$PMBody = 'One of your posts has been edited by '.$ProfLink.': [url]'.$PMurl.'[/url]';
Misc::send_pm($AuthorID, 0, $PMSubject, $PMBody);
}
// Perform the update
$DB->query("UPDATE forums_posts SET
$DB->query("
UPDATE forums_posts
SET
Body = '" . db_string($Body) . "',
EditedUserID = '$UserID',
EditedTime = '".$SQLTime."'
@ -107,8 +111,9 @@
$Cache->cache_value('thread_'.$TopicID.'_info', $ThreadInfo, 0);
}
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('forums', ".$PostID.", ".$UserID.", '".$SQLTime."', '".db_string($OldBody)."')");
$DB->query("
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('forums', $PostID, $UserID, '$SQLTime', '".db_string($OldBody)."')");
$Cache->delete_value("forums_edits_$PostID");
// This gets sent to the browser, which echoes it in place of the old body
echo $Text->full_format($Body);

View File

@ -19,8 +19,7 @@
if (!isset($_GET['threadid']) || !is_number($_GET['threadid'])) {
if (isset($_GET['topicid']) && is_number($_GET['topicid'])) {
$ThreadID = $_GET['topicid'];
}
elseif(isset($_GET['postid']) && is_number($_GET['postid'])) {
} elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
$DB->query("SELECT TopicID FROM forums_posts WHERE ID = $_GET[postid]");
list($ThreadID) = $DB->next_record();
if ($ThreadID) {
@ -61,7 +60,11 @@
if (isset($_GET['post']) && is_number($_GET['post'])) {
$PostNum = $_GET['post'];
} elseif (isset($_GET['postid']) && is_number($_GET['postid']) && $_GET['postid'] != $ThreadInfo['StickyPostID']) {
$SQL = "SELECT COUNT(ID) FROM forums_posts WHERE TopicID = $ThreadID AND ID <= $_GET[postid]";
$SQL = "
SELECT COUNT(ID)
FROM forums_posts
WHERE TopicID = $ThreadID
AND ID <= $_GET[postid]";
if ($ThreadInfo['StickyPostID'] < $_GET['postid']) {
$SQL .= " AND ID != $ThreadInfo[StickyPostID]";
}
@ -81,7 +84,8 @@
// 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)) {
$DB->query("SELECT
$DB->query("
SELECT
p.ID,
p.AuthorID,
p.AddedTime,
@ -91,7 +95,8 @@
ed.Username
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']."'
WHERE p.TopicID = '$ThreadID'
AND p.ID != '".$ThreadInfo['StickyPostID']."'
LIMIT $CatalogueLimit");
$Catalogue = $DB->to_array(false,MYSQLI_ASSOC);
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
@ -112,12 +117,16 @@
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
$DB->query("SELECT PostID From forums_last_read_topics WHERE UserID='$LoggedUser[ID]' AND TopicID='$ThreadID'");
$DB->query("
SELECT PostID
FROM forums_last_read_topics
WHERE UserID='$LoggedUser[ID]'
AND TopicID='$ThreadID'");
list($LastRead) = $DB->next_record();
if ($LastRead < $LastPost) {
$DB->query("INSERT INTO forums_last_read_topics
(UserID, TopicID, PostID) VALUES
('$LoggedUser[ID]', '".$ThreadID ."', '".db_string($LastPost)."')
$DB->query("
INSERT INTO forums_last_read_topics (UserID, TopicID, PostID)
VALUES ('$LoggedUser[ID]', '$ThreadID', '".db_string($LastPost)."')
ON DUPLICATE KEY UPDATE PostID='$LastPost'");
}
}
@ -139,7 +148,12 @@
}
$DB->query("UPDATE users_notify_quoted SET UnRead = false WHERE UserID = '$LoggedUser[ID]' AND Page = 'forums' AND PageID = '$ThreadID'");
$DB->query("
UPDATE users_notify_quoted
SET UnRead = false
WHERE UserID = '$LoggedUser[ID]'
AND Page = 'forums'
AND PageID = '$ThreadID'");
$Cache->delete_value('notify_quoted_' . $LoggedUser['ID']);
/*
$QuoteNotificationsCount = $Cache->get_value('notify_quoted_' . $LoggedUser['ID']);
@ -151,7 +165,7 @@
*/
// Start printing
View::show_header($ThreadInfo['Title'] . ' < '.$Forums[$ForumID]['Name'].' < '. 'Forums','comments,subscriptions,bbcode,jquery');
View::show_header($ThreadInfo['Title'] . ' &lt; '.$Forums[$ForumID]['Name'].' &lt; Forums','comments,subscriptions,bbcode,jquery');
?>
<div class="thin">
<h2>
@ -179,7 +193,7 @@
<td><input type="text" id="username" name="user" size="70" /></td>
</tr>
<tr>
<td colspan="2" style="text-align: center">
<td colspan="2" style="text-align: center;">
<input type="hidden" name="action" value="search" />
<input type="hidden" name="threadid" value="<?=$ThreadID?>" />
<input type="submit" name="submit" value="Search" />
@ -198,10 +212,17 @@
<?
if ($ThreadInfo['NoPoll'] == 0) {
if (!list($Question,$Answers,$Votes,$Featured,$Closed) = $Cache->get_value('polls_'.$ThreadID)) {
$DB->query("SELECT Question, Answers, Featured, Closed FROM forums_polls WHERE TopicID='".$ThreadID."'");
$DB->query("
SELECT Question, Answers, Featured, Closed
FROM forums_polls
WHERE TopicID='$ThreadID'");
list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
$Answers = unserialize($Answers);
$DB->query("SELECT Vote, COUNT(UserID) FROM forums_polls_votes WHERE TopicID='$ThreadID' GROUP BY Vote");
$DB->query("
SELECT Vote, COUNT(UserID)
FROM forums_polls_votes
WHERE TopicID='$ThreadID'
GROUP BY Vote");
$VoteArray = $DB->to_array(false, MYSQLI_NUM);
$Votes = array();
@ -228,7 +249,11 @@
$RevealVoters = in_array($ForumID, $ForumsRevealVoters);
//Polls lose the you voted arrow thingy
$DB->query("SELECT Vote FROM forums_polls_votes WHERE UserID='".$LoggedUser['ID']."' AND TopicID='$ThreadID'");
$DB->query("
SELECT Vote
FROM forums_polls_votes
WHERE UserID='".$LoggedUser['ID']."'
AND TopicID='$ThreadID'");
list($UserResponse) = $DB->next_record();
if (!empty($UserResponse) && $UserResponse != 0) {
$Answers[$UserResponse] = '&raquo; '.$Answers[$UserResponse];
@ -286,7 +311,9 @@
$StaffNames[] = $Staffer['Username'];
}
$DB->query("SELECT fpv.Vote AS Vote,
$DB->query("
SELECT
fpv.Vote AS Vote,
GROUP_CONCAT(um.Username SEPARATOR ', ')
FROM users_main AS um
LEFT JOIN forums_polls_votes AS fpv ON um.ID = fpv.UserID
@ -300,7 +327,7 @@
foreach ($StaffVotesTmp as $StaffVote) {
list($Vote, $Names) = $StaffVote;
$StaffVotes[$Vote] = $Names;
$Names = explode(", ", $Names);
$Names = explode(', ', $Names);
$StaffNames = array_diff($StaffNames, $Names);
}
?> <ul style="list-style: none;" id="poll_options">

View File

@ -1,11 +1,15 @@
<?php
if (!check_perms('users_warn')) { error(404);}
if (!check_perms('users_warn')) {
error(404);
}
Misc::assert_isset_request($_POST, array('postid', 'userid', 'key'));
$PostID = (int) $_POST['postid'];
$UserID = (int)$_POST['userid'];
$Key = (int)$_POST['key'];
$UserInfo = Users::user_info($UserID);
$DB -> query(" SELECT
$DB -> query("
SELECT
p.Body,
t.ForumID
FROM forums_posts as p
@ -46,13 +50,13 @@
</select></td>
</tr>
<tr>
<td class="label">Private Message:</td>
<td class="label">Private message:</td>
<td>
<textarea id="message" style="width: 95%;" tabindex="1" onkeyup="resize('message');" name="privatemessage" cols="90" rows="4"></textarea>
</td>
</tr>
<tr>
<td class="label">Edit Post:</td>
<td class="label">Edit post:</td>
<td>
<textarea id="body" style="width: 95%;" tabindex="1" onkeyup="resize('body');" name="body" cols="90" rows="8"><?=$PostBody?></textarea>
<br />

View File

@ -2,7 +2,9 @@
authorize();
if(empty($_POST['toid'])) { error(404); }
if (empty($_POST['toid'])) {
error(404);
}
if (!empty($LoggedUser['DisablePM']) && !isset($StaffIDs[$_POST['toid']])) {
error(403);
@ -15,7 +17,7 @@
$ToID = explode(',', $_POST['toid']);
foreach ($ToID as $TID) {
if (!is_number($TID)) {
$Err = "A recipient does not exist.";
$Err = 'A recipient does not exist.';
}
}
$DB->query("SELECT UserID FROM pm_conversations_users WHERE UserID='$LoggedUser[ID]' AND ConvID='$ConvID'");
@ -25,7 +27,7 @@
} else {
$ConvID = '';
if (!is_number($_POST['toid'])) {
$Err = "This recipient does not exist.";
$Err = 'This recipient does not exist.';
} else {
$ToID = $_POST['toid'];
}

View File

@ -3,29 +3,41 @@
$UserID = $LoggedUser['ID'];
$ConvID = $_POST['convid'];
if(!is_number($ConvID)) { error(404); }
$DB->query("SELECT UserID FROM pm_conversations_users WHERE UserID='$UserID' AND ConvID='$ConvID'");
if($DB->record_count() == 0) { error(403); }
if (!is_number($ConvID)) {
error(404);
}
$DB->query("
SELECT UserID
FROM pm_conversations_users
WHERE UserID='$UserID' AND ConvID='$ConvID'");
if ($DB->record_count() == 0) {
error(403);
}
if (isset($_POST['delete'])) {
$DB->query("UPDATE pm_conversations_users SET
$DB->query("
UPDATE pm_conversations_users
SET
InInbox='0',
InSentbox='0',
Sticky='0'
WHERE ConvID='$ConvID' AND UserID='$UserID'");
} else {
if (isset($_POST['sticky'])) {
$DB->query("UPDATE pm_conversations_users SET
Sticky='1'
$DB->query("
UPDATE pm_conversations_users
SET Sticky='1'
WHERE ConvID='$ConvID' AND UserID='$UserID'");
} else {
$DB->query("UPDATE pm_conversations_users SET
Sticky='0'
$DB->query("
UPDATE pm_conversations_users
SET Sticky='0'
WHERE ConvID='$ConvID' AND UserID='$UserID'");
}
if (isset($_POST['mark_unread'])) {
$DB->query("UPDATE pm_conversations_users SET
Unread='1'
$DB->query("
UPDATE pm_conversations_users
SET Unread='1'
WHERE ConvID='$ConvID' AND UserID='$UserID'");
$Cache->increment('inbox_new_'.$UserID);
}

View File

@ -52,7 +52,7 @@
error(0);
}
if ($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed.');
error('Your posting privileges have been removed.');
}
$RequestID = $_POST['requestid'];
@ -60,11 +60,19 @@
error(404);
}
$DB->query("SELECT CEIL((SELECT COUNT(ID)+1 FROM requests_comments AS rc WHERE rc.RequestID='".$RequestID."')/".TORRENT_COMMENTS_PER_PAGE.") AS Pages");
$DB->query("
SELECT
CEIL((
SELECT COUNT(ID)+1
FROM requests_comments AS rc
WHERE rc.RequestID='".$RequestID."'
)/".TORRENT_COMMENTS_PER_PAGE."
) AS Pages");
list($Pages) = $DB->next_record();
$DB->query("INSERT INTO requests_comments (RequestID,AuthorID,AddedTime,Body) VALUES (
'".$RequestID."', '".db_string($LoggedUser['ID'])."','".sqltime()."','".db_string($_POST['body'])."')");
$DB->query("
INSERT INTO requests_comments (RequestID,AuthorID,AddedTime,Body)
VALUES ('$RequestID', '".db_string($LoggedUser['ID'])."','".sqltime()."','".db_string($_POST['body'])."')");
$PostID = $DB->inserted_id();
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
@ -109,7 +117,8 @@
}
// Mainly
$DB->query("SELECT
$DB->query("
SELECT
rc.Body,
rc.AuthorID,
rc.RequestID,
@ -118,7 +127,11 @@
WHERE rc.ID='".db_string($_POST['post'])."'");
list($OldBody, $AuthorID,$RequestID,$AddedTime)=$DB->next_record();
$DB->query("SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page FROM requests_comments WHERE RequestID = $RequestID AND ID <= $_POST[post]");
$DB->query("
SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page
FROM requests_comments
WHERE RequestID = $RequestID
AND ID <= $_POST[post]");
list($Page) = $DB->next_record();
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
@ -129,7 +142,9 @@
}
// Perform the update
$DB->query("UPDATE requests_comments SET
$DB->query("
UPDATE requests_comments
SET
Body = '".db_string($_POST['body'])."',
EditedUserID = '".db_string($LoggedUser['ID'])."',
EditedTime = '".sqltime()."'
@ -150,7 +165,8 @@
));
$Cache->commit_transaction(0);
$DB->query("INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
$DB->query("
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
VALUES ('requests', ".db_string($_POST['post']).", ".db_string($LoggedUser['ID']).", '".sqltime()."', '".db_string($OldBody)."')");
// This gets sent to the browser, which echoes it in place of the old body
@ -172,12 +188,17 @@
}
// Get topicid, forumid, number of pages
$DB->query("SELECT DISTINCT
$DB->query("
SELECT DISTINCT
RequestID,
CEIL(COUNT(rc.ID)/".TORRENT_COMMENTS_PER_PAGE.") AS Pages,
CEIL(SUM(IF(rc.ID<=".$_GET['postid'].",1,0))/".TORRENT_COMMENTS_PER_PAGE.") AS Page
FROM requests_comments AS rc
WHERE rc.RequestID=(SELECT RequestID FROM requests_comments WHERE ID='".db_string($_GET['postid'])."')");
WHERE rc.RequestID=(
SELECT RequestID
FROM requests_comments
WHERE ID='".db_string($_GET['postid'])."'
)");
list($RequestID,$Pages,$Page) = $DB->next_record();
// $Pages = number of pages in the thread

View File

@ -171,7 +171,7 @@
<option value="5"<?=($Importance == '5' ? ' selected="selected"' : '')?>>Conductor</option>
<option value="6"<?=($Importance == '6' ? ' selected="selected"' : '')?>>DJ / Compiler</option>
<option value="3"<?=($Importance == '3' ? ' selected="selected"' : '')?>>Remixer</option>
<option value="3"<?=($Importance == '7' ? ' selected="selected"' : '')?>>Producer</option>
<option value="7"<?=($Importance == '7' ? ' selected="selected"' : '')?>>Producer</option>
</select>
<? if ($First) { ?><a href="#" onclick="AddArtistField();return false;" class="brackets">+</a> <a href="#" onclick="RemoveArtistField();return false;" class="brackets">&minus;</a><? } $First = false; ?>
<br />
@ -186,6 +186,7 @@
<option value="5">Conductor</option>
<option value="6">DJ / Compiler</option>
<option value="3">Remixer</option>
<option value="7">Producer</option>
</select>
<a href="#" onclick="AddArtistField();return false;" class="brackets">+</a> <a href="#" onclick="RemoveArtistField();return false;" class="brackets">&minus;</a>
<?

View File

@ -1,4 +1,40 @@
<?
/**
* Generate a table row for a staff member on staff.php
*
* @param $Row used for alternating row colors
* @param $ID the user ID of the staff member
* @param $Paranoia the user's paranoia
* @param $Class the user class
* @param $LastAccess datetime the user last browsed the site
* @param $Remark the "Staff remark" or FLS' "Support for" text
* @param $HiddenBy the text that is displayed when a staff member's
* paranoia hides their LastAccess time
* @return string $Row
*/
function make_staff_row($Row, $ID, $Paranoia, $Class, $LastAccess, $Remark = '', $HiddenBy = 'Hidden by user') {
$Row = ($Row == 'a') ? 'b' : 'a';
echo "\t\t\t<tr class=\"row$Row\">
<td class=\"nobr\">
" . Users::format_username($ID, false, false, false) . "
</td>
<td class=\"nobr\">
"; //used for proper indentation of HTML
if (check_paranoia('lastseen', $Paranoia, $Class)) {
echo time_diff($LastAccess);
} else {
echo "$HiddenBy";
}
echo "\n\t\t\t\t</td>
<td class=\"nobr\">
$Remark
</td>
</tr>\n"; // the "\n" is needed for pretty HTML
// the foreach loop that calls this function needs to know the new value of $Row
return $Row;
}
function get_fls() {
global $Cache, $DB;
static $FLS;
@ -6,7 +42,8 @@ function get_fls() {
return $FLS;
}
if (($FLS = $Cache->get_value('fls')) === false) {
$DB->query("SELECT
$DB->query('
SELECT
m.ID,
p.Level,
m.Username,
@ -17,23 +54,34 @@ function get_fls() {
JOIN users_main AS m ON m.ID=i.UserID
JOIN permissions AS p ON p.ID=m.PermissionID
JOIN users_levels AS l ON l.UserID = i.UserID
WHERE l.PermissionID = ".FLS_TEAM);
WHERE l.PermissionID = ' . FLS_TEAM . '
ORDER BY m.Username');
$FLS = $DB->to_array(false, MYSQLI_BOTH, array(3,'Paranoia'));
$Cache->cache_value('fls', $FLS, 180);
}
return $FLS;
}
function get_forum_staff() {
global $Cache, $DB;
static $ForumStaff;
if (is_array($ForumStaff)) {
return $ForumStaff;
/*
* Build the SQL query that will be used for displaying staff members
*
* @param $StaffLevel a string for selecting the type of staff being queried
* @return string the text of the generated SQL query
*/
function generate_staff_query($StaffLevel) {
if ($StaffLevel == 'forum_staff') {
$PName = ''; // only needed for full staff
$PLevel = 'p.Level < 700';
} elseif ($StaffLevel == 'staff') {
$PName = 'p.Name,';
$PLevel = 'p.Level >= 700';
}
if (($ForumStaff = $Cache->get_value('forum_staff')) === false) {
$DB->query("SELECT
$SQL = "
SELECT
m.ID,
p.Level,
$PName
m.Username,
m.Paranoia,
m.LastAccess,
@ -42,11 +90,37 @@ function get_forum_staff() {
JOIN users_info AS i ON m.ID=i.UserID
JOIN permissions AS p ON p.ID=m.PermissionID
WHERE p.DisplayStaff='1'
AND p.Level < 700
ORDER BY p.Level, m.LastAccess ASC");
AND $PLevel
ORDER BY p.Level";
if (check_perms('users_mod')) {
$SQL.= ', m.LastAccess ASC';
} else {
$SQL.= ', m.Username';
}
return $SQL;
}
function get_forum_staff() {
global $Cache, $DB;
static $ForumStaff;
if (is_array($ForumStaff)) {
return $ForumStaff;
}
// sort the lists differently if the viewer is a staff member
if (!check_perms('users_mod')) {
if (($ForumStaff = $Cache->get_value('forum_staff')) === false) {
$DB->query(generate_staff_query('forum_staff'));
$ForumStaff = $DB->to_array(false, MYSQLI_BOTH, array(3,'Paranoia'));
$Cache->cache_value('forum_staff', $ForumStaff, 180);
}
} else {
if (($ForumStaff = $Cache->get_value('forum_staff_mod_view')) === false) {
$DB->query(generate_staff_query('forum_staff'));
$ForumStaff = $DB->to_array(false, MYSQLI_BOTH, array(3,'Paranoia'));
$Cache->cache_value('forum_staff_mod_view', $ForumStaff, 180);
}
}
return $ForumStaff;
}
@ -56,24 +130,21 @@ function get_staff() {
if (is_array($Staff)) {
return $Staff;
}
// sort the lists differently if the viewer is a staff member
if (!check_perms('users_mod')) {
if (($Staff = $Cache->get_value('staff')) === false) {
$DB->query("SELECT
m.ID,
p.Level,
p.Name,
m.Username,
m.Paranoia,
m.LastAccess,
i.SupportFor
FROM users_main AS m
JOIN users_info AS i ON m.ID=i.UserID
JOIN permissions AS p ON p.ID=m.PermissionID
WHERE p.DisplayStaff='1'
AND p.Level >= 700
ORDER BY p.Level, m.LastAccess ASC");
$DB->query(generate_staff_query('staff'));
$Staff = $DB->to_array(false, MYSQLI_BOTH, array(4,'Paranoia'));
$Cache->cache_value('staff', $Staff, 180);
}
} else {
if (($Staff = $Cache->get_value('staff_mod_view')) === false) {
$DB->query(generate_staff_query('staff'));
$Staff = $DB->to_array(false, MYSQLI_BOTH, array(4,'Paranoia'));
$Cache->cache_value('staff_mod_view', $Staff, 180);
}
}
return $Staff;
}

View File

@ -23,7 +23,7 @@
<? View::parse('generic/reply/staffpm.php', array('Hidden' => true)); ?>
<br />
<h3>First-line Support</h3>
<p><strong>These users are not official staff members</strong> - they're users who have volunteered their time to help people in need. Please treat them with respect and read <a href="wiki.php?action=article&amp;id=260">this</a> before contacting them.</p>
<p><strong>These users are not official staff members.</strong> They are users who have volunteered their time to help people in need. Please treat them with respect, and read <a href="wiki.php?action=article&amp;id=260">this</a> before contacting them.</p>
<table class="staff" width="100%">
<tr class="colhead">
<td style="width: 130px;">Username</td>
@ -34,27 +34,13 @@
$Row = 'a';
foreach ($FrontLineSupport as $Support) {
list($ID, $Class, $Username, $Paranoia, $LastAccess, $SupportFor) = $Support;
$Row = ($Row == 'a') ? 'b' : 'a';
?>
<tr class="row<?=$Row?>">
<td class="nobr">
<?=Users::format_username($ID, false, false, false) ?>
</td>
<td class="nobr">
<? if (check_paranoia('lastseen', $Paranoia, $Class)) {
echo time_diff($LastAccess);
} else {
echo 'Hidden by user';
}
?>
</td>
<td class="nobr">
<?=$SupportFor?>
</td>
</tr>
<? } ?>
$Row = make_staff_row($Row, $ID, $Paranoia, $Class, $LastAccess, $SupportFor);
} ?>
</table>
</div>
<br />
<div class="box pad" style="padding: 0px 10px 10px 10px;">
<br />
<h3>Forum Moderators</h3>
@ -69,29 +55,15 @@
$Row = 'a';
foreach ($ForumStaff as $Support) {
list($ID, $Class, $Username, $Paranoia, $LastAccess, $SupportFor) = $Support;
$Row = ($Row == 'a') ? 'b' : 'a';
?>
<tr class="row<?=$Row?>">
<td class="nobr">
<?=Users::format_username($ID, false, false, false) ?>
</td>
<td class="nobr">
<? if (check_paranoia('lastseen', $Paranoia, $Class)) {
echo time_diff($LastAccess);
} else {
echo 'Hidden by user';
}
?>
</td>
<td class="nobr">
<?=$SupportFor?>
</td>
</tr>
<? } ?>
$Row = make_staff_row($Row, $ID, $Paranoia, $Class, $LastAccess, $SupportFor);
} ?>
</table>
</div>
<br />
<div class="box pad" style="padding: 0px 10px 10px 10px;">
<br />
<?
$CurClass = 0;
$CloseTable = false;
@ -101,11 +73,12 @@
$Row = 'a';
if ($CloseTable) {
$CloseTable = false;
echo "\t</table><br />";
// the "\t" and "\n" are used here to make the HTML look pretty
echo "\t\t</table>\n\t\t<br />\n";
}
$CurClass = $Class;
$CloseTable = true;
echo '<h3>'.$ClassName.'s</h3>';
echo "\t\t<h3>".$ClassName."s</h3>\n";
?>
<table class="staff" width="100%">
<tr class="colhead">
@ -116,26 +89,12 @@
<?
} // End new class header
$HiddenBy = 'Hidden by staff member';
// Display staff members for this class
$Row = ($Row == 'a') ? 'b' : 'a';
?>
<tr class="row<?=$Row?>">
<td class="nobr">
<?=Users::format_username($ID, false, false, false) ?>
</td>
<td class="nobr">
<? if (check_paranoia('lastseen', $Paranoia, $Class)) {
echo time_diff($LastAccess);
} else {
echo 'Hidden by staff member';
}
?>
</td>
<td class="nobr">
<?=$Remark?>
</td>
</tr>
<? } ?>
$Row = make_staff_row($Row, $ID, $Paranoia, $Class, $LastAccess, $Remark, $HiddenBy);
} ?>
</table>
</div>

View File

@ -183,7 +183,7 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
error(0);
}
if ($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed.');
error('Your posting privileges have been removed.');
}
$GroupID = $_POST['groupid'];
@ -191,11 +191,18 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
error(404);
}
$DB->query("SELECT CEIL((SELECT COUNT(ID)+1 FROM torrents_comments AS tc WHERE tc.GroupID='".db_string($GroupID)."')/".TORRENT_COMMENTS_PER_PAGE.") AS Pages");
$DB->query("
SELECT
CEIL((
SELECT COUNT(ID)+1
FROM torrents_comments AS tc
WHERE tc.GroupID='".db_string($GroupID)."')/".TORRENT_COMMENTS_PER_PAGE."
) AS Pages");
list($Pages) = $DB->next_record();
$DB->query("INSERT INTO torrents_comments (GroupID,AuthorID,AddedTime,Body) VALUES (
'".db_string($GroupID)."', '".db_string($LoggedUser['ID'])."','".sqltime()."','".db_string($_POST['body'])."')");
$DB->query("
INSERT INTO torrents_comments (GroupID,AuthorID,AddedTime,Body)
VALUES ('".db_string($GroupID)."', '".db_string($LoggedUser['ID'])."','".sqltime()."','".db_string($_POST['body'])."')");
$PostID = $DB->inserted_id();
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);