Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

initial symfony2 import

  • Loading branch information...
commit bd1c0206196c2874ed586e5343fb36f7009cf57c 1 parent fc8f91e
Igor Wiedler igorw authored

Showing 124 changed files with 3,907 additions and 0 deletions. Show diff stats Hide diff stats

  1. +3 0  .gitignore
  2. +19 0 LICENSE
  3. +82 0 README.rst
  4. +1 0  app/.htaccess
  5. +9 0 app/AppCache.php
  6. +36 0 app/AppKernel.php
  7. +13 0 app/Resources/views/base.html.twig
  8. +32 0 app/autoload.php
  9. +105 0 app/check.php
  10. +56 0 app/config/config.yml
  11. +23 0 app/config/config_dev.yml
  12. +18 0 app/config/config_prod.yml
  13. +14 0 app/config/config_test.yml
  14. +18 0 app/config/parameters.ini
  15. 0  app/config/routing.yml
  16. +31 0 app/config/routing_dev.yml
  17. +37 0 app/config/security.yml
  18. +16 0 app/console
  19. 0  app/logs/.gitkeep
  20. +36 0 app/logs/dev.log
  21. +1 0  app/logs/prod.log
  22. +41 0 app/phpunit.xml.dist
  23. +1 0  bin/.htaccess
  24. +107 0 bin/vendors
  25. +50 0 deps
  26. +15 0 deps.lock
  27. +1 0  src/.htaccess
  28. +9 0 src/Acme/DemoBundle/AcmeDemoBundle.php
  29. +57 0 src/Acme/DemoBundle/Controller/DemoController.php
  30. +69 0 src/Acme/DemoBundle/Controller/SecuredController.php
  31. +13 0 src/Acme/DemoBundle/Controller/WelcomeController.php
  32. +25 0 src/Acme/DemoBundle/ControllerListener.php
  33. +22 0 src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php
  34. +15 0 src/Acme/DemoBundle/Form/ContactType.php
  35. +18 0 src/Acme/DemoBundle/Resources/config/services.xml
  36. +293 0 src/Acme/DemoBundle/Resources/public/css/demo.css
  37. BIN  src/Acme/DemoBundle/Resources/public/images/blue-arrow.png
  38. BIN  src/Acme/DemoBundle/Resources/public/images/field-background.gif
  39. BIN  src/Acme/DemoBundle/Resources/public/images/logo.gif
  40. BIN  src/Acme/DemoBundle/Resources/public/images/search.png
  41. BIN  src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif
  42. BIN  src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif
  43. BIN  src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif
  44. +15 0 src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig
  45. +9 0 src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig
  46. +14 0 src/Acme/DemoBundle/Resources/views/Demo/index.html.twig
  47. +11 0 src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig
  48. +9 0 src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig
  49. +6 0 src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig
  50. +29 0 src/Acme/DemoBundle/Resources/views/Secured/login.html.twig
  51. +63 0 src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig
  52. +49 0 src/Acme/DemoBundle/Resources/views/layout.html.twig
  53. +17 0 src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php
  54. +74 0 src/Acme/DemoBundle/Twig/Extension/DemoExtension.php
  55. +5 0 web/.htaccess
  56. +13 0 web/app.php
  57. +20 0 web/app_dev.php
  58. BIN  web/apple-touch-icon.png
  59. +293 0 web/bundles/acmedemo/css/demo.css
  60. BIN  web/bundles/acmedemo/images/blue-arrow.png
  61. BIN  web/bundles/acmedemo/images/field-background.gif
  62. BIN  web/bundles/acmedemo/images/logo.gif
  63. BIN  web/bundles/acmedemo/images/search.png
  64. BIN  web/bundles/acmedemo/images/welcome-configure.gif
  65. BIN  web/bundles/acmedemo/images/welcome-demo.gif
  66. BIN  web/bundles/acmedemo/images/welcome-quick-tour.gif
  67. +273 0 web/bundles/framework/css/exception.css
  68. +161 0 web/bundles/framework/css/exception_layout.css
  69. BIN  web/bundles/framework/images/blue_picto_less.gif
  70. BIN  web/bundles/framework/images/blue_picto_more.gif
  71. BIN  web/bundles/framework/images/border_l.png
  72. BIN  web/bundles/framework/images/border_r.png
  73. BIN  web/bundles/framework/images/btn_bg.png
  74. BIN  web/bundles/framework/images/close_quote.gif
  75. BIN  web/bundles/framework/images/exception_detected.gif
  76. BIN  web/bundles/framework/images/grey_magnifier.png
  77. BIN  web/bundles/framework/images/icon_log.png
  78. BIN  web/bundles/framework/images/input_bg.gif
  79. BIN  web/bundles/framework/images/logo_symfony.gif
  80. BIN  web/bundles/framework/images/open_quote.gif
  81. +438 0 web/bundles/sensiodistribution/webconfigurator/css/configure.css
  82. +374 0 web/bundles/sensiodistribution/webconfigurator/css/install.css
  83. BIN  web/bundles/sensiodistribution/webconfigurator/images/background-textfield.gif
  84. BIN  web/bundles/sensiodistribution/webconfigurator/images/blue-arrow.png
  85. BIN  web/bundles/sensiodistribution/webconfigurator/images/favicon.ico
  86. BIN  web/bundles/sensiodistribution/webconfigurator/images/logo-big.gif
  87. BIN  web/bundles/sensiodistribution/webconfigurator/images/logo-small.gif
  88. BIN  web/bundles/sensiodistribution/webconfigurator/images/notification.gif
  89. +515 0 web/bundles/webprofiler/css/profiler.css
  90. +28 0 web/bundles/webprofiler/css/toolbar.css
  91. BIN  web/bundles/webprofiler/favicon.ico
  92. BIN  web/bundles/webprofiler/images/close.png
  93. BIN  web/bundles/webprofiler/images/config.png
  94. BIN  web/bundles/webprofiler/images/db.png
  95. BIN  web/bundles/webprofiler/images/events.png
  96. BIN  web/bundles/webprofiler/images/exception.png
  97. BIN  web/bundles/webprofiler/images/import.png
  98. BIN  web/bundles/webprofiler/images/logger.png
  99. BIN  web/bundles/webprofiler/images/mail.png
  100. BIN  web/bundles/webprofiler/images/memory.png
  101. BIN  web/bundles/webprofiler/images/profiler/bg_submenu.gif
  102. BIN  web/bundles/webprofiler/images/profiler/border_l.png
  103. BIN  web/bundles/webprofiler/images/profiler/border_r.png
  104. BIN  web/bundles/webprofiler/images/profiler/btn_bg.png
  105. BIN  web/bundles/webprofiler/images/profiler/config.png
  106. BIN  web/bundles/webprofiler/images/profiler/db.png
  107. BIN  web/bundles/webprofiler/images/profiler/events.png
  108. BIN  web/bundles/webprofiler/images/profiler/exception.png
  109. BIN  web/bundles/webprofiler/images/profiler/grey_magnifier.png
  110. BIN  web/bundles/webprofiler/images/profiler/input_bg.gif
  111. BIN  web/bundles/webprofiler/images/profiler/logger.png
  112. BIN  web/bundles/webprofiler/images/profiler/logo_symfony_profiler.gif
  113. BIN  web/bundles/webprofiler/images/profiler/mail.png
  114. BIN  web/bundles/webprofiler/images/profiler/request.png
  115. BIN  web/bundles/webprofiler/images/profiler/security.png
  116. BIN  web/bundles/webprofiler/images/request.png
  117. BIN  web/bundles/webprofiler/images/search.png
  118. BIN  web/bundles/webprofiler/images/security.png
  119. BIN  web/bundles/webprofiler/images/spacer.gif
  120. BIN  web/bundles/webprofiler/images/symfony.png
  121. BIN  web/bundles/webprofiler/images/timer.png
  122. +201 0 web/config.php
  123. BIN  web/favicon.ico
  124. +4 0 web/robots.txt
