]> ruin.nu Git - ndwebbie.git/blobdiff - memberIntel.pl
nicer output
[ndwebbie.git] / memberIntel.pl
index db7c939f66f25f6071ac12ae33102ca4e4a62c24..61423242f660bc466f849c3f5ebe0cdeea8463f6 100644 (file)
@@ -18,7 +18,7 @@
 #**************************************************************************/
 
 use strict;
-use POSIX;
+use warnings FATAL => 'all';
 our $BODY;
 our $DBH;
 our $LOG;
@@ -29,17 +29,19 @@ $ND::TEMPLATE->param(TITLE => 'Member Intel');
 die "You don't have access" unless isHC();
 
 my $showticks = 'AND i.tick > tick()';
-if (param('show') eq 'all'){
-       $showticks = '';
-}elsif (param('show') =~ /^(\d+)$/){
-       $showticks = "AND (i.tick - i.eta) > (tick() - $1)";
+if (defined param('show')){
+       if (param('show') eq 'all'){
+               $showticks = '';
+       }elsif (param('show') =~ /^(\d+)$/){
+               $showticks = "AND (i.tick - i.eta) > (tick() - $1)";
+       }
 }
 
 
 my $query = $DBH->prepare(intelquery('o.alliance AS oalliance,coords(o.x,o.y,o.z) AS origin, coords(t.x,t.y,t.z) AS target, t.nick',"t.alliance_id = 1 $showticks"));
 $query->execute() or $error .= $DBH->errstr;
 my @intellists;
-my @intel;
+my @incomings;
 my $i = 0;
 while (my $intel = $query->fetchrow_hashref){
        if ($intel->{ingal}){
@@ -49,14 +51,14 @@ while (my $intel = $query->fetchrow_hashref){
        }
        $i++;
        $intel->{ODD} = $i % 2;
-       push @intel,$intel;
+       push @incomings,$intel;
 }
-push @intellists,{Message => 'Incoming fleets', Intel => \@intel, Origin => 1};
+push @intellists,{Message => 'Incoming fleets', Intel => \@incomings, Origin => 1};
 
-my $query = $DBH->prepare(intelquery('o.nick,coords(o.x,o.y,o.z) AS origin,t.alliance AS talliance,coords(t.x,t.y,t.z) AS target',"o.alliance_id = 1 $showticks"));
+$query = $DBH->prepare(intelquery('o.nick,coords(o.x,o.y,o.z) AS origin,t.alliance AS talliance,coords(t.x,t.y,t.z) AS target',"o.alliance_id = 1 $showticks"));
 $query->execute() or $error .= $DBH->errstr;
-my @intel;
-my $i = 0;
+my @outgoings;
+$i = 0;
 while (my $intel = $query->fetchrow_hashref){
        if ($intel->{ingal}){
                $intel->{missionclass} = 'ingal';
@@ -65,9 +67,9 @@ while (my $intel = $query->fetchrow_hashref){
        }
        $i++;
        $intel->{ODD} = $i % 2;
-       push @intel,$intel;
+       push @outgoings,$intel;
 }
-push @intellists,{Message => 'Outgoing Fleets', Intel => \@intel, Target => 1};
+push @intellists,{Message => 'Outgoing Fleets', Intel => \@outgoings, Target => 1};
 
 $BODY->param(IntelLIsts => \@intellists);