Empty commit

This commit is contained in:
Git 2013-05-28 08:01:02 +00:00
parent b3cc179926
commit 07804af8e4
64 changed files with 450 additions and 408 deletions

View File

@ -9,7 +9,7 @@ public function __construct($Type, $Width, $Height, $Options) {
if ($Width * $Height > 300000 || $Height > 1000 || $Width > 1000) {
trigger_error('Tried to make chart too large.');
}
$this->URL .= '?cht='.$Type.'&chs='.$Width.'x'.$Height;
$this->URL .= "?cht=$Type&chs={$Width}x$Height";
$this->Options = $Options;
}
@ -18,18 +18,18 @@ protected function encode($Number) {
return '__';
}
$CharKey = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.';
return $CharKey[floor($Number/64)].$CharKey[floor($Number%64)];
return $CharKey[floor($Number / 64)].$CharKey[floor($Number % 64)];
}
public function color($Colors) {
$this->URL .= '&chco='.$Colors;
}
public function lines($Thickness, $Solid=1, $Blank=0) {
$this->URL .= '&chls='.$Thickness.','.$Solid.','.$Blank;
public function lines($Thickness, $Solid = 1, $Blank = 0) {
$this->URL .= "&chls=$Thickness,$Solid,$Blank";
}
public function title($Title, $Color='', $Size='') {
public function title($Title, $Color = '', $Size = '') {
$this->URL .= '&chtt='.str_replace(array(' ',"\n"), array('+','|'), $Title);
if (!empty($Color)) {
$this->URL .= '&chts='.$Color;
@ -39,10 +39,10 @@ public function title($Title, $Color='', $Size='') {
}
}
public function legend($Items, $Placement='') {
public function legend($Items, $Placement = '') {
$this->URL .= '&chdl='.str_replace(' ', '+', implode('|', $Items));
if (!empty($Placement)) {
if (!in_array($Placement, array('b','t','r','l','bv','tv'))) {
if (!in_array($Placement, array('b', 't', 'r', 'l', 'bv', 'tv'))) {
trigger_error('Invalid legend placement.');
}
$this->URL .= '&chdlp='.$Placement;
@ -56,9 +56,9 @@ public function add($Label, $Data) {
$this->Data[] = $Data;
}
public function grid_lines($SpacingX=0, $SpacingY=-1, $Solid=1, $Blank=1) {
public function grid_lines($SpacingX = 0, $SpacingY = -1, $Solid = 1, $Blank = 1) {
//Can take 2 more parameters for offset, but we're not bothering with that right now
$this->URL .= '&chg='.$SpacingX.','.$SpacingY.','.$Solid.','.$Blank.'';
$this->URL .= "&chg=$SpacingX,$SpacingY,$Solid,$Blank";
}
public function transparent() {
@ -72,7 +72,7 @@ public function url() {
}
class AREA_GRAPH extends GOOGLE_CHARTS {
public function __construct ($Width, $Height, $Options=array()) {
public function __construct ($Width, $Height, $Options = array()) {
parent::__construct('lc', $Width, $Height, $Options);
}
@ -82,18 +82,18 @@ public function color ($Color) {
public function generate() {
$Max = max($this->Data);
$Min = (isset($this->Options['Break']))?$Min=min($this->Data):0;
$Min = ((isset($this->Options['Break'])) ? $Min = min($this->Data) : 0);
$Data = array();
foreach ($this->Data as $Value) {
$Data[] = $this->encode((($Value-$Min)/($Max-$Min))*4095);
$Data[] = $this->encode((($Value - $Min) / ($Max - $Min)) * 4095);
}
$this->URL .= "&chxt=y,x&chxs=0,h&chxl=1:|".implode('|', $this->Labels).'&chxr=0,'.$Min.','.($Max-$Min).'&chd=e:'.implode('', $Data);
$this->URL .= "&chxt=y,x&chxs=0,h&chxl=1:|".implode('|', $this->Labels).'&chxr=0,'.$Min.','.($Max - $Min).'&chd=e:'.implode('', $Data);
}
}
class PIE_CHART extends GOOGLE_CHARTS {
public function __construct ($Width, $Height, $Options=array()) {
$Type = (isset($this->Options['3D']))?'p3':'p';
public function __construct ($Width, $Height, $Options = array()) {
$Type = ((isset($this->Options['3D'])) ? 'p3' : 'p');
parent::__construct($Type, $Width, $Height, $Options);
}
@ -116,8 +116,8 @@ public function generate() {
$OtherData = 0;
foreach ($this->Data as $Key => $Value) {
$ThisPercentage = number_format(($Value/$Sum)*100, 2);
$ThisData = ($Value/$Sum)*4095;
$ThisPercentage = number_format(($Value / $Sum) * 100, 2);
$ThisData = ($Value / $Sum) * 4095;
if ($Other && $ThisPercentage < 1) {
$OtherPercentage += $ThisPercentage;
$OtherData += $ThisData;
@ -145,7 +145,7 @@ public function generate() {
class LOG_BAR_GRAPH extends GOOGLE_CHARTS {
//TODO: Finish.
public function __construct ($Base, $Width, $Height, $Options=array()) {
public function __construct ($Base, $Width, $Height, $Options = array()) {
parent::__construct('lc', $Width, $Height, $Options);
}
@ -155,10 +155,10 @@ public function color ($Color) {
public function generate() {
$Max = max($this->Data);
$Min = (isset($this->Options['Break']))?$Min=min($this->Data):0;
$Min = ((isset($this->Options['Break'])) ? $Min = min($this->Data) : 0);
$Data = array();
foreach ($this->Data as $Value) {
$Data[] = $this->encode((($Value-$Min)/($Max-$Min))*4095);
$Data[] = $this->encode((($Value - $Min) / ($Max - $Min)) * 4095);
}
$this->URL .= "&amp;chxt=y,x&amp;chxs=0,h&amp;chxl=1:|".implode('|', $this->Labels).'&amp;chxr=0,'.$Min.','.($Max-$Min).'&amp;chd=e:'.implode('', $Data);
}
@ -171,23 +171,23 @@ public function __construct () {
public function add($Label, $Data) {
if ($Label !== false) {
$this->Labels[] = Format::cut_string($Label,35);
$this->Labels[] = Format::cut_string($Label, 35);
}
$this->Data[] = $Data;
}
public function generate() {
$Count = count($this->Data);
$Height = (30*$Count)+20;
$Height = (30 * $Count) + 20;
$Max = max($this->Data);
$Sum = array_sum($this->Data);
$Increment = ($Max/$Sum)*25; // * 100% / 4divisions
$Increment = ($Max / $Sum) * 25; // * 100% / 4divisions
$Data = array();
$Labels = array();
foreach ($this->Data as $Key => $Value) {
$Data[] = $this->encode(($Value/$Max)*4095);
$Labels[] = '@t'.str_replace(array(' ',','),array('+','\,'),$this->Labels[$Key]).',000000,1,'.round((($Key + 1)/$Count) - (12/$Height),2).':0,12';
$Data[] = $this->encode(($Value / $Max) * 4095);
$Labels[] = '@t'.str_replace(array(' ', ','),array('+', '\,'), $this->Labels[$Key]).',000000,1,'.round((($Key + 1) / $Count) - (12 / $Height), 2).':0,12';
}
$this->URL .= "&amp;chbh=25,0,5&amp;chs=214x$Height&amp;chl=0%|".round($Increment,1)."%|".round($Increment * 2,1)."%|".round($Increment * 3,1)."%|".round($Increment * 4,1)."%&amp;chm=".implode('|', $Labels).'&amp;chd=e:'.implode('', $Data);
$this->URL .= "&amp;chbh=25,0,5&amp;chs=214x$Height&amp;chl=0%|".round($Increment, 1)."%|".round($Increment * 2, 1)."%|".round($Increment * 3, 1)."%|".round($Increment * 4, 1)."%&amp;chm=".implode('|', $Labels).'&amp;chd=e:'.implode('', $Data);
}
}

View File

@ -3,7 +3,7 @@
ini_set('max_execution_time',600);
define('MAX_TIME', 20000); //Maximum execution time in ms
define('MAX_ERRORS', 0); //Maxmimum errors, warnings, notices we will allow in a page
define('MAX_MEMORY', 80*1024*1024); //Maximum memory used per pageload
define('MAX_MEMORY', 80 * 1024 * 1024); //Maximum memory used per pageload
define('MAX_QUERIES', 30); //Maxmimum queries
class DEBUG {
@ -12,7 +12,7 @@ class DEBUG {
public $Perf = array();
private $LoggedVars = array();
public function profile($Automatic='') {
public function profile($Automatic = '') {
global $ScriptStartTime;
$Reason = array();
@ -20,14 +20,14 @@ public function profile($Automatic='') {
$Reason[] = $Automatic;
}
$Micro = (microtime(true)-$ScriptStartTime)*1000;
$Micro = (microtime(true) - $ScriptStartTime) * 1000;
if ($Micro > MAX_TIME && !defined('TIME_EXCEPTION')) {
$Reason[] = number_format($Micro, 3).' ms';
}
$Errors = count($this->get_errors());
if ($Errors > MAX_ERRORS && !defined('ERROR_EXCEPTION')) {
$Reason[] = $Errors.' PHP Errors';
$Reason[] = $Errors.' PHP errors';
}
/*
$Queries = count($this->get_queries());
@ -37,7 +37,7 @@ public function profile($Automatic='') {
*/
$Ram = memory_get_usage(true);
if ($Ram > MAX_MEMORY && !defined('MEMORY_EXCEPTION')) {
$Reason[] = Format::get_size($Ram).' Ram Used';
$Reason[] = Format::get_size($Ram).' RAM used';
}
if (isset($_REQUEST['profile'])) {
@ -45,7 +45,7 @@ public function profile($Automatic='') {
$Reason[] = 'Requested by '.$LoggedUser['Username'];
}
$this->Perf['Memory usage'] = (($Ram>>10)/1024).' MB';
$this->Perf['Memory usage'] = (($Ram>>10) / 1024).' MB';
$this->Perf['Page process time'] = number_format($Micro / 1000, 3).' s';
$this->Perf['CPU time'] = number_format($this->get_cpu_time() / 1000000, 3).' s';
@ -57,7 +57,7 @@ public function profile($Automatic='') {
return false;
}
public function analysis($Message, $Report='', $Time=43200) {
public function analysis($Message, $Report = '', $Time = 43200) {
global $Cache, $Document;
if (empty($Report)) {
$Report = $Message;
@ -78,14 +78,14 @@ public function analysis($Message, $Report='', $Time=43200) {
),
$Time
);
send_irc('PRIVMSG '.LAB_CHAN.' :'.$Message.' '.$Document.' '.' https://'.SSL_SITE_URL.'/tools.php?action=analysis&case='.$Identifier.' https://'.SSL_SITE_URL.$_SERVER['REQUEST_URI']);
send_irc('PRIVMSG '.LAB_CHAN." :{$Message} $Document https://".SSL_SITE_URL.'/tools.php?action=analysis&case='.$Identifier.' https://'.SSL_SITE_URL.$_SERVER['REQUEST_URI']);
}
public function get_cpu_time() {
if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
global $CPUTimeStart;
$RUsage = getrusage();
$CPUTime = $RUsage['ru_utime.tv_sec']*1000000 + $RUsage['ru_utime.tv_usec'] - $CPUTimeStart;
$CPUTime = $RUsage['ru_utime.tv_sec'] * 1000000 + $RUsage['ru_utime.tv_usec'] - $CPUTimeStart;
return $CPUTime;
}
return false;
@ -122,9 +122,9 @@ protected function format_args($Array) {
$Return[$Key] .= "'$Key' => ";
}
if ($Val === true) {
$Return[$Key] .= "true";
$Return[$Key] .= 'true';
} elseif ($Val === false) {
$Return[$Key] .= "false";
$Return[$Key] .= 'false';
} elseif (is_string($Val)) {
$Return[$Key] .= "'$Val'";
} elseif (is_int($Val)) {
@ -223,7 +223,7 @@ public function get_flags() {
return $this->Flags;
}
public function get_errors($Light=false) {
public function get_errors($Light = false) {
//Because the cache can't take some of these variables
if ($Light) {
foreach ($this->Errors as $Key => $Value) {
@ -304,7 +304,7 @@ public function get_logged_vars() {
/* Output Formatting */
public function perf_table($Perf=false) {
public function perf_table($Perf = false) {
if (!is_array($Perf)) {
$Perf = $this->get_perf();
}
@ -332,7 +332,7 @@ public function perf_table($Perf=false) {
<?
}
public function include_table($Includes=false) {
public function include_table($Includes = false) {
if (!is_array($Includes)) {
$Includes = $this->get_includes();
}
@ -356,7 +356,7 @@ public function include_table($Includes=false) {
<?
}
public function class_table($Classes=false) {
public function class_table($Classes = false) {
if (!is_array($Classes)) {
$Classes = $this->get_classes();
}
@ -393,7 +393,7 @@ public function extension_table() {
<?
}
public function flag_table($Flags=false) {
public function flag_table($Flags = false) {
if (!is_array($Flags)) {
$Flags = $this->get_flags();
}
@ -434,7 +434,7 @@ public function flag_table($Flags=false) {
<?
}
public function constant_table($Constants=false) {
public function constant_table($Constants = false) {
if (!is_array($Constants)) {
$Constants = $this->get_constants();
}
@ -454,7 +454,7 @@ public function constant_table($Constants=false) {
<?
}
public function cache_table($CacheKeys=false) {
public function cache_table($CacheKeys = false) {
global $Cache;
$Header = 'Cache keys';
if (!is_array($CacheKeys)) {
@ -464,7 +464,7 @@ public function cache_table($CacheKeys=false) {
if (empty($CacheKeys)) {
return;
}
$Header = ' '.number_format(count($CacheKeys)).' '.$Header.':';
$Header = ' '.number_format(count($CacheKeys))." $Header:";
?>
<table class="layout" width="100%">
@ -487,7 +487,7 @@ public function cache_table($CacheKeys=false) {
<?
}
public function error_table($Errors=false) {
public function error_table($Errors = false) {
if (!is_array($Errors)) {
$Errors = $this->get_errors();
}
@ -503,7 +503,7 @@ public function error_table($Errors=false) {
<table id="debug_error" class="debug_table hidden" width="100%">
<?
foreach ($Errors as $Error) {
list($Error,$Location,$Call,$Args) = $Error;
list($Error, $Location, $Call, $Args) = $Error;
?>
<tr valign="top">
<td align="left" class="debug_info debug_error_call">
@ -532,7 +532,7 @@ public function query_table($Queries=false) {
if (empty($Queries)) {
return;
}
$Header = ' '.number_format(count($Queries)).' '.$Header.':';
$Header = ' '.number_format(count($Queries))." $Header:";
?>
<table class="layout" width="100%">
<tr>
@ -542,7 +542,7 @@ public function query_table($Queries=false) {
<table id="debug_database" class="debug_table hidden" width="100%">
<?
foreach ($Queries as $Query) {
list($SQL,$Time) = $Query;
list($SQL, $Time) = $Query;
?>
<tr valign="top">
<td class="debug_data debug_query_data"><div><?=str_replace("\t", '&nbsp;&nbsp;', nl2br(display_str($SQL)))?></div></td>
@ -555,7 +555,7 @@ public function query_table($Queries=false) {
<?
}
public function sphinx_table($Queries=false) {
public function sphinx_table($Queries = false) {
$Header = 'Searches';
if (!is_array($Queries)) {
$Queries = $this->get_sphinx_queries();
@ -567,7 +567,7 @@ public function sphinx_table($Queries=false) {
if (empty($Queries)) {
return;
}
$Header = ' '.number_format(count($Queries)).' '.$Header.':';
$Header = ' '.number_format(count($Queries))." $Header:";
?>
<table class="layout" width="100%">
<tr>
@ -577,7 +577,7 @@ public function sphinx_table($Queries=false) {
<table id="debug_sphinx" class="debug_table hidden" width="100%">
<?
foreach ($Queries as $Query) {
list($Params,$Time) = $Query;
list($Params, $Time) = $Query;
?>
<tr valign="top">
<td class="debug_data debug_sphinx_data"><pre><?=str_replace("\t", ' ', $Params)?></pre></td>
@ -590,7 +590,7 @@ public function sphinx_table($Queries=false) {
<?
}
public function vars_table($Vars=false) {
public function vars_table($Vars = false) {
$Header = 'Logged Variables';
if (empty($Vars)) {
if (empty($this->LoggedVars)) {
@ -598,7 +598,7 @@ public function vars_table($Vars=false) {
}
$Vars = $this->LoggedVars;
}
$Header = ' '.number_format(count($Vars)).' '.$Header.':';
$Header = ' '.number_format(count($Vars))." $Header:";
?>
<table class="layout" width="100%">

View File

@ -8,10 +8,12 @@ function open_feed() {
echo '<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />'."\n";
echo '<meta xmlns="http://pipes.yahoo.com" name="pipes" content="noprocess" />'."\n";
}
function close_feed() {
echo "\t</channel>\n</rss>";
}
function channel($Title, $Description, $Section='') {
function channel($Title, $Description, $Section = '') {
$Site = $this->UseSSL ? 'https://'.SSL_SITE_URL : 'http://'.NONSSL_SITE_URL;
echo "\t\t<title>$Title :: ". SITE_NAME. "</title>\n";
echo "\t\t<link>$Site/$Section</link>\n";
@ -21,13 +23,14 @@ function channel($Title, $Description, $Section='') {
echo "\t\t<docs>http://blogs.law.harvard.edu/tech/rss</docs>\n";
echo "\t\t<generator>Gazelle Feed Class</generator>\n\n";
}
function item($Title, $Description, $Page, $Creator, $Comments='', $Category='', $Date='') { //Escape with CDATA, otherwise the feed breaks.
function item($Title, $Description, $Page, $Creator, $Comments = '', $Category = '', $Date = '') { //Escape with CDATA, otherwise the feed breaks.
if ($Date == '') {
$Date = date('r');
} else {
$Date = date('r',strtotime($Date));
$Date = date('r', strtotime($Date));
}
$Site = $this->UseSSL ? 'https://'.SSL_SITE_URL : 'http://'.NONSSL_SITE_URL;
$Site = ($this->UseSSL ? 'https://'.SSL_SITE_URL : 'http://'.NONSSL_SITE_URL);
$Item = "\t\t<item>\n";
$Item .= "\t\t\t<title><![CDATA[$Title]]></title>\n";
$Item .= "\t\t\t<description><![CDATA[$Description]]></description>\n";
@ -51,14 +54,14 @@ function retrieve($CacheKey, $AuthKey, $PassKey) {
$Entries = array();
} else {
foreach ($Entries as $Item) {
echo str_replace(array('[[PASSKEY]]','[[AUTHKEY]]'),array(display_str($PassKey),display_str($AuthKey)),$Item);
echo str_replace(array('[[PASSKEY]]', '[[AUTHKEY]]'), array(display_str($PassKey), display_str($AuthKey)), $Item);
}
}
}
function populate($CacheKey, $Item) {
global $Cache;
$Entries = $Cache->get_value($CacheKey,true);
$Entries = $Cache->get_value($CacheKey, true);
if (!$Entries) {
$Entries = array();
} else {

View File

@ -9,15 +9,15 @@ class Misc {
* @param string $From The user part of the user@NONSSL_SITE_URL email address.
* @param string $ContentType text/plain or text/html
*/
public static function send_email($To,$Subject,$Body,$From='noreply',$ContentType='text/plain') {
$Headers='MIME-Version: 1.0'."\r\n";
$Headers.='Content-type: '.$ContentType.'; charset=iso-8859-1'."\r\n";
$Headers.='From: '.SITE_NAME.' <'.$From.'@'.NONSSL_SITE_URL.'>'."\r\n";
$Headers.='Reply-To: '.$From.'@'.NONSSL_SITE_URL."\r\n";
$Headers.='X-Mailer: Project Gazelle'."\r\n";
$Headers.='Message-Id: <'.Users::make_secret().'@'.NONSSL_SITE_URL.">\r\n";
$Headers.='X-Priority: 3'."\r\n";
mail($To,$Subject,$Body,$Headers,"-f ".$From."@".NONSSL_SITE_URL);
public static function send_email($To, $Subject, $Body, $From = 'noreply', $ContentType = 'text/plain') {
$Headers = 'MIME-Version: 1.0'."\r\n";
$Headers.= 'Content-type: '.$ContentType.'; charset=iso-8859-1'."\r\n";
$Headers.= 'From: '.SITE_NAME.' <'.$From.'@'.NONSSL_SITE_URL.'>'."\r\n";
$Headers.= 'Reply-To: '.$From.'@'.NONSSL_SITE_URL."\r\n";
$Headers.= 'X-Mailer: Project Gazelle'."\r\n";
$Headers.= 'Message-Id: <'.Users::make_secret().'@'.NONSSL_SITE_URL.">\r\n";
$Headers.= 'X-Priority: 3'."\r\n";
mail($To, $Subject, $Body, $Headers, "-f $From@".NONSSL_SITE_URL);
}

View File

@ -5,7 +5,7 @@
}
class SPHINX_SEARCH extends SphinxClient {
private $Index='*';
private $Index = '*';
public $TotalResults = 0;
public $Queries = array();
public $Time = 0.0;
@ -44,11 +44,11 @@ function SPHINX_SEARCH() {
****************************************************************/
function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(), $SQL = '', $IDColumn='ID') {
function search($Query = '', $CachePrefix = '', $CacheLength = 0, $ReturnData = array(), $SQL = '', $IDColumn = 'ID') {
global $Cache, $DB;
$QueryStartTime=microtime(true);
$QueryStartTime = microtime(true);
$Result = $this->Query($Query, $this->Index);
$QueryEndTime=microtime(true);
$QueryEndTime = microtime(true);
$Filters = array();
foreach ($this->Filters as $Name => $Values) {
@ -57,8 +57,8 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
}
}
$this->Queries[] = array('Params: '.$Query.' Filters: '.implode(", ", $Filters).' Indicies: '.$this->Index,($QueryEndTime-$QueryStartTime) * 1000);
$this->Time += ($QueryEndTime-$QueryStartTime) * 1000;
$this->Queries[] = array('Params: '.$Query.' Filters: '.implode(", ", $Filters).' Indicies: '.$this->Index,($QueryEndTime - $QueryStartTime) * 1000);
$this->Time += ($QueryEndTime - $QueryStartTime) * 1000;
if ($Result === false) {
if ($this->_connerror && !$Cache->get_value('sphinx_crash_reported')) {
@ -78,8 +78,6 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
$MatchIDs = array_keys($Matches);
$NotFound = array();
$Skip = array();
if (!empty($ReturnData)) {
@ -123,7 +121,7 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
if ($SQL != '') {
if (!empty($NotFound)) {
$DB->query(str_replace('%ids', implode(',',$NotFound), $SQL));
$DB->query(str_replace('%ids', implode(',', $NotFound), $SQL));
while ($Data = $DB->next_record(MYSQLI_ASSOC)) {
$Matches[$Data[$IDColumn]] = array_merge($Matches[$Data[$IDColumn]], $Data);
$Cache->cache_value($CachePrefix.'_'.$Data[$IDColumn], $Data, $CacheLength);
@ -139,7 +137,7 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
function limit($Start, $Length) {
$Start = (int)$Start;
$Length = (int)$Length;
$this->SetLimits($Start, $Length, $Start+$Length);
$this->SetLimits($Start, $Length, $Start + $Length);
}
@ -147,7 +145,7 @@ function set_index($Index) {
$this->Index = $Index;
}
function set_filter($Name, $Vals, $Exclude=false) {
function set_filter($Name, $Vals, $Exclude = false) {
foreach ($Vals as $Val) {
if ($Exclude) {
$this->Filters[$Name][] = "!$Val";
@ -182,7 +180,5 @@ function escape_string($String) {
'$'=>'\$',
'='=>'\='));
}
}
?>

View File

@ -145,7 +145,7 @@ public function format($Link = 'torrents.php?taglist=', $ArtistName = '') {
public static function format_top($Max = 5, $Link = 'torrents.php?taglist=', $ArtistName = '') {
if (empty(self::$All)) { ?>
<li>No torrent tags</li>
<?
<?
return;
}
if (!empty($ArtistName)) {
@ -153,6 +153,6 @@ public static function format_top($Max = 5, $Link = 'torrents.php?taglist=', $Ar
}
foreach (array_slice(self::sorted(), 0, $Max) as $TagName => $Total) { ?>
<li><a href="<?=$Link . display_str($TagName) . $ArtistName?>"><?=display_str($TagName)?></a> (<?=$Total?>)</li>
<? }
<? }
}
}

View File

@ -13,22 +13,22 @@ function open($file) {
$this->file = file($file);
}
function set($name,$var,$ifnone='<span style="font-style: italic;">-None-</span>') {
function set($name, $var, $ifnone = '<span style="font-style: italic;">-None-</span>') {
if ($name != '') {
$this->vars[$name][0]=$var;
$this->vars[$name][1]=$ifnone;
$this->vars[$name][0] = $var;
$this->vars[$name][1] = $ifnone;
}
}
function show() {
$TMPVAR='';
for ($i=0; $i<sizeof($this->file); $i++) {
$TMPVAR=$this->file[$i];
$TMPVAR = '';
for ($i = 0; $i < sizeof($this->file); $i++) {
$TMPVAR = $this->file[$i];
foreach ($this->vars as $k=>$v) {
if ($v[1] != '' && $v[0] == '') {
$v[0] = $v[1];
}
$TMPVAR = str_replace('{{'.$k.'}}',$v[0],$TMPVAR);
$TMPVAR = str_replace('{{'.$k.'}}', $v[0], $TMPVAR);
}
print $TMPVAR;
}
@ -38,19 +38,19 @@ function get() {
$RESULT = '';
$TMPVAR = '';
for ($i = 0; $i < sizeof($this->file); $i++) {
$TMPVAR=$this->file[$i];
$TMPVAR = $this->file[$i];
foreach ($this->vars as $k=>$v) {
if ($v[1] != '' && $v[0] == '') {
$v[0] = $v[1];
}
$TMPVAR = str_replace('{{'.$k.'}}',$v[0],$TMPVAR);
$TMPVAR = str_replace('{{'.$k.'}}', $v[0], $TMPVAR);
}
$RESULT.=$TMPVAR;
$RESULT.= $TMPVAR;
}
return $RESULT;
}
function str_align($len,$str,$align,$fill) {
function str_align($len, $str, $align, $fill) {
$strlen = strlen($str);
if ($strlen > $len) {
return substr($str, 0, $len);
@ -60,22 +60,20 @@ function str_align($len,$str,$align,$fill) {
} else {
if (($align == 'l') || ($align == 'left')) {
$result = $str.str_repeat($fill,($len - $strlen));
$result = $str.str_repeat($fill, ($len - $strlen));
} elseif (($align == 'r') || ($align == 'right')) {
$result = str_repeat($fill,($len - $strlen)).$str;
$result = str_repeat($fill, ($len - $strlen)).$str;
} elseif (($align == 'c') || ($align == 'center')) {
$snm = intval(($len - $strlen) / 2);
if (($strlen + ($snm * 2)) == $len) {
$result = str_repeat($fill,$snm).$str;
$result = str_repeat($fill, $snm).$str;
} else {
$result = str_repeat($fill,$snm + 1).$str;
$result = str_repeat($fill, $snm + 1).$str;
}
$result.=str_repeat($fill,$snm);
$result.= str_repeat($fill, $snm);
}
return $result;
}

View File

@ -11,7 +11,10 @@ public static function site_ban_ip($IP) {
$IPNum = Tools::ip_to_unsigned($IP);
$IPBans = $Cache->get_value('ip_bans_'.$A);
if (!is_array($IPBans)) {
$SQL = sprintf("SELECT ID, FromIP, ToIP FROM ip_bans WHERE FromIP BETWEEN %d << 24 AND (%d << 24) - 1", $A, $A+1);
$SQL = sprintf("
SELECT ID, FromIP, ToIP
FROM ip_bans
WHERE FromIP BETWEEN %d << 24 AND (%d << 24) - 1", $A, $A + 1);
$DB->query($SQL);
$IPBans = $DB->to_array(0, MYSQLI_NUM);
$Cache->cache_value('ip_bans_'.$A, $IPBans, 0);
@ -57,8 +60,13 @@ public static function geoip($IP) {
return false;
}
global $DB;
$DB->query("SELECT EndIP,Code FROM geoip_country WHERE $Long >= StartIP ORDER BY StartIP DESC LIMIT 1");
if ((!list($EndIP,$Country) = $DB->next_record()) || $EndIP < $Long) {
$DB->query("
SELECT EndIP, Code
FROM geoip_country
WHERE $Long >= StartIP
ORDER BY StartIP DESC
LIMIT 1");
if ((!list($EndIP, $Country) = $DB->next_record()) || $EndIP < $Long) {
$Country = '?';
}
$IPs[$IP] = $Country;
@ -72,7 +80,7 @@ public static function geoip($IP) {
* @return hostname fetched
*/
public static function get_host_by_ip($IP) {
$testar = explode('.',$IP);
$testar = explode('.', $IP);
if (count($testar) != 4) {
return $IP;
}
@ -83,7 +91,7 @@ public static function get_host_by_ip($IP) {
}
$host = `host -W 1 $IP`;
return (($host ? end ( explode (' ', $host)) : $IP));
return ($host ? end(explode(' ', $host)) : $IP);
}
/**
@ -141,8 +149,6 @@ public static function get_country_code_by_ajax($IP) {
}
/**
* Disable an array of users.
*

View File

@ -10,7 +10,10 @@ public static function get_classes() {
// Get permissions
list($Classes, $ClassLevels) = $Cache->get_value('classes');
if (!$Classes || !$ClassLevels) {
$DB->query('SELECT ID, Name, Level, Secondary FROM permissions ORDER BY Level');
$DB->query('
SELECT ID, Name, Level, Secondary
FROM permissions
ORDER BY Level');
$Classes = $DB->to_array('ID');
$ClassLevels = $DB->to_array('Level');
$Cache->cache_value('classes', array($Classes, $ClassLevels), 0);
@ -232,8 +235,11 @@ public static function update_site_options($UserID, $NewOptions) {
global $DB, $Cache, $LoggedUser;
// Get SiteOptions
$DB->query("SELECT SiteOptions FROM users_info WHERE UserID = $UserID");
list($SiteOptions) = $DB->next_record(MYSQLI_NUM,false);
$DB->query("
SELECT SiteOptions
FROM users_info
WHERE UserID = $UserID");
list($SiteOptions) = $DB->next_record(MYSQLI_NUM, false);
$SiteOptions = unserialize($SiteOptions);
// Get HeavyInfo
@ -244,7 +250,10 @@ public static function update_site_options($UserID, $NewOptions) {
$HeavyInfo = array_merge($HeavyInfo, $NewOptions);
// Update DB
$DB->query("UPDATE users_info SET SiteOptions = '".db_string(serialize($SiteOptions))."' WHERE UserID = $UserID");
$DB->query("
UPDATE users_info
SET SiteOptions = '".db_string(serialize($SiteOptions))."'
WHERE UserID = $UserID");
// Update cache
$Cache->cache_value('user_info_heavy_'.$UserID, $HeavyInfo, 0);
@ -262,8 +271,7 @@ public static function update_site_options($UserID, $NewOptions) {
* @global array $SiteOptions
* @param boolean $Default Returns the default list if true
*/
public static function release_order ($Default = false)
{
public static function release_order ($Default = false) {
global $SiteOptions, $ReleaseTypes;
$RT = $ReleaseTypes + array(
@ -281,19 +289,17 @@ public static function release_order ($Default = false)
foreach ($Sort as $Key => $Val) {
if (isset($Defaults)) {
$Checked = $Defaults && isset($SiteOptions['HideTypes'][$Key]) ? 'checked="checked"' : '';
$Checked = ($Defaults && isset($SiteOptions['HideTypes'][$Key]) ? ' checked="checked"' : '');
} else {
$Checked = $Val ? 'checked="checked"' : '';
$Val = isset($RT[$Key]) ? $RT[$Key] : 'Error';
$Checked = ($Val ? ' checked="checked"' : '');
$Val = (isset($RT[$Key]) ? $RT[$Key] : 'Error');
}
$ID = $Key . '_' . (int) !!$Checked;
?>
<li class="sortable_item">
<label><input type="checkbox" <?=$Checked?> id="<?=$ID?>" /> <?=$Val?></label>
<label><input type="checkbox"<?=$Checked?> id="<?=$ID?>" /> <?=$Val?></label>
</li>
<?
}
}
@ -302,8 +308,7 @@ public static function release_order ($Default = false)
* Returns the default order for the sort list in a JS-friendly string
* @return string
*/
public static function release_order_default_js ()
{
public static function release_order_default_js () {
ob_start();
self::release_order(true);
$HTML = ob_get_contents();
@ -319,8 +324,8 @@ public static function release_order_default_js ()
*/
public static function make_secret($Length = 32) {
$Secret = '';
$Chars='abcdefghijklmnopqrstuvwxyz0123456789';
$CharLen = strlen($Chars)-1;
$Chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
$CharLen = strlen($Chars) - 1;
for ($i = 0; $i < $Length; ++$i) {
$Secret .= $Chars[mt_rand(0, $CharLen)];
}
@ -335,7 +340,7 @@ public static function make_secret($Length = 32) {
* @param $Secret salt
* @return password hash
*/
public static function make_hash($Str,$Secret) {
public static function make_hash($Str, $Secret) {
return sha1(md5($Secret).$Str.sha1($Secret).SITE_SALT);
}
@ -348,7 +353,7 @@ public static function make_hash($Str,$Secret) {
* with the deprecated Users::make_hash() method
* @return true on correct password
*/
public static function check_password($Password, $Hash, $Secret='') {
public static function check_password($Password, $Hash, $Secret = '') {
if (!$Password || !$Hash) {
return false;
}
@ -448,11 +453,11 @@ public static function format_username($UserID, $Badges = false, $IsWarned = tru
$Str .= ($UserInfo['Donor'] == 1) ? '<a href="donate.php"><img src="'.STATIC_SERVER.'common/symbols/donor.png" alt="Donor" title="Donor" /></a>' : '';
}
$Str .= ($IsWarned && $UserInfo['Warned'] != '0000-00-00 00:00:00') ? '<a href="wiki.php?action=article&amp;id=218"'
$Str .= (($IsWarned && $UserInfo['Warned'] != '0000-00-00 00:00:00') ? '<a href="wiki.php?action=article&amp;id=218"'
. '><img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned'
. ($LoggedUser['ID'] === $UserID ? ' - Expires ' . date('Y-m-d H:i', strtotime($UserInfo['Warned'])) : '')
. '" /></a>' : '';
$Str .= ($IsEnabled && $UserInfo['Enabled'] == 2) ? '<a href="rules.php"><img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" title="Be good, and you won\'t end up like this user" /></a>' : '';
. '" /></a>' : '');
$Str .= (($IsEnabled && $UserInfo['Enabled'] == 2) ? '<a href="rules.php"><img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" title="Be good, and you won\'t end up like this user" /></a>' : '');
if ($Badges) {
$ClassesDisplay = array();
@ -518,7 +523,11 @@ public static function get_bookmarks ($UserID)
if (($Data = $Cache->get_value('bookmarks_group_ids_' . $UserID))) {
list($GroupIDs, $BookmarkData) = $Data;
} else {
$DB->query("SELECT GroupID, Sort, `Time` FROM bookmarks_torrents WHERE UserID=$UserID ORDER BY Sort, `Time` ASC");
$DB->query("
SELECT GroupID, Sort, `Time`
FROM bookmarks_torrents
WHERE UserID=$UserID
ORDER BY Sort, `Time` ASC");
$GroupIDs = $DB->collect('GroupID');
$BookmarkData = $DB->to_array('GroupID', MYSQLI_ASSOC);
$Cache->cache_value('bookmarks_group_ids_' . $UserID,
@ -526,7 +535,7 @@ public static function get_bookmarks ($UserID)
}
$TorrentList = Torrents::get_groups($GroupIDs);
$TorrentList = isset($TorrentList['matches']) ? $TorrentList['matches'] : array();
$TorrentList = (isset($TorrentList['matches']) ? $TorrentList['matches'] : array());
return array($GroupIDs, $BookmarkData, $TorrentList);
}
@ -547,10 +556,10 @@ public static function show_avatar($Avatar, $Username, $Setting, $Size=150, $Ret
switch ($Setting) {
case 0:
if (!empty($Avatar)) {
$ToReturn = $ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"$Username avatar\" />" : $Avatar;
$ToReturn = ($ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"$Username avatar\" />" : $Avatar);
} else {
$URL = STATIC_SERVER.'common/avatars/default.png';
$ToReturn = $ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"Default avatar\" />" : $URL;
$ToReturn = ($ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"Default avatar\" />" : $URL);
}
break;
case 2:
@ -588,17 +597,17 @@ public static function show_avatar($Avatar, $Username, $Setting, $Size=150, $Ret
if (!$Robot) {
$URL = 'https://secure.gravatar.com/avatar/'.md5(strtolower(trim($Username)))."?s=$Size&amp;d=$Type&amp;r=$Rating";
} else {
$URL = 'https://robohash.org/'.md5($Username).'?set=set'.$Type.'&amp;size='.$Size.'x'.$Size;
$URL = 'https://robohash.org/'.md5($Username)."?set=set$Type&amp;size={$Size}x$Size";
}
if ($ShowAvatar == True && !empty($Avatar)) {
$ToReturn = $ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"$Username avatar\" />" : $Avatar;
$ToReturn = ($ReturnHTML ? "<img src=\"$Avatar\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"$Username avatar\" />" : $Avatar);
} else {
$ToReturn = $ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"Default avatar\" />" : $URL;
$ToReturn = ($ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"Default avatar\" />" : $URL);
}
break;
default:
$URL = STATIC_SERVER.'common/avatars/default.png';
$ToReturn = $ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"Default avatar\" />" : $URL;
$ToReturn = ($ReturnHTML ? "<img src=\"$URL\" width=\"$Size\" style=\"max-height: 400px;\" alt=\"Default avatar\" />" : $URL);
}
return $ToReturn;
}

View File

@ -85,7 +85,7 @@ function dostime($TimeStamp = 0) {
}
$TimeStamp = strtotime($TimeStamp);
}
$Date = ($TimeStamp == 0) ? getdate() : getdate($TimeStamp);
$Date = (($TimeStamp == 0) ? getdate() : getdate($TimeStamp));
$Hex = dechex((($Date['year'] - 1980) << 25) | ($Date['mon'] << 21) | ($Date['mday'] << 16) | ($Date['hours'] << 11) | ($Date['minutes'] << 5) | ($Date['seconds'] >> 1));
eval("\$Return = \"\x$Hex[6]$Hex[7]\x$Hex[4]$Hex[5]\x$Hex[2]$Hex[3]\x$Hex[0]$Hex[1]\";");
return $Return;
@ -93,20 +93,20 @@ function dostime($TimeStamp = 0) {
*/
class Zip {
public $ArchiveSize = 0; //Total size
public $ArchiveSize = 0; // Total size
public $ArchiveFiles = 0; // Total files
private $Structure = ''; // Structure saved to memory
private $FileOffset = 0; // Offset to write data
private $Data = ''; //An idea
public function __construct ($ArchiveName='Archive') {
header("Content-type: application/octet-stream"); //Stream download
header("Content-disposition: attachment; filename=\"$ArchiveName.zip\""); //Name the archive - Should not be urlencoded
public function __construct ($ArchiveName = 'Archive') {
header("Content-type: application/octet-stream"); // Stream download
header("Content-disposition: attachment; filename=\"$ArchiveName.zip\""); // Name the archive - Should not be urlencoded
}
public static function unlimit () {
ob_end_clean();
set_time_limit(3600); //Limit 1 hour
set_time_limit(3600); // Limit 1 hour
ini_set('memory_limit', '1024M'); // Because the buffers can get extremely large
}
@ -116,19 +116,19 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
$this->Data .= "\x14\x00"; // Version requirements
$this->Data .= "\x00\x08"; // Bit flag - 0x8 = UTF-8 file names
$this->Data .= "\x08\x00"; // Compression
//$this->Data .= dostime($TimeStamp); //Last modified
//$this->Data .= dostime($TimeStamp); // Last modified
$this->Data .= "\x00\x00\x00\x00";
$DataLength = strlen($FileData); // Saved as varibale to avoid wasting CPU calculating it multiple times.
$DataLength = strlen($FileData); // Saved as variable to avoid wasting CPU calculating it multiple times.
$CRC32 = crc32($FileData); // Ditto.
$ZipData = gzcompress($FileData); // Ditto.
$ZipData = substr ($ZipData, 2,(strlen($ZipData) - 6)); // Checksum resolution
$ZipLength = strlen($ZipData); //Ditto.
$this->Data .= pack("V",$CRC32); // CRC-32
$this->Data .= pack("V",$ZipLength); // Compressed filesize
$this->Data .= pack("V",$DataLength); // Uncompressed filesize
$this->Data .= pack("v",strlen($ArchivePath)); // Pathname length
$ZipData = substr ($ZipData, 2, (strlen($ZipData) - 6)); // Checksum resolution
$ZipLength = strlen($ZipData); // Ditto.
$this->Data .= pack('V', $CRC32); // CRC-32
$this->Data .= pack('V', $ZipLength); // Compressed file size
$this->Data .= pack('V', $DataLength); // Uncompressed file size
$this->Data .= pack('v', strlen($ArchivePath)); // Path name length
$this->Data .="\x00\x00"; // Extra field length (0'd so we can ignore this)
$this->Data .= $ArchivePath; // Filename & Exta Field (length set to 0 so ignored)
$this->Data .= $ArchivePath; // File name & Extra Field (length set to 0 so ignored)
/* END file header */
/* File data */
@ -137,9 +137,9 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
/* Data descriptor
Not needed (only needed when 3rd bitflag is set), causes problems with OS X archive utility
$this->Data .= pack("V",$CRC32); // CRC-32
$this->Data .= pack("V",$ZipLength); // Compressed filesize
$this->Data .= pack("V",$DataLength); // Uncompressed filesize
$this->Data .= pack('V', $CRC32); // CRC-32
$this->Data .= pack('V', $ZipLength); // Compressed file size
$this->Data .= pack('V', $DataLength); // Uncompressed file size
END data descriptor */
$FileDataLength = strlen($this->Data);
@ -154,17 +154,17 @@ public function add_file ($FileData, $ArchivePath, $TimeStamp = 0) {
$CDS .="\x00\x08"; // Bit flag - 0x8 = UTF-8 file names
$CDS .="\x08\x00"; // Compression
$CDS .="\x00\x00\x00\x00"; // Last modified
$CDS .= pack("V",$CRC32); // CRC-32
$CDS .= pack("V",$ZipLength); // Compressed filesize
$CDS .= pack("V",$DataLength); // Uncompressed filesize
$CDS .= pack("v",strlen($ArchivePath)); // Pathname length
$CDS .= pack('V', $CRC32); // CRC-32
$CDS .= pack('V', $ZipLength); // Compressed file size
$CDS .= pack('V', $DataLength); // Uncompressed file size
$CDS .= pack('v', strlen($ArchivePath)); // Path name length
$CDS .="\x00\x00"; // Extra field length (0'd so we can ignore this)
$CDS .="\x00\x00"; // File comment length (no comment, 0'd)
$CDS .="\x00\x00"; // Disk number start (0 seems valid)
$CDS .="\x00\x00"; // Internal file attributes (again with the 0's)
$CDS .="\x20\x00\x00\x00"; // External file attributes
$CDS .= pack("V", $this->FileOffset ); // Offsets
$CDS .= $ArchivePath; // Filename & Exta Field (length set to 0 so ignored)
$CDS .= pack('V', $this->FileOffset); // Offsets
$CDS .= $ArchivePath; // File name & Extra Field (length set to 0 so ignored)
/* END central Directory Structure */
$this->FileOffset = $CurrentOffset; // Update offsets
@ -177,10 +177,10 @@ public function close_stream() {
echo "\x50\x4b\x05\x06"; // End of central directory signature
echo "\x00\x00"; // This disk
echo "\x00\x00"; // CDS start
echo pack("v", $this->ArchiveFiles); // Handle the numebr of entries
echo pack("v", $this->ArchiveFiles); // Ditto
echo pack("V", strlen($this->Structure)); //Size
echo pack("V", $this->ArchiveSize); // Offset
echo pack('v', $this->ArchiveFiles); // Handle the number of entries
echo pack('v', $this->ArchiveFiles); // Ditto
echo pack('V', strlen($this->Structure)); //Size
echo pack('V', $this->ArchiveSize); // Offset
echo "\x00\x00"; // No comment, close it off
}
}

View File

@ -62,7 +62,7 @@
<script src="<?=STATIC_SERVER?>functions/sizzle.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/script_start.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/script_start.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/class_ajax.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/class_ajax.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/ajax.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/ajax.class.js')?>" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
var authkey = "<?=$LoggedUser['AuthKey']?>";
var userid = <?=$LoggedUser['ID']?>;
@ -70,7 +70,7 @@
<script src="<?=STATIC_SERVER?>functions/global.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/global.js')?>" type="text/javascript"></script>
<?
$Scripts=explode(',',$JSIncludes);
$Scripts = explode(',', $JSIncludes);
foreach ($Scripts as $Script) {
if (empty($Script)) {

View File

@ -19,9 +19,9 @@
<? } ?>
<script src="<?=STATIC_SERVER?>functions/sizzle.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/script_start.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/script_start.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/class_ajax.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/class_ajax.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/class_cookie.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/class_cookie.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/class_storage.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/class_storage.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/ajax.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/ajax.class.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/cookie.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/cookie.class.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/storage.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/storage.class.js')?>" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/global.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/global.js')?>" type="text/javascript"></script>
<? if ($Mobile) { ?>
<script src="<?=STATIC_SERVER?>styles/mobile/style.js?v=<?=filemtime(SERVER_ROOT.'/static/mobile/style.js')?>" type="text/javascript"></script>

View File

@ -1 +1 @@
<script type="text/javascript" src="static/functions/class_textareapreview.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/class_textareapreview.js')?>"></script>
<script type="text/javascript" src="static/functions/textareapreview.class.js?v=<?=filemtime(SERVER_ROOT.'/static/functions/textareapreview.class.js')?>"></script>

View File

@ -1,6 +1,4 @@
<?
<?php
//TODO: Normalize thread_*_info don't need to waste all that ram on things that are already in other caches
/**********|| Page to show individual threads || ********************************\
@ -72,7 +70,7 @@
} else {
$PostNum = 1;
}
list($Page,$Limit) = Format::page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
list($Page, $Limit) = Format::page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
if (($Page - 1) * $PerPage > $ThreadInfo['Posts']) {
$Page = ceil($ThreadInfo['Posts']/$PerPage);
}

View File

@ -1,5 +1,4 @@
<?
<?php
$UserID = $LoggedUser['ID'];
@ -19,7 +18,7 @@
die();
}
list($Page,$Limit) = Format::page_limit(MESSAGES_PER_PAGE);
list($Page, $Limit) = Format::page_limit(MESSAGES_PER_PAGE);
$Sort = empty($_GET['sort']) || $_GET['sort'] != "unread" ? "Date DESC" : "cu.Unread = '1' DESC, DATE DESC";

View File

@ -1,10 +1,10 @@
<?
<?php
if (!check_perms('site_torrents_notify')) {
json_die("failure");
}
define('NOTIFICATIONS_PER_PAGE', 50);
list($Page,$Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
$Results = $DB->query("
SELECT SQL_CALC_FOUND_ROWS

View File

@ -1,9 +1,9 @@
<?
<?php
$Queries = array();
$OrderWays = array('year', 'votes', 'bounty', 'created', 'lastvote', 'filled');
list($Page,$Limit) = Format::page_limit(REQUESTS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(REQUESTS_PER_PAGE);
$Submitted = !empty($_GET['submit']);
//Paranoia

View File

@ -1,4 +1,4 @@
<?
<?php
/*
User topic subscription page
*/
@ -15,7 +15,7 @@
} else {
$PerPage = POSTS_PER_PAGE;
}
list($Page,$Limit) = Format::page_limit($PerPage);
list($Page, $Limit) = Format::page_limit($PerPage);
if ($LoggedUser['CustomForums']) {
unset($LoggedUser['CustomForums']['']);

View File

@ -1,5 +1,4 @@
<?
<?php
include(SERVER_ROOT.'/classes/text.class.php');
$Text = new TEXT;
@ -24,9 +23,9 @@
WHERE GroupID = $GroupID
AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record();
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $PostNum);
} else {
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $Results);
}
//Get the cache catalogue
@ -57,7 +56,7 @@
}
//This is a hybrid to reduce the catalogue down to the page elements: We use the page limit % catalogue
$Thread = array_slice($Catalogue,((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE),TORRENT_COMMENTS_PER_PAGE,true);
$Thread = array_slice($Catalogue, ((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) % THREAD_CATALOGUE), TORRENT_COMMENTS_PER_PAGE, true);
//---------- Begin printing
$JsonComments = array();
@ -79,7 +78,7 @@
'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
)
);

View File

@ -1,4 +1,4 @@
<?
<?php
/*
User post history page
*/
@ -31,7 +31,7 @@ function error_out($reason = '') {
$PerPage = POSTS_PER_PAGE;
}
list($Page,$Limit) = Format::page_limit($PerPage);
list($Page, $Limit) = Format::page_limit($PerPage);
$UserInfo = Users::user_info($UserID);
extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));

View File

@ -1,4 +1,4 @@
<?
<?php
/**********************************************************************
*>>>>>>>>>>>>>>>>>>>>>>>>>>> User search <<<<<<<<<<<<<<<<<<<<<<<<<<<<*
**********************************************************************/
@ -14,7 +14,7 @@
if (isset($_GET['username'])) {
$_GET['username'] = trim($_GET['username']);
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(USERS_PER_PAGE);
$DB->query("
SELECT SQL_CALC_FOUND_ROWS
ID,

View File

@ -1,10 +1,10 @@
<?
<?php
define('COLLAGES_PER_PAGE', 25);
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
$Text = new TEXT;
list($Page,$Limit) = Format::page_limit(COLLAGES_PER_PAGE);
list($Page, $Limit) = Format::page_limit(COLLAGES_PER_PAGE);
$OrderVals = array('Time', 'Name', 'Subscribers', 'Torrents', 'Updated');

View File

@ -47,7 +47,7 @@
} else {
$PerPage = POSTS_PER_PAGE;
}
list($Page,$Limit) = Format::page_limit($PerPage);
list($Page, $Limit) = Format::page_limit($PerPage);
switch ($action) {
case 'requests':

View File

@ -1,4 +1,4 @@
<?
<?php
/**********|| Page to show individual forums || ********************************\
Things to expect in $_GET:
@ -22,7 +22,7 @@
$PerPage = POSTS_PER_PAGE;
}
list($Page,$Limit) = Format::page_limit(TOPICS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(TOPICS_PER_PAGE);
//---------- Get some data to start processing

View File

@ -1,4 +1,4 @@
<?
<?php
//TODO: Normalize thread_*_info don't need to waste all that ram on things that are already in other caches
/**********|| Page to show individual threads || ********************************\
@ -76,7 +76,7 @@
} else {
$PostNum = 1;
}
list($Page,$Limit) = Format::page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
list($Page, $Limit) = Format::page_limit($PerPage, min($ThreadInfo['Posts'],$PostNum));
if (($Page - 1) * $PerPage > $ThreadInfo['Posts']) {
$Page = ceil($ThreadInfo['Posts'] / $PerPage);
}

View File

@ -1,4 +1,4 @@
<?
<?php
/************************************************************************
//------------// Main friends page //----------------------------------//
This page lists a user's friends.
@ -19,7 +19,7 @@
$UserID = $LoggedUser['ID'];
list($Page,$Limit) = Format::page_limit(FRIENDS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(FRIENDS_PER_PAGE);
// Main query
$DB->query("
@ -72,7 +72,7 @@
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<table class="friends_table vertical_margin">
<tr class="colhead">
<td colspan="<?=Users::has_avatars_enabled() ? 3 : 2?>">
<td colspan="<?=(Users::has_avatars_enabled() ? 3 : 2)?>">
<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>

View File

@ -1,4 +1,4 @@
<?
<?php
$UserID = $LoggedUser['ID'];
@ -13,7 +13,7 @@
error(404);
}
list($Page,$Limit) = Format::page_limit(MESSAGES_PER_PAGE);
list($Page, $Limit) = Format::page_limit(MESSAGES_PER_PAGE);
View::show_header('Inbox');
?>

View File

@ -1,5 +1,5 @@
<?
list($Page,$Limit) = Format::page_limit(LOG_ENTRIES_PER_PAGE);
<?php
list($Page, $Limit) = Format::page_limit(LOG_ENTRIES_PER_PAGE);
if (!empty($_GET['search'])) {
$Search = db_string($_GET['search']);

View File

@ -1,4 +1,4 @@
<?
<?php
/*
* This page is used for viewing reports in every viewpoint except auto.
* It doesn't AJAX grab a new report when you resolve each one, use auto
@ -18,7 +18,7 @@
$Text = NEW TEXT;
define('REPORTS_PER_PAGE', '10');
list($Page,$Limit) = Format::page_limit(REPORTS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(REPORTS_PER_PAGE);
if (isset($_GET['view'])) {

View File

@ -1,4 +1,4 @@
<?
<?php
/*
* This is the page that displays the request to the end user after being created.
@ -467,9 +467,9 @@
if (isset($_GET['postid']) && is_number($_GET['postid']) && $Results > TORRENT_COMMENTS_PER_PAGE) {
$DB->query("SELECT COUNT(ID) FROM requests_comments WHERE RequestID = $RequestID AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record();
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $PostNum);
} else {
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE, $Results);
}
//Get the cache catalogue
@ -496,7 +496,7 @@
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));
?>
<table class="forum_post box vertical_margin<?=!Users::has_avatars_enabled() ? ' noavatar' : ''?>" id="post<?=$PostID?>">
<table class="forum_post box vertical_margin<?=(!Users::has_avatars_enabled() ? ' noavatar' : '')?>" id="post<?=$PostID?>">
<colgroup>
<? if (Users::has_avatars_enabled()) { ?>
<col class="col_avatar" />
@ -504,7 +504,7 @@
<col class="col_post_body" />
</colgroup>
<tr class="colhead_dark">
<td colspan="<?=Users::has_avatars_enabled() ? 2 : 1?>">
<td colspan="<?=(Users::has_avatars_enabled() ? 2 : 1)?>">
<div style="float: left;"><a href="#post<?=$PostID?>">#<?=$PostID?></a>
by <strong><?=Users::format_username($AuthorID, true, true, true, true)?></strong> <?=time_diff($AddedTime)?>
- <a href="#quickpost" onclick="Quote('<?=$PostID?>','<?=$Username?>');" class="brackets">Quote</a>
@ -552,7 +552,7 @@
<a href="#content<?=$PostID?>" onclick="LoadEdit('requests', <?=$PostID?>, 1); return false;">&laquo;</a>
<? } ?>
Last edited by
<?=Users::format_username($EditedUserID, false, false, false) ?> <?=time_diff($EditedTime,2,true,true)?>
<?=Users::format_username($EditedUserID, false, false, false)?> <?=time_diff($EditedTime, 2, true, true)?>
<? } ?>
</div>
</td>

View File

@ -1,9 +1,9 @@
<?
<?php
$Queries = array();
$OrderWays = array('year', 'votes', 'bounty', 'created', 'lastvote', 'filled');
list($Page,$Limit) = Format::page_limit(REQUESTS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(REQUESTS_PER_PAGE);
$Submitted = !empty($_GET['submit']);
//Paranoia

View File

@ -1,6 +1,6 @@
<?
<?php
list($Page,$Limit) = page_limit(REQUESTS_PER_PAGE);
list($Page, $Limit) = page_limit(REQUESTS_PER_PAGE);
$OrderWays = array('name', 'votes', 'bounty', 'filler', 'requestor', 'created', 'lastvote', 'filled');
$Wheres = array();
$ExtraJoins = array();

View File

@ -1,4 +1,4 @@
<?
<?php
View::show_header('Staff Inbox');
@ -42,7 +42,7 @@
break;
}
list($Page,$Limit) = Format::page_limit(MESSAGES_PER_PAGE);
list($Page, $Limit) = Format::page_limit(MESSAGES_PER_PAGE);
// Get messages
$StaffPMs = $DB->query("
SELECT

View File

@ -1,4 +1,4 @@
<?
<?php
if (!check_perms('admin_donor_log')) {
error(403);
}
@ -6,7 +6,7 @@
include(SERVER_ROOT.'/sections/donate/config.php');
define('DONATIONS_PER_PAGE', 50);
list($Page,$Limit) = Format::page_limit(DONATIONS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(DONATIONS_PER_PAGE);
$sql = "

View File

@ -1,10 +1,10 @@
<?
<?php
if (!check_perms('users_view_ips') || !check_perms('users_view_email')) {
error(403);
}
View::show_header('Registration log');
define('USERS_PER_PAGE', 50);
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(USERS_PER_PAGE);
$AfterDate = $_POST['after_date'];
$BeforeDate = $_POST['before_date'];

View File

@ -1,10 +1,10 @@
<?
<?php
if (!check_perms('site_view_flow')) {
error(403);
}
View::show_header('Upscale Pool');
define('USERS_PER_PAGE', 50);
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(USERS_PER_PAGE);
$RS = $DB->query("
SELECT

View File

@ -1,11 +1,11 @@
<?
<?php
if (!check_perms('site_view_flow')) {
error(403);
}
//Timeline generation
if (!isset($_GET['page'])) {
if (!list($Labels,$InFlow,$OutFlow,$Max) = $Cache->get_value('users_timeline')) {
if (!list($Labels, $InFlow, $OutFlow, $Max) = $Cache->get_value('users_timeline')) {
$DB->query("
SELECT DATE_FORMAT(JoinDate,'%b \'%y') AS Month, COUNT(UserID)
FROM users_info
@ -41,14 +41,14 @@
list($Label,$Amount) = $Month;
$OutFlow[] = number_format(($Amount / $Max) * 100, 4);
}
$Cache->cache_value('users_timeline',array($Labels,$InFlow,$OutFlow,$Max),mktime(0,0,0,date('n') + 1,2));
$Cache->cache_value('users_timeline', array($Labels, $InFlow, $OutFlow, $Max), mktime(0, 0, 0, date('n') + 1, 2));
}
}
//End timeline generation
define('DAYS_PER_PAGE', 100);
list($Page,$Limit) = Format::page_limit(DAYS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(DAYS_PER_PAGE);
$RS = $DB->query("
SELECT
@ -122,7 +122,7 @@
<? } ?>
<div class="linkbox">
<?
$Pages = Format::get_pages($Page, $Results, DAYS_PER_PAGE, 11) ;
$Pages = Format::get_pages($Page, $Results, DAYS_PER_PAGE, 11);
echo $Pages;
?>
</div>

View File

@ -1,4 +1,4 @@
<?
<?php
if (!check_perms('admin_manage_ipbans')) {
error(403);
}
@ -45,7 +45,7 @@
}
define('BANS_PER_PAGE', '20');
list($Page,$Limit) = Format::page_limit(BANS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(BANS_PER_PAGE);
$sql = "SELECT SQL_CALC_FOUND_ROWS ID, FromIP, ToIP, Reason FROM ip_bans AS i ";

View File

@ -1,4 +1,4 @@
<?
<?php
if (!check_perms('users_mod')) {
error(403);
}

View File

@ -1,11 +1,11 @@
<?
<?php
if (!check_perms('users_view_ips')) {
error(403);
}
View::show_header('Dupe IPs');
define('USERS_PER_PAGE', 50);
define('IP_OVERLAPS', 5);
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(USERS_PER_PAGE);
$RS = $DB->query("

View File

@ -121,9 +121,25 @@
$FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName;
$GroupByToggleQuery = "&amp;groups=";
$GroupBy = "";
$GroupBySum = "";
if(isset($_GET['groups']) && $_GET['groups'] == "show") {
$GroupBy = " GROUP BY g.ID ";
$GroupBySum = md5($GroupBy);
$GroupByToggleQuery .= "hide";
$GroupByToggleName = "Show Top Torrents";
} else {
$GroupByToggleQuery .= "show";
$GroupByToggleName = "Show Top Groups";
}
?>
<div style="text-align: right;" class="linkbox">
<a href="top10.php?<?=$FreeleechToggleQuery?>" class="brackets"><?=ucfirst($FreeleechToggleName)?> freeleech in Top 10</a>
<? if(check_perms("users_mod")) { ?>
<a href="top10.php?<?=$GroupByToggleQuery?>" class="brackets"><?=ucfirst($GroupByToggleName)?></a>
<? } ?>
</div>
<?
@ -160,7 +176,7 @@
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID ";
if ($Details=='all' || $Details=='day') {
$TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum);
$TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastDay === false) {
if ($Cache->get_query_lock('top10')) {
$DayAgo = time_minus(86400);
@ -168,11 +184,12 @@
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'$DayAgo'
$GroupID
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastDay = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_day_'.$Limit.$WhereSum,$TopTorrentsActiveLastDay,3600*2);
$Cache->cache_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveLastDay,3600*2);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastDay = false;
@ -181,7 +198,7 @@
generate_torrent_table('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
}
if ($Details=='all' || $Details=='week') {
$TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum);
$TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastWeek === false) {
if ($Cache->get_query_lock('top10')) {
$WeekAgo = time_minus(604800);
@ -189,11 +206,12 @@
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'$WeekAgo'
$GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastWeek = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_week_'.$Limit.$WhereSum,$TopTorrentsActiveLastWeek,3600*6);
$Cache->cache_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveLastWeek,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastWeek = false;
@ -203,18 +221,19 @@
}
if ($Details=='all' || $Details=='month') {
$TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum);
$TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastMonth === false) {
if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery.' WHERE ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'".sqltime()."' - INTERVAL 1 MONTH
$GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastMonth = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_month_'.$Limit.$WhereSum,$TopTorrentsActiveLastMonth,3600*6);
$Cache->cache_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveLastMonth,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastMonth = false;
@ -224,7 +243,7 @@
}
if ($Details=='all' || $Details=='year') {
$TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum);
$TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastYear === false) {
if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Seeders>200 in order to speed up this query. You should remove it!
@ -236,11 +255,12 @@
elseif (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'".sqltime()."' - INTERVAL 1 YEAR
$GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastYear = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_year_'.$Limit.$WhereSum,$TopTorrentsActiveLastYear,3600*6);
$Cache->cache_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveLastYear,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastYear = false;
@ -250,7 +270,7 @@
}
if ($Details=='all' || $Details=='overall') {
$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum);
$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveAllTime === false) {
if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it!
@ -261,11 +281,12 @@
}
elseif (!empty($Where)) { $Query .= ' WHERE '.$Where; }
$Query .= "
$GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveAllTime = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum,$TopTorrentsActiveAllTime,3600*6);
$Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsActiveAllTime,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveAllTime = false;
@ -275,17 +296,18 @@
}
if (($Details=='all' || $Details=='snatched') && !$Filtered) {
$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum);
$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsSnatched === false) {
if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; }
$Query .= "
$GroupBy
ORDER BY t.Snatched DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum,$TopTorrentsSnatched,3600*6);
$Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsSnatched,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsSnatched = false;
@ -295,7 +317,7 @@
}
if (($Details=='all' || $Details=='data') && !$Filtered) {
$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum);
$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsTransferred === false) {
if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it!
@ -305,11 +327,12 @@
if (!empty($Where)) { $Query .= ' AND '.$Where; }
}
$Query .= "
$GroupBy
ORDER BY Data DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_data_'.$Limit.$WhereSum,$TopTorrentsTransferred,3600*6);
$Cache->cache_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsTransferred,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsTransferred = false;
@ -319,17 +342,18 @@
}
if (($Details=='all' || $Details=='seeded') && !$Filtered) {
$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum);
$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsSeeded === false) {
if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; }
$Query .= "
$GroupBy
ORDER BY t.Seeders DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum,$TopTorrentsSeeded,3600*6);
$Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum,$TopTorrentsSeeded,3600*6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsSeeded = false;
@ -445,46 +469,48 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
// append extra info to torrent title
$ExtraInfo = '';
$AddExtra = '';
if ($Format) {
$ExtraInfo.= $Format;
$AddExtra = ' / ';
}
if ($Encoding) {
$ExtraInfo.= $AddExtra.$Encoding;
$AddExtra = ' / ';
}
// "FLAC / Lossless / Log (100%) / Cue / CD";
if ($HasLog) {
$ExtraInfo.= $AddExtra.'Log ('.$LogScore.'%)';
$AddExtra = ' / ';
}
if ($HasCue) {
$ExtraInfo.= $AddExtra.'Cue';
$AddExtra = ' / ';
}
if ($Media) {
$ExtraInfo.= $AddExtra.$Media;
$AddExtra = ' / ';
}
if ($Scene) {
$ExtraInfo.= $AddExtra.'Scene';
$AddExtra = ' / ';
}
if ($Year > 0) {
$ExtraInfo.= $AddExtra.$Year;
$AddExtra = ' ';
}
if ($RemasterTitle) {
$ExtraInfo.= $AddExtra.$RemasterTitle;
}
if ($IsSnatched) {
if ($GroupCategoryID == 1) {
$ExtraInfo .= ' / ';
if(empty($GroupBy)) {
if ($Format) {
$ExtraInfo.= $Format;
$AddExtra = ' / ';
}
if ($Encoding) {
$ExtraInfo.= $AddExtra.$Encoding;
$AddExtra = ' / ';
}
// "FLAC / Lossless / Log (100%) / Cue / CD";
if ($HasLog) {
$ExtraInfo.= $AddExtra.'Log ('.$LogScore.'%)';
$AddExtra = ' / ';
}
if ($HasCue) {
$ExtraInfo.= $AddExtra.'Cue';
$AddExtra = ' / ';
}
if ($Media) {
$ExtraInfo.= $AddExtra.$Media;
$AddExtra = ' / ';
}
if ($Scene) {
$ExtraInfo.= $AddExtra.'Scene';
$AddExtra = ' / ';
}
if ($Year > 0) {
$ExtraInfo.= $AddExtra.$Year;
$AddExtra = ' ';
}
if ($RemasterTitle) {
$ExtraInfo.= $AddExtra.$RemasterTitle;
}
if ($IsSnatched) {
if ($GroupCategoryID == 1) {
$ExtraInfo .= ' / ';
}
$ExtraInfo.= Format::torrent_label('Snatched!');
}
if ($ExtraInfo != '') {
$ExtraInfo = "- [$ExtraInfo]";
}
$ExtraInfo.= Format::torrent_label('Snatched!');
}
if ($ExtraInfo != '') {
$ExtraInfo = "- [$ExtraInfo]";
}
$TorrentTags = new Tags($TagsList);

View File

@ -31,7 +31,7 @@
// Function to build a SQL WHERE to search for a string
// Offers exact searching, fulltext searching, and negative searching
function build_search($SearchStr, $Field, $Exact=false, $SQLWhere='', $FullText=0, &$FilterString='') {
function build_search($SearchStr, $Field, $Exact = false, $SQLWhere = '', $FullText = 0, &$FilterString = '') {
if ($SQLWhere != '') {
$AddWhere = false;
} else {
@ -81,8 +81,8 @@ function build_search($SearchStr, $Field, $Exact=false, $SQLWhere='', $FullText=
if ($SQLWhere != '') {
$SQLWhere.= ' AND ';
}
$SQLWhere.=$Field." LIKE '".db_string($SearchStr)."'";
$FilterString.="(.+?)($SearchStr)(.+?)";
$SQLWhere.= $Field." LIKE '".db_string($SearchStr)."'";
$FilterString.= "(.+?)($SearchStr)(.+?)";
}
$Search = 1;
$FilterString = "/$FilterString/si";
@ -93,13 +93,13 @@ function build_search($SearchStr, $Field, $Exact=false, $SQLWhere='', $FullText=
}
function quotes($Str) {
$Str = str_replace(' ','{{SPACE}}',trim($Str[1]));
$Str = str_replace(' ', '{{SPACE}}', trim($Str[1]));
return ' '.$Str.' ';
}
// The "order by x" links on columns headers
function header_link($SortKey,$DefaultWay = 'DESC') {
global $OrderBy,$OrderWay;
function header_link($SortKey, $DefaultWay = 'DESC') {
global $OrderBy, $OrderWay;
if ($SortKey == $OrderBy) {
if ($OrderWay == 'DESC') {
$NewWay = 'ASC';
@ -155,7 +155,7 @@ function header_link($SortKey,$DefaultWay = 'DESC') {
$OrderBy = 's3'; // We order by GroupTime by default
$OrderWay = 'DESC'; // We also order descending by default
list($Page,$Limit) = Format::page_limit(TORRENTS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(TORRENTS_PER_PAGE);
if (preg_match('/^s[1-7]$/',$_GET['order_by'])) {
$OrderBy = strtolower($_GET['order_by']);

View File

@ -1,4 +1,4 @@
<?
<?php
function compare($X, $Y) {
return($Y['score'] - $X['score']);
}
@ -85,7 +85,8 @@ function compare($X, $Y) {
$DB->query("
SELECT ID, Image, Summary, UserID, Time
FROM cover_art
WHERE GroupID = '$GroupID'");
WHERE GroupID = '$GroupID'
ORDER BY Time ASC");
$CoverArt = array();
$CoverArt = $DB->to_array();
if ($DB->record_count() > 0) {
@ -137,11 +138,13 @@ function compare($X, $Y) {
<? if ($Index == count($CoverArt)) { ?>
<a class="brackets prev_cover" data-gazelle-prev-cover="<?=($Index - 1)?>" href="#">Prev</a>
<a class="brackets show_all_covers" href="#">Show all</a>
<span class="brackets next_cover">Next</span>
<? } elseif ($Index > 0) { ?>
<a class="brackets prev_cover" data-gazelle-prev-cover="<?=($Index - 1)?>" href="#">Prev</a>
<a class="brackets show_all_covers" href="#">Show all</a>
<a class="brackets next_cover" data-gazelle-next-cover="<?=($Index + 1)?>" href="#">Next</a>
<? } elseif ($Index == 0 && count($CoverArt) > 0) { ?>
<span class="brackets prev_cover">Prev</span>
<a class="brackets show_all_covers" href="#">Show all</a>
<a class="brackets next_cover" data-gazelle-next-cover="<?=($Index + 1)?>" href="#">Next</a>
<? } ?>
@ -177,7 +180,7 @@ function compare($X, $Y) {
<li>
<?=$Summary?>
<?=(check_perms('users_mod') ? ' added by ' . Users::format_username($AddedBy, false, false, false, false, false) : '')?>
<span class="remove remove_cover_art"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=remove_cover_art&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;id=<?=$ImageID?>');this.parentNode.parentNode.parentNode.style.display = 'none';this.parentNode.parentNode.parentNode.previousElementSibling.style.display = 'none';" class="brackets" title="Remove Image">X</a></span>
<span class="remove remove_cover_art"><a href="#" onclick="ajax.get('torrents.php?action=remove_cover_art&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;id=<?=$ImageID?>&amp;groupid=<?=$GroupID?>');this.parentNode.parentNode.parentNode.style.display = 'none';this.parentNode.parentNode.parentNode.previousElementSibling.style.display = 'none';" class="brackets" title="Remove Image">X</a></span>
</li>
</ul>
</div>
@ -877,9 +880,9 @@ function filelist($Str) {
WHERE GroupID = $GroupID
AND ID <= $_GET[postid]");
list($PostNum) = $DB->next_record();
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$PostNum);
} else {
list($Page,$Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
list($Page, $Limit) = Format::page_limit(TORRENT_COMMENTS_PER_PAGE,$Results);
}
//Get the cache catalogue

View File

@ -1,4 +1,4 @@
<?
<?php
if (!check_perms('site_torrents_notify')) {
error(403);
}
@ -31,7 +31,7 @@
$FilterID = false;
}
list($Page,$Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
// The "order by x" links on columns headers
function header_link($SortKey, $DefaultWay = 'desc') {

View File

@ -5,13 +5,21 @@
}
$ID = $_GET['id'];
$GroupID = $_GET['groupid'];
if (!is_number($ID) || !is_number($ID)) {
if (!is_number($ID) || !is_number($ID) || !is_number($GroupID) || !is_number($GroupID)) {
error(404);
}
$DB->query("SELECT Image, Summary FROM cover_art WHERE ID = '$ID'");
list($Image, $Summary) = $DB->next_record();
$DB->query("DELETE FROM cover_art WHERE ID = '$ID'");
$DB->query("INSERT INTO group_log (GroupID, UserID, Time, Info)
VALUES ('$GroupID',".$LoggedUser['ID'].",'".sqltime()."','".db_string('Additional Cover "'.$Summary . ' - ' . $Image .'" removed from group')."')");
$Cache->delete_value('torrents_cover_art_' . $GroupID);
header('Location: '.$_SERVER['HTTP_REFERER']);
?>

View File

@ -1,4 +1,4 @@
<?
<?php
/**********************************************************************
*>>>>>>>>>>>>>>>>>>>>>>>>>>> User search <<<<<<<<<<<<<<<<<<<<<<<<<<<<*
* Best viewed with a wide screen monitor *
@ -428,7 +428,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
$RunQuery = true;
}
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(USERS_PER_PAGE);
$SQL.=" LIMIT $Limit";
} else { error($Err); }
@ -447,10 +447,10 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr"><span title="Date format is YYYY-MM-DD">Joined:</span></td>
<td width="24%">
<select name="joined">
<option value="on"<? if ($_GET['joined']==='on') {echo ' selected="selected"';} ?>>On</option>
<option value="before"<? if ($_GET['joined']==='before') {echo ' selected="selected"';} ?>>Before</option>
<option value="after"<? if ($_GET['joined']==='after') {echo ' selected="selected"';} ?>>After</option>
<option value="between"<? if ($_GET['joined']==='between') {echo ' selected="selected"';} ?>>Between</option>
<option value="on"<? if ($_GET['joined'] === 'on') { echo ' selected="selected"'; } ?>>On</option>
<option value="before"<? if ($_GET['joined'] === 'before') { echo ' selected="selected"'; } ?>>Before</option>
<option value="after"<? if ($_GET['joined'] === 'after') { echo ' selected="selected"'; } ?>>After</option>
<option value="between"<? if ($_GET['joined'] === 'between') { echo ' selected="selected"'; } ?>>Between</option>
</select>
<input type="text" name="join1" size="6" value="<?=display_str($_GET['join1'])?>" />
<input type="text" name="join2" size="6" value="<?=display_str($_GET['join2'])?>" />
@ -458,10 +458,10 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr">Enabled:</td>
<td>
<select name="enabled">
<option value=""<? if ($_GET['enabled']==='') {echo ' selected="selected"';} ?>>Any</option>
<option value="0"<? if ($_GET['enabled']==='0') {echo ' selected="selected"';} ?>>Unconfirmed</option>
<option value="1"<? if ($_GET['enabled']==='1') {echo ' selected="selected"';} ?>>Enabled</option>
<option value="2"<? if ($_GET['enabled']==='2') {echo ' selected="selected"';} ?>>Disabled</option>
<option value=""<? if ($_GET['enabled'] === '') { echo ' selected="selected"'; } ?>>Any</option>
<option value="0"<? if ($_GET['enabled'] === '0') { echo ' selected="selected"'; } ?>>Unconfirmed</option>
<option value="1"<? if ($_GET['enabled'] === '1') { echo ' selected="selected"'; } ?>>Enabled</option>
<option value="2"<? if ($_GET['enabled'] === '2') { echo ' selected="selected"'; } ?>>Disabled</option>
</select>
</td>
</tr>
@ -473,10 +473,10 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr"><span title="Date format is YYYY-MM-DD">Last active:</span></td>
<td width="30%">
<select name="lastactive">
<option value="on"<? if ($_GET['lastactive']==='on') {echo ' selected="selected"';} ?>>On</option>
<option value="before"<? if ($_GET['lastactive']==='before') {echo ' selected="selected"';} ?>>Before</option>
<option value="after"<? if ($_GET['lastactive']==='after') {echo ' selected="selected"';} ?>>After</option>
<option value="between"<? if ($_GET['lastactive']==='between') {echo ' selected="selected"';} ?>>Between</option>
<option value="on"<? if ($_GET['lastactive'] === 'on') { echo ' selected="selected"'; } ?>>On</option>
<option value="before"<? if ($_GET['lastactive'] === 'before') { echo ' selected="selected"'; } ?>>Before</option>
<option value="after"<? if ($_GET['lastactive'] === 'after') { echo ' selected="selected"'; } ?>>After</option>
<option value="between"<? if ($_GET['lastactive'] === 'between') { echo ' selected="selected"'; } ?>>Between</option>
</select>
<input type="text" name="lastactive1" size="6" value="<?=display_str($_GET['lastactive1'])?>" />
<input type="text" name="lastactive2" size="6" value="<?=display_str($_GET['lastactive2'])?>" />
@ -484,13 +484,13 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr">Primary class:</td>
<td>
<select name="class">
<option value=""<? if ($_GET['class']==='') {echo ' selected="selected"';} ?>>Any</option>
<option value=""<? if ($_GET['class'] === '') { echo ' selected="selected"'; } ?>>Any</option>
<? foreach ($ClassLevels as $Class) {
if ($Class['Secondary']) {
continue;
}
?>
<option value="<?=$Class['ID'] ?>"<? if ($_GET['class']===$Class['ID']) {echo ' selected="selected"';} ?>><?=Format::cut_string($Class['Name'], 10, 1, 1).' ('.$Class['Level'].')'?></option>
<option value="<?=$Class['ID'] ?>"<? if ($_GET['class'] === $Class['ID']) { echo ' selected="selected"'; } ?>><?=Format::cut_string($Class['Name'], 10, 1, 1).' ('.$Class['Level'].')'?></option>
<? } ?>
</select>
</td>
@ -505,11 +505,11 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr">Secondary class:</td>
<td>
<select name="secclass">
<option value=""<? if ($_GET['secclass']==='') {echo ' selected="selected"';} ?>>Any</option>
<option value=""<? if ($_GET['secclass'] === '') { echo ' selected="selected"'; } ?>>Any</option>
<? $Secondaries = array();
// Neither level nor ID is particularly useful when searching secondary classes, so let's do some
// kung-fu to sort them alphabetically.
$fnc = function($Class1, $Class2) { return strcmp($Class1['Name'], $Class2['Name']);};
$fnc = function($Class1, $Class2) { return strcmp($Class1['Name'], $Class2['Name']); };
foreach ($ClassLevels as $Class) {
if (!$Class['Secondary']) {
continue;
@ -519,7 +519,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
usort($Secondaries, $fnc);
foreach ($Secondaries as $Class) {
?>
<option value="<?=$Class['ID'] ?>"<? if ($_GET['secclass']===$Class['ID']) {echo ' selected="selected"';} ?>><?=Format::cut_string($Class['Name'], 20, 1, 1)?></option>
<option value="<?=$Class['ID'] ?>"<? if ($_GET['secclass'] === $Class['ID']) { echo ' selected="selected"'; } ?>><?=Format::cut_string($Class['Name'], 20, 1, 1)?></option>
<? } ?>
</select>
</td>
@ -536,10 +536,10 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr">Ratio:</td>
<td width="30%">
<select name="ratio">
<option value="equal"<? if ($_GET['ratio']==='equal') {echo ' selected="selected"';} ?>>Equal</option>
<option value="above"<? if ($_GET['ratio']==='above') {echo ' selected="selected"';} ?>>Above</option>
<option value="below"<? if ($_GET['ratio']==='below') {echo ' selected="selected"';} ?>>Below</option>
<option value="between"<? if ($_GET['ratio']==='between') {echo ' selected="selected"';} ?>>Between</option>
<option value="equal"<? if ($_GET['ratio'] === 'equal') { echo ' selected="selected"'; } ?>>Equal</option>
<option value="above"<? if ($_GET['ratio'] === 'above') { echo ' selected="selected"'; } ?>>Above</option>
<option value="below"<? if ($_GET['ratio'] === 'below') { echo ' selected="selected"'; } ?>>Below</option>
<option value="between"<? if ($_GET['ratio'] === 'between') { echo ' selected="selected"'; } ?>>Between</option>
</select>
<input type="text" name="ratio1" size="6" value="<?=display_str($_GET['ratio1'])?>" />
<input type="text" name="ratio2" size="6" value="<?=display_str($_GET['ratio2'])?>" />
@ -547,9 +547,9 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr">Donor:</td>
<td>
<select name="donor">
<option value=""<? if ($_GET['donor']==='') {echo ' selected="selected"';} ?>>Any</option>
<option value="yes"<? if ($_GET['donor']==='yes') {echo ' selected="selected"';} ?>>Yes</option>
<option value="no"<? if ($_GET['donor']==='no') {echo ' selected="selected"';} ?>>No</option>
<option value=""<? if ($_GET['donor'] === '') { echo ' selected="selected"'; } ?>>Any</option>
<option value="yes"<? if ($_GET['donor'] === 'yes') { echo ' selected="selected"'; } ?>>Yes</option>
<option value="no"<? if ($_GET['donor'] === 'no') { echo ' selected="selected"'; } ?>>No</option>
</select>
</td>
</tr>
@ -567,11 +567,11 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr"><span title="Units are in gibibytes (the base 2 sibling of gigabytes)">Uploaded:</span></td>
<td width="30%">
<select name="uploaded">
<option value="equal"<? if ($_GET['uploaded']==='equal') {echo ' selected="selected"';} ?>>Equal</option>
<option value="above"<? if ($_GET['uploaded']==='above') {echo ' selected="selected"';} ?>>Above</option>
<option value="below"<? if ($_GET['uploaded']==='below') {echo ' selected="selected"';} ?>>Below</option>
<option value="between"<? if ($_GET['uploaded']==='between') {echo ' selected="selected"';} ?>>Between</option>
<option value="buffer"<? if ($_GET['uploaded']==='buffer') {echo ' selected="selected"';} ?>>Buffer</option>
<option value="equal"<? if ($_GET['uploaded'] === 'equal') { echo ' selected="selected"'; } ?>>Equal</option>
<option value="above"<? if ($_GET['uploaded'] === 'above') { echo ' selected="selected"'; } ?>>Above</option>
<option value="below"<? if ($_GET['uploaded'] === 'below') { echo ' selected="selected"'; } ?>>Below</option>
<option value="between"<? if ($_GET['uploaded'] === 'between') { echo ' selected="selected"'; } ?>>Between</option>
<option value="buffer"<? if ($_GET['uploaded'] === 'buffer') { echo ' selected="selected"'; } ?>>Buffer</option>
</select>
<input type="text" name="uploaded1" size="6" value="<?=display_str($_GET['uploaded1'])?>" />
<input type="text" name="uploaded2" size="6" value="<?=display_str($_GET['uploaded2'])?>" />
@ -579,9 +579,9 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr">Warned:</td>
<td>
<select name="warned">
<option value=""<? if ($_GET['warned']==='') {echo ' selected="selected"';} ?>>Any</option>
<option value="yes"<? if ($_GET['warned']==='yes') {echo ' selected="selected"';} ?>>Yes</option>
<option value="no"<? if ($_GET['warned']==='no') {echo ' selected="selected"';} ?>>No</option>
<option value=""<? if ($_GET['warned'] === '') { echo ' selected="selected"'; } ?>>Any</option>
<option value="yes"<? if ($_GET['warned'] === 'yes') { echo ' selected="selected"'; } ?>>Yes</option>
<option value="no"<? if ($_GET['warned'] === 'no') { echo ' selected="selected"'; } ?>>No</option>
</select>
</td>
</tr>
@ -590,10 +590,10 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr"># of invites:</td>
<td>
<select name="invites">
<option value="equal"<? if ($_GET['invites']==='equal') {echo ' selected="selected"';} ?>>Equal</option>
<option value="above"<? if ($_GET['invites']==='above') {echo ' selected="selected"';} ?>>Above</option>
<option value="below"<? if ($_GET['invites']==='below') {echo ' selected="selected"';} ?>>Below</option>
<option value="between"<? if ($_GET['invites']==='between') {echo ' selected="selected"';} ?>>Between</option>
<option value="equal"<? if ($_GET['invites'] === 'equal') { echo ' selected="selected"'; } ?>>Equal</option>
<option value="above"<? if ($_GET['invites'] === 'above') { echo ' selected="selected"'; } ?>>Above</option>
<option value="below"<? if ($_GET['invites'] === 'below') { echo ' selected="selected"'; } ?>>Below</option>
<option value="between"<? if ($_GET['invites'] === 'between') { echo ' selected="selected"'; } ?>>Between</option>
</select>
<input type="text" name="invites1" size="6" value="<?=display_str($_GET['invites1'])?>" />
<input type="text" name="invites2" size="6" value="<?=display_str($_GET['invites2'])?>" />
@ -601,10 +601,10 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr"><span title="Units are in gibibytes (the base 2 sibling of gigabytes)">Downloaded:</span></td>
<td width="30%">
<select name="downloaded">
<option value="equal"<? if ($_GET['downloaded']==='equal') {echo ' selected="selected"';} ?>>Equal</option>
<option value="above"<? if ($_GET['downloaded']==='above') {echo ' selected="selected"';} ?>>Above</option>
<option value="below"<? if ($_GET['downloaded']==='below') {echo ' selected="selected"';} ?>>Below</option>
<option value="between"<? if ($_GET['downloaded']==='between') {echo ' selected="selected"';} ?>>Between</option>
<option value="equal"<? if ($_GET['downloaded'] === 'equal') { echo ' selected="selected"'; } ?>>Equal</option>
<option value="above"<? if ($_GET['downloaded'] === 'above') { echo ' selected="selected"'; } ?>>Above</option>
<option value="below"<? if ($_GET['downloaded'] === 'below') { echo ' selected="selected"'; } ?>>Below</option>
<option value="between"<? if ($_GET['downloaded'] === 'between') { echo ' selected="selected"'; } ?>>Between</option>
</select>
<input type="text" name="downloaded1" size="6" value="<?=display_str($_GET['downloaded1'])?>" />
<input type="text" name="downloaded2" size="6" value="<?=display_str($_GET['downloaded2'])?>" />
@ -621,19 +621,19 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr">Disabled invites:</td>
<td>
<select name="disabled_invites">
<option value=""<? if ($_GET['disabled_invites']==='') {echo ' selected="selected"';} ?>>Any</option>
<option value="yes"<? if ($_GET['disabled_invites']==='yes') {echo ' selected="selected"';} ?>>Yes</option>
<option value="no"<? if ($_GET['disabled_invites']==='no') {echo ' selected="selected"';} ?>>No</option>
<option value=""<? if ($_GET['disabled_invites'] === '') { echo ' selected="selected"'; } ?>>Any</option>
<option value="yes"<? if ($_GET['disabled_invites'] === 'yes') { echo ' selected="selected"'; } ?>>Yes</option>
<option value="no"<? if ($_GET['disabled_invites'] === 'no') { echo ' selected="selected"'; } ?>>No</option>
</select>
</td>
<td class="label nobr">Snatched:</td>
<td width="30%">
<select name="snatched">
<option value="equal"<? if (isset($_GET['snatched']) && $_GET['snatched']==='equal') {echo ' selected="selected"';} ?>>Equal</option>
<option value="above"<? if (isset($_GET['snatched']) && $_GET['snatched']==='above') {echo ' selected="selected"';} ?>>Above</option>
<option value="below"<? if (isset($_GET['snatched']) && $_GET['snatched']==='below') {echo ' selected="selected"';} ?>>Below</option>
<option value="between"<? if (isset($_GET['snatched']) && $_GET['snatched']==='between') {echo ' selected="selected"';} ?>>Between</option>
<option value="off"<? if (isset($_GET['snatched']) && $_GET['snatched']==='off') {echo ' selected="selected"';} ?>>Off</option>
<option value="equal"<? if (isset($_GET['snatched']) && $_GET['snatched'] === 'equal') { echo ' selected="selected"'; } ?>>Equal</option>
<option value="above"<? if (isset($_GET['snatched']) && $_GET['snatched'] === 'above') { echo ' selected="selected"'; } ?>>Above</option>
<option value="below"<? if (isset($_GET['snatched']) && $_GET['snatched'] === 'below') { echo ' selected="selected"'; } ?>>Below</option>
<option value="between"<? if (isset($_GET['snatched']) && $_GET['snatched'] === 'between') { echo ' selected="selected"'; } ?>>Between</option>
<option value="off"<? if (isset($_GET['snatched']) && $_GET['snatched'] === 'off') { echo ' selected="selected"'; } ?>>Off</option>
</select>
<input type="text" name="snatched1" size="6" value="<?=display_str($_GET['snatched1'])?>" />
<input type="text" name="snatched2" size="6" value="<?=display_str($_GET['snatched2'])?>" />
@ -641,9 +641,9 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr">Disabled uploads:</td>
<td>
<select name="disabled_uploads">
<option value=""<? if (isset($_GET['disabled_uploads']) && $_GET['disabled_uploads']==='') {echo ' selected="selected"';} ?>>Any</option>
<option value="yes"<? if (isset($_GET['disabled_uploads']) && $_GET['disabled_uploads']==='yes') {echo ' selected="selected"';} ?>>Yes</option>
<option value="no"<? if (isset($_GET['disabled_uploads']) && $_GET['disabled_uploads']==='no') {echo ' selected="selected"';} ?>>No</option>
<option value=""<? if (isset($_GET['disabled_uploads']) && $_GET['disabled_uploads'] === '') { echo ' selected="selected"'; } ?>>Any</option>
<option value="yes"<? if (isset($_GET['disabled_uploads']) && $_GET['disabled_uploads'] === 'yes') { echo ' selected="selected"'; } ?>>Yes</option>
<option value="no"<? if (isset($_GET['disabled_uploads']) && $_GET['disabled_uploads'] === 'no') { echo ' selected="selected"'; } ?>>No</option>
</select>
</td>
</tr>
@ -679,8 +679,8 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr"><span title="Two-letter codes as defined in ISO 3166-1 alpha-2">Country code:</span></td>
<td width="30%">
<select name="cc_op">
<option value="equal"<? if ($_GET['cc_op'] === 'equal') { echo ' selected="selected"';} ?>>Equals</option>
<option value="not_equal"<? if ($_GET['cc_op'] === 'not_equal') { echo ' selected="selected"';} ?>>Not equal</option>
<option value="equal"<? if ($_GET['cc_op'] === 'equal') { echo ' selected="selected"'; } ?>>Equals</option>
<option value="not_equal"<? if ($_GET['cc_op'] === 'not_equal') { echo ' selected="selected"'; } ?>>Not equal</option>
</select>
<input type="text" name="cc" size="2" value="<?=display_str($_GET['cc'])?>" />
</td>
@ -710,9 +710,9 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
<td class="label nobr"># of emails:</td>
<td>
<select name="emails_opt">
<option value="equal"<? if ($_GET['emails_opt']==='equal') {echo ' selected="selected"';} ?>>Equal</option>
<option value="above"<? if ($_GET['emails_opt']==='above') {echo ' selected="selected"';} ?>>Above</option>
<option value="below"<? if ($_GET['emails_opt']==='below') {echo ' selected="selected"';} ?>>Below</option>
<option value="equal"<? if ($_GET['emails_opt'] === 'equal') { echo ' selected="selected"'; } ?>>Equal</option>
<option value="above"<? if ($_GET['emails_opt'] === 'above') { echo ' selected="selected"'; } ?>>Above</option>
<option value="below"<? if ($_GET['emails_opt'] === 'below') { echo ' selected="selected"'; } ?>>Below</option>
</select>
<input type="text" name="email_cnt" size="6" value="<?=display_str($_GET['email_cnt'])?>" />
</td>
@ -778,7 +778,7 @@ function num_compare($Field, $Operand, $Num1, $Num2 = '') {
$DB->set_query_id($Results);
?>
<td><?=number_format((int)$Downloads)?></td>
<td><?=is_numeric($Snatched) ? number_format($Snatched) : display_str($Snatched)?></td>
<td><?=(is_numeric($Snatched) ? number_format($Snatched) : display_str($Snatched))?></td>
<td><? if ($DisableInvites) { echo 'X'; } else { echo number_format($Invites); } ?></td>
</tr>
<?

View File

@ -199,7 +199,7 @@ function user_dupes_table($UserID) {
<input type="hidden" id="form_comment_hash" name="form_comment_hash" value="<?=$CommentHash?>" />
<div class="box" id="l_a_box">
<div class="head">
<a href="#l_a_box"><strong>&uarr;</strong></a> <?=max($DupeCount - 1, 0)?> Linked account<?=(($DupeCount == 2) ? '' : 's')?> <a href="#" onclick="$('.linkedaccounts').toggle(); return false;" class="brackets">View</a>
<a href="#l_a_box" class="brackets anchor">#</a> <?=max($DupeCount - 1, 0)?> Linked account<?=(($DupeCount == 2) ? '' : 's')?> <a href="#" onclick="$('.linkedaccounts').toggle(); return false;" class="brackets">View</a>
</div>
<table width="100%" class="layout hidden linkedaccounts">
<?=($DupeCount ? '<tr>' : '')?>

View File

@ -1,4 +1,4 @@
<?
<?php
/**********************************************************************
*>>>>>>>>>>>>>>>>>>>>>>>>>>> User search <<<<<<<<<<<<<<<<<<<<<<<<<<<<*
**********************************************************************/
@ -19,7 +19,7 @@
if (!$Err) {
// Passed validation. Let's rock.
list($Page,$Limit) = Format::page_limit(USERS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(USERS_PER_PAGE);
if ($Page > 10) {
$Page = 10;
$Limit = sprintf("%d, %d", ($Page - 1) * USERS_PER_PAGE, USERS_PER_PAGE);

View File

@ -183,15 +183,7 @@ function check_paranoia_here($Setting) {
<div class="linkbox">
<? if (!$OwnProfile) { ?>
<a href="inbox.php?action=compose&amp;to=<?=$UserID?>" class="brackets">Send message</a>
<? if (check_perms("users_mod")) {
$DB->query("SELECT PushService FROM users_push_notifications WHERE UserID = '$UserID'");
if ($DB->record_count() > 0) { ?>
<a
href="user.php?action=take_push&amp;push=1&amp;userid=<?=$UserID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets"
>Push user</a>
<? }
}
<?
$DB->query("SELECT FriendID FROM friends WHERE UserID='$LoggedUser[ID]' AND FriendID='$UserID'");
if ($DB->record_count() == 0) { ?>
<a href="friends.php?action=add&amp;friendid=<?=$UserID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Add to friends</a>
@ -571,7 +563,7 @@ function check_paranoia_here($Setting) {
<table class="layout recent" id="recent_snatches" cellpadding="0" cellspacing="0" border="0">
<tr class="colhead">
<td colspan="5">
<a href="#recent_snatches"><strong>&uarr;</strong></a> Recent snatches
<a href="#recent_snatches" class="brackets anchor">#</a> Recent snatches
</td>
</tr>
<tr>
@ -615,7 +607,7 @@ function check_paranoia_here($Setting) {
<table class="layout recent" id="recent_uploads" cellpadding="0" cellspacing="0" border="0">
<tr class="colhead">
<td colspan="5">
<a href="#recent_uploads"><strong>&uarr;</strong></a> Recent uploads
<a href="#recent_uploads" class="brackets anchor">#</a> Recent uploads
</td>
</tr>
<tr>
@ -655,7 +647,7 @@ function check_paranoia_here($Setting) {
<tr class="colhead">
<td colspan="5">
<span style="float: left;">
<a href="#collage<?=$CollageID?>_box"><strong>&uarr;</strong></a> <?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>" class="brackets">See full</a>
<a href="#collage<?=$CollageID?>_box" class="brackets anchor">#</a> <?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>" class="brackets">See full</a>
</span>
<span style="float: right;">
<a href="#" onclick="$('#collage<?=$CollageID?>_box .images').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="brackets"><?=$FirstCol ? 'Hide' : 'Show' ?></a>
@ -695,7 +687,7 @@ function check_paranoia_here($Setting) {
?>
<div class="box" id="invitetree_box">
<div class="head">
<a href="#invitetree_box"><strong>&uarr;</strong></a> Invite tree <a href="#" onclick="$('#invitetree').toggle();return false;" class="brackets">View</a>
<a href="#invitetree_box" class="brackets anchor">#</a> Invite tree <a href="#" onclick="$('#invitetree').toggle();return false;" class="brackets">View</a>
</div>
<div id="invitetree" class="hidden">
<? $Tree->make_tree(); ?>
@ -728,7 +720,7 @@ function check_paranoia_here($Setting) {
?>
<div class="box" id="requests_box">
<div class="head">
<a href="#requests_box"><strong>&uarr;</strong></a> Requests <a href="#" onclick="$('#requests').toggle();return false;" class="brackets">View</a>
<a href="#requests_box" class="brackets anchor">#</a> Requests <a href="#" onclick="$('#requests').toggle();return false;" class="brackets">View</a>
</div>
<div id="requests" class="request_table hidden">
<table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
@ -831,7 +823,7 @@ function check_paranoia_here($Setting) {
?>
<div class="box" id="staffpms_box">
<div class="head">
<a href="#staffpms_box"><strong>&uarr;</strong></a> Staff PMs <a href="#" onclick="$('#staffpms').toggle();return false;" class="brackets">View</a>
<a href="#staffpms_box" class="brackets anchor">#</a> Staff PMs <a href="#" onclick="$('#staffpms').toggle();return false;" class="brackets">View</a>
</div>
<table width="100%" class="message_table hidden" id="staffpms">
<tr class="colhead">
@ -902,7 +894,7 @@ function check_paranoia_here($Setting) {
<div class="box" id="staff_notes_box">
<div class="head">
<a href="#staff_notes_box"><strong>&uarr;</strong></a> Staff notes
<a href="#staff_notes_box" class="brackets anchor">#</a> Staff notes
<a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Edit</a>
<a href="#" onclick="$('#staffnotes').toggle(); return false;" class="brackets">Toggle</a>
</div>
@ -920,7 +912,7 @@ function check_paranoia_here($Setting) {
<table class="layout" id="user_info_box">
<tr class="colhead">
<td colspan="2">
<a href="#user_info_box"><strong>&uarr;</strong></a> User information
<a href="#user_info_box" class="brackets anchor">#</a> User information
</td>
</tr>
<? if (check_perms('users_edit_usernames', $Class)) { ?>
@ -1106,7 +1098,7 @@ function check_paranoia_here($Setting) {
<table class="layout" id="warn_user_box">
<tr class="colhead">
<td colspan="2">
<a href="#warn_user_box"><strong>&uarr;</strong></a> Warn user
<a href="#warn_user_box" class="brackets anchor">#</a> Warn user
</td>
</tr>
<tr>
@ -1165,7 +1157,7 @@ function check_paranoia_here($Setting) {
<table class="layout" id="user_privs_box">
<tr class="colhead">
<td colspan="2">
<a href="#user_privs_box"><strong>&uarr;</strong></a> User privileges
<a href="#user_privs_box" class="brackets anchor">#</a> User privileges
</td>
</tr>
<? if (check_perms('users_disable_posts') || check_perms('users_disable_any')) {
@ -1255,7 +1247,7 @@ function check_paranoia_here($Setting) {
<table class="layout" id="session_box">
<tr class="colhead">
<td colspan="2">
<a href="#session_box"><strong>&uarr;</strong></a> Session
<a href="#session_box" class="brackets anchor">#</a> Session
</td>
</tr>
<tr>
@ -1272,7 +1264,7 @@ function check_paranoia_here($Setting) {
<table class="layout" id="submit_box">
<tr class="colhead">
<td colspan="2">
<a href="#submit_box"><strong>&uarr;</strong></a> Submit
<a href="#submit_box" class="brackets anchor">#</a> Submit
</td>
</tr>
<tr>

View File

@ -1,4 +1,4 @@
<?
<?php
/************************************************************************
||------------|| User IP history page ||---------------------------||
@ -84,7 +84,7 @@ function UnBan(ip, id, elemID) {
//]]>
</script>
<?
list($Page,$Limit) = Format::page_limit(IPS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(IPS_PER_PAGE);
if ($UsersOnly == 1) {
$RS = $DB->query("

View File

@ -1,4 +1,4 @@
<?
<?php
/************************************************************************
||------------|| User IP history page ||---------------------------||
@ -43,7 +43,7 @@ function ShowIPs(rowname) {
}
</script>
<?
list($Page,$Limit) = Format::page_limit(IPS_PER_PAGE);
list($Page, $Limit) = Format::page_limit(IPS_PER_PAGE);
$TrackerIps = $DB->query("
SELECT IP, fid, tstamp

View File

@ -1,4 +1,4 @@
<?
<?php
/*
User post history page
*/
@ -21,7 +21,7 @@
$PerPage = POSTS_PER_PAGE;
}
list($Page,$Limit) = Format::page_limit($PerPage);
list($Page, $Limit) = Format::page_limit($PerPage);
$UserInfo = Users::user_info($UserID);
extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));

View File

@ -1,4 +1,4 @@
<?
<?php
/*
User topic subscription page
*/
@ -15,7 +15,7 @@
} else {
$PerPage = POSTS_PER_PAGE;
}
list($Page,$Limit) = Format::page_limit($PerPage);
list($Page, $Limit) = Format::page_limit($PerPage);
View::show_header('Subscribed topics','subscriptions,bbcode');

View File

@ -1,4 +1,4 @@
<?
<?php
/************************************************************************
||------------------|| User token history page ||-----------------------||
This page lists the torrents a user has spent his tokens on. It
@ -48,7 +48,7 @@
View::show_header('Freeleech token history');
list($Page,$Limit) = Format::page_limit(25);
list($Page, $Limit) = Format::page_limit(25);
$DB->query("
SELECT SQL_CALC_FOUND_ROWS

View File

@ -1,4 +1,4 @@
<?
<?php
if (empty($_GET['nojump'])) {
$ArticleID = $Alias->to_id($_GET['search']);
if ($ArticleID) { //Found Article
@ -7,7 +7,7 @@
}
define('ARTICLES_PER_PAGE', 25);
list($Page,$Limit) = Format::page_limit(ARTICLES_PER_PAGE);
list($Page, $Limit) = Format::page_limit(ARTICLES_PER_PAGE);
$OrderVals = array('Title', 'Created', 'Edited');
$WayVals = array('Ascending', 'Descending');

View File

@ -1,5 +1,5 @@
/*
TODO: Move to more efficient structure used in class_ajax.
TODO: Move to more efficient structure used in ajax.class.
Example Usage:
<script type="text/javascript">

View File

@ -47,7 +47,7 @@ function Load(reportid) {
function ErrorBox(reportid, message) {
var div = document.createElement("div");
div.id = "#error_box";
div.innerHTML = "<table class='layout'><tr><td class='center'>Message from report " + reportid + ": " + message + "\n <input type='button' value='Hide Errors' onclick='HideErrors();' /></td></tr></table>";
div.innerHTML = '<table class="layout"><tr><td class="center">Message from report ' + reportid + ': ' + message + '\n <input type="button" value="Hide Errors" onclick="HideErrors();" /></td></tr></table>';
$('#all_reports').raw().insertBefore(div, $('#all_reports').raw().firstChild);
}
@ -102,7 +102,7 @@ function NewReport(q, view, id) {
if (!$('#report').results() && !$('#no_reports').results()) {
var div = document.createElement("div");
div.id = "no_reports";
div.innerHTML = "<table class='layout'><tr><td class='center'><strong>No new reports! \\o/</strong></td></tr></table>";
div.innerHTML = '<table class="layout"><tr><td class="center"><strong>No new reports! \\o/</strong></td></tr></table>';
$('#all_reports').raw().appendChild(div);
}
}

View File

@ -491,3 +491,8 @@ tr.torrent .bookmark>a:after {
text-align: center;
margin-top: 10px;
}
.anchor {
font-size: 85%;
font-weight: normal;
}

View File

@ -536,7 +536,7 @@ p.min_padding {
}
.sidebar .box img {
margin: 0;
margin: 10px 5px 10px 5px;
}
.body {