Exemplo n.º 1
0
<?php

$_SERVER['backend_start'] = microtime(true);
include __DIR__ . '/backend/include/all.php';
allow_origin(['webkameleon.com', 'ecco', 'fly']);
autoload([__DIR__ . '/classes', __DIR__ . '/controllers', __DIR__ . '/models']);
$config = json_config(__DIR__ . '/config/application.json');
$method = http_method();
if (in_array(strtolower(ini_get('magic_quotes_gpc')), array('1', 'on'))) {
    $_POST = array_map('stripslashes', $_POST);
    $_GET = array_map('stripslashes', $_GET);
    $_COOKIE = array_map('stripslashes', $_COOKIE);
    ini_set('magic_quotes_gpc', 0);
}
ini_set('display_errors', 1);
$bootstrap = new Bootstrap($config);
$result = $bootstrap->run(strtolower($method));
Exemplo n.º 2
0
 * 		size => 1234,
 * 		...
 * 	},
 * 	{ ... }
 * ]
 */
if (!empty($_FILES)) {
    $files = new \Sauce\Vector();
    foreach ($_FILES as $field => $uploads) {
        $keys = array_keys($uploads);
        $count = count($uploads[$keys[0]]);
        $obj = new \Sauce\Object();
        if (!is_array($keys[0])) {
            foreach ($keys as $key) {
                $obj->{$key} = $uploads[$key];
            }
        } else {
            for ($i = 0; $i < $count; $i++) {
                foreach ($keys as $key) {
                    $obj->{$key} = $uploads[$key][$i];
                }
                $obj->field = $field;
            }
        }
        $files->push($obj);
    }
    $params->files = $files;
}
$app = new \Bacon\App($config->app, $session, $log, $params, $env, $authcookie);
$app->prepare(path_info(), http_method());
$app->run();