NobuNobu
nobun****@users*****
2006年 5月 18日 (木) 23:04:04 JST
Index: xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php diff -u xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.11 xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.12 --- xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php:1.1.2.11 Tue Apr 11 17:39:07 2006 +++ xoops2jp/html/modules/base/admin/class/ModuleInstaller.class.php Thu May 18 23:04:04 2006 @@ -37,6 +37,10 @@ return $ret; } + if ($module->get('dirname') == 'system') { + $module->setVar('mid', 1); + } + if (isset($module->modinfo['installer']) && isset($module->modinfo['installer']['licence']) ) { $this->mAgree = true; } @@ -65,14 +69,23 @@ // Add a permission which administrators can manage. (Special for Legacy System Module) // if ($this->mModule->getVar('dirname') == 'system') { - for ($i=1; $i<16; $i++) { - $sysAdminPerm =& $this->_createPermission(XOOPS_GROUP_ADMIN); - $adminPerm->setVar('gperm_itemid', $i); - $adminPerm->setVar('gperm_name', 'system_admin'); - if (!$gpermHandler->insert($adminPerm)) { - $log->addError("Could not set system admin permission " . $this->mModule->getVar('mid')); + require_once XOOPS_ROOT_PATH . "/modules/system/constants.php"; + $fileHandler = opendir(XOOPS_ROOT_PATH . "/modules/system/admin"); + while ($file = readdir($fileHandler)) { + $infoFile = XOOPS_ROOT_PATH . "/modules/system/admin/" . $file . "/xoops_version.php"; + if (file_exists($infoFile)) { + require_once $infoFile; + if (!empty($modversion['category'])) { + $sysAdminPerm =& $this->_createPermission(XOOPS_GROUP_ADMIN); + $adminPerm->setVar('gperm_itemid', $modversion['category']); + $adminPerm->setVar('gperm_name', 'system_admin'); + if (!$gpermHandler->insert($adminPerm)) { + $log->addError("Could not set system admin permission " . $this->mModule->getVar('mid')); + } + unset($sysAdminPerm); + } + unset($modversion); } - unset($sysAdminPerm); } }