3 # Routino data visualiser custom link CGI
5 # Part of the Routino routing software.
7 # This file Copyright 2008,2009 Andrew M. Bishop
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU Affero General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU Affero General Public License for more details.
19 # You should have received a copy of the GNU Affero General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # Use the perl CGI module
26 # Create the query and get the parameters
30 @rawparams=$query->param;
32 # Legal CGI parameters with regexp validity check
40 # Validate the CGI parameters, ignore invalid ones
42 foreach $key (@rawparams)
44 foreach $test (keys (%legalparams))
46 if($key =~ m%^$test$%)
48 $value=$query->param($key);
50 if($value =~ m%^$legalparams{$test}$%)
52 $cgiparams{$key}=$value;
59 # Open template file and output it
61 open(TEMPLATE,"<visualiser.html");
63 # Parse the template and fill in the parameters
65 print header('text/html');
71 s/'lat'/$cgiparams{'lat'}/ if(defined $cgiparams{'lat'});
72 s/'lon'/$cgiparams{'lon'}/ if(defined $cgiparams{'lon'});
73 s/'zoom'/$cgiparams{'zoom'}/ if(defined $cgiparams{'zoom'});