示例#1
0
function handle_user($user, $do_type)
{
    global $globals;
    global $email_interval;
    if ($user->send_email == 0) {
        if ($globals->explain) {
            echo "user: {$user->id} send_email = 0\n";
        }
        return;
    }
    $max_email_time = time() - $globals->email_interval;
    if (last_reminder_time($user) > $max_email_time) {
        if ($globals->explain) {
            echo "user: {$user->id} sent too recently\n";
        }
        return;
    }
    if ($globals->explain) {
        $x = (time() - $user->create_time) / 86400;
        $t = last_rpc_time($user);
        $show_lapsed_interval = (time() - $t) / 86400;
        echo "user {$user->id} ({$user->email_addr}) was created {$x} days ago\n";
        echo "  total_credit: {$user->total_credit}; last RPC {$show_lapsed_interval} days ago\n";
        echo "  sending {$do_type} email\n";
    }
    mail_type($user, $do_type);
}
示例#2
0
function handle_user($user)
{
    global $email_files;
    global $globals;
    $user->last_rpc_time = last_rpc_time($user);
    $lapsed = time() - $user->last_rpc_time > $globals->lapsed_interval;
    if ($user->total_credit == 0) {
        mail_type($user, $email_files['failed']);
        if ($globals->explain) {
            echo "sending failed email to {$user->email_addr}\n";
        }
    } else {
        if ($lapsed) {
            mail_type($user, $email_files['lapsed']);
            if ($globals->explain) {
                echo "sending lapsed email to {$user->email_addr}\n";
            }
        } else {
            if (!$globals->nocurrent) {
                mail_type($user, $email_files['current']);
                if ($globals->explain) {
                    echo "sending current email to {$user->email_addr}\n";
                }
            }
        }
    }
}