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
33 lines (28 loc) · 895 Bytes
/
geojson.php
File metadata and controls
33 lines (28 loc) · 895 Bytes
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
<?php
if ( file_exists('../config.php') ) {
require_once("../config.php");
} else {
require_once("../../config.php");
}
require_once("locations.php");
$address = isset($_GET['address']) ? $_GET['address'] : false;
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 ) {
http_response_code(400);
$retval = array('error' => 'Address not found in the list of available locations',
'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");