projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'origin/platal-0.10.0'
[platal.git]
/
include
/
newsletter.inc.php
diff --git
a/include/newsletter.inc.php
b/include/newsletter.inc.php
index
07aac94
..
c58844e
100644
(file)
--- a/
include/newsletter.inc.php
+++ b/
include/newsletter.inc.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-200
8
Polytechnique.org *
+ * Copyright (C) 2003-200
9
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-45,6
+45,9
@@
class NewsLetter extends MassMailer
}
$res = XDB::query("SELECT * FROM newsletter WHERE bits='new'");
}
}
$res = XDB::query("SELECT * FROM newsletter WHERE bits='new'");
}
+ if ($res->numRows() != 1) {
+ throw new MailNotFound();
+ }
$nl = $res->fetchOneAssoc();
$this->_id = $nl['id'];
$nl = $res->fetchOneAssoc();
$this->_id = $nl['id'];
@@
-223,18
+226,24
@@
class NLArticle
// }}}
// {{{ function toText()
// }}}
// {{{ 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);
{
$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()
}
// }}}
// {{{ function toHtml()
- public function toHtml()
+ public function toHtml(
$hash = null, $login = null
)
{
$title = "<h2 class='xorg_nl'><a id='art{$this->_aid}'></a>".pl_entities($this->title()).'</h2>';
$body = MiniWiki::WikiToHTML($this->_body);
{
$title = "<h2 class='xorg_nl'><a id='art{$this->_aid}'></a>".pl_entities($this->title()).'</h2>';
$body = MiniWiki::WikiToHTML($this->_body);
@@
-246,6
+255,11
@@
class NLArticle
$art .= "<div class='app'>$app</div>";
}
$art .= "</div>\n";
$art .= "<div class='app'>$app</div>";
}
$art .= "</div>\n";
+ if (!is_null($hash) && !is_null($login)) {
+ $art = str_replace('%HASH%', "$hash/$login", $art);
+ } else {
+ $art = str_replace('%HASH%', '', $art);
+ }
return $art;
}
return $art;
}