-
Notifications
You must be signed in to change notification settings - Fork 1
/
ala.explore.group.php
47 lines (35 loc) · 1003 Bytes
/
ala.explore.group.php
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
44
45
46
47
<?php
require_once ('./bootstrap.php');
/**
* /ala.explore.groups.php?include=ala.details&bname=Acacia&lat=-34.928726&lon=138.59994&radius=5&dump=1
*/
/**
* Request > Validation, required params
*/
if (!isset($_GET['lon'])) {// longitude
\Api\View::out(400, 'Invalid parameters: `lon` required.');
}
if (!isset($_GET['lat'])) {// latitude
\Api\View::out(400, 'Invalid parameters: `lat` required.');
}
if (!isset($_GET['radius'])) {// latitude
\Api\View::out(400, 'Invalid parameters: `radius` required.');
}
$aggregator = new \Api\Aggregator();
$groups = new \Api\Ala\Explore\Group($_GET);
$aggregator->set('ala.explore.group', $groups);
/**
* Debug: Dump
*/
if (isset($request['dump']) && (int) $request['dump'] > 0) {
\Api\View::serviceHeaders('html');
dump(json_decode(json_encode($aggregator)));
print json_encode($aggregator, JSON_PRETTY_PRINT);
exit(1);
}
/**
* Default: Data
*/
\Api\View::serviceHeaders();
print json_encode($aggregator);
exit(1);