-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathindex.php
40 lines (38 loc) · 1.5 KB
/
index.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
<?php
//Include lib Requests
require_once 'lib/Requests.php';
Requests::register_autoloader();
// This is required for including configs and functions. Sorry, bad code :D
define("_KATE_MAIN", true);
include_once("config/config.php");
include_once($global_path."include/function.php");
// We don't want errors to block our app from displaying info
error_reporting(0);
$requestParams = request_compose();
$url = $requestParams['httpScheme'] . '://' . $requestParams['httpHost'] . $requestParams['requestPath'];
if($requestParams['requestPath'] == '/') {
// Index
header("Location: admin.php");
}elseif($requestParams['requestPath'] == '/openapi-gateway-app/live/radios') {
// Radio search request
include($global_path . 'include/api/radiosearch.php');
} elseif($requestParams['requestPath'] == '/openapi-gateway-app/live/get_radios_by_ids') {
// Radio list by ids
include($global_path . 'include/api/get_radios_by_ids.php');
} else {
// Requests which we don't intercept
/*
if($requestParams['method'] == 'GET') {
$url = 'http' . $url . '?' . $requestParams['paramsString'];
echo $url;
$response = Requests::get($url);
} else {
$response = Requests::post($url, array(), $requestParams['params']);
}
echo $response->body;
*/ echo "error";
// Logging unknown/untracked requests
//addlog($url); // URL composed by our wrapper
//addlog($requestParams['requestPath']); // API path
//addlog($response->body); // Response from API
}