X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fspool.inc.php;h=c7a7daeb85471109d0434be7befed00cf7f9c297;hb=fb6428c855e1be6fed8326d1ddecbf7a4eab3f60;hp=afe1a5a5eb214331bb5c76e8cd0bd2e1c0e8f01a;hpb=d81ff9886830f92030d8fba054eba5ddf77c2d7b;p=banana.git diff --git a/banana/spool.inc.php b/banana/spool.inc.php index afe1a5a..c7a7dae 100644 --- a/banana/spool.inc.php +++ b/banana/spool.inc.php @@ -83,6 +83,8 @@ class BananaSpool var $ids; /** thread starts */ var $roots; + /** test validity */ + var $valid = true; /** constructor * @param $_group STRING group name @@ -94,23 +96,30 @@ class BananaSpool global $banana; $this->group = $_group; $groupinfo = $banana->nntp->group($_group); - if (!$groupinfo) { return null; } + if (!$groupinfo) { + $this->valid = false; + return null; + } $this->_readFromFile(); $do_save = false; - $first = $banana->maxspool ? max($groupinfo[2]-$banana->maxspool, $groupinfo[1]) : $groupinfo[1]; - $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++) { + $first = $banana->maxspool ? max($groupinfo[2] - $banana->maxspool, $groupinfo[1]) : $groupinfo[1]; + $last = $groupinfo[2]; + + if ($this->version == BANANA_SPOOL_VERSION && is_array($this->overview)) { + $mids = array_keys($this->overview); + foreach ($mids as $id) { + if (($first <= $last && ($id < $first || $id > $last)) + || ($first > $last && $id < $first && $id > $last)) + { $this->delid($id, false); $do_save = true; } } if (!empty($this->overview)) { $first = max(array_keys($this->overview))+1; - } + } } else { unset($this->overview, $this->ids); $this->version = BANANA_SPOOL_VERSION; @@ -336,7 +345,9 @@ class BananaSpool if ($_index == $_ref) { $res .= ''.htmlentities($subject).''; } else { - $res .= "".htmlentities($subject).''; + $res .= makeHREF(Array('group' => $this->group, + 'artid' => $_id), + htmlentities($subject)); } $res .= "\n".formatFrom($this->overview[$_id]->from)."\n";