* $Id: tools.php 3436 2008-07-05 10:49:26Z malanciault $ * Module: SmartSection * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ include_once "admin_header.php"; $op = ''; if (isset($_POST['replacepermissions'])) { $op = 'replacepermissions'; } switch ($op) { case 'replacepermissions': $categoriesObj = $smartsection_category_handler->getObjects(); $groups_read = isset($_POST['groups_read']) ? $_POST['groups_read'] : array(); foreach ($categoriesObj as $categoryObj) { smartsection_saveCategory_Permissions($groups_read, $categoryObj->categoryid(), 'category_read'); smartsection_overrideItemsPermissions($groups_read, $categoryObj->categoryid()); } redirect_header("index.php", 3, _AM_SSECTION_PERMISSIONS_UPDATED); exit; break; case "default": default: smartsection_xoops_cp_header(); smartsection_adminMenu(-1, _AM_SSECTION_TOOLS); smartsection_collapsableBar('tools1', 'tools1icon', _AM_SSECTION_CONFIGURE_READ_PERMISSIONS, _AM_SSECTION_CONFIGURE_READ_PERMISSIONS_EXP); include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; $sform = new XoopsThemeForm(_AM_SSECTION_FULLACCESS, "form", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // READ PERMISSIONS $groups_read_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_CAT_READ, 'groups_read[]');
//Added by fx2024 $parentCat = $categoryObj->categoryid(); for ($i = 0; $i < sizeof($_POST['scname']); $i++) { if ($_POST['scname'][$i] != '') { $categoryObj = $smartsection_category_handler->create(); $categoryObj->setVar('name', $_POST['scname'][$i]); $categoryObj->setVar('parentid', $parentCat); $categoryObj->setGroups_read($grpread); $categoryObj->setGroups_submit($grpsubmit); if (!$categoryObj->store()) { redirect_header("javascript:history.go(-1)", 3, _AM_SSECTION_SUBCATEGORY_SAVE_ERROR . smartsection_formatErrors($categoryObj->getErrors())); exit; } // TODO : put this function in the category class smartsection_saveCategory_Permissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); smartsection_saveCategory_Permissions($categoryObj->getGroups_submit(), $categoryObj->categoryid(), 'item_submit'); //smartsection_saveCategory_Permissions($groups_admin, $categoriesObj->categoryid(), 'category_admin'); if ($applyall) { // TODO : put this function in the category class smartsection_overrideItemsPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid()); } } } //end of fx2024 code redirect_header($redirect_to, 2, $redirect_msg); exit; break; //Added by fx2024 //Added by fx2024 case "addsubcats": $categoryid = 0;