Ejemplo n.º 1
0
}
// Require the config
if (file_exists(__DIR__ . "/config/config.php")) {
    require_once __DIR__ . "/config/config.php";
} else {
    throw new Exception("config.php not found (you might wanna start by copying config_new.php)");
}
// Init Slim
$app = new \ProjectRena\RenaApp($config["slim"]);
// Session
$session = new SessionHandler();
session_set_save_handler($session, true);
session_cache_limiter(false);
session_start();
// Launch Whoops
$app->add(new WhoopsMiddleware());
// Load the translator
$translator = new \Symfony\Component\Translation\Translator("en_US", new \Symfony\Component\Translation\MessageSelector());
$translator->setFallbackLocales(array("en_US"));
$translator->addLoader("php", new \Symfony\Component\Translation\Loader\PhpFileLoader());
$languageFiles = glob(__DIR__ . "/lang/*.php");
foreach ($languageFiles as $langFile) {
    $translator->addResource("php", $langFile, str_replace(".php", "", basename($langFile)));
}
// Prepare view
$app->view(new Twig());
$app->view->parserExtensions = array(new \Slim\Views\TwigExtension(), new \Symfony\Bridge\Twig\Extension\TranslationExtension($translator));
$app->view->parserOptions = $config['twig'];
// Load the lib/Model loader
if (file_exists(__DIR__ . "/src/Loader.php")) {
    require_once __DIR__ . "/src/Loader.php";