-
Notifications
You must be signed in to change notification settings - Fork 0
/
requestHandler.php
35 lines (25 loc) · 960 Bytes
/
requestHandler.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
<?php
/** @var \STPH\addressAutoComplete\addressAutoComplete $module */
if ($_REQUEST['action'] == 'mapResults') {
if(empty($_POST["source"]) || empty($_POST["results"])) {
header("HTTP/1.1 400 Bad Request");
die("results or source missing!");
}
$source = htmlentities($_POST["source"], ENT_QUOTES);
$results = json_decode($_POST["results"]);
$module->mapResults($source, $results);
}
else if($_REQUEST['action'] == 'getConfigDescription') {
if(empty($_POST["pid"]) || empty($_POST["source"])) {
header("HTTP/1.1 400 Bad Request");
die("pid or source missing!");
}
$pid = htmlentities($_POST["pid"], ENT_QUOTES);
$source = htmlentities($_POST["source"], ENT_QUOTES);
$module->getConfigDescription($pid,$source);
}
else {
header("HTTP/1.1 400 Bad Request");
header('Content-Type: application/json; charset=UTF-8');
die("The action does not exist.");
}