Skip to content

Commit

Permalink
fix: do not show pages without AUTH_READ
Browse files Browse the repository at this point in the history
We now use the search function correctly for the pages, which now also
means, that the ACL-checks are working correctly 👍
  • Loading branch information
micgro42 committed Nov 21, 2017
1 parent 59c6d77 commit 1ed9ae0
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions helper.php
Expand Up @@ -7,19 +7,16 @@

class helper_plugin_sitemapnavi extends DokuWiki_Plugin {

protected $baseNS;

public function getSiteMap($baseNS)
{
global $conf, $INFO;
$this->baseNS = $baseNS;

$base = $conf['datadir'] . '/' . str_replace(':', '/', $baseNS);
$subdir = trim(str_replace(':', '/', $baseNS),'/');
$level = $this->getNumberOfSubnamespaces($baseNS) + 1;

$pages = array();
$currentNS = utf8_encodeFN(str_replace(':', '/', $INFO['namespace']));
search($pages, $base, 'search_index', array('ns' => $currentNS), '', $level);
search($pages, $conf['datadir'], 'search_index', array('ns' => $currentNS), $subdir, $level);
$media = array();
search($media, $conf['mediadir'], [$this, 'searchMediaIndex'], array('ns' => $currentNS, 'depth' => 1, 'showmsg'=>false), str_replace(':', '/', $baseNS));
$media = array_map(function($mediaFile) {
Expand Down Expand Up @@ -195,7 +192,7 @@ public function searchMediaIndex(&$data,$base,$file,$type,$lvl,$opts) {

public function listItemCallback($item)
{
$fullId = cleanID($this->baseNS . ':' . $item['id']);
$fullId = cleanID($item['id']);

$ret = '';
$base = ':' . $fullId;
Expand All @@ -221,7 +218,7 @@ public function liCallback($item)
{
global $INFO;
$currentClass = '';
$adjustedItemID = str_replace('::', ':', $this->baseNS . ':' . $item['id']);
$adjustedItemID = str_replace('::', ':', ':' . $item['id']);
if (strpos(':' . $INFO['id'] . ':', $adjustedItemID . ':') === 0) {
$currentClass = 'current';
}
Expand Down

0 comments on commit 1ed9ae0

Please sign in to comment.