Empty commit

This commit is contained in:
Git 2013-04-30 18:18:07 +00:00
parent 0a565870d9
commit b055e9c6f1
88 changed files with 812 additions and 798 deletions

View File

@ -70,7 +70,7 @@ function make_utf8($Str) {
$Encoding = 'UTF-8'; $Encoding = 'UTF-8';
} }
if (empty($Encoding)) { if (empty($Encoding)) {
$Encoding = mb_detect_encoding($Str,'UTF-8, ISO-8859-1'); $Encoding = mb_detect_encoding($Str, 'UTF-8, ISO-8859-1');
} }
if (empty($Encoding)) { if (empty($Encoding)) {
$Encoding = 'ISO-8859-1'; $Encoding = 'ISO-8859-1';
@ -78,7 +78,7 @@ function make_utf8($Str) {
if ($Encoding == 'UTF-8') { if ($Encoding == 'UTF-8') {
return $Str; return $Str;
} else { } else {
return @mb_convert_encoding($Str,'UTF-8',$Encoding); return @mb_convert_encoding($Str, 'UTF-8', $Encoding);
} }
} }
} }
@ -108,9 +108,9 @@ function display_array($Array, $DontEscape = array()) {
function make_secret($Length = 32) { function make_secret($Length = 32) {
$Secret = ''; $Secret = '';
$Chars='abcdefghijklmnopqrstuvwxyz0123456789'; $Chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
for($i=0; $i<$Length; $i++) { for ($i = 0; $i < $Length; $i++) {
$Rand = mt_rand(0, strlen($Chars)-1); $Rand = mt_rand(0, strlen($Chars) - 1);
$Secret .= substr($Chars, $Rand, 1); $Secret .= substr($Chars, $Rand, 1);
} }
return str_shuffle($Secret); return str_shuffle($Secret);

View File

@ -97,7 +97,7 @@ public function replace_value($Key, $Value, $Duration=2592000) {
} }
public function get_value($Key, $NoCache=false) { public function get_value($Key, $NoCache=false) {
if(!$this->InternalCache) { if (!$this->InternalCache) {
$NoCache = true; $NoCache = true;
} }
$StartTime=microtime(true); $StartTime=microtime(true);

View File

@ -456,7 +456,7 @@ public function constant_table($Constants=false) {
public function cache_table($CacheKeys=false) { public function cache_table($CacheKeys=false) {
global $Cache; global $Cache;
$Header = 'Cache Keys'; $Header = 'Cache keys';
if (!is_array($CacheKeys)) { if (!is_array($CacheKeys)) {
$CacheKeys = $this->get_cache_keys(); $CacheKeys = $this->get_cache_keys();
$Header .= ' ('.number_format($this->get_cache_time(), 5).' ms)'; $Header .= ' ('.number_format($this->get_cache_time(), 5).' ms)';

View File

@ -9,13 +9,13 @@ class ImageTools {
* Store processed links to avoid repetition * Store processed links to avoid repetition
* @var array 'URL' => 'Parsed URL' * @var array 'URL' => 'Parsed URL'
*/ */
static private $Storage = array(); private static $Storage = array();
/** /**
* We use true as an extra property to make the domain an array key * We use true as an extra property to make the domain an array key
* @var array $Hosts Array of image hosts * @var array $Hosts Array of image hosts
*/ */
static private $Hosts = array( private static $Hosts = array(
'whatimg.com' => true, 'whatimg.com' => true,
'imgur.com' => true 'imgur.com' => true
); );
@ -24,7 +24,7 @@ class ImageTools {
* Blacklisted sites * Blacklisted sites
* @var array $Blacklist Array of blacklisted hosts * @var array $Blacklist Array of blacklisted hosts
*/ */
static private $Blacklist = array( private static $Blacklist = array(
'tinypic.com' 'tinypic.com'
); );
@ -32,7 +32,7 @@ class ImageTools {
* Array of image hosts that provide thumbnailing * Array of image hosts that provide thumbnailing
* @var array $Thumbs * @var array $Thumbs
*/ */
static private $Thumbs = array( private static $Thumbs = array(
'i.imgur.com' => true, 'i.imgur.com' => true,
'whatimg.com' => true 'whatimg.com' => true
); );
@ -41,7 +41,7 @@ class ImageTools {
* Array of extensions * Array of extensions
* @var array $Extensions * @var array $Extensions
*/ */
static private $Extensions = array( private static $Extensions = array(
'jpg' => true, 'jpg' => true,
'jpeg' => true, 'jpeg' => true,
'png' => true, 'png' => true,
@ -78,7 +78,7 @@ public static function blacklisted($Url) {
* @param string $Url Link to an image * @param string $Url Link to an image
* @return string|false Matched host or false * @return string|false Matched host or false
*/ */
public static function thumbnailable($Url) { private static function thumbnailable($Url) {
$ParsedUrl = parse_url($Url); $ParsedUrl = parse_url($Url);
return !empty(self::$Thumbs[$ParsedUrl['host']]); return !empty(self::$Thumbs[$ParsedUrl['host']]);
} }
@ -88,7 +88,7 @@ public static function thumbnailable($Url) {
* @param string $Ext Extension to check * @param string $Ext Extension to check
* @return boolean * @return boolean
*/ */
public static function valid_extension($Ext) { private static function valid_extension($Ext) {
// return @self::$Extensions[$Ext] === true; // return @self::$Extensions[$Ext] === true;
return !empty(self::$Extensions[$Ext]) && self::$Extensions[$Ext] === true; return !empty(self::$Extensions[$Ext]) && self::$Extensions[$Ext] === true;
} }
@ -98,7 +98,7 @@ public static function valid_extension($Ext) {
* @param type $Link * @param type $Link
* @param type $Processed * @param type $Processed
*/ */
public static function store($Link, $Processed) { private static function store($Link, $Processed) {
self::$Storage[$Link] = $Processed; self::$Storage[$Link] = $Processed;
} }
@ -107,7 +107,7 @@ public static function store($Link, $Processed) {
* @param type $Link * @param type $Link
* @return boolean|string Returns false if no match * @return boolean|string Returns false if no match
*/ */
public static function get_stored($Link) { private static function get_stored($Link) {
if (isset(self::$Storage[$Link])) { if (isset(self::$Storage[$Link])) {
return self::$Storage[$Link]; return self::$Storage[$Link];
} }
@ -115,79 +115,34 @@ public static function get_stored($Link) {
} }
/** /**
* Turns link into thumbnail (if possible) or default group image (if missing) * Checks if URL points to a whatimg thumbnail.
* Automatically applies proxy when appropriate
*
* @global array $CategoryIcons
* @param string $Link Link to an image
* @param int $Groupid The torrent's group ID for a default image
* @param boolean $Thumb Thumbnail image
* @return string Link to image
*/ */
public static function wiki_image($Link, $GroupID = 0, $Thumb = true) { private static function has_whatimg_thumb($Url) {
global $CategoryIcons; return (strpos($Url, '_thumb') !== false);
if ($Link && $Thumb) {
$Thumb = self::thumbnail($Link);
if (check_perms('site_proxy_images')) {
return self::proxy_url($Thumb);
}
return $Thumb;
}
return STATIC_SERVER . 'common/noartwork/' . $CategoryIcons[$GroupID];
} }
/** /**
* The main function called to get a thumbnail link. * Cleans up imgur URL if it already has a modifier attached to the end of it.
* Use wiki_image() instead of this method for more advanced options
*
* @param string $Link Image link
* @return string Image link
*/ */
public static function thumbnail($Link) { private static function clean_imgur_url($Url) {
if (($Found = self::get_stored($Link))) { $Extension = pathinfo($Url, PATHINFO_EXTENSION);
return $Found; $Full = preg_replace('/\.[^.]*$/', '', $Url);
} $Base = substr($Full, 0, strrpos($Full, '/'));
return self::process_thumbnail($Link); $Path = substr($Full, strrpos($Full, '/') + 1);
if (strlen($Path) == 6) {
$Last = $Path[strlen($Path) - 1];
if ($Last == 'm' || $Last == 'l' || $Last == 's' || $Last == 'h' || $Last == 'b') {
$Path = substr($Path, 0, -1);
}
}
return $Base . '/' . $Path . '.' . $Extension;
} }
/** /**
* Matches a hosts that thumbnails and stores link * Replaces the extension.
* @param string $Link Image link
* @return string Thumbnail link or Image link
*/ */
static private function process_thumbnail($Link) { private static function replace_extension($String, $Extension) {
$Thumb = $Link; return preg_replace('/\.[^.]*$/', $Extension, $String);
$Extension = pathinfo($Link, PATHINFO_EXTENSION);
if (self::thumbnailable($Link) && self::valid_extension($Extension)) {
if (contains('whatimg', $Link) && !has_whatimg_thumb($Link)) {
$Thumb = replace_extension($Link, '_thumb.' . $Extension);
} elseif (contains('imgur', $Link)) {
$Thumb = replace_extension(clean_imgur_url($Link), 'm.' . $Extension);
}
}
self::store($Link, $Thumb);
return $Thumb;
}
/**
* Creates an HTML thumbnail
* @param type $Source
* @param type $Category
* @param type $Size
*/
public static function cover_thumb($Source, $Category = 0, $Size = 90, $Title = 'Cover') {
$Img = self::wiki_image($Source, $Category);
if (!$Source) {
$Source = $Img;
} elseif (check_perms('site_proxy_images')) {
$Source = self::proxy_url($Source);
}
?>
<img src="<?=$Img?>" width="<?=$Size?>" height="<?=$Size?>" alt="<?=$Title?>" onclick="lightbox.init('<?=$Source?>', <?=$Size?>)" />
<?
} }
/** /**
@ -197,48 +152,70 @@ public static function cover_thumb($Source, $Category = 0, $Size = 90, $Title =
*/ */
public static function proxy_url($Url) { public static function proxy_url($Url) {
global $SSL; global $SSL;
return ($SSL ? 'https' : 'http') . '://' . SITE_URL return ($SSL ? 'https' : 'http') . '://' . SITE_URL . '/image.php?c=1&amp;i=' . urlencode($Url);
. '/image.php?i=' . urlencode($Url);
} }
}
/** /**
* This non-class determines the thumbnail equivalent of an image's URL after being passed the original * Determine the image URL. This takes care of the image proxy and thumbnailing.
* * @param string $Url
**/ * @param bool $Thumb
* @return string
*/
/** public static function process($Url, $Thumb = false) {
* Replaces the extension. global $LoggedUser;
*/ if (empty($Url)) {
function replace_extension($String, $Extension) { return '';
return preg_replace('/\.[^.]*$/', $Extension, $String);
}
function contains($Substring, $String) {
return strpos($String, $Substring) !== false;
}
/**
* Checks if URL points to a whatimg thumbnail.
*/
function has_whatimg_thumb($Url) {
return contains("_thumb", $Url);
}
/**
* Cleans up imgur URL if it already has a modifier attached to the end of it.
*/
function clean_imgur_url($Url) {
$Extension = pathinfo($Url, PATHINFO_EXTENSION);
$Full = preg_replace('/\.[^.]*$/', '', $Url);
$Base = substr($Full, 0, strrpos($Full, '/'));
$Path = substr($Full, strrpos($Full, '/') + 1);
if (strlen($Path) == 6) {
$Last = $Path[strlen($Path) - 1];
if ($Last == 'm' || $Last == 'l' || $Last == 's' || $Last == 'h' || $Last == 'b') {
$Path = substr($Path, 0, -1);
} }
if (($Found = self::get_stored($Url . ($Thumb ? '_thumb' : '')))) {
return $Found;
}
$ProcessedUrl = $Url;
if ($Thumb) {
$Extension = pathinfo($Url, PATHINFO_EXTENSION);
if (self::thumbnailable($Url) && self::valid_extension($Extension)) {
if (strpos($Url, 'whatimg') !== false && !self::has_whatimg_thumb($Url)) {
$ProcessedUrl = self::replace_extension($Url, '_thumb.' . $Extension);
} elseif (strpos($Url, 'imgur') !== false) {
$ProcessedUrl = self::replace_extension(self::clean_imgur_url($Url), 'm.' . $Extension);
}
}
}
if (isset($LoggedUser['Permissions'])) {
/*
* We only want to apply the proxy and store the processed URL if the
* permissions were loaded before. This is necessary because self::process
* is used in Users::user_info which is called in script_start.php before
* the permissions are loaded, causing the own avatar to always load without
* proxy later on.
*/
if (check_perms('site_proxy_images')) {
$ProcessedUrl = self::proxy_url($ProcessedUrl);
}
self::store($Url . ($Thumb ? '_thumb' : ''), $ProcessedUrl);
}
return $ProcessedUrl;
}
/**
* Cover art thumbnail in browse, on artist pages etc.
* @global array $CategoryIcons
* @param string $Url
* @param int $CategoryID
*/
public static function cover_thumb($Url, $CategoryID) {
global $CategoryIcons;
if ($Url) {
$Src = self::process($Url, true);
$Lightbox = self::process($Url);
} else {
$Src = STATIC_SERVER . 'common/noartwork/' . $CategoryIcons[$CategoryID - 1];
$Lightbox = $Src;
}
?>
<img src="<?=$Src?>" width="90" height="90" alt="Cover" onclick="lightbox.init('<?=$Lightbox?>', 90)" />
<?
} }
return $Base . '/' . $Path . '.' . $Extension;
} }

View File

@ -50,48 +50,51 @@ function check_paranoia($Property, $Paranoia, $UserClass, $UserID = false) {
if ($Property == false) { if ($Property == false) {
return false; return false;
} }
if(!is_array($Paranoia)) { if (!is_array($Paranoia)) {
$Paranoia = unserialize($Paranoia); $Paranoia = unserialize($Paranoia);
} }
if(!is_array($Paranoia)) { if (!is_array($Paranoia)) {
$Paranoia = array(); $Paranoia = array();
} }
if(is_array($Property)) { if (is_array($Property)) {
$all = true; $all = true;
foreach ($Property as $P) { $all = $all && check_paranoia($P, $Paranoia, $UserClass, $UserID); } foreach ($Property as $P) {
$all = $all && check_paranoia($P, $Paranoia, $UserClass, $UserID);
}
return $all; return $all;
} else { } else {
if(($UserID !== false) && ($LoggedUser['ID'] == $UserID)) { if (($UserID !== false) && ($LoggedUser['ID'] == $UserID)) {
return PARANOIA_ALLOWED; return PARANOIA_ALLOWED;
} }
$May = !in_array($Property, $Paranoia) && !in_array($Property . '+', $Paranoia); $May = !in_array($Property, $Paranoia) && !in_array($Property . '+', $Paranoia);
if($May) if ($May)
return PARANOIA_ALLOWED; return PARANOIA_ALLOWED;
if(check_perms('users_override_paranoia', $UserClass)) if (check_perms('users_override_paranoia', $UserClass)) {
return PARANOIA_OVERRIDDEN; return PARANOIA_OVERRIDDEN;
}
$Override=false; $Override=false;
switch ($Property) { switch ($Property) {
case 'downloaded': case 'downloaded':
case 'ratio': case 'ratio':
case 'uploaded': case 'uploaded':
case 'lastseen': case 'lastseen':
if(check_perms('users_mod', $UserClass)) if (check_perms('users_mod', $UserClass))
return PARANOIA_OVERRIDDEN; return PARANOIA_OVERRIDDEN;
break; break;
case 'snatched': case 'snatched+': case 'snatched': case 'snatched+':
if(check_perms('users_view_torrents_snatchlist', $UserClass)) if (check_perms('users_view_torrents_snatchlist', $UserClass))
return PARANOIA_OVERRIDDEN; return PARANOIA_OVERRIDDEN;
break; break;
case 'uploads': case 'uploads+': case 'uploads': case 'uploads+':
case 'seeding': case 'seeding+': case 'seeding': case 'seeding+':
case 'leeching': case 'leeching+': case 'leeching': case 'leeching+':
if(check_perms('users_view_seedleech', $UserClass)) if (check_perms('users_view_seedleech', $UserClass))
return PARANOIA_OVERRIDDEN; return PARANOIA_OVERRIDDEN;
break; break;
case 'invitedcount': case 'invitedcount':
if(check_perms('users_view_invites', $UserClass)) if (check_perms('users_view_invites', $UserClass))
return PARANOIA_OVERRIDDEN; return PARANOIA_OVERRIDDEN;
break; break;
} }

View File

@ -1,6 +1,6 @@
<? <?
//Require base class //Require base class
if(!extension_loaded('sphinx')) { if (!extension_loaded('sphinx')) {
require(SERVER_ROOT.'/classes/sphinxapi.php'); require(SERVER_ROOT.'/classes/sphinxapi.php');
} }
@ -51,17 +51,17 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
$QueryEndTime=microtime(true); $QueryEndTime=microtime(true);
$Filters = array(); $Filters = array();
foreach($this->Filters as $Name => $Values) { foreach ($this->Filters as $Name => $Values) {
foreach($Values as $Value) { foreach ($Values as $Value) {
$Filters[] = $Name." - ".$Value; $Filters[] = $Name." - ".$Value;
} }
} }
$this->Queries[]=array('Params: '.$Query.' Filters: '.implode(", ", $Filters).' Indicies: '.$this->Index,($QueryEndTime-$QueryStartTime)*1000); $this->Queries[] = array('Params: '.$Query.' Filters: '.implode(", ", $Filters).' Indicies: '.$this->Index,($QueryEndTime-$QueryStartTime) * 1000);
$this->Time+=($QueryEndTime-$QueryStartTime)*1000; $this->Time += ($QueryEndTime-$QueryStartTime) * 1000;
if($Result === false) { if ($Result === false) {
if($this->_connerror && !$Cache->get_value('sphinx_crash_reported')) { if ($this->_connerror && !$Cache->get_value('sphinx_crash_reported')) {
send_irc('PRIVMSG '.ADMIN_CHAN.' :!dev Connection to searchd failed'); send_irc('PRIVMSG '.ADMIN_CHAN.' :!dev Connection to searchd failed');
$Cache->cache_value('sphinx_crash_reported', 1, 3600); $Cache->cache_value('sphinx_crash_reported', 1, 3600);
} }
@ -71,7 +71,7 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
$this->TotalResults = $Result['total_found']; $this->TotalResults = $Result['total_found'];
$this->SearchTime = $Result['time']; $this->SearchTime = $Result['time'];
if(empty($Result['matches'])) { if (empty($Result['matches'])) {
return false; return false;
} }
$Matches = $Result['matches']; $Matches = $Result['matches'];
@ -82,49 +82,49 @@ function search($Query='', $CachePrefix='', $CacheLength=0, $ReturnData=array(),
$NotFound = array(); $NotFound = array();
$Skip = array(); $Skip = array();
if(!empty($ReturnData)) { if (!empty($ReturnData)) {
$AllFields = false; $AllFields = false;
} else { } else {
$AllFields = true; $AllFields = true;
} }
foreach($MatchIDs as $Match) { foreach ($MatchIDs as $Match) {
$Matches[$Match] = $Matches[$Match]['attrs']; $Matches[$Match] = $Matches[$Match]['attrs'];
if(!empty($CachePrefix)) { if (!empty($CachePrefix)) {
$Data = $Cache->get_value($CachePrefix.'_'.$Match); $Data = $Cache->get_value($CachePrefix.'_'.$Match);
if($Data == false) { if ($Data == false) {
$NotFound[]=$Match; $NotFound[] = $Match;
continue; continue;
} }
} else { } else {
$NotFound[]=$Match; $NotFound[] = $Match;
} }
if(!$AllFields) { if (!$AllFields) {
// Populate list of fields to unset (faster than picking out the ones we need). Should only be run once, on the first cache key // Populate list of fields to unset (faster than picking out the ones we need). Should only be run once, on the first cache key
if(empty($Skip)) { if (empty($Skip)) {
foreach(array_keys($Data) as $Key) { foreach (array_keys($Data) as $Key) {
if(!in_array($Key, $ReturnData)) { if (!in_array($Key, $ReturnData)) {
$Skip[]=$Key; $Skip[] = $Key;
} }
} }
if(empty($Skip)) { if (empty($Skip)) {
$AllFields = true; $AllFields = true;
} }
} }
foreach($Skip as $Key) { foreach ($Skip as $Key) {
unset($Data[$Key]); unset($Data[$Key]);
} }
reset($Skip); reset($Skip);
} }
if(!empty($Data)) { if (!empty($Data)) {
$Matches[$Match] = array_merge($Matches[$Match], $Data); $Matches[$Match] = array_merge($Matches[$Match], $Data);
} }
} }
if($SQL!='') { if ($SQL != '') {
if(!empty($NotFound)) { 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)) { while ($Data = $DB->next_record(MYSQLI_ASSOC)) {
$Matches[$Data[$IDColumn]] = array_merge($Matches[$Data[$IDColumn]], $Data); $Matches[$Data[$IDColumn]] = array_merge($Matches[$Data[$IDColumn]], $Data);
$Cache->cache_value($CachePrefix.'_'.$Data[$IDColumn], $Data, $CacheLength); $Cache->cache_value($CachePrefix.'_'.$Data[$IDColumn], $Data, $CacheLength);
} }
@ -148,8 +148,8 @@ function set_index($Index) {
} }
function set_filter($Name, $Vals, $Exclude=false) { function set_filter($Name, $Vals, $Exclude=false) {
foreach($Vals as $Val) { foreach ($Vals as $Val) {
if($Exclude) { if ($Exclude) {
$this->Filters[$Name][] = "!$Val"; $this->Filters[$Name][] = "!$Val";
} else { } else {
$this->Filters[$Name][] = $Val; $this->Filters[$Name][] = $Val;

View File

@ -38,7 +38,7 @@ public function __construct($Server, $Port, $Socket) {
* @return identification string * @return identification string
*/ */
private function get_ident($Server, $Port, $Socket) { private function get_ident($Server, $Port, $Socket) {
if($Socket) { if ($Socket) {
return $Socket; return $Socket;
} else { } else {
return "$Server:$Port"; return "$Server:$Port";
@ -55,7 +55,7 @@ private function get_ident($Server, $Port, $Socket) {
*/ */
public static function init_connection($Server, $Port, $Socket) { public static function init_connection($Server, $Port, $Socket) {
$Ident = self::get_ident($Server, $Port, $Socket); $Ident = self::get_ident($Server, $Port, $Socket);
if(!isset(self::$Connections[$Ident])) { if (!isset(self::$Connections[$Ident])) {
self::$Connections[$Ident] = new Sphinxql($Server, $Port, $Socket); self::$Connections[$Ident] = new Sphinxql($Server, $Port, $Socket);
} }
return self::$Connections[$Ident]; return self::$Connections[$Ident];
@ -65,11 +65,11 @@ public static function init_connection($Server, $Port, $Socket) {
* Connect the Sphinxql object to the Sphinx server * Connect the Sphinxql object to the Sphinx server
*/ */
public function connect() { public function connect() {
if(!$this->Connected) { if (!$this->Connected) {
global $Debug; global $Debug;
$Debug->set_flag('Connecting to Sphinx server '.$this->Ident); $Debug->set_flag('Connecting to Sphinx server '.$this->Ident);
parent::__construct($this->Server, '', '', '', $this->Port, $this->Socket); parent::__construct($this->Server, '', '', '', $this->Port, $this->Socket);
if($this->connect_error) { if ($this->connect_error) {
$Errno = $this->connect_errno; $Errno = $this->connect_errno;
$Error = $this->connect_error; $Error = $this->connect_error;
$this->error("Connection failed. ".strval($Errno)." (".strval($Error).")"); $this->error("Connection failed. ".strval($Errno)." (".strval($Error).")");
@ -90,10 +90,10 @@ public function error($Msg, $Halt = false) {
global $Debug; global $Debug;
$ErrorMsg = 'SphinxQL ('.$this->Ident.'): '.strval($Msg); $ErrorMsg = 'SphinxQL ('.$this->Ident.'): '.strval($Msg);
$Debug->analysis('SphinxQL Error', $ErrorMsg, 3600*24); $Debug->analysis('SphinxQL Error', $ErrorMsg, 3600*24);
if($Halt === true && (DEBUG_MODE || check_perms('site_debug'))) { if ($Halt === true && (DEBUG_MODE || check_perms('site_debug'))) {
echo '<pre>'.display_str($ErrorMsg).'</pre>'; echo '<pre>'.display_str($ErrorMsg).'</pre>';
die(); die();
} elseif($Halt === true) { } elseif ($Halt === true) {
error('-1'); error('-1');
} }
} }

View File

@ -56,26 +56,26 @@ public function from($Indexes) {
* @return current Sphinxql query object * @return current Sphinxql query object
*/ */
public function where($Attribute, $Values, $Exclude = false) { public function where($Attribute, $Values, $Exclude = false) {
if(empty($Attribute) && empty($Values)) { if (empty($Attribute) && empty($Values)) {
return false; return false;
} }
$Filters = array(); $Filters = array();
if(is_array($Values)) { if (is_array($Values)) {
foreach($Values as $Value) { foreach ($Values as $Value) {
if(!is_number($Value)) { if (!is_number($Value)) {
$this->error("Filters require numeric values"); $this->error("Filters require numeric values");
} }
} }
if($Exclude) { if ($Exclude) {
$Filters[] = "$Attribute NOT IN (".implode(",", $Values).")"; $Filters[] = "$Attribute NOT IN (".implode(",", $Values).")";
} else { } else {
$Filters[] = "$Attribute IN (".implode(",", $Values).")"; $Filters[] = "$Attribute IN (".implode(",", $Values).")";
} }
} else { } else {
if(!is_number($Values)) { if (!is_number($Values)) {
$this->error("Filters require numeric values"); $this->error("Filters require numeric values");
} }
if($Exclude) { if ($Exclude) {
$Filters[] = "$Attribute != $Values"; $Filters[] = "$Attribute != $Values";
} else { } else {
$Filters[] = "$Attribute = $Values"; $Filters[] = "$Attribute = $Values";
@ -93,7 +93,7 @@ public function where($Attribute, $Values, $Exclude = false) {
* @return current Sphinxql query object * @return current Sphinxql query object
*/ */
public function where_between($Attribute, $Values) { public function where_between($Attribute, $Values) {
if(empty($Attribute) || empty($Values) || count($Values) != 2 || !is_number($Values[0]) || !is_number($Values[1])) { if (empty($Attribute) || empty($Values) || count($Values) != 2 || !is_number($Values[0]) || !is_number($Values[1])) {
$this->error("Filter range requires array of two numerical boundaries as values."); $this->error("Filter range requires array of two numerical boundaries as values.");
} }
$this->Filters[] = "$Attribute BETWEEN $Values[0] AND $Values[1]"; $this->Filters[] = "$Attribute BETWEEN $Values[0] AND $Values[1]";
@ -109,7 +109,7 @@ public function where_between($Attribute, $Values) {
* @return current Sphinxql query object * @return current Sphinxql query object
*/ */
public function where_match($Expr, $Field = '*', $Escape = true) { public function where_match($Expr, $Field = '*', $Escape = true) {
if(empty($Expr)) { if (empty($Expr)) {
return $this; return $this;
} }
if ($Field !== false) { if ($Field !== false) {
@ -216,29 +216,29 @@ private function build_options() {
* Combine the query conditions into a valid Sphinx query segment * Combine the query conditions into a valid Sphinx query segment
*/ */
private function build_query() { private function build_query() {
if(!$this->Indexes) { if (!$this->Indexes) {
$this->error('Index name is required.'); $this->error('Index name is required.');
} }
$this->QueryString = "SELECT $this->Select\nFROM $this->Indexes"; $this->QueryString = "SELECT $this->Select\nFROM $this->Indexes";
if(!empty($this->Expressions)) { if (!empty($this->Expressions)) {
$this->Filters['expr'] = "MATCH('".implode(" ", $this->Expressions)."')"; $this->Filters['expr'] = "MATCH('".implode(" ", $this->Expressions)."')";
} }
if(!empty($this->Filters)) { if (!empty($this->Filters)) {
$this->QueryString .= "\nWHERE ".implode("\n\tAND ", $this->Filters); $this->QueryString .= "\nWHERE ".implode("\n\tAND ", $this->Filters);
} }
if(!empty($this->GroupBy)) { if (!empty($this->GroupBy)) {
$this->QueryString .= "\nGROUP BY $this->GroupBy"; $this->QueryString .= "\nGROUP BY $this->GroupBy";
} }
if(!empty($this->SortGroupBy)) { if (!empty($this->SortGroupBy)) {
$this->QueryString .= "\nWITHIN GROUP ORDER BY $this->SortGroupBy"; $this->QueryString .= "\nWITHIN GROUP ORDER BY $this->SortGroupBy";
} }
if(!empty($this->SortBy)) { if (!empty($this->SortBy)) {
$this->QueryString .= "\nORDER BY ".implode(", ", $this->SortBy); $this->QueryString .= "\nORDER BY ".implode(", ", $this->SortBy);
} }
if(!empty($this->Limits)) { if (!empty($this->Limits)) {
$this->QueryString .= "\nLIMIT $this->Limits"; $this->QueryString .= "\nLIMIT $this->Limits";
} }
if(!empty($this->Options)) { if (!empty($this->Options)) {
$Options = $this->build_options(); $Options = $this->build_options();
$this->QueryString .= "\nOPTION $Options"; $this->QueryString .= "\nOPTION $Options";
} }
@ -279,12 +279,12 @@ public function raw_query($Query, $GetMeta = true) {
* @return Sphinxql result object * @return Sphinxql result object
*/ */
private function send_query($GetMeta) { private function send_query($GetMeta) {
if(!$this->QueryString) { if (!$this->QueryString) {
return false; return false;
} }
$this->Sphinxql->connect(); $this->Sphinxql->connect();
$Result = $this->Sphinxql->query($this->QueryString); $Result = $this->Sphinxql->query($this->QueryString);
if($Result === false) { if ($Result === false) {
$Errno = $this->Sphinxql->errno; $Errno = $this->Sphinxql->errno;
$Error = $this->Sphinxql->error; $Error = $this->Sphinxql->error;
$this->error("Query returned error $Errno ($Error).\n$this->QueryString"); $this->error("Query returned error $Errno ($Error).\n$this->QueryString");

View File

@ -39,7 +39,7 @@ public function __call($Name, $Arguments) {
*/ */
public function collect($Key) { public function collect($Key) {
$Return = array(); $Return = array();
while($Row = $this->fetch_array()) { while ($Row = $this->fetch_array()) {
$Return[] = $Row[$Key]; $Return[] = $Row[$Key];
} }
$this->data_seek(0); $this->data_seek(0);
@ -55,8 +55,8 @@ public function collect($Key) {
*/ */
public function to_array($Key, $ResultType = MYSQLI_ASSOC) { public function to_array($Key, $ResultType = MYSQLI_ASSOC) {
$Return = array(); $Return = array();
while($Row = $this->fetch_array($ResultType)) { while ($Row = $this->fetch_array($ResultType)) {
if($Key !== false) { if ($Key !== false) {
$Return[$Row[$Key]] = $Row; $Return[$Row[$Key]] = $Row;
} else { } else {
$Return[] = $Row; $Return[] = $Row;
@ -75,7 +75,7 @@ public function to_array($Key, $ResultType = MYSQLI_ASSOC) {
*/ */
public function to_pair($Key1, $Key2) { public function to_pair($Key1, $Key2) {
$Return = array(); $Return = array();
while($Row = $this->fetch_array()) { while ($Row = $this->fetch_array()) {
$Return[$Row[$Key1]] = $Row[$Key2]; $Return[$Row[$Key1]] = $Row[$Key2];
} }
$this->data_seek(0); $this->data_seek(0);
@ -89,11 +89,11 @@ public function to_pair($Key1, $Key2) {
* @return array with meta data * @return array with meta data
*/ */
public function get_meta($Keys = false) { public function get_meta($Keys = false) {
if($Keys !== false) { if ($Keys !== false) {
if(is_array($Keys)) { if (is_array($Keys)) {
$Return = array(); $Return = array();
foreach($Keys as $Key) { foreach ($Keys as $Key) {
if(!isset($this->Meta[$Key])) { if (!isset($this->Meta[$Key])) {
continue; continue;
} }
$Return[$Key] = $this->Meta[$Key]; $Return[$Key] = $this->Meta[$Key];
@ -114,11 +114,11 @@ public function get_meta($Keys = false) {
* @return array with result information * @return array with result information
*/ */
public function get_result_info($Keys = false) { public function get_result_info($Keys = false) {
if($Keys !== false) { if ($Keys !== false) {
if(is_array($Keys)) { if (is_array($Keys)) {
$Return = array(); $Return = array();
foreach($Keys as $Key) { foreach ($Keys as $Key) {
if(!isset($this->Result->$Key)) { if (!isset($this->Result->$Key)) {
continue; continue;
} }
$Return[$Key] = $this->Result->$Key; $Return[$Key] = $this->Result->$Key;

View File

@ -6,15 +6,15 @@
// $TPL->get(); // $TPL->get();
class TEMPLATE { class TEMPLATE {
var $file=''; var $file = '';
var $vars=array(); var $vars = array();
function open($file) { function open($file) {
$this->file=file($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!='') { if ($name != '') {
$this->vars[$name][0]=$var; $this->vars[$name][0]=$var;
$this->vars[$name][1]=$ifnone; $this->vars[$name][1]=$ifnone;
} }
@ -22,24 +22,28 @@ function set($name,$var,$ifnone='<span style="font-style: italic;">-None-</span>
function show() { function show() {
$TMPVAR=''; $TMPVAR='';
for($i=0; $i<sizeof($this->file); $i++) { for ($i=0; $i<sizeof($this->file); $i++) {
$TMPVAR=$this->file[$i]; $TMPVAR=$this->file[$i];
foreach($this->vars as $k=>$v) { foreach ($this->vars as $k=>$v) {
if ($v[1]!="" && $v[0]=="") { $v[0]=$v[1]; } if ($v[1] != '' && $v[0] == '') {
$TMPVAR=str_replace('{{'.$k.'}}',$v[0],$TMPVAR); $v[0] = $v[1];
}
$TMPVAR = str_replace('{{'.$k.'}}',$v[0],$TMPVAR);
} }
print $TMPVAR; print $TMPVAR;
} }
} }
function get() { function get() {
$RESULT=''; $RESULT = '';
$TMPVAR=''; $TMPVAR = '';
for($i=0; $i<sizeof($this->file); $i++) { for ($i = 0; $i < sizeof($this->file); $i++) {
$TMPVAR=$this->file[$i]; $TMPVAR=$this->file[$i];
foreach($this->vars as $k=>$v) { foreach ($this->vars as $k=>$v) {
if ($v[1]!="" && $v[0]=="") { $v[0]=$v[1]; } if ($v[1] != '' && $v[0] == '') {
$TMPVAR=str_replace('{{'.$k.'}}',$v[0],$TMPVAR); $v[0] = $v[1];
}
$TMPVAR = str_replace('{{'.$k.'}}',$v[0],$TMPVAR);
} }
$RESULT.=$TMPVAR; $RESULT.=$TMPVAR;
} }
@ -47,33 +51,32 @@ function get() {
} }
function str_align($len,$str,$align,$fill) { function str_align($len,$str,$align,$fill) {
$strlen=strlen($str); $strlen = strlen($str);
if ($strlen>$len) { if ($strlen > $len) {
return substr($str, 0, $len); return substr($str, 0, $len);
} elseif (($strlen==0)||($len==0)) { } elseif (($strlen == 0) || ($len == 0)) {
return ''; return '';
} else { } else {
if (($align=='l')||($align=='left')) { if (($align == 'l') || ($align == 'left')) {
$result=$str.str_repeat($fill,($len-$strlen)); $result = $str.str_repeat($fill,($len - $strlen));
} elseif (($align=='r')||($align=='right')) { } elseif (($align == 'r') || ($align == 'right')) {
$result=str_repeat($fill,($len-$strlen)).$str; $result = str_repeat($fill,($len - $strlen)).$str;
} elseif (($align=='c')||($align=='center')) { } elseif (($align == 'c') || ($align == 'center')) {
$snm=intval(($len-$strlen)/2); $snm = intval(($len - $strlen) / 2);
if (($strlen+($snm*2))==$len) { if (($strlen + ($snm * 2)) == $len) {
$result=str_repeat($fill,$snm).$str; $result = str_repeat($fill,$snm).$str;
} else { } 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; return $result;
} }
} }

View File

@ -736,7 +736,7 @@ private function to_html ($Array) {
} }
} }
$Str.='<blockquote>'.$this->to_html($Block['Val']).'</blockquote>'; $Str.='<blockquote>'.$this->to_html($Block['Val']).'</blockquote>';
if($this->InQuotes == $this->NestsBeforeHide) { //Close quote the deeply nested quote [hide]. if ($this->InQuotes == $this->NestsBeforeHide) { //Close quote the deeply nested quote [hide].
$Str.='</blockquote><br />'; // Ensure new line after quote train hiding $Str.='</blockquote><br />'; // Ensure new line after quote train hiding
} }
$this->NoImg--; $this->NoImg--;
@ -772,10 +772,8 @@ private function to_html ($Array) {
$LocalURL = $this->local_url($Block['Val']); $LocalURL = $this->local_url($Block['Val']);
if ($LocalURL) { if ($LocalURL) {
$Str.='<img class="scale_image" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.$LocalURL.'" />'; $Str.='<img class="scale_image" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.$LocalURL.'" />';
} elseif (check_perms('site_proxy_images')) {
$Str.='<img class="scale_image" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Block['Val']).'" />';
} else { } else {
$Str.='<img class="scale_image" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.$Block['Val'].'" />'; $Str.='<img class="scale_image" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.ImageTools::process($Block['Val']).'" />';
} }
} }
break; break;

View File

@ -543,11 +543,7 @@ function to_html($Array) {
if (!$this->valid_url($Block['Val'], '\.(jpe?g|gif|png|bmp|tiff)')) { if (!$this->valid_url($Block['Val'], '\.(jpe?g|gif|png|bmp|tiff)')) {
$Str.='[img]'.$Block['Val'].'[/img]'; $Str.='[img]'.$Block['Val'].'[/img]';
} else { } else {
if (check_perms('site_proxy_images')) { $Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.ImageTools::process($Block['Val']).'" />';
$Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Block['Val']).'" />';
} else {
$Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.$Block['Val'].'" />';
}
} }
break; break;

View File

@ -286,8 +286,8 @@ function parse($Str) {
$i = $CloseTag; // 5d) Move the pointer past the end of the [/close] tag. $i = $CloseTag; // 5d) Move the pointer past the end of the [/close] tag.
} else { } else {
//5b) If it's a normal tag, it may have versions of itself nested inside //5b) If it's a normal tag, it may have versions of itself nested inside
$CloseTag = $i-1; $CloseTag = $i - 1;
$InTagPos = $i-1; $InTagPos = $i - 1;
$NumInOpens = 0; $NumInOpens = 0;
$NumInCloses = -1; $NumInCloses = -1;
@ -318,7 +318,7 @@ function parse($Str) {
$NumInOpens++; $NumInOpens++;
} }
} while($NumInOpens>$NumInCloses); } while ($NumInOpens > $NumInCloses);
// Find the internal block inside the tag // Find the internal block inside the tag
@ -504,11 +504,7 @@ function to_html($Array) {
if (!$this->valid_url($Block['Val'], '\.(jpe?g|gif|png|bmp|tiff)')) { if (!$this->valid_url($Block['Val'], '\.(jpe?g|gif|png|bmp|tiff)')) {
$Str.='[img]'.$Block['Val'].'[/img]'; $Str.='[img]'.$Block['Val'].'[/img]';
} else { } else {
if (check_perms('site_proxy_images')) { $Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.ImageTools::process($Block['Val']).'" />';
$Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Block['Val']).'" />';
} else {
$Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.$Block['Val'].'" />';
}
} }
break; break;

View File

@ -3,8 +3,7 @@
* This super class is used to manage the ammount of textareas there are and to * This super class is used to manage the ammount of textareas there are and to
* generate the required JavaScript that enables the previews to work. * generate the required JavaScript that enables the previews to work.
*/ */
class TEXTAREA_PREVIEW_SUPER class TEXTAREA_PREVIEW_SUPER {
{
/** /**
* @static * @static
* @var int $Textareas Total number of textareas created * @var int $Textareas Total number of textareas created
@ -37,11 +36,13 @@ class TEXTAREA_PREVIEW_SUPER
* @example <pre><?php TEXT_PREVIEW::JavaScript(); ?></pre> * @example <pre><?php TEXT_PREVIEW::JavaScript(); ?></pre>
* @return void * @return void
*/ */
static public function JavaScript ($all = true) static public function JavaScript ($all = true) {
{ if (self::$Textareas === 0) {
if (self::$Textareas === 0) return; return;
if (self::$Exectuted === false && $all) }
if (self::$Exectuted === false && $all) {
View::parse('generic/textarea/script.phtml'); View::parse('generic/textarea/script.phtml');
}
self::$Exectuted = true; self::$Exectuted = true;
self::iterator(); self::iterator();
@ -55,10 +56,9 @@ static public function JavaScript ($all = true)
* @static * @static
* @return void * @return void
*/ */
static private function iterator () static private function iterator () {
{
$script = array(); $script = array();
for($i = 0; $i < self::$Textareas; $i++) { for ($i = 0; $i < self::$Textareas; $i++) {
if (isset(self::$_ID[$i]) && is_string(self::$_ID[$i])) { if (isset(self::$_ID[$i]) && is_string(self::$_ID[$i])) {
$a = sprintf('%d, "%s"', $i, self::$_ID[$i]); $a = sprintf('%d, "%s"', $i, self::$_ID[$i]);
} else { } else {
@ -66,9 +66,9 @@ static private function iterator ()
} }
$script[] = sprintf('[%s]', $a); $script[] = sprintf('[%s]', $a);
} }
if (!empty($script)) if (!empty($script)) {
View::parse('generic/textarea/script_factory.phtml', View::parse('generic/textarea/script_factory.phtml', array('script' => join(', ', $script)));
array('script' => join(', ', $script))); }
} }
} }
@ -111,8 +111,7 @@ static private function iterator ()
* </div> * </div>
* </pre> * </pre>
*/ */
class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER {
{
/** /**
* @var int Unique ID * @var int Unique ID
*/ */
@ -157,14 +156,19 @@ public function __construct ($Name, $ID = '', $Value = '', $Cols = 50, $Rows = 1
parent::$Textareas += 1; parent::$Textareas += 1;
array_push(parent::$_ID, $ID); array_push(parent::$_ID, $ID);
if (empty($ID)) $ID = 'quickpost_' . $this->id; if (empty($ID)) {
$ID = 'quickpost_' . $this->id;
}
if (!empty($ExtraAttributes)) if (!empty($ExtraAttributes)) {
$Attributes = ' ' . implode(' ', $ExtraAttributes); $Attributes = ' ' . implode(' ', $ExtraAttributes);
else } else {
$Attributes = ''; $Attributes = '';
}
if ($Preview === true) $this->preview(); if ($Preview === true) {
$this->preview();
}
$this->buffer = View::parse('generic/textarea/textarea.phtml', array( $this->buffer = View::parse('generic/textarea/textarea.phtml', array(
'ID' => $ID, 'ID' => $ID,
@ -176,17 +180,19 @@ public function __construct ($Name, $ID = '', $Value = '', $Cols = 50, $Rows = 1
'Attributes' => &$Attributes 'Attributes' => &$Attributes
), $Buffer); ), $Buffer);
if ($Buttons === true) $this->buttons(); if ($Buttons === true) {
$this->buttons();
}
} }
/** /**
* Outputs the divs required for previewing the AJAX content * Outputs the divs required for previewing the AJAX content
* Will only output once * Will only output once
*/ */
public function preview () public function preview () {
{ if (!$this->preview) {
if (!$this->preview)
View::parse('generic/textarea/preview.phtml', array('ID' => $this->id)); View::parse('generic/textarea/preview.phtml', array('ID' => $this->id));
}
$this->preview = true; $this->preview = true;
} }
@ -194,16 +200,14 @@ public function preview ()
* Outputs the preview and edit buttons * Outputs the preview and edit buttons
* Can be called many times to place buttons in different areas * Can be called many times to place buttons in different areas
*/ */
public function buttons () public function buttons () {
{
View::parse('generic/textarea/buttons.phtml', array('ID' => $this->id)); View::parse('generic/textarea/buttons.phtml', array('ID' => $this->id));
} }
/** /**
* Returns the textarea's numeric ID. * Returns the textarea's numeric ID.
*/ */
public function getID () public function getID () {
{
return $this->id; return $this->id;
} }
@ -211,8 +215,7 @@ public function getID ()
* Returns textarea string when buffer is enabled in the constructor * Returns textarea string when buffer is enabled in the constructor
* @return string * @return string
*/ */
public function getBuffer () public function getBuffer () {
{
return $this->buffer; return $this->buffer;
} }
} }

View File

@ -121,7 +121,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) {
if ($Return != '') { if ($Return != '') {
$Return.=' and '; $Return.=' and ';
} }
if ($Minutes>1) { if ($Minutes > 1) {
$Return.=$Minutes.' mins'; $Return.=$Minutes.' mins';
} else { } else {
$Return.=$Minutes.' min'; $Return.=$Minutes.' min';

View File

@ -172,7 +172,7 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
$Cache->delete_value('user_stats_'.$UserID); $Cache->delete_value('user_stats_'.$UserID);
$DB->query("SELECT SessionID FROM users_sessions WHERE UserID='$UserID' AND Active = 1"); $DB->query("SELECT SessionID FROM users_sessions WHERE UserID='$UserID' AND Active = 1");
while(list($SessionID) = $DB->next_record()) { while (list($SessionID) = $DB->next_record()) {
$Cache->delete_value('session_'.$UserID.'_'.$SessionID); $Cache->delete_value('session_'.$UserID.'_'.$SessionID);
} }
$Cache->delete_value('users_sessions_'.$UserID); $Cache->delete_value('users_sessions_'.$UserID);

View File

@ -81,7 +81,7 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType, g.VanityHouse, g.WikiImage, g.CategoryID g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType, g.VanityHouse, g.WikiImage, g.CategoryID
FROM torrents_group AS g WHERE g.ID IN ($IDs)"); FROM torrents_group AS g WHERE g.ID IN ($IDs)");
while($Group = $DB->next_record(MYSQLI_ASSOC, true)) { while ($Group = $DB->next_record(MYSQLI_ASSOC, true)) {
unset($NotFound[$Group['ID']]); unset($NotFound[$Group['ID']]);
$Found[$Group['ID']] = $Group; $Found[$Group['ID']] = $Group;
$Found[$Group['ID']]['Torrents'] = array(); $Found[$Group['ID']]['Torrents'] = array();
@ -104,7 +104,7 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
WHERE GroupID IN($IDs) WHERE GroupID IN($IDs)
ORDER BY GroupID, Remastered, (RemasterYear <> 0) DESC, RemasterYear, RemasterTitle, ORDER BY GroupID, Remastered, (RemasterYear <> 0) DESC, RemasterYear, RemasterTitle,
RemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding, ID"); RemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding, ID");
while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) { while ($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent; $Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
} }
@ -262,7 +262,7 @@ public static function delete_torrent($ID, $GroupID=0, $OcelotReason=-1) {
// Torrent notifications // Torrent notifications
$DB->query("SELECT UserID FROM users_notify_torrents WHERE TorrentID='$ID'"); $DB->query("SELECT UserID FROM users_notify_torrents WHERE TorrentID='$ID'");
while(list($UserID) = $DB->next_record()) { while (list($UserID) = $DB->next_record()) {
$Cache->delete_value('notifications_new_'.$UserID); $Cache->delete_value('notifications_new_'.$UserID);
} }
$DB->query("DELETE FROM users_notify_torrents WHERE TorrentID='$ID'"); $DB->query("DELETE FROM users_notify_torrents WHERE TorrentID='$ID'");

View File

@ -23,7 +23,7 @@ function update_tracker($Action, $Updates, $ToIRC = false) {
} }
$Path = TRACKER_SECRET.$Get; $Path = TRACKER_SECRET.$Get;
$Return = ""; $Return = '';
$Attempts = 0; $Attempts = 0;
while ($Return != "success" && $Attempts < 3) { while ($Return != "success" && $Attempts < 3) {
@ -52,7 +52,7 @@ function update_tracker($Action, $Updates, $ToIRC = false) {
} while (!feof($File) && !Misc::ends_with($ResHeader, "\r\n\r\n")); } while (!feof($File) && !Misc::ends_with($ResHeader, "\r\n\r\n"));
$Response = ''; $Response = '';
while($Line = fgets($File)) { while ($Line = fgets($File)) {
$Response .= $Line; $Response .= $Line;
} }

View File

@ -104,9 +104,7 @@ public static function user_info($UserID) {
} }
// Image proxy // Image proxy
if (check_perms('site_proxy_images') && !empty($UserInfo['Avatar'])) { $UserInfo['Avatar'] = ImageTools::process($UserInfo['Avatar']);
$UserInfo['Avatar'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;avatar='.$UserID.'&amp;i='.urlencode($UserInfo['Avatar']);
}
return $UserInfo; return $UserInfo;
} }
@ -397,12 +395,12 @@ public static function gen_crypt_salt() {
$Numchars = strlen($Chars) - 1; $Numchars = strlen($Chars) - 1;
if ($Handle = @fopen('/dev/urandom', 'r')) { if ($Handle = @fopen('/dev/urandom', 'r')) {
$Bytes = fread($Handle, 22); $Bytes = fread($Handle, 22);
for($i = 0; $i < 21; $i++) { for ($i = 0; $i < 21; $i++) {
$Salt .= $Chars[ord($Bytes[$i]) & $Numchars]; $Salt .= $Chars[ord($Bytes[$i]) & $Numchars];
} }
$Salt[$i] = $Chars[(ord($Bytes[$i]) & 3) << 4]; $Salt[$i] = $Chars[(ord($Bytes[$i]) & 3) << 4];
} else { } else {
for($i = 0; $i < 21; $i++) { for ($i = 0; $i < 21; $i++) {
$Salt .= $Chars[mt_rand(0, $Numchars)]; $Salt .= $Chars[mt_rand(0, $Numchars)];
} }
$Salt[$i] = $Chars[mt_rand(0, 3) << 4]; $Salt[$i] = $Chars[mt_rand(0, 3) << 4];
@ -481,7 +479,7 @@ public static function format_username($UserID, $Badges = false, $IsWarned = tru
if (check_perms('site_proxy_images') && !empty($UserInfo['Title'])) { if (check_perms('site_proxy_images') && !empty($UserInfo['Title'])) {
$UserInfo['Title'] = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', $UserInfo['Title'] = preg_replace_callback('~src=("?)(http.+?)(["\s>])~',
function($Matches) { function($Matches) {
return 'src='.$Matches[1].'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Matches[2]).$Matches[3]; return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3];
}, },
$UserInfo['Title']); $UserInfo['Title']);
} }

View File

@ -10,7 +10,6 @@
/*------------------------------------------------------*/ /*------------------------------------------------------*/
/********************************************************/ /********************************************************/
require 'config.php'; //The config contains all site wide configuration information require 'config.php'; //The config contains all site wide configuration information
//Deal with dumbasses //Deal with dumbasses
if (isset($_REQUEST['info_hash']) && isset($_REQUEST['peer_id'])) { die('d14:failure reason40:Invalid .torrent, try downloading again.e'); } if (isset($_REQUEST['info_hash']) && isset($_REQUEST['peer_id'])) { die('d14:failure reason40:Invalid .torrent, try downloading again.e'); }
@ -435,8 +434,6 @@ function authorize($Ajax = false) {
$Document = basename(parse_url($_SERVER['SCRIPT_FILENAME'], PHP_URL_PATH), '.php'); $Document = basename(parse_url($_SERVER['SCRIPT_FILENAME'], PHP_URL_PATH), '.php');
if (!preg_match('/^[a-z0-9]+$/i', $Document)) { error(404); } if (!preg_match('/^[a-z0-9]+$/i', $Document)) { error(404); }
require(SERVER_ROOT.'/sections/'.$Document.'/index.php'); require(SERVER_ROOT.'/sections/'.$Document.'/index.php');
$Debug->set_flag('completed module execution'); $Debug->set_flag('completed module execution');

View File

@ -229,7 +229,7 @@
$Cache->cache_value('news_latest_id', $CurrentNews, 0); $Cache->cache_value('news_latest_id', $CurrentNews, 0);
} }
if ($MyNews < $CurrentNews) { if ($MyNews < $CurrentNews) {
$Alerts[] = '<a href="index.php">'.'New announcement!'.'</a>'; $Alerts[] = '<a href="index.php">New announcement!</a>';
} }
// Blog // Blog
@ -245,7 +245,7 @@
$Cache->cache_value('blog_latest_id', $CurrentBlog, 0); $Cache->cache_value('blog_latest_id', $CurrentBlog, 0);
} }
if ($MyBlog < $CurrentBlog) { if ($MyBlog < $CurrentBlog) {
$Alerts[] = '<a href="blog.php">'.'New blog post!'.'</a>'; $Alerts[] = '<a href="blog.php">New blog post!</a>';
} }
// Staff blog // Staff blog
@ -270,7 +270,7 @@
$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600); $Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
} }
if ($SBlogReadTime < $LatestSBlogTime) { if ($SBlogReadTime < $LatestSBlogTime) {
$Alerts[] = '<a href="staffblog.php">'.'New staff blog post!'.'</a>'; $Alerts[] = '<a href="staffblog.php">New staff blog post!</a>';
} }
} }
@ -283,7 +283,7 @@
} }
if ($NewStaffPMs > 0) { if ($NewStaffPMs > 0) {
$Alerts[] = '<a href="staffpm.php">'.'You have '.$NewStaffPMs.(($NewStaffPMs > 1) ? ' new staff messages' : ' new staff message').'</a>'; $Alerts[] = '<a href="staffpm.php">You have '.$NewStaffPMs.(($NewStaffPMs > 1) ? ' new staff messages' : ' new staff message').'</a>';
} }
//Inbox //Inbox
@ -295,13 +295,13 @@
} }
if ($NewMessages > 0) { if ($NewMessages > 0) {
$Alerts[] = '<a href="inbox.php">'.'You have '.$NewMessages.(($NewMessages > 1) ? ' new messages' : ' new message').'</a>'; $Alerts[] = '<a href="inbox.php">You have '.$NewMessages.(($NewMessages > 1) ? ' new messages' : ' new message').'</a>';
} }
if ($LoggedUser['RatioWatch']) { if ($LoggedUser['RatioWatch']) {
$Alerts[] = '<a href="rules.php?p=ratio">'.'Ratio Watch'.'</a>: '.'You have '.time_diff($LoggedUser['RatioWatchEnds'], 3).' to get your ratio over your required ratio or your leeching abilities will be disabled.'; $Alerts[] = '<a href="rules.php?p=ratio">Ratio Watch</a>: You have '.time_diff($LoggedUser['RatioWatchEnds'], 3).' to get your ratio over your required ratio or your leeching abilities will be disabled.';
} elseif ($LoggedUser['CanLeech'] != 1) { } elseif ($LoggedUser['CanLeech'] != 1) {
$Alerts[] = '<a href="rules.php?p=ratio">'.'Ratio Watch'.'</a>: '.'Your downloading privileges are disabled until you meet your required ratio.'; $Alerts[] = '<a href="rules.php?p=ratio">Ratio Watch</a>: Your downloading privileges are disabled until you meet your required ratio.';
} }
if (check_perms('site_torrents_notify')) { if (check_perms('site_torrents_notify')) {
@ -316,7 +316,7 @@
$Cache->cache_value('notifications_new_'.$LoggedUser['ID'], $NewNotifications, 0); $Cache->cache_value('notifications_new_'.$LoggedUser['ID'], $NewNotifications, 0);
} }
if ($NewNotifications > 0) { if ($NewNotifications > 0) {
$Alerts[] = '<a href="torrents.php?action=notify">'.'You have '.$NewNotifications.(($NewNotifications > 1) ? ' new torrent notifications' : ' new torrent notification').'</a>'; $Alerts[] = '<a href="torrents.php?action=notify">You have '.$NewNotifications.(($NewNotifications > 1) ? ' new torrent notifications' : ' new torrent notification').'</a>';
} }
} }
@ -333,11 +333,11 @@
$Cache->cache_value('collage_subs_user_new_'.$LoggedUser['ID'], $NewCollages, 0); $Cache->cache_value('collage_subs_user_new_'.$LoggedUser['ID'], $NewCollages, 0);
} }
if ($NewCollages > 0) { if ($NewCollages > 0) {
$Alerts[] = '<a href="userhistory.php?action=subscribed_collages">'.'You have '.$NewCollages.(($NewCollages > 1) ? ' new collage updates' : ' new collage update').'</a>'; $Alerts[] = '<a href="userhistory.php?action=subscribed_collages">You have '.$NewCollages.(($NewCollages > 1) ? ' new collage updates' : ' new collage update').'</a>';
} }
} }
if (check_perms('users_mod')) { if (check_perms('users_mod')) {
$ModBar[] = '<a href="tools.php">'.'Toolbox'.'</a>'; $ModBar[] = '<a href="tools.php">Toolbox</a>';
} }
if (check_perms('users_mod') || $LoggedUser['PermissionID'] == FORUM_MOD) { if (check_perms('users_mod') || $LoggedUser['PermissionID'] == FORUM_MOD) {
$NumStaffPMs = $Cache->get_value('num_staff_pms_'.$LoggedUser['ID']); $NumStaffPMs = $Cache->get_value('num_staff_pms_'.$LoggedUser['ID']);
@ -387,7 +387,7 @@
} }
if ($NumUpdateReports > 0) { if ($NumUpdateReports > 0) {
$ModBar[] = '<a href="reports.php">'.'Request update reports'.'</a>'; $ModBar[] = '<a href="reports.php">Request update reports</a>';
} }
} elseif (check_perms('site_moderate_forums')) { } elseif (check_perms('site_moderate_forums')) {
$NumForumReports = $Cache->get_value('num_forum_reports'); $NumForumReports = $Cache->get_value('num_forum_reports');

View File

@ -1510,7 +1510,7 @@ CREATE TABLE `users_sessions` (
`SessionID` char(32) NOT NULL, `SessionID` char(32) NOT NULL,
`KeepLogged` enum('0','1') NOT NULL DEFAULT '0', `KeepLogged` enum('0','1') NOT NULL DEFAULT '0',
`Browser` varchar(40) DEFAULT NULL, `Browser` varchar(40) DEFAULT NULL,
`OperatingSystem` varchar(8) DEFAULT NULL, `OperatingSystem` varchar(13) DEFAULT NULL,
`IP` varchar(15) NOT NULL, `IP` varchar(15) NOT NULL,
`LastUpdate` datetime NOT NULL, `LastUpdate` datetime NOT NULL,
`Active` tinyint(4) NOT NULL DEFAULT '1', `Active` tinyint(4) NOT NULL DEFAULT '1',

View File

@ -24,7 +24,7 @@
case 'artists': case 'artists':
?> ?>
<Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/artist.php?artistname={searchTerms}"></Url> <Url type="text/html" method="get" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/artist.php?artistname={searchTerms}"></Url>
<Url type="application/x-suggestions+json" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/artist.php?action=autocomplete&amp;name={searchTerms}"/> <Url type="application/x-suggestions+json" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/artist.php?action=autocomplete&amp;name={searchTerms}" />
<moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=advanced</moz:SearchForm> <moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=advanced</moz:SearchForm>
<? <?
break; break;

View File

@ -22,6 +22,7 @@
g.ID, g.ID,
g.Name, g.Name,
g.CategoryID, g.CategoryID,
g.wikiImage,
g.TagList, g.TagList,
t.Format, t.Format,
t.Encoding, t.Encoding,
@ -54,7 +55,7 @@
ORDER BY (t.Seeders + t.Leechers) DESC ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;"; LIMIT $Limit;";
$DB->query($Query); $DB->query($Query);
$TopTorrentsActiveLastDay = $DB->to_array(); $TopTorrentsActiveLastDay = $DB->to_array(); // TODO: MYSQLI_NUM to avoid duplicate data in the cache (does that break something with generate_torrent_json?)
$Cache->cache_value('top10tor_day_'.$Limit.$WhereSum,$TopTorrentsActiveLastDay,3600*2); $Cache->cache_value('top10tor_day_'.$Limit.$WhereSum,$TopTorrentsActiveLastDay,3600*2);
} }
$OuterResults[] = generate_torrent_json('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit); $OuterResults[] = generate_torrent_json('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
@ -144,7 +145,7 @@ function generate_torrent_json($Caption, $Tag, $Details, $Limit) {
global $LoggedUser,$Categories; global $LoggedUser,$Categories;
$results = array(); $results = array();
foreach ($Details as $Detail) { foreach ($Details as $Detail) {
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$TorrentTags, list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$WikiImage,$TorrentTags,
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear, $Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType,$Size) = $Detail; $RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType,$Size) = $Detail;

View File

@ -54,10 +54,6 @@ function error_out($reason = '') {
extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned')))); extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));
} }
if (check_perms('site_proxy_images') && !empty($Avatar)) {
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Avatar);
}
if ($LoggedUser['CustomForums']) { if ($LoggedUser['CustomForums']) {
unset($LoggedUser['CustomForums']['']); unset($LoggedUser['CustomForums']['']);
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0)); $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));

View File

@ -387,7 +387,7 @@ function compare($X, $Y) {
<td colspan="5" class="big_info"> <td colspan="5" class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">
@ -527,15 +527,11 @@ function compare($X, $Y) {
</div> </div>
<? /* Misc::display_recommend($ArtistID, "artist"); */ ?> <? /* Misc::display_recommend($ArtistID, "artist"); */ ?>
<div class="sidebar"> <div class="sidebar">
<? if ($Image) { <? if ($Image) { ?>
$WikiImage = $Image;
if (check_perms('site_proxy_images')) {
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
} ?>
<div class="box box_image"> <div class="box box_image">
<div class="head"><strong><?=$Name?></strong></div> <div class="head"><strong><?=$Name?></strong></div>
<div style="text-align: center; padding: 10px 0px;"> <div style="text-align: center; padding: 10px 0px;">
<img style="max-width: 220px;" src="<?=ImageTools::thumbnail($WikiImage)?>" alt="<?=$Name?>" onclick="lightbox.init('<?=$WikiImage?>',220);" /> <img style="max-width: 220px;" src="<?=ImageTools::process($Image, true)?>" alt="<?=$Name?>" onclick="lightbox.init('<?=ImageTools::process($Image)?>',220);" />
</div> </div>
</div> </div>
<? } ?> <? } ?>

View File

@ -51,7 +51,7 @@
if ($ThreadID && is_number($ThreadID)) { if ($ThreadID && is_number($ThreadID)) {
$DB->query("SELECT ForumID FROM forums_topics WHERE ID=".$ThreadID); $DB->query("SELECT ForumID FROM forums_topics WHERE ID=".$ThreadID);
if ($DB->record_count() < 1) { if ($DB->record_count() < 1) {
error("No such thread exists!"); error('No such thread exists!');
header('Location: blog.php'); header('Location: blog.php');
} }
} else { } else {

View File

@ -210,11 +210,8 @@ function compare($X, $Y){
<li class="image_group_<?=$GroupID?>"> <li class="image_group_<?=$GroupID?>">
<a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>"> <a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>">
<? if($WikiImage) { <? if($WikiImage) {
if(check_perms('site_proxy_images')) {
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
}
?> ?>
<img src="<?=ImageTools::thumbnail($WikiImage)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" /> <img src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="117" />
<? } else { ?> <? } else { ?>
<div style="width:107px;padding:5px"><?=$DisplayName?></div> <div style="width:107px;padding:5px"><?=$DisplayName?></div>
<? } ?> <? } ?>

View File

@ -285,11 +285,8 @@ function compare($X, $Y){
<li class="image_group_<?=$GroupID?>"> <li class="image_group_<?=$GroupID?>">
<a href="torrents.php?id=<?=$GroupID?>"> <a href="torrents.php?id=<?=$GroupID?>">
<? if ($WikiImage) { <? if ($WikiImage) {
if (check_perms('site_proxy_images')) {
$WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage);
}
?> ?>
<img src="<?=ImageTools::thumbnail($WikiImage)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" /> <img src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?>" width="118" />
<? } else { ?> <? } else { ?>
<span style="width: 107px; padding: 5px;"><?=$DisplayName?></span> <span style="width: 107px; padding: 5px;"><?=$DisplayName?></span>
<? } ?> <? } ?>

View File

@ -75,7 +75,7 @@
} }
// Start printing // Start printing
View::show_header('Forums > '. $Forums[$ForumID]['Name']); View::show_header('Forums &gt; '. $Forums[$ForumID]['Name']);
?> ?>
<div class="thin"> <div class="thin">
<h2><a href="forums.php">Forums</a> &gt; <?=$ForumName?></h2> <h2><a href="forums.php">Forums</a> &gt; <?=$ForumName?></h2>

View File

@ -58,11 +58,11 @@
<h3><?=$ForumCats[$CategoryID]?></h3> <h3><?=$ForumCats[$CategoryID]?></h3>
<table class="forum_index"> <table class="forum_index">
<tr class="colhead"> <tr class="colhead">
<td style="width:2%;"></td> <td style="width: 2%;"></td>
<td style="width:25%;">Forum</td> <td style="width: 25%;">Forum</td>
<td>Last post</td> <td>Last post</td>
<td style="width:7%;">Topics</td> <td style="width: 7%;">Topics</td>
<td style="width:7%;">Posts</td> <td style="width: 7%;">Posts</td>
</tr> </tr>
<? <?
$OpenTable = true; $OpenTable = true;
@ -87,7 +87,7 @@
</td> </td>
<? if ($NumPosts == 0) { ?> <? if ($NumPosts == 0) { ?>
<td colspan="3"> <td colspan="3">
There are no topics here<?=($MinCreate <= $LoggedUser['Class']) ? ', <a href="forums.php?action=new&amp;forumid='.$ForumID.'">'.'create one'.'</a>' : ''?>. There are no topics here.<?=($MinCreate <= $LoggedUser['Class']) ? ', <a href="forums.php?action=new&amp;forumid='.$ForumID.'">Create one!</a>' : '' ?>.
</td> </td>
<? } else { ?> <? } else { ?>
<td> <td>

View File

@ -22,7 +22,7 @@
if (!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) { if (!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) {
error(403); error(403);
} }
View::show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode'); View::show_header('Forums &gt; '.$Forum['Name'].' &gt; New Topic','comments,bbcode');
?> ?>
<div class="thin"> <div class="thin">
<h2><a href="forums.php">Forums</a> &gt; <a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$Forum['Name']?></a> &gt; <span id="newthreadtitle">New Topic</span></h2> <h2><a href="forums.php">Forums</a> &gt; <a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$Forum['Name']?></a> &gt; <span id="newthreadtitle">New Topic</span></h2>

View File

@ -1,6 +1,8 @@
<? <?
if(!isset($_POST['topicid']) || !is_number($_POST['topicid'])) { error(0,true); } if (!isset($_POST['topicid']) || !is_number($_POST['topicid'])) {
error(0,true);
}
$TopicID = $_POST['topicid']; $TopicID = $_POST['topicid'];
if (!empty($_POST['large'])) { if (!empty($_POST['large'])) {
@ -9,7 +11,7 @@
$Size = 140; $Size = 140;
} }
if(!$ThreadInfo = $Cache->get_value('thread_'.$TopicID.'_info')) { if (!$ThreadInfo = $Cache->get_value('thread_'.$TopicID.'_info')) {
$DB->query("SELECT $DB->query("SELECT
t.Title, t.Title,
t.ForumID, t.ForumID,
@ -23,7 +25,9 @@
LEFT JOIN forums_polls AS p ON p.TopicID=t.ID LEFT JOIN forums_polls AS p ON p.TopicID=t.ID
WHERE t.ID = '$TopicID' WHERE t.ID = '$TopicID'
GROUP BY fp.TopicID"); GROUP BY fp.TopicID");
if($DB->record_count()==0) { die(); } if ($DB->record_count() == 0) {
die();
}
$ThreadInfo = $DB->next_record(MYSQLI_ASSOC); $ThreadInfo = $DB->next_record(MYSQLI_ASSOC);
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) { if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
$Cache->cache_value('thread_'.$TopicID.'_info', $ThreadInfo, 0); $Cache->cache_value('thread_'.$TopicID.'_info', $ThreadInfo, 0);
@ -77,7 +81,7 @@
<input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" /> <input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />
<label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br /> <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
<? } ?> <? } ?>
<br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank - Show the results!</label><br /><br /> <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank &mdash; Show the results!</label><br /><br />
<input type="button" onclick="ajax.post('index.php','poll',function(response){$('#poll_container').raw().innerHTML = response});" value="Vote" /> <input type="button" onclick="ajax.post('index.php','poll',function(response){$('#poll_container').raw().innerHTML = response});" value="Vote" />
</form> </form>
<? <?
@ -104,20 +108,20 @@
?> ?>
<ul class="poll nobullet"> <ul class="poll nobullet">
<? <?
if($ForumID != STAFF_FORUM) { if ($ForumID != STAFF_FORUM) {
for ($i = 1, $il = count($Answers); $i <= $il; $i++) { for ($i = 1, $il = count($Answers); $i <= $il; $i++) {
if (!empty($Votes[$i]) && $TotalVotes > 0) { if (!empty($Votes[$i]) && $TotalVotes > 0) {
$Ratio = $Votes[$i]/$MaxVotes; $Ratio = $Votes[$i] / $MaxVotes;
$Percent = $Votes[$i]/$TotalVotes; $Percent = $Votes[$i] / $TotalVotes;
} else { } else {
$Ratio=0; $Ratio = 0;
$Percent=0; $Percent = 0;
} }
?> ?>
<li><?=display_str($Answers[$i])?> (<?=number_format($Percent*100,2)?>%)</li> <li><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100,2)?>%)</li>
<li class="graph"> <li class="graph">
<span class="left_poll"></span> <span class="left_poll"></span>
<span class="center_poll" style="width:<?=round($Ratio*$Size)?>px;"></span> <span class="center_poll" style="width: <?=round($Ratio * $Size)?>px;"></span>
<span class="right_poll"></span> <span class="right_poll"></span>
</li> </li>
<? } <? }
@ -131,10 +135,10 @@
GROUP BY fpv.Vote"); GROUP BY fpv.Vote");
$StaffVotes = $DB->to_array(); $StaffVotes = $DB->to_array();
foreach($StaffVotes as $StaffVote) { foreach ($StaffVotes as $StaffVote) {
list($StaffString, $StaffVoted) = $StaffVote; list($StaffString, $StaffVoted) = $StaffVote;
?> ?>
<li><a href="forums.php?action=change_vote&amp;threadid=<?=$TopicID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=<?=(int) $StaffVoted?>"><?=display_str(empty($Answers[$StaffVoted]) ? "Blank" : $Answers[$StaffVoted])?></a> - <?=$StaffString?></li> <li><a href="forums.php?action=change_vote&amp;threadid=<?=$TopicID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=<?=(int) $StaffVoted?>"><?=display_str(empty($Answers[$StaffVoted]) ? 'Blank' : $Answers[$StaffVoted])?></a> - <?=$StaffString?></li>
<? <?
} }
} }

View File

@ -86,7 +86,7 @@
} }
// Let's hope we got some results - start printing out the content. // Let's hope we got some results - start printing out the content.
View::show_header('Forums'.' > '.'Search', 'bbcode'); View::show_header('Forums &gt; Search', 'bbcode');
?> ?>
<div class="thin"> <div class="thin">
<h2><a href="forums.php">Forums</a> &gt; Search<?=$Title?></h2> <h2><a href="forums.php">Forums</a> &gt; Search<?=$Title?></h2>
@ -271,14 +271,14 @@
list($Results) = $DB->next_record(); list($Results) = $DB->next_record();
$DB->set_query_id($Records); $DB->set_query_id($Records);
$Pages=Format::get_pages($Page,$Results,POSTS_PER_PAGE,9); $Pages = Format::get_pages($Page, $Results, POSTS_PER_PAGE, 9);
echo $Pages; echo $Pages;
?> ?>
</div> </div>
<table cellpadding="6" cellspacing="1" border="0" class="forum_list border" width="100%"> <table cellpadding="6" cellspacing="1" border="0" class="forum_list border" width="100%">
<tr class="colhead"> <tr class="colhead">
<td>Forum</td> <td>Forum</td>
<td><?=(!empty($ThreadID))?'Post Begins':'Topic'?></td> <td><?=(!empty($ThreadID)) ? 'Post begins' : 'Topic' ?></td>
<td>Time</td> <td>Time</td>
</tr> </tr>
<? if ($DB->record_count() == 0) { ?> <? if ($DB->record_count() == 0) { ?>

View File

@ -54,13 +54,13 @@
// Make sure they aren't trying to edit posts they shouldn't // Make sure they aren't trying to edit posts they shouldn't
// We use die() here instead of error() because whatever we spit out is displayed to the user in the box where his forum post is // We use die() here instead of error() because whatever we spit out is displayed to the user in the box where his forum post is
if(!check_forumperm($ForumID, 'Write') || ($IsLocked && !check_perms('site_moderate_forums'))) { if(!check_forumperm($ForumID, 'Write') || ($IsLocked && !check_perms('site_moderate_forums'))) {
error('Either the thread is locked, or you lack the permission to edit this post.',true); error('Either the thread is locked, or you lack the permission to edit this post.', true);
} }
if($UserID != $AuthorID && !check_perms('site_moderate_forums')) { if($UserID != $AuthorID && !check_perms('site_moderate_forums')) {
error(403,true); error(403,true);
} }
if($LoggedUser['DisablePosting']) { if($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed.',true); error('Your posting rights have been removed.', true);
} }
if($DB->record_count()==0) { if($DB->record_count()==0) {
error(404,true); error(404,true);

View File

@ -246,29 +246,29 @@
<? if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || !check_forumperm($ForumID)) { ?> <? if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || !check_forumperm($ForumID)) { ?>
<ul class="poll nobullet"> <ul class="poll nobullet">
<? <?
if(!$RevealVoters) { if (!$RevealVoters) {
foreach($Answers as $i => $Answer) { foreach ($Answers as $i => $Answer) {
if (!empty($Votes[$i]) && $TotalVotes > 0) { if (!empty($Votes[$i]) && $TotalVotes > 0) {
$Ratio = $Votes[$i]/$MaxVotes; $Ratio = $Votes[$i] / $MaxVotes;
$Percent = $Votes[$i]/$TotalVotes; $Percent = $Votes[$i] / $TotalVotes;
} else { } else {
$Ratio=0; $Ratio = 0;
$Percent=0; $Percent = 0;
} }
?> ?>
<li><?=display_str($Answer)?> (<?=number_format($Percent*100,2)?>%)</li> <li><?=display_str($Answer)?> (<?=number_format($Percent * 100,2)?>%)</li>
<li class="graph"> <li class="graph">
<span class="left_poll"></span> <span class="left_poll"></span>
<span class="center_poll" style="width:<?=round($Ratio*750)?>px;"></span> <span class="center_poll" style="width: <?=round($Ratio * 750)?>px;"></span>
<span class="right_poll"></span> <span class="right_poll"></span>
</li> </li>
<? } <? }
if ($Votes[0] > 0) { if ($Votes[0] > 0) {
?> ?>
<li>(Blank) (<?=number_format((float)($Votes[0]/$TotalVotes*100),2)?>%)</li> <li>(Blank) (<?=number_format((float)($Votes[0] / $TotalVotes * 100),2)?>%)</li>
<li class="graph"> <li class="graph">
<span class="left_poll"></span> <span class="left_poll"></span>
<span class="center_poll" style="width:<?=round(($Votes[0]/$MaxVotes)*750)?>px;"></span> <span class="center_poll" style="width: <?=round(($Votes[0] / $MaxVotes) * 750)?>px;"></span>
<span class="right_poll"></span> <span class="right_poll"></span>
</li> </li>
<? } ?> <? } ?>
@ -309,20 +309,20 @@
foreach($Answers as $i => $Answer) { foreach($Answers as $i => $Answer) {
?> ?>
<li> <li>
<a href="forums.php?action=change_vote&amp;threadid=<?=$ThreadID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=<?=(int) $i?>"><?=display_str($Answer == '' ? "Blank" : $Answer)?></a> <a href="forums.php?action=change_vote&amp;threadid=<?=$ThreadID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=<?=(int) $i?>"><?=display_str($Answer == '' ? 'Blank' : $Answer)?></a>
- <?=$StaffVotes[$i]?>&nbsp;(<?=number_format(((float) $Votes[$i]/$TotalVotes)*100, 2)?>%) - <?=$StaffVotes[$i]?>&nbsp;(<?=number_format(((float) $Votes[$i] / $TotalVotes) * 100, 2)?>%)
<a href="forums.php?action=delete_poll_option&amp;threadid=<?=$ThreadID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=<?=(int) $i?>" class="brackets">X</a> <a href="forums.php?action=delete_poll_option&amp;threadid=<?=$ThreadID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=<?=(int) $i?>" class="brackets">X</a>
</li> </li>
<? } ?> <? } ?>
<li><a href="forums.php?action=change_vote&amp;threadid=<?=$ThreadID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=0">Blank</a> - <?=$StaffVotes[0]?>&nbsp;(<?=number_format(((float) $Votes[0]/$TotalVotes)*100, 2)?>%)</li> <li><a href="forums.php?action=change_vote&amp;threadid=<?=$ThreadID?>&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;vote=0">Blank</a> - <?=$StaffVotes[0]?>&nbsp;(<?=number_format(((float) $Votes[0] / $TotalVotes) * 100, 2)?>%)</li>
</ul> </ul>
<? <?
if($ForumID == STAFF_FORUM) { if ($ForumID == STAFF_FORUM) {
?> ?>
<br /> <br />
<strong>Votes:</strong> <?=number_format($TotalVotes)?> / <?=$StaffCount ?> <strong>Votes:</strong> <?=number_format($TotalVotes)?> / <?=$StaffCount ?>
<br /> <br />
<strong>Missing Votes:</strong> <?=implode(", ", $StaffNames)?> <strong>Missing votes:</strong> <?=implode(", ", $StaffNames)?>
<br /><br /> <br /><br />
<? <?
} }
@ -349,7 +349,7 @@
<? } ?> <? } ?>
<li> <li>
<br /> <br />
<input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank - Show the results!</label><br /> <input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank &mdash; Show the results!</label><br />
</li> </li>
</ul> </ul>
<? if($ForumID == STAFF_FORUM) { ?> <? if($ForumID == STAFF_FORUM) { ?>
@ -524,13 +524,13 @@
<tr> <tr>
<td class="label">Sticky</td> <td class="label">Sticky</td>
<td> <td>
<input type="checkbox" name="sticky"<? if($ThreadInfo['IsSticky']) { echo ' checked="checked"'; } ?> tabindex="2" /> <input type="checkbox" name="sticky"<? if ($ThreadInfo['IsSticky']) { echo ' checked="checked"'; } ?> tabindex="2" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="label">Locked</td> <td class="label">Locked</td>
<td> <td>
<input type="checkbox" name="locked"<? if($ThreadInfo['IsLocked']) { echo ' checked="checked"'; } ?> tabindex="2" /> <input type="checkbox" name="locked"<? if ($ThreadInfo['IsLocked']) { echo ' checked="checked"'; } ?> tabindex="2" />
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -93,11 +93,8 @@
<td width="50px" valign="top"> <td width="50px" valign="top">
<? <?
if (empty($HeavyInfo['DisableAvatars'])) { if (empty($HeavyInfo['DisableAvatars'])) {
if (!empty($Avatar)) { if (!empty($Avatar)) { ?>
if (check_perms('site_proxy_images')) { <img src="<?=ImageTools::process($Avatar)?>" alt="<?=$Username?>'s avatar" width="50px" />
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Avatar);
} ?>
<img src="<?=$Avatar?>" alt="<?=$Username?>'s avatar" width="50px" />
<? } else { ?> <? } else { ?>
<img src="<?=STATIC_SERVER?>common/avatars/default.png" width="50px" alt="Default avatar" /> <img src="<?=STATIC_SERVER?>common/avatars/default.png" width="50px" alt="Default avatar" />
<? } <? }

View File

@ -16,10 +16,6 @@
} }
if (is_number($FeaturedAlbum['GroupID'])) { if (is_number($FeaturedAlbum['GroupID'])) {
$Artists = Artists::get_artist($FeaturedAlbum['GroupID']); $Artists = Artists::get_artist($FeaturedAlbum['GroupID']);
if (check_perms('site_proxy_images')) {
$FeaturedAlbum['WikiImage'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($FeaturedAlbum['WikiImage']);
}
?> ?>
<div class="box"> <div class="box">
<div class="head colhead_dark"><strong>Featured Album</strong></div> <div class="head colhead_dark"><strong>Featured Album</strong></div>
@ -28,7 +24,7 @@
</div> </div>
<div class="center"> <div class="center">
<a href="torrents.php?id=<?=$FeaturedAlbum['GroupID']?>" title="<?=Artists::display_artists($Artists, false, false)?> - <?=$FeaturedAlbum['Name']?>"> <a href="torrents.php?id=<?=$FeaturedAlbum['GroupID']?>" title="<?=Artists::display_artists($Artists, false, false)?> - <?=$FeaturedAlbum['Name']?>">
<img src="<?=ImageTools::thumbnail($FeaturedAlbum['WikiImage'])?>" alt="<?=Artists::display_artists($Artists, false, false)?> - <?=$FeaturedAlbum['Name']?>" width="100%" /> <img src="<?=ImageTools::process($FeaturedAlbum['WikiImage'], true)?>" alt="<?=Artists::display_artists($Artists, false, false)?> - <?=$FeaturedAlbum['Name']?>" width="100%" />
</a> </a>
</div> </div>
<div class="center pad"> <div class="center pad">

View File

@ -1,6 +1,5 @@
<? <?
include(SERVER_ROOT.'/classes/class_text.php'); include(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT(true); $Text = new TEXT(true);
if (!$News = $Cache->get_value('news')) { if (!$News = $Cache->get_value('news')) {
@ -294,7 +293,7 @@
?> ?>
<div class="box"> <div class="box">
<div class="head colhead_dark"><strong>Poll<? if ($Closed) { echo ' ['.'Closed'.']'; } ?></strong></div> <div class="head colhead_dark"><strong>Poll<? if ($Closed) { echo ' [Closed]'; } ?></strong></div>
<div class="pad"> <div class="pad">
<p><strong><?=display_str($Question)?></strong></p> <p><strong><?=display_str($Question)?></strong></p>
<? if ($UserResponse !== null || $Closed) { ?> <? if ($UserResponse !== null || $Closed) { ?>
@ -327,7 +326,7 @@
<input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" /> <input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />
<label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br /> <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
<? } ?> <? } ?>
<br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank - Show the results!</label><br /><br /> <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank &mdash; Show the results!</label><br /><br />
<input type="button" onclick="ajax.post('index.php','poll',function(response) {$('#poll_container').raw().innerHTML = response});" value="Vote" /> <input type="button" onclick="ajax.post('index.php','poll',function(response) {$('#poll_container').raw().innerHTML = response});" value="Vote" />
</form> </form>
</div> </div>

View File

@ -1,22 +1,22 @@
<? View::show_header('Login'); ?> <? View::show_header('Login'); ?>
<span id="no-cookies" class="hidden warning">You appear to have cookies disabled.<br /><br /></span> <span id="no-cookies" class="hidden warning">You appear to have cookies disabled.<br /><br /></span>
<noscript><span class="warning">You appear to have javascript disabled.</span><br /><br /></noscript> <noscript><span class="warning">You appear to have JavaScript disabled.</span><br /><br /></noscript>
<? <?
if(strtotime($BannedUntil)<time() && !$BanID) { if (strtotime($BannedUntil) < time() && !$BanID) {
?> ?>
<form class="auth_form" name="login" id="loginform" method="post" action="login.php"> <form class="auth_form" name="login" id="loginform" method="post" action="login.php">
<? <?
if(!empty($BannedUntil) && $BannedUntil != '0000-00-00 00:00:00') { if (!empty($BannedUntil) && $BannedUntil != '0000-00-00 00:00:00') {
$DB->query("UPDATE login_attempts SET BannedUntil='0000-00-00 00:00:00', Attempts='0' WHERE ID='".db_string($AttemptID)."'"); $DB->query("UPDATE login_attempts SET BannedUntil='0000-00-00 00:00:00', Attempts='0' WHERE ID='".db_string($AttemptID)."'");
$Attempts = 0; $Attempts = 0;
} }
if(isset($Err)) { if (isset($Err)) {
?> ?>
<span class="warning"><?=$Err?><br /><br /></span> <span class="warning"><?=$Err?><br /><br /></span>
<? } ?> <? } ?>
<? if ($Attempts > 0) { ?> <? if ($Attempts > 0) { ?>
You have <span class="info"><?=(6-$Attempts)?></span> attempts remaining.<br /><br /> You have <span class="info"><?=(6 - $Attempts)?></span> attempts remaining.<br /><br />
<strong>WARNING:</strong> You will be banned for 6 hours after your login attempts run out!<br /><br /> <strong>WARNING:</strong> You will be banned for 6 hours after your login attempts run out!<br /><br />
<? } ?> <? } ?>
<table class="layout"> <table class="layout">
@ -31,7 +31,7 @@
<tr> <tr>
<td></td> <td></td>
<td> <td>
<input type="checkbox" id="keeplogged" name="keeplogged" value="1"<? if(isset($_REQUEST['keeplogged']) && $_REQUEST['keeplogged']) { ?> checked="checked"<? } ?> /> <input type="checkbox" id="keeplogged" name="keeplogged" value="1"<? if (isset($_REQUEST['keeplogged']) && $_REQUEST['keeplogged']) { ?> checked="checked"<? } ?> />
<label for="keeplogged">Remember me</label> <label for="keeplogged">Remember me</label>
</td> </td>
<td><input type="submit" name="login" value="Login" class="submit" /></td> <td><input type="submit" name="login" value="Login" class="submit" /></td>
@ -40,9 +40,9 @@
</form> </form>
<? <?
} else { } else {
if($BanID) { if ($BanID) {
?> ?>
<span class="warning">Your IP is banned indefinitely.</span> <span class="warning">Your IP address is banned indefinitely.</span>
<? } else { ?> <? } else { ?>
<span class="warning">You are banned from logging in for another <?=time_diff($BannedUntil)?>.</span> <span class="warning">You are banned from logging in for another <?=time_diff($BannedUntil)?>.</span>
<? <?

View File

@ -3,11 +3,11 @@
echo $Validate->GenerateJS('recoverform'); echo $Validate->GenerateJS('recoverform');
?> ?>
<form class="auth_form" name="recovery" id="recoverform" method="post" action="" onsubmit="return formVal();"> <form class="auth_form" name="recovery" id="recoverform" method="post" action="" onsubmit="return formVal();">
<div style="width:320px;"> <div style="width: 320px;">
<span class="titletext">Reset your password - Step 1</span><br /><br /> <span class="titletext">Reset your password - Step 1</span><br /><br />
<? <?
if(empty($Sent) || (!empty($Sent) && $Sent!=1)) { if (empty($Sent) || (!empty($Sent) && $Sent != 1)) {
if(!empty($Err)) { if (!empty($Err)) {
?> ?>
<strong class="important_text"><?=$Err ?></strong><br /><br /> <strong class="important_text"><?=$Err ?></strong><br /><br />
<? } ?> <? } ?>
@ -21,9 +21,11 @@
<td colspan="2" align="right"><input type="submit" name="reset" value="Reset!" class="submit" /></td> <td colspan="2" align="right"><input type="submit" name="reset" value="Reset!" class="submit" /></td>
</tr> </tr>
</table> </table>
<? } else { ?> <?
} else { ?>
An email has been sent to you; please follow the directions in that email to reset your password. An email has been sent to you; please follow the directions in that email to reset your password.
<? } ?> <?
} ?>
</div> </div>
</form> </form>
<? <?

View File

@ -1,7 +1,7 @@
<? <?
View::show_header('Registration Closed'); View::show_header('Registration Closed');
?> ?>
<div style="width:500px;"> <div style="width: 500px;">
<strong>Sorry, the site is currently invite only.</strong> <strong>Sorry, the site is currently invite only.</strong>
</div> </div>
<? <?

View File

@ -1,7 +1,7 @@
<? <?
View::show_header('Register'); View::show_header('Register');
?> ?>
<div style="width:500px;"> <div style="width: 500px;">
<form class="auth_form" name="invite" method="get" action="register.php"> <form class="auth_form" name="invite" method="get" action="register.php">
Please enter your invite code into the box below.<br /><br /> Please enter your invite code into the box below.<br /><br />
<table class="layout" cellpadding="2" cellspacing="1" border="0" align="center"> <table class="layout" cellpadding="2" cellspacing="1" border="0" align="center">

View File

@ -48,7 +48,7 @@
list($UserCount)=$DB->next_record(); list($UserCount)=$DB->next_record();
if ($UserCount) { if ($UserCount) {
$Err = "There is already someone registered with that username."; $Err = 'There is already someone registered with that username.';
$_REQUEST['username']=''; $_REQUEST['username']='';
} }

View File

@ -5,21 +5,21 @@
<script src="<?=STATIC_SERVER?>functions/jquery.js" type="text/javascript"></script> <script src="<?=STATIC_SERVER?>functions/jquery.js" type="text/javascript"></script>
<script src="<?=STATIC_SERVER?>functions/password_validate.js" type="text/javascript"></script> <script src="<?=STATIC_SERVER?>functions/password_validate.js" type="text/javascript"></script>
<form class="create_form" name="user" id="registerform" method="post" action="" onsubmit="return formVal();"> <form class="create_form" name="user" id="registerform" method="post" action="" onsubmit="return formVal();">
<div style="width:500px;"> <div style="width: 500px;">
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<? <?
if(empty($Sent)) { if (empty($Sent)) {
if(!empty($_REQUEST['invite'])) { if (!empty($_REQUEST['invite'])) {
echo '<input type="hidden" name="invite" value="'.display_str($_REQUEST['invite']).'" />'."\n"; echo '<input type="hidden" name="invite" value="'.display_str($_REQUEST['invite']).'" />'."\n";
} }
if(!empty($Err)) { if (!empty($Err)) {
?> ?>
<strong class="important_text"><?=$Err?></strong><br /><br /> <strong class="important_text"><?=$Err?></strong><br /><br />
<? } ?> <? } ?>
<table class="layout" cellpadding="2" cellspacing="1" border="0" align="center"> <table class="layout" cellpadding="2" cellspacing="1" border="0" align="center">
<tr valign="top"> <tr valign="top">
<td align="right" style="width:100px;">Username&nbsp;</td> <td align="right" style="width: 100px;">Username&nbsp;</td>
<td align="left"> <td align="left">
<input type="text" name="username" id="username" class="inputtext" value="<?=(!empty($_REQUEST['username']) ? display_str($_REQUEST['username']) : '')?>" /> <input type="text" name="username" id="username" class="inputtext" value="<?=(!empty($_REQUEST['username']) ? display_str($_REQUEST['username']) : '')?>" />
<p>Use common sense when choosing your username. Offensive usernames will not be tolerated. <strong>Do not choose a username that can be associated with your real name.</strong> If you do so, we will not be changing it for you.</p> <p>Use common sense when choosing your username. Offensive usernames will not be tolerated. <strong>Do not choose a username that can be associated with your real name.</strong> If you do so, we will not be changing it for you.</p>
@ -61,7 +61,9 @@
<? } else { ?> <? } else { ?>
An email has been sent to the address that you provided. After you confirm your email address, you will be able to log into your account. An email has been sent to the address that you provided. After you confirm your email address, you will be able to log into your account.
<? if($NewInstall) { echo "Since this is a new installation, you can log in directly without having to confirm your account."; } <? if ($NewInstall) {
echo "Since this is a new installation, you can log in directly without having to confirm your account.";
}
} ?> } ?>
</div> </div>
</form> </form>

View File

@ -316,9 +316,8 @@
<? <?
$Images = explode(" ", $Images); $Images = explode(" ", $Images);
foreach ($Images as $Image) { foreach ($Images as $Image) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Image);
?> ?>
<img style="max-width: 200px;" onclick="lightbox.init(this,200);" src="<?=$Image?>" alt="Relevant image" /> <img style="max-width: 200px;" onclick="lightbox.init(this,200);" src="<?=ImageTools::process($Image)?>" alt="Relevant image" />
<? <?
} ?> } ?>
</td> </td>

View File

@ -474,9 +474,8 @@
<? <?
$Images = explode(' ', $Images); $Images = explode(' ', $Images);
foreach ($Images as $Image) { foreach ($Images as $Image) {
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Image);
?> ?>
<img style="max-width: 200px;" onclick="lightbox.init(this,200);" src="<?=$Image?>" alt="Relevant image" /> <img style="max-width: 200px;" onclick="lightbox.init(this,200);" src="<?=ImageTools::process($Image)?>" alt="Relevant image" />
<? <?
} ?> } ?>
</td> </td>

View File

@ -6,16 +6,16 @@
// Minimum and default amount of upload to remove from the user when they vote. // Minimum and default amount of upload to remove from the user when they vote.
// Also change in static/functions/requests.js // Also change in static/functions/requests.js
$MinimumVote = 20*1024*1024; $MinimumVote = 20 * 1024 * 1024;
if(!empty($LoggedUser['DisableRequests'])) { if (!empty($LoggedUser['DisableRequests'])) {
error('Your request privileges have been removed.'); error('Your request privileges have been removed.');
} }
if(!isset($_REQUEST['action'])) { if (!isset($_REQUEST['action'])) {
include(SERVER_ROOT.'/sections/requests/requests.php'); include(SERVER_ROOT.'/sections/requests/requests.php');
} else { } else {
switch($_REQUEST['action']){ switch($_REQUEST['action']) {
case 'new': case 'new':
case 'edit': case 'edit':
include(SERVER_ROOT.'/sections/requests/new_edit.php'); include(SERVER_ROOT.'/sections/requests/new_edit.php');
@ -48,15 +48,17 @@
authorize(); authorize();
enforce_login(); enforce_login();
if (!isset($_POST['requestid']) || !is_number($_POST['requestid']) || $_POST['body']==='' || !isset($_POST['body'])) { if (!isset($_POST['requestid']) || !is_number($_POST['requestid']) || $_POST['body'] === '' || !isset($_POST['body'])) {
error(0); error(0);
} }
if($LoggedUser['DisablePosting']) { if ($LoggedUser['DisablePosting']) {
error('Your posting rights have been removed.'); error('Your posting rights have been removed.');
} }
$RequestID = $_POST['requestid']; $RequestID = $_POST['requestid'];
if(!$RequestID) { error(404); } if (!$RequestID) {
error(404);
}
$DB->query("SELECT CEIL((SELECT COUNT(ID)+1 FROM requests_comments AS rc WHERE rc.RequestID='".$RequestID."')/".TORRENT_COMMENTS_PER_PAGE.") AS Pages"); $DB->query("SELECT CEIL((SELECT COUNT(ID)+1 FROM requests_comments AS rc WHERE rc.RequestID='".$RequestID."')/".TORRENT_COMMENTS_PER_PAGE.") AS Pages");
list($Pages) = $DB->next_record(); list($Pages) = $DB->next_record();
@ -85,7 +87,9 @@
case 'get_post': case 'get_post':
enforce_login(); enforce_login();
if (!$_GET['post'] || !is_number($_GET['post'])) { error(0); } if (!$_GET['post'] || !is_number($_GET['post'])) {
error(0);
}
$DB->query("SELECT Body FROM requests_comments WHERE ID='".db_string($_GET['post'])."'"); $DB->query("SELECT Body FROM requests_comments WHERE ID='".db_string($_GET['post'])."'");
list($Body) = $DB->next_record(MYSQLI_NUM); list($Body) = $DB->next_record(MYSQLI_NUM);
@ -100,7 +104,9 @@
$Text = new TEXT; $Text = new TEXT;
// Quick SQL injection check // Quick SQL injection check
if(!$_POST['post'] || !is_number($_POST['post'])) { error(0); } if (!$_POST['post'] || !is_number($_POST['post'])) {
error(0);
}
// Mainly // Mainly
$DB->query("SELECT $DB->query("SELECT
@ -115,8 +121,12 @@
$DB->query("SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page FROM requests_comments WHERE RequestID = $RequestID AND ID <= $_POST[post]"); $DB->query("SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page FROM requests_comments WHERE RequestID = $RequestID AND ID <= $_POST[post]");
list($Page) = $DB->next_record(); list($Page) = $DB->next_record();
if ($LoggedUser['ID']!=$AuthorID && !check_perms('site_moderate_forums')) { error(404); } if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
if ($DB->record_count()==0) { error(404); } error(404);
}
if ($DB->record_count() == 0) {
error(404);
}
// Perform the update // Perform the update
$DB->query("UPDATE requests_comments SET $DB->query("UPDATE requests_comments SET
@ -152,10 +162,14 @@
authorize(); authorize();
// Quick SQL injection check // Quick SQL injection check
if (!$_GET['postid'] || !is_number($_GET['postid'])) { error(0); } if (!$_GET['postid'] || !is_number($_GET['postid'])) {
error(0);
}
// Make sure they are moderators // Make sure they are moderators
if (!check_perms('site_moderate_forums')) { error(403); } if (!check_perms('site_moderate_forums')) {
error(403);
}
// Get topicid, forumid, number of pages // Get topicid, forumid, number of pages
$DB->query("SELECT DISTINCT $DB->query("SELECT DISTINCT

View File

@ -146,7 +146,7 @@
</td> </td>
<td> <td>
<select id="categories" name="type" onchange="Categories()"> <select id="categories" name="type" onchange="Categories()">
<? foreach(Misc::display_array($Categories) as $Cat){ ?> <? foreach (Misc::display_array($Categories) as $Cat) { ?>
<option value="<?=$Cat?>"<?=(!empty($CategoryName) && ($CategoryName == $Cat) ? ' selected="selected"' : '')?>><?=$Cat?></option> <option value="<?=$Cat?>"<?=(!empty($CategoryName) && ($CategoryName == $Cat) ? ' selected="selected"' : '')?>><?=$Cat?></option>
<? } ?> <? } ?>
</select> </select>
@ -160,8 +160,8 @@
if (!empty($ArtistForm)) { if (!empty($ArtistForm)) {
$First = true; $First = true;
foreach($ArtistForm as $Importance => $ArtistNames) { foreach ($ArtistForm as $Importance => $ArtistNames) {
foreach($ArtistNames as $Artist) { foreach ($ArtistNames as $Artist) {
?> ?>
<input type="text" id="artist" name="artists[]" size="45" value="<?=display_str($Artist['name']) ?>" /> <input type="text" id="artist" name="artists[]" size="45" value="<?=display_str($Artist['name']) ?>" />
<select id="importance" name="importance[]" > <select id="importance" name="importance[]" >
@ -245,7 +245,7 @@
?> ?>
<select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" > <select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" >
<option>---</option> <option>---</option>
<? foreach (Misc::display_array($GenreTags) as $Genre){ ?> <? foreach (Misc::display_array($GenreTags) as $Genre) { ?>
<option value="<?=$Genre ?>"><?=$Genre ?></option> <option value="<?=$Genre ?>"><?=$Genre ?></option>
<? } ?> <? } ?>
</select> </select>

View File

@ -127,12 +127,10 @@
<div class="box box_image box_image_albumart box_albumart"><!-- .box_albumart deprecated --> <div class="box box_image box_image_albumart box_albumart"><!-- .box_albumart deprecated -->
<div class="head"><strong>Cover</strong></div> <div class="head"><strong>Cover</strong></div>
<? <?
if (!empty($Image)) { if (!empty($Image)) {
if (check_perms('site_proxy_images')) { $Image = ImageTools::process($Image, true);
$Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image);
}
?> ?>
<p align="center"><img style="max-width: 220px;" src="<?=ImageTools::thumbnail($Image)?>" alt="<?=$FullName?>" onclick="lightbox.init('<?=$Image?>',220);" /></p> <p align="center"><img style="max-width: 220px;" src="<?=$Image?>" alt="<?=$FullName?>" onclick="lightbox.init('<?=$Image?>',220);" /></p>
<? } else { ?> <? } else { ?>
<p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$CategoryID-1]?>" alt="<?=$CategoryName?>" title="<?=$CategoryName?>" width="220" height="220" border="0" /></p> <p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$CategoryID-1]?>" alt="<?=$CategoryName?>" title="<?=$CategoryName?>" width="220" height="220" border="0" /></p>
<? } ?> <? } ?>

View File

@ -15,12 +15,12 @@
<p>Client rules are how we maintain the integrity of our swarms. This allows us to filter out disruptive and dishonest clients that may hurt the performance of either the tracker or individual peers.</p> <p>Client rules are how we maintain the integrity of our swarms. This allows us to filter out disruptive and dishonest clients that may hurt the performance of either the tracker or individual peers.</p>
<table cellpadding="5" cellspacing="1" border="0" class="border" width="100%"> <table cellpadding="5" cellspacing="1" border="0" class="border" width="100%">
<tr class="colhead"> <tr class="colhead">
<td style="width:150px;"><strong>Allowed Client</strong></td> <td style="width: 150px;"><strong>Allowed Client</strong></td>
<!-- td style="width:400px;"><strong>Additional Notes</strong></td> --> <!-- td style="width: 400px;"><strong>Additional Notes</strong></td> -->
</tr> </tr>
<? <?
$Row = 'a'; $Row = 'a';
foreach($WhitelistedClients as $Client) { foreach ($WhitelistedClients as $Client) {
//list($ClientName,$Notes) = $Client; //list($ClientName,$Notes) = $Client;
list($ClientName) = $Client; list($ClientName) = $Client;
$Row = ($Row == 'a') ? 'b' : 'a'; $Row = ($Row == 'a') ? 'b' : 'a';

View File

@ -40,52 +40,52 @@
<td>Required Ratio (0% seeded)</td> <td>Required Ratio (0% seeded)</td>
<td>Required Ratio (100% seeded)</td> <td>Required Ratio (100% seeded)</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] < 5 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] < 5 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>0-5 GB</td> <td>0&ndash;5 GB</td>
<td>0.00</td> <td>0.00</td>
<td>0.00</td> <td>0.00</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] >= 5 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 10 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 5 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 10 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>5-10 GB</td> <td>5&ndash;10 GB</td>
<td>0.15</td> <td>0.15</td>
<td>0.00</td> <td>0.00</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] >= 10 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 20 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 10 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 20 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>10-20 GB</td> <td>10&ndash;20 GB</td>
<td>0.20</td> <td>0.20</td>
<td>0.00</td> <td>0.00</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] >= 20 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 30 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 20 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 30 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>20-30 GB</td> <td>20&ndash;30 GB</td>
<td>0.30</td> <td>0.30</td>
<td>0.05</td> <td>0.05</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] >= 30 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 40 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 30 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 40 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>30-40 GB</td> <td>30&ndash;40 GB</td>
<td>0.40</td> <td>0.40</td>
<td>0.10</td> <td>0.10</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] >= 40 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 50 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 40 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 50 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>40-50 GB</td> <td>40&ndash;50 GB</td>
<td>0.50</td> <td>0.50</td>
<td>0.20</td> <td>0.20</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] >= 50 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 60 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 50 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 60 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>50-60 GB</td> <td>50&ndash;60 GB</td>
<td>0.60</td> <td>0.60</td>
<td>0.30</td> <td>0.30</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] >= 60 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 80 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 60 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 80 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>60-80 GB</td> <td>60&ndash;80 GB</td>
<td>0.60</td> <td>0.60</td>
<td>0.40</td> <td>0.40</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] >= 80 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 100 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 80 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 100 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>80-100 GB</td> <td>80&ndash;100 GB</td>
<td>0.60</td> <td>0.60</td>
<td>0.50</td> <td>0.50</td>
</tr> </tr>
<tr class="row<?=($LoggedUser['BytesDownloaded'] >= 100 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 100 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>">
<td>100+ GB</td> <td>100+ GB</td>
<td>0.60</td> <td>0.60</td>
<td>0.60</td> <td>0.60</td>
@ -101,15 +101,15 @@
bracket. The maximum and minimum required ratios are also referred to as the <strong>0% seeded</strong> and <strong>100% seeded</strong> required ratios, respectively. bracket. The maximum and minimum required ratios are also referred to as the <strong>0% seeded</strong> and <strong>100% seeded</strong> required ratios, respectively.
</li> </li>
<li><strong>2: Determine the actual required ratio.</strong> Your actual required ratio will be a number that falls between the maximum and minimum required ratio values determined in the <li><strong>2: Determine the actual required ratio.</strong> Your actual required ratio will be a number that falls between the maximum and minimum required ratio values determined in the
previous step. To determine your actual required ratio, the system first uses the maximum required ratio (0% seeded) and multiplies it by the value [1-seeding/snatched]. Formatted previous step. To determine your actual required ratio, the system first uses the maximum required ratio (0% seeded) and multiplies it by the value [1 &minus; (seeding / snatched)]. Formatted
differently, the calculation performed by the system looks like this: differently, the calculation performed by the system looks like this:
</li> </li>
</ul> </ul>
<br /> <br />
<br /> <br />
<div style="text-align:center"><img style="vertical-align: middle" src="static/blank.gif" <div style="text-align: center;"><img style="vertical-align: middle;" src="static/blank.gif"
onload="if (this.src.substr(this.src.length-9,this.src.length) == 'blank.gif') { this.src = 'http://chart.apis.google.com/chart?cht=tx&amp;chf=bg,s,FFFFFF00&amp;chl=%5Ctextrm%7B%28maximum+required+ratio%29+%2A+%281-%5Cfrac%7Bseeding%7D%7Bsnatched%7D%29%7D&amp;chco=' + hexify(getComputedStyle(this.parentNode,null).color); }"/> onload="if (this.src.substr(this.src.length-9,this.src.length) == 'blank.gif') { this.src = 'http://chart.apis.google.com/chart?cht=tx&amp;chf=bg,s,FFFFFF00&amp;chl=%5Ctextrm%7B%28maximum+required+ratio%29+%2A+%281-%5Cfrac%7Bseeding%7D%7Bsnatched%7D%29%7D&amp;chco=' + hexify(getComputedStyle(this.parentNode,null).color); }" />
</div> </div>
<br /> <br />
<br /> <br />
@ -144,11 +144,11 @@
<br /> <br />
<strong>Required Ratio Example:</strong><br /> <strong>Required Ratio Example:</strong><br />
<ul> <ul>
<li>In this example, Rippy has downloaded 25 GB. Rippy falls into the 20-30 GB amount downloaded bracket in the table above. Rippy&#39;s maximum required ratio (0% seeded) is 0.30, and his minimum required ratio (100% seeded) is 0.05. <li>In this example, Rippy has downloaded 25 GB. Rippy falls into the 20&ndash;30 GB amount downloaded bracket in the table above. Rippy&#39;s maximum required ratio (0% seeded) is 0.30, and his minimum required ratio (100% seeded) is 0.05.
</li> </li>
<li>In this example, Rippy has snatched 90 torrents, and is currently seeding 45 torrents.</li> <li>In this example, Rippy has snatched 90 torrents, and is currently seeding 45 torrents.</li>
<li>To calculate Rippy&#39;s actual required ratio, we take his maximum required ratio (0% seeded), which is 0.30, and multiply it by [1 - seeding/snatched] (which is 0.50). Written out: <li>To calculate Rippy&#39;s actual required ratio, we take his maximum required ratio (0% seeded), which is 0.30, and multiply it by [1 &minus; (seeding / snatched)] (which is 0.50). Written out:
0.3 * [1 - (45/90)] = 0.15. <samp>0.3 * [1 &minus; (45 / 90)] = 0.15</samp>
</li> </li>
<li>The resulting required ratio is 0.15, which falls between the maximum required ratio of 0.30 and the minimum required ratio of 0.05 for his amount downloaded bracket.</li> <li>The resulting required ratio is 0.15, which falls between the maximum required ratio of 0.30 and the minimum required ratio of 0.05 for his amount downloaded bracket.</li>
<li>If Rippy&#39;s on-site required ratio was listed as a value greater than the calculated value, this would be because he hadn&#39;t seeded those 45 torrents for a 72 hour period in the <li>If Rippy&#39;s on-site required ratio was listed as a value greater than the calculated value, this would be because he hadn&#39;t seeded those 45 torrents for a 72 hour period in the

View File

@ -18,7 +18,7 @@
<li>This is a torrent site which promotes sharing amongst the community. If you are not willing to give back to the community what you take from it, this site is not for you. In other words, we expect you to have an acceptable share ratio. If you download a torrent, please, seed the copy you have until there are sufficient people seeding the torrent data before you stop.</li> <li>This is a torrent site which promotes sharing amongst the community. If you are not willing to give back to the community what you take from it, this site is not for you. In other words, we expect you to have an acceptable share ratio. If you download a torrent, please, seed the copy you have until there are sufficient people seeding the torrent data before you stop.</li>
<li>Do not browse the site using proxies or Tor. The site will automatically alert us. This includes VPNs with dynamic IP addresses.</li> <li>Do not browse the site using proxies or Tor. The site will automatically alert us. This includes VPNs with dynamic IP addresses.</li>
<li>Asking for invites to any site is not allowed anywhere on What.CD or our IRC network. Invites may be offered in the Invites forum, and nowhere else.</li> <li>Asking for invites to any site is not allowed anywhere on What.CD or our IRC network. Invites may be offered in the Invites forum, and nowhere else.</li>
<li>Trading and selling invites is strictly prohibited, as is offering them in public - this includes on any forum which is not a class-restricted section on an invitation-only torrent site.</li> <li>Trading and selling invites is strictly prohibited, as is offering them in public - this includes on any forum which is not a class-restricted section on an invitation-only torrent site. Responding to public requests for invites may also jeopardize your account and those whom you invite from a public request.</li>
<li>Trading, selling, sharing, or giving away your account is prohibited. If you no longer want your account, send a staff PM requesting that it be disabled.</li> <li>Trading, selling, sharing, or giving away your account is prohibited. If you no longer want your account, send a staff PM requesting that it be disabled.</li>
<li>You're completely responsible for the people you invite. If your invitees are caught cheating or trading/selling invites, not only will they be banned, so will you. Be careful who you invite. Invites are a precious commodity.</li> <li>You're completely responsible for the people you invite. If your invitees are caught cheating or trading/selling invites, not only will they be banned, so will you. Be careful who you invite. Invites are a precious commodity.</li>
<li>Be careful when sharing an IP address or a computer with a friend if they have (or have had) an account. From then on your accounts will be inherently linked and if one of you violates the rules, both accounts will be disabled along with any other accounts linked by IP address. This rule applies to logging into the site.</li> <li>Be careful when sharing an IP address or a computer with a friend if they have (or have had) an account. From then on your accounts will be inherently linked and if one of you violates the rules, both accounts will be disabled along with any other accounts linked by IP address. This rule applies to logging into the site.</li>

View File

@ -1,7 +1,7 @@
<? <?
enforce_login(); enforce_login();
if(!check_perms('users_mod')) { if (!check_perms('users_mod')) {
error(403); error(403);
} }
@ -12,15 +12,15 @@
require(SERVER_ROOT.'/classes/class_text.php'); require(SERVER_ROOT.'/classes/class_text.php');
$Text = new TEXT; $Text = new TEXT;
if(check_perms('admin_manage_blog')) { if (check_perms('admin_manage_blog')) {
if(!empty($_REQUEST['action'])) { if (!empty($_REQUEST['action'])) {
switch($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'takeeditblog': case 'takeeditblog':
authorize(); authorize();
if (empty($_POST['title'])) { if (empty($_POST['title'])) {
error("Please enter a title."); error("Please enter a title.");
} }
if(is_number($_POST['blogid'])) { if (is_number($_POST['blogid'])) {
$DB->query("UPDATE staff_blog SET Title='".db_string($_POST['title'])."', Body='".db_string($_POST['body'])."' WHERE ID='".db_string($_POST['blogid'])."'"); $DB->query("UPDATE staff_blog SET Title='".db_string($_POST['title'])."', Body='".db_string($_POST['body'])."' WHERE ID='".db_string($_POST['blogid'])."'");
$Cache->delete_value('staff_blog'); $Cache->delete_value('staff_blog');
$Cache->delete_value('staff_feed_blog'); $Cache->delete_value('staff_feed_blog');
@ -28,14 +28,14 @@
header('Location: staffblog.php'); header('Location: staffblog.php');
break; break;
case 'editblog': case 'editblog':
if(is_number($_GET['id'])){ if (is_number($_GET['id'])) {
$BlogID = $_GET['id']; $BlogID = $_GET['id'];
$DB->query("SELECT Title, Body FROM staff_blog WHERE ID=$BlogID"); $DB->query("SELECT Title, Body FROM staff_blog WHERE ID=$BlogID");
list($Title, $Body, $ThreadID) = $DB->next_record(); list($Title, $Body, $ThreadID) = $DB->next_record();
} }
break; break;
case 'deleteblog': case 'deleteblog':
if(is_number($_GET['id'])){ if (is_number($_GET['id'])) {
authorize(); authorize();
$DB->query("DELETE FROM staff_blog WHERE ID='".db_string($_GET['id'])."'"); $DB->query("DELETE FROM staff_blog WHERE ID='".db_string($_GET['id'])."'");
$Cache->delete_value('staff_blog'); $Cache->delete_value('staff_blog');
@ -67,21 +67,21 @@
<div class="box thin"> <div class="box thin">
<div class="head"> <div class="head">
<?=((empty($_GET['action'])) ? 'Create a staff blog post' : 'Edit staff blog post')?> <?=((empty($_GET['action'])) ? 'Create a staff blog post' : 'Edit staff blog post')?>
<span style="float:right;"> <span style="float: right;">
<a href="#" onclick="$('#postform').toggle(); this.innerHTML=(this.innerHTML=='(Hide)'?'(Show)':'(Hide)'); return false;"><?=($_REQUEST['action']!='editblog')?'(Show)':'(Hide)'?></a> <a href="#" onclick="$('#postform').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="bracket"><?=($_REQUEST['action'] != 'editblog') ? 'Show' : 'Hide' ?></a>
</span> </span>
</div> </div>
<form class="<?=((empty($_GET['action'])) ? 'create_form' : 'edit_form')?>" name="blog_post" action="staffblog.php" method="post"> <form class="<?=((empty($_GET['action'])) ? 'create_form' : 'edit_form')?>" name="blog_post" action="staffblog.php" method="post">
<div id="postform" class="pad<?=($_REQUEST['action']!='editblog')?' hidden':''?>"> <div id="postform" class="pad<?=($_REQUEST['action'] != 'editblog') ? ' hidden' : '' ?>">
<input type="hidden" name="action" value="<?=((empty($_GET['action'])) ? 'takenewblog' : 'takeeditblog')?>" /> <input type="hidden" name="action" value="<?=((empty($_GET['action'])) ? 'takenewblog' : 'takeeditblog')?>" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<? if(!empty($_GET['action']) && $_GET['action'] == 'editblog'){?> <? if (!empty($_GET['action']) && $_GET['action'] == 'editblog') { ?>
<input type="hidden" name="blogid" value="<?=$BlogID; ?>" /> <input type="hidden" name="blogid" value="<?=$BlogID; ?>" />
<? }?> <? } ?>
<h3>Title</h3> <h3>Title</h3>
<input type="text" name="title" size="95" <? if(!empty($Title)) { echo 'value="'.display_str($Title).'"'; } ?> /><br /> <input type="text" name="title" size="95"<? if (!empty($Title)) { echo ' value="'.display_str($Title).'"'; } ?> /><br />
<h3>Body</h3> <h3>Body</h3>
<textarea name="body" cols="95" rows="15"><? if(!empty($Body)) { echo display_str($Body); } ?></textarea> <br /> <textarea name="body" cols="95" rows="15"><? if (!empty($Body)) { echo display_str($Body); } ?></textarea> <br />
<br /><br /> <br /><br />
<div class="center"> <div class="center">
<input type="submit" value="<?=((!isset($_GET['action'])) ? 'Create blog post' : 'Edit blog post') ?>" /> <input type="submit" value="<?=((!isset($_GET['action'])) ? 'Create blog post' : 'Edit blog post') ?>" />
@ -117,10 +117,10 @@
<div id="blog<?=$BlogID?>" class="box"> <div id="blog<?=$BlogID?>" class="box">
<div class="head"> <div class="head">
<strong><?=$Title?></strong> - posted <?=time_diff($BlogTime);?> by <?=$Author?> <strong><?=$Title?></strong> - posted <?=time_diff($BlogTime);?> by <?=$Author?>
<? if(check_perms('admin_manage_blog')) { ?> <? if (check_perms('admin_manage_blog')) { ?>
- <a href="staffblog.php?action=editblog&amp;id=<?=$BlogID?>" class="brackets">Edit</a> - <a href="staffblog.php?action=editblog&amp;id=<?=$BlogID?>" class="brackets">Edit</a>
<a href="staffblog.php?action=deleteblog&amp;id=<?=$BlogID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Do you want to delete this?')" class="brackets">Delete</a> <a href="staffblog.php?action=deleteblog&amp;id=<?=$BlogID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Do you want to delete this?')" class="brackets">Delete</a>
<? } ?> <? } ?>
</div> </div>
<div class="pad"> <div class="pad">
<?=$Text->full_format($Body)?> <?=$Text->full_format($Body)?>

View File

@ -1,9 +1,9 @@
<? <?
enforce_login(); enforce_login();
if(!isset($_REQUEST['action'])) { if (!isset($_REQUEST['action'])) {
error(404); error(404);
} else { } else {
switch($_REQUEST['action']){ switch ($_REQUEST['action']) {
case 'users': case 'users':
include(SERVER_ROOT.'/sections/stats/users.php'); include(SERVER_ROOT.'/sections/stats/users.php');
break; break;

View File

@ -7,45 +7,45 @@
$DB->query("SELECT DATE_FORMAT(Time,'%b \'%y') AS Month, COUNT(ID) FROM torrents GROUP BY Month ORDER BY Time DESC LIMIT 1, 12"); $DB->query("SELECT DATE_FORMAT(Time,'%b \'%y') AS Month, COUNT(ID) FROM torrents GROUP BY Month ORDER BY Time DESC LIMIT 1, 12");
$TimelineNet = array_reverse($DB->to_array()); $TimelineNet = array_reverse($DB->to_array());
foreach($TimelineIn as $Month) { foreach ($TimelineIn as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
if ($Amount > $Max) { if ($Amount > $Max) {
$Max = $Amount; $Max = $Amount;
} }
} }
foreach($TimelineOut as $Month) { foreach ($TimelineOut as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
if ($Amount > $Max) { if ($Amount > $Max) {
$Max = $Amount; $Max = $Amount;
} }
} }
foreach($TimelineNet as $Month) { foreach ($TimelineNet as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
if ($Amount > $Max) { if ($Amount > $Max) {
$Max = $Amount; $Max = $Amount;
} }
} }
foreach($TimelineIn as $Month) { foreach ($TimelineIn as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
$Labels[] = $Label; $Labels[] = $Label;
$InFlow[] = number_format(($Amount/$Max)*100,4); $InFlow[] = number_format(($Amount / $Max) * 100, 4);
} }
foreach($TimelineOut as $Month) { foreach ($TimelineOut as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
$OutFlow[] = number_format(($Amount/$Max)*100,4); $OutFlow[] = number_format(($Amount / $Max) * 100, 4);
} }
foreach($TimelineNet as $Month) { foreach ($TimelineNet as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
$NetFlow[] = number_format(($Amount/$Max)*100,4); $NetFlow[] = number_format(($Amount / $Max) * 100, 4);
} }
$Cache->cache_value('torrents_timeline',array($Labels,$InFlow,$OutFlow,$NetFlow,$Max),mktime(0,0,0,date('n')+1,2)); //Tested: fine for dec -> jan $Cache->cache_value('torrents_timeline',array($Labels,$InFlow,$OutFlow,$NetFlow,$Max),mktime(0,0,0,date('n') + 1,2)); //Tested: fine for dec -> jan
} }
include_once(SERVER_ROOT.'/classes/class_charts.php'); include_once(SERVER_ROOT.'/classes/class_charts.php');
$DB->query("SELECT tg.CategoryID, COUNT(t.ID) AS Torrents FROM torrents AS t JOIN torrents_group AS tg ON tg.ID=t.GroupID GROUP BY tg.CategoryID ORDER BY Torrents DESC"); $DB->query("SELECT tg.CategoryID, COUNT(t.ID) AS Torrents FROM torrents AS t JOIN torrents_group AS tg ON tg.ID=t.GroupID GROUP BY tg.CategoryID ORDER BY Torrents DESC");
$Groups = $DB->to_array(); $Groups = $DB->to_array();
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
foreach($Groups as $Group) { foreach ($Groups as $Group) {
list($CategoryID, $Torrents) = $Group; list($CategoryID, $Torrents) = $Group;
$CategoryName = $Categories[$CategoryID - 1]; $CategoryName = $Categories[$CategoryID - 1];
$Pie->add($CategoryName,$Torrents); $Pie->add($CategoryName,$Torrents);

View File

@ -3,26 +3,26 @@
include_once(SERVER_ROOT.'/classes/class_charts.php'); include_once(SERVER_ROOT.'/classes/class_charts.php');
$DB->query('SELECT Code, Users FROM users_geodistribution'); $DB->query('SELECT Code, Users FROM users_geodistribution');
$Data = $DB->to_array(); $Data = $DB->to_array();
$Count = $DB->record_count()-1; $Count = $DB->record_count() - 1;
if($Count<30) { if ($Count < 30) {
$CountryMinThreshold = $Count; $CountryMinThreshold = $Count;
} else { } else {
$CountryMinThreshold = 30; $CountryMinThreshold = 30;
} }
$CountryMax = ceil(log(Max(1,$Data[0][1]))/log(2))+1; $CountryMax = ceil(log(Max(1, $Data[0][1])) / log(2)) + 1;
$CountryMin = floor(log(Max(1,$Data[$CountryMinThreshold][1]))/log(2)); $CountryMin = floor(log(Max(1, $Data[$CountryMinThreshold][1])) / log(2));
$CountryRegions = array('RS' => array('RS-KM')); // Count Kosovo as Serbia as it doesn't have a TLD $CountryRegions = array('RS' => array('RS-KM')); // Count Kosovo as Serbia as it doesn't have a TLD
foreach ($Data as $Key => $Item) { foreach ($Data as $Key => $Item) {
list($Country,$UserCount) = $Item; list($Country,$UserCount) = $Item;
$Countries[] = $Country; $Countries[] = $Country;
$CountryUsers[] = number_format((((log($UserCount)/log(2))-$CountryMin)/($CountryMax-$CountryMin))*100,2); $CountryUsers[] = number_format((((log($UserCount) / log(2)) - $CountryMin) / ($CountryMax - $CountryMin)) * 100, 2);
$Rank[] = round((1-($Key/$Count))*100); $Rank[] = round((1 - ($Key / $Count)) * 100);
if(isset($CountryRegions[$Country])) { if (isset($CountryRegions[$Country])) {
foreach($CountryRegions[$Country] as $Region) { foreach ($CountryRegions[$Country] as $Region) {
$Countries[] = $Region; $Countries[] = $Region;
$Rank[] = end($Rank); $Rank[] = end($Rank);
} }
@ -30,20 +30,20 @@
} }
reset($Rank); reset($Rank);
for ($i=$CountryMin;$i<=$CountryMax;$i++) { for ($i = $CountryMin; $i <= $CountryMax; $i++) {
$LogIncrements[] = Format::human_format(pow(2,$i)); $LogIncrements[] = Format::human_format(pow(2, $i));
} }
$Cache->cache_value('geodistribution',array($Countries,$Rank,$CountryUsers,$CountryMax,$CountryMin,$LogIncrements),0); $Cache->cache_value('geodistribution',array($Countries, $Rank, $CountryUsers, $CountryMax, $CountryMin, $LogIncrements), 0);
} }
if(!$ClassDistribution = $Cache->get_value('class_distribution')) { if (!$ClassDistribution = $Cache->get_value('class_distribution')) {
include_once(SERVER_ROOT.'/classes/class_charts.php'); include_once(SERVER_ROOT.'/classes/class_charts.php');
$DB->query("SELECT p.Name, COUNT(m.ID) AS Users FROM users_main AS m JOIN permissions AS p ON m.PermissionID=p.ID WHERE m.Enabled='1' GROUP BY p.Name ORDER BY Users DESC"); $DB->query("SELECT p.Name, COUNT(m.ID) AS Users FROM users_main AS m JOIN permissions AS p ON m.PermissionID=p.ID WHERE m.Enabled='1' GROUP BY p.Name ORDER BY Users DESC");
$ClassSizes = $DB->to_array(); $ClassSizes = $DB->to_array();
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
foreach($ClassSizes as $ClassSize) { foreach ($ClassSizes as $ClassSize) {
list($Label,$Users) = $ClassSize; list($Label, $Users) = $ClassSize;
$Pie->add($Label,$Users); $Pie->add($Label, $Users);
} }
$Pie->transparent(); $Pie->transparent();
$Pie->color('FF33CC'); $Pie->color('FF33CC');
@ -51,7 +51,7 @@
$ClassDistribution = $Pie->url(); $ClassDistribution = $Pie->url();
$Cache->cache_value('class_distribution',$ClassDistribution,3600*24*14); $Cache->cache_value('class_distribution',$ClassDistribution,3600*24*14);
} }
if(!$PlatformDistribution = $Cache->get_value('platform_distribution')) { if (!$PlatformDistribution = $Cache->get_value('platform_distribution')) {
include_once(SERVER_ROOT.'/classes/class_charts.php'); include_once(SERVER_ROOT.'/classes/class_charts.php');
@ -59,7 +59,7 @@
$Platforms = $DB->to_array(); $Platforms = $DB->to_array();
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
foreach($Platforms as $Platform) { foreach ($Platforms as $Platform) {
list($Label,$Users) = $Platform; list($Label,$Users) = $Platform;
$Pie->add($Label,$Users); $Pie->add($Label,$Users);
} }
@ -67,10 +67,10 @@
$Pie->color('8A00B8'); $Pie->color('8A00B8');
$Pie->generate(); $Pie->generate();
$PlatformDistribution = $Pie->url(); $PlatformDistribution = $Pie->url();
$Cache->cache_value('platform_distribution',$PlatformDistribution,3600*24*14); $Cache->cache_value('platform_distribution',$PlatformDistribution,3600 * 24 * 14);
} }
if(!$BrowserDistribution = $Cache->get_value('browser_distribution')) { if (!$BrowserDistribution = $Cache->get_value('browser_distribution')) {
include_once(SERVER_ROOT.'/classes/class_charts.php'); include_once(SERVER_ROOT.'/classes/class_charts.php');
@ -78,7 +78,7 @@
$Browsers = $DB->to_array(); $Browsers = $DB->to_array();
$Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1));
foreach($Browsers as $Browser) { foreach ($Browsers as $Browser) {
list($Label,$Users) = $Browser; list($Label,$Users) = $Browser;
$Pie->add($Label,$Users); $Pie->add($Label,$Users);
} }
@ -86,7 +86,7 @@
$Pie->color('008AB8'); $Pie->color('008AB8');
$Pie->generate(); $Pie->generate();
$BrowserDistribution = $Pie->url(); $BrowserDistribution = $Pie->url();
$Cache->cache_value('browser_distribution',$BrowserDistribution,3600*24*14); $Cache->cache_value('browser_distribution',$BrowserDistribution,3600 * 24 * 14);
} }
@ -96,13 +96,13 @@
$TimelineIn = array_reverse($DB->to_array()); $TimelineIn = array_reverse($DB->to_array());
$DB->query("SELECT DATE_FORMAT(BanDate,'%b \\'%y') AS Month, COUNT(UserID) FROM users_info GROUP BY Month ORDER BY BanDate DESC LIMIT 1, 12"); $DB->query("SELECT DATE_FORMAT(BanDate,'%b \\'%y') AS Month, COUNT(UserID) FROM users_info GROUP BY Month ORDER BY BanDate DESC LIMIT 1, 12");
$TimelineOut = array_reverse($DB->to_array()); $TimelineOut = array_reverse($DB->to_array());
foreach($TimelineIn as $Month) { foreach ($TimelineIn as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
if ($Amount > $Max) { if ($Amount > $Max) {
$Max = $Amount; $Max = $Amount;
} }
} }
foreach($TimelineOut as $Month) { foreach ($TimelineOut as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
if ($Amount > $Max) { if ($Amount > $Max) {
$Max = $Amount; $Max = $Amount;
@ -110,16 +110,16 @@
} }
$Labels = array(); $Labels = array();
foreach($TimelineIn as $Month) { foreach ($TimelineIn as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
$Labels[] = $Label; $Labels[] = $Label;
$InFlow[] = number_format(($Amount/$Max)*100,4); $InFlow[] = number_format(($Amount / $Max) * 100, 4);
} }
foreach($TimelineOut as $Month) { foreach ($TimelineOut as $Month) {
list($Label,$Amount) = $Month; list($Label,$Amount) = $Month;
$OutFlow[] = number_format(($Amount/$Max)*100,4); $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)); //Tested: fine for dec -> jan $Cache->cache_value('users_timeline',array($Labels,$InFlow,$OutFlow,$Max),mktime(0,0,0,date('n') + 1, 2)); //Tested: fine for dec -> jan
} }
//End timeline generation //End timeline generation

View File

@ -1,5 +1,7 @@
<? <?
if(!check_perms('admin_donor_log')) { error(403); } if (!check_perms('admin_donor_log')) {
error(403);
}
include(SERVER_ROOT.'/sections/donate/config.php'); include(SERVER_ROOT.'/sections/donate/config.php');
@ -15,7 +17,7 @@
d.Email, d.Email,
d.Time d.Time
FROM donations AS d "; FROM donations AS d ";
if(!empty($_GET['search'])) { if (!empty($_GET['search'])) {
$sql .= "WHERE d.Email LIKE '%".db_string($_GET['search'])."%' "; $sql .= "WHERE d.Email LIKE '%".db_string($_GET['search'])."%' ";
} }
$sql .= "ORDER BY d.Time DESC LIMIT $Limit"; $sql .= "ORDER BY d.Time DESC LIMIT $Limit";
@ -30,7 +32,7 @@
$DB->query("SELECT DATE_FORMAT(Time,'%b \'%y') AS Month, SUM(Amount) FROM donations GROUP BY Month ORDER BY Time DESC LIMIT 1, 18"); $DB->query("SELECT DATE_FORMAT(Time,'%b \'%y') AS Month, SUM(Amount) FROM donations GROUP BY Month ORDER BY Time DESC LIMIT 1, 18");
$Timeline = array_reverse($DB->to_array()); $Timeline = array_reverse($DB->to_array());
$Area = new AREA_GRAPH(880,160,array('Break'=>1)); $Area = new AREA_GRAPH(880,160,array('Break'=>1));
foreach($Timeline as $Entry) { foreach ($Timeline as $Entry) {
list($Label,$Amount) = $Entry; list($Label,$Amount) = $Entry;
$Area->add($Label,$Amount); $Area->add($Label,$Amount);
} }
@ -40,7 +42,7 @@
$Area->lines(2); $Area->lines(2);
$Area->generate(); $Area->generate();
$DonationTimeline = $Area->url(); $DonationTimeline = $Area->url();
$Cache->cache_value('donation_timeline',$DonationTimeline,mktime(0,0,0,date('n')+1,2)); $Cache->cache_value('donation_timeline',$DonationTimeline,mktime(0,0,0,date('n') + 1, 2));
} }
View::show_header('Donation log'); View::show_header('Donation log');
@ -69,7 +71,7 @@
<br /> <br />
<div class="linkbox"> <div class="linkbox">
<? <?
$Pages=Format::get_pages($Page,$Results,DONATIONS_PER_PAGE,11) ; $Pages = Format::get_pages($Page, $Results, DONATIONS_PER_PAGE, 11);
echo $Pages; echo $Pages;
?> ?>
</div> </div>
@ -81,7 +83,7 @@
<td>Time</td> <td>Time</td>
</tr> </tr>
<? <?
foreach($Donations as $Donation) { foreach ($Donations as $Donation) {
list($UserID, $Amount, $Currency, $Email, $DonationTime) = $Donation; list($UserID, $Amount, $Currency, $Email, $DonationTime) = $Donation;
?> ?>
<tr> <tr>

View File

@ -506,7 +506,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
<td class="big_info"> <td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">

View File

@ -214,7 +214,7 @@
<td class="big_info"> <td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">
@ -314,7 +314,7 @@
<td class="nobr big_info"> <td class="nobr big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">

View File

@ -1001,7 +1001,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<td colspan="2" class="big_info"> <td colspan="2" class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupInfo['CategoryID'] - 1) ?> <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupInfo['CategoryID']) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">
@ -1122,7 +1122,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<td class="big_info"> <td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($GroupInfo['WikiImage'], $CategoryID - 1) ?> <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $CategoryID) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">

View File

@ -119,12 +119,8 @@ function compare($X, $Y) {
<div class="head"><strong>Cover</strong></div> <div class="head"><strong>Cover</strong></div>
<? <?
if ($WikiImage != '') { if ($WikiImage != '') {
$WikiImageThumb = ImageTools::wiki_image($WikiImage);
if (check_perms('site_proxy_images')) {
$WikiImage = ImageTools::proxy_url($WikiImage);
}
?> ?>
<p align="center"><img style="max-width: 220px;" src="<?=$WikiImageThumb?>" alt="<?=$AltName?>" onclick="lightbox.init('<?=$WikiImage?>',220);" /></p> <p align="center"><img style="max-width: 220px;" src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$AltName?>" onclick="lightbox.init('<?=ImageTools::process($WikiImage)?>',220);" /></p>
<? <?
} else { } else {
?> ?>

View File

@ -256,7 +256,7 @@ function header_link($SortKey, $DefaultWay = "desc") {
<td class="big_info"> <td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupCategoryID - 1) ?> <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupCategoryID) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">

View File

@ -25,14 +25,14 @@
$Type = $Categories[$TypeID-1]; $Type = $Categories[$TypeID-1];
$TorrentID = (int)$_POST['torrentid']; $TorrentID = (int)$_POST['torrentid'];
$Properties['Remastered'] = (isset($_POST['remaster']))? 1 : 0; $Properties['Remastered'] = (isset($_POST['remaster']))? 1 : 0;
if($Properties['Remastered']) { if ($Properties['Remastered']) {
$Properties['UnknownRelease'] = (isset($_POST['unknown'])) ? 1 : 0; $Properties['UnknownRelease'] = (isset($_POST['unknown'])) ? 1 : 0;
$Properties['RemasterYear'] = $_POST['remaster_year']; $Properties['RemasterYear'] = $_POST['remaster_year'];
$Properties['RemasterTitle'] = $_POST['remaster_title']; $Properties['RemasterTitle'] = $_POST['remaster_title'];
$Properties['RemasterRecordLabel'] = $_POST['remaster_record_label']; $Properties['RemasterRecordLabel'] = $_POST['remaster_record_label'];
$Properties['RemasterCatalogueNumber'] = $_POST['remaster_catalogue_number']; $Properties['RemasterCatalogueNumber'] = $_POST['remaster_catalogue_number'];
} }
if(!$Properties['Remastered']) { if (!$Properties['Remastered']) {
$Properties['UnknownRelease'] = 0; $Properties['UnknownRelease'] = 0;
$Properties['RemasterYear'] = ''; $Properties['RemasterYear'] = '';
$Properties['RemasterTitle'] = ''; $Properties['RemasterTitle'] = '';
@ -57,21 +57,21 @@
$Properties['Trumpable'] = (isset($_POST['make_trumpable'])) ? 1 : 0; $Properties['Trumpable'] = (isset($_POST['make_trumpable'])) ? 1 : 0;
$Properties['TorrentDescription'] = $_POST['release_desc']; $Properties['TorrentDescription'] = $_POST['release_desc'];
$Properties['Name'] = $_POST['title']; $Properties['Name'] = $_POST['title'];
if($_POST['album_desc']) { if ($_POST['album_desc']) {
$Properties['GroupDescription'] = $_POST['album_desc']; $Properties['GroupDescription'] = $_POST['album_desc'];
} }
if(check_perms('torrents_freeleech')) { if (check_perms('torrents_freeleech')) {
$Free = (int)$_POST['freeleech']; $Free = (int)$_POST['freeleech'];
if(!in_array($Free, array(0,1,2))) { if (!in_array($Free, array(0,1,2))) {
error(404); error(404);
} }
$Properties['FreeLeech'] = $Free; $Properties['FreeLeech'] = $Free;
if($Free == 0) { if ($Free == 0) {
$FreeType = 0; $FreeType = 0;
} else { } else {
$FreeType = (int)$_POST['freeleechtype']; $FreeType = (int)$_POST['freeleechtype'];
if(!in_array($Free, array(0,1,2,3))) { if (!in_array($Free, array(0,1,2,3))) {
error(404); error(404);
} }
} }
@ -82,22 +82,22 @@
//--------------- Validate data in edit form -----------------------------------// //--------------- Validate data in edit form -----------------------------------//
$DB->query('SELECT UserID, Remastered, RemasterYear, FreeTorrent FROM torrents WHERE ID='.$TorrentID); $DB->query('SELECT UserID, Remastered, RemasterYear, FreeTorrent FROM torrents WHERE ID='.$TorrentID);
if($DB->record_count() == 0) { if ($DB->record_count() == 0) {
error(404); error(404);
} }
list($UserID, $Remastered, $RemasterYear, $CurFreeLeech) = $DB->next_record(MYSQLI_BOTH, false); list($UserID, $Remastered, $RemasterYear, $CurFreeLeech) = $DB->next_record(MYSQLI_BOTH, false);
if($LoggedUser['ID']!=$UserID && !check_perms('torrents_edit')) { if ($LoggedUser['ID'] != $UserID && !check_perms('torrents_edit')) {
error(403); error(403);
} }
if($Remastered == '1' && !$RemasterYear && !check_perms('edit_unknowns')) { if ($Remastered == '1' && !$RemasterYear && !check_perms('edit_unknowns')) {
error(403); error(403);
} }
if($Properties['UnknownRelease'] && !($Remastered == '1' && !$RemasterYear) && !check_perms('edit_unknowns')) { if ($Properties['UnknownRelease'] && !($Remastered == '1' && !$RemasterYear) && !check_perms('edit_unknowns')) {
//It's Unknown now, and it wasn't before //It's Unknown now, and it wasn't before
if($LoggedUser['ID'] != $UserID) { if ($LoggedUser['ID'] != $UserID) {
//Hax //Hax
die(); die();
} }
@ -106,7 +106,7 @@
$Validate->SetFields('type','1','number','Not a valid type.',array('maxlength'=>count($Categories), 'minlength'=>1)); $Validate->SetFields('type','1','number','Not a valid type.',array('maxlength'=>count($Categories), 'minlength'=>1));
switch ($Type) { switch ($Type) {
case 'Music': case 'Music':
if(!empty($Properties['Remastered']) && !$Properties['UnknownRelease']){ if (!empty($Properties['Remastered']) && !$Properties['UnknownRelease']) {
$Validate->SetFields('remaster_year', '1', 'number', 'Year of remaster/re-issue must be entered.'); $Validate->SetFields('remaster_year', '1', 'number', 'Year of remaster/re-issue must be entered.');
} else { } else {
$Validate->SetFields('remaster_year', '0','number', 'Invalid remaster year.'); $Validate->SetFields('remaster_year', '0','number', 'Invalid remaster year.');
@ -142,11 +142,13 @@
// Handle 'other' bitrates // Handle 'other' bitrates
if($Properties['Encoding'] == 'Other') { if ($Properties['Encoding'] == 'Other') {
$Validate->SetFields('other_bitrate', $Validate->SetFields('other_bitrate',
'1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9)); '1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9));
$enc = trim($_POST['other_bitrate']); $enc = trim($_POST['other_bitrate']);
if(isset($_POST['vbr'])) { $enc.=' (VBR)'; } if (isset($_POST['vbr'])) {
$enc.=' (VBR)';
}
$Properties['Encoding'] = $enc; $Properties['Encoding'] = $enc;
$Properties['Bitrate'] = $enc; $Properties['Bitrate'] = $enc;
@ -179,11 +181,13 @@
// Handle 'other' bitrates // Handle 'other' bitrates
if($Properties['Encoding'] == 'Other') { if ($Properties['Encoding'] == 'Other') {
$Validate->SetFields('other_bitrate', $Validate->SetFields('other_bitrate',
'1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9)); '1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9));
$enc = trim($_POST['other_bitrate']); $enc = trim($_POST['other_bitrate']);
if(isset($_POST['vbr'])) { $enc.=' (VBR)'; } if (isset($_POST['vbr'])) {
$enc.=' (VBR)';
}
$Properties['Encoding'] = $enc; $Properties['Encoding'] = $enc;
$Properties['Bitrate'] = $enc; $Properties['Bitrate'] = $enc;
@ -209,9 +213,9 @@
$Err = $Validate->ValidateForm($_POST); // Validate the form $Err = $Validate->ValidateForm($_POST); // Validate the form
if($Properties['Remastered'] && !$Properties['RemasterYear']) { if ($Properties['Remastered'] && !$Properties['RemasterYear']) {
//Unknown Edit! //Unknown Edit!
if($LoggedUser['ID'] == $UserID || check_perms('edit_unknowns')) { if ($LoggedUser['ID'] == $UserID || check_perms('edit_unknowns')) {
//Fine! //Fine!
} else { } else {
$Err = "You may not edit somebody else's upload to unknown release."; $Err = "You may not edit somebody else's upload to unknown release.";
@ -226,8 +230,8 @@
} }
ImageTools::blacklisted($Properties['Image']); ImageTools::blacklisted($Properties['Image']);
if($Err){ // Show the upload form, with the data the user entered if ($Err) { // Show the upload form, with the data the user entered
if(check_perms('site_debug')) { if (check_perms('site_debug')) {
die($Err); die($Err);
} }
error($Err); error($Err);
@ -240,8 +244,8 @@
// Shorten and escape $Properties for database input // Shorten and escape $Properties for database input
$T = array(); $T = array();
foreach ($Properties as $Key => $Value) { foreach ($Properties as $Key => $Value) {
$T[$Key]="'".db_string(trim($Value))."'"; $T[$Key] = "'".db_string(trim($Value))."'";
if(!$T[$Key]){ if (!$T[$Key]) {
$T[$Key] = NULL; $T[$Key] = NULL;
} }
} }
@ -286,13 +290,13 @@
Scene=$T[Scene], Scene=$T[Scene],
Description=$T[TorrentDescription],"; Description=$T[TorrentDescription],";
if(check_perms('torrents_freeleech')) { if (check_perms('torrents_freeleech')) {
$SQL .= "FreeTorrent=$T[FreeLeech],"; $SQL .= "FreeTorrent=$T[FreeLeech],";
$SQL .= "FreeLeechType=$T[FreeLeechType],"; $SQL .= "FreeLeechType=$T[FreeLeechType],";
} }
if(check_perms('users_mod')) { if (check_perms('users_mod')) {
if($T[Format] != "'FLAC'") { if ($T[Format] != "'FLAC'") {
$SQL .= " $SQL .= "
HasLog='0', HasLog='0',
HasCue='0', HasCue='0',
@ -381,7 +385,7 @@
"; ";
$DB->query($SQL); $DB->query($SQL);
if(check_perms('torrents_freeleech') && $Properties['FreeLeech'] != $CurFreeLeech) { if (check_perms('torrents_freeleech') && $Properties['FreeLeech'] != $CurFreeLeech) {
Torrents::freeleech_torrents($TorrentID, $Properties['FreeLeech'], $Properties['FreeLeechType']); Torrents::freeleech_torrents($TorrentID, $Properties['FreeLeech'], $Properties['FreeLeechType']);
} }
@ -389,8 +393,8 @@
list($GroupID, $Time) = $DB->next_record(); list($GroupID, $Time) = $DB->next_record();
// Competition // Competition
if(strtotime($Time)>1241352173) { if (strtotime($Time)>1241352173) {
if($_POST['log_score'] == '100') { if ($_POST['log_score'] == '100') {
$DB->query("INSERT IGNORE into users_points (GroupID, UserID, Points) VALUES ('$GroupID', '$UserID', '1')"); $DB->query("INSERT IGNORE into users_points (GroupID, UserID, Points) VALUES ('$GroupID', '$UserID', '1')");
} }
} }

View File

@ -492,7 +492,7 @@ function header_link($SortKey,$DefaultWay="DESC") {
<td class="big_info"> <td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">

View File

@ -811,9 +811,9 @@
foreach ($ArtistsUnescaped as $Importance => $Artists) { foreach ($ArtistsUnescaped as $Importance => $Artists) {
foreach ($Artists as $Artist) { foreach ($Artists as $Artist) {
if ($Importance == 1 || $Importance == 4 || $Importance == 5 || $Importance == 6) { if ($Importance == 1 || $Importance == 4 || $Importance == 5 || $Importance == 6) {
$ArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']))."|%'"; $ArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']), true)."|%'";
} else { } else {
$GuestArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']))."|%'"; $GuestArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']), true)."|%'";
} }
} }
} }

View File

@ -166,8 +166,10 @@ function user_dupes_table($UserID) {
<input type="hidden" name="userid" value="<?=$UserID?>" /> <input type="hidden" name="userid" value="<?=$UserID?>" />
<input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" id="form_comment_hash" name="form_comment_hash" value="<?=$CommentHash?>" /> <input type="hidden" id="form_comment_hash" name="form_comment_hash" value="<?=$CommentHash?>" />
<div class="box"> <div class="box" id="l_a_box">
<div class="head"><?=max($DupeCount - 1, 0)?> Linked account<?=(($DupeCount == 2)?'':'s')?> <a href="#" onclick="$('.linkedaccounts').toggle(); return false;" class="brackets">View</a></div> <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>
</div>
<table width="100%" class="layout hidden linkedaccounts"> <table width="100%" class="layout hidden linkedaccounts">
<?=$DupeCount?'<tr>':''?> <?=$DupeCount?'<tr>':''?>
<? <?

View File

@ -13,7 +13,7 @@
if (!$Name) { if (!$Name) {
error(404); error(404);
} }
if (isset($_GET['format']) && $_GET['format'] === "data"){ if (isset($_GET['format']) && $_GET['format'] === "data") {
global $Cache; global $Cache;
$ImageData = $Cache->get_value("cssgallery_".$Name); $ImageData = $Cache->get_value("cssgallery_".$Name);
if(!empty($ImageData)){ if(!empty($ImageData)){
@ -26,19 +26,19 @@
} else { } else {
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" style="overflow:hidden !important; margin: 0 !important; padding: 0 !important;"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" style="overflow: hidden !important; margin: 0 !important; padding: 0 !important;">
<head> <head>
<title>Stylesheet Gallery</title> <title>Stylesheet Gallery</title>
<meta http-equiv="X-UA-Compatible" content="chrome=1;IE=edge" /> <meta http-equiv="X-UA-Compatible" content="chrome=1; IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<? echo STATIC_SERVER; ?>styles/global.css?v=<?=filemtime(STATIC_SERVER.'styles/global.css')?>" rel="stylesheet" type="text/css" /> <link href="<? echo STATIC_SERVER; ?>styles/global.css?v=<?=filemtime(STATIC_SERVER.'styles/global.css')?>" rel="stylesheet" type="text/css" />
<link href="<? echo STATIC_SERVER; ?>styles/<?= $Name ?>/style.css?v=<?=filemtime(STATIC_SERVER.'styles/'.$Name.'/style.css')?>" title="<?= $Name ?>" rel="stylesheet" type="text/css" media="screen" /> <link href="<? echo STATIC_SERVER; ?>styles/<?= $Name ?>/style.css?v=<?=filemtime(STATIC_SERVER.'styles/'.$Name.'/style.css')?>" title="<?= $Name ?>" rel="stylesheet" type="text/css" media="screen" />
<? if (isset($_GET['save']) && $_GET['save']==="true" && check_perms('admin_clear_cache')) { ?> <? if (isset($_GET['save']) && $_GET['save'] === 'true' && check_perms('admin_clear_cache')) { ?>
<script src="<? echo STATIC_SERVER; ?>functions/jquery.js?v=<?=filemtime(STATIC_SERVER.'functions/jquery.js')?>"></script> <script src="<? echo STATIC_SERVER; ?>functions/jquery.js?v=<?=filemtime(STATIC_SERVER.'functions/jquery.js')?>"></script>
<script src="<? echo STATIC_SERVER; ?>functions/stylesheetgallery.js?v=<?=filemtime(STATIC_SERVER.'functions/stylesheetgallery.js')?>"></script> <script src="<? echo STATIC_SERVER; ?>functions/stylesheetgallery.js?v=<?=filemtime(STATIC_SERVER.'functions/stylesheetgallery.js')?>"></script>
<? } ?> <? } ?>
</head> </head>
<body id="user" style="overflow:hidden !important; margin: 0 !important; padding: 0 !important; position: absolute !important;" stylesheet="<?= $Name ?>"> <body id="user" style="overflow: hidden !important; margin: 0 !important; padding: 0 !important; position: absolute !important;" stylesheet="<?= $Name ?>">
<div id="wrapper"> <div id="wrapper">
<h1 class="hidden">Gazelle</h1> <h1 class="hidden">Gazelle</h1>
<div id="header"> <div id="header">
@ -110,39 +110,38 @@
<span class="hidden">Artist: </span> <span class="hidden">Artist: </span>
<form class="search_form" name="artists" action="" method="get"> <form class="search_form" name="artists" action="" method="get">
<script type="text/javascript" src="static/functions/autocomplete.js?v=1362029969"></script> <script type="text/javascript" src="static/functions/autocomplete.js?v=1362029969"></script>
<input id="artistsearch" value="Artists" type="text" name="artistname" size="17"/> <input id="artistsearch" value="Artists" type="text" name="artistname" size="17" />
<ul id="artistcomplete" style="visibility: hidden;"><li/></ul> <ul id="artistcomplete" style="visibility: hidden;"><li/></ul>
</form> </form>
</li> </li>
<li id="searchbar_requests"> <li id="searchbar_requests">
<span class="hidden">Requests: </span> <span class="hidden">Requests: </span>
<form class="search_form" name="requests" action="" method="get"> <form class="search_form" name="requests" action="" method="get">
<input id="requestssearch" value="Requests" type="text" name="search" size="17"/> <input id="requestssearch" value="Requests" type="text" name="search" size="17" />
</form> </form>
</li> </li>
<li id="searchbar_forums"> <li id="searchbar_forums">
<span class="hidden">Forums: </span> <span class="hidden">Forums: </span>
<form class="search_form" name="forums" action="" method="get"> <form class="search_form" name="forums" action="" method="get">
<input value="search" type="hidden" name="action" /> <input value="search" type="hidden" name="action" />
<input id="forumssearch" value="Forums" type="text" name="search" size="17"/> <input id="forumssearch" value="Forums" type="text" name="search" size="17" />
</form> </form>
</li> </li>
<li id="searchbar_log"> <li id="searchbar_log">
<span class="hidden">Log: </span> <span class="hidden">Log: </span>
<form class="search_form" name="log" action="" method="get"> <form class="search_form" name="log" action="" method="get">
<input id="logsearch" value="Log" type="text" name="search" size="17"/> <input id="logsearch" value="Log" type="text" name="search" size="17" />
</form> </form>
</li> </li>
<li id="searchbar_users"> <li id="searchbar_users">
<span class="hidden">Users: </span> <span class="hidden">Users: </span>
<form class="search_form" name="users" action="" method="get"> <form class="search_form" name="users" action="" method="get">
<input type="hidden" name="action" value="search" /> <input type="hidden" name="action" value="search" />
<input id="userssearch" value="Users" type="text" name="search" size="20"/> <input id="userssearch" value="Users" type="text" name="search" size="20" />
</form> </form>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div id="content"> <div id="content">
<div class="thin"> <div class="thin">
@ -152,11 +151,11 @@
<table class="forum_index"> <table class="forum_index">
<tbody> <tbody>
<tr class="colhead"> <tr class="colhead">
<td style="width:2%;"></td> <td style="width: 2%;"></td>
<td style="width:25%;">Forum</td> <td style="width: 25%;">Forum</td>
<td>Last post</td> <td>Last post</td>
<td style="width:7%;">Topics</td> <td style="width: 7%;">Topics</td>
<td style="width:7%;">Posts</td> <td style="width: 7%;">Posts</td>
</tr> </tr>
<tr class="rowb"> <tr class="rowb">
<td title="Unread" class="unread"></td> <td title="Unread" class="unread"></td>
@ -166,13 +165,13 @@
</h4> </h4>
</td> </td>
<td> <td>
<span class="last_topic" style="float:left;"> <span class="last_topic" style="float: left;">
<a title="New Site Announcements" href="#">New Site Announcements</a> <a title="New Site Announcements" href="#">New Site Announcements</a>
</span> </span>
<span title="Jump to last read" class="last_read" style="float: left;"> <span title="Jump to last read" class="last_read" style="float: left;">
<a href="#"></a> <a href="#"></a>
</span> </span>
<span class="last_poster" style="float:right;">by <a href="#">Rippy</a> <span title="Aug 14 1992, 18:35" class="time">Just now</span></span> <span class="last_poster" style="float: right;">by <a href="#">Rippy</a> <span title="Aug 14 1992, 18:35" class="time">Just now</span></span>
</td> </td>
<td>385</td> <td>385</td>
<td>95,197</td> <td>95,197</td>
@ -181,14 +180,14 @@
<td title="Read" class="read"></td> <td title="Read" class="read"></td>
<td> <td>
<h4 class="min_padding"> <h4 class="min_padding">
<a href="#">What.CD</a> <a href="#"><?=SITE_NAME?></a>
</h4> </h4>
</td> </td>
<td> <td>
<span class="last_topic" style="float:left;"> <span class="last_topic" style="float: left;">
<a title="Dear Mortals, you have violated the rule..." href="#">Dear Mortals, you have violated the rule...</a> <a title="Dear Mortals, you have violated the rule..." href="#">Dear Mortals, you have violated the rule...</a>
</span> </span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span title="Sep 9 1992, 10:55" class="time">3 mins ago</span></span> <span class="last_poster" style="float: right;">by <a href="#">Drone</a> <span title="Sep 9 1992, 10:55" class="time">3 mins ago</span></span>
</td> </td>
<td>2,624</td> <td>2,624</td>
<td>110,432</td> <td>110,432</td>
@ -198,11 +197,11 @@
<h3>Community</h3> <h3>Community</h3>
<table class="forum_index"> <table class="forum_index">
<tbody><tr class="colhead"> <tbody><tr class="colhead">
<td style="width:2%;"></td> <td style="width: 2%;"></td>
<td style="width:25%;">Forum</td> <td style="width: 25%;">Forum</td>
<td>Last post</td> <td>Last post</td>
<td style="width:7%;">Topics</td> <td style="width: 7%;">Topics</td>
<td style="width:7%;">Posts</td> <td style="width: 7%;">Posts</td>
</tr> </tr>
<tr class="rowb"> <tr class="rowb">
<td title="Unread" class="unread"></td> <td title="Unread" class="unread"></td>
@ -212,13 +211,13 @@
</h4> </h4>
</td> </td>
<td> <td>
<span class="last_topic" style="float:left;"> <span class="last_topic" style="float: left;">
<a title="Last stand against Drone?" href="#">Last stand against Drone?</a> <a title="Last stand against Drone?" href="#">Last stand against Drone?</a>
</span> </span>
<span title="Jump to last read" class="last_read" style="float: left;"> <span title="Jump to last read" class="last_read" style="float: left;">
<a href="#"></a> <a href="#"></a>
</span> </span>
<span class="last_poster" style="float:right;">by <a href="#">Ajax</a> <span class="time">Just now</span></span> <span class="last_poster" style="float: right;">by <a href="#">Ajax</a> <span class="time">Just now</span></span>
</td> </td>
<td>37,531</td> <td>37,531</td>
<td>1,545,089</td> <td>1,545,089</td>
@ -231,10 +230,10 @@
</h4> </h4>
</td> </td>
<td> <td>
<span class="last_topic" style="float:left;"> <span class="last_topic" style="float: left;">
<a title="No fun allowed" href="#">No fun allowed</a> <a title="No fun allowed" href="#">No fun allowed</a>
</span> </span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span class="time">10 mins ago</span></span> <span class="last_poster" style="float: right;">by <a href="#">Drone</a> <span class="time">10 mins ago</span></span>
</td> </td>
<td>424</td> <td>424</td>
<td>490,163</td> <td>490,163</td>
@ -247,10 +246,10 @@
</h4> </h4>
</td> </td>
<td> <td>
<span class="last_topic" style="float:left;"> <span class="last_topic" style="float: left;">
<a title="List of forbidden literature" href="#">List of forbidden literature</a> <a title="List of forbidden literature" href="#">List of forbidden literature</a>
</span> </span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span class="time">7 hours ago</span></span> <span class="last_poster" style="float: right;">by <a href="#">Drone</a> <span class="time">7 hours ago</span></span>
</td> </td>
<td>424</td> <td>424</td>
<td>490,163</td> <td>490,163</td>
@ -263,10 +262,10 @@
</h4> </h4>
</td> </td>
<td> <td>
<span class="last_topic" style="float:left;"> <span class="last_topic" style="float: left;">
<a title="[Region] The Void" href="#">[Region] The Void</a> <a title="[Region] The Void" href="#">[Region] The Void</a>
</span> </span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span class="time">25 mins ago</span></span> <span class="last_poster" style="float: right;">by <a href="#">Drone</a> <span class="time">25 mins ago</span></span>
</td> </td>
<td>305</td> <td>305</td>
<td>15,231</td> <td>15,231</td>
@ -279,13 +278,13 @@
</h4> </h4>
</td> </td>
<td> <td>
<span class="last_topic" style="float:left;"> <span class="last_topic" style="float: left;">
<a title="How did Drone take over the site?" href="#">How did Drone take over the site?</a> <a title="How did Drone take over the site?" href="#">How did Drone take over the site?</a>
</span> </span>
<span title="Jump to last read" class="last_read" style="float: left;"> <span title="Jump to last read" class="last_read" style="float: left;">
<a href="#"></a> <a href="#"></a>
</span> </span>
<span class="last_poster" style="float:right;">by <a href="#">Etheryte</a> <span class="time">5 mins ago</span></span> <span class="last_poster" style="float: right;">by <a href="#">Etheryte</a> <span class="time">5 mins ago</span></span>
</td> </td>
<td>25,031</td> <td>25,031</td>
<td>386,278</td> <td>386,278</td>
@ -296,11 +295,11 @@
<table class="forum_index"> <table class="forum_index">
<tbody> <tbody>
<tr class="colhead"> <tr class="colhead">
<td style="width:2%;"></td> <td style="width: 2%;"></td>
<td style="width:25%;">Forum</td> <td style="width: 25%;">Forum</td>
<td>Last post</td> <td>Last post</td>
<td style="width:7%;">Topics</td> <td style="width: 7%;">Topics</td>
<td style="width:7%;">Posts</td> <td style="width: 7%;">Posts</td>
</tr> </tr>
<tr class="rowb"> <tr class="rowb">
<td title="Unread" class="unread"></td> <td title="Unread" class="unread"></td>
@ -310,13 +309,13 @@
</h4> </h4>
</td> </td>
<td> <td>
<span class="last_topic" style="float:left;"> <span class="last_topic" style="float: left;">
<a title="Where did all the non-drone threads go?" href="#">Where did all the non-drone threads go?</a> <a title="Where did all the non-drone threads go?" href="#">Where did all the non-drone threads go?</a>
</span> </span>
<span title="Jump to last read" class="last_read" style="float: left;"> <span title="Jump to last read" class="last_read" style="float: left;">
<a href="#"></a> <a href="#"></a>
</span> </span>
<span class="last_poster" style="float:right;">by <a href="#">Ananke</a> <span class="time">1 min ago</span></span> <span class="last_poster" style="float: right;">by <a href="#">Ananke</a> <span class="time">1 min ago</span></span>
</td> </td>
<td>22,564</td> <td>22,564</td>
<td>608,253</td> <td>608,253</td>
@ -329,10 +328,10 @@
</h4> </h4>
</td> </td>
<td> <td>
<span class="last_topic" style="float:left;"> <span class="last_topic" style="float: left;">
<a title="Drone - Drone [EP] (drone, noise)" href="#">Drone - Drone [EP] (drone, noise)</a> <a title="Drone - Drone [EP] (drone, noise)" href="#">Drone - Drone [EP] (drone, noise)</a>
</span> </span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span class="time">Just now</span></span> <span class="last_poster" style="float: right;">by <a href="#">Drone</a> <span class="time">Just now</span></span>
</td> </td>
<td>3,948</td> <td>3,948</td>
<td>24,269</td> <td>24,269</td>

View File

@ -120,7 +120,7 @@
$DisplayCustomTitle = $CustomTitle; $DisplayCustomTitle = $CustomTitle;
if (check_perms('site_proxy_images') && !empty($CustomTitle)) { if (check_perms('site_proxy_images') && !empty($CustomTitle)) {
$DisplayCustomTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) { $DisplayCustomTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) {
return 'src='.$Matches[1].'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Matches[2]).$Matches[3]; return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3];
}, $CustomTitle); }, $CustomTitle);
} }
@ -535,16 +535,14 @@ function check_paranoia_here($Setting) {
?> ?>
<table class="layout recent" id="recent_snatches" cellpadding="0" cellspacing="0" border="0"> <table class="layout recent" id="recent_snatches" cellpadding="0" cellspacing="0" border="0">
<tr class="colhead"> <tr class="colhead">
<td colspan="5">Recent snatches</td> <td colspan="5">
<a href="#recent_snatches"><strong>&uarr;</strong></a> Recent snatches
</td>
</tr> </tr>
<tr> <tr>
<? <? foreach ($RecentSnatches as $RS) { ?>
foreach ($RecentSnatches as $RS) {
if (check_perms('site_proxy_images')) {
$RS['WikiImage'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($RS['WikiImage']);
} ?>
<td> <td>
<a href="torrents.php?id=<?=$RS['ID']?>" title="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>"><img src="<?=ImageTools::thumbnail($RS['WikiImage'])?>" alt="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>" width="107" /></a> <a href="torrents.php?id=<?=$RS['ID']?>" title="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>"><img src="<?=ImageTools::process($RS['WikiImage'], true)?>" alt="<?=display_str($RS['Artist'])?><?=display_str($RS['Name'])?>" width="107" /></a>
</td> </td>
<? } ?> <? } ?>
</tr> </tr>
@ -580,15 +578,14 @@ function check_paranoia_here($Setting) {
?> ?>
<table class="layout recent" id="recent_uploads" cellpadding="0" cellspacing="0" border="0"> <table class="layout recent" id="recent_uploads" cellpadding="0" cellspacing="0" border="0">
<tr class="colhead"> <tr class="colhead">
<td colspan="5">Recent uploads</td> <td colspan="5">
<a href="#recent_uploads"><strong>&uarr;</strong></a> Recent uploads
</td>
</tr> </tr>
<tr> <tr>
<? foreach ($RecentUploads as $RU) { <? foreach ($RecentUploads as $RU) { ?>
if (check_perms('site_proxy_images')) {
$RU['WikiImage'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($RU['WikiImage']);
} ?>
<td> <td>
<a href="torrents.php?id=<?=$RU['ID']?>" title="<?=$RU['Artist']?><?=$RU['Name']?>"><img src="<?=ImageTools::thumbnail($RU['WikiImage'])?>" alt="<?=$RU['Artist']?><?=$RU['Name']?>" width="107" /></a> <a href="torrents.php?id=<?=$RU['ID']?>" title="<?=$RU['Artist']?><?=$RU['Name']?>"><img src="<?=ImageTools::process($RU['WikiImage'], true)?>" alt="<?=$RU['Artist']?><?=$RU['Name']?>" width="107" /></a>
</td> </td>
<? } ?> <? } ?>
</tr> </tr>
@ -610,14 +607,14 @@ function check_paranoia_here($Setting) {
ORDER BY ct.Sort LIMIT 5"); ORDER BY ct.Sort LIMIT 5");
$Collage = $DB->to_array(); $Collage = $DB->to_array();
?> ?>
<table class="layout recent" id="collage<?=$CollageID?>" cellpadding="0" cellspacing="0" border="0"> <table class="layout recent" id="collage<?=$CollageID?>_box" cellpadding="0" cellspacing="0" border="0">
<tr class="colhead"> <tr class="colhead">
<td colspan="5"> <td colspan="5">
<span style="float:left;"> <span style="float:left;">
<?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>" class="brackets">See full</a> <a href="#collage<?=$CollageID?>_box"><strong>&uarr;</strong></a> <?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>" class="brackets">See full</a>
</span> </span>
<span style="float:right;"> <span style="float:right;">
<a href="#" onclick="$('#collage<?=$CollageID?> .images').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="brackets"><?=$FirstCol?'Hide':'Show'?></a> <a href="#" onclick="$('#collage<?=$CollageID?>_box .images').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="brackets"><?=$FirstCol?'Hide':'Show'?></a>
</span> </span>
</td> </td>
</tr> </tr>
@ -630,13 +627,9 @@ function check_paranoia_here($Setting) {
$Name = ''; $Name = '';
$Name .= Artists::display_artists(array('1'=>$Artists), false, true); $Name .= Artists::display_artists(array('1'=>$Artists), false, true);
$Name .= $GroupName; $Name .= $GroupName;
if (check_perms('site_proxy_images')) {
$C['WikiImage'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($C['WikiImage']);
}
?> ?>
<td> <td>
<a href="torrents.php?id=<?=$GroupID?>" title="<?=$Name?>"><img src="<?=ImageTools::thumbnail($C['WikiImage'])?>" alt="<?=$Name?>" width="107" /></a> <a href="torrents.php?id=<?=$GroupID?>" title="<?=$Name?>"><img src="<?=ImageTools::process($C['WikiImage'], true)?>" alt="<?=$Name?>" width="107" /></a>
</td> </td>
<? } ?> <? } ?>
</tr> </tr>
@ -658,8 +651,10 @@ function check_paranoia_here($Setting) {
include(SERVER_ROOT.'/classes/class_invite_tree.php'); include(SERVER_ROOT.'/classes/class_invite_tree.php');
$Tree = new INVITE_TREE($UserID, array('visible'=>false)); $Tree = new INVITE_TREE($UserID, array('visible'=>false));
?> ?>
<div class="box"> <div class="box" id="invitetree_box">
<div class="head">Invite tree <a href="#" onclick="$('#invitetree').toggle();return false;" class="brackets">View</a></div> <div class="head">
<a href="#invitetree_box"><strong>&uarr;</strong></a> Invite tree <a href="#" onclick="$('#invitetree').toggle();return false;" class="brackets">View</a>
</div>
<div id="invitetree" class="hidden"> <div id="invitetree" class="hidden">
<? $Tree->make_tree(); ?> <? $Tree->make_tree(); ?>
</div> </div>
@ -688,8 +683,10 @@ function check_paranoia_here($Setting) {
if ($DB->record_count() > 0) { if ($DB->record_count() > 0) {
$Requests = $DB->to_array(); $Requests = $DB->to_array();
?> ?>
<div class="box"> <div class="box" id="requests_box">
<div class="head">Requests <a href="#" onclick="$('#requests').toggle();return false;" class="brackets">View</a></div> <div class="head">
<a href="#requests_box"><strong>&uarr;</strong></a> Requests <a href="#" onclick="$('#requests').toggle();return false;" class="brackets">View</a>
</div>
<div id="requests" class="request_table hidden"> <div id="requests" class="request_table hidden">
<table cellpadding="6" cellspacing="1" border="0" class="border" width="100%"> <table cellpadding="6" cellspacing="1" border="0" class="border" width="100%">
<tr class="colhead_dark"> <tr class="colhead_dark">
@ -787,8 +784,10 @@ function check_paranoia_here($Setting) {
if ($DB->record_count()) { if ($DB->record_count()) {
$StaffPMs = $DB->to_array(); $StaffPMs = $DB->to_array();
?> ?>
<div class="box"> <div class="box" id="staffpms_box">
<div class="head">Staff PMs <a href="#" onclick="$('#staffpms').toggle();return false;" class="brackets">View</a></div> <div class="head">
<a href="#staffpms_box"><strong>&uarr;</strong></a> Staff PMs <a href="#" onclick="$('#staffpms').toggle();return false;" class="brackets">View</a>
</div>
<table width="100%" class="message_table hidden" id="staffpms"> <table width="100%" class="message_table hidden" id="staffpms">
<tr class="colhead"> <tr class="colhead">
<td>Subject</td> <td>Subject</td>
@ -856,8 +855,9 @@ function check_paranoia_here($Setting) {
<input type="hidden" name="userid" value="<?=$UserID?>" /> <input type="hidden" name="userid" value="<?=$UserID?>" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<div class="box"> <div class="box" id="staff_notes_box">
<div class="head">Staff notes <div class="head">
<a href="#staff_notes_box"><strong>&uarr;</strong></a> Staff notes
<a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Edit</a> <a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Edit</a>
<a href="#" onclick="$('#staffnotes').toggle(); return false;" class="brackets">Toggle</a> <a href="#" onclick="$('#staffnotes').toggle(); return false;" class="brackets">Toggle</a>
</div> </div>
@ -872,9 +872,11 @@ function check_paranoia_here($Setting) {
</div> </div>
</div> </div>
<table class="layout"> <table class="layout" id="user_info_box">
<tr class="colhead"> <tr class="colhead">
<td colspan="2">User information</td> <td colspan="2">
<a href="#user_info_box"><strong>&uarr;</strong></a> User information
</td>
</tr> </tr>
<? if (check_perms('users_edit_usernames', $Class)) { ?> <? if (check_perms('users_edit_usernames', $Class)) { ?>
<tr> <tr>
@ -1055,9 +1057,11 @@ function check_paranoia_here($Setting) {
</table><br /> </table><br />
<? if (check_perms('users_warn')) { ?> <? if (check_perms('users_warn')) { ?>
<table class="layout"> <table class="layout" id="warn_user_box">
<tr class="colhead"> <tr class="colhead">
<td colspan="2">Warn user</td> <td colspan="2">
<a href="#warn_user_box"><strong>&uarr;</strong></a> Warn user
</td>
</tr> </tr>
<tr> <tr>
<td class="label">Warned:</td> <td class="label">Warned:</td>
@ -1112,8 +1116,12 @@ function check_paranoia_here($Setting) {
</tr> </tr>
<? } ?> <? } ?>
</table><br /> </table><br />
<table class="layout"> <table class="layout" id="user_privs_box">
<tr class="colhead"><td colspan="2">User privileges</td></tr> <tr class="colhead">
<td colspan="2">
<a href="#user_privs_box"><strong>&uarr;</strong></a> User privileges
</td>
</tr>
<? if (check_perms('users_disable_posts') || check_perms('users_disable_any')) { <? if (check_perms('users_disable_posts') || check_perms('users_disable_any')) {
$DB->query("SELECT DISTINCT Email, IP FROM users_history_emails WHERE UserID = ".$UserID." ORDER BY Time ASC"); $DB->query("SELECT DISTINCT Email, IP FROM users_history_emails WHERE UserID = ".$UserID." ORDER BY Time ASC");
$Emails = $DB->to_array(); $Emails = $DB->to_array();
@ -1165,8 +1173,9 @@ function check_paranoia_here($Setting) {
<option value="1"<? if ($Enabled=='1') { ?> selected="selected"<? } ?>>Enabled</option> <option value="1"<? if ($Enabled=='1') { ?> selected="selected"<? } ?>>Enabled</option>
<option value="2"<? if ($Enabled=='2') { ?> selected="selected"<? } ?>>Disabled</option> <option value="2"<? if ($Enabled=='2') { ?> selected="selected"<? } ?>>Disabled</option>
<? if (check_perms('users_delete_users')) { ?> <? if (check_perms('users_delete_users')) { ?>
<optgroup label="-- WARNING --"></optgroup> <optgroup label="-- WARNING --">
<option value="delete">Delete account</option> <option value="delete">Delete account</option>
</optgroup>
<? } ?> <? } ?>
</select> </select>
</td> </td>
@ -1193,8 +1202,12 @@ function check_paranoia_here($Setting) {
<? } ?> <? } ?>
</table><br /> </table><br />
<? if (check_perms('users_logout')) { ?> <? if (check_perms('users_logout')) { ?>
<table class="layout"> <table class="layout" id="session_box">
<tr class="colhead"><td colspan="2">Session</td></tr> <tr class="colhead">
<td colspan="2">
<a href="#session_box"><strong>&uarr;</strong></a> Session
</td>
</tr>
<tr> <tr>
<td class="label">Reset session:</td> <td class="label">Reset session:</td>
<td><input type="checkbox" name="ResetSession" id="ResetSession" /></td> <td><input type="checkbox" name="ResetSession" id="ResetSession" /></td>
@ -1206,8 +1219,12 @@ function check_paranoia_here($Setting) {
</table> </table>
<? } ?> <? } ?>
<table class="layout"> <table class="layout" id="submit_box">
<tr class="colhead"><td colspan="2">Submit</td></tr> <tr class="colhead">
<td colspan="2">
<a href="#submit_box"><strong>&uarr;</strong></a> Submit
</td>
</tr>
<tr> <tr>
<td class="label"><span title="This message will be entered into staff notes only.">Reason:</span></td> <td class="label"><span title="This message will be entered into staff notes only.">Reason:</span></td>
<td> <td>

View File

@ -46,10 +46,6 @@
extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned')))); extract(array_intersect_key($UserInfo, array_flip(array('Username', 'Enabled', 'Title', 'Avatar', 'Donor', 'Warned'))));
} }
if (check_perms('site_proxy_images') && !empty($Avatar)) {
$Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($Avatar);
}
View::show_header('Post history for '.$Username,'subscriptions,comments,bbcode'); View::show_header('Post history for '.$Username,'subscriptions,comments,bbcode');
if ($LoggedUser['CustomForums']) { if ($LoggedUser['CustomForums']) {
@ -305,7 +301,7 @@
<? <?
if ($Avatar) { if ($Avatar) {
?> ?>
<img src="<?=$Avatar?>" width="150" style="max-height:400px;" alt="<?=$Username?>'s avatar" /> <img src="<?=ImageTools::process($Avatar)?>" width="150" style="max-height:400px;" alt="<?=$Username?>'s avatar" />
<? <?
} }
?> ?>

View File

@ -138,7 +138,7 @@
<td colspan="5" class="big_info"> <td colspan="5" class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">
@ -217,7 +217,7 @@
<td class="big_info"> <td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?> <? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear"> <div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="group_info clear"> <div class="group_info clear">

View File

@ -168,13 +168,10 @@
<tr class="row<?=$ShowCollapsed ? ' hidden' : '' ?>"> <tr class="row<?=$ShowCollapsed ? ' hidden' : '' ?>">
<? if (empty($HeavyInfo['DisableAvatars'])) { ?> <? if (empty($HeavyInfo['DisableAvatars'])) { ?>
<td class="avatar" valign="top"> <td class="avatar" valign="top">
<? if (check_perms('site_proxy_images') && preg_match('/^https?:\/\/(localhost(:[0-9]{2,5})?|[0-9]{1,3}(\.[0-9]{1,3}){3}|([a-zA-Z0-9\-\_]+\.)+([a-zA-Z]{1,5}[^\.]))(:[0-9]{2,5})?(\/[^<>]+)+\.(jpg|jpeg|gif|png|tif|tiff|bmp)$/is',$AuthorAvatar)) { <? if ($AuthorAvatar) { ?>
$AuthorAvatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&amp;i='.urlencode($AuthorAvatar); ?> <img src="<?=ImageTools::process($AuthorAvatar)?>" width="150" style="max-height: 400px;" alt="<?=$AuthorName?>'s avatar" />
<img src="<?=$AuthorAvatar?>" width="150" style="max-height: 400px;" alt="<?=$AuthorName?>'s avatar" />
<? } elseif (!$AuthorAvatar) { ?>
<img src="<?=STATIC_SERVER.'common/avatars/default.png'?>" width="150" style="max-height: 400px;" alt="Default avatar" />
<? } else { ?> <? } else { ?>
<img src="<?=$AuthorAvatar?>" width="150" style="max-height: 400px;" alt="<?=$AuthorName?>'s avatar" /> <img src="<?=STATIC_SERVER.'common/avatars/default.png'?>" width="150" style="max-height: 400px;" alt="Default avatar" />
<? } ?> <? } ?>
</td> </td>
<? } ?> <? } ?>

View File

@ -68,7 +68,7 @@
/> />
<input value="Search" type="submit" class="hidden" /> <input value="Search" type="submit" class="hidden" />
</form> </form>
<br style="line-height:10px;" /> <br style="line-height: 10px;" />
<strong><a href="wiki.php?action=browse" class="brackets">Browse articles</a></strong> <strong><a href="wiki.php?action=browse" class="brackets">Browse articles</a></strong>
</div> </div>
</div> </div>
@ -104,7 +104,7 @@
$i = 0; $i = 0;
foreach ($AliasArray as $AliasItem) { foreach ($AliasArray as $AliasItem) {
?> ?>
<li id="alias_<?=$AliasItem?>"><a href="wiki.php?action=article&amp;name=<?=$AliasItem?>"><?=Format::cut_string($AliasItem,20,1)?></a><? if (check_perms('admin_manage_wiki')) { ?> <a href="#" onclick="Remove_Alias('<?=$AliasItem?>');return false;" class="brackets" title="Delete Alias">X</a> <a href="user.php?id=<?=$UserArray[$i]?>" class="brackets" title="View User">U</a><? } ?></li> <li id="alias_<?=$AliasItem?>"><a href="wiki.php?action=article&amp;name=<?=$AliasItem?>"><?=Format::cut_string($AliasItem,20,1)?></a><? if (check_perms('admin_manage_wiki')) { ?> <a href="#" onclick="Remove_Alias('<?=$AliasItem?>');return false;" class="brackets" title="Delete alias">X</a> <a href="user.php?id=<?=$UserArray[$i]?>" class="brackets" title="View user">U</a><? } ?></li>
<? $i++; <? $i++;
} }
} }

View File

@ -1,6 +1,6 @@
var BBCode = { var BBCode = {
spoiler: function(link) { spoiler: function(link) {
if($(link.nextSibling).has_class('hidden')) { if ($(link.nextSibling).has_class('hidden')) {
$(link.nextSibling).show(); $(link.nextSibling).show();
$(link).html('Hide'); $(link).html('Hide');
} else { } else {

View File

@ -1,5 +1,5 @@
function show_peers (TorrentID, Page) { function show_peers (TorrentID, Page) {
if(Page>0) { if (Page > 0) {
ajax.get('torrents.php?action=peerlist&page='+Page+'&torrentid=' + TorrentID,function(response){ ajax.get('torrents.php?action=peerlist&page='+Page+'&torrentid=' + TorrentID,function(response){
$('#peers_' + TorrentID).show().raw().innerHTML=response; $('#peers_' + TorrentID).show().raw().innerHTML=response;
}); });
@ -20,7 +20,7 @@ function show_peers (TorrentID, Page) {
} }
function show_snatches (TorrentID, Page){ function show_snatches (TorrentID, Page){
if(Page>0) { if (Page > 0) {
ajax.get('torrents.php?action=snatchlist&page='+Page+'&torrentid=' + TorrentID,function(response){ ajax.get('torrents.php?action=snatchlist&page='+Page+'&torrentid=' + TorrentID,function(response){
$('#snatches_' + TorrentID).show().raw().innerHTML=response; $('#snatches_' + TorrentID).show().raw().innerHTML=response;
}); });
@ -41,7 +41,7 @@ function show_snatches (TorrentID, Page){
} }
function show_downloads (TorrentID, Page){ function show_downloads (TorrentID, Page){
if(Page>0) { if (Page > 0) {
ajax.get('torrents.php?action=downloadlist&page='+Page+'&torrentid=' + TorrentID,function(response){ ajax.get('torrents.php?action=downloadlist&page='+Page+'&torrentid=' + TorrentID,function(response){
$('#downloads_' + TorrentID).show().raw().innerHTML=response; $('#downloads_' + TorrentID).show().raw().innerHTML=response;
}); });

View File

@ -139,7 +139,7 @@ function Bookmark(type, id, newName) {
} }
function Unbookmark(type, id, newName) { function Unbookmark(type, id, newName) {
if(window.location.pathname.indexOf('bookmarks.php') != -1) { if (window.location.pathname.indexOf('bookmarks.php') != -1) {
ajax.get("bookmarks.php?action=remove&type=" + type + "&auth=" + authkey + "&id=" + id, function() { ajax.get("bookmarks.php?action=remove&type=" + type + "&auth=" + authkey + "&id=" + id, function() {
$('#group_' + id).remove(); $('#group_' + id).remove();
$('.groupid_' + id).remove(); $('.groupid_' + id).remove();

View File

@ -56,7 +56,7 @@ function main () {
get_headers(response); get_headers(response);
elements.titles[0].innerHTML = title; elements.titles[0].innerHTML = title;
elements.pages[0].innerHTML = response; elements.pages[0].innerHTML = response;
if(back_name){ if (back_name) {
elements.buttons[0].textContent = back_name; elements.buttons[0].textContent = back_name;
} }
}); });
@ -78,7 +78,7 @@ function go_back() {
// Get data from comments // Get data from comments
function get_headers(response) { function get_headers(response) {
title = response.match(/\<\!\-\-Title\:(.+?)\-\-\>/i)[1]; title = response.match(/\<\!\-\-Title\:(.+?)\-\-\>/i)[1];
if(response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)) { if (response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)) {
back_name = response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)[1]; back_name = response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)[1];
back_url = response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)[2]; back_url = response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)[2];
} else { } else {
@ -89,10 +89,16 @@ function get_headers(response) {
// Load content // Load content
function load(url,forward,formid) { function load(url,forward,formid) {
if(forward===undefined) { forward=true; } if (forward === undefined) {
if (transitions_in_progress && document.createTouch) { return; } //OS 2 forward = true;
if (moved_after_touch) { return; } }
if(formid===undefined){ if (transitions_in_progress && document.createTouch) { // OS 2
return;
}
if (moved_after_touch) {
return;
}
if (formid === undefined){
ajax.get(url, function (response) { ajax.get(url, function (response) {
get_headers(response); get_headers(response);
transition_to_new_element(response, forward); transition_to_new_element(response, forward);
@ -105,12 +111,18 @@ function load(url,forward,formid) {
// Moves // Moves
var moved_after_touch = false; var moved_after_touch = false;
function touch_started () { moved_after_touch = false; }; function touch_started () {
function touch_moved () { moved_after_touch = true; }; moved_after_touch = false;
};
function touch_moved () {
moved_after_touch = true;
};
// Transitions // Transitions
var transitions_in_progress = false; var transitions_in_progress = false;
function transition_ended () { transitions_in_progress = false; }; function transition_ended () {
transitions_in_progress = false;
};
function transition_to_new_element (data, going_forward) { function transition_to_new_element (data, going_forward) {
transitions_in_progress = true; transitions_in_progress = true;

View File

@ -2,16 +2,16 @@
var PUSHOVER = 5; var PUSHOVER = 5;
var TOASTY = 4; var TOASTY = 4;
$(document).ready(function() { $(document).ready(function() {
if($("#pushservice").val() > 0) { if ($("#pushservice").val() > 0) {
$('#pushsettings').show(); $('#pushsettings').show();
} }
$("#pushservice").change(function() { $("#pushservice").change(function() {
if($(this).val() > 0) { if ($(this).val() > 0) {
$('#pushsettings').show(500); $('#pushsettings').show(500);
if($(this).val() == TOASTY) { if ($(this).val() == TOASTY) {
$('#pushservice_title').text("Device ID"); $('#pushservice_title').text("Device ID");
} else if($(this).val() == PUSHOVER) { } else if ($(this).val() == PUSHOVER) {
$('#pushservice_title').text("User Key"); $('#pushservice_title').text("User Key");
} else { } else {
$('#pushservice_title').text("API Key"); $('#pushservice_title').text("API Key");

View File

@ -8,7 +8,7 @@
id = $("#recommendation_div").data('id'); id = $("#recommendation_div").data('id');
$("#recommend").click(function() { $("#recommend").click(function() {
$("#recommendation_div").slideToggle(150); $("#recommendation_div").slideToggle(150);
if(!loaded) { if (!loaded) {
$("#recommendation_status").html("Loading..."); $("#recommendation_status").html("Loading...");
$.ajax({ $.ajax({
type : "POST", type : "POST",

View File

@ -8,7 +8,7 @@ function ChangeResolve(reportid) {
ajax.get('reportsv2.php?action=ajax_change_resolve&id=' + reportid + '&type=' + $('#resolve_type' + reportid).raw().value + '&categoryid=' + $('#categoryid' + reportid).raw().value, function (response) { ajax.get('reportsv2.php?action=ajax_change_resolve&id=' + reportid + '&type=' + $('#resolve_type' + reportid).raw().value + '&categoryid=' + $('#categoryid' + reportid).raw().value, function (response) {
var x = json.decode(response); var x = json.decode(response);
$('#delete' + reportid).raw().checked = (x[0] == '1' ? true : false); $('#delete' + reportid).raw().checked = (x[0] == '1' ? true : false);
if($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) { if ($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) {
$('#warning' + reportid).raw().selectedIndex = 0; $('#warning' + reportid).raw().selectedIndex = 0;
$('#upload' + reportid).raw().checked = false; $('#upload' + reportid).raw().checked = false;
} else { } else {
@ -23,7 +23,7 @@ function ChangeResolve(reportid) {
function Load(reportid) { function Load(reportid) {
var t = $('#type' + reportid).raw().value; var t = $('#type' + reportid).raw().value;
for (var i = 0; i<$('#resolve_type' + reportid).raw().options.length; i++) { for (var i = 0; i<$('#resolve_type' + reportid).raw().options.length; i++) {
if($('#resolve_type' + reportid).raw().options[i].value == t) { if ($('#resolve_type' + reportid).raw().options[i].value == t) {
$('#resolve_type' + reportid).raw().selectedIndex = i; $('#resolve_type' + reportid).raw().selectedIndex = i;
break; break;
} }
@ -32,7 +32,7 @@ function Load(reportid) {
ajax.get('reportsv2.php?action=ajax_change_resolve&id=' + reportid + '&type=' + $('#resolve_type' + reportid).raw().value + '&categoryid=' + $('#categoryid' + reportid).raw().value, function (response) { ajax.get('reportsv2.php?action=ajax_change_resolve&id=' + reportid + '&type=' + $('#resolve_type' + reportid).raw().value + '&categoryid=' + $('#categoryid' + reportid).raw().value, function (response) {
var x = json.decode(response); var x = json.decode(response);
$('#delete' + reportid).raw().checked = (x[0] == '1' ? true : false); $('#delete' + reportid).raw().checked = (x[0] == '1' ? true : false);
if($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) { if ($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) {
$('#warning' + reportid).raw().selectedIndex = 0; $('#warning' + reportid).raw().selectedIndex = 0;
$('#upload' + reportid).raw().checked = false; $('#upload' + reportid).raw().checked = false;
} else { } else {
@ -52,7 +52,7 @@ function ErrorBox(reportid, message) {
} }
function HideErrors() { function HideErrors() {
if($('#error_box')) { if ($('#error_box')) {
$('#error_box').remove(); $('#error_box').remove();
} }
} }
@ -60,14 +60,14 @@ function HideErrors() {
function TakeResolve(reportid) { function TakeResolve(reportid) {
$('#submit_' + reportid).disable(); $('#submit_' + reportid).disable();
ajax.post("reportsv2.php?action=takeresolve","reportform_" + reportid, function (response) { ajax.post("reportsv2.php?action=takeresolve","reportform_" + reportid, function (response) {
if(response) { if (response) {
ErrorBox(reportid, response); ErrorBox(reportid, response);
} else { } else {
if($('#from_delete' + reportid).results()) { if ($('#from_delete' + reportid).results()) {
window.location = location.protocol + '//' + location.host + location.pathname + "?id=" + $('#from_delete' + reportid).raw().value; window.location = location.protocol + '//' + location.host + location.pathname + "?id=" + $('#from_delete' + reportid).raw().value;
} else { } else {
$('#report' + reportid).remove(); $('#report' + reportid).remove();
if($('#dynamic').raw().checked) { if ($('#dynamic').raw().checked) {
NewReport(1); NewReport(1);
} }
} }
@ -76,17 +76,17 @@ function TakeResolve(reportid) {
} }
function NewReport(q, view, id) { function NewReport(q, view, id) {
for(var i = 0; i < q; i++) { for (var i = 0; i < q; i++) {
var url = "reportsv2.php?action=ajax_new_report"; var url = "reportsv2.php?action=ajax_new_report";
if(view) { if (view) {
url += "&view=" + view; url += "&view=" + view;
} }
if(id) { if (id) {
url += "&id=" + id; url += "&id=" + id;
} }
ajax.get(url, function (response) { ajax.get(url, function (response) {
if(response) { if (response) {
var div = document.createElement("div"); var div = document.createElement("div");
div.id = "report"; div.id = "report";
div.innerHTML = response; div.innerHTML = response;
@ -94,12 +94,12 @@ function NewReport(q, view, id) {
var id = $('#newreportid').raw().value; var id = $('#newreportid').raw().value;
Load(id); Load(id);
$('#newreportid').remove(); $('#newreportid').remove();
if($('#no_reports').results()) { if ($('#no_reports').results()) {
$('#all_reports').raw().removeChild($('#no_reports').raw()); $('#all_reports').raw().removeChild($('#no_reports').raw());
} }
} else { } else {
//No new reports at this time //No new reports at this time
if(!$('#report').results() && !$('#no_reports').results()) { if (!$('#report').results() && !$('#no_reports').results()) {
var div = document.createElement("div"); var div = document.createElement("div");
div.id = "no_reports"; 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>";
@ -114,13 +114,13 @@ function AddMore(view, id) {
//Function will add the amount of reports in the input box unless that will take it over 50 //Function will add the amount of reports in the input box unless that will take it over 50
var x = 10; var x = 10;
var a = $('#repop_amount').raw().value; var a = $('#repop_amount').raw().value;
if(a) { if (a) {
if(!isNaN(a) && a <= 50) { if (!isNaN(a) && a <= 50) {
x = a; x = a;
} }
} }
if(document.getElementsByName("reportid").length + x <= 50) { if (document.getElementsByName("reportid").length + x <= 50) {
NewReport(x, view, id); NewReport(x, view, id);
} else { } else {
NewReport(50 - document.getElementsByName("reportid").length, view, id); NewReport(50 - document.getElementsByName("reportid").length, view, id);
@ -129,7 +129,7 @@ function AddMore(view, id) {
function SendPM(reportid) { function SendPM(reportid) {
ajax.post("reportsv2.php?action=ajax_take_pm", "reportform_" + reportid, function (response) { ajax.post("reportsv2.php?action=ajax_take_pm", "reportform_" + reportid, function (response) {
if(response) { if (response) {
$('#uploader_pm' + reportid).raw().value = response; $('#uploader_pm' + reportid).raw().value = response;
} else { } else {
$('#uploader_pm' + reportid).raw().value = ""; $('#uploader_pm' + reportid).raw().value = "";
@ -139,18 +139,18 @@ function SendPM(reportid) {
function UpdateComment(reportid) { function UpdateComment(reportid) {
ajax.post("reportsv2.php?action=ajax_update_comment", "reportform_" + reportid, function (response) { ajax.post("reportsv2.php?action=ajax_update_comment", "reportform_" + reportid, function (response) {
if(response) { if (response) {
alert(response); alert(response);
} }
}); });
} }
function GiveBack(id) { function GiveBack(id) {
if(!id) { if (!id) {
var x = document.getElementsByName("reportid"); var x = document.getElementsByName("reportid");
for(i = 0; i < x.length; i++) { for (i = 0; i < x.length; i++) {
/*ajax.get("ajax.php?action=giveback_report&id=" + x[i].value, function (response) { /*ajax.get("ajax.php?action=giveback_report&id=" + x[i].value, function (response) {
if(response) { if (response) {
alert(response); alert(response);
} }
});*/ });*/
@ -158,7 +158,7 @@ function GiveBack(id) {
} }
} else { } else {
ajax.get("ajax.php?action=giveback_report&id=" + id, function (response) { ajax.get("ajax.php?action=giveback_report&id=" + id, function (response) {
if(response) { if (response) {
alert(response); alert(response);
} }
}); });
@ -189,9 +189,9 @@ function ClearReport(reportid) {
} }
function Grab(reportid) { function Grab(reportid) {
if(reportid) { if (reportid) {
ajax.get("reportsv2.php?action=ajax_grab_report&id=" + reportid, function (response) { ajax.get("reportsv2.php?action=ajax_grab_report&id=" + reportid, function (response) {
if(response == '1') { if (response == '1') {
$('#grab' + reportid).raw().disabled = true; $('#grab' + reportid).raw().disabled = true;
} else { } else {
alert('Grab failed for some reason :/'); alert('Grab failed for some reason :/');
@ -199,9 +199,9 @@ function Grab(reportid) {
}); });
} else { } else {
var x = document.getElementsByName("reportid"); var x = document.getElementsByName("reportid");
for(i = 0; i < x.length; i++) { for (i = 0; i < x.length; i++) {
ajax.get("reportsv2.php?action=ajax_grab_report&id=" + x[i].value, function (response) { ajax.get("reportsv2.php?action=ajax_grab_report&id=" + x[i].value, function (response) {
if(response != '1') { if (response != '1') {
alert("One of those grabs failed, sorry I can't be more useful :P"); alert("One of those grabs failed, sorry I can't be more useful :P");
} }
}); });
@ -241,7 +241,7 @@ function Switch(reportid, torrentid, otherid) {
ajax.post('reportsv2.php?action=ajax_create_report', report, function (response) { ajax.post('reportsv2.php?action=ajax_create_report', report, function (response) {
//Returns new report ID. //Returns new report ID.
if(isNaN(response)) { if (isNaN(response)) {
alert(response); alert(response);
} else { } else {
window.location = 'reportsv2.php?view=report&id=' + response; window.location = 'reportsv2.php?view=report&id=' + response;

View File

@ -1,8 +1,8 @@
function Subscribe(topicid) { function Subscribe(topicid) {
ajax.get("userhistory.php?action=thread_subscribe&topicid=" + topicid + "&auth=" + authkey, function() { ajax.get("userhistory.php?action=thread_subscribe&topicid=" + topicid + "&auth=" + authkey, function() {
var subscribeLink = $("#subscribelink" + topicid).raw(); var subscribeLink = $("#subscribelink" + topicid).raw();
if(subscribeLink) { if (subscribeLink) {
if(subscribeLink.firstChild.nodeValue.charAt(0) == '[') { if (subscribeLink.firstChild.nodeValue.charAt(0) == '[') {
subscribeLink.firstChild.nodeValue = subscribeLink.firstChild.nodeValue.charAt(1) == 'U' subscribeLink.firstChild.nodeValue = subscribeLink.firstChild.nodeValue.charAt(1) == 'U'
? '[Subscribe]' ? '[Subscribe]'
: '[Unsubscribe]'; : '[Unsubscribe]';
@ -19,10 +19,10 @@ function Subscribe(topicid) {
function Collapse() { function Collapse() {
var collapseLink = $('#collapselink').raw(); var collapseLink = $('#collapselink').raw();
var hide = (collapseLink.innerHTML.substr(0,1) == 'H' ? 1 : 0); var hide = (collapseLink.innerHTML.substr(0,1) == 'H' ? 1 : 0);
if($('.row').results() > 0) { if ($('.row').results() > 0) {
$('.row').toggle(); $('.row').toggle();
} }
if(hide) { if (hide) {
collapseLink.innerHTML = 'Show post bodies'; collapseLink.innerHTML = 'Show post bodies';
} else { } else {
collapseLink.innerHTML = 'Hide post bodies'; collapseLink.innerHTML = 'Hide post bodies';

View File

@ -34,7 +34,7 @@ function ArtistManager() {
var elArtistList = ArtistList.cloneNode(true); var elArtistList = ArtistList.cloneNode(true);
elArtistList.id = 'artistmanager_list'; elArtistList.id = 'artistmanager_list';
for(var i=0; i<elArtistList.children.length; i++) { for (var i = 0; i < elArtistList.children.length; i++) {
switch (elArtistList.children[i].className) { switch (elArtistList.children[i].className) {
case 'artist_main': case 'artist_main':
importance = 1; importance = 1;
@ -170,9 +170,9 @@ function SelectArtist(e,obj) {
} }
Dir = (EndBox > StartBox ? 1 : -1); Dir = (EndBox > StartBox ? 1 : -1);
var checked = obj.checked; var checked = obj.checked;
for(var i = StartBox; i != EndBox; i += Dir) { for (var i = StartBox; i != EndBox; i += Dir) {
var key, importance = obj.value.substr(0,1), id = obj.value.substr(2); var key, importance = obj.value.substr(0,1), id = obj.value.substr(2);
$('#artistmanager_box'+i).raw().checked = checked; $('#artistmanager_box' + i).raw().checked = checked;
} }
StartBox = Number(obj.id.substr(17)); StartBox = Number(obj.id.substr(17));
} }
@ -180,7 +180,7 @@ function SelectArtist(e,obj) {
function ArtistManagerSubmit() { function ArtistManagerSubmit() {
var Selection = new Array(); var Selection = new Array();
var MainSelectionCount = 0; var MainSelectionCount = 0;
for(var i = 0, boxes = $('[name="artistmanager_box"]'); boxes.raw(i); i++) { for (var i = 0, boxes = $('[name="artistmanager_box"]'); boxes.raw(i); i++) {
if (boxes.raw(i).checked) { if (boxes.raw(i).checked) {
Selection.push(boxes.raw(i).value); Selection.push(boxes.raw(i).value);
if (boxes.raw(i).value.substr(0,1) == '1') { if (boxes.raw(i).value.substr(0,1) == '1') {

View File

@ -7,7 +7,7 @@ function Categories() {
} }
function Remaster() { function Remaster() {
if($('#remaster').raw().checked) { if ($('#remaster').raw().checked) {
$('#remaster_true').show(); $('#remaster_true').show();
} else { } else {
$('#remaster_true').hide(); $('#remaster_true').hide();
@ -16,9 +16,9 @@ function Remaster() {
} }
function Format() { function Format() {
if($('#format').raw().options[$('#format').raw().selectedIndex].value == 'FLAC') { if ($('#format').raw().options[$('#format').raw().selectedIndex].value == 'FLAC') {
for (var i = 0; i<$('#bitrate').raw().options.length; i++) { for (var i = 0; i<$('#bitrate').raw().options.length; i++) {
if($('#bitrate').raw().options[i].value == 'Lossless') { if ($('#bitrate').raw().options[i].value == 'Lossless') {
$('#bitrate').raw()[i].selected = true; $('#bitrate').raw()[i].selected = true;
} }
} }
@ -29,7 +29,7 @@ function Format() {
$('#upload_logs').hide(); $('#upload_logs').hide();
} }
if($('#format').raw().options[$('#format').raw().selectedIndex].value == 'AAC') { if ($('#format').raw().options[$('#format').raw().selectedIndex].value == 'AAC') {
$('#format_warning').raw().innerHTML = 'Lossy AAC torrents may only be uploaded when they represent exclusive content not currently available in any other format. <a href="rules.php?p=upload#r2.1.24">(2.1.24)</a>'; $('#format_warning').raw().innerHTML = 'Lossy AAC torrents may only be uploaded when they represent exclusive content not currently available in any other format. <a href="rules.php?p=upload#r2.1.24">(2.1.24)</a>';
} else { } else {
$('#format_warning').raw().innerHTML = ''; $('#format_warning').raw().innerHTML = '';
@ -38,7 +38,7 @@ function Format() {
function Bitrate() { function Bitrate() {
$('#other_bitrate').raw().value = ''; $('#other_bitrate').raw().value = '';
if($('#bitrate').raw().options[$('#bitrate').raw().selectedIndex].value == 'Other') { if ($('#bitrate').raw().options[$('#bitrate').raw().selectedIndex].value == 'Other') {
$('#other_bitrate_span').show(); $('#other_bitrate_span').show();
} else { } else {
$('#other_bitrate_span').hide(); $('#other_bitrate_span').hide();
@ -46,7 +46,7 @@ function Bitrate() {
} }
function AltBitrate() { function AltBitrate() {
if($('#other_bitrate').raw().value >= 320) { if ($('#other_bitrate').raw().value >= 320) {
$('#vbr').raw().disabled = true; $('#vbr').raw().disabled = true;
$('#vbr').raw().checked = false; $('#vbr').raw().checked = false;
} else { } else {
@ -55,9 +55,9 @@ function AltBitrate() {
} }
function add_tag() { function add_tag() {
if($('#tags').raw().value == "") { if ($('#tags').raw().value == "") {
$('#tags').raw().value = $('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value; $('#tags').raw().value = $('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value;
} else if($('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value == '---') { } else if ($('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value == '---') {
} else { } else {
$('#tags').raw().value = $('#tags').raw().value + ', ' + $('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value; $('#tags').raw().value = $('#tags').raw().value + ', ' + $('#genre_tags').raw().options[$('#genre_tags').raw().selectedIndex].value;
} }
@ -66,7 +66,7 @@ function add_tag() {
var LogCount = 1; var LogCount = 1;
function AddLogField() { function AddLogField() {
if(LogCount >= 200) { if (LogCount >= 200) {
return; return;
} }
var LogField = document.createElement("input"); var LogField = document.createElement("input");
@ -81,7 +81,7 @@ function AddLogField() {
} }
function RemoveLogField() { function RemoveLogField() {
if(LogCount == 1) { if (LogCount == 1) {
return; return;
} }
var x = $('#logfields').raw(); var x = $('#logfields').raw();
@ -94,7 +94,7 @@ function RemoveLogField() {
var ExtraLogCount = 1; var ExtraLogCount = 1;
function AddExtraLogField(id) { function AddExtraLogField(id) {
if(LogCount >= 200) { if (LogCount >= 200) {
return; return;
} }
var LogField = document.createElement("input"); var LogField = document.createElement("input");
@ -109,7 +109,7 @@ function AddExtraLogField(id) {
} }
function RemoveLogField() { function RemoveLogField() {
if(LogCount == 1) { if (LogCount == 1) {
return; return;
} }
var x = $('#logfields').raw(); var x = $('#logfields').raw();
@ -122,7 +122,7 @@ function RemoveLogField() {
var FormatCount = 0; var FormatCount = 0;
function AddFormat() { function AddFormat() {
if(FormatCount >= 10) { if (FormatCount >= 10) {
return; return;
} }
FormatCount++; FormatCount++;
@ -157,14 +157,14 @@ function AddFormat() {
NewCell2 = document.createElement("td"); NewCell2 = document.createElement("td");
tmp = '<select id="releasetype" name="extra_formats[]"><option value="">---</option>'; tmp = '<select id="releasetype" name="extra_formats[]"><option value="">---</option>';
var formats=["Saab","Volvo","BMW"]; var formats=["Saab","Volvo","BMW"];
for(var i in formats) { for (var i in formats) {
tmp += "<option value='"+formats[i]+"'>"+formats[i]+"</option>\n"; tmp += '<option value="'+formats[i]+'">'+formats[i]+"</option>\n";
} }
tmp += "</select>"; tmp += "</select>";
var bitrates=["1","2","3"]; var bitrates=["1","2","3"];
tmp += '<select id="releasetype" name="extra_bitrates[]"><option value="">---</option>'; tmp += '<select id="releasetype" name="extra_bitrates[]"><option value="">---</option>';
for(var i in bitrates) { for (var i in bitrates) {
tmp += "<option value='"+bitrates[i]+"'>"+bitrates[i]+"</option>\n"; tmp += '<option value="'+bitrates[i]+'">'+bitrates[i]+"</option>\n";
} }
tmp += "</select>"; tmp += "</select>";
@ -188,7 +188,7 @@ function AddFormat() {
} }
function RemoveFormat() { function RemoveFormat() {
if(FormatCount == 0) { if (FormatCount == 0) {
return; return;
} }
$('#extras').raw().value = FormatCount; $('#extras').raw().value = FormatCount;
@ -209,7 +209,7 @@ function RemoveFormat() {
var ArtistCount = 1; var ArtistCount = 1;
function AddArtistField() { function AddArtistField() {
if(ArtistCount >= 200) { if (ArtistCount >= 200) {
return; return;
} }
var ArtistField = document.createElement("input"); var ArtistField = document.createElement("input");
@ -238,7 +238,7 @@ function AddArtistField() {
} }
function RemoveArtistField() { function RemoveArtistField() {
if(ArtistCount == 1) { if (ArtistCount == 1) {
return; return;
} }
var x = $('#artistfields').raw(); var x = $('#artistfields').raw();
@ -259,15 +259,15 @@ function CheckVA () {
function CheckYear() { function CheckYear() {
var media = $('#media').raw().options[$('#media').raw().selectedIndex].text; var media = $('#media').raw().options[$('#media').raw().selectedIndex].text;
if(media == "---" || media == "Vinyl" || media == "Soundboard" || media == "Cassette") { if (media == "---" || media == "Vinyl" || media == "Soundboard" || media == "Cassette") {
media = "old"; media = "old";
} }
var x = $('#year').raw(); var x = $('#year').raw();
if(x.value < 1982 && x.value != '' && media != "old" && !$('#unknown').raw().checked) { if (x.value < 1982 && x.value != '' && media != "old" && !$('#unknown').raw().checked) {
$('#yearwarning').show(); $('#yearwarning').show();
$('#remaster').raw().checked = true; $('#remaster').raw().checked = true;
$('#remaster_true').show(); $('#remaster_true').show();
} else if($('#unknown').raw().checked) { } else if ($('#unknown').raw().checked) {
$('#remaster').raw().checked = true; $('#remaster').raw().checked = true;
$('#yearwarning').hide(); $('#yearwarning').hide();
$('#remaster_true').show(); $('#remaster_true').show();
@ -277,13 +277,13 @@ function CheckYear() {
} }
function ToggleUnknown() { function ToggleUnknown() {
if($('#unknown').raw().checked) { if ($('#unknown').raw().checked) {
$('#remaster_year').raw().value = ""; $('#remaster_year').raw().value = "";
$('#remaster_title').raw().value = ""; $('#remaster_title').raw().value = "";
$('#remaster_record_label').raw().value = ""; $('#remaster_record_label').raw().value = "";
$('#remaster_catalogue_number').raw().value = ""; $('#remaster_catalogue_number').raw().value = "";
if($('#groupremasters').raw()) { if ($('#groupremasters').raw()) {
$('#groupremasters').raw().selectedIndex = 0; $('#groupremasters').raw().selectedIndex = 0;
$('#groupremasters').raw().disabled = true; $('#groupremasters').raw().disabled = true;
} }
@ -298,7 +298,7 @@ function ToggleUnknown() {
$('#remaster_record_label').raw().disabled = false; $('#remaster_record_label').raw().disabled = false;
$('#remaster_catalogue_number').raw().disabled = false; $('#remaster_catalogue_number').raw().disabled = false;
if($('#groupremasters').raw()) { if ($('#groupremasters').raw()) {
$('#groupremasters').raw().disabled = false; $('#groupremasters').raw().disabled = false;
} }
} }
@ -307,7 +307,7 @@ function ToggleUnknown() {
function GroupRemaster() { function GroupRemaster() {
var remasters = json.decode($('#json_remasters').raw().value); var remasters = json.decode($('#json_remasters').raw().value);
var index = $('#groupremasters').raw().options[$('#groupremasters').raw().selectedIndex].value; var index = $('#groupremasters').raw().options[$('#groupremasters').raw().selectedIndex].value;
if(index != "") { if (index != "") {
$('#remaster_year').raw().value = remasters[index][1]; $('#remaster_year').raw().value = remasters[index][1];
$('#remaster_title').raw().value = remasters[index][2]; $('#remaster_title').raw().value = remasters[index][2];
$('#remaster_record_label').raw().value = remasters[index][3]; $('#remaster_record_label').raw().value = remasters[index][3];

View File

@ -4,7 +4,7 @@ function ChangeTo(to) {
$('#admincomment').show(); $('#admincomment').show();
resize('admincomment'); resize('admincomment');
var buttons = document.getElementsByName('admincommentbutton'); var buttons = document.getElementsByName('admincommentbutton');
for(var i = 0; i < buttons.length; i++) { for (var i = 0; i < buttons.length; i++) {
buttons[i].setAttribute('onclick',"ChangeTo('links'); return false;"); buttons[i].setAttribute('onclick',"ChangeTo('links'); return false;");
} }
} else if (to == "links") { } else if (to == "links") {
@ -13,7 +13,7 @@ function ChangeTo(to) {
$('#admincomment').hide(); $('#admincomment').hide();
$('#admincommentlinks').show(); $('#admincommentlinks').show();
var buttons = document.getElementsByName('admincommentbutton'); var buttons = document.getElementsByName('admincommentbutton');
for(var i = 0; i < buttons.length; i++) { for (var i = 0; i < buttons.length; i++) {
buttons[i].setAttribute('onclick',"ChangeTo('text'); return false;"); buttons[i].setAttribute('onclick',"ChangeTo('text'); return false;");
} }
}) })

View File

@ -9,7 +9,7 @@ var tags = new Object();
function isValidTag(value) { function isValidTag(value) {
var toReturn = false; var toReturn = false;
if(tags[value] == true) { if (tags[value] == true) {
toReturn = true; toReturn = true;
} }
return toReturn; return toReturn;

View File

@ -1,5 +1,5 @@
var elemStyles=Array(); var elemStyles = Array();
var errorElems=Array(); var errorElems = Array();
function validEmail(str) { function validEmail(str) {
if (str.match(/^[_a-z0-9-]+([.+][_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i)) { if (str.match(/^[_a-z0-9-]+([.+][_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i)) {
@ -12,60 +12,80 @@ function validEmail(str) {
function validLink(str) { function validLink(str) {
if (str.match(/^(https?):\/\/([a-z0-9\-\_]+\.)+([a-z]{1,5}[^\.])(\/[^<>]+)*$/i)) { if (str.match(/^(https?):\/\/([a-z0-9\-\_]+\.)+([a-z]{1,5}[^\.])(\/[^<>]+)*$/i)) {
return true; return true;
} else { return false; } } else {
return false;
}
} }
function isNumeric(str,usePeriod) { function isNumeric(str,usePeriod) {
matchStr='/[^0-9'; matchStr = '/[^0-9';
if (usePeriod) { if (usePeriod) {
matchStr+='\.'; matchStr += '\.';
} }
matchStr=']/'; matchStr = ']/';
if (str.match(matchStr)) { return false; } if (str.match(matchStr)) {
return false;
}
return true; return true;
} }
function validDate(theDate) { function validDate(theDate) {
days=0; days = 0;
theDate=theDate.split("/"); theDate = theDate.split("/");
month=theDate[0]; month = theDate[0];
day=theDate[1]; day = theDate[1];
year=theDate[2]; year = theDate[2];
if (!isNumeric(month) || !isNumeric(day) || !isNumeric(year)) { return false; } if (!isNumeric(month) || !isNumeric(day) || !isNumeric(year)) { return false; }
if (month==1) { days=31; } if (month == 1) { days = 31; }
else if (month==2) { if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { days=29; } else { days=28; }} else if (month == 2) {
else if (month==3) { days=31; } if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
else if (month==4) { days=30; } days = 29;
else if (month==5) { days=31; } } else {
else if (month==6) { days=30; } days = 28;
else if (month==7) { days=31; } }}
else if (month==8) { days=31; } else if (month == 3) { days = 31; }
else if (month==9) { days=30; } else if (month == 4) { days = 30; }
else if (month==10) { days=31; } else if (month == 5) { days = 31; }
else if (month==11) { days=30; } else if (month == 6) { days = 30; }
else if (month==12) { days=31; } else if (month == 7) { days = 31; }
else if (month == 8) { days = 31; }
else if (month == 9) { days = 30; }
else if (month == 10) { days = 31; }
else if (month == 11) { days = 30; }
else if (month == 12) { days = 31; }
if (day>days || day==undefined || days==undefined || month==undefined || year==undefined || year.length<4) { return false; } else { return true; } if (day > days || day == undefined || days == undefined || month == undefined || year == undefined || year.length < 4) {
return false;
} else {
return true;
}
} }
function showError(fields,alertStr) { function showError(fields,alertStr) {
var tField=Array(); var tField=Array();
if (typeof(fields)=='object') { tField[0]=fields; } else { tField=fields.split(','); } if (typeof(fields) == 'object') {
for(s=0; s<=tField.length-1; s++) { tField[0] = fields;
} else {
tField = fields.split(',');
}
for (s = 0; s <= tField.length - 1; s++) {
if ($('#'+tField[s])) { if ($('#'+tField[s])) {
$('#'+tField[s]).className=$('#'+tField[s]).className+" elem_error"; $('#'+tField[s]).className=$('#'+tField[s]).className+" elem_error";
if (s==0) { if (s == 0) {
$('#'+tField[s]).focus(); $('#'+tField[s]).focus();
try { $('#'+tField[s]).select(); } catch (error) { } try {
$('#'+tField[s]).select();
} catch (error) {
}
} }
errorElems[errorElems.length]=tField[s]; errorElems[errorElems.length] = tField[s];
if ($('#'+tField[s]).type!="select-one") { if ($('#'+tField[s]).type != "select-one") {
$('#'+tField[s]).onkeypress=function() { clearElemError(); }; $('#'+tField[s]).onkeypress=function() { clearElemError(); };
} else { } else {
$('#'+tField[s]).onchange=function() { clearElemError(); }; $('#'+tField[s]).onchange=function() { clearElemError(); };
@ -73,34 +93,36 @@ function showError(fields,alertStr) {
} }
} }
if (alertStr!="") { alert(alertStr); } if (alertStr != "") {
alert(alertStr);
}
return false; return false;
} }
function clearErrors(theForm) { function clearErrors(theForm) {
elementList=document.forms[theForm].elements; elementList = document.forms[theForm].elements;
for(x=0; x<=elementList.length-1; x++) { for (x = 0; x <= elementList.length - 1; x++) {
if (elementList[x].type!="submit" && elementList[x].type!="button") { if (elementList[x].type != "submit" && elementList[x].type != "button") {
if (!elemStyles[elementList[x].id]) { if (!elemStyles[elementList[x].id]) {
elemStyles[elementList[x].id]=elementList[x].className; elemStyles[elementList[x].id] = elementList[x].className;
} }
try { try {
elementList[x].className=elemStyles[elementList[x].id]; elementList[x].className = elemStyles[elementList[x].id];
} catch (error) { } } catch (error) { }
} }
} }
} }
function clearElemError(evt) { function clearElemError(evt) {
for(x=0; x<=errorElems.length-1; x++) { for (x = 0; x <= errorElems.length - 1; x++) {
elem=$('#'+errorElems[x]); elem = $('#'+errorElems[x]);
if ($('#'+elem).type!="select-one") { if ($('#'+elem).type != "select-one") {
$('#'+elem).onkeypress=""; $('#'+elem).onkeypress = "";
} else { } else {
$('#'+elem).onchange=""; $('#'+elem).onchange = "";
} }
elem.className=elemStyles[elem.id]; elem.className = elemStyles[elem.id];
} }
errorElems=Array(); errorElems = Array();
} }

View File

@ -2,9 +2,9 @@
$(document).ready(function () { $(document).ready(function () {
// Upload button is clicked // Upload button is clicked
$("#post").click(function(e) { $("#post").click(function(e) {
// Make sure "Music" category is selected. // Make sure "Music" category is selected.
if($("#categories").find(":selected").val() == 0) { if ($("#categories").find(":selected").val() == 0) {
checkHasMainArtist(e); checkHasMainArtist(e);
} }
}); });
@ -14,16 +14,15 @@
function checkHasMainArtist(e) { function checkHasMainArtist(e) {
var has_main = false; var has_main = false;
$("select[id^=importance]").each(function() { $("select[id^=importance]").each(function() {
if($(this).find(":selected").val() == 1) { if ($(this).find(":selected").val() == 1) {
has_main = true; has_main = true;
} }
}); });
if(!has_main) { if (!has_main) {
alert('A "Main" artist is required'); alert('A "Main" artist is required');
// Don't POST the form. // Don't POST the form.
e.preventDefault(); e.preventDefault();
} }
} }
}); });
})(jQuery); })(jQuery);