Don't read file contents of inaccessible pages
This commit is contained in:
parent
95db5ba1a1
commit
45815e2c6d
14
lib/Pico.php
14
lib/Pico.php
@ -717,6 +717,13 @@ class Pico
|
|||||||
}
|
}
|
||||||
|
|
||||||
$id = substr($file, strlen($this->getConfig('content_dir')), -strlen($this->getConfig('content_ext')));
|
$id = substr($file, strlen($this->getConfig('content_dir')), -strlen($this->getConfig('content_ext')));
|
||||||
|
|
||||||
|
// drop inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists)
|
||||||
|
$conflictFile = $this->getConfig('content_dir') . $id . '/index' . $this->getConfig('content_ext');
|
||||||
|
if (in_array($conflictFile, $files, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$url = $this->getPageUrl($id);
|
$url = $this->getPageUrl($id);
|
||||||
if ($file != $this->requestFile) {
|
if ($file != $this->requestFile) {
|
||||||
$rawContent = file_get_contents($file);
|
$rawContent = file_get_contents($file);
|
||||||
@ -726,13 +733,6 @@ class Pico
|
|||||||
$meta = &$this->meta;
|
$meta = &$this->meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists)
|
|
||||||
if (substr($id, -6) === '/index') {
|
|
||||||
unset($pages[dirname($id)]);
|
|
||||||
} elseif (isset($pages[$id . '/index'])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// build page data
|
// build page data
|
||||||
// title, description, author and date are assumed to be pretty basic data
|
// title, description, author and date are assumed to be pretty basic data
|
||||||
// everything else is accessible through $page['meta']
|
// everything else is accessible through $page['meta']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user