X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fuserfilter%2Fconditions.inc.php;h=2ad8d1dd7ceed6587220a2439d73d09df5c4912e;hb=73317355964c4cd538157f8b281a1384b7e38e4d;hp=2604a37eb24351ee561bbe53c67b97d47ad62262;hpb=ba1cbd51cd218c3a8caf6d9518df9d2367a9ae54;p=platal.git diff --git a/classes/userfilter/conditions.inc.php b/classes/userfilter/conditions.inc.php index 2604a37..2ad8d1d 100644 --- a/classes/userfilter/conditions.inc.php +++ b/classes/userfilter/conditions.inc.php @@ -1,6 +1,6 @@ nlid = $nlid; $this->issue_id = $issue_id; @@ -847,7 +847,11 @@ class UFC_NLSubscribed extends UserFilterCondition public function buildCondition(PlFilter $uf) { $sub = $uf->addNewsLetterFilter($this->nlid); - return XDB::format($sub . '.nlid IS NOT NULL AND ( ' . $sub . '.last IS NULL OR ' . $sub . '.last < {?})', $this->issue_id); + $cond = $sub . '.nlid IS NOT NULL'; + if (!is_null($this->issue_id)) { + $cond = XDB::format($cond . ' AND ( ' . $sub . '.last IS NULL OR ' . $sub . '.last < {?})', $this->issue_id); + } + return $cond; } } // }}} @@ -858,12 +862,19 @@ class UFC_NLSubscribed extends UserFilterCondition */ class UFC_Group extends UserFilterCondition { + const BOTH = 0; + const NOTIFIED = 1; + const UNNOTIFIED = 2; + private $group; private $anim; - public function __construct($group, $anim = false) + private $notified; + + public function __construct($group, $anim = false, $notified = self::BOTH) { $this->group = $group; $this->anim = $anim; + $this->notified = $notified; } public function buildCondition(PlFilter $uf) @@ -877,6 +888,10 @@ class UFC_Group extends UserFilterCondition if ($this->anim) { $where .= ' AND gpm' . $sub . '.perms = \'admin\''; } + if ($this->notified != self::BOTH) { + $where .= ' AND ' . ($this->notified == self::UNNOTIFIED ? 'NOT ' : '') + . "FIND_IN_SET('notify', gpm" . $sub . '.flags)'; + } return $where; } } @@ -1013,14 +1028,16 @@ abstract class UFC_Address extends UserFilterCondition /** Flags for addresses */ + const FLAG_NONE = 0x0000; const FLAG_CURRENT = 0x0001; const FLAG_TEMP = 0x0002; const FLAG_SECOND = 0x0004; const FLAG_MAIL = 0x0008; const FLAG_CEDEX = 0x0010; + const FLAG_AX_MAIL = 0x0020; // Binary OR of those flags - const FLAG_ANY = 0x001F; + const FLAG_ANY = 0x003F; /** Text of these flags */ @@ -1030,6 +1047,7 @@ abstract class UFC_Address extends UserFilterCondition self::FLAG_SECOND => 'secondary', self::FLAG_MAIL => 'mail', self::FLAG_CEDEX => 'cedex', + self::FLAG_AX_MAIL => 'ax_mail', ); protected $flags; @@ -1083,7 +1101,7 @@ class UFC_AddressComponent extends UFC_Address private $fieldtype; private $exact; - public function __construct($val, $fieldtype, $exact = true, $type = null, $flags = self::FLAG_ANY) + public function __construct($val, $fieldtype, $type = null, $flags = self::FLAG_ANY) { if (!in_array($fieldtype, self::$components)) { Platal::page()->killError('Invalid address field type: ' . $this->fieldtype); @@ -1095,7 +1113,6 @@ class UFC_AddressComponent extends UFC_Address } $this->val = $val; $this->fieldtype = $fieldtype; - $this->exact = $exact; } public function buildCondition(PlFilter $uf) @@ -1704,5 +1721,5 @@ class UFC_PartnerSharingID extends UserFilterCondition } // }}} -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: ?>