2 set_include_path(get_include_path() . PATH_SEPARATOR
. '../lib');
4 include_once("aur.inc.php");
5 include_once("pkgfuncs.inc.php");
7 $path = $_SERVER['PATH_INFO'];
8 $tokens = explode('/', $path);
10 if (config_get_bool('options', 'enable-maintenance') && (empty($tokens[1]) ||
($tokens[1] != "css" && $tokens[1] != "images"))) {
11 if (!in_array($_SERVER['REMOTE_ADDR'], explode(" ", config_get('options', 'maintenance-exceptions')))) {
12 header("HTTP/1.0 503 Service Unavailable");
18 if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
19 if (!empty($tokens[2])) {
20 /* TODO: Create a proper data structure to pass variables from
21 * the routing framework to the individual pages instead of
22 * initializing arbitrary variables here. */
23 $pkgname = $tokens[2];
24 $pkgid = pkg_from_name($pkgname);
27 header("HTTP/1.0 404 Not Found");
33 include get_route('/' . $tokens[1]);
34 } elseif (!empty($tokens[1]) && '/' . $tokens[1] == get_pkgbase_route()) {
35 if (!empty($tokens[2])) {
36 /* TODO: Create a proper data structure to pass variables from
37 * the routing framework to the individual pages instead of
38 * initializing arbitrary variables here. */
39 $pkgbase_name = $tokens[2];
40 $base_id = pkgbase_from_name($pkgbase_name);
43 header("HTTP/1.0 404 Not Found");
48 if (!empty($tokens[3])) {
49 /* TODO: Remove support for legacy URIs and move these
50 * actions to separate modules. */
53 $_POST['do_Adopt'] = __('Adopt');
56 include('pkgdisown.php');
59 $_POST['do_Vote'] = __('Vote');
62 $_POST['do_UnVote'] = __('UnVote');
65 $_POST['do_Notify'] = __('Notify');
68 $_POST['do_UnNotify'] = __('UnNotify');
71 include('pkgflag.php');
74 $_POST['do_UnFlag'] = __('UnFlag');
77 include('pkgdel.php');
80 include('pkgmerge.php');
83 $_GET['N'] = $tokens[2];
84 include('voters.php');
87 include('pkgreq.php');
90 include('comaintainers.php');
93 include('commentedit.php');
96 header("HTTP/1.0 404 Not Found");
101 $_POST['IDs'] = array(pkgbase_from_name($tokens[2]) => '1');
105 include get_route('/' . $tokens[1]);
106 } elseif (!empty($tokens[1]) && '/' . $tokens[1] == get_pkgreq_route()) {
107 if (!empty($tokens[2])) {
108 /* TODO: Create a proper data structure to pass variables from
109 * the routing framework to the individual pages instead of
110 * initializing arbitrary variables here. */
111 if (!empty($tokens[3]) && $tokens[3] == 'close') {
112 $pkgreq_id = $tokens[2];
118 header("HTTP/1.0 404 Not Found");
124 include get_route('/' . $tokens[1]);
125 } elseif (!empty($tokens[1]) && '/' . $tokens[1] == get_user_route()) {
126 if (!empty($tokens[2])) {
127 $_REQUEST['ID'] = uid_from_username($tokens[2]);
129 if (!$_REQUEST['ID']) {
130 header("HTTP/1.0 404 Not Found");
135 if (!empty($tokens[3])) {
136 if ($tokens[3] == 'edit') {
137 $_REQUEST['Action'] = "DisplayAccount";
138 } elseif ($tokens[3] == 'update') {
139 $_REQUEST['Action'] = "UpdateAccount";
140 } elseif ($tokens[3] == 'delete') {
141 $_REQUEST['Action'] = "DeleteAccount";
143 header("HTTP/1.0 404 Not Found");
148 $_REQUEST['Action'] = "AccountInfo";
151 include get_route('/' . $tokens[1]);
152 } elseif (get_route($path) !== NULL) {
153 include get_route($path);
156 case "/css/archweb.css":
157 case "/css/aurweb.css":
158 case "/css/cgit.css":
159 case "/css/archnavbar/archnavbar.css":
160 header("Content-Type: text/css");
163 case "/images/ajax-loader.gif":
164 header("Content-Type: image/gif");
167 case "/css/archnavbar/archlogo.gif":
168 case "/images/new.png":
169 header("Content-Type: image/png");
172 case "/css/archnavbar/archlogo.png":
173 case "/css/archnavbar/aurlogo.png":
174 case "/images/AUR-logo-80.png":
175 case "/images/AUR-logo.png":
176 case "/images/favicon.ico":
177 case "/images/feed-icon-14x14.png":
178 case "/images/titlelogo.png":
179 case "/images/x.png":
180 header("Content-Type: image/png");
183 case "/images/x.min.svg":
184 case "/images/pencil.min.svg":
185 case "/images/pin.min.svg":
186 case "/images/unpin.min.svg":
187 header("Content-Type: image/svg+xml");
190 case "/js/bootstrap-typeahead.min.js":
191 header("Content-Type: application/javascript");
196 header("Content-Type: text/plain");
197 header("Content-Encoding: gzip");
201 header("HTTP/1.0 404 Not Found");