X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=lib%2FNDWeb%2FController%2FForum.pm;h=a9b1cb5f3a7302e82bb3d471237e1ed21ea9b8d6;hb=77bd36f5189b0de25ff99ffec16d9e9187feb2fd;hp=1a796246688d090a717e7046e02af5bb52c12e16;hpb=c66b1b9074d880fb13a825bc75c1bc842ec65f75;p=ndwebbie.git diff --git a/lib/NDWeb/Controller/Forum.pm b/lib/NDWeb/Controller/Forum.pm index 1a79624..a9b1cb5 100644 --- a/lib/NDWeb/Controller/Forum.pm +++ b/lib/NDWeb/Controller/Forum.pm @@ -159,6 +159,9 @@ sub board : Local { $c->forward('findBoard'); $board = $c->stash->{board}; + if ( !defined $board->{fbid}){ + $c->detach('/default'); + } my $threads = $dbh->prepare(q{SELECT ft.ftid,u.username,ft.subject ,count(NULLIF(COALESCE(fp.time > ftv.time,TRUE),FALSE)) AS unread,count(fp.fpid) AS posts @@ -180,8 +183,14 @@ sub board : Local { while (my $thread = $threads->fetchrow_hashref){ push @threads,$thread; } + + if ( !(defined $board->{post}) && @threads == 0){ + $c->acl_access_denied('test',$c->action,'No access to board') + } $c->stash(threads => \@threads); + $c->stash(title => "$board->{board} ($board->{category})"); + $c->forward('listModeratorBoards', [$board->{fbid}]) if $board->{moderate}; } @@ -191,14 +200,18 @@ sub thread : Local { my $dbh = $c->model; $c->forward('findThread'); - unless ($c->stash->{thread}){ - $c->stash(template => 'access_denied.tt2'); + $thread = $c->stash->{thread}; + unless ($thread){ + $c->stash(template => 'default.tt2'); + $c->res->status(404); return; } my $query = $dbh->prepare(q{SELECT uid,username FROM users u JOIN forum_priv_access fta USING (uid) WHERE fta.ftid = $1}); - $query->execute($thread); + $query->execute($thread->{ftid}); $c->stash(access => $query->fetchall_arrayref({}) ); + $c->stash(title => $thread->{subject} + . " ($thread->{category} - $thread->{board})"); $c->forward('findPosts'); $c->forward('markThreadAsRead') if $c->user_exists; if ($c->stash->{thread}->{moderate}) {