2007-10-24 21:45:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Name: Report Images
|
|
|
|
* Author: ATravelingGeek (atg@atravelinggeek.com
|
|
|
|
* Link: http://atravelinggeek.com/
|
|
|
|
* License: GPLv2
|
|
|
|
* Description: Report images as dupes/illegal/etc
|
2007-11-06 20:59:15 +00:00
|
|
|
* Version 0.3a - See changelog in main.php
|
2007-11-06 20:17:14 +00:00
|
|
|
* November 06, 2007
|
2007-10-24 21:45:38 +00:00
|
|
|
*/
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2007-10-24 21:45:38 +00:00
|
|
|
class ReportImageTheme extends Themelet {
|
2014-04-28 22:22:57 +00:00
|
|
|
/**
|
|
|
|
* @param Page $page
|
|
|
|
* @param array $reports
|
|
|
|
*/
|
2009-01-04 19:54:16 +00:00
|
|
|
public function display_reported_images(Page $page, $reports) {
|
2008-08-12 02:37:48 +00:00
|
|
|
global $config;
|
|
|
|
|
2007-10-24 21:45:38 +00:00
|
|
|
$h_reportedimages = "";
|
2008-08-12 02:37:48 +00:00
|
|
|
foreach($reports as $report) {
|
|
|
|
$image = $report['image'];
|
2010-02-11 10:50:50 +00:00
|
|
|
$h_reason = format_text($report['reason']);
|
2012-03-19 10:43:54 +00:00
|
|
|
$image_link = $this->build_thumb_html($image);
|
2008-08-12 02:37:48 +00:00
|
|
|
|
|
|
|
$reporter_name = html_escape($report['reporter_name']);
|
|
|
|
$userlink = "<a href='".make_link("user/$reporter_name")."'>$reporter_name</a>";
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2008-08-12 02:37:48 +00:00
|
|
|
global $user;
|
|
|
|
$iabbe = new ImageAdminBlockBuildingEvent($image, $user);
|
|
|
|
send_event($iabbe);
|
|
|
|
ksort($iabbe->parts);
|
|
|
|
$actions = join("<br>", $iabbe->parts);
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2008-08-12 02:37:48 +00:00
|
|
|
$h_reportedimages .= "
|
2012-02-22 14:27:56 +00:00
|
|
|
<tr>
|
2008-08-12 02:37:48 +00:00
|
|
|
<td>{$image_link}</td>
|
|
|
|
<td>Report by $userlink: $h_reason</td>
|
|
|
|
<td class='formstretch'>
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("image_report/remove"))."
|
2008-08-12 02:37:48 +00:00
|
|
|
<input type='hidden' name='id' value='{$report['id']}'>
|
|
|
|
<input type='submit' value='Remove Report'>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<br>$actions
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
";
|
2007-10-24 21:45:38 +00:00
|
|
|
}
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2008-08-12 02:37:48 +00:00
|
|
|
$thumb_width = $config->get_int("thumb_width");
|
2007-10-24 21:45:38 +00:00
|
|
|
$html = "
|
2009-08-18 21:39:10 +00:00
|
|
|
<table id='reportedimage' class='zebra'>
|
2008-08-12 02:37:48 +00:00
|
|
|
<thead><td width='$thumb_width'>Image</td><td>Reason</td><td width='128'>Action</td></thead>
|
2007-10-24 21:45:38 +00:00
|
|
|
$h_reportedimages
|
|
|
|
</table>
|
|
|
|
";
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2007-10-24 21:45:38 +00:00
|
|
|
$page->set_title("Reported Images");
|
|
|
|
$page->set_heading("Reported Images");
|
|
|
|
$page->add_block(new NavBlock());
|
2007-11-06 20:17:14 +00:00
|
|
|
$page->add_block(new Block("Reported Images", $html));
|
2007-10-24 21:45:38 +00:00
|
|
|
}
|
|
|
|
|
2014-04-28 07:26:35 +00:00
|
|
|
/**
|
|
|
|
* @param Image $image
|
|
|
|
* @param array $reporters
|
|
|
|
*/
|
2012-02-12 06:41:10 +00:00
|
|
|
public function display_image_banner(Image $image, /*array*/ $reporters) {
|
2014-04-28 07:26:35 +00:00
|
|
|
global $page;
|
2009-01-04 19:18:37 +00:00
|
|
|
|
2009-01-22 13:42:44 +00:00
|
|
|
$i_image = int_escape($image->id);
|
2012-02-12 06:41:10 +00:00
|
|
|
$html = "";
|
|
|
|
if(count($reporters) > 0) {
|
|
|
|
$html .= "<b>Image reported by ".html_escape(implode(", ", $reporters))."</b><p>";
|
|
|
|
}
|
|
|
|
$html .= "
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("image_report/add"))."
|
2007-10-24 21:45:38 +00:00
|
|
|
<input type='hidden' name='image_id' value='$i_image'>
|
2012-02-12 09:55:47 +00:00
|
|
|
<input type='text' name='reason' placeholder='Please enter a reason'>
|
2007-10-24 21:45:38 +00:00
|
|
|
<input type='submit' value='Report'>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
$page->add_block(new Block("Report Image", $html, "left"));
|
|
|
|
}
|
2015-02-08 04:27:54 +00:00
|
|
|
|
|
|
|
public function get_nuller(User $duser) {
|
|
|
|
global $user, $page;
|
|
|
|
$html = "
|
|
|
|
<form action='".make_link("image_report/remove_reports_by")."' method='POST'>
|
|
|
|
".$user->get_auth_html()."
|
|
|
|
<input type='hidden' name='user_id' value='{$duser->id}'>
|
|
|
|
<input type='submit' value='Delete all reports by this user'>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
$page->add_block(new Block("Reports", $html, "main", 80));
|
|
|
|
}
|
2007-10-24 21:45:38 +00:00
|
|
|
}
|
2014-04-26 02:54:51 +00:00
|
|
|
|