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/ext/report_image/theme.php

112 lines
3.5 KiB
PHP
Raw Normal View History

<?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
*/
2009-01-04 19:18:37 +00:00
class ReportImageTheme extends Themelet
{
public function display_reported_images(Page $page, array $reports)
{
global $config, $user;
$h_reportedimages = "";
foreach ($reports as $report) {
$image = $report['image'];
$h_reason = format_text($report['reason']);
$image_link = $this->build_thumb_html($image);
$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
$iabbe = new ImageAdminBlockBuildingEvent($image, $user);
send_event($iabbe);
ksort($iabbe->parts);
$actions = join("<br>", $iabbe->parts);
2009-01-04 19:18:37 +00:00
$h_reportedimages .= "
2012-02-22 14:27:56 +00:00
<tr>
<td>{$image_link}</td>
<td>Report by $userlink: $h_reason</td>
<td class='formstretch'>
".make_form(make_link("image_report/remove"))."
<input type='hidden' name='id' value='{$report['id']}'>
<input type='submit' value='Remove Report'>
</form>
<br>$actions
</td>
</tr>
";
}
2009-01-04 19:18:37 +00:00
$thumb_width = $config->get_int("thumb_width");
$html = "
2009-08-18 21:39:10 +00:00
<table id='reportedimage' class='zebra'>
<thead><td width='$thumb_width'>Image</td><td>Reason</td><td width='128'>Action</td></thead>
$h_reportedimages
</table>
";
2009-01-04 19:18:37 +00:00
$page->set_title("Reported Images");
$page->set_heading("Reported Images");
$page->add_block(new NavBlock());
$page->add_block(new Block("Reported Images", $html));
}
/**
* #param ImageReport[] $reports
*/
public function display_image_banner(Image $image, array $reports)
{
global $config, $page;
2009-01-04 19:18:37 +00:00
$i_image = int_escape($image->id);
$html = "";
$public = $config->get_string("report_image_publicity");
if ($public != "none" && count($reports) > 0) {
$html .= "<b>Current reports:</b>";
foreach ($reports as $report) {
$html .= "<br>";
if ($public == "both") {
$html .= html_escape(User::by_id($report->user_id)->name);
$html .= " - ";
$html .= format_text($report->reason);
} elseif ($public == "user") {
$html .= html_escape(User::by_id($report->user_id)->name);
} elseif ($public == "reason") {
$html .= format_text($report->reason);
}
}
$html .= "<p>";
}
$html .= "
".make_form(make_link("image_report/add"))."
<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'>
<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 = "
2015-02-08 04:27:54 +00:00
<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));
}
}