2005-10-01 11:11:53 +00:00
< ? php
2006-06-16 23:53:56 +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' );
2006-06-16 23:53:56 +00:00
require_once ( '../inc/forum_std.inc' );
2005-10-01 11:11:53 +00:00
2006-06-16 23:53:56 +00:00
db_init ();
2005-10-01 11:11:53 +00:00
$postId = get_int ( 'post' );
2006-06-16 23:53:56 +00:00
$post = new Post ( $postId );
$thread = $post -> getThread ();
$forum = $thread -> getForum ();
2005-10-01 11:11:53 +00:00
2006-06-16 23:53:56 +00:00
$user = re_get_logged_in_user ( true );
2006-08-08 20:32:37 +00:00
check_banished ( $user );
2005-10-01 11:11:53 +00:00
/* 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 )
*/
2006-06-16 23:53:56 +00:00
if ( $user -> getTotalCredit () < $forum -> getRateMinTotalCredit () || $user -> getExpavgCredit () < $forum -> getRateMinExpavgCredit ()) {
2005-10-01 11:11:53 +00:00
error_page ( " You need more average or total credit to report a post. " );
}
2006-06-16 23:53:56 +00:00
if ( $post -> hasReported ( $user )) {
2005-10-01 11:11:53 +00:00
error_page ( " You have already reported this post once. " );
}
//__-------------- Action part
$success_page = 0 ;
if ( get_str ( " submit " , true )){
2007-02-08 19:54:05 +00:00
check_tokens ( $user -> getAuthenticator ());
$reason = get_str ( " reason " );
if ( send_report_post_email ( $user , $thread , $post , $reason )){
$success_page = 1 ;
} else {
$success_page =- 1 ;
}
2005-10-01 11:11:53 +00:00
}
2006-06-16 23:53:56 +00:00
//__--------------- Display part
2005-10-01 11:11:53 +00:00
if ( $success_page == 1 ) {
2006-06-16 23:53:56 +00:00
$post_thread = $post -> getThread ();
2005-10-01 11:11:53 +00:00
page_head ( 'Report Registered' );
echo " <p>Your report has been successfully recorded. Thank you for your input.</p>
< p > A moderator will now look at your report and decide what will happen - this may take a little while , so please be patient </ p > " ;
2006-06-16 23:53:56 +00:00
echo " <a href= \" forum_thread.php?id= " , $post_thread -> getID (), " # " , $post -> getID (), " \" >Return to thread</a> " ;
2005-10-01 11:11:53 +00:00
} elseif ( $success_page == 0 ){
page_head ( 'Report a forum post' );
2006-06-16 23:53:56 +00:00
echo " <p>Before reporting this post <em>please</em> consider using the +/- rating system instead. If enough users agree on rating a post negatively it will
eventually be hidden . < br /> You can find the rating system at the bottom of the post .</ p > " ;
start_forum_table ( array ( tr ( FORUM_AUTHOR ), tr ( FORUM_MESSAGE ), " " ));
2005-10-01 11:11:53 +00:00
show_post ( $post , $thread , $user , 0 );
echo " <form action= \" forum_report_post.php \" method= \" get \" > \n " ;
2007-02-08 19:54:05 +00:00
echo form_tokens ( $user -> getAuthenticator ());
2005-10-01 11:11:53 +00:00
row1 ( " Report post " );
row2 ( " Why do you find the post offensive:<br><font size=-1>Please include enough information so that a person that
has not yet read the thread will quickly be able to identify the issue .</ font > " ,
2006-06-16 23:53:56 +00:00
" <textarea name= \" reason \" rows=12 cols=54></textarea> " );
2005-10-01 11:11:53 +00:00
row2 ( " " ,
" <input type= \" submit \" name= \" submit \" value= \" OK \" > " );
2006-06-16 23:53:56 +00:00
echo " <input type= \" hidden \" name= \" post \" value= \" " . $post -> getID () . " \" > " ;
2005-10-01 11:11:53 +00:00
echo " </form> " ;
2006-06-16 23:53:56 +00:00
end_table ();
2005-10-01 11:11:53 +00:00
} elseif ( $success_page ==- 1 ) {
page_head ( 'Report NOT registered' );
echo " <p>Your report could not be recorded. Please wait a short while and try again.</p>
< p > If this is not a temporary error , please report it to the project developers .</ p > " ;
2006-06-16 23:53:56 +00:00
echo " <a href= \" forum_thread.php?id= " , $post -> getThread (), " # " , $post -> getID (), " \" >Return to thread</a> " ;
2005-10-01 11:11:53 +00:00
}
page_tail ();
?>