edit/head: keep login containers only if editable
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 7 Jan 2021 19:57:59 +0000 (20:57 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 10 Jan 2021 05:02:36 +0000 (06:02 +0100)
Fix logout hiding for admins with missing edit stylesheet.

article.inc.php
page.php

index f14de99079301d2574d0ae5752c5d5af76a22579..8e121d36196705ceeed56f2d17e1c1df73914308 100644 (file)
@@ -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.'"[^>]*>';
index 3e3f4cc10e4db38f995f195a8023e3138c2130d4..f9dabf07caf4f7a9e3e2d231a4e67f6efad86da9 100644 (file)
--- 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';
 }