private $tpl;
private $mailer = null;
- function __construct(&$mailer, $tpl)
+ function __construct($tpl)
{
global $globals;
$this->tpl = $tpl;
- $this->mailer =& $mailer;
$this->caching = false;
$this->compile_check = true;
$this->register_function('add_header', Array($this, 'addHeader'));
}
+ public static function &get(&$mailer, $tpl)
+ {
+ static $plmail;
+ if (!isset($plmail) || $plmail->tpl != $tpl) {
+ $plmail = new PlMail($tpl);
+ }
+ $plmail->mailer =& $mailer;
+ return $plmail;
+ }
+
public function run($html)
{
$this->assign('html_version', $html);
$this->Mail_Mime("\n");
$this->mail = @Mail::factory('sendmail', Array('sendmail_args' => '-oi'));
if (!is_null($tpl)) {
- $this->page = new PlMail($this, $tpl);
+ $this->page =& PlMail::get($this, $tpl);
}
}
protected function getAllRecipients()
{
- return "SELECT u.user_id, a.alias,
+ global $globals;
+ return "SELECT u.user_id, CONCAT(a.alias, '@{$globals->mail->domain}'),
u.prenom, IF(u.nom_usage='', u.nom, u.nom_usage),
FIND_IN_SET('femme', u.flags),
q.core_mail_fmt AS pref, 0 AS hash
XDB::execute("UPDATE {$this->subscriptionTable()}
SET last = {?}
WHERE " . implode(' OR ', $sent), $this->_id);
+
sleep(60);
}
}