while (true) {
$res = XDB::iterRow($query, $this->_id, 60);
if (!$res->total()) {
- exit;
+ return;
}
$sent = array();
while (list($uid, $bestalias, $prenom, $nom, $sexe, $fmt, $hash) = $res->next()) {
LEFT JOIN auth_user_quick AS q ON(q.user_id = u.user_id)
LEFT JOIN aliases AS a ON(u.user_id=a.id AND FIND_IN_SET('bestalias',a.flags))
LEFT JOIN emails AS e ON(e.uid=u.user_id AND e.flags='active')
- WHERE ni.last < {?} AND (e.email IS NOT NULL OR ni.user_id = 0)
+ WHERE ni.last < {?} AND {$this->subscriptionWhere()}
+ AND (e.email IS NOT NULL OR ni.user_id = 0)
GROUP BY u.user_id";
}
protected function subscriptionWhere()
{
- return 'ni.last';
+ if (!$this->_promo_min && !$this->_promo_max) {
+ return '1';
+ }
+ $where = array();
+ if ($this->_promo_min) {
+ $where[] = "((ni.user_id = 0 AND ni.promo >= {$this->_promo_min}) OR (ni.user_id != 0 AND u.promo >= {$this->_promo_min}))";
+ }
+ if ($this->_promo_max) {
+ $where[] = "((ni.user_id = 0 AND ni.promo <= {$this->_promo_max}) OR (ni.user_id != 0 AND u.promo <= {$this->_promo_max}))";
+ }
+ return implode(' AND ', $where);
}
static public function awaiting()
Cette lettre est envoyée par l'AX grâce aux outils de Polytechnique.org.
archives : [https://www.polytechnique.org/ax]
-ne plus recevoir : [https://www.polytechnique.org/ax/out]
+ne plus recevoir : [https://www.polytechnique.org/ax/out{if $hash}/{$hash}{/if}]
{if !$is_mail}
</pre>
</div>
<div class="foot2">
[<a href="https://www.polytechnique.org/ax">archives</a> |
- <a href="https://www.polytechnique.org/ax/out">ne plus recevoir</a>]
+ <a href="https://www.polytechnique.org/ax/out{if $hash}/{$hash}{/if}">ne plus recevoir</a>]
</div>
</div>
{if $is_mail}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2006 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<h1>Désinscription des envois de l'AX</h1>
+
+{if $success}
+<p>
+ Votre inscription aux envois exceptionnels de l'AX a été réalisée avec
+ succès. Si vous désirez vous réinscrire, merci de contacter
+ <a href="mailto:info@amicale.polytechnique.org">l'AX</a>. Vous pouvez également
+ le faire en vous <a href="register">inscrivant à Polytechnique.org</a> (pour
+ les X uniquement).
+</p>
+{else}
+<p>
+ Votre inscription aux envois de l'AX n'a pu être résiliée. Merci de contacter
+ au plus vite <a href="mailto:info@amicale.polytechnique.org">l'AX</a> pour faire
+ part de ce problème.
+</p>
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
flag set('femme') default '',
prenom varchar(32) default NULL,
nom varchar(255) default NULL,
+ promo smallint(4) default 0,
last int(11) NOT NULL default 0,
hash varchar(32) default NULL,