X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fnewsletter.inc.php;h=c58844e478cc7e09e5b16cc10f710f8d0d95072d;hb=2d88346f4b0d60bf0d7e1d340a2dfd6535ed5b82;hp=07aac94d71263ef535829677b5cf6d4893fea838;hpb=d0327f6de73e81c4bcc656471ca4161e4f1e1e1b;p=platal.git diff --git a/include/newsletter.inc.php b/include/newsletter.inc.php index 07aac94..c58844e 100644 --- a/include/newsletter.inc.php +++ b/include/newsletter.inc.php @@ -1,6 +1,6 @@ numRows() != 1) { + throw new MailNotFound(); + } $nl = $res->fetchOneAssoc(); $this->_id = $nl['id']; @@ -223,18 +226,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 = "