diff --git a/checkin_notes b/checkin_notes index a0bb3c5b89..fa389e413a 100755 --- a/checkin_notes +++ b/checkin_notes @@ -2805,3 +2805,13 @@ David 23 Mar 2007 clientgui/ Makefile.am + +Rytis 24 Mar 2007 + - Forum: duration selection and optional message to the user. + + html/ + user/ + forum_moderate_post.php + forum_moderate_post_action.php + inc/ + forum_email.inc diff --git a/html/inc/forum_email.inc b/html/inc/forum_email.inc index 8808a66c3f..32c15d3f60 100644 --- a/html/inc/forum_email.inc +++ b/html/inc/forum_email.inc @@ -167,13 +167,17 @@ For further information and assistance with ".PROJECT." go to ".MASTER_URL; return success; } -function send_banish_email($user) { +function send_banish_email($user, $duration, $reason) { $subject = PROJECT." posting privileges suspended"; $body = " This email is to inform you that you will not be able to -post to the ".PROJECT." message boards for two weeks, +post to the ".PROJECT." message boards until ".date('M j, Y G:i', $duration).", because your postings have not followed our guidelines. "; + if ($reason) { + $body .= "\n\nThe moderator gave the following explanation about your suspension:\n"; + $body .= $reason; + } $emails = explode("|", POST_REPORT_EMAILS); $success = true; foreach ($emails as $email) { diff --git a/html/user/forum_moderate_post.php b/html/user/forum_moderate_post.php index a84411d4a2..b0b520abc6 100644 --- a/html/user/forum_moderate_post.php +++ b/html/user/forum_moderate_post.php @@ -58,28 +58,34 @@ if (get_str('action')=="hide") { } $x = $user->getBanishedUntil(); if ($x>time()) { - echo "User is already banished"; - exit(); + error_page("User is already banished"); } - echo "Are you sure you want to banish $user->name? - This will prevent $user->name from posting for 2 weeks. - It should be done only if $user->name - has consistently exhibited trollish behavior. -
- Yes, banish $user->name
- ";
- page_tail();
- exit();
+ row1("Are you sure you want to banish ".$user->getName()."?
+ This will prevent ".$user->getName()." from posting for chosen time period.
+ It should be done only if ".$user->getName()."
+ has consistently exhibited trollish behavior.");
+ row2("Ban duration", "");
+ echo "\n";
+ echo "\n";
+ echo "\n";
+ echo "\n";
} else {
error_page( "Unknown action");
}
row2("Reason
Mailed if nonempty",
- "");
+ "");
row2(
"",
- ""
+ ""
);
end_table();
diff --git a/html/user/forum_moderate_post_action.php b/html/user/forum_moderate_post_action.php
index 863b11344b..4982d52579 100644
--- a/html/user/forum_moderate_post_action.php
+++ b/html/user/forum_moderate_post_action.php
@@ -50,17 +50,23 @@ if ($action=="hide"){
// Can't banish without being administrator
error_page("You are not authorized to banish this user.");
}
- $userid = get_int('userid');
+ $userid = post_int('userid');
$user = newUser($userid);
if (!$user) {
error_page("no user");
}
- $t = time() + 14*86400; // two weeks
+ $duration = post_int('duration');
+ if ($duration == -1) {
+ $t = 2147483647; // Maximum integer value
+ } else {
+ $t = time() + $duration;
+ }
+ $reason = post_str("reason", true);
$query = "update forum_preferences set banished_until=$t where userid=$userid";
$result = mysql_query($query);
if ($result) {
- echo "User $user->name has been banished for 2 weeks.";
- send_banish_email($user);
+ echo "User $user->name has been banished.";
+ send_banish_email($user, $t, $reason);
} else {
echo "DB failure for $query";
echo mysql_error();