Beispiel #1
0
<?php

session_cache_limiter(false);
session_start();
ob_start();
ini_set('display_errors', 'On');
define('INC_ROOT', dirname(__DIR__));
require INC_ROOT . '/vendor/autoload.php';
$app = new Slim\Slim(['mode' => file_get_contents(INC_ROOT . '/app/config/env/mode.php'), 'view' => new Slim\Views\Twig(), 'templates.path' => INC_ROOT . '/views/']);
$app->add(new BuiSoft\Middleware\BeforeMiddleware());
$app->configureMode($app->config('mode'), function () use($app) {
    $app->config = Noodlehaus\Config::load(INC_ROOT . "/app/config/env/{$app->mode}.php");
});
require INC_ROOT . '/app/config/database.php';
require INC_ROOT . '/app/filters/authentication.php';
require INC_ROOT . '/app/config/api.php';
require INC_ROOT . '/app/config/routes.php';
require INC_ROOT . '/app/config/queue.php';
require INC_ROOT . '/app/config/session.php';
require INC_ROOT . '/app/config/cache.php';
require INC_ROOT . '/app/config/languages.php';
require INC_ROOT . '/app/config/app.php';
$view = $app->view();
$view->parserOptions = ['debug' => $app->config->get('twig.debug')];
$view->parserExtensions = [new Slim\Views\TwigExtension()];
Beispiel #2
0
<?php

$app->auth = false;
//TODO Autoset the language given IP Address, Previous Visit, User Settings
$app->lang = Noodlehaus\Config::load(INC_ROOT . "/app/languages/en/defaults.php");
$app->container->set('hash', function () use($app) {
    //return new BuiSoft\Helpers\Hash($app->config);
});
require_once INC_ROOT . "/app/WOB/Courses/Course.php";
use WOB\Courses\Course;
$app->container->set('course', function () use($app) {
    return new Course();
});
$app->container->singleton('mail', function () use($app) {
    $mailer = new PHPMailer();
    $mailer->Host = $app->config->get('mail.host');
    $mailer->SMTPAuth = $app->config->get('mail.smtp_auth');
    $mailer->SMTPSecure = $app->config->get('mail.smtp_secure');
    $mailer->Port = $app->config->get('mail.port');
    $mailer->Username = $app->config->get('mail.username');
    $mailer->Password = $app->config->get('mail.password');
    $mailer->isHTML($app->config->get('mail.html'));
    return new BuiSoft\Mail\Mailer($mailer, $app->view);
});
$app->container->singleton('randomlib', function () {
    $factory = new RandomLib\Factory();
    return $factory->getMediumStrengthGenerator();
});