X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=intel.pl;h=e5ce1e071fe24b7eb51ae1fde9987bce1c4ebef4;hb=03830799201db0b0f28e9c494fdd1b5b5143749c;hp=9ab58647886fe7045962dea1933b8f029cdd3b46;hpb=3fbdd3816ab065ed3ac2b5f77e7617b2c09ea00c;p=ndwebbie.git diff --git a/intel.pl b/intel.pl index 9ab5864..e5ce1e0 100644 --- a/intel.pl +++ b/intel.pl @@ -20,6 +20,7 @@ use strict; use warnings FATAL => 'all'; use ND::Web::Forum; +use ND::Include; our $BODY; our $DBH; @@ -32,9 +33,9 @@ die "You don't have access" unless isIntel() || isHC(); my $planet; if (defined param('coords') && param('coords') =~ /^(\d+)(?: |:)(\d+)(?: |:)(\d+)$/){ - my $query = $DBH->prepare(q{SELECT x,y,z,coords(x,y,z),id, nick, alliance,alliance_id, planet_status,channel FROM current_planet_stats + my $query = $DBH->prepare(q{SELECT x,y,z,coords(x,y,z),id, nick, alliance,alliance_id, planet_status,channel,ftid FROM current_planet_stats WHERE x = ? AND y = ? AND z = ?}); - $planet = $DBH->selectrow_hashref($query,undef,$1,$2,$3); + $planet = $DBH->selectrow_hashref($query,undef,$1,$2,$3) or $ND::ERROR .= p $DBH->errstr; } my $showticks = 'AND (i.tick - i.eta) > (tick() - 48)'; @@ -49,7 +50,7 @@ if (defined param('show')){ my $thread; if (defined $planet){ $thread = $DBH->selectrow_hashref(q{SELECT ftid AS id, subject FROM forum_threads - where planet = $1},undef,$planet->{id}) or $ERROR .= p($DBH->errstr); + where ftid = $1},undef,$planet->{ftid}) or $ERROR .= p($DBH->errstr); } if (defined param('cmd') && param('cmd') eq 'coords'){ @@ -85,6 +86,7 @@ if ($planet && defined param('cmd')){ my $value = escapeHTML(param('nick')); if ($DBH->do(q{UPDATE planets SET nick = ? WHERE id =?} ,undef,$value,$planet->{id})){ + intel_log $ND::UID,$planet->{id},"Set nick to: $value"; $planet->{nick} = $value; }else{ $error .= "

Something went wrong: ".$DBH->errstr."

"; @@ -94,6 +96,7 @@ if ($planet && defined param('cmd')){ my $value = escapeHTML(param('channel')); if ($DBH->do(q{UPDATE planets SET channel = ? WHERE id =?} ,undef,$value,$planet->{id})){ + intel_log $ND::UID,$planet->{id},"Set channel to: $value"; $planet->{channel} = $value; }else{ $error .= "

Something went wrong: ".$DBH->errstr."

"; @@ -103,6 +106,7 @@ if ($planet && defined param('cmd')){ my $value = escapeHTML(param('status')); if ($DBH->do(q{UPDATE planets SET planet_status = ? WHERE id =?} ,undef,$value,$planet->{id})){ + intel_log $ND::UID,$planet->{id},"Set planet_status to: $value"; $planet->{planet_status} = $value; }else{ $error .= "

Something went wrong: ".$DBH->errstr."

"; @@ -111,6 +115,7 @@ if ($planet && defined param('cmd')){ if (param('calliance')){ if ($DBH->do(q{UPDATE planets SET alliance_id = NULLIF(?,-1) WHERE id =?} ,undef,param('alliance'),$planet->{id})){ + intel_log $ND::UID,$planet->{id},"Set alliance_id to: ".param('alliance'); $planet->{alliance_id} = param('alliance'); }else{ $error .= "

Something went wrong: ".$DBH->errstr."

";