mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
This adds a URL mapping library that can be used to implement virtual paths. Also, "web/html/index.php" is moved to "web/html/home.php" and "web/html/index.php" becomes a routing front end that maps virtual paths to corresponding files. To enable the virtual path feature, all requests need to be redirected to the "index.php" routing script. If you use lighttpd, following rewrite rule can be used: url.rewrite = ( "^(.*)$" => "/index.php/$1" ) A similar rule can be used for Apache (using mod_rewrite). Note that the current routing front end only works if PATH_INFO is provided. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
35 lines
847 B
PHP
35 lines
847 B
PHP
<?php
|
|
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
|
|
|
|
include_once("config.inc.php");
|
|
include_once("routing.inc.php");
|
|
|
|
$path = rtrim($_SERVER['PATH_INFO'], '/');
|
|
|
|
if (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;
|
|
}
|
|
}
|