function run($dbi, $argstr, &$request, $basepage) { return $this->disabled("This action is blocked by administrator. Sorry for the inconvenience !"); if ($request->getArg('action') != 'browse') { if (!$request->getArg('action') == _("PhpWikiAdministration/Chown")) { return $this->disabled("(action != 'browse')"); } } $args = $this->getArgs($argstr, $request); $this->_args = $args; if (empty($args['user'])) { $args['user'] = $request->_user->UserName(); } /*if (!empty($args['exclude'])) $exclude = explodePageList($args['exclude']); else $exclude = false;*/ $this->preSelectS($args, $request); $p = $request->getArg('p'); if (!$p) { $p = $this->_list; } $post_args = $request->getArg('admin_chown'); if (!$request->isPost() and empty($post_args['user'])) { $post_args['user'] = $args['user']; } $next_action = 'select'; $pages = array(); if ($p && !$request->isPost()) { $pages = $p; } if ($p && $request->isPost() && !empty($post_args['chown']) && empty($post_args['cancel'])) { // without individual PagePermissions: if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } // DONE: error message if not allowed. if ($post_args['action'] == 'verify') { // Real action return $this->chownPages($dbi, $request, array_keys($p), $post_args['user']); } if ($post_args['action'] == 'select') { if (!empty($post_args['user'])) { $next_action = 'verify'; } foreach ($p as $name => $c) { $pages[$name] = 1; } } } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } /* // let the user decide which info if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,owner,mtime"; } */ $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args); $pagelist->addPageList($pages); $header = HTML::p(); if ($next_action == 'verify') { $button_label = _("Yes"); $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently chown the selected files?")))); $header = $this->chownForm($header, $post_args); } else { $button_label = _("Chown selected pages"); $header->pushContent(HTML::p(_("Select the pages to change the owner:"))); $header = $this->chownForm($header, $post_args); } $buttons = HTML::p(Button('submit:admin_chown[chown]', $button_label, 'wikiadmin'), Button('submit:admin_chown[cancel]', _("Cancel"), 'button')); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_chown')), HiddenInputs(array('admin_chown[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons); }
function run($dbi, $argstr, &$request, $basepage) { if ($request->getArg('action') != 'browse') { if ($request->getArg('action') != _("PhpWikiAdministration/SetAcl")) { return $this->disabled("(action != 'browse')"); } } if (!ENABLE_PAGEPERM) { return $this->disabled("ENABLE_PAGEPERM = false"); } $args = $this->getArgs($argstr, $request); $this->_args = $args; $this->preSelectS($args, $request); $p = $request->getArg('p'); $post_args = $request->getArg('admin_setacl'); $next_action = 'select'; $pages = array(); if ($p && !$request->isPost()) { $pages = $p; } elseif ($this->_list) { $pages = $this->_list; } $header = HTML::fieldset(); if ($p && $request->isPost() && !empty($post_args['acl']) && empty($post_args['cancel'])) { // without individual PagePermissions: if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } if ($post_args['action'] == 'verify') { // Real action return $this->setaclPages($request, array_keys($p), $request->getArg('acl')); } if ($post_args['action'] == 'select') { if (!empty($post_args['acl'])) { $next_action = 'verify'; } foreach ($p as $name => $c) { $pages[$name] = 1; } } } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,perm,mtime,owner,author"; } $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') { $button_label = _("Yes"); $header = $this->setaclForm($header, $post_args, $pages); $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently change access rights to the selected files?")))); } else { $button_label = _("Change Access Rights"); $header = $this->setaclForm($header, $post_args, $pages); $header->pushContent(HTML::legend(_("Select the pages where to change access rights"))); } $buttons = HTML::p(Button('submit:admin_setacl[acl]', $button_label, 'wikiadmin'), Button('submit:admin_setacl[cancel]', _("Cancel"), 'button')); $header->pushContent($buttons); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_setacl')), HiddenInputs(array('admin_setacl[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN))); }
function run($dbi, $argstr, &$request, $basepage) { //if ($request->getArg('action') != 'browse') // return $this->disabled("(action != 'browse')"); $args = $this->getArgs($argstr, $request); $this->_args = $args; extract($args); $this->preSelectS($args, $request); $info = $args['info']; $this->debug = $args['debug']; // array_multisort($this->_list, SORT_NUMERIC, SORT_DESC); $pagename = $request->getArg('pagename'); // GetUrlToSelf() with all given params //$uri = $GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI']; // without s would be better. //$uri = $request->getURLtoSelf();//false, array('verify')); $form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'POST')); if ($request->getArg('WikiAdminSelect') == _("Go")) { $p = false; } else { $p = $request->getArg('p'); } //$p = @$GLOBALS['HTTP_POST_VARS']['p']; $form->pushContent(HTML::p(array('class' => 'wikitext'), _("Select: "), HTML::input(array('type' => 'text', 'name' => 's', 'value' => $args['s'])), HTML::input(array('type' => 'submit', 'name' => 'WikiAdminSelect', 'value' => _("Go"))))); if ($request->isPost() && !$request->getArg('wikiadmin') && !empty($p)) { $this->_list = array(); // List all selected pages again. foreach ($p as $page => $name) { $this->_list[$name] = 1; } } elseif ($request->isPost() and $request->_user->isAdmin() and !empty($p) and $request->getArg('action') == 'WikiAdminSelect' and $request->getArg('wikiadmin')) { // handle external plugin $loader = new WikiPluginLoader(); $a = array_keys($request->getArg('wikiadmin')); $plugin_action = $a[0]; $single_arg_plugins = array("Remove"); if (in_array($plugin_action, $single_arg_plugins)) { $plugin = $loader->getPlugin($plugin_action); $ul = HTML::ul(); foreach ($p as $page => $name) { $plugin_args = "run_page={$name}"; $request->setArg($plugin_action, 1); $request->setArg('p', array($page => $name)); // if the plugin requires more args than the pagename, // then this plugin will not return. (Rename, SearchReplace, ...) $action_result = $plugin->run($dbi, $plugin_args, $request, $basepage); $ul->pushContent(HTML::li(fmt("Selected page '%s' passed to '%s'.", $name, $select))); $ul->pushContent(HTML::ul(HTML::li($action_result))); } } else { // redirect to the plugin page. // in which page is this plugin? $plugin_action = preg_replace("/^WikiAdmin/", "", $plugin_action); $args = array(); foreach ($p as $page => $x) { $args["p[{$page}]"] = 1; } header("Location: " . WikiURL(_("PhpWikiAdministration") . "/" . _($plugin_action), $args, 1)); exit; } } elseif (empty($args['s'])) { // List all pages to select from. $this->_list = $this->collectPages($this->_list, $dbi, $args['sortby'], $args['limit']); } $pagelist = new PageList_Selectable($info, $args['exclude'], $args); $pagelist->addPageList($this->_list); $form->pushContent($pagelist->getContent()); foreach ($args as $k => $v) { if (!in_array($k, array('s', 'WikiAdminSelect', 'action', 'verify'))) { $form->pushContent(HiddenInputs(array($k => $v))); } // plugin params } /* foreach ($_GET as $k => $v) { if (!in_array($k,array('s','WikiAdminSelect','action'))) $form->pushContent(HiddenInputs(array($k => $v))); // debugging params, ... } */ if (!$request->getArg('verify')) { $form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'action', 'value' => 'verify'))); $form->pushContent(Button('submit:verify', _("Select pages"), 'wikiadmin'), Button('submit:cancel', _("Cancel"), 'button')); } else { global $WikiTheme; $form->pushContent(HTML::input(array('type' => 'hidden', 'name' => 'action', 'value' => 'WikiAdminSelect'))); // Add the Buttons for all registered WikiAdmin plugins $plugin_dir = 'lib/plugin'; if (defined('PHPWIKI_DIR')) { $plugin_dir = PHPWIKI_DIR . "/{$plugin_dir}"; } $fs = new fileSet($plugin_dir, 'WikiAdmin*.php'); $actions = $fs->getFiles(); foreach ($actions as $f) { $f = preg_replace('/.php$/', '', $f); $s = preg_replace('/^WikiAdmin/', '', $f); if (!in_array($s, array("Select", "Utils"))) { // disable Select and Utils $form->pushContent(Button("submit:wikiadmin[{$f}]", _($s), "wikiadmin")); $form->pushContent($WikiTheme->getButtonSeparator()); } } $form->pushContent(Button('submit:cancel', _("Cancel"), 'button')); } if (!$request->getArg('select')) { return $form; } else { //return $action_result; } }
function run($dbi, $argstr, &$request, $basepage) { if ($request->getArg('action') != 'browse') { if (!$request->getArg('action') == _("PhpWikiAdministration/SetExternal")) { return $this->disabled("(action != 'browse')"); } } $args = $this->getArgs($argstr, $request); $this->_args = $args; $this->preSelectS($args, $request); $p = $request->getArg('p'); if (!$p) { $p = $this->_list; } $post_args = $request->getArg('admin_external'); if (!$request->isPost() and empty($post_args['external'])) { $post_args['external'] = $args['external']; } $pages = array(); if ($p && !$request->isPost()) { $pages = $p; } if ($p && $request->isPost() && !empty($post_args['button']) && empty($post_args['cancel'])) { // without individual PagePermissions: if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } // Real action return $this->setExternalPages($dbi, $request, array_keys($p)); } $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args); $pagelist->addPageList($pages); $header = HTML::fieldset(); $button_label = _("Set pages to external"); $header->pushContent(HTML::legend(_("Select the pages to set as external"))); $buttons = HTML::p(Button('submit:admin_external[button]', $button_label, 'wikiadmin'), Button('submit:admin_external[cancel]', _("Cancel"), 'button')); $header->pushContent($buttons); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_external')), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN))); }
function run($dbi, $argstr, &$request, $basepage) { return $this->disabled("This action is blocked by administrator. Sorry for the inconvenience !"); if (!DEBUG) { return $this->disabled("WikiAdminChmod not yet enabled. Set DEBUG to try it."); } $args = $this->getArgs($argstr, $request); $this->_args = $args; $this->preSelectS($args, $request); $p = $request->getArg('p'); if (!$p) { $p = $this->_list; } $post_args = $request->getArg('admin_chmod'); $next_action = 'select'; $pages = array(); if ($p && !$request->isPost()) { $pages = $p; } if ($p && $request->isPost() && !empty($post_args['chmod']) && empty($post_args['cancel'])) { // without individual PagePermissions: if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } if ($post_args['action'] == 'verify') { // Real action return $this->chmodPages($dbi, $request, array_keys($p), $post_args['perm']); } if ($post_args['action'] == 'select') { if (!empty($post_args['perm'])) { $next_action = 'verify'; } foreach ($p as $name => $c) { $pages[$name] = 1; } } } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,perm,author,mtime"; } $args['types'] = array('perm' => new _PageList_Column_chmod_perm('perm', _("Permission"))); $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args); $pagelist->addPageList($pages); $header = HTML::p(); if ($next_action == 'verify') { $button_label = _("Yes"); $header = $this->chmodForm($header, $post_args); $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently change the selected files?")))); } else { $button_label = _("Chmod"); $header = $this->chmodForm($header, $post_args); $header->pushContent(HTML::p(_("Select the pages to change:"))); } $buttons = HTML::p(Button('submit:admin_chmod[chmod]', $button_label, 'wikiadmin'), Button('submit:admin_chmod[cancel]', _("Cancel"), 'button')); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_chmod')), HiddenInputs(array('admin_chmod[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons); }
function run($dbi, $argstr, &$request, $basepage) { // no action=replace support yet if ($request->getArg('action') != 'browse') { return $this->disabled("(action != 'browse')"); } $args = $this->getArgs($argstr, $request); $this->_args = $args; //TODO: support p from <!plugin-list !> $this->preSelectS($args, $request); $p = $request->getArg('p'); if (!$p) { $p = $this->_list; } $post_args = $request->getArg('admin_replace'); $next_action = 'select'; $pages = array(); if ($p && !$request->isPost()) { $pages = $p; } if ($p && $request->isPost() && empty($post_args['cancel'])) { // without individual PagePermissions: if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } if ($post_args['action'] == 'verify' and !empty($post_args['from'])) { // Real action return $this->searchReplacePages($dbi, $request, array_keys($p), $post_args['from'], $post_args['to']); } if ($post_args['action'] == 'select') { if (!empty($post_args['from'])) { $next_action = 'verify'; } foreach ($p as $name => $c) { $pages[$name] = 1; } } } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. //TODO: check for permissions and list only the allowed $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,hi_content"; } $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array_merge($args, array('types' => array('hi_content' => new _PageList_Column_content('rev:hi_content', _("Content")))))); $pagelist->addPageList($pages); $header = HTML::p(); if (empty($post_args['from'])) { $header->pushContent(HTML::p(HTML::em(_("Warning: The search string cannot be empty!")))); } if ($next_action == 'verify') { $button_label = _("Yes"); $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently search & replace text in the selected files?")))); $this->replaceForm($header, $post_args); } else { $button_label = _("Search & Replace"); $this->replaceForm($header, $post_args); $header->pushContent(HTML::p(_("Select the pages to search:"))); } $buttons = HTML::p(Button('submit:admin_replace[rename]', $button_label, 'wikiadmin'), Button('submit:admin_replace[cancel]', _("Cancel"), 'button')); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_replace')), HiddenInputs(array('admin_replace[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons); }
function run($dbi, $argstr, &$request, $basepage) { if ($request->getArg('action') != 'browse') { if ($request->getArg('action') != _("PhpWikiAdministration/MassRevert")) { return $this->disabled("(action != 'browse')"); } } $args = $this->getArgs($argstr, $request); if (!is_numeric($args['min_age'])) { $args['min_age'] = -1; } $this->_args =& $args; /*if (!empty($args['exclude'])) $exclude = explodePageList($args['exclude']); else $exclude = false;*/ $this->preSelectS($args, $request); $p = $request->getArg('p'); if (!$p) { $p = $this->_list; } $post_args = $request->getArg('admin_revert'); $next_action = 'select'; $pages = array(); if ($p && $request->isPost() && !empty($post_args['revert']) && empty($post_args['cancel'])) { // check individual PagePermissions if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } if ($post_args['action'] == 'verify') { // Real delete. return $this->revertPages($request, array_keys($p)); } if ($post_args['action'] == 'select') { $next_action = 'verify'; foreach ($p as $name => $c) { $name = str_replace(array('%5B', '%5D'), array('[', ']'), $name); $pages[$name] = $c; } } } elseif ($p && is_array($p) && !$request->isPost()) { // from WikiAdminSelect $next_action = 'verify'; foreach ($p as $name => $c) { $name = str_replace(array('%5B', '%5D'), array('[', ']'), $name); $pages[$name] = $c; } $request->setArg('p', false); } if ($next_action == 'select') { // List all pages to select from. $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array('types' => array('revert' => new _PageList_Column_revert('revert', _("Revert")), 'diff' => new _PageList_Column_diff('diff', _("Changes"))))); $pagelist->addPageList($pages); $header = HTML::p(); if ($next_action == 'verify') { $button_label = _("Yes"); $header->pushContent(HTML::strong(_("Are you sure you want to overwrite the selected files with the previous version?"))); } else { $button_label = _("Revert selected pages"); $header->pushContent(_("Permanently remove the selected files:"), HTML::br()); if ($args['min_age'] > 0) { $header->pushContent(fmt("Also pages which have been deleted at least %s days.", $args['min_age'])); } else { $header->pushContent(_("List all pages.")); } if ($args['max_age'] > 0) { $header->pushContent(" ", fmt("(Pages which have been deleted at least %s days are already checked.)", $args['max_age'])); } } $buttons = HTML::p(Button('submit:admin_revert[revert]', $button_label, 'wikiadmin'), Button('submit:admin_revert[cancel]', _("Cancel"), 'button')); // TODO: quick select by regex javascript? return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_revert')), HiddenInputs(array('admin_revert[action]' => $next_action, 'require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons); }
function run($dbi, $argstr, &$request, $basepage) { if ($request->getArg('action') != 'browse') { if ($request->getArg('action') != _("PhpWikiAdministration/Rename")) { return $this->disabled("(action != 'browse')"); } } $args = $this->getArgs($argstr, $request); $this->_args = $args; $this->preSelectS($args, $request); $p = $request->getArg('p'); if (!$p) { $p = $this->_list; } $post_args = $request->getArg('admin_rename'); $next_action = 'select'; $pages = array(); if ($p && !$request->isPost()) { $pages = $p; } if ($p && $request->isPost() && !empty($post_args['rename']) && empty($post_args['cancel'])) { // without individual PagePermissions: if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } // DONE: error message if not allowed. if ($post_args['action'] == 'verify') { // Real action return $this->renamePages($dbi, $request, array_keys($p), $post_args['from'], $post_args['to'], !empty($post_args['updatelinks'])); } if ($post_args['action'] == 'select') { if (!empty($post_args['from'])) { $next_action = 'verify'; } foreach ($p as $name => $c) { $pages[$name] = 1; } } } if ($next_action == 'select' and empty($pages)) { // List all pages to select from. $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } if ($next_action == 'verify') { $args['info'] = "checkbox,pagename,renamed_pagename"; } $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array('types' => array('renamed_pagename' => new _PageList_Column_renamed_pagename('rename', _("Rename to"))))); $pagelist->addPageList($pages); $header = HTML::p(); if ($next_action == 'verify') { $button_label = _("Yes"); $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently rename the selected files?")))); $header = $this->renameForm($header, $post_args); } else { $button_label = _("Rename selected pages"); $header->pushContent(HTML::p(_("Select the pages to rename:"))); if (!$post_args and count($pages) == 1) { list($post_args['from'], ) = array_keys($pages); $post_args['to'] = $post_args['from']; } $header = $this->renameForm($header, $post_args); } $buttons = HTML::p(Button('submit:admin_rename[rename]', $button_label, 'wikiadmin'), Button('submit:admin_rename[cancel]', _("Cancel"), 'button')); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_rename')), HiddenInputs(array('admin_rename[action]' => $next_action)), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN)), $buttons); }
function run($dbi, $argstr, &$request, $basepage) { if ($request->getArg('action') != 'browse') { if ($request->getArg('action') != _("PhpWikiAdministration/SetAclSimple")) { return $this->disabled("(action != 'browse')"); } } if (!ENABLE_PAGEPERM) { return $this->disabled("ENABLE_PAGEPERM = false"); } $args = $this->getArgs($argstr, $request); $this->_args = $args; $this->preSelectS($args, $request); $p = $request->getArg('p'); $post_args = $request->getArg('admin_setacl'); $pages = array(); if ($p && !$request->isPost()) { $pages = $p; } elseif ($this->_list) { $pages = $this->_list; } $header = HTML::fieldset(); if ($p && $request->isPost() && (!empty($post_args['aclliberal']) || !empty($post_args['aclrestricted']))) { // without individual PagePermissions: if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } if (!empty($post_args['aclliberal'])) { return $this->setaclPages($request, array_keys($p), $this->liberalPerms()); } else { if (!empty($post_args['aclrestricted'])) { return $this->setaclPages($request, array_keys($p), $this->restrictedPerms()); } } } if (empty($pages)) { // List all pages to select from. $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array('types' => array('acl' => new _PageList_Column_acl('acl', _("ACL"))))); $pagelist->addPageList($pages); $button_label_liberal = _("Set Liberal Access Rights"); $button_label_restrictive = _("Set Restrictive Access Rights"); $header = $this->setaclForm($header, $pages); $header->pushContent(HTML::legend(_("Select the pages where to change access rights"))); $buttons = HTML::p(Button('submit:admin_setacl[aclliberal]', $button_label_liberal, 'wikiadmin'), Button('submit:admin_setacl[aclrestricted]', $button_label_restrictive, 'wikiadmin')); $header->pushContent($buttons); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_setacl')), ENABLE_PAGEPERM ? '' : HiddenInputs(array('require_authority_for_post' => WIKIAUTH_ADMIN))); }
function run($dbi, $argstr, &$request, $basepage) { if ($request->getArg('action') != 'browse') { if ($request->getArg('action') != _("PhpWikiAdministration/Purge")) { return $this->disabled("(action != 'browse')"); } } $args = $this->getArgs($argstr, $request); $this->_args =& $args; $this->preSelectS($args, $request); $p = $request->getArg('p'); if (!$p) { $p = $this->_list; } $post_args = $request->getArg('admin_purge'); $next_action = 'select'; $pages = array(); if ($p && $request->isPost() && !empty($post_args['purge']) && empty($post_args['cancel'])) { // check individual PagePermissions if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } if ($post_args['action'] == 'verify') { // Real purge. return $this->purgePages($request, array_keys($p)); } if ($post_args['action'] == 'select') { $next_action = 'verify'; foreach ($p as $name => $c) { $name = str_replace(array('%5B', '%5D'), array('[', ']'), $name); $pages[$name] = $c; } } } elseif ($p && is_array($p) && !$request->isPost()) { // from WikiAdminSelect $next_action = 'verify'; foreach ($p as $name => $c) { $name = str_replace(array('%5B', '%5D'), array('[', ']'), $name); $pages[$name] = $c; } $request->setArg('p', false); } if ($next_action == 'select') { // List all pages to select from. $pages = $this->collectPages($pages, $dbi, $args['sortby'], $args['limit'], $args['exclude']); } $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array()); $pagelist->addPageList($pages); $header = HTML::fieldset(); if ($next_action == 'verify') { $button_label = _("Yes"); $header->pushContent(HTML::p(HTML::strong(_("Are you sure you want to permanently purge the following files?")))); } else { $button_label = _("Permanently purge selected pages"); $header->pushContent(HTML::legend(_("Select the files to purge"))); } $buttons = HTML::p(Button('submit:admin_purge[purge]', $button_label, 'wikiadmin'), Button('submit:admin_purge[cancel]', _("Cancel"), 'button')); $header->pushContent($buttons); // TODO: quick select by regex javascript? return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, array('admin_purge')), HiddenInputs(array('admin_purge[action]' => $next_action, 'require_authority_for_post' => WIKIAUTH_ADMIN))); }