Beispiel #1
0
<?php

/**
 * PHP Settings
 */
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_NOTICE);
require 'instance.php';
/**
 * Authentication setup
 */
use Colorium\Stateful\Auth;
use Pictobox\Model\User;
Auth::factory(function ($id) {
    return User::one(['id' => $id]);
});
/**
 * Debug mode
 */
use Colorium\Http;
$request = Http\Request::globals();
$request->local[] = '10.0.2.2';
if ($request->local()) {
    $app->catch = false;
    $handler = new Whoops\Handler\PrettyPageHandler();
    $handler->addDataTableCallback('App Request', function () use($request) {
        return (array) $request;
    });
    $whoops = new Whoops\Run();
    $whoops->pushHandler($handler)->register();
Beispiel #2
0
<?php

/**
 * Database setup
 */
use Colorium\Orm;
use App\Model\User;
$sqlite = new Orm\SQLite(__DIR__ . '/database.db', ['user' => User::class]);
Orm\Hub::source($sqlite);
/**
 * Authentication setup
 * Define user factory when login in
 */
use Colorium\Stateful\Auth;
Auth::factory(function ($ref) {
    return User::one(['id' => $ref]);
});
/**
 * Template setup
 */
use Colorium\Templating\Templater;
$templater = new Templater(__DIR__ . '/views/');
/**
 * Router setup
 */
use Colorium\Routing\Router;
$router = new Router(['GET  /login' => 'App\\Logic\\Users::login', 'POST /authenticate' => 'App\\Logic\\Users::authenticate', 'GET  /logout' => 'App\\Logic\\Users::logout', 'GET  /' => 'App\\Logic\\Home::page']);
/**
 * App instance
 */
$app = new Colorium\App\Front($router, $templater);