X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Faxletter%2Faxletter.inc.php;h=f8c7ca1df2ec34ba6ee0ebb65676a85528050ffa;hb=afada5eb6cf23005f775fbab0d421c27393172f1;hp=e405f3bb787eb365cf9ae23f825a29a17588c00c;hpb=9b242f1745890afcbd3c7b8c08a43894d068d0f0;p=platal.git diff --git a/modules/axletter/axletter.inc.php b/modules/axletter/axletter.inc.php index e405f3b..f8c7ca1 100644 --- a/modules/axletter/axletter.inc.php +++ b/modules/axletter/axletter.inc.php @@ -1,6 +1,6 @@ _head = ' ,'; if (!is_array($id)) { @@ -45,7 +45,7 @@ class AXLetter extends MassMailer } else { $res = XDB::query("SELECT * FROM axletter - WHERE id = {?} OR shortname = {?}", $id, $id); + WHERE id = {?} OR short_name = {?}", $id, $id); } if (!$res->numRows()) { $this->_id = null; @@ -111,9 +111,9 @@ class AXLetter extends MassMailer 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 {$this->subscriptionWhere()} - AND (e.email IS NOT NULL OR ni.user_id = 0) + AND (e.email IS NOT NULL OR FIND_IN_SET('googleapps', u.mail_storage) OR ni.user_id = 0) GROUP BY u.user_id"; - } + } static public function subscriptionState($uid = null) { @@ -122,8 +122,8 @@ class AXLetter extends MassMailer FROM axletter_ins WHERE user_id={?}", $user); return $res->fetchOneCell(); - } - + } + static public function unsubscribe($uid = null, $hash = false) { $user = is_null($uid) ? S::v('uid') : $uid; @@ -177,18 +177,13 @@ class AXLetter extends MassMailer if (!is_numeric($uid)) { $res = XDB::query("SELECT id FROM aliases WHERE alias = {?}", $uid); $uid = $res->fetchOneCell(); - } + } if (!$uid) { return false; } return XDB::execute("DELETE FROM axletter_rights WHERE user_id = {?}", $uid); } - protected function subscriptionTable() - { - return 'axletter_ins'; - } - protected function subscriptionWhere() { if (!$this->_promo_min && !$this->_promo_max) { @@ -227,17 +222,17 @@ class AXLetter extends MassMailer } static public function listSent() - { - $res = XDB::query("SELECT IF(shortname IS NULL, id, shortname) as id, date, subject AS titre + { + $res = XDB::query("SELECT IF(short_name IS NULL, id, short_name) as id, date, subject AS titre FROM axletter - WHERE NOT (FIND_IN_SET('new', bits)) + WHERE NOT FIND_IN_SET('new', bits) AND NOT FIND_IN_SET('invalid', bits) ORDER BY date DESC"); return $res->fetchAllAssoc(); } - + static public function listAll() - { - $res = XDB::query("SELECT IF(shortname IS NULL, id, shortname) as id, date, subject AS titre + { + $res = XDB::query("SELECT IF(short_name IS NULL, id, short_name) as id, date, subject AS titre FROM axletter ORDER BY date DESC"); return $res->fetchAllAssoc();