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/
|
clientgui/
|
||||||
Makefile.am
|
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;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_banish_email($user) {
|
function send_banish_email($user, $duration, $reason) {
|
||||||
$subject = PROJECT." posting privileges suspended";
|
$subject = PROJECT." posting privileges suspended";
|
||||||
$body = "
|
$body = "
|
||||||
This email is to inform you that you will not be able to
|
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.
|
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);
|
$emails = explode("|", POST_REPORT_EMAILS);
|
||||||
$success = true;
|
$success = true;
|
||||||
foreach ($emails as $email) {
|
foreach ($emails as $email) {
|
||||||
|
|
|
@ -58,28 +58,34 @@ if (get_str('action')=="hide") {
|
||||||
}
|
}
|
||||||
$x = $user->getBanishedUntil();
|
$x = $user->getBanishedUntil();
|
||||||
if ($x>time()) {
|
if ($x>time()) {
|
||||||
echo "User is already banished";
|
error_page("User is already banished");
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
echo "Are you sure you want to banish $user->name?
|
row1("Are you sure you want to banish ".$user->getName()."?
|
||||||
This will prevent $user->name from posting for 2 weeks.
|
This will prevent ".$user->getName()." from posting for chosen time period.<br />
|
||||||
It should be done only if $user->name
|
It should be done only if ".$user->getName()."
|
||||||
has consistently exhibited trollish behavior.
|
has consistently exhibited trollish behavior.");
|
||||||
<p>
|
row2("Ban duration", "<select name=\"duration\">
|
||||||
<a href=forum_moderate_post_action.php?action=banish_user&id=$postid&userid=$userid&confirmed=yes>Yes, banish $user->name</a>
|
<option value=\"14400\">4 hours</option>
|
||||||
";
|
<option value=\"86400\">1 day</option>
|
||||||
page_tail();
|
<option value=\"604800\">1 week</option>
|
||||||
exit();
|
<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 {
|
} else {
|
||||||
error_page( "Unknown action");
|
error_page( "Unknown action");
|
||||||
}
|
}
|
||||||
|
|
||||||
row2("Reason<br>Mailed if nonempty",
|
row2("Reason<br>Mailed if nonempty",
|
||||||
"<textarea name=\"reason\"></textarea>");
|
"<textarea name=\"reason\" rows=\"10\" cols=\"80\"></textarea>");
|
||||||
|
|
||||||
row2(
|
row2(
|
||||||
"",
|
"",
|
||||||
"<input type=\"submit\" name=\"submit\" value=\"OK\">"
|
"<input type=\"submit\" name=\"submit\" value=\"Proceed with moderation\">"
|
||||||
);
|
);
|
||||||
|
|
||||||
end_table();
|
end_table();
|
||||||
|
|
|
@ -50,17 +50,23 @@ if ($action=="hide"){
|
||||||
// Can't banish without being administrator
|
// Can't banish without being administrator
|
||||||
error_page("You are not authorized to banish this user.");
|
error_page("You are not authorized to banish this user.");
|
||||||
}
|
}
|
||||||
$userid = get_int('userid');
|
$userid = post_int('userid');
|
||||||
$user = newUser($userid);
|
$user = newUser($userid);
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
error_page("no 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";
|
$query = "update forum_preferences set banished_until=$t where userid=$userid";
|
||||||
$result = mysql_query($query);
|
$result = mysql_query($query);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
echo "User $user->name has been banished for 2 weeks.";
|
echo "User $user->name has been banished.";
|
||||||
send_banish_email($user);
|
send_banish_email($user, $t, $reason);
|
||||||
} else {
|
} else {
|
||||||
echo "DB failure for $query";
|
echo "DB failure for $query";
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
|
|
Loading…
Reference in New Issue