function save_config() { global $xoopsDB; if (!mysql_table_exists('ck2mod_config')) { mk_config_table(); } $sql = "delete from `ck2mod_config`"; $xoopsDB->query($sql); foreach ($_POST['setup'] as $name => $value) { $sql = "insert into `ck2mod_config` (config_name,config_value,config_type) values('{$name}','{$value}','module');"; $xoopsDB->query($sql); } }
function get_xoopsModulesConfig($config_type = 'module') { global $xoopsDB; if (!mysql_table_exists('ck2mod_config')) { mk_config_table(); } $sql = "select config_sn,config_name,config_value from `ck2mod_config` where config_type='{$config_type}'"; $result = $xoopsDB->query($sql); while (list($config_sn, $config_name, $config_value) = $xoopsDB->fetchRow($result)) { $xoopsModulesConfig[$config_name] = $config_value; } return $xoopsModulesConfig; }