Minahito
minah****@users*****
2006年 10月 14日 (土) 23:55:23 JST
Index: xoops2jp/html/modules/legacy/include/xoops2_system_constants.inc.php diff -u /dev/null xoops2jp/html/modules/legacy/include/xoops2_system_constants.inc.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:23 2006 +++ xoops2jp/html/modules/legacy/include/xoops2_system_constants.inc.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,29 @@ +<?php +/** + * This file defines constants which were defined in system module of XOOPS2. + * Legacy module already has removed all codes which depend on these constants. + * This file may be loaded by some developers who need these constants. + * + * @package Legacy + * @version $Id$ + */ + +if (!defined('XOOPS_SYSTEM_GROUP')) { + define('XOOPS_SYSTEM_GROUP', 1); + define('XOOPS_SYSTEM_USER', 2); + define('XOOPS_SYSTEM_PREF', 3); + define('XOOPS_SYSTEM_MODULE', 4); + define('XOOPS_SYSTEM_BLOCK', 5); + // define('XOOPS_SYSTEM_THEME', 6); + define('XOOPS_SYSTEM_FINDU', 7); + define('XOOPS_SYSTEM_MAILU', 8); + define('XOOPS_SYSTEM_IMAGE', 9); + define('XOOPS_SYSTEM_AVATAR', 10); + define('XOOPS_SYSTEM_URANK', 11); + define('XOOPS_SYSTEM_SMILE', 12); + define('XOOPS_SYSTEM_BANNER', 13); + define('XOOPS_SYSTEM_COMMENT', 14); + define('XOOPS_SYSTEM_TPLSET', 15); +} + +?> Index: xoops2jp/html/modules/legacy/include/groupperm.php diff -u /dev/null xoops2jp/html/modules/legacy/include/groupperm.php:1.1.2.1 --- /dev/null Sat Oct 14 23:55:23 2006 +++ xoops2jp/html/modules/legacy/include/groupperm.php Sat Oct 14 23:55:22 2006 @@ -0,0 +1,84 @@ +<?php +/** + * This file has been moved from XOOPS2 for some things which need + * full-compatibility with XOOPS2. + * + * @package Legacy + * @version $Id$ + */ + +include '../../../include/cp_header.php'; +$modid = isset($_POST['modid']) ? intval($_POST['modid']) : 0; + +// +// Load Message catalog +// +$root =& XCube_Root::getSingleton(); +$root->mLanguageManager->loadModuleAdminMessageCatalog('base'); + +// we dont want system module permissions to be changed here +if ($modid <= 1 || !is_object($xoopsUser) || !$xoopsUser->isAdmin($modid)) { + redirect_header(XOOPS_URL.'/index.php', 1, _NOPERM); + exit(); +} +$module_handler =& xoops_gethandler('module'); +$module =& $module_handler->get($modid); +if (!is_object($module) || !$module->getVar('isactive')) { + redirect_header(XOOPS_URL.'/admin.php', 1, _MODULENOEXIST); + exit(); +} +$member_handler =& xoops_gethandler('member'); +$group_list =& $member_handler->getGroupList(); +if (is_array($_POST['perms']) && !empty($_POST['perms'])) { + $gperm_handler = xoops_gethandler('groupperm'); + foreach ($_POST['perms'] as $perm_name => $perm_data) { + if (false != $gperm_handler->deleteByModule($modid, $perm_name)) { + if (is_array($perm_data['groups'])) { + foreach ($perm_data['groups'] as $group_id => $item_ids) { + foreach ($item_ids as $item_id => $selected) { + if ($selected == 1) { + // make sure that all parent ids are selected as well + if ($perm_data['parents'][$item_id] != '') { + $parent_ids = explode(':', $perm_data['parents'][$item_id]); + foreach ($parent_ids as $pid) { + if ($pid != 0 && !in_array($pid, array_keys($item_ids))) { + // one of the parent items were not selected, so skip this item + $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>'.$perm_name.'</b>', '<b>'.$perm_data['itemname'][$item_id].'</b>', '<b>'.$group_list[$group_id].'</b>').' ('._MD_AM_PERMADDNGP.')'; + continue 2; + } + } + } + $gperm =& $gperm_handler->create(); + $gperm->setVar('gperm_groupid', $group_id); + $gperm->setVar('gperm_name', $perm_name); + $gperm->setVar('gperm_modid', $modid); + $gperm->setVar('gperm_itemid', $item_id); + if (!$gperm_handler->insert($gperm)) { + $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>'.$perm_name.'</b>', '<b>'.$perm_data['itemname'][$item_id].'</b>', '<b>'.$group_list[$group_id].'</b>'); + } else { + $msg[] = sprintf(_MD_AM_PERMADDOK, '<b>'.$perm_name.'</b>', '<b>'.$perm_data['itemname'][$item_id].'</b>', '<b>'.$group_list[$group_id].'</b>'); + } + unset($gperm); + } + } + } + } + } else { + $msg[] = sprintf(_MD_AM_PERMRESETNG, $module->getVar('name').'('.$perm_name.')'); + } + } +} + +$backlink = XOOPS_URL.'/admin.php'; +if ($module->getVar('hasadmin')) { + $adminindex = isset($_POST['redirect_url']) ? $_POST['redirect_url'] : $module->getInfo('adminindex'); + if ($adminindex) { + $backlink = XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'.$adminindex; + } +} + +$msg[] = '<br /><br /><a href="'.$backlink.'">'._BACK.'</a>'; +xoops_cp_header(); +xoops_result($msg); +xoops_cp_footer(); +?> \ No newline at end of file