Created
April 16, 2014 11:16
-
-
Save djvov/10855033 to your computer and use it in GitHub Desktop.
cab test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// index.php | |
require_once __DIR__.'/silex/vendor/autoload.php'; | |
require_once "conf.php"; | |
$app = new Silex\Application(); | |
use Silex\Provider; | |
use Neutron\Silex\Provider\ImagineServiceProvider; | |
use Silex\Provider\FormServiceProvider; | |
use Symfony\Component\Translation\Loader\YamlFileLoader; | |
$app->register(new Provider\SecurityServiceProvider(), array( | |
'security.firewalls' => array( | |
'secured_area' => array( | |
'pattern' => '^.*$', | |
'anonymous' => true, | |
'remember_me' => array(), | |
'form' => array( | |
'login_path' => '/user/login', | |
'check_path' => '/user/login_check', | |
), | |
'logout' => array( | |
'logout_path' => '/user/logout', | |
), | |
'users' => $app->share(function($app) { return $app['user.manager']; }), | |
), | |
), | |
)); | |
$app->register(new Silex\Provider\DoctrineServiceProvider(), array( | |
'db.options' => array( | |
'driver' => 'pdo_mysql', | |
'dbname' => $conf['dbname'], | |
'user' => $conf['dbuser'], | |
'password' => $conf['dbpass'], | |
'host' =>$conf['dbhost'], | |
'charset' => 'cp1251', | |
), | |
)); | |
$app->register(new Silex\Provider\TwigServiceProvider(), array( | |
'twig.path' => __DIR__.'/templates', | |
'twig.options' => array('charset'=>'cp1251'), | |
'twig.options.charset' => 'cp1251', | |
)); | |
$app->register(new Silex\Provider\SessionServiceProvider()); | |
$app->register(new Provider\RememberMeServiceProvider()); | |
$app->register(new Provider\ServiceControllerServiceProvider()); | |
$app->register(new Provider\UrlGeneratorServiceProvider()); | |
$app->register(new ImagineServiceProvider()); | |
$userServiceProvider = new SimpleUser\UserServiceProvider(); | |
$app->register($userServiceProvider); | |
$app->register(new FormServiceProvider()); | |
$app->register(new Silex\Provider\TranslationServiceProvider(), array( | |
'locale' => 'ru', | |
)) ; | |
$app['translator'] = $app->share($app->extend('translator', function($translator, $app) { | |
//$translator->addLoader('yaml', new YamlFileLoader()); | |
$translator->addResource('xliff', __DIR__.'/locales/en.xliff', 'en'); | |
$translator->addResource('xliff', __DIR__.'/locales/ru.xliff', 'ru'); | |
return $translator; | |
})); | |
//$app['user.controller']->setLayoutTemplate($_SERVER['DOCUMENT_ROOT'].'/templates/SimpleUser/layout.twig'); | |
//echo $_SERVER['DOCUMENT_ROOT']; | |
//echo $app['translator']->trans('reg.Account created'); | |
require_once "controllers.php"; | |
$app['locale'] = 'ru'; | |
$app['debug'] = true; | |
$app['charset']='cp1251'; | |
$app->run(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment