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);
}
}
}
}
+ function changeTpl($tpl)
+ {
+ if (!empty($GLOBALS['IS_XNET_SITE'])) {
+ new_group_open_page($tpl);
+ } else {
+ global $page;
+ $page->changeTpl($tpl);
+ }
+ }
+
function handler_members(&$page, $liste = null)
{
if (is_null($liste)) {
$this->prepare_client($page);
- $page->changeTpl('lists/members.tpl');
+ $this->changeTpl('lists/members.tpl');
if (Get::has('del')) {
$this->client->unsubscribe($liste);
$this->prepare_client($page);
- $page->changeTpl('lists/trombi.tpl');
+ $this->changeTpl('lists/trombi.tpl');
if (Get::has('del')) {
$this->client->unsubscribe($liste);
$domain = $this->prepare_client($page);
- $page->changeTpl('lists/archives.tpl');
+ $this->changeTpl('lists/archives.tpl');
if (list($det) = $this->client->get_members($liste)) {
if (substr($liste,0,5) != 'promo' && ($det['ins'] || $det['priv'])
$domain = $this->prepare_client($page);
- $page->changeTpl('lists/moderate.tpl');
+ $this->changeTpl('lists/moderate.tpl');
$page->register_modifier('hdc', 'list_header_decode');
$page->assign('msg', $msg);
$page->addCssLink('banana.css');
- $page->changeTpl('lists/moderate_mail.tpl');
+ $this->changeTpl('lists/moderate_mail.tpl');
$page->assign_by_ref('mail', $res);
return;
}
if (list($subs,$mails) = $this->client->get_pending_ops($liste)) {
foreach($subs as $user) {
if ($user['id'] == Env::v('sid')) {
- $page->changeTpl('lists/moderate_sub.tpl');
+ $this->changeTpl('lists/moderate_sub.tpl');
$page->assign('del_user', $user);
return;
}
$this->prepare_client($page);
- $page->changeTpl('lists/admin.tpl');
+ $this->changeTpl('lists/admin.tpl');
if (Env::has('add_member')) {
require_once('user.func.inc.php');
$this->prepare_client($page);
- $page->changeTpl('lists/options.tpl');
+ $this->changeTpl('lists/options.tpl');
if (Post::has('submit')) {
$values = $_POST;
$type = 'list';
}
- $page->changeTpl('lists/delete.tpl');
+ $this->changeTpl('lists/delete.tpl');
if (Post::v('valid') == 'OUI') {
if ($this->client->delete_list($liste, Post::b('del_archive'))) {
foreach (array('', '-owner', '-admin', '-bounces') as $app) {
$this->prepare_client($page);
- $page->changeTpl('lists/soptions.tpl');
+ $this->changeTpl('lists/soptions.tpl');
if (Post::has('submit')) {
$values = $_POST;
$this->prepare_client($page);
- $page->changeTpl('lists/check.tpl');
+ $this->changeTpl('lists/check.tpl');
if (Post::has('correct')) {
$this->client->check_options($liste, true);
}
function handler_admin_all(&$page) {
- $page->changeTpl('lists/admin_all.tpl');
+ $this->changeTpl('lists/admin_all.tpl');
$page->assign('xorg_title','Polytechnique.org - Administration - Mailing lists');
$client = new MMList(S::v('uid'), S::v('password'));