forked from csev/py4e
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeojson.php
More file actions
43 lines (37 loc) · 1.01 KB
/
geojson.php
File metadata and controls
43 lines (37 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
if ( file_exists('../config.php') ) {
require_once("../config.php");
} else {
require_once("../../config.php");
}
require_once("locations.php");
$address = false;
if ( isset($_GET['address']) ) {
$address = $_GET['address'];
}
if ( isset($_GET['query']) ) {
$address = $_GET['query'];
}
header('Content-Type: application/json; charset=utf-8');
if ( $address === false ) {
sort($LOCATIONS);
echo(\Tsugi\Util\LTI::jsonIndent(json_encode($LOCATIONS)));
return;
}
$where = array_search($address, $LOCATIONS);
if ( $where === false ) {
$retval = array(
'error' => 'Address not found in the list of available locations',
'results' => array(),
'status' => 'ZERO_RESULTS',
'locations' => $LOCATIONS
);
echo(\Tsugi\Util\LTI::jsonIndent(json_encode($retval)));
return;
}
// Check to see if we already have this in the variable
if ( $GEODATA !== false ) {
echo($GEODATA[$address]);
return;
}
lmsDie("DIE: Data failure - please contact the instructor");