X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FWeb%2FPages%2FForum.pm;h=8c21cd2792826a1173734e2c02c31db651590075;hb=0de73d6e8744b300650b12edae899f6a865c58a8;hp=a54d23e42eca8188eb07e6b0be8383ef5e5094e1;hpb=6fe6edd0f7b5e12d88ec0549252104e5a287888c;p=ndwebbie.git diff --git a/ND/Web/Pages/Forum.pm b/ND/Web/Pages/Forum.pm index a54d23e..8c21cd2 100644 --- a/ND/Web/Pages/Forum.pm +++ b/ND/Web/Pages/Forum.pm @@ -82,12 +82,12 @@ sub render { } if (defined param('cmd')){ - if(param('cmd') eq 'Submit'){ + if(param('cmd') eq 'Submit' or param('cmd') eq 'Preview'){ $DBH->begin_work; if ($board && $board->{post}){ $thread = addForumThread $DBH,$board,$ND::UID,param('subject'); } - if ($thread && $thread->{post}){ + if (param('cmd') eq 'Submit' and $thread && $thread->{post}){ addForumPost($DBH,$thread,$ND::UID,param('message')); } $DBH->commit or $ND::ERROR .= p($DBH->errstr); @@ -202,10 +202,6 @@ sub render { my @categories; while (my $category = $categories->fetchrow_hashref){ $boards->execute($category->{id},$ND::UID) or $ND::ERROR .= p($DBH->errstr); - #TODO: really need to do this outside, so you don't need moderate access - if ($category->{id} == $board->{fcid}){ - $BODY->param(Category => $category->{category}); - } my @boards; while (my $b = $boards->fetchrow_hashref){ @@ -219,6 +215,9 @@ sub render { } $BODY->param(Categories => \@categories); } + my ($category) = $DBH->selectrow_array(q{SELECT category FROM forum_categories WHERE fcid = $1} + ,undef,$board->{fcid}) or $ND::ERROR .= p($DBH->errstr); + $BODY->param(Category => $category); }else{ #List boards $BODY->param(Overview => 1);