mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Minor refactorings.
This commit is contained in:
parent
799f1ecd13
commit
4c96efe1c7
2 changed files with 4 additions and 4 deletions
|
@ -6,7 +6,7 @@ var path = require('path'),
|
||||||
child_process = require('child_process');
|
child_process = require('child_process');
|
||||||
|
|
||||||
|
|
||||||
var version = '0.22-dev-8',
|
var version = '0.22-dev-11',
|
||||||
|
|
||||||
root = path.resolve(__dirname),
|
root = path.resolve(__dirname),
|
||||||
src = path.join(root, 'src'),
|
src = path.join(root, 'src'),
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Entry {
|
||||||
private static $cache = array();
|
private static $cache = array();
|
||||||
|
|
||||||
|
|
||||||
private static function startsWith($sequence, $part) {
|
private static function starts_with($sequence, $part) {
|
||||||
|
|
||||||
return (substr($sequence, 0, strlen($part)) === $part);
|
return (substr($sequence, 0, strlen($part)) === $part);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class Entry {
|
||||||
|
|
||||||
public static function get($h5ai, $absPath, $absHref) {
|
public static function get($h5ai, $absPath, $absHref) {
|
||||||
|
|
||||||
if (!Entry::startsWith($absHref, $h5ai->getRootAbsHref())) {
|
if (!Entry::starts_with($absHref, $h5ai->getRootAbsHref())) {
|
||||||
error_log("ILLEGAL REQUEST: " . $absHref . ", " . $absPath . ", " . $h5ai->getRootAbsHref());
|
error_log("ILLEGAL REQUEST: " . $absHref . ", " . $absPath . ", " . $h5ai->getRootAbsHref());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class Entry {
|
||||||
|
|
||||||
$this->parent = null;
|
$this->parent = null;
|
||||||
$parentAbsHref = H5ai::normalize_path(dirname($this->absHref), true);
|
$parentAbsHref = H5ai::normalize_path(dirname($this->absHref), true);
|
||||||
if ($this->absHref !== "/" && Entry::startsWith($parentAbsHref, $h5ai->getRootAbsHref())) {
|
if ($this->absHref !== "/" && Entry::starts_with($parentAbsHref, $h5ai->getRootAbsHref())) {
|
||||||
$this->parent = Entry::get($this->h5ai, H5ai::normalize_path(dirname($this->absPath)), $parentAbsHref);
|
$this->parent = Entry::get($this->h5ai, H5ai::normalize_path(dirname($this->absPath)), $parentAbsHref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue