From: Mischa POSLAWSKY Date: Thu, 7 Jan 2021 19:57:59 +0000 (+0100) Subject: edit/head: keep login containers only if editable X-Git-Tag: v5.1~2 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/217f7dc706236f1edbff198893b54f3518742879 edit/head: keep login containers only if editable Fix logout hiding for admins with missing edit stylesheet. --- diff --git a/article.inc.php b/article.inc.php index f14de99..8e121d3 100644 --- a/article.inc.php +++ b/article.inc.php @@ -223,7 +223,7 @@ class ArchiveArticle # keep either login or logout parts depending on user level global $User; $userexists = $User && property_exists($User, 'login') && $User->login; - if (! ($userexists and $User->admin("edit {$this->link}")) ) { + if (! ($userexists and !empty($this->editable)) ) { # remove matching elements until first corresponding closing tag $hideclass = $userexists ? 'logout' : 'login'; $tagmatch = '<([a-z]+) class="'.$hideclass.'"[^>]*>'; diff --git a/page.php b/page.php index 3e3f4cc..f9dabf0 100644 --- a/page.php +++ b/page.php @@ -56,7 +56,7 @@ $Page->place += [ 'url' => htmlspecialchars($_SERVER['REQUEST_URI']), ]; -if ($User->admin("edit {$Page->link}")) { +if ($Page->editable = $User->admin("edit {$Page->link}")) { include_once 'edit/head.inc.php'; }