diff --git a/src/_h5ai/client/js/inc/boot.js b/src/_h5ai/client/js/inc/boot.js index f3ddfc18..70f595d7 100644 --- a/src/_h5ai/client/js/inc/boot.js +++ b/src/_h5ai/client/js/inc/boot.js @@ -6,19 +6,19 @@ modulejs.define('boot', ['$'], function ($) { var module = $('script[data-module]').data('module'); var data = {action: 'get', setup: true, options: true, types: true, theme: true, langs: true}; - var url; + var href; if (module === 'index') { - url = '.'; + href = '.'; } else if (module === 'info') { data.updatecmds = true; - url = 'server/php/index.php'; + href = 'server/php/index.php'; } else { return; } $.ajax({ - url: url, + url: href, data: data, type: 'post', dataType: 'json' diff --git a/src/_h5ai/server/php/inc/class-api.php b/src/_h5ai/server/php/inc/class-api.php index 805593dc..5694f201 100644 --- a/src/_h5ai/server/php/inc/class-api.php +++ b/src/_h5ai/server/php/inc/class-api.php @@ -58,16 +58,16 @@ class Api { if (Util::get_boolean_request_param("custom", false)) { - $url = Util::get_request_param("customHref"); - $response["custom"] = $this->app->get_customizations($url); + $href = Util::get_request_param("customHref"); + $response["custom"] = $this->app->get_customizations($href); } if (Util::get_boolean_request_param("items", false)) { - $url = Util::get_request_param("itemsHref"); + $href = Util::get_request_param("itemsHref"); $what = Util::get_request_param("itemsWhat"); $what = is_numeric($what) ? intval($what, 10) : 1; - $response["items"] = $this->app->get_items($url, $what); + $response["items"] = $this->app->get_items($href, $what); } Util::json_exit($response); @@ -80,15 +80,15 @@ class Api { Util::json_fail(Util::ERR_UNSUPPORTED, "thumbnails not supported", !HAS_PHP_JPEG); $type = Util::get_request_param("type"); - $src_url = Util::get_request_param("href"); + $src_href = Util::get_request_param("href"); $width = Util::get_request_param("width"); $height = Util::get_request_param("height"); $thumb = new Thumb($this->app); - $thumb_url = $thumb->thumb($type, $src_url, $width, $height); - Util::json_fail(Util::ERR_FAILED, "thumbnail creation failed", $thumb_url === null); + $thumb_href = $thumb->thumb($type, $src_href, $width, $height); + Util::json_fail(Util::ERR_FAILED, "thumbnail creation failed", $thumb_href === null); - Util::json_exit(array("absHref" => $thumb_url)); + Util::json_exit(array("absHref" => $thumb_href)); } diff --git a/src/_h5ai/server/php/inc/class-app.php b/src/_h5ai/server/php/inc/class-app.php index 88c685f9..716d4309 100644 --- a/src/_h5ai/server/php/inc/class-app.php +++ b/src/_h5ai/server/php/inc/class-app.php @@ -110,7 +110,7 @@ class App { } - public function to_url($path, $trailing_slash = true) { + public function to_href($path, $trailing_slash = true) { $rel_path = substr($path, strlen(ROOT_PATH)); $parts = explode("/", $rel_path); @@ -125,10 +125,10 @@ class App { } - public function to_path($url) { + public function to_path($href) { - $rel_url = substr($url, strlen(ROOT_HREF)); - return Util::normalize_path(ROOT_PATH . "/" . rawurldecode($rel_url)); + $rel_href = substr($href, strlen(ROOT_HREF)); + return Util::normalize_path(ROOT_PATH . "/" . rawurldecode($rel_href)); } @@ -157,7 +157,7 @@ class App { foreach (scandir($path) as $name) { if ( $this->is_hidden($name) - || $this->is_hidden($this->to_url($path) . $name) + || $this->is_hidden($this->to_href($path) . $name) || (!is_readable($path .'/'. $name) && $this->get_option("view.hideIf403", false)) ) { continue; @@ -169,9 +169,9 @@ class App { } - public function is_managed_url($url) { + public function is_managed_href($href) { - return $this->is_managed_path($this->to_path($url)); + return $this->is_managed_path($this->to_path($href)); } @@ -205,14 +205,14 @@ class App { } - public function get_items($url, $what) { + public function get_items($href, $what) { - if (!$this->is_managed_url($url)) { + if (!$this->is_managed_href($href)) { return array(); } $cache = array(); - $folder = Item::get($this, $this->to_path($url), $cache); + $folder = Item::get($this, $this->to_path($href), $cache); // add content of subfolders if ($what >= 2 && $folder !== null) { @@ -286,7 +286,7 @@ class App { $html .= ""; $html .= "" . $type . ""; - $html .= "" . basename($item->path) . ""; + $html .= "" . basename($item->path) . ""; $html .= "" . date("Y-m-d H:i", $item->date) . ""; $html .= "" . ($item->size !== null ? intval($item->size / 1000) . " KB" : "" ) . ""; $html .= ""; @@ -350,7 +350,7 @@ class App { } - public function get_customizations($url) { + public function get_customizations($href) { if (!$this->get_option("custom.enabled", false)) { return array( @@ -361,7 +361,7 @@ class App { ); } - $path = $this->to_path($url); + $path = $this->to_path($href); $header = null; $header_type = null; diff --git a/src/_h5ai/server/php/inc/class-archive.php b/src/_h5ai/server/php/inc/class-archive.php index 8ec405b3..77822e35 100644 --- a/src/_h5ai/server/php/inc/class-archive.php +++ b/src/_h5ai/server/php/inc/class-archive.php @@ -15,9 +15,9 @@ class Archive { } - public function output($type, $base_url, $urls) { + public function output($type, $base_href, $hrefs) { - $this->base_path = $this->app->to_path($base_url); + $this->base_path = $this->app->to_path($base_href); if (!$this->app->is_managed_path($this->base_path)) { return 500; } @@ -25,7 +25,7 @@ class Archive { $this->dirs = array(); $this->files = array(); - $this->add_hrefs($urls); + $this->add_hrefs($hrefs); if (count($this->dirs) === 0 && count($this->files) === 0) { if ($type === "php-tar") { @@ -150,9 +150,9 @@ class Archive { } - private function add_hrefs($urls) { + private function add_hrefs($hrefs) { - foreach ($urls as $href) { + foreach ($hrefs as $href) { if (trim($href) === "") { continue; @@ -161,7 +161,7 @@ class Archive { $d = Util::normalize_path(dirname($href), true); $n = basename($href); - if ($this->app->is_managed_url($d) && !$this->app->is_hidden($n)) { + if ($this->app->is_managed_href($d) && !$this->app->is_hidden($n)) { $real_file = $this->app->to_path($href); $archived_file = preg_replace("!^" . preg_quote(Util::normalize_path($this->base_path, true)) . "!", "", $real_file); diff --git a/src/_h5ai/server/php/inc/class-item.php b/src/_h5ai/server/php/inc/class-item.php index 873d8ab0..6822cd60 100644 --- a/src/_h5ai/server/php/inc/class-item.php +++ b/src/_h5ai/server/php/inc/class-item.php @@ -35,7 +35,7 @@ class Item { public $app; - public $path, $url, $date, $size; + public $path, $href, $date, $size; public $is_folder, $is_content_fetched; @@ -45,7 +45,7 @@ class Item { $this->path = Util::normalize_path($path, false); $this->is_folder = is_dir($this->path); - $this->url = $app->to_url($this->path, $this->is_folder); + $this->href = $app->to_href($this->path, $this->is_folder); $this->date = @filemtime($this->path); $this->size = Util::filesize($app, $this->path); $this->is_content_fetched = false; @@ -55,13 +55,13 @@ class Item { public function to_json_object() { $obj = array( - "absHref" => $this->url, + "absHref" => $this->href, "time" => $this->date * 1000, // seconds (PHP) to milliseconds (JavaScript) "size" => $this->size ); if ($this->is_folder) { - $obj["isManaged"] = $this->app->is_managed_url($this->url); + $obj["isManaged"] = $this->app->is_managed_href($this->href); $obj["content"] = $this->is_content_fetched; } @@ -83,7 +83,7 @@ class Item { $items = array(); - if (!$this->app->is_managed_url($this->url)) { + if (!$this->app->is_managed_href($this->href)) { return $items; } diff --git a/src/_h5ai/server/php/inc/class-thumb.php b/src/_h5ai/server/php/inc/class-thumb.php index 9390b45e..e93c56ea 100644 --- a/src/_h5ai/server/php/inc/class-thumb.php +++ b/src/_h5ai/server/php/inc/class-thumb.php @@ -23,9 +23,9 @@ class Thumb { } - public function thumb($type, $source_url, $width, $height) { + public function thumb($type, $source_href, $width, $height) { - $source_path = $this->app->to_path($source_url); + $source_path = $this->app->to_path($source_href); if (!file_exists($source_path) || Util::starts_with($source_path, CACHE_PATH)) { return null; } @@ -55,7 +55,7 @@ class Thumb { $name = "thumb-" . sha1("$source_path") . "-" . $width . "x" . $height . ".jpg"; $thumb_path = $this->thumbs_path . "/" . $name; - $thumb_url = $this->thumbs_href . "/" . $name; + $thumb_href = $this->thumbs_href . "/" . $name; if (!file_exists($thumb_path) || filemtime($source_path) >= filemtime($thumb_path)) { @@ -77,7 +77,7 @@ class Thumb { $image->save_dest_jpeg($thumb_path, 80); } - return file_exists($thumb_path) ? $thumb_url : null; + return file_exists($thumb_path) ? $thumb_href : null; }