X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;ds=sidebyside;f=lib%2FNDWeb%2FController%2FIntel.pm;h=fd844725a0b407eec6ab3f0c7ef69f0eb49f4168;hb=a399becb6b6f5178faa2197c37b369ecbf3a9248;hp=55f6643ee057f789e51746bff47427703bc32f15;hpb=ae3584eafcf3b109119ed28e6a7c6d873ca6ec2c;p=ndwebbie.git diff --git a/lib/NDWeb/Controller/Intel.pm b/lib/NDWeb/Controller/Intel.pm index 55f6643..fd84472 100644 --- a/lib/NDWeb/Controller/Intel.pm +++ b/lib/NDWeb/Controller/Intel.pm @@ -159,11 +159,24 @@ sub find : Local { my $dbh = $c->model; local $_ = $find || $c->req->param('coords'); + $c->stash(searchterm => $_); if (/(\d+)(?: |:)(\d+)(?: |:)(\d+)(?:(?: |:)(\d+))?/){ my $planet = $dbh->selectrow_array(q{SELECT planetid($1,$2,$3,$4)} ,undef,$1,$2,$3,$4); $c->res->redirect($c->uri_for('planet',$planet)); + }else{ + my $query = $dbh->prepare(q{SELECT id,coords(x,y,z),nick + FROM current_planet_stats p + WHERE nick ilike $1 + }); + $query->execute($_); + my $planets = $query->fetchall_arrayref({}); + if (@{$planets} == 1){ + $c->res->redirect($c->uri_for('planet',$planets->[0]->{id})); + }else{ + $c->stash(planets => $planets); + } } }