diff --git a/.gitignore b/.gitignore index 3268211..8fdafe1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,33 @@ -.*.sw? +# Bootstrap +app/bootstrap* +app/SymfonyRequirements.php + +# Symfony directories +vendor/* +app/logs/* +app/cache/* +web/uploads/* +web/bundles/* + +# Configuration files +app/config/parameters.ini + +# Composer related files +composer.lock +vendor/composer/installed.json + +# Assetic-generated .js and .css files +web/js/* +web/css/* + +# Project's upload directory +web/upload/* + +# Spool directory +spool/* + +# Backup files +*~ + +#NetBeans private files +/nbproject/private/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 3719455..0000000 --- a/.gitmodules +++ /dev/null @@ -1,51 +0,0 @@ -[submodule "vendor/symfony"] - path = vendor/symfony - url = http://github.com/symfony/symfony.git -[submodule "vendor/twig"] - path = vendor/twig - url = http://github.com/fabpot/Twig.git -[submodule "vendor/monolog"] - path = vendor/monolog - url = http://github.com/Seldaek/monolog.git -[submodule "vendor/doctrine-common"] - path = vendor/doctrine-common - url = http://github.com/doctrine/common.git -[submodule "vendor/doctrine-dbal"] - path = vendor/doctrine-dbal - url = http://github.com/doctrine/dbal.git -[submodule "vendor/doctrine"] - path = vendor/doctrine - url = http://github.com/doctrine/doctrine2.git -[submodule "vendor/swiftmailer"] - path = vendor/swiftmailer - url = http://github.com/swiftmailer/swiftmailer.git -[submodule "vendor/assetic"] - path = vendor/assetic - url = http://github.com/kriswallsmith/assetic.git -[submodule "vendor/twig-extensions"] - path = vendor/twig-extensions - url = http://github.com/fabpot/Twig-extensions.git -[submodule "vendor/metadata"] - path = vendor/metadata - url = http://github.com/schmittjoh/metadata.git -[submodule "vendor/bundles/Sensio/Bundle/FrameworkExtraBundle"] - path = vendor/bundles/Sensio/Bundle/FrameworkExtraBundle - url = http://github.com/sensio/SensioFrameworkExtraBundle.git -[submodule "vendor/bundles/JMS/SecurityExtraBundle"] - path = vendor/bundles/JMS/SecurityExtraBundle - url = http://github.com/schmittjoh/JMSSecurityExtraBundle.git -[submodule "vendor/bundles/Sensio/Bundle/DistributionBundle"] - path = vendor/bundles/Sensio/Bundle/DistributionBundle - url = http://github.com/sensio/SensioDistributionBundle.git -[submodule "vendor/bundles/Sensio/Bundle/GeneratorBundle"] - path = vendor/bundles/Sensio/Bundle/GeneratorBundle - url = http://github.com/sensio/SensioGeneratorBundle.git -[submodule "vendor/bundles/Symfony/Bundle/AsseticBundle"] - path = vendor/bundles/Symfony/Bundle/AsseticBundle - url = http://github.com/symfony/AsseticBundle.git -[submodule "vendor/tcpdf"] - path = vendor/tcpdf - url = git://tcpdf.git.sourceforge.net/gitroot/tcpdf/tcpdf -[submodule "vendor/bundles/Io/TcpdfBundle"] - path = vendor/bundles/Io/TcpdfBundle - url = git://github.com/ioalessio/IoTcpdfBundle.git diff --git a/README.md b/README.md index 864d170..186b846 100644 --- a/README.md +++ b/README.md @@ -2,146 +2,173 @@ Symfony Standard Edition ======================== Welcome to the Symfony Standard Edition - a fully-functional Symfony2 -application that you can use as the skeleton for your new app. If you want -to learn more about the features included, see the "What's Inside?" section. +application that you can use as the skeleton for your new applications. -This document contains information on how to download and start using Symfony. -For a more detailed explanation, see the -[Installation chapter](http://symfony.com/doc/current/book/installation.html) -of the Symfony Documentation. +This document contains information on how to download, install, and start +using Symfony. For a more detailed explanation, see the [Installation][1] +chapter of the Symfony Documentation. -1) Download the Standard Edition --------------------------------- +1) Installing the Standard Edition +---------------------------------- -If you've already downloaded the standard edition, and unpacked it somewhere -within your web root directory, then move on to the "Installation" section. +When it comes to installing the Symfony Standard Edition, you have the +following options. -To download the standard edition, you have two options: +### Use Composer (*recommended*) -### Download an archive file (*recommended*) +As Symfony uses [Composer][2] to manage its dependencies, the recommended way +to create a new project is to use it. -The easiest way to get started is to download an archive of the standard edition -(http://symfony.com/download). Unpack it somewhere under your web server root -directory and you're done. The web root is wherever your web server (e.g. Apache) -looks when you access `http://localhost` in a browser. +If you don't have Composer yet, download it following the instructions on +http://getcomposer.org/ or just run the following command: -### Clone the git Repository + curl -s http://getcomposer.org/installer | php -We highly recommend that you download the packaged version of this distribution. -But if you still want to use Git, you are on your own. +Then, use the `create-project` command to generate a new Symfony application: -Run the following commands: + php composer.phar create-project symfony/framework-standard-edition path/to/install - git clone http://github.com/symfony/symfony-standard.git - cd symfony-standard - rm -rf .git +Composer will install Symfony and all its dependencies under the +`path/to/install` directory. -2) Installation ---------------- +### Download an Archive File -Once you've downloaded the standard edition, installation is easy, and basically -involves making sure your system is ready for Symfony. +To quickly test Symfony, you can also download an [archive][3] of the Standard +Edition and unpack it somewhere under your web server root directory. -### a) Check your System Configuration +If you downloaded an archive "without vendors", you also need to install all +the necessary dependencies. Download composer (see above) and run the +following command: -Before you begin, make sure that your local system is properly configured -for Symfony. To do this, execute the following: + php composer.phar install + +2) Checking your System Configuration +------------------------------------- + +Before starting coding, make sure that your local system is properly +configured for Symfony. + +Execute the `check.php` script from the command line: php app/check.php -If you get any warnings or recommendations, fix these now before moving on. +Access the `config.php` script from a browser: -### b) Install the Vendor Libraries + http://localhost/path/to/symfony/app/web/config.php -If you downloaded the archive "without vendors" or installed via git, then -you need to download all of the necessary vendor libraries. If you're not -sure if you need to do this, check to see if you have a ``vendor/`` directory. -If you don't, or if that directory is empty, run the following: +If you get any warnings or recommendations, fix them before moving on. - php bin/vendors install +3) Browsing the Demo Application +-------------------------------- -Note that you **must** have git installed and be able to execute the `git` -command to execute this script. If you don't have git available, either install -it or download Symfony with the vendor libraries already included. +Congratulations! You're now ready to use Symfony. -### c) Access the Application via the Browser - -Congratulations! You're now ready to use Symfony. If you've unzipped Symfony -in the web root of your computer, then you should be able to access the -web version of the Symfony requirements check via: - - http://localhost/Symfony/web/config.php - -If everything looks good, click the "Bypass configuration and go to the Welcome page" -link to load up your first Symfony page. +From the `config.php` page, click the "Bypass configuration and go to the +Welcome page" link to load up your first Symfony page. You can also use a web-based configurator by clicking on the "Configure your -Symfony Application online" link of the ``config.php`` page. +Symfony Application online" link of the `config.php` page. To see a real-live Symfony page in action, access the following page: web/app_dev.php/demo/hello/Fabien -3) Learn about Symfony! ------------------------ +4) Getting started with Symfony +------------------------------- -This distribution is meant to be the starting point for your application, -but it also contains some sample code that you can learn from and play with. +This distribution is meant to be the starting point for your Symfony +applications, but it also contains some sample code that you can learn from +and play with. -A great way to start learning Symfony is via the [Quick Tour](http://symfony.com/doc/current/quick_tour/the_big_picture.html), -which will take you through all the basic features of Symfony2 and the test -pages that are available in the standard edition. +A great way to start learning Symfony is via the [Quick Tour][4], which will +take you through all the basic features of Symfony2. Once you're feeling good, you can move onto reading the official -[Symfony2 book](http://symfony.com/doc/current/). +[Symfony2 book][5]. -Using this Edition as the Base of your Application --------------------------------------------------- - -Since the standard edition is fully-configured and comes with some examples, -you'll need to make a few changes before using it to build your application. - -The distribution is configured with the following defaults: - -* Twig is the only configured template engine; -* Doctrine ORM/DBAL is configured; -* Swiftmailer is configured; -* Annotations for everything are enabled. - -A default bundle, ``AcmeDemoBundle``, shows you Symfony2 in action. After +A default bundle, `AcmeDemoBundle`, shows you Symfony2 in action. After playing with it, you can remove it by following these steps: -* delete the ``src/Acme`` directory; -* remove the routing entries referencing AcmeBundle in ``app/config/routing_dev.yml``; -* remove the AcmeBundle from the registered bundles in ``app/AppKernel.php``; + * delete the `src/Acme` directory; + + * remove the routing entries referencing AcmeBundle in + `app/config/routing_dev.yml`; + + * remove the AcmeBundle from the registered bundles in `app/AppKernel.php`; + + * remove the `web/bundles/acmedemo` directory; + + * remove the `security.providers`, `security.firewalls.login` and + `security.firewalls.secured_area` entries in the `security.yml` file or + tweak the security configuration to fit your needs. What's inside? --------------- -The Symfony Standard Edition comes pre-configured with the following bundles: -* **FrameworkBundle** - The core Symfony framework bundle -* **SensioFrameworkExtraBundle** - Adds several enhancements, including template - and routing annotation capability ([documentation](http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html)) -* **DoctrineBundle** - Adds support for the Doctrine ORM - ([documentation](http://symfony.com/doc/current/book/doctrine.html)) -* **TwigBundle** - Adds support for the Twig templating engine - ([documentation](http://symfony.com/doc/current/book/templating.html)) -* **SecurityBundle** - Adds security by integrating Symfony's security component - ([documentation](http://symfony.com/doc/current/book/security.html)) -* **SwiftmailerBundle** - Adds support for Swiftmailer, a library for sending emails - ([documentation](http://symfony.com/doc/2.0/cookbook/email.html)) -* **MonologBundle** - Adds support for Monolog, a logging library - ([documentation](http://symfony.com/doc/2.0/cookbook/logging/monolog.html)) -* **AsseticBundle** - Adds support for Assetic, an asset processing library - ([documentation](http://symfony.com/doc/2.0/cookbook/assetic/asset_management.html)) -* **JMSSecurityExtraBundle** - Allows security to be added via annotations - ([documentation](http://symfony.com/doc/current/bundles/JMSSecurityExtraBundle/index.html)) -* **WebProfilerBundle** (in dev/test env) - Adds profiling functionality and - the web debug toolbar -* **SensioDistributionBundle** (in dev/test env) - Adds functionality for configuring - and working with Symfony distributions -* **SensioGeneratorBundle** (in dev/test env) - Adds code generation capabilities - ([documentation](http://symfony.com/doc/current/bundles/SensioGeneratorBundle/index.html)) -* **AcmeDemoBundle** (in dev/test env) - A demo bundle with some example code +The Symfony Standard Edition is configured with the following defaults: + + * Twig is the only configured template engine; + + * Doctrine ORM/DBAL is configured; + + * Swiftmailer is configured; + + * Annotations for everything are enabled. + +It comes pre-configured with the following bundles: + + * **FrameworkBundle** - The core Symfony framework bundle + + * [**SensioFrameworkExtraBundle**][6] - Adds several enhancements, including + template and routing annotation capability + + * [**DoctrineBundle**][7] - Adds support for the Doctrine ORM + + * [**TwigBundle**][8] - Adds support for the Twig templating engine + + * [**SecurityBundle**][9] - Adds security by integrating Symfony's security + component + + * [**SwiftmailerBundle**][10] - Adds support for Swiftmailer, a library for + sending emails + + * [**MonologBundle**][11] - Adds support for Monolog, a logging library + + * [**AsseticBundle**][12] - Adds support for Assetic, an asset processing + library + + * [**JMSSecurityExtraBundle**][13] - Allows security to be added via + annotations + + * [**JMSDiExtraBundle**][14] - Adds more powerful dependency injection + features + + * **WebProfilerBundle** (in dev/test env) - Adds profiling functionality and + the web debug toolbar + + * **SensioDistributionBundle** (in dev/test env) - Adds functionality for + configuring and working with Symfony distributions + + * [**SensioGeneratorBundle**][15] (in dev/test env) - Adds code generation + capabilities + + * **AcmeDemoBundle** (in dev/test env) - A demo bundle with some example + code Enjoy! + +[1]: http://symfony.com/doc/2.1/book/installation.html +[2]: http://getcomposer.org/ +[3]: http://symfony.com/download +[4]: http://symfony.com/doc/2.1/quick_tour/the_big_picture.html +[5]: http://symfony.com/doc/2.1/index.html +[6]: http://symfony.com/doc/2.1/bundles/SensioFrameworkExtraBundle/index.html +[7]: http://symfony.com/doc/2.1/book/doctrine.html +[8]: http://symfony.com/doc/2.1/book/templating.html +[9]: http://symfony.com/doc/2.1/book/security.html +[10]: http://symfony.com/doc/2.1/cookbook/email.html +[11]: http://symfony.com/doc/2.1/cookbook/logging/monolog.html +[12]: http://symfony.com/doc/2.1/cookbook/assetic/asset_management.html +[13]: http://jmsyst.com/bundles/JMSSecurityExtraBundle/master +[14]: http://jmsyst.com/bundles/JMSDiExtraBundle/master +[15]: http://symfony.com/doc/2.1/bundles/SensioGeneratorBundle/index.html diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 0000000..0f7cdfc --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,257 @@ +Symfony Standard Edition Upgrade +================================ + +From Symfony 2.0 to Symfony 2.1 +------------------------------- + +### Project Dependencies + +As of Symfony 2.1, project dependencies are managed by +[Composer](http://getcomposer.org/): + +* The `bin/vendors` script can be removed as `composer.phar` does all the work + now (it is recommended to install it globally on your machine). + +* The `deps` file need to be replaced with the `composer.json` one. + +* The `composer.lock` is the equivalent of the generated `deps.lock` file and + it is automatically generated by Composer. + +Download the default +[`composer.json`](https://raw.github.com/symfony/symfony-standard/master/composer.json) +and +[`composer.lock`](https://raw.github.com/symfony/symfony-standard/master/composer.lock) +files for Symfony 2.1 and put them into the main directory of your project. If +you have customized your `deps` file, move the added dependencies to the +`composer.json` file (many bundles and PHP libraries are already available as +Composer packages -- search for them on [Packagist](http://packagist.org/)). + +Remove your current `vendor` directory. + +Finally, run Composer: + + $ composer.phar install + +### `app/autoload.php` + +The default `autoload.php` reads as follows (it has been simplified a lot as +autoloading for libraries and bundles declared in your `composer.json` file is +automatically managed by the Composer autoloader): + + add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs'); + } + + AnnotationRegistry::registerLoader(array($loader, 'loadClass')); + + return $loader; + +### `app/config/config.yml` + +The `framework.charset` setting must be removed. If you are not using `UTF-8` +for your application, override the `getCharset()` method in your `AppKernel` +class instead: + + class AppKernel extends Kernel + { + public function getCharset() + { + return 'ISO-8859-1'; + } + + // ... + } + +You might want to add the new `strict_requirements` parameter to +`framework.router` (it avoids fatal errors in the production environment when +a link cannot be generated): + + framework: + router: + strict_requirements: %kernel.debug% + +You can even disable the requirements check on production with `null` as you should +know that the parameters for URL generation always pass the requirements, e.g. by +validating them beforehand. This additionally enhances performance. See +[config_prod.yml](https://github.com/symfony/symfony-standard/blob/master/app/config/config_prod.yml). + +The `default_locale` parameter is now a setting of the main `framework` +configuration (it was under the `framework.session` in 2.0): + + framework: + default_locale: %locale% + +The `auto_start` setting under `framework.session` must be removed as it is +not used anymore (the session is now always started on-demand). If +`auto_start` was the only setting under the `framework.session` entry, don't +remove it entirely, but set its value to `~` (`~` means `null` in YAML) +instead: + + framework: + session: ~ + +The `trust_proxy_headers` setting was added in the default configuration file +(as it should be set to `true` when you install your application behind a +reverse proxy): + + framework: + trust_proxy_headers: false + +An empty `bundles` entry was added to the `assetic` configuration: + + assetic: + bundles: [] + +The default `swiftmailer` configuration now has the `spool` setting configured +to the `memory` type to defer email sending after the response is sent to the +user (recommended for better end-user performance): + + swiftmailer: + spool: { type: memory } + +The `jms_security_extra` configuration was moved to the `security.yml` +configuration file. + +### `app/config/config_dev.yml` + +An example of how to send all emails to a unique address was added: + + #swiftmailer: + # delivery_address: me@example.com + +### `app/config/config_test.yml` + +The `storage_id` setting must be changed to `session.storage.mock_file`: + + framework: + session: + storage_id: session.storage.mock_file + +### `app/config/parameters.ini` + +The file has been converted to a YAML file which reads as follows: + + parameters: + database_driver: pdo_mysql + database_host: localhost + database_port: ~ + database_name: symfony + database_user: root + database_password: ~ + + mailer_transport: smtp + mailer_host: localhost + mailer_user: ~ + mailer_password: ~ + + locale: en + secret: ThisTokenIsNotSoSecretChangeIt + +Note that if you convert your parameters file to YAML, you must also change +its reference in `app/config/config.yml`. + +### `app/config/routing_dev.yml` + +The `_assetic` entry was removed: + + #_assetic: + # resource: . + # type: assetic + +### `app/config/security.yml` + +Under `security.access_control`, the default rule for internal routes was changed: + + security: + access_control: + #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 } + +Under `security.providers`, the `in_memory` example was updated to the following: + + security: + providers: + in_memory: + memory: + users: + user: { password: userpass, roles: [ 'ROLE_USER' ] } + admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } + +### `app/AppKernel.php` + +The following bundles have been added to the list of default registered bundles: + + `new JMS\AopBundle\JMSAopBundle(), + `new JMS\DiExtraBundle\JMSDiExtraBundle($this), + +### `web/app.php` + +The default `web/app.php` file now reads as follows: + + register(true); + */ + + require_once __DIR__.'/../app/AppKernel.php'; + //require_once __DIR__.'/../app/AppCache.php'; + + $kernel = new AppKernel('prod', false); + $kernel->loadClassCache(); + //$kernel = new AppCache($kernel); + $request = Request::createFromGlobals(); + $response = $kernel->handle($request); + $response->send(); + $kernel->terminate($request, $response); + +### `web/app_dev.php` + +The default `web/app_dev.php` file now reads as follows: + + loadClassCache(); + $request = Request::createFromGlobals(); + $response = $kernel->handle($request); + $response->send(); + $kernel->terminate($request, $response); diff --git a/app/AppKernel.php b/app/AppKernel.php index 9e16e2d..a97dffd 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -13,9 +13,11 @@ class AppKernel extends Kernel new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), - new Symfony\Bundle\DoctrineBundle\DoctrineBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), + new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), + new JMS\AopBundle\JMSAopBundle(), + new JMS\DiExtraBundle\JMSDiExtraBundle($this), new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), new Io\TcpdfBundle\IoTcpdfBundle(), new GergelyPolonkai\FrontBundle\GergelyPolonkaiFrontBundle(), diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index 4b9151e..bafd28d 100644 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -4,7 +4,7 @@ {% block title %}Welcome!{% endblock %} {% block stylesheets %}{% endblock %} - + {% block body %}{% endblock %} diff --git a/app/autoload.php b/app/autoload.php index 3abbfcc..a68e37f 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -1,48 +1,16 @@ registerNamespaces(array( - 'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'), - 'Sensio' => __DIR__.'/../vendor/bundles', - 'JMS' => __DIR__.'/../vendor/bundles', - 'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib', - 'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib', - 'Doctrine' => __DIR__.'/../vendor/doctrine/lib', - 'Monolog' => __DIR__.'/../vendor/monolog/src', - 'Assetic' => __DIR__.'/../vendor/assetic/src', - 'Metadata' => __DIR__.'/../vendor/metadata/src', - 'Io' => __DIR__.'/../vendor/bundles', -)); -$loader->registerPrefixes(array( - 'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib', - 'Twig_' => __DIR__.'/../vendor/twig/lib', -)); +$loader = require __DIR__.'/../vendor/autoload.php'; // intl if (!function_exists('intl_get_error_code')) { - require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php'; + require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php'; - $loader->registerPrefixFallbacks(array(__DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs')); + $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs'); } -$loader->registerNamespaceFallbacks(array( - __DIR__.'/../src', -)); -$loader->register(); - -AnnotationRegistry::registerLoader(function($class) use ($loader) { - $loader->loadClass($class); - return class_exists($class, false); -}); -AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'); - -// Swiftmailer needs a special autoloader to allow -// the lazy loading of the init file (which is expensive) -require_once __DIR__.'/../vendor/swiftmailer/lib/classes/Swift.php'; -Swift::registerAutoload(__DIR__.'/../vendor/swiftmailer/lib/swift_init.php'); +AnnotationRegistry::registerLoader(array($loader, 'loadClass')); +return $loader; diff --git a/app/bootstrap.php.cache b/app/bootstrap.php.cache deleted file mode 100644 index 34be12c..0000000 --- a/app/bootstrap.php.cache +++ /dev/null @@ -1,1501 +0,0 @@ -parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag; - - $this->services = array(); - $this->scopes = array(); - $this->scopeChildren = array(); - $this->scopedServices = array(); - $this->scopeStacks = array(); - - $this->set('service_container', $this); - } - - - public function compile() - { - $this->parameterBag->resolve(); - - $this->parameterBag = new FrozenParameterBag($this->parameterBag->all()); - } - - - public function isFrozen() - { - return $this->parameterBag instanceof FrozenParameterBag; - } - - - public function getParameterBag() - { - return $this->parameterBag; - } - - - public function getParameter($name) - { - return $this->parameterBag->get($name); - } - - - public function hasParameter($name) - { - return $this->parameterBag->has($name); - } - - - public function setParameter($name, $value) - { - $this->parameterBag->set($name, $value); - } - - - public function set($id, $service, $scope = self::SCOPE_CONTAINER) - { - if (self::SCOPE_PROTOTYPE === $scope) { - throw new \InvalidArgumentException('You cannot set services of scope "prototype".'); - } - - $id = strtolower($id); - - if (self::SCOPE_CONTAINER !== $scope) { - if (!isset($this->scopedServices[$scope])) { - throw new \RuntimeException('You cannot set services of inactive scopes.'); - } - - $this->scopedServices[$scope][$id] = $service; - } - - $this->services[$id] = $service; - } - - - public function has($id) - { - $id = strtolower($id); - - return isset($this->services[$id]) || method_exists($this, 'get'.strtr($id, array('_' => '', '.' => '_')).'Service'); - } - - - public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) - { - $id = strtolower($id); - - if (isset($this->services[$id])) { - return $this->services[$id]; - } - - if (isset($this->loading[$id])) { - throw new ServiceCircularReferenceException($id, array_keys($this->loading)); - } - - if (method_exists($this, $method = 'get'.strtr($id, array('_' => '', '.' => '_')).'Service')) { - $this->loading[$id] = true; - - try { - $service = $this->$method(); - } catch (\Exception $e) { - unset($this->loading[$id]); - throw $e; - } - - unset($this->loading[$id]); - - return $service; - } - - if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) { - throw new ServiceNotFoundException($id); - } - } - - - public function getServiceIds() - { - $ids = array(); - $r = new \ReflectionClass($this); - foreach ($r->getMethods() as $method) { - if (preg_match('/^get(.+)Service$/', $method->getName(), $match)) { - $ids[] = self::underscore($match[1]); - } - } - - return array_unique(array_merge($ids, array_keys($this->services))); - } - - - public function enterScope($name) - { - if (!isset($this->scopes[$name])) { - throw new \InvalidArgumentException(sprintf('The scope "%s" does not exist.', $name)); - } - - if (self::SCOPE_CONTAINER !== $this->scopes[$name] && !isset($this->scopedServices[$this->scopes[$name]])) { - throw new \RuntimeException(sprintf('The parent scope "%s" must be active when entering this scope.', $this->scopes[$name])); - } - - if (isset($this->scopedServices[$name])) { - $services = array($this->services, $name => $this->scopedServices[$name]); - unset($this->scopedServices[$name]); - - foreach ($this->scopeChildren[$name] as $child) { - $services[$child] = $this->scopedServices[$child]; - unset($this->scopedServices[$child]); - } - - $this->services = call_user_func_array('array_diff_key', $services); - array_shift($services); - - if (!isset($this->scopeStacks[$name])) { - $this->scopeStacks[$name] = new \SplStack(); - } - $this->scopeStacks[$name]->push($services); - } - - $this->scopedServices[$name] = array(); - } - - - public function leaveScope($name) - { - if (!isset($this->scopedServices[$name])) { - throw new \InvalidArgumentException(sprintf('The scope "%s" is not active.', $name)); - } - - $services = array($this->services, $this->scopedServices[$name]); - unset($this->scopedServices[$name]); - foreach ($this->scopeChildren[$name] as $child) { - if (!isset($this->scopedServices[$child])) { - continue; - } - - $services[] = $this->scopedServices[$child]; - unset($this->scopedServices[$child]); - } - $this->services = call_user_func_array('array_diff_key', $services); - - if (isset($this->scopeStacks[$name]) && count($this->scopeStacks[$name]) > 0) { - $services = $this->scopeStacks[$name]->pop(); - $this->scopedServices += $services; - - array_unshift($services, $this->services); - $this->services = call_user_func_array('array_merge', $services); - } - } - - - public function addScope(ScopeInterface $scope) - { - $name = $scope->getName(); - $parentScope = $scope->getParentName(); - - if (self::SCOPE_CONTAINER === $name || self::SCOPE_PROTOTYPE === $name) { - throw new \InvalidArgumentException(sprintf('The scope "%s" is reserved.', $name)); - } - if (isset($this->scopes[$name])) { - throw new \InvalidArgumentException(sprintf('A scope with name "%s" already exists.', $name)); - } - if (self::SCOPE_CONTAINER !== $parentScope && !isset($this->scopes[$parentScope])) { - throw new \InvalidArgumentException(sprintf('The parent scope "%s" does not exist, or is invalid.', $parentScope)); - } - - $this->scopes[$name] = $parentScope; - $this->scopeChildren[$name] = array(); - - while ($parentScope !== self::SCOPE_CONTAINER) { - $this->scopeChildren[$parentScope][] = $name; - $parentScope = $this->scopes[$parentScope]; - } - } - - - public function hasScope($name) - { - return isset($this->scopes[$name]); - } - - - public function isScopeActive($name) - { - return isset($this->scopedServices[$name]); - } - - - static public function camelize($id) - { - return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $id); - } - - - static public function underscore($id) - { - return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.'))); - } -} -} - - - - -namespace Symfony\Component\HttpKernel -{ - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - - -interface HttpKernelInterface -{ - const MASTER_REQUEST = 1; - const SUB_REQUEST = 2; - - - function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); -} -} - - - - -namespace Symfony\Component\HttpKernel -{ - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\Config\Loader\LoaderInterface; - - -interface KernelInterface extends HttpKernelInterface, \Serializable -{ - - function registerBundles(); - - - function registerContainerConfiguration(LoaderInterface $loader); - - - function boot(); - - - function shutdown(); - - - function getBundles(); - - - function isClassInActiveBundle($class); - - - function getBundle($name, $first = true); - - - function locateResource($name, $dir = null, $first = true); - - - function getName(); - - - function getEnvironment(); - - - function isDebug(); - - - function getRootDir(); - - - function getContainer(); - - - function getStartTime(); - - - function getCacheDir(); - - - function getLogDir(); -} -} - - - - -namespace Symfony\Component\HttpKernel -{ - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Dumper\PhpDumper; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\DependencyInjection\Loader\IniFileLoader; -use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\DependencyInjection\Loader\ClosureLoader; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\HttpKernel\Config\FileLocator; -use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; -use Symfony\Component\HttpKernel\DependencyInjection\AddClassesToCachePass; -use Symfony\Component\HttpKernel\Debug\ErrorHandler; -use Symfony\Component\HttpKernel\Debug\ExceptionHandler; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\Loader\DelegatingLoader; -use Symfony\Component\Config\ConfigCache; -use Symfony\Component\ClassLoader\ClassCollectionLoader; -use Symfony\Component\ClassLoader\DebugUniversalClassLoader; - - -abstract class Kernel implements KernelInterface -{ - protected $bundles; - protected $bundleMap; - protected $container; - protected $rootDir; - protected $environment; - protected $debug; - protected $booted; - protected $name; - protected $startTime; - protected $classes; - - const VERSION = '2.0.15'; - const VERSION_ID = '20015'; - const MAJOR_VERSION = '2'; - const MINOR_VERSION = '0'; - const RELEASE_VERSION = '15'; - const EXTRA_VERSION = ''; - - - public function __construct($environment, $debug) - { - $this->environment = $environment; - $this->debug = (Boolean) $debug; - $this->booted = false; - $this->rootDir = $this->getRootDir(); - $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); - $this->classes = array(); - - if ($this->debug) { - $this->startTime = microtime(true); - } - - $this->init(); - } - - public function init() - { - if ($this->debug) { - ini_set('display_errors', 1); - error_reporting(-1); - - DebugUniversalClassLoader::enable(); - ErrorHandler::register(); - if ('cli' !== php_sapi_name()) { - ExceptionHandler::register(); - } - } else { - ini_set('display_errors', 0); - } - } - - public function __clone() - { - if ($this->debug) { - $this->startTime = microtime(true); - } - - $this->booted = false; - $this->container = null; - } - - - public function boot() - { - if (true === $this->booted) { - return; - } - - $this->initializeBundles(); - - $this->initializeContainer(); - - foreach ($this->getBundles() as $bundle) { - $bundle->setContainer($this->container); - $bundle->boot(); - } - - $this->booted = true; - } - - - public function shutdown() - { - if (false === $this->booted) { - return; - } - - $this->booted = false; - - foreach ($this->getBundles() as $bundle) { - $bundle->shutdown(); - $bundle->setContainer(null); - } - - $this->container = null; - } - - - public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true) - { - if (false === $this->booted) { - $this->boot(); - } - - return $this->getHttpKernel()->handle($request, $type, $catch); - } - - - protected function getHttpKernel() - { - return $this->container->get('http_kernel'); - } - - - public function getBundles() - { - return $this->bundles; - } - - - public function isClassInActiveBundle($class) - { - foreach ($this->getBundles() as $bundle) { - if (0 === strpos($class, $bundle->getNamespace())) { - return true; - } - } - - return false; - } - - - public function getBundle($name, $first = true) - { - if (!isset($this->bundleMap[$name])) { - throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() function of your %s.php file?', $name, get_class($this))); - } - - if (true === $first) { - return $this->bundleMap[$name][0]; - } - - return $this->bundleMap[$name]; - } - - - public function locateResource($name, $dir = null, $first = true) - { - if ('@' !== $name[0]) { - throw new \InvalidArgumentException(sprintf('A resource name must start with @ ("%s" given).', $name)); - } - - if (false !== strpos($name, '..')) { - throw new \RuntimeException(sprintf('File name "%s" contains invalid characters (..).', $name)); - } - - $bundleName = substr($name, 1); - $path = ''; - if (false !== strpos($bundleName, '/')) { - list($bundleName, $path) = explode('/', $bundleName, 2); - } - - $isResource = 0 === strpos($path, 'Resources') && null !== $dir; - $overridePath = substr($path, 9); - $resourceBundle = null; - $bundles = $this->getBundle($bundleName, false); - $files = array(); - - foreach ($bundles as $bundle) { - if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { - if (null !== $resourceBundle) { - throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', - $file, - $resourceBundle, - $dir.'/'.$bundles[0]->getName().$overridePath - )); - } - - if ($first) { - return $file; - } - $files[] = $file; - } - - if (file_exists($file = $bundle->getPath().'/'.$path)) { - if ($first && !$isResource) { - return $file; - } - $files[] = $file; - $resourceBundle = $bundle->getName(); - } - } - - if (count($files) > 0) { - return $first && $isResource ? $files[0] : $files; - } - - throw new \InvalidArgumentException(sprintf('Unable to find file "%s".', $name)); - } - - - public function getName() - { - return $this->name; - } - - - public function getEnvironment() - { - return $this->environment; - } - - - public function isDebug() - { - return $this->debug; - } - - - public function getRootDir() - { - if (null === $this->rootDir) { - $r = new \ReflectionObject($this); - $this->rootDir = str_replace('\\', '/', dirname($r->getFileName())); - } - - return $this->rootDir; - } - - - public function getContainer() - { - return $this->container; - } - - - public function loadClassCache($name = 'classes', $extension = '.php') - { - if (!$this->booted && file_exists($this->getCacheDir().'/classes.map')) { - ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension); - } - } - - - public function setClassCache(array $classes) - { - file_put_contents($this->getCacheDir().'/classes.map', sprintf('debug ? $this->startTime : -INF; - } - - - public function getCacheDir() - { - return $this->rootDir.'/cache/'.$this->environment; - } - - - public function getLogDir() - { - return $this->rootDir.'/logs'; - } - - - protected function initializeBundles() - { - $this->bundles = array(); - $topMostBundles = array(); - $directChildren = array(); - - foreach ($this->registerBundles() as $bundle) { - $name = $bundle->getName(); - if (isset($this->bundles[$name])) { - throw new \LogicException(sprintf('Trying to register two bundles with the same name "%s"', $name)); - } - $this->bundles[$name] = $bundle; - - if ($parentName = $bundle->getParent()) { - if (isset($directChildren[$parentName])) { - throw new \LogicException(sprintf('Bundle "%s" is directly extended by two bundles "%s" and "%s".', $parentName, $name, $directChildren[$parentName])); - } - if ($parentName == $name) { - throw new \LogicException(sprintf('Bundle "%s" can not extend itself.', $name)); - } - $directChildren[$parentName] = $name; - } else { - $topMostBundles[$name] = $bundle; - } - } - - if (count($diff = array_values(array_diff(array_keys($directChildren), array_keys($this->bundles))))) { - throw new \LogicException(sprintf('Bundle "%s" extends bundle "%s", which is not registered.', $directChildren[$diff[0]], $diff[0])); - } - - $this->bundleMap = array(); - foreach ($topMostBundles as $name => $bundle) { - $bundleMap = array($bundle); - $hierarchy = array($name); - - while (isset($directChildren[$name])) { - $name = $directChildren[$name]; - array_unshift($bundleMap, $this->bundles[$name]); - $hierarchy[] = $name; - } - - foreach ($hierarchy as $bundle) { - $this->bundleMap[$bundle] = $bundleMap; - array_pop($bundleMap); - } - } - - } - - - protected function getContainerClass() - { - return $this->name.ucfirst($this->environment).($this->debug ? 'Debug' : '').'ProjectContainer'; - } - - - protected function getContainerBaseClass() - { - return 'Container'; - } - - - protected function initializeContainer() - { - $class = $this->getContainerClass(); - $cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug); - $fresh = true; - if (!$cache->isFresh()) { - $container = $this->buildContainer(); - $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); - - $fresh = false; - } - - require_once $cache; - - $this->container = new $class(); - $this->container->set('kernel', $this); - - if (!$fresh && $this->container->has('cache_warmer')) { - $this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir')); - } - } - - - protected function getKernelParameters() - { - $bundles = array(); - foreach ($this->bundles as $name => $bundle) { - $bundles[$name] = get_class($bundle); - } - - return array_merge( - array( - 'kernel.root_dir' => $this->rootDir, - 'kernel.environment' => $this->environment, - 'kernel.debug' => $this->debug, - 'kernel.name' => $this->name, - 'kernel.cache_dir' => $this->getCacheDir(), - 'kernel.logs_dir' => $this->getLogDir(), - 'kernel.bundles' => $bundles, - 'kernel.charset' => 'UTF-8', - 'kernel.container_class' => $this->getContainerClass(), - ), - $this->getEnvParameters() - ); - } - - - protected function getEnvParameters() - { - $parameters = array(); - foreach ($_SERVER as $key => $value) { - if (0 === strpos($key, 'SYMFONY__')) { - $parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value; - } - } - - return $parameters; - } - - - protected function buildContainer() - { - foreach (array('cache' => $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) { - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true)) { - throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); - } - } elseif (!is_writable($dir)) { - throw new \RuntimeException(sprintf("Unable to write in the %s directory (%s)\n", $name, $dir)); - } - } - - $container = new ContainerBuilder(new ParameterBag($this->getKernelParameters())); - $extensions = array(); - foreach ($this->bundles as $bundle) { - $bundle->build($container); - - if ($extension = $bundle->getContainerExtension()) { - $container->registerExtension($extension); - $extensions[] = $extension->getAlias(); - } - - if ($this->debug) { - $container->addObjectResource($bundle); - } - } - $container->addObjectResource($this); - - $container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions)); - - if (null !== $cont = $this->registerContainerConfiguration($this->getContainerLoader($container))) { - $container->merge($cont); - } - - $container->addCompilerPass(new AddClassesToCachePass($this)); - $container->compile(); - - return $container; - } - - - protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, $class, $baseClass) - { - $dumper = new PhpDumper($container); - $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass)); - if (!$this->debug) { - $content = self::stripComments($content); - } - - $cache->write($content, $container->getResources()); - } - - - protected function getContainerLoader(ContainerInterface $container) - { - $locator = new FileLocator($this); - $resolver = new LoaderResolver(array( - new XmlFileLoader($container, $locator), - new YamlFileLoader($container, $locator), - new IniFileLoader($container, $locator), - new PhpFileLoader($container, $locator), - new ClosureLoader($container), - )); - - return new DelegatingLoader($resolver); - } - - - static public function stripComments($source) - { - if (!function_exists('token_get_all')) { - return $source; - } - - $output = ''; - foreach (token_get_all($source) as $token) { - if (is_string($token)) { - $output .= $token; - } elseif (!in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { - $output .= $token[1]; - } - } - - $output = preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $output); - - return $output; - } - - public function serialize() - { - return serialize(array($this->environment, $this->debug)); - } - - public function unserialize($data) - { - list($environment, $debug) = unserialize($data); - - $this->__construct($environment, $debug); - } -} -} - - - - -namespace Symfony\Component\ClassLoader -{ - - -class ClassCollectionLoader -{ - static private $loaded; - - - static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php') - { - if (isset(self::$loaded[$name])) { - return; - } - - self::$loaded[$name] = true; - - if ($adaptive) { - $classes = array_diff($classes, get_declared_classes(), get_declared_interfaces()); - - $name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5); - } - - $cache = $cacheDir.'/'.$name.$extension; - - $reload = false; - if ($autoReload) { - $metadata = $cacheDir.'/'.$name.$extension.'.meta'; - if (!file_exists($metadata) || !file_exists($cache)) { - $reload = true; - } else { - $time = filemtime($cache); - $meta = unserialize(file_get_contents($metadata)); - - if ($meta[1] != $classes) { - $reload = true; - } else { - foreach ($meta[0] as $resource) { - if (!file_exists($resource) || filemtime($resource) > $time) { - $reload = true; - - break; - } - } - } - } - } - - if (!$reload && file_exists($cache)) { - require_once $cache; - - return; - } - - $files = array(); - $content = ''; - foreach ($classes as $class) { - if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) { - throw new \InvalidArgumentException(sprintf('Unable to load class "%s"', $class)); - } - - $r = new \ReflectionClass($class); - $files[] = $r->getFileName(); - - $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName())); - - if (!$r->inNamespace()) { - $c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n"; - } else { - $c = self::fixNamespaceDeclarations('namespaces; - } - - - public function getPrefixes() - { - return $this->prefixes; - } - - - public function getNamespaceFallbacks() - { - return $this->namespaceFallbacks; - } - - - public function getPrefixFallbacks() - { - return $this->prefixFallbacks; - } - - - public function registerNamespaceFallbacks(array $dirs) - { - $this->namespaceFallbacks = $dirs; - } - - - public function registerPrefixFallbacks(array $dirs) - { - $this->prefixFallbacks = $dirs; - } - - - public function registerNamespaces(array $namespaces) - { - foreach ($namespaces as $namespace => $locations) { - $this->namespaces[$namespace] = (array) $locations; - } - } - - - public function registerNamespace($namespace, $paths) - { - $this->namespaces[$namespace] = (array) $paths; - } - - - public function registerPrefixes(array $classes) - { - foreach ($classes as $prefix => $locations) { - $this->prefixes[$prefix] = (array) $locations; - } - } - - - public function registerPrefix($prefix, $paths) - { - $this->prefixes[$prefix] = (array) $paths; - } - - - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - require $file; - } - } - - - public function findFile($class) - { - if ('\\' == $class[0]) { - $class = substr($class, 1); - } - - if (false !== $pos = strrpos($class, '\\')) { - $namespace = substr($class, 0, $pos); - foreach ($this->namespaces as $ns => $dirs) { - if (0 !== strpos($namespace, $ns)) { - continue; - } - - foreach ($dirs as $dir) { - $className = substr($class, $pos + 1); - $file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php'; - if (file_exists($file)) { - return $file; - } - } - } - - foreach ($this->namespaceFallbacks as $dir) { - $file = $dir.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - return $file; - } - } - } else { - foreach ($this->prefixes as $prefix => $dirs) { - if (0 !== strpos($class, $prefix)) { - continue; - } - - foreach ($dirs as $dir) { - $file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - return $file; - } - } - } - - foreach ($this->prefixFallbacks as $dir) { - $file = $dir.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - return $file; - } - } - } - } -} -} - - - - -namespace Symfony\Component\HttpKernel\Bundle -{ - -use Symfony\Component\DependencyInjection\ContainerAware; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\Console\Application; -use Symfony\Component\Finder\Finder; - - -abstract class Bundle extends ContainerAware implements BundleInterface -{ - protected $name; - protected $reflected; - protected $extension; - - - public function boot() - { - } - - - public function shutdown() - { - } - - - public function build(ContainerBuilder $container) - { - } - - - public function getContainerExtension() - { - if (null === $this->extension) { - $basename = preg_replace('/Bundle$/', '', $this->getName()); - - $class = $this->getNamespace().'\\DependencyInjection\\'.$basename.'Extension'; - if (class_exists($class)) { - $extension = new $class(); - - $expectedAlias = Container::underscore($basename); - if ($expectedAlias != $extension->getAlias()) { - throw new \LogicException(sprintf( - 'The extension alias for the default extension of a '. - 'bundle must be the underscored version of the '. - 'bundle name ("%s" instead of "%s")', - $expectedAlias, $extension->getAlias() - )); - } - - $this->extension = $extension; - } else { - $this->extension = false; - } - } - - if ($this->extension) { - return $this->extension; - } - } - - - public function getNamespace() - { - if (null === $this->reflected) { - $this->reflected = new \ReflectionObject($this); - } - - return $this->reflected->getNamespaceName(); - } - - - public function getPath() - { - if (null === $this->reflected) { - $this->reflected = new \ReflectionObject($this); - } - - return dirname($this->reflected->getFileName()); - } - - - public function getParent() - { - return null; - } - - - final public function getName() - { - if (null !== $this->name) { - return $this->name; - } - - $name = get_class($this); - $pos = strrpos($name, '\\'); - - return $this->name = false === $pos ? $name : substr($name, $pos + 1); - } - - - public function registerCommands(Application $application) - { - if (!$dir = realpath($this->getPath().'/Command')) { - return; - } - - $finder = new Finder(); - $finder->files()->name('*Command.php')->in($dir); - - $prefix = $this->getNamespace().'\\Command'; - foreach ($finder as $file) { - $ns = $prefix; - if ($relativePath = $file->getRelativePath()) { - $ns .= '\\'.strtr($relativePath, '/', '\\'); - } - $r = new \ReflectionClass($ns.'\\'.$file->getBasename('.php')); - if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract()) { - $application->add($r->newInstance()); - } - } - } -} -} - - - - -namespace Symfony\Component\HttpKernel\Bundle -{ - -use Symfony\Component\DependencyInjection\ContainerBuilder; - - -interface BundleInterface -{ - - function boot(); - - - function shutdown(); - - - function build(ContainerBuilder $container); - - - function getContainerExtension(); - - - function getParent(); - - - function getName(); - - - function getNamespace(); - - - function getPath(); -} -} - - - - -namespace Symfony\Component\Config -{ - - -class ConfigCache -{ - private $debug; - private $file; - - - public function __construct($file, $debug) - { - $this->file = $file; - $this->debug = (Boolean) $debug; - } - - - public function __toString() - { - return $this->file; - } - - - public function isFresh() - { - if (!file_exists($this->file)) { - return false; - } - - if (!$this->debug) { - return true; - } - - $metadata = $this->file.'.meta'; - if (!file_exists($metadata)) { - return false; - } - - $time = filemtime($this->file); - $meta = unserialize(file_get_contents($metadata)); - foreach ($meta as $resource) { - if (!$resource->isFresh($time)) { - return false; - } - } - - return true; - } - - - public function write($content, array $metadata = null) - { - $dir = dirname($this->file); - if (!is_dir($dir)) { - if (false === @mkdir($dir, 0777, true)) { - throw new \RuntimeException(sprintf('Unable to create the %s directory', $dir)); - } - } elseif (!is_writable($dir)) { - throw new \RuntimeException(sprintf('Unable to write in the %s directory', $dir)); - } - - $tmpFile = tempnam(dirname($this->file), basename($this->file)); - if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $this->file)) { - chmod($this->file, 0666); - } else { - throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $this->file)); - } - - if (null !== $metadata && true === $this->debug) { - $file = $this->file.'.meta'; - $tmpFile = tempnam(dirname($file), basename($file)); - if (false !== @file_put_contents($tmpFile, serialize($metadata)) && @rename($tmpFile, $file)) { - chmod($file, 0666); - } - } - } -} -} diff --git a/app/cache/.gitignore b/app/cache/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/app/cache/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/app/check.php b/app/check.php index 9481c07..daa6d0a 100644 --- a/app/check.php +++ b/app/check.php @@ -1,104 +1,51 @@ getPhpIniConfigPath(); echo "********************************\n"; echo "* *\n"; echo "* Symfony requirements check *\n"; echo "* *\n"; echo "********************************\n\n"; -echo sprintf("php.ini used by PHP: %s\n\n", $iniPath); -echo "** WARNING **\n"; +echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n"; + +echo "** ATTENTION **\n"; echo "* The PHP CLI can use a different php.ini file\n"; echo "* than the one used with your web server.\n"; if ('\\' == DIRECTORY_SEPARATOR) { echo "* (especially on the Windows platform)\n"; } -echo "* If this is the case, please ALSO launch this\n"; -echo "* utility from your web server.\n"; -echo "** WARNING **\n"; +echo "* To be on the safe side, please also launch the requirements check\n"; +echo "* from your web server using the web/config.php script.\n"; -// mandatory -echo_title("Mandatory requirements"); -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); -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); -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); -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); -check(function_exists('json_encode'), 'Checking that the json_encode() is available', 'Install and enable the json extension', true); -check(class_exists('SQLite3') || in_array('sqlite', PDO::getAvailableDrivers()), 'Checking that the SQLite3 or PDO_SQLite extension is available', 'Install and enable the SQLite3 or PDO_SQLite extension.', true); -check(function_exists('session_start'), 'Checking that the session_start() is available', 'Install and enable the session extension', true); -check(function_exists('ctype_alpha'), 'Checking that the ctype_alpha() is available', 'Install and enable the ctype extension', true); -check(function_exists('token_get_all'), 'Checking that the token_get_all() is available', 'Install and enable the tokenizer extension', true); -check(!(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='), 'Checking that the APC version is at least 3.0.17', 'Upgrade your APC extension (3.0.17+)', true); +echo_title('Mandatory requirements'); -// warnings -echo_title("Optional checks"); -check(class_exists('DomDocument'), 'Checking that the PHP-XML module is installed', 'Install and enable the php-xml module', false); -check(function_exists('token_get_all'), 'Checking that the token_get_all() function is available', 'Install and enable the Tokenizer extension (highly recommended)', false); -check(function_exists('mb_strlen'), 'Checking that the mb_strlen() function is available', 'Install and enable the mbstring extension', false); -check(function_exists('iconv'), 'Checking that the iconv() function is available', 'Install and enable the iconv extension', false); -check(function_exists('utf8_decode'), 'Checking that the utf8_decode() is available', 'Install and enable the XML extension', false); -if (PHP_OS != 'WINNT') { - 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); -} -check(class_exists('Locale'), 'Checking that the intl extension is available', 'Install and enable the intl extension (used for validators)', false); -if (class_exists('Locale')) { - $version = ''; - - if (defined('INTL_ICU_VERSION')) { - $version = INTL_ICU_VERSION; - } else { - $reflector = new \ReflectionExtension('intl'); - - ob_start(); - $reflector->info(); - $output = strip_tags(ob_get_clean()); - - preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches); - $version = $matches[1]; - } - - check(version_compare($version, '4.0', '>='), 'Checking that the intl ICU version is at least 4+', 'Upgrade your intl extension with a newer ICU version (4+)', false); +foreach ($symfonyRequirements->getRequirements() as $req) { + echo_requirement($req); } -$accelerator = - (function_exists('apc_store') && ini_get('apc.enabled')) - || - function_exists('eaccelerator_put') && ini_get('eaccelerator.enable') - || - function_exists('xcache_set') -; -check($accelerator, 'Checking that a PHP accelerator is installed', 'Install a PHP accelerator like APC (highly recommended)', false); +echo_title('Optional recommendations'); -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); -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); -check(!ini_get('register_globals'), 'Checking that php.ini has register_globals set to off', 'Set register_globals to off in php.ini', false); -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); - -echo_title("Optional checks (Doctrine)"); - -check(class_exists('PDO'), 'Checking that PDO is installed', 'Install PDO (mandatory for Doctrine)', false); -if (class_exists('PDO')) { - $drivers = PDO::getAvailableDrivers(); - check(count($drivers), 'Checking that PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)'); +foreach ($symfonyRequirements->getRecommendations() as $req) { + echo_requirement($req); } /** - * Checks a configuration. + * Prints a Requirement instance */ -function check($boolean, $message, $help = '', $fatal = false) +function echo_requirement(Requirement $requirement) { - echo $boolean ? " OK " : sprintf("\n\n[[%s]] ", $fatal ? ' ERROR ' : 'WARNING'); - echo sprintf("$message%s\n", $boolean ? '' : ': FAILED'); + $result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR'); + echo ' ' . str_pad($result, 9); + echo $requirement->getTestMessage() . "\n"; - if (!$boolean) { - echo " *** $help ***\n"; - if ($fatal) { - exit("You must fix this problem before resuming the check.\n"); - } + if (!$requirement->isFulfilled()) { + echo sprintf(" %s\n\n", $requirement->getHelpText()); } } diff --git a/app/config/config.yml b/app/config/config.yml index b6da31e..b812a36 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -1,20 +1,21 @@ imports: - - { resource: parameters.ini } + - { resource: parameters.yml } - { resource: security.yml } framework: #esi: ~ #translator: { fallback: %locale% } secret: %secret% - charset: UTF-8 - router: { resource: "%kernel.root_dir%/config/routing.yml" } + router: + resource: "%kernel.root_dir%/config/routing.yml" + strict_requirements: %kernel.debug% form: true csrf_protection: true validation: { enable_annotations: true } templating: { engines: ['twig'] } #assets_version: SomeVersionScheme - session: - default_locale: %locale% - auto_start: true + default_locale: %locale% + trust_proxy_headers: false # Whether or not the Request object should trust proxy headers (X_FORWARDED_FOR/HTTP_CLIENT_IP) + session: ~ # Twig Configuration twig: @@ -25,13 +26,14 @@ twig: assetic: debug: %kernel.debug% use_controller: false - # java: /usr/bin/java + bundles: [ ] + #java: /usr/bin/java filters: cssrewrite: ~ - # closure: - # jar: %kernel.root_dir%/java/compiler.jar - # yui_css: - # jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar + #closure: + # jar: %kernel.root_dir%/Resources/java/compiler.jar + #yui_css: + # jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar # Doctrine Configuration doctrine: @@ -54,7 +56,4 @@ swiftmailer: host: %mailer_host% username: %mailer_user% password: %mailer_password% - -jms_security_extra: - secure_controllers: true - secure_all_services: false + spool: { type: memory } diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml index 671f52f..b7e675d 100644 --- a/app/config/config_dev.yml +++ b/app/config/config_dev.yml @@ -21,3 +21,6 @@ monolog: assetic: use_controller: true + +#swiftmailer: +# delivery_address: me@example.com diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml index 0b91d4d..5e31419 100644 --- a/app/config/config_prod.yml +++ b/app/config/config_prod.yml @@ -1,6 +1,14 @@ imports: - { resource: config.yml } +# In production environment you should know that the parameters for URL generation +# always pass the requirements. Otherwise it would break your link (or even site with +# strict_requirements = true). So we can disable the requirements check completely for +# enhanced performance with strict_requirements = null. +framework: + router: + strict_requirements: null + #doctrine: # orm: # metadata_cache_driver: apc diff --git a/app/config/config_test.yml b/app/config/config_test.yml index 7dba2fb..e7f44e5 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml @@ -4,7 +4,7 @@ imports: framework: test: ~ session: - storage_id: session.storage.filesystem + storage_id: session.storage.mock_file web_profiler: toolbar: false diff --git a/app/config/parameters.ini b/app/config/parameters.ini deleted file mode 100644 index 3628066..0000000 --- a/app/config/parameters.ini +++ /dev/null @@ -1,19 +0,0 @@ -; These parameters can be imported into other config files -; by enclosing the key with % (like %database_user%) -; Comments start with ';', as in php.ini -[parameters] - database_driver = pdo_mysql - database_host = localhost - database_port = - database_name = symfony - database_user = root - database_password = - - mailer_transport = smtp - mailer_host = localhost - mailer_user = - mailer_password = - - locale = en - - secret = ThisTokenIsNotSoSecretChangeIt diff --git a/app/config/parameters.yml b/app/config/parameters.yml new file mode 100644 index 0000000..6f0c6ee --- /dev/null +++ b/app/config/parameters.yml @@ -0,0 +1,15 @@ +parameters: + database_driver: pdo_mysql + database_host: localhost + database_port: ~ + database_name: symfony + database_user: root + database_password: ~ + + mailer_transport: smtp + mailer_host: localhost + mailer_user: ~ + mailer_password: ~ + + locale: en + secret: ThisTokenIsNotSoSecretChangeIt diff --git a/app/config/routing.yml b/app/config/routing.yml index 3aa39ed..5e493e5 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -4,5 +4,5 @@ GergelyPolonkaiFrontBundle: # Internal routing configuration to handle ESI #_internal: -# resource: "@FrameworkBundle/Resources/config/routing/internal.xml" -# prefix: /_internal +# resource: "@FrameworkBundle/Resources/config/routing/internal.xml" +# prefix: /_internal diff --git a/app/config/routing_dev.yml b/app/config/routing_dev.yml index 27bc683..ff93a02 100644 --- a/app/config/routing_dev.yml +++ b/app/config/routing_dev.yml @@ -1,7 +1,3 @@ -_assetic: - resource: . - type: assetic - _wdt: resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml" prefix: /_wdt diff --git a/app/config/security.yml b/app/config/security.yml index 586d1d0..e01c1c2 100644 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -1,3 +1,7 @@ +jms_security_extra: + secure_all_services: false + expressions: true + security: encoders: Symfony\Component\Security\Core\User\User: plaintext @@ -8,9 +12,10 @@ security: providers: in_memory: - users: - user: { password: userpass, roles: [ 'ROLE_USER' ] } - admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } + memory: + users: + user: { password: userpass, roles: [ 'ROLE_USER' ] } + admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } firewalls: dev: @@ -35,4 +40,4 @@ security: access_control: #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https } - #- { path: ^/_internal, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 } + #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 } diff --git a/app/console b/app/console index 468cc84..1de6db4 100755 --- a/app/console +++ b/app/console @@ -15,8 +15,8 @@ use Symfony\Component\Console\Input\ArgvInput; $input = new ArgvInput(); $env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); -$debug = !$input->hasParameterOption(array('--no-debug', '')); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; $kernel = new AppKernel($env, $debug); $application = new Application($kernel); -$application->run(); +$application->run($input); diff --git a/app/logs/.gitignore b/app/logs/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/app/logs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/bin/.htaccess b/bin/.htaccess deleted file mode 100644 index 3418e55..0000000 --- a/bin/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/bin/doctrine b/bin/doctrine new file mode 120000 index 0000000..0f72e36 --- /dev/null +++ b/bin/doctrine @@ -0,0 +1 @@ +../vendor/doctrine/orm/bin/doctrine \ No newline at end of file diff --git a/bin/doctrine.php b/bin/doctrine.php new file mode 120000 index 0000000..b22b74d --- /dev/null +++ b/bin/doctrine.php @@ -0,0 +1 @@ +../vendor/doctrine/orm/bin/doctrine.php \ No newline at end of file diff --git a/bin/vendors b/bin/vendors deleted file mode 100755 index 49c774a..0000000 --- a/bin/vendors +++ /dev/null @@ -1,240 +0,0 @@ -#!/usr/bin/env php - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Fabien Potencier - * @author Florian Preusner - */ - -$rootDir = dirname(__DIR__); -$vendorName = 'vendor'; -$vendorDir = $rootDir . '/' . $vendorName; -$submodule = false; -$cloneOptions = ''; -$delete = false; -$install = true; - -$commands = array( - 'install' => 'install vendors as specified in deps or deps.lock (recommended)', - 'update' => 'update vendors to their latest versions (as specified in deps)', - 'delete' => 'remove vendors', - 'reinstall' => 'delete and install', - 'submodule:install' => 'install vendors as submodules', - 'submodule:update' => 'update vendors to their latest versions (as specified in deps)', - 'submodule:delete' => 'remove vendors', - 'submodule:reinstall' => 'delete and install' -); - - - -array_shift($argv); -if (!isset($argv[0]) || in_array('help', $argv)) { - - $help = "Symfony2 vendors script management.\n"; - $help .= "Specify a command to run:\n\n"; - - foreach($commands as $cmd => $info) { - - $help .= str_pad($cmd, 21, ' ') . ": $info\n"; - } - - exit($help . "\n"); -} - -if (!in_array($command = array_shift($argv), array_keys($commands))) { - exit(sprintf("Command \"%s\" does not exist.\n", $command)); -} - -if (!is_dir($vendorDir)) { - mkdir($vendorDir, 0777, true); -} - -if (strpos($command, 'submodule') !== false) { - - $submodule = true; - $command = str_replace('submodule:', '', $command); - - if(!is_dir($rootDir . '/.git')) { - - exit("This project is not a git repository. To use submodules it should be a repository :)\n"); - } -} - -// versions -$versions = array(); -if ('install' === $command && file_exists($rootDir.'/deps.lock')) { - foreach (file($rootDir.'/deps.lock', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) { - $parts = array_values(array_filter(explode(' ', $line))); - if (2 !== count($parts)) { - exit(sprintf('The deps version file is not valid (near "%s")', $line)); - } - $versions[$parts[0]] = $parts[1]; - } -} - -if('delete' === $command) { - $delete = true; - $install = false; -} - -if('reinstall' === $command) { - $delete = true; -} - -$newversions = array(); -$deps = parse_ini_file($rootDir.'/deps', true, INI_SCANNER_RAW); -foreach ($deps as $name => $dep) { - // revision - if (isset($versions[$name])) { - $rev = $versions[$name]; - } else { - $rev = isset($dep['version']) ? $dep['version'] : 'origin/HEAD'; - } - - // make sure to run commands on rootDir - system("cd $rootDir"); - - // install dir - if($submodule) { - - $installDir = isset($dep['target']) ? $vendorName . $dep['target'] : $vendorName . '/' . $name; - } else { - - $installDir = isset($dep['target']) ? $vendorDir . $dep['target'] : $vendorDir . '/' . $name; - } - - - - if($delete) { - - echo "> Removing $name\n"; - - if($submodule) { - - deleteSubmodule($installDir, $rootDir); - } - - if(PHP_OS == 'WINNT') { - - system('rmdir /S /Q ' . escapeshellarg(realpath($installDir))); - } else { - - system('rm -rf ' . escapeshellarg($installDir)); - } - } - - - if($install) { - - echo "> Installing/Updating $name\n"; - - // url - if (!isset($dep['git'])) { - exit(sprintf('The "git" value for the "%s" dependency must be set.', $name)); - } - $url = $dep['git']; - - if($submodule) { - - $cmd = sprintf('git submodule add %s %s', escapeshellarg($url), escapeshellarg($installDir)); - $cmd .= ' && git submodule init'; - - } else { - - $cmd = sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)); - } - - echo " $cmd\n"; - - system($cmd); - - system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev))); - } - - if ('update' === $command) { - ob_start(); - system(sprintf('cd %s && git log -n 1 --format=%%H', escapeshellarg($installDir))); - $newversions[] = trim($name.' '.ob_get_clean()); - } -} - -// update? -if ('update' === $command) { - file_put_contents($rootDir.'/deps.lock', implode("\n", $newversions)); -} - -if($install) { - - // php on windows can't use the shebang line from system() - $interpreter = PHP_OS == 'WINNT' ? 'php.exe' : ''; - - // Update the bootstrap files - //system(sprintf('%s %s', $interpreter, escapeshellarg($rootDir.'/bin/build_bootstrap'))); - - // Update assets - system(sprintf('%s %s assets:install --symlink %s', $interpreter, escapeshellarg($rootDir.'/app/console'), escapeshellarg($rootDir.'/web'))); - - // Remove the cache - system(sprintf('%s %s cache:clear --no-warmup', $interpreter, escapeshellarg($rootDir.'/app/console'))); -} - - - - -function deleteSubmodule($name, $rootDir) { - - $gitModules = $rootDir . '/.gitmodules'; - $gitConfig = $rootDir . '/.git/config'; - - $files = array($gitModules, $gitConfig); - - foreach($files as $file) : - - if(file_exists($file)) { - - $fileReturn = array(); - $found = false; - - foreach(file($file) as $line) { - - if(strpos($line, '"' . $name . '"') !== false) { - - $found = true; - continue; - } - - if($found) { - - if($line{0} != '[') { - - continue; - } - - $found = false; - } - - array_push($fileReturn, $line); - } - - $handle = fopen($file, 'wt'); - - if($handle) { - - fwrite($handle, implode($fileReturn)); - fclose($handle); - } - } - endforeach; - - $cmd = "git rm --cached --force $name"; - - echo " $cmd\n"; - system($cmd); -} \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..8f905d7 --- /dev/null +++ b/composer.json @@ -0,0 +1,44 @@ +{ + "name": "symfony/framework-standard-edition", + "description": "The \"Symfony Standard Edition\" distribution", + "autoload": { + "psr-0": { "": "src/" } + }, + "require": { + "php": ">=5.3.3", + "symfony/symfony": "2.1.*", + "doctrine/orm": ">=2.2.3,<2.4-dev", + "doctrine/doctrine-bundle": "1.0.*", + "twig/extensions": "1.0.*", + "symfony/assetic-bundle": "2.1.*", + "symfony/swiftmailer-bundle": "2.1.*", + "symfony/monolog-bundle": "2.1.*", + "sensio/distribution-bundle": "2.1.*", + "sensio/framework-extra-bundle": "2.1.*", + "sensio/generator-bundle": "2.1.*", + "jms/security-extra-bundle": "1.2.*", + "jms/di-extra-bundle": "1.1.*" + }, + "scripts": { + "post-install-cmd": [ + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" + ], + "post-update-cmd": [ + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", + "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" + ] + }, + "config": { + "bin-dir": "bin" + }, + "minimum-stability": "dev", + "extra": { + "symfony-app-dir": "app", + "symfony-web-dir": "web" + } +} diff --git a/deps b/deps deleted file mode 100644 index be3a474..0000000 --- a/deps +++ /dev/null @@ -1,63 +0,0 @@ -[symfony] - git=http://github.com/symfony/symfony.git - version=v2.0.15 - -[twig] - git=http://github.com/fabpot/Twig.git - version=v1.8.2 - -[monolog] - git=http://github.com/Seldaek/monolog.git - version=1.0.2 - -[doctrine-common] - git=http://github.com/doctrine/common.git - version=2.1.4 - -[doctrine-dbal] - git=http://github.com/doctrine/dbal.git - version=2.1.7 - -[doctrine] - git=http://github.com/doctrine/doctrine2.git - version=2.1.7 - -[swiftmailer] - git=http://github.com/swiftmailer/swiftmailer.git - version=v4.1.7 - -[assetic] - git=http://github.com/kriswallsmith/assetic.git - version=v1.0.3 - -[twig-extensions] - git=http://github.com/fabpot/Twig-extensions.git - -[metadata] - git=http://github.com/schmittjoh/metadata.git - version=1.0.0 - -[SensioFrameworkExtraBundle] - git=http://github.com/sensio/SensioFrameworkExtraBundle.git - target=/bundles/Sensio/Bundle/FrameworkExtraBundle - version=origin/2.0 - -[JMSSecurityExtraBundle] - git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git - target=/bundles/JMS/SecurityExtraBundle - version=origin/1.0.x - -[SensioDistributionBundle] - git=http://github.com/sensio/SensioDistributionBundle.git - target=/bundles/Sensio/Bundle/DistributionBundle - version=origin/2.0 - -[SensioGeneratorBundle] - git=http://github.com/sensio/SensioGeneratorBundle.git - target=/bundles/Sensio/Bundle/GeneratorBundle - version=origin/2.0 - -[AsseticBundle] - git=http://github.com/symfony/AsseticBundle.git - target=/bundles/Symfony/Bundle/AsseticBundle - version=v1.0.1 diff --git a/deps.lock b/deps.lock deleted file mode 100644 index 406b884..0000000 --- a/deps.lock +++ /dev/null @@ -1,15 +0,0 @@ -symfony v2.0.15 -twig v1.8.2 -monolog 1.0.2 -doctrine-common 2.1.4 -doctrine-dbal 2.1.7 -doctrine 2.1.7 -swiftmailer v4.1.7 -assetic v1.0.3 -twig-extensions feb6d3f10c411e2631997c0a905aa581c80305c1 -metadata 1.0.0 -SensioFrameworkExtraBundle 1eda94d838aa885e154f92f426df35f2252cdb92 -JMSSecurityExtraBundle e752f888c51425f71382c056961f10f2be642102 -SensioDistributionBundle 41a6c5caed65f02bb09c95a90579f047616471fd -SensioGeneratorBundle 83b768a487a6878f2bc2ad6859bd61a3651a7885 -AsseticBundle v1.0.1 diff --git a/vendor/assetic b/vendor/assetic deleted file mode 160000 index 4aeef88..0000000 --- a/vendor/assetic +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4aeef88b7908510d0bcbbde357f0adf470534ed8 diff --git a/vendor/bundles/Io/TcpdfBundle b/vendor/bundles/Io/TcpdfBundle deleted file mode 160000 index 4702094..0000000 --- a/vendor/bundles/Io/TcpdfBundle +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 470209476a38ab95b335b13b96160395841e6f8c diff --git a/vendor/bundles/JMS/SecurityExtraBundle b/vendor/bundles/JMS/SecurityExtraBundle deleted file mode 160000 index e752f88..0000000 --- a/vendor/bundles/JMS/SecurityExtraBundle +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e752f888c51425f71382c056961f10f2be642102 diff --git a/vendor/bundles/Sensio/Bundle/DistributionBundle b/vendor/bundles/Sensio/Bundle/DistributionBundle deleted file mode 160000 index 41a6c5c..0000000 --- a/vendor/bundles/Sensio/Bundle/DistributionBundle +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 41a6c5caed65f02bb09c95a90579f047616471fd diff --git a/vendor/bundles/Sensio/Bundle/FrameworkExtraBundle b/vendor/bundles/Sensio/Bundle/FrameworkExtraBundle deleted file mode 160000 index 1eda94d..0000000 --- a/vendor/bundles/Sensio/Bundle/FrameworkExtraBundle +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1eda94d838aa885e154f92f426df35f2252cdb92 diff --git a/vendor/bundles/Sensio/Bundle/GeneratorBundle b/vendor/bundles/Sensio/Bundle/GeneratorBundle deleted file mode 160000 index 83b768a..0000000 --- a/vendor/bundles/Sensio/Bundle/GeneratorBundle +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 83b768a487a6878f2bc2ad6859bd61a3651a7885 diff --git a/vendor/bundles/Symfony/Bundle/AsseticBundle b/vendor/bundles/Symfony/Bundle/AsseticBundle deleted file mode 160000 index 41b5913..0000000 --- a/vendor/bundles/Symfony/Bundle/AsseticBundle +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 41b5913b5086a0909af92adcb4a6005ee0051b16 diff --git a/vendor/doctrine-common b/vendor/doctrine-common deleted file mode 160000 index b886898..0000000 --- a/vendor/doctrine-common +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b886898821288d305862ee9c567cc5b5cbb4c0dc diff --git a/vendor/doctrine-dbal b/vendor/doctrine-dbal deleted file mode 160000 index 6465038..0000000 --- a/vendor/doctrine-dbal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 64650385987dee6be046b8fa2485ff4d7663f814 diff --git a/vendor/metadata b/vendor/metadata deleted file mode 160000 index 8717ad2..0000000 --- a/vendor/metadata +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8717ad2a5689480765d9ffafe925cd8a2457e582 diff --git a/vendor/tcpdf b/vendor/tcpdf deleted file mode 160000 index 4bfc80d..0000000 --- a/vendor/tcpdf +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4bfc80dce04e3f268a74e39faeebbe808cd3c53b diff --git a/vendor/twig-extensions b/vendor/twig-extensions deleted file mode 160000 index feb6d3f..0000000 --- a/vendor/twig-extensions +++ /dev/null @@ -1 +0,0 @@ -Subproject commit feb6d3f10c411e2631997c0a905aa581c80305c1 diff --git a/web/.htaccess b/web/.htaccess index 0355c20..08dce6f 100644 --- a/web/.htaccess +++ b/web/.htaccess @@ -1,5 +1,10 @@ RewriteEngine On + + # + # RewriteBase / + # + RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ app.php [QSA,L] diff --git a/web/app.php b/web/app.php index 5a9e02d..2b4d5e7 100644 --- a/web/app.php +++ b/web/app.php @@ -1,12 +1,24 @@ register(true); +*/ + require_once __DIR__.'/../app/AppKernel.php'; //require_once __DIR__.'/../app/AppCache.php'; -use Symfony\Component\HttpFoundation\Request; - $kernel = new AppKernel('prod', false); $kernel->loadClassCache(); //$kernel = new AppCache($kernel); -$kernel->handle(Request::createFromGlobals())->send(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/web/app_dev.php b/web/app_dev.php index 717b6c1..08a5a28 100644 --- a/web/app_dev.php +++ b/web/app_dev.php @@ -2,12 +2,14 @@ require 'dev-ips.php'; -// if you don't want to setup permissions the proper way, just uncomment the following PHP line +use Symfony\Component\HttpFoundation\Request; + +// If you don't want to setup permissions the proper way, just uncomment the following PHP line // read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information //umask(0000); -// this check prevents access to debug front controllers that are deployed by accident to production servers. -// feel free to remove this, extend it, or make something more sophisticated. +// This check prevents access to debug front controllers that are deployed by accident to production servers. +// Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !in_array(@$_SERVER['REMOTE_ADDR'], $dev_ips) @@ -16,11 +18,12 @@ if (isset($_SERVER['HTTP_CLIENT_IP']) exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } -require_once __DIR__.'/../app/bootstrap.php.cache'; +$loader = require_once __DIR__.'/../app/bootstrap.php.cache'; require_once __DIR__.'/../app/AppKernel.php'; -use Symfony\Component\HttpFoundation\Request; - $kernel = new AppKernel('dev', true); $kernel->loadClassCache(); -$kernel->handle(Request::createFromGlobals())->send(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/web/bundles/framework b/web/bundles/framework deleted file mode 120000 index 4ff1eeb..0000000 --- a/web/bundles/framework +++ /dev/null @@ -1 +0,0 @@ -/var/www/vhosts/gergely.polonkai.eu/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public \ No newline at end of file diff --git a/web/bundles/sensiodistribution b/web/bundles/sensiodistribution deleted file mode 120000 index 458289d..0000000 --- a/web/bundles/sensiodistribution +++ /dev/null @@ -1 +0,0 @@ -/var/www/vhosts/gergely.polonkai.eu/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/public \ No newline at end of file diff --git a/web/bundles/webprofiler b/web/bundles/webprofiler deleted file mode 120000 index 3bc427f..0000000 --- a/web/bundles/webprofiler +++ /dev/null @@ -1 +0,0 @@ -/var/www/vhosts/gergely.polonkai.eu/vendor/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/public \ No newline at end of file diff --git a/web/config.php b/web/config.php index d2eb342..03845c2 100644 --- a/web/config.php +++ b/web/config.php @@ -11,201 +11,87 @@ if (!in_array(@$_SERVER['REMOTE_ADDR'], $dev_ips)) { exit('This script is only accessible from localhost.'); } -$majorProblems = array(); -$minorProblems = array(); -$phpini = false; +require_once dirname(__FILE__).'/../app/SymfonyRequirements.php'; -// minimum -if (!version_compare(phpversion(), '5.3.2', '>=')) { - $version = phpversion(); - $majorProblems[] = <<$version", but Symfony - needs at least PHP "5.3.2" to run. Before using Symfony, install - PHP "5.3.2" or newer. -EOF; -} +$symfonyRequirements = new SymfonyRequirements(); -if (!is_writable(__DIR__ . '/../app/cache')) { - $majorProblems[] = 'Change the permissions of the "app/cache/" - directory so that the web server can write into it.'; -} +$majorProblems = $symfonyRequirements->getFailedRequirements(); +$minorProblems = $symfonyRequirements->getFailedRecommendations(); -if (!is_writable(__DIR__ . '/../app/logs')) { - $majorProblems[] = 'Change the permissions of the "app/logs/" - directory so that the web server can write into it.'; -} - -// extensions -if (!class_exists('DomDocument')) { - $minorProblems[] = 'Install and enable the php-xml module.'; -} - -if (!((function_exists('apc_store') && ini_get('apc.enabled')) || function_exists('eaccelerator_put') && ini_get('eaccelerator.enable') || function_exists('xcache_set'))) { - $minorProblems[] = 'Install and enable a PHP accelerator like APC (highly recommended).'; -} - -if (!(!(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='))) { - $majorProblems[] = 'Upgrade your APC extension (3.0.17+)'; -} - -if (!function_exists('token_get_all')) { - $minorProblems[] = 'Install and enable the Tokenizer extension.'; -} - -if (!function_exists('mb_strlen')) { - $minorProblems[] = 'Install and enable the mbstring extension.'; -} - -if (!function_exists('iconv')) { - $minorProblems[] = 'Install and enable the iconv extension.'; -} - -if (!function_exists('utf8_decode')) { - $minorProblems[] = 'Install and enable the XML extension.'; -} - -if (PHP_OS != 'WINNT' && !function_exists('posix_isatty')) { - $minorProblems[] = 'Install and enable the php_posix extension (used to colorize the CLI output).'; -} - -if (!class_exists('Locale')) { - $minorProblems[] = 'Install and enable the intl extension.'; -} else { - $version = ''; - - if (defined('INTL_ICU_VERSION')) { - $version = INTL_ICU_VERSION; - } else { - $reflector = new \ReflectionExtension('intl'); - - ob_start(); - $reflector->info(); - $output = strip_tags(ob_get_clean()); - - preg_match('/^ICU version (.*)$/m', $output, $matches); - $version = $matches[1]; - } - - if (!version_compare($version, '4.0', '>=')) { - $minorProblems[] = 'Upgrade your intl extension with a newer ICU version (4+).'; - } -} - -if (!class_exists('SQLite3') && !in_array('sqlite', PDO::getAvailableDrivers())) { - $majorProblems[] = 'Install and enable the SQLite3 or PDO_SQLite extension.'; -} - -if (!function_exists('json_encode')) { - $majorProblems[] = 'Install and enable the json extension.'; -} - -if (!function_exists('session_start')) { - $majorProblems[] = 'Install and enable the session extension.'; -} - -if (!function_exists('ctype_alpha')) { - $majorProblems[] = 'Install and enable the ctype extension.'; -} - -if (!function_exists('token_get_all')) { - $majorProblems[] = 'Install and enable the Tokenizer extension.'; -} - -// php.ini -if (!ini_get('date.timezone')) { - $phpini = true; - $majorProblems[] = 'Set the "date.timezone" setting in php.ini* (like Europe/Paris).'; -} - -if (ini_get('short_open_tag')) { - $phpini = true; - $minorProblems[] = 'Set short_open_tag to off in php.ini*.'; -} - -if (ini_get('magic_quotes_gpc')) { - $phpini = true; - $minorProblems[] = 'Set magic_quotes_gpc to off in php.ini*.'; -} - -if (ini_get('register_globals')) { - $phpini = true; - $minorProblems[] = 'Set register_globals to off in php.ini*.'; -} - -if (ini_get('session.auto_start')) { - $phpini = true; - $minorProblems[] = 'Set session.auto_start to off in php.ini*.'; -} ?> - + - + Symfony Configuration
- + -
-

