$checkedoutby = mysql_result($result, $rownum, "checkedoutby");
    $modifieddate = mysql_result($result, $rownum, "modifieddate");
    $projectid = mysql_result($result, $rownum, "projectid");
    $nicedate = mysql_result($result, $rownum, "nicedate");
    if ($PPinQuestion != $checkedoutby) {
        // have finished the last PPer. Send email to them
        if ($rownum > 0) {
            $user = new User($PPinQuestion);
            $email = $user->email;
            echo $PPinQuestion . "\n" . $projectslist . "\n\n";
            if ($numprojs == 1) {
                $message = "Hello {$PPinQuestion},\n\nThis is an automated message.\n\n\nOur database indicates that you have had a PP project checked out for more than 90 days:\n\n\n{$projectslist}\n\n\nIf you haven't yet finished and wish to continue working on this book, please log in to {$site_url} and visit {$url} . This will update the status of the project. If you need help please forward a copy of this email (quoting the information on the book, above) with a brief description of the status to {$general_help_email_addr}.\n\n\nIf you have completed your work on the book, please log in to {$site_url} and visit {$url}. Select the 'Upload for verification' option and follow the prompts. You will be able to leave a message for the verifier during this process, if you have any special information or comments to pass on.\n\n\nIf you are waiting on missing images or page scans, please add the details to the Missing Page Wiki at: {$forums_url}/viewtopic.php?t=7584\n\n\nIf you no longer wish to have this text assigned to you please visit the {$site_name} website Post Processing section and select Return to Available for this book, or forward this email to {$general_help_email_addr} and state that you would no longer like to have the book in question assigned to you so that we may return it to the available pool for someone else to work on.\n\n\n{$site_signoff}";
            } else {
                $message = "Hello {$PPinQuestion},\n\nThis is an automated message.\n\n\nOur database indicates that you have had {$numprojs} PP projects checked out for more than 90 days:\n\n\n{$projectslist}\n\n\nIf you wish to continue working on some or all of these books, please log in to {$site_url} and visit each such project's home-page (copy the URL listed with the project above and paste it into your browser's address-field). Doing this will update the status of the project and let us know that you are still working on it. If you need help please forward this email, quoting the list of books, with a brief description of the status for each of the various books listed above that you need help with to {$general_help_email_addr}.\n\n\nIf you have completed your work on any of these books, please log in to {$site_url} and visit each such project's home-page (copy the URL listed with the project above and paste it into your browser's address-field). Select the 'Upload for verification' option and follow the prompts. You will be able to leave a message for the verifier during this process, if you have any special information or comments to pass on.\n\n\nIf you are waiting on missing images or page scans, please add the details to the Missing Page Wiki at: {$forums_url}/viewtopic.php?t=7584\n\n\nIf you no longer wish to have some or all of these books assigned to you please visit the {$site_name} website Post Processing section and select Return to Available for the books in question or forward this email to {$general_help_email_addr} and state that you would no longer like to have the books in question assigned to you so that we may return them to the available pool for someone else to work on.\n\n\n{$site_signoff}";
            }
            maybe_mail("{$email}", "{$subject}", "{$message}");
            $projectslist = "";
            $numprojs = 0;
        }
        $PPinQuestion = $checkedoutby;
    }
    $numprojs++;
    $url = $urlbase . $projectid;
    $projectslist .= "{$nameofwork} by {$authorsname} ({$projectid}), out since {$nicedate}\n{$url}\n\n";
    if ($numprojs == 1) {
        $subject = "{$site_abbreviation}: Status update needed for 1 project checked out for PPing over 90 days";
    } else {
        $subject = "{$site_abbreviation}: Status updates needed for {$numprojs} projects checked out for PPing over 90 days";
    }
    $rownum++;
}
            if (isset($_POST['cc_pp'])) {
                $to = $pper->email;
                $subject = "{$site_abbreviation} PP: {$nameofwork}";
                $message = $ppbit . $reportcard;
                maybe_mail($to, $subject, $message);
            }
            if (isset($_POST['cc_ppv'])) {
                $to = $ppver->email;
                $subject = "{$site_abbreviation} PPV: {$nameofwork}";
                $message = $ppvbit . $reportcard;
                maybe_mail($to, $subject, $message);
            }
            $to = $ppv_reporting_email_addr;
            $subject = "PPV Summary - {$project->postproofer} ({$_POST['pp_evaluation']})";
            $message = $reportcard;
            maybe_mail($to, $subject, $message, array("From: {$pguser} <{$ppver->email}>"));
            printf(_("Return to <a href='%s'>the Project Page</a>"), "../../project.php?id={$projectid}");
            exit;
        } else {
            assert(FALSE);
        }
    }
}
function report_error_counts($errors)
{
    $result = "";
    foreach ($errors as $id => $label) {
        if ($_POST[$id]) {
            $result .= "\n      {$_POST[$id]} {$label}";
        }
    }
        case 'unsat-ungranted':
            echo _('First you must satisfy the minimum requirements.');
            break;
        case 'sat-denied':
        case 'unsat-denied':
            echo _('You are not allowed to request access to this stage.');
            break;
        case 'sat-available':
            if ($stage->after_satisfying_minima == 'REQ-AUTO') {
                $userSettings =& Settings::get_Settings($pguser);
                $userSettings->set_true("{$stage_id}.access");
                log_access_change($pguser, 'AUTO-GRANTED', $stage_id, 'grant');
                echo _('Access has been granted!');
            } elseif ($stage->after_satisfying_minima == 'REQ-HUMAN') {
                $body = sprintf(_("User '%s' has requested access to stage '%s'"), $pguser, $stage_id);
                maybe_mail($email_addr, $title, $body);
                $userSettings =& Settings::get_Settings($pguser);
                $userSettings->set_value("{$stage_id}.access", "requested");
                log_access_change($pguser, 'n/a', $stage_id, 'request');
                echo _('Your request has been submitted and logged.');
            } else {
                die("unexpected value for after_satisfying_minima: '{$stage->after_satisfying_minima}'");
            }
            break;
        default:
            die("bad request_status value: '{$uao->request_status}'");
    }
}
echo "</p>\n";
echo "<p>";
printf(_("Back to <a href='%s'>Activity Hub</a>"), "{$code_url}/activity_hub.php");
Example #4
0
function NotificationMail($tid, $message)
{
    global $code_url, $tasks_url, $pguser;
    $notify_setting_all = Settings::get_users_with_setting('taskctr_notice', 'all');
    $notify_setting_this = Settings::get_users_with_setting('taskctr_notice', $tid);
    $users_to_notify = array_merge($notify_setting_all, $notify_setting_this);
    foreach ($users_to_notify as $username) {
        if ($username != $pguser) {
            $user = new User($username);
            maybe_mail($user->email, "DP Task Center: Task #{$tid} has been updated", "You have requested notification of updates to task #{$tid}. " . "{$message}" . "\n" . "You can see task #{$tid} by visiting {$tasks_url}?action=show&task_id={$tid}" . "\n\n" . "--" . "\n" . "Distributed Proofreaders" . "\n" . "{$code_url}" . "\n\n" . "This is an automated message that you had requested, please do not respond directly to this e-mail.");
        }
    }
}
 function log_request_for_approval($requestor_username)
 {
     global $general_help_email_addr, $image_sources_manager_addr, $code_url, $site_abbreviation, $site_name, $site_signoff;
     $userSettings =& Settings::get_Settings($requestor_username);
     $userSettings->add_value('is_approval_notify', $this->code_name);
     $subject = sprintf(_('%s: New Image Source proposed'), $site_abbreviation) . " : " . $this->display_name;
     $body = "Hello,\n\nYou are receiving this email because\n" . "you are listed as an Image Sources manager at the {$site_name}\n" . "site. If this is an error, please contact <{$general_help_email_addr}>.\n\n" . "{$requestor_username} has proposed that {$this->display_name} be added\n" . "to the list of Image Sources. To edit or approve this Image Source,\n" . "visit\n    {$code_url}/tools/project_manager/manage_image_sources.php?action=show_sources#{$this->code_name}" . "\n\n{$site_signoff}";
     maybe_mail($image_sources_manager_addr, $subject, $body);
 }
