mirror of https://github.com/BOINC/boinc.git
Updated banishing feature
svn path=/trunk/boinc/; revision=12268
This commit is contained in:
parent
d183ca2a7f
commit
a3e53a0004
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
<p>
|
||||
<a href=forum_moderate_post_action.php?action=banish_user&id=$postid&userid=$userid&confirmed=yes>Yes, banish $user->name</a>
|
||||
";
|
||||
page_tail();
|
||||
exit();
|
||||
row1("Are you sure you want to banish ".$user->getName()."?
|
||||
This will prevent ".$user->getName()." from posting for chosen time period.<br />
|
||||
It should be done only if ".$user->getName()."
|
||||
has consistently exhibited trollish behavior.");
|
||||
row2("Ban duration", "<select name=\"duration\">
|
||||
<option value=\"14400\">4 hours</option>
|
||||
<option value=\"86400\">1 day</option>
|
||||
<option value=\"604800\">1 week</option>
|
||||
<option value=\"1209600\" selected=\"selected\">2 weeks</option>
|
||||
<option value=\"2592000\">1 month</option>
|
||||
<option value=\"-1\">Forever</option>
|
||||
</select>");
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"banish_user\">\n";
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"".$postid."\">\n";
|
||||
echo "<input type=\"hidden\" name=\"userid\" value=\"".$userid."\">\n";
|
||||
echo "<input type=\"hidden\" name=\"confirmed\" value=\"yes\">\n";
|
||||
} else {
|
||||
error_page( "Unknown action");
|
||||
}
|
||||
|
||||
row2("Reason<br>Mailed if nonempty",
|
||||
"<textarea name=\"reason\"></textarea>");
|
||||
"<textarea name=\"reason\" rows=\"10\" cols=\"80\"></textarea>");
|
||||
|
||||
row2(
|
||||
"",
|
||||
"<input type=\"submit\" name=\"submit\" value=\"OK\">"
|
||||
"<input type=\"submit\" name=\"submit\" value=\"Proceed with moderation\">"
|
||||
);
|
||||
|
||||
end_table();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue