Empty commit

This commit is contained in:
Git 2013-05-27 08:00:58 +00:00
parent 5669fbc5f9
commit b3cc179926
184 changed files with 1345 additions and 589 deletions

View File

@ -15,8 +15,8 @@
require 'classes/config.php'; //The config contains all site wide configuration information as well as memcached rules
require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class
require(SERVER_ROOT.'/classes/class_debug.php'); //Require the debug class
require(SERVER_ROOT.'/classes/cache.class.php'); //Require the caching class
require(SERVER_ROOT.'/classes/debug.class.php'); //Require the debug class
$Cache = NEW CACHE($MemcachedServers); //Load the caching class
$Debug = new DEBUG;

View File

@ -1,8 +1,8 @@
<?
require 'config.php'; //The config contains all site wide configuration information as well as memcached rules
require(SERVER_ROOT.'/classes/class_debug.php');
require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class
require(SERVER_ROOT.'/classes/class_encrypt.php'); //Require the caching class
require(SERVER_ROOT.'/classes/debug.class.php');
require(SERVER_ROOT.'/classes/cache.class.php'); //Require the caching class
require(SERVER_ROOT.'/classes/encrypt.class.php'); //Require the caching class
$Debug = new DEBUG;
$Cache = NEW CACHE($MemcachedServers); //Load the caching class
@ -21,7 +21,7 @@
}
if (!$Enabled = $Cache->get_value('enabled_'.$UserID)) {
require(SERVER_ROOT.'/classes/class_mysql.php'); //Require the database wrapper
require(SERVER_ROOT.'/classes/mysql.class.php'); //Require the database wrapper
$DB=NEW DB_MYSQL; //Load the database wrapper
$DB->query("SELECT Enabled FROM users_main WHERE ID='$UserID'");
list($Enabled) = $DB->next_record();

View File

@ -0,0 +1,45 @@
<?
class Collages {
public static function get_comment_count($CollageID) {
global $DB, $Cache;
$NumComments = $Cache->get_value('collage_comments_'.$CollageID);
if ($NumComments === false) {
$DB->query("SELECT COUNT(ID) FROM collages_comments WHERE CollageID = '$CollageID'");
list($NumComments) = $DB->next_record();
$Cache->cache_value('collage_comments_'.$CollageID, $NumComments, 0);
}
return $NumComments;
}
public static function get_comment_catalogue($CollageID, $CatalogueID) {
global $DB, $Cache;
$Catalogue = $Cache->get_value('collage_comments_'.$CollageID.'_catalogue_'.$CatalogueID);
if ($Catalogue === false) {
$CatalogueLimit = $CatalogueID * THREAD_CATALOGUE . ', ' . THREAD_CATALOGUE;
$DB->query("
SELECT
ID,
UserID,
Time,
Body
FROM collages_comments
WHERE CollageID = '$CollageID'
LIMIT $CatalogueLimit");
$Catalogue = $DB->to_array(false, MYSQLI_ASSOC);
$Cache->cache_value('collage_comments_'.$CollageID.'_catalogue_'.$CatalogueID, $Catalogue, 0);
}
return $Catalogue;
}
public static function increase_subscriptions($CollageID) {
global $DB;
$DB->query("UPDATE collages SET Subscribers = Subscribers + 1 WHERE ID = '$CollageID'");
}
public static function decrease_subscriptions($CollageID) {
global $DB;
$DB->query("UPDATE collages SET Subscribers = IF(Subscribers < 1, 0, Subscribers - 1) WHERE ID = '$CollageID'");
}
}

View File

@ -62,11 +62,13 @@ public static function valid_host($Host) {
* @param string $Url Link to an image
* @return boolean
*/
public static function blacklisted($Url) {
public static function blacklisted($Url, $ShowError = true) {
foreach (self::$Blacklist as &$Value) {
if (stripos($Url, $Value)) {
$ParsedUrl = parse_url($Url);
error($ParsedUrl['host'] . ' is not an allowed image host. Please use a different host.');
if($ShowError) {
error($ParsedUrl['host'] . ' is not an allowed image host. Please use a different host.');
}
return true;
}
}

View File

@ -1,6 +1,6 @@
<?php
//require_once 'class_mass_user_torrents_editor.php';
//require_once 'mass_user_torrents_editor.class.php';
/**
* This class helps with mass-editing bookmarked torrents.
@ -8,10 +8,8 @@
* It can later be used for other bookmark tables.
*
*/
class MASS_USER_BOOKMARKS_EDITOR extends MASS_USER_TORRENTS_EDITOR
{
public function __construct ($Table = 'bookmarks_torrents')
{
class MASS_USER_BOOKMARKS_EDITOR extends MASS_USER_TORRENTS_EDITOR {
public function __construct ($Table = 'bookmarks_torrents') {
parent::__construct();
$this->set_table($Table);
}
@ -23,8 +21,7 @@ public function __construct ($Table = 'bookmarks_torrents')
*
* @param string $sql
*/
protected function query_and_clear_cache ($sql)
{
protected function query_and_clear_cache ($sql) {
if (is_string($sql) && $this->DB->query($sql))
$this->Cache->delete_value('bookmarks_group_ids_' . $this->UserID);
}
@ -69,4 +66,4 @@ public function mass_update () {
$this->query_and_clear_cache($SQL);
}
}
}
}

View File

@ -42,7 +42,7 @@ public static function file_string($EscapeStr) {
* @param int $ConvID The conversation the message goes in. Leave blank to start a new conversation.
* @return
*/
public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
public static function send_pm($ToID, $FromID, $Subject, $Body, $ConvID = '') {
global $DB, $Cache, $Time;
$Subject = db_string($Subject);
$Body = db_string($Body);
@ -50,26 +50,34 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
// Don't allow users to send messages to the system or themselves
return;
}
if ($ConvID=='') {
if ($ConvID == '') {
// Create a new conversation.
$DB->query("INSERT INTO pm_conversations(Subject) VALUES ('".$Subject."')");
$DB->query("
INSERT INTO pm_conversations (Subject)
VALUES ('$Subject')");
$ConvID = $DB->inserted_id();
$DB->query("INSERT INTO pm_conversations_users
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead) VALUES
$DB->query("
INSERT INTO pm_conversations_users
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead)
VALUES
('$ToID', '$ConvID', '1','0','".sqltime()."', '".sqltime()."', '1')");
if ($FromID != 0) {
$DB->query("INSERT INTO pm_conversations_users
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead) VALUES
('$FromID', '$ConvID', '0','1','".sqltime()."', '".sqltime()."', '0')");
$DB->query("
INSERT INTO pm_conversations_users
(UserID, ConvID, InInbox, InSentbox, SentDate, ReceivedDate, UnRead)
VALUES
('$FromID', '$ConvID', '0','1','".sqltime()."', '".sqltime()."', '0')");
}
$ToID = array($ToID);
} else {
// Update the pre-existing conversations.
$DB->query("UPDATE pm_conversations_users SET
$DB->query("
UPDATE pm_conversations_users
SET
InInbox='1',
UnRead='1',
ReceivedDate='".sqltime()."'
WHERE UserID IN (".implode(',', $ToID).")
WHERE UserID IN (".implode(',', $ToID).")
AND ConvID='$ConvID'");
$DB->query("
@ -374,7 +382,11 @@ public static function get_tags($TagNames) {
*/
public static function get_alias_tag($BadTag) {
global $DB;
$DB->query("SELECT AliasTag FROM tag_aliases WHERE BadTag = '". $BadTag ."' LIMIT 1");
$DB->query("
SELECT AliasTag
FROM tag_aliases
WHERE BadTag = '$BadTag'
LIMIT 1");
if ($DB->record_count() > 0) {
list($AliasTag) = $DB->next_record();
return $AliasTag;

View File

@ -14,8 +14,8 @@
* Creating the object.
require(SERVER_ROOT.'/classes/class_mysql.php');
$DB=NEW DB_MYSQL;
require(SERVER_ROOT.'/classes/mysql.class.php');
$DB = NEW DB_MYSQL;
-----
* Making a query
@ -48,12 +48,12 @@
* The conventional way of retrieving a row from a result set is as follows:
list($All,$Columns,$That,$You,$Select)=$DB->next_record();
list($All,$Columns,$That,$You,$Select) = $DB->next_record();
-----
* This is how you loop over the result set:
while (list($All,$Columns,$That,$You,$Select)=$DB->next_record()) {
while (list($All,$Columns,$That,$You,$Select) = $DB->next_record()) {
echo "Do stuff with ".$All." of the ".$Columns.$That.$You.$Select;
}
-----

27
classes/reports.class.php Normal file
View File

@ -0,0 +1,27 @@
<?php
class Reports {
/**
* This function formats a string containing a torrent's remaster information
* to be used in Reports v2.
*
* @param boolean $Remastered - whether the torrent contains remaster information
* @param string $RemasterTitle - the title of the remaster information
* @param string $RemasterYear - the year of the remaster information
*/
public static function format_reports_remaster_info($Remastered, $RemasterTitle, $RemasterYear) {
if ($Remastered) {
$RemasterDisplayString = ' &lt;';
if ($RemasterTitle != '' && $RemasterYear != '') {
$RemasterDisplayString .= "$RemasterTitle - $RemasterYear";
} else if ($RemasterTitle != '' && $RemasterYear == '') {
$RemasterDisplayString .= $RemasterTitle;
} else if ($RemasterTitle == '' && $RemasterYear != '') {
$RemasterDisplayString .= $RemasterYear;
}
$RemasterDisplayString .= '&gt;';
} else {
$RemasterDisplayString = '';
}
return $RemasterDisplayString;
}
}

View File

@ -15,7 +15,7 @@
die('d14:failure reason40:Invalid .torrent, try downloading again.e');
}
require(SERVER_ROOT.'/classes/class_proxies.php');
require(SERVER_ROOT.'/classes/proxies.class.php');
// Get the user's actual IP address if they're proxied.
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])
@ -54,19 +54,19 @@
$ScriptStartTime = microtime(true); //To track how long a page takes to create
if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
$RUsage = getrusage();
$CPUTimeStart = $RUsage['ru_utime.tv_sec']*1000000 + $RUsage['ru_utime.tv_usec'];
$CPUTimeStart = $RUsage['ru_utime.tv_sec'] * 1000000 + $RUsage['ru_utime.tv_usec'];
}
ob_start(); //Start a buffer, mainly in case there is a mysql error
require(SERVER_ROOT.'/classes/class_debug.php'); //Require the debug class
require(SERVER_ROOT.'/classes/class_mysql.php'); //Require the database wrapper
require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class
require(SERVER_ROOT.'/classes/class_encrypt.php'); //Require the encryption class
require(SERVER_ROOT.'/classes/class_useragent.php'); //Require the useragent class
require(SERVER_ROOT.'/classes/class_time.php'); //Require the time class
require(SERVER_ROOT.'/classes/class_search.php'); //Require the searching class
require(SERVER_ROOT.'/classes/class_paranoia.php'); //Require the paranoia check_paranoia function
require(SERVER_ROOT.'/classes/debug.class.php'); //Require the debug class
require(SERVER_ROOT.'/classes/mysql.class.php'); //Require the database wrapper
require(SERVER_ROOT.'/classes/cache.class.php'); //Require the caching class
require(SERVER_ROOT.'/classes/encrypt.class.php'); //Require the encryption class
require(SERVER_ROOT.'/classes/useragent.class.php'); //Require the useragent class
require(SERVER_ROOT.'/classes/time.class.php'); //Require the time class
require(SERVER_ROOT.'/classes/search.class.php'); //Require the searching class
require(SERVER_ROOT.'/classes/paranoia.class.php'); //Require the paranoia check_paranoia function
require(SERVER_ROOT.'/classes/regex.php');
require(SERVER_ROOT.'/classes/util.php');
@ -86,52 +86,52 @@
$FileName='';
switch ($ClassName) {
case 'Artists':
$FileName = 'class_artists';
$FileName = 'artists.class';
break;
case 'Bencode':
$FileName = 'class_bencode';
$FileName = 'bencode.class';
break;
case 'BencodeDecode':
$FileName = 'class_bencodedecode';
$FileName = 'bencodedecode.class';
break;
case 'BencodeTorrent':
$FileName = 'class_bencodetorrent';
$FileName = 'bencodetorrent.class';
break;
case 'Bookmarks':
$FileName = 'bookmarks.class';
break;
case 'Collages':
$FileName = 'class_collages';
$FileName = 'collages.class';
break;
case 'Format':
$FileName = 'class_format';
$FileName = 'format.class';
break;
case 'Forums':
$FileName = 'class_forums';
$FileName = 'forums.class';
break;
case 'ImageTools':
$FileName = 'class_image_tools';
$FileName = 'image_tools.class';
break;
case 'LastFM':
$FileName = 'class_lastfm';
$FileName = 'lastfm.class';
break;
case 'MASS_USER_BOOKMARKS_EDITOR':
$FileName = 'class_mass_user_bookmarks_editor';
$FileName = 'mass_user_bookmarks_editor.class';
break;
case 'MASS_USER_TORRENTS_EDITOR':
$FileName = 'class_mass_user_torrents_editor';
$FileName = 'mass_user_torrents_editor.class';
break;
case 'MASS_USER_TORRENTS_TABLE_VIEW':
$FileName = 'class_mass_user_torrents_table_view';
$FileName = 'mass_user_torrents_table_view.class';
break;
case 'Misc':
$FileName = 'class_misc';
$FileName = 'misc.class';
break;
case 'Permissions':
$FileName = 'class_permissions';
$FileName = 'permissions.class';
break;
case 'Requests':
$FileName = 'class_requests';
$FileName = 'requests.class';
break;
case 'Rippy':
$FileName = 'rippy.class';
@ -140,48 +140,48 @@
$FileName = 'rules.class';
break;
case 'Sphinxql':
$FileName = 'class_sphinxql';
$FileName = 'sphinxql.class';
break;
case 'SphinxqlQuery':
$FileName = 'class_sphinxqlquery';
$FileName = 'sphinxqlquery.class';
break;
case 'SphinxqlResult':
$FileName = 'class_sphinxqlresult';
$FileName = 'sphinxqlresult.class';
break;
case 'Tags':
$FileName = 'class_tags';
$FileName = 'tags.class';
break;
case 'TEXTAREA_PREVIEW':
$FileName = 'class_textarea_preview';
$FileName = 'textarea_preview.class';
break;
case 'Tools':
$FileName = 'class_tools';
$FileName = 'tools.class';
break;
case 'TORRENT':
case 'BENCODE_DICT':
case 'BENCODE_LIST':
$FileName = 'class_torrent';
$FileName = 'torrent.class';
break;
case 'Torrents':
$FileName = 'class_torrents';
$FileName = 'torrents.class';
break;
case 'TorrentsDL':
$FileName = 'class_torrentsdl';
$FileName = 'torrentsdl.class';
break;
case 'Tracker':
$FileName = 'class_tracker';
$FileName = 'tracker.class';
break;
case 'Users':
$FileName = 'class_users';
$FileName = 'users.class';
break;
case 'View':
$FileName = 'class_view';
$FileName = 'view.class';
break;
case 'Votes':
$FileName = 'class_votes';
$FileName = 'votes.class';
break;
case 'Zip':
$FileName = 'class_zip';
$FileName = 'zip.class';
break;
default:
die("Couldn't import class " . $ClassName);

View File

@ -16,7 +16,7 @@ function time_ago($TimeStamp) {
return time() - $TimeStamp;
}
function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) {
/*
Returns a <span> by default but can optionally return the raw time
difference in text (e.g. "16 hours and 28 minutes", "1 day, 18 hours").
@ -178,9 +178,9 @@ function validDate($DateString) {
return false;
}
list($H, $M, $S) = $SplitTime;
if ($H != 0 && !(is_number($H) && $H < 24 && $H >= 0)) return false;
if ($M != 0 && !(is_number($M) && $M < 60 && $M >= 0)) return false;
if ($S != 0 && !(is_number($S) && $S < 60 && $S >= 0)) return false;
if ($H != 0 && !(is_number($H) && $H < 24 && $H >= 0)) { return false; }
if ($M != 0 && !(is_number($M) && $M < 60 && $M >= 0)) { return false; }
if ($S != 0 && !(is_number($S) && $S < 60 && $S >= 0)) { return false; }
$SplitDate = explode('-', $Date);
if (count($SplitDate) != 3) {
return false;

View File

@ -210,8 +210,8 @@ public static function warn_user($UserID, $Duration, $Reason) {
$DB->query("
SELECT Warned
FROM users_info
WHERE UserID=".$UserID."
AND Warned <> '0000-00-00 00:00:00'");
WHERE UserID=$UserID
AND Warned != '0000-00-00 00:00:00'");
if ($DB->record_count() > 0) {
//User was already warned, appending new warning to old.
list($OldDate) = $DB->next_record();

View File

@ -102,7 +102,7 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
FileCount, FreeTorrent, Size, Leechers, Seeders, Snatched, Time, ID AS HasFile
FROM torrents AS t
WHERE GroupID IN($IDs)
ORDER BY GroupID, Remastered, (RemasterYear <> 0) DESC, RemasterYear, RemasterTitle,
ORDER BY GroupID, Remastered, (RemasterYear != 0) DESC, RemasterYear, RemasterTitle,
RemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding, ID");
while ($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;

View File

@ -11,16 +11,21 @@ function build_table($MemKey, $Query) {
$DB->query("DROP TEMPORARY TABLE IF EXISTS temp_stats");
$DB->query("CREATE TEMPORARY TABLE temp_stats
(ID int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
Val bigint(20) NOT NULL);");
$DB->query("
CREATE TEMPORARY TABLE temp_stats (
ID int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT,
Val bigint(20) NOT NULL
);");
$DB->query("INSERT INTO temp_stats (Val) ".$Query);
$DB->query("SELECT COUNT(ID) FROM temp_stats");
list($UserCount) = $DB->next_record();
$DB->query("SELECT MIN(Val) FROM temp_stats GROUP BY CEIL(ID/(".(int)$UserCount."/100));");
$DB->query("
SELECT MIN(Val)
FROM temp_stats
GROUP BY CEIL(ID/(".(int)$UserCount."/100));");
$Table = $DB->to_array();
@ -33,27 +38,68 @@ function build_table($MemKey, $Query) {
function table_query($TableName) {
switch ($TableName) {
case 'uploaded':
$Query = "SELECT Uploaded FROM users_main WHERE Enabled='1' AND Uploaded>0 ORDER BY Uploaded;";
$Query = "
SELECT Uploaded
FROM users_main
WHERE Enabled='1'
AND Uploaded > 0
ORDER BY Uploaded;";
break;
case 'downloaded':
$Query = "SELECT Downloaded FROM users_main WHERE Enabled='1' AND Downloaded>0 ORDER BY Downloaded;";
$Query = "
SELECT Downloaded
FROM users_main
WHERE Enabled='1'
AND Downloaded > 0
ORDER BY Downloaded;";
break;
case 'uploads':
$Query = "SELECT COUNT(t.ID) AS Uploads FROM users_main AS um JOIN torrents AS t ON t.UserID=um.ID WHERE um.Enabled='1' GROUP BY um.ID ORDER BY Uploads;";
$Query = "
SELECT COUNT(t.ID) AS Uploads
FROM users_main AS um
JOIN torrents AS t ON t.UserID=um.ID
WHERE um.Enabled='1'
GROUP BY um.ID
ORDER BY Uploads;";
break;
case 'requests':
$Query = "SELECT COUNT(r.ID) AS Requests FROM users_main AS um JOIN requests AS r ON r.FillerID=um.ID WHERE um.Enabled='1' GROUP BY um.ID ORDER BY Requests;";
$Query = "
SELECT COUNT(r.ID) AS Requests
FROM users_main AS um
JOIN requests AS r ON r.FillerID=um.ID
WHERE um.Enabled='1'
GROUP BY um.ID
ORDER BY Requests;";
break;
case 'posts':
$Query = "SELECT COUNT(p.ID) AS Posts FROM users_main AS um JOIN forums_posts AS p ON p.AuthorID=um.ID WHERE um.Enabled='1' GROUP BY um.ID ORDER BY Posts;";
$Query = "
SELECT COUNT(p.ID) AS Posts
FROM users_main AS um
JOIN forums_posts AS p ON p.AuthorID=um.ID
WHERE um.Enabled='1'
GROUP BY um.ID
ORDER BY Posts;";
break;
case 'bounty':
$Query = "SELECT SUM(rv.Bounty) AS Bounty FROM users_main AS um JOIN requests_votes AS rv ON rv.UserID=um.ID WHERE um.Enabled='1' GROUP BY um.ID ORDER BY Bounty;";
$Query = "
SELECT SUM(rv.Bounty) AS Bounty
FROM users_main AS um
JOIN requests_votes AS rv ON rv.UserID=um.ID
WHERE um.Enabled='1'
GROUP BY um.ID
ORDER BY Bounty;";
break;
case 'artists':
$Query = "SELECT COUNT(ta.ArtistID) AS Artists FROM torrents_artists AS ta JOIN torrents_group AS tg ON tg.ID=ta.GroupID JOIN torrents AS t ON t.GroupID = tg.ID WHERE t.UserID != ta.UserID GROUP BY tg.ID ORDER BY Artists ASC";
$Query = "
SELECT COUNT(ta.ArtistID) AS Artists
FROM torrents_artists AS ta
JOIN torrents_group AS tg ON tg.ID=ta.GroupID
JOIN torrents AS t ON t.GroupID = tg.ID
WHERE t.UserID != ta.UserID
GROUP BY tg.ID
ORDER BY Artists ASC";
break;
}
return $Query;

View File

@ -29,7 +29,7 @@ public static function get_classes() {
* int ID
* string Username
* int PermissionID
* array Paranoia - $Paranoia array sent to class_paranoia
* array Paranoia - $Paranoia array sent to paranoia.class
* boolean Artist
* boolean Donor
* string Warned - When their warning expires in international time format

View File

@ -91,7 +91,7 @@ function error($Error, $Ajax=false, $Log=false) {
/**
* Convenience function. See doc in class_permissions.php
* Convenience function. See doc in permissions.class.php
*/
function check_perms($PermissionName, $MinClass = 0) {
return Permissions::check_perms($PermissionName, $MinClass);

View File

@ -10,7 +10,7 @@
table with the revision history for that particular wiki page.
class_wiki depends on your wiki table being structured like this:
wiki.class depends on your wiki table being structured like this:
+------------+--------------+------+-----+----------------------+-------+
| Field | Type | Null | Key | Default | Extra |

View File

@ -58,7 +58,7 @@
//------------- Detailed example -------------//
require('classes/class_zip.php');
require('classes/zip.class.php');
$Zip = new Zip('FileName');
$Name = 'Ubuntu-8.10';
$Zip->add_file($TorrentData, 'Torrents/'.Misc::file_string($Name).'.torrent');

View File

@ -225,7 +225,11 @@
$MyNews = $LoggedUser['LastReadNews'];
$CurrentNews = $Cache->get_value('news_latest_id');
if ($CurrentNews === false) {
$DB->query("SELECT ID FROM news ORDER BY Time DESC LIMIT 1");
$DB->query("
SELECT ID
FROM news
ORDER BY Time DESC
LIMIT 1");
if ($DB->record_count() == 1) {
list($CurrentNews) = $DB->next_record();
} else {
@ -241,7 +245,12 @@
$MyBlog = $LoggedUser['LastReadBlog'];
$CurrentBlog = $Cache->get_value('blog_latest_id');
if ($CurrentBlog === false) {
$DB->query("SELECT ID FROM blog WHERE Important = 1 ORDER BY Time DESC LIMIT 1");
$DB->query("
SELECT ID
FROM blog
WHERE Important = 1
ORDER BY Time DESC
LIMIT 1");
if ($DB->record_count() == 1) {
list($CurrentBlog) = $DB->next_record();
} else {
@ -282,7 +291,11 @@
//Staff PM
$NewStaffPMs = $Cache->get_value('staff_pm_new_'.$LoggedUser['ID']);
if ($NewStaffPMs === false) {
$DB->query("SELECT COUNT(ID) FROM staff_pm_conversations WHERE UserID='".$LoggedUser['ID']."' AND Unread = '1'");
$DB->query("
SELECT COUNT(ID)
FROM staff_pm_conversations
WHERE UserID='".$LoggedUser['ID']."'
AND Unread = '1'");
list($NewStaffPMs) = $DB->next_record();
$Cache->cache_value('staff_pm_new_'.$LoggedUser['ID'], $NewStaffPMs, 0);
}
@ -294,7 +307,12 @@
//Inbox
$NewMessages = $Cache->get_value('inbox_new_'.$LoggedUser['ID']);
if ($NewMessages === false) {
$DB->query("SELECT COUNT(UnRead) FROM pm_conversations_users WHERE UserID='".$LoggedUser['ID']."' AND UnRead = '1' AND InInbox = '1'");
$DB->query("
SELECT COUNT(UnRead)
FROM pm_conversations_users
WHERE UserID='".$LoggedUser['ID']."'
AND UnRead = '1'
AND InInbox = '1'");
list($NewMessages) = $DB->next_record();
$Cache->cache_value('inbox_new_'.$LoggedUser['ID'], $NewMessages, 0);
}
@ -312,7 +330,11 @@
if (check_perms('site_torrents_notify')) {
$NewNotifications = $Cache->get_value('notifications_new_'.$LoggedUser['ID']);
if ($NewNotifications === false) {
$DB->query("SELECT COUNT(UserID) FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]' AND UnRead='1'");
$DB->query("
SELECT COUNT(UserID)
FROM users_notify_torrents
WHERE UserID='$LoggedUser[ID]'
AND UnRead='1'");
list($NewNotifications) = $DB->next_record();
/* if ($NewNotifications && !check_perms('site_torrents_notify')) {
$DB->query("DELETE FROM users_notify_torrents WHERE UserID='$LoggedUser[ID]'");
@ -329,11 +351,14 @@
if (check_perms('site_collages_subscribe')) {
$NewCollages = $Cache->get_value('collage_subs_user_new_'.$LoggedUser['ID']);
if ($NewCollages === false) {
$DB->query("SELECT COUNT(DISTINCT s.CollageID)
FROM users_collage_subs as s
JOIN collages as c ON s.CollageID = c.ID
JOIN collages_torrents as ct on ct.CollageID = c.ID
WHERE s.UserID = $LoggedUser[ID] AND ct.AddedOn > s.LastVisit AND c.Deleted = '0'");
$DB->query("
SELECT COUNT(DISTINCT s.CollageID)
FROM users_collage_subs as s
JOIN collages as c ON s.CollageID = c.ID
JOIN collages_torrents as ct on ct.CollageID = c.ID
WHERE s.UserID = $LoggedUser[ID]
AND ct.AddedOn > s.LastVisit
AND c.Deleted = '0'");
list($NewCollages) = $DB->next_record();
$Cache->cache_value('collage_subs_user_new_'.$LoggedUser['ID'], $NewCollages, 0);
}
@ -348,10 +373,21 @@
$NumStaffPMs = $Cache->get_value('num_staff_pms_'.$LoggedUser['ID']);
if ($NumStaffPMs === false) {
if (check_perms('users_mod')) {
$DB->query("SELECT COUNT(ID) FROM staff_pm_conversations WHERE Status='Unanswered' AND (AssignedToUser=".$LoggedUser['ID']." OR (Level >= ".max(700,$Classes[MOD]['Level'])." AND Level <=".$LoggedUser['Class']."))");
$DB->query("
SELECT COUNT(ID)
FROM staff_pm_conversations
WHERE Status='Unanswered'
AND (AssignedToUser=".$LoggedUser['ID']."
OR (Level >= ".max(700,$Classes[MOD]['Level'])."
AND Level <=".$LoggedUser['Class']."))");
}
if ($LoggedUser['PermissionID'] == FORUM_MOD) {
$DB->query("SELECT COUNT(ID) FROM staff_pm_conversations WHERE Status='Unanswered' AND (AssignedToUser=".$LoggedUser['ID']." OR Level = '". $Classes[FORUM_MOD]['Level'] . "')");
$DB->query("
SELECT COUNT(ID)
FROM staff_pm_conversations
WHERE Status='Unanswered'
AND (AssignedToUser=".$LoggedUser['ID']."
OR Level = '". $Classes[FORUM_MOD]['Level'] . "')");
}
list($NumStaffPMs) = $DB->next_record();
$Cache->cache_value('num_staff_pms_'.$LoggedUser['ID'], $NumStaffPMs , 1000);
@ -386,7 +422,11 @@
} elseif (check_perms('project_team')) {
$NumUpdateReports = $Cache->get_value('num_update_reports');
if ($NumUpdateReports === false) {
$DB->query("SELECT COUNT(ID) FROM reports WHERE Status='New' AND Type = 'request_update'");
$DB->query("
SELECT COUNT(ID)
FROM reports
WHERE Status='New'
AND Type = 'request_update'");
list($NumUpdateReports) = $DB->next_record();
$Cache->cache_value('num_update_reports', $NumUpdateReports, 0);
}
@ -397,7 +437,11 @@
} elseif (check_perms('site_moderate_forums')) {
$NumForumReports = $Cache->get_value('num_forum_reports');
if ($NumForumReports === false) {
$DB->query("SELECT COUNT(ID) FROM reports WHERE Status='New' AND Type IN('collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment')");
$DB->query("
SELECT COUNT(ID)
FROM reports
WHERE Status='New'
AND Type IN('artist_comment', 'collages_comment', 'post', 'requests_comment', 'thread', 'torrents_comment')");
list($NumForumReports) = $DB->next_record();
$Cache->cache_value('num_forum_reports', $NumForumReports, 0);
}

View File

@ -29,8 +29,7 @@ step in properly enforcing coding standards throughout the project.
1. FILE FORMATTING
Tabs shall always be used for indentation. Do not use spaces to make code
blocks align in a pretty fashion.
Tabs shall always be used for indentation.
Files shall be encoded in ASCII.
@ -100,6 +99,12 @@ Use indents as appropriate to aid readability.
The SQL keywords JOIN, RIGHT JOIN, LEFT JOIN must be indented once from
the SELECT statement.
The SQL keyword AND must be indented once from the WHILE (and similar)
statements.
The "not equal to" operator "!=" must be used instead of the alternative
operator "<>".
3. NAMING CONVENTIONS
@ -231,14 +236,14 @@ ORDER BY e.EditionID, r.Year ASC
SELECT SQL_CALC_FOUND_ROWS c.ID, c.Subject, cu.Unread, cu.Sticky,
cu.ForwardedTo, cu2.UserID, cu.ReceivedDate AS Date
FROM pm_conversations AS c
LEFT JOIN pm_conversations_users AS cu ON cu.ConvID=c.ID
AND cu.UserID='1'
LEFT JOIN pm_conversations_users AS cu2 ON cu2.ConvID=c.ID
AND cu2.UserID!='1'
AND cu2.ForwardedTo=0
LEFT JOIN users_main AS um ON um.ID=cu2.UserID
LEFT JOIN pm_conversations_users AS cu ON cu.ConvID = c.ID
AND cu.UserID = '1'
LEFT JOIN pm_conversations_users AS cu2 ON cu2.ConvID = c.ID
AND cu2.UserID != '1'
AND cu2.ForwardedTo = 0
LEFT JOIN users_main AS um ON um.ID = cu2.UserID
WHERE um.Username LIKE 'test'
AND cu.InInbox='1'
AND cu.InInbox = '1'
GROUP BY c.ID
ORDER BY cu.Sticky, Date DESC
LIMIT 25

View File

@ -13,8 +13,8 @@
require 'classes/config.php'; //The config contains all site wide configuration information as well as memcached rules
require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class
require(SERVER_ROOT.'/classes/class_feed.php'); //Require the caching class
require(SERVER_ROOT.'/classes/cache.class.php'); //Require the caching class
require(SERVER_ROOT.'/classes/feed.class.php'); //Require the caching class
$Cache = NEW CACHE($MemcachedServers); //Load the caching class
$Feed = NEW FEED; //Lead the time class

View File

@ -227,6 +227,17 @@ CREATE TABLE `concerts` (
KEY `TopicID` (`TopicID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `cover_art` (
`ID` int(10) NOT NULL AUTO_INCREMENT,
`GroupID` int(10) NOT NULL,
`Image` varchar(255) NOT NULL DEFAULT '',
`Summary` varchar(100) DEFAULT NULL,
`UserID` int(10) NOT NULL DEFAULT '0',
`Time` datetime DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `GroupID` (`GroupID`,`Image`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `do_not_upload` (
`ID` int(10) NOT NULL AUTO_INCREMENT,
`Name` varchar(255) COLLATE utf8_bin NOT NULL,

View File

@ -21,8 +21,8 @@
error('nogd');
}
require(SERVER_ROOT.'/classes/class_cache.php'); //Require the caching class
require(SERVER_ROOT.'/classes/class_encrypt.php'); //Require the encryption class
require(SERVER_ROOT.'/classes/cache.class.php'); //Require the caching class
require(SERVER_ROOT.'/classes/encrypt.class.php'); //Require the encryption class
require(SERVER_ROOT.'/classes/regex.php');
$Cache = NEW CACHE($MemcachedServers); //Load the caching class

View File

@ -1,5 +1,5 @@
<?
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT;
if (!$News = $Cache->get_value('news')) {

View File

@ -4,7 +4,7 @@ function compare($X, $Y) {
return($Y['count'] - $X['count']);
}
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
if ($_GET['id'] && $_GET['artistname']) {

View File

@ -500,11 +500,11 @@ function header_link($SortKey,$DefaultWay = 'desc') {
INNER JOIN torrents_group AS g ON t.GroupID=g.ID
INNER JOIN torrents_tags AS tt ON tt.GroupID=g.ID
INNER JOIN tags ON tags.ID=tt.TagID
WHERE s.uid='$LoggedUser[ID]'
AND tt.TagID<>'13679'
AND tt.TagID<>'4820'
AND tt.TagID<>'2838'
AND g.CategoryID='1'
WHERE s.uid = '$LoggedUser[ID]'
AND tt.TagID != '13679'
AND tt.TagID != '4820'
AND tt.TagID != '2838'
AND g.CategoryID = '1'
AND tags.Uses > '10'
GROUP BY tt.TagID
ORDER BY Score DESC

View File

@ -1,6 +1,6 @@
<?
include(SERVER_ROOT.'/classes/class_bencodetorrent.php');
include(SERVER_ROOT.'/classes/bencodetorrent.class.php');
$TorrentID = $_GET['torrentid'];
if (!is_number($TorrentID)) {

View File

@ -13,7 +13,7 @@
//---------- Things to sort out before it can start printing/generating content
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT;
// Check for lame SQL injection attempts
@ -106,12 +106,18 @@
}
//Handle last read
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'");
}
}
@ -119,7 +125,10 @@
//Handle subscriptions
if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
$DB->query("SELECT TopicID FROM users_subscriptions WHERE UserID = '$LoggedUser[ID]'");
$DB->query("
SELECT TopicID
FROM users_subscriptions
WHERE UserID = '$LoggedUser[ID]'");
$UserSubscriptions = $DB->collect(0);
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
}
@ -135,10 +144,17 @@
$JsonPoll = array();
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();
@ -165,7 +181,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];
@ -211,7 +231,7 @@
if ($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
array_unshift($Thread, $ThreadInfo['StickyPost']);
}
if ($ThreadInfo['StickyPostID'] != $Thread[count($Thread)-1]['ID']) {
if ($ThreadInfo['StickyPostID'] != $Thread[count($Thread) - 1]['ID']) {
$Thread[] = $ThreadInfo['StickyPost'];
}
}
@ -235,7 +255,7 @@
'paranoia' => $Paranoia,
'artist' => $Artist == 1,
'donor' => $Donor == 1,
'warned' => ($Warned!='0000-00-00 00:00:00'),
'warned' => ($Warned != '0000-00-00 00:00:00'),
'avatar' => $Avatar,
'enabled' => $Enabled == 2 ? false : true,
'userTitle' => $UserTitle
@ -257,7 +277,7 @@
'locked' => $ThreadInfo['IsLocked'] == 1,
'sticky' => $ThreadInfo['IsSticky'] == 1,
'currentPage' => (int) $Page,
'pages' => ceil($ThreadInfo['Posts']/$PerPage),
'pages' => ceil($ThreadInfo['Posts'] / $PerPage),
'poll' => empty($JsonPoll) ? null : $JsonPoll,
'posts' => $JsonPosts
)

View File

@ -11,7 +11,7 @@
UPDATE reportsv2
SET Status='New'
WHERE ID=".$_GET['id']."
AND Status <> 'Resolved'");
AND Status != 'Resolved'");
if ($DB->affected_rows() > 0) {
//Win
} else {

View File

@ -1,5 +1,5 @@
<?
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT;
$ConvID = $_GET['id'];

View File

@ -1,7 +1,7 @@
<?
/* AJAX Previews, simple stuff. */
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT(true);
if (!empty($_POST['AdminComment'])) {

View File

@ -10,7 +10,7 @@
* This is the page that displays the request to the end user after being created.
*/
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT;
if (empty($_GET['id']) || !is_number($_GET['id'])) {

View File

@ -7,7 +7,7 @@
json_die('failure');
}
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
if (isset($LoggedUser['PostsPerPage'])) {

View File

@ -1,7 +1,7 @@
<?
include(SERVER_ROOT.'/classes/class_text.php');
include(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT;
$GroupID=ceil($_GET['id']);

View File

@ -1,6 +1,6 @@
<?
require(SERVER_ROOT.'/sections/torrents/functions.php');
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
$GroupAllowed = array('WikiBody', 'WikiImage', 'ID', 'Name', 'Year', 'RecordLabel', 'CatalogueNumber', 'ReleaseType', 'CategoryID', 'Time', 'VanityHouse');

View File

@ -2,7 +2,7 @@
require(SERVER_ROOT.'/sections/torrents/functions.php');
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
$GroupAllowed = array('WikiBody', 'WikiImage', 'ID', 'Name', 'Year', 'RecordLabel', 'CatalogueNumber', 'ReleaseType', 'CategoryID', 'Time', 'VanityHouse');

View File

@ -3,7 +3,7 @@
// Include the necessary form class
include(SERVER_ROOT.'/classes/class_torrent_form.php');
include(SERVER_ROOT.'/classes/torrent_form.class.php');
$TorrentForm = new TORRENT_FORM();
$GenreTags = $Cache->get_value('genre_tags');

View File

@ -1,6 +1,6 @@
<?php
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
@ -78,13 +78,21 @@ function check_paranoia_here($Setting) {
}
$Friend = false;
$DB->query("SELECT FriendID FROM friends WHERE UserID='$LoggedUser[ID]' AND FriendID='$UserID'");
$DB->query("
SELECT FriendID
FROM friends
WHERE UserID='$LoggedUser[ID]'
AND FriendID='$UserID'");
if ($DB->record_count() != 0) {
$Friend = true;
}
if (check_paranoia_here('requestsfilled_count') || check_paranoia_here('requestsfilled_bounty')) {
$DB->query("SELECT COUNT(DISTINCT r.ID), SUM(rv.Bounty) FROM requests AS r LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID WHERE r.FillerID = ".$UserID);
$DB->query("
SELECT COUNT(DISTINCT r.ID), SUM(rv.Bounty)
FROM requests AS r
LEFT JOIN requests_votes AS rv ON r.ID=rv.RequestID
WHERE r.FillerID = ".$UserID);
list($RequestsFilled, $TotalBounty) = $DB->next_record();
$DB->query("SELECT COUNT(rv.RequestID), SUM(rv.Bounty) FROM requests_votes AS rv WHERE rv.UserID = ".$UserID);
list($RequestsVoted, $TotalSpent) = $DB->next_record();
@ -103,14 +111,17 @@ function check_paranoia_here($Setting) {
}
if (check_paranoia_here('artistsadded')) {
$DB->query("SELECT COUNT(ta.ArtistID) FROM torrents_artists AS ta WHERE ta.UserID = ".$UserID);
$DB->query("
SELECT COUNT(ta.ArtistID)
FROM torrents_artists AS ta
WHERE ta.UserID = ".$UserID);
list($ArtistsAdded) = $DB->next_record();
} else {
$ArtistsAdded = 0;
}
// Do the ranks.
include(SERVER_ROOT.'/classes/class_user_rank.php');
include(SERVER_ROOT.'/classes/user_rank.class.php');
$Rank = new USER_RANK;
if (check_paranoia_here('uploaded')) {
@ -160,27 +171,46 @@ function check_paranoia_here($Setting) {
// Community section
if (check_paranoia_here(array('snatched', 'snatched+'))) {
$DB->query("SELECT COUNT(x.uid), COUNT(DISTINCT x.fid) FROM xbt_snatched AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID'");
$DB->query("
SELECT COUNT(x.uid), COUNT(DISTINCT x.fid)
FROM xbt_snatched AS x
INNER JOIN torrents AS t ON t.ID=x.fid
WHERE x.uid='$UserID'");
list($Snatched, $UniqueSnatched) = $DB->next_record();
}
if (check_paranoia_here(array('torrentcomments', 'torrentcomments+'))) {
$DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE AuthorID='$UserID'");
$DB->query("
SELECT COUNT(ID)
FROM torrents_comments
WHERE AuthorID='$UserID'");
list($NumComments) = $DB->next_record();
}
if (check_paranoia_here(array('collages', 'collages+'))) {
$DB->query("SELECT COUNT(ID) FROM collages WHERE Deleted='0' AND UserID='$UserID'");
$DB->query("
SELECT COUNT(ID)
FROM collages
WHERE Deleted='0'
AND UserID='$UserID'");
list($NumCollages) = $DB->next_record();
}
if (check_paranoia_here(array('collagecontribs', 'collagecontribs+'))) {
$DB->query("SELECT COUNT(DISTINCT CollageID) FROM collages_torrents AS ct JOIN collages ON CollageID = ID WHERE Deleted='0' AND ct.UserID='$UserID'");
$DB->query("
SELECT COUNT(DISTINCT CollageID)
FROM collages_torrents AS ct
JOIN collages ON CollageID = ID
WHERE Deleted='0'
AND ct.UserID='$UserID'");
list($NumCollageContribs) = $DB->next_record();
}
if (check_paranoia_here(array('uniquegroups', 'uniquegroups+'))) {
$DB->query("SELECT COUNT(DISTINCT GroupID) FROM torrents WHERE UserID = '$UserID'");
$DB->query("
SELECT COUNT(DISTINCT GroupID)
FROM torrents
WHERE UserID = '$UserID'");
list($UniqueGroups) = $DB->next_record();
}
@ -204,17 +234,30 @@ function check_paranoia_here($Setting) {
}
if (check_paranoia_here('seeding+')) {
$DB->query("SELECT COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.remaining=0");
$DB->query("
SELECT COUNT(x.uid)
FROM xbt_files_users AS x
INNER JOIN torrents AS t ON t.ID=x.fid
WHERE x.uid='$UserID'
AND x.remaining=0");
list($Seeding) = $DB->next_record();
}
if (check_paranoia_here('leeching+')) {
$DB->query("SELECT COUNT(x.uid) FROM xbt_files_users AS x INNER JOIN torrents AS t ON t.ID=x.fid WHERE x.uid='$UserID' AND x.remaining>0");
$DB->query("
SELECT COUNT(x.uid)
FROM xbt_files_users AS x
INNER JOIN torrents AS t ON t.ID=x.fid
WHERE x.uid='$UserID'
AND x.remaining>0");
list($Leeching) = $DB->next_record();
}
if (check_paranoia_here('invitedcount')) {
$DB->query("SELECT COUNT(UserID) FROM users_info WHERE Inviter='$UserID'");
$DB->query("
SELECT COUNT(UserID)
FROM users_info
WHERE Inviter='$UserID'");
list($Invited) = $DB->next_record();
}

View File

@ -16,7 +16,7 @@ function error_out($reason = '') {
}
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;

View File

@ -1,6 +1,6 @@
<?
include(SERVER_ROOT . '/classes/class_text.php');
include(SERVER_ROOT . '/classes/class_alias.php');
include(SERVER_ROOT . '/classes/text.class.php');
include(SERVER_ROOT . '/classes/alias.class.php');
$Text = new TEXT(true);
$Alias = new ALIAS;
@ -38,4 +38,4 @@
'date' => $Date,
'revision' => (int) $Revision
));
?>
?>

View File

@ -26,7 +26,7 @@
$App = $Cache->get_value('api_apps_'.$AppID);
if (!is_array($App)) {
if (!isset($DB)) {
require(SERVER_ROOT.'/classes/class_mysql.php');
require(SERVER_ROOT.'/classes/mysql.class.php');
$DB = new DB_MYSQL;
}
$DB->query("SELECT Token, Name FROM api_applications WHERE ID='$AppID' LIMIT 1");
@ -44,7 +44,7 @@
$User = $Cache->get_value('api_users_'.$UserID);
if (!is_array($User)) {
if (!isset($DB)) {
require(SERVER_ROOT.'/classes/class_mysql.php');
require(SERVER_ROOT.'/classes/mysql.class.php');
$DB = new DB_MYSQL;
}
$DB->query("

View File

@ -6,11 +6,11 @@ function compare($X, $Y) {
return($Y['count'] - $X['count']);
}
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
// Similar artist map
include(SERVER_ROOT.'/classes/class_artists_similar.php');
include(SERVER_ROOT.'/classes/artists_similar.class.php');
$UserVotes = Votes::get_user_votes($LoggedUser['ID']);
@ -839,7 +839,7 @@ function compare($X, $Y) {
}
}
if (empty($Similar) || empty($Similar->Artists)) {
include(SERVER_ROOT.'/classes/class_image.php');
include(SERVER_ROOT.'/classes/image.class.php');
$Img = new IMAGE;
$Img->create(WIDTH, HEIGHT);
$Img->color(255, 255, 255, 127);

View File

@ -18,8 +18,8 @@
$AutoSuggest = $Cache->get('autocomplete_artist_'.$KeySize.'_'.$Letters);
if (!is_array($AutoSuggest)) {
if (!isset($DB) || !is_object($DB)) {
require(SERVER_ROOT.'/classes/class_mysql.php'); //Require the database wrapper
$DB=NEW DB_MYSQL; //Load the database wrapper
require(SERVER_ROOT.'/classes/mysql.class.php'); //Require the database wrapper
$DB = NEW DB_MYSQL; //Load the database wrapper
}
$Limit = (($KeySize === $MaxKeySize) ? 250 : 10);
$DB->query("

View File

@ -10,17 +10,21 @@
error(0);
}
$DB->query("SELECT aa.AliasID
FROM artists_alias AS aa
JOIN artists_alias AS aa2 ON aa.ArtistID=aa2.ArtistID
WHERE aa.AliasID=".$AliasID);
$DB->query("
SELECT aa.AliasID
FROM artists_alias AS aa
JOIN artists_alias AS aa2 ON aa.ArtistID=aa2.ArtistID
WHERE aa.AliasID=".$AliasID);
if ($DB->record_count() == 1) {
//This is the last alias on the artist
error("That alias is the last alias for that artist; removing it would cause bad things to happen.");
}
$DB->query("SELECT GroupID FROM torrents_artists WHERE AliasID='$AliasID'");
$DB->query("
SELECT GroupID
FROM torrents_artists
WHERE AliasID='$AliasID'");
if ($DB->record_count() > 0) {
list($GroupID) = $DB->next_record();
if ($GroupID != 0) {
@ -28,11 +32,20 @@
}
}
$DB->query("SELECT aa.ArtistID, ag.Name, aa.Name FROM artists_alias AS aa JOIN artists_group AS ag ON aa.ArtistID=ag.ArtistID WHERE aa.AliasID=$AliasID");
$DB->query("
SELECT aa.ArtistID, ag.Name, aa.Name
FROM artists_alias AS aa
JOIN artists_group AS ag ON aa.ArtistID=ag.ArtistID
WHERE aa.AliasID=$AliasID");
list($ArtistID, $ArtistName, $AliasName) = $DB->next_record(MYSQLI_NUM, false);
$DB->query("DELETE FROM artists_alias WHERE AliasID='$AliasID'");
$DB->query("UPDATE artists_alias SET Redirect='0' WHERE Redirect='$AliasID'");
$DB->query("
DELETE FROM artists_alias
WHERE AliasID='$AliasID'");
$DB->query("
UPDATE artists_alias
SET Redirect='0'
WHERE Redirect='$AliasID'");
Misc::write_log("The alias $AliasID ($AliasName) was removed from the artist $ArtistID ($ArtistName) by user $LoggedUser[ID] ($LoggedUser[Username])");

View File

@ -16,7 +16,7 @@
error(0);
}
include(SERVER_ROOT.'/classes/class_wiki.php'); // Wiki class
include(SERVER_ROOT.'/classes/wiki.class.php'); // Wiki class
$Wiki = new WIKI('wiki_artists', $ArtistID, "artist.php?id=$ArtistID");
// Get the artist name and the body of the last revision

View File

@ -156,7 +156,7 @@
case 'takeedit_post':
authorize();
include(SERVER_ROOT . '/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT . '/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
// Quick SQL injection check

View File

@ -8,17 +8,33 @@
error(0);
}
$DB->query("SELECT GROUP_CONCAT(Name SEPARATOR '|') FROM artists_alias WHERE ArtistID = '$ArtistID' AND Redirect = 0 GROUP BY ArtistID");
$DB->query("
SELECT GROUP_CONCAT(Name SEPARATOR '|')
FROM artists_alias
WHERE ArtistID = '$ArtistID'
AND Redirect = 0
GROUP BY ArtistID");
list($ArtistAliases) = $DB->next_record(MYSQLI_NUM, FALSE);
$Notify = $Cache->get_value('notify_artists_'.$LoggedUser['ID']);
if (empty($Notify)) {
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE Label='Artist notifications' AND UserID='$LoggedUser[ID]' ORDER BY ID LIMIT 1");
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE Label='Artist notifications'
AND UserID='$LoggedUser[ID]'
ORDER BY ID
LIMIT 1");
} else {
$DB->query("SELECT ID, Artists FROM users_notify_filters WHERE ID='$Notify[ID]'");
$DB->query("
SELECT ID, Artists
FROM users_notify_filters
WHERE ID='$Notify[ID]'");
}
if (empty($Notify) && $DB->record_count() == 0) {
$DB->query("INSERT INTO users_notify_filters (UserID, Label, Artists) VALUES ('$LoggedUser[ID]', 'Artist notifications', '|".db_string($ArtistAliases)."|')");
$DB->query("
INSERT INTO users_notify_filters (UserID, Label, Artists)
VALUES ('$LoggedUser[ID]', 'Artist notifications', '|".db_string($ArtistAliases)."|')");
$FilterID = $DB->inserted_id();
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
@ -26,7 +42,10 @@
list($ID, $ArtistNames) = $DB->next_record(MYSQLI_NUM, FALSE);
if (stripos($ArtistNames,$ArtistAliases) === false) {
$ArtistNames.=$ArtistAliases.'|';
$DB->query("UPDATE users_notify_filters SET Artists='".db_string($ArtistNames)."' WHERE ID='$ID'");
$DB->query("
UPDATE users_notify_filters
SET Artists='".db_string($ArtistNames)."'
WHERE ID='$ID'");
$Cache->delete_value('notify_filters_'.$LoggedUser['ID']);
$Cache->delete_value('notify_artists_'.$LoggedUser['ID']);
}

View File

@ -3,7 +3,7 @@
define('ANNOUNCEMENT_FORUM_ID', 19);
View::show_header('Blog','bbcode');
require(SERVER_ROOT.'/classes/class_text.php');
require(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT;
if (check_perms('admin_manage_blog')) {

View File

@ -1,6 +1,6 @@
<?
include(SERVER_ROOT.'/classes/class_feed.php'); // RSS feeds
include(SERVER_ROOT.'/classes/class_text.php'); // strip_bbcode
include(SERVER_ROOT.'/classes/feed.class.php'); // RSS feeds
include(SERVER_ROOT.'/classes/text.class.php'); // strip_bbcode
authorize();

View File

@ -17,7 +17,7 @@
// Finally we start
// Require the table class
// require_once SERVER_ROOT . '/classes/class_mass_user_torrents_table_view.php';
// require_once SERVER_ROOT . '/classes/mass_user_torrents_table_view.class.php';
View::show_header('Organize Bookmarks', 'browse,jquery,jquery-ui,jquery.tablesorter,sort');

View File

@ -7,7 +7,7 @@
}
if ($_POST['type'] === 'torrents') {
// require_once SERVER_ROOT.'/classes/class_mass_user_bookmarks_editor.php'; //Bookmark Updater Class
// require_once SERVER_ROOT.'/classes/mass_user_bookmarks_editor.class.php'; //Bookmark Updater Class
$BU = new MASS_USER_BOOKMARKS_EDITOR;
if ($_POST['delete']) {
$BU->mass_remove();

View File

@ -3,7 +3,7 @@
authorize();
include(SERVER_ROOT.'/classes/class_validate.php');
include(SERVER_ROOT.'/classes/validate.class.php');
$Val = new VALIDATE;
function add_artist($CollageID, $ArtistID) {
@ -18,9 +18,9 @@ function add_artist($CollageID, $ArtistID) {
$DB->query("INSERT IGNORE INTO collages_artists
(CollageID, ArtistID, UserID, Sort, AddedOn)
VALUES
('$CollageID', '$ArtistID', '$LoggedUser[ID]', '$Sort', NOW())");
('$CollageID', '$ArtistID', '$LoggedUser[ID]', '$Sort', '" . sqltime() . "')");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1 WHERE ID='$CollageID'");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1, Updated = '" . sqltime() . "' WHERE ID='$CollageID'");
$Cache->delete_value('collage_'.$CollageID);
$Cache->delete_value('artists_collages_'.$ArtistID);

View File

@ -2,7 +2,7 @@
authorize();
include(SERVER_ROOT.'/classes/class_validate.php');
include(SERVER_ROOT.'/classes/validate.class.php');
$Val = new VALIDATE;
function add_torrent($CollageID, $GroupID) {
@ -17,9 +17,9 @@ function add_torrent($CollageID, $GroupID) {
$DB->query("INSERT IGNORE INTO collages_torrents
(CollageID, GroupID, UserID, Sort, AddedOn)
VALUES
('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', NOW())");
('$CollageID', '$GroupID', '$LoggedUser[ID]', '$Sort', '" . sqltime() . "')");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1, Updated = NOW() WHERE ID='$CollageID'");
$DB->query("UPDATE collages SET NumTorrents=NumTorrents+1, Updated = '" . sqltime() . "' WHERE ID='$CollageID'");
$Cache->delete_value('collage_'.$CollageID);
$Cache->delete_value('torrents_details_'.$GroupID);

View File

@ -10,7 +10,7 @@
//---------- Things to sort out before it can start printing/generating content
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
// Check for lame SQL injection attempts

View File

@ -1,7 +1,7 @@
<?
define('COLLAGES_PER_PAGE', 25);
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
list($Page,$Limit) = Format::page_limit(COLLAGES_PER_PAGE);

View File

@ -7,7 +7,7 @@ function compare($X, $Y) {
return($Y['count'] - $X['count']);
}
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;

Some files were not shown because too many files have changed in this diff Show More