From f7ec00b2f8ba3efc5bdeacef9c813f8a826ae3be Mon Sep 17 00:00:00 2001
From: Patrick Anders <p.anders@timmehosting.de>
Date: Wed, 10 Dec 2014 08:44:26 -0500
Subject: [PATCH] add Spdy option - http://en.wikipedia.org/wiki/SPDY
---
interface/lib/classes/aps_crawler.inc.php | 41 +++++++++++++++++++++++++++++++----------
1 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/interface/lib/classes/aps_crawler.inc.php b/interface/lib/classes/aps_crawler.inc.php
index 8260f34..7bb2650 100644
--- a/interface/lib/classes/aps_crawler.inc.php
+++ b/interface/lib/classes/aps_crawler.inc.php
@@ -288,11 +288,26 @@
$sxe = new SimpleXMLElement($xml);
$namespaces = $sxe->getDocNamespaces(true);
foreach($namespaces as $ns => $url) $sxe->registerXPathNamespace($ns, $url);
+
+ //Find highest version
+ $app_version = "0.0.0";
+ $entry_pos = 1;
+ for ($p = 1; ; $p++) {
+ $app_version_tmp = parent::getXPathValue($sxe, 'entry[position()=' . $p . ']/a:version');
+ if (strlen($app_version_tmp) < 1) break;
+ if (version_compare($app_version_tmp, $app_version) >= 0) {
+ $app_version = $app_version_tmp;
+ $entry_pos = $p;
+ }
+ }
// Fetching values of interest
- $app_name = parent::getXPathValue($sxe, 'entry[position()=1]/a:name');
- $app_version = parent::getXPathValue($sxe, 'entry[position()=1]/a:version');
- $app_release = parent::getXPathValue($sxe, 'entry[position()=1]/a:release');
+ //$app_name = parent::getXPathValue($sxe, 'entry[position()=1]/a:name');
+ //$app_version = parent::getXPathValue($sxe, 'entry[position()=1]/a:version');
+ //$app_release = parent::getXPathValue($sxe, 'entry[position()=1]/a:release');
+ $app_name = parent::getXPathValue($sxe, "entry[position()=" . $entry_pos . "]/a:name");
+ $app_version = parent::getXPathValue($sxe, "entry[position()=" . $entry_pos . "]/a:version");
+ $app_release = parent::getXPathValue($sxe, "entry[position()=" . $entry_pos . "]/a:release");
// Find out a (possibly) existing package version
$ex_ver = '';
@@ -315,9 +330,12 @@
// Check if we already have an old version of this app
if(!empty($ex_ver) && version_compare($new_ver, $ex_ver) == 1) $apps_updated++;
- $app_dl = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@href");
- $app_filesize = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@length");
- $app_metafile = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='meta']/@href");
+ //$app_dl = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@href");
+ //$app_filesize = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='aps']/@length");
+ //$app_metafile = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='meta']/@href");
+ $app_dl = parent::getXPathValue($sxe, "entry[position()=" . $entry_pos . "]/link[@a:type='aps']/@href");
+ $app_filesize = parent::getXPathValue($sxe, "entry[position()=" . $entry_pos . "]/link[@a:type='aps']/@length");
+ $app_metafile = parent::getXPathValue($sxe, "entry[position()=" . $entry_pos . "]/link[@a:type='meta']/@href");
//$this->app_download_url_list[$app_name.'-'.$new_ver.'.app.zip'] = $app_dl;
// Skip ASP.net packages because they can't be used at all
@@ -365,7 +383,8 @@
}
// Download package license
- $license = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='eula']/@href");
+ //$license = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='eula']/@href");
+ $license = parent::getXPathValue($sxe, "entry[position()=" . $entry_pos . "]/link[@a:type='eula']/@href");
if($license != '')
{
$local_license = $local_intf_folder.'LICENSE';
@@ -379,7 +398,8 @@
}
// Download package icon
- $icon = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='icon']/@href");
+ //$icon = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='icon']/@href");
+ $icon = parent::getXPathValue($sxe, "entry[position()=" . $entry_pos . "]/link[@a:type='icon']/@href");
if($icon != '')
{
$local_icon = $local_intf_folder.basename($icon);
@@ -393,7 +413,8 @@
}
// Download available screenshots
- $screenshots = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='screenshot']", true);
+ //$screenshots = parent::getXPathValue($sxe, "entry[position()=1]/link[@a:type='screenshot']", true);
+ $screenshots = parent::getXPathValue($sxe, "entry[position()=" . $entry_pos . "]/link[@a:type='screenshot']", true);
if(!empty($screenshots))
{
foreach($screenshots as $screen)
@@ -595,7 +616,7 @@
foreach($incomplete_pkgs as $incomplete_pkg){
$pkg_url = @file_get_contents($this->interface_pkg_dir.'/'.$incomplete_pkg['path'].'/PKG_URL');
if($pkg_url != ''){
- $app->db->datalogUpdate('aps_packages', "package_url = '".$pkg_url."'", 'id', $incomplete_pkg['id']);
+ $app->db->datalogUpdate('aps_packages', "package_url = '".$app->db->quote($pkg_url)."'", 'id', $incomplete_pkg['id']);
}
}
}
--
Gitblit v1.9.1