Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Contents of /trunk/web/www/routino/results.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 629 - (show annotations) (download)
Fri Feb 11 10:12:14 2011 UTC (14 years, 1 month ago) by amb
File size: 1824 byte(s)
Print a message if routed OK, allow web users to see router output (now logged
to file).

1 #!/usr/bin/perl
2 #
3 # Routino router results retrieval CGI
4 #
5 # Part of the Routino routing software.
6 #
7 # This file Copyright 2008-2011 Andrew M. Bishop
8 #
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.
13 #
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.
18 #
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/>.
21 #
22
23 # Use the directory paths script
24 require "paths.pl";
25
26 # Use the generic router script
27 require "router.pl";
28
29 # Use the perl CGI module
30 use CGI ':cgi';
31
32 # Create the query and get the parameters
33
34 $query=new CGI;
35
36 @rawparams=$query->param;
37
38 # Legal CGI parameters with regexp validity check
39
40 %legalparams=(
41 "type" => "(shortest|quickest|router)",
42 "format" => "(html|gpx-route|gpx-track|text|text-all|log)",
43
44 "uuid" => "[0-9a-f]{32}"
45 );
46
47 # Validate the CGI parameters, ignore invalid ones
48
49 foreach $key (@rawparams)
50 {
51 foreach $test (keys (%legalparams))
52 {
53 if($key =~ m%^$test$%)
54 {
55 $value=$query->param($key);
56
57 if($value =~ m%^$legalparams{$test}$%)
58 {
59 $cgiparams{$key}=$value;
60 last;
61 }
62 }
63 }
64 }
65
66 # Parse the parameters
67
68 $uuid =$cgiparams{"uuid"};
69 $type =$cgiparams{"type"};
70 $format=$cgiparams{"format"};
71
72 # Return the file
73
74 ReturnOutput($uuid,$type,$format);

Properties

Name Value
svn:executable *