mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
This commit is contained in:
parent
2425f963f8
commit
03486c3b6f
10 changed files with 40 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue