NobuNobu
nobun****@users*****
2006年 5月 18日 (木) 23:04:04 JST
Index: xoops2jp/html/kernel/module.php diff -u xoops2jp/html/kernel/module.php:1.2.8.10 xoops2jp/html/kernel/module.php:1.2.8.11 --- xoops2jp/html/kernel/module.php:1.2.8.10 Wed Apr 19 14:30:07 2006 +++ xoops2jp/html/kernel/module.php Thu May 18 23:04:04 2006 @@ -1,5 +1,5 @@ <?php -// $Id: module.php,v 1.2.8.10 2006/04/19 05:30:07 minahito Exp $ +// $Id: module.php,v 1.2.8.11 2006/05/18 14:04:04 nobunobu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -436,7 +436,9 @@ ${$k} = $v; } if ($module->isNew()) { - $mid = $this->db->genId('modules_mid_seq'); + if (empty($mid)) { //Memo: if system module, mid might be set to 1 + $mid = $this->db->genId('modules_mid_seq'); + } $sql = sprintf("INSERT INTO %s (mid, name, version, last_update, weight, isactive, dirname, hasmain, hasadmin, hassearch, hasconfig, hascomments, hasnotification) VALUES (%u, %s, %u, %u, %u, %u, %s, %u, %u, %u, %u, %u, %u)", $this->db->prefix('modules'), $mid, $this->db->quoteString($name), $version, time(), $weight, 1, $this->db->quoteString($dirname), $hasmain, $hasadmin, $hassearch, $hasconfig, $hascomments, $hasnotification); } else { $sql = sprintf("UPDATE %s SET name = %s, dirname = %s, version = %u, last_update = %u, weight = %u, isactive = %u, hasmain = %u, hasadmin = %u, hassearch = %u, hasconfig = %u, hascomments = %u, hasnotification = %u WHERE mid = %u", $this->db->prefix('modules'), $this->db->quoteString($name), $this->db->quoteString($dirname), $version, time(), $weight, $isactive, $hasmain, $hasadmin, $hassearch, $hasconfig, $hascomments, $hasnotification, $mid); @@ -479,6 +481,13 @@ $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'module_read' AND gperm_itemid = %u", $this->db->prefix('group_permission'), $module->getVar('mid')); $this->db->query($sql); + if ($module->getVar('mid')==1) { + $sql = sprintf("DELETE FROM %s WHERE gperm_name = 'system_admin'", $this->db->prefix('group_permission')); + } else { + $sql = sprintf("DELETE FROM %s WHERE gperm_modid = %u", $this->db->prefix('group_permission'), $module->getVar('mid')); + } + $this->db->query($sql); + $sql = sprintf("SELECT block_id FROM %s WHERE module_id = %u", $this->db->prefix('block_module_link'), $module->getVar('mid')); if ($result = $this->db->query($sql)) { $block_id_arr = array();