summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/config.inc.php.proto4
-rw-r--r--web/lib/routing.inc.php39
2 files changed, 43 insertions, 0 deletions
diff --git a/web/lib/config.inc.php.proto b/web/lib/config.inc.php.proto
index 1e2699e..fee1022 100644
--- a/web/lib/config.inc.php.proto
+++ b/web/lib/config.inc.php.proto
@@ -51,3 +51,7 @@ $DISABLE_HTTP_LOGIN = true;
# Web URL used in email links and absolute redirects, no trailing slash
$AUR_LOCATION = "http://localhost";
+
+# Use virtual URLs -- to enable this feature, you also need to tell your web
+# server to redirect all requests to "/index.php/$uri".
+$USE_VIRTUAL_URLS = true;
diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php
new file mode 100644
index 0000000..0d940a2
--- /dev/null
+++ b/web/lib/routing.inc.php
@@ -0,0 +1,39 @@
+<?php
+
+$ROUTES = array(
+ '' => 'home.php',
+ '/index.php' => 'home.php',
+ '/packages' => 'packages.php',
+ '/register' => 'account.php',
+ '/accounts' => 'account.php',
+ '/login' => 'login.php',
+ '/logout' => 'logout.php',
+ '/passreset' => 'passreset.php',
+ '/rpc' => 'rpc.php',
+ '/rss' => 'rss.php',
+ '/submit' => 'pkgsubmit.php',
+ '/tu' => 'tu.php',
+ '/voters' => 'voters.php',
+ '/addvote' => 'addvote.php',
+);
+
+function get_route($path) {
+ global $ROUTES;
+
+ if (isset($ROUTES[$path])) {
+ return $ROUTES[$path];
+ } else {
+ return NULL;
+ }
+}
+
+function get_uri($path) {
+ global $USE_VIRTUAL_URLS;
+ global $ROUTES;
+
+ if ($USE_VIRTUAL_URLS) {
+ return $path;
+ } else {
+ return get_route($path);
+ }
+}