Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (29 sloc) 955 Bytes
<?php
require_once('includes/inc.php');
if (!$_SESSION['login_string']) {
header("HTTP/1.0 401 Unauthorized");
exit();
}
session_write_close();
$CACHED = true;
if (isset($_GET['cached']) && ($_GET['cached'] == 'false' || $_GET['cached'] == 0)) {
$CACHED = false;
}
$GLOBALS['cached'] = $CACHED;
$type = (!empty($_GET['type']) ? $_GET['type'] : $_POST['type']);
$action = (!empty($_GET['action']) ? $_GET['action'] : $_POST['action']);
$type = str_replace(' ', '', lcfirst(ucwords(str_replace('-', ' ', strtolower($type)))));
$action = str_replace(' ', '', lcfirst(ucwords(str_replace('-', ' ', strtolower($action)))));
// If we're not posting, it's a get function
if (empty($_POST)) {
$action = 'get' . $action;
}
if (empty($type) || empty($action)) {
exit();
}
require_once('includes/autoloader.inc.php');
$obj = new $type();
$result = $obj->$action();
header('Content-Type: application/json');
echo json_encode($result);
?>
You can’t perform that action at this time.