2007-10-22 00:13:57 +00:00
|
|
|
<?php
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
class ImageBanTheme extends Themelet
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Show all the bans
|
|
|
|
*
|
|
|
|
* $bans = an array of (
|
|
|
|
* 'hash' => the banned hash
|
|
|
|
* 'reason' => why the hash was banned
|
|
|
|
* 'date' => when the ban started
|
|
|
|
* )
|
|
|
|
*/
|
|
|
|
public function display_image_hash_bans(Page $page, $page_number, $page_count, $bans)
|
|
|
|
{
|
|
|
|
$h_bans = "";
|
|
|
|
foreach ($bans as $ban) {
|
|
|
|
$h_bans .= "
|
2012-02-22 14:27:56 +00:00
|
|
|
<tr>
|
2012-03-30 16:20:15 +00:00
|
|
|
".make_form(make_link("image_hash_ban/remove"))."
|
|
|
|
<td width='30%'>{$ban['hash']}</td>
|
|
|
|
<td>{$ban['reason']}</td>
|
|
|
|
<td width='10%'>
|
2007-10-22 00:13:57 +00:00
|
|
|
<input type='hidden' name='hash' value='{$ban['hash']}'>
|
|
|
|
<input type='submit' value='Remove'>
|
2012-03-30 16:20:15 +00:00
|
|
|
</td>
|
|
|
|
</form>
|
2007-10-22 00:13:57 +00:00
|
|
|
</tr>
|
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
|
|
|
$html = "
|
2012-03-30 16:20:15 +00:00
|
|
|
<table id='image_bans' class='zebra sortable'>
|
2012-01-17 15:33:42 +00:00
|
|
|
<thead>
|
|
|
|
<th>Hash</th><th>Reason</th><th>Action</th>
|
|
|
|
<tr>
|
|
|
|
<form action='".make_link("image_hash_ban/list/1")."' method='GET'>
|
|
|
|
<td><input type='text' name='hash'></td>
|
|
|
|
<td><input type='text' name='reason'></td>
|
|
|
|
<td><input type='submit' value='Search'></td>
|
|
|
|
</form>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2007-10-22 00:13:57 +00:00
|
|
|
$h_bans
|
2009-01-17 04:24:43 +00:00
|
|
|
<tfoot><tr>
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("image_hash_ban/add"))."
|
2007-10-22 00:13:57 +00:00
|
|
|
<td><input type='text' name='hash'></td>
|
|
|
|
<td><input type='text' name='reason'></td>
|
|
|
|
<td><input type='submit' value='Ban'></td>
|
|
|
|
</form>
|
2009-01-17 04:24:43 +00:00
|
|
|
</tr></tfoot>
|
2007-10-22 00:13:57 +00:00
|
|
|
</table>
|
|
|
|
";
|
2008-12-14 23:57:26 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$prev = $page_number - 1;
|
|
|
|
$next = $page_number + 1;
|
2008-12-14 23:57:26 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$h_prev = ($page_number <= 1) ? "Prev" : "<a href='".make_link("image_hash_ban/list/$prev")."'>Prev</a>";
|
|
|
|
$h_index = "<a href='".make_link()."'>Index</a>";
|
|
|
|
$h_next = ($page_number >= $page_count) ? "Next" : "<a href='".make_link("image_hash_ban/list/$next")."'>Next</a>";
|
2008-12-14 23:57:26 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$nav = "$h_prev | $h_index | $h_next";
|
2008-12-14 23:57:26 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->set_title("Image Bans");
|
|
|
|
$page->set_heading("Image Bans");
|
|
|
|
$page->add_block(new Block("Edit Image Bans", $html));
|
|
|
|
$page->add_block(new Block("Navigation", $nav, "left", 0));
|
|
|
|
$this->display_paginator($page, "image_hash_ban/list", null, $page_number, $page_count);
|
|
|
|
}
|
2007-10-22 00:13:57 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
/*
|
|
|
|
* Display a link to delete an image
|
|
|
|
*
|
|
|
|
* $image_id = the image to delete
|
|
|
|
*/
|
|
|
|
public function get_buttons_html(Image $image)
|
|
|
|
{
|
|
|
|
$html = "
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("image_hash_ban/add"))."
|
2008-07-27 15:55:45 +00:00
|
|
|
<input type='hidden' name='hash' value='{$image->hash}'>
|
|
|
|
<input type='hidden' name='image_id' value='{$image->id}'>
|
|
|
|
<input type='text' name='reason'>
|
2013-09-18 08:28:07 +00:00
|
|
|
<input type='submit' value='Ban Hash and Delete Image'>
|
2007-10-22 00:13:57 +00:00
|
|
|
</form>
|
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
return $html;
|
|
|
|
}
|
2007-10-22 00:13:57 +00:00
|
|
|
}
|