2005-10-01 11:11:53 +00:00
< ? php
2008-08-05 22:43:14 +00:00
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC 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.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
2007-11-12 20:57:15 +00:00
// Some posts may contain material that is not suited for public
// viewing. This file allows people to report such posts
// For this file to work the project must have defined who
// should receive such reports (in the configuration file)
2005-10-01 11:11:53 +00:00
require_once ( '../inc/forum.inc' );
2006-07-01 20:03:48 +00:00
require_once ( '../inc/forum_email.inc' );
2005-10-01 11:11:53 +00:00
2011-02-09 22:11:34 +00:00
check_get_args ( array ( " post " , " submit " , " reason " , " tnow " , " ttok " ));
2005-10-01 11:11:53 +00:00
2007-11-12 20:57:15 +00:00
$postId = get_int ( 'post' );
2005-10-01 11:11:53 +00:00
2007-11-12 20:57:15 +00:00
$post = BoincPost :: lookup_id ( $postId );
$thread = BoincThread :: lookup_id ( $post -> thread );
$forum = BoincForum :: lookup_id ( $thread -> forum );
2005-10-01 11:11:53 +00:00
2007-11-12 20:57:15 +00:00
$user = get_logged_in_user ();
BoincForumPrefs :: lookup ( $user );
check_banished ( $user );
// Make sure the user has the forum's minimum amount of RAC and total credit
// before allowing them to report a post.
// Using the same rules as for rating (at least for now)
//
if ( $user -> total_credit < $forum -> rate_min_total_credit || $user -> expavg_credit < $forum -> rate_min_expavg_credit ) {
2011-08-25 22:12:48 +00:00
error_page ( tra ( " You need more average or total credit to report a post. " ));
2007-11-12 20:57:15 +00:00
}
2005-10-01 11:11:53 +00:00
//__-------------- Action part
2007-11-12 20:57:15 +00:00
$success_page = 0 ;
if ( get_str ( " submit " , true )){
check_tokens ( $user -> authenticator );
$reason = get_str ( " reason " );
2007-11-18 04:10:37 +00:00
if ( send_report_post_email ( $user , $forum , $thread , $post , $reason )){
2007-11-12 20:57:15 +00:00
$success_page = 1 ;
} else {
$success_page =- 1 ;
2005-10-01 11:11:53 +00:00
}
2007-11-12 20:57:15 +00:00
}
2005-10-01 11:11:53 +00:00
2010-11-04 18:20:57 +00:00
$no_forum_rating = parse_bool ( $config , " no_forum_rating " );
2005-10-01 11:11:53 +00:00
2006-06-16 23:53:56 +00:00
//__--------------- Display part
2007-11-12 20:57:15 +00:00
if ( $success_page == 1 ) {
2011-08-25 22:12:48 +00:00
page_head ( tra ( " Report Registered " ));
2012-01-29 07:25:55 +00:00
echo tra ( " Your report has been recorded. Thanks for your input. " ) . " <p> "
2011-08-25 22:12:48 +00:00
. tra ( " A moderator will now look at your report and decide what will happen - this may take a little while, so please be patient " );
2012-01-29 07:25:55 +00:00
echo " <p><a href= \" forum_thread.php?id= " , $thread -> id , " # " , $post -> id , " \" > " . tra ( " Return to thread " ) . " </a> " ;
2007-11-12 20:57:15 +00:00
} elseif ( $success_page == 0 ){
2011-08-29 17:50:00 +00:00
page_head ( tra ( " Report a forum post " ));
2008-11-11 23:43:56 +00:00
if ( ! $no_forum_rating ) {
2011-08-25 22:12:48 +00:00
echo " <p> " . tra ( " Before reporting this post, consider using the +/- rating system instead. If enough users rate a post negatively it will eventually be hidden.<br />You can find the rating system at the bottom of the post. " ) . " </p>
2008-11-11 23:43:56 +00:00
" ;
}
2007-11-18 04:10:37 +00:00
start_forum_table ( array ( tra ( " Author " ), tra ( " Message " ), " " ));
2007-11-15 22:51:05 +00:00
show_post ( $post , $thread , $forum , $user , 0 , 0 );
2007-11-12 20:57:15 +00:00
echo " <form action= \" forum_report_post.php \" method= \" get \" > \n " ;
echo form_tokens ( $user -> authenticator );
2011-08-25 22:12:48 +00:00
row1 ( tra ( " Report post " ));
row2 ( tra ( " Why do you find the post offensive: %1Please include enough information so that a person that
has not yet read the thread will quickly be able to identify the issue .% 2 " , " < span class = \ " smalltext \" > " , " </span> " ),
2007-11-18 04:10:37 +00:00
" <textarea name= \" reason \" rows=12 cols=54></textarea> "
);
2011-08-25 22:12:48 +00:00
row2 ( " " , " <input type= \" submit \" name= \" submit \" value= \" " . tra ( " OK " ) . " \" > " );
2007-11-12 20:57:15 +00:00
echo " <input type= \" hidden \" name= \" post \" value= \" " . $post -> id . " \" > " ;
2010-11-04 18:20:57 +00:00
echo " </form> " ;
2007-11-18 04:10:37 +00:00
end_table ();
2007-11-12 20:57:15 +00:00
} elseif ( $success_page ==- 1 ) {
2011-08-25 22:12:48 +00:00
page_head ( tra ( " Report not registered " ));
echo " <p> " . tra ( " Your report could not be recorded. Please wait a while and try again. " ) . " </p>
< p > " .tra( " If this is not a temporary error , please report it to the project developers . " ). " </ p >
2007-11-18 04:10:37 +00:00
" ;
2011-08-25 22:12:48 +00:00
echo " <a href= \" forum_thread.php?id= " , $thread -> id , " # " , $post -> id , " \" > " . tra ( " Return to thread " ) . " </a> " ;
2007-11-12 20:57:15 +00:00
}
page_tail ();
2005-10-01 11:11:53 +00:00
?>