Image to Post - hash bans
This commit is contained in:
parent
83f8b61c4e
commit
708acd461c
3 changed files with 11 additions and 11 deletions
|
@ -5,7 +5,7 @@ class ImageBanInfo extends ExtensionInfo
|
|||
public const KEY = "image_hash_ban";
|
||||
|
||||
public $key = self::KEY;
|
||||
public $name = "Image Hash Ban";
|
||||
public $name = "Post Hash Ban";
|
||||
public $url = "http://atravelinggeek.com/";
|
||||
public $authors = ["ATravelingGeek"=>"atg@atravelinggeek.com"];
|
||||
public $license = self::LICENSE_GPLV2;
|
||||
|
|
|
@ -78,7 +78,7 @@ class ImageBan extends Extension
|
|||
$row = $database->get_row("SELECT * FROM image_bans WHERE hash = :hash", ["hash"=>$event->hash]);
|
||||
if ($row) {
|
||||
log_info("image_hash_ban", "Attempted to upload a blocked image ({$event->hash} - {$row['reason']})");
|
||||
throw new UploadException("Image ".html_escape($row["hash"])." has been banned, reason: ".format_text($row["reason"]));
|
||||
throw new UploadException("Post ".html_escape($row["hash"])." has been banned, reason: ".format_text($row["reason"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,11 +97,11 @@ class ImageBan extends Extension
|
|||
|
||||
if ($hash) {
|
||||
send_event(new AddImageHashBanEvent($hash, $reason));
|
||||
$page->flash("Image ban added");
|
||||
$page->flash("Post ban added");
|
||||
|
||||
if ($image) {
|
||||
send_event(new ImageDeletionEvent($image));
|
||||
$page->flash("Image deleted");
|
||||
$page->flash("Post deleted");
|
||||
}
|
||||
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
|
@ -111,7 +111,7 @@ class ImageBan extends Extension
|
|||
$user->ensure_authed();
|
||||
$input = validate_input(["d_hash"=>"string"]);
|
||||
send_event(new RemoveImageHashBanEvent($input['d_hash']));
|
||||
$page->flash("Image ban removed");
|
||||
$page->flash("Post ban removed");
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
$page->set_redirect(referer_or(make_link()));
|
||||
} elseif ($event->get_arg(0) == "list") {
|
||||
|
@ -129,7 +129,7 @@ class ImageBan extends Extension
|
|||
global $user;
|
||||
if ($event->parent==="system") {
|
||||
if ($user->can(Permissions::BAN_IMAGE)) {
|
||||
$event->add_nav_link("image_bans", new Link('image_hash_ban/list/1'), "Image Bans", NavLink::is_active(["image_hash_ban"]));
|
||||
$event->add_nav_link("image_bans", new Link('image_hash_ban/list/1'), "Post Bans", NavLink::is_active(["image_hash_ban"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ class ImageBan extends Extension
|
|||
{
|
||||
global $user;
|
||||
if ($user->can(Permissions::BAN_IMAGE)) {
|
||||
$event->add_link("Image Bans", make_link("image_hash_ban/list/1"));
|
||||
$event->add_link("Post Bans", make_link("image_hash_ban/list/1"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ class ImageBanTheme extends Themelet
|
|||
*/
|
||||
public function display_bans(Page $page, $table, $paginator)
|
||||
{
|
||||
$page->set_title("Image Bans");
|
||||
$page->set_heading("Image Bans");
|
||||
$page->set_title("Post Bans");
|
||||
$page->set_heading("Post Bans");
|
||||
$page->add_block(new NavBlock());
|
||||
$page->add_block(new Block("Edit Image Bans", $table . $paginator));
|
||||
$page->add_block(new Block("Edit Post Bans", $table . $paginator));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -24,7 +24,7 @@ class ImageBanTheme extends Themelet
|
|||
INPUT(["type"=>'hidden', "name"=>'c_hash', "value"=>$image->hash]),
|
||||
INPUT(["type"=>'hidden', "name"=>'c_image_id', "value"=>$image->id]),
|
||||
INPUT(["type"=>'text', "name"=>'c_reason']),
|
||||
INPUT(["type"=>'submit', "value"=>'Ban Hash and Delete Image']),
|
||||
INPUT(["type"=>'submit', "value"=>'Ban Hash and Delete Post']),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue