X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FWeb%2FPages%2FForum.pm;h=81943a9707d7b2e2e47c06384b3591a162810fda;hb=c5cc1151b5a4f1e52eb577a78df1f79dfdc193db;hp=d31f4d3c04cd7a080ecc3530490652913518ccf4;hpb=06830a05ebd5541e52f8ca4e421286c1313420c7;p=ndwebbie.git diff --git a/ND/Web/Pages/Forum.pm b/ND/Web/Pages/Forum.pm index d31f4d3..81943a9 100644 --- a/ND/Web/Pages/Forum.pm +++ b/ND/Web/Pages/Forum.pm @@ -25,23 +25,22 @@ use CGI qw/:standard/; 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); @@ -89,8 +88,11 @@ sub render { } 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;