diff --git a/_test/tests/inc/pageutils_findnearest.test.php b/_test/tests/inc/pageutils_findnearest.test.php index 1709626507c33b9b3fef07769b93f085b72628e4..d62d3dd78d07dc60196f1946356587f605d5fe8b 100644 --- a/_test/tests/inc/pageutils_findnearest.test.php +++ b/_test/tests/inc/pageutils_findnearest.test.php @@ -78,7 +78,7 @@ class pageutils_findnearest_test extends DokuWikiTest { $sidebar = page_findnearest('sidebar'); $this->assertEquals('sidebar', $sidebar); - $sidebar = page_findnearest('sidebar', true); + $sidebar = page_findnearest('sidebar', false); $this->assertEquals('internal:sidebar', $sidebar); $INPUT->server->set('REMOTE_USER', 'max'); diff --git a/inc/pageutils.php b/inc/pageutils.php index e5f2d35a4975d84af0017d00fb9a6050e675be6b..04ec54ad83644e3190b59f7a0399a500a08b6fa6 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -746,10 +746,10 @@ function utf8_decodeFN($file){ * @todo add event hook * * @param string $page the pagename you're looking for - * @param bool $ignoreacl If pages that can't be accessed by the current user shall be returend + * @param bool $useacl only return pages readable by the current user, false to ignore ACLs * @return false|string the full page id of the found page, false if any */ -function page_findnearest($page, $ignoreacl = false){ +function page_findnearest($page, $useacl = true){ if (!$page) return false; global $ID; @@ -757,7 +757,7 @@ function page_findnearest($page, $ignoreacl = false){ do { $ns = getNS($ns); $pageid = cleanID("$ns:$page"); - if(page_exists($pageid) && ($ignoreacl || auth_quickaclcheck($pageid) >= AUTH_READ)){ + if(page_exists($pageid) && (!$useacl || auth_quickaclcheck($pageid) >= AUTH_READ)){ return $pageid; } } while($ns); diff --git a/inc/template.php b/inc/template.php index 5c2dc153bd17c81a323bb8cd5b1e4cc530775b25..92de109e84c22319425df06ae4fb0ca7e18e58d7 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1712,14 +1712,14 @@ function tpl_license($img = 'badge', $imgonly = false, $return = false, $wrap = * @param string $pageid The page name you want to include * @param bool $print Should the content be printed or returned only * @param bool $propagate Search higher namespaces, too? - * @param bool $ignoreacl Include the page without chcking ACLs? + * @param bool $useacl Include the page only if the ACLs check out? * @return bool|null|string */ -function tpl_include_page($pageid, $print = true, $propagate = false, $ignoreacl = false) { +function tpl_include_page($pageid, $print = true, $propagate = false, $useacl = true) { if (!$pageid) return false; if($propagate) { - $pageid = page_findnearest($pageid, $ignoreacl); - } elseif(!$ignoreacl && auth_quickaclcheck($pageid) == AUTH_NONE) { + $pageid = page_findnearest($pageid, $useacl); + } elseif($useacl && auth_quickaclcheck($pageid) == AUTH_NONE) { return false; }