X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FWeb%2FPages%2FForum.pm;h=4aa72fec7ece06206f5e95516bbc1045c8f6c790;hb=83a572a26245ad849be8983a818ae586f29a56c2;hp=6a703fbe909319f2261d1b33e736bf81d26cc4b0;hpb=e1e188775dd3c5e1e9472661dc2006c3cca29e1c;p=ndwebbie.git diff --git a/ND/Web/Pages/Forum.pm b/ND/Web/Pages/Forum.pm index 6a703fb..4aa72fe 100644 --- a/ND/Web/Pages/Forum.pm +++ b/ND/Web/Pages/Forum.pm @@ -19,8 +19,7 @@ package ND::Web::Pages::Forum; use strict; -use warnings FATAL => 'all'; -no warnings 'uninitialized'; +use warnings; use ND::Web::Forum; use CGI qw/:standard/; use ND::Web::Include; @@ -43,6 +42,8 @@ sub render { $ND::TEMPLATE->param(TITLE => 'Forum'); + $DBH->do(q{UPDATE users SET last_forum_visit = NOW() WHERE uid = $1},undef,$ND::UID) or $ND::ERROR .= p($DBH->errstr); + my $board; if(param('b')){ my $boards = $DBH->prepare(q{SELECT fb.fbid AS id,fb.board, bool_or(fa.post) AS post @@ -91,7 +92,7 @@ sub render { } my $categories = $DBH->prepare(q{SELECT fcid AS id,category FROM forum_categories ORDER BY fcid}); - my $threads = $DBH->prepare(q{SELECT ft.ftid AS id,ft.subject,count(NULLIF(COALESCE(fp.time > ftv.time,TRUE),FALSE)) AS unread,count(fp.fpid) AS posts, max(fp.time)::timestamp as last_post + my $threads = $DBH->prepare(q{SELECT ft.ftid AS id,ft.subject,count(NULLIF(COALESCE(fp.time > ftv.time,TRUE),FALSE)) AS unread,count(fp.fpid) AS posts, date_trunc('seconds',max(fp.time)::timestamp) as last_post FROM forum_threads ft JOIN forum_posts fp USING (ftid) LEFT OUTER JOIN (SELECT * FROM forum_thread_visits WHERE uid = $2) ftv ON ftv.ftid = ft.ftid WHERE ft.fbid = $1 GROUP BY ft.ftid, ft.subject