Empty commit

This commit is contained in:
Git 2014-05-15 08:00:27 +00:00
parent 3d8a5aa2f5
commit 947a3ddab4
7 changed files with 27 additions and 97 deletions

View File

@ -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;

View File

@ -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;

View File

@ -1,31 +1,30 @@
<?
if (($GroupIDs = $Cache->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) {

View File

@ -1,10 +1,10 @@
<?
if (($GroupIDs = $Cache->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 @@
<td>Torrent</td>
</tr>
<?
foreach ($GroupIDs as $GroupID) {
if (!isset($Results[$GroupID])) {
foreach ($Results as $GroupID => $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 .= "<a href=\"torrents.php?id=$GroupID&amp;torrentid=$FlacID\" class=\"tooltip\" title=\"View torrent\" dir=\"ltr\">$GroupName</a>";
if ($GroupYear > 0) {

View File

@ -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

View File

@ -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

View File

@ -1,85 +1,11 @@
<?
//TODO: Move to somewhere more appropriate, doesn't really belong under users, tools maybe but we don't have that page publicly accessible.
if (isset($_GET['ip']) && isset($_GET['port'])) {
$Octets = explode('.', $_GET['ip']);
if (
empty($_GET['ip'])
|| !preg_match('/'.IP_REGEX.'/', $_GET['ip'])
|| $Octets[0] < 0
|| $Octets[0] > 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');
?>
<div class="thin">
<div class="header">
<h2><a href="user.php?id=<?=$LoggedUser['ID']?>"><?=$LoggedUser['Username']?></a> &gt; Connectability Checker</h2>
</div>
<form class="manage_form" name="connections" action="javascript:check_ip();" method="get">
<table class="layout">
<tr>
<td class="label">IP address</td>
<td>
<input type="text" id="ip" name="ip" value="<?=$_SERVER['REMOTE_ADDR']?>" size="20" />
</td>
<td class="label">Port</td>
<td>
<input type="text" id="port" name="port" size="10" />
</td>
<td>
<input type="submit" value="Check" />
</td>
</tr>
</table>
</form>
<div id="result" class="box pad"></div>
<div class="linkbox"></div>
<div class="box pad">This page has been disabled because the results have been inaccurate. Try a smarter and more reliable service, like <a href="http://www.canyouseeme.org">http://www.canyouseeme.org</a>.</div>
</div>
<script type="text/javascript">//<![CDATA[
var result = $('#result').raw();
function check_ip() {
var intervalid = setInterval("result.innerHTML += '.';",999);
result.innerHTML = 'Checking.';
ajax.get('user.php?action=connchecker&ip=' + $('#ip').raw().value + '&port=' + $('#port').raw().value, function (response) {
clearInterval(intervalid);
result.innerHTML = response;
});
}
//]]>
</script>
<? View::show_footer(); ?>