d34c96f4608566729b92392dd5980a689b1ca418
2 /********************************************************************************
3 * include/groups.inc.php : class for group lists
4 * ------------------------
6 * This file is part of the banana distribution
7 * Copyright: See COPYING files that comes with this distribution
8 ********************************************************************************/
10 /** class for group lists
20 * @param $_nntp RESOURCE handle to NNTP socket
23 function BananaGroups(&$_nntp,$_type=0) {
25 $desc=$_nntp->xgtitle();
27 $list=$_nntp->newgroups($profile['lastnews']);
29 $list=$_nntp->liste();
32 $this->overview
=array();
36 foreach ($desc as $g=>$d) {
37 if ((($_type==0) and (in_array($g,$profile['subscribe']) or !count($profile['subscribe'])))
38 or (($_type==1) and in_array($g,array_keys($list)))
40 $this->overview
[$g][0]=$d;
41 $this->overview
[$g][1]=$list[$g][0];
44 foreach (array_diff(array_keys($list),array_keys($desc)) as $g) {
45 if ((($_type==0) and (in_array($g,$profile['subscribe']) or !count($profile['subscribe'])))
46 or (($_type==1) and in_array($g,array_keys($list)))
48 $this->overview
[$g][0]="-";
49 $this->overview
[$g][1]=$list[$g][0];
53 foreach ($list as $g=>$l) {
54 if ((($_type==0) and (!count($profile['subscribe']) and in_array($g,$profile['subscribe'])))
55 or (($_type==1) and in_array($g,array_keys($list)))
57 $this->overview
[$g][0]="-";
58 $this->overview
[$g][1]=$l[0];
66 * @param $_nntp RESOURCE handle to NNTP socket
67 * @param date INTEGER date of last update
69 function update(&$_nntp,$_date) {
70 $serverdate = $_nntp->date();
71 if (!$serverdate) $serverdate=time();
72 $newlist = $_nntp->newgroups($_date);
73 if (!$newlist) return false
;
74 $this->date
= $serverdate;
75 foreach (array_keys($newlist) as $g) {
76 $groupstat = $_nntp->group($g);
77 $groupdesc = $_nntp->xgtitle($g);
78 $this->overview
[$g][0]=($groupdesc?
$groupdesc:"-");
79 $this->overview
[$g][1]=$groupstat[0];