2012-09-04 08:00:23 +00:00
|
|
|
<?
|
2013-05-01 08:00:16 +00:00
|
|
|
if (!check_perms('site_moderate_forums')) {
|
2012-09-04 08:00:23 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:00:16 +00:00
|
|
|
if (empty($Return)) {
|
2012-09-04 08:00:23 +00:00
|
|
|
$ToID = $_GET['to'];
|
2013-05-01 08:00:16 +00:00
|
|
|
if ($ToID == $LoggedUser['ID']) {
|
2012-09-04 08:00:23 +00:00
|
|
|
error("You cannot start a conversation with yourself!");
|
|
|
|
header('Location: inbox.php');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:00:16 +00:00
|
|
|
if (!$ToID || !is_number($ToID)) {
|
2012-09-04 08:00:23 +00:00
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
|
|
|
|
$ReportID = $_GET['reportid'];
|
|
|
|
$Type = $_GET['type'];
|
2013-11-19 08:00:48 +00:00
|
|
|
$ThingID = $_GET['thingid'];
|
2012-09-04 08:00:23 +00:00
|
|
|
|
2013-05-01 08:00:16 +00:00
|
|
|
if (!$ReportID || !is_number($ReportID) || !$ThingID || !is_number($ThingID) || !$Type) {
|
2012-09-04 08:00:23 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:00:16 +00:00
|
|
|
if (!empty($LoggedUser['DisablePM']) && !isset($StaffIDs[$ToID])) {
|
2012-09-04 08:00:23 +00:00
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
|
2013-05-30 08:00:30 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT Username
|
|
|
|
FROM users_main
|
2013-11-19 08:00:48 +00:00
|
|
|
WHERE ID = '$ToID'");
|
2012-09-18 08:00:29 +00:00
|
|
|
list($ComposeToUsername) = $DB->next_record();
|
2013-05-01 08:00:16 +00:00
|
|
|
if (!$ComposeToUsername) {
|
2012-09-04 08:00:23 +00:00
|
|
|
error(404);
|
|
|
|
}
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_header('Compose', 'inbox,bbcode');
|
2012-09-04 08:00:23 +00:00
|
|
|
|
2013-01-16 08:00:31 +00:00
|
|
|
// $TypeLink is placed directly in the <textarea> when composing a PM
|
2013-05-01 08:00:16 +00:00
|
|
|
switch ($Type) {
|
2013-05-30 08:00:30 +00:00
|
|
|
case 'user':
|
|
|
|
$DB->query("
|
|
|
|
SELECT Username
|
|
|
|
FROM users_main
|
2013-11-19 08:00:48 +00:00
|
|
|
WHERE ID = $ThingID");
|
2013-07-10 00:08:53 +00:00
|
|
|
if (!$DB->has_results()) {
|
2013-05-30 08:00:30 +00:00
|
|
|
$Error = 'No user with the reported ID found';
|
2012-09-04 08:00:23 +00:00
|
|
|
} else {
|
|
|
|
list($Username) = $DB->next_record();
|
2013-05-30 08:00:30 +00:00
|
|
|
$TypeLink = "the user [user]{$Username}[/user]";
|
|
|
|
$Subject = 'User Report: '.display_str($Username);
|
2012-09-04 08:00:23 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-05-30 08:00:30 +00:00
|
|
|
case 'request':
|
|
|
|
case 'request_update':
|
|
|
|
$DB->query("
|
|
|
|
SELECT Title
|
|
|
|
FROM requests
|
2013-11-19 08:00:48 +00:00
|
|
|
WHERE ID = $ThingID");
|
2013-07-10 00:08:53 +00:00
|
|
|
if (!$DB->has_results()) {
|
2013-05-30 08:00:30 +00:00
|
|
|
$Error = 'No request with the reported ID found';
|
2012-09-04 08:00:23 +00:00
|
|
|
} else {
|
|
|
|
list($Name) = $DB->next_record();
|
2013-11-19 08:00:48 +00:00
|
|
|
$TypeLink = 'the request [url='.site_url()."requests.php?action=view&id=$ThingID]".display_str($Name).'[/url]';
|
2013-05-30 08:00:30 +00:00
|
|
|
$Subject = 'Request Report: '.display_str($Name);
|
2012-09-04 08:00:23 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-05-30 08:00:30 +00:00
|
|
|
case 'collage':
|
|
|
|
$DB->query("
|
|
|
|
SELECT Name
|
|
|
|
FROM collages
|
2013-11-19 08:00:48 +00:00
|
|
|
WHERE ID = $ThingID");
|
2013-07-10 00:08:53 +00:00
|
|
|
if (!$DB->has_results()) {
|
2013-05-30 08:00:30 +00:00
|
|
|
$Error = 'No collage with the reported ID found';
|
2012-09-04 08:00:23 +00:00
|
|
|
} else {
|
|
|
|
list($Name) = $DB->next_record();
|
2013-11-19 08:00:48 +00:00
|
|
|
$TypeLink = 'the collage [url='.site_url()."collage.php?id=$ThingID]".display_str($Name).'[/url]';
|
2013-05-30 08:00:30 +00:00
|
|
|
$Subject = 'Collage Report: '.display_str($Name);
|
2012-09-04 08:00:23 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-05-30 08:00:30 +00:00
|
|
|
case 'thread':
|
|
|
|
$DB->query("
|
|
|
|
SELECT Title
|
|
|
|
FROM forums_topics
|
2013-11-19 08:00:48 +00:00
|
|
|
WHERE ID = $ThingID");
|
2013-07-10 00:08:53 +00:00
|
|
|
if (!$DB->has_results()) {
|
2013-05-30 08:00:30 +00:00
|
|
|
$Error = 'No forum thread with the reported ID found';
|
2012-09-04 08:00:23 +00:00
|
|
|
} else {
|
|
|
|
list($Title) = $DB->next_record();
|
2013-11-19 08:00:48 +00:00
|
|
|
$TypeLink = 'the forum thread [url='.site_url()."forums.php?action=viewthread&threadid=$ThingID]".display_str($Title).'[/url]';
|
2013-05-30 08:00:30 +00:00
|
|
|
$Subject = 'Forum Thread Report: '.display_str($Title);
|
2012-09-04 08:00:23 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-05-30 08:00:30 +00:00
|
|
|
case 'post':
|
2012-09-04 08:00:23 +00:00
|
|
|
if (isset($LoggedUser['PostsPerPage'])) {
|
|
|
|
$PerPage = $LoggedUser['PostsPerPage'];
|
|
|
|
} else {
|
|
|
|
$PerPage = POSTS_PER_PAGE;
|
|
|
|
}
|
2013-05-30 08:00:30 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT
|
|
|
|
p.ID,
|
|
|
|
p.Body,
|
|
|
|
p.TopicID,
|
2013-11-19 08:00:48 +00:00
|
|
|
(
|
|
|
|
SELECT COUNT(p2.ID)
|
2013-11-17 08:00:47 +00:00
|
|
|
FROM forums_posts AS p2
|
|
|
|
WHERE p2.TopicID = p.TopicID
|
|
|
|
AND p2.ID <= p.ID
|
2013-05-30 08:00:30 +00:00
|
|
|
) AS PostNum
|
|
|
|
FROM forums_posts AS p
|
2013-11-17 08:00:47 +00:00
|
|
|
WHERE p.ID = $ThingID");
|
2013-07-10 00:08:53 +00:00
|
|
|
if (!$DB->has_results()) {
|
2013-05-30 08:00:30 +00:00
|
|
|
$Error = 'No forum post with the reported ID found';
|
2012-09-04 08:00:23 +00:00
|
|
|
} else {
|
2013-05-30 08:00:30 +00:00
|
|
|
list($PostID, $Body, $TopicID, $PostNum) = $DB->next_record();
|
2013-11-19 08:00:48 +00:00
|
|
|
$TypeLink = 'this [url='.site_url()."forums.php?action=viewthread&threadid=$TopicID&post=$PostNum#post$PostID]forum post[/url]";
|
2013-05-30 08:00:30 +00:00
|
|
|
$Subject = 'Forum Post Report: Post ID #'.display_str($PostID);
|
2012-09-04 08:00:23 +00:00
|
|
|
}
|
|
|
|
break;
|
2013-08-28 23:08:41 +00:00
|
|
|
case 'comment':
|
2013-05-30 08:00:30 +00:00
|
|
|
$DB->query("
|
2013-08-28 23:08:41 +00:00
|
|
|
SELECT 1
|
2013-11-17 08:00:47 +00:00
|
|
|
FROM comments
|
2013-08-28 23:08:41 +00:00
|
|
|
WHERE ID = $ThingID");
|
2013-07-10 00:08:53 +00:00
|
|
|
if (!$DB->has_results()) {
|
2013-08-28 23:08:41 +00:00
|
|
|
$Error = 'No comment with the reported ID found';
|
2012-09-04 08:00:23 +00:00
|
|
|
} else {
|
2013-11-19 08:00:48 +00:00
|
|
|
$TypeLink = '[url='.site_url()."comments.php?action=jump&postid=$ThingID]this comment[/url]";
|
2013-08-28 23:08:41 +00:00
|
|
|
$Subject = 'Comment Report: ID #'.display_str($ThingID);
|
2012-09-04 08:00:23 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2013-05-30 08:00:30 +00:00
|
|
|
error('Incorrect type');
|
2012-09-04 08:00:23 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-05-01 08:00:16 +00:00
|
|
|
if (isset($Error)) {
|
2012-09-04 08:00:23 +00:00
|
|
|
error($Error);
|
|
|
|
}
|
|
|
|
|
2013-05-30 08:00:30 +00:00
|
|
|
$DB->query("
|
2013-11-17 08:00:47 +00:00
|
|
|
SELECT Reason
|
|
|
|
FROM reports
|
|
|
|
WHERE ID = $ReportID");
|
2012-09-04 08:00:23 +00:00
|
|
|
list($Reason) = $DB->next_record();
|
|
|
|
|
2013-05-30 08:00:30 +00:00
|
|
|
$Body = "You reported $TypeLink for the reason:\n[quote]{$Reason}[/quote]";
|
2012-09-04 08:00:23 +00:00
|
|
|
|
|
|
|
?>
|
|
|
|
<div class="thin">
|
|
|
|
<div class="header">
|
|
|
|
<h2>
|
2012-09-18 08:00:29 +00:00
|
|
|
Send a message to <a href="user.php?id=<?=$ToID?>"> <?=$ComposeToUsername?></a>
|
2012-09-04 08:00:23 +00:00
|
|
|
</h2>
|
|
|
|
</div>
|
2012-09-15 08:00:25 +00:00
|
|
|
<form class="send_form" name="message" action="reports.php" method="post" id="messageform">
|
2012-09-04 08:00:23 +00:00
|
|
|
<div class="box pad">
|
2013-01-16 08:00:31 +00:00
|
|
|
<input type="hidden" name="action" value="takecompose" />
|
|
|
|
<input type="hidden" name="toid" value="<?=$ToID?>" />
|
|
|
|
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
2012-09-04 08:00:23 +00:00
|
|
|
<div id="quickpost">
|
|
|
|
<h3>Subject</h3>
|
2013-01-16 08:00:31 +00:00
|
|
|
<input type="text" name="subject" size="95" value="<?=(!empty($Subject) ? $Subject : '')?>" />
|
|
|
|
<br />
|
2012-09-04 08:00:23 +00:00
|
|
|
<h3>Body</h3>
|
|
|
|
<textarea id="body" name="body" cols="95" rows="10"><?=(!empty($Body) ? $Body : '')?></textarea>
|
|
|
|
</div>
|
|
|
|
<div id="preview" class="hidden"></div>
|
|
|
|
<div id="buttons" class="center">
|
2013-01-16 08:00:31 +00:00
|
|
|
<input type="button" value="Preview" onclick="Quick_Preview();" />
|
|
|
|
<input type="submit" value="Send message" />
|
2012-09-04 08:00:23 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<?
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_footer();
|
2012-09-04 08:00:23 +00:00
|
|
|
?>
|