]> ruin.nu Git - ndwebbie.git/blobdiff - index.pl
nicer table in check
[ndwebbie.git] / index.pl
index abedcdfc83464c5e4247414554705069be8e50e9..c0ab40fde76d2dffdf92943ec947832f18ed214b 100755 (executable)
--- a/index.pl
+++ b/index.pl
@@ -23,18 +23,26 @@ use CGI qw/:standard/;
 use HTML::Template;
 use DBI;
 use DBD::Pg qw(:pg_types);
+#use Apache2::Request;
 use strict;
 
-my $cgi = new CGI;
+local $ND::DBH;
+local $ND::USER;
+local $ND::UID;
+local $ND::PLANET;
+local $ND::TEMPLATE;
+local $ND::BODY;
+local $ND::TICK;
+
 our $DBH = undef;
 our $USER = $ENV{'REMOTE_USER'};
-my $error;
+my $error;# = $ND::r->param('page');
 
 if ($ENV{'DOCUMENT_ROOT'} =~ m{((\w|/)+)}){
        chdir $1;
 }
 
-our $TEMPLATE = HTML::Template->new(filename => 'templates/skel.tmpl', global_vars => 1);
+our $TEMPLATE = HTML::Template->new(filename => 'templates/skel.tmpl', global_vars => 1, cache => 1);
 
 for my $file ("db.pl","include.pl"){
        unless (my $return = do $file){
@@ -64,7 +72,7 @@ while (my ($name,$attack,$gid) = $query->fetchrow()){
 our $LOG = $DBH->prepare('INSERT INTO log (uid,text) VALUES(?,?)');
 
 my $page = 'main';
-if (param('page') =~ /^(main|check|motd|points|covop|top100|launchConfirmation|addintel|defrequest|raids|editRaid|calls|intel|users|alliances|memberIntel|resources)$/){
+if (param('page') =~ /^(main|check|motd|points|covop|top100|launchConfirmation|addintel|defrequest|raids|editRaid|calls|intel|users|alliances|memberIntel|resources|planetNaps)$/){
        $page = $1;
 }
 
@@ -76,10 +84,10 @@ our $AJAX = 1;
 my $type = 'text/html';
 if ($XML){
        $type = 'text/xml';
-       $ND::TEMPLATE = HTML::Template->new(filename => "templates/xml.tmpl");
-       $ND::BODY = HTML::Template->new(filename => "templates/${page}.xml.tmpl");
+       $ND::TEMPLATE = HTML::Template->new(filename => "templates/xml.tmpl", cache => 1);
+       $ND::BODY = HTML::Template->new(filename => "templates/${page}.xml.tmpl", cache => 1);
 }else{
-       $ND::BODY = HTML::Template->new(filename => "templates/${page}.tmpl", global_vars => 1);
+       $ND::BODY = HTML::Template->new(filename => "templates/${page}.tmpl", global_vars => 1, cache => 1);
        $ND::BODY->param(PAGE => $page);
 }
 
@@ -124,4 +132,4 @@ $TICK = undef;
 undef %GROUPS;
 $ND::BODY = undef;
 
-exit;
+1;