-
Notifications
You must be signed in to change notification settings - Fork 0
/
api-direct.php
30 lines (26 loc) · 991 Bytes
/
api-direct.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
<?php
include_once "classes/classes.php";
try{
$result = Array();
if(isset($_GET['version']) $version = filter_var($_GET['version'], FILTER_SANITIZE_STRING);
if(isset($_GET['type']) $args['type'] = filter_var($_GET['type'], FILTER_SANITIZE_STRING);
if(isset($_GET['arg1']) $args['arg1'] = filter_var($_GET['arg1'], FILTER_SANITIZE_STRING);
if(isset($_GET['arg2']) $args['arg2'] = filter_var($_GET['arg2'], FILTER_SANITIZE_STRING);
if(isset($_GET['arg3']) $args['arg3'] = filter_var($_GET['arg3'], FILTER_SANITIZE_STRING);
switch($version){
case 1:
$controller = new APIController($args);
$result['data'] = $controller->execute();
$result['success'] = true;
break;
default:
throw new Exception("invalid version");
}
}catch (Exception $e){
$result = Array();
$result['success'] = false;
$result['errormsg'] = $e->getMessage();
}
echo json_encode($result);
exit;
?>