X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Faxletter%2Faxletter.inc.php;h=386eb268e5b481b5677ab1f3946dd847c6258d51;hb=295d4c48a12e49274135d9f781862a45e5b8c5dc;hp=a2a136b6781055e229beb420d8f1347aeb4eaea3;hpb=0d75939a5e7640b66188ab4fc5d03a999b2c574e;p=platal.git diff --git a/modules/axletter/axletter.inc.php b/modules/axletter/axletter.inc.php index a2a136b..386eb26 100644 --- a/modules/axletter/axletter.inc.php +++ b/modules/axletter/axletter.inc.php @@ -33,7 +33,7 @@ class AXLetter extends MassMailer function __construct($id) { - parent::__construct('axletter/letter.tpl', 'ax.css', 'ax/show'); + parent::__construct('axletter/letter.tpl', 'ax.css', 'ax/show', 'axletter', 'axletter_ins'); $this->_head = ' ,'; if (!is_array($id)) { @@ -56,6 +56,9 @@ class AXLetter extends MassMailer list($this->_id, $this->_shortname, $this->_title_mail, $this->_title, $this->_body, $this->_signature, $this->_promo_min, $this->_promo_max, $this->_echeance, $this->_date, $this->_bits) = $id; + if ($this->_date == '0000-00-00') { + $this->_date = 0; + } } protected function assignData(&$smarty) @@ -110,7 +113,7 @@ class AXLetter extends MassMailer WHERE ni.last < {?} AND {$this->subscriptionWhere()} AND (e.email IS NOT NULL OR ni.user_id = 0) GROUP BY u.user_id"; - } + } static public function subscriptionState($uid = null) { @@ -119,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; @@ -174,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) { @@ -224,16 +222,16 @@ class AXLetter extends MassMailer } static public function listSent() - { + { $res = XDB::query("SELECT IF(shortname IS NULL, id, shortname) as id, date, subject AS titre FROM axletter WHERE NOT (FIND_IN_SET('new', 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 FROM axletter ORDER BY date DESC"); @@ -241,5 +239,5 @@ class AXLetter extends MassMailer } } -// vim:set et sw=4 sts=4 sws=4: +// vim:set et sw=4 sts=4 sws=4 enc=utf-8: ?>