<!--##################################################################### # # File : DELETE IMAGE # Project : Game Magazine Project # Author : Béo Sagittarius # Created : 07/01/2015 # ##################################################################### --> <?php include '../includes/functions.php'; include '../includes/backend/header-admin.php'; include '../includes/backend/mysqli_connect.php'; $iid = validate_id($_GET['iid']); // Neu muon delete page $result = delete_images($iid); if (mysqli_affected_rows($dbc) == 1) { echo "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\talert('{$lang['AD_DEL_SUCCESS']}');\n window.location = 'list_images.php';\n\t\t\t\t</script>\n\t\t\t"; } else { echo "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\talert('{$lang['AD_DEL_FAIL']}');\n window.location = 'list_images.php';\n\t\t\t\t</script>\n\t\t\t"; }
} show_admin_header(); if ($action == "deleteimage") { $selectimages = isset($HTTP_POST_VARS['selectimages']) ? $HTTP_POST_VARS['selectimages'] : array(); $delfromserver = isset($HTTP_POST_VARS['delfromserver']) ? intval($HTTP_POST_VARS['delfromserver']) : 1; $image_ids = ""; if (!empty($selectimages)) { foreach ($selectimages as $val) { $image_ids .= ($image_ids != "" ? ", " : "") . $val; } } $lang_key = count($selectimages) > 1 ? 'images' : 'image'; show_table_header($lang['delete'] . ": " . $lang[$lang_key], 1); echo "<tr><td class=\"tablerow\">\n"; echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td> </td><td>\n"; $error_log = delete_images($image_ids, $delfromserver); echo "</td></tr></table>\n"; echo "</td></tr>\n"; show_table_footer(); if (!empty($error_log)) { show_table_header("Error Log:", 1); echo "<tr><td class=\"tablerow\">\n"; echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td> </td><td>\n"; echo "<b>" . $lang['error_log_desc'] . "</b>\n<ul>\n"; foreach ($error_log as $val) { printf("<li>%s</li>\n", $val); } echo "</ul>\n</td></tr></table>\n"; echo "</td></tr>\n"; show_table_footer(); }
} showsubmit('optiondetailsubmit', 'submit'); showtablefooter(); showformfooter(); $bbcode = '[poll=' . $itemid . ',' . $choiceid . ']' . $_G['siteurl'] . '[/poll]'; $jscode = '<script type="text/javascript" src="' . $_G['siteurl'] . 'api/poll.php?action=pollnum&itemid=' . $itemid . '&choiceid=' . $choiceid . '" charset="' . CHARSET . '"></script>'; showtableheader('poll_option_code', 'fixpadding'); showsetting('poll_option_bbcode', '', $bbcode, 'textarea'); showsetting('poll_option_jscode', '', $jscode, 'textarea'); showtablefooter(); } else { if (empty($_G['gp_captionnew'])) { cpmsg('poll_add_invalid', '', 'error'); } if ($_FILES['urlnew']['name']) { delete_images($optiondata['aid']); $attach = upload_images($_FILES['urlnew'], 'poll', 176, 176); } else { $attach['attachment'] = $optiondata['imageurl']; $attach['aid'] = $optiondata['aid']; } $optiondata = array('caption' => dhtmlspecialchars(trim($_G['gp_captionnew'])), 'pollnum' => intval($_G['gp_pollnumnew']), 'imageurl' => $attach['attachment'], 'detailurl' => dhtmlspecialchars(trim($_G['gp_detailurlnew'])), 'aid' => $attach['aid']); DB::update('poll_choice', $optiondata, "choiceid='{$choiceid}'"); $pollnum = DB::result_first("SELECT SUM(pollnum) FROM " . DB::table('poll_choice') . " WHERE itemid = '{$itemid}'"); DB::update('poll_item', array('totalnum' => $pollnum), "itemid = '{$itemid}'"); cpmsg('poll_option_succeed', $returnurl, 'succeed'); } } elseif ($operation == 'rlist') { $choiceid = intval($_G['gp_choiceid']); $adminurl = ADMINSCRIPT . '?action=poll&operation=rlist'; shownav('poll', 'nav_poll_manage', 'nav_poll_choose_rlist');
function delete_multi_news($perpage, $offset) { is_admin(); $list = ""; $adelete = $this->input->post('delete'); $N = count($adelete); for ($i = 0; $i < $N; $i++) { if ($adelete[$i] != "") { $list = $list . ',' . $adelete[$i]; $news = $this->News_m->get_detail_news($adelete[$i]); if ($news->num_rows() > 0) { if ($news->row()->img != null) { $image_to_delete = './assets/photo_news/' . $news->row()->img; $thumb_to_delete = './assets/photo_news/thumbs/' . $news->row()->img; delete_images($image_to_delete, $thumb_to_delete); } } } } $list = '(' . substr($list, 1) . ')'; $query = $this->News_m->delete_multi_news($list); if ($query) { $this->session->set_flashdata('error', "L'article a été supprimé !"); } else { $this->session->set_flashdata('error', "L'article n'a pas été supprimé !"); } redirect('admin_news/list_news/' . $perpage . '/' . $offset); }
$product_id = $cascaded_prod_id_for_delete; $product_categories = $cascaded_prod_cat_for_delete; $do_delete_flag = true; // no check for $delete_linked here, because it should already be passed from categories.php } if ($do_delete_flag) { //--------------PRODUCT_TYPE_SPECIFIC_INSTRUCTIONS_GO__BELOW_HERE-------------------------------------------------------- //--------------PRODUCT_TYPE_SPECIFIC_INSTRUCTIONS_GO__ABOVE__HERE-------------------------------------------------------- // now do regular non-type-specific delete: // remove product from all its categories: for ($k = 0, $m = sizeof($product_categories); $k < $m; $k++) { //delete_images $rs = $db->Execute("select products_image from products where products_id = '" . (int) $product_id . "'"); $products_image = $rs->fields['products_image']; if ($products_image != "") { delete_images($products_image); } $db->Execute("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . "\n where products_id = '" . (int) $product_id . "'\n and categories_id = '" . (int) $product_categories[$k] . "'"); } // confirm that product is no longer linked to any categories $count_categories = $db->Execute("select count(categories_id) as total\n from " . TABLE_PRODUCTS_TO_CATEGORIES . "\n where products_id = '" . (int) $product_id . "'"); // echo 'count of category links for this product=' . $count_categories->fields['total'] . '<br />'; // if not linked to any categories, do delete: if ($count_categories->fields['total'] == '0') { zen_remove_product($product_id, $delete_linked); } } // endif $do_delete_flag // if this is a single-product delete, redirect to categories page // if not, then this file was called by the cascading delete initiated by the category-delete process if ($action == 'delete_product_confirm') {
function delete_album($id, $kind) { is_admin(); $media = $this->Media_m->get_media_by_album($id); foreach ($media as $m) { if ($kind == 'video') { $file_name = './assets/media/videos/' . $m['file_path']; if ($m['file_path'] != null) { delete_my_file($file_name); } } else { $file_name = './assets/media/images/' . $m['file_path']; $thumbs_name = './assets/media/images/thumbs/' . $m['file_path']; if ($m['file_path'] != null) { delete_images($file_name, $thumbs_name); } } } $query = $this->Media_m->delete_album($id); if ($query > 0) { $this->session->set_flashdata('error', 'Supprimer le succès'); } redirect('admin_media/list_albums'); }
//Delete thumbnail file //Video thumbnail has jpg extension $targetFile = dirname(__FILE__) . $ds . 'src' . $ds . $entity['album_ID'] . $ds . "thumb" . $ds . $entity['id'] . ".jpg"; if (!unlink($targetFile)) { echo "Error deleting {$targetFile}"; } else { echo "Deleted {$targetFile}"; } //Remove sql entity $entityController->remove_entity($entity['id']); } } if (in_array('all', $_POST['media'])) { delete_images(); delete_videos(); $dbController->remove_album($_POST['album_ID']); header('Location: index.php'); die; } else { if (in_array('photos', $_POST['media'])) { echo "delete all Images"; delete_images(); } if (in_array('videos', $_POST['media'])) { echo "delete all videos"; delete_videos(); } } //Redirect Back header('Location: ' . $_SERVER['HTTP_REFERER']); die;