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