[xml] kimulla

Viewer

  1. <?php
  2.  
  3. use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
  4.  
  5. // web/index.php
  6. require_once __DIR__.'/vendor/autoload.php';
  7.  
  8. // init app
  9. $app = new Silex\Application([
  10.     'debug' => APPLICATION_ENV !== 'prod',
  11. ]);
  12.  
  13. $app['config'] = require_once __DIR__ . '/configs/config.php';
  14.  
  15. $app->register(new Silex\Provider\TwigServiceProvider(), array(
  16.     'twig.path' => __DIR__ . '/views',
  17. ));
  18.  
  19. // security
  20. if ($app['config']['public'] === false) {
  21.     $app->register(new Silex\Provider\SecurityServiceProvider(), [
  22.         'security.encoder.digest' => $app->share(function ($app) {
  23.             return new PlaintextPasswordEncoder();
  24.         }),
  25.         'security.firewalls' => [
  26.             'main' => array(
  27.                 'anonymous' => false,
  28.                 'pattern' => '^/(?!login)',
  29.                 'form' => array('login_path' => '/login', 'check_path' => '/checkLogin'),
  30.                 'logout' => array('logout_path' => '/logout', 'invalidate_session' => true),
  31.                 'users' => $app->share(function($app) {
  32.                     return new \Sokil\Provider\UserProvider(
  33.                         __DIR__ . '/configs/userList.xml'
  34.                     );
  35.                 }),
  36.             ),
  37.         ]
  38.     ]);
  39. }
  40.  
  41. $app['imageProvider'] = $app->share(function($app) {
  42.  
  43.     /* @var $mobileDetect \Detection\MobileDetect */
  44.     $mobileDetect = $app['mobileDetect'];
  45.  
  46.     return new \Sokil\Provider\ImageProvider(
  47.         __DIR__ . '/configs/imageList.xml',
  48.         $app['isMobile']
  49.     );
  50. });
  51.  
  52. return $app;

Editor

You can edit this paste and save as new:


File Description
  • kimulla
  • Paste Code
  • 17 Apr-2024
  • 1.54 Kb
You can Share it: