From: Florent Bruneau Date: Sun, 25 May 2008 10:00:50 +0000 (+0200) Subject: Replace %HASH% in the newsletter with $hash/$login. X-Git-Tag: xorg/0.9.16~9 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;ds=sidebyside;h=e0e77c5a55e92d873accf3fe735042eb8b088e34;p=platal.git Replace %HASH% in the newsletter with $hash/$login. Signed-off-by: Florent Bruneau --- diff --git a/include/massmailer.inc.php b/include/massmailer.inc.php index 93f661d..8b01b50 100644 --- a/include/massmailer.inc.php +++ b/include/massmailer.inc.php @@ -185,6 +185,8 @@ abstract class MassMailer $mailer->assign('sexe', $sexe); $mailer->assign('prefix', null); $mailer->assign('hash', $hash); + $mailer->assign('email', $login); + $mailer->assign('alias', $alias); $mailer->addTo("\"$prenom $nom\" <$login>"); $mailer->send($html); } diff --git a/include/newsletter.inc.php b/include/newsletter.inc.php index 07aac94..9e1a59b 100644 --- a/include/newsletter.inc.php +++ b/include/newsletter.inc.php @@ -223,18 +223,24 @@ class NLArticle // }}} // {{{ function toText() - public function toText() + public function toText($hash = null, $login = null) { $title = '*'.$this->title().'*'; $body = MiniWiki::WikiToText($this->_body, true); $app = MiniWiki::WikiToText($this->_append,false,4); - return trim("$title\n\n$body\n\n$app")."\n"; + $text = trim("$title\n\n$body\n\n$app")."\n"; + if (!is_null($hash) && !is_null($login)) { + $text = str_replace('%HASH%', "$hash/$login", $text); + } else { + $text = str_replace('%HASH%', '', $text); + } + return $text; } // }}} // {{{ function toHtml() - public function toHtml() + public function toHtml($hash = null, $login = null) { $title = "

".pl_entities($this->title()).'

'; $body = MiniWiki::WikiToHTML($this->_body); @@ -246,6 +252,11 @@ class NLArticle $art .= "
$app
"; } $art .= "\n"; + if (!is_null($hash) && !is_null($login)) { + $art = str_replace('%HASH%', "$hash/$login", $art); + } else { + $art = str_replace('%HASH%', '', $art); + } return $art; } diff --git a/templates/newsletter/nl.mail.tpl b/templates/newsletter/nl.mail.tpl index d32325e..cd6ecd3 100644 --- a/templates/newsletter/nl.mail.tpl +++ b/templates/newsletter/nl.mail.tpl @@ -51,7 +51,7 @@ -------------------------------------------------------------------- {foreach from=$arts item=art} -{$art->toText()} +{$art->toText($hash, $alias)} {/foreach} {/foreach} @@ -109,7 +109,7 @@ ne plus recevoir : <https://www.polytechnique.org/nl/out> {$nl->_cats[$cid]} {foreach from=$arts item=art} - {$art->toHtml()|smarty:nodefaults} + {$art->toHtml($hash, $alias)|smarty:nodefaults} {/foreach} {/foreach}