Empty commit

This commit is contained in:
Git 2013-10-30 08:01:19 +00:00
parent b2a8f94274
commit 8b4df3109e
59 changed files with 535 additions and 594 deletions

View File

@ -115,10 +115,10 @@ define('BOT_HELP_CHAN', '#');
define('BOT_DEBUG_CHAN', '#');
define('BOT_REPORT_CHAN', '#');
define('BOT_NICKSERV_PASS', '');
define('BOT_INVITE_CHAN',BOT_CHAN.'-invites'); // Channel for non-members seeking an interview
define('BOT_INTERVIEW_CHAN',BOT_CHAN.'-interview'); // Channel for the interviews
define('BOT_INTERVIEW_NUM',5);
define('BOT_INTERVIEW_STAFF',BOT_CHAN.'-interviewers'); // Channel for the interviewers
define('BOT_INVITE_CHAN', BOT_CHAN.'-invites'); // Channel for non-members seeking an interview
define('BOT_INTERVIEW_CHAN', BOT_CHAN.'-interview'); // Channel for the interviews
define('BOT_INTERVIEW_NUM', 5);
define('BOT_INTERVIEW_STAFF', BOT_CHAN.'-interviewers'); // Channel for the interviewers
define('SOCKET_LISTEN_PORT', 51010);
define('SOCKET_LISTEN_ADDRESS', 'localhost');
define('ADMIN_CHAN', '#');
@ -163,32 +163,32 @@ $ZIPGroups = array(
//3D array of attributes, OptionGroup, OptionNumber, Name
$ZIPOptions = array(
'00' => array(0,0,'V0'),
'01' => array(0,1,'APX'),
'02' => array(0,2,'256'),
'03' => array(0,3,'V1'),
'10' => array(1,0,'224'),
'11' => array(1,1,'V2'),
'12' => array(1,2,'APS'),
'13' => array(1,3,'192'),
'20' => array(2,0,'320'),
'21' => array(2,1,'256'),
'22' => array(2,2,'224'),
'23' => array(2,3,'192'),
'30' => array(3,0,'FLAC / 24bit / Vinyl'),
'31' => array(3,1,'FLAC / 24bit / DVD'),
'32' => array(3,2,'FLAC / 24bit / SACD'),
'33' => array(3,3,'FLAC / Log (100) / Cue'),
'34' => array(3,4,'FLAC / Log (100)'),
'35' => array(3,5,'FLAC / Log'),
'36' => array(3,6,'FLAC'),
'40' => array(4,0,'DTS'),
'41' => array(4,1,'Ogg Vorbis'),
'42' => array(4,2,'AAC - 320'),
'43' => array(4,3,'AAC - 256'),
'44' => array(4,4,'AAC - q5.5'),
'45' => array(4,5,'AAC - q5'),
'46' => array(4,6,'AAC - 192')
'00' => array(0, 0, 'V0'),
'01' => array(0, 1, 'APX'),
'02' => array(0, 2, '256'),
'03' => array(0, 3, 'V1'),
'10' => array(1, 0, '224'),
'11' => array(1, 1, 'V2'),
'12' => array(1, 2, 'APS'),
'13' => array(1, 3, '192'),
'20' => array(2, 0, '320'),
'21' => array(2, 1, '256'),
'22' => array(2, 2, '224'),
'23' => array(2, 3, '192'),
'30' => array(3, 0, 'FLAC / 24bit / Vinyl'),
'31' => array(3, 1, 'FLAC / 24bit / DVD'),
'32' => array(3, 2, 'FLAC / 24bit / SACD'),
'33' => array(3, 3, 'FLAC / Log (100) / Cue'),
'34' => array(3, 4, 'FLAC / Log (100)'),
'35' => array(3, 5, 'FLAC / Log'),
'36' => array(3, 6, 'FLAC'),
'40' => array(4, 0, 'DTS'),
'41' => array(4, 1, 'Ogg Vorbis'),
'42' => array(4, 2, 'AAC - 320'),
'43' => array(4, 3, 'AAC - 256'),
'44' => array(4, 4, 'AAC - q5.5'),
'45' => array(4, 5, 'AAC - q5'),
'46' => array(4, 6, 'AAC - 192')
);
// Ratio requirements, in descending order
@ -203,9 +203,28 @@ $RatioRequirements = array(
);
//Captcha fonts should be located in /classes/fonts
$CaptchaFonts=array('ARIBLK.TTF','IMPACT.TTF','TREBUC.TTF','TREBUCBD.TTF','TREBUCBI.TTF','TREBUCIT.TTF','VERDANA.TTF','VERDANAB.TTF','VERDANAI.TTF','VERDANAZ.TTF');
$CaptchaFonts = array(
'ARIBLK.TTF',
'IMPACT.TTF',
'TREBUC.TTF',
'TREBUCBD.TTF',
'TREBUCBI.TTF',
'TREBUCIT.TTF',
'VERDANA.TTF',
'VERDANAB.TTF',
'VERDANAI.TTF',
'VERDANAZ.TTF');
//Captcha images should be located in /captcha
$CaptchaBGs=array('captcha1.png','captcha2.png','captcha3.png','captcha4.png','captcha5.png','captcha6.png','captcha7.png','captcha8.png','captcha9.png');
$CaptchaBGs = array(
'captcha1.png',
'captcha2.png',
'captcha3.png',
'captcha4.png',
'captcha5.png',
'captcha6.png',
'captcha7.png',
'captcha8.png',
'captcha9.png');
// Special characters, and what they should be converted to
// Used for torrent searching

View File

@ -158,7 +158,7 @@ public static function get_notification_enabled_users($Type, $UserID) {
$Type = db_string($Type);
$UserWhere = '';
if (isset($UserID)) {
$UserID = (int) $UserID;
$UserID = (int)$UserID;
$UserWhere = " AND UserID = '$UserID'";
}
$QueryID = G::$DB->get_query_id();

View File

@ -69,10 +69,10 @@ public static function get_months() {
if (!$Results) {
$QueryID = G::$DB->get_query_id();
G::$DB->query("
SELECT DISTINCT
YEAR(DATE) AS Year, MONTH(Date) AS Month, MONTHNAME(Date) AS MonthName
FROM site_history
ORDER BY Date DESC");
SELECT DISTINCT
YEAR(DATE) AS Year, MONTH(Date) AS Month, MONTHNAME(Date) AS MonthName
FROM site_history
ORDER BY Date DESC");
$Results = G::$DB->to_array();
G::$DB->set_query_id($QueryID);
G::$Cache->cache_value("site_history_months", $Results, 0);
@ -84,11 +84,11 @@ public static function get_event($ID) {
if (!empty($ID)) {
$QueryID = G::$DB->get_query_id();
G::$DB->query("
SELECT
ID, Title, Url, Category, SubCategory, Tags, Body, AddedBy, Date
FROM site_history
WHERE ID = '$ID'
ORDER BY Date DESC");
SELECT
ID, Title, Url, Category, SubCategory, Tags, Body, AddedBy, Date
FROM site_history
WHERE ID = '$ID'
ORDER BY Date DESC");
$Event = G::$DB->next_record();
G::$DB->set_query_id($QueryID);
return $Event;
@ -189,10 +189,10 @@ public static function add_event($Date, $Title, $Link, $Category, $SubCategory,
$QueryID = G::$DB->get_query_id();
G::$DB->query("
INSERT INTO site_history
(Title, Url, Category, SubCategory, Tags, Body, AddedBy, Date)
VALUES
('$Title', '$Link', '$Category', '$SubCategory', '$Tags', '$Body', '$UserID', '$Date')");
INSERT INTO site_history
(Title, Url, Category, SubCategory, Tags, Body, AddedBy, Date)
VALUES
('$Title', '$Link', '$Category', '$SubCategory', '$Tags', '$Body', '$UserID', '$Date')");
G::$DB->set_query_id($QueryID);
G::$Cache->delete_value("site_history_months");
}
@ -220,7 +220,7 @@ public static function update_event($ID, $Date, $Title, $Link, $Category, $SubCa
}
}
$Body = db_string($Body);
$UserID = (int) $UserID;
$UserID = (int)$UserID;
if (empty($ID) || empty($Title) || empty($Category) || empty($SubCategory)) {
error("Error");
@ -228,18 +228,17 @@ public static function update_event($ID, $Date, $Title, $Link, $Category, $SubCa
$QueryID = G::$DB->get_query_id();
G::$DB->query("
UPDATE site_history
SET
Title = '$Title',
Url = '$Link',
Category = '$Category',
SubCategory = '$SubCategory',
Tags = '$Tags',
Body = '$Body',
AddedBy = '$UserID',
Date = '$Date'
WHERE
ID = '$ID'");
UPDATE site_history
SET
Title = '$Title',
Url = '$Link',
Category = '$Category',
SubCategory = '$SubCategory',
Tags = '$Tags',
Body = '$Body',
AddedBy = '$UserID',
Date = '$Date'
WHERE ID = '$ID'");
G::$DB->set_query_id($QueryID);
G::$Cache->delete_value("site_history_months");
}
@ -249,7 +248,9 @@ public static function delete_event($ID) {
error(404);
}
$QueryID = G::$DB->get_query_id();
G::$DB->query("DELETE FROM site_history WHERE ID = '$ID'");
G::$DB->query("
DELETE FROM site_history
WHERE ID = '$ID'");
G::$DB->set_query_id($QueryID);
G::$Cache->delete_value("site_history_months");
}

View File

@ -109,7 +109,7 @@ class TEXT {
* @param bool $TOC When used, will enabled TOC
*/
public function __construct ($TOC = false) {
$this->TOC = (bool) $TOC;
$this->TOC = (boolean)$TOC;
foreach ($this->Smileys as $Key=>$Val) {
$this->Smileys[$Key] = '<img border="0" src="'.STATIC_SERVER.'common/smileys/'.$Val.'" alt="" />';
}
@ -530,7 +530,7 @@ public function parse_toc ($Min = 3) {
$off = 0;
foreach ($this->Headlines as $t) {
$n = (int) $t[0];
$n = (int)$t[0];
if ($i === 0 && $n > 1) {
$off = $n - $level;
}

View File

@ -1,6 +1,7 @@
<?
class Torrents {
const FilelistDelim = 0xF7; // Hex for &divide; Must be the same as phrase_boundary in sphinx.conf!
const FILELIST_DELIM = 0xF7; // Hex for &divide; Must be the same as phrase_boundary in sphinx.conf!
const SNATCHED_UPDATE_INTERVAL = 3600; // How often we want to update users' snatch lists
/*
* Function to get data and torrents for an array of GroupIDs. Order of keys doesn't matter
@ -149,11 +150,13 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
}
}
// Fetch all user specific torrent properties
foreach ($Found as &$Group) {
$Group['Flags'] = array('IsSnatched' => false);
if (!empty($Group['Torrents'])) {
foreach ($Group['Torrents'] as &$Torrent) {
self::torrent_properties($Torrent, $Group['Flags']);
if ($Torrents) {
foreach ($Found as &$Group) {
$Group['Flags'] = array('IsSnatched' => false);
if (!empty($Group['Torrents'])) {
foreach ($Group['Torrents'] as &$Torrent) {
self::torrent_properties($Torrent, $Group['Flags']);
}
}
}
}
@ -588,7 +591,7 @@ public static function filelist_delim() {
if (isset($FilelistDelimUTF8)) {
return $FilelistDelimUTF8;
}
return $FilelistDelimUTF8 = utf8_encode(chr(self::FilelistDelim));
return $FilelistDelimUTF8 = utf8_encode(chr(self::FILELIST_DELIM));
}
/**
@ -837,7 +840,7 @@ public static function has_snatched($TorrentID, $AllUsers = false) {
$CurTime = time();
// This bucket hasn't been checked before
$CurSnatchedTorrents = G::$Cache->get_value("users_snatched_{$UserID}_$BucketID", true);
if ($CurSnatchedTorrents === false || $CurTime - $LastUpdate > 1800) {
if ($CurSnatchedTorrents === false || $CurTime - $LastUpdate > self::SNATCHED_UPDATE_INTERVAL) {
$Updated = array();
$QueryID = G::$DB->get_query_id();
if ($CurSnatchedTorrents === false || $LastUpdate == 0) {

View File

@ -1,8 +1,6 @@
<?
define('PREFIX', 'percentiles_'); // Prefix for memcache keys, to make life easier
class UserRank {
const PREFIX = 'percentiles_'; // Prefix for memcache keys, to make life easier
// Returns a 101 row array (101 percentiles - 0 - 100), with the minimum value for that percentile as the value for each row
// BTW - ingenious
@ -115,16 +113,16 @@ public static function get_rank($TableName, $Value) {
return 0;
}
$Table = G::$Cache->get_value(PREFIX.$TableName);
$Table = G::$Cache->get_value(self::PREFIX.$TableName);
if (!$Table) {
//Cache lock!
$Lock = G::$Cache->get_value(PREFIX.$TableName.'_lock');
$Lock = G::$Cache->get_value(self::PREFIX.$TableName.'_lock');
if ($Lock) {
return false;
} else {
G::$Cache->cache_value(PREFIX.$TableName.'_lock', '1', 300);
$Table = self::build_table(PREFIX.$TableName, self::table_query($TableName));
G::$Cache->delete_value(PREFIX.$TableName.'_lock');
G::$Cache->cache_value(self::PREFIX.$TableName.'_lock', '1', 300);
$Table = self::build_table(self::PREFIX.$TableName, self::table_query($TableName));
G::$Cache->delete_value(self::PREFIX.$TableName.'_lock');
}
}
$LastPercentile = 0;

View File

@ -321,7 +321,7 @@ public static function release_order(&$SiteOptions, $Default = false) {
$Val = $RT[$Key];
}
$ID = $Key . '_' . (int) !!$Checked;
$ID = "$Key_" . (int)(!!$Checked);
// The HTML is indented this far for proper indentation in the generated HTML
// on user.php?action=edit
@ -584,7 +584,7 @@ public static function make_class_string($ClassID) {
* @return array Group IDs, Bookmark Data, Torrent List
*/
public static function get_bookmarks($UserID) {
$UserID = (int) $UserID;
$UserID = (int)$UserID;
if (($Data = G::$Cache->get_value("bookmarks_group_ids_$UserID"))) {
list($GroupIDs, $BookmarkData) = $Data;

View File

@ -1071,12 +1071,6 @@ CREATE TABLE `tags` (
KEY `UserID` (`UserID`)
) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `temp_torrents_files` (
`TorrentID` int(10) NOT NULL,
`File` mediumblob NOT NULL,
PRIMARY KEY (`TorrentID`)
) ENGINE=MyISAM CHARSET utf8;
CREATE TABLE `top10_history` (
`ID` int(10) NOT NULL AUTO_INCREMENT,
`Date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@ -1189,7 +1183,6 @@ CREATE TABLE `torrents_balance_history` (
`Last` enum('0','1','2') DEFAULT '0',
UNIQUE KEY `TorrentID_2` (`TorrentID`,`Time`),
UNIQUE KEY `TorrentID_3` (`TorrentID`,`balance`),
KEY `TorrentID` (`TorrentID`),
KEY `Time` (`Time`)
) ENGINE=MyISAM CHARSET utf8;
@ -1503,138 +1496,6 @@ CREATE TABLE `users_info` (
KEY `ResetKey` (`ResetKey`)
) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `users_info_bak` (
`UserID` int(10) unsigned NOT NULL,
`StyleID` int(10) unsigned NOT NULL,
`StyleURL` varchar(255) DEFAULT NULL,
`Info` text NOT NULL,
`Avatar` varchar(255) NOT NULL,
`Country` int(10) unsigned NOT NULL,
`AdminComment` text NOT NULL,
`SiteOptions` text NOT NULL,
`ViewAvatars` enum('0','1') NOT NULL DEFAULT '1',
`Donor` enum('0','1') NOT NULL DEFAULT '0',
`Artist` enum('0','1') NOT NULL DEFAULT '0',
`DownloadAlt` enum('0','1') NOT NULL DEFAULT '0',
`Warned` datetime NOT NULL,
`MessagesPerPage` tinyint(3) unsigned NOT NULL DEFAULT '0',
`DeletePMs` enum('0','1') NOT NULL DEFAULT '1',
`SaveSentPMs` enum('0','1') NOT NULL DEFAULT '0',
`SupportFor` varchar(255) NOT NULL,
`TorrentGrouping` enum('0','1','2') NOT NULL COMMENT '0=Open,1=Closed,2=Off',
`ShowTags` enum('0','1') NOT NULL DEFAULT '1',
`NotifyOnQuote` enum('0','1','2') NOT NULL DEFAULT '0',
`AuthKey` varchar(32) NOT NULL,
`ResetKey` varchar(32) NOT NULL,
`ResetExpires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`JoinDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Inviter` int(10) DEFAULT NULL,
`BitcoinAddress` varchar(34) DEFAULT NULL,
`WarnedTimes` int(2) NOT NULL DEFAULT '0',
`DisableAvatar` enum('0','1') NOT NULL DEFAULT '0',
`DisableInvites` enum('0','1') NOT NULL DEFAULT '0',
`DisablePosting` enum('0','1') NOT NULL DEFAULT '0',
`DisableForums` enum('0','1') NOT NULL DEFAULT '0',
`DisableIRC` enum('0','1') DEFAULT '0',
`DisableTagging` enum('0','1') NOT NULL DEFAULT '0',
`DisableUpload` enum('0','1') NOT NULL DEFAULT '0',
`DisableWiki` enum('0','1') NOT NULL DEFAULT '0',
`DisablePM` enum('0','1') NOT NULL DEFAULT '0',
`RatioWatchEnds` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`RatioWatchDownload` bigint(20) unsigned NOT NULL DEFAULT '0',
`RatioWatchTimes` tinyint(1) unsigned NOT NULL DEFAULT '0',
`BanDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`BanReason` enum('0','1','2','3','4') NOT NULL DEFAULT '0',
`CatchupTime` datetime DEFAULT NULL,
`LastReadNews` int(10) NOT NULL DEFAULT '0',
`HideCountryChanges` enum('0','1') NOT NULL DEFAULT '0',
`RestrictedForums` varchar(150) NOT NULL DEFAULT '',
`DisableRequests` enum('0','1') NOT NULL DEFAULT '0',
`PermittedForums` varchar(150) NOT NULL DEFAULT '',
`UnseededAlerts` enum('0','1') NOT NULL DEFAULT '0',
`LastReadBlog` int(10) NOT NULL DEFAULT '0',
`TorrentsCommentsCatchupTime` datetime DEFAULT NULL,
`ArtistsCommentsCatchupTime` datetime DEFAULT NULL,
`InfoTitle` varchar(255) NOT NULL,
UNIQUE KEY `UserID` (`UserID`),
KEY `SupportFor` (`SupportFor`),
KEY `DisableInvites` (`DisableInvites`),
KEY `Donor` (`Donor`),
KEY `Warned` (`Warned`),
KEY `JoinDate` (`JoinDate`),
KEY `Inviter` (`Inviter`),
KEY `RatioWatchEnds` (`RatioWatchEnds`),
KEY `RatioWatchDownload` (`RatioWatchDownload`),
KEY `BitcoinAddress` (`BitcoinAddress`(4)),
KEY `AuthKey` (`AuthKey`)
) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `users_info_tmp` (
`UserID` int(10) unsigned NOT NULL,
`StyleID` int(10) unsigned NOT NULL,
`StyleURL` varchar(255) DEFAULT NULL,
`Info` text NOT NULL,
`Avatar` varchar(255) NOT NULL,
`Country` int(10) unsigned NOT NULL,
`AdminComment` text NOT NULL,
`SiteOptions` text NOT NULL,
`ViewAvatars` enum('0','1') NOT NULL DEFAULT '1',
`Donor` enum('0','1') NOT NULL DEFAULT '0',
`Artist` enum('0','1') NOT NULL DEFAULT '0',
`DownloadAlt` enum('0','1') NOT NULL DEFAULT '0',
`Warned` datetime NOT NULL,
`MessagesPerPage` tinyint(3) unsigned NOT NULL DEFAULT '0',
`DeletePMs` enum('0','1') NOT NULL DEFAULT '1',
`SaveSentPMs` enum('0','1') NOT NULL DEFAULT '0',
`SupportFor` varchar(255) NOT NULL,
`TorrentGrouping` enum('0','1','2') NOT NULL COMMENT '0=Open,1=Closed,2=Off',
`ShowTags` enum('0','1') NOT NULL DEFAULT '1',
`NotifyOnQuote` enum('0','1','2') NOT NULL DEFAULT '0',
`AuthKey` varchar(32) NOT NULL,
`ResetKey` varchar(32) NOT NULL,
`ResetExpires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`JoinDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Inviter` int(10) DEFAULT NULL,
`BitcoinAddress` varchar(34) DEFAULT NULL,
`WarnedTimes` int(2) NOT NULL DEFAULT '0',
`DisableAvatar` enum('0','1') NOT NULL DEFAULT '0',
`DisableInvites` enum('0','1') NOT NULL DEFAULT '0',
`DisablePosting` enum('0','1') NOT NULL DEFAULT '0',
`DisableForums` enum('0','1') NOT NULL DEFAULT '0',
`DisableIRC` enum('0','1') DEFAULT '0',
`DisableTagging` enum('0','1') NOT NULL DEFAULT '0',
`DisableUpload` enum('0','1') NOT NULL DEFAULT '0',
`DisableWiki` enum('0','1') NOT NULL DEFAULT '0',
`DisablePM` enum('0','1') NOT NULL DEFAULT '0',
`RatioWatchEnds` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`RatioWatchDownload` bigint(20) unsigned NOT NULL DEFAULT '0',
`RatioWatchTimes` tinyint(1) unsigned NOT NULL DEFAULT '0',
`BanDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`BanReason` enum('0','1','2','3','4') NOT NULL DEFAULT '0',
`CatchupTime` datetime DEFAULT NULL,
`LastReadNews` int(10) NOT NULL DEFAULT '0',
`HideCountryChanges` enum('0','1') NOT NULL DEFAULT '0',
`RestrictedForums` varchar(150) NOT NULL DEFAULT '',
`DisableRequests` enum('0','1') NOT NULL DEFAULT '0',
`PermittedForums` varchar(150) NOT NULL DEFAULT '',
`UnseededAlerts` enum('0','1') NOT NULL DEFAULT '0',
`LastReadBlog` int(10) NOT NULL DEFAULT '0',
`TorrentsCommentsCatchupTime` datetime DEFAULT NULL,
`ArtistsCommentsCatchupTime` datetime DEFAULT NULL,
`InfoTitle` varchar(255) NOT NULL,
UNIQUE KEY `UserID` (`UserID`),
KEY `SupportFor` (`SupportFor`),
KEY `DisableInvites` (`DisableInvites`),
KEY `Donor` (`Donor`),
KEY `Warned` (`Warned`),
KEY `JoinDate` (`JoinDate`),
KEY `Inviter` (`Inviter`),
KEY `RatioWatchEnds` (`RatioWatchEnds`),
KEY `RatioWatchDownload` (`RatioWatchDownload`),
KEY `BitcoinAddress` (`BitcoinAddress`(4)),
KEY `AuthKey` (`AuthKey`)
) ENGINE=InnoDB CHARSET utf8;
CREATE TABLE `users_levels` (
`UserID` int(10) unsigned NOT NULL,
`PermissionID` int(10) unsigned NOT NULL,

View File

@ -48,13 +48,13 @@
for ($i = 0; $i < 5; $i++) {
list($BlogID, $Author, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i];
$JsonBlog[] = array(
'blogId' => (int) $BlogID,
'blogId' => (int)$BlogID,
'author' => $Author,
'title' => $Title,
'bbBody' => $Body,
'body' => $Text->full_format($Body),
'blogTime' => $BlogTime,
'threadId' => (int) $ThreadID
'threadId' => (int)$ThreadID
);
}
@ -67,7 +67,7 @@
}
$JsonAnnouncements[] = array(
'newsId' => (int) $NewsID,
'newsId' => (int)$NewsID,
'title' => $Title,
'bbBody' => $Body,
'body' => $Text->full_format($Body),

View File

@ -27,20 +27,20 @@
if (count($Artists) > 0) {
foreach ($Artists as $Artist) {
$JsonArtists[] = array(
'id' => (int) $Artist['id'],
'id' => (int)$Artist['id'],
'name' => $Artist['name'],
'aliasId' => (int) $Artist['aliasid']
'aliasId' => (int)$Artist['aliasid']
);
}
}
$JsonResults[] = array(
'torrentId' => (int) $FlacID,
'groupId' => (int) $GroupID,
'torrentId' => (int)$FlacID,
'groupId' => (int)$GroupID,
'artist' => $JsonArtists,
'groupName' => $GroupName,
'groupYear' => (int) $GroupYear,
'downloadUrl' => 'torrents.php?action=download&id='.$FlacID.'&authkey='.$LoggedUser['AuthKey'].'&torrent_pass='.$LoggedUser['torrent_pass']
'groupYear' => (int)$GroupYear,
'downloadUrl' => "torrents.php?action=download&id=$FlacID&authkey=".$LoggedUser['AuthKey'].'&torrent_pass='.$LoggedUser['torrent_pass']
);
}

View File

@ -110,11 +110,11 @@
}
$JsonResults[] = array(
'torrentId' => (int) $Edition['FlacID'],
'groupId' => (int) $GroupID,
'torrentId' => (int)$Edition['FlacID'],
'groupId' => (int)$GroupID,
'artist' => $ArtistNames,
'groupName' => $GroupName,
'groupYear' => (int) $GroupYear,
'groupYear' => (int)$GroupYear,
'missingV2' => !isset($Edition['Formats']['V2 (VBR)']),
'missingV0' => !isset($Edition['Formats']['V0 (VBR)']),
'missing320' => !isset($Encodings['Formats']['320']),

View File

@ -46,7 +46,7 @@
foreach ($ArtistList as $Artist) {
list($ArtistID, $Name) = $Artist;
$JsonArtists[] = array(
'artistId' => (int) $ArtistID,
'artistId' => (int)$ArtistID,
'artistName' => $Name
);
}

View File

@ -34,12 +34,12 @@ function compare($X, $Y) {
$JsonTorrents = array();
foreach ($Torrent['Torrents'] as $GroupTorrents) {
$JsonTorrents[] = array(
'id' => (int) $GroupTorrents['ID'],
'groupId' => (int) $GroupTorrents['GroupID'],
'id' => (int)$GroupTorrents['ID'],
'groupId' => (int)$GroupTorrents['GroupID'],
'media' => $GroupTorrents['Media'],
'format' => $GroupTorrents['Format'],
'encoding' => $GroupTorrents['Encoding'],
'remasterYear' => (int) $GroupTorrents['RemasterYear'],
'remasterYear' => (int)$GroupTorrents['RemasterYear'],
'remastered' => $GroupTorrents['Remastered'] == 1,
'remasterTitle' => $GroupTorrents['RemasterTitle'],
'remasterRecordLabel' => $GroupTorrents['RemasterRecordLabel'],
@ -47,21 +47,21 @@ function compare($X, $Y) {
'scene' => $GroupTorrents['Scene'] == 1,
'hasLog' => $GroupTorrents['HasLog'] == 1,
'hasCue' => $GroupTorrents['HasCue'] == 1,
'logScore' => (float) $GroupTorrents['LogScore'],
'fileCount' => (int) $GroupTorrents['FileCount'],
'logScore' => (float)$GroupTorrents['LogScore'],
'fileCount' => (int)$GroupTorrents['FileCount'],
'freeTorrent' => $GroupTorrents['FreeTorrent'] == 1,
'size' => (float) $GroupTorrents['Size'],
'leechers' => (int) $GroupTorrents['Leechers'],
'seeders' => (int) $GroupTorrents['Seeders'],
'snatched' => (int) $GroupTorrents['Snatched'],
'size' => (float)$GroupTorrents['Size'],
'leechers' => (int)$GroupTorrents['Leechers'],
'seeders' => (int)$GroupTorrents['Seeders'],
'snatched' => (int)$GroupTorrents['Snatched'],
'time' => $GroupTorrents['Time'],
'hasFile' => (int) $GroupTorrents['HasFile']
'hasFile' => (int)$GroupTorrents['HasFile']
);
}
$JsonBookmarks[] = array(
'id' => (int) $Torrent['ID'],
'id' => (int)$Torrent['ID'],
'name' => $Torrent['Name'],
'year' => (int) $Torrent['Year'],
'year' => (int)$Torrent['Year'],
'recordLabel' => $Torrent['RecordLabel'],
'catalogueNumber' => $Torrent['CatalogueNumber'],
'tagList' => $Torrent['TagList'],

View File

@ -592,18 +592,18 @@
$DisplayName = Artists::display_artists($ExtendedArtists, false, false, true);
foreach ($ExtendedArtists[1] as $Artist) {
$JsonArtists[] = array(
'id' => (int) $Artist['id'],
'id' => (int)$Artist['id'],
'name' => $Artist['name'],
'aliasid' => (int) $Artist['id']
'aliasid' => (int)$Artist['id']
);
}
} elseif (!empty($Artists)) {
$DisplayName = Artists::display_artists(array(1=>$Artists), false, false, true);
$DisplayName = Artists::display_artists(array(1 => $Artists), false, false, true);
foreach ($Artists as $Artist) {
$JsonArtists[] = array(
'id' => (int) $Artist['id'],
'id' => (int)$Artist['id'],
'name' => $Artist['name'],
'aliasid' => (int) $Artist['id']
'aliasid' => (int)$Artist['id']
);
}
} else {
@ -684,27 +684,27 @@
$LastMedia = $Data['Media'];
$JsonTorrents[] = array(
'torrentId' => (int) $TorrentID,
'editionId' => (int) $EditionID,
'torrentId' => (int)$TorrentID,
'editionId' => (int)$EditionID,
'artists' => $JsonArtists,
'remastered' => $Data['Remastered'] == '1',
'remasterYear' => (int) $Data['RemasterYear'],
'remasterYear' => (int)$Data['RemasterYear'],
'remasterCatalogueNumber' => $Data['RemasterCatalogueNumber'],
'remasterTitle' => $Data['RemasterTitle'],
'media' => $Data['Media'],
'encoding' => $Data['Encoding'],
'format' => $Data['Format'],
'hasLog' => $Data['HasLog'] == '1',
'logScore' => (int) $Data['LogScore'],
'logScore' => (int)$Data['LogScore'],
'hasCue' => $Data['HasCue'] == '1',
'scene' => $Data['Scene'] == '1',
'vanityHouse' => $GroupInfo['VanityHouse'] == '1',
'fileCount' => (int) $Data['FileCount'],
'fileCount' => (int)$Data['FileCount'],
'time' => $Data['Time'],
'size' => (int) $Data['Size'],
'snatches' => (int) $Data['Snatched'],
'seeders' => (int) $Data['Seeders'],
'leechers' => (int) $Data['Leechers'],
'size' => (int)$Data['Size'],
'snatches' => (int)$Data['Snatched'],
'seeders' => (int)$Data['Seeders'],
'leechers' => (int)$Data['Leechers'],
'isFreeleech' => $Data['FreeTorrent'] == '1',
'isNeutralLeech' => $Data['FreeTorrent'] == '2',
'isPersonalFreeleech' => $Data['PersonalFL'],
@ -714,20 +714,20 @@
}
$JsonGroups[] = array(
'groupId' => (int) $GroupID,
'groupId' => (int)$GroupID,
'groupName' => $GroupName,
'artist' => $DisplayName,
'cover' => $GroupInfo['WikiImage'],
'tags' => $TagList,
'bookmarked' => in_array($GroupID, $Bookmarks),
'vanityHouse' => $GroupInfo['VanityHouse'] == '1',
'groupYear' => (int) $GroupYear,
'groupYear' => (int)$GroupYear,
'releaseType' => $ReleaseTypes[$ReleaseType],
'groupTime' => (string) $GroupTime,
'maxSize' => (int) $MaxSize,
'totalSnatched' => (int) $TotalSnatched,
'totalSeeders' => (int) $TotalSeeders,
'totalLeechers' => (int) $TotalLeechers,
'groupTime' => (string)$GroupTime,
'maxSize' => (int)$MaxSize,
'totalSnatched' => (int)$TotalSnatched,
'totalSeeders' => (int)$TotalSeeders,
'totalLeechers' => (int)$TotalLeechers,
'torrents' => $JsonTorrents
);
} else {
@ -736,17 +736,17 @@
list($TorrentID, $Data) = each($Torrents);
$JsonGroups[] = array(
'groupId' => (int) $GroupID,
'groupId' => (int)$GroupID,
'groupName' => $GroupName,
'torrentId' => (int) $TorrentID,
'torrentId' => (int)$TorrentID,
'tags' => $TagList,
'category' => $Categories[$CategoryID - 1],
'fileCount' => (int) $Data['FileCount'],
'groupTime' => (string) strtotime($Data['Time']),
'size' => (int) $Data['Size'],
'snatches' => (int) $Data['Snatched'],
'seeders' => (int) $Data['Seeders'],
'leechers' => (int) $Data['Leechers'],
'fileCount' => (int)$Data['FileCount'],
'groupTime' => (string)strtotime($Data['Time']),
'size' => (int)$Data['Size'],
'snatches' => (int)$Data['Snatched'],
'seeders' => (int)$Data['Seeders'],
'leechers' => (int)$Data['Leechers'],
'isFreeleech' => $Data['FreeTorrent'] == '1',
'isNeutralLeech' => $Data['FreeTorrent'] == '2',
'isPersonalFreeleech' => $Data['PersonalFL'],

View File

@ -82,7 +82,7 @@
foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
$Thread = Forums::get_thread_info($ThreadIDs);
$JsonSpecificRules[] = array(
'threadId' => (int) $ThreadIDs,
'threadId' => (int)$ThreadIDs,
'thread' => display_str($Thread['Title'])
);
}
@ -104,11 +104,14 @@
SELECT
l.TopicID,
l.PostID,
CEIL(( SELECT COUNT(ID)
CEIL(
(
SELECT COUNT(ID)
FROM forums_posts
WHERE forums_posts.TopicID = l.TopicID
AND forums_posts.ID <= l.PostID) / $PerPage
) AS Page
AND forums_posts.ID <= l.PostID
) / $PerPage
) AS Page
FROM forums_last_read_topics AS l
WHERE TopicID IN(".implode(', ', array_keys($Forum)).')
AND UserID = \''.$LoggedUser['ID'].'\'');
@ -124,7 +127,10 @@
list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
// handle read/unread posts - the reason we can't cache the whole page
if ((!$Locked || $Sticky) && ((empty($LastRead[$TopicID]) || $LastRead[$TopicID]['PostID'] < $LastID) && strtotime($LastTime) > $LoggedUser['CatchupTime'])) {
if ((!$Locked || $Sticky)
&& ((empty($LastRead[$TopicID]) || $LastRead[$TopicID]['PostID'] < $LastID)
&& strtotime($LastTime) > $LoggedUser['CatchupTime'])
) {
$Read = 'unread';
} else {
$Read = 'read';
@ -139,20 +145,20 @@
}
$JsonTopics[] = array(
'topicId' => (int) $TopicID,
'topicId' => (int)$TopicID,
'title' => display_str($Title),
'authorId' => (int) $AuthorID,
'authorId' => (int)$AuthorID,
'authorName' => $AuthorName,
'locked' => ($Locked == 1),
'sticky' => ($Sticky == 1),
'postCount' => (int) $PostCount,
'lastID' => (($LastID == null) ? 0 : (int) $LastID),
'locked' => $Locked == 1,
'sticky' => $Sticky == 1,
'postCount' => (int)$PostCount,
'lastID' => ($LastID == null) ? 0 : (int)$LastID,
'lastTime' => $LastTime,
'lastAuthorId' => (($LastAuthorID == null) ? 0 : (int) $LastAuthorID),
'lastAuthorName' => (($LastAuthorName == null) ? '' : $LastAuthorName),
'lastReadPage' => (($LastRead[$TopicID]['Page'] == null) ? 0 : (int) $LastRead[$TopicID]['Page']),
'lastReadPostId' => (($LastRead[$TopicID]['PostID'] == null) ? 0 : (int) $LastRead[$TopicID]['PostID']),
'read' => ($Read == 'read')
'lastAuthorId' => ($LastAuthorID == null) ? 0 : (int)$LastAuthorID,
'lastAuthorName' => ($LastAuthorName == null) ? '' : $LastAuthorName,
'lastReadPage' => ($LastRead[$TopicID]['Page'] == null) ? 0 : (int)$LastRead[$TopicID]['Page'],
'lastReadPostId' => ($LastRead[$TopicID]['PostID'] == null) ? 0 : (int)$LastRead[$TopicID]['PostID'],
'read' => $Read == 'read'
);
}
@ -163,7 +169,7 @@
'response' => array(
'forumName' => $ForumName,
'specificRules' => $JsonSpecificRules,
'currentPage' => (int) $Page,
'currentPage' => (int)$Page,
'pages' => ceil($Forums[$ForumID]['NumTopics'] / TOPICS_PER_PAGE),
'threads' => $JsonTopics
)

View File

@ -45,7 +45,10 @@
$JsonForums = array();
foreach ($Forums as $Forum) {
list($ForumID, $CategoryID, $ForumName, $ForumDescription, $MinRead, $MinWrite, $MinCreate, $NumTopics, $NumPosts, $LastPostID, $LastAuthorID, $LastTopicID, $LastTime, $SpecificRules, $LastTopic, $Locked, $Sticky) = array_values($Forum);
if ($LoggedUser['CustomForums'][$ForumID] != 1 && ($MinRead>$LoggedUser['Class'] || array_search($ForumID, $RestrictedForums) !== false)) {
if ($LoggedUser['CustomForums'][$ForumID] != 1
&& ($MinRead>$LoggedUser['Class']
|| array_search($ForumID, $RestrictedForums) !== false)
) {
continue;
}
$ForumDescription = display_str($ForumDescription);
@ -57,13 +60,17 @@
}
$LastCategoryID = $CategoryID;
$JsonCategory = array(
'categoryID' => (int) $CategoryID,
'categoryID' => (int)$CategoryID,
'categoryName' => $ForumCats[$CategoryID]
);
$JsonForums = array();
}
if ((!$Locked || $Sticky) && $LastPostID != 0 && ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID) && strtotime($LastTime) > $LoggedUser['CatchupTime'])) {
if ((!$Locked || $Sticky)
&& $LastPostID != 0
&& ((empty($LastRead[$LastTopicID]) || $LastRead[$LastTopicID]['PostID'] < $LastPostID)
&& strtotime($LastTime) > $LoggedUser['CatchupTime'])
) {
$Read = 'unread';
} else {
$Read = 'read';
@ -71,21 +78,21 @@
$UserInfo = Users::user_info($LastAuthorID);
$JsonForums[] = array(
'forumId' => (int) $ForumID,
'forumId' => (int)$ForumID,
'forumName' => $ForumName,
'forumDescription' => $ForumDescription,
'numTopics' => (float) $NumTopics,
'numPosts' => (float) $NumPosts,
'lastPostId' => (float) $LastPostID,
'lastAuthorId' => (float) $LastAuthorID,
'numTopics' => (float)$NumTopics,
'numPosts' => (float)$NumPosts,
'lastPostId' => (float)$LastPostID,
'lastAuthorId' => (float)$LastAuthorID,
'lastPostAuthorName' => $UserInfo['Username'],
'lastTopicId' => (float) $LastTopicID,
'lastTopicId' => (float)$LastTopicID,
'lastTime' => $LastTime,
'specificRules' => $SpecificRules,
'lastTopic' => display_str($LastTopic),
'read' => ($Read == 1),
'locked' => ($Locked == 1),
'sticky' => ($Sticky == 1)
'read' => $Read == 1,
'locked' => $Locked == 1,
'sticky' => $Sticky == 1
);
}
// ...And an extra one to catch the last category.

View File

@ -202,7 +202,7 @@
$JsonPoll['closed'] = ($Closed == 1);
$JsonPoll['featured'] = $Featured;
$JsonPoll['question'] = $Question;
$JsonPoll['maxVotes'] = (int) $MaxVotes;
$JsonPoll['maxVotes'] = (int)$MaxVotes;
$JsonPoll['totalVotes'] = $TotalVotes;
$JsonPollAnswers = array();
@ -246,22 +246,22 @@
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
$UserInfo = Users::user_info($EditedUserID);
$JsonPosts[] = array(
'postId' => (int) $PostID,
'postId' => (int)$PostID,
'addedTime' => $AddedTime,
'bbBody' => $Body,
'body' => $Text->full_format($Body),
'editedUserId' => (int) $EditedUserID,
'editedUserId' => (int)$EditedUserID,
'editedTime' => $EditedTime,
'editedUsername' => $UserInfo['Username'],
'author' => array(
'authorId' => (int) $AuthorID,
'authorId' => (int)$AuthorID,
'authorName' => $Username,
'paranoia' => $Paranoia,
'artist' => ($Artist === '1'),
'donor' => ($Donor === '1'),
'warned' => ($Warned !== '0000-00-00 00:00:00'),
'artist' => $Artist === '1',
'donor' => $Donor === '1',
'warned' => $Warned !== '0000-00-00 00:00:00',
'avatar' => $Avatar,
'enabled' => (($Enabled === '2') ? false : true),
'enabled' => $Enabled === '2' ? false : true,
'userTitle' => $UserTitle
),
@ -273,16 +273,16 @@
array(
'status' => 'success',
'response' => array(
'forumId' => (int) $ForumID,
'forumId' => (int)$ForumID,
'forumName' => $Forums[$ForumID]['Name'],
'threadId' => (int) $ThreadID,
'threadId' => (int)$ThreadID,
'threadTitle' => display_str($ThreadInfo['Title']),
'subscribed' => in_array($ThreadID, $UserSubscriptions),
'locked' => ($ThreadInfo['IsLocked'] == 1),
'sticky' => ($ThreadInfo['IsSticky'] == 1),
'currentPage' => (int) $Page,
'locked' => $ThreadInfo['IsLocked'] == 1,
'sticky' => $ThreadInfo['IsSticky'] == 1,
'currentPage' => (int)$Page,
'pages' => ceil($ThreadInfo['Posts'] / $PerPage),
'poll' => (empty($JsonPoll) ? null : $JsonPoll),
'poll' => empty($JsonPoll) ? null : $JsonPoll,
'posts' => $JsonPosts
)
)

View File

@ -37,36 +37,38 @@
ui.Warned,
um.Enabled,
ui.Avatar,";
$sql .= ($Section == 'sentbox')? ' cu.SentDate ' : ' cu.ReceivedDate ';
$sql .= $Section === 'sentbox' ? ' cu.SentDate ' : ' cu.ReceivedDate ';
$sql .= "AS Date
FROM pm_conversations AS c
LEFT JOIN pm_conversations_users AS cu ON cu.ConvID=c.ID AND cu.UserID='$UserID'
LEFT JOIN pm_conversations_users AS cu2 ON cu2.ConvID=c.ID AND cu2.UserID!='$UserID' AND cu2.ForwardedTo=0
LEFT JOIN users_main AS um ON um.ID=cu2.UserID
LEFT JOIN users_info AS ui ON ui.UserID=um.ID
LEFT JOIN users_main AS um2 ON um2.ID=cu.ForwardedTo";
LEFT JOIN pm_conversations_users AS cu ON cu.ConvID = c.ID AND cu.UserID = '$UserID'
LEFT JOIN pm_conversations_users AS cu2 ON cu2.ConvID = c.ID AND cu2.UserID != '$UserID' AND cu2.ForwardedTo = 0
LEFT JOIN users_main AS um ON um.ID = cu2.UserID
LEFT JOIN users_info AS ui ON ui.UserID = um.ID
LEFT JOIN users_main AS um2 ON um2.ID = cu.ForwardedTo";
if (!empty($_GET['search']) && $_GET['searchtype'] == "message") {
$sql .= " JOIN pm_messages AS m ON c.ID=m.ConvID";
if (!empty($_GET['search']) && $_GET['searchtype'] === 'message') {
$sql .= ' JOIN pm_messages AS m ON c.ID = m.ConvID';
}
$sql .= " WHERE ";
if (!empty($_GET['search'])) {
$Search = db_string($_GET['search']);
if ($_GET['searchtype'] == "user") {
$sql .= "um.Username LIKE '".$Search."' AND ";
} elseif ($_GET['searchtype'] == "subject") {
$Words = explode(' ', $Search);
$sql .= "c.Subject LIKE '%".implode("%' AND c.Subject LIKE '%", $Words)."%' AND ";
} elseif ($_GET['searchtype'] == "message") {
$Words = explode(' ', $Search);
$sql .= "m.Body LIKE '%".implode("%' AND m.Body LIKE '%", $Words)."%' AND ";
}
$Search = db_string($_GET['search']);
if ($_GET['searchtype'] === 'user') {
$sql .= "um.Username LIKE '$Search' AND ";
} elseif ($_GET['searchtype'] === 'subject') {
$Words = explode(' ', $Search);
$sql .= "c.Subject LIKE '%".implode("%' AND c.Subject LIKE '%", $Words)."%' AND ";
} elseif ($_GET['searchtype'] === 'message') {
$Words = explode(' ', $Search);
$sql .= "m.Body LIKE '%".implode("%' AND m.Body LIKE '%", $Words)."%' AND ";
}
}
$sql .= ($Section == 'sentbox') ? ' cu.InSentbox' : ' cu.InInbox';
$sql .="='1'";
$sql .= $Section === 'sentbox' ? ' cu.InSentbox' : ' cu.InInbox';
$sql .= " = '1'";
$sql .=" GROUP BY c.ID
ORDER BY cu.Sticky, ".$Sort." LIMIT $Limit";
$sql .= "
GROUP BY c.ID
ORDER BY cu.Sticky, $Sort
LIMIT $Limit";
$Results = $DB->query($sql);
$DB->query('SELECT FOUND_ROWS()');
list($NumResults) = $DB->next_record();
@ -84,18 +86,18 @@
$JsonMessages = array();
while (list($ConvID, $Subject, $Unread, $Sticky, $ForwardedID, $ForwardedName, $SenderID, $Username, $Donor, $Warned, $Enabled, $Avatar, $Date) = $DB->next_record()) {
$JsonMessage = array(
'convId' => (int) $ConvID,
'convId' => (int)$ConvID,
'subject' => $Subject,
'unread' => $Unread == 1,
'sticky' => $Sticky == 1,
'forwardedId' => (int) $ForwardedID,
'forwardedId' => (int)$ForwardedID,
'forwardedName' => $ForwardedName,
'senderId' => (int) $SenderID,
'senderId' => (int)$SenderID,
'username' => $Username,
'avatar' => $Avatar,
'donor' => $Donor == 1,
'warned' => $Warned == 1,
'enabled' => ($Enabled == 2 ? false : true),
'enabled' => $Enabled == 2 ? false : true,
'date' => $Date
);
$JsonMessages[] = $JsonMessage;
@ -106,7 +108,7 @@
array(
'status' => 'success',
'response' => array(
'currentPage' => (int) $Page,
'currentPage' => (int)$Page,
'pages' => ceil($NumResults / MESSAGES_PER_PAGE),
'messages' => $JsonMessages
)

View File

@ -14,8 +14,8 @@
$DB->query("
SELECT InInbox, InSentbox
FROM pm_conversations_users
WHERE UserID='$UserID'
AND ConvID='$ConvID'");
WHERE UserID = '$UserID'
AND ConvID = '$ConvID'");
if (!$DB->has_results()) {
print json_encode(array('status' => 'failure'));
die();
@ -39,17 +39,17 @@
cu.ForwardedTo,
um.Username
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'");
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'");
list($Subject, $Sticky, $UnRead, $ForwardedID, $ForwardedName) = $DB->next_record();
$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'");
JOIN users_main AS um ON um.ID = pm.SenderID
WHERE pm.ConvID = '$ConvID'");
while (list($PMUserID, $Username) = $DB->next_record()) {
$PMUserID = (int)$PMUserID;
@ -62,31 +62,28 @@
$Users[0]['Username'] = 'System';
$Users[0]['Avatar'] = '';
if ($UnRead == '1') {
$DB->query("
UPDATE pm_conversations_users
SET UnRead='0'
WHERE ConvID='$ConvID'
AND UserID='$UserID'");
SET UnRead = '0'
WHERE ConvID = '$ConvID'
AND UserID = '$UserID'");
// Clear the caches of the inbox and sentbox
$Cache->decrement('inbox_new_'.$UserID);
$Cache->decrement("inbox_new_$UserID");
}
// Get messages
$DB->query("
SELECT SentDate, SenderID, Body, ID
FROM pm_messages AS m
WHERE ConvID='$ConvID'
WHERE ConvID = '$ConvID'
ORDER BY ID");
$JsonMessages = array();
while (list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) {
$JsonMessage = array(
'messageId' => (int) $MessageID,
'senderId' => (int) $SenderID,
'messageId' => (int)$MessageID,
'senderId' => (int)$SenderID,
'senderName' => $Users[(int)$SenderID]['Username'],
'sentDate' => $SentDate,
'avatar' => $Users[(int)$SenderID]['Avatar'],
@ -101,7 +98,7 @@
array(
'status' => 'success',
'response' => array(
'convId' => (int) $ConvID,
'convId' => (int)$ConvID,
'subject' => $Subject.($ForwardedID > 0 ? " (Forwarded to $ForwardedName)" : ''),
'sticky' => $Sticky == 1,
'messages' => $JsonMessages

View File

@ -95,21 +95,21 @@
json_die("success", array(
'username' => $LoggedUser['Username'],
'id' => (int) $LoggedUser['ID'],
'id' => (int)$LoggedUser['ID'],
'authkey' => $LoggedUser['AuthKey'],
'passkey' => $LoggedUser['torrent_pass'],
'notifications' => array(
'messages' => (int) $NewMessages,
'notifications' => (int) $NewNotifications,
'messages' => (int)$NewMessages,
'notifications' => (int)$NewNotifications,
'newAnnouncement' => $MyNews < $CurrentNews,
'newBlog' => $MyBlog < $CurrentBlog,
'newSubscriptions' => $NewSubscriptions == 1
),
'userstats' => array(
'uploaded' => (int) $LoggedUser['BytesUploaded'],
'downloaded' => (int) $LoggedUser['BytesDownloaded'],
'ratio' => (float) $Ratio,
'requiredratio' => (float) $LoggedUser['RequiredRatio'],
'uploaded' => (int)$LoggedUser['BytesUploaded'],
'downloaded' => (int)$LoggedUser['BytesDownloaded'],
'ratio' => (float)$Ratio,
'requiredratio' => (float)$LoggedUser['RequiredRatio'],
'class' => $ClassLevels[$LoggedUser['Class']]['Name']
)
));

View File

@ -3,8 +3,8 @@
//Don't allow bigger queries than specified below regardless of called function
$SizeLimit = 10;
$Count = (int) $_GET['count'];
$Offset = (int) $_GET['offset'];
$Count = (int)$_GET['count'];
$Offset = (int)$_GET['offset'];
if (!isset($_GET['count']) || !isset($_GET['offset']) || $Count <= 0 || $Offset < 0 || $Count > $SizeLimit) {
json_die('failure');

View File

@ -17,9 +17,9 @@
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]".
WHERE unt.UserID = $LoggedUser[ID]".
((!empty($_GET['filterid']) && is_number($_GET['filterid']))
? " AND unf.ID='$_GET[filterid]'"
? " AND unf.ID = '$_GET[filterid]'"
: '')."
ORDER BY TorrentID DESC
LIMIT $Limit");
@ -70,28 +70,28 @@
}
$JsonNotifications[] = array(
'torrentId' => (int) $TorrentID,
'groupId' => (int) $GroupID,
'torrentId' => (int)$TorrentID,
'groupId' => (int)$GroupID,
'groupName' => $GroupName,
'groupCategoryId' => (int) $GroupCategoryID,
'groupCategoryId' => (int)$GroupCategoryID,
'wikiImage' => $WikiImage,
'torrentTags' => $TagList,
'size' => (float) $TorrentInfo['Size'],
'fileCount' => (int) $TorrentInfo['FileCount'],
'size' => (float)$TorrentInfo['Size'],
'fileCount' => (int)$TorrentInfo['FileCount'],
'format' => $TorrentInfo['Format'],
'encoding' => $TorrentInfo['Encoding'],
'media' => $TorrentInfo['Media'],
'scene' => $TorrentInfo['Scene'] == 1,
'groupYear' => (int) $GroupYear,
'remasterYear' => (int) $TorrentInfo['RemasterYear'],
'groupYear' => (int)$GroupYear,
'remasterYear' => (int)$TorrentInfo['RemasterYear'],
'remasterTitle' => $TorrentInfo['RemasterTitle'],
'snatched' => (int) $TorrentInfo['Snatched'],
'seeders' => (int) $TorrentInfo['Seeders'],
'leechers' => (int) $TorrentInfo['Leechers'],
'snatched' => (int)$TorrentInfo['Snatched'],
'seeders' => (int)$TorrentInfo['Seeders'],
'leechers' => (int)$TorrentInfo['Leechers'],
'notificationTime' => $TorrentInfo['Time'],
'hasLog' => $TorrentInfo['HasLog'] == 1,
'hasCue' => $TorrentInfo['HasCue'] == 1,
'logScore' => (float) $TorrentInfo['LogScore'],
'logScore' => (float)$TorrentInfo['LogScore'],
'freeTorrent' => $TorrentInfo['FreeTorrent'] == 1,
'logInDb' => $TorrentInfo['HasLog'] == 1,
'unread' => $Result['UnRead'] == 1

View File

@ -81,9 +81,9 @@
for ($i = 0; $i < $VoteMax; $i++) {
$User = array_shift($RequestVotes['Voters']);
$JsonTopContributors[] = array(
'userId' => (int) $User['UserID'],
'userId' => (int)$User['UserID'],
'userName' => $User['Username'],
'bounty' => (int) $User['Bounty']
'bounty' => (int)$User['Bounty']
);
}
reset($RequestVotes['Voters']);

View File

@ -1,7 +1,7 @@
<?php
$FriendID = (int) $_POST['friend'];
$FriendID = (int)$_POST['friend'];
$Type = $_POST['type'];
$ID = (int) $_POST['id'];
$ID = (int)$_POST['id'];
$Note = $_POST['note'];
if (empty($FriendID) || empty($Type) || empty($ID)) {

View File

@ -19,10 +19,10 @@
ag.Name,
ass.Score
FROM artists_similar AS s1
JOIN artists_similar AS s2 ON s1.SimilarID=s2.SimilarID AND s1.ArtistID!=s2.ArtistID
JOIN artists_similar_scores AS ass ON ass.SimilarID=s1.SimilarID
JOIN artists_group AS ag ON ag.ArtistID=s2.ArtistID
WHERE s1.ArtistID=$artist_id
JOIN artists_similar AS s2 ON s1.SimilarID = s2.SimilarID AND s1.ArtistID != s2.ArtistID
JOIN artists_similar_scores AS ass ON ass.SimilarID = s1.SimilarID
JOIN artists_group AS ag ON ag.ArtistID = s2.ArtistID
WHERE s1.ArtistID = $artist_id
ORDER BY ass.Score DESC
LIMIT $artist_limit");
@ -31,7 +31,10 @@
if ($Score < 0) {
continue;
}
$results[] = array('id' => (int) $ArtistID, 'name' => $Name, 'score' => (int) $Score);
$results[] = array(
'id' => (int)$ArtistID,
'name' => $Name,
'score' => (int)$Score);
}
print json_encode($results);

View File

@ -29,16 +29,16 @@
LEFT JOIN forums AS f ON f.ID = t.ForumID
LEFT JOIN forums_last_read_topics AS l ON p.TopicID = l.TopicID AND l.UserID = s.UserID
WHERE s.UserID = '.$LoggedUser['ID'].'
AND p.ID <= IFNULL(l.PostID,t.LastPostID)
AND p.ID <= IFNULL(l.PostID, t.LastPostID)
AND ' . Forums::user_forums_sql();
if ($ShowUnread) {
$sql .= '
AND IF(l.PostID IS NULL OR (t.IsLocked = \'1\' && t.IsSticky = \'0\'), t.LastPostID, l.PostID) < t.LastPostID';
}
$sql .= '
$sql .= "
GROUP BY t.ID
ORDER BY t.LastPostID DESC
LIMIT '.$Limit;
LIMIT $Limit";
$PostIDs = $DB->query($sql);
$DB->query('SELECT FOUND_ROWS()');
list($NumResults) = $DB->next_record();
@ -69,7 +69,7 @@
LEFT JOIN users_main AS um ON um.ID = p.AuthorID
LEFT JOIN users_info AS ui ON ui.UserID = um.ID
LEFT JOIN users_main AS ed ON ed.ID = um.ID
WHERE p.ID IN ('.implode(',',$PostIDs).')
WHERE p.ID IN ('.implode(',', $PostIDs).')
ORDER BY f.Name ASC, t.LastPostID DESC';
$DB->query($sql);
}
@ -77,14 +77,14 @@
$JsonPosts = array();
while (list($ForumID, $ForumName, $TopicID, $ThreadTitle, $Body, $LastPostID, $Locked, $Sticky, $PostID, $AuthorID, $AuthorName, $AuthorAvatar, $EditedUserID, $EditedTime, $EditedUsername) = $DB->next_record()) {
$JsonPost = array(
'forumId' => (int) $ForumID,
'forumId' => (int)$ForumID,
'forumName' => $ForumName,
'threadId' => (int) $TopicID,
'threadId' => (int)$TopicID,
'threadTitle' => $ThreadTitle,
'postId' => (int) $PostID,
'lastPostId' => (int) $LastPostID,
'postId' => (int)$PostID,
'lastPostId' => (int)$LastPostID,
'locked' => $Locked == 1,
'new' => ($PostID<$LastPostID && !$Locked)
'new' => ($PostID < $LastPostID && !$Locked)
);
$JsonPosts[] = $JsonPost;
}

View File

@ -14,15 +14,15 @@
list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
$JsonComments[] = array(
'postId' => (int) $PostID,
'postId' => (int)$PostID,
'addedTime' => $AddedTime,
'bbBody' => $Body,
'body' => $Text->full_format($Body),
'editedUserId' => (int) $EditedUserID,
'editedUserId' => (int)$EditedUserID,
'editedTime' => $EditedTime,
'editedUsername' => $EditedUsername,
'userinfo' => array(
'authorId' => (int) $AuthorID,
'authorId' => (int)$AuthorID,
'authorName' => $Username,
'artist' => $Artist == 1,
'donor' => $Donor == 1,
@ -35,7 +35,7 @@
}
json_die("success", array(
'page' => (int) $Page,
'page' => (int)$Page,
'pages' => ceil($NumComments / TORRENT_COMMENTS_PER_PAGE),
'comments' => $JsonComments
));

View File

@ -19,28 +19,28 @@
$OuterResults = array();
if ($Details == 'all' || $Details == 'ut') {
if (!$TopUsedTags = $Cache->get_value('topusedtag_'.$Limit)) {
if (!$TopUsedTags = $Cache->get_value("topusedtag_$Limit")) {
$DB->query("
SELECT
t.ID,
t.Name,
COUNT(tt.GroupID) AS Uses,
SUM(tt.PositiveVotes-1) AS PosVotes,
SUM(tt.NegativeVotes-1) AS NegVotes
SUM(tt.PositiveVotes - 1) AS PosVotes,
SUM(tt.NegativeVotes - 1) AS NegVotes
FROM tags AS t
JOIN torrents_tags AS tt ON tt.TagID=t.ID
JOIN torrents_tags AS tt ON tt.TagID = t.ID
GROUP BY tt.TagID
ORDER BY Uses DESC
LIMIT $Limit");
$TopUsedTags = $DB->to_array();
$Cache->cache_value('topusedtag_'.$Limit,$TopUsedTags,3600 * 12);
$Cache->cache_value("topusedtag_$Limit", $TopUsedTags, 3600 * 12);
}
$OuterResults[] = generate_tag_json('Most Used Torrent Tags', 'ut', $TopUsedTags, $Limit);
}
if ($Details == 'all' || $Details == 'ur') {
if (!$TopRequestTags = $Cache->get_value('toprequesttag_'.$Limit)) {
if (!$TopRequestTags = $Cache->get_value("toprequesttag_$Limit")) {
$DB->query("
SELECT
t.ID,
@ -48,33 +48,33 @@
COUNT(r.RequestID) AS Uses,
'',''
FROM tags AS t
JOIN requests_tags AS r ON r.TagID=t.ID
JOIN requests_tags AS r ON r.TagID = t.ID
GROUP BY r.TagID
ORDER BY Uses DESC
LIMIT $Limit");
$TopRequestTags = $DB->to_array();
$Cache->cache_value('toprequesttag_'.$Limit,$TopRequestTags,3600 * 12);
$Cache->cache_value("toprequesttag_$Limit", $TopRequestTags, 3600 * 12);
}
$OuterResults[] = generate_tag_json('Most Used Request Tags', 'ur', $TopRequestTags, $Limit);
}
if ($Details == 'all' || $Details == 'v') {
if (!$TopVotedTags = $Cache->get_value('topvotedtag_'.$Limit)) {
if (!$TopVotedTags = $Cache->get_value("topvotedtag_$Limit")) {
$DB->query("
SELECT
t.ID,
t.Name,
COUNT(tt.GroupID) AS Uses,
SUM(tt.PositiveVotes-1) AS PosVotes,
SUM(tt.NegativeVotes-1) AS NegVotes
SUM(tt.PositiveVotes - 1) AS PosVotes,
SUM(tt.NegativeVotes - 1) AS NegVotes
FROM tags AS t
JOIN torrents_tags AS tt ON tt.TagID=t.ID
JOIN torrents_tags AS tt ON tt.TagID = t.ID
GROUP BY tt.TagID
ORDER BY PosVotes DESC
LIMIT $Limit");
$TopVotedTags = $DB->to_array();
$Cache->cache_value('topvotedtag_'.$Limit,$TopVotedTags,3600 * 12);
$Cache->cache_value("topvotedtag_$Limit", $TopVotedTags, 3600 * 12);
}
$OuterResults[] = generate_tag_json('Most Highly Voted Tags', 'v', $TopVotedTags, $Limit);
@ -93,16 +93,16 @@ function generate_tag_json($Caption, $Tag, $Details, $Limit) {
foreach ($Details as $Detail) {
$results[] = array(
'name' => $Detail['Name'],
'uses' => (int) $Detail['Uses'],
'posVotes' => (int) $Detail['PosVotes'],
'negVotes' => (int) $Detail['NegVotes']
'uses' => (int)$Detail['Uses'],
'posVotes' => (int)$Detail['PosVotes'],
'negVotes' => (int)$Detail['NegVotes']
);
}
return array(
'caption' => $Caption,
'tag' => $Tag,
'limit' => (int) $Limit,
'limit' => (int)$Limit,
'results' => $results
);
}

View File

@ -77,57 +77,62 @@
}
if ($Details == 'all' || $Details == 'overall') {
if (!$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum)) {
if (!$TopTorrentsActiveAllTime = $Cache->get_value("top10tor_overall_$Limit$WhereSum")) {
// IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it!
$Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; }
elseif ($Details=='all') { $Query .= " WHERE t.Seeders>500 "; }
if (!empty($Where)) {
$Query .= " WHERE $Where";
} elseif ($Details == 'all') {
$Query .= " WHERE t.Seeders > 500 ";
}
$Query .= "
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveAllTime = $DB->to_array();
$Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum,$TopTorrentsActiveAllTime,3600*6);
$Cache->cache_value("top10tor_overall_$Limit$WhereSum", $TopTorrentsActiveAllTime, 3600 * 6);
}
$OuterResults[] = generate_torrent_json('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit);
}
if (($Details == 'all' || $Details == 'snatched') && empty($Where)) {
if (!$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum)) {
if (!$TopTorrentsSnatched = $Cache->get_value("top10tor_snatched_$Limit$WhereSum")) {
$Query = $BaseQuery;
$Query .= "
ORDER BY t.Snatched DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSnatched = $DB->to_array();
$Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum,$TopTorrentsSnatched,3600*6);
$Cache->cache_value("top10tor_snatched_$Limit$WhereSum", $TopTorrentsSnatched, 3600 * 6);
}
$OuterResults[] = generate_torrent_json('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit);
}
if (($Details == 'all' || $Details == 'data') && empty($Where)) {
if (!$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum)) {
if (!$TopTorrentsTransferred = $Cache->get_value("top10tor_data_$Limit$WhereSum")) {
// IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it!
$Query = $BaseQuery;
if ($Details=='all') { $Query .= " WHERE t.Snatched>100 "; }
if ($Details == 'all') {
$Query .= " WHERE t.Snatched > 100 ";
}
$Query .= "
ORDER BY Data DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsTransferred = $DB->to_array();
$Cache->cache_value('top10tor_data_'.$Limit.$WhereSum,$TopTorrentsTransferred,3600*6);
$Cache->cache_value("top10tor_data_$Limit$WhereSum", $TopTorrentsTransferred, 3600 * 6);
}
$OuterResults[] = generate_torrent_json('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit);
}
if (($Details == 'all' || $Details == 'seeded') && empty($Where)) {
if (!$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum)) {
if (!$TopTorrentsSeeded = $Cache->get_value("top10tor_seeded_$Limit$WhereSum")) {
$Query = $BaseQuery."
ORDER BY t.Seeders DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSeeded = $DB->to_array();
$Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum,$TopTorrentsSeeded,3600*6);
$Cache->cache_value("top10tor_seeded_$Limit$WhereSum", $TopTorrentsSeeded, 3600 * 6);
}
$OuterResults[] = generate_torrent_json('Best Seeded Torrents', 'seeded', $TopTorrentsSeeded, $Limit);
}
@ -142,34 +147,34 @@
function generate_torrent_json($Caption, $Tag, $Details, $Limit) {
global $LoggedUser,$Categories;
global $LoggedUser, $Categories;
$results = array();
foreach ($Details as $Detail) {
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$WikiImage,$TorrentTags,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType,$Size) = $Detail;
list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $WikiImage, $TorrentTags,
$Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear,
$RemasterTitle, $Snatched, $Seeders, $Leechers, $Data, $ReleaseType, $Size) = $Detail;
$Artist = Artists::display_artists(Artists::get_artist($GroupID), false, true);
$TruncArtist = substr($Artist, 0, strlen($Artist)-3);
$TruncArtist = substr($Artist, 0, strlen($Artist) - 3);
$TagList = array();
if ($TorrentTags != '') {
$TorrentTags = explode(' ',$TorrentTags);
$TorrentTags = explode(' ', $TorrentTags);
foreach ($TorrentTags as $TagKey => $TagName) {
$TagName = str_replace('_','.',$TagName);
$TagName = str_replace('_', '.', $TagName);
$TagList[] = $TagName;
}
}
// Append to the existing array.
$results[] = array(
'torrentId' => (int) $TorrentID,
'groupId' => (int) $GroupID,
'torrentId' => (int)$TorrentID,
'groupId' => (int)$GroupID,
'artist' => $TruncArtist,
'groupName' => $GroupName,
'groupCategory' => (int) $GroupCategory,
'groupYear' => (int) $GroupYear,
'groupCategory' => (int)$GroupCategory,
'groupYear' => (int)$GroupYear,
'remasterTitle' => $RemasterTitle,
'format' => $Format,
'encoding' => $Encoding,
@ -177,20 +182,20 @@ function generate_torrent_json($Caption, $Tag, $Details, $Limit) {
'hasCue' => $HasCue == 1,
'media' => $Media,
'scene' => $Scene == 1,
'year' => (int) $Year,
'year' => (int)$Year,
'tags' => $TagList,
'snatched' => (int) $Snatched,
'seeders' => (int) $Seeders,
'leechers' => (int) $Leechers,
'data' => (int) $Data,
'size' => (int) $Size,
'snatched' => (int)$Snatched,
'seeders' => (int)$Seeders,
'leechers' => (int)$Leechers,
'data' => (int)$Data,
'size' => (int)$Size,
);
}
return array(
'caption' => $Caption,
'tag' => $Tag,
'limit' => (int) $Limit,
'limit' => (int)$Limit,
'results' => $results
);
}

View File

@ -26,56 +26,71 @@
COUNT(t.ID) AS NumUploads
FROM users_main AS u
JOIN users_info AS ui ON ui.UserID = u.ID
LEFT JOIN torrents AS t ON t.UserID=u.ID
WHERE u.Enabled='1'
AND Uploaded>'". 5 * 1024 * 1024 * 1024 ."'
AND Downloaded>'". 5 * 1024 * 1024 * 1024 ."'
LEFT JOIN torrents AS t ON t.UserID = u.ID
WHERE u.Enabled = '1'
AND Uploaded > '". 5 * 1024 * 1024 * 1024 ."'
AND Downloaded > '". 5 * 1024 * 1024 * 1024 ."'
AND (Paranoia IS NULL OR (Paranoia NOT LIKE '%\"uploaded\"%' AND Paranoia NOT LIKE '%\"downloaded\"%'))
GROUP BY u.ID";
$OuterResults = array();
if ($Details == 'all' || $Details == 'ul') {
if (!$TopUserUploads = $Cache->get_value('topuser_ul_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY u.Uploaded DESC LIMIT $Limit;");
if (!$TopUserUploads = $Cache->get_value("topuser_ul_$Limit")) {
$DB->query("
$BaseQuery
ORDER BY u.Uploaded DESC
LIMIT $Limit;");
$TopUserUploads = $DB->to_array();
$Cache->cache_value('topuser_ul_'.$Limit,$TopUserUploads,3600*12);
$Cache->cache_value("topuser_ul_$Limit", $TopUserUploads, 3600 * 12);
}
$OuterResults[] = generate_user_json('Uploaders', 'ul', $TopUserUploads, $Limit);
}
if ($Details == 'all' || $Details == 'dl') {
if (!$TopUserDownloads = $Cache->get_value('topuser_dl_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY u.Downloaded DESC LIMIT $Limit;");
if (!$TopUserDownloads = $Cache->get_value("topuser_dl_$Limit")) {
$DB->query("
$BaseQuery
ORDER BY u.Downloaded DESC
LIMIT $Limit;");
$TopUserDownloads = $DB->to_array();
$Cache->cache_value('topuser_dl_'.$Limit,$TopUserDownloads,3600*12);
$Cache->cache_value("topuser_dl_$Limit", $TopUserDownloads, 3600 * 12);
}
$OuterResults[] = generate_user_json('Downloaders', 'dl', $TopUserDownloads, $Limit);
}
if ($Details == 'all' || $Details == 'numul') {
if (!$TopUserNumUploads = $Cache->get_value('topuser_numul_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY NumUploads DESC LIMIT $Limit;");
if (!$TopUserNumUploads = $Cache->get_value("topuser_numul_$Limit")) {
$DB->query("
$BaseQuery
ORDER BY NumUploads DESC
LIMIT $Limit;");
$TopUserNumUploads = $DB->to_array();
$Cache->cache_value('topuser_numul_'.$Limit,$TopUserNumUploads,3600*12);
$Cache->cache_value("topuser_numul_$Limit", $TopUserNumUploads, 3600 * 12);
}
$OuterResults[] = generate_user_json('Torrents Uploaded', 'numul', $TopUserNumUploads, $Limit);
}
if ($Details == 'all' || $Details == 'uls') {
if (!$TopUserUploadSpeed = $Cache->get_value('topuser_ulspeed_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY UpSpeed DESC LIMIT $Limit;");
if (!$TopUserUploadSpeed = $Cache->get_value("topuser_ulspeed_$Limit")) {
$DB->query("
$BaseQuery
ORDER BY UpSpeed DESC
LIMIT $Limit;");
$TopUserUploadSpeed = $DB->to_array();
$Cache->cache_value('topuser_ulspeed_'.$Limit,$TopUserUploadSpeed,3600*12);
$Cache->cache_value("topuser_ulspeed_$Limit", $TopUserUploadSpeed, 3600 * 12);
}
$OuterResults[] = generate_user_json('Fastest Uploaders', 'uls', $TopUserUploadSpeed, $Limit);
}
if ($Details == 'all' || $Details == 'dls') {
if (!$TopUserDownloadSpeed = $Cache->get_value('topuser_dlspeed_'.$Limit)) {
$DB->query("$BaseQuery ORDER BY DownSpeed DESC LIMIT $Limit;");
if (!$TopUserDownloadSpeed = $Cache->get_value("topuser_dlspeed_$Limit")) {
$DB->query("
$BaseQuery
ORDER BY DownSpeed DESC
LIMIT $Limit;");
$TopUserDownloadSpeed = $DB->to_array();
$Cache->cache_value('topuser_dlspeed_'.$Limit,$TopUserDownloadSpeed,3600*12);
$Cache->cache_value("topuser_dlspeed_$Limit", $TopUserDownloadSpeed, 3600 * 12);
}
$OuterResults[] = generate_user_json('Fastest Downloaders', 'dls', $TopUserDownloadSpeed, $Limit);
}
@ -92,20 +107,20 @@ function generate_user_json($Caption, $Tag, $Details, $Limit) {
$results = array();
foreach ($Details as $Detail) {
$results[] = array(
'id' => (int) $Detail['ID'],
'id' => (int)$Detail['ID'],
'username' => $Detail['Username'],
'uploaded' => (float) $Detail['Uploaded'],
'upSpeed' => (float) $Detail['UpSpeed'],
'downloaded' => (float) $Detail['Downloaded'],
'downSpeed' => (float) $Detail['DownSpeed'],
'numUploads' => (int) $Detail['NumUploads'],
'uploaded' => (float)$Detail['Uploaded'],
'upSpeed' => (float)$Detail['UpSpeed'],
'downloaded' => (float)$Detail['Downloaded'],
'downSpeed' => (float)$Detail['DownSpeed'],
'numUploads' => (int)$Detail['NumUploads'],
'joinDate' => $Detail['JoinDate']
);
}
return array(
'caption' => $Caption,
'tag' => $Tag,
'limit' => (int) $Limit,
'limit' => (int)$Limit,
'results' => $results
);
}

View File

@ -62,13 +62,13 @@
$JsonTorrentDetails = array(
'wikiBody' => $Text->full_format($TorrentDetails['WikiBody']),
'wikiImage' => $TorrentDetails['WikiImage'],
'id' => (int) $TorrentDetails['ID'],
'id' => (int)$TorrentDetails['ID'],
'name' => $TorrentDetails['Name'],
'year' => (int) $TorrentDetails['Year'],
'year' => (int)$TorrentDetails['Year'],
'recordLabel' => $TorrentDetails['RecordLabel'],
'catalogueNumber' => $TorrentDetails['CatalogueNumber'],
'releaseType' => (int) $TorrentDetails['ReleaseType'],
'categoryId' => (int) $TorrentDetails['CategoryID'],
'releaseType' => (int)$TorrentDetails['ReleaseType'],
'categoryId' => (int)$TorrentDetails['CategoryID'],
'categoryName' => $CategoryName,
'time' => $TorrentDetails['Time'],
'vanityHouse' => ($TorrentDetails['VanityHouse'] == 1),
@ -93,31 +93,31 @@
$Torrent['Reported'] = false;
}
$JsonTorrentList[] = array(
'id' => (int) $Torrent['ID'],
'id' => (int)$Torrent['ID'],
'media' => $Torrent['Media'],
'format' => $Torrent['Format'],
'encoding' => $Torrent['Encoding'],
'remastered' => ($Torrent['Remastered'] == 1),
'remasterYear' => (int) $Torrent['RemasterYear'],
'remastered' => $Torrent['Remastered'] == 1,
'remasterYear' => (int)$Torrent['RemasterYear'],
'remasterTitle' => $Torrent['RemasterTitle'],
'remasterRecordLabel' => $Torrent['RemasterRecordLabel'],
'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'],
'scene' => ($Torrent['Scene'] == 1),
'hasLog' => ($Torrent['HasLog'] == 1),
'hasCue' => ($Torrent['HasCue'] == 1),
'logScore' => (int) $Torrent['LogScore'],
'fileCount' => (int) $Torrent['FileCount'],
'size' => (int) $Torrent['Size'],
'seeders' => (int) $Torrent['Seeders'],
'leechers' => (int) $Torrent['Leechers'],
'snatched' => (int) $Torrent['Snatched'],
'freeTorrent' => ($Torrent['FreeTorrent'] == 1),
'scene' => $Torrent['Scene'] == 1,
'hasLog' => $Torrent['HasLog'] == 1,
'hasCue' => $Torrent['HasCue'] == 1,
'logScore' => (int)$Torrent['LogScore'],
'fileCount' => (int)$Torrent['FileCount'],
'size' => (int)$Torrent['Size'],
'seeders' => (int)$Torrent['Seeders'],
'leechers' => (int)$Torrent['Leechers'],
'snatched' => (int)$Torrent['Snatched'],
'freeTorrent' => $Torrent['FreeTorrent'] == 1,
'reported' => $Torrent['Reported'],
'time' => $Torrent['Time'],
'description' => $Torrent['Description'],
'fileList' => $FileList,
'filePath' => $Torrent['FilePath'],
'userId' => (int) $Torrent['UserID'],
'userId' => (int)$Torrent['UserID'],
'username' => $Userinfo['Username']
);
}

View File

@ -316,10 +316,10 @@ function check_paranoia_here($Setting) {
'stats' => array(
'joinedDate' => $JoinDate,
'lastAccess' => $LastAccess,
'uploaded' => (($Uploaded == null) ? null : (int) $Uploaded),
'downloaded' => (($Downloaded == null) ? null : (int) $Downloaded),
'uploaded' => (($Uploaded == null) ? null : (int)$Uploaded),
'downloaded' => (($Downloaded == null) ? null : (int)$Downloaded),
'ratio' => $Ratio,
'requiredRatio' => (($RequiredRatio == null) ? null : (float) $RequiredRatio)
'requiredRatio' => (($RequiredRatio == null) ? null : (float)$RequiredRatio)
),
'ranks' => array(
'uploaded' => $UploadedRank,
@ -341,19 +341,19 @@ function check_paranoia_here($Setting) {
'passkey' => $torrent_pass
),
'community' => array(
'posts' => (int) $ForumPosts,
'torrentComments' => (int) $NumComments,
'collagesStarted' => (($NumCollages == null) ? null : (int) $NumCollages),
'collagesContrib' => (($NumCollageContribs == null) ? null : (int) $NumCollageContribs),
'requestsFilled' => (($RequestsFilled == null) ? null : (int) $RequestsFilled),
'requestsVoted' => (($RequestsVoted == null) ? null : (int) $RequestsVoted),
'perfectFlacs' => (($PerfectFLACs == null) ? null : (int) $PerfectFLACs),
'uploaded' => (($Uploads == null) ? null : (int) $Uploads),
'groups' => (($UniqueGroups == null) ? null : (int) $UniqueGroups),
'seeding' => (($Seeding == null) ? null : (int) $Seeding),
'leeching' => (($Leeching == null) ? null : (int) $Leeching),
'snatched' => (($Snatched == null) ? null : (int) $Snatched),
'invited' => (($Invited == null) ? null : (int) $Invited)
'posts' => (int)$ForumPosts,
'torrentComments' => (int)$NumComments,
'collagesStarted' => (($NumCollages == null) ? null : (int)$NumCollages),
'collagesContrib' => (($NumCollageContribs == null) ? null : (int)$NumCollageContribs),
'requestsFilled' => (($RequestsFilled == null) ? null : (int)$RequestsFilled),
'requestsVoted' => (($RequestsVoted == null) ? null : (int)$RequestsVoted),
'perfectFlacs' => (($PerfectFLACs == null) ? null : (int)$PerfectFLACs),
'uploaded' => (($Uploads == null) ? null : (int)$Uploads),
'groups' => (($UniqueGroups == null) ? null : (int)$UniqueGroups),
'seeding' => (($Seeding == null) ? null : (int)$Seeding),
'leeching' => (($Leeching == null) ? null : (int)$Leeching),
'snatched' => (($Snatched == null) ? null : (int)$Snatched),
'invited' => (($Invited == null) ? null : (int)$Invited)
)
));
?>

View File

@ -1,6 +1,6 @@
<?
$UserID = (int) $_GET['userid'];
$Limit = (int) $_GET['limit'];
$UserID = (int)$_GET['userid'];
$Limit = (int)$_GET['limit'];
if (empty($UserID) || $Limit > 50) {
json_die("failure", "bad parameters");
@ -28,7 +28,7 @@
$Artists = Artists::get_artists($DB->collect('ID'));
foreach ($RecentSnatches as $Key => $SnatchInfo) {
$RecentSnatches[$Key]['artists'][] = $Artists[$SnatchInfo['ID']];
$RecentSnatches[$Key]['ID'] = (int) $RecentSnatches[$Key]['ID'];
$RecentSnatches[$Key]['ID'] = (int)$RecentSnatches[$Key]['ID'];
}
$Results['snatches'] = $RecentSnatches;
@ -54,7 +54,7 @@
$Artists = Artists::get_artists($DB->collect('ID'));
foreach ($RecentUploads as $Key => $UploadInfo) {
$RecentUploads[$Key]['artists'][] = $Artists[$UploadInfo['ID']];
$RecentUploads[$Key]['ID'] = (int) $RecentUploads[$Key]['ID'];
$RecentUploads[$Key]['ID'] = (int)$RecentUploads[$Key]['ID'];
}
$Results['uploads'] = $RecentUploads;

View File

@ -162,17 +162,17 @@ function error_out($reason = '') {
$JsonResults = array();
while (list($PostID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername, $TopicID, $ThreadTitle, $LastPostID, $LastRead, $Locked, $Sticky) = $DB->next_record()) {
$JsonResults[] = array(
'postId' => (int) $PostID,
'topicId' => (int) $TopicID,
'postId' => (int)$PostID,
'topicId' => (int)$TopicID,
'threadTitle' => $ThreadTitle,
'lastPostId' => (int) $LastPostID,
'lastRead' => (int) $LastRead,
'lastPostId' => (int)$LastPostID,
'lastRead' => (int)$LastRead,
'locked' => $Locked === '1',
'sticky' => $Sticky === '1',
'addedTime' => $AddedTime,
'body' => $Text->full_format($Body),
'bbbody' => $Body,
'editedUserId' => (int) $EditedUserID,
'editedUserId' => (int)$EditedUserID,
'editedTime' => $EditedTime,
'editedUsername' => $EditedUsername
);
@ -182,7 +182,7 @@ function error_out($reason = '') {
array(
'status' => 'success',
'response' => array(
'currentPage' => (int) $Page,
'currentPage' => (int)$Page,
'pages' => ceil($Results / $PerPage),
'threads' => $JsonResults
)

View File

@ -26,7 +26,7 @@
Warned,
Avatar
FROM users_main AS um
JOIN users_info AS ui ON ui.UserID=um.ID
JOIN users_info AS ui ON ui.UserID = um.ID
WHERE Username LIKE '%".db_string($_GET['username'])."%'
ORDER BY Username
LIMIT $Limit");
@ -41,7 +41,7 @@
list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned, $Avatar) = $Result;
$JsonUsers[] = array(
'userId' => (int) $UserID,
'userId' => (int)$UserID,
'username' => $Username,
'donor' => $Donor == 1,
'warned' => ($Warned != '0000-00-00 00:00:00'),
@ -52,7 +52,7 @@
}
json_die("success", array(
'currentPage' => (int) $Page,
'currentPage' => (int)$Page,
'pages' => ceil($NumResults / USERS_PER_PAGE),
'results' => $JsonUsers
));

View File

@ -33,9 +33,9 @@
'bbBody' => $Body,
'body' => $TextBody,
'aliases' => $Aliases,
'authorID' => (int) $AuthorID,
'authorID' => (int)$AuthorID,
'authorName' => $AuthorName,
'date' => $Date,
'revision' => (int) $Revision
'revision' => (int)$Revision
));
?>

View File

@ -98,7 +98,7 @@ function add_artist($CollageID, $ArtistID) {
// Get artist ID
preg_match('/^'.ARTIST_REGEX.'/i', $URL, $Matches);
$ArtistID = $Matches[4];
if (!$ArtistID || (int) $ArtistID == 0) {
if (!$ArtistID || (int)$ArtistID === 0) {
error(404);
}
@ -161,4 +161,4 @@ function add_artist($CollageID, $ArtistID) {
add_artist($CollageID, $ArtistID);
}
}
header('Location: collages.php?id='.$CollageID);
header("Location: collages.php?id=$CollageID");

View File

@ -100,5 +100,3 @@ function compare($X, $Y) {
(int)$MaxGroupsPerUser,
(int)$Subscribers
)), 3600);

View File

@ -374,7 +374,7 @@
}
break;
case 'trashing':
$TopicNotes[] = 'Trashed';
$TopicNotes[] = "Trashed (moved from [url=https://" . SSL_SITE_URL . "/forums.php?action=viewforum&forumid=$OldForumID]${OldForumName}[/url] to [url=https://" . SSL_SITE_URL . "/forums.php?action=viewforum&forumid=$ForumID]${ForumName}[/url])";
$Notification = "Your thread \"$NewLastTitle\" has been trashed";
break;
default:

View File

@ -1,7 +1,7 @@
<?
if (!isset($_POST['topicid']) || !is_number($_POST['topicid'])) {
error(0,true);
error(0, true);
}
$TopicID = $_POST['topicid'];
@ -11,7 +11,7 @@
$Size = 140;
}
if (!$ThreadInfo = $Cache->get_value('thread_'.$TopicID.'_info')) {
if (!$ThreadInfo = $Cache->get_value("thread_$TopicID".'_info')) {
$DB->query("
SELECT
t.Title,
@ -23,7 +23,7 @@
ISNULL(p.TopicID) AS NoPoll
FROM forums_topics AS t
JOIN forums_posts AS fp ON fp.TopicID = t.ID
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
LEFT JOIN forums_polls AS p ON p.TopicID = t.ID
WHERE t.ID = '$TopicID'
GROUP BY fp.TopicID");
if (!$DB->has_results()) {
@ -31,12 +31,12 @@
}
$ThreadInfo = $DB->next_record(MYSQLI_ASSOC);
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
$Cache->cache_value('thread_'.$TopicID.'_info', $ThreadInfo, 0);
$Cache->cache_value("thread_$TopicID".'_info', $ThreadInfo, 0);
}
}
$ForumID = $ThreadInfo['ForumID'];
if (!list($Question,$Answers,$Votes,$Featured,$Closed) = $Cache->get_value('polls_'.$TopicID)) {
if (!list($Question, $Answers, $Votes, $Featured, $Closed) = $Cache->get_value("polls_$TopicID")) {
$DB->query("
SELECT
Question,
@ -44,7 +44,7 @@
Featured,
Closed
FROM forums_polls
WHERE TopicID='$TopicID'");
WHERE TopicID = '$TopicID'");
list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
$Answers = unserialize($Answers);
$DB->query("
@ -66,7 +66,7 @@
$Votes[$i] = 0;
}
}
$Cache->cache_value('polls_'.$TopicID, array($Question,$Answers,$Votes,$Featured,$Closed), 0);
$Cache->cache_value("polls_$TopicID", array($Question, $Answers, $Votes, $Featured, $Closed), 0);
}
@ -90,12 +90,12 @@
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="large" value="<?=display_str($_POST['large'])?>" />
<input type="hidden" name="topicid" value="<?=$TopicID?>" />
<? for ($i = 1, $il = count($Answers); $i <= $il; $i++) { ?>
<? for ($i = 1, $il = count($Answers); $i <= $il; $i++) { ?>
<input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />
<label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
<? } ?>
<? } ?>
<br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank&#8202;&mdash;&#8202;Show the results!</label><br /><br />
<input type="button" onclick="ajax.post('index.php','poll',function(response) { $('#poll_container').raw().innerHTML = response });" value="Vote" />
<input type="button" onclick="ajax.post('index.php', 'poll', function(response) { $('#poll_container').raw().innerHTML = response });" value="Vote" />
</form>
<?
} else {
@ -106,9 +106,13 @@
}
//Add our vote
$DB->query('INSERT IGNORE INTO forums_polls_votes (TopicID, UserID, Vote) VALUES ('.$TopicID.','.$LoggedUser['ID'].','.$Vote.')');
$DB->query("
INSERT IGNORE INTO forums_polls_votes
(TopicID, UserID, Vote)
VALUES
($TopicID, " . $LoggedUser['ID'] . ", $Vote)");
if ($DB->affected_rows() == 1 && $Vote != 0) {
$Cache->begin_transaction('polls_'.$TopicID);
$Cache->begin_transaction("polls_$TopicID");
$Cache->update_row(2, array($Vote => '+1'));
$Cache->commit_transaction(0);
$Votes[$Vote]++;
@ -133,13 +137,14 @@
$Percent = 0;
}
?>
<li><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100,2)?>%)</li>
<li><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100, 2)?>%)</li>
<li class="graph">
<span class="left_poll"></span>
<span class="center_poll" style="width: <?=round($Ratio * $Size)?>px;"></span>
<span class="right_poll"></span>
</li>
<? }
<?
}
} else {
//Staff forum, output voters, not percentages
$DB->query("
@ -154,7 +159,7 @@
foreach ($StaffVotes as $StaffVote) {
list($StaffString, $StaffVoted) = $StaffVote;
?>
<li><a href="forums.php?action=change_vote&amp;threadid=<?=$TopicID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=<?=(int) $StaffVoted?>"><?=display_str(empty($Answers[$StaffVoted]) ? 'Blank' : $Answers[$StaffVoted])?></a> - <?=$StaffString?></li>
<li><a href="forums.php?action=change_vote&amp;threadid=<?=$TopicID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=<?=(int)$StaffVoted?>"><?=display_str(empty($Answers[$StaffVoted]) ? 'Blank' : $Answers[$StaffVoted])?></a> - <?=$StaffString?></li>
<?
}
}

View File

@ -18,15 +18,15 @@
error(403);
}
$URL = 'https://' . SSL_SITE_URL . "/forums.php?action=viewthread&amp;postid=$PostID#post$PostID";
$URL = site_url() . "forums.php?action=viewthread&amp;postid=$PostID#post$PostID";
if ($Length != 'verbal') {
$Time = ((int) $Length) * (7 * 24 * 60 * 60);
Tools::warn_user($UserID, $Time, "$URL - " . $Reason);
$Time = ((int)$Length) * (7 * 24 * 60 * 60);
Tools::warn_user($UserID, $Time, "$URL - $Reason");
$Subject = 'You have received a warning';
$PrivateMessage = "You have received a $Length week warning for [url=$URL]this post[/url].\n\n" . $PrivateMessage;
$WarnTime = time_plus($Time);
$AdminComment = date('Y-m-d') . ' - Warned until ' . $WarnTime . ' by ' . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
$AdminComment = date('Y-m-d') . " - Warned until $WarnTime by " . $LoggedUser['Username'] . " for $URL \nReason: $Reason\n\n";
} else {
$Subject = 'You have received a verbal warning';
@ -51,11 +51,14 @@
p.AuthorID,
p.TopicID,
t.ForumID,
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
@ -71,10 +74,10 @@
WHERE ID = '$PostID'");
$CatalogueID = floor((POSTS_PER_PAGE * $Page - POSTS_PER_PAGE) / THREAD_CATALOGUE);
$Cache->begin_transaction('thread_' . $TopicID . '_catalogue_' . $CatalogueID);
$Cache->begin_transaction("thread_$TopicID" . "_catalogue_$CatalogueID");
if ($Cache->MemcacheDBArray[$Key]['ID'] != $PostID) {
$Cache->cancel_transaction();
$Cache->delete_value('thread_' . $TopicID . '_catalogue_' . $CatalogueID);
$Cache->delete_value("thread_$TopicID" . "_catalogue_$CatalogueID");
//just clear the cache for would be cache-screwer-uppers
} else {
$Cache->update_row($Key, array(
@ -95,7 +98,7 @@
$ThreadInfo['StickyPost']['Body'] = $Body;
$ThreadInfo['StickyPost']['EditedUserID'] = $LoggedUser['ID'];
$ThreadInfo['StickyPost']['EditedTime'] = $SQLTime;
$Cache->cache_value('thread_' . $TopicID . '_info', $ThreadInfo, 0);
$Cache->cache_value("thread_$TopicID" . '_info', $ThreadInfo, 0);
}
$DB->query("

View File

@ -4,7 +4,7 @@
error(404);
}
Misc::assert_isset_request($_POST, array('postid', 'userid', 'key'));
$PostID = (int) $_POST['postid'];
$PostID = (int)$_POST['postid'];
$UserID = (int)$_POST['userid'];
$Key = (int)$_POST['key'];
$UserInfo = Users::user_info($UserID);
@ -22,7 +22,7 @@
<h2>Warning <a href="user.php?id=<?=$UserID?>"><?=$UserInfo['Username']?></a></h2>
</div>
<div class="thin box pad">
<form class="send_form" name="warning" action="" onsubmit="quickpostform.submit_button.disabled=true;" method="post">
<form class="send_form" name="warning" action="" onsubmit="quickpostform.submit_button.disabled = true;" method="post">
<input type="hidden" name="postid" value="<?=$PostID?>" />
<input type="hidden" name="userid" value="<?=$UserID?>" />
<input type="hidden" name="key" value="<?=$Key?>" />

View File

@ -76,11 +76,15 @@
<span style="float: left;"><?=Users::format_username($FriendID, true, true, true, true)?>
<? if (check_paranoia('ratio', $Paranoia, $Class, $FriendID)) { ?>
&nbsp;Ratio: <strong><?=Format::get_ratio_html($Uploaded, $Downloaded)?></strong>
<? }
if (check_paranoia('uploaded', $Paranoia, $Class, $FriendID)) { ?>
<?
}
if (check_paranoia('uploaded', $Paranoia, $Class, $FriendID)) {
?>
&nbsp;Up: <strong><?=Format::get_size($Uploaded)?></strong>
<? }
if (check_paranoia('downloaded', $Paranoia, $Class, $FriendID)) { ?>
<?
}
if (check_paranoia('downloaded', $Paranoia, $Class, $FriendID)) {
?>
&nbsp;Down: <strong><?=Format::get_size($Downloaded)?></strong>
<? } ?>
</span>
@ -96,14 +100,14 @@
</td>
<? } ?>
<td valign="top">
<input type="hidden" name="friendid" value="<?=$FriendID?>" />
<input type="hidden" name="friendid" value="<?=$FriendID?>" />
<textarea name="comment" rows="4" cols="65"><?=$Comment?></textarea>
</td>
<td class="left" valign="top">
<input type="submit" name="action" value="Update" /><br />
<input type="submit" name="action" value="Remove friend" /><br />
<input type="submit" name="action" value="Contact" /><br />
<textarea name="comment" rows="4" cols="65"><?=$Comment?></textarea>
</td>
<td class="left" valign="top">
<input type="submit" name="action" value="Update" /><br />
<input type="submit" name="action" value="Remove friend" /><br />
<input type="submit" name="action" value="Contact" /><br />
</td>
</tr>
</table>

View File

@ -49,7 +49,7 @@
$ConverstionParticipants = $DB->to_array();
foreach ($ConverstionParticipants as $Participant) {
$PMUserID = (int) $Participant['ID'];
$PMUserID = (int)$Participant['ID'];
$Users[$PMUserID]['UserStr'] = Users::format_username($PMUserID, true, true, true, true);
$Users[$PMUserID]['Username'] = $Participant['Username'];
}

View File

@ -17,7 +17,7 @@
WHERE ID = '$ID'");
$Question = $DB->next_record();
View::show_header("Ask the Staff");
View::show_header('Ask the Staff', 'bbcode');
?>
<div class="thin">
<h2>

View File

@ -23,7 +23,7 @@
list($Answer) = $DB->next_record();
View::show_header("Ask the Staff");
View::show_header('Ask the Staff', 'bbcode');
?>
<div class="thin">
<h2>

View File

@ -20,7 +20,7 @@
$Questions = G::$DB->to_array();
View::show_header("Popular Questions", "questions");
View::show_header('Popular Questions', 'questions,bbcode');
?>
<div class="thin">

View File

@ -37,7 +37,7 @@
FROM user_questions");
list($TotalQuestions) = $DB->next_record();
View::show_header("Ask the Staff", "questions");
View::show_header('Ask the Staff', 'questions,bbcode');
?>
<div class="thin">

View File

@ -38,7 +38,7 @@
$Questions = G::$DB->to_array();
View::show_header($UserInfo['Username'] . "'s answers", "questions");
View::show_header($UserInfo['Username'] . "'s answers", 'questions,bbcode');
?>
<div class="thin">

View File

@ -10,12 +10,15 @@
die();
}
$ID = (int) $_POST['id'];
$ID = (int)$_POST['id'];
$Notes = str_replace("<br />", "\n", $_POST['notes']);
$Notes = db_string($Notes);
$DB->query("UPDATE reports SET Notes = '$Notes' WHERE ID = '$ID'");
$DB->query("
UPDATE reports
SET Notes = '$Notes'
WHERE ID = '$ID'");
print
json_encode(
array(

View File

@ -126,14 +126,23 @@
if (strpos($LogCue, '%') !== false) {
preg_match('/\d+/', $LogCue, $Matches);
if ((int) $LogScore < (int) $Matches[0]) {
if ((int)$LogScore < (int)$Matches[0]) {
$Err = 'This torrent\'s log score is too low.';
}
}
}
if ($BitrateList === 'Other') {
if ($Bitrate === 'Lossless' || $Bitrate === 'APS (VBR)' || $Bitrate === 'V2 (VBR)' || $Bitrate === 'V1 (VBR)' || $Bitrate === '256' || $Bitrate === 'APX (VBR)' || $Bitrate === 'V0 (VBR)' || $Bitrate === 'q8.x (VBR)' || $Bitrate === '320' || $Bitrate === '24bit Lossless') {
if ($Bitrate === 'Lossless'
|| $Bitrate === 'APS (VBR)'
|| $Bitrate === 'V2 (VBR)'
|| $Bitrate === 'V1 (VBR)'
|| $Bitrate === '256'
|| $Bitrate === 'APX (VBR)'
|| $Bitrate === 'V0 (VBR)'
|| $Bitrate === '320'
|| $Bitrate === '24bit Lossless'
) {
$Err = "$Bitrate is not an allowed bitrate for this request.";
}
} elseif ($BitrateList && $BitrateList != 'Any' && !Misc::search_joined_string($BitrateList, $Bitrate)) {

View File

@ -36,7 +36,7 @@
$OwnerName = $UserInfo['Username'];
?>
<div id="thin">
<div class="thin">
<div class="header">
<h2>Staff PM - <?=display_str($Subject)?></h2>
<div class="linkbox">
@ -153,7 +153,9 @@
<input type="hidden" name="action" value="takepost" />
<input type="hidden" name="convid" value="<?=$ConvID?>" id="convid" />
<?
$TextPrev = new TEXTAREA_PREVIEW('message', 'quickpost', '', 90, 10, true, false);
if ($Status != 'Resolved') {
$TextPrev = new TEXTAREA_PREVIEW('message', 'quickpost', '', 90, 10, true, false);
}
?>
<br />
<?

View File

@ -145,7 +145,7 @@
<td><?=$Date?></td>
<td><?=number_format($Joined)?></td>
<td><?=number_format($Manual)?></td>
<td><?=number_format((double) $Ratio)?></td>
<td><?=number_format((float)$Ratio)?></td>
<td><?=number_format($Inactivity)?></td>
<td><?=number_format($TotalOut)?></td>
<td><?=number_format($TotalGrowth)?></td>

View File

@ -6,18 +6,18 @@
if ($CanEdit && isset($_POST['perform'])) {
authorize();
if ($_POST['perform'] == 'add' && !empty($_POST['message'])) {
if ($_POST['perform'] === 'add' && !empty($_POST['message'])) {
$Message = db_string($_POST['message']);
$Author = db_string($_POST['author']);
$DB->query("
INSERT INTO changelog (Message, Author, Time)
VALUES ('$Message', '$Author', NOW())");
$ID = $DB->inserted_id();
// SiteHistory::add_event(sqltime(), "Changelog $ID", "tools.php?action=change_log", 1, 3, "", $Message, $LoggedUser['ID']);
// SiteHistory::add_event(sqltime(), "Change log $ID", "tools.php?action=change_log", 1, 3, "", $Message, $LoggedUser['ID']);
}
if ($_POST['perform'] == 'remove' && !empty($_POST['change_id'])) {
$ID = (int) $_POST['change_id'];
if ($_POST['perform'] === 'remove' && !empty($_POST['change_id'])) {
$ID = (int)$_POST['change_id'];
$DB->query("
DELETE FROM changelog
WHERE ID = '$ID'");

View File

@ -31,10 +31,10 @@
if ($Count > 0) {
foreach ($EmailResults as $Email) {
$Emails[] = array(
'id' => (int) $Email['ID'],
'id' => (int)$Email['ID'],
'email' => $Email['Email'],
'comment' => $Email['Comment'],
'userid' => (int) $Email['UserID'],
'userid' => (int)$Email['UserID'],
'time' => $Email['Time']);
}
}

View File

@ -11,9 +11,9 @@
View::show_header('Label Aliases');
$OrderBy = (($_GET['order'] == 'BadLabels') ? 'BadLabel' : 'AliasLabel');
$OrderBy = $_GET['order'] === 'BadLabels' ? 'BadLabel' : 'AliasLabel';
/*
$LabelID = (int) $_GET['id'];
$LabelID = (int)$_GET['id'];
$LabelNameSQL = '';
//TODO join with labels table to get label name
if (!empty($LabelID)) {

View File

@ -666,7 +666,7 @@ function filelist($Str) {
if ($Format) { $ExtraInfo.=display_str($Format); $AddExtra=' / '; }
if ($Encoding) { $ExtraInfo.=$AddExtra.display_str($Encoding); $AddExtra=' / '; }
if ($HasLog) { $ExtraInfo.=$AddExtra.'Log'; $AddExtra=' / '; }
if ($HasLog && $LogInDB) { $ExtraInfo.=' ('.(int) $LogScore.'%)'; }
if ($HasLog && $LogInDB) { $ExtraInfo.=' ('.(int)$LogScore.'%)'; }
if ($HasCue) { $ExtraInfo.=$AddExtra.'Cue'; $AddExtra=' / '; }
if ($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if (!$ExtraInfo) {

View File

@ -377,7 +377,7 @@ function filelist($Str) {
$AddExtra = ' / ';
}
if ($HasLog && $LogInDB) {
$ExtraInfo .= ' (' . (int) $LogScore . '%)';
$ExtraInfo .= ' (' . (int)$LogScore . '%)';
}
if ($HasCue) {
$ExtraInfo .= "{$AddExtra}Cue";

View File

@ -6,7 +6,7 @@
error(0);
}
$CollageID = (int) $_GET['collageid'];
$CollageID = (int)$_GET['collageid'];
if (!$UserSubscriptions = $Cache->get_value('collage_subs_user_'.$LoggedUser['ID'])) {
$DB->query('