X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND.pm;fp=ND.pm;h=c3391f2bcc2ddf74781cfd62e2de3a4ca49f488c;hb=2d7464077ae805a1923bb4e2024afeb769f30e02;hp=3c053b853e66606e9d72c3573122deab9b4bef7d;hpb=e1e188775dd3c5e1e9472661dc2006c3cca29e1c;p=ndwebbie.git diff --git a/ND.pm b/ND.pm index 3c053b8..c3391f2 100755 --- a/ND.pm +++ b/ND.pm @@ -26,6 +26,7 @@ use DBD::Pg qw(:pg_types); use Apache2::Request; use ND::Web::Include; use ND::DB; +use ND::Include; use Tie::File; use Fcntl 'O_RDONLY'; use strict; @@ -110,15 +111,8 @@ sub page { $fleetupdate = 0 unless defined $fleetupdate; - my ($unread) = $DBH->selectrow_array(q{ - SELECT count(*) AS unread -FROM forum_boards fb NATURAL JOIN forum_threads ft - JOIN forum_posts fp USING (ftid) LEFT OUTER JOIN - (SELECT * FROM forum_thread_visits WHERE uid = $1) ftv ON ftv.ftid = ft.ftid -WHERE (ftv.time IS NULL OR fp.time > ftv.time) AND fbid > 0 AND - fbid IN (SELECT fbid FROM forum_access WHERE gid IN (SELECT groups($1))) - },undef,$UID) or $ERROR .= p($DBH->errstr); - + my ($unread,$lastv) = $DBH->selectrow_array(unread_query,undef,$UID) or $ERROR .= p($DBH->errstr); + $TEMPLATE->param(UnreadPosts => $unread); $TEMPLATE->param(Tick => $TICK); $TEMPLATE->param(isMember => (($TICK - $fleetupdate < 24) || isScanner()) && $PLANET && isMember());