3  .gitignore
... ... @@ -1 +1,4 @@
  1 +app/cache
1 2 writable/stats/*
  3 +vendor
  4 +*.cache
19 LICENSE
... ... @@ -0,0 +1,19 @@
  1 +Copyright (c) 2004-2010 Fabien Potencier
  2 +
  3 +Permission is hereby granted, free of charge, to any person obtaining a copy
  4 +of this software and associated documentation files (the "Software"), to deal
  5 +in the Software without restriction, including without limitation the rights
  6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7 +copies of the Software, and to permit persons to whom the Software is furnished
  8 +to do so, subject to the following conditions:
  9 +
  10 +The above copyright notice and this permission notice shall be included in all
  11 +copies or substantial portions of the Software.
  12 +
  13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19 +THE SOFTWARE.
82 README.rst
Source Rendered
... ... @@ -0,0 +1,82 @@
  1 +Symfony Standard Edition
  2 +========================
  3 +
  4 +What's inside?
  5 +--------------
  6 +
  7 +Symfony Standard Edition comes pre-configured with the following bundles:
  8 +
  9 +* FrameworkBundle
  10 +* SensioFrameworkExtraBundle
  11 +* DoctrineBundle
  12 +* TwigBundle
  13 +* SwiftmailerBundle
  14 +* MonologBundle
  15 +* AsseticBundle
  16 +* JMSSecurityExtraBundle
  17 +* WebProfilerBundle (in dev/test env)
  18 +* SensioDistributionBundle (in dev/test env)
  19 +* SensioGeneratorBundle (in dev/test env)
  20 +* AcmeDemoBundle (in dev/test env)
  21 +
  22 +Installation from an Archive
  23 +----------------------------
  24 +
  25 +The easiest way to get started is to download an archive with vendors included
  26 +(http://symfony.com/download). Unpack it somewhere under your web server root
  27 +directory and you're done.
  28 +
  29 +If you have downloaded an archive without the vendors, you must have ``git``
  30 +available to install the vendors:
  31 +
  32 + php bin/vendors install
  33 +
  34 +Installation from Git
  35 +---------------------
  36 +
  37 +We highly recommend you that you download the packaged version of this
  38 +distribution. If you still want to use Git, your are on your own.
  39 +
  40 +Run the following commands:
  41 +
  42 + git clone http://github.com/symfony/symfony-standard.git
  43 + cd symfony-standard
  44 + rm -rf .git
  45 + php bin/vendors install
  46 +
  47 +.. note::
  48 +
  49 + Symfony SE does/can not use git submodules as you should not keep the
  50 + `.git` directory.
  51 +
  52 +Configuration
  53 +-------------
  54 +
  55 +Check that everything is working fine by going to the ``web/config.php`` page
  56 +in a browser and follow the instructions.
  57 +
  58 +The distribution is configured with the following defaults:
  59 +
  60 +* Twig is the only configured template engine;
  61 +* Doctrine ORM/DBAL is configured;
  62 +* Swiftmailer is configured;
  63 +* Annotations for everything are enabled.
  64 +
  65 +A default bundle, ``AcmeDemoBundle``, shows you Symfony2 in action. After
  66 +playing with it, you can remove it by following these steps:
  67 +
  68 +* delete the ``src/Acme`` directory;
  69 +* remove the routing entries referencing AcmeBundle in ``app/config/routing_dev.yml``;
  70 +* remove the AcmeBundle from the registered bundles in ``app/AppKernel.php``;
  71 +
  72 +Configure the distribution by editing ``app/config/parameters.ini`` or by
  73 +accessing ``web/config.php`` in a browser.
  74 +
  75 +A simple controller is configured at ``/hello/{name}``. Access it via
  76 +``web/app_dev.php/demo/hello/Fabien``.
  77 +
  78 +If you want to use the CLI, a console application is available at
  79 +``app/console``. Check first that your PHP is correctly configured for the CLI
  80 +by running ``app/check.php``.
  81 +
  82 +Enjoy!
1  app/.htaccess
... ... @@ -0,0 +1 @@
  1 +deny from all
9 app/AppCache.php
... ... @@ -0,0 +1,9 @@
  1 +<?php
  2 +
  3 +require_once __DIR__.'/AppKernel.php';
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
  6 +
  7 +class AppCache extends HttpCache
  8 +{
  9 +}
36 app/AppKernel.php
... ... @@ -0,0 +1,36 @@
  1 +<?php
  2 +
  3 +use Symfony\Component\HttpKernel\Kernel;
  4 +use Symfony\Component\Config\Loader\LoaderInterface;
  5 +
  6 +class AppKernel extends Kernel
  7 +{
  8 + public function registerBundles()
  9 + {
  10 + $bundles = array(
  11 + new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
  12 + new Symfony\Bundle\SecurityBundle\SecurityBundle(),
  13 + new Symfony\Bundle\TwigBundle\TwigBundle(),
  14 + new Symfony\Bundle\MonologBundle\MonologBundle(),
  15 + new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
  16 + new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
  17 + new Symfony\Bundle\AsseticBundle\AsseticBundle(),
  18 + new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
  19 + new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
  20 + );
  21 +
  22 + if (in_array($this->getEnvironment(), array('dev', 'test'))) {
  23 + $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
  24 + $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
  25 + $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
  26 + $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
  27 + }
  28 +
  29 + return $bundles;
  30 + }
  31 +
  32 + public function registerContainerConfiguration(LoaderInterface $loader)
  33 + {
  34 + $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
  35 + }
  36 +}
13 app/Resources/views/base.html.twig
... ... @@ -0,0 +1,13 @@
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5 + <title>{% block title %}Welcome!{% endblock %}</title>
  6 + {% block stylesheets %}{% endblock %}
  7 + <link rel="shortcut icon" href="{{ asset('favicon.ico') }}" />
  8 + </head>
  9 + <body>
  10 + {% block body %}{% endblock %}
  11 + {% block javascripts %}{% endblock %}
  12 + </body>
  13 +</html>
32 app/autoload.php
... ... @@ -0,0 +1,32 @@
  1 +<?php
  2 +
  3 +use Symfony\Component\ClassLoader\UniversalClassLoader;
  4 +
  5 +$loader = new UniversalClassLoader();
  6 +$loader->registerNamespaces(array(
  7 + 'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
  8 + 'Sensio' => __DIR__.'/../vendor/bundles',
  9 + 'JMS' => __DIR__.'/../vendor/bundles',
  10 + 'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
  11 + 'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
  12 + 'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
  13 + 'Monolog' => __DIR__.'/../vendor/monolog/src',
  14 + 'Assetic' => __DIR__.'/../vendor/assetic/src',
  15 + 'Metadata' => __DIR__.'/../vendor/metadata/src',
  16 +));
  17 +$loader->registerPrefixes(array(
  18 + 'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
  19 + 'Twig_' => __DIR__.'/../vendor/twig/lib',
  20 +));
  21 +$loader->registerPrefixFallbacks(array(
  22 + __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs',
  23 +));
  24 +$loader->registerNamespaceFallbacks(array(
  25 + __DIR__.'/../src',
  26 +));
  27 +$loader->register();
  28 +
  29 +// Swiftmailer needs a special autoloader to allow
  30 +// the lazy loading of the init file (which is expensive)
  31 +require_once __DIR__.'/../vendor/swiftmailer/lib/classes/Swift.php';
  32 +Swift::registerAutoload(__DIR__.'/../vendor/swiftmailer/lib/swift_init.php');
105 app/check.php
... ... @@ -0,0 +1,105 @@
  1 +<?php
  2 +
  3 +if (!$iniPath = get_cfg_var('cfg_file_path')) {
  4 + $iniPath = 'WARNING: not using a php.ini file';
  5 +}
  6 +
  7 +echo "********************************\n";
  8 +echo "* *\n";
  9 +echo "* Symfony requirements check *\n";
  10 +echo "* *\n";
  11 +echo "********************************\n\n";
  12 +echo sprintf("php.ini used by PHP: %s\n\n", $iniPath);
  13 +
  14 +echo "** WARNING **\n";
  15 +echo "* The PHP CLI can use a different php.ini file\n";
  16 +echo "* than the one used with your web server.\n";
  17 +if ('\\' == DIRECTORY_SEPARATOR) {
  18 + echo "* (especially on the Windows platform)\n";
  19 +}
  20 +echo "* If this is the case, please ALSO launch this\n";
  21 +echo "* utility from your web server.\n";
  22 +echo "** WARNING **\n";
  23 +
  24 +// mandatory
  25 +echo_title("Mandatory requirements");
  26 +check(version_compare(phpversion(), '5.3.2', '>='), sprintf('Checking that PHP version is at least 5.3.2 (%s installed)', phpversion()), 'Install PHP 5.3.2 or newer (current version is '.phpversion(), true);
  27 +check(ini_get('date.timezone'), 'Checking that the "date.timezone" setting is set', 'Set the "date.timezone" setting in php.ini (like Europe/Paris)', true);
  28 +check(is_writable(__DIR__.'/../app/cache'), sprintf('Checking that app/cache/ directory is writable'), 'Change the permissions of the app/cache/ directory so that the web server can write in it', true);
  29 +check(is_writable(__DIR__.'/../app/logs'), sprintf('Checking that the app/logs/ directory is writable'), 'Change the permissions of the app/logs/ directory so that the web server can write in it', true);
  30 +check(function_exists('json_encode'), 'Checking that the json_encode() is available', 'Install and enable the json extension', true);
  31 +check(class_exists('SQLite3') || in_array('sqlite', PDO::getAvailableDrivers()), 'Install and enable the SQLite3 or PDO_SQLite extension.', true);
  32 +
  33 +// warnings
  34 +echo_title("Optional checks");
  35 +check(class_exists('DomDocument'), 'Checking that the PHP-XML module is installed', 'Install and enable the php-xml module', false);
  36 +check(defined('LIBXML_COMPACT'), 'Checking that the libxml version is at least 2.6.21', 'Upgrade your php-xml module with a newer libxml', false);
  37 +check(function_exists('token_get_all'), 'Checking that the token_get_all() function is available', 'Install and enable the Tokenizer extension (highly recommended)', false);
  38 +check(function_exists('mb_strlen'), 'Checking that the mb_strlen() function is available', 'Install and enable the mbstring extension', false);
  39 +check(function_exists('iconv'), 'Checking that the iconv() function is available', 'Install and enable the iconv extension', false);
  40 +check(function_exists('utf8_decode'), 'Checking that the utf8_decode() is available', 'Install and enable the XML extension', false);
  41 +if (PHP_OS != 'WINNT') {
  42 + check(function_exists('posix_isatty'), 'Checking that the posix_isatty() is available', 'Install and enable the php_posix extension (used to colorized the CLI output)', false);
  43 +}
  44 +check(class_exists('Locale'), 'Checking that the intl extension is available', 'Install and enable the intl extension (used for validators)', false);
  45 +if (class_exists('Locale')) {
  46 + $version = '';
  47 +
  48 + if (defined('INTL_ICU_VERSION')) {
  49 + $version = INTL_ICU_VERSION;
  50 + } else {
  51 + $reflector = new \ReflectionExtension('intl');
  52 +
  53 + ob_start();
  54 + $reflector->info();
  55 + $output = ob_get_clean();
  56 +
  57 + preg_match('/^ICU version => (.*)$/m', $output, $matches);
  58 + $version = $matches[1];
  59 + }
  60 +
  61 + check(version_compare($matches[1], '4.0', '>='), 'Checking that the intl ICU version is at least 4+', 'Upgrade your intl extension with a newer ICU version (4+)', false);
  62 +}
  63 +
  64 +$accelerator =
  65 + (function_exists('apc_store') && ini_get('apc.enabled'))
  66 + ||
  67 + function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
  68 + ||
  69 + function_exists('xcache_set')
  70 +;
  71 +check($accelerator, 'Checking that a PHP accelerator is installed', 'Install a PHP accelerator like APC (highly recommended)', false);
  72 +
  73 +check(!ini_get('short_open_tag'), 'Checking that php.ini has short_open_tag set to off', 'Set short_open_tag to off in php.ini', false);
  74 +check(!ini_get('magic_quotes_gpc'), 'Checking that php.ini has magic_quotes_gpc set to off', 'Set magic_quotes_gpc to off in php.ini', false);
  75 +check(!ini_get('register_globals'), 'Checking that php.ini has register_globals set to off', 'Set register_globals to off in php.ini', false);
  76 +check(!ini_get('session.auto_start'), 'Checking that php.ini has session.auto_start set to off', 'Set session.auto_start to off in php.ini', false);
  77 +
  78 +echo_title("Optional checks (Doctrine)");
  79 +
  80 +check(class_exists('PDO'), 'Checking that PDO is installed', 'Install PDO (mandatory for Doctrine)', false);
  81 +if (class_exists('PDO')) {
  82 + $drivers = PDO::getAvailableDrivers();
  83 + check(count($drivers), 'Checking that PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)');
  84 +}
  85 +
  86 +/**
  87 + * Checks a configuration.
  88 + */
  89 +function check($boolean, $message, $help = '', $fatal = false)
  90 +{
  91 + echo $boolean ? " OK " : sprintf("\n\n[[%s]] ", $fatal ? ' ERROR ' : 'WARNING');
  92 + echo sprintf("$message%s\n", $boolean ? '' : ': FAILED');
  93 +
  94 + if (!$boolean) {
  95 + echo " *** $help ***\n";
  96 + if ($fatal) {
  97 + die("You must fix this problem before resuming the check.\n");
  98 + }
  99 + }
  100 +}
  101 +
  102 +function echo_title($title)
  103 +{
  104 + echo "\n** $title **\n\n";
  105 +}
