[aur-dev] [PATCH 1/2] aur.inc.php: Include routing backend
This needs to be available on every page since it is needed for get_uri() and get_pkg_uri() and "web/html/index.php" isn't executed if the virtual path feature is disabled. Reported-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/index.php | 2 -- web/lib/aur.inc.php | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/web/html/index.php b/web/html/index.php index 0af3f2d..1561168 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -1,8 +1,6 @@ <?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"); diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index 1a6164e..6dcbb34 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -11,6 +11,7 @@ include_once('translator.inc.php'); set_lang(); include_once("config.inc.php"); +include_once("routing.inc.php"); include_once("version.inc.php"); include_once("acctfuncs.inc.php"); include_once("cachefuncs.inc.php"); -- 1.7.11.2
Return the correct route -- even if a "/" is appended to the URI. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/index.php | 2 +- web/lib/routing.inc.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web/html/index.php b/web/html/index.php index 1561168..3539c5a 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -4,7 +4,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib'); include_once("aur.inc.php"); include_once("pkgfuncs.inc.php"); -$path = rtrim($_SERVER['PATH_INFO'], '/'); +$path = $_SERVER['PATH_INFO']; $tokens = explode('/', $path); if (isset($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) { diff --git a/web/lib/routing.inc.php b/web/lib/routing.inc.php index e8a2deb..bbcb9e2 100644 --- a/web/lib/routing.inc.php +++ b/web/lib/routing.inc.php @@ -22,6 +22,7 @@ $PKG_PATH = '/packages'; function get_route($path) { global $ROUTES; + $path = rtrim($path, '/'); if (isset($ROUTES[$path])) { return $ROUTES[$path]; } else { -- 1.7.11.2
participants (1)
-
Lukas Fleischer