From 03486c3b6feafb18f00b0e0c092a1bd4ac2f3903 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sat, 14 Jul 2012 01:57:19 +0200 Subject: Use virtual paths for package details Extend the routing front/back ends to allow for using "/package/$pkgname/" for individual packages. Signed-off-by: Lukas Fleischer --- web/html/index.php | 10 +++++++++- web/html/pkgsubmit.php | 2 +- web/html/voters.php | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) (limited to 'web/html') diff --git a/web/html/index.php b/web/html/index.php index b0f346da..de38178e 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -5,8 +5,16 @@ include_once("config.inc.php"); include_once("routing.inc.php"); $path = rtrim($_SERVER['PATH_INFO'], '/'); +$tokens = explode('/', $path); -if (get_route($path) !== NULL) { +if (isset($tokens[1]) &&'/' . $tokens[1] == get_pkg_route()) { + if (isset($tokens[2])) { + unset($_GET['ID']); + $_GET['N'] = $tokens[2]; + } + + include get_route('/' . $tokens[1]); +} elseif (get_route($path) !== NULL) { include get_route($path); } else { switch ($path) { diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 8c93b0cc..b918e8ba 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -400,7 +400,7 @@ if ($uid): # Entire package creation process is atomic end_atomic_commit($dbh); - header('Location: ' . get_uri('/packages/') . '?ID=' . $packageID); + header('Location: ' . get_pkg_uri($pkg_name)); } chdir($cwd); diff --git a/web/html/voters.php b/web/html/voters.php index 378e605d..3ba5248c 100644 --- a/web/html/voters.php +++ b/web/html/voters.php @@ -15,7 +15,7 @@ if ($atype == 'Trusted User' || $atype== 'Developer'): ?>
-

Votes for

+

Votes for