From c3088c57fe5cc10f7712e6a1aa67e3d1fe5dc27f Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 4 Feb 2020 00:47:13 +0000 Subject: [PATCH] remove bulk_remove - it was never completed, and bulk_actions is better --- ext/bulk_remove/info.php | 14 ----- ext/bulk_remove/main.php | 132 --------------------------------------- 2 files changed, 146 deletions(-) delete mode 100644 ext/bulk_remove/info.php delete mode 100644 ext/bulk_remove/main.php diff --git a/ext/bulk_remove/info.php b/ext/bulk_remove/info.php deleted file mode 100644 index 25bf3ea1..00000000 --- a/ext/bulk_remove/info.php +++ /dev/null @@ -1,14 +0,0 @@ -"support@drudexsoftware.com"]; - public $license = self::LICENSE_GPLV2; - public $description = "Allows admin to delete many images at once through Board Admin."; -} diff --git a/ext/bulk_remove/main.php b/ext/bulk_remove/main.php deleted file mode 100644 index 7f7433b9..00000000 --- a/ext/bulk_remove/main.php +++ /dev/null @@ -1,132 +0,0 @@ -page_matches("bulk_remove") && $user->can(Permissions::BULK_ADD) && $user->check_auth_token()) { - if ($event->get_arg(0) == "confirm") { - $this->do_bulk_remove(); - } else { - $this->show_confirm(); - } - } - } - - public function onAdminBuilding(AdminBuildingEvent $event) - { - global $page; - $html = "Be extremely careful when using this!
- Once an image is removed there is no way to recover it so it is recommended that - you first take when removing a large amount of images.
- Note: Entering both an ID range and tags will only remove images between the given ID's that have the given tags. - -

".make_form(make_link("bulk_remove"))." - - - - - - - - -
Remove images by ID
From
Until
Where tags are
- -
- - "; - $page->add_block(new Block("Bulk Remove", $html)); - } - - // returns a list of images to be removed - private function determine_images() - { - // set vars - $images_for_removal = []; - $error = ""; - - $min_id = $_POST['remove_id_min']; - $max_id = $_POST['remove_id_max']; - $tags = $_POST['remove_tags']; - - - // if using id range to remove (comined removal with tags) - if ($min_id != "" && $max_id != "") { - // error if values are not correctly entered - if (!is_numeric($min_id) || !is_numeric($max_id) || - intval($max_id) < intval($min_id)) { - $error = "Values not correctly entered for removal between id."; - } else { // if min & max id are valid - - // Grab the list of images & place it in the removing array - foreach (Image::find_images(intval($min_id), intval($max_id)) as $image) { - array_push($images_for_removal, $image); - } - } - } - - // refine previous results or create results from tags - if ($tags != "") { - $tags_arr = explode(" ", $_POST['remove_tags']); - - // Search all images with the specified tags & add to list - foreach (Image::find_images(1, 2147483647, $tags_arr) as $image) { - array_push($images_for_removal, $image); - } - } - - - // if no images were found with the given info - if (count($images_for_removal) == 0) { - $error = "No images selected for removal"; - } - - //var_dump($tags_arr); - return [ - "error" => $error, - "images_for_removal" => $images_for_removal]; - } - - // displays confirmation to admin before removal - private function show_confirm() - { - global $page; - - // set vars - $determined_imgs = $this->determine_images(); - $error = $determined_imgs["error"]; - $images_for_removal = $determined_imgs["images_for_removal"]; - - // if there was an error in determine_images() - if ($error != "") { - $page->add_block(new Block("Cannot remove images", $error)); - return; - } - // generates the image array & places it in $_POST["bulk_remove_images"] - $_POST["bulk_remove_images"] = $images_for_removal; - - // Display confirmation message - $html = make_form(make_link("bulk_remove")). - "Are you sure you want to PERMANENTLY remove ". - count($images_for_removal) ." images?
"; - $page->add_block(new Block("Confirm Removal", $html)); - } - - private function do_bulk_remove() - { - global $page; - // display error if user didn't go through admin board - if (!isset($_POST["bulk_remove_images"])) { - $page->add_block(new Block( - "Bulk Remove Error", - "Please use Board Admin to use bulk remove." - )); - } - - // - $image_arr = $_POST["bulk_remove_images"]; - } -}