56 app/config/config.yml
... ... @@ -0,0 +1,56 @@
  1 +imports:
  2 + - { resource: parameters.ini }
  3 + - { resource: security.yml }
  4 +
  5 +framework:
  6 + secret: %secret%
  7 + charset: UTF-8
  8 + router: { resource: "%kernel.root_dir%/config/routing.yml" }
  9 + form: true
  10 + csrf_protection: true
  11 + validation: { enable_annotations: true }
  12 + templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
  13 + session:
  14 + default_locale: %locale%
  15 + auto_start: true
  16 +
  17 +# Twig Configuration
  18 +twig:
  19 + debug: %kernel.debug%
  20 + strict_variables: %kernel.debug%
  21 +
  22 +# Assetic Configuration
  23 +assetic:
  24 + debug: %kernel.debug%
  25 + use_controller: false
  26 + filters:
  27 + cssrewrite: ~
  28 + # closure:
  29 + # jar: %kernel.root_dir%/java/compiler.jar
  30 + # yui_css:
  31 + # jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar
  32 +
  33 +# Doctrine Configuration
  34 +doctrine:
  35 + dbal:
  36 + driver: %database_driver%
  37 + host: %database_host%
  38 + dbname: %database_name%
  39 + user: %database_user%
  40 + password: %database_password%
  41 + charset: UTF8
  42 +
  43 + orm:
  44 + auto_generate_proxy_classes: %kernel.debug%
  45 + auto_mapping: true
  46 +
  47 +# Swiftmailer Configuration
  48 +swiftmailer:
  49 + transport: %mailer_transport%
  50 + host: %mailer_host%
  51 + username: %mailer_user%
  52 + password: %mailer_password%
  53 +
  54 +jms_security_extra:
  55 + secure_controllers: true
  56 + secure_all_services: false
