aurweb/web/lib/routing.inc.php
Lukas Fleischer f7d13b5b36 Add package base detail pages
This adds package base details pages, similar to the package details
pages. Each package base details page contains general information
(package base name, category, submitter, maintainer, ...) and links to
all the corresponding packages. As on the package details pages,
comments and links to several package actions are also provided.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
2014-04-05 12:21:36 +02:00

93 lines
1.8 KiB
PHP

<?php
$ROUTES = array(
'' => 'home.php',
'/index.php' => 'home.php',
'/packages' => 'packages.php',
'/pkgbase' => 'pkgbase.php',
'/register' => 'account.php',
'/account' => 'account.php',
'/accounts' => 'account.php',
'/login' => 'login.php',
'/logout' => 'logout.php',
'/passreset' => 'passreset.php',
'/rpc' => 'rpc.php',
'/rss' => 'rss.php',
'/submit' => 'pkgsubmit.php',
'/tu' => 'tu.php',
'/addvote' => 'addvote.php',
);
$PKG_PATH = '/packages';
$PKGBASE_PATH = '/pkgbase';
$USER_PATH = '/account';
function get_route($path) {
global $ROUTES;
$path = rtrim($path, '/');
if (isset($ROUTES[$path])) {
return $ROUTES[$path];
} else {
return NULL;
}
}
function get_uri($path) {
global $USE_VIRTUAL_URLS;
global $ROUTES;
if ($USE_VIRTUAL_URLS) {
return $path;
} else {
return get_route($path);
}
}
function get_pkg_route() {
global $PKG_PATH;
return $PKG_PATH;
}
function get_pkgbase_route() {
global $PKGBASE_PATH;
return $PKGBASE_PATH;
}
function get_pkg_uri($pkgname) {
global $USE_VIRTUAL_URLS;
global $PKG_PATH;
if ($USE_VIRTUAL_URLS) {
return $PKG_PATH . '/' . urlencode($pkgname) . '/';
} else {
return '/' . get_route($PKG_PATH) . '?N=' . urlencode($pkgname);
}
}
function get_pkgbase_uri($pkgbase_name) {
global $USE_VIRTUAL_URLS;
global $PKGBASE_PATH;
if ($USE_VIRTUAL_URLS) {
return $PKGBASE_PATH . '/' . urlencode($pkgbase_name) . '/';
} else {
return '/' . get_route($PKGBASE_PATH) . '?N=' . urlencode($pkgbase_name);
}
}
function get_user_route() {
global $USER_PATH;
return $USER_PATH;
}
function get_user_uri($username) {
global $USE_VIRTUAL_URLS;
global $USER_PATH;
if ($USE_VIRTUAL_URLS) {
return $USER_PATH . '/' . urlencode($username) . '/';
} else {
return '/' . get_route($USER_PATH) . '?U=' . urlencode($username);
}
}