summaryrefslogtreecommitdiffstats
path: root/web/lib/routing.inc.php
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2012-07-14 01:57:19 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2012-07-15 22:48:32 +0200
commit03486c3b6feafb18f00b0e0c092a1bd4ac2f3903 (patch)
treef91bbdf64c725e35c7f08ac930e7fcd2a1f066c6 /web/lib/routing.inc.php
parent2425f963f8ad45292c217914b5fee1ed18104c26 (diff)
downloadaurweb-03486c3b6feafb18f00b0e0c092a1bd4ac2f3903.tar.xz
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 <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/routing.inc.php')
-rw-r--r--web/lib/routing.inc.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php
index 0d940a2..e8a2deb 100644
--- a/web/lib/routing.inc.php
+++ b/web/lib/routing.inc.php
@@ -17,6 +17,8 @@ $ROUTES = array(
'/addvote' => 'addvote.php',
);
+$PKG_PATH = '/packages';
+
function get_route($path) {
global $ROUTES;
@@ -37,3 +39,19 @@ function get_uri($path) {
return get_route($path);
}
}
+
+function get_pkg_route() {
+ global $PKG_PATH;
+ return $PKG_PATH;
+}
+
+function get_pkg_uri($pkgname) {
+ global $USE_VIRTUAL_URLS;
+ global $PKG_PATH;
+
+ if ($USE_VIRTUAL_URLS) {
+ return $PKG_PATH . '/' . urlencode($pkgname) . '/';
+ } else {
+ return get_route($PKG_PATH) . '?N=' . urlencode($pkgname);
+ }
+}