X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=calls.pl;h=c09b6067acdacf6b87bda1b9514f2d975ddb561e;hb=2a0730763283fb04dd842b4011b15da8ee9206c7;hp=ce708fc0df83aa37c90a9c33988111e3bb2bd815;hpb=87ea16a6c380092ec28438082de21d6ec14caa93;p=ndwebbie.git diff --git a/calls.pl b/calls.pl index ce708fc..c09b606 100644 --- a/calls.pl +++ b/calls.pl @@ -18,7 +18,7 @@ #**************************************************************************/ use strict; -use POSIX; +use warnings FATAL => 'all'; our $BODY; our $DBH; our $LOG; @@ -29,7 +29,7 @@ $ND::TEMPLATE->param(TITLE => 'Defense Calls'); die "You don't have access" unless isDC(); my $call; -if (param('call') =~ /^(\d+)$/){ +if (defined param('call') && param('call') =~ /^(\d+)$/){ my $query = $DBH->prepare(q{ SELECT c.id, coords(p.x,p.y,p.z), c.landing_tick, c.info, covered, open, dc.username AS dc, u.defense_points,c.member FROM calls c @@ -39,7 +39,7 @@ FROM calls c WHERE c.id = ?}); $call = $DBH->selectrow_hashref($query,undef,$1); } -if ($call){ +if ($call && defined param('cmd')){ if (param('cmd') eq 'Submit'){ $DBH->begin_work; if (param('ctick')){ @@ -160,7 +160,7 @@ WHERE i.call = ? ORDER BY p.x,p.y,p.z}); $attackers->execute($call->{id}); my @attackers; - my $i = 0; + $i = 0; while(my $attacker = $attackers->fetchrow_hashref){ $i++; $attacker->{ODD} = $i % 2; @@ -169,12 +169,14 @@ ORDER BY p.x,p.y,p.z}); $BODY->param(Attackers => \@attackers); }else{ my $where = 'open AND c.landing_tick-6 > tick()'; - if (param('show') eq 'covered'){ - $where = 'covered'; - }elsif (param('show') eq 'all'){ - $where = 'true'; - }elsif (param('show') eq 'uncovered'){ - $where = 'not covered'; + if (defined param('show')){ + if (param('show') eq 'covered'){ + $where = 'covered'; + }elsif (param('show') eq 'all'){ + $where = 'true'; + }elsif (param('show') eq 'uncovered'){ + $where = 'not covered'; + } } my $pointlimits = $DBH->prepare(q{SELECT value :: int FROM misc WHERE id = ?}); my ($minpoints) = $DBH->selectrow_array($pointlimits,undef,'DEFMIN');