use Apache2::Request;
use ND::Web::Include;
use ND::DB;
+use ND::Include;
use Tie::File;
use Fcntl 'O_RDONLY';
use strict;
-use warnings FATAL => 'all';
+use warnings;
+
+$SIG{__WARN__} = sub {$ND::ERROR .= p $_[0]};
chdir '/var/www/ndawn/code';
our %PAGES;
$ND::BODY = HTML::Template->new(filename => "templates/$ND::PAGE.xml.tmpl", cache => 1);
}else{
$ND::BODY = HTML::Template->new(filename => "templates/$ND::PAGE.tmpl", global_vars => 1, cache => 1);
- $ND::BODY->param(PAGE => '/'.$ND::PAGE);
+ $ND::BODY->param(PAGE => $ND::PAGE);
}
$ND::BODY = $PAGES{$PAGE}->{render}->($DBH,$ND::BODY);
$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 ($last_forum_visit) = $DBH->selectrow_array(q{SELECT last_forum_visit FROM users WHERE uid = $1}
+ ,undef,$UID) or $ERROR .= p($DBH->errstr);
+ my ($unread,$newposts) = $DBH->selectrow_array(unread_query,undef,$UID,$last_forum_visit)
+ or $ERROR .= p($DBH->errstr);
+
$TEMPLATE->param(UnreadPosts => $unread);
+ $TEMPLATE->param(NewPosts => $newposts);
$TEMPLATE->param(Tick => $TICK);
$TEMPLATE->param(isMember => (($TICK - $fleetupdate < 24) || isScanner()) && $PLANET && isMember());
$TEMPLATE->param(isHC => isHC());
$ND::TEMPLATE->param(Targets => listTargets());
}
$TEMPLATE->param(Coords => param('coords') ? param('coords') : '1:1:1');
+ my ($css) = $DBH->selectrow_array(q{SELECT css FROM users WHERE uid = $1},undef,$ND::UID);
+ $TEMPLATE->param(CSS => $css);
}
$TEMPLATE->param(Error => $ERROR);