Gazelle/sections/reports/report.php

306 lines
7.7 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
include(SERVER_ROOT.'/sections/reports/array.php');
2013-04-17 08:00:58 +00:00
if (empty($_GET['type']) || empty($_GET['id']) || !is_number($_GET['id'])) {
2011-03-28 14:21:28 +00:00
error(404);
}
2013-04-17 08:00:58 +00:00
if (!array_key_exists($_GET['type'], $Types)) {
2011-03-28 14:21:28 +00:00
error(403);
}
$Short = $_GET['type'];
2013-02-22 08:00:24 +00:00
$Type = $Types[$Short];
2011-03-28 14:21:28 +00:00
$ID = $_GET['id'];
2013-04-17 08:00:58 +00:00
switch ($Short) {
2013-04-19 08:00:55 +00:00
case 'user' :
2011-10-01 08:00:08 +00:00
$DB->query("SELECT Username FROM users_main WHERE ID=".$ID);
2013-04-17 08:00:58 +00:00
if ($DB->record_count() < 1) {
2011-10-01 08:00:08 +00:00
error(404);
}
list($Username) = $DB->next_record();
break;
2013-04-19 08:00:55 +00:00
case 'request_update' :
2011-10-01 08:00:08 +00:00
$NoReason = true;
$DB->query("SELECT Title, Description, TorrentID, CategoryID, Year FROM requests WHERE ID=".$ID);
2013-04-17 08:00:58 +00:00
if ($DB->record_count() < 1) {
2011-10-01 08:00:08 +00:00
error(404);
}
list($Name, $Desc, $Filled, $CategoryID, $Year) = $DB->next_record();
2013-04-19 08:00:55 +00:00
if ($Filled || ($CategoryID != 0 && ($Categories[$CategoryID-1] != 'Music' || $Year != 0))) {
2011-10-01 08:00:08 +00:00
error(403);
}
break;
2013-04-19 08:00:55 +00:00
case 'request' :
2011-10-01 08:00:08 +00:00
$DB->query("SELECT Title, Description, TorrentID FROM requests WHERE ID=".$ID);
2013-04-17 08:00:58 +00:00
if ($DB->record_count() < 1) {
2011-10-01 08:00:08 +00:00
error(404);
}
list($Name, $Desc, $Filled) = $DB->next_record();
break;
2013-04-19 08:00:55 +00:00
case 'collage' :
2011-10-01 08:00:08 +00:00
$DB->query("SELECT Name, Description FROM collages WHERE ID=".$ID);
2013-04-17 08:00:58 +00:00
if ($DB->record_count() < 1) {
2011-10-01 08:00:08 +00:00
error(404);
}
list($Name, $Desc) = $DB->next_record();
break;
2013-04-19 08:00:55 +00:00
case 'thread' :
2013-05-27 08:00:58 +00:00
$DB->query("
SELECT ft.Title, ft.ForumID, um.Username
FROM forums_topics AS ft
JOIN users_main AS um ON um.ID=ft.AuthorID
WHERE ft.ID=".$ID);
2013-04-17 08:00:58 +00:00
if ($DB->record_count() < 1) {
2011-10-01 08:00:08 +00:00
error(404);
}
list($Title, $ForumID, $Username) = $DB->next_record();
$DB->query("SELECT MinClassRead FROM forums WHERE ID = ".$ForumID);
list($MinClassRead) = $DB->next_record();
2013-04-17 08:00:58 +00:00
if (!empty($LoggedUser['DisableForums']) ||
2012-03-28 08:00:20 +00:00
($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
2011-10-01 08:00:08 +00:00
(isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
error(403);
}
break;
2013-04-19 08:00:55 +00:00
case 'post' :
2013-05-27 08:00:58 +00:00
$DB->query('
SELECT fp.Body, fp.TopicID, um.Username
FROM forums_posts AS fp
JOIN users_main AS um ON um.ID=fp.AuthorID
WHERE fp.ID='.$ID);
2013-04-17 08:00:58 +00:00
if ($DB->record_count() < 1) {
2011-10-01 08:00:08 +00:00
error(404);
}
list($Body, $TopicID, $Username) = $DB->next_record();
2013-04-19 08:00:55 +00:00
$DB->query('SELECT ForumID FROM forums_topics WHERE ID = '.$TopicID);
2011-10-01 08:00:08 +00:00
list($ForumID) = $DB->next_record();
2013-04-19 08:00:55 +00:00
$DB->query('SELECT MinClassRead FROM forums WHERE ID = '.$ForumID);
2011-10-01 08:00:08 +00:00
list($MinClassRead) = $DB->next_record();
2013-04-17 08:00:58 +00:00
if (!empty($LoggedUser['DisableForums']) ||
2012-03-28 08:00:20 +00:00
($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0)) ||
2011-10-01 08:00:08 +00:00
(isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
error(403);
}
break;
2013-04-19 08:00:55 +00:00
case 'requests_comment' :
case 'torrents_comment' :
case 'artist_comment':
case 'collages_comment' :
2011-10-01 08:00:08 +00:00
$Table = $Short.'s';
2013-04-19 08:00:55 +00:00
if ($Short == 'collages_comment') {
$Column = 'UserID';
2011-10-01 08:00:08 +00:00
} else {
2013-04-19 08:00:55 +00:00
$Column = 'AuthorID';
2011-10-01 08:00:08 +00:00
}
2013-05-27 08:00:58 +00:00
$DB->query('
SELECT '.$Short.".Body, um.Username
FROM $Table AS $Short
JOIN users_main AS um ON um.ID=$Short.$Column
WHERE $Short.ID=".$ID);
2013-04-17 08:00:58 +00:00
if ($DB->record_count() < 1) {
2011-10-01 08:00:08 +00:00
error(404);
}
2012-03-02 08:00:27 +00:00
list($Body, $Username) = $DB->next_record();
2011-10-01 08:00:08 +00:00
break;
}
2013-05-21 08:01:09 +00:00
View::show_header('Report a '.$Type['title'],'bbcode,jquery,jquery.validate,form_validate');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>Report <?=$Type['title']?></h2>
</div>
2011-03-28 14:21:28 +00:00
<h3>Reporting guidelines</h3>
<div class="box pad">
<p>Following these guidelines will help the moderators deal with your report in a timely fashion. </p>
<ul>
<?
2013-04-17 08:00:58 +00:00
foreach ($Type['guidelines'] as $Guideline) {
2011-03-28 14:21:28 +00:00
?>
<li><?=$Guideline?></li>
<? } ?>
</ul>
<p>In short, please include as much detail as possible when reporting. Thank you. </p>
</div>
<?
2013-05-27 08:00:58 +00:00
include(SERVER_ROOT.'/classes/text.class.php'); // Text formatting class
2011-03-28 14:21:28 +00:00
$Text = new TEXT;
2013-04-17 08:00:58 +00:00
switch ($Short) {
2013-04-19 08:00:55 +00:00
case 'user' :
2011-03-28 14:21:28 +00:00
?>
<p>You are reporting the user <strong><?=display_str($Username)?></strong></p>
<?
break;
2013-04-19 08:00:55 +00:00
case 'request_update' :
2011-03-28 14:21:28 +00:00
?>
<p>You are reporting the request:</p>
<table>
<tr class="colhead">
<td>Title</td>
<td>Description</td>
<td>Filled?</td>
</tr>
<tr>
<td><?=display_str($Name)?></td>
2013-02-22 08:00:24 +00:00
<td><?=$Text->full_format($Desc)?></td>
2011-03-28 14:21:28 +00:00
<td><strong><?=($Filled == 0 ? 'No' : 'Yes')?></strong></td>
</tr>
</table>
<br />
<div class="box pad center">
2012-09-09 08:00:26 +00:00
<p><strong>It will greatly increase the turnover rate of the updates if you can fill in as much of the following details as possible.</strong></p>
2013-05-21 08:01:09 +00:00
<form class="create_form" id="report_form" name="report" action="" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="takereport" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$ID?>" />
<input type="hidden" name="type" value="<?=$Short?>" />
2012-09-01 08:00:24 +00:00
<table class="layout">
2011-03-28 14:21:28 +00:00
<tr>
<td class="label">Year (required)</td>
<td>
2013-05-21 08:01:09 +00:00
<input type="text" size="4" name="year" class="required" />
2011-03-28 14:21:28 +00:00
</td>
</tr>
<tr>
2013-04-19 08:00:55 +00:00
<td class="label">Release type</td>
2011-03-28 14:21:28 +00:00
<td>
<select id="releasetype" name="releasetype">
2013-04-19 08:00:55 +00:00
<option value="0">---</option>
2013-02-22 08:00:24 +00:00
<?
2011-03-28 14:21:28 +00:00
foreach ($ReleaseTypes as $Key => $Val) {
2013-05-27 08:00:58 +00:00
?> <option value="<?=$Key?>"<?=(!empty($ReleaseType) ? ($Key == $ReleaseType ? ' selected="selected"' : '') : '')?>><?=$Val?></option>
2013-02-22 08:00:24 +00:00
<?
2011-03-28 14:21:28 +00:00
}
?>
</select>
</td>
</tr>
<tr>
<td class="label">Comment</td>
<td>
2013-05-21 08:01:09 +00:00
<textarea rows="8" cols="80" name="comment" class="required"></textarea>
2011-03-28 14:21:28 +00:00
</td>
</tr>
</table>
<br />
<br />
<input type="submit" value="Submit report" />
</form>
</div>
<?
break;
2013-04-19 08:00:55 +00:00
case 'request' :
2011-03-28 14:21:28 +00:00
?>
<p>You are reporting the request:</p>
<table>
<tr class="colhead">
<td>Title</td>
<td>Description</td>
<td>Filled?</td>
</tr>
<tr>
<td><?=display_str($Name)?></td>
2013-02-22 08:00:24 +00:00
<td><?=$Text->full_format($Desc)?></td>
2011-03-28 14:21:28 +00:00
<td><strong><?=($Filled == 0 ? 'No' : 'Yes')?></strong></td>
</tr>
</table>
2013-02-22 08:00:24 +00:00
<?
2011-03-28 14:21:28 +00:00
break;
2013-04-19 08:00:55 +00:00
case 'collage' :
2011-03-28 14:21:28 +00:00
?>
<p>You are reporting the collage:</p>
<table>
<tr class="colhead">
<td>Title</td>
<td>Description</td>
</tr>
<tr>
2013-02-22 08:00:24 +00:00
<td><?=display_str($Name)?></td>
2011-03-28 14:21:28 +00:00
<td><?=$Text->full_format($Desc)?></td>
</tr>
</table>
2013-02-22 08:00:24 +00:00
<?
2011-03-28 14:21:28 +00:00
break;
2013-04-19 08:00:55 +00:00
case 'thread' :
2011-03-28 14:21:28 +00:00
?>
<p>You are reporting the thread:</p>
<table>
<tr class="colhead">
<td>Username</td>
<td>Title</td>
</tr>
<tr>
2013-02-22 08:00:24 +00:00
<td><?=display_str($Username)?></td>
2011-03-28 14:21:28 +00:00
<td><?=display_str($Title)?></td>
</tr>
</table>
2013-02-22 08:00:24 +00:00
<?
2011-03-28 14:21:28 +00:00
break;
2013-04-19 08:00:55 +00:00
case 'post' :
2011-03-28 14:21:28 +00:00
?>
<p>You are reporting the post:</p>
<table>
<tr class="colhead">
<td>Username</td>
<td>Body</td>
</tr>
<tr>
2013-02-22 08:00:24 +00:00
<td><?=display_str($Username)?></td>
2011-03-28 14:21:28 +00:00
<td><?=$Text->full_format($Body)?></td>
</tr>
</table>
2013-02-22 08:00:24 +00:00
<?
2011-03-28 14:21:28 +00:00
break;
2013-04-19 08:00:55 +00:00
case 'requests_comment' :
case 'torrents_comment' :
case 'artist_comment':
case 'collages_comment' :
2011-03-28 14:21:28 +00:00
?>
<p>You are reporting the <?=$Types[$Short]['title']?>:</p>
<table>
<tr class="colhead">
<td>Username</td>
<td>Body</td>
</tr>
<tr>
2013-02-22 08:00:24 +00:00
<td><?=display_str($Username)?></td>
2011-03-28 14:21:28 +00:00
<td><?=$Text->full_format($Body)?></td>
</tr>
</table>
2013-02-22 08:00:24 +00:00
<?
break;
2011-03-28 14:21:28 +00:00
}
2013-04-17 08:00:58 +00:00
if (empty($NoReason)) {
2011-03-28 14:21:28 +00:00
?>
<h3>Reason</h3>
<div class="box pad center">
2013-05-21 08:01:09 +00:00
<form class="create_form" name="report" id="report_form" action="" method="post">
2011-03-28 14:21:28 +00:00
<input type="hidden" name="action" value="takereport" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$ID?>" />
<input type="hidden" name="type" value="<?=$Short?>" />
2013-05-21 08:01:09 +00:00
<textarea class="required" rows="10" cols="95" name="reason"></textarea><br /><br />
2011-03-28 14:21:28 +00:00
<input type="submit" value="Submit report" />
</form>
</div>
<?
}
// close <div class="thin"> ?>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2012-10-27 08:00:09 +00:00
?>