Integrate Dokuwiki ACL for file endpoint
This commit is contained in:
33
Output.php
33
Output.php
@@ -562,10 +562,37 @@ class Output
|
||||
*/
|
||||
protected function itemWebUrl($item, $cachbuster = false)
|
||||
{
|
||||
if (str_ends_with($this->webdir, '=')) {
|
||||
$url = $this->webdir . rawurlencode($item['local']);
|
||||
$webdir = $this->webdir;
|
||||
|
||||
// When using the built-in file-serving endpoint, include the current page id
|
||||
// so file.php can enforce DokuWiki ACLs for that page.
|
||||
if (
|
||||
is_string($webdir)
|
||||
&& $webdir !== ''
|
||||
&& strpos($webdir, 'lib/plugins/luxtools/file.php') !== false
|
||||
&& strpos($webdir, 'id=') === false
|
||||
) {
|
||||
global $ID;
|
||||
$pageId = isset($ID) ? (string)$ID : '';
|
||||
if ($pageId !== '') {
|
||||
if (function_exists('cleanID')) {
|
||||
$pageId = (string)cleanID($pageId);
|
||||
}
|
||||
if ($pageId !== '') {
|
||||
$encoded = rawurlencode($pageId);
|
||||
if (strpos($webdir, '&file=') !== false) {
|
||||
$webdir = str_replace('&file=', '&id=' . $encoded . '&file=', $webdir);
|
||||
} elseif (strpos($webdir, '?file=') !== false) {
|
||||
$webdir = str_replace('?file=', '?id=' . $encoded . '&file=', $webdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (str_ends_with($webdir, '=')) {
|
||||
$url = $webdir . rawurlencode($item['local']);
|
||||
} else {
|
||||
$url = $this->webdir . $item['local'];
|
||||
$url = $webdir . $item['local'];
|
||||
}
|
||||
|
||||
if ($cachbuster) {
|
||||
|
||||
Reference in New Issue
Block a user