summaryrefslogtreecommitdiffstats
path: root/web/lib/routing.inc.php
blob: 0d940a23ea1db3f95c3cc6d2a6cd01dc0cef0cfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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);
	}
}