Welcome!

-

Welcome to your new Symfony project.

-

This script will guide you through the basic configuration of your project. You can also do the same by editing the ‘app/config/parameters.ini’ file directly.

- - -

- Major problems -

-

Major problems have been detected and must be fixed before continuing :

-
    - -
  1. - -
- - - -

Recommendations

+
+

Welcome!

+

Welcome to your new Symfony project.

- - Additionally, to - - To - enhance your Symfony experience, it’s recommended that you fix the following : + This script will guide you through the basic configuration of your project. + You can also do the same by editing the ‘app/config/parameters.yml’ file directly.

-
    - -
  1. - -
- - - -

* - - Changes to the php.ini file must be done in "". + +

Major problems

+

Major problems have been detected and must be fixed before continuing:

+
    + +
  1. getHelpHtml() ?>
  2. + +
+ + + +

Recommendations

+

+ Additionally, toTo enhance your Symfony experience, + it’s recommended that you fix the following: +

+
    + +
  1. getHelpHtml() ?>
  2. + +
+ + + hasPhpIniConfigIssue()): ?> +

* + getPhpIniConfigPath()): ?> + Changes to the php.ini file must be done in "getPhpIniConfigPath() ?>". To change settings, create a "php.ini".

- + - + +

Your configuration looks good to run Symfony.

+ + + +
+
Symfony Standard Edition
-
Symfony Standard Edition