SF.net SVN: phpwiki:[10755] trunk/lib/plugin/WikiAdminSetAcl.php

vargenau--- via phpwiki-checkins <[email protected]>
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 10755
          http://sourceforge.net/p/phpwiki/code/10755
Author:   vargenau
Date:     2021-12-09 13:58:30 +0000 (Thu, 09 Dec 2021)
Log Message:
-----------
WikiAdminSetAcl plugin: factor code

Modified Paths:
--------------
    trunk/lib/plugin/WikiAdminSetAcl.php

Modified: trunk/lib/plugin/WikiAdminSetAcl.php
===================================================================
--- trunk/lib/plugin/WikiAdminSetAcl.php	2021-12-09 13:47:59 UTC (rev 10754)
+++ trunk/lib/plugin/WikiAdminSetAcl.php	2021-12-09 13:58:30 UTC (rev 10755)
@@ -57,7 +57,7 @@
             ));
     }
 
-    protected function setaclPages(&$request, $pages, $acl)
+    protected function setaclPages($request, $pages, $acl)
     {
         $result = HTML::div();
         $count = 0;
@@ -194,15 +194,15 @@
             $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']);
         }
 
+        $pagelist = new PageList_Selectable($args['info'],
+            $args['exclude'],
+            array('types' => array(
+                'perm'
+                => new _PageList_Column_perm('perm', _("Permission")),
+                'acl'
+                => new _PageList_Column_acl('acl', _("ACL")))));
+        $pagelist->addPageList($pages);
         if ($next_action == 'verify') {
-            $pagelist = new PageList_Selectable($args['info'],
-                $args['exclude'],
-                array('types' => array(
-                    'perm'
-                    => new _PageList_Column_perm('perm', _("Permission")),
-                    'acl'
-                    => new _PageList_Column_acl('acl', _("ACL")))));
-            $pagelist->addPageList($pages);
             $button_label = _("Yes");
             $header = $this->setaclForm($header, $post_args, $pages);
             $header->pushContent(
@@ -209,14 +209,6 @@
                 HTML::p(HTML::strong(
                     _("Are you sure you want to permanently change access rights to the selected pages?"))));
         } else {
-            $pagelist = new PageList_Selectable($args['info'],
-                $args['exclude'],
-                array('types' => array(
-                    'perm'
-                    => new _PageList_Column_perm('perm', _("Permission")),
-                    'acl'
-                    => new _PageList_Column_acl('acl', _("ACL")))));
-            $pagelist->addPageList($pages);
             $button_label = _("Change Access Rights");
             $header = $this->setaclForm($header, $post_args, $pages);
             $header->pushContent(HTML::legend(_("Select the pages where to change access rights")));
@@ -240,7 +232,7 @@
                 : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)));
     }
 
-    function setaclForm(&$header, $post_args, $pagehash)
+    private function setaclForm($header, $post_args, $pagehash)
     {
         /**
          * @var WikiRequest $request
@@ -247,8 +239,6 @@
          */
         global $request;
 
-        $acl = $post_args['acl'];
-
         //FIXME: find intersection of all pages perms, not just from the last pagename
         $pages = array();
         foreach ($pagehash as $name => $checked) {
@@ -258,13 +248,12 @@
         $table = pagePermissionsAclFormat($perm_tree, !empty($pages));
         $header->pushContent(HTML::strong(_("Selected Pages: ")), HTML::samp(join(', ', $pages)), HTML::br());
         $first_page = $request->_dbi->getPage($name);
-        $owner = $first_page->getOwner();
         list($type, $perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
-        //if (DEBUG) $header->pushContent(HTML::pre("Permission tree for $name:\n",print_r($perm_tree,true)));
         if ($type == 'inherited')
             $type = sprintf(_("page permission inherited from %s"), $perm_tree[1][0]);
         elseif ($type == 'page')
-            $type = _("individual page permission"); elseif ($type == 'default')
+            $type = _("individual page permission");
+        elseif ($type == 'default')
             $type = _("default page permission");
         $header->pushContent(HTML::strong(_("Type") . _(": ")), HTML::samp($type), HTML::br());
         $header->pushContent(HTML::strong(_("ACL") . _(": ")), HTML::samp($perm->asAclLines()), HTML::br());

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.