Empty commit

This commit is contained in:
Git 2013-07-17 08:00:52 +00:00
parent 63f08f0b62
commit 19bb3b95d1
33 changed files with 343 additions and 309 deletions

133
classes/classloader.php Normal file
View File

@ -0,0 +1,133 @@
<?
spl_autoload_register(function ($ClassName) {
$FileName = '';
switch ($ClassName) {
case 'Artists':
$FileName = 'artists.class';
break;
case 'Bencode':
$FileName = 'bencode.class';
break;
case 'BencodeDecode':
$FileName = 'bencodedecode.class';
break;
case 'BencodeTorrent':
$FileName = 'bencodetorrent.class';
break;
case 'Bookmarks':
$FileName = 'bookmarks.class';
break;
case 'Collages':
$FileName = 'collages.class';
break;
case 'Format':
$FileName = 'format.class';
break;
case 'Forums':
$FileName = 'forums.class';
break;
case 'ForumsView':
$FileName = 'forumsview.class';
case 'Forum':
$FileName = 'forum.class';
break;
case 'ForumView':
$FileName = 'forumsview.class';
break;
case 'G':
$FileName = 'g.class';
break;
case 'ImageTools':
$FileName = 'image_tools.class';
break;
case 'Inbox':
$FileName = 'inbox.class';
break;
case 'LastFM':
$FileName = 'lastfm.class';
break;
case 'MASS_USER_BOOKMARKS_EDITOR':
$FileName = 'mass_user_bookmarks_editor.class';
break;
case 'MASS_USER_TORRENTS_EDITOR':
$FileName = 'mass_user_torrents_editor.class';
break;
case 'MASS_USER_TORRENTS_TABLE_VIEW':
$FileName = 'mass_user_torrents_table_view.class';
break;
case 'Misc':
$FileName = 'misc.class';
break;
case 'Permissions':
$FileName = 'permissions.class';
break;
case 'Requests':
$FileName = 'requests.class';
break;
case 'Rippy':
$FileName = 'rippy.class';
break;
case 'Rules':
$FileName = 'rules.class';
break;
case 'Sphinxql':
$FileName = 'sphinxql.class';
break;
case 'SphinxqlQuery':
$FileName = 'sphinxqlquery.class';
break;
case 'SphinxqlResult':
$FileName = 'sphinxqlresult.class';
break;
case 'Tags':
$FileName = 'tags.class';
break;
case 'TEXTAREA_PREVIEW':
$FileName = 'textarea_preview.class';
break;
case 'Thread':
$FileName = 'thread.class';
break;
case 'Tools':
$FileName = 'tools.class';
break;
case 'TORRENT':
case 'BENCODE_DICT':
case 'BENCODE_LIST':
$FileName = 'torrent.class';
break;
case 'Torrents':
$FileName = 'torrents.class';
break;
case 'TorrentsDL':
$FileName = 'torrentsdl.class';
break;
case 'Tracker':
$FileName = 'tracker.class';
break;
case 'UserAgent':
$FileName = 'useragent.class';
break;
case 'UserRank':
$FileName = 'user_rank.class';
break;
case 'Users':
$FileName = 'users.class';
break;
case 'View':
$FileName = 'view.class';
break;
case 'Votes':
$FileName = 'votes.class';
break;
case 'Wiki':
$FileName = 'wiki.class';
break;
case 'Zip':
$FileName = 'zip.class';
break;
default:
die("Couldn't import class $ClassName");
}
require_once(SERVER_ROOT . "/classes/$FileName.php");
});

View File

