function delTopic() { global $xoopsDB, $xoopsModule; if (!isset($_POST['ok'])) { xoops_cp_header(); echo '<h4>' . _AM_CONFIG . '</h4>'; $xt = new XoopsTopic($xoopsDB->prefix('topics'), intval($_GET['topic_id'])); xoops_confirm(array('op' => 'delTopic', 'topic_id' => intval($_GET['topic_id']), 'ok' => 1), 'index.php', _AM_WAYSYWTDTTAL . '<br />' . $xt->topic_title('S')); } else { xoops_cp_header(); $xt = new XoopsTopic($xoopsDB->prefix('topics'), intval($_POST['topic_id'])); if (isset($_SESSION['items_count'])) { $_SESSION['items_count'] = -1; } // get all subtopics under the specified topic $topic_arr = $xt->getAllChildTopics(); array_push($topic_arr, $xt); foreach ($topic_arr as $eachtopic) { // get all stories in each topic $story_arr = NewsStory::getByTopic($eachtopic->topic_id()); foreach ($story_arr as $eachstory) { if (false != $eachstory->delete()) { xoops_comment_delete($xoopsModule->getVar('mid'), $eachstory->storyid()); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'story', $eachstory->storyid()); } } // all stories for each topic is deleted, now delete the topic data $eachtopic->delete(); // Delete also the notifications and permissions xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $eachtopic->topic_id); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'news_approve', $eachtopic->topic_id); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'news_submit', $eachtopic->topic_id); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'news_view', $eachtopic->topic_id); } news_updateCache(); redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED); exit; } }
function delTopic() { if (!isset($_REQUEST['topic_id']) || $_REQUEST['topic_id'] == 0) { redirect_header('index.php?op=topicsmanager', 3, _AMS_AM_NOTOPICSELECTED); } global $xoopsDB, $xoopsModule; if (!isset($_POST['ok'])) { echo "<h4>" . _AMS_AM_CONFIG . "</h4>"; $xt = new XoopsTopic($xoopsDB->prefix("ams_topics"), intval($_GET['topic_id'])); xoops_confirm(array('op' => 'delTopic', 'topic_id' => intval($_GET['topic_id']), 'ok' => 1), 'index.php', _AMS_AM_WAYSYWTDTTAL . '<br />' . $xt->topic_title('S')); } else { $xt = new XoopsTopic($xoopsDB->prefix("ams_topics"), intval($_POST['topic_id'])); // get all subtopics under the specified topic $topic_arr = $xt->getAllChildTopics(); array_push($topic_arr, $xt); foreach ($topic_arr as $eachtopic) { // get all stories in each topic $story_arr = AmsStory::getByTopic($eachtopic->topic_id()); foreach ($story_arr as $eachstory) { if (false != $eachstory->delete()) { xoops_comment_delete($xoopsModule->getVar('mid'), $eachstory->storyid()); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'story', $eachstory->storyid()); } } // all stories for each topic is deleted, now delete the topic data $eachtopic->delete(); // Delete also the notifications and permissions xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $eachtopic->topic_id); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'ams_approve', $eachtopic->topic_id); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'ams_submit', $eachtopic->topic_id); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'ams_view', $eachtopic->topic_id); } redirect_header('index.php?op=topicsmanager', 1, _AMS_AM_DBUPDATED); exit; } }
function delTopic() { global $xoopsDB, $xoopsConfig, $xoopsModule; if (empty($_POST['ok'])) { xoops_cp_header(); echo "<h4>" . _AM_CONFIG . "</h4>"; xoops_confirm(array('op' => 'delTopic', 'topic_id' => intval($_GET['topic_id']), 'ok' => 1), 'index.php', _AM_WAYSYWTDTTAL); } else { $xt = new XoopsTopic($xoopsDB->prefix("topics"), $_POST['topic_id']); // get all subtopics under the specified topic $topic_arr = $xt->getAllChildTopics(); array_push($topic_arr, $xt); foreach ($topic_arr as $eachtopic) { // get all stories in each topic $story_arr = NewsStory::getByTopic($eachtopic->topic_id()); foreach ($story_arr as $eachstory) { if (false != $eachstory->delete()) { xoops_comment_delete($xoopsModule->getVar('mid'), $eachstory->storyid()); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'story', $eachstory->storyid()); } } // all stories for each topic is deleted, now delete the topic data $eachtopic->delete(); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $eachtopic->topic_id); } redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED); exit; } }