| 1 | #!/usr/bin/php5 -q |
| 2 | <?php |
| 3 | require 'connect.db.inc.php'; |
| 4 | $message = ''; |
| 5 | |
| 6 | // --------------------------------------- |
| 7 | |
| 8 | $res = XDB::iterRow("SELECT al.alias, pd.promo, e.email //a.alias, u.promo, email |
| 9 | FROM accounts AS a |
| 10 | INNER JOIN account_profile AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms)) |
| 11 | INNER JOIN profile_display AS pd ON (ap.pid = pd.pid) |
| 12 | LEFT JOIN aliases AS al ON (a.uid =a.uid AND al.type = 'a_vie') |
| 13 | LEFT JOIN emails AS e ON (a.uid = e.uid AND NOT FIND_IN_SET('filter', e.flags)) |
| 14 | WHERE a.registration_date > {?} |
| 15 | GROUP BY al.alias |
| 16 | ORDER BY pd.promo", |
| 17 | date("Ymd000000", strtotime('last Monday'))); |
| 18 | if ($count = $res->total()) { |
| 19 | $message .= "$count INSCRIPTIONS CONFIRMÉES :\n"; |
| 20 | while (list($forlife, $promo, $email) = $res->next()) { |
| 21 | $message .= "$promo, $forlife, $email\n"; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | // --------------------------------------- |
| 26 | |
| 27 | $res = XDB::iterRow("SELECT a.hruid, r.email, r.date |
| 28 | FROM register_pending AS r |
| 29 | INNER JOIN accounts AS a ON (a.uid = r.uid) |
| 30 | WHERE r.hash != 'INSCRIT' |
| 31 | ORDER BY r.date"); |
| 32 | if ($count = $res->total()) { |
| 33 | $message .= "\n$count INSCRIPTIONS NON CONFIRMÉES :\n"; |
| 34 | while (list($forlife, $email, $date) = $res->next()) { |
| 35 | $message .= "$date, $forlife,\n $email\n"; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | // --------------------------------------- |
| 40 | |
| 41 | $res = XDB::query('SELECT COUNT(DISTINCT uid), COUNT(*) |
| 42 | FROM register_marketing'); |
| 43 | list($a, $b) = $res->fetchOneRow(); |
| 44 | $message .= "\nINSCRIPTIONS SOLICITÉES :\n"; |
| 45 | $message .= " $a utilisateurs\n $b adresses email\n"; |
| 46 | |
| 47 | // --------------------------------------- |
| 48 | |
| 49 | $message .= "\n\n"; |
| 50 | |
| 51 | $mailer = new PlMailer(); |
| 52 | $mailer->setSubject('Rapport des inscriptions de la semaine'); |
| 53 | $mailer->setFrom($globals->register->notif); |
| 54 | $mailer->addTo($globals->register->notif); |
| 55 | $mailer->setTxtBody($message); |
| 56 | $mailer->send(); |
| 57 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: |
| 58 | ?> |