Exemplo n.º 1
0
$p->load(10693);
$da = $p->getDefaultAssumptions();
print_r($da);
exit;
$c->setMode('SHELL');
// Define Options
$short = 'p:';
// Script Path
$short .= 'a:';
// Authorized User ID
$short .= 'r:';
// Request Parameters
$opt = getopt($short, array());
// Assign Path
if (!isset($opt['p'])) {
    echo "-p PATH REQUIRED\n";
    exit;
} else {
    $c->setPath(explode('/', $opt['p']));
}
// Assign Request Parameters
if (isset($opt['r'])) {
    $r = array();
    parse_str($opt['r'], $r);
    if (is_array($r)) {
        $c->setParams($r);
    }
}
// Run
$c->run();
exit;
Exemplo n.º 2
0
// Opens Up AJAX Calls
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS' && isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
    header('Access-Control-Allow-Origin: *');
    header('Access-Control-Allow-Headers: X-Requested-With');
    exit;
}
//else {
//    header('Access-Control-Allow-Origin: *');
//    header('Content-Type: application/json');
//}
$c = new Controller();
$d = json_decode(file_get_contents('php://input'), true);
switch ($_SERVER['REQUEST_METHOD']) {
    case 'GET':
        $c->setMode('GET');
        $c->setParams($_GET);
        break;
    case 'POST':
        $c->setMode('POST');
        if (is_array($d)) {
            $c->setParams($d);
        } else {
            $c->setParams($_POST);
        }
        break;
    case 'DELETE':
        $c->setMode('DELETE');
        $c->setParams($_REQUEST);
        break;
    case 'PUT':
        $c->setMode('PUT');