From: <ok...@us...> - 2003-01-07 21:33:41
|
Update of /cvsroot/xoops/xoops2/modules/system/admin/modulesadmin In directory sc8-pr-cvs1:/tmp/cvs-serv14503/modules/system/admin/modulesadmin Modified Files: modulesadmin.php Log Message: added global comments feature Index: modulesadmin.php =================================================================== RCS file: /cvsroot/xoops/xoops2/modules/system/admin/modulesadmin/modulesadmin.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** modulesadmin.php 5 Jan 2003 18:40:14 -0000 1.2 --- modulesadmin.php 7 Jan 2003 21:32:36 -0000 1.3 *************** *** 140,143 **** --- 140,147 ---- $module =& $module_handler->create(); $module->loadInfoAsVar($dirname); + // set hasconfig to 1 if has comments feature + if ($module->getVar('hascomments') == 1) { + $module->setVar('hasconfig', 1); + } $module->setVar('weight', 1); $error = false; *************** *** 328,331 **** --- 332,348 ---- $configs = $module->getInfo('config'); if ($configs != false) { + if ($module->getVar('hascomments') != 0) { + include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); + array_push($configs, array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '_CM_COMRULES', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN))); + array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '_CM_COMANONPOST', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0)); + } + } else { + if ($module->getVar('hascomments') != 0) { + include_once(XOOPS_ROOT_PATH.'/include/comment_constants.php'); + $configs = array('name' => 'com_rule', 'title' => '_CM_COMRULES', 'description' => '_CM_COMRULES', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, 'options' => array('_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN)); + array_push($configs, array('name' => 'com_anonpost', 'title' => '_CM_COMANONPOST', 'description' => '_CM_COMANONPOST', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0)); + } + } + if ($configs != false) { $msgs[] = 'Adding module config data...'; $config_handler =& xoops_gethandler('config'); *************** *** 476,479 **** --- 493,497 ---- } else { + // delete template files $tplfile_handler = xoops_gethandler('themeset', 'tplfile'); $criteria = new CriteriaCompo(new Criteria('tpl_refid', $module->getVar('mid'))); *************** *** 493,496 **** --- 511,515 ---- unset($templates); + // delete blocks and block tempalte files $block_arr =& XoopsBlock::getByModule($module->getVar('mid')); if (is_array($block_arr)) { *************** *** 521,524 **** --- 540,545 ---- } } + + // delete tables used by this module $modtables = $module->getInfo('tables'); if ($modtables != false && is_array($modtables)) { *************** *** 538,554 **** } } ! $config_handler =& xoops_gethandler('config'); ! $configs =& $config_handler->getConfigs(new Criteria('conf_modid', $module->getVar('mid'))); ! $confcount = count($configs); ! if (is_array($configs) && $confcount > 0) { ! $msgs[] = 'Deleting module config options...'; ! for ($i = 0; $i < $confcount; $i++) { ! if (!$config_handler->deleteConfig($configs[$i])) { ! $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not delete config data from the database. Config ID: <b>'.$configs[$i]->getvar('conf_id').'</b></span>'; ! } else { ! $msgs[] = ' Config data deleted from the database. Config ID: <b>'.$configs[$i]->getVar('conf_id').'</b>'; } } } $msgs[] = '</code><p>'.sprintf(_MD_AM_OKUNINS, "<b>".$module->getVar('name')."</b>").'</p>'; } --- 559,591 ---- } } ! ! // delete comments if any ! if ($module->getVar('hascomments') != 0) { ! $msgs[] = 'Deleting comments...'; ! $comment_handler =& xoops_gethandler('comment'); ! if (!$comment_handler->deleteByModule($module->getVar('mid'))) { ! $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not delete comments</span>'; ! } else { ! $msgs[] = ' Comments deleted'; ! } ! } ! ! // delete module config options if any ! if ($module->getVar('hasconfig') != 0) { ! $config_handler =& xoops_gethandler('config'); ! $configs =& $config_handler->getConfigs(new Criteria('conf_modid', $module->getVar('mid'))); ! $confcount = count($configs); ! if (is_array($configs) && $confcount > 0) { ! $msgs[] = 'Deleting module config options...'; ! for ($i = 0; $i < $confcount; $i++) { ! if (!$config_handler->deleteConfig($configs[$i])) { ! $msgs[] = ' <span style="color:#ff0000;">ERROR: Could not delete config data from the database. Config ID: <b>'.$configs[$i]->getvar('conf_id').'</b></span>'; ! } else { ! $msgs[] = ' Config data deleted from the database. Config ID: <b>'.$configs[$i]->getVar('conf_id').'</b>'; ! } } } } + $msgs[] = '</code><p>'.sprintf(_MD_AM_OKUNINS, "<b>".$module->getVar('name')."</b>").'</p>'; } |