@ -41,7 +41,7 @@ public function profile($Automatic = '') {
}
$DB->warnings(); // see comment in MYSQL::query
$Queries = $this->get_queries();
/*$Queries = $this->get_queries();
$DBWarningCount = 0;
foreach ($Queries as $Query) {
if (!empty($Query[2])) {
@ -50,7 +50,7 @@ public function profile($Automatic = '') {
}
if ($DBWarningCount) {
$Reason[] = $DBWarningCount . ' DB warning(s)';
}
}*/
if (isset($_REQUEST['profile'])) {
global $LoggedUser;

13
classes/g.class.php Normal file
View File

@ -0,0 +1,13 @@
<?
class G {
public static $DB;
public static $Cache;
public static $LoggedUser;
public static function initialize() {
global $DB, $Cache, $LoggedUser;
self::$DB = $DB;
self::$Cache = $Cache;
self::$LoggedUser = $LoggedUser;
}
}

View File

@ -98,7 +98,7 @@ protected function get_irc_host() {
return trim($Host[1]);
}
protected function get_word($Select=1) {
protected function get_word($Select = 1) {
preg_match('/:.+ PRIVMSG [^:]+ :(.+)/', $this->Data, $Word);
$Word = split(' ', $Word[1]);
return trim($Word[$Select]);
@ -111,7 +111,7 @@ protected function get_action() {
protected function send_raw($Text) {
if (!feof($this->Socket)) {
fwrite($this->Socket, $Text."\n");
fwrite($this->Socket, "$Text\n");
} elseif (!$this->Connecting) {
$this->Connecting = true;
sleep(120);
@ -179,7 +179,9 @@ protected function listen() {
unset($this->Identified[$Nick[1]]);
}
if (isset($this->DisabledUsers[$Nick[1]])) {
$DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[1] . "'");
$DB->query("
DELETE FROM disable_list
WHERE Nick = '$Nick[1]'");
$Cache->increment_value('num_disablees', -1);
unset($this->DisabledUsers[$Nick[1]]);
}
@ -187,16 +189,20 @@ protected function listen() {
if (preg_match("/:([^!]+)![^\s]* PART ".BOT_DISABLED_CHAN.'/', $this->Data, $Nick)) {
if (isset($this->DisabledUsers[$Nick[1]])) {
$DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[1] . "'");
$DB->query("
DELETE FROM disable_list
WHERE Nick = '$Nick[1]'");
$Cache->increment_value('num_disablees', -1);
unset($this->DisabledUsers[$Nick[1]]);
}
}
if (preg_match("/:([^!]+)![^\s]* KICK ".BOT_DISABLED_CHAN.'.* /', $this->Data, $Nick)) {
$Nick = explode(" ", $Nick[0]);
$Nick = explode(' ', $Nick[0]);
if (isset($this->DisabledUsers[$Nick[3]])) {
$DB->query("DELETE FROM disable_list WHERE Nick = '" . $Nick[3] . "'");
$DB->query("
DELETE FROM disable_list
WHERE Nick = '$Nick[3]'");
$Cache->increment_value('num_disablees', -1);
unset($this->DisabledUsers[$Nick[3]]);
}
@ -214,7 +220,7 @@ protected function listen() {
$this->channel_events();
}
if (preg_match("/.* PRIVMSG ".BOT_NICK." .*/", $this->Data)) {
if (preg_match('/.* PRIVMSG '.BOT_NICK.' .*/', $this->Data)) {
$this->query_events();
}
}

View File

@ -79,125 +79,7 @@
$SS = new SPHINX_SEARCH;
// Autoload classes.
spl_autoload_register(function ($ClassName) {
$FileName = '';
switch ($ClassName) {
case 'Artists':
$FileName = 'artists.class';
break;
case 'Bencode':
$FileName = 'bencode.class';
break;
case 'BencodeDecode':
$FileName = 'bencodedecode.class';
break;
case 'BencodeTorrent':
$FileName = 'bencodetorrent.class';
break;
case 'Bookmarks':
$FileName = 'bookmarks.class';
break;
case 'Collages':
$FileName = 'collages.class';
break;
case 'Format':
$FileName = 'format.class';
break;
case 'Forums':
$FileName = 'forums.class';
break;
case 'ImageTools':
$FileName = 'image_tools.class';
break;
case 'Inbox':
$FileName = 'inbox.class';
break;
case 'LastFM':
$FileName = 'lastfm.class';
break;
case 'MASS_USER_BOOKMARKS_EDITOR':
$FileName = 'mass_user_bookmarks_editor.class';
break;
case 'MASS_USER_TORRENTS_EDITOR':
$FileName = 'mass_user_torrents_editor.class';
break;
case 'MASS_USER_TORRENTS_TABLE_VIEW':
$FileName = 'mass_user_torrents_table_view.class';
break;
case 'Misc':
$FileName = 'misc.class';
break;
case 'Permissions':
$FileName = 'permissions.class';
break;
case 'Requests':
$FileName = 'requests.class';
break;
case 'Rippy':
$FileName = 'rippy.class';
break;
case 'Rules':
$FileName = 'rules.class';
break;
case 'Sphinxql':
$FileName = 'sphinxql.class';
break;
case 'SphinxqlQuery':
$FileName = 'sphinxqlquery.class';
break;
case 'SphinxqlResult':
$FileName = 'sphinxqlresult.class';
break;
case 'Tags':
$FileName = 'tags.class';
break;
case 'TEXTAREA_PREVIEW':
$FileName = 'textarea_preview.class';
break;
case 'Tools':
$FileName = 'tools.class';
break;
case 'TORRENT':
case 'BENCODE_DICT':
case 'BENCODE_LIST':
$FileName = 'torrent.class';
break;
case 'Torrents':
$FileName = 'torrents.class';
break;
case 'TorrentsDL':
$FileName = 'torrentsdl.class';
break;
case 'Tracker':
$FileName = 'tracker.class';
break;
case 'UserAgent':
$FileName = 'useragent.class';
break;
case 'UserRank':
$FileName = 'user_rank.class';
break;
case 'Users':
$FileName = 'users.class';
break;
case 'View':
$FileName = 'view.class';
break;
case 'Votes':
$FileName = 'votes.class';
break;
case 'Wiki':
$FileName = 'wiki.class';
break;
case 'Zip':
$FileName = 'zip.class';
break;
default:
die("Couldn't import class $ClassName");
}
require_once(SERVER_ROOT . "/classes/$FileName.php");
});
require(SERVER_ROOT.'/classes/classloader.php');
//Begin browser identification
@ -419,7 +301,7 @@
logout(); // Ghost
}
}
G::initialize();
$Debug->set_flag('end user handling');
$Debug->set_flag('start function definitions');

View File

@ -5,8 +5,8 @@
t.ID AS TorrentID,
t.GroupID AS GroupID
FROM xbt_files_users AS x
JOIN torrents AS t ON t.ID=x.fid
WHERE t.Format='FLAC'
JOIN torrents AS t ON t.ID = x.fid
WHERE t.Format = 'FLAC'
GROUP BY x.fid
HAVING COUNT(x.uid) = 1
ORDER BY t.LogScore DESC, t.Time ASC
@ -21,7 +21,7 @@
$Results = $Results['matches'];
$JsonResults = array();
foreach ($Results as $GroupID=>$Group) {
foreach ($Results as $GroupID => $Group) {
extract(Torrents::array_group($Group));
$FlacID = $GroupIDs[$GroupID]['TorrentID'];

View File

@ -3,17 +3,15 @@
error(0);
}
$Options = array('v0','v2','320');
$Options = array('v0', 'v2', '320');
$Encodings = array('V0 (VBR)', 'V2 (VBR)', '320');
$EncodingKeys = array_fill_keys($Encodings, true);
if ($_GET['type'] == 3) {
if ($_GET['type'] === '3') {
$List = "!(v0 | v2 | 320)";
} else {
$List = '!'.$Options[$_GET['type']];
if ($_GET['type'] == 0) {
$_GET['type'] = '0';
} else {
if ($_GET['type'] !== '0') {
$_GET['type'] = display_str($_GET['type']);
}
}
@ -99,15 +97,15 @@
}
$TagList = array();
$TagList = explode(' ',str_replace('_','.',$GroupInfo['TagList']));
$TagList = explode(' ', str_replace('_', '.', $GroupInfo['TagList']));
$TorrentTags = array();
foreach ($TagList as $Tag) {
$TorrentTags[] = '<a href="torrents.php?taglist='.$Tag.'">'.$Tag.'</a>';
$TorrentTags[] = "<a href=\"torrents.php?taglist=$Tag\">$Tag</a>";
}
$TorrentTags = implode(', ', $TorrentTags);
foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID']
|| !empty($Edition['Formats']) && $_GET['type'] == 3
|| !empty($Edition['Formats']) && $_GET['type'] === '3'
|| $Edition['Formats'][$Encodings[$_GET['type']]] == true) {
continue;
}

View File

@ -163,7 +163,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
// Filelist searches makes use of the proximity operator to ensure that all keywords match the same file
if (!empty($_GET['filelist'])) {
$SearchString = trim($_GET['filelist']);
if ($SearchString != '') {
if ($SearchString !== '') {
$SearchString = '"'.Sphinxql::escape_string($_GET['filelist']).'"~20';
$SphQL->where_match($SearchString, 'filelist', false);
$SphQLTor->where_match($SearchString, 'filelist', false);
@ -181,7 +181,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
'remastercataloguenumber', 'encoding', 'format', 'media') as $Search) {
if (!empty($_GET[$Search])) {
$SearchString = trim($_GET[$Search]);
if ($SearchString != '') {
if ($SearchString !== '') {
$SearchWords[$Search] = array('include' => array(), 'exclude' => array());
if ($Search == 'taglist') {
$SearchString = strtr($SearchString, '.', '_');
@ -198,7 +198,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
$SearchWords[$Search]['include'][] = $Word;
$EnableNegation = true;
}
} elseif ($Word != '') {
} elseif ($Word !== '') {
$SearchWords[$Search]['include'][] = $Word;
$EnableNegation = true;
}
@ -231,9 +231,9 @@ function header_link($SortKey, $DefaultWay = 'desc') {
} elseif (in_array($Word, $SearchFormats)) {
$FilterFormats[] = $Word;
$EnableNegation = true;
} elseif ($Word == '100%') {
} elseif ($Word === '100%') {
$_GET['haslog'] = '100';
} elseif ($Word != '') {
} elseif ($Word !== '') {
$BasicSearch['include'][] = $Word;
$EnableNegation = true;
}
@ -290,7 +290,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
$QueryParts = array();
// 'All' tags
if (!isset($_GET['tags_type']) || $_GET['tags_type'] == 1) {
if (!isset($_GET['tags_type']) || $_GET['tags_type'] === '1') {
$_GET['tags_type'] = '1';
$Tags = array_merge($Tags['include'], $Tags['exclude']);
if (!empty($Tags)) {
@ -310,8 +310,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
$Filtered = true;
}
unset($SearchWords['taglist']);
}
elseif (!isset($_GET['tags_type'])) {
} elseif (!isset($_GET['tags_type'])) {
$_GET['tags_type'] = '1';
}
@ -357,7 +356,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
}
if (isset($_GET['haslog']) && $_GET['haslog'] !== '') {
if ($_GET['haslog'] == 100) {
if ($_GET['haslog'] === '100') {
$SphQL->where('logscore', 100);
$SphQLTor->where('logscore', 100);
$Filtered = true;

View File

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

View File

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

View File

@ -9,11 +9,9 @@
}
$DB->query("
SELECT
t.ForumID, p.Body
SELECT t.ForumID, p.Body
FROM forums_posts AS p
JOIN forums_topics AS t
ON p.TopicID = t.ID
JOIN forums_topics AS t ON p.TopicID = t.ID
WHERE p.ID = '$PostID'");
if (!$DB->has_results()) {

View File

@ -56,7 +56,7 @@
'producer' => ($ArtistForm[7] == null) ? array() : pullmediainfo($ArtistForm[7])
);
} else {
$JsonMusicInfo = NULL;
$JsonMusicInfo = null;
}
$JsonTorrentDetails = array(

View File

@ -2,7 +2,7 @@
require(SERVER_ROOT.'/sections/torrents/functions.php');
$GroupID = (int)$_GET['id'];
if ($GroupID == 0) {
if ($GroupID === 0) {
error('bad id parameter', true);
}
@ -10,9 +10,9 @@
$TorrentDetails = $TorrentDetails[0];
$Image = $TorrentDetails['WikiImage'];
if (!$Image) { // handle no artwork
$Image = STATIC_SERVER.'common/noartwork/'.$CategoryIcons[$TorrentDetails['CategoryID']-1];
$Image = STATIC_SERVER.'common/noartwork/'.$CategoryIcons[$TorrentDetails['CategoryID'] - 1];
}
json_die("success", array(
'wikiImage' => $Image
));
));

View File

@ -46,7 +46,7 @@ function make_concert_link($Event) {
?>
<form class="hidden" action="" id="concert<?=$Event['id']?>" method="post">
<input type="hidden" name="action" value="concert_thread" />
<input type="hidden" name="concert_title" value="<?='[Concert] ' . display_str($Name) . ' - ' . $ConcertTitle?>" />
<input type="hidden" name="concert_title" value="<?='[Concert] ' . display_str($Name) . " - $ConcertTitle"?>" />
<input type="hidden" name="concert_id" value="<?=$Event['id']?>" />
<input type="hidden" name="concert_template" value="<?=get_concert_post_template($Name, $Event)?>" />
</form>
@ -82,11 +82,11 @@ function get_concert_post_template($Artist, $Event) {
}
$Website = '[b]Web site:[/b] ' . $Url;
}
if (isset($Event['artists']['artist']) && (count($Event['artists']['artist']) == 1 && strtolower($Event['artists']['artist'][1]) == strtolower($Artist))) {
if (isset($Event['artists']['artist']) && (count($Event['artists']['artist']) === 1 && strtolower($Event['artists']['artist'][1]) == strtolower($Artist))) {
$i = 0;
$j = count($Event['artists']['artist']) - 1;
foreach ($Event['artists']['artist'] as $WithArtist) {
if ($i == $j) {
if ($i === $j) {
$With .= " and [artist]" . $WithArtist . "[/artist]";
} elseif ($i == 0) {
$With .= "[artist]" . $WithArtist . "[/artist]";
@ -97,13 +97,13 @@ function get_concert_post_template($Artist, $Event) {
}
}
return "[align=center][size=6][artist]" . $Artist . "[/artist] at " . $EventTitle . "[/size]
[size=4]" . $With . "
[size=4]$With
[b]" . get_date_post($Event['startDate']) . "[/b][/size]
[size=3]" . $Location . "[/align]
[size=3]$Location" . "[/align]
" . $Directions . "
" . $Website . "
$Directions
$Website
[b]Last.fm Listing:[/b] [url=" . $Event['venue']['url'] . "]Visit Last.fm[/url]
[align=center]. . . . . . . . . .[/align]";

View File

@ -54,7 +54,7 @@
|| !is_number($_REQUEST['preference'])
|| !is_number($_REQUEST['artistid'])
|| $_REQUEST['preference'] > 2
|| count($_REQUEST['list']) == 0
|| count($_REQUEST['list']) === 0
) {
error(0);
}

View File

@ -12,7 +12,7 @@
$Encodings = array('V0 (VBR)', 'V2 (VBR)', '320');
$EncodingKeys = array_fill_keys($Encodings, true);
if (!empty($_GET['filter']) && $_GET['filter'] == 'seeding') {
if (!empty($_GET['filter']) && $_GET['filter'] === 'seeding') {
$SeedingOnly = true;
} else {
$SeedingOnly = false;
@ -38,7 +38,7 @@
$SnatchedGroupIDs = array_slice($SnatchedGroupIDs, 0, 1000);
}
if (count($SnatchedGroupIDs) == 0) {
if (count($SnatchedGroupIDs) === 0) {
error(($SeedingOnly ? "You aren't seeding any perfect FLACs!" : "You haven't snatched any perfect FLACs!"));
}
// Create hash table
@ -70,7 +70,7 @@
$GroupIDs = array_fill_keys($DB->collect('GroupID'), true);
if (count($GroupIDs) == 0) {
if (count($GroupIDs) === 0) {
error('No results found');
}
@ -188,7 +188,7 @@
}
$TorrentTags = new Tags($GroupInfo['TagList']);
foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID'] || count($Edition['Formats']) == 3) {
if (!$Edition['FlacID'] || count($Edition['Formats']) === 3) {
continue;
}
$DisplayName = $ArtistNames . '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$Edition['FlacID'].'#torrent'.$Edition['FlacID'].'" title="View Torrent">'.$GroupName.'</a>';

View File

@ -3,17 +3,15 @@
error(0);
}
$Options = array('v0','v2','320');
$Options = array('v0', 'v2', '320');
$Encodings = array('V0 (VBR)', 'V2 (VBR)', '320');
$EncodingKeys = array_fill_keys($Encodings, true);
if ($_GET['type'] == 3) {
if ($_GET['type'] === '3') {
$List = "!(v0 | v2 | 320)";
} else {
$List = '!'.$Options[$_GET['type']];
if ($_GET['type'] == 0) {
$_GET['type'] = '0';
} else {
if ($_GET['type'] !== '0') {
$_GET['type'] = display_str($_GET['type']);
}
}
@ -131,9 +129,9 @@
$TorrentTags = new Tags($GroupInfo['TagList']);
foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID'] //no FLAC in this group
|| !empty($Edition['Formats']) && $_GET['type'] == 3 //at least one transcode present when we only wanted groups containing no transcodes at all (type 3)
|| !empty($Edition['Formats']) && $_GET['type'] === '3' //at least one transcode present when we only wanted groups containing no transcodes at all (type 3)
|| $Edition['Formats'][$Encodings[$_GET['type']]] == true //the transcode we asked for is already there
|| count($Edition['Formats']) == 3) //all 3 transcodes are there already (this can happen due to the caching of Sphinx's better_transcode table)
|| count($Edition['Formats']) === 3) //all 3 transcodes are there already (this can happen due to the caching of Sphinx's better_transcode table)
{
$Debug->log_var($Edition, 'Skipping '.$RemIdent);
continue;

View File

@ -39,7 +39,7 @@ function transcode_init_sphql() {
if (in_array($_GET['target'], array('v0', 'v2', '320'))) {
// V0/V2/320 is missing
$SphQL->where_match('!'.$_GET['target'], 'encoding', false);
} elseif ($_GET['target'] == 'all') {
} elseif ($_GET['target'] === 'all') {
// all transcodes are missing
$SphQL->where_match('!(v0 | v2 | 320)', 'encoding', false);
} else {
@ -129,7 +129,7 @@ function transcode_parse_groups($Groups) {
$ResultCount = 0;
if (in_array($_GET['filter'], array('all', 'uploaded'))) {
$SphQL = transcode_init_sphql();
if ($_GET['filter'] == 'uploaded') {
if ($_GET['filter'] === 'uploaded') {
$SphQL->where('uploader', $UserID);
}
@ -145,14 +145,14 @@ function transcode_parse_groups($Groups) {
// Read all snatched/seeding torrents
$DB->query("
SELECT t.GroupID, x.fid
FROM ".($_GET['filter'] == 'seeding' ? 'xbt_files_users' : 'xbt_snatched')." AS x
FROM ".($_GET['filter'] === 'seeding' ? 'xbt_files_users' : 'xbt_snatched')." AS x
JOIN torrents AS t ON t.ID=x.fid
JOIN torrents_group AS tg ON tg.ID = t.GroupID
WHERE t.Format='FLAC'
AND (t.LogScore = '100' OR t.Media != 'CD')
AND tg.CategoryID = 1
AND x.uid='$UserID'
".($_GET['filter'] == 'seeding' ? 'AND x.active=1 AND x.Remaining=0' : ''));
AND x.uid = '$UserID'
".($_GET['filter'] === 'seeding' ? 'AND x.active=1 AND x.Remaining=0' : ''));
$Debug->set_flag('SELECTed ' . $_GET['filter'] . ' torrents');
$Snatched = $DB->to_array();
$Debug->set_flag('Received data from DB');
@ -179,12 +179,12 @@ function transcode_parse_groups($Groups) {
break;
}
}
if (!$EditionSnatched || count($Edition['MP3s']) == 3) {
if (!$EditionSnatched || count($Edition['MP3s']) === 3) {
unset($GroupsTmp[$GroupID]['Editions'][$RemIdent]);
}
}
$ResultCount += count($GroupsTmp[$GroupID]['Editions']);
if (count($GroupsTmp[$GroupID]['Editions']) == 0) {
if (count($GroupsTmp[$GroupID]['Editions']) === 0) {
unset($GroupsTmp[$GroupID]);
}
}
@ -203,10 +203,10 @@ function transcode_parse_groups($Groups) {
);
foreach ($Groups as $GroupID => $Group) {
foreach ($Group['Editions'] as $RemIdent => $Edition) {
if (count($Edition['FlacIDs']) == 0 //no FLAC in this group
|| (!empty($Edition['MP3s']) && $_GET['target'] == 'all') //at least one transcode present when we only wanted groups containing no transcodes at all
if (count($Edition['FlacIDs']) === 0 //no FLAC in this group
|| (!empty($Edition['MP3s']) && $_GET['target'] === 'all') //at least one transcode present when we only wanted groups containing no transcodes at all
|| isset($Edition['MP3s'][$Encodings[$_GET['target']]]) //the transcode we asked for is already there
|| count($Edition['MP3s']) == 3) //all 3 transcodes are there already (this can happen due to the caching of Sphinx's better_transcode table)
|| count($Edition['MP3s']) === 3) //all 3 transcodes are there already (this can happen due to the caching of Sphinx's better_transcode table)
{
$Debug->log_var($Edition, 'Skipping '.$RemIdent);
unset($Groups[$GroupID]['Editions'][$RemIdent]);

View File

@ -26,7 +26,7 @@
$UploadedTorrentIDs = array_fill_keys($DB->collect('ID'), true);
$UploadedGroupIDs = $DB->collect('GroupID');
if (count($UploadedGroupIDs) == 0) {
if (count($UploadedGroupIDs) === 0) {
error("You haven't uploaded any perfect FLACs!");
}
@ -54,7 +54,7 @@
$GroupIDs = array_fill_keys($DB->collect('GroupID'), true);
if (count($GroupIDs) == 0) {
if (count($GroupIDs) === 0) {
error('No results found.');
}
@ -163,7 +163,7 @@
}
$TorrentTags = new Tags($TagList);
foreach ($Editions as $RemIdent => $Edition) {
if (!$Edition['FlacID'] || count($Edition['Formats']) == 3) {
if (!$Edition['FlacID'] || count($Edition['Formats']) === 3) {
continue;
}
$DisplayName = $ArtistNames . '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$Edition['FlacID'].'#torrent'.$Edition['FlacID'].'" title="View Torrent">'.$GroupName.'</a>';

View File

@ -47,7 +47,7 @@
</div>
</div>
<div class="box pad" align="center">
<? if (count($ArtistList) == 0) { ?>
<? if (count($ArtistList) === 0) { ?>
<br /><h2>You have not bookmarked any artists.</h2>
</div>
</div><!--content-->
@ -62,7 +62,7 @@
<?
$Row = 'a';
foreach ($ArtistList as $Artist) {
$Row = ($Row === 'a') ? 'b' : 'a';
$Row = $Row === 'a' ? 'b' : 'a';
list($ArtistID, $Name) = $Artist;
?>
<tr class="row<?=$Row?> bookmark_<?=$ArtistID?>">

View File

@ -29,7 +29,7 @@
// Caching anything beyond the first page of any given forum is just wasting ram
// users are more likely to search then to browse to page 2
if ($Page == 1) {
list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID);
list($Forum,,,$Stickies) = $Cache->get_value("forums_$ForumID");
}
if (!isset($Forum) || !is_array($Forum)) {
$DB->query("
@ -47,16 +47,16 @@
WHERE t.ForumID = '$ForumID'
ORDER BY t.Ranking = 0, t.Ranking ASC, t.IsSticky DESC, t.LastPostTime DESC
LIMIT $Limit"); // Can be cached until someone makes a new post
$Forum = $DB->to_array('ID',MYSQLI_ASSOC, false);
$Forum = $DB->to_array('ID', MYSQLI_ASSOC, false);
if ($Page == 1) {
$DB->query("
SELECT COUNT(ID)
FROM forums_topics
WHERE ForumID='$ForumID'
AND IsSticky='1'");
WHERE ForumID = '$ForumID'
AND IsSticky = '1'");
list($Stickies) = $DB->next_record();
$Cache->cache_value('forums_'.$ForumID, array($Forum,'',0,$Stickies), 0);
$Cache->cache_value("forums_$ForumID", array($Forum, '', 0, $Stickies), 0);
}
}
@ -173,7 +173,7 @@
</tr>
<?
// Check that we have content to process
if (count($Forum) == 0) {
if (count($Forum) === 0) {
?>
<tr>
<td colspan="4">
@ -183,18 +183,20 @@
<?
} else {
// forums_last_read_topics is a record of the last post a user read in a topic, and what page that was on
$DB->query('
$DB->query("
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'].'\'');
WHERE TopicID IN(".implode(', ', array_keys($Forum)).')
AND UserID = \''.$LoggedUser['ID'].'\'');
// Turns the result set into a multi-dimensional array, with
// forums_last_read_topics.TopicID as the key.
@ -207,13 +209,13 @@
$Row = 'a';
foreach ($Forum as $Topic) {
list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
$Row = (($Row == 'a') ? 'b' : 'a');
// Build list of page links
$Row = $Row === 'a' ? 'b' : 'a';
// Build list of page links
// Only do this if there is more than one page
$PageLinks = array();
$ShownEllipses = false;
$PagesText = '';
$TopicPages = ceil($PostCount/$PerPage);
$TopicPages = ceil($PostCount / $PerPage);
if ($TopicPages > 1) {
$PagesText = ' (';
@ -225,10 +227,10 @@
}
continue;
}
$PageLinks[] = '<a href="forums.php?action=viewthread&amp;threadid='.$TopicID.'&amp;page='.$i.'">'.$i.'</a>';
$PageLinks[] = "<a href=\"forums.php?action=viewthread&amp;threadid=$TopicID&amp;page=$i\">$i</a>";
}
$PagesText.=implode(' ', $PageLinks);
$PagesText.=')';
$PagesText .= implode(' ', $PageLinks);
$PagesText .= ')';
}
// handle read/unread posts - the reason we can't cache the whole page
@ -266,7 +268,7 @@
</span>
<? } ?>
<span style="float: right;" class="last_poster">
by <?=Users::format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime,1)?>
by <?=Users::format_username($LastAuthorID, false, false, false)?> <?=time_diff($LastTime, 1)?>
</span>
</td>
<td><?=number_format($PostCount - 1)?></td>

View File

@ -144,15 +144,15 @@
(TopicID, Question, Answers)
VALUES
('$TopicID', '".db_string($Question)."', '".db_string(serialize($Answers))."')");
$Cache->cache_value('polls_'.$TopicID, array($Question, $Answers, $Votes, '0000-00-00 00:00:00', '0'), 0);
$Cache->cache_value("polls_$TopicID", array($Question, $Answers, $Votes, '0000-00-00 00:00:00', '0'), 0);
if ($ForumID == STAFF_FORUM) {
send_irc('PRIVMSG '.ADMIN_CHAN.' :!mod Poll created by '.$LoggedUser['Username'].": \"$Question\" https://".SSL_SITE_URL.'/forums.php?action=viewthread&threadid='.$TopicID);
send_irc('PRIVMSG '.ADMIN_CHAN.' :!mod Poll created by '.$LoggedUser['Username'].": \"$Question\" https://".SSL_SITE_URL."/forums.php?action=viewthread&threadid=$TopicID");
}
}
// if cache exists modify it, if not, then it will be correct when selected next, and we can skip this block
if ($Forum = $Cache->get_value('forums_'.$ForumID)) {
if ($Forum = $Cache->get_value("forums_$ForumID")) {
list($Forum,,,$Stickies) = $Forum;
// Remove the last thread from the index
@ -181,7 +181,7 @@
)); // Bumped
$Forum = $Part1 + $Part2 + $Part3;
$Cache->cache_value('forums_'.$ForumID, array($Forum, '', 0, $Stickies), 0);
$Cache->cache_value("forums_$ForumID", array($Forum, '', 0, $Stickies), 0);
// Update the forum root
$Cache->begin_transaction('forums_list');
@ -202,7 +202,7 @@
$Cache->delete_value('forums_list');
}
$Cache->begin_transaction('thread_'.$TopicID.'_catalogue_0');
$Cache->begin_transaction("thread_$TopicID".'_catalogue_0');
$Post = array(
'ID' => $PostID,
'AuthorID' => $LoggedUser['ID'],
@ -214,12 +214,10 @@
$Cache->insert('', $Post);
$Cache->commit_transaction(0);
$Cache->begin_transaction('thread_'.$TopicID.'_info');
$Cache->begin_transaction("thread_$TopicID".'_info');
$Cache->update_row(false, array('Posts' => '+1', 'LastPostAuthorID' => $LoggedUser['ID']));
$Cache->commit_transaction(0);
header("Location: forums.php?action=viewthread&threadid=$TopicID");
die();

View File

@ -149,7 +149,7 @@
WHERE ID = '$TopicID'");
// if cache exists modify it, if not, then it will be correct when selected next, and we can skip this block
if ($Forum = $Cache->get_value('forums_'.$ForumID)) {
if ($Forum = $Cache->get_value("forums_$ForumID")) {
list($Forum,,,$Stickies) = $Forum;
// if the topic is already on this page
@ -179,8 +179,8 @@
f.NumPosts,
ISNULL(p.TopicID) AS NoPoll
FROM forums_topics AS f
LEFT JOIN forums_polls AS p ON p.TopicID=f.ID
WHERE f.ID ='$TopicID'");
LEFT JOIN forums_polls AS p ON p.TopicID = f.ID
WHERE f.ID = '$TopicID'");
list($AuthorID,$IsLocked,$IsSticky,$NumPosts,$NoPoll) = $DB->next_record();
$Part2 = array($TopicID => array(
'ID' => $TopicID,

View File

@ -28,7 +28,7 @@
}
if (isset($_GET['id'])) {
if (!is_number($_GET['id']) && $View != 'type') {
if (!is_number($_GET['id']) && $View !== 'type') {
error(404);
} else {
$ID = db_string($_GET['id']);
@ -218,11 +218,11 @@
<? include('header.php'); ?>
</div>
<div class="buttonbox thin center">
<? if ($View != 'resolved') { ?>
<? if ($View !== 'resolved') { ?>
<span title="Resolves *all* checked reports with their respective resolutions"><input type="button" onclick="MultiResolve();" value="Multi-resolve" /></span>
<span title="Assigns all of the reports on the page to you!"><input type="button" onclick="Grab();" value="Claim all" /></span>
<? }
if ($View == 'staff' && $LoggedUser['ID'] == $ID) { ?>
if ($View === 'staff' && $LoggedUser['ID'] == $ID) { ?>
| <span title="Unclaim all of the reports currently displayed"><input type="button" onclick="GiveBack();" value="Unclaim all" /></span>
<? } ?>
</div>
@ -232,7 +232,7 @@
</div>
<div id="all_reports" style="width: 80%; margin-left: auto; margin-right: auto;">
<?
if (count($Reports) == 0) {
if (count($Reports) === 0) {
?>
<div>
<table class="layout">
@ -406,7 +406,8 @@
<?=str_replace(' ', ', ', $Tracks)?>
</td>
</tr>
<? }
<?
}
if ($Links) { ?>
<tr>
@ -420,8 +421,7 @@
$Link = $local_url;
} ?>
<a href="<?=$Link?>"><?=$Link?></a>
<?
} ?>
<? } ?>
</td>
</tr>
<?
@ -507,8 +507,7 @@
foreach ($Images as $Image) {
?>
<img style="max-width: 200px;" onclick="lightbox.init(this, 200);" src="<?=ImageTools::process($Image)?>" alt="Relevant image" />
<?
} ?>
<? } ?>
</td>
</tr>
<?
@ -562,11 +561,9 @@
<span title="Warning length in weeks">
<strong>Warning</strong>
<select name="warning" id="warning<?=$ReportID?>">
<?
for ($i = 0; $i < 9; $i++) { ?>
<? for ($i = 0; $i < 9; $i++) { ?>
<option value="<?=$i?>"><?=$i?></option>
<?
} ?>
<? } ?>
</select>
</span>
<span title="Remove upload privileges?">

View File

@ -432,20 +432,21 @@
<td class="label" valign="top">Fill request</td>
<td>
<form class="edit_form" name="request" action="" method="post">
<div>
<div class="field_div">
<input type="hidden" name="action" value="takefill" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="requestid" value="<?=$RequestID?>" />
<input type="text" size="50" name="link"<?=(!empty($Link) ? " value=\"$Link\"" : '')?> />
<br />
<strong>Should be the permalink (PL) to the torrent (e.g. https://<?=SSL_SITE_URL?>/torrents.php?torrentid=xxxx).</strong>
<br />
<br />
<? if (check_perms('site_moderate_requests')) { ?>
</div>
<? if (check_perms('site_moderate_requests')) { ?>
<div class="field_div">
For user: <input type="text" size="25" name="user"<?=(!empty($FillerUsername) ? " value=\"$FillerUsername\"" : '')?> />
<br />
<? } ?>
</div>
<? } ?>
<div class="submit_div">
<input type="submit" value="Fill request" />
<br />
</div>
</form>
</td>

View File

@ -125,13 +125,13 @@
<td>Hits</td>
</tr>
<?
if (count($CachedScripts) == 0) { // Uh-oh, try again.
if (count($CachedScripts) === 0) { // Uh-oh, try again.
echo '<tr><td colspan="5">No scripts cached.</td></tr>';
}
$Row = 'a'; // For the pretty colours
foreach ($CachedScripts as $Script) {
list($FilePath, $Modified, $Size, $Reloads, $Uses, $Hits) = array_values($Script);
$Row = ($Row == 'a') ? 'b' : 'a';
$Row = $Row === 'a' ? 'b' : 'a';
?>
<tr class="row<?=$Row?>">
<td><?=$FilePath?></td>

View File

@ -10,11 +10,11 @@
$Limit = 25;
if ($_GET['tags']) {
$Tags = explode(',', str_replace(".","_",trim($_GET['tags'])));
$Tags = explode(',', str_replace('.', '_', trim($_GET['tags'])));
foreach ($Tags as $Tag) {
$Tag = preg_replace('/[^a-z0-9_]/', '', $Tag);
if ($Tag != '') {
$Where[]="g.TagList REGEXP '[[:<:]]".db_string($Tag)."[[:>:]]'";
$Where[] = "g.TagList REGEXP '[[:<:]]".db_string($Tag)."[[:>:]]'";
}
}
}
@ -35,7 +35,7 @@
}
$Filtered = !empty($Where);
if ($_GET['anyall'] == 'any' && !empty($Where)) {
if ($_GET['anyall'] === 'any' && !empty($Where)) {
$Where = '('.implode(' OR ', $Where).')';
} else {
$Where = implode(' AND ', $Where);
@ -45,15 +45,21 @@
// Unlike the other top 10s, this query just gets some raw stats
// We'll need to do some fancy-pants stuff to translate it into
// BPCI scores before getting the torrent data
$Query = 'SELECT v.GroupID, v.Ups, v.Total, v.Score
FROM torrents_votes AS v';
$Query = '
SELECT v.GroupID, v.Ups, v.Total, v.Score
FROM torrents_votes AS v';
if (!empty($Where)) {
$Query .= " JOIN torrents_group AS g ON g.ID = v.GroupID
WHERE $Where AND ";
$Query .= "
JOIN torrents_group AS g ON g.ID = v.GroupID
WHERE $Where AND ";
} else {
$Query .= ' WHERE ';
$Query .= '
WHERE ';
}
$Query .= "Score > 0 ORDER BY Score DESC LIMIT $Limit";
$Query .= "
Score > 0
ORDER BY Score DESC
LIMIT $Limit";
$TopVotes = $Cache->get_value('top10votes_'.$Limit.$WhereSum);
if ($TopVotes === false) {
@ -73,14 +79,14 @@
$TopVotes[$GroupID]['Score'] = $Data[$GroupID]['Score'];
}
$Cache->cache_value('top10votes_'.$Limit.$WhereSum,$TopVotes,60*30);
$Cache->cache_value('top10votes_'.$Limit.$WhereSum, $TopVotes, 60 * 30);
$Cache->clear_query_lock('top10votes');
} else {
$TopVotes = false;
}
}
View::show_header('Top '.$Limit.' Voted Groups','browse,voting');
View::show_header("Top $Limit Voted Groups",'browse,voting');
?>
<div class="thin">
<div class="header">
@ -103,8 +109,8 @@
<td class="label">Tags (comma-separated):</td>
<td class="ft_taglist">
<input type="text" name="tags" size="75" value="<? if (!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />&nbsp;
<input type="radio" id="rdoAll" name="anyall" value="all"<?=($_GET['anyall'] != 'any' ? ' checked="checked"' : '')?> /><label for="rdoAll"> All</label>&nbsp;&nbsp;
<input type="radio" id="rdoAny" name="anyall" value="any"<?=($_GET['anyall'] == 'any' ? ' checked="checked"' : '')?> /><label for="rdoAny"> Any</label>
<input type="radio" id="rdoAll" name="anyall" value="all"<?=($_GET['anyall'] !== 'any' ? ' checked="checked"' : '')?> /><label for="rdoAll"> All</label>&nbsp;&nbsp;
<input type="radio" id="rdoAny" name="anyall" value="any"<?=($_GET['anyall'] === 'any' ? ' checked="checked"' : '')?> /><label for="rdoAny"> Any</label>
</td>
</tr>
<tr id="yearfilter">
@ -127,7 +133,7 @@
$Bookmarks = Bookmarks::all_bookmarks('torrent');
?>
<h3>Top <?=$Limit.' '.$Caption?>
<h3>Top <?="$Limit $Caption"?>
<?
if (empty($_GET['advanced'])) { ?>
<small class="top10_quantity_links">
@ -205,7 +211,7 @@
<tr class="group discog<?=$SnatchedGroupClass?>" id="group_<?=$GroupID?>">
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="show_torrents">
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups on this page."></a>
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event);" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups on this page."></a>
</div>
</td>
<td class="center">
@ -221,9 +227,9 @@
<strong><?=$DisplayName?></strong> <!--<?Votes::vote_link($GroupID,$UserVotes[$GroupID]['Type']);?>-->
<? if ($IsBookmarked) { ?>
<span class="bookmark" style="float: right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a></span>
<span class="bookmark" style="float: right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Unbookmark</a></span>
<? } else { ?>
<span class="bookmark" style="float: right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a></span>
<span class="bookmark" style="float: right;"><a href="#" class="bookmarklink_torrent_<?=$GroupID?> brackets add_bookmark" title="Add bookmark" onclick="Bookmark('torrent', <?=$GroupID?>, 'Unbookmark'); return false;">Bookmark</a></span>
<? } ?>
<div class="tags"><?=$TorrentTags->format()?></div>
@ -258,7 +264,7 @@
$EditionID++;
?>
<tr class="group_torrent groupid_<?=$GroupID?> edition<?=$SnatchedGroupClass?> hidden">
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=Torrents::edition_string($Torrent, $Group)?></strong></td>
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event);" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?=Torrents::edition_string($Torrent, $Group)?></strong></td>
</tr>
<?
}
@ -325,9 +331,9 @@
<? } ?>
| <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" title="Report">RP</a>
<? if ($IsBookmarked) { ?>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Unbookmark</a>
<? } else { ?>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a>
| <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark" title="Add bookmark" onclick="Bookmark('torrent', <?=$GroupID?>, 'Unbookmark'); return false;">Bookmark</a>
<? } ?>
]
</span>
@ -342,7 +348,7 @@
</tr>
<?
endif;
$TorrentTable.=ob_get_clean();
$TorrentTable .= ob_get_clean();
}
?>
<table class="torrent_table grouping cats" id="discog_table">
@ -361,7 +367,7 @@
<td colspan="7" class="center">Server is busy processing another top list request. Please try again in a minute.</td>
</tr>
<?
} elseif (count($TopVotes) == 0) { ?>
} elseif (count($TopVotes) === 0) { ?>
<tr>
<td colspan="7" class="center">No torrents were found that meet your criteria.</td>
</tr>

View File

@ -104,7 +104,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
$Cache->commit_transaction(0);
// Use default search options
} elseif (empty($_SERVER['QUERY_STRING']) || (count($_GET) == 1 && isset($_GET['page']))) {
} elseif (empty($_SERVER['QUERY_STRING']) || (count($_GET) === 1 && isset($_GET['page']))) {
if (!empty($LoggedUser['DefaultSearch'])) {
if (!empty($_GET['page'])) {
$Page = $_GET['page'];
@ -438,7 +438,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
if (!empty($_GET['year'])) {
$Years = explode('-', $_GET['year']);
if (is_number($Years[0]) || (empty($Years[0]) && !empty($Years[1]) && is_number($Years[1]))) {
if (count($Years) == 1) {
if (count($Years) === 1) {
$SphQL->where('year', (int)$Years[0]);
$SphQLTor->where('year', (int)$Years[0]);
} else {
@ -455,7 +455,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
}
if (isset($_GET['haslog']) && $_GET['haslog'] !== '') {
if ($_GET['haslog'] == 100) {
if ($_GET['haslog'] === '100') {
$SphQL->where('logscore', 100);
$SphQLTor->where('logscore', 100);
$Filtered = true;
@ -879,7 +879,7 @@ function header_link($SortKey, $DefaultWay = 'desc') {
<input type="submit" value="Filter torrents" />
<input type="hidden" name="action" id="ft_type" value="<?=($AdvancedSearch ? 'advanced' : 'basic')?>" />
<input type="hidden" name="searchsubmit" value="1" />
<input type="button" value="Reset" onclick="location.href = 'torrents.php<? if (isset($_GET['action']) && $_GET['action'] == 'advanced') { ?>?action=advanced<? } ?>'" />
<input type="button" value="Reset" onclick="location.href = 'torrents.php<? if (isset($_GET['action']) && $_GET['action'] === 'advanced') { ?>?action=advanced<? } ?>'" />
&nbsp;&nbsp;
<? if ($Filtered) { ?>
<input type="submit" name="setdefault" value="Make default" />

View File

@ -151,7 +151,7 @@
'Artist' => $Artists,
'WikiImage' => $Image);
if (!in_array($Snatch, $RecentSnatches)) {
if (count($RecentSnatches) == 5) {
if (count($RecentSnatches) === 5) {
array_pop($RecentSnatches);
}
array_unshift($RecentSnatches, $Snatch);

View File

@ -2,7 +2,7 @@
function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProperties = true, $ApiCall = false) {
global $Cache, $DB;
if (!$RevisionID) {
$TorrentCache = $Cache->get_value('torrents_details_'.$GroupID);
$TorrentCache = $Cache->get_value("torrents_details_$GroupID");
// This block can be used to test if the cached data predates structure changes
if (isset($TorrentCache[0][0])) {
@ -122,10 +122,10 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProp
t.ID");
$TorrentList = $DB->to_array('ID', MYSQLI_ASSOC);
if (count($TorrentList) == 0 && $ApiCall == false) {
if (count($TorrentList) === 0 && $ApiCall == false) {
header('Location: log.php?search='.(empty($_GET['torrentid']) ? "Group+$GroupID" : "Torrent+$_GET[torrentid]"));
die();
} else if (count($TorrentList) == 0 && $ApiCall == true) {
} else if (count($TorrentList) === 0 && $ApiCall == true) {
return NULL;
}
if (in_array(0, $DB->collect('Seeders'))) {

View File

@ -80,10 +80,10 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
}
if (isset($_GET['log']) && in_array($_GET['log'], array('1', '0', '100', '-1'))) {
if ($_GET['log'] == '100') {
if ($_GET['log'] === '100') {
$SearchWhere[] = "t.HasLog = '1'";
$SearchWhere[] = "t.LogScore = '100'";
} elseif ($_GET['log'] == '-1') {
} elseif ($_GET['log'] === '-1') {
$SearchWhere[] = "t.HasLog = '1'";
$SearchWhere[] = "t.LogScore < '100'";
} else {
@ -125,7 +125,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
}
}
if (!empty($TagList)) {
if (isset($_GET['tags_type']) && $_GET['tags_type'] != 1) {
if (isset($_GET['tags_type']) && $_GET['tags_type'] !== '1') {
$_GET['tags_type'] = '0';
$SearchWhere[] = '('.implode(' OR ', $TagList).')';
} else {
@ -194,7 +194,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
JOIN torrents AS t ON t.ID = xfu.fid";
break;
case 'uploaded':
if ((empty($_GET['filter']) || $_GET['filter'] != 'perfectflac') && !check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) {
if ((empty($_GET['filter']) || $_GET['filter'] !== 'perfectflac') && !check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
$Time = 'unix_timestamp(t.Time)';
@ -218,7 +218,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
}
if (!empty($_GET['filter'])) {
if ($_GET['filter'] == 'perfectflac') {
if ($_GET['filter'] === 'perfectflac') {
if (!check_paranoia('perfectflacs', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
@ -229,11 +229,11 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
t.LogScore = 100 OR
t.Media IN ('Vinyl', 'WEB', 'DVD', 'Soundboard', 'Cassette', 'SACD', 'Blu-ray', 'DAT')
)";
} elseif (strtoupper($_GET['media']) == 'CD' && empty($_GET['log'])) {
} elseif (strtoupper($_GET['media']) === 'CD' && empty($_GET['log'])) {
$ExtraWhere .= "
AND t.LogScore = 100";
}
} elseif ($_GET['filter'] == 'uniquegroup') {
} elseif ($_GET['filter'] === 'uniquegroup') {
if (!check_paranoia('uniquegroups', $User['Paranoia'], $UserClass, $UserID)) {
error(403);
}
@ -245,7 +245,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
$GroupBy = 't.ID';
}
if ((empty($_GET['search']) || trim($_GET['search']) == '') && $Order != 'Name') {
if ((empty($_GET['search']) || trim($_GET['search']) === '') && $Order != 'Name') {
$SQL = "
SELECT
SQL_CALC_FOUND_ROWS
@ -295,7 +295,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
$SearchWhere
GROUP BY TorrentID, Time");
if (!empty($_GET['search']) && trim($_GET['search']) != '') {
if (!empty($_GET['search']) && trim($_GET['search']) !== '') {
$Words = array_unique(explode(' ', db_string($_GET['search'])));
}
@ -410,8 +410,8 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
<td class="label"><strong>Tags:</strong></td>
<td>
<input type="text" name="tags" size="60" title="Use !tag to exclude tag" value="<?Format::form('tags')?>" />&nbsp;
<input type="radio" name="tags_type" id="tags_type0" value="0"<?Format::selected('tags_type',0,'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1"<?Format::selected('tags_type',1,'checked')?> /><label for="tags_type1"> All</label>
<input type="radio" name="tags_type" id="tags_type0" value="0"<?Format::selected('tags_type', 0, 'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
<input type="radio" name="tags_type" id="tags_type1" value="1"<?Format::selected('tags_type', 1, 'checked')?> /><label for="tags_type1"> All</label>
</td>
</tr>
@ -437,7 +437,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
$x = 0;
reset($Categories);
foreach ($Categories as $CatKey => $CatName) {
if ($x % 7 == 0) {
if ($x % 7 === 0) {
if ($x > 0) {
?>
</tr>
@ -461,7 +461,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
</div>
</form>
</div>
<? if (count($GroupIDs) == 0) { ?>
<? if (count($GroupIDs) === 0) { ?>
<div class="center">
Nothing found!
</div>
@ -499,13 +499,13 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
unset($ExtendedArtists[3]);
$DisplayName = Artists::display_artists($ExtendedArtists);
} elseif (!empty($Artists)) {
$DisplayName = Artists::display_artists(array(1=>$Artists));
$DisplayName = Artists::display_artists(array(1 => $Artists));
} else {
$DisplayName = '';
}
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
$DisplayName .= '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if ($GroupYear > 0) {
$DisplayName.=" [$GroupYear]";
$DisplayName .= " [$GroupYear]";
}
if ($GroupVanityHouse) {
$DisplayName .= ' [<abbr title="This is a Vanity House release">VH</abbr>]';
@ -513,7 +513,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
$ExtraInfo = Torrents::torrent_info($Torrent);
if ($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo;
$DisplayName .= ' - '.$ExtraInfo;
}
?>
<tr class="torrent torrent_row<?=($Torrent['IsSnatched'] ? ' snatched_torrent' : '') . ($GroupFlags['IsSnatched'] ? ' snatched_group' : '')?>">
@ -536,7 +536,7 @@ function header_link($SortKey, $DefaultWay = 'DESC') {
<div class="tags"><?=$TorrentTags->format('torrents.php?type='.$Action.'&amp;userid='.$UserID.'&amp;tags=')?></div>
</div>
</td>
<td class="nobr"><?=time_diff($Time,1)?></td>
<td class="nobr"><?=time_diff($Time, 1)?></td>
<td class="nobr"><?=Format::get_size($Torrent['Size'])?></td>
<td><?=number_format($Torrent['Snatched'])?></td>
<td<?=(($Torrent['Seeders'] == 0) ? ' class="r00"' : '')?>><?=number_format($Torrent['Seeders'])?></td>

View File

@ -35,7 +35,7 @@
SELECT Username
FROM users_main
WHERE ID = $UserID");
list($Username)= $DB->next_record();
list($Username) = $DB->next_record();
View::show_header("Email history for $Username");
// Get current email (and matches)
@ -91,13 +91,13 @@
// Matches for current email
if ($CurrentEmail['Usernames'] != '') {
$UserIDs=explode('|', $CurrentEmail['UserIDs']);
$Usernames=explode('|', $CurrentEmail['Usernames']);
$UsersEnabled=explode('|', $CurrentEmail['UsersEnabled']);
$UsersDonor=explode('|', $CurrentEmail['UsersDonor']);
$UsersWarned=explode('|', $CurrentEmail['UsersWarned']);
$UserSetTimes=explode('|', $CurrentEmail['UserSetTimes']);
$UserIPs=explode('|', $CurrentEmail['UserIPs']);
$UserIDs = explode('|', $CurrentEmail['UserIDs']);
$Usernames = explode('|', $CurrentEmail['Usernames']);
$UsersEnabled = explode('|', $CurrentEmail['UsersEnabled']);
$UsersDonor = explode('|', $CurrentEmail['UsersDonor']);
$UsersWarned = explode('|', $CurrentEmail['UsersWarned']);
$UserSetTimes = explode('|', $CurrentEmail['UserSetTimes']);
$UserIPs = explode('|', $CurrentEmail['UserIPs']);
foreach ($UserIDs as $Key => $Val) {
$CurrentMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val, true, true, true);
@ -107,7 +107,7 @@
}
// Email history records
if (count($History) == 1) {
if (count($History) === 1) {
$Invite['Email'] = $History[0]['Email'];
$Invite['EndTime'] = $Joined;
$Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
@ -229,14 +229,14 @@
<td>Set from IP</td>
</tr>
<?
$j=0;
$j = 0;
// Old email
foreach ($Old as $Record) {
++$j;
// Matches on old email
ob_start();
$i=0;
$i = 0;
foreach ($OldMatches as $Match) {
if ($Match['Email'] == $Record['Email']) {
++$i;

View File

@ -1,5 +1,6 @@
var username;
var postid;
var url = new URL();
function QuoteJump(event, post) {
var button = event.button;
@ -23,7 +24,9 @@ var original_post;
function Quote(post, user, link) {
username = user;
postid = post;
if(!$('#reply_box').length) {
// check if reply_box element exists and that user is in the forums
if(!$('#reply_box').length && url.path == "forums") {
if ($("#quote_" + postid).text() == "Quote") {
original_post = $("#content" + postid).html();
$("#quote_" + postid).text("Unquote");