/** * Supprime un produit (et tout ce qui lui est relatif) * @param oledrion_products $product */ function deleteProduct(oledrion_products $product) { global $xoopsModule; $id = $product->getVar('product_id'); // On commence par supprimer les commentaires $mid = $xoopsModule->getVar('mid'); xoops_comment_delete($mid, $id); // Puis les votes $this->handlers->h_oledrion_votedata->deleteProductRatings($id); // Puis les produits relatifs $this->handlers->h_oledrion_related->deleteProductRelatedProducts($id); // Les images (la grande et la miniature) $product->deletePictures(); // Le fichier attaché $product->deleteAttachment(); // Les fichiers attachés $this->handlers->h_oledrion_files->deleteProductFiles($id); // Suppression dans les paniers persistants enregistrés $this->handlers->h_oledrion_persistent_cart->deleteProductForAllCarts($id); // Les attributs qui lui sont rattachés $this->handlers->h_oledrion_attributes->deleteProductAttributes($id); // Le produit dans les listes $this->handlers->h_oledrion_products_list->deleteProductFromLists($id); // La relation entre le produit et le fabricant $this->handlers->h_oledrion_productsmanu->removeManufacturerProduct($id); // Le produit dans les remises $this->handlers->h_oledrion_discounts->removeProductFromDiscounts($id); // Et le produit en lui même, à la fin return $this->handlers->h_oledrion_products->delete($product, true); }
/** * Supprime un produit (et tout ce qui lui est relatif) * @param myshop_products $product */ function deleteProduct(myshop_products $product) { global $xoopsModule; $id = $product->getVar('product_id'); // On commence par supprimer les commentaires $mid = $xoopsModule->getVar('mid'); xoops_comment_delete($mid, $id); // Puis les votes $this->handlers->h_myshop_votedata->deleteProductRatings($id); // Puis les produits relatifs $this->handlers->h_myshop_related->deleteProductRelatedProducts($id); // Les images (la grande et la miniature) $product->deletePictures(); // Le fichier attaché $product->deleteAttachment(); // Les fichiers attachés $this->handlers->h_myshop_files->deleteProductFiles($id); // Suppression dans les paniers enregistrés $this->handlers->h_myshop_persistent_cart->deleteProductForAllCarts($id); // Et le produit en lui même, à la fin return $this->handlers->h_myshop_products->delete($product, true); }
<?php include "header.php"; $op = isset($_POST["op"]) ? $_POST["op"] : "list"; $topic_id = isset($_POST["topic_id"]) ? intval($_POST["topic_id"]) : 0; $topic_handler = xoops_getmodulehandler("topics", "press"); switch ($op) { case "deletetopic": if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header("index.php", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); exit; } $topic = $topic_handler->get($topic_id); xoops_comment_delete($xoopsModule->getVar('mid'), $topic_id); if ($topic_handler->delete($topic)) { $stop = _PRESS_SUCCESSFULLY; } else { $stop = _PRESS_DATABASE_FAIL; } redirect_header("index.php", 5, $stop); break; case "savecategory": if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header("category.php", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); exit; } $cat_id = isset($_POST["cat_id"]) ? intval($_POST["cat_id"]) : 0; $category_handler = xoops_getmodulehandler("category", "press"); if (empty($cat_id)) { $cat_obj = $category_handler->get(); } else {
function delete() { global $xoopsDB, $HTTP_POST_VARS, $HTTP_GET_VARS, $xoopsConfig, $xoopsModule; $sql = "DELETE FROM " . $this->table . " WHERE articleid=" . $this->articleid . ""; if (!($result = $this->db->query($sql))) { return false; } if (isset($this->commentstable) && $this->commentstable != "") { xoops_comment_delete($xoopsModule->getVar('mid'), $this->articleid); } if (isset($this->filestable) && $this->filestable != "") { $this->files = WfsFiles::getAllbyArticle($this->articleid); foreach ($this->files as $file) { $file->delete(); } } 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 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"); } }
$obj->displayForm(); } else { $category_handler->displayError(_AM_XOOPSFAQ_ERRORCOULDNOTEDITCAT); } break; case 'delete': $ok = xoopsFaq_CleanVars($_REQUEST, 'ok', 0, 'int'); $category_id = xoopsFaq_CleanVars($_REQUEST, 'category_id', 0, 'int'); if (1 == $ok) { $obj = $category_handler->get($category_id); if (is_object($obj)) { if ($category_handler->delete($obj)) { $sql = sprintf('DELETE FROM %s WHERE contents_cid = %u', $xoopsDB->prefix('xoopsfaq_contents'), $category_id); $xoopsDB->query($sql); // delete comments xoops_comment_delete($xoopsModule->getVar('mid'), $category_id); redirect_header('category.php', 1, _AM_XOOPSFAQ_DBSUCCESS); } } $category_handler->displayError(_AM_XOOPSFAQ_ERRORCOULDNOTDELCAT); } else { xoops_cp_header(); //xoopsFaq_AdminMenu(1); $index_admin = new ModuleAdmin(); echo $index_admin->addNavigation('category.php'); //xoopsFaq_DisplayHeading(_AM_XOOPSFAQ_CATEGORY_HEADER, _AM_XOOPSFAQ_CATEGORY_DELETE_DSC, false); xoopsFaq_DisplayHeading('', _AM_XOOPSFAQ_CATEGORY_DELETE_DSC, false); xoops_confirm(array('op' => 'delete', 'category_id' => $category_id, 'ok' => 1), 'category.php', _AM_XOOPSFAQ_RUSURECAT); } break; case 'save':
$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'; } } ?>
$sform->display(); unset($hidden); } switch ($op) { case "mod": xoops_cp_header(); adminmenu(_AM_CHANADMIN, $extra = ''); $CID = isset($HTTP_POST_VARS['CID']) ? $HTTP_POST_VARS['CID'] : $CID; edittopic($CID); break; case "del": global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB; if ($confirm) { $xoopsDB->query("DELETE FROM " . $xoopsDB->prefix("wfschannel") . " WHERE CID = {$CID}"); xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), '', $CID); xoops_comment_delete($xoopsModule->getVar('mid'), $CID); redirect_header("index.php", 1, sprintf(_AM_CHANISDELETED, $pagetitle)); exit; } else { $CID = isset($HTTP_POST_VARS['CID']) ? $HTTP_POST_VARS['CID'] : $CID; $result = $xoopsDB->query("SELECT CID, pagetitle FROM " . $xoopsDB->prefix("wfschannel") . " "); if ($xoopsDB->getRowsNum($result) == 1) { redirect_header("index.php", 3, _AM_CANNOTDELETELASTONE); exit; } $result = $xoopsDB->query("SELECT CID, pagetitle FROM " . $xoopsDB->prefix("wfschannel") . " WHERE CID = {$CID}"); list($CID, $pagetitle) = $xoopsDB->fetchrow($result); xoops_cp_header(); echo "<table width='100%' border='0' cellpadding = '2' cellspacing='1' class = 'confirmMsg'><tr><td class='confirmMsg'>"; echo "<div class='confirmMsg'>"; echo "<h4>" . _AM_DELTHISCHAN . "</h4>";
} else { 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 {
$mes = urlencode(sprintf("{$records} " . _AM_FMT_IMPORTED, $calname)); $cal->redirect("done=imported&mes={$mes}"); exit; } } else { if (isset($_POST['delete'])) { // Ticket Check if (!$xoopsGTicket->check()) { redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); } // レコードの削除 if (isset($_POST['ids']) && is_array($_POST['ids'])) { $whr = ""; foreach ($_POST['ids'] as $id) { $whr .= "id={$id} OR rrule_pid={$id} OR "; xoops_comment_delete($xoopsModule->mid(), $id); } $sql = "DELETE FROM {$cal->table} WHERE ({$whr} 0) AND (rrule_pid=0 OR rrule_pid=id)"; mysql_query($sql, $conn); $records = mysql_affected_rows($conn); $sql = "DELETE FROM {$cal->table} WHERE {$whr} 0 "; if (!mysql_query($sql, $conn)) { echo mysql_error(); } else { $mes = urlencode("{$records} " . _AM_MES_DELETED); } } else { $mes = ""; } $cal->redirect("done=deleted&mes={$mes}"); exit;
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; } }
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); } }
function delete_picture($pid) { global $xoopsModuleConfig, $header_printed, $xoopsDB; global $del_pic, $xoopsModule; if (!$header_printed) { output_table_header(); } $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object $green = "<img src=\"images/green.gif\" border=\"0\" width=\"12\" height=\"12\" alt=\"\" /><br />"; $red = "<img src=\"images/red.gif\" border=\"0\" width=\"12\" height=\"12\" alt=\"\" /><br />"; if (USER_IS_ADMIN) { $query = "SELECT aid, filepath, filename FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE pid='{$pid}'"; $result = $xoopsDB->query($query); if (!$xoopsDB->getRowsNum($result)) { redirect_header('index.php', 2, _MD_NON_EXIST_AP); } $pic = $xoopsDB->fetchArray($result); } else { $query = "SELECT " . $xoopsDB->prefix("xcgal_pictures") . ".aid as aid, category, filepath, filename FROM " . $xoopsDB->prefix("xcgal_pictures") . ", " . $xoopsDB->prefix("xcgal_albums") . " WHERE " . $xoopsDB->prefix("xcgal_pictures") . ".aid = " . $xoopsDB->prefix("xcgal_albums") . ".aid AND pid='{$pid}'"; $result = $xoopsDB->query($query); if (!$xoopsDB->getRowsNum($result)) { redirect_header('index.php', 2, _MD_NON_EXIST_AP); } $pic = $xoopsDB->fetchArray($result); if ($pic['category'] != FIRST_USER_CAT + USER_ID) { redirect_header('index.php', 2, _MD_PERM_DENIED); } } $aid = $pic['aid']; $dir = $xoopsModuleConfig['fullpath'] . $pic['filepath']; $file = $pic['filename']; if (!is_writable($dir)) { redirect_header('index.php', 2, sprintf(_MD_DIRECTORY_RO, htmlspecialchars($dir))); } $del_pic = "<tr><td class=\"even\">" . $myts->makeTboxData4Show($file) . "</td>"; $files = array($dir . $file, $dir . $xoopsModuleConfig['normal_pfx'] . $file, $dir . $xoopsModuleConfig['thumb_pfx'] . $file); foreach ($files as $currFile) { $del_pic .= "<td class=\"even\" align=\"center\">"; if (is_file($currFile)) { if (@unlink($currFile)) { $del_pic .= $green; } else { $del_pic .= $red; } } else { $del_pic .= " "; } $del_pic .= "</td>"; } $deleted = xoops_comment_delete($xoopsModule->getVar('mid'), $pid); $del_pic .= "<td class=\"even\" align=\"center\">"; if ($deleted) { $del_pic .= $green; } else { $del_pic .= " "; } $del_pic .= "</td>"; $query = "DELETE FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE pid='{$pid}' LIMIT 1"; $result = $xoopsDB->queryf($query); $del_pic .= "<td class=\"even\" align=\"center\">"; if ($xoopsDB->getAffectedRows() > 0) { $del_pic .= $green; } else { $del_pic .= $red; } $del_pic .= "</td>"; $del_pic .= "</tr>\n"; return $aid; }
$obj->displayForm(); } else { $contents_handler->displayError(_AM_XOOPSFAQ_ERRORCOULDNOTEDITCAT); } break; case 'delete': $ok = xoopsFaq_CleanVars($_REQUEST, 'ok', 0, 'int'); $contents_id = xoopsFaq_CleanVars($_REQUEST, 'contents_id', 0, 'int'); if (1 == $ok) { $obj = $contents_handler->get($contents_id); if (is_object($obj)) { if ($contents_handler->delete($obj)) { $sql = sprintf('DELETE FROM %s WHERE contents_id = %u', $xoopsDB->prefix('xoopsfaq_contents'), $contents_id); $xoopsDB->query($sql); // delete comments xoops_comment_delete($xoopsModule->getVar('mid'), $contents_id); redirect_header('main.php', 1, _AM_XOOPSFAQ_DBSUCCESS); } } $contents_handler->displayError(_AM_XOOPSFAQ_ERRORCOULDNOTDELCAT); } else { xoops_cp_header(); //xoopsFaq_AdminMenu(0); $indexAdmin = new ModuleAdmin(); echo $indexAdmin->addNavigation('main.php'); //xoopsFaq_DisplayHeading(_AM_XOOPSFAQ_CONTENTS_HEADER, _AM_XOOPSFAQ_CATEGORY_DELETE_DSC, false); xoopsFaq_DisplayHeading('', _AM_XOOPSFAQ_CATEGORY_DELETE_DSC, false); xoops_confirm(array('op' => 'delete', 'contents_id' => $contents_id, 'ok' => 1), 'main.php', _AM_XOOPSFAQ_RUSURECAT); } break; case 'save':
function delNewDownload() { global $xoopsDB, $eh, $xoopsModule; $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_downloads"), $_GET['lid']); $xoopsDB->query($sql) or $eh->show("0013"); $sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mydownloads_text"), $_GET['lid']); $xoopsDB->query($sql) or $eh->show("0013"); // delete comments xoops_comment_delete($xoopsModule->getVar('mid'), $_GET['lid']); redirect_header("index.php", 1, _MD_FILEDELETED); }
function process_post_data() { global $_POST, $xoopsModuleConfig, $xoopsDB; global $user_albums_list, $xoopsModule, $myts; $user_album_set = array(); foreach ($user_albums_list as $album) { $user_album_set[$album['aid']] = 1; } if (!is_array($_POST['pid'])) { redirect_header('index.php', 2, _MD_PARAM_MISSING); } $pid_array =& $_POST['pid']; foreach ($pid_array as $pid) { $pid = (int) $pid; $aid = (int) get_post_var('aid', $pid); $title = get_post_var('title', $pid); $caption = get_post_var('caption', $pid); $keywords = get_post_var('keywords', $pid); $user1 = get_post_var('user1', $pid); $user2 = get_post_var('user2', $pid); $user3 = get_post_var('user3', $pid); $user4 = get_post_var('user4', $pid); $delete = isset($_POST['delete' . $pid]); $reset_vcount = isset($_POST['reset_vcount' . $pid]); $reset_votes = isset($_POST['reset_votes' . $pid]); $del_comments = isset($_POST['del_comments' . $pid]) || $delete; $query = "SELECT category, filepath, filename, owner_id FROM " . $xoopsDB->prefix("xcgal_pictures") . ", " . $xoopsDB->prefix("xcgal_albums") . " WHERE " . $xoopsDB->prefix("xcgal_pictures") . ".aid = " . $xoopsDB->prefix("xcgal_albums") . ".aid AND pid='{$pid}'"; $result = $xoopsDB->query($query); if (!$xoopsDB->getRowsNum($result)) { redirect_header('index.php', 2, _MD_NON_EXIST_AP); } $pic = $xoopsDB->fetchArray($result); $xoopsDB->freeRecordSet($result); if (!USER_IS_ADMIN) { if ($pic['category'] != FIRST_USER_CAT + USER_ID) { redirect_header('index.php', 2, _MD_PERM_DENIED . "<br />(picture category = {$pic['category']}/ {$pid})"); } if (!isset($user_album_set[$aid])) { redirect_header('index.php', 2, _MD_PERM_DENIED . "<br />(target album = {$aid})"); } } $update = "aid = '" . $aid . "'"; $update .= ", title = '" . $myts->makeTboxData4Save($title) . "'"; $update .= ", caption = '" . $myts->makeTareaData4Save($caption, 0) . "'"; $update .= ", keywords = '" . $myts->makeTboxData4Save($keywords) . "'"; $update .= ", user1 = '" . $myts->makeTboxData4Save($user1) . "'"; $update .= ", user2 = '" . $myts->makeTboxData4Save($user2) . "'"; $update .= ", user3 = '" . $myts->makeTboxData4Save($user3) . "'"; $update .= ", user4 = '" . $myts->makeTboxData4Save($user4) . "'"; if ($reset_vcount) { $update .= ", hits = '0'"; } if ($reset_votes) { $update .= ", pic_rating = '0', votes = '0'"; } if (UPLOAD_APPROVAL_MODE) { $approved = get_post_var('approved', $pid); if ($approved == 'YES') { $update .= ", approved = 'YES'"; } elseif ($approved == 'DELETE') { $del_comments = 1; $delete = 1; } } if ($del_comments) { //$query = "DELETE FROM ".$xoopsDB->prefix("xcgal_comments")." WHERE pid='$pid'"; //$result =$xoopsDB->query($query); xoops_comment_delete($xoopsModule->getVar('mid'), $pid); } if ($delete) { $dir = $xoopsModuleConfig['fullpath'] . $pic['filepath']; $file = $pic['filename']; if (!is_writable($dir)) { redirect_header('index.php', 2, sprintf(_MD_DIRECTORY_RO, $dir)); } $files = array($dir . $file, $dir . $xoopsModuleConfig['normal_pfx'] . $file, $dir . $xoopsModuleConfig['thumb_pfx'] . $file); foreach ($files as $currFile) { if (is_file($currFile)) { @unlink($currFile); } } $query = "DELETE FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE pid='{$pid}' LIMIT 1"; $result = $xoopsDB->query($query); } else { $query = "UPDATE " . $xoopsDB->prefix("xcgal_pictures") . " SET {$update} WHERE pid='{$pid}' LIMIT 1"; $result = $xoopsDB->query($query); if ($pic['owner_id'] != 0) { $submitter = new XoopsUser($pic['owner_id']); $submitter->incrementPost(); } } } }
//ver3.0 if (!is_array($_POST['topics'])) { redirect_header('index.php?op=topicsmanager', 1, _TAKINGBACK); } else { $move_topics = array_map('intval', $_POST['topics']); } $gperm =& BulletinGP::getInstance($mydirname); array_push($topic_arr, $BTopic); foreach ($topic_arr as $eachtopic) { if ($move_topics[$eachtopic->topic_id()] == 0) { // Gets all articles $story_arr = Bulletin::getAllByTopic($mydirname, $eachtopic->topic_id()); foreach ($story_arr as $eachstory) { if (false != $eachstory->delete()) { //Delete Comment xoops_comment_delete($xoopsModule->getVar('mid'), $eachstory->getVar('storyid')); //Delete an event notification 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
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; } }
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 categoryDeletego($categoryID = '') { global $cat_table,$ent_table,$xoopsConfig,$xoopsModuleConfig,$xoopsModule,$xoopsGTicket,$MYDIRNAME; // Ticket check if ( ! $xoopsGTicket->check() ) { redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors()); } $xoopsDB =& Database::getInstance(); $myts =& MyTextSanitizer::getInstance(); $ok = !empty($_POST['ok']) ? intval($_POST['ok']) : 0; $name = !empty($_POST['name']) ? $myts -> htmlSpecialChars($_POST['name']) : ""; // confirmed, so delete if ( $ok != 1 && $categoryID < 0 ) { redirect_header( "index.php", 2, constant("_AM_{$MYDIRNAME}_NOTUPDATED") ); } $resultA2 = $xoopsDB -> query( "SELECT entryID FROM $ent_table WHERE categoryID = '$categoryID'" ); if ( $xoopsDB -> getRowsNum( $resultA2 ) ) { while ( list( $entryID ) = $xoopsDB -> fetchrow( $resultA2 ) ) { xoops_comment_delete($xoopsModule->getVar('mid'), $entryID); } $xoopsDB -> query( "DELETE FROM $ent_table WHERE categoryID = '$categoryID'"); } if ( !$xoopsDB -> queryF( "DELETE FROM $cat_table WHERE categoryID = '$categoryID'") ) { redirect_header( "index.php", 2, constant("_AM_{$MYDIRNAME}_NOTUPDATED") ); } else { redirect_header("index.php",1,sprintf( constant("_AM_{$MYDIRNAME}_CATISDELETED"), $name ) ); } }
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 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 emptyTopic(&$post) { global $xoopsModule, $xoopsConfig; if (!is_object($post) || !$post->isTopic()) { return false; } $sql = sprintf("UPDATE %s SET post_text='[--DELETED--]', post_edit='' WHERE post_id = %u", $this->db->prefix("bb_posts_text"), $post->getVar('post_id')); if (!($result = $this->db->queryF($sql))) { newbb_message("Could not remove post text: " . $sql); return false; } $post->deleteAttachment(); $sql = sprintf("UPDATE %s SET uid=0, attachment='', attachsig=0 WHERE post_id = %u", $this->db->prefix("bb_posts"), $post->getVar('post_id')); if (!($result = $this->db->queryF($sql))) { newbb_message("Could not remove post : " . $sql); return false; } $sql = sprintf("UPDATE %s SET topic_poster=0, topic_haspoll=0 WHERE topic_id = %u", $this->db->prefix("bb_topics"), $post->getVar('topic_id')); if (!($result = $this->db->queryF($sql))) { newbb_message("Could not update topic: " . $sql); return false; } if ($post->getVar('uid')) { $sql = sprintf("UPDATE %s SET posts=posts-1 WHERE uid = %u", $this->db->prefix("users"), $post->getVar('uid')); if (!($result = $this->db->queryF($sql))) { newbb_message("Could not update user posts: " . $sql); } } $topic_handler =& xoops_getmodulehandler('topic', 'newbb'); $poll_id =& $topic_handler->get($post->getVar('topic_id'), "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_votedata"), $post->getVar('topic_id')); if (!($result = $this->db->queryF($sql))) { newbb_message("Could not delete votedata: " . $sql); } return 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 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); }
/** * 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; }
$topic_views = $topic_obj->getVar("topic_views") + $newtopic_obj->getVar("topic_views"); $criteria_newtopic = new Criteria("topic_id", $newtopic); $topic_handler->updateAll("topic_views", $topic_views, $criteria_newtopic, true); $topic_handler->synchronization($newtopic); $poll_id = $topic_handler->get($tid, "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", $xoopsDB->prefix("bb_topics"), $tid); $result = $xoopsDB->queryF($sql); $sql = sprintf("DELETE FROM %s WHERE topic_id = %u", $xoopsDB->prefix("bb_votedata"), $tid); $result = $xoopsDB->queryF($sql); $sql = sprintf("UPDATE %s SET forum_topics = forum_topics-1 WHERE forum_id = %u", $xoopsDB->prefix("bb_forums"), $forum); $result = $xoopsDB->queryF($sql); $topic_obj->loadFilters("delete"); $newtopic_obj->loadFilters("update"); } echo $action[$mode]['msg'] . "<p><a href='viewtopic.php?topic_id={$newtopic}'>" . _MD_VIEWTHETOPIC . "</a></p>" . "<p><a href='viewforum.php?forum={$forum}'>" . _MD_RETURNTOTHEFORUM . "</a></p>" . "<p><a href='index.php'>" . _MD_RETURNFORUMINDEX . "</a></p>"; } elseif ('move' == $mode) { if ($newforum > 0) {
function entryDeletego($entryID = '') { global $cat_table,$ent_table,$xoopsConfig,$xoopsModuleConfig,$xoopsModule,$xoopsGTicket,$MYDIRNAME; // Ticket check if ( ! $xoopsGTicket->check() ) { redirect_header(XOOPS_URL.'/',3,$xoopsGTicket->getErrors()); } $xoopsDB =& Database::getInstance(); $myts =& MyTextSanitizer::getInstance(); $confirm = !empty($_POST['confirm']) ? intval($_POST['confirm']) : 0; $term = !empty($_POST['term']) ? $myts -> htmlSpecialChars($_POST['term']) : ""; if ( $confirm != 1 || $entryID < 0 ) { redirect_header( "submissions.php", 2, constant("_AM_{$MYDIRNAME}_NOENTRY") ); exit(); } if ( $xoopsDB -> query( "DELETE FROM $ent_table WHERE entryID = $entryID" ) ) { // delete comments xoops_comment_delete($xoopsModule->getVar('mid'), $entryID); redirect_header( "submissions.php", 1, sprintf( constant("_AM_{$MYDIRNAME}_ENTRYISDELETED"), $term ) ); } else { redirect_header( "index.php", 2, constant("_AM_{$MYDIRNAME}_NOTUPDATED") ); } }