private static function spoolFilename($group)
{
- $file = dirname(dirname(__FILE__));
- $file .= '/spool/' . Banana::$protocole->name() . '/';
+ $file = Banana::$spool_root . '/' . Banana::$protocole->name() . '/';
if (!is_dir($file)) {
mkdir($file);
}
$this->ids[$message['message-id']] = $id;
}
+ if (!is_array($this->overview)) {
+ $this->overview = array();
+ }
foreach ($messages as $id=>&$message) {
if (!isset($this->overview[$id])) {
$this->overview[$id] = new BananaSpoolHead($message);
*/
public function markAllAsRead(array &$array = null)
{
- if (is_null($array)) {
+ if (is_null($array) && is_array($this->roots)) {
$array =& $this->roots;
+ } elseif (is_null($array)) {
+ return;
}
foreach ($array as $id) {
if (!$this->overview[$id]->isread) {
}
unset($this->overview[$_id]);
$msgid = array_search($_id, $this->ids);
- if ($msgid) {
+ if ($msgid !== false) {
unset($this->ids[$msgid]);
}
+ $msgid = array_search($_id, $this->roots);
+ if ($msgid !== false) {
+ unset($this->roots[$msgid]);
+ }
if ($write) {
+ $this->markAllAsRead();
$this->saveToFile();
}
}
} else {
$format = '%a %e %b';
}
- return utf8_encode(strftime($format, $stamp));
+ return strftime($format, $stamp);
}
/** displays children tree of a post
$res .= '<tr class="' . ($_index%2 ? 'pair' : 'impair') . ($overview->isread ? '' : ' new') . "\">\n";
$res .= '<td class="date">' . $this->formatDate($overview->date) . " </td>\n";
- $res .= '<td class="subj' . ($_index == $_ref ? ' cur' : '') . '">'
- . $_pfx_node .($hc ? ($_head ? $spfx_f : ($overview->parent_direct ? $spfx_s : $spfx_snd)) : $spfx_n);
+ $res .= '<td class="subj' . ($_index == $_ref ? ' cur' : '') . '"><div class="tree">'
+ . $_pfx_node .($hc ? ($_head ? $spfx_f : ($overview->parent_direct ? $spfx_s : $spfx_snd)) : $spfx_n)
+ . '</div>';
$subject = $overview->subject;
if (function_exists('hook_formatDisplayHeader')) {
list($subject, $link) = hook_formatDisplayHeader('subject', $subject, true);
} else {
- $subject = banana_catchFormats(stripslashes($subject));
+ $subject = banana_catchFormats(banana_htmlentities(stripslashes($subject)));
$link = null;
}
if (empty($subject)) {
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;
}