Exemple #1
0
define('API_DIR', BASE_DIR . 'api' . DIRECTORY_SEPARATOR);
define('MODULES_DIR', BASE_DIR . 'modules' . DIRECTORY_SEPARATOR);
define('VIEWS_DIR', BASE_DIR . 'views' . DIRECTORY_SEPARATOR);
define('LOCALES_DIR', BASE_DIR . 'locales' . DIRECTORY_SEPARATOR);
require INC_DIR . 'Exceptions.php';
require INC_DIR . 'Val.php';
require INC_DIR . 'Config.php';
require INC_DIR . 'Localizer.php';
require INC_DIR . 'Router.php';
require INC_DIR . 'ControllerDispatcher.php';
Config::load(CONFIG_DIR . 'cfg.json');
$baseUrl = Config::get('baseurl');
if (!$baseUrl) {
    throw new \Exception('Invalid configuration. Missing "baseurl" definition.');
}
Localizer::load(LOCALES_DIR);
Router::init($baseUrl);
/* Setup propel
---------------------------------------------*/
set_include_path(get_include_path() . PATH_SEPARATOR . ENTITIES_CLASSES_DIR . LIB_DIR . PATH_SEPARATOR . BASE_DIR . PATH_SEPARATOR);
require_once LIB_DIR . '/propel/runtime/lib/Propel.php';
try {
    \Propel::init(ENTITIES_DIR . 'build' . DIRECTORY_SEPARATOR . 'conf' . DIRECTORY_SEPARATOR . PROJECT_NAME . '-conf.php');
    \Propel::getDB()->setCharset(\Propel::getConnection(), 'UTF8');
    \Transaction::initAmounts(Config::get('amounts', TYPE_ARRAY), Config::get('member_fee', TYPE_FLOAT), Config::get('base_currency'));
} catch (\Exception $e) {
    // Do NOT output stacktrace because it holds the plain pg password.
    echo $e->getMessage();
    error_log($e->__toString());
    exit;
}