From 947a3ddab44b80a580551a9e1aa3157ddd17193a Mon Sep 17 00:00:00 2001 From: Git Date: Thu, 15 May 2014 08:00:27 +0000 Subject: [PATCH] Empty commit --- classes/cache.class.php | 4 +- gazelle.sql | 1 + sections/ajax/better/single.php | 19 ++++---- sections/better/single.php | 17 ++++--- sections/forums/delete.php | 4 ++ sections/schedule/index.php | 1 + sections/user/connchecker.php | 78 +-------------------------------- 7 files changed, 27 insertions(+), 97 deletions(-) diff --git a/classes/cache.class.php b/classes/cache.class.php index 77da0f5a..5f759f14 100644 --- a/classes/cache.class.php +++ b/classes/cache.class.php @@ -83,7 +83,7 @@ public function cache_value($Key, $Value, $Duration = 2592000) { if (!$this->set($Key, $Value, 0, $Duration)) { trigger_error("Cache insert failed for key $Key"); } - if (array_key_exists($Key, $this->CacheHits)) { + if ($this->InternalCache && array_key_exists($Key, $this->CacheHits)) { $this->CacheHits[$Key] = $Value; } $this->Time += (microtime(true) - $StartTime) * 1000; @@ -100,7 +100,7 @@ public function add_value($Key, $Value, $Duration = 2592000) { public function replace_value($Key, $Value, $Duration = 2592000) { $StartTime = microtime(true); $this->replace($Key, $Value, false, $Duration); - if (array_key_exists($Key, $this->CacheHits)) { + if ($this->InternalCache && array_key_exists($Key, $this->CacheHits)) { $this->CacheHits[$Key] = $Value; } $this->Time += (microtime(true) - $StartTime) * 1000; diff --git a/gazelle.sql b/gazelle.sql index 03573e9c..119ef055 100644 --- a/gazelle.sql +++ b/gazelle.sql @@ -828,6 +828,7 @@ CREATE TABLE `sphinx_delta` ( `FileList` mediumtext, `Description` text, `VoteScore` float NOT NULL DEFAULT '0', + `LastChanged` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`ID`), KEY `GroupID` (`GroupID`) ) ENGINE=MyISAM CHARSET utf8; diff --git a/sections/ajax/better/single.php b/sections/ajax/better/single.php index 32a184ad..c828e949 100644 --- a/sections/ajax/better/single.php +++ b/sections/ajax/better/single.php @@ -1,31 +1,30 @@ get_value('better_single_groupids')) === false) { +if (($Results = $Cache->get_value('better_single_groupids')) === false) { $DB->query(" SELECT t.ID AS TorrentID, t.GroupID AS GroupID FROM xbt_files_users AS x - JOIN torrents AS t ON t.ID = x.fid - WHERE t.Format = 'FLAC' + JOIN torrents AS t ON t.ID=x.fid + WHERE t.Format='FLAC' GROUP BY x.fid HAVING COUNT(x.uid) = 1 ORDER BY t.LogScore DESC, t.Time ASC LIMIT 30"); - $GroupIDs = $DB->to_array('GroupID'); - $Cache->cache_value('better_single_groupids', $GroupIDs, 30 * 60); + $Results = $DB->to_pair('GroupID', 'TorrentID', false); + $Cache->cache_value('better_single_groupids', $Results, 30 * 60); } -$Results = Torrents::get_groups(array_keys($GroupIDs)); +$Groups = Torrents::get_groups(array_keys($Results)); $JsonResults = array(); -foreach ($GroupIDs as $GroupID) { - if (!isset($Results[$GroupID])) { +foreach ($Results as $GroupID => $FlacID) { + if (!isset($Groups[$GroupID])) { continue; } - $Group = $Results[$GroupIDs]; + $Group = $Groups[$GroupID]; extract(Torrents::array_group($Group)); - $FlacID = $GroupIDs[$GroupID]['TorrentID']; $JsonArtists = array(); if (count($Artists) > 0) { diff --git a/sections/better/single.php b/sections/better/single.php index 12425caa..fa95e06b 100644 --- a/sections/better/single.php +++ b/sections/better/single.php @@ -1,10 +1,10 @@ get_value('better_single_groupids')) === false) { +if (($Results = $Cache->get_value('better_single_groupids')) === false) { $DB->query(" SELECT t.ID AS TorrentID, t.GroupID AS GroupID - FROM xbt_files_users AS x + FROM xbt_files_users AS x JOIN torrents AS t ON t.ID=x.fid WHERE t.Format='FLAC' GROUP BY x.fid @@ -12,11 +12,11 @@ ORDER BY t.LogScore DESC, t.Time ASC LIMIT 30"); - $GroupIDs = $DB->to_array('GroupID'); - $Cache->cache_value('better_single_groupids', $GroupIDs, 30 * 60); + $Results = $DB->to_pair('GroupID', 'TorrentID', false); + $Cache->cache_value('better_single_groupids', $Results, 30 * 60); } -$Results = Torrents::get_groups(array_keys($GroupIDs)); +$Groups = Torrents::get_groups(array_keys($Results)); View::show_header('Single seeder FLACs'); ?> @@ -29,11 +29,11 @@ Torrent $FlacID) { + if (!isset($Groups[$GroupID])) { continue; } - $Group = $Results[$GroupID]; + $Group = $Groups[$GroupID]; extract(Torrents::array_group($Group)); $TorrentTags = new Tags($TagList); @@ -44,7 +44,6 @@ } else { $DisplayName = ''; } - $FlacID = $GroupIDs[$GroupID]['TorrentID']; $DisplayName .= "$GroupName"; if ($GroupYear > 0) { diff --git a/sections/forums/delete.php b/sections/forums/delete.php index 4175d812..a40fd442 100644 --- a/sections/forums/delete.php +++ b/sections/forums/delete.php @@ -28,6 +28,10 @@ ) GROUP BY t.ID"); list($TopicID, $ForumID, $Pages, $Page, $StickyPostID) = $DB->next_record(); +if (!$TopicID) { + // Post is deleted or thread doesn't exist + error(0); // This is evil, but the ajax call doesn't check the response +} // $Pages = number of pages in the thread // $Page = which page the post is on diff --git a/sections/schedule/index.php b/sections/schedule/index.php index 82300776..607ac78c 100644 --- a/sections/schedule/index.php +++ b/sections/schedule/index.php @@ -1275,6 +1275,7 @@ function next_hour() { ($HistoryID, $i, $TorrentID, '" . db_string($TitleString) . "', '" . db_string($TagString) . "')"); $i++; } //foreach ($Top10 as $Torrent) + // Send warnings to uploaders of torrents that will be deleted this week $DB->query(" SELECT diff --git a/sections/user/connchecker.php b/sections/user/connchecker.php index 5e96dea1..b3e38a92 100644 --- a/sections/user/connchecker.php +++ b/sections/user/connchecker.php @@ -1,85 +1,11 @@ 255 - || $Octets[1] < 0 - || $Octets[1] > 255 - || $Octets[2] < 0 - || $Octets[2] > 255 - || $Octets[3] < 0 - || $Octets[3] > 255 - /* - * Per RFC 1918, the following CIDR blocks should never be found on the public Internet. - * 10.0.0.0/8 - * 172.16.0.0/12 - * 192.168.0.0/16 - * - * Per RFC 3330, the block 127.0.0.0/8 should never appear on any network. - * - */ - || $Octets[0] == 127 - || $Octets[0] == 10 - || ($Octets[0] == 172 && ((16 <= $Octets[1]) && ($Octets[1] <= 31))) - || ($Octets[0] == 192 && $Octets[1] == 168) - ) { - die('Invalid IPv4 address'); - } - - // Valid port numbers are defined in RFC 1700 - if (empty($_GET['port']) || !is_number($_GET['port']) || $_GET['port'] < 1 || $_GET['port'] > 65535) { - die('Invalid port'); - } - - // Error suppression, ugh. - if (@fsockopen($_GET['ip'], $_GET['port'], $Errno, $Errstr, 20)) { - die('Port '.$_GET['port'].' on '.$_GET['ip'].' connected successfully.'); - } else { - die('Port '.$_GET['port'].' on '.$_GET['ip'].' failed to connect.'); - } -} - View::show_header('Connectability Checker'); ?>

> Connectability Checker

-
- - - - - - - - -
IP address - - Port - - - -
-
-
+ +
This page has been disabled because the results have been inaccurate. Try a smarter and more reliable service, like http://www.canyouseeme.org.
-