From 4116bda0663e1757237fe4d1f59f62193a9b747d Mon Sep 17 00:00:00 2001 From: Matthew Barbour Date: Thu, 27 Jun 2019 14:37:05 -0500 Subject: [PATCH] Adjusted admin delete by query to bypass trash --- ext/admin/main.php | 3 ++- ext/admin/theme.php | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ext/admin/main.php b/ext/admin/main.php index c6c7f33f..4ebae35e 100644 --- a/ext/admin/main.php +++ b/ext/admin/main.php @@ -137,6 +137,7 @@ class AdminPage extends Extension global $page; $query = $_POST['query']; $reason = @$_POST['reason']; + assert(strlen($query) > 1); $images = Image::find_images(0, 1000000, Tag::explode($query)); @@ -146,7 +147,7 @@ class AdminPage extends Extension if ($reason && class_exists("ImageBan")) { send_event(new AddImageHashBanEvent($image->hash, $reason)); } - send_event(new ImageDeletionEvent($image)); + send_event(new ImageDeletionEvent($image, true)); } $page->set_mode(PageMode::REDIRECT); diff --git a/ext/admin/theme.php b/ext/admin/theme.php index 64191067..1abe6542 100644 --- a/ext/admin/theme.php +++ b/ext/admin/theme.php @@ -55,16 +55,18 @@ class AdminPageTheme extends Themelet $html .= ""; $html .= "\n"; $page->add_block(new Block("Set Tag Case", $html)); + } public function dbq_html($terms) { - $h_terms = html_escape($terms); - $h_reason = ""; + if(ext_is_live("Trash")) { + $warning = "This delete method will bypass the trash
"; + } if (class_exists("ImageBan")) { $h_reason = ""; } - $html = make_form(make_link("admin/delete_by_query"), "POST") . " + $html = $warning.make_form(make_link("admin/delete_by_query"), "POST") . " $h_reason @@ -73,4 +75,6 @@ class AdminPageTheme extends Themelet "; return $html; } + + }