23 app/config/config_dev.yml
... ... @@ -0,0 +1,23 @@
  1 +imports:
  2 + - { resource: config.yml }
  3 +
  4 +framework:
  5 + router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
  6 + profiler: { only_exceptions: false }
  7 +
  8 +web_profiler:
  9 + toolbar: true
  10 + intercept_redirects: false
  11 +
  12 +monolog:
  13 + handlers:
  14 + main:
  15 + type: stream
  16 + path: %kernel.logs_dir%/%kernel.environment%.log
  17 + level: debug
  18 + firephp:
  19 + type: firephp
  20 + level: info
  21 +
  22 +assetic:
  23 + use_controller: true
18 app/config/config_prod.yml
... ... @@ -0,0 +1,18 @@
  1 +imports:
  2 + - { resource: config.yml }
  3 +
  4 +#doctrine:
  5 +# metadata_cache_driver: apc
  6 +# result_cache_driver: apc
  7 +# query_cache_driver: apc
  8 +
  9 +monolog:
  10 + handlers:
  11 + main:
  12 + type: fingers_crossed
  13 + action_level: error
  14 + handler: nested
  15 + nested:
  16 + type: stream
  17 + path: %kernel.logs_dir%/%kernel.environment%.log
  18 + level: debug
14 app/config/config_test.yml
... ... @@ -0,0 +1,14 @@
  1 +imports:
  2 + - { resource: config_dev.yml }
  3 +
  4 +framework:
  5 + test: ~
  6 + session:
  7 + storage_id: session.storage.filesystem
  8 +
  9 +web_profiler:
  10 + toolbar: false
  11 + intercept_redirects: false
  12 +
  13 +swiftmailer:
  14 + disable_delivery: true
