Add 'hideIf403' option.

This commit is contained in:
Lars Jung 2014-05-31 00:28:58 +02:00
parent 25d84fe3df
commit dfa72936f2
3 changed files with 11 additions and 3 deletions

View File

@ -9,6 +9,7 @@
* adds icons from [Evolvere Icon Theme](http://franksouza183.deviantart.com/art/Evolvere-Icon-theme-440718295)
* adds PHP variant to calc folder sizes
* adds scroll position reset on location change (issue #279)
* adds "hide if 403" option
* updates H5BP to 4.3.0
* updates jQuery to 2.1.1
* updates json2.js to 2014-02-04

View File

@ -41,6 +41,7 @@ Options
- ignore: don't list items matching these regular expressions
- smartBrowsing: use History API if available (no need to reload the whole page)
- extInNewWindow: open non-h5ai links in new window/tab
- hideIf403: hide files and folders that are not readable by the server
*/
"view": {
"modes": ["details", "grid", "icons"],
@ -52,7 +53,8 @@ Options
"indexFiles": ["index.html", "index.htm", "index.php"],
"ignore": ["^\\.", "^_{{pkg.name}}"],
"smartBrowsing": true,
"extInNewWindow": false
"extInNewWindow": false,
"hideIf403": true
},

View File

@ -80,9 +80,14 @@ class App {
if (is_dir($path)) {
if ($dir = opendir($path)) {
while (($name = readdir($dir)) !== false) {
if (!$this->is_ignored($name) && !$this->is_ignored($this->to_url($path) . $name)) {
$names[] = $name;
if (
$this->is_ignored($name)
|| $this->is_ignored($this->to_url($path) . $name)
|| (!is_readable($path .'/'. $name) && $this->options["view"]["hideIf403"])
) {
continue;
}
$names[] = $name;
}
closedir($dir);
}