diff --git a/contrib/image_hash_ban/main.php b/contrib/image_hash_ban/main.php index 1c36fd9c..a99fe7c7 100644 --- a/contrib/image_hash_ban/main.php +++ b/contrib/image_hash_ban/main.php @@ -128,11 +128,30 @@ class ImageBan extends SimpleExtension { // DB funness public function get_image_hash_bans($page, $size=100) { + global $database; + // FIXME: many $size_i = int_escape($size); $offset_i = int_escape($page-1)*$size_i; - global $database; - $bans = $database->get_all("SELECT * FROM image_bans ORDER BY id DESC LIMIT $size_i OFFSET $offset_i"); + $where = array("(1=1)"); + $args = array(); + if(!empty($_GET['hash'])) { + $where[] = 'hash = ?'; + $args[] = $_GET['hash']; + } + if(!empty($_GET['reason'])) { + $where[] = 'reason SCORE_ILIKE ?'; + $args[] = "%".$_GET['reason']."%"; + } + $where = implode(" AND ", $where); + $bans = $database->get_all($database->engine->scoreql_to_sql(" + SELECT * + FROM image_bans + WHERE $where + ORDER BY id DESC + LIMIT $size_i + OFFSET $offset_i + "), $args); if($bans) {return $bans;} else {return array();} } diff --git a/contrib/image_hash_ban/theme.php b/contrib/image_hash_ban/theme.php index 1e858c79..d4649921 100644 --- a/contrib/image_hash_ban/theme.php +++ b/contrib/image_hash_ban/theme.php @@ -45,7 +45,16 @@ class ImageBanTheme extends Themelet { }); - + + + + + + + + + + $h_bans ".make_form(make_link("image_hash_ban/add"))."
HashReasonAction
HashReasonAction