custom primary keys

This commit is contained in:
Shish 2019-11-29 02:21:00 +00:00
parent 3ac3fcb711
commit 71941da552
3 changed files with 8 additions and 6 deletions

8
composer.lock generated
View file

@ -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",

View file

@ -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']);

View file

@ -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());
}
}
}