X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fspool.inc.php;h=0f8b64c5db4f5a4760990607d3cc9dac924a0d76;hb=2d4e8347aed866199dd1bc3d2e09a84e7bb55315;hp=8bb553759083aa9298951cf40a388b3bc33291c6;hpb=e9360b112e17413c5d74a8dbb33ee8c6d5111dc4;p=banana.git diff --git a/banana/spool.inc.php b/banana/spool.inc.php index 8bb5537..0f8b64c 100644 --- a/banana/spool.inc.php +++ b/banana/spool.inc.php @@ -49,7 +49,7 @@ class BananaSpoolHead public function __construct(array &$message) { $this->date = $message['date']; - $this->subject = stripslashes($message['subject']); + $this->subject = $message['subject']; $this->from = $message['from']; $this->desc = 1; $this->isread = true; @@ -85,10 +85,10 @@ class BananaSpool $this->group = $group; } - public static function getSpool($group, $since = 0) + public static function getSpool($group, $since = 0, $clean = false) { if (!is_null(Banana::$spool) && Banana::$spool->group == $group) { - $spool = Banana::$spool; + $spool =& Banana::$spool; } else { $spool = BananaSpool::readFromFile($group); } @@ -97,6 +97,9 @@ class BananaSpool } Banana::$spool =& $spool; $spool->build(); + if ($clean) { + $spool->markAllAsRead(); + } $spool->updateUnread($since); return $spool; } @@ -243,7 +246,7 @@ class BananaSpool } $newpostsids = Banana::$protocole->getNewIndexes($since); - + if (empty($newpostsids)) { return; } @@ -392,9 +395,7 @@ class BananaSpool * @param $_pfx_end STRING prefix used for children of current node * @param $_head BOOLEAN true if first post in thread * - * If you want to analyse subject, you can define the function hook_getSubject(&$subject) which - * take the subject as a reference parameter, transform this subject to be displaid in the spool - * view and return a string. This string will be put after the subject. + * If you want to analyse subject, you can define the function hook_formatDisplayHeader */ private function _to_html($_id, $_index, $_first=0, $_last=0, $_ref="", $_pfx_node="", $_pfx_end="", $_head=true) { @@ -426,14 +427,15 @@ class BananaSpool $res .= '' . $_pfx_node .($hc ? ($_head ? $spfx_f : ($overview->parent_direct ? $spfx_s : $spfx_snd)) : $spfx_n); $subject = $overview->subject; + if (function_exists('hook_formatDisplayHeader')) { + list($subject, $link) = hook_formatDisplayHeader('subject', $subject, true); + } else { + $subject = banana_catchFormats(banana_htmlentities(stripslashes($subject))); + $link = null; + } if (empty($subject)) { $subject = _b_('(pas de sujet)'); } - $link = null; - if (function_exists('hook_getSubject')) { - $link = hook_getSubject($subject); - } - $subject = banana_catchFormats($subject); if ($_index != $_ref) { $subject = Banana::$page->makeLink(Array('group' => $this->group, 'artid' => $_id, 'text' => $subject, 'popup' => $subject)); @@ -518,7 +520,7 @@ class BananaSpool for ($i = 0; $i < $pos ; $i++) { $ndx += $this->overview[$this->overview[$id_parent]->children[$i]]->desc; } - $ndx++; //noeud père + $ndx++; //noeud père $id_cur = $id_parent; } @@ -687,5 +689,5 @@ class BananaSpool } } -// vim:set et sw=4 sts=4 ts=4 +// vim:set et sw=4 sts=4 ts=4 enc=utf-8: ?>