Alright, this time it should actually work with RCx. It now requires a different theme file for RCx.
git-svn-id: file:///home/shish/svn/shimmie2/trunk@614 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
7958f19800
commit
078043b9bf
5 changed files with 115 additions and 9 deletions
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
|
||||
/*
|
||||
* Name: Report Images
|
||||
* Author: ATravelingGeek (atg@atravelinggeek.com
|
||||
* Link: http://atravelinggeek.com/
|
||||
* License: GPLv2
|
||||
* Description: Report images as dupes/illegal/etc
|
||||
* Version 0.3 - See changelog in main.php
|
||||
* Version 0.3a - See changelog in main.php
|
||||
* November 06, 2007
|
||||
*
|
||||
* NOTE: This is for Shimmie2 SVN Trunk. Use the other main.php.use... for Shimmie2 RCx.
|
||||
|
@ -162,6 +163,8 @@ class report_image extends Extension {
|
|||
add_event_listener(new report_image(), 29); // Not sure what I'm in before.
|
||||
|
||||
// ===== Changelog =====
|
||||
// * Version 0.3a / 0.3a_rc - 11/06/07 - I can no longer use the same theme.php file for both SVN and RCx. Sorry.
|
||||
// * Same deal with theme.php as it is with main.php
|
||||
// * Version 0.3 / 0.3_rc - 11/06/07 - Added the option to display thumbnails, moved the reported image list to it's
|
||||
// own page, and checked to make sure the user is an admin before letting them delete / view reported images.
|
||||
// * Version 0.2c_rc2 - 10/27/07 - Now (really!) supports Shimmie2 RC2!
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
|
||||
/*
|
||||
* Name: Report Images
|
||||
* Author: ATravelingGeek (atg@atravelinggeek.com
|
||||
* Link: http://atravelinggeek.com/
|
||||
* License: GPLv2
|
||||
* Description: Report images as dupes/illegal/etc
|
||||
* Version 0.3_rc - See changelog in main.php
|
||||
* Version 0.3a_rc - See changelog in main.php
|
||||
* November 06, 2007
|
||||
*
|
||||
* NOTE: This is for Shimmie2 RCx. Rename this file to main.php and delete the other file.
|
||||
|
@ -59,7 +60,7 @@ class report_image extends Extension {
|
|||
}
|
||||
else if($event->get_arg(0) == "remove") {
|
||||
if(isset($_POST['id'])) {
|
||||
if($event->user->is_admin()) {
|
||||
if($user->is_admin()) {
|
||||
send_event(new RemoveReportedImageEvent($_POST['id']));
|
||||
global $page;
|
||||
$page->set_mode("redirect");
|
||||
|
@ -68,7 +69,7 @@ class report_image extends Extension {
|
|||
}
|
||||
}
|
||||
else if($event->get_arg(0) == "list") {
|
||||
if($event->user->is_admin()) {
|
||||
if($user->is_admin()) {
|
||||
global $page;
|
||||
$this->theme->display_reported_images($page, $this->get_reported_images());
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
* Link: http://atravelinggeek.com/
|
||||
* License: GPLv2
|
||||
* Description: Report images as dupes/illegal/etc
|
||||
* Version 0.3 - See changelog in main.php
|
||||
* Version 0.3a - See changelog in main.php
|
||||
* November 06, 2007
|
||||
*/
|
||||
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
* Link: http://atravelinggeek.com/
|
||||
* License: GPLv2
|
||||
* Description: Report images as dupes/illegal/etc
|
||||
* Version 0.3 - See changelog in main.php
|
||||
* Version 0.3a - See changelog in main.php
|
||||
* November 06, 2007
|
||||
*
|
||||
* NOTE: This is for Shimmie2 SVN Trunk. Use the other theme.php.use... for Shimmie2 RCx.
|
||||
*
|
||||
*/
|
||||
|
||||
class ReportImageTheme extends Themelet {
|
||||
|
@ -30,7 +33,7 @@ class ReportImageTheme extends Themelet {
|
|||
|
||||
$h_reportedimages .= "
|
||||
<tr>
|
||||
<td>{$image_link}{$image_reported_thumb_html}</td>
|
||||
<td>{$image_link}</td>
|
||||
<td>{$userlink}</td>
|
||||
<td>{$reportedimage['reason_type']}</td>
|
||||
<td>{$reason}</td>
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
<?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_rc - See changelog in main.php
|
||||
* November 06, 2007
|
||||
*
|
||||
* NOTE: This is for Shimmie2 RCx. Rename this file to theme.php and delete the other file.
|
||||
*
|
||||
*/
|
||||
|
||||
class ReportImageTheme extends Themelet {
|
||||
public function display_reported_images($page, $reportedimages) {
|
||||
$h_reportedimages = "";
|
||||
foreach($reportedimages as $reportedimage) {
|
||||
|
||||
// If the reason is 'Duplicate' make the 'reason' field a link to the reported image
|
||||
if ($reportedimage['reason_type'] == "Duplicate")
|
||||
{
|
||||
$reason = "<a href=\"".make_link("post/view/{$reportedimage['reason']}")."\">".$reportedimage['reason']."</a>";
|
||||
$reason .= $this->make_thumbnail_html($reportedimage['reason']);
|
||||
} else {
|
||||
$reason = $reportedimage['reason'];
|
||||
}
|
||||
|
||||
$image_link = "<a href=\"".make_link("post/view/{$reportedimage['image_id']}")."\">".$reportedimage['image_id']."</a>";
|
||||
$image_link .= $this->make_thumbnail_html($reportedimage['image_id']);
|
||||
$userlink = "<a href='".make_link("user/{$reportedimage['reporter_name']}")."'>{$reportedimage['reporter_name']}</a>";
|
||||
|
||||
$h_reportedimages .= "
|
||||
<tr>
|
||||
<td>{$image_link}</td>
|
||||
<td>{$userlink}</td>
|
||||
<td>{$reportedimage['reason_type']}</td>
|
||||
<td>{$reason}</td>
|
||||
<td>
|
||||
<form action='".make_link("ReportImage/remove")."' method='POST'>
|
||||
<input type='hidden' name='id' value='{$reportedimage['id']}'>
|
||||
<input type='submit' value='Remove'>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
$html = "
|
||||
<table border='1'>
|
||||
<thead><td>Image</td><td>Reporter</td><td>Reason Type</td><td>Reason / Image ID</td><td>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));
|
||||
|
||||
}
|
||||
|
||||
protected function make_thumbnail_html($image_id) {
|
||||
global $config;
|
||||
global $database;
|
||||
|
||||
if($config->get_bool('report_image_show_thumbs')) {
|
||||
|
||||
$image_obj_reported = $database->get_image($image_id);
|
||||
return "<br>" . build_thumb_html($image_obj_reported);
|
||||
}
|
||||
}
|
||||
|
||||
public function display_image_banner($page, $image) {
|
||||
|
||||
global $config;
|
||||
|
||||
$page->add_header("<script type='text/javascript' src='".get_base_href()."/ext/report_image/report_image.js'></script>");
|
||||
|
||||
$i_image = int_escape($image);
|
||||
$html = "
|
||||
<form name='ReportImage' action='".make_link("ReportImage/add")."' onsubmit='return validate_report()' method='POST'>
|
||||
<input type='hidden' name='image_id' value='$i_image'>
|
||||
<select onchange='change_reason()' name='reason_type'>
|
||||
<option style='font-weight:bold' selected>Select a reason...</option>
|
||||
<option value='Other'>Other</option>
|
||||
<option value='Violates Rules'>Violates Rules</option>
|
||||
<option value='Illegal'>Illegal</option>
|
||||
<option value='Duplicate'>Duplicate</option>
|
||||
<input type='field' name='reason' value='Please enter a reason' onclick='document.ReportImage.reason.select()'>
|
||||
</select>
|
||||
<input type='submit' value='Report'>
|
||||
</form>
|
||||
";
|
||||
$page->add_block(new Block("Report Image", $html, "left"));
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
Reference in a new issue