From 71941da552f6f2f2bf735f15d457c0a679b84bf6 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 29 Nov 2019 02:21:00 +0000 Subject: [PATCH] custom primary keys --- composer.lock | 8 ++++---- ext/image_hash_ban/main.php | 3 ++- ext/not_a_tag/main.php | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 12147aae..dd97dbb2 100644 --- a/composer.lock +++ b/composer.lock @@ -388,12 +388,12 @@ "source": { "type": "git", "url": "https://github.com/shish/microcrud.git", - "reference": "6471a4c7445e872282f12d1de3730db55d5c06e2" + "reference": "f346979a046cf3d348df6a552d7a919f9793c938" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/shish/microcrud/zipball/6471a4c7445e872282f12d1de3730db55d5c06e2", - "reference": "6471a4c7445e872282f12d1de3730db55d5c06e2", + "url": "https://api.github.com/repos/shish/microcrud/zipball/f346979a046cf3d348df6a552d7a919f9793c938", + "reference": "f346979a046cf3d348df6a552d7a919f9793c938", "shasum": "" }, "require": { @@ -429,7 +429,7 @@ "crud", "generator" ], - "time": "2019-11-28T15:53:53+00:00" + "time": "2019-11-29T02:11:55+00:00" }, { "name": "shish/microhtml", diff --git a/ext/image_hash_ban/main.php b/ext/image_hash_ban/main.php index 33c49d29..b968e999 100644 --- a/ext/image_hash_ban/main.php +++ b/ext/image_hash_ban/main.php @@ -12,6 +12,7 @@ class HashBanTable extends Table parent::__construct($db); $this->table = "image_bans"; $this->base_query = "SELECT * FROM image_bans"; + $this->primary_key = "hash"; $this->size = 100; $this->limit = 1000000; $this->columns = [ @@ -102,7 +103,7 @@ class ImageBan extends Extension } elseif ($event->get_arg(0) == "remove") { $user->ensure_authed(); $input = validate_input(["d_hash"=>"string"]); - send_event(new RemoveImageHashBanEvent($input['hash'])); + send_event(new RemoveImageHashBanEvent($input['d_hash'])); flash_message("Image ban removed"); $page->set_mode(PageMode::REDIRECT); $page->set_redirect($_SERVER['HTTP_REFERER']); diff --git a/ext/not_a_tag/main.php b/ext/not_a_tag/main.php index 4a0d56d4..20d5682b 100644 --- a/ext/not_a_tag/main.php +++ b/ext/not_a_tag/main.php @@ -10,6 +10,7 @@ class NotATagTable extends Table parent::__construct($db); $this->table = "untags"; $this->base_query = "SELECT * FROM untags"; + $this->primary_key = "tag"; $this->size = 100; $this->limit = 1000000; $this->columns = [ @@ -122,7 +123,7 @@ class NotATag extends Extension $t = new NotATagTable($database->raw_db()); $t->token = $user->get_auth_token(); $t->inputs = $_GET; - $this->theme->display_bans($page, $t->table($t->query()), $t->paginator()); + $this->theme->display_untags($page, $t->table($t->query()), $t->paginator()); } } }