Example #1
0
}
// Process a suspension:
if (isset($_POST['suspend_submit']) && !empty($user) && $is_admin) {
    $dt = post_int('suspend_for', true);
    if ($is_admin || $is_mod && $dt < 86400) {
        $reason = $_POST['suspend_reason'];
        if ($dt > 0 && empty($reason)) {
            error_page("You must supply a reason for a suspension.\n                <p><a href=manage_user.php?userid={$user->id}>Try again</a>");
        } else {
            if (is_numeric($dt)) {
                $t = time() + $dt;
                $q = "UPDATE forum_preferences SET banished_until={$t} WHERE userid={$id}";
                mysql_query($q);
                // put a timestamp in wiki to trigger re-validation of credentials
                if (function_exists('touch_wiki_user')) {
                    touch_wiki_user($user);
                }
                // Send suspension e-mail to user and administrators
                if ($dt > 0) {
                    $subject = PROJECT . " posting privileges suspended for " . $user->name;
                    $body = "\nForum posting privileges for the " . PROJECT . " user \"" . $user->name . "\"\nhave been suspended for " . time_diff($dt) . " by " . $g_logged_in_user->name . ". \nThe reason given was:\n  \n   {$reason}\n   \nThe suspension will end at " . time_str($t) . "\n";
                } else {
                    $subject = PROJECT . " user " . $user->name . " unsuspended";
                    $body = "\nForum posting privileges for the " . PROJECT . " user \"" . $user->name . "\"\nhave been restored by " . $g_logged_in_user->name . "\n";
                    if ($reason) {
                        $body .= "The reason given was:\n\n   {$reason}\n";
                    }
                }
                send_email($user, $subject, $body);
                $emails = explode(",", POST_REPORT_EMAILS);
                foreach ($emails as $email) {
Example #2
0
function handle_suspend($user)
{
    global $g_logged_in_user;
    $dt = post_int('suspend_for', true);
    $reason = $_POST['suspend_reason'];
    if ($dt > 0 && empty($reason)) {
        error_page("You must supply a reason for a suspension.\n            <p><a href=manage_user.php?userid={$user->id}>Try again</a>");
    } else {
        if (is_numeric($dt)) {
            $t = $dt > 0 ? time() + $dt : 0;
            $q = "UPDATE forum_preferences SET banished_until={$t} WHERE userid={$user->id}";
            mysql_query($q);
            // put a timestamp in wiki to trigger re-validation of credentials
            if (function_exists('touch_wiki_user')) {
                touch_wiki_user($user);
            }
            // Send suspension e-mail to user and administrators
            if ($dt > 0) {
                $subject = PROJECT . " posting privileges suspended for " . $user->name;
                $body = "\nForum posting privileges for the " . PROJECT . " user \"" . $user->name . "\"\nhave been suspended for " . time_diff($dt) . " by " . $g_logged_in_user->name . ". \nThe reason given was:\n\n{$reason}\n\nThe suspension will end at " . time_str($t) . "\n";
            } else {
                $subject = PROJECT . " user " . $user->name . " unsuspended";
                $body = "\nForum posting privileges for the " . PROJECT . " user \"" . $user->name . "\"\nhave been restored by " . $g_logged_in_user->name . "\n";
                if ($reason) {
                    $body .= "The reason given was:\n\n   {$reason}\n";
                }
            }
            send_email($user, $subject, $body);
            $emails = explode(",", POST_REPORT_EMAILS);
            foreach ($emails as $email) {
                $admin->email_addr = $email;
                send_email($admin, $subject, $body);
            }
        }
    }
}