X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=index.pl;h=abedcdfc83464c5e4247414554705069be8e50e9;hb=bb3ed008868592ef478d8432b86a39c293efae2d;hp=537f46fed29ab15cd2f93772da02c22d66f60c7a;hpb=0261522c27d089adb08a6055c2c9e9b41459dd6e;p=ndwebbie.git diff --git a/index.pl b/index.pl index 537f46f..abedcdf 100755 --- a/index.pl +++ b/index.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl -w -T #************************************************************************** # Copyright (C) 2006 by Michael Andreen * # * @@ -25,16 +25,16 @@ use DBI; use DBD::Pg qw(:pg_types); use strict; - my $cgi = new CGI; - -chdir $ENV{'DOCUMENT_ROOT'}; - our $DBH = undef; our $USER = $ENV{'REMOTE_USER'}; my $error; -our $TEMPLATE = HTML::Template->new(filename => 'templates/skel.tmpl'); +if ($ENV{'DOCUMENT_ROOT'} =~ m{((\w|/)+)}){ + chdir $1; +} + +our $TEMPLATE = HTML::Template->new(filename => 'templates/skel.tmpl', global_vars => 1); for my $file ("db.pl","include.pl"){ unless (my $return = do $file){ @@ -71,13 +71,16 @@ if (param('page') =~ /^(main|check|motd|points|covop|top100|launchConfirmation|a our $XML = 0; $XML = 1 if param('xml') and $page =~ /^(raids)$/; +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"); }else{ - $ND::BODY = HTML::Template->new(filename => "templates/${page}.tmpl"); + $ND::BODY = HTML::Template->new(filename => "templates/${page}.tmpl", global_vars => 1); + $ND::BODY->param(PAGE => $page); } @@ -118,7 +121,7 @@ $USER = undef; $PLANET = undef; $TEMPLATE = undef; $TICK = undef; -%GROUPS = undef; +undef %GROUPS; $ND::BODY = undef; exit;