Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

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