This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/contrib/report_image/theme.php
shish 0cbc905e7c give the report image extension some love
git-svn-id: file:///home/shish/svn/shimmie2/trunk@983 7f39781d-f577-437e-ae19-be835c7a54ca
2008-08-12 02:37:48 +00:00

88 lines
2.3 KiB
PHP
Executable file

<?php
/*
* Name: Report Images
* Author: ATravelingGeek (atg@atravelinggeek.com
* Link: http://atravelinggeek.com/
* License: GPLv2
* Description: Report images as dupes/illegal/etc
* Version 0.3a - See changelog in main.php
* November 06, 2007
*/
class ReportImageTheme extends Themelet {
public function display_reported_images($page, $reports) {
global $config;
$h_reportedimages = "";
foreach($reports as $report) {
$image = $report['image'];
$h_reason = html_escape($report['reason']);
if($config->get_bool('report_image_show_thumbs')) {
$image_link = $this->build_thumb_html($image);
}
else {
$image_link = "<a href=\"".make_link("post/view/{$image->id}")."\">{$image->id}</a>";
}
$reporter_name = html_escape($report['reporter_name']);
$userlink = "<a href='".make_link("user/$reporter_name")."'>$reporter_name</a>";
global $user;
$iabbe = new ImageAdminBlockBuildingEvent($image, $user);
send_event($iabbe);
ksort($iabbe->parts);
$actions = join("<br>", $iabbe->parts);
$h_reportedimages .= "
<tr>
<td>{$image_link}</td>
<td>Report by $userlink: $h_reason</td>
<td class='formstretch'>
<form action='".make_link("image_report/remove")."' method='POST'>
<input type='hidden' name='id' value='{$report['id']}'>
<input type='submit' value='Remove Report'>
</form>
<br>$actions
</td>
</tr>
";
}
$thumb_width = $config->get_int("thumb_width");
$html = "
<style>
.formstretch FORM INPUT {
width: 100%;
}
</style>
<table border='1'>
<thead><td width='$thumb_width'>Image</td><td>Reason</td><td width='128'>Action</td></thead>
$h_reportedimages
</table>
";
$page->set_title("Reported Images");
$page->set_heading("Reported Images");
$page->add_block(new NavBlock());
$page->add_block(new Block("Reported Images", $html));
}
public function display_image_banner($page, $image) {
global $config;
$i_image = int_escape($image);
$html = "
<form action='".make_link("image_report/add")."' method='POST'>
<input type='hidden' name='image_id' value='$i_image'>
<input type='field' name='reason' value='Please enter a reason' onclick='this.value=\"\";'>
<input type='submit' value='Report'>
</form>
";
$page->add_block(new Block("Report Image", $html, "left"));
}
}
?>