X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Faxletter%2Faxletter.inc.php;h=53c7dd3039af3d2b0eeb146f8b3ee25311438374;hb=bdbda592dfa0fe34eb359adf1f90082ec313b8fb;hp=18818c7c4c452c9ac15a02f354dd6c882ea01f98;hpb=c0c4edb5cc8926253a5cc7dcc94ff754a9356cf6;p=platal.git diff --git a/modules/axletter/axletter.inc.php b/modules/axletter/axletter.inc.php index 18818c7..53c7dd3 100644 --- a/modules/axletter/axletter.inc.php +++ b/modules/axletter/axletter.inc.php @@ -117,10 +117,10 @@ class AXLetter extends MassMailer if (is_null($uid) && $hash) { return false; } - $res = XDB::query("SELECT * + $res = XDB::query("SELECT uid FROM axletter_ins WHERE $field={?}", $user); - if (!$res->numRows()) { + if ($res->numRows() != 1) { return false; } XDB::execute("DELETE FROM axletter_ins @@ -175,12 +175,13 @@ class AXLetter extends MassMailer if (!$this->_promo_min && !$this->_promo_max && !$this->_subset) { return '1'; } + /* TODO: refines this filter on promotions by using userfilter. */ $where = array(); if ($this->_promo_min) { - $where[] = "((ni.uid = 0 AND ni.promo >= {$this->_promo_min}) OR (ni.uid != 0 AND u.promo >= {$this->_promo_min}))"; + $where[] = "((ni.uid = 0 AND ni.promo >= {$this->_promo_min}) OR (ni.uid != 0 AND pd.promo >= 'X{$this->_promo_min}'))"; } if ($this->_promo_max) { - $where[] = "((ni.uid = 0 AND ni.promo <= {$this->_promo_max}) OR (ni.uid != 0 AND u.promo <= {$this->_promo_max}))"; + $where[] = "((ni.uid = 0 AND ni.promo <= {$this->_promo_max}) OR (ni.uid != 0 AND pd.promo <= 'X{$this->_promo_max}'))"; } if ($this->_subset) { require_once("emails.inc.php");