diff --git a/checkin_notes b/checkin_notes index fa221db30f..180daa58cf 100755 --- a/checkin_notes +++ b/checkin_notes @@ -12510,3 +12510,20 @@ Rom 30 Sept 2005 clientgui/ BOINCGUIApp.cpp, .h MainFrame.cpp + +Janus 01 Oct 2005 + - Added "Report this post" option to the forum. It will send an email to + the user/mailinglist specified in project.inc. + All projects that want to make use of this feature should define an + email address there like this (in html/project/project.inc): + $forum_post_reporting_admin->email_addr="jbk@vgroup.dk"; + If not defined the users will get a warning when trying to use the + feature. + + html/ + inc/ + forum.inc + email.inc + user/ + forum_report_post.php + diff --git a/html/inc/email.inc b/html/inc/email.inc index e02f860833..ce41c43ae3 100644 --- a/html/inc/email.inc +++ b/html/inc/email.inc @@ -229,4 +229,30 @@ For further information and assistance with ".PROJECT." go to ".MASTER_URL; } +function send_report_post_email($user, $thread, $post, $message) { + global $forum_post_reporting_admin; + + $body = ""; + + $subject = PROJECT." post in '".$thread->title."' reported as offensive"; + $body = PROJECT." notification: + +This email is sent to inform you that one of the posts in the forum was reported as offensive in ".PROJECT.": + Thread: ".$thread->title." + Post: ".$post->id." + Link: ".MASTER_URL."/forum_thread.php?id=".$thread->id."#".$post->id." + +The reporting user gave this explanation to why the post was reported: +".$message." + +This was the contents of the post: +".$post->content." + +For further information and assistance with ".PROJECT." go to ".MASTER_URL; + //Security check, do we have an admin? + if (!$forum_post_reporting_admin) error_page("This project has not yet defined an administrator to handle this kind of forum reports. Please contact the project and tell them to add this information in their html/project/project.inc file"); + return send_email($forum_post_reporting_admin, $subject, $body); +} + + ?> diff --git a/html/inc/forum.inc b/html/inc/forum.inc index 1b262c10cb..da84a97b6c 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -42,6 +42,8 @@ define('RATE_POSITIVE_IMAGE', 'img/rate_positive.png'); define('RATE_POSITIVE_IMAGE_HEIGHT','9'); define('RATE_NEGATIVE_IMAGE', 'img/rate_negative.png'); define('RATE_NEGATIVE_IMAGE_HEIGHT','9'); +define('REPORT_POST_IMAGE', 'img/report_post.png'); +define('REPORT_POST_IMAGE_HEIGHT','9'); define ('SOLUTION', 'This answered my question'); define ('SUFFERER', 'I also have this question'); @@ -311,7 +313,7 @@ function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS echo " / Score: ", round(($post->score * $post->votes),0), ""; } else { $rating = floor($post->score*$post->votes + 0.01); - echo " | Rating: ", $rating, " | rate: id."&choice=p\">\"+\" / id."&choice=n\">\"-\""; + echo " | Rating: ", $rating, " | rate: id."&choice=p\">\"+\" / id."&choice=n\">\"-\" - id."\">\"Report"; } if ($controls == FORUM_CONTROLS) { diff --git a/html/project.sample/project.inc b/html/project.sample/project.inc index 4b6da08ed5..1957860e31 100644 --- a/html/project.sample/project.inc +++ b/html/project.sample/project.inc @@ -15,7 +15,7 @@ define("LANGUAGE_FILE", "languages.txt"); define("STYLESHEET", "white.css"); define("COPYRIGHT_HOLDER", "Test Group"); define("SYS_ADMIN_EMAIL", "foo@a.b.c"); - +$forum_post_reporting_admin->email_addr="bar@a.b.c"; //The email/mailinglist that will receive user reported forum posts (offensive etc.) function project_banner($title) { // Put your project title and logo here diff --git a/html/user/forum_report_post.php b/html/user/forum_report_post.php new file mode 100644 index 0000000000..c585299136 --- /dev/null +++ b/html/user/forum_report_post.php @@ -0,0 +1,79 @@ +thread); + $forum = getForum($thread->forum); + + $user = get_logged_in_user(true); + $user = getForumPreferences($user); + + if (!$post) error_page("There post you specified does not exist, or your rating was invalid"); + + /* 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) { + error_page("You need more average or total credit to report a post."); + } + + if (getHasReported($user,$postId)) { + error_page("You have already reported this post once."); + } + +//__-------------- Action part + $success_page=0; + if (get_str("submit",true)){ + $reason = get_str("reason"); + if (send_report_post_email($user, $thread,$post,$reason)){ + $success_page=1; + } else { + $success_page=-1; + } + } + + + +//__-------------- /Action part - start display part + if ($success_page==1) { + page_head('Report Registered'); + echo "

Your report has been successfully recorded. Thank you for your input.

+

A moderator will now look at your report and decide what will happen - this may take a little while, so please be patient

"; + echo "thread, "#", $post->id, "\">Return to thread"; + } elseif($success_page==0){ + page_head('Report a forum post'); + echo "

Before reporting this post please consider using the +/- rating system instead. If enough users agree on rating a post negatively it will + eventually be hidden.

"; + start_table(); + show_post($post,$thread, $user,0); + echo "
\n"; + row1("Report post"); + row2("Why do you find the post offensive:
Please include enough information so that a person that + has not yet read the thread will quickly be able to identify the issue.", + ""); + row2("", + ""); + echo "id."\">"; + echo "
"; + end_table(); + } elseif ($success_page==-1) { + page_head('Report NOT registered'); + echo "

Your report could not be recorded. Please wait a short while and try again.

+

If this is not a temporary error, please report it to the project developers.

"; + echo "thread, "#", $post->id, "\">Return to thread"; + } + page_tail(); +?>