diff options
88 files changed, 810 insertions, 796 deletions
diff --git a/classes/ajax_start.php b/classes/ajax_start.php index a835b6e..5a7c391 100644 --- a/classes/ajax_start.php +++ b/classes/ajax_start.php @@ -70,7 +70,7 @@ function make_utf8($Str) { $Encoding = 'UTF-8'; } 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)) { $Encoding = 'ISO-8859-1'; @@ -78,7 +78,7 @@ function make_utf8($Str) { if ($Encoding == 'UTF-8') { return $Str; } 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) { $Secret = ''; - $Chars='abcdefghijklmnopqrstuvwxyz0123456789'; - for($i=0; $i<$Length; $i++) { - $Rand = mt_rand(0, strlen($Chars)-1); + $Chars = 'abcdefghijklmnopqrstuvwxyz0123456789'; + for ($i = 0; $i < $Length; $i++) { + $Rand = mt_rand(0, strlen($Chars) - 1); $Secret .= substr($Chars, $Rand, 1); } return str_shuffle($Secret); diff --git a/classes/class_cache.php b/classes/class_cache.php index 04fd1c7..a3d5345 100644 --- a/classes/class_cache.php +++ b/classes/class_cache.php @@ -97,7 +97,7 @@ class CACHE extends Memcache } public function get_value($Key, $NoCache=false) { - if(!$this->InternalCache) { + if (!$this->InternalCache) { $NoCache = true; } $StartTime=microtime(true); diff --git a/classes/class_debug.php b/classes/class_debug.php index 93d41a0..d0c9645 100644 --- a/classes/class_debug.php +++ b/classes/class_debug.php @@ -456,7 +456,7 @@ class DEBUG { public function cache_table($CacheKeys=false) { global $Cache; - $Header = 'Cache Keys'; + $Header = 'Cache keys'; if (!is_array($CacheKeys)) { $CacheKeys = $this->get_cache_keys(); $Header .= ' ('.number_format($this->get_cache_time(), 5).' ms)'; diff --git a/classes/class_forums.php b/classes/class_forums.php index 506e1fc..3530a79 100644 --- a/classes/class_forums.php +++ b/classes/class_forums.php @@ -63,4 +63,4 @@ class Forums { } } -}
\ No newline at end of file +} diff --git a/classes/class_image_tools.php b/classes/class_image_tools.php index b36671d..c3f84f4 100644 --- a/classes/class_image_tools.php +++ b/classes/class_image_tools.php @@ -9,13 +9,13 @@ class ImageTools { * Store processed links to avoid repetition * @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 * @var array $Hosts Array of image hosts */ - static private $Hosts = array( + private static $Hosts = array( 'whatimg.com' => true, 'imgur.com' => true ); @@ -24,7 +24,7 @@ class ImageTools { * Blacklisted sites * @var array $Blacklist Array of blacklisted hosts */ - static private $Blacklist = array( + private static $Blacklist = array( 'tinypic.com' ); @@ -32,7 +32,7 @@ class ImageTools { * Array of image hosts that provide thumbnailing * @var array $Thumbs */ - static private $Thumbs = array( + private static $Thumbs = array( 'i.imgur.com' => true, 'whatimg.com' => true ); @@ -41,7 +41,7 @@ class ImageTools { * Array of extensions * @var array $Extensions */ - static private $Extensions = array( + private static $Extensions = array( 'jpg' => true, 'jpeg' => true, 'png' => true, @@ -78,7 +78,7 @@ class ImageTools { * @param string $Url Link to an image * @return string|false Matched host or false */ - public static function thumbnailable($Url) { + private static function thumbnailable($Url) { $ParsedUrl = parse_url($Url); return !empty(self::$Thumbs[$ParsedUrl['host']]); } @@ -88,7 +88,7 @@ class ImageTools { * @param string $Ext Extension to check * @return boolean */ - public static function valid_extension($Ext) { + private static function valid_extension($Ext) { // return @self::$Extensions[$Ext] === true; return !empty(self::$Extensions[$Ext]) && self::$Extensions[$Ext] === true; } @@ -98,7 +98,7 @@ class ImageTools { * @param type $Link * @param type $Processed */ - public static function store($Link, $Processed) { + private static function store($Link, $Processed) { self::$Storage[$Link] = $Processed; } @@ -107,7 +107,7 @@ class ImageTools { * @param type $Link * @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])) { return self::$Storage[$Link]; } @@ -115,79 +115,34 @@ class ImageTools { } /** - * Turns link into thumbnail (if possible) or default group image (if missing) - * 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 + * Checks if URL points to a whatimg thumbnail. */ - public static function wiki_image($Link, $GroupID = 0, $Thumb = true) { - global $CategoryIcons; - - 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]; + private static function has_whatimg_thumb($Url) { + return (strpos($Url, '_thumb') !== false); } /** - * The main function called to get a thumbnail link. - * 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) { - if (($Found = self::get_stored($Link))) { - return $Found; - } - return self::process_thumbnail($Link); + * Cleans up imgur URL if it already has a modifier attached to the end of it. + */ + private static 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); + } + } + return $Base . '/' . $Path . '.' . $Extension; } /** - * Matches a hosts that thumbnails and stores link - * @param string $Link Image link - * @return string Thumbnail link or Image link + * Replaces the extension. */ - static private function process_thumbnail($Link) { - $Thumb = $Link; - $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?>)" /> -<? + private static function replace_extension($String, $Extension) { + return preg_replace('/\.[^.]*$/', $Extension, $String); } /** @@ -197,48 +152,70 @@ class ImageTools { */ public static function proxy_url($Url) { global $SSL; - return ($SSL ? 'https' : 'http') . '://' . SITE_URL - . '/image.php?i=' . urlencode($Url); + return ($SSL ? 'https' : 'http') . '://' . SITE_URL . '/image.php?c=1&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) { + global $LoggedUser; + if (empty($Url)) { + return ''; + } + if (($Found = self::get_stored($Url . ($Thumb ? '_thumb' : '')))) { + return $Found; + } -/** - * Replaces the extension. - */ -function replace_extension($String, $Extension) { - return preg_replace('/\.[^.]*$/', $Extension, $String); -} + $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); + } + } + } -function contains($Substring, $String) { - return strpos($String, $Substring) !== false; -} + 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); + } -/** - * Checks if URL points to a whatimg thumbnail. - */ -function has_whatimg_thumb($Url) { - return contains("_thumb", $Url); -} + self::store($Url . ($Thumb ? '_thumb' : ''), $ProcessedUrl); + } + return $ProcessedUrl; + } -/** - * 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); + /** + * 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; } diff --git a/classes/class_paranoia.php b/classes/class_paranoia.php index b68b0bb..fdfa1ea 100644 --- a/classes/class_paranoia.php +++ b/classes/class_paranoia.php @@ -50,51 +50,54 @@ function check_paranoia($Property, $Paranoia, $UserClass, $UserID = false) { if ($Property == false) { return false; } - if(!is_array($Paranoia)) { + if (!is_array($Paranoia)) { $Paranoia = unserialize($Paranoia); } - if(!is_array($Paranoia)) { + if (!is_array($Paranoia)) { $Paranoia = array(); } - if(is_array($Property)) { + if (is_array($Property)) { $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; } else { - if(($UserID !== false) && ($LoggedUser['ID'] == $UserID)) { + if (($UserID !== false) && ($LoggedUser['ID'] == $UserID)) { return PARANOIA_ALLOWED; } $May = !in_array($Property, $Paranoia) && !in_array($Property . '+', $Paranoia); - if($May) + if ($May) return PARANOIA_ALLOWED; - if(check_perms('users_override_paranoia', $UserClass)) + if (check_perms('users_override_paranoia', $UserClass)) { return PARANOIA_OVERRIDDEN; + } $Override=false; switch ($Property) { case 'downloaded': case 'ratio': case 'uploaded': case 'lastseen': - if(check_perms('users_mod', $UserClass)) + if (check_perms('users_mod', $UserClass)) return PARANOIA_OVERRIDDEN; break; case 'snatched': case 'snatched+': - if(check_perms('users_view_torrents_snatchlist', $UserClass)) + if (check_perms('users_view_torrents_snatchlist', $UserClass)) return PARANOIA_OVERRIDDEN; break; case 'uploads': case 'uploads+': case 'seeding': case 'seeding+': case 'leeching': case 'leeching+': - if(check_perms('users_view_seedleech', $UserClass)) + if (check_perms('users_view_seedleech', $UserClass)) return PARANOIA_OVERRIDDEN; break; case 'invitedcount': - if(check_perms('users_view_invites', $UserClass)) + if (check_perms('users_view_invites', $UserClass)) return PARANOIA_OVERRIDDEN; break; } return false; } -}
\ No newline at end of file +} diff --git a/classes/class_search.php b/classes/class_search.php index 1c9f133..a39d150 100644 --- a/classes/class_search.php +++ b/classes/class_search.php @@ -1,6 +1,6 @@ <? //Require base class -if(!extension_loaded('sphinx')) { +if (!extension_loaded('sphinx')) { require(SERVER_ROOT.'/classes/sphinxapi.php'); } @@ -51,17 +51,17 @@ class SPHINX_SEARCH extends SphinxClient { $QueryEndTime=microtime(true); $Filters = array(); - foreach($this->Filters as $Name => $Values) { - foreach($Values as $Value) { + foreach ($this->Filters as $Name => $Values) { + foreach ($Values as $Value) { $Filters[] = $Name." - ".$Value; } } - $this->Queries[]=array('Params: '.$Query.' Filters: '.implode(", ", $Filters).' Indicies: '.$this->Index,($QueryEndTime-$QueryStartTime)*1000); - $this->Time+=($QueryEndTime-$QueryStartTime)*1000; + $this->Queries[] = array('Params: '.$Query.' Filters: '.implode(", ", $Filters).' Indicies: '.$this->Index,($QueryEndTime-$QueryStartTime) * 1000); + $this->Time += ($QueryEndTime-$QueryStartTime) * 1000; - if($Result === false) { - if($this->_connerror && !$Cache->get_value('sphinx_crash_reported')) { + if ($Result === false) { + if ($this->_connerror && !$Cache->get_value('sphinx_crash_reported')) { send_irc('PRIVMSG '.ADMIN_CHAN.' :!dev Connection to searchd failed'); $Cache->cache_value('sphinx_crash_reported', 1, 3600); } @@ -71,7 +71,7 @@ class SPHINX_SEARCH extends SphinxClient { $this->TotalResults = $Result['total_found']; $this->SearchTime = $Result['time']; - if(empty($Result['matches'])) { + if (empty($Result['matches'])) { return false; } $Matches = $Result['matches']; @@ -82,49 +82,49 @@ class SPHINX_SEARCH extends SphinxClient { $NotFound = array(); $Skip = array(); - if(!empty($ReturnData)) { + if (!empty($ReturnData)) { $AllFields = false; } else { $AllFields = true; } - foreach($MatchIDs as $Match) { + foreach ($MatchIDs as $Match) { $Matches[$Match] = $Matches[$Match]['attrs']; - if(!empty($CachePrefix)) { + if (!empty($CachePrefix)) { $Data = $Cache->get_value($CachePrefix.'_'.$Match); - if($Data == false) { - $NotFound[]=$Match; + if ($Data == false) { + $NotFound[] = $Match; continue; } } 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 - if(empty($Skip)) { - foreach(array_keys($Data) as $Key) { - if(!in_array($Key, $ReturnData)) { - $Skip[]=$Key; + if (empty($Skip)) { + foreach (array_keys($Data) as $Key) { + if (!in_array($Key, $ReturnData)) { + $Skip[] = $Key; } } - if(empty($Skip)) { + if (empty($Skip)) { $AllFields = true; } } - foreach($Skip as $Key) { + foreach ($Skip as $Key) { unset($Data[$Key]); } reset($Skip); } - if(!empty($Data)) { + if (!empty($Data)) { $Matches[$Match] = array_merge($Matches[$Match], $Data); } } - if($SQL!='') { - if(!empty($NotFound)) { + if ($SQL != '') { + if (!empty($NotFound)) { $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); $Cache->cache_value($CachePrefix.'_'.$Data[$IDColumn], $Data, $CacheLength); } @@ -148,8 +148,8 @@ class SPHINX_SEARCH extends SphinxClient { } function set_filter($Name, $Vals, $Exclude=false) { - foreach($Vals as $Val) { - if($Exclude) { + foreach ($Vals as $Val) { + if ($Exclude) { $this->Filters[$Name][] = "!$Val"; } else { $this->Filters[$Name][] = $Val; diff --git a/classes/class_sphinxql.php b/classes/class_sphinxql.php index 9c411e0..d7d41c6 100644 --- a/classes/class_sphinxql.php +++ b/classes/class_sphinxql.php @@ -38,7 +38,7 @@ class Sphinxql extends mysqli { * @return identification string */ private function get_ident($Server, $Port, $Socket) { - if($Socket) { + if ($Socket) { return $Socket; } else { return "$Server:$Port"; @@ -55,7 +55,7 @@ class Sphinxql extends mysqli { */ public static function init_connection($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); } return self::$Connections[$Ident]; @@ -65,11 +65,11 @@ class Sphinxql extends mysqli { * Connect the Sphinxql object to the Sphinx server */ public function connect() { - if(!$this->Connected) { + if (!$this->Connected) { global $Debug; $Debug->set_flag('Connecting to Sphinx server '.$this->Ident); parent::__construct($this->Server, '', '', '', $this->Port, $this->Socket); - if($this->connect_error) { + if ($this->connect_error) { $Errno = $this->connect_errno; $Error = $this->connect_error; $this->error("Connection failed. ".strval($Errno)." (".strval($Error).")"); @@ -90,10 +90,10 @@ class Sphinxql extends mysqli { global $Debug; $ErrorMsg = 'SphinxQL ('.$this->Ident.'): '.strval($Msg); $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>'; die(); - } elseif($Halt === true) { + } elseif ($Halt === true) { error('-1'); } } diff --git a/classes/class_sphinxqlquery.php b/classes/class_sphinxqlquery.php index e5909ee..03e2668 100644 --- a/classes/class_sphinxqlquery.php +++ b/classes/class_sphinxqlquery.php @@ -56,26 +56,26 @@ class SphinxqlQuery { * @return current Sphinxql query object */ public function where($Attribute, $Values, $Exclude = false) { - if(empty($Attribute) && empty($Values)) { + if (empty($Attribute) && empty($Values)) { return false; } $Filters = array(); - if(is_array($Values)) { - foreach($Values as $Value) { - if(!is_number($Value)) { + if (is_array($Values)) { + foreach ($Values as $Value) { + if (!is_number($Value)) { $this->error("Filters require numeric values"); } } - if($Exclude) { + if ($Exclude) { $Filters[] = "$Attribute NOT IN (".implode(",", $Values).")"; } else { $Filters[] = "$Attribute IN (".implode(",", $Values).")"; } } else { - if(!is_number($Values)) { + if (!is_number($Values)) { $this->error("Filters require numeric values"); } - if($Exclude) { + if ($Exclude) { $Filters[] = "$Attribute != $Values"; } else { $Filters[] = "$Attribute = $Values"; @@ -93,7 +93,7 @@ class SphinxqlQuery { * @return current Sphinxql query object */ 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->Filters[] = "$Attribute BETWEEN $Values[0] AND $Values[1]"; @@ -109,7 +109,7 @@ class SphinxqlQuery { * @return current Sphinxql query object */ public function where_match($Expr, $Field = '*', $Escape = true) { - if(empty($Expr)) { + if (empty($Expr)) { return $this; } if ($Field !== false) { @@ -216,29 +216,29 @@ class SphinxqlQuery { * Combine the query conditions into a valid Sphinx query segment */ private function build_query() { - if(!$this->Indexes) { + if (!$this->Indexes) { $this->error('Index name is required.'); } $this->QueryString = "SELECT $this->Select\nFROM $this->Indexes"; - if(!empty($this->Expressions)) { + if (!empty($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); } - if(!empty($this->GroupBy)) { + if (!empty($this->GroupBy)) { $this->QueryString .= "\nGROUP BY $this->GroupBy"; } - if(!empty($this->SortGroupBy)) { + if (!empty($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); } - if(!empty($this->Limits)) { + if (!empty($this->Limits)) { $this->QueryString .= "\nLIMIT $this->Limits"; } - if(!empty($this->Options)) { + if (!empty($this->Options)) { $Options = $this->build_options(); $this->QueryString .= "\nOPTION $Options"; } @@ -279,12 +279,12 @@ class SphinxqlQuery { * @return Sphinxql result object */ private function send_query($GetMeta) { - if(!$this->QueryString) { + if (!$this->QueryString) { return false; } $this->Sphinxql->connect(); $Result = $this->Sphinxql->query($this->QueryString); - if($Result === false) { + if ($Result === false) { $Errno = $this->Sphinxql->errno; $Error = $this->Sphinxql->error; $this->error("Query returned error $Errno ($Error).\n$this->QueryString"); diff --git a/classes/class_sphinxqlresult.php b/classes/class_sphinxqlresult.php index 11a4295..1c2491c 100644 --- a/classes/class_sphinxqlresult.php +++ b/classes/class_sphinxqlresult.php @@ -39,7 +39,7 @@ class SphinxqlResult { */ public function collect($Key) { $Return = array(); - while($Row = $this->fetch_array()) { + while ($Row = $this->fetch_array()) { $Return[] = $Row[$Key]; } $this->data_seek(0); @@ -55,8 +55,8 @@ class SphinxqlResult { */ public function to_array($Key, $ResultType = MYSQLI_ASSOC) { $Return = array(); - while($Row = $this->fetch_array($ResultType)) { - if($Key !== false) { + while ($Row = $this->fetch_array($ResultType)) { + if ($Key !== false) { $Return[$Row[$Key]] = $Row; } else { $Return[] = $Row; @@ -75,7 +75,7 @@ class SphinxqlResult { */ public function to_pair($Key1, $Key2) { $Return = array(); - while($Row = $this->fetch_array()) { + while ($Row = $this->fetch_array()) { $Return[$Row[$Key1]] = $Row[$Key2]; } $this->data_seek(0); @@ -89,11 +89,11 @@ class SphinxqlResult { * @return array with meta data */ public function get_meta($Keys = false) { - if($Keys !== false) { - if(is_array($Keys)) { + if ($Keys !== false) { + if (is_array($Keys)) { $Return = array(); - foreach($Keys as $Key) { - if(!isset($this->Meta[$Key])) { + foreach ($Keys as $Key) { + if (!isset($this->Meta[$Key])) { continue; } $Return[$Key] = $this->Meta[$Key]; @@ -114,11 +114,11 @@ class SphinxqlResult { * @return array with result information */ public function get_result_info($Keys = false) { - if($Keys !== false) { - if(is_array($Keys)) { + if ($Keys !== false) { + if (is_array($Keys)) { $Return = array(); - foreach($Keys as $Key) { - if(!isset($this->Result->$Key)) { + foreach ($Keys as $Key) { + if (!isset($this->Result->$Key)) { continue; } $Return[$Key] = $this->Result->$Key; diff --git a/classes/class_templates.php b/classes/class_templates.php index 05e8acf..9e69d9d 100644 --- a/classes/class_templates.php +++ b/classes/class_templates.php @@ -6,15 +6,15 @@ // $TPL->get(); class TEMPLATE { - var $file=''; - var $vars=array(); + var $file = ''; + var $vars = array(); function open($file) { - $this->file=file($file); + $this->file = file($file); } function set($name,$var,$ifnone='<span style="font-style: italic;">-None-</span>') { - if ($name!='') { + if ($name != '') { $this->vars[$name][0]=$var; $this->vars[$name][1]=$ifnone; } @@ -22,24 +22,28 @@ class TEMPLATE { function show() { $TMPVAR=''; - for($i=0; $i<sizeof($this->file); $i++) { + for ($i=0; $i<sizeof($this->file); $i++) { $TMPVAR=$this->file[$i]; - foreach($this->vars as $k=>$v) { - if ($v[1]!="" && $v[0]=="") { $v[0]=$v[1]; } - $TMPVAR=str_replace('{{'.$k.'}}',$v[0],$TMPVAR); + foreach ($this->vars as $k=>$v) { + if ($v[1] != '' && $v[0] == '') { + $v[0] = $v[1]; + } + $TMPVAR = str_replace('{{'.$k.'}}',$v[0],$TMPVAR); } print $TMPVAR; } } function get() { - $RESULT=''; - $TMPVAR=''; - for($i=0; $i<sizeof($this->file); $i++) { + $RESULT = ''; + $TMPVAR = ''; + for ($i = 0; $i < sizeof($this->file); $i++) { $TMPVAR=$this->file[$i]; - foreach($this->vars as $k=>$v) { - if ($v[1]!="" && $v[0]=="") { $v[0]=$v[1]; } - $TMPVAR=str_replace('{{'.$k.'}}',$v[0],$TMPVAR); + foreach ($this->vars as $k=>$v) { + if ($v[1] != '' && $v[0] == '') { + $v[0] = $v[1]; + } + $TMPVAR = str_replace('{{'.$k.'}}',$v[0],$TMPVAR); } $RESULT.=$TMPVAR; } @@ -47,33 +51,32 @@ class TEMPLATE { } function str_align($len,$str,$align,$fill) { - $strlen=strlen($str); - if ($strlen>$len) { + $strlen = strlen($str); + if ($strlen > $len) { return substr($str, 0, $len); - } elseif (($strlen==0)||($len==0)) { + } elseif (($strlen == 0) || ($len == 0)) { return ''; } else { - if (($align=='l')||($align=='left')) { - $result=$str.str_repeat($fill,($len-$strlen)); + if (($align == 'l') || ($align == 'left')) { + $result = $str.str_repeat($fill,($len - $strlen)); - } elseif (($align=='r')||($align=='right')) { - $result=str_repeat($fill,($len-$strlen)).$str; + } elseif (($align == 'r') || ($align == 'right')) { + $result = str_repeat($fill,($len - $strlen)).$str; - } elseif (($align=='c')||($align=='center')) { - $snm=intval(($len-$strlen)/2); - if (($strlen+($snm*2))==$len) { - $result=str_repeat($fill,$snm).$str; + } elseif (($align == 'c') || ($align == 'center')) { + $snm = intval(($len - $strlen) / 2); + if (($strlen + ($snm * 2)) == $len) { + $result = str_repeat($fill,$snm).$str; } else { - $result=str_repeat($fill,$snm+1).$str; + $result = str_repeat($fill,$snm + 1).$str; } $result.=str_repeat($fill,$snm); } - return $result; } } diff --git a/classes/class_text.php b/classes/class_text.php index bb497fc..9389a4c 100644 --- a/classes/class_text.php +++ b/classes/class_text.php @@ -736,7 +736,7 @@ class TEXT { } } $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 } $this->NoImg--; @@ -772,10 +772,8 @@ class TEXT { $LocalURL = $this->local_url($Block['Val']); if ($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 { - $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; diff --git a/classes/class_text2.php b/classes/class_text2.php index 89d7d48..b79ed17 100644 --- a/classes/class_text2.php +++ b/classes/class_text2.php @@ -543,11 +543,7 @@ EXPLANATION OF PARSER LOGIC if (!$this->valid_url($Block['Val'], '\.(jpe?g|gif|png|bmp|tiff)')) { $Str.='[img]'.$Block['Val'].'[/img]'; } else { - if (check_perms('site_proxy_images')) { - $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'].'" />'; - } + $Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.ImageTools::process($Block['Val']).'" />'; } break; diff --git a/classes/class_text3.php b/classes/class_text3.php index e0f2e7a..ca8abb3 100644 --- a/classes/class_text3.php +++ b/classes/class_text3.php @@ -286,8 +286,8 @@ EXPLANATION OF PARSER LOGIC $i = $CloseTag; // 5d) Move the pointer past the end of the [/close] tag. } else { //5b) If it's a normal tag, it may have versions of itself nested inside - $CloseTag = $i-1; - $InTagPos = $i-1; + $CloseTag = $i - 1; + $InTagPos = $i - 1; $NumInOpens = 0; $NumInCloses = -1; @@ -318,7 +318,7 @@ EXPLANATION OF PARSER LOGIC $NumInOpens++; } - } while($NumInOpens>$NumInCloses); + } while ($NumInOpens > $NumInCloses); // Find the internal block inside the tag @@ -504,11 +504,7 @@ EXPLANATION OF PARSER LOGIC if (!$this->valid_url($Block['Val'], '\.(jpe?g|gif|png|bmp|tiff)')) { $Str.='[img]'.$Block['Val'].'[/img]'; } else { - if (check_perms('site_proxy_images')) { - $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'].'" />'; - } + $Str.='<img style="max-width: 500px;" onclick="lightbox.init(this,500);" alt="'.$Block['Val'].'" src="'.ImageTools::process($Block['Val']).'" />'; } break; diff --git a/classes/class_textarea_preview.php b/classes/class_textarea_preview.php index 536996a..b7c0f54 100644 --- a/classes/class_textarea_preview.php +++ b/classes/class_textarea_preview.php @@ -3,8 +3,7 @@ * 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. */ -class TEXTAREA_PREVIEW_SUPER -{ +class TEXTAREA_PREVIEW_SUPER { /** * @static * @var int $Textareas Total number of textareas created @@ -37,11 +36,13 @@ class TEXTAREA_PREVIEW_SUPER * @example <pre><?php TEXT_PREVIEW::JavaScript(); ?></pre> * @return void */ - static public function JavaScript ($all = true) - { - if (self::$Textareas === 0) return; - if (self::$Exectuted === false && $all) + static public function JavaScript ($all = true) { + if (self::$Textareas === 0) { + return; + } + if (self::$Exectuted === false && $all) { View::parse('generic/textarea/script.phtml'); + } self::$Exectuted = true; self::iterator(); @@ -55,10 +56,9 @@ class TEXTAREA_PREVIEW_SUPER * @static * @return void */ - static private function iterator () - { + static private function iterator () { $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])) { $a = sprintf('%d, "%s"', $i, self::$_ID[$i]); } else { @@ -66,9 +66,9 @@ class TEXTAREA_PREVIEW_SUPER } $script[] = sprintf('[%s]', $a); } - if (!empty($script)) - View::parse('generic/textarea/script_factory.phtml', - array('script' => join(', ', $script))); + if (!empty($script)) { + View::parse('generic/textarea/script_factory.phtml', array('script' => join(', ', $script))); + } } } @@ -111,8 +111,7 @@ class TEXTAREA_PREVIEW_SUPER * </div> * </pre> */ -class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER -{ +class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER { /** * @var int Unique ID */ @@ -157,14 +156,19 @@ class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER parent::$Textareas += 1; 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); - else + } else { $Attributes = ''; + } - if ($Preview === true) $this->preview(); + if ($Preview === true) { + $this->preview(); + } $this->buffer = View::parse('generic/textarea/textarea.phtml', array( 'ID' => $ID, @@ -176,17 +180,19 @@ class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER 'Attributes' => &$Attributes ), $Buffer); - if ($Buttons === true) $this->buttons(); + if ($Buttons === true) { + $this->buttons(); + } } /** * Outputs the divs required for previewing the AJAX content * Will only output once */ - public function preview () - { - if (!$this->preview) + public function preview () { + if (!$this->preview) { View::parse('generic/textarea/preview.phtml', array('ID' => $this->id)); + } $this->preview = true; } @@ -194,16 +200,14 @@ class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER * Outputs the preview and edit buttons * 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)); } /** * Returns the textarea's numeric ID. */ - public function getID () - { + public function getID () { return $this->id; } @@ -211,8 +215,7 @@ class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER * Returns textarea string when buffer is enabled in the constructor * @return string */ - public function getBuffer () - { + public function getBuffer () { return $this->buffer; } } diff --git a/classes/class_time.php b/classes/class_time.php index b8d8a77..510a99e 100644 --- a/classes/class_time.php +++ b/classes/class_time.php @@ -121,7 +121,7 @@ function time_diff($TimeStamp, $Levels=2, $Span=true, $Lowercase=false) { if ($Return != '') { $Return.=' and '; } - if ($Minutes>1) { + if ($Minutes > 1) { $Return.=$Minutes.' mins'; } else { $Return.=$Minutes.' min'; diff --git a/classes/class_tools.php b/classes/class_tools.php index 4ffa240..fc60a95 100644 --- a/classes/class_tools.php +++ b/classes/class_tools.php @@ -172,7 +172,7 @@ class Tools { $Cache->delete_value('user_stats_'.$UserID); $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('users_sessions_'.$UserID); diff --git a/classes/class_torrents.php b/classes/class_torrents.php index 6a36177..0ac2ddf 100644 --- a/classes/class_torrents.php +++ b/classes/class_torrents.php @@ -81,7 +81,7 @@ class Torrents { 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)"); - while($Group = $DB->next_record(MYSQLI_ASSOC, true)) { + while ($Group = $DB->next_record(MYSQLI_ASSOC, true)) { unset($NotFound[$Group['ID']]); $Found[$Group['ID']] = $Group; $Found[$Group['ID']]['Torrents'] = array(); @@ -104,7 +104,7 @@ class Torrents { WHERE GroupID IN($IDs) ORDER BY GroupID, Remastered, (RemasterYear <> 0) DESC, RemasterYear, RemasterTitle, 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; } @@ -262,7 +262,7 @@ class Torrents { // Torrent notifications $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); } $DB->query("DELETE FROM users_notify_torrents WHERE TorrentID='$ID'"); diff --git a/classes/class_tracker.php b/classes/class_tracker.php index ef6251f..5de49a5 100644 --- a/classes/class_tracker.php +++ b/classes/class_tracker.php @@ -23,7 +23,7 @@ class Tracker { } $Path = TRACKER_SECRET.$Get; - $Return = ""; + $Return = ''; $Attempts = 0; while ($Return != "success" && $Attempts < 3) { @@ -52,7 +52,7 @@ class Tracker { } while (!feof($File) && !Misc::ends_with($ResHeader, "\r\n\r\n")); $Response = ''; - while($Line = fgets($File)) { + while ($Line = fgets($File)) { $Response .= $Line; } diff --git a/classes/class_users.php b/classes/class_users.php index 340e66d..daba276 100644 --- a/classes/class_users.php +++ b/classes/class_users.php @@ -104,9 +104,7 @@ class Users { } // Image proxy - if (check_perms('site_proxy_images') && !empty($UserInfo['Avatar'])) { - $UserInfo['Avatar'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&avatar='.$UserID.'&i='.urlencode($UserInfo['Avatar']); - } + $UserInfo['Avatar'] = ImageTools::process($UserInfo['Avatar']); return $UserInfo; } @@ -397,12 +395,12 @@ class Users { $Numchars = strlen($Chars) - 1; if ($Handle = @fopen('/dev/urandom', 'r')) { $Bytes = fread($Handle, 22); - for($i = 0; $i < 21; $i++) { + for ($i = 0; $i < 21; $i++) { $Salt .= $Chars[ord($Bytes[$i]) & $Numchars]; } $Salt[$i] = $Chars[(ord($Bytes[$i]) & 3) << 4]; } else { - for($i = 0; $i < 21; $i++) { + for ($i = 0; $i < 21; $i++) { $Salt .= $Chars[mt_rand(0, $Numchars)]; } $Salt[$i] = $Chars[mt_rand(0, 3) << 4]; @@ -481,7 +479,7 @@ class Users { if (check_perms('site_proxy_images') && !empty($UserInfo['Title'])) { $UserInfo['Title'] = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) { - return 'src='.$Matches[1].'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($Matches[2]).$Matches[3]; + return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3]; }, $UserInfo['Title']); } diff --git a/classes/script_start.php b/classes/script_start.php index da6f05f..ce7af93 100644 --- a/classes/script_start.php +++ b/classes/script_start.php @@ -10,7 +10,6 @@ /*------------------------------------------------------*/ /********************************************************/ require 'config.php'; //The config contains all site wide configuration information - //Deal with dumbasses if (isset($_REQUEST['info_hash']) && isset($_REQUEST['peer_id'])) { die('d14:failure reason40:Invalid .torrent, try downloading again.e'); } @@ -435,8 +434,6 @@ $Debug->set_flag('ending function definitions'); $Document = basename(parse_url($_SERVER['SCRIPT_FILENAME'], PHP_URL_PATH), '.php'); if (!preg_match('/^[a-z0-9]+$/i', $Document)) { error(404); } - - require(SERVER_ROOT.'/sections/'.$Document.'/index.php'); $Debug->set_flag('completed module execution'); diff --git a/design/privateheader.php b/design/privateheader.php index 3d92778..9afdfd7 100644 --- a/design/privateheader.php +++ b/design/privateheader.php @@ -229,7 +229,7 @@ if ($CurrentNews === false) { $Cache->cache_value('news_latest_id', $CurrentNews, 0); } if ($MyNews < $CurrentNews) { - $Alerts[] = '<a href="index.php">'.'New announcement!'.'</a>'; + $Alerts[] = '<a href="index.php">New announcement!</a>'; } // Blog @@ -245,7 +245,7 @@ if ($CurrentBlog === false) { $Cache->cache_value('blog_latest_id', $CurrentBlog, 0); } if ($MyBlog < $CurrentBlog) { - $Alerts[] = '<a href="blog.php">'.'New blog post!'.'</a>'; + $Alerts[] = '<a href="blog.php">New blog post!</a>'; } // Staff blog @@ -270,7 +270,7 @@ if (check_perms('users_mod')) { $Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600); } 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 === false) { } 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 @@ -295,13 +295,13 @@ if ($NewMessages === false) { } 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']) { - $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) { - $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')) { @@ -316,7 +316,7 @@ if (check_perms('site_torrents_notify')) { $Cache->cache_value('notifications_new_'.$LoggedUser['ID'], $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 @@ if (check_perms('site_collages_subscribe')) { $Cache->cache_value('collage_subs_user_new_'.$LoggedUser['ID'], $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')) { - $ModBar[] = '<a href="tools.php">'.'Toolbox'.'</a>'; + $ModBar[] = '<a href="tools.php">Toolbox</a>'; } if (check_perms('users_mod') || $LoggedUser['PermissionID'] == FORUM_MOD) { $NumStaffPMs = $Cache->get_value('num_staff_pms_'.$LoggedUser['ID']); @@ -387,7 +387,7 @@ if (check_perms('admin_reports')) { } 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')) { $NumForumReports = $Cache->get_value('num_forum_reports'); diff --git a/gazelle.sql b/gazelle.sql index 41a8efe..c7fe983 100644 --- a/gazelle.sql +++ b/gazelle.sql @@ -1510,7 +1510,7 @@ CREATE TABLE `users_sessions` ( `SessionID` char(32) NOT NULL, `KeepLogged` enum('0','1') NOT NULL DEFAULT '0', `Browser` varchar(40) DEFAULT NULL, - `OperatingSystem` varchar(8) DEFAULT NULL, + `OperatingSystem` varchar(13) DEFAULT NULL, `IP` varchar(15) NOT NULL, `LastUpdate` datetime NOT NULL, `Active` tinyint(4) NOT NULL DEFAULT '1', diff --git a/opensearch.php b/opensearch.php index 791b84f..7fc25f0 100644 --- a/opensearch.php +++ b/opensearch.php @@ -24,7 +24,7 @@ switch ($Type) { case 'artists': ?> <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&name={searchTerms}"/> + <Url type="application/x-suggestions+json" template="http<?=($SSL?'s':'')?>://<?=SITE_URL?>/artist.php?action=autocomplete&name={searchTerms}" /> <moz:SearchForm>http<?=($SSL?'s':'')?>://<?=SITE_URL?>/torrents.php?action=advanced</moz:SearchForm> <? break; diff --git a/sections/ajax/top10/torrents.php b/sections/ajax/top10/torrents.php index df7071b..e28335c 100644 --- a/sections/ajax/top10/torrents.php +++ b/sections/ajax/top10/torrents.php @@ -22,6 +22,7 @@ $BaseQuery = "SELECT g.ID, g.Name, g.CategoryID, + g.wikiImage, g.TagList, t.Format, t.Encoding, @@ -54,7 +55,7 @@ if ($Details == 'all' || $Details == 'day') { ORDER BY (t.Seeders + t.Leechers) DESC LIMIT $Limit;"; $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); } $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; $results = array(); 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, $RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType,$Size) = $Detail; diff --git a/sections/ajax/userhistory/post_history.php b/sections/ajax/userhistory/post_history.php index edf96e5..9fa1b60 100644 --- a/sections/ajax/userhistory/post_history.php +++ b/sections/ajax/userhistory/post_history.php @@ -54,10 +54,6 @@ if (($UserInfo = $Cache->get_value('user_info_'.$UserID)) === false) { 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&i='.urlencode($Avatar); -} - if ($LoggedUser['CustomForums']) { unset($LoggedUser['CustomForums']['']); $RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0)); diff --git a/sections/artist/artist.php b/sections/artist/artist.php index aba47d8..0a03f50 100644 --- a/sections/artist/artist.php +++ b/sections/artist/artist.php @@ -387,7 +387,7 @@ foreach ($Importances as $Group) { <td colspan="5" class="big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> + <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?> </div> <? endif; ?> <div class="group_info clear"> @@ -527,15 +527,11 @@ if (check_perms('site_torrents_notify')) { </div> <? /* Misc::display_recommend($ArtistID, "artist"); */ ?> <div class="sidebar"> -<? if ($Image) { - $WikiImage = $Image; - if (check_perms('site_proxy_images')) { - $WikiImage = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($WikiImage); - } ?> +<? if ($Image) { ?> <div class="box box_image"> <div class="head"><strong><?=$Name?></strong></div> <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> <? } ?> diff --git a/sections/blog/index.php b/sections/blog/index.php index 9b79969..a14387e 100644 --- a/sections/blog/index.php +++ b/sections/blog/index.php @@ -51,7 +51,7 @@ if (check_perms('admin_manage_blog')) { if ($ThreadID && is_number($ThreadID)) { $DB->query("SELECT ForumID FROM forums_topics WHERE ID=".$ThreadID); if ($DB->record_count() < 1) { - error("No such thread exists!"); + error('No such thread exists!'); header('Location: blog.php'); } } else { diff --git a/sections/bookmarks/torrents.php b/sections/bookmarks/torrents.php index 17917fb..a7cc900 100644 --- a/sections/bookmarks/torrents.php +++ b/sections/bookmarks/torrents.php @@ -210,11 +210,8 @@ foreach ($TorrentList as $GroupID => $Group) { <li class="image_group_<?=$GroupID?>"> <a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>"> <? 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 { ?> <div style="width:107px;padding:5px"><?=$DisplayName?></div> <? } ?> diff --git a/sections/collages/collage.php b/sections/collages/collage.php index 1a27e0a..356e5c0 100644 --- a/sections/collages/collage.php +++ b/sections/collages/collage.php @@ -285,11 +285,8 @@ foreach ($TorrentList as $GroupID => $Group) { <li class="image_group_<?=$GroupID?>"> <a href="torrents.php?id=<?=$GroupID?>"> <? 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 { ?> <span style="width: 107px; padding: 5px;"><?=$DisplayName?></span> <? } ?> diff --git a/sections/forums/forum.php b/sections/forums/forum.php index aed8f12..eab175c 100644 --- a/sections/forums/forum.php +++ b/sections/forums/forum.php @@ -75,7 +75,7 @@ if ($LoggedUser['CustomForums'][$ForumID] != 1 && $Forums[$ForumID]['MinClassRea } // Start printing -View::show_header('Forums > '. $Forums[$ForumID]['Name']); +View::show_header('Forums > '. $Forums[$ForumID]['Name']); ?> <div class="thin"> <h2><a href="forums.php">Forums</a> > <?=$ForumName?></h2> diff --git a/sections/forums/main.php b/sections/forums/main.php index a7b44b0..a527951 100644 --- a/sections/forums/main.php +++ b/sections/forums/main.php @@ -58,11 +58,11 @@ foreach ($Forums as $Forum) { <h3><?=$ForumCats[$CategoryID]?></h3> <table class="forum_index"> <tr class="colhead"> - <td style="width:2%;"></td> - <td style="width:25%;">Forum</td> + <td style="width: 2%;"></td> + <td style="width: 25%;">Forum</td> <td>Last post</td> - <td style="width:7%;">Topics</td> - <td style="width:7%;">Posts</td> + <td style="width: 7%;">Topics</td> + <td style="width: 7%;">Posts</td> </tr> <? $OpenTable = true; @@ -87,7 +87,7 @@ foreach ($Forums as $Forum) { </td> <? if ($NumPosts == 0) { ?> <td colspan="3"> - There are no topics here<?=($MinCreate <= $LoggedUser['Class']) ? ', <a href="forums.php?action=new&forumid='.$ForumID.'">'.'create one'.'</a>' : ''?>. + There are no topics here.<?=($MinCreate <= $LoggedUser['Class']) ? ', <a href="forums.php?action=new&forumid='.$ForumID.'">Create one!</a>' : '' ?>. </td> <? } else { ?> <td> diff --git a/sections/forums/newthread.php b/sections/forums/newthread.php index 385781d..cb69045 100644 --- a/sections/forums/newthread.php +++ b/sections/forums/newthread.php @@ -22,7 +22,7 @@ if ($Forum === false) { if (!check_forumperm($ForumID, 'Write') || !check_forumperm($ForumID, 'Create')) { error(403); } -View::show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode'); +View::show_header('Forums > '.$Forum['Name'].' > New Topic','comments,bbcode'); ?> <div class="thin"> <h2><a href="forums.php">Forums</a> > <a href="forums.php?action=viewforum&forumid=<?=$ForumID?>"><?=$Forum['Name']?></a> > <span id="newthreadtitle">New Topic</span></h2> diff --git a/sections/forums/poll_vote.php b/sections/forums/poll_vote.php index 9be170f..9e068db 100644 --- a/sections/forums/poll_vote.php +++ b/sections/forums/poll_vote.php @@ -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']; if (!empty($_POST['large'])) { @@ -9,7 +11,7 @@ if (!empty($_POST['large'])) { $Size = 140; } -if(!$ThreadInfo = $Cache->get_value('thread_'.$TopicID.'_info')) { +if (!$ThreadInfo = $Cache->get_value('thread_'.$TopicID.'_info')) { $DB->query("SELECT t.Title, t.ForumID, @@ -23,7 +25,9 @@ if(!$ThreadInfo = $Cache->get_value('thread_'.$TopicID.'_info')) { LEFT JOIN forums_polls AS p ON p.TopicID=t.ID WHERE t.ID = '$TopicID' GROUP BY fp.TopicID"); - if($DB->record_count()==0) { die(); } + if ($DB->record_count() == 0) { + die(); + } $ThreadInfo = $DB->next_record(MYSQLI_ASSOC); if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) { $Cache->cache_value('thread_'.$TopicID.'_info', $ThreadInfo, 0); @@ -77,7 +81,7 @@ if (!isset($_POST['vote']) || !is_number($_POST['vote'])) { <input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" /> <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br /> <? } ?> - <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank - Show the results!</label><br /><br /> + <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank — Show the results!</label><br /><br /> <input type="button" onclick="ajax.post('index.php','poll',function(response){$('#poll_container').raw().innerHTML = response});" value="Vote" /> </form> <? @@ -104,20 +108,20 @@ if (!isset($_POST['vote']) || !is_number($_POST['vote'])) { ?> <ul class="poll nobullet"> <? - if($ForumID != STAFF_FORUM) { + if ($ForumID != STAFF_FORUM) { for ($i = 1, $il = count($Answers); $i <= $il; $i++) { if (!empty($Votes[$i]) && $TotalVotes > 0) { - $Ratio = $Votes[$i]/$MaxVotes; - $Percent = $Votes[$i]/$TotalVotes; + $Ratio = $Votes[$i] / $MaxVotes; + $Percent = $Votes[$i] / $TotalVotes; } else { - $Ratio=0; - $Percent=0; + $Ratio = 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"> <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> </li> <? } @@ -131,10 +135,10 @@ if (!isset($_POST['vote']) || !is_number($_POST['vote'])) { GROUP BY fpv.Vote"); $StaffVotes = $DB->to_array(); - foreach($StaffVotes as $StaffVote) { + foreach ($StaffVotes as $StaffVote) { list($StaffString, $StaffVoted) = $StaffVote; ?> - <li><a href="forums.php?action=change_vote&threadid=<?=$TopicID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int) $StaffVoted?>"><?=display_str(empty($Answers[$StaffVoted]) ? "Blank" : $Answers[$StaffVoted])?></a> - <?=$StaffString?></li> + <li><a href="forums.php?action=change_vote&threadid=<?=$TopicID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int) $StaffVoted?>"><?=display_str(empty($Answers[$StaffVoted]) ? 'Blank' : $Answers[$StaffVoted])?></a> - <?=$StaffString?></li> <? } } diff --git a/sections/forums/search.php b/sections/forums/search.php index d7168d4..683348b 100644 --- a/sections/forums/search.php +++ b/sections/forums/search.php @@ -86,7 +86,7 @@ if (!empty($_GET['threadid']) && is_number($_GET['threadid'])) { } // Let's hope we got some results - start printing out the content. -View::show_header('Forums'.' > '.'Search', 'bbcode'); +View::show_header('Forums > Search', 'bbcode'); ?> <div class="thin"> <h2><a href="forums.php">Forums</a> > Search<?=$Title?></h2> @@ -271,14 +271,14 @@ $DB->query('SELECT FOUND_ROWS()'); list($Results) = $DB->next_record(); $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; ?> </div> <table cellpadding="6" cellspacing="1" border="0" class="forum_list border" width="100%"> <tr class="colhead"> <td>Forum</td> - <td><?=(!empty($ThreadID))?'Post Begins':'Topic'?></td> + <td><?=(!empty($ThreadID)) ? 'Post begins' : 'Topic' ?></td> <td>Time</td> </tr> <? if ($DB->record_count() == 0) { ?> diff --git a/sections/forums/takeedit.php b/sections/forums/takeedit.php index 1a6484c..6ccd108 100644 --- a/sections/forums/takeedit.php +++ b/sections/forums/takeedit.php @@ -54,13 +54,13 @@ list($OldBody, $AuthorID, $TopicID, $IsLocked, $ForumID, $MinClassWrite, $Page) // 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 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')) { error(403,true); } if($LoggedUser['DisablePosting']) { - error('Your posting rights have been removed.',true); + error('Your posting rights have been removed.', true); } if($DB->record_count()==0) { error(404,true); diff --git a/sections/forums/thread.php b/sections/forums/thread.php index 398630c..8b9ef68 100644 --- a/sections/forums/thread.php +++ b/sections/forums/thread.php @@ -246,29 +246,29 @@ if ($ThreadInfo['NoPoll'] == 0) { <? if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || !check_forumperm($ForumID)) { ?> <ul class="poll nobullet"> <? - if(!$RevealVoters) { - foreach($Answers as $i => $Answer) { + if (!$RevealVoters) { + foreach ($Answers as $i => $Answer) { if (!empty($Votes[$i]) && $TotalVotes > 0) { - $Ratio = $Votes[$i]/$MaxVotes; - $Percent = $Votes[$i]/$TotalVotes; + $Ratio = $Votes[$i] / $MaxVotes; + $Percent = $Votes[$i] / $TotalVotes; } else { - $Ratio=0; - $Percent=0; + $Ratio = 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"> <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> </li> <? } 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"> <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> </li> <? } ?> @@ -309,20 +309,20 @@ if ($ThreadInfo['NoPoll'] == 0) { foreach($Answers as $i => $Answer) { ?> <li> - <a href="forums.php?action=change_vote&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int) $i?>"><?=display_str($Answer == '' ? "Blank" : $Answer)?></a> - - <?=$StaffVotes[$i]?> (<?=number_format(((float) $Votes[$i]/$TotalVotes)*100, 2)?>%) + <a href="forums.php?action=change_vote&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int) $i?>"><?=display_str($Answer == '' ? 'Blank' : $Answer)?></a> + - <?=$StaffVotes[$i]?> (<?=number_format(((float) $Votes[$i] / $TotalVotes) * 100, 2)?>%) <a href="forums.php?action=delete_poll_option&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int) $i?>" class="brackets">X</a> </li> <? } ?> - <li><a href="forums.php?action=change_vote&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=0">Blank</a> - <?=$StaffVotes[0]?> (<?=number_format(((float) $Votes[0]/$TotalVotes)*100, 2)?>%)</li> + <li><a href="forums.php?action=change_vote&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=0">Blank</a> - <?=$StaffVotes[0]?> (<?=number_format(((float) $Votes[0] / $TotalVotes) * 100, 2)?>%)</li> </ul> <? - if($ForumID == STAFF_FORUM) { + if ($ForumID == STAFF_FORUM) { ?> <br /> <strong>Votes:</strong> <?=number_format($TotalVotes)?> / <?=$StaffCount ?> <br /> - <strong>Missing Votes:</strong> <?=implode(", ", $StaffNames)?> + <strong>Missing votes:</strong> <?=implode(", ", $StaffNames)?> <br /><br /> <? } @@ -349,7 +349,7 @@ if ($ThreadInfo['NoPoll'] == 0) { <? } ?> <li> <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 — Show the results!</label><br /> </li> </ul> <? if($ForumID == STAFF_FORUM) { ?> @@ -524,13 +524,13 @@ if(check_perms('site_moderate_forums')) { <tr> <td class="label">Sticky</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> </tr> <tr> <td class="label">Locked</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> </tr> <tr> diff --git a/sections/friends/friends.php b/sections/friends/friends.php index 4194dcf..a4f2119 100644 --- a/sections/friends/friends.php +++ b/sections/friends/friends.php @@ -93,11 +93,8 @@ foreach ($Friends as $Friend) { <td width="50px" valign="top"> <? if (empty($HeavyInfo['DisableAvatars'])) { - if (!empty($Avatar)) { - if (check_perms('site_proxy_images')) { - $Avatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($Avatar); - } ?> - <img src="<?=$Avatar?>" alt="<?=$Username?>'s avatar" width="50px" /> + if (!empty($Avatar)) { ?> + <img src="<?=ImageTools::process($Avatar)?>" alt="<?=$Username?>'s avatar" width="50px" /> <? } else { ?> <img src="<?=STATIC_SERVER?>common/avatars/default.png" width="50px" alt="Default avatar" /> <? } diff --git a/sections/index/feat_album.php b/sections/index/feat_album.php index 0ec519b..e18efa5 100644 --- a/sections/index/feat_album.php +++ b/sections/index/feat_album.php @@ -16,10 +16,6 @@ if ($FeaturedAlbum === false) { } if (is_number($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="head colhead_dark"><strong>Featured Album</strong></div> @@ -28,7 +24,7 @@ if (is_number($FeaturedAlbum['GroupID'])) { </div> <div class="center"> <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> </div> <div class="center pad"> diff --git a/sections/index/private.php b/sections/index/private.php index 1c75837..30d6738 100644 --- a/sections/index/private.php +++ b/sections/index/private.php @@ -1,6 +1,5 @@ <? include(SERVER_ROOT.'/classes/class_text.php'); - $Text = new TEXT(true); if (!$News = $Cache->get_value('news')) { @@ -294,7 +293,7 @@ if ($TopicID) { ?> <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"> <p><strong><?=display_str($Question)?></strong></p> <? if ($UserResponse !== null || $Closed) { ?> @@ -327,7 +326,7 @@ if ($TopicID) { <input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" /> <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br /> <? } ?> - <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank - Show the results!</label><br /><br /> + <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank — Show the results!</label><br /><br /> <input type="button" onclick="ajax.post('index.php','poll',function(response) {$('#poll_container').raw().innerHTML = response});" value="Vote" /> </form> </div> diff --git a/sections/login/login.php b/sections/login/login.php index 14bd53d..4837794 100644 --- a/sections/login/login.php +++ b/sections/login/login.php @@ -1,22 +1,22 @@ <? View::show_header('Login'); ?> <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"> <? - 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)."'"); $Attempts = 0; } - if(isset($Err)) { + if (isset($Err)) { ?> <span class="warning"><?=$Err?><br /><br /></span> <? } ?> <? 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 /> <? } ?> <table class="layout"> @@ -31,7 +31,7 @@ if(strtotime($BannedUntil)<time() && !$BanID) { <tr> <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> </td> <td><input type="submit" name="login" value="Login" class="submit" /></td> @@ -40,9 +40,9 @@ if(strtotime($BannedUntil)<time() && !$BanID) { </form> <? } 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 { ?> <span class="warning">You are banned from logging in for another <?=time_diff($BannedUntil)?>.</span> <? diff --git a/sections/login/recover_step1.php b/sections/login/recover_step1.php index aa84eda..f544550 100644 --- a/sections/login/recover_step1.php +++ b/sections/login/recover_step1.php @@ -3,11 +3,11 @@ View::show_header('Recover Password','validate'); echo $Validate->GenerateJS('recoverform'); ?> <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 /> <? -if(empty($Sent) || (!empty($Sent) && $Sent!=1)) { - if(!empty($Err)) { +if (empty($Sent) || (!empty($Sent) && $Sent != 1)) { + if (!empty($Err)) { ?> <strong class="important_text"><?=$Err ?></strong><br /><br /> <? } ?> @@ -21,9 +21,11 @@ if(empty($Sent) || (!empty($Sent) && $Sent!=1)) { <td colspan="2" align="right"><input type="submit" name="reset" value="Reset!" class="submit" /></td> </tr> </table> -<? } else { ?> +<? +} else { ?> An email has been sent to you; please follow the directions in that email to reset your password. -<? } ?> +<? +} ?> </div> </form> <? diff --git a/sections/register/closed.php b/sections/register/closed.php index c9ba832..88e1b44 100644 --- a/sections/register/closed.php +++ b/sections/register/closed.php @@ -1,7 +1,7 @@ <? View::show_header('Registration Closed'); ?> -<div style="width:500px;"> +<div style="width: 500px;"> <strong>Sorry, the site is currently invite only.</strong> </div> <? diff --git a/sections/register/code.php b/sections/register/code.php index 1f2abf0..0d95d52 100644 --- a/sections/register/code.php +++ b/sections/register/code.php @@ -1,7 +1,7 @@ <? View::show_header('Register'); ?> -<div style="width:500px;"> +<div style="width: 500px;"> <form class="auth_form" name="invite" method="get" action="register.php"> Please enter your invite code into the box below.<br /><br /> <table class="layout" cellpadding="2" cellspacing="1" border="0" align="center"> diff --git a/sections/register/index.php b/sections/register/index.php index e125861..f4e5609 100644 --- a/sections/register/index.php +++ b/sections/register/index.php @@ -48,7 +48,7 @@ if (!empty($_REQUEST['confirm'])) { list($UserCount)=$DB->next_record(); if ($UserCount) { - $Err = "There is already someone registered with that username."; + $Err = 'There is already someone registered with that username.'; $_REQUEST['username']=''; } diff --git a/sections/register/step1.php b/sections/register/step1.php index 4ba7513..7289a90 100644 --- a/sections/register/step1.php +++ b/sections/register/step1.php @@ -5,21 +5,21 @@ echo $Val->GenerateJS('registerform'); <script src="<?=STATIC_SERVER?>functions/jquery.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();"> -<div style="width:500px;"> +<div style="width: 500px;"> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <? -if(empty($Sent)) { - if(!empty($_REQUEST['invite'])) { +if (empty($Sent)) { + if (!empty($_REQUEST['invite'])) { 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 /> <? } ?> <table class="layout" cellpadding="2" cellspacing="1" border="0" align="center"> <tr valign="top"> - <td align="right" style="width:100px;">Username </td> + <td align="right" style="width: 100px;">Username </td> <td align="left"> <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> @@ -61,7 +61,9 @@ if(empty($Sent)) { <? } 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. -<? 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> </form> diff --git a/sections/reportsv2/ajax_new_report.php b/sections/reportsv2/ajax_new_report.php index 32acf1d..04095a3 100644 --- a/sections/reportsv2/ajax_new_report.php +++ b/sections/reportsv2/ajax_new_report.php @@ -316,9 +316,8 @@ $DB->query("SELECT <? $Images = explode(" ", $Images); foreach ($Images as $Image) { - $Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&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> diff --git a/sections/reportsv2/static.php b/sections/reportsv2/static.php index c64e2c5..0058226 100644 --- a/sections/reportsv2/static.php +++ b/sections/reportsv2/static.php @@ -474,9 +474,8 @@ if (count($Reports) == 0) { <? $Images = explode(' ', $Images); foreach ($Images as $Image) { - $Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&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> diff --git a/sections/requests/index.php b/sections/requests/index.php index 7871b68..0e08d52 100644 --- a/sections/requests/index.php +++ b/sections/requests/index.php @@ -6,16 +6,16 @@ $RequestTax = 0.1; // Minimum and default amount of upload to remove from the user when they vote. // 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.'); } -if(!isset($_REQUEST['action'])) { +if (!isset($_REQUEST['action'])) { include(SERVER_ROOT.'/sections/requests/requests.php'); } else { - switch($_REQUEST['action']){ + switch($_REQUEST['action']) { case 'new': case 'edit': include(SERVER_ROOT.'/sections/requests/new_edit.php'); @@ -48,15 +48,17 @@ if(!isset($_REQUEST['action'])) { authorize(); 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); } - if($LoggedUser['DisablePosting']) { + if ($LoggedUser['DisablePosting']) { error('Your posting rights have been removed.'); } $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"); list($Pages) = $DB->next_record(); @@ -85,7 +87,9 @@ if(!isset($_REQUEST['action'])) { case 'get_post': 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'])."'"); list($Body) = $DB->next_record(MYSQLI_NUM); @@ -100,7 +104,9 @@ if(!isset($_REQUEST['action'])) { $Text = new TEXT; // Quick SQL injection check - if(!$_POST['post'] || !is_number($_POST['post'])) { error(0); } + if (!$_POST['post'] || !is_number($_POST['post'])) { + error(0); + } // Mainly $DB->query("SELECT @@ -115,8 +121,12 @@ if(!isset($_REQUEST['action'])) { $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(); - if ($LoggedUser['ID']!=$AuthorID && !check_perms('site_moderate_forums')) { error(404); } - if ($DB->record_count()==0) { error(404); } + if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) { + error(404); + } + if ($DB->record_count() == 0) { + error(404); + } // Perform the update $DB->query("UPDATE requests_comments SET @@ -152,10 +162,14 @@ if(!isset($_REQUEST['action'])) { authorize(); // 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 - if (!check_perms('site_moderate_forums')) { error(403); } + if (!check_perms('site_moderate_forums')) { + error(403); + } // Get topicid, forumid, number of pages $DB->query("SELECT DISTINCT diff --git a/sections/requests/new_edit.php b/sections/requests/new_edit.php index 96383c5..f3d3348 100644 --- a/sections/requests/new_edit.php +++ b/sections/requests/new_edit.php @@ -146,7 +146,7 @@ View::show_header(($NewRequest ? "Create a request" : "Edit a request"), 'reques </td> <td> <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> <? } ?> </select> @@ -160,8 +160,8 @@ View::show_header(($NewRequest ? "Create a request" : "Edit a request"), 'reques if (!empty($ArtistForm)) { $First = true; - foreach($ArtistForm as $Importance => $ArtistNames) { - foreach($ArtistNames as $Artist) { + foreach ($ArtistForm as $Importance => $ArtistNames) { + foreach ($ArtistNames as $Artist) { ?> <input type="text" id="artist" name="artists[]" size="45" value="<?=display_str($Artist['name']) ?>" /> <select id="importance" name="importance[]" > @@ -245,7 +245,7 @@ View::show_header(($NewRequest ? "Create a request" : "Edit a request"), 'reques ?> <select id="genre_tags" name="genre_tags" onchange="add_tag();return false;" > <option>---</option> -<? foreach (Misc::display_array($GenreTags) as $Genre){ ?> +<? foreach (Misc::display_array($GenreTags) as $Genre) { ?> <option value="<?=$Genre ?>"><?=$Genre ?></option> <? } ?> </select> diff --git a/sections/requests/request.php b/sections/requests/request.php index 0ca9ebc..8f928df 100644 --- a/sections/requests/request.php +++ b/sections/requests/request.php @@ -127,12 +127,10 @@ $google_url = "https://www.google.com/search?&tbm=shop&q=" . $encoded_artist . " <div class="box box_image box_image_albumart box_albumart"><!-- .box_albumart deprecated --> <div class="head"><strong>Cover</strong></div> <? -if (!empty($Image)) { - if (check_perms('site_proxy_images')) { - $Image = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($Image); - } + if (!empty($Image)) { + $Image = ImageTools::process($Image, true); ?> - <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 { ?> <p align="center"><img src="<?=STATIC_SERVER?>common/noartwork/<?=$CategoryIcons[$CategoryID-1]?>" alt="<?=$CategoryName?>" title="<?=$CategoryName?>" width="220" height="220" border="0" /></p> <? } ?> diff --git a/sections/rules/clients.php b/sections/rules/clients.php index c655dd9..dfed307 100644 --- a/sections/rules/clients.php +++ b/sections/rules/clients.php @@ -15,12 +15,12 @@ if (!$WhitelistedClients = $Cache->get_value('whitelisted_clients')) { <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%"> <tr class="colhead"> - <td style="width:150px;"><strong>Allowed Client</strong></td> - <!-- td style="width:400px;"><strong>Additional Notes</strong></td> --> + <td style="width: 150px;"><strong>Allowed Client</strong></td> + <!-- td style="width: 400px;"><strong>Additional Notes</strong></td> --> </tr> <? $Row = 'a'; - foreach($WhitelistedClients as $Client) { + foreach ($WhitelistedClients as $Client) { //list($ClientName,$Notes) = $Client; list($ClientName) = $Client; $Row = ($Row == 'a') ? 'b' : 'a'; diff --git a/sections/rules/ratio.php b/sections/rules/ratio.php index 72da704..07b0d4a 100644 --- a/sections/rules/ratio.php +++ b/sections/rules/ratio.php @@ -40,52 +40,52 @@ View::show_header('Ratio Requirements'); <td>Required Ratio (0% seeded)</td> <td>Required Ratio (100% seeded)</td> </tr> - <tr class="row<?=($LoggedUser['BytesDownloaded'] < 5 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> - <td>0-5 GB</td> + <tr class="row<?=($LoggedUser['BytesDownloaded'] < 5 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>"> + <td>0–5 GB</td> <td>0.00</td> <td>0.00</td> </tr> - <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 5 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 10 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> - <td>5-10 GB</td> + <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 5 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 10 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>"> + <td>5–10 GB</td> <td>0.15</td> <td>0.00</td> </tr> - <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 10 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 20 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> - <td>10-20 GB</td> + <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 10 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 20 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>"> + <td>10–20 GB</td> <td>0.20</td> <td>0.00</td> </tr> - <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 20 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 30 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> - <td>20-30 GB</td> + <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 20 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 30 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>"> + <td>20–30 GB</td> <td>0.30</td> <td>0.05</td> </tr> - <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 30 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 40 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> - <td>30-40 GB</td> + <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 30 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 40 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>"> + <td>30–40 GB</td> <td>0.40</td> <td>0.10</td> </tr> - <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 40 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 50 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> - <td>40-50 GB</td> + <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 40 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 50 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>"> + <td>40–50 GB</td> <td>0.50</td> <td>0.20</td> </tr> - <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 50 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 60 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> - <td>50-60 GB</td> + <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 50 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 60 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>"> + <td>50–60 GB</td> <td>0.60</td> <td>0.30</td> </tr> - <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 60 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 80 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> - <td>60-80 GB</td> + <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 60 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 80 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>"> + <td>60–80 GB</td> <td>0.60</td> <td>0.40</td> </tr> - <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 80 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 100 * 1024 * 1024 * 1024) ? 'a' : 'b'?>"> - <td>80-100 GB</td> + <tr class="row<?=($LoggedUser['BytesDownloaded'] >= 80 * 1024 * 1024 * 1024 && $LoggedUser['BytesDownloaded'] < 100 * 1024 * 1024 * 1024) ? 'a' : 'b' ?>"> + <td>80–100 GB</td> <td>0.60</td> <td>0.50</td> </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>0.60</td> <td>0.60</td> @@ -101,15 +101,15 @@ View::show_header('Ratio Requirements'); 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><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 − (seeding / snatched)]. Formatted differently, the calculation performed by the system looks like this: </li> </ul> <br /> <br /> - <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&chf=bg,s,FFFFFF00&chl=%5Ctextrm%7B%28maximum+required+ratio%29+%2A+%281-%5Cfrac%7Bseeding%7D%7Bsnatched%7D%29%7D&chco=' + hexify(getComputedStyle(this.parentNode,null).color); }"/> + <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&chf=bg,s,FFFFFF00&chl=%5Ctextrm%7B%28maximum+required+ratio%29+%2A+%281-%5Cfrac%7Bseeding%7D%7Bsnatched%7D%29%7D&chco=' + hexify(getComputedStyle(this.parentNode,null).color); }" /> </div> <br /> <br /> @@ -144,11 +144,11 @@ View::show_header('Ratio Requirements'); <br /> <strong>Required Ratio Example:</strong><br /> <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'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–30 GB amount downloaded bracket in the table above. Rippy's maximum required ratio (0% seeded) is 0.30, and his minimum required ratio (100% seeded) is 0.05. </li> <li>In this example, Rippy has snatched 90 torrents, and is currently seeding 45 torrents.</li> - <li>To calculate Rippy'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: - 0.3 * [1 - (45/90)] = 0.15. + <li>To calculate Rippy'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: + <samp>0.3 * [1 − (45 / 90)] = 0.15</samp> </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's on-site required ratio was listed as a value greater than the calculated value, this would be because he hadn't seeded those 45 torrents for a 72 hour period in the diff --git a/sections/rules/rules.php b/sections/rules/rules.php index 451e52c..66b7e30 100644 --- a/sections/rules/rules.php +++ b/sections/rules/rules.php @@ -18,7 +18,7 @@ View::show_header('Rule Index'); <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>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>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> diff --git a/sections/staffblog/index.php b/sections/staffblog/index.php index fc7dc5a..f2d92b9 100644 --- a/sections/staffblog/index.php +++ b/sections/staffblog/index.php @@ -1,7 +1,7 @@ <? enforce_login(); -if(!check_perms('users_mod')) { +if (!check_perms('users_mod')) { error(403); } @@ -12,15 +12,15 @@ define('ANNOUNCEMENT_FORUM_ID', 19); require(SERVER_ROOT.'/classes/class_text.php'); $Text = new TEXT; -if(check_perms('admin_manage_blog')) { - if(!empty($_REQUEST['action'])) { - switch($_REQUEST['action']) { +if (check_perms('admin_manage_blog')) { + if (!empty($_REQUEST['action'])) { + switch ($_REQUEST['action']) { case 'takeeditblog': authorize(); if (empty($_POST['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'])."'"); $Cache->delete_value('staff_blog'); $Cache->delete_value('staff_feed_blog'); @@ -28,14 +28,14 @@ if(check_perms('admin_manage_blog')) { header('Location: staffblog.php'); break; case 'editblog': - if(is_number($_GET['id'])){ + if (is_number($_GET['id'])) { $BlogID = $_GET['id']; $DB->query("SELECT Title, Body FROM staff_blog WHERE ID=$BlogID"); list($Title, $Body, $ThreadID) = $DB->next_record(); } break; case 'deleteblog': - if(is_number($_GET['id'])){ + if (is_number($_GET['id'])) { authorize(); $DB->query("DELETE FROM staff_blog WHERE ID='".db_string($_GET['id'])."'"); $Cache->delete_value('staff_blog'); @@ -67,21 +67,21 @@ if(check_perms('admin_manage_blog')) { <div class="box thin"> <div class="head"> <?=((empty($_GET['action'])) ? 'Create a staff blog post' : 'Edit staff blog post')?> - <span style="float:right;"> - <a href="#" onclick="$('#postform').toggle(); this.innerHTML=(this.innerHTML=='(Hide)'?'(Show)':'(Hide)'); return false;"><?=($_REQUEST['action']!='editblog')?'(Show)':'(Hide)'?></a> + <span style="float: right;"> + <a href="#" onclick="$('#postform').toggle(); this.innerHTML=(this.innerHTML=='Hide'?'Show':'Hide'); return false;" class="bracket"><?=($_REQUEST['action'] != 'editblog') ? 'Show' : 'Hide' ?></a> </span> </div> <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="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; ?>" /> - <? }?> +<? } ?> <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> - <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 /> <div class="center"> <input type="submit" value="<?=((!isset($_GET['action'])) ? 'Create blog post' : 'Edit blog post') ?>" /> @@ -117,10 +117,10 @@ foreach ($Blog as $BlogItem) { <div id="blog<?=$BlogID?>" class="box"> <div class="head"> <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&id=<?=$BlogID?>" class="brackets">Edit</a> <a href="staffblog.php?action=deleteblog&id=<?=$BlogID?>&auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Do you want to delete this?')" class="brackets">Delete</a> - <? } ?> +<? } ?> </div> <div class="pad"> <?=$Text->full_format($Body)?> diff --git a/sections/stats/index.php b/sections/stats/index.php index 09697ef..8e6853b 100644 --- a/sections/stats/index.php +++ b/sections/stats/index.php @@ -1,9 +1,9 @@ <? enforce_login(); -if(!isset($_REQUEST['action'])) { +if (!isset($_REQUEST['action'])) { error(404); } else { - switch($_REQUEST['action']){ + switch ($_REQUEST['action']) { case 'users': include(SERVER_ROOT.'/sections/stats/users.php'); break; diff --git a/sections/stats/torrents.php b/sections/stats/torrents.php index 29dc488..c7e40c5 100644 --- a/sections/stats/torrents.php +++ b/sections/stats/torrents.php @@ -7,45 +7,45 @@ if (!list($Labels,$InFlow,$OutFlow,$NetFlow,$Max) = $Cache->get_value('torrents_ $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()); - foreach($TimelineIn as $Month) { + foreach ($TimelineIn as $Month) { list($Label,$Amount) = $Month; if ($Amount > $Max) { $Max = $Amount; } } - foreach($TimelineOut as $Month) { + foreach ($TimelineOut as $Month) { list($Label,$Amount) = $Month; if ($Amount > $Max) { $Max = $Amount; } } - foreach($TimelineNet as $Month) { + foreach ($TimelineNet as $Month) { list($Label,$Amount) = $Month; if ($Amount > $Max) { $Max = $Amount; } } - foreach($TimelineIn as $Month) { + foreach ($TimelineIn as $Month) { list($Label,$Amount) = $Month; $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; - $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; - $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'); $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(); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); -foreach($Groups as $Group) { +foreach ($Groups as $Group) { list($CategoryID, $Torrents) = $Group; $CategoryName = $Categories[$CategoryID - 1]; $Pie->add($CategoryName,$Torrents); diff --git a/sections/stats/users.php b/sections/stats/users.php index 5b28709..0d6224e 100644 --- a/sections/stats/users.php +++ b/sections/stats/users.php @@ -3,26 +3,26 @@ if (!list($Countries,$Rank,$CountryUsers,$CountryMax,$CountryMin,$LogIncrements) include_once(SERVER_ROOT.'/classes/class_charts.php'); $DB->query('SELECT Code, Users FROM users_geodistribution'); $Data = $DB->to_array(); - $Count = $DB->record_count()-1; + $Count = $DB->record_count() - 1; - if($Count<30) { + if ($Count < 30) { $CountryMinThreshold = $Count; } else { $CountryMinThreshold = 30; } - $CountryMax = ceil(log(Max(1,$Data[0][1]))/log(2))+1; - $CountryMin = floor(log(Max(1,$Data[$CountryMinThreshold][1]))/log(2)); + $CountryMax = ceil(log(Max(1, $Data[0][1])) / log(2)) + 1; + $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 foreach ($Data as $Key => $Item) { list($Country,$UserCount) = $Item; $Countries[] = $Country; - $CountryUsers[] = number_format((((log($UserCount)/log(2))-$CountryMin)/($CountryMax-$CountryMin))*100,2); - $Rank[] = round((1-($Key/$Count))*100); + $CountryUsers[] = number_format((((log($UserCount) / log(2)) - $CountryMin) / ($CountryMax - $CountryMin)) * 100, 2); + $Rank[] = round((1 - ($Key / $Count)) * 100); - if(isset($CountryRegions[$Country])) { - foreach($CountryRegions[$Country] as $Region) { + if (isset($CountryRegions[$Country])) { + foreach ($CountryRegions[$Country] as $Region) { $Countries[] = $Region; $Rank[] = end($Rank); } @@ -30,20 +30,20 @@ if (!list($Countries,$Rank,$CountryUsers,$CountryMax,$CountryMin,$LogIncrements) } reset($Rank); - for ($i=$CountryMin;$i<=$CountryMax;$i++) { - $LogIncrements[] = Format::human_format(pow(2,$i)); + for ($i = $CountryMin; $i <= $CountryMax; $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'); $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(); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); - foreach($ClassSizes as $ClassSize) { - list($Label,$Users) = $ClassSize; - $Pie->add($Label,$Users); + foreach ($ClassSizes as $ClassSize) { + list($Label, $Users) = $ClassSize; + $Pie->add($Label, $Users); } $Pie->transparent(); $Pie->color('FF33CC'); @@ -51,7 +51,7 @@ if(!$ClassDistribution = $Cache->get_value('class_distribution')) { $ClassDistribution = $Pie->url(); $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'); @@ -59,7 +59,7 @@ if(!$PlatformDistribution = $Cache->get_value('platform_distribution')) { $Platforms = $DB->to_array(); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); - foreach($Platforms as $Platform) { + foreach ($Platforms as $Platform) { list($Label,$Users) = $Platform; $Pie->add($Label,$Users); } @@ -67,10 +67,10 @@ if(!$PlatformDistribution = $Cache->get_value('platform_distribution')) { $Pie->color('8A00B8'); $Pie->generate(); $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'); @@ -78,7 +78,7 @@ if(!$BrowserDistribution = $Cache->get_value('browser_distribution')) { $Browsers = $DB->to_array(); $Pie = new PIE_CHART(750,400,array('Other'=>1,'Percentage'=>1)); - foreach($Browsers as $Browser) { + foreach ($Browsers as $Browser) { list($Label,$Users) = $Browser; $Pie->add($Label,$Users); } @@ -86,7 +86,7 @@ if(!$BrowserDistribution = $Cache->get_value('browser_distribution')) { $Pie->color('008AB8'); $Pie->generate(); $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 @@ if (!list($Labels,$InFlow,$OutFlow,$Max) = $Cache->get_value('users_timeline')) $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"); $TimelineOut = array_reverse($DB->to_array()); - foreach($TimelineIn as $Month) { + foreach ($TimelineIn as $Month) { list($Label,$Amount) = $Month; if ($Amount > $Max) { $Max = $Amount; } } - foreach($TimelineOut as $Month) { + foreach ($TimelineOut as $Month) { list($Label,$Amount) = $Month; if ($Amount > $Max) { $Max = $Amount; @@ -110,16 +110,16 @@ if (!list($Labels,$InFlow,$OutFlow,$Max) = $Cache->get_value('users_timeline')) } $Labels = array(); - foreach($TimelineIn as $Month) { + foreach ($TimelineIn as $Month) { list($Label,$Amount) = $Month; $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; - $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 diff --git a/sections/tools/data/donation_log.php b/sections/tools/data/donation_log.php index 37bca4e..2c47119 100644 --- a/sections/tools/data/donation_log.php +++ b/sections/tools/data/donation_log.php @@ -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'); @@ -15,7 +17,7 @@ $sql = "SELECT d.Email, d.Time FROM donations AS d "; -if(!empty($_GET['search'])) { +if (!empty($_GET['search'])) { $sql .= "WHERE d.Email LIKE '%".db_string($_GET['search'])."%' "; } $sql .= "ORDER BY d.Time DESC LIMIT $Limit"; @@ -30,7 +32,7 @@ if (empty($_GET['search']) && !isset($_GET['page']) && !$DonationTimeline = $Cac $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()); $Area = new AREA_GRAPH(880,160,array('Break'=>1)); - foreach($Timeline as $Entry) { + foreach ($Timeline as $Entry) { list($Label,$Amount) = $Entry; $Area->add($Label,$Amount); } @@ -40,7 +42,7 @@ if (empty($_GET['search']) && !isset($_GET['page']) && !$DonationTimeline = $Cac $Area->lines(2); $Area->generate(); $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'); @@ -69,7 +71,7 @@ if (empty($_GET['search']) && !isset($_GET['page'])) { <br /> <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; ?> </div> @@ -81,7 +83,7 @@ if (empty($_GET['search']) && !isset($_GET['page'])) { <td>Time</td> </tr> <? - foreach($Donations as $Donation) { + foreach ($Donations as $Donation) { list($UserID, $Amount, $Currency, $Email, $DonationTime) = $Donation; ?> <tr> diff --git a/sections/top10/torrents.php b/sections/top10/torrents.php index 73d830f..fb97077 100644 --- a/sections/top10/torrents.php +++ b/sections/top10/torrents.php @@ -506,7 +506,7 @@ function generate_torrent_table($Caption, $Tag, $Details, $Limit) { <td class="big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> + <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?> </div> <? endif; ?> <div class="group_info clear"> diff --git a/sections/top10/votes.php b/sections/top10/votes.php index 38a541a..82e7ad3 100644 --- a/sections/top10/votes.php +++ b/sections/top10/votes.php @@ -214,7 +214,7 @@ foreach ($TopVotes as $GroupID => $Group) { <td class="big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> + <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?> </div> <? endif; ?> <div class="group_info clear"> @@ -314,7 +314,7 @@ foreach ($TopVotes as $GroupID => $Group) { <td class="nobr big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> + <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?> </div> <? endif; ?> <div class="group_info clear"> diff --git a/sections/torrents/browse2.php b/sections/torrents/browse2.php index d3b3797..f32e0f5 100644 --- a/sections/torrents/browse2.php +++ b/sections/torrents/browse2.php @@ -1001,7 +1001,7 @@ $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGr <td colspan="2" class="big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupInfo['CategoryID'] - 1) ?> + <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupInfo['CategoryID']) ?> </div> <? endif; ?> <div class="group_info clear"> @@ -1122,7 +1122,7 @@ $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGr <td class="big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $CategoryID - 1) ?> + <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $CategoryID) ?> </div> <? endif; ?> <div class="group_info clear"> diff --git a/sections/torrents/details.php b/sections/torrents/details.php index 53f40bd..1d898b9 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -119,12 +119,8 @@ View::show_header($Title,'jquery,browse,comments,torrent,bbcode,recommend'); <div class="head"><strong>Cover</strong></div> <? 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 { ?> diff --git a/sections/torrents/notify.php b/sections/torrents/notify.php index 4921e76..4f91825 100644 --- a/sections/torrents/notify.php +++ b/sections/torrents/notify.php @@ -256,7 +256,7 @@ if (empty($Results)) { <td class="big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupCategoryID - 1) ?> + <? ImageTools::cover_thumb($GroupInfo['WikiImage'], $GroupCategoryID) ?> </div> <? endif; ?> <div class="group_info clear"> diff --git a/sections/torrents/takeedit.php b/sections/torrents/takeedit.php index 45e5174..3b69e5d 100644 --- a/sections/torrents/takeedit.php +++ b/sections/torrents/takeedit.php @@ -25,14 +25,14 @@ $TypeID = (int)$_POST['type']; $Type = $Categories[$TypeID-1]; $TorrentID = (int)$_POST['torrentid']; $Properties['Remastered'] = (isset($_POST['remaster']))? 1 : 0; -if($Properties['Remastered']) { +if ($Properties['Remastered']) { $Properties['UnknownRelease'] = (isset($_POST['unknown'])) ? 1 : 0; $Properties['RemasterYear'] = $_POST['remaster_year']; $Properties['RemasterTitle'] = $_POST['remaster_title']; $Properties['RemasterRecordLabel'] = $_POST['remaster_record_label']; $Properties['RemasterCatalogueNumber'] = $_POST['remaster_catalogue_number']; } -if(!$Properties['Remastered']) { +if (!$Properties['Remastered']) { $Properties['UnknownRelease'] = 0; $Properties['RemasterYear'] = ''; $Properties['RemasterTitle'] = ''; @@ -57,21 +57,21 @@ $Properties['Encoding'] = $_POST['bitrate']; $Properties['Trumpable'] = (isset($_POST['make_trumpable'])) ? 1 : 0; $Properties['TorrentDescription'] = $_POST['release_desc']; $Properties['Name'] = $_POST['title']; -if($_POST['album_desc']) { +if ($_POST['album_desc']) { $Properties['GroupDescription'] = $_POST['album_desc']; } -if(check_perms('torrents_freeleech')) { +if (check_perms('torrents_freeleech')) { $Free = (int)$_POST['freeleech']; - if(!in_array($Free, array(0,1,2))) { + if (!in_array($Free, array(0,1,2))) { error(404); } $Properties['FreeLeech'] = $Free; - if($Free == 0) { + if ($Free == 0) { $FreeType = 0; } else { $FreeType = (int)$_POST['freeleechtype']; - if(!in_array($Free, array(0,1,2,3))) { + if (!in_array($Free, array(0,1,2,3))) { error(404); } } @@ -82,22 +82,22 @@ if(check_perms('torrents_freeleech')) { //--------------- Validate data in edit form -----------------------------------// $DB->query('SELECT UserID, Remastered, RemasterYear, FreeTorrent FROM torrents WHERE ID='.$TorrentID); -if($DB->record_count() == 0) { +if ($DB->record_count() == 0) { error(404); } 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); } -if($Remastered == '1' && !$RemasterYear && !check_perms('edit_unknowns')) { +if ($Remastered == '1' && !$RemasterYear && !check_perms('edit_unknowns')) { 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 - if($LoggedUser['ID'] != $UserID) { + if ($LoggedUser['ID'] != $UserID) { //Hax die(); } @@ -106,7 +106,7 @@ if($Properties['UnknownRelease'] && !($Remastered == '1' && !$RemasterYear) && ! $Validate->SetFields('type','1','number','Not a valid type.',array('maxlength'=>count($Categories), 'minlength'=>1)); switch ($Type) { 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.'); } else { $Validate->SetFields('remaster_year', '0','number', 'Invalid remaster year.'); @@ -142,11 +142,13 @@ switch ($Type) { // Handle 'other' bitrates - if($Properties['Encoding'] == 'Other') { + if ($Properties['Encoding'] == 'Other') { $Validate->SetFields('other_bitrate', '1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9)); $enc = trim($_POST['other_bitrate']); - if(isset($_POST['vbr'])) { $enc.=' (VBR)'; } + if (isset($_POST['vbr'])) { + $enc.=' (VBR)'; + } $Properties['Encoding'] = $enc; $Properties['Bitrate'] = $enc; @@ -179,11 +181,13 @@ switch ($Type) { // Handle 'other' bitrates - if($Properties['Encoding'] == 'Other') { + if ($Properties['Encoding'] == 'Other') { $Validate->SetFields('other_bitrate', '1','text','You must enter the other bitrate (max length: 9 characters).', array('maxlength'=>9)); $enc = trim($_POST['other_bitrate']); - if(isset($_POST['vbr'])) { $enc.=' (VBR)'; } + if (isset($_POST['vbr'])) { + $enc.=' (VBR)'; + } $Properties['Encoding'] = $enc; $Properties['Bitrate'] = $enc; @@ -209,9 +213,9 @@ switch ($Type) { $Err = $Validate->ValidateForm($_POST); // Validate the form -if($Properties['Remastered'] && !$Properties['RemasterYear']) { +if ($Properties['Remastered'] && !$Properties['RemasterYear']) { //Unknown Edit! - if($LoggedUser['ID'] == $UserID || check_perms('edit_unknowns')) { + if ($LoggedUser['ID'] == $UserID || check_perms('edit_unknowns')) { //Fine! } else { $Err = "You may not edit somebody else's upload to unknown release."; @@ -226,8 +230,8 @@ if (preg_match($RegX, $Properties['Image'], $Matches)) { } ImageTools::blacklisted($Properties['Image']); -if($Err){ // Show the upload form, with the data the user entered - if(check_perms('site_debug')) { +if ($Err) { // Show the upload form, with the data the user entered + if (check_perms('site_debug')) { die($Err); } error($Err); @@ -240,8 +244,8 @@ if($Err){ // Show the upload form, with the data the user entered // Shorten and escape $Properties for database input $T = array(); foreach ($Properties as $Key => $Value) { - $T[$Key]="'".db_string(trim($Value))."'"; - if(!$T[$Key]){ + $T[$Key] = "'".db_string(trim($Value))."'"; + if (!$T[$Key]) { $T[$Key] = NULL; } } @@ -286,13 +290,13 @@ $SQL = " Scene=$T[Scene], Description=$T[TorrentDescription],"; -if(check_perms('torrents_freeleech')) { +if (check_perms('torrents_freeleech')) { $SQL .= "FreeTorrent=$T[FreeLeech],"; $SQL .= "FreeLeechType=$T[FreeLeechType],"; } -if(check_perms('users_mod')) { - if($T[Format] != "'FLAC'") { +if (check_perms('users_mod')) { + if ($T[Format] != "'FLAC'") { $SQL .= " HasLog='0', HasCue='0', @@ -381,7 +385,7 @@ $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']); } @@ -389,8 +393,8 @@ $DB->query("SELECT GroupID, Time FROM torrents WHERE ID='$TorrentID'"); list($GroupID, $Time) = $DB->next_record(); // Competition -if(strtotime($Time)>1241352173) { - if($_POST['log_score'] == '100') { +if (strtotime($Time)>1241352173) { + if ($_POST['log_score'] == '100') { $DB->query("INSERT IGNORE into users_points (GroupID, UserID, Points) VALUES ('$GroupID', '$UserID', '1')"); } } diff --git a/sections/torrents/user.php b/sections/torrents/user.php index bd76654..d64d365 100644 --- a/sections/torrents/user.php +++ b/sections/torrents/user.php @@ -492,7 +492,7 @@ foreach ($Categories as $CatKey => $CatName) { <td class="big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> + <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?> </div> <? endif; ?> <div class="group_info clear"> diff --git a/sections/upload/upload_handle.php b/sections/upload/upload_handle.php index 78d285b..077e110 100644 --- a/sections/upload/upload_handle.php +++ b/sections/upload/upload_handle.php @@ -811,9 +811,9 @@ if (!empty($ArtistsUnescaped)) { foreach ($ArtistsUnescaped as $Importance => $Artists) { foreach ($Artists as $Artist) { 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 { - $GuestArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']))."|%'"; + $GuestArtistNameList[] = "Artists LIKE '%|".db_string(str_replace('\\','\\\\',$Artist['name']), true)."|%'"; } } } diff --git a/sections/user/linkedfunctions.php b/sections/user/linkedfunctions.php index 269b4ed..4f188ba 100644 --- a/sections/user/linkedfunctions.php +++ b/sections/user/linkedfunctions.php @@ -166,8 +166,10 @@ function user_dupes_table($UserID) { <input type="hidden" name="userid" value="<?=$UserID?>" /> <input type="hidden" id="auth" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> <input type="hidden" id="form_comment_hash" name="form_comment_hash" value="<?=$CommentHash?>" /> - <div class="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="box" id="l_a_box"> + <div class="head"> + <a href="#l_a_box"><strong>↑</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"> <?=$DupeCount?'<tr>':''?> <? diff --git a/sections/user/stylesheetgallery.php b/sections/user/stylesheetgallery.php index c790ea1..bb57497 100644 --- a/sections/user/stylesheetgallery.php +++ b/sections/user/stylesheetgallery.php @@ -13,7 +13,7 @@ if (!isset($_GET['name'])) { if (!$Name) { error(404); } - if (isset($_GET['format']) && $_GET['format'] === "data"){ + if (isset($_GET['format']) && $_GET['format'] === "data") { global $Cache; $ImageData = $Cache->get_value("cssgallery_".$Name); if(!empty($ImageData)){ @@ -26,19 +26,19 @@ if (!isset($_GET['name'])) { } else { ?> <!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> <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" /> <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" /> - <? 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/stylesheetgallery.js?v=<?=filemtime(STATIC_SERVER.'functions/stylesheetgallery.js')?>"></script> - <? } ?> +<? } ?> </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"> <h1 class="hidden">Gazelle</h1> <div id="header"> @@ -110,39 +110,38 @@ if (!isset($_GET['name'])) { <span class="hidden">Artist: </span> <form class="search_form" name="artists" action="" method="get"> <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> </form> </li> <li id="searchbar_requests"> <span class="hidden">Requests: </span> <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> </li> <li id="searchbar_forums"> <span class="hidden">Forums: </span> <form class="search_form" name="forums" action="" method="get"> <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> </li> <li id="searchbar_log"> <span class="hidden">Log: </span> <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> </li> <li id="searchbar_users"> <span class="hidden">Users: </span> <form class="search_form" name="users" action="" method="get"> <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> </li> </ul> </div> - </div> <div id="content"> <div class="thin"> @@ -152,11 +151,11 @@ if (!isset($_GET['name'])) { <table class="forum_index"> <tbody> <tr class="colhead"> - <td style="width:2%;"></td> - <td style="width:25%;">Forum</td> + <td style="width: 2%;"></td> + <td style="width: 25%;">Forum</td> <td>Last post</td> - <td style="width:7%;">Topics</td> - <td style="width:7%;">Posts</td> + <td style="width: 7%;">Topics</td> + <td style="width: 7%;">Posts</td> </tr> <tr class="rowb"> <td title="Unread" class="unread"></td> @@ -166,13 +165,13 @@ if (!isset($_GET['name'])) { </h4> </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> </span> <span title="Jump to last read" class="last_read" style="float: left;"> <a href="#"></a> </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>385</td> <td>95,197</td> @@ -181,14 +180,14 @@ if (!isset($_GET['name'])) { <td title="Read" class="read"></td> <td> <h4 class="min_padding"> - <a href="#">What.CD</a> + <a href="#"><?=SITE_NAME?></a> </h4> </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> </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>2,624</td> <td>110,432</td> @@ -198,11 +197,11 @@ if (!isset($_GET['name'])) { <h3>Community</h3> <table class="forum_index"> <tbody><tr class="colhead"> - <td style="width:2%;"></td> - <td style="width:25%;">Forum</td> + <td style="width: 2%;"></td> + <td style="width: 25%;">Forum</td> <td>Last post</td> - <td style="width:7%;">Topics</td> - <td style="width:7%;">Posts</td> + <td style="width: 7%;">Topics</td> + <td style="width: 7%;">Posts</td> </tr> <tr class="rowb"> <td title="Unread" class="unread"></td> @@ -212,13 +211,13 @@ if (!isset($_GET['name'])) { </h4> </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> </span> <span title="Jump to last read" class="last_read" style="float: left;"> <a href="#"></a> </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>37,531</td> <td>1,545,089</td> @@ -231,10 +230,10 @@ if (!isset($_GET['name'])) { </h4> </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> </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>424</td> <td>490,163</td> @@ -247,10 +246,10 @@ if (!isset($_GET['name'])) { </h4> </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> </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>424</td> <td>490,163</td> @@ -263,10 +262,10 @@ if (!isset($_GET['name'])) { </h4> </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> </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>305</td> <td>15,231</td> @@ -279,13 +278,13 @@ if (!isset($_GET['name'])) { </h4> </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> </span> <span title="Jump to last read" class="last_read" style="float: left;"> <a href="#"></a> </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>25,031</td> <td>386,278</td> @@ -296,11 +295,11 @@ if (!isset($_GET['name'])) { <table class="forum_index"> <tbody> <tr class="colhead"> - <td style="width:2%;"></td> - <td style="width:25%;">Forum</td> + <td style="width: 2%;"></td> + <td style="width: 25%;">Forum</td> <td>Last post</td> - <td style="width:7%;">Topics</td> - <td style="width:7%;">Posts</td> + <td style="width: 7%;">Topics</td> + <td style="width: 7%;">Posts</td> </tr> <tr class="rowb"> <td title="Unread" class="unread"></td> @@ -310,13 +309,13 @@ if (!isset($_GET['name'])) { </h4> </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> </span> <span title="Jump to last read" class="last_read" style="float: left;"> <a href="#"></a> </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>22,564</td> <td>608,253</td> @@ -329,10 +328,10 @@ if (!isset($_GET['name'])) { </h4> </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> </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>3,948</td> <td>24,269</td> @@ -344,6 +343,6 @@ if (!isset($_GET['name'])) { </div> </body> </html> -<? +<? } -}
\ No newline at end of file +} diff --git a/sections/user/user.php b/sections/user/user.php index b02efdd..9ba539a 100644 --- a/sections/user/user.php +++ b/sections/user/user.php @@ -120,7 +120,7 @@ if (check_perms('users_mod')) { // Person viewing is a staff member $DisplayCustomTitle = $CustomTitle; if (check_perms('site_proxy_images') && !empty($CustomTitle)) { $DisplayCustomTitle = preg_replace_callback('~src=("?)(http.+?)(["\s>])~', function($Matches) { - return 'src='.$Matches[1].'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($Matches[2]).$Matches[3]; + return 'src=' . $Matches[1] . ImageTools::process($Matches[2]) . $Matches[3]; }, $CustomTitle); } @@ -535,16 +535,14 @@ if ($Snatched > 4 && check_paranoia_here('snatched')) { ?> <table class="layout recent" id="recent_snatches" cellpadding="0" cellspacing="0" border="0"> <tr class="colhead"> - <td colspan="5">Recent snatches</td> + <td colspan="5"> + <a href="#recent_snatches"><strong>↑</strong></a> Recent snatches + </td> </tr> <tr> -<? - foreach ($RecentSnatches as $RS) { - if (check_perms('site_proxy_images')) { - $RS['WikiImage'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($RS['WikiImage']); - } ?> +<? foreach ($RecentSnatches as $RS) { ?> <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> <? } ?> </tr> @@ -580,15 +578,14 @@ if ($Uploads > 4 && check_paranoia_here('uploads')) { ?> <table class="layout recent" id="recent_uploads" cellpadding="0" cellspacing="0" border="0"> <tr class="colhead"> - <td colspan="5">Recent uploads</td> + <td colspan="5"> + <a href="#recent_uploads"><strong>↑</strong></a> Recent uploads + </td> </tr> <tr> -<? foreach ($RecentUploads as $RU) { - if (check_perms('site_proxy_images')) { - $RU['WikiImage'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($RU['WikiImage']); - } ?> +<? foreach ($RecentUploads as $RU) { ?> <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> <? } ?> </tr> @@ -610,14 +607,14 @@ foreach ($Collages as $CollageInfo) { ORDER BY ct.Sort LIMIT 5"); $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"> <td colspan="5"> <span style="float:left;"> - <?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>" class="brackets">See full</a> + <a href="#collage<?=$CollageID?>_box"><strong>↑</strong></a> <?=display_str($CName)?> - <a href="collages.php?id=<?=$CollageID?>" class="brackets">See full</a> </span> <span style="float:right;"> - <a href="#" onclick="$('#collage<?=$CollageID?> .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> </td> </tr> @@ -630,13 +627,9 @@ foreach ($Collages as $CollageInfo) { $Name = ''; $Name .= Artists::display_artists(array('1'=>$Artists), false, true); $Name .= $GroupName; - - if (check_perms('site_proxy_images')) { - $C['WikiImage'] = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?i='.urlencode($C['WikiImage']); - } ?> <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> <? } ?> </tr> @@ -658,8 +651,10 @@ if ((check_perms('users_view_invites')) && $Invited > 0) { include(SERVER_ROOT.'/classes/class_invite_tree.php'); $Tree = new INVITE_TREE($UserID, array('visible'=>false)); ?> - <div class="box"> - <div class="head">Invite tree <a href="#" onclick="$('#invitetree').toggle();return false;" class="brackets">View</a></div> + <div class="box" id="invitetree_box"> + <div class="head"> + <a href="#invitetree_box"><strong>↑</strong></a> Invite tree <a href="#" onclick="$('#invitetree').toggle();return false;" class="brackets">View</a> + </div> <div id="invitetree" class="hidden"> <? $Tree->make_tree(); ?> </div> @@ -688,8 +683,10 @@ if (check_paranoia_here('requestsvoted_list')) { if ($DB->record_count() > 0) { $Requests = $DB->to_array(); ?> - <div class="box"> - <div class="head">Requests <a href="#" onclick="$('#requests').toggle();return false;" class="brackets">View</a></div> + <div class="box" id="requests_box"> + <div class="head"> + <a href="#requests_box"><strong>↑</strong></a> Requests <a href="#" onclick="$('#requests').toggle();return false;" class="brackets">View</a> + </div> <div id="requests" class="request_table hidden"> <table cellpadding="6" cellspacing="1" border="0" class="border" width="100%"> <tr class="colhead_dark"> @@ -787,8 +784,10 @@ if (check_perms('users_mod', $Class) || $IsFLS) { if ($DB->record_count()) { $StaffPMs = $DB->to_array(); ?> - <div class="box"> - <div class="head">Staff PMs <a href="#" onclick="$('#staffpms').toggle();return false;" class="brackets">View</a></div> + <div class="box" id="staffpms_box"> + <div class="head"> + <a href="#staffpms_box"><strong>↑</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"> <tr class="colhead"> <td>Subject</td> @@ -856,8 +855,9 @@ if (check_perms('users_mod', $Class)) { ?> <input type="hidden" name="userid" value="<?=$UserID?>" /> <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" /> - <div class="box"> - <div class="head">Staff notes + <div class="box" id="staff_notes_box"> + <div class="head"> + <a href="#staff_notes_box"><strong>↑</strong></a> Staff notes <a href="#" name="admincommentbutton" onclick="ChangeTo('text'); return false;" class="brackets">Edit</a> <a href="#" onclick="$('#staffnotes').toggle(); return false;" class="brackets">Toggle</a> </div> @@ -872,9 +872,11 @@ if (check_perms('users_mod', $Class)) { ?> </div> </div> - <table class="layout"> + <table class="layout" id="user_info_box"> <tr class="colhead"> - <td colspan="2">User information</td> + <td colspan="2"> + <a href="#user_info_box"><strong>↑</strong></a> User information + </td> </tr> <? if (check_perms('users_edit_usernames', $Class)) { ?> <tr> @@ -1055,9 +1057,11 @@ if (check_perms('users_mod', $Class)) { ?> </table><br /> <? if (check_perms('users_warn')) { ?> - <table class="layout"> + <table class="layout" id="warn_user_box"> <tr class="colhead"> - <td colspan="2">Warn user</td> + <td colspan="2"> + <a href="#warn_user_box"><strong>↑</strong></a> Warn user + </td> </tr> <tr> <td class="label">Warned:</td> @@ -1112,8 +1116,12 @@ if (check_perms('users_mod', $Class)) { ?> </tr> <? } ?> </table><br /> - <table class="layout"> - <tr class="colhead"><td colspan="2">User privileges</td></tr> + <table class="layout" id="user_privs_box"> + <tr class="colhead"> + <td colspan="2"> + <a href="#user_privs_box"><strong>↑</strong></a> User privileges + </td> + </tr> <? 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"); $Emails = $DB->to_array(); @@ -1165,8 +1173,9 @@ if (check_perms('users_mod', $Class)) { ?> <option value="1"<? if ($Enabled=='1') { ?> selected="selected"<? } ?>>Enabled</option> <option value="2"<? if ($Enabled=='2') { ?> selected="selected"<? } ?>>Disabled</option> <? if (check_perms('users_delete_users')) { ?> - <optgroup label="-- WARNING --"></optgroup> - <option value="delete">Delete account</option> + <optgroup label="-- WARNING --"> + <option value="delete">Delete account</option> + </optgroup> <? } ?> </select> </td> @@ -1193,8 +1202,12 @@ if (check_perms('users_mod', $Class)) { ?> <? } ?> </table><br /> <? if (check_perms('users_logout')) { ?> - <table class="layout"> - <tr class="colhead"><td colspan="2">Session</td></tr> + <table class="layout" id="session_box"> + <tr class="colhead"> + <td colspan="2"> + <a href="#session_box"><strong>↑</strong></a> Session + </td> + </tr> <tr> <td class="label">Reset session:</td> <td><input type="checkbox" name="ResetSession" id="ResetSession" /></td> @@ -1206,8 +1219,12 @@ if (check_perms('users_mod', $Class)) { ?> </table> <? } ?> - <table class="layout"> - <tr class="colhead"><td colspan="2">Submit</td></tr> + <table class="layout" id="submit_box"> + <tr class="colhead"> + <td colspan="2"> + <a href="#submit_box"><strong>↑</strong></a> Submit + </td> + </tr> <tr> <td class="label"><span title="This message will be entered into staff notes only.">Reason:</span></td> <td> diff --git a/sections/userhistory/post_history.php b/sections/userhistory/post_history.php index 4f3e303..af776f1 100644 --- a/sections/userhistory/post_history.php +++ b/sections/userhistory/post_history.php @@ -46,10 +46,6 @@ if (($UserInfo = $Cache->get_value('user_info_'.$UserID)) === false) { 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&i='.urlencode($Avatar); -} - View::show_header('Post history for '.$Username,'subscriptions,comments,bbcode'); if ($LoggedUser['CustomForums']) { @@ -305,7 +301,7 @@ if (empty($Results)) { <? 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" /> <? } ?> diff --git a/sections/userhistory/subscribed_collages.php b/sections/userhistory/subscribed_collages.php index 58e18d7..ce370c2 100644 --- a/sections/userhistory/subscribed_collages.php +++ b/sections/userhistory/subscribed_collages.php @@ -138,7 +138,7 @@ if (!$NumResults) { <td colspan="5" class="big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> + <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?> </div> <? endif; ?> <div class="group_info clear"> @@ -217,7 +217,7 @@ if (!$NumResults) { <td class="big_info"> <? if ($LoggedUser['CoverArt']) : ?> <div class="group_image float_left clear"> - <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?> + <? ImageTools::cover_thumb($WikiImage, $GroupCategoryID) ?> </div> <? endif; ?> <div class="group_info clear"> diff --git a/sections/userhistory/subscriptions.php b/sections/userhistory/subscriptions.php index 6bf8043..7d74fd3 100644 --- a/sections/userhistory/subscriptions.php +++ b/sections/userhistory/subscriptions.php @@ -168,13 +168,10 @@ if (!$NumResults) { <tr class="row<?=$ShowCollapsed ? ' hidden' : '' ?>"> <? if (empty($HeavyInfo['DisableAvatars'])) { ?> <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)) { - $AuthorAvatar = 'http'.($SSL?'s':'').'://'.SITE_URL.'/image.php?c=1&i='.urlencode($AuthorAvatar); ?> - <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" /> +<? if ($AuthorAvatar) { ?> + <img src="<?=ImageTools::process($AuthorAvatar)?>" width="150" style="max-height: 400px;" alt="<?=$AuthorName?>'s avatar" /> <? } 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> <? } ?> diff --git a/sections/wiki/article.php b/sections/wiki/article.php index f77b9ff..6605e15 100644 --- a/sections/wiki/article.php +++ b/sections/wiki/article.php @@ -68,7 +68,7 @@ View::show_header($Title,'wiki,bbcode'); /> <input value="Search" type="submit" class="hidden" /> </form> - <br style="line-height:10px;" /> + <br style="line-height: 10px;" /> <strong><a href="wiki.php?action=browse" class="brackets">Browse articles</a></strong> </div> </div> @@ -104,7 +104,7 @@ View::show_header($Title,'wiki,bbcode'); $i = 0; foreach ($AliasArray as $AliasItem) { ?> - <li id="alias_<?=$AliasItem?>"><a href="wiki.php?action=article&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&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++; } } diff --git a/static/functions/bbcode.js b/static/functions/bbcode.js index bf9e985..4014e13 100644 --- a/static/functions/bbcode.js +++ b/static/functions/bbcode.js @@ -1,6 +1,6 @@ var BBCode = { spoiler: function(link) { - if($(link.nextSibling).has_class('hidden')) { + if ($(link.nextSibling).has_class('hidden')) { $(link.nextSibling).show(); $(link).html('Hide'); } else { diff --git a/static/functions/browse.js b/static/functions/browse.js index 8db5822..b210f06 100644 --- a/static/functions/browse.js +++ b/static/functions/browse.js @@ -1,5 +1,5 @@ function show_peers (TorrentID, Page) { - if(Page>0) { + if (Page > 0) { ajax.get('torrents.php?action=peerlist&page='+Page+'&torrentid=' + TorrentID,function(response){ $('#peers_' + TorrentID).show().raw().innerHTML=response; }); @@ -20,7 +20,7 @@ function show_peers (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){ $('#snatches_' + TorrentID).show().raw().innerHTML=response; }); @@ -41,7 +41,7 @@ function show_snatches (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){ $('#downloads_' + TorrentID).show().raw().innerHTML=response; }); diff --git a/static/functions/class_ajax.js b/static/functions/class_ajax.js index f283fe3..86d5c97 100644 --- a/static/functions/class_ajax.js +++ b/static/functions/class_ajax.js @@ -139,7 +139,7 @@ function Bookmark(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() { $('#group_' + id).remove(); $('.groupid_' + id).remove(); diff --git a/static/functions/iphone.js b/static/functions/iphone.js index ba992da..b454e74 100644 --- a/static/functions/iphone.js +++ b/static/functions/iphone.js @@ -56,7 +56,7 @@ function main () { get_headers(response); elements.titles[0].innerHTML = title; elements.pages[0].innerHTML = response; - if(back_name){ + if (back_name) { elements.buttons[0].textContent = back_name; } }); @@ -78,7 +78,7 @@ function go_back() { // Get data from comments function get_headers(response) { title = response.match(/\<\!\-\-Title\:(.+?)\-\-\>/i)[1]; - if(response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)) { + if (response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)) { back_name = response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)[1]; back_url = response.match(/\<\!\-\-Back\:(.+?)\:(.+?)\-\-\>/i)[2]; } else { @@ -89,10 +89,16 @@ function get_headers(response) { // Load content function load(url,forward,formid) { - if(forward===undefined) { forward=true; } - if (transitions_in_progress && document.createTouch) { return; } //OS 2 - if (moved_after_touch) { return; } - if(formid===undefined){ + if (forward === undefined) { + forward = true; + } + if (transitions_in_progress && document.createTouch) { // OS 2 + return; + } + if (moved_after_touch) { + return; + } + if (formid === undefined){ ajax.get(url, function (response) { get_headers(response); transition_to_new_element(response, forward); @@ -105,12 +111,18 @@ function load(url,forward,formid) { // Moves var moved_after_touch = false; -function touch_started () { moved_after_touch = false; }; -function touch_moved () { moved_after_touch = true; }; +function touch_started () { + moved_after_touch = false; +}; +function touch_moved () { + moved_after_touch = true; +}; // Transitions 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) { transitions_in_progress = true; diff --git a/static/functions/push_settings.js b/static/functions/push_settings.js index 218270f..685971c 100644 --- a/static/functions/push_settings.js +++ b/static/functions/push_settings.js @@ -2,16 +2,16 @@ var PUSHOVER = 5; var TOASTY = 4; $(document).ready(function() { - if($("#pushservice").val() > 0) { + if ($("#pushservice").val() > 0) { $('#pushsettings').show(); } $("#pushservice").change(function() { - if($(this).val() > 0) { + if ($(this).val() > 0) { $('#pushsettings').show(500); - if($(this).val() == TOASTY) { + if ($(this).val() == TOASTY) { $('#pushservice_title').text("Device ID"); - } else if($(this).val() == PUSHOVER) { + } else if ($(this).val() == PUSHOVER) { $('#pushservice_title').text("User Key"); } else { $('#pushservice_title').text("API Key"); diff --git a/static/functions/recommend.js b/static/functions/recommend.js index 1d1afcd..16172d5 100644 --- a/static/functions/recommend.js +++ b/static/functions/recommend.js @@ -8,7 +8,7 @@ id = $("#recommendation_div").data('id'); $("#recommend").click(function() { $("#recommendation_div").slideToggle(150); - if(!loaded) { + if (!loaded) { $("#recommendation_status").html("Loading..."); $.ajax({ type : "POST", diff --git a/static/functions/reportsv2.js b/static/functions/reportsv2.js index 982d000..9919c48 100644 --- a/static/functions/reportsv2.js +++ b/static/functions/reportsv2.js @@ -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) { var x = json.decode(response); $('#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; $('#upload' + reportid).raw().checked = false; } else { @@ -23,7 +23,7 @@ function ChangeResolve(reportid) { function Load(reportid) { var t = $('#type' + reportid).raw().value; 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; 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) { var x = json.decode(response); $('#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; $('#upload' + reportid).raw().checked = false; } else { @@ -52,7 +52,7 @@ function ErrorBox(reportid, message) { } function HideErrors() { - if($('#error_box')) { + if ($('#error_box')) { $('#error_box').remove(); } } @@ -60,14 +60,14 @@ function HideErrors() { function TakeResolve(reportid) { $('#submit_' + reportid).disable(); ajax.post("reportsv2.php?action=takeresolve","reportform_" + reportid, function (response) { - if(response) { + if (response) { ErrorBox(reportid, response); } 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; } else { $('#report' + reportid).remove(); - if($('#dynamic').raw().checked) { + if ($('#dynamic').raw().checked) { NewReport(1); } } @@ -76,17 +76,17 @@ function TakeResolve(reportid) { } 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"; - if(view) { + if (view) { url += "&view=" + view; } - if(id) { + if (id) { url += "&id=" + id; } ajax.get(url, function (response) { - if(response) { + if (response) { var div = document.createElement("div"); div.id = "report"; div.innerHTML = response; @@ -94,12 +94,12 @@ function NewReport(q, view, id) { var id = $('#newreportid').raw().value; Load(id); $('#newreportid').remove(); - if($('#no_reports').results()) { + if ($('#no_reports').results()) { $('#all_reports').raw().removeChild($('#no_reports').raw()); } } else { //No new reports at this time - if(!$('#report').results() && !$('#no_reports').results()) { + if (!$('#report').results() && !$('#no_reports').results()) { var div = document.createElement("div"); div.id = "no_reports"; div.innerHTML = "<table class='layout'><tr><td class='center'><strong>No new reports! \\o/</strong></td></tr></table>"; @@ -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 var x = 10; var a = $('#repop_amount').raw().value; - if(a) { - if(!isNaN(a) && a <= 50) { + if (a) { + if (!isNaN(a) && a <= 50) { x = a; } } - if(document.getElementsByName("reportid").length + x <= 50) { + if (document.getElementsByName("reportid").length + x <= 50) { NewReport(x, view, id); } else { NewReport(50 - document.getElementsByName("reportid").length, view, id); @@ -129,7 +129,7 @@ function AddMore(view, id) { function SendPM(reportid) { ajax.post("reportsv2.php?action=ajax_take_pm", "reportform_" + reportid, function (response) { - if(response) { + if (response) { $('#uploader_pm' + reportid).raw().value = response; } else { $('#uploader_pm' + reportid).raw().value = ""; @@ -139,18 +139,18 @@ function SendPM(reportid) { function UpdateComment(reportid) { ajax.post("reportsv2.php?action=ajax_update_comment", "reportform_" + reportid, function (response) { - if(response) { + if (response) { alert(response); } }); } function GiveBack(id) { - if(!id) { + if (!id) { 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) { - if(response) { + if (response) { alert(response); } });*/ @@ -158,7 +158,7 @@ function GiveBack(id) { } } else { ajax.get("ajax.php?action=giveback_report&id=" + id, function (response) { - if(response) { + if (response) { alert(response); } }); @@ -189,9 +189,9 @@ function ClearReport(reportid) { } function Grab(reportid) { - if(reportid) { + if (reportid) { ajax.get("reportsv2.php?action=ajax_grab_report&id=" + reportid, function (response) { - if(response == '1') { + if (response == '1') { $('#grab' + reportid).raw().disabled = true; } else { alert('Grab failed for some reason :/'); @@ -199,9 +199,9 @@ function Grab(reportid) { }); } else { 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) { - if(response != '1') { + if (response != '1') { 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) { //Returns new report ID. - if(isNaN(response)) { + if (isNaN(response)) { alert(response); } else { window.location = 'reportsv2.php?view=report&id=' + response; diff --git a/static/functions/subscriptions.js b/static/functions/subscriptions.js index f215810..9f7749a 100644 --- a/static/functions/subscriptions.js +++ b/static/functions/subscriptions.js @@ -1,8 +1,8 @@ function Subscribe(topicid) { ajax.get("userhistory.php?action=thread_subscribe&topicid=" + topicid + "&auth=" + authkey, function() { var subscribeLink = $("#subscribelink" + topicid).raw(); - if(subscribeLink) { - if(subscribeLink.firstChild.nodeValue.charAt(0) == '[') { + if (subscribeLink) { + if (subscribeLink.firstChild.nodeValue.charAt(0) == '[') { subscribeLink.firstChild.nodeValue = subscribeLink.firstChild.nodeValue.charAt(1) == 'U' ? '[Subscribe]' : '[Unsubscribe]'; @@ -19,10 +19,10 @@ function Subscribe(topicid) { function Collapse() { var collapseLink = $('#collapselink').raw(); var hide = (collapseLink.innerHTML.substr(0,1) == 'H' ? 1 : 0); - if($('.row').results() > 0) { + if ($('.row').results() > 0) { $('.row').toggle(); } - if(hide) { + if (hide) { collapseLink.innerHTML = 'Show post bodies'; } else { collapseLink.innerHTML = 'Hide post bodies'; diff --git a/static/functions/torrent.js b/static/functions/torrent.js index 2e30943..0db1539 100644 --- a/static/functions/torrent.js +++ b/static/functions/torrent.js @@ -34,7 +34,7 @@ function ArtistManager() { var elArtistList = ArtistList.cloneNode(true); 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) { case 'artist_main': importance = 1; @@ -170,9 +170,9 @@ function SelectArtist(e,obj) { } Dir = (EndBox > StartBox ? 1 : -1); 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); - $('#artistmanager_box'+i).raw().checked = checked; + $('#artistmanager_box' + i).raw().checked = checked; } StartBox = Number(obj.id.substr(17)); } @@ -180,7 +180,7 @@ function SelectArtist(e,obj) { function ArtistManagerSubmit() { var Selection = new Array(); 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) { Selection.push(boxes.raw(i).value); if (boxes.raw(i).value.substr(0,1) == '1') { diff --git a/static/functions/upload.js b/static/functions/upload.js index 8ffa231..78bf87e 100644 --- a/static/functions/upload.js +++ b/static/functions/upload.js @@ -7,7 +7,7 @@ function Categories() { } function Remaster() { - if($('#remaster').raw().checked) { + if ($('#remaster').raw().checked) { $('#remaster_true').show(); } else { $('#remaster_true').hide(); @@ -16,9 +16,9 @@ function Remaster() { } 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++) { - if($('#bitrate').raw().options[i].value == 'Lossless') { + if ($('#bitrate').raw().options[i].value == 'Lossless') { $('#bitrate').raw()[i].selected = true; } } @@ -29,7 +29,7 @@ function Format() { $('#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>'; } else { $('#format_warning').raw().innerHTML = ''; @@ -38,7 +38,7 @@ function Format() { function Bitrate() { $('#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(); } else { $('#other_bitrate_span').hide(); @@ -46,7 +46,7 @@ function Bitrate() { } function AltBitrate() { - if($('#other_bitrate').raw().value >= 320) { + if ($('#other_bitrate').raw().value >= 320) { $('#vbr').raw().disabled = true; $('#vbr').raw().checked = false; } else { @@ -55,9 +55,9 @@ function AltBitrate() { } function add_tag() { - if($('#tags').raw().value == "") { + if ($('#tags').raw().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 { $('#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; function AddLogField() { - if(LogCount >= 200) { + if (LogCount >= 200) { return; } var LogField = document.createElement("input"); @@ -81,7 +81,7 @@ function AddLogField() { } function RemoveLogField() { - if(LogCount == 1) { + if (LogCount == 1) { return; } var x = $('#logfields').raw(); @@ -94,7 +94,7 @@ function RemoveLogField() { var ExtraLogCount = 1; function AddExtraLogField(id) { - if(LogCount >= 200) { + if (LogCount >= 200) { return; } var LogField = document.createElement("input"); @@ -109,7 +109,7 @@ function AddExtraLogField(id) { } function RemoveLogField() { - if(LogCount == 1) { + if (LogCount == 1) { return; } var x = $('#logfields').raw(); @@ -122,7 +122,7 @@ function RemoveLogField() { var FormatCount = 0; function AddFormat() { - if(FormatCount >= 10) { + if (FormatCount >= 10) { return; } FormatCount++; @@ -157,14 +157,14 @@ function AddFormat() { NewCell2 = document.createElement("td"); tmp = '<select id="releasetype" name="extra_formats[]"><option value="">---</option>'; var formats=["Saab","Volvo","BMW"]; - for(var i in formats) { - tmp += "<option value='"+formats[i]+"'>"+formats[i]+"</option>\n"; + for (var i in formats) { + tmp += '<option value="'+formats[i]+'">'+formats[i]+"</option>\n"; } tmp += "</select>"; var bitrates=["1","2","3"]; tmp += '<select id="releasetype" name="extra_bitrates[]"><option value="">---</option>'; - for(var i in bitrates) { - tmp += "<option value='"+bitrates[i]+"'>"+bitrates[i]+"</option>\n"; + for (var i in bitrates) { + tmp += '<option value="'+bitrates[i]+'">'+bitrates[i]+"</option>\n"; } tmp += "</select>"; @@ -188,7 +188,7 @@ function AddFormat() { } function RemoveFormat() { - if(FormatCount == 0) { + if (FormatCount == 0) { return; } $('#extras').raw().value = FormatCount; @@ -209,7 +209,7 @@ function RemoveFormat() { var ArtistCount = 1; function AddArtistField() { - if(ArtistCount >= 200) { + if (ArtistCount >= 200) { return; } var ArtistField = document.createElement("input"); @@ -238,7 +238,7 @@ function AddArtistField() { } function RemoveArtistField() { - if(ArtistCount == 1) { + if (ArtistCount == 1) { return; } var x = $('#artistfields').raw(); @@ -259,15 +259,15 @@ function CheckVA () { function CheckYear() { 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"; } 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(); $('#remaster').raw().checked = true; $('#remaster_true').show(); - } else if($('#unknown').raw().checked) { + } else if ($('#unknown').raw().checked) { $('#remaster').raw().checked = true; $('#yearwarning').hide(); $('#remaster_true').show(); @@ -277,13 +277,13 @@ function CheckYear() { } function ToggleUnknown() { - if($('#unknown').raw().checked) { + if ($('#unknown').raw().checked) { $('#remaster_year').raw().value = ""; $('#remaster_title').raw().value = ""; $('#remaster_record_label').raw().value = ""; $('#remaster_catalogue_number').raw().value = ""; - if($('#groupremasters').raw()) { + if ($('#groupremasters').raw()) { $('#groupremasters').raw().selectedIndex = 0; $('#groupremasters').raw().disabled = true; } @@ -298,7 +298,7 @@ function ToggleUnknown() { $('#remaster_record_label').raw().disabled = false; $('#remaster_catalogue_number').raw().disabled = false; - if($('#groupremasters').raw()) { + if ($('#groupremasters').raw()) { $('#groupremasters').raw().disabled = false; } } @@ -307,7 +307,7 @@ function ToggleUnknown() { function GroupRemaster() { var remasters = json.decode($('#json_remasters').raw().value); var index = $('#groupremasters').raw().options[$('#groupremasters').raw().selectedIndex].value; - if(index != "") { + if (index != "") { $('#remaster_year').raw().value = remasters[index][1]; $('#remaster_title').raw().value = remasters[index][2]; $('#remaster_record_label').raw().value = remasters[index][3]; diff --git a/static/functions/user.js b/static/functions/user.js index f5a2856..b9013f1 100644 --- a/static/functions/user.js +++ b/static/functions/user.js @@ -4,7 +4,7 @@ function ChangeTo(to) { $('#admincomment').show(); resize('admincomment'); 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;"); } } else if (to == "links") { @@ -13,7 +13,7 @@ function ChangeTo(to) { $('#admincomment').hide(); $('#admincommentlinks').show(); 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;"); } }) diff --git a/static/functions/valid_tags.js b/static/functions/valid_tags.js index e36a870..f752d6e 100644 --- a/static/functions/valid_tags.js +++ b/static/functions/valid_tags.js @@ -9,7 +9,7 @@ var tags = new Object(); function isValidTag(value) { var toReturn = false; - if(tags[value] == true) { + if (tags[value] == true) { toReturn = true; } return toReturn; diff --git a/static/functions/validate.js b/static/functions/validate.js index dbfb514..eb872ff 100644 --- a/static/functions/validate.js +++ b/static/functions/validate.js @@ -1,5 +1,5 @@ -var elemStyles=Array(); -var errorElems=Array(); +var elemStyles = Array(); +var errorElems = Array(); function validEmail(str) { 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) { if (str.match(/^(https?):\/\/([a-z0-9\-\_]+\.)+([a-z]{1,5}[^\.])(\/[^<>]+)*$/i)) { return true; - } else { return false; } + } else { + return false; + } } function isNumeric(str,usePeriod) { - matchStr='/[^0-9'; + matchStr = '/[^0-9'; if (usePeriod) { - matchStr+='\.'; + matchStr += '\.'; } - matchStr=']/'; + matchStr = ']/'; - if (str.match(matchStr)) { return false; } + if (str.match(matchStr)) { + return false; + } return true; } function validDate(theDate) { - days=0; + days = 0; - theDate=theDate.split("/"); - month=theDate[0]; - day=theDate[1]; - year=theDate[2]; + theDate = theDate.split("/"); + month = theDate[0]; + day = theDate[1]; + year = theDate[2]; if (!isNumeric(month) || !isNumeric(day) || !isNumeric(year)) { return false; } - 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==3) { days=31; } - else if (month==4) { days=30; } - else if (month==5) { days=31; } - else if (month==6) { days=30; } - 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 (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 == 3) { days = 31; } + else if (month == 4) { days = 30; } + else if (month == 5) { days = 31; } + else if (month == 6) { days = 30; } + 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; + } } function showError(fields,alertStr) { var tField=Array(); - if (typeof(fields)=='object') { tField[0]=fields; } else { tField=fields.split(','); } - for(s=0; s<=tField.length-1; s++) { + if (typeof(fields) == 'object') { + tField[0] = fields; + } else { + tField = fields.split(','); + } + for (s = 0; s <= tField.length - 1; s++) { if ($('#'+tField[s])) { $('#'+tField[s]).className=$('#'+tField[s]).className+" elem_error"; - if (s==0) { + if (s == 0) { $('#'+tField[s]).focus(); - try { $('#'+tField[s]).select(); } catch (error) { } + try { + $('#'+tField[s]).select(); + } catch (error) { + } } - errorElems[errorElems.length]=tField[s]; - if ($('#'+tField[s]).type!="select-one") { + errorElems[errorElems.length] = tField[s]; + if ($('#'+tField[s]).type != "select-one") { $('#'+tField[s]).onkeypress=function() { clearElemError(); }; } else { $('#'+tField[s]).onchange=function() { clearElemError(); }; @@ -73,34 +93,36 @@ function showError(fields,alertStr) { } } - if (alertStr!="") { alert(alertStr); } + if (alertStr != "") { + alert(alertStr); + } return false; } function clearErrors(theForm) { - elementList=document.forms[theForm].elements; - for(x=0; x<=elementList.length-1; x++) { - if (elementList[x].type!="submit" && elementList[x].type!="button") { + elementList = document.forms[theForm].elements; + for (x = 0; x <= elementList.length - 1; x++) { + if (elementList[x].type != "submit" && elementList[x].type != "button") { if (!elemStyles[elementList[x].id]) { - elemStyles[elementList[x].id]=elementList[x].className; + elemStyles[elementList[x].id] = elementList[x].className; } try { - elementList[x].className=elemStyles[elementList[x].id]; + elementList[x].className = elemStyles[elementList[x].id]; } catch (error) { } } } } function clearElemError(evt) { - for(x=0; x<=errorElems.length-1; x++) { - elem=$('#'+errorElems[x]); - if ($('#'+elem).type!="select-one") { - $('#'+elem).onkeypress=""; + for (x = 0; x <= errorElems.length - 1; x++) { + elem = $('#'+errorElems[x]); + if ($('#'+elem).type != "select-one") { + $('#'+elem).onkeypress = ""; } else { - $('#'+elem).onchange=""; + $('#'+elem).onchange = ""; } - elem.className=elemStyles[elem.id]; + elem.className = elemStyles[elem.id]; } - errorElems=Array(); + errorElems = Array(); } diff --git a/static/functions/validate_upload.js b/static/functions/validate_upload.js index e464bd7..0694b04 100644 --- a/static/functions/validate_upload.js +++ b/static/functions/validate_upload.js @@ -2,9 +2,9 @@ $(document).ready(function () { // Upload button is clicked $("#post").click(function(e) { - // Make sure "Music" category is selected. - if($("#categories").find(":selected").val() == 0) { - checkHasMainArtist(e); + // Make sure "Music" category is selected. + if ($("#categories").find(":selected").val() == 0) { + checkHasMainArtist(e); } }); @@ -14,16 +14,15 @@ function checkHasMainArtist(e) { var has_main = false; $("select[id^=importance]").each(function() { - if($(this).find(":selected").val() == 1) { + if ($(this).find(":selected").val() == 1) { has_main = true; } }); - if(!has_main) { + if (!has_main) { alert('A "Main" artist is required'); // Don't POST the form. e.preventDefault(); } } }); - -})(jQuery);
\ No newline at end of file +})(jQuery); |