$do_save = false;
$first = $banana->maxspool ? max($groupinfo[2]-$banana->maxspool, $groupinfo[1]) : $groupinfo[1];
- $last = $groupinfo[2];
- if ($this->version == BANANA_SPOOL_VERSION) {
- for ($id = min(array_keys($this->overview)); $id<$first; $id++) {
- $this->delid($id, false);
- $do_save = true;
+ $last = $groupinfo[2];
+ if ($this->version == BANANA_SPOOL_VERSION && is_array($this->overview)) {
+ if (count($this->overview)) {
+ for ($id = min(array_keys($this->overview)); $id<$first; $id++) {
+ $this->delid($id, false);
+ $do_save = true;
+ }
+ }
+ if (!empty($this->overview)) {
+ $first = max(array_keys($this->overview))+1;
}
- $first = max(array_keys($this->overview))+1;
} else {
unset($this->overview, $this->ids);
$this->version = BANANA_SPOOL_VERSION;
$this->roots[] = $id;
}
}
-
+
file_put_contents($file, serialize($this));
}
function _updateSpool($arg)
{
global $banana;
- $dates = array_map(strtotime, $banana->nntp->xhdr("Date", $arg));
- $subjects = array_map(headerdecode, $banana->nntp->xhdr("Subject", $arg));
- $froms = array_map(headerdecode, $banana->nntp->xhdr("From", $arg));
- $msgids = $banana->nntp->xhdr("Message-ID", $arg);
- $refs = $banana->nntp->xhdr("References", $arg);
+ $dates = array_map('strtotime', $banana->nntp->xhdr('Date', $arg));
+ $subjects = array_map('headerdecode', $banana->nntp->xhdr('Subject', $arg));
+ $froms = array_map('headerdecode', $banana->nntp->xhdr('From', $arg));
+ $msgids = $banana->nntp->xhdr('Message-ID', $arg);
+ $refs = $banana->nntp->xhdr('References', $arg);
if (is_array($this->ids)) {
$this->ids = array_merge($this->ids, array_flip($msgids));
if (empty($since)) { return; }
if (is_array($newpostsids = $banana->nntp->newnews($since, $this->group))) {
+ if (!is_array($this->ids)) { $this->ids = array(); }
$newpostsids = array_intersect($newpostsids, array_keys($this->ids));
foreach ($newpostsids as $mid) {
$this->overview[$this->ids[$mid]]->isread = false;
$res .= "<td class='subj'>"
."<div class='tree'>$_pfx_node".($hc?($_head?$spfx_f:($this->overview[$_id]->parent_direct?$spfx_s:$spfx_snd)):$spfx_n)
."</div>";
+ $subject = $this->overview[$_id]->subject;
+ if (strlen($subject) == 0) {
+ $subject = _b_('(pas de sujet)');
+ }
if ($_index == $_ref) {
- $res .= '<span class="cur">'.htmlentities($this->overview[$_id]->subject).'</span>';
+ $res .= '<span class="cur">'.htmlentities($subject).'</span>';
} else {
- $res .= "<a href='?group={$this->group}&artid=$_id'>".htmlentities($this->overview[$_id]->subject).'</a>';
+ $res .= "<a href='?group={$this->group}&artid=$_id'>".htmlentities($subject).'</a>';
}
$res .= "</td>\n<td class='from'>".formatFrom($this->overview[$_id]->from)."</td>\n</tr>";