18 app/config/parameters.ini
... ... @@ -0,0 +1,18 @@
  1 +; These parameters can be imported into other config files
  2 +; by enclosing the key with % (like %database_user%)
  3 +; Comments start with ';', as in php.ini
  4 +[parameters]
  5 + database_driver = pdo_mysql
  6 + database_host = localhost
  7 + database_name = symfony
  8 + database_user = root
  9 + database_password =
  10 +
  11 + mailer_transport = smtp
  12 + mailer_host = localhost
  13 + mailer_user =
  14 + mailer_password =
  15 +
  16 + locale = en
  17 +
  18 + secret = ThisTokenIsNotSoSecretChangeIt
0  app/config/routing.yml
No changes.
31 app/config/routing_dev.yml
... ... @@ -0,0 +1,31 @@
  1 +_welcome:
  2 + pattern: /
  3 + defaults: { _controller: AcmeDemoBundle:Welcome:index }
  4 +
  5 +_demo_secured:
  6 + resource: "@AcmeDemoBundle/Controller/SecuredController.php"
  7 + type: annotation
  8 +
  9 +_demo:
  10 + resource: "@AcmeDemoBundle/Controller/DemoController.php"
  11 + type: annotation
  12 + prefix: /demo
  13 +
  14 +_assetic:
  15 + resource: .
  16 + type: assetic
  17 +
  18 +_wdt:
  19 + resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
  20 + prefix: /_wdt
  21 +
  22 +_profiler:
  23 + resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
  24 + prefix: /_profiler
  25 +
  26 +_configurator:
  27 + resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
  28 + prefix: /_configurator
  29 +
  30 +_main:
  31 + resource: routing.yml
37 app/config/security.yml
... ... @@ -0,0 +1,37 @@
  1 +security:
  2 + encoders:
  3 + Symfony\Component\Security\Core\User\User: plaintext
  4 +
  5 + role_hierarchy:
  6 + ROLE_ADMIN: ROLE_USER
  7 + ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
  8 +
  9 + providers:
  10 + in_memory:
  11 + users:
  12 + user: { password: userpass, roles: [ 'ROLE_USER' ] }
  13 + admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
  14 +
  15 + firewalls:
  16 + dev:
  17 + pattern: ^/(_(profiler|wdt)|css|images|js)/
  18 + security: false
  19 +
  20 + login:
  21 + pattern: ^/demo/secured/login$
  22 + security: false
  23 +
  24 + secured_area:
  25 + pattern: ^/demo/secured/
  26 + form_login:
  27 + check_path: /demo/secured/login_check
  28 + login_path: /demo/secured/login
  29 + logout:
  30 + path: /demo/secured/logout
  31 + target: /demo/
  32 + #anonymous: ~
  33 + #http_basic:
  34 + # realm: "Secured Demo Area"
  35 +
  36 + access_control:
  37 + #- { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
16 app/console
... ... @@ -0,0 +1,16 @@
  1 +#!/usr/bin/env php
  2 +<?php
  3 +
  4 +require_once __DIR__.'/bootstrap.php.cache';
  5 +require_once __DIR__.'/AppKernel.php';
  6 +
  7 +use Symfony\Bundle\FrameworkBundle\Console\Application;
  8 +use Symfony\Component\Console\Input\ArgvInput;
  9 +
  10 +$input = new ArgvInput();
  11 +$env = $input->getParameterOption(array('--env', '-e'), 'dev');
  12 +$debug = !$input->hasParameterOption(array('--no-debug', ''));
  13 +
  14 +$kernel = new AppKernel($env, $debug);
  15 +$application = new Application($kernel);
  16 +$application->run();
0  app/logs/.gitkeep
No changes.
36 app/logs/dev.log
... ... @@ -0,0 +1,36 @@
  1 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onEarlyKernelRequest". [] []
  2 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". [] []
  3 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] []
  4 +[2011-07-02 21:57:47] request.INFO: Matched route "_welcome" (parameters: "_controller": "Acme\DemoBundle\Controller\WelcomeController::indexAction", "_route": "_welcome") [] []
  5 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onKernelRequest". [] []
  6 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". [] []
  7 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector::onKernelController". [] []
  8 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". [] []
  9 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". [] []
  10 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". [] []
  11 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Acme\DemoBundle\ControllerListener::onKernelController". [] []
  12 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "JMS\SecurityExtraBundle\Controller\ControllerListener::onCoreController". [] []
  13 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ResponseListener::onKernelResponse". [] []
  14 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bundle\SecurityBundle\EventListener\ResponseListener::onKernelResponse". [] []
  15 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bridge\Monolog\Handler\FirePHPHandler::onKernelResponse". [] []
  16 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\CacheListener::onKernelResponse". [] []
  17 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelResponse". [] []
  18 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener::onKernelResponse". [] []
  19 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onEarlyKernelRequest". [] []
  20 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". [] []
  21 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". [] []
  22 +[2011-07-02 21:57:47] request.INFO: Matched route "_wdt" (parameters: "_controller": "Symfony\Bundle\WebProfilerBundle\Controller\ProfilerController::toolbarAction", "token": "4e0f783b3bec2", "_route": "_wdt") [] []
  23 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\RouterListener::onKernelRequest". [] []
  24 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". [] []
  25 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector::onKernelController". [] []
  26 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". [] []
  27 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". [] []
  28 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". [] []
  29 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "Acme\DemoBundle\ControllerListener::onKernelController". [] []
  30 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.controller" to listener "JMS\SecurityExtraBundle\Controller\ControllerListener::onCoreController". [] []
  31 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ResponseListener::onKernelResponse". [] []
  32 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bundle\SecurityBundle\EventListener\ResponseListener::onKernelResponse". [] []
  33 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bridge\Monolog\Handler\FirePHPHandler::onKernelResponse". [] []
  34 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\CacheListener::onKernelResponse". [] []
  35 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelResponse". [] []
  36 +[2011-07-02 21:57:47] event.DEBUG: Notified event "kernel.response" to listener "Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener::onKernelResponse". [] []
1  app/logs/prod.log
... ... @@ -0,0 +1 @@
  1 +[2011-07-02 21:57:52] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /" (uncaught exception) at /Users/igor/Sites/phpbb.com/area51/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/RouterListener.php line 88 [] []
