diff options
author | canyonknight <canyonknight@gmail.com> | 2012-09-12 18:21:22 -0400 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2012-09-18 00:59:21 +0200 |
commit | 98b6ba94795b27b098276b30ca9fd61b28b2b110 (patch) | |
tree | 250cc8a639bdbe0f1b07928182c4e197cb6fb63e /web/lib/routing.inc.php | |
parent | 440a66ced0bb8ebe9172f99bc98529645194e0ee (diff) | |
download | aurweb-98b6ba94795b27b098276b30ca9fd61b28b2b110.tar.xz |
Use URL rewriting for user info page
Navigation to the "AccountInfo" page should only require a user to know the
username of the account they are looking for. Update all AUR links that use
the user info page to reflect the new URL.
Before:
AUR_URL/account/?Action=AccountInfo&U=userfoo
After:
AUR_URL/account/userfoo
Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/routing.inc.php')
-rw-r--r-- | web/lib/routing.inc.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php index 4ca1150..dfd6942 100644 --- a/web/lib/routing.inc.php +++ b/web/lib/routing.inc.php @@ -18,6 +18,7 @@ $ROUTES = array( ); $PKG_PATH = '/packages'; +$USER_PATH = '/account'; function get_route($path) { global $ROUTES; @@ -56,3 +57,19 @@ function get_pkg_uri($pkgname) { return get_route($PKG_PATH) . '?N=' . urlencode($pkgname); } } + +function get_user_route() { + global $USER_PATH; + return $USER_PATH; +} + +function get_user_uri($username) { + global $USE_VIRTUAL_URLS; + global $USER_PATH; + + if ($USE_VIRTUAL_URLS) { + return $USER_PATH . '/' . urlencode($username) . '/'; + } else { + return get_route($USER_PATH) . '?U=' . urlencode($username); + } +} |