*/ // must be run within Dokuwiki if (!defined('DOKU_INC')) die(); if (!defined('DOKU_LF')) define('DOKU_LF', "\n"); if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t"); if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once DOKU_PLUGIN.'admin.php'; class admin_plugin_groupadmin extends DokuWiki_Admin_Plugin { var $_auth = null; var $_group_name = ''; /** * Constructor */ function admin_plugin_groupadmin(){ global $auth; $this->setupLocale(); if (!isset($auth)) { $this->disabled = $this->lang['noauth']; } else if (!$auth->canDo('getUsers')) { $this->disabled = $this->lang['nosupport']; } else { // we're good to go $this->_auth = & $auth; } } /** * return some info */ function getInfo(){ $info = parent::getInfo(); $info['desc'] = $info['desc'].' '.$this->disabled; return $info; } public function getMenuSort() { return 3; } /** * return prompt for admin menu */ function getMenuText($language) { if (!is_null($this->_auth)) return parent::getMenuText($language); return $this->getLang('title').' '.$this->disabled; } public function forAdminOnly() { return true; } public function handle() { global $ID; if (!isset($_REQUEST['cmd'])) return; // first time - nothing to do $this->output = 'invalid'; if (!checkSecurityToken()) return; if (!is_array($_REQUEST['cmd'])) return; if (is_null($this->_auth)) return false; if (is_array($fn)) { $cmd = key($fn); $param = is_array($fn[$cmd]) ? key($fn[$cmd]) : null; } else { $cmd = $fn; $param = null; } switch (key($_REQUEST['cmd'])) { case 'save' : $this->_group_name = $_REQUEST['groupname']; $this->_saveGroup($param); $this->_group_name = null; break; case 'load' : $this->_group_name = $_REQUEST['groupname']; break; } } public function html() { $all_users = $this->_auth->retrieveUsers(); if ($this->_auth->canDo("getGroups")) { $group_list = $this->_auth->retrieveGroups(); } else { $group_list = array(); foreach ($all_users as $user => $userinfo) { extract($userinfo); $group_list = array_merge($group_list, $grps); } $group_list = array_unique($group_list); } ptln('
'.htmlspecialchars($this->getLang('description')).'
'); ptln('