mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-29 22:45:14 -04:00
Remove CURRENT_* definitions.
This commit is contained in:
parent
a74e849faf
commit
4b19239f6f
2 changed files with 20 additions and 13 deletions
|
@ -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"));
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue