+}elsif(defined param('allUnread')){ #List threads in this board
+ $BODY->param(AllUnread => 1);
+ $BODY->param(Id => $board->{id});
+ $categories->execute or $ERROR .= p($DBH->errstr);
+ my @categories;
+ my $boards = $DBH->prepare(q{SELECT fb.fbid AS id,fb.board, bool_or(fa.post) AS post
+FROM forum_boards fb NATURAL JOIN forum_access fa
+WHERE fb.fcid = $1 AND (gid = -1 OR gid IN (SELECT gid FROM groupmembers
+ WHERE uid = $2))
+GROUP BY fb.fbid,fb.board
+});
+ while (my $category = $categories->fetchrow_hashref){
+ $boards->execute($category->{id},$ND::UID) or $ERROR .= p($DBH->errstr);
+ my @boards;
+ while (my $board = $boards->fetchrow_hashref){
+ $threads->execute($board->{id},$ND::UID,1) or $ERROR .= p($DBH->errstr);
+ my $i = 0;
+ my @threads;
+ while (my $thread = $threads->fetchrow_hashref){
+ $i++;
+ $thread->{Odd} = $i % 2;
+ push @threads,$thread;
+ }
+ $board->{Threads} = \@threads;
+ delete $board->{post};
+ push @boards,$board if $i > 0;
+ }
+ $category->{Boards} = \@boards;
+ delete $category->{id};
+ push @categories,$category if @boards;
+ }
+ $BODY->param(Categories => \@categories);
+