X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=index.pl;h=3d324604456016bccdcc95d625e41f59b03482e3;hb=75a59d56e110b1170efdb18ec629ca885026176c;hp=e1067c4f436bc4dc3615e3bc9bb31772f94cd8fb;hpb=8d1ec9372fa9786009022fca3503ef3c79974f3e;p=ndwebbie.git diff --git a/index.pl b/index.pl index e1067c4..3d32460 100755 --- a/index.pl +++ b/index.pl @@ -32,14 +32,15 @@ chdir $ENV{'DOCUMENT_ROOT'}; our $DBH = undef; our $USER = $ENV{'REMOTE_USER'}; +my $error; our $TEMPLATE = HTML::Template->new(filename => 'templates/skel.tmpl'); for my $file ("db.pl","include.pl"){ unless (my $return = do $file){ - warn "couldn't parse $file: $@" if $@; - warn "couldn't do $file: $!" unless defined $return; - warn "couldn't run $file" unless $return; + print "couldn't parse $file: $@" if $@; + print "couldn't do $file: $!" unless defined $return; + print "couldn't run $file" unless $return; } } @@ -63,13 +64,15 @@ 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)$/){ +if (param('page') =~ /^(main|check|motd|points|covop|top100|launchConfirmation|addintel|defrequest|raids|editRaid|calls|intel|users|alliances|memberIntel|resources)$/){ $page = $1; } our $XML = 0; $XML = 1 if param('xml') and $page =~ /^(raids)$/; +our $AJAX = 1; + my $type = 'text/html'; if ($XML){ $type = 'text/xml'; @@ -81,23 +84,27 @@ if ($XML){ unless (my $return = do "${page}.pl"){ - print "

couldn't parse $page: $@

" if $@; - print "

couldn't do $page: $!

" unless defined $return; - print "

couldn't run $page

" unless $return; + $error .= "

couldn't parse $page: $@

" if $@; + $error .= "

couldn't do $page: $!

" unless defined $return; + $error .= "

couldn't run $page

" unless $return; } unless ($XML){ my $fleetupdate = $DBH->selectrow_array('SELECT landing_tick FROM fleets WHERE uid = ? AND fleet = 0',undef,$UID); + $TEMPLATE->param(Tick => $TICK); $TEMPLATE->param(isMember => (($TICK - $fleetupdate < 24) || isScanner()) && $PLANET && isMember()); $TEMPLATE->param(isHC => isHC()); $TEMPLATE->param(isDC => isDC()); $TEMPLATE->param(isBC => isBC()); + $TEMPLATE->param(isIntel => isBC()); $TEMPLATE->param(isAttacker => $ATTACKER && (!isMember() || ((($TICK - $fleetupdate < 24) || isScanner()) && $PLANET))); if ($ATTACKER && (!isMember() || ((($TICK - $fleetupdate < 24) || isScanner()) && $PLANET))){ $ND::TEMPLATE->param(Targets => listTargets()); } + $TEMPLATE->param(Coords => param('coords') ? param('coords') : '1:1:1'); + $TEMPLATE->param(Error => $error); } $ND::TEMPLATE->param(BODY => $ND::BODY->output);