diff --git a/admin/admin_permissions.php b/admin/admin_permissions.php index 00e9516c..edd1729a 100644 --- a/admin/admin_permissions.php +++ b/admin/admin_permissions.php @@ -119,7 +119,7 @@ public function render() if ('' !== $elements[$i]->getDescription()) { $ret .= '

' . $elements[$i]->getDescription() . ''; } - $ret .= "\n\n" . $elements[$i]->render() . "\n\n"; + $ret .= "\n\n" . $elements[$i]->render() . "\n\n"; } else { $hidden .= $elements[$i]->render(); } @@ -205,16 +205,16 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) //$action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ""; $action = strtolower(Request::getCmd('action', '')); $module_id = $xoopsModule->getVar('mid'); -///** @var \NewbbPermissionHandler $permHandler */ -//$permHandler = xoops_getModuleHandler('permission', 'newbb'); -$perms = $permHandler->getValidForumPerms(); +/** @var \NewbbPermissionHandler $newbbpermHandler */ +$newbbpermHandler = xoops_getModuleHandler('permission', 'newbb'); +$perms = $newbbpermHandler->getValidForumPerms(); switch ($action) { case 'template': xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); + $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_TEMPLAT, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray([ @@ -229,7 +229,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $memberHandler = xoops_getHandler('member'); $glist = $memberHandler->getGroupList(); $elements = []; - $perm_template = $permHandler->getTemplate(); + $perm_template = $newbbpermHandler->getTemplate(); foreach (array_keys($glist) as $i) { $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : []; $ret_ele = '' . $glist[$i] . ''; @@ -260,17 +260,17 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $ret = '

' . _AM_NEWBB_PERM_TEMPLATE . '

' . _AM_NEWBB_PERM_TEMPLATE_DESC . '


'; $ret .= "
\n\n"; $ret .= implode("\n", $elements); - $ret .= ''; $ret .= '
'; + $ret .= '
'; $ret .= $tray->render(); $ret .= '
'; echo $ret; include_once __DIR__ . '/admin_footer.php'; break; - + case 'template_save': - // $res = $permHandler->setTemplate($_POST['perms'], $groupid = 0); - $res = $permHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0); + // $res = $newbbpermHandler->setTemplate($_POST['perms'], $groupid = 0); + $res = $newbbpermHandler->setTemplate(Request::getArray('perms', '', 'POST'), $groupid = 0); if ($res) { redirect_header('admin_permissions.php', 2, _AM_NEWBB_PERM_TEMPLATE_CREATED); } else { @@ -280,14 +280,14 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) // exit(); case 'apply': - $perm_template = $permHandler->getTemplate(); + $perm_template = $newbbpermHandler->getTemplate(); if (null === $perm_template) { redirect_header('admin_permissions.php?action=template', 2, _AM_NEWBB_PERM_TEMPLATE); } xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); + $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP_APPLY, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray([ @@ -298,14 +298,14 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $opform->addElement($op_select); $opform->display(); -// /** @var \NewbbCategoryHandler $categoryHandler */ -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); + /** @var \NewbbCategoryHandler $categoryHandler */ + $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); -// /** @var \NewbbForumHandler $forumHandler */ -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + /** @var \NewbbForumHandler $forumHandler */ + $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); foreach (array_keys($forums) as $c) { $fm_options[-1 * $c - 1000] = ' '; @@ -337,7 +337,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) if ($forum < 1) { continue; } - $permHandler->applyTemplate($forum, $module_id); + $newbbpermHandler->applyTemplate($forum, $module_id); } $cacheHelper = NewbbUtility::cleanCache(); //$cacheHelper->delete('permission'); @@ -347,7 +347,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) default: xoops_cp_header(); -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); + $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -356,7 +356,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); } -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); if (0 === count($forums)) { @@ -365,7 +365,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $adminObject->displayNavigation(basename(__FILE__)); echo "" . _AM_NEWBB_PERM_ACTION . ''; - $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION, 'actionform', 'admin_permissions.php', 'get'); + $opform = new XoopsSimpleForm(_AM_NEWBB_PERM_ACTION_HELP, 'actionform', 'admin_permissions.php', 'get'); $op_select = new XoopsFormSelect('', 'action'); $op_select->setExtra('onchange="document.forms.actionform.submit()"'); $op_select->addOptionArray([ @@ -416,7 +416,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form = new NewbbXoopsGroupPermForm($fm_options[$op]['title'], $module_id, $fm_options[$op]['item'], $fm_options[$op]['desc'], 'admin/admin_permissions.php', $fm_options[$op]['anonymous']); -// $categoryHandler = xoops_getModuleHandler('category', 'newbb'); + $categoryHandler = xoops_getModuleHandler('category', 'newbb'); $criteriaCategory = new CriteriaCompo(new criteria('1', 1)); $criteriaCategory->setSort('cat_order'); $categories = $categoryHandler->getList($criteriaCategory); @@ -426,7 +426,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) } unset($categories); } else { -// $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); if (count($forums) > 0) { foreach (array_keys($forums) as $c) { @@ -443,9 +443,9 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) $form->display(); // Since we can not control the permission update, a trick is used here -// /** @var \NewbbPermissionHandler $permHandler */ -// $permHandler = xoops_getModuleHandler('permission', 'newbb'); - $permHandler->createPermData(); + /** @var \NewbbPermissionHandler $permissionHandler */ + $permissionHandler = xoops_getModuleHandler('permission', 'newbb'); + $permissionHandler->createPermData(); $cacheHelper = NewbbUtility::cleanCache(); //$cacheHelper->delete('permission'); include_once __DIR__ . '/admin_footer.php'; diff --git a/language/english/admin.php b/language/english/admin.php index 168abff0..98f6f809 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -185,6 +185,9 @@ define('_AM_NEWBB_PERM_TEMPLATEAPP', 'Apply default permission'); define('_AM_NEWBB_PERM_TEMPLATE_APPLIED', 'Default permissions have been applied to forums'); define('_AM_NEWBB_PERM_ACTION', 'Permission management tools'); +define('_AM_NEWBB_PERM_ACTION_HELP', 'Allows you to set the access rights for each function and group'); +define('_AM_NEWBB_PERM_ACTION_HELP_TEMPLAT', 'Allows you to create an access rights template for automatic installation when creating a forum.'); +define('_AM_NEWBB_PERM_ACTION_HELP_APPLY', 'Allows you to apply a permission template to already created forums.'); define('_AM_NEWBB_PERM_SETBYGROUP', 'Set permissions directly by group'); // admin_forum_prune.php define('_AM_NEWBB_PRUNE_RESULTS_TITLE', 'Prune Results');