use ND::Web::Include;
use ND::Include;
-$ND::PAGES{forum} = {parse => \&parse, process => \&process, render=> \&render};
+use base qw/ND::Web::XMLPage/;
+
+$ND::Web::Page::PAGES{forum} = __PACKAGE__;
sub parse {
- my ($uri) = @_;
- if ($uri =~ m{^/.*/allUnread}){
+ my $self = shift;
+ if ($self->{URI} =~ m{^/.*/allUnread}){
param('allUnread',1);
}
}
-sub process {
-
-}
-
-sub render {
- my ($DBH,$BODY) = @_;
-
- $ND::TEMPLATE->param(TITLE => 'Forum');
+sub render_body {
+ my $self = shift;
+ my ($BODY) = @_;
+ $self->{TITLE} = 'Forum';
+ my $DBH = $self->{DBH};
$DBH->do(q{UPDATE users SET last_forum_visit = NOW() WHERE uid = $1},undef,$ND::UID) or $ND::ERROR .= p($DBH->errstr);
}
if (param('cmd') eq 'Submit' and $thread && $thread->{post}){
addForumPost($DBH,$thread,$ND::UID,param('message'));
+ $self->{RETURN} = 'REDIRECT';
+ $self->{REDIR_LOCATION} = "/forum?t=$thread->{id}#NewPosts";
}
$DBH->commit or $ND::ERROR .= p($DBH->errstr);
+ return if $self->{RETURN};
}
if(param('cmd') eq 'Move' && $board->{moderate}){
$DBH->begin_work;
$boards->execute($category->{id},$ND::UID) or $ND::ERROR .= p($DBH->errstr);
my @boards;
while (my $board = $boards->fetchrow_hashref){
+ next if $board->{id} < 0;
$threads->execute($board->{id},$ND::UID,1) or $ND::ERROR .= p($DBH->errstr);
my $i = 0;
my @threads;
,undef,$board->{fcid}) or $ND::ERROR .= p($DBH->errstr);
$BODY->param(Category => $category);
+ }elsif($self->{URI} =~ m{^/.*/search/(.*)}){ #List threads in this board
}else{ #List boards
$BODY->param(Overview => 1);
$categories->execute or $ND::ERROR .= p($DBH->errstr);