From 186b663bf3f69e02137d247021400e5a3f90d666 Mon Sep 17 00:00:00 2001 From: Jeroen van Wolffelaar Date: Thu, 2 Feb 2006 13:23:32 +0000 Subject: [PATCH] Allow "static page" url's --- cgi-bin/index.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/cgi-bin/index.php b/cgi-bin/index.php index e5ad56b..5e9809d 100644 --- a/cgi-bin/index.php +++ b/cgi-bin/index.php @@ -21,20 +21,37 @@ function go($script) echo "
".htmlspecialchars($stderr);
 	echo "
"; } + +$SUITES = array('oldstable', 'stable', 'testing', 'unstable', 'experimental'); $pi = substr($_SERVER["PATH_INFO"], 1); -if ($pi == '') { +$elems = explode('/', $pi); +if (!$elems) { readfile("index.html"); exit; } elseif ($pi == 'search') { go("search_packages.pl"); -} elseif (substr($pi, 0, 8) == 'package/') { +} elseif ($elems[0] == 'package' && count($elems) == 2) { $_GET['searchon'] = 'names'; - $_GET['keywords'] = substr($pi, 8); + $_GET['keywords'] = $elems[1]; + $_GET['suite'] = 'all'; + $_GET['exact'] = 1; + go("search_packages.pl"); +} elseif ($elems[0] == 'source' && count($elems) == 2) { + $_GET['searchon'] = 'sourcenames'; + $_GET['keywords'] = $elems[1]; $_GET['suite'] = 'all'; $_GET['exact'] = 1; go("search_packages.pl"); +} elseif (in_array($elems[0], $SUITES) && count($elems) == 2) { + $_GET['package'] = $elems[1]; + $_GET['suite'] = $elems[0]; + go("show_package.pl"); +} elseif (in_array($elems[0], $SUITES) && count($elems) == 3) { + header("Location: http://merkel.debian.org/~jeroen/pdo/$elems[0]/".urlencode($elems[2])); + exit; } elseif (substr($pi, 0, 4) == 'src:') { header("Location: http://merkel.debian.org/~jeroen/pdo/source/".urlencode(substr($pi,4))); + exit; } elseif (!eregi('[^a-z0-9+.-]', $pi)) { header("Location: http://merkel.debian.org/~jeroen/pdo/package/".urlencode($pi)); exit; -- 2.39.2