예제 #1
0
<?php

/* Duplicate the sample config file and rename it as app_config.php.
 If you don't sample config file will be used.
*/
if (file_exists(dirname(__DIR__) . '/app_config.php')) {
    require_once dirname(__DIR__) . '/app_config.php';
} else {
    require_once dirname(__DIR__) . '/app_config.sample.php';
}
require_once $config['base_dir'] . '/vendor/autoload.php';
session_start();
$api_key = isset($_SERVER['HTTP_X_API_KEY']) ? $_SERVER['HTTP_X_API_KEY'] : '';
$api_secret = isset($_SERVER['HTTP_X_API_SECRET']) ? $_SERVER['HTTP_X_API_SECRET'] : '';
$RSlim = new \RSlim\RSlim($config);
if ($api_key != $config['api_key'] || $api_secret != $config['api_secret']) {
    $RSlim->register('get', '/', 'upload/unauthorized', 'json');
    $RSlim->register('post', '/upload/base64/{bucket}', 'upload/unauthorized', 'json');
    $RSlim->register('post', '/upload/file/{bucket}', 'upload/unauthorized', 'json');
} else {
    $RSlim->register('get', '/', 'upload/api_status', 'json');
    $RSlim->register('post', '/upload/base64/{bucket}', 'upload/base64', 'json');
    $RSlim->register('post', '/upload/file/{bucket}', 'upload/file', 'json');
}
$RSlim->run();
예제 #2
0
파일: index.php 프로젝트: reformo/rslim
<?php

require_once dirname(__DIR__) . '/app_config.php';
require_once $config['base_dir'] . '/lib/vendor/autoload.php';
/*
    DB/CACHE CONNECTIONS, SESSION SETTINGS, ETC CAN BE SET AND DONE HERE
*/
session_start();
$RSlim = new \RSlim\RSlim($config);
/*
 $RSlim->register($request_method, $route, $controller, $return_type);
*/
$RSlim->register("get", '/', 'app/main');
$RSlim->register("get", "/hello", "app/hello");
$RSlim->register("post", "/hello", "app/hello_post");
$RSlim->register("get", "/hello/{name}", "app/hello_name", "json");
$RSlim->run();
예제 #3
0
파일: index.php 프로젝트: mkorkmaz/elastico
<?php

if (file_exists(dirname(__DIR__) . '/app_config.php')) {
    require_once dirname(__DIR__) . '/app_config.php';
} else {
    require_once dirname(__DIR__) . '/app_config.sample.php';
}
require_once $config['base_dir'] . '/vendor/autoload.php';
define('BASE_HREF', $config['base_url']);
session_start();
if (isset($_GET['ES_SERVER'])) {
    $_SESSION['ES_SERVER'] = $_GET['ES_SERVER'];
}
if (isset($_SESSION['ES_SERVER'])) {
    $config['es_server'] = $_SESSION['ES_SERVER'];
}
$esConn = \Elasticsearch\ClientBuilder::create()->setHosts([$config['es_server']])->build();
$RSlim = new \RSlim\RSlim($config);
$RSlim->register('get', '/', 'es/root');
$RSlim->register('get', '/{index}/{type}', 'es/type');
$RSlim->register('get', '/delete/{index}/{type}/{id}', 'es/doc_delete', 'json');
$RSlim->run();