summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/pkginfo.php23
1 files changed, 12 insertions, 11 deletions
diff --git a/packages/pkginfo.php b/packages/pkginfo.php
index 3a3fc2e..d6d04fb 100644
--- a/packages/pkginfo.php
+++ b/packages/pkginfo.php
@@ -5,17 +5,17 @@ require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";
require_once BASE . "/lib/style.php";
- if ($_GET["arch"] == "i486")
- $skip_json_checks = true;
- else
- $skip_json_checks = false;
-
if (!$skip_json_checks) {
$memcache = new Memcache;
$memcache -> connect('localhost', 11211) or die ('Memcached Connection Error');
$pkgapi_reachable = $memcache -> get('pkgapi_reachable');
+ $tld = array_pop((explode('.', $_SERVER['HTTP_HOST'])));
+ if (array_key_exists('HTTPS', $_SERVER) && ($_SERVER['HTTPS'] == 'on'))
+ $protocol = 'https';
+ else
+ $protocol = 'http';
if ($pkgapi_reachable === false) {
- if (site_is_reachable('https://pkgapi.arch32.tyzoid.com/package/'))
+ if (site_is_reachable($protocol . '://pkgapi.archlinux32.' . $tld . '/'))
$pkgapi_reachable = 'YES';
else
$pkgapi_reachable = 'NO';
@@ -28,18 +28,19 @@ require_once BASE . "/lib/style.php";
if (!$skip_json_checks) {
$json_content = json_decode(
file_get_contents(
- "https://pkgapi.arch32.tyzoid.com/package/" .
- urlencode ($_GET["repo"].":".$_GET["pkgname"])
+ $protocol . '://pkgapi.archlinux32.' . $tld . '/' .
+ urlencode($_GET["arch"]) . '/' .
+ urlencode($_GET["repo"]) . '/' .
+ urlencode($_GET["pkgname"])
),
true
);
- if (!isset($json_content["package"])) {
+ if (!isset($json_content["Name"])) {
//throw_http_error(404, "Package Not Found In Sync Database");
unset($json_content);
$skip_json_checks = true;
- } else
- $json_content = $json_content["package"];
+ };
}
$mysql_result = mysql_run_query(