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('pkgflagcomment.php');
80 include('pkgdel.php');
83 include('pkgmerge.php');
86 $_GET['N'] = $tokens[2];
87 include('voters.php');
90 include('pkgreq.php');
93 include('comaintainers.php');
96 include('commentedit.php');
99 header("HTTP/1.0 404 Not Found");
104 $_POST['IDs'] = array(pkgbase_from_name($tokens[2]) => '1');
108 include get_route('/' . $tokens[1]);
109 } elseif (!empty($tokens[1]) && '/' . $tokens[1] == get_pkgreq_route()) {
110 if (!empty($tokens[2])) {
111 /* TODO: Create a proper data structure to pass variables from
112 * the routing framework to the individual pages instead of
113 * initializing arbitrary variables here. */
114 if (!empty($tokens[3]) && $tokens[3] == 'close') {
115 $pkgreq_id = $tokens[2];
121 header("HTTP/1.0 404 Not Found");
127 include get_route('/' . $tokens[1]);
128 } elseif (!empty($tokens[1]) && '/' . $tokens[1] == get_user_route()) {
129 if (!empty($tokens[2])) {
130 $_REQUEST['ID'] = uid_from_username($tokens[2]);
132 if (!$_REQUEST['ID']) {
133 header("HTTP/1.0 404 Not Found");
138 if (!empty($tokens[3])) {
139 if ($tokens[3] == 'edit') {
140 $_REQUEST['Action'] = "DisplayAccount";
141 } elseif ($tokens[3] == 'update') {
142 $_REQUEST['Action'] = "UpdateAccount";
143 } elseif ($tokens[3] == 'delete') {
144 $_REQUEST['Action'] = "DeleteAccount";
146 header("HTTP/1.0 404 Not Found");
151 $_REQUEST['Action'] = "AccountInfo";
154 include get_route('/' . $tokens[1]);
155 } elseif (get_route($path) !== NULL) {
156 include get_route($path);
159 case "/css/archweb.css":
160 case "/css/aurweb.css":
161 case "/css/cgit.css":
162 case "/css/archnavbar/archnavbar.css":
163 header("Content-Type: text/css");
166 case "/images/ajax-loader.gif":
167 header("Content-Type: image/gif");
170 case "/css/archnavbar/archlogo.gif":
171 header("Content-Type: image/png");
174 case "/css/archnavbar/archlogo.png":
175 case "/css/archnavbar/aurlogo.png":
176 case "/images/favicon.ico":
177 case "/images/titlelogo.png":
178 case "/images/x.png":
179 header("Content-Type: image/png");
182 case "/images/x.min.svg":
183 case "/images/action-undo.min.svg":
184 case "/images/pencil.min.svg":
185 case "/images/pin.min.svg":
186 case "/images/unpin.min.svg":
187 case "/images/rss.svg":
188 case "/images/new.svg":
189 header("Content-Type: image/svg+xml");
192 case "/js/bootstrap-typeahead.min.js":
193 header("Content-Type: application/javascript");
198 header("Content-Type: text/plain");
199 header("Content-Encoding: gzip");
203 header("HTTP/1.0 404 Not Found");