41 app/phpunit.xml.dist
... ... @@ -0,0 +1,41 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
  4 +<phpunit
  5 + backupGlobals = "false"
  6 + backupStaticAttributes = "false"
  7 + colors = "true"
  8 + convertErrorsToExceptions = "true"
  9 + convertNoticesToExceptions = "true"
  10 + convertWarningsToExceptions = "true"
  11 + processIsolation = "false"
  12 + stopOnFailure = "false"
  13 + syntaxCheck = "false"
  14 + bootstrap = "bootstrap.php.cache" >
  15 +
  16 + <testsuites>
  17 + <testsuite name="Project Test Suite">
  18 + <directory>../src/*/*Bundle/Tests</directory>
  19 + <directory>../src/*/Bundle/*Bundle/Tests</directory>
  20 + </testsuite>
  21 + </testsuites>
  22 +
  23 + <!--
  24 + <php>
  25 + <server name="KERNEL_DIR" value="/path/to/your/app/" />
  26 + </php>
  27 + -->
  28 +
  29 + <filter>
  30 + <whitelist>
  31 + <directory>../src</directory>
  32 + <exclude>
  33 + <directory>../src/*/*Bundle/Resources</directory>
  34 + <directory>../src/*/*Bundle/Tests</directory>
  35 + <directory>../src/*/Bundle/*Bundle/Resources</directory>
  36 + <directory>../src/*/Bundle/*Bundle/Tests</directory>
  37 + </exclude>
  38 + </whitelist>
  39 + </filter>
  40 +
  41 +</phpunit>
1  bin/.htaccess
... ... @@ -0,0 +1 @@
  1 +deny from all
107 bin/vendors
... ... @@ -0,0 +1,107 @@
  1 +#!/usr/bin/env php
  2 +<?php
  3 +
  4 +/*
  5 + * This file is part of the Symfony Standard Edition.
  6 + *
  7 + * (c) Fabien Potencier <fabien@symfony.com>
  8 + *
  9 + * For the full copyright and license information, please view the LICENSE
  10 + * file that was distributed with this source code.
  11 + */
  12 +
  13 +$rootDir = dirname(__DIR__);
  14 +$vendorDir = $rootDir.'/vendor';
  15 +
  16 +array_shift($argv);
  17 +if (!isset($argv[0])) {
  18 + exit(<<<EOF
  19 +Symfony2 vendors script management.
  20 +
  21 +Specify a command to run:
  22 +
  23 + install: install vendors as specified in deps or deps.lock (recommended)
  24 + update: update vendors to their latest versions (as specified in deps)
  25 +
  26 +
  27 +EOF
  28 + );
  29 +}
  30 +
  31 +if (!in_array($command = array_shift($argv), array('install', 'update'))) {
  32 + exit(sprintf("Command \"%s\" does not exist.\n", $command));
  33 +}
  34 +
  35 +if (!is_dir($vendorDir)) {
  36 + mkdir($vendorDir, 0777, true);
  37 +}
  38 +
  39 +// versions
  40 +$versions = array();
  41 +if ('install' === $command && file_exists($rootDir.'/deps.lock')) {
  42 + foreach (file($rootDir.'/deps.lock', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
  43 + $parts = array_values(array_filter(explode(' ', $line)));
  44 + if (2 !== count($parts)) {
  45 + exit(sprintf('The deps version file is not valid (near "%s")', $line));
  46 + }
  47 + $versions[$parts[0]] = $parts[1];
  48 + }
  49 +}
  50 +
  51 +$newversions = array();
  52 +$deps = parse_ini_file($rootDir.'/deps', true, INI_SCANNER_RAW);
  53 +foreach ($deps as $name => $dep) {
  54 + // revision
  55 + if (isset($versions[$name])) {
  56 + $rev = $versions[$name];
  57 + } else {
  58 + $rev = isset($dep['version']) ? $dep['version'] : 'origin/HEAD';
  59 + }
  60 +
  61 + // install dir
  62 + $installDir = isset($dep['target']) ? $vendorDir.'/'.$dep['target'] : $vendorDir.'/'.$name;
  63 + if (in_array('--reinstall', $argv)) {
  64 + if (PHP_OS == 'WINNT') {
  65 + system(sprintf('rmdir /S /Q %s', escapeshellarg(realpath($installDir))));
  66 + } else {
  67 + system(sprintf('rm -rf %s', escapeshellarg($installDir)));
  68 + }
  69 + }
  70 +
  71 + echo "> Installing/Updating $name\n";
  72 +
  73 + // url
  74 + if (!isset($dep['git'])) {
  75 + exit(sprintf('The "git" value for the "%s" dependency must be set.', $name));
  76 + }
  77 + $url = $dep['git'];
  78 +
  79 + if (!is_dir($installDir)) {
  80 + system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)));
  81 + }
  82 +
  83 + system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
  84 +
  85 + if ('update' === $command) {
  86 + ob_start();
  87 + system(sprintf('cd %s && git log -n 1 --format=%%H', escapeshellarg($installDir)));
  88 + $newversions[] = trim($name.' '.ob_get_clean());
  89 + }
  90 +}
  91 +
  92 +// update?
  93 +if ('update' === $command) {
  94 + file_put_contents($rootDir.'/deps.lock', implode("\n", $newversions));
  95 +}
  96 +
  97 +// php on windows can't use the shebang line from system()
  98 +$interpreter = PHP_OS == 'WINNT' ? 'php.exe' : '';
  99 +
  100 +// Update the bootstrap files
  101 +system(sprintf('%s %s', $interpreter, escapeshellarg($rootDir.'/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php')));
  102 +
  103 +// Update assets
  104 +system(sprintf('%s %s assets:install %s', $interpreter, escapeshellarg($rootDir.'/app/console'), escapeshellarg($rootDir.'/web/')));
  105 +
  106 +// Remove the cache
  107 +system(sprintf('%s %s cache:clear --no-warmup', $interpreter, escapeshellarg($rootDir.'/app/console')));
