diff --git a/sections/register/index.php b/sections/register/index.php
index 0ccb0009..e002a660 100644
--- a/sections/register/index.php
+++ b/sections/register/index.php
@@ -18,15 +18,15 @@
$DB->query("
SELECT ID
FROM users_main
- WHERE torrent_pass='".db_string($_REQUEST['confirm'])."'
- AND Enabled='0'");
+ WHERE torrent_pass = '".db_string($_REQUEST['confirm'])."'
+ AND Enabled = '0'");
list($UserID) = $DB->next_record();
if ($UserID) {
$DB->query("
UPDATE users_main
- SET Enabled='1'
- WHERE ID='$UserID'");
+ SET Enabled = '1'
+ WHERE ID = '$UserID'");
$Cache->increment('stats_user_count');
include('step2.php');
}
@@ -35,7 +35,7 @@
$Val->SetFields('username', true, 'regex', 'You did not enter a valid username.', array('regex' => USERNAME_REGEX));
$Val->SetFields('email', true, 'email', 'You did not enter a valid email address.');
$Val->SetFields('password', true, 'regex', 'A strong password is between 8 and 40 characters long, contains at least 1 lowercase and uppercase letter, and contains at least a number or symbol', array('regex'=>'/(?=^.{8,}$)(?=.*[^a-zA-Z])(?=.*[A-Z])(?=.*[a-z]).*$/'));
- $Val->SetFields('confirm_password', true, 'compare', 'Your passwords do not match.', array('comparefield'=>'password'));
+ $Val->SetFields('confirm_password', true, 'compare', 'Your passwords do not match.', array('comparefield' => 'password'));
$Val->SetFields('readrules', true, 'checkbox', 'You did not select the box that says you will read the rules.');
$Val->SetFields('readwiki', true, 'checkbox', 'You did not select the box that says you will read the wiki.');
$Val->SetFields('agereq', true, 'checkbox', 'You did not select the box that says you are 13 years of age or older.');
@@ -70,7 +70,7 @@
$DB->query("
SELECT InviterID, Email
FROM invites
- WHERE InviteKey='".db_string($_REQUEST['invite'])."'");
+ WHERE InviteKey = '".db_string($_REQUEST['invite'])."'");
if ($DB->record_count() == 0) {
$Err = 'Invite does not exist.';
$InviterID = 0;
@@ -107,10 +107,10 @@
INSERT INTO users_main
(Username, Email, PassHash, torrent_pass, IP, PermissionID, Enabled, Invites, Uploaded, ipcc)
VALUES
- ('".db_string(trim($_POST['username']))."','".db_string($_POST['email'])."','".db_string(Users::make_crypt_hash($_POST['password']))."','".db_string($torrent_pass)."','".db_string($_SERVER['REMOTE_ADDR'])."','$Class','$Enabled','".STARTING_INVITES."', '524288000', '$IPcc')");
+ ('".db_string(trim($_POST['username']))."', '".db_string($_POST['email'])."', '".db_string(Users::make_crypt_hash($_POST['password']))."', '".db_string($torrent_pass)."', '".db_string($_SERVER['REMOTE_ADDR'])."', '$Class', '$Enabled', '".STARTING_INVITES."', '524288000', '$IPcc')");
$UserID = $DB->inserted_id();
-
+
// User created, delete invite. If things break after this point, then it's better to have a broken account to fix than a 'free' invite floating around that can be reused
$DB->query("
@@ -165,7 +165,9 @@
// If the inviter doesn't have an invite tree
// Note: This should never happen unless you've transferred from another database, like What.CD did
if ($DB->record_count() == 0) {
- $DB->query("SELECT MAX(TreeID)+1 FROM invite_tree");
+ $DB->query("
+ SELECT MAX(TreeID) + 1
+ FROM invite_tree");
list($TreeID) = $DB->next_record();
$DB->query("
@@ -230,7 +232,7 @@
$TPL->set('SITE_NAME', SITE_NAME);
$TPL->set('SITE_URL', SITE_URL);
- Misc::send_email($_REQUEST['email'],'New account confirmation at '.SITE_NAME,$TPL->get(),'noreply');
+ Misc::send_email($_REQUEST['email'], 'New account confirmation at '.SITE_NAME, $TPL->get(), 'noreply');
Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass));
$Sent = 1;
diff --git a/sections/reports/ajax_claim_report.php b/sections/reports/ajax_claim_report.php
index ef12872b..34468781 100644
--- a/sections/reports/ajax_claim_report.php
+++ b/sections/reports/ajax_claim_report.php
@@ -11,7 +11,10 @@
}
$ID = (int)$_POST['id'];
-$DB->query("SELECT ClaimerID FROM reports WHERE ID = '$ID'");
+$DB->query("
+ SELECT ClaimerID
+ FROM reports
+ WHERE ID = '$ID'");
list($ClaimerID) = $DB->next_record();
if ($ClaimerID) {
print
@@ -23,7 +26,10 @@
die();
} else {
$UserID = $LoggedUser['ID'];
- $DB->query("UPDATE reports SET ClaimerID = '$UserID' WHERE ID = '$ID'");
+ $DB->query("
+ UPDATE reports
+ SET ClaimerID = '$UserID'
+ WHERE ID = '$ID'");
print
json_encode(
array(
diff --git a/sections/reports/ajax_resolve_report.php b/sections/reports/ajax_resolve_report.php
index 6b9e9b63..d3ee78eb 100644
--- a/sections/reports/ajax_resolve_report.php
+++ b/sections/reports/ajax_resolve_report.php
@@ -7,7 +7,10 @@
$ReportID = $_POST['reportid'];
-$DB->query('SELECT Type FROM reports WHERE ID = '.$ReportID);
+$DB->query("
+ SELECT Type
+ FROM reports
+ WHERE ID = $ReportID");
list($Type) = $DB->next_record();
if (!check_perms('admin_reports')) {
if (check_perms('site_moderate_forums')) {
@@ -23,11 +26,10 @@
$DB->query("
UPDATE reports
- SET Status='Resolved',
- ResolvedTime='".sqltime()."',
- ResolverID='".$LoggedUser['ID']."'
- WHERE ID='".db_string($ReportID)."'");
-
+ SET Status = 'Resolved',
+ ResolvedTime = '".sqltime()."',
+ ResolverID = '".$LoggedUser['ID']."'
+ WHERE ID = '".db_string($ReportID)."'");
$Channels = array();
@@ -41,12 +43,14 @@
$Cache->decrement('num_forum_reports');
}
-
-$DB->query("SELECT COUNT(ID) FROM reports WHERE Status = 'New'");
+$DB->query("
+ SELECT COUNT(ID)
+ FROM reports
+ WHERE Status = 'New'");
list($Remaining) = $DB->next_record();
foreach ($Channels as $Channel) {
- send_irc("PRIVMSG $Channel :Report $ReportID resolved by ".preg_replace("/^(.{2})/", "$1·", $LoggedUser['Username']).' on site ('.(int)$Remaining.' remaining).');
+ send_irc("PRIVMSG $Channel :Report $ReportID resolved by ".preg_replace('/^(.{2})/', '$1·', $LoggedUser['Username']).' on site ('.(int)$Remaining.' remaining).');
}
$Cache->delete_value('num_other_reports');
@@ -54,12 +58,12 @@
ajax_success();
function ajax_error($Error = 'error') {
- echo json_encode(array('status'=>$Error));
+ echo json_encode(array('status' => $Error));
die();
}
function ajax_success() {
- echo json_encode(array("status"=>"success"));
+ echo json_encode(array('status' => 'success'));
die();
}
?>
diff --git a/sections/reports/report.php b/sections/reports/report.php
index ffad2a7c..04677cf1 100644
--- a/sections/reports/report.php
+++ b/sections/reports/report.php
@@ -15,97 +15,118 @@
$ID = $_GET['id'];
switch ($Short) {
- case 'user' :
- $DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
+ case 'user':
+ $DB->query("
+ SELECT Username
+ FROM users_main
+ WHERE ID = $ID");
if ($DB->record_count() < 1) {
error(404);
}
list($Username) = $DB->next_record();
break;
- case 'request_update' :
+ case 'request_update':
$NoReason = true;
- $DB->query("SELECT Title, Description, TorrentID, CategoryID, Year FROM requests WHERE ID=".$ID);
+ $DB->query("
+ SELECT Title, Description, TorrentID, CategoryID, Year
+ FROM requests
+ WHERE ID = $ID");
if ($DB->record_count() < 1) {
error(404);
}
list($Name, $Desc, $Filled, $CategoryID, $Year) = $DB->next_record();
- if ($Filled || ($CategoryID != 0 && ($Categories[$CategoryID-1] != 'Music' || $Year != 0))) {
+ if ($Filled || ($CategoryID != 0 && ($Categories[$CategoryID - 1] != 'Music' || $Year != 0))) {
error(403);
}
break;
- case 'request' :
- $DB->query("SELECT Title, Description, TorrentID FROM requests WHERE ID=".$ID);
+ case 'request':
+ $DB->query("
+ SELECT Title, Description, TorrentID
+ FROM requests
+ WHERE ID = $ID");
if ($DB->record_count() < 1) {
error(404);
}
list($Name, $Desc, $Filled) = $DB->next_record();
break;
- case 'collage' :
- $DB->query("SELECT Name, Description FROM collages WHERE ID=".$ID);
+ case 'collage':
+ $DB->query("
+ SELECT Name, Description
+ FROM collages
+ WHERE ID = $ID");
if ($DB->record_count() < 1) {
error(404);
}
list($Name, $Desc) = $DB->next_record();
break;
- case 'thread' :
+ case 'thread':
$DB->query("
SELECT ft.Title, ft.ForumID, um.Username
FROM forums_topics AS ft
- JOIN users_main AS um ON um.ID=ft.AuthorID
- WHERE ft.ID=".$ID);
+ JOIN users_main AS um ON um.ID = ft.AuthorID
+ WHERE ft.ID = $ID");
if ($DB->record_count() < 1) {
error(404);
}
list($Title, $ForumID, $Username) = $DB->next_record();
- $DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID);
+ $DB->query("
+ SELECT MinClassRead
+ FROM forums
+ WHERE ID = $ForumID");
list($MinClassRead) = $DB->next_record();
- if (!empty($LoggedUser['DisableForums']) ||
- ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
- (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
+ if (!empty($LoggedUser['DisableForums'])
+ || ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0))
+ || (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
error(403);
}
break;
- case 'post' :
- $DB->query('
+ case 'post':
+ $DB->query("
SELECT fp.Body, fp.TopicID, um.Username
FROM forums_posts AS fp
- JOIN users_main AS um ON um.ID=fp.AuthorID
- WHERE fp.ID='.$ID);
+ JOIN users_main AS um ON um.ID = fp.AuthorID
+ WHERE fp.ID = $ID");
if ($DB->record_count() < 1) {
error(404);
}
list($Body, $TopicID, $Username) = $DB->next_record();
- $DB->query('SELECT ForumID FROM forums_topics WHERE ID = '.$TopicID);
+ $DB->query("
+ SELECT ForumID
+ FROM forums_topics
+ WHERE ID = $TopicID");
list($ForumID) = $DB->next_record();
- $DB->query('SELECT MinClassRead FROM forums WHERE ID = '.$ForumID);
+ $DB->query("
+ SELECT MinClassRead
+ FROM forums
+ WHERE ID = $ForumID");
list($MinClassRead) = $DB->next_record();
- if (!empty($LoggedUser['DisableForums']) ||
- ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
- (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
+ if (!empty($LoggedUser['DisableForums'])
+ || ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0))
+ || (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
error(403);
}
break;
- case 'requests_comment' :
- case 'torrents_comment' :
+ case 'requests_comment':
+ case 'torrents_comment':
case 'artist_comment':
- case 'collages_comment' :
- $Table = $Short.'s';
+ case 'collages_comment':
+ $Table = "{$Short}s";
if ($Short == 'collages_comment') {
$Column = 'UserID';
} else {
$Column = 'AuthorID';
}
- $DB->query('
- SELECT '.$Short.".Body, um.Username
+ $DB->query("
+ SELECT $Short.Body, um.Username
FROM $Table AS $Short
- JOIN users_main AS um ON um.ID=$Short.$Column
- WHERE $Short.ID=".$ID);
+ JOIN users_main AS um ON um.ID = $Short.$Column
+ WHERE $Short.ID = $ID");
if ($DB->record_count() < 1) {
error(404);
}
@@ -113,7 +134,7 @@
break;
}
-View::show_header('Report a '.$Type['title'],'bbcode,jquery.validate,form_validate');
+View::show_header('Report a '.$Type['title'], 'bbcode,jquery.validate,form_validate');
?>