forked from ffaadd-dk/visitationszone.dk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzone.php
More file actions
25 lines (24 loc) · 682 Bytes
/
Copy pathzone.php
File metadata and controls
25 lines (24 loc) · 682 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
<?
$dir = 'zones/';
$sdir = array_diff(scandir($dir), array('..', '.'));
natsort($sdir);
$features = array();
foreach($sdir as $file){
$data = file_get_contents($dir.$file, 0, null, null);
$json = json_decode($data);
if(isset($json->features[0])){
$json->features[0]->properties->filename = $file;
if(empty($_GET['authority']))
{
array_push($features, $json->features[0]);
}
elseif(isset($_GET['authority']) && $_GET['authority'] == $json->features[0]->properties->authority)
{
array_push($features, $json->features[0]);
}
}
}
$json->features = $features;
header('Content-Type: application/json');
echo json_encode($json);
?>