function delete(&$forum) { global $xoopsModule; // RMV-NOTIFY xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'forum', $forum->getVar('forum_id')); // Get list of all topics in forum, to delete them too $topic_handler =& xoops_getmodulehandler('topic', 'newbb'); $topic_handler->deleteAll(new Criteria("forum_id", $forum->getVar('forum_id')), true, true); $this->updateAll("parent_forum", $forum->getVar('parent_forum'), new Criteria("parent_forum", $forum->getVar('forum_id'))); $this->deletePermission($forum); return parent::delete($forum); }
function deleteForm($fid) { global $xoopsDB, $myts, $eh; global $xoopsUser, $xoopsModule; $gperm_handler =& xoops_gethandler('groupperm'); $module_id = $xoopsModule->getVar('mid'); $groups = $xoopsUser ? $xoopsUser->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); if (!$gperm_handler->checkRight("delete_form", $fid, $groups, $module_id)) { return; } $form_handler = xoops_getmodulehandler('forms', 'formulize'); $form_handler->dropDataTable($fid); $sql = sprintf("DELETE FROM %s WHERE id_form = '%s'", $xoopsDB->prefix("formulize_id"), $fid); $xoopsDB->queryF($sql) or $eh->show("error supression 1 dans delform"); $sql = sprintf("DELETE FROM %s WHERE id_form = '%u'", $xoopsDB->prefix("formulize"), $fid); $xoopsDB->queryF($sql) or $eh->show("error supression 2 dans delform"); $sql = sprintf("DELETE FROM %s WHERE itemname = '%s'", $xoopsDB->prefix("formulize_menu"), $fid); $xoopsDB->queryF($sql) or $eh->show("error supression 3 dans delform"); xoops_notification_deletebyitem($module_id, "form", $id_form); // added by jwe-10/10/04 to handle removing notifications for a form once it's gone }
$storyid = isset( $_POST['storyid'] ) ? intval( $_POST['storyid'] ) : 0 ; if ( empty($storyid) ){ die( _MD_EMPTYNODELETE ); exit(); } $story = new Bulletin( $mydirname , $storyid ); if (!$story){ die( _MD_EMPTYNODELETE ); exit(); } // Remove the related articles $story->relation->queryUnlinkById($storyid); $story->relation->queryDelete(1); $story -> delete(); xoops_comment_delete( $xoopsModule->getVar('mid'), $storyid ); xoops_notification_deletebyitem( $xoopsModule->getVar('mid'), 'story', $storyid ); if( $return == 1){ redirect_header( $mydirurl.'/index.php?mode=admin&op=list', 1, _MD_DBPUDATED ); }else{ redirect_header( $mydirurl.'/index.php', 1, _MD_DBPUDATED ); } exit(); }else{ require_once XOOPS_ROOT_PATH.'/header.php'; xoops_confirm( array( 'op' => 'delete', 'storyid' => $storyid, 'ok' => 1, 'return' => $return, 'XOOPS_G_TICKET'=>$xoopsGTicket->issue( __LINE__ ) ), 'index.php?page=submit', $story->getVar('title').'<br/><br/>'._MD_RUSUREDEL ); require_once XOOPS_ROOT_PATH.'/footer.php'; } } ?>
// end of u2t table $sql = "DELETE FROM " . $xoopsDB->prefix("xhnewbb_posts_text") . " WHERE "; $set = false; for ($x = 0; $x < count($posts_to_remove); $x++) { if ($set) { $sql .= " OR "; } $sql .= "post_id = " . $posts_to_remove[$x]; $set = true; } if (!$xoopsDB->query($sql)) { exit(_MD_XHNEWBB_COULDNOTREMOVETXT); } xhnewbb_sync($forum, 'forum'); // RMV-NOTIFY xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'thread', $topic_id); echo _MD_XHNEWBB_TTHBRFTD . "<p><a href='" . XOOPS_URL . "/modules/xhnewbb/viewforum.php?forum={$forum}'>" . _MD_XHNEWBB_RETURNTOTHEFORUM . "</a></p><p><a href='" . XOOPS_URL . "/modules/xhnewbb/index.php'>" . _MD_XHNEWBB_RTTFI . "</a></p>"; break; case 'move': if ($newforum > 0) { $sql = "SELECT * FROM " . $xoopsDB->prefix("xhnewbb_forums") . " WHERE forum_id={$newforum}"; if (!($r = $xoopsDB->query($sql)) || $xoopsDB->getRowsNum($r) != 1) { exit(_MD_XHNEWBB_EPGBATA); } $sql = sprintf("UPDATE %s SET forum_id = %u WHERE topic_id = %u", $xoopsDB->prefix("xhnewbb_topics"), $newforum, $topic_id); if (!($r = $xoopsDB->query($sql))) { exit(_MD_XHNEWBB_EPGBATA); } $sql = sprintf("UPDATE %s SET forum_id = %u WHERE topic_id = %u", $xoopsDB->prefix("xhnewbb_posts"), $newforum, $topic_id); if (!($r = $xoopsDB->query($sql))) { exit(_MD_XHNEWBB_EPGBATA);
xoops_cp_header(); $id = isset($_POST['id']) ? intval($_POST['id']) : 0; if ($id == 0) { oledrion_utils::redirect(_AM_OLEDRION_ERROR_1, $baseurl, 5); } $opRedirect = 'products'; $tblTmp = array(); $tblTmp = $h_oledrion_caddy->getCommandIdFromProduct($id); if (count($tblTmp) == 0) { $item = null; $item = $h_oledrion_products->get($id); if (is_object($item)) { $res = $oledrion_shelf->deleteProduct($item, true); if ($res) { oledrion_utils::updateCache(); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'new_product', $id); oledrion_utils::redirect(_AM_OLEDRION_SAVE_OK, $baseurl . '?op=' . $opRedirect, 2); } else { oledrion_utils::redirect(_AM_OLEDRION_SAVE_PB, $baseurl . '?op=' . $opRedirect, 5); } } else { oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl . '?op=' . $opRedirect, 5); } } else { oledrion_utils::htitle(_AM_OLEDRION_SORRY_NOREMOVE, 4); $tblTmp2 = array(); $tblTmp2 = $h_oledrion_commands->getObjects(new Criteria('cmd_id', '(' . implode(',', $tblTmp) . ')', 'IN'), true); echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; $class = ''; echo "<tr><th align='center'>" . _AM_OLEDRION_ID . "</th><th align='center'>" . _AM_OLEDRION_DATE . "</th><th align='center'>" . _AM_OLEDRION_CLIENT . "</th><th align='center'>" . _AM_OLEDRION_TOTAL_SHIPP . "</th></tr>"; foreach ($tblTmp2 as $item) {
// Delete if (isset($_REQUEST['op']) && $_REQUEST['op'] == "delete") { if (isset($_REQUEST['art_id'])) { $art_id = $_REQUEST['art_id']; } // confirm if (!isset($_REQUEST['subop'])) { xoops_cp_header(); xoops_confirm(array('op' => 'delete', 'art_id' => $art_id, 'subop' => 'delok'), 'arteddel.php', _MD_CONFIRMDELETE); xoops_cp_footer(); } // // Delete if (isset($_REQUEST['subop']) && $_REQUEST['subop'] == "delok") { $sql = sprintf("DELETE FROM %s WHERE id = %u", $xoopsDB->prefix("articles_main"), $art_id); if ($xoopsDB->queryF($sql)) { // delete comments for the article being deleted xoops_comment_delete($xoopsModule->getVar('mid'), $art_id); // delete notifications for deleted article xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'global', $art_id); redirect_header("arteddel.php", 2, _MD_ITEMDELETED); //echo "deleted"; } else { redirect_header("arteddel.php", 2, _MD_ITEMNOTDELETED); //echo "not deleted"; } // } // } //
if (!empty($_POST['delcat'])) { // anti-CSRF (Double Check) if (!xoops_refcheck()) { die("XOOPS_URL is not included in your REFERER"); } // Delete $cid = intval($_POST['delcat']); //get all categories under the specified category $children = $cattree->getAllChildId($cid); $whr = "cid IN ("; foreach ($children as $child) { $whr .= "{$child},"; xoops_notification_deletebyitem($myalbum_mid, 'category', $child); } $whr .= "{$cid})"; xoops_notification_deletebyitem($myalbum_mid, 'category', $cid); myalbum_delete_photos($whr); $xoopsDB->query("DELETE FROM {$table_cat} WHERE {$whr}") or die("DB error: DELETE cat table"); redirect_header('index.php', 2, _ALBM_CATDELETED); exit; } else { if (!empty($_POST['batch_update'])) { // Batch update } } } } // // Form Part // xoops_cp_header();
function _delete(&$post, $force = false) { global $xoopsModule; if (!is_object($post) || $post->getVar('post_id') == 0) { return false; } /* Set active post as deleted */ if ($post->getVar("approved") > 0 && empty($force)) { $sql = "UPDATE " . $this->db->prefix("bb_posts") . " SET approved = -1 WHERE post_id = " . $post->getVar("post_id"); if (!($result = $this->db->queryF($sql))) { } /* delete pending post directly */ } else { $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("bb_posts"), $post->getVar('post_id')); if (!($result = $this->db->queryF($sql))) { $post->setErrors("delte post error: " . $sql); return false; } $post->deleteAttachment(); $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("bb_posts_text"), $post->getVar('post_id')); if (!($result = $this->db->queryF($sql))) { $post->setErrors("Could not remove post text: " . $sql); return false; } } if ($post->isTopic()) { $topic_handler =& xoops_getmodulehandler('topic', 'newbb'); $topic_obj =& $topic_handler->get($post->getVar('topic_id')); if (is_object($topic_obj) && $topic_obj->getVar("approved") > 0 && empty($force)) { $topiccount_toupdate = 1; $topic_obj->setVar("approved", -1); $topic_handler->insert($topic_obj); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'thread', $post->getVar('topic_id')); } else { if (is_object($topic_obj)) { if ($topic_obj->getVar("approved") > 0) { xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'thread', $post->getVar('topic_id')); } $poll_id = $topic_obj->getVar("poll_id"); if ($poll_id > 0) { if (is_dir(XOOPS_ROOT_PATH . "/modules/xoopspoll/")) { include_once XOOPS_ROOT_PATH . "/modules/xoopspoll/class/xoopspoll.php"; include_once XOOPS_ROOT_PATH . "/modules/xoopspoll/class/xoopspolloption.php"; include_once XOOPS_ROOT_PATH . "/modules/xoopspoll/class/xoopspolllog.php"; include_once XOOPS_ROOT_PATH . "/modules/xoopspoll/class/xoopspollrenderer.php"; $poll = new XoopsPoll($poll_id); if ($poll->delete() != false) { XoopsPollOption::deleteByPollId($poll->getVar("poll_id")); XoopsPollLog::deleteByPollId($poll->getVar("poll_id")); xoops_comment_delete($xoopsModule->getVar('mid'), $poll->getVar('poll_id')); } } } } $sql = sprintf("DELETE FROM %s WHERE topic_id = %u", $this->db->prefix("bb_topics"), $post->getVar('topic_id')); if (!($result = $this->db->queryF($sql))) { //xoops_error($this->db->error()); } $sql = sprintf("DELETE FROM %s WHERE topic_id = %u", $this->db->prefix("bb_votedata"), $post->getVar('topic_id')); if (!($result = $this->db->queryF($sql))) { //xoops_error($this->db->error()); } } } else { $sql = "UPDATE " . $this->db->prefix("bb_topics") . " t\r\n \t\t\t\tLEFT JOIN " . $this->db->prefix("bb_posts") . " p ON p.topic_id = t.topic_id\r\n \t\t\t\tSET t.topic_last_post_id = p.post_id\r\n \t\t\t\tWHERE t.topic_last_post_id = " . $post->getVar('post_id') . "\r\n \t\t\t\t\t\tAND p.post_id = (SELECT MAX(post_id) FROM " . $this->db->prefix("bb_posts") . " WHERE topic_id=t.topic_id)"; if (!($result = $this->db->queryF($sql))) { } } $postcount_toupdate = $post->getVar("approved"); if ($postcount_toupdate > 0) { // Update user stats if ($post->getVar('uid') > 0) { $member_handler =& xoops_gethandler('member'); $poster =& $member_handler->getUser($post->getVar('uid')); if (is_object($poster) && $post->getVar('uid') == $poster->getVar("uid")) { $poster->setVar('posts', $poster->getVar('posts') - 1); $res = $member_handler->insertUser($poster, true); unset($poster); } } $sql = "UPDATE " . $this->db->prefix("bb_posts") . " SET pid = " . $post->getVar('pid') . " WHERE pid=" . $post->getVar('post_id'); if (!($result = $this->db->queryF($sql))) { //xoops_error($this->db->error()); } } return true; }
function delNewLink() { global $xoopsDB, $eh, $xoopsModule; $lid = mylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min' => 0)); $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_links"), $lid); $xoopsDB->query($sql) or $eh->show('0013'); $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_text"), $lid); $xoopsDB->query($sql) or $eh->show('0013'); // delete comments xoops_comment_delete($xoopsModule->getVar('mid'), $lid); // delete notifications xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'link', $lid); redirect_header('index.php', 2, _MD_MYLINKS_LINKDELETED); }
function d3download_delcat( $mydirname, $cid ) { $db =& Database::getInstance() ; include_once dirname( dirname(__FILE__) ).'/class/mycategory.php' ; $mycategory = new MyCategory( $mydirname, 'Show' ) ; $module_handler =& xoops_gethandler('module'); $xoopsModule =& $module_handler->getByDirname( $mydirname ); $mid =& $xoopsModule->getVar('mid'); $children = $mycategory->getAllChildId( $cid ) ; $whr = "cid IN (" ; foreach( $children as $child ) { $whr .= "$child," ; xoops_notification_deletebyitem( $mid , 'cat' , $child ) ; } $whr .= "$cid)" ; xoops_notification_deletebyitem( $mid, 'category', $cid ) ; d3download_delete_contents( $mydirname , $whr, $cid ); d3download_delete_cache_of_categories( $mydirname ) ; $db->query( "DELETE FROM ".$db->prefix( $mydirname."_cat")." WHERE $whr" ) or die( "DB error: DELETE cat table" ) ; }
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; } }
if (!empty($_POST['delcat'])) { // Ticket Check if (!$xoopsGTicket->check()) { redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); } // Delete $cid = intval($_POST['delcat']); //get all categories under the specified category $children = $cattree->getAllChildId($cid); $whr = "cid IN ("; foreach ($children as $child) { $whr .= "{$child},"; xoops_notification_deletebyitem($gnavi_mid, 'category', $child); } $whr .= "{$cid})"; xoops_notification_deletebyitem($gnavi_mid, 'category', $cid); gnavi_delete_photos($whr); $xoopsDB->query("DELETE FROM {$table_cat} WHERE {$whr}") or die("DB error: DELETE cat table"); redirect_header('index.php?page=category', 2, _MD_A_GNAVI_CATDELETED); exit; } else { if (!empty($_POST['batch_update'])) { // Batch update } } } } // // Form Part // xoops_cp_header();
if (!empty($_POST['delete']) || !empty($_POST['op']) && $_POST['op'] == 'delete') { if (!$xoopsGTicket->check()) { redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); } $entry =& getEntry($_POST); if (!empty($_POST['ok'])) { // After delete, return the user to the user's blog they were reading. $link = sprintf('%s/modules/%s/index.php?user_id=%d', XOOPS_URL, $xoopsModule->dirname(), $entry->getVar('user_id')); $isEditable = $entry->getVar('user_id') == $currentuid || $isAdmin; if ($isEditable) { $ret = $weblog->removeEntry($entry->getVar('blog_id')); if ($ret) { // delete trackbacks $tb_operator->removeTrackback($entry->getVar('blog_id')); xoops_comment_delete($xoopsModule->getVar('mid'), $entry->getVar('blog_id')); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'blog_entry', $entry->getVar('blog_id')); redirect_header($link, 2, _BL_BLOG_DELETED); } else { redirect_header($link, 5, _BL_BLOG_NOT_DELETED); } } else { redirect_header($link, 5, _BL_BLOG_NOT_DELETED); // TODO } } else { require XOOPS_ROOT_PATH . '/header.php'; weblog_confirm(array('blog_id' => $entry->getVar('blog_id'), 'private' => $entry->isPrivate(), 'dohtml' => !$entry->doHtml(), 'dobr' => $entry->doBr(), 'updateping' => $entry->isUpdateping(), 'specify_created' => $entry->isSpecifycreated(), 'user_id' => $entry->getVar('user_id'), 'cat_id' => $entry->getVar('cat_id'), 'created' => $entry->getVar('created'), 'title' => $entry->getVar('title', 'n'), 'contents' => $entry->getVar('contents', 'n'), 'ent_trackbackurl' => $entry->getVar('ent_trackbackurl'), 'permission_group' => $entry->getVar('permission_group'), 'XOOPS_G_TICKET' => $xoopsGTicket->issue(__LINE__), 'op' => 'delete', 'ok' => 1), 'post.php', sprintf(_BL_CONFIRM_DELETE, stripslashes($entry->getVar('title'))), false, true); require XOOPS_ROOT_PATH . '/footer.php'; } } else { // Edit/Create/Preview the post
function delCategory($post, $get) { global $xoopsConfig, $xoopsModule; $cat_handler =& xoops_getmodulehandler('category'); $gperm_handler =& xoops_gethandler('groupperm'); if (!isset($post['ok']) || $post['ok'] != 1) { $category =& $cat_handler->get($get['cat_id']); xoops_cp_header(); xoops_confirm(array('action' => 'delCat', 'cat_id' => intval($get['cat_id']), 'ok' => 1), 'catmanager.php', sprintf(_AM_WEBLOG_DELCONFIRM, $category->getVar('cat_title'))); xoops_cp_footer(); } else { $entry_handler =& xoops_getmodulehandler('entry'); $id_arr = $cat_handler->getAllChildrenIds($post['cat_id']); array_push($id_arr, $post['cat_id']); foreach ($id_arr as $id) { $criteria = new criteria('cat_id', $id); $entries = $entry_handler->getObjects($criteria); foreach ($entries as $entry) { if ($entry_handler->delete($entry)) { xoops_comment_delete($xoopsModule->getVar('mid'), $entry->getVar('blog_id')); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'blog_entry', $entry->getVar('blog_id')); } } $category =& $cat_handler->create(); $category->setVar('cat_id', $id); $cat_handler->delete($category); // delete category $gperm_handler->deleteByModule($xoopsModule->getVar('mid'), 'weblog_cat_post', $id); // delete gperm /****** xoops_notification_deleteitem($xoopsModule->getVar('mid'), 'category', $id); ******/ } redirect_header('catmanager.php', 2, _AM_WEBLOG_CATDELETED); exit; } }
xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'story', $eachstory->getVar('storyid')); } } } else { // Gets all articles $story_arr = Bulletin::getAllByTopic($mydirname, $eachtopic->topic_id()); foreach ($story_arr as $eachstory) { $eachstory->setVar('topicid', $move_topics[$eachtopic->topic_id()]); $eachstory->store(); } } // Delete the topic $eachtopic->delete(); //ver3.0 $gperm->delete_topic_access($eachtopic->topic_id()); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $eachtopic->topic_id); } redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED); } break; case 'modTopicS': //ver3.0 if (!$xoopsGTicket->check(true, 'bulletin_admin')) { redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); } $BTopic = new BulletinTopic($mydirname, $_POST['topic_id']); if (empty($BTopic)) { redirect_header('index.php?op=topicsmanager', 1, _TAKINGBACK); } if (empty($BTopic->topic_id)) { redirect_header('index.php?op=topicsmanager', 1, _TAKINGBACK);
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; } }
/** * Delete category and related content * * @param myshop_cat $category * @return boolean Result */ function deleteCategory(myshop_cat $category) { global $xoopsModule; $category->deletePicture(); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'new_category', $category->getVar('cat_cid')); return $this->delete($category, true); }
function gnavi_delete_photos($whr) { global $xoopsDB; global $photos_dir, $thumbs_dir, $gnavi_mid; global $table_photos, $table_text, $table_votedata; $prs = $xoopsDB->query("SELECT lid, ext, ext1, ext2 FROM {$table_photos} WHERE {$whr}"); while (list($lid, $ext, $ext1, $ext2) = $xoopsDB->fetchRow($prs)) { xoops_comment_delete($gnavi_mid, $lid); xoops_notification_deletebyitem($gnavi_mid, 'photo', $lid); $xoopsDB->query("DELETE FROM {$table_votedata} WHERE lid={$lid}") or die("DB error: DELETE votedata table."); $xoopsDB->query("DELETE FROM {$table_text} WHERE lid={$lid}") or die("DB error: DELETE text table."); $xoopsDB->query("DELETE FROM {$table_photos} WHERE lid={$lid}") or die("DB error: DELETE photo table."); if ($ext) { @unlink("{$photos_dir}/{$lid}.{$ext}"); @unlink("{$thumbs_dir}/{$lid}.{$ext}"); } if ($ext1) { @unlink($photos_dir . "/" . $lid . "_1." . $ext1); @unlink($photos_dir . "/" . $lid . "_1." . $ext1); } if ($ext2) { @unlink($photos_dir . "/" . $lid . "_2." . $ext2); @unlink($photos_dir . "/" . $lid . "_2." . $ext2); } } }
function myalbum_delete_photos($whr) { global $xoopsDB; global $photos_dir, $thumbs_dir, $myalbum_mid; global $table_photos, $table_text, $table_votedata; $prs = $xoopsDB->query("SELECT lid, ext FROM {$table_photos} WHERE {$whr}"); while (list($lid, $ext) = $xoopsDB->fetchRow($prs)) { xoops_comment_delete($myalbum_mid, $lid); xoops_notification_deletebyitem($myalbum_mid, 'photo', $lid); $xoopsDB->query("DELETE FROM {$table_votedata} WHERE lid={$lid}") or die("DB error: DELETE votedata table."); $xoopsDB->query("DELETE FROM {$table_text} WHERE lid={$lid}") or die("DB error: DELETE text table."); $xoopsDB->query("DELETE FROM {$table_photos} WHERE lid={$lid}") or die("DB error: DELETE photo table."); @unlink("{$photos_dir}/{$lid}.{$ext}"); @unlink("{$photos_dir}/{$lid}.gif"); @unlink("{$thumbs_dir}/{$lid}.{$ext}"); @unlink("{$thumbs_dir}/{$lid}.gif"); } }
/** * Delete stories that were published before a given date */ function DeleteBeforeDate($timestamp, $expired, $topicslist = '') { global $xoopsModule; $mid = $xoopsModule->getVar('mid'); $db =& Database::getInstance(); $prefix = $db->prefix('stories'); $vote_prefix = $db->prefix('stories_votedata'); $files_prefix = $db->prefix('stories_files'); $sql = 'SELECT storyid FROM ' . $prefix . ' WHERE published <=' . $timestamp; if ($expired) { $sql .= ' (AND expired>0 AND expired<=' . time() . ')'; } if (strlen(trim($topicslist)) > 0) { $sql .= ' AND topicid IN (' . $topicslist . ')'; } $result = $db->query($sql); while ($myrow = $db->fetchArray($result)) { xoops_comment_delete($mid, $myrow['storyid']); // Delete comments xoops_notification_deletebyitem($mid, 'story', $myrow['storyid']); // Delete notifications $db->queryF('DELETE FROM ' . $vote_prefix . ' WHERE storyid=' . $myrow['storyid']); // Delete votes // Remove files and records related to the files $result2 = $db->query('SELECT * FROM ' . $files_prefix . ' WHERE storyid=' . $myrow['storyid']); while ($myrow2 = $db->fetchArray($result2)) { $name = XOOPS_ROOT_PATH . '/uploads/' . $myrow2['downloadname']; if (file_exists($name)) { unlink($name); } $db->query('DELETE FROM ' . $files_prefix . ' WHERE fileid=' . $myrow2['fileid']); } $db->queryF('DELETE FROM ' . $prefix . ' WHERE storyid=' . $myrow['storyid']); // Delete the story } return true; }
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 delete(&$forum) { global $xoopsModule; $sql = "SELECT post_id FROM " . $this->db->prefix("bb_posts") . " WHERE forum_id = " . $forum->getVar('forum_id'); if (!($r = $this->db->query($sql))) { newbb_message("NewbbForumHandler::delete error::" . $sql); return false; } if ($this->db->getRowsNum($r) > 0) { $sql = "DELETE FROM " . $this->db->prefix("bb_posts_text") . " WHERE "; $looped = false; while ($ids = $this->db->fetchArray($r)) { if ($looped == true) { $sql .= " OR "; } $sql .= "post_id = " . $ids["post_id"] . " "; $looped = true; } if (!($r = $this->db->query($sql))) { newbb_message("NewbbForumHandler::delete error::" . $sql); return false; } $sql = sprintf("DELETE FROM %s WHERE forum_id = %u", $this->db->prefix("bb_posts"), $forum->getVar('forum_id')); if (!($r = $this->db->query($sql))) { newbb_message("NewbbForumHandler::delete error::" . $sql); return false; } } // RMV-NOTIFY xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'forum', $forum->getVar('forum_id')); // Get list of all topics in forum, to delete them too $sql = sprintf("SELECT topic_id FROM %s WHERE forum_id = %u", $this->db->prefix("bb_topics"), $forum->getVar('forum_id')); if ($r = $this->db->query($sql)) { while ($row = $this->db->fetchArray($r)) { xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'thread', $row['topic_id']); } } $sql = sprintf("DELETE FROM %s WHERE forum_id = %u", $this->db->prefix("bb_topics"), $forum->getVar('forum_id')); if (!($r = $this->db->query($sql))) { return false; } $sql = "DELETE FROM " . $forum->table . " WHERE forum_id=" . $forum->getVar('forum_id') . ""; if (!$this->db->query($sql)) { newbb_message("NewbbForumHandler::delete error::" . $sql); return false; } $sql = "UPDATE " . $this->db->prefix('bb_forums') . " SET parent_forum = 0 WHERE parent_forum=" . $forum->getVar('forum_id'); if (!$this->db->query($sql)) { newbb_message("NewbbForumHandler::delete error::" . $sql); return false; } return $this->deletePermission($forum); }
function delNewLink() { global $xoopsDB, $eh, $xoopsModule; $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_links"), $_GET['lid']); $xoopsDB->query($sql) or $eh->show("0013"); $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_text"), $_GET['lid']); $xoopsDB->query($sql) or $eh->show("0013"); // delete comments xoops_comment_delete($xoopsModule->getVar('mid'), $_GET['lid']); // delete notifications xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'link', $_GET['lid']); redirect_header("index.php", 1, _MD_LINKDELETED); }
function deletesong($del = 0) { global $xoopsDB, $xoopsModule; if (isset($_POST['del']) && $_POST['del'] == 1) { $sql = "\r\n\t\tDELETE FROM " . $xoopsDB->prefix('debaser_files') . "\r\n\t\tWHERE xfid=" . intval($_POST['mpegid']) . ""; if ($xoopsDB->query($sql)) { @unlink(XOOPS_ROOT_PATH . '/modules/debaser/upload/' . $_POST['delfile']); xoops_comment_delete($xoopsModule->getVar('mid'), $_POST['mpegid']); xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'song', $_POST['mpegid']); redirect_header('index.php', 2, $_POST['delfile'] . _AM_DEBASER_DELETED); } else { redirect_header('index.php', 2, $_POST['delfile'] . _AM_DEBASER_NOTDELETED); } exit; } else { echo "<h4>" . _AM_DEBASER_FILEADMIN . "</h4>"; if (isset($_POST['delfile']) && $_POST['mpegid']) { $delfile = $_POST['delfile']; $mpegid = $_POST['mpegid']; } else { $delfile = $_GET['delfile']; $mpegid = $_GET['mpegid']; } xoops_confirm(array('delfile' => $delfile, 'mpegid' => $mpegid, 'del' => 1), 'index.php?op=deletesong', _AM_DEBASER_SUREDELETEFILE); } }