X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=memberIntel.pl;h=66e0dcd7b70f00be6e2f8cde8b8a345dfb3be91e;hb=1cb9216d9579051c654e339ed88848f5a45ef12c;hp=98d6738f0532122d7a291c489aae6ece6667ee62;hpb=5af89dd22a075c6652b779ef471bf21cb9965cb6;p=ndwebbie.git diff --git a/memberIntel.pl b/memberIntel.pl index 98d6738..66e0dcd 100644 --- a/memberIntel.pl +++ b/memberIntel.pl @@ -18,10 +18,9 @@ #**************************************************************************/ use strict; -use POSIX; +use warnings FATAL => 'all'; our $BODY; our $DBH; -our $LOG; my $error; $ND::TEMPLATE->param(TITLE => 'Member Intel'); @@ -29,17 +28,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}){ @@ -47,27 +48,27 @@ while (my $intel = $query->fetchrow_hashref){ }else{ $intel->{missionclass} = $intel->{mission}; } - $intel->{ODD} = $i % 2; - push @intel,$intel; $i++; + $intel->{ODD} = $i % 2; + 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'; }else{ $intel->{missionclass} = $intel->{mission}; } - $intel->{ODD} = $i % 2; - push @intel,$intel; $i++; + $intel->{ODD} = $i % 2; + 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);