summaryrefslogtreecommitdiffstats
path: root/web/lib/routing.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'web/lib/routing.inc.php')
-rw-r--r--web/lib/routing.inc.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php
index 2fa3e1f7..95853041 100644
--- a/web/lib/routing.inc.php
+++ b/web/lib/routing.inc.php
@@ -1,5 +1,7 @@
<?php
+include_once("confparser.inc.php");
+
$ROUTES = array(
'' => 'home.php',
'/index.php' => 'home.php',
@@ -24,6 +26,10 @@ $PKGBASE_PATH = '/pkgbase';
$PKGREQ_PATH = '/requests';
$USER_PATH = '/account';
+function use_virtual_urls() {
+ return config_get_bool('options', 'use_virtual_urls');
+}
+
function get_route($path) {
global $ROUTES;
@@ -36,10 +42,9 @@ function get_route($path) {
}
function get_uri($path) {
- global $USE_VIRTUAL_URLS;
global $ROUTES;
- if ($USE_VIRTUAL_URLS) {
+ if (use_virtual_urls()) {
return $path;
} else {
return get_route($path);
@@ -62,10 +67,9 @@ function get_pkgreq_route() {
}
function get_pkg_uri($pkgname) {
- global $USE_VIRTUAL_URLS;
global $PKG_PATH;
- if ($USE_VIRTUAL_URLS) {
+ if (use_virtual_urls()) {
return $PKG_PATH . '/' . urlencode($pkgname) . '/';
} else {
return '/' . get_route($PKG_PATH) . '?N=' . urlencode($pkgname);
@@ -73,10 +77,9 @@ function get_pkg_uri($pkgname) {
}
function get_pkgbase_uri($pkgbase_name) {
- global $USE_VIRTUAL_URLS;
global $PKGBASE_PATH;
- if ($USE_VIRTUAL_URLS) {
+ if (use_virtual_urls()) {
return $PKGBASE_PATH . '/' . urlencode($pkgbase_name) . '/';
} else {
return '/' . get_route($PKGBASE_PATH) . '?N=' . urlencode($pkgbase_name);
@@ -89,10 +92,9 @@ function get_user_route() {
}
function get_user_uri($username) {
- global $USE_VIRTUAL_URLS;
global $USER_PATH;
- if ($USE_VIRTUAL_URLS) {
+ if (use_virtual_urls()) {
return $USER_PATH . '/' . urlencode($username) . '/';
} else {
return '/' . get_route($USER_PATH) . '?U=' . urlencode($username);