diff --git a/distroquery.php b/distroquery.php index f0354e8..9f3f495 100644 --- a/distroquery.php +++ b/distroquery.php @@ -43,7 +43,7 @@ $url_prefix = home_url() . "/rpms/"; $arch=get_query_var('arch'); $get_args = array( - 'timeout' => 15, + 'timeout' => 20, 'sslverify' => false ); diff --git a/functions.php b/functions.php index ea95b6a..f532824 100644 --- a/functions.php +++ b/functions.php @@ -347,8 +347,45 @@ function openmamba_distromatic_func() { $outputlang = "en_US.UTF-8"; if (preg_match('/^[a-zA-Z0-9._\=\-\+\/\.\&\:]*$/', $urlargs)) { - $ret = "" . __("Loading, please wait...", "responsive") . "
"; - $ret .= ""; + + // Set title for obsolete packages pages + $arch = ""; + parse_str($urlargs, $args); + if (array_key_exists('arch', $args)) { + if (preg_match('/^[a-zA-Z0-9._]*$/', $args['arch'])) { + $arch = urlencode($args['arch']); + } + } + if (array_key_exists('tag', $args)) { + if (preg_match('/^[a-zA-Z0-9._-]*$/', $args['tag'])) { + $repo = urlencode($args['tag']); + } + } + if (array_key_exists('pkg', $args)) { + if ($args['pkg'] != '_index') { + if (preg_match('/^[a-zA-Z0-9._+-]*$/', $args['pkg'])) { + $pkgarr = explode('.', urlencode($args['pkg'])); + $pkg = $pkgarr[0]; + if (sizeof($pkgarr) > 1 && $pkgarr[1] != "source") { + $arch = $pkgarr[1]; + } + } + } + } + + + if ($repo != "base" && substr($repo, 0, 6) != "devel-") { + // Old repos -> old interface + $ret = "" . __("Loading, please wait...", "responsive") . "
"; + $ret .= ""; + } else { + // Current repos -> redirect to new interface + $ret = "" . __("Redirecting to new interface, please wait...", "responsive") . "
"; + $redirect_url = "https://openmamba.org/en/rpms/" . $repo . "/"; + if ($pkg != "") $redirect_url .= $pkg . "/"; + if ($arch != "") $redirect_url .= $arch . "/"; + $ret .= ""; + } } else { $ret = "" . __("Invalid request.", "responsive") . "
"; }