[ Index ]
 

Code source de Phorum 5.1.25

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> report.php (source)

   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  $message=array();
  38  // get the message
  39  if (isset($PHORUM["args"][1]) && is_numeric($PHORUM["args"][1])) {
  40      $message_id = $PHORUM["args"][1];
  41      $message = phorum_db_get_message($message_id);
  42  }
  43  
  44  if(is_array($message) && count($message)) {
  45  
  46      // check for report requests
  47      if(!empty($_POST["report"])) {
  48          if ($PHORUM["DATA"]["LOGGEDIN"]){
  49              if (empty($_POST["explanation"])){
  50                  $_POST["explanation"] = "<" . $PHORUM["DATA"]["LANG"]["None"] . ">";
  51              }
  52  
  53              $mail_users = phorum_user_get_moderators($PHORUM['forum_id'],false,true);
  54  
  55              if(count($mail_users)){
  56                  $mail_data = array(
  57                  "mailmessage" => $PHORUM["DATA"]["LANG"]['ReportPostEmailBody'],
  58                  "mailsubject" => $PHORUM["DATA"]["LANG"]['ReportPostEmailSubject'],
  59                  "forumname"   => $PHORUM["DATA"]["NAME"],
  60                  "reportedby"  => $PHORUM["user"]["username"],
  61                  "author"      => $message["author"],
  62                  "subject"     => $message["subject"],
  63                  "body"        => wordwrap($message["body"], 72),
  64                  "ip"          => $message["ip"],
  65                  "date"        => phorum_date($PHORUM["short_date"], $message["datestamp"]),
  66                  "explanation" => wordwrap($_POST["explanation"], 72),
  67                  "url"         => phorum_get_url(PHORUM_READ_URL, $message["thread"], $message_id),
  68                  "delete_url"  => phorum_get_url(PHORUM_MODERATION_URL, PHORUM_DELETE_MESSAGE, $message_id),
  69                  "hide_url"    => phorum_get_url(PHORUM_MODERATION_URL, PHORUM_HIDE_POST, $message_id),
  70                  "edit_url"    => phorum_get_url(PHORUM_POSTING_URL, 'moderation', $message_id),
  71                  "reporter_url"=> phorum_get_url(PHORUM_PROFILE_URL, $PHORUM["user"]["user_id"]),
  72                  "message"     => $message
  73                  );
  74  
  75                  if (isset($_POST[PHORUM_SESSION_LONG_TERM])) {
  76                      // strip any auth info from the created urls
  77                      $mail_data["url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["url"]);
  78                      $mail_data["delete_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["delete_url"]);
  79                      $mail_data["hide_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["hide_url"]);
  80                      $mail_data["edit_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["edit_url"]);
  81                      $mail_data["reporter_url"] = preg_replace("!,{0,1}" . PHORUM_SESSION_LONG_TERM . "=" . urlencode($_POST[PHORUM_SESSION_LONG_TERM]) . "!", "", $mail_data["reporter_url"]);
  82                  }
  83  
  84                  $mail_data = phorum_hook("report", $mail_data);
  85  
  86                  phorum_email_user($mail_users, $mail_data);
  87  
  88                  $PHORUM["DATA"]["URL"]["REDIRECT"]=phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $message["thread"]);
  89                  $PHORUM["DATA"]["BACKMSG"]=$PHORUM["DATA"]["LANG"]["BackToThread"];
  90                  $PHORUM["DATA"]["MESSAGE"]=$PHORUM["DATA"]["LANG"]["ReportPostSuccess"];
  91                  $template="message";
  92                  $report = true;
  93              }
  94          }
  95          else{
  96              $PHORUM["DATA"]["ReportPostMessage"] = $PHORUM["DATA"]["LANG"]['ReportPostNotAllowed'];
  97          }
  98      }
  99  
 100      // format message
 101      list($message) = phorum_format_messages(array($message));
 102  
 103      $PHORUM["DATA"]["PostSubject"] = $message["subject"];
 104      $PHORUM["DATA"]["PostAuthor"] = $message["author"];
 105      $PHORUM["DATA"]["PostBody"] = $message["body"];
 106      $PHORUM["DATA"]["PostDate"] = phorum_date($PHORUM["short_date"], $message["datestamp"]);
 107      $PHORUM["DATA"]["ReportURL"] = phorum_get_url(PHORUM_REPORT_URL, $message_id);
 108  
 109      // if the report was not successfully sent, keep whatever explanation they gave already
 110      if (isset($_POST["explanation"]) && !$report) {
 111          $PHORUM["DATA"]["explanation"] = $_POST["explanation"];
 112      }
 113      else {
 114          $PHORUM["DATA"]["explanation"] = "";
 115      }
 116  } else {
 117  
 118      $PHORUM["DATA"]["ERROR"] = $PHORUM['DATA']['LANG']['MessageNotFound'];
 119      $template = 'message';
 120  }
 121  include phorum_get_template("header");
 122  phorum_hook("after_header");
 123  include phorum_get_template($template);
 124  phorum_hook("before_footer");
 125  include phorum_get_template("footer");
 126  
 127  ?>


Généré le : Thu Nov 29 12:22:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics