コード例 #1
0
ファイル: index.php プロジェクト: NetworkCedu/saigon
//
// Copyright (c) 2013, Zynga Inc.
// https://github.com/zynga/saigon
// Author: Matt West (https://github.com/mhwest13)
// License: BSD 2-Clause
//
/*
 * Saigon API - Index
 */
// Lets load up the composer autoloader
require_once dirname(dirname(__FILE__)) . '/conf/saigon.inc.php';
require_once BASE_PATH . '/vendor/autoload.php';
// Lets load up the saigon autoloader
require_once BASE_PATH . '/lib/classLoader.class.php';
Saigon_ClassLoader::register();
// Lets start up Slim...
$app = new \Slim\Slim();
\Slim\Route::setDefaultConditions(array('deployment' => '[a-zA-Z0-9_-]{1,}', 'staged' => '[1]', 'merged' => '[1]'));
// Internal functions
function check_auth($app, $deployment)
{
    $amodule = AUTH_MODULE;
    $authmodule = new $amodule();
    $return = $authmodule->checkAuth($deployment);
    if ($return === false) {
        $apiResponse = new APIViewData(1, $deployment, "Invalid Login or Invalid Credentials Supplied");
        $app->halt(401, $apiResponse->returnJson());
    }
    return true;
}