50 deps
... ... @@ -0,0 +1,50 @@
  1 +[symfony]
  2 + git=http://github.com/symfony/symfony.git
  3 +
  4 +[twig]
  5 + git=http://github.com/fabpot/Twig.git
  6 +
  7 +[monolog]
  8 + git=http://github.com/Seldaek/monolog.git
  9 +
  10 +[doctrine-common]
  11 + git=http://github.com/doctrine/common.git
  12 +
  13 +[doctrine-dbal]
  14 + git=http://github.com/doctrine/dbal.git
  15 +
  16 +[doctrine]
  17 + git=http://github.com/doctrine/doctrine2.git
  18 +
  19 +[swiftmailer]
  20 + git=http://github.com/swiftmailer/swiftmailer.git
  21 + version=origin/4.1
  22 +
  23 +[assetic]
  24 + git=http://github.com/kriswallsmith/assetic.git
  25 +
  26 +[twig-extensions]
  27 + git=http://github.com/fabpot/Twig-extensions.git
  28 +
  29 +[metadata]
  30 + git=http://github.com/schmittjoh/metadata.git
  31 +
  32 +[SensioFrameworkExtraBundle]
  33 + git=http://github.com/sensio/SensioFrameworkExtraBundle.git
  34 + target=/bundles/Sensio/Bundle/FrameworkExtraBundle
  35 +
  36 +[JMSSecurityExtraBundle]
  37 + git=http://github.com/schmittjoh/SecurityExtraBundle.git
  38 + target=/bundles/JMS/SecurityExtraBundle
  39 +
  40 +[SensioDistributionBundle]
  41 + git=http://github.com/sensio/SensioDistributionBundle.git
  42 + target=/bundles/Sensio/Bundle/DistributionBundle
  43 +
  44 +[SensioGeneratorBundle]
  45 + git=http://github.com/sensio/SensioGeneratorBundle.git
  46 + target=/bundles/Sensio/Bundle/GeneratorBundle
  47 +
  48 +[AsseticBundle]
  49 + git=http://github.com/symfony/AsseticBundle.git
  50 + target=/bundles/Symfony/Bundle/AsseticBundle
15 deps.lock
... ... @@ -0,0 +1,15 @@
  1 +symfony 705fc0ddd3c615b03a4ee001a9164259c8011b68
  2 +twig cdd8351cf58babc767a8fbe0a3f6d05df90373ff
  3 +monolog 8492eb74b30429c68beeca22ded788a487d0fd82
  4 +doctrine-common fa9954572e2489d54d015eaf648e5d867e6605c9
  5 +doctrine-dbal 2cb22496a732029373d98ff9e4d54a7187ee9bb8
  6 +doctrine 5afc097527685f33abddbfb10af4741e8bd7385a
  7 +swiftmailer 79fe79112664b855c9f6db3350e374b5ea9467cf
  8 +assetic 50d4b959d713f7544dc98e36bc181631aca034a0
  9 +twig-extensions 6b0cc16934b6e62ef07c8d2e59f9f13ff3193d3d
  10 +metadata aa04872c6f0e2b32128b62dd075e8cf97a8d93da
  11 +SensioFrameworkExtraBundle 414c0812bf941811791f8a1efd4ccd25e9562406
  12 +JMSSecurityExtraBundle f9fbc5da0d464a3764ef7bf6d7988fbb7b883d6a
  13 +SensioDistributionBundle 868d8db9ca3ae41d5d6e74f3db708eb5970bc478
  14 +SensioGeneratorBundle 719b6912c19d9c27c39f1df59885718c8c4af0ae
  15 +AsseticBundle f6ec47d9399459ab7b602fb3737243a0f1fa2f29
1  src/.htaccess
... ... @@ -0,0 +1 @@
  1 +deny from all
9 src/Acme/DemoBundle/AcmeDemoBundle.php
... ... @@ -0,0 +1,9 @@
  1 +<?php
  2 +
  3 +namespace Acme\DemoBundle;
  4 +
  5 +use Symfony\Component\HttpKernel\Bundle\Bundle;
  6 +
  7 +class AcmeDemoBundle extends Bundle
  8 +{
  9 +}
57 src/Acme/DemoBundle/Controller/DemoController.php
... ... @@ -0,0 +1,57 @@
  1 +<?php
  2 +
  3 +namespace Acme\DemoBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\HttpFoundation\RedirectResponse;
  7 +use Acme\DemoBundle\Form\ContactType;
  8 +
  9 +// these import the "@Route" and "@Template" annotations
  10 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  11 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  12 +
  13 +class DemoController extends Controller
  14 +{
  15 + /**
  16 + * @Route("/", name="_demo")
  17 + * @Template()
  18 + */
  19 + public function indexAction()
  20 + {
  21 + return array();
  22 + }
  23 +
  24 + /**
  25 + * @Route("/hello/{name}", name="_demo_hello")
  26 + * @Template()
  27 + */
  28 + public function helloAction($name)
  29 + {
  30 + return array('name' => $name);
  31 + }
  32 +
  33 + /**
  34 + * @Route("/contact", name="_demo_contact")
  35 + * @Template()
  36 + */
  37 + public function contactAction()
  38 + {
  39 + $form = $this->get('form.factory')->create(new ContactType());
  40 +
  41 + $request = $this->get('request');
  42 + if ('POST' == $request->getMethod()) {
  43 + $form->bindRequest($request);
  44 + if ($form->isValid()) {
  45 + $mailer = $this->get('mailer');
  46 + // .. setup a message and send it
  47 + // http://symfony.com/doc/current/cookbook/email.html
  48 +
  49 + $this->get('session')->setFlash('notice', 'Message sent!');
  50 +
  51 + return new RedirectResponse($this->generateUrl('_demo'));
  52 + }
  53 + }
  54 +
  55 + return array('form' => $form->createView());
  56 + }
  57 +}
