'1'); } } include get_route('/' . $tokens[1]); } elseif (!empty($tokens[1]) && '/' . $tokens[1] == get_pkgreq_route()) { if (!empty($tokens[2])) { /* TODO: Create a proper data structure to pass variables from * the routing framework to the individual pages instead of * initializing arbitrary variables here. */ if (!empty($tokens[3]) && $tokens[3] == 'close') { $pkgreq_id = $tokens[2]; } else { $pkgreq_id = null; } if (!$pkgreq_id) { header("HTTP/1.0 404 Not Found"); include "./404.php"; return; } } include get_route('/' . $tokens[1]); } elseif (!empty($tokens[1]) && '/' . $tokens[1] == get_user_route()) { if (!empty($tokens[2])) { $_REQUEST['ID'] = uid_from_username($tokens[2]); if (!$_REQUEST['ID']) { header("HTTP/1.0 404 Not Found"); include "./404.php"; return; } if (!empty($tokens[3])) { if ($tokens[3] == 'edit') { $_REQUEST['Action'] = "DisplayAccount"; } elseif ($tokens[3] == 'update') { $_REQUEST['Action'] = "UpdateAccount"; } elseif ($tokens[3] == 'delete') { $_REQUEST['Action'] = "DeleteAccount"; } elseif ($tokens[3] == 'comments') { $_REQUEST['Action'] = "ListComments"; } else { header("HTTP/1.0 404 Not Found"); include "./404.php"; return; } } else { $_REQUEST['Action'] = "AccountInfo"; } } include get_route('/' . $tokens[1]); } elseif (get_route($path) !== NULL) { include get_route($path); } else { switch ($path) { case "/css/archweb.css": case "/css/aurweb.css": case "/css/cgit.css": case "/css/archnavbar/archnavbar.css": header("Content-Type: text/css"); readfile("./$path"); break; case "/images/ajax-loader.gif": header("Content-Type: image/gif"); readfile("./$path"); break; case "/css/archnavbar/archlogo.png": case "/css/archnavbar/aurlogo.png": case "/images/favicon.ico": header("Content-Type: image/png"); readfile("./$path"); break; case "/images/x.min.svg": case "/images/action-undo.min.svg": case "/images/pencil.min.svg": case "/images/pin.min.svg": case "/images/unpin.min.svg": case "/images/rss.svg": header("Content-Type: image/svg+xml"); readfile("./$path"); break; case "/js/bootstrap-typeahead.min.js": header("Content-Type: application/javascript"); readfile("./$path"); break; case "/packages.gz": case "/pkgbase.gz": case "/users.gz": header("Content-Type: text/plain"); header("Content-Encoding: gzip"); readfile("./$path"); break; default: header("HTTP/1.0 404 Not Found"); include "./404.php"; break; } }