Remove CURRENT_* definitions.

This commit is contained in:
Lars Jung 2015-05-03 16:48:53 +02:00
parent a74e849faf
commit 4b19239f6f
2 changed files with 20 additions and 13 deletions

View file

@ -238,10 +238,28 @@ class App {
}
public function get_fallback() {
private function get_current_path() {
$uri_parts = parse_url(getenv("REQUEST_URI"));
$current_href = Util::normalize_path($uri_parts["path"], true);
$current_path = $this->to_path($current_href);
if (!is_dir($current_path)) {
$current_path = Util::normalize_path(dirname($current_path), false);
}
return $current_path;
}
public function get_fallback($path = null) {
if (!$path) {
$path = $this->get_current_path();
}
$cache = array();
$folder = Item::get($this, CURRENT_PATH, $cache);
$folder = Item::get($this, $path, $cache);
$items = $folder->get_content($cache);
uasort($items, array("Item", "cmp"));

View file

@ -90,17 +90,6 @@ class Bootstrap {
define("ROOT_HREF", Util::normalize_path(dirname(APP_HREF), true));
define("ROOT_PATH", Util::normalize_path(dirname(APP_PATH), false));
$uri_parts = parse_url(getenv("REQUEST_URI"));
$current_href = Util::normalize_path($uri_parts["path"], true);
$rel_href = substr($current_href, strlen(ROOT_HREF));
$current_path = Util::normalize_path(ROOT_PATH . "/" . rawurldecode($rel_href));
if (!is_dir($current_path)) {
$current_href = Util::normalize_path(dirname($current_href), true);
$current_path = Util::normalize_path(dirname($current_path), false);
}
define("CURRENT_HREF", $current_href);
define("CURRENT_PATH", $current_path);
$index_href = null;
if (@is_readable(Util::normalize_path(APP_PATH . "/server/php/index.php", false))) {
$index_href = Util::normalize_path(APP_HREF . "/server/php/index.php", false);