Beispiel #1
0
$app->get('/gestionAg/:mail', function ($mail) {
    global $db;
    $rows = $db->selectEquals("gestionnaire_agendas", "mail,idAgenda", array('mail' => $mail));
    echoResponse(200, $rows);
});
$app->get('/personnes/:mail', function ($mail) {
    global $db;
    $rows = $db->selectEquals("personne", "mail, nom, prenom, grade, createurAg, admin", array('mail' => $mail));
    echoResponse(200, $rows);
});
$app->get('/personneCle/:mail', function ($mail) {
    global $db;
    $rows = $db->selectEquals("personne", "cle", array('mail' => $mail));
    if ($rows["status"] == "success") {
        $rows["message"] = "Vous allez recevoir un mail";
        mail_type($mail, $rows["data"][0]["cle"]);
    } else {
        $rows["message"] = "Adresse mail inconnu.";
    }
    echoResponse(200, $rows);
});
$app->get('/personne/:cle', function ($cle) {
    global $db;
    $rows = $db->selectEquals("personne", "mail, nom, prenom, grade, createurAg, admin", array('cle' => $cle));
    echoResponse(200, $rows);
});
$app->get('/createurs', function () {
    global $db;
    $rows = $db->selectEquals("personne", "mail, nom, prenom, grade, createurAg, admin", array('createurAg' => 1));
    echoResponse(200, $rows);
});
Beispiel #2
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);
}
Beispiel #3
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";
                }
            }
        }
    }
}