forked from Phorum/Core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreport.php
More file actions
120 lines (100 loc) · 5.29 KB
/
report.php
File metadata and controls
120 lines (100 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2017 Phorum Development Team //
// http://www.phorum.org //
// //
// This program is free software. You can redistribute it and/or modify //
// it under the terms of either the current Phorum License (viewable at //
// phorum.org) or the Phorum License that was distributed with this file //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY, without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
// //
// You should have received a copy of the Phorum License //
// along with this program. //
////////////////////////////////////////////////////////////////////////////////
define('phorum_page','report');
include_once("./common.php");
include_once("./include/email_functions.php");
include_once("./include/format_functions.php");
include_once("./include/api/base.php");
include_once("./include/api/user.php");
// set all our URL's ... we need these earlier
phorum_build_common_urls();
// checking read-permissions
if(!phorum_check_read_common()) {
return;
}
$report = false;
$template = "report";
$message=array();
// get the message
if (isset($PHORUM["args"][1]) && is_numeric($PHORUM["args"][1])) {
$message_id = $PHORUM["args"][1];
$message = phorum_db_get_message($message_id);
}
if(is_array($message) && count($message)) {
// check for report requests
if(!empty($_POST["report"])) {
if ($PHORUM["DATA"]["LOGGEDIN"]){
if (empty($_POST["explanation"])){
$_POST["explanation"] = "<" . $PHORUM["DATA"]["LANG"]["None"] . ">";
}
$mail_users = phorum_api_user_list_moderators($PHORUM['forum_id'], $PHORUM['email_ignore_admin'], TRUE);
if(count($mail_users)){
$mail_data = array(
"mailmessage" => $PHORUM["DATA"]["LANG"]['ReportPostEmailBody'],
"mailsubject" => $PHORUM["DATA"]["LANG"]['ReportPostEmailSubject'],
"forumname" => $PHORUM["DATA"]["NAME"],
"reportedby" => $PHORUM["user"]["display_name"],
"author" => $message["author"],
"subject" => $message["subject"],
"body" => phorum_wordwrap($message["body"], 72),
"ip" => $message["ip"],
"raw_date" => $message["datestamp"],
"date" => phorum_date($PHORUM["short_date_time"], $message["datestamp"]),
"explanation" => phorum_wordwrap($_POST["explanation"], 72),
"url" => phorum_get_url_no_uri_auth(PHORUM_READ_URL, $message["thread"], $message_id),
"delete_url" => phorum_get_url_no_uri_auth(PHORUM_MODERATION_URL, PHORUM_DELETE_MESSAGE, $message_id),
"hide_url" => phorum_get_url_no_uri_auth(PHORUM_MODERATION_URL, PHORUM_HIDE_POST, $message_id),
"edit_url" => phorum_get_url_no_uri_auth(PHORUM_POSTING_URL, 'moderation', $message_id),
"reporter_url"=> phorum_get_url_no_uri_auth(PHORUM_PROFILE_URL, $PHORUM["user"]["user_id"]),
"message" => $message
);
if (isset($PHORUM["hooks"]["report"]))
$mail_data = phorum_hook("report", $mail_data);
phorum_email_user($mail_users, $mail_data);
$PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $message["thread"]);
$PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
$PHORUM["DATA"]["OKMSG"]=$PHORUM["DATA"]["LANG"]["ReportPostSuccess"];
$template="message";
$report = true;
}
}
else{
$PHORUM["DATA"]["ReportPostMessage"] = $PHORUM["DATA"]["LANG"]['ReportPostNotAllowed'];
}
}
// format message
list($message) = phorum_format_messages(array($message));
$PHORUM["DATA"]["PostSubject"] = $message["subject"];
$PHORUM["DATA"]["PostAuthor"] = $message["author"];
$PHORUM["DATA"]["PostBody"] = $message["body"];
$PHORUM["DATA"]["raw_PostDate"] = $message["datestamp"];
$PHORUM["DATA"]["PostDate"] = phorum_date($PHORUM["short_date_time"], $message["datestamp"]);
$PHORUM["DATA"]["ReportURL"] = phorum_get_url(PHORUM_REPORT_URL, $message_id);
// if the report was not successfully sent, keep whatever explanation they gave already
if (isset($_POST["explanation"]) && !$report) {
$PHORUM["DATA"]["explanation"] = $_POST["explanation"];
}
else {
$PHORUM["DATA"]["explanation"] = "";
}
} else {
$PHORUM["DATA"]["ERROR"] = $PHORUM['DATA']['LANG']['MessageNotFound'];
$template='message';
}
phorum_output($template);
?>