コード例 #1
0
ファイル: Slim.php プロジェクト: datado/slim
 public static function attach(App $slim)
 {
     $slimBS = new Slim();
     // Find options
     foreach (func_get_args() as $option) {
         if (is_int($option)) {
             $slimBS->flag($option);
         }
     }
     foreach (func_get_args() as $arg) {
         if ($arg instanceof Repository) {
             $slimBS->bootStrap($slim, $arg);
         }
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: bobvdvalk/scaling-happiness
<?php

/**
 * Created by IntelliJ IDEA.
 * User: Bob
 * Date: 29-1-2016
 * Time: 01:29
 */
require_once "vendor/autoload.php";
use DataDo\Data\Repository;
use Mawoo\Security\DataDoTokenHandlerImpl;
use Mawoo\Security\DataDoWhitelistImpl;
use Mawoo\Security\Security;
use Mawoo\Security\ShaTokenGenerator;
// Setting up
$setup = new \Mawoo\Config\Setup();
$pdo = new PDO('mysql:host=' . $setup->host . ';dbname=' . $setup->db, $setup->user, $setup->pass);
// Repo's
$ticket = new Repository(\Mawoo\Models\Ticket::class, $pdo, 'id');
$client = new Repository(\Mawoo\Models\Client::class, $pdo, 'client_id');
$admin = new Repository(\Mawoo\Models\Admin::class, $pdo, 'id');
$configuration = ['settings' => ['displayErrorDetails' => true]];
$c = new \Slim\Container($configuration);
$app = new \Slim\App($c);
\DataDo\Slim::attach($app, $ticket, $client, $admin, \DataDo\Slim::CHECK_PAGE);
$token_generator = new ShaTokenGenerator($setup->encrypt_key);
$token_handler = new DataDoTokenHandlerImpl(Mawoo\Security\DataDoModels\Apikey::class, $pdo, 'id');
$whitelist = new DataDoWhitelistImpl(Mawoo\Security\DataDoModels\Whitelist::class, $pdo, 'id');
$security = new Security($setup->auth_user, $setup->auth_pass, $token_generator, $token_handler, $whitelist);
$security->run($app);
$app->run();