From: x99bachelart Date: Fri, 12 Sep 2003 16:17:22 +0000 (+0000) Subject: subscription system X-Git-Tag: 1.8~411 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=8f98c1e8512036e5babe05ed44b0d840fabab3ef;p=banana.git subscription system --- diff --git a/include/groups.inc.php b/include/groups.inc.php index 871867e..4c5e647 100644 --- a/include/groups.inc.php +++ b/include/groups.inc.php @@ -20,26 +20,43 @@ class groups { * @param $_nntp RESOURCE handle to NNTP socket */ - function groups(&$_nntp) { + function groups(&$_nntp,$_type=0) { + global $profile; $desc=$_nntp->xgtitle(); - $list=$_nntp->liste(); + if ($_type==1) { + $list=$_nntp->newgroups($profile['lastnews']); + } else { + $list=$_nntp->liste(); + } if (!$list) { - $this="list"; + $this->overview=array(); return false; } if (isset($desc)) { foreach ($desc as $g=>$d) { - $this->overview[$g][0]=$d; - $this->overview[$g][1]=$list[$g][0]; + if ((($_type==0) and (in_array($g,$profile['subscribe']) or !count($profile['subscribe']))) + or (($_type==1) and in_array($g,array_keys($list))) + or ($_type==2)) { + $this->overview[$g][0]=$d; + $this->overview[$g][1]=$list[$g][0]; + } } foreach (array_diff(array_keys($list),array_keys($desc)) as $g) { - $this->overview[$g][0]="-"; - $this->overview[$g][1]=$list[$g][0]; + if ((($_type==0) and (in_array($g,$profile['subscribe']) or !count($profile['subscribe']))) + or (($_type==1) and in_array($g,array_keys($list))) + or ($_type==2)) { + $this->overview[$g][0]="-"; + $this->overview[$g][1]=$list[$g][0]; + } } } else { foreach ($list as $g=>$l) { - $this->overview[$g][0]="-"; - $this->overview[$g][1]=$l[0]; + if ((($_type==0) and (in_array($g,$profile['subscribe']) or !count($profile['subscribe']))) + or (($_type==1) and in_array($g,array_keys($list))) + or ($_type==2)) { + $this->overview[$g][0]="-"; + $this->overview[$g][1]=$l[0]; + } } } return true; diff --git a/index.php b/index.php index ea3a699..0286da1 100644 --- a/index.php +++ b/index.php @@ -30,8 +30,8 @@ if ($news['user']!="anonymous") { exit; } } -$groups = new groups($nntp); - +$groups = new groups($nntp,0); +$newgroups = new groups($nntp,1); ?>
"> @@ -92,6 +92,47 @@ foreach ($groups->overview as $g => $d) { ?> overview) and count($profile['subscribe'])) { +?> +

+ +

+" cellspacing="0" cellpadding="2" + summary=""> + + + + + +overview as $g => $d) { + $pair = !$pair; + $groupinfo = $nntp->group($g); +?> + " > + + + + + +
+ + + + + +
"> + + "> + $g";?> + "> + +
+ "Nouveaux", 'name' => "Nom", 'description' => "Description", + 'newgroupstext' => "Les forums suivants ont été créés depuis ton dernier passage :" +); + +$locale['subscribe'] = array( + 'title' => "Abonnements", + 'summary' => "Liste des forums", + 'total' => "Total", + 'subscribed' => "Abonné", + 'name' => "Nom", + 'description' => "Description", ); $locale['article'] = array(