// Paris and Idiorm
require VENDOR_PATH . 'Paris/idiorm.php';
require VENDOR_PATH . 'Paris/paris.php';
// Models
require 'models/Article.php';
require 'models/Author.php';
// Configuration
# ORM::configure('sqlite:' . ROOT_PATH . '/sql/database.db');
ORM::configure('mysql:host=localhost;dbname=blog');
ORM::configure('username', 'root');
ORM::configure('password', '');
#ORM::logging(true);
// Slim Configuration
\Slim\Slim::registerAutoloader();
// Twig Configuration
\Slim\Extras\Views\Twig::$twigDirectory = VENDOR_PATH . 'Twig';
\Slim\Extras\Views\Twig::$twigOptions = array("debug" => true);
if (is_writable(ROOT_PATH . 'cache')) {
    \Slim\Extras\Views\Twig::$twigOptions['cache'] = ROOT_PATH . 'cache';
}
// Twig i18n config
\Slim\Extras\Views\Twig::$twigExtensions = array('Twig_Extensions_Extension_I18n');
$locality = $site_cfg['website']['i18n'];
// locality should be determined here
require_once APP_PATH . 'config/locales.php';
// Setup $app
$app = new \Slim\Slim(array('templates.path' => APP_PATH . 'views/' . $site_cfg['website']['theme'] . '/', 'locales.path' => APP_PATH . 'i18n/', 'debug' => true, 'view' => new \Slim\Extras\Views\Twig(), 'log.enabled' => false, 'log.writer' => new \Slim\Extras\Log\DateTimeFileWriter(array('path' => ROOT_PATH . 'logs', 'name_format' => 'Y-m-d', 'message_format' => '%label% - %date% - %message%'))));
// Cookie
$app->add(new \Slim\Middleware\SessionCookie(array('expires' => '40 minutes', 'path' => '/', 'domain' => 'slim', 'secure' => false, 'httponly' => false, 'encrypt' => false, 'name' => 'slimblog', 'secret' => md5($site_cfg['website']['secret']))));
// Authenticate
$app->add(new \SlimBasicAuth('', 'admin'));
Beispiel #2
0
<?php

require_once '../vendor/Pimple.php';
require_once '../vendor/php-activerecord/ActiveRecord.php';
require_once '../vendor/Slim/Slim/Slim.php';
\Slim\Slim::registerAutoloader();
require_once '../vendor/Slim/Views/Extension/TwigAutoloader.php';
Twig_Extensions_Autoloader::register();
Slim\Extras\Views\Twig::$twigDirectory = '../vendor/Twig';
Slim\Extras\Views\Twig::$twigExtensions = array('Twig_Extensions_Slim');
$twigView = new \Slim\Views\Twig();
require_once '../vendor/firephp-core/lib/FirePHPCore/FirePHP.class.php';
ob_start();
$config = new Pimple(array('slim' => array('view' => '\\Slim\\Views\\Twig', 'name', 'markettrader', 'twig' => $twigView, 'templates.path' => 'view'), 'log' => $firephp = FirePHP::getInstance(true)));
return $config;