69 src/Acme/DemoBundle/Controller/SecuredController.php
... ... @@ -0,0 +1,69 @@
  1 +<?php
  2 +
  3 +namespace Acme\DemoBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +use Symfony\Component\Security\Core\SecurityContext;
  7 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  8 +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  9 +use JMS\SecurityExtraBundle\Annotation\Secure;
  10 +
  11 +/**
  12 + * @Route("/demo/secured")
  13 + */
  14 +class SecuredController extends Controller
  15 +{
  16 + /**
  17 + * @Route("/login", name="_demo_login")
  18 + * @Template()
  19 + */
  20 + public function loginAction()
  21 + {
  22 + if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
  23 + $error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
  24 + } else {
  25 + $error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
  26 + }
  27 +
  28 + return array(
  29 + 'last_username' => $this->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
  30 + 'error' => $error,
  31 + );
  32 + }
  33 +
  34 + /**
  35 + * @Route("/login_check", name="_security_check")
  36 + */
  37 + public function securityCheckAction()
  38 + {
  39 + // The security layer will intercept this request
  40 + }
  41 +
  42 + /**
  43 + * @Route("/logout", name="_demo_logout")
  44 + */
  45 + public function logoutAction()
  46 + {
  47 + // The security layer will intercept this request
  48 + }
  49 +
  50 + /**
  51 + * @Route("/hello", defaults={"name"="World"}),
  52 + * @Route("/hello/{name}", name="_demo_secured_hello")
  53 + * @Template()
  54 + */
  55 + public function helloAction($name)
  56 + {
  57 + return array('name' => $name);
  58 + }
  59 +
  60 + /**
  61 + * @Route("/hello/admin/{name}", name="_demo_secured_hello_admin")
  62 + * @Secure(roles="ROLE_ADMIN")
  63 + * @Template()
  64 + */
  65 + public function helloadminAction($name)
  66 + {
  67 + return array('name' => $name);
  68 + }
  69 +}
13 src/Acme/DemoBundle/Controller/WelcomeController.php
... ... @@ -0,0 +1,13 @@
  1 +<?php
  2 +
  3 +namespace Acme\DemoBundle\Controller;
  4 +
  5 +use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6 +
  7 +class WelcomeController extends Controller
  8 +{
  9 + public function indexAction()
  10 + {
  11 + return $this->render('AcmeDemoBundle:Welcome:index.html.twig');
  12 + }
  13 +}
25 src/Acme/DemoBundle/ControllerListener.php
... ... @@ -0,0 +1,25 @@
  1 +<?php
  2 +
  3 +namespace Acme\DemoBundle;
  4 +
  5 +use Symfony\Component\EventDispatcher\Event;
  6 +use Symfony\Component\HttpKernel\HttpKernelInterface;
  7 +use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
  8 +use Acme\DemoBundle\Twig\Extension\DemoExtension;
  9 +
  10 +class ControllerListener
  11 +{
  12 + protected $extension;
  13 +
  14 + public function __construct(DemoExtension $extension)
  15 + {
  16 + $this->extension = $extension;
  17 + }
  18 +
  19 + public function onKernelController(FilterControllerEvent $event)
  20 + {
  21 + if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
  22 + $this->extension->setController($event->getController());
  23 + }
  24 + }
  25 +}
22 src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php
... ... @@ -0,0 +1,22 @@
  1 +<?php
  2 +
  3 +namespace Acme\DemoBundle\DependencyInjection;
  4 +
  5 +use Symfony\Component\DependencyInjection\ContainerBuilder;
  6 +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  7 +use Symfony\Component\HttpKernel\DependencyInjection\Extension;
  8 +use Symfony\Component\Config\FileLocator;
  9 +
  10 +class AcmeDemoExtension extends Extension
  11 +{
  12 + public function load(array $configs, ContainerBuilder $container)
  13 + {
  14 + $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
  15 + $loader->load('services.xml');
  16 + }
  17 +
  18 + public function getAlias()
  19 + {
  20 + return 'acme_demo';
  21 + }
  22 +}
15 src/Acme/DemoBundle/Form/ContactType.php
... ... @@ -0,0 +1,15 @@
  1 +<?php
  2 +
  3 +namespace Acme\DemoBundle\Form;
  4 +
  5 +use Symfony\Component\Form\AbstractType;
  6 +use Symfony\Component\Form\FormBuilder;
  7 +
  8 +class ContactType extends AbstractType
  9 +{
  10 + public function buildForm(FormBuilder $builder, array $options)
  11 + {
  12 + $builder->add('email', 'email');
  13 + $builder->add('message', 'textarea');
  14 + }
  15 +}
18 src/Acme/DemoBundle/Resources/config/services.xml
... ... @@ -0,0 +1,18 @@
  1 +<?xml version="1.0" ?>
  2 +
  3 +<container xmlns="http://symfony.com/schema/dic/services"
  4 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5 + xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
  6 +
  7 + <services>
  8 + <service id="twig.extension.acme.demo" class="Acme\DemoBundle\Twig\Extension\DemoExtension" public="false">
  9 + <tag name="twig.extension" />
  10 + <argument type="service" id="twig.loader" />
  11 + </service>
  12 +
  13 + <service id="acme.demo.listener" class="Acme\DemoBundle\ControllerListener">
  14 + <tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" />
  15 + <argument type="service" id="twig.extension.acme.demo" />
  16 + </service>
  17 + </services>
  18 +</container>
293 src/Acme/DemoBundle/Resources/public/css/demo.css
... ... @@ -0,0 +1,293 @@
  1 +/*
  2 +Copyright (c) 2010, Yahoo! Inc. All rights reserved.
  3 +Code licensed under the BSD License:
  4 +http://developer.yahoo.com/yui/license.html
  5 +version: 2.8.2r1
  6 +
  7 +Reset
  8 +*/
  9 +
  10 +html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}del,ins{text-decoration:none;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#000;}input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}input,button,textarea,select{*font-size:100%;}
  11 +
  12 +html, body
  13 +{
  14 + background-color: #EFEFEF;
  15 +}
  16 +
  17 +body
  18 +{
  19 + font-size: 14px;
  20 + font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
  21 + color: #313131;
  22 +}
  23 +
  24 +a
  25 +{
  26 + color: #08C;
  27 + text-decoration: none;
  28 +}
  29 +
  30 +a:hover
  31 +{
  32 + text-decoration: underline;
  33 +}
  34 +
  35 +strong
  36 +{
  37 + font-weight: bold;
  38 +}
  39 +
  40 +em
  41 +{
  42 + font-style: italic;
  43 +}
  44 +
  45 +h1, h2, h3
  46 +{
  47 + font-family: Georgia, "Times New Roman", Times, serif;
  48 + color: #404040;
  49 +}
  50 +
  51 +h1
  52 +{
  53 + font-size: 45px;
  54 + padding-bottom: 30px;
  55 +}
  56 +
  57 +h2
  58 +{
  59 + font-weight: bold;
  60 + color: #FFFFFF;
  61 + /* Font is duplicated of body (sans-serif) */