summaryrefslogtreecommitdiffstats
path: root/web/html/index.php
blob: 0af3f2dbeb65769a48dc450522769cf29d4ab781 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');

include_once("config.inc.php");
include_once("routing.inc.php");
include_once("aur.inc.php");
include_once("pkgfuncs.inc.php");

$path = rtrim($_SERVER['PATH_INFO'], '/');
$tokens = explode('/', $path);

if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
	if (isset($tokens[2])) {
		unset($_GET['ID']);
		$_GET['N'] = $tokens[2];

		if (isset($tokens[3])) {
			/* TODO: Remove support for legacy URIs and move these
			 * actions to separate modules. */
			switch ($tokens[3]) {
			case "vote":
				$_POST['do_Vote'] = __('Vote');
				break;
			case "unvote":
				$_POST['do_UnVote'] = __('UnVote');
				break;
			case "notify":
				$_POST['do_Notify'] = __('Notify');
				break;
			case "unnotify":
				$_POST['do_UnNotify'] = __('UnNotify');
				break;
			case "flag":
				$_POST['do_Flag'] = __('Flag');
				break;
			case "unflag":
				$_POST['do_UnFlag'] = __('UnFlag');
				break;
			}

			$_POST['token'] = $_COOKIE['AURSID'];
			$_POST['IDs'] = array(pkgid_from_name($tokens[2]) => '1');
		}
	}

	include get_route('/' . $tokens[1]);
} elseif (get_route($path) !== NULL) {
	include get_route($path);
} else {
	switch ($path) {
	case "/css/archweb.css":
	case "/css/aur.css":
	case "/css/archnavbar/archnavbar.css":
		header("Content-Type: text/css");
		include "./$path";
		break;
	case "/css/archnavbar/archlogo.gif":
	case "/images/new.gif":
		header("Content-Type: image/gif");
		include "./$path";
		break;
	case "/css/archnavbar/archlogo.png":
	case "/images/AUR-logo-80.png":
	case "/images/AUR-logo.png":
	case "/images/favicon.ico":
	case "/images/feed-icon-14x14.png":
	case "/images/titlelogo.png":
	case "/images/x.png":
		header("Content-Type: image/png");
		include "./$path";
		break;
	}
}