[not_a_tag] fix link

This commit is contained in:
Shish 2024-02-24 16:30:59 +00:00 committed by Shish
parent ac14d1e4c6
commit 255e797ea0

View file

@ -109,7 +109,7 @@ class NotATag extends Extension
global $user; global $user;
if ($event->parent === "tags") { if ($event->parent === "tags") {
if ($user->can(Permissions::BAN_IMAGE)) { if ($user->can(Permissions::BAN_IMAGE)) {
$event->add_nav_link("untags", new Link('untag/list/1'), "UnTags"); $event->add_nav_link("untags", new Link('untag/list'), "UnTags");
} }
} }
} }
@ -118,7 +118,7 @@ class NotATag extends Extension
{ {
global $user; global $user;
if ($user->can(Permissions::BAN_IMAGE)) { if ($user->can(Permissions::BAN_IMAGE)) {
$event->add_link("UnTags", make_link("untag/list/1")); $event->add_link("UnTags", make_link("untag/list"));
} }
} }
@ -126,8 +126,7 @@ class NotATag extends Extension
{ {
global $database, $page, $user; global $database, $page, $user;
if ($event->page_matches("untag", permission: Permissions::BAN_IMAGE)) { if ($event->page_matches("untag/add", method: "POST", permission: Permissions::BAN_IMAGE)) {
if ($event->page_matches("untag/add", method: "POST")) {
$input = validate_input(["c_tag" => "string", "c_redirect" => "string"]); $input = validate_input(["c_tag" => "string", "c_redirect" => "string"]);
$database->execute( $database->execute(
"INSERT INTO untags(tag, redirect) VALUES (:tag, :redirect)", "INSERT INTO untags(tag, redirect) VALUES (:tag, :redirect)",
@ -136,7 +135,7 @@ class NotATag extends Extension
$page->set_mode(PageMode::REDIRECT); $page->set_mode(PageMode::REDIRECT);
$page->set_redirect(referer_or(make_link())); $page->set_redirect(referer_or(make_link()));
} }
if ($event->page_matches("untag/remove", method: "POST")) { if ($event->page_matches("untag/remove", method: "POST", permission: Permissions::BAN_IMAGE)) {
$input = validate_input(["d_tag" => "string"]); $input = validate_input(["d_tag" => "string"]);
$database->execute( $database->execute(
"DELETE FROM untags WHERE LOWER(tag) = LOWER(:tag)", "DELETE FROM untags WHERE LOWER(tag) = LOWER(:tag)",
@ -153,5 +152,4 @@ class NotATag extends Extension
$this->theme->display_crud("UnTags", $t->table($t->query()), $t->paginator()); $this->theme->display_crud("UnTags", $t->table($t->query()), $t->paginator());
} }
} }
}
} }