function notify_user($username, $actions)
{
    global $site_name, $site_signoff;
    $user = new User($username);
    if (count($actions) == 1 && array_search('grant', $actions) !== false) {
        // Special case: If the user has been granted access to
        // a single round, send a congratulations! email.
        list($activity_id) = array_keys($actions);
        $subject = "DP: You have been granted access to {$activity_id}!";
        $message = "Hello {$username},\n\nThis is a message from the {$site_name} website.\n\n" . "Congratulations, you have been granted access to {$activity_id} projects!\n" . "You can access this stage by following the link to it at the Activity Hub.\n\n" . "{$site_signoff}";
        // XXX: Note that this wording works when the activity is a stage (round or pool),
        // but not otherwise.
        maybe_mail($user->email, $subject, $message);
        return "congratulated user.";
    } else {
        $subject = "DP: Your access has been modified";
        $message = "Hello {$username},\n\nThis is a message from the {$site_name} website.\n\n" . "The following modifications have been made to the stages in which you can work:\n";
        foreach ($actions as $activity_id => $action_type) {
            $message .= "\n";
            $message .= "  {$activity_id}: ";
            $message .= $action_type == 'deny_request_for' ? 'Your request for access has not been approved. Please try again in a few weeks.' : ($action_type == 'grant' ? 'Access granted.' : 'Access revoked.');
        }
        $message .= "\n\n{$site_signoff}";
        maybe_mail($user->email, $subject, $message);
        return "notified user.";
    }
}
<?php

$relPath = "./../pinc/";
include_once $relPath . 'base.inc';
include_once $relPath . 'maybe_mail.inc';
include_once $relPath . 'misc.inc';
include_once $relPath . 'forum_interface.inc';
// check that caller is localhost or bail
if (!requester_is_localhost()) {
    die("You are not authorized to perform this request.");
}
$old_date = time() - 13176000;
// 30 days less than 1/2 a year.
$reset_password_url = get_reset_password_url();
$result = mysql_query("SELECT * FROM `users` WHERE t_last_activity < {$old_date} AND active ='yes'");
$numrows = mysql_num_rows($result);
$rownum = 0;
while ($rownum < $numrows) {
    $username = mysql_result($result, $rownum, "username");
    $real_name = mysql_result($result, $rownum, "real_name");
    $email = mysql_result($result, $rownum, "email");
    $email_updates = mysql_result($result, $rownum, "email_updates");
    if ($email_updates) {
        maybe_mail("{$email}", "{$site_name}: Inactive Account {$username}", "Hello {$real_name},\n\n" . "This is an automated message and your only e-mail reminder that your account on the\n {$site_name} site ({$code_url}/) has been inactive\nfor over 5 months now. In order to show a valid number of active members for our\nsite, we will be marking this account as inactive a month from today if you do not\nlog into the site.\n\n\nIf you wish to receive no more mailings from us, you need to do nothing else and\nthis account will be marked as inactive. If you have forgotten your password,\nvisit ({$reset_password_url}) to have\nit reset. We hope you care to join us, much has changed since you last saw us.\n\n\n{$site_signoff}");
    }
    $rownum++;
}
if ($numrows) {
    echo "notify_users.php attempted to email {$numrows} users with a 5 month inactivity warning";
}