X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fspool.inc.php;h=3d54680c58f30859dae28060b05947c289529864;hb=82c17a914411d0a96b207ebff024d0adbb3a26e8;hp=314267d0d92170614fabeace27baefec44c67331;hpb=cdedbcb15d2d17454af288e065e9eaf9e02aeace;p=banana.git diff --git a/include/spool.inc.php b/include/spool.inc.php index 314267d..3d54680 100644 --- a/include/spool.inc.php +++ b/include/spool.inc.php @@ -87,7 +87,7 @@ class spool { // remove expired messages $msgids=array_flip($this->ids); for ($id=min(array_keys($this->overview)); $id<$first; $id++) { - $this->delid[$id]; + $this->delid($id); } $this->ids=array_flip($msgids); $first=max(array_keys($this->overview))+1; @@ -107,24 +107,36 @@ class spool { "$first-$last")); $refs = $_nntp->xhdr("References","$first-$last"); # $this->date=$nntp->date; - if ($this->ids) { + if (isset($this->ids)) { $this->ids=array_merge($this->ids,array_flip($msgids)); } else { $this->ids=array_flip($msgids); } foreach ($msgids as $id=>$msgid) { - $msg = new spoolhead($dates[$id],$subjects[$id],$froms[$id], - (isset($this->overview[$id]->desc)? - $this->overview[$id]->desc+1:1)); + if (isset($this->overview[$id])) { + $msg = $this->overview[$id]; + $msg->desc++; + } else { + $msg = new spoolhead($dates[$id],$subjects[$id],$froms[$id],1); + } $refs[$id]=str_replace("><","> <",$refs[$id]); $msgrefs=preg_split("/( |\t)/",strtr($refs[$id],$this->ids)); $parents=preg_grep("/^\d+$/",$msgrefs); $msg->parent=array_pop($parents); $p = $msg->parent; while ($p) { - $this->overview[$p]->desc++; - $p = $this->overview[$p]->parent; + if (isset($this->overview[$p])) { + $this->overview[$p]->desc++; + if (isset($this->overview[$p]->parent)) { + $p = $this->overview[$p]->parent; + } else { + $p = false; + } + } else { + $this->overview[$p] = new spoolhead($dates[$p],$subjects[$p],$froms[$p],1); + $p = false; + } } if ($msg->parent!="") $this->overview[$msg->parent]->children[]=$id; @@ -158,7 +170,8 @@ class spool { switch ($_display) { case 1: foreach ($this->overview as $i=>$p) { - if (!isset($this->overview[$i]->parent) && + if (isset($this->overview[$i]) && + !isset($this->overview[$i]->parent) && ($this->overview[$i]->descunread==0)) { $this->killdesc($i); } @@ -246,6 +259,7 @@ class spool { function disp_desc($_id,$_index="",$_first=0,$_last=0,$_ref="", $_pfx_node="", $_pfx_end="",$_head=true) { + global $css; $debug = false; $spfx_f = 'o'; $spfx_n = '*'; @@ -259,18 +273,18 @@ class spool { if (!sizeof($this->overview[$_id]->children) && ($_index<=$_last) && ($_index>=$_first)) { - echo '\n"; - echo "" + echo '\n"; + echo "" .formatSpoolHeader("date",$this->overview[$_id]->date,$_id, $this->group,($_index==$_ref),$this->overview[$_id]->isread) ." \n"; - echo "
" + echo "
" .$_pfx_node.($_head?$spfx_f:$spfx_s)."
" .formatSpoolHeader("subject",$this->overview[$_id]->subject,$_id, $this->group,($_index==$_ref),$this->overview[$_id]->isread) .($debug?" $_id $_index ". $this->overview[$_id]->desc." ".$this->overview[$_id]->descunread." ":"")." \n"; - echo "" + echo "" .formatSpoolHeader("from",$this->overview[$_id]->from,$_id, $this->group,($_index==$_ref),$this->overview[$_id]->isread) ." \n"; @@ -278,18 +292,18 @@ class spool { } $children = $this->overview[$_id]->children; if (($_index<=$_last) && ($_index>=$_first)) { - echo '\n"; - echo "" + echo '\n"; + echo "" .formatSpoolHeader("date",$this->overview[$_id]->date,$_id, $this->group,($_index==$_ref),$this->overview[$_id]->isread) ." \n"; - echo "
" + echo "
" .$_pfx_node.$spfx_n."
" .formatSpoolHeader("subject",$this->overview[$_id]->subject,$_id, $this->group,($_index==$_ref),$this->overview[$_id]->isread) .($debug?" $_id $_index ". $this->overview[$_id]->desc." ".$this->overview[$_id]->descunread." ":"")." \n"; - echo "" + echo "" .formatSpoolHeader("from",$this->overview[$_id]->from,$_id, $this->group,($_index==$_ref),$this->overview[$_id]->isread) ." \n"; @@ -317,6 +331,7 @@ class spool { */ function disp($_first=0,$_last=0,$_ref="") { + global $css; $index=1; if (sizeof($this->overview)) { foreach ($this->overview as $id=>$msg) { @@ -326,7 +341,7 @@ class spool { } } } else { - echo "\n"; + echo "\n"; echo "\t\n"; echo "\t\tNo post in this newsgroup\n"; echo "\t\n";