Upgraded to Symfony 2.1-beta2
This commit is contained in:
@@ -14,6 +14,17 @@
|
||||
* It can be a mandatory requirement or an optional recommendation.
|
||||
* There is a special subclass, named PhpIniRequirement, to check a php.ini configuration.
|
||||
*
|
||||
* This file must be compatible with PHP 5.2+.
|
||||
*
|
||||
* ************** CAUTION **************
|
||||
*
|
||||
* DO NOT EDIT THIS FILE AS IT WILL BE OVERRIDEN BY COMPOSER
|
||||
*
|
||||
* If you want to change this file, edit the one in the
|
||||
* SensioDistributionBundle instead.
|
||||
*
|
||||
* ************** CAUTION **************
|
||||
*
|
||||
* @author Tobias Schultze <http://tobion.de>
|
||||
*/
|
||||
class Requirement
|
||||
@@ -386,12 +397,18 @@ class SymfonyRequirements extends RequirementCollection
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
is_dir(__DIR__.'/../vendor/symfony'),
|
||||
is_dir(__DIR__.'/../vendor/composer'),
|
||||
'Vendor libraries must be installed',
|
||||
'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' .
|
||||
'Then run "<strong>php composer.phar install</strong>" to install them.'
|
||||
);
|
||||
|
||||
$this->addRequirement(
|
||||
file_get_contents(__FILE__) == file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
|
||||
'Outdated requirements file',
|
||||
'Your requirements file is outdated. Run composer install and re-check your configuration.'
|
||||
);
|
||||
|
||||
$baseDir = basename(__DIR__);
|
||||
$this->addRequirement(
|
||||
is_writable(__DIR__.'/cache'),
|
||||
@@ -413,7 +430,7 @@ class SymfonyRequirements extends RequirementCollection
|
||||
|
||||
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
|
||||
$this->addRequirement(
|
||||
(in_array(date_default_timezone_get(), \DateTimeZone::listIdentifiers())),
|
||||
(in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())),
|
||||
sprintf('Default timezone is deprecated (%s)', date_default_timezone_get()),
|
||||
'Fix your <strong>php.ini</strong> file (list of deprecated timezones http://us.php.net/manual/en/timezones.others.php).'
|
||||
);
|
||||
|
@@ -2,23 +2,7 @@
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||
|
||||
if (!$loader = @include __DIR__.'/../vendor/autoload.php') {
|
||||
|
||||
$message = <<< EOF
|
||||
<p>You must set up the project dependencies by running the following commands:</p>
|
||||
<pre>
|
||||
curl -s http://getcomposer.org/installer | php
|
||||
php composer.phar install
|
||||
</pre>
|
||||
|
||||
EOF;
|
||||
|
||||
if (PHP_SAPI === 'cli') {
|
||||
$message = strip_tags($message);
|
||||
}
|
||||
|
||||
die($message);
|
||||
}
|
||||
$loader = require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
// intl
|
||||
if (!function_exists('intl_get_error_code')) {
|
||||
|
@@ -72,6 +72,21 @@ interface ContainerInterface
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\DependencyInjection
|
||||
{
|
||||
|
||||
|
||||
interface IntrospectableContainerInterface extends ContainerInterface
|
||||
{
|
||||
|
||||
function initialized($id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\DependencyInjection
|
||||
{
|
||||
|
||||
@@ -341,6 +356,23 @@ class Container implements IntrospectableContainerInterface
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\HttpKernel
|
||||
{
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
|
||||
interface TerminableInterface
|
||||
{
|
||||
|
||||
function terminate(Request $request, Response $response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\HttpKernel
|
||||
{
|
||||
|
||||
@@ -419,6 +451,9 @@ interface KernelInterface extends HttpKernelInterface, \Serializable
|
||||
|
||||
|
||||
function getLogDir();
|
||||
|
||||
|
||||
function getCharset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,7 +502,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
protected $classes;
|
||||
protected $errorReportingLevel;
|
||||
|
||||
const VERSION = '2.1.0-BETA1';
|
||||
const VERSION = '2.1.0-BETA2';
|
||||
const VERSION_ID = '20100';
|
||||
const MAJOR_VERSION = '2';
|
||||
const MINOR_VERSION = '1';
|
||||
@@ -736,6 +771,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
}
|
||||
|
||||
|
||||
public function getCharset()
|
||||
{
|
||||
return 'UTF-8';
|
||||
}
|
||||
|
||||
|
||||
protected function initializeBundles()
|
||||
{
|
||||
$this->bundles = array();
|
||||
@@ -837,7 +878,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
'kernel.cache_dir' => $this->getCacheDir(),
|
||||
'kernel.logs_dir' => $this->getLogDir(),
|
||||
'kernel.bundles' => $bundles,
|
||||
'kernel.charset' => 'UTF-8',
|
||||
'kernel.charset' => $this->getCharset(),
|
||||
'kernel.container_class' => $this->getContainerClass(),
|
||||
),
|
||||
$this->getEnvParameters()
|
||||
@@ -971,177 +1012,6 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
||||
|
||||
|
||||
|
||||
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 (!is_file($metadata) || !is_file($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 (!is_file($resource) || filemtime($resource) > $time) {
|
||||
$reload = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$reload && is_file($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('<?php '.$c);
|
||||
$c = preg_replace('/^\s*<\?php/', '', $c);
|
||||
}
|
||||
|
||||
$content .= $c;
|
||||
}
|
||||
|
||||
if (!is_dir(dirname($cache))) {
|
||||
mkdir(dirname($cache), 0777, true);
|
||||
}
|
||||
self::writeCacheFile($cache, '<?php '.$content);
|
||||
|
||||
if ($autoReload) {
|
||||
self::writeCacheFile($metadata, serialize(array($files, $classes)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static public function fixNamespaceDeclarations($source)
|
||||
{
|
||||
if (!function_exists('token_get_all')) {
|
||||
return $source;
|
||||
}
|
||||
|
||||
$output = '';
|
||||
$inNamespace = false;
|
||||
$tokens = token_get_all($source);
|
||||
|
||||
for ($i = 0, $max = count($tokens); $i < $max; $i++) {
|
||||
$token = $tokens[$i];
|
||||
if (is_string($token)) {
|
||||
$output .= $token;
|
||||
} elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
||||
continue;
|
||||
} elseif (T_NAMESPACE === $token[0]) {
|
||||
if ($inNamespace) {
|
||||
$output .= "}\n";
|
||||
}
|
||||
$output .= $token[1];
|
||||
|
||||
while (($t = $tokens[++$i]) && is_array($t) && in_array($t[0], array(T_WHITESPACE, T_NS_SEPARATOR, T_STRING))) {
|
||||
$output .= $t[1];
|
||||
}
|
||||
if (is_string($t) && '{' === $t) {
|
||||
$inNamespace = false;
|
||||
--$i;
|
||||
} else {
|
||||
$output = rtrim($output);
|
||||
$output .= "\n{";
|
||||
$inNamespace = true;
|
||||
}
|
||||
} else {
|
||||
$output .= $token[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($inNamespace) {
|
||||
$output .= "}\n";
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
static private function writeCacheFile($file, $content)
|
||||
{
|
||||
$tmpFile = tempnam(dirname($file), basename($file));
|
||||
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
|
||||
@chmod($file, 0666 & ~umask());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file));
|
||||
}
|
||||
|
||||
|
||||
static private 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\ClassLoader
|
||||
{
|
||||
|
||||
@@ -1155,7 +1025,7 @@ class ApcClassLoader
|
||||
public function __construct($prefix, $classFinder)
|
||||
{
|
||||
if (!extension_loaded('apc')) {
|
||||
throw new \RuntimeException('Unable to use ApcUniversalClassLoader as APC is not enabled.');
|
||||
throw new \RuntimeException('Unable to use ApcClassLoader as APC is not enabled.');
|
||||
}
|
||||
|
||||
if (!method_exists($classFinder, 'findFile')) {
|
||||
@@ -1242,6 +1112,26 @@ interface BundleInterface extends ContainerAwareInterface
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\DependencyInjection
|
||||
{
|
||||
|
||||
|
||||
abstract class ContainerAware implements ContainerAwareInterface
|
||||
{
|
||||
|
||||
protected $container;
|
||||
|
||||
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Bundle
|
||||
{
|
||||
|
||||
@@ -1449,6 +1339,349 @@ class ConfigCache
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Component\HttpKernel
|
||||
{
|
||||
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
|
||||
class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
{
|
||||
protected $dispatcher;
|
||||
protected $resolver;
|
||||
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->resolver = $resolver;
|
||||
}
|
||||
|
||||
|
||||
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
||||
{
|
||||
try {
|
||||
return $this->handleRaw($request, $type);
|
||||
} catch (\Exception $e) {
|
||||
if (false === $catch) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $this->handleException($e, $request, $type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function terminate(Request $request, Response $response)
|
||||
{
|
||||
$this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $request, $response));
|
||||
}
|
||||
|
||||
|
||||
private function handleRaw(Request $request, $type = self::MASTER_REQUEST)
|
||||
{
|
||||
$event = new GetResponseEvent($this, $request, $type);
|
||||
$this->dispatcher->dispatch(KernelEvents::REQUEST, $event);
|
||||
|
||||
if ($event->hasResponse()) {
|
||||
return $this->filterResponse($event->getResponse(), $request, $type);
|
||||
}
|
||||
|
||||
if (false === $controller = $this->resolver->getController($request)) {
|
||||
throw new NotFoundHttpException(sprintf('Unable to find the controller for path "%s". Maybe you forgot to add the matching route in your routing configuration?', $request->getPathInfo()));
|
||||
}
|
||||
|
||||
$event = new FilterControllerEvent($this, $controller, $request, $type);
|
||||
$this->dispatcher->dispatch(KernelEvents::CONTROLLER, $event);
|
||||
$controller = $event->getController();
|
||||
|
||||
$arguments = $this->resolver->getArguments($request, $controller);
|
||||
|
||||
$response = call_user_func_array($controller, $arguments);
|
||||
|
||||
if (!$response instanceof Response) {
|
||||
$event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
|
||||
$this->dispatcher->dispatch(KernelEvents::VIEW, $event);
|
||||
|
||||
if ($event->hasResponse()) {
|
||||
$response = $event->getResponse();
|
||||
}
|
||||
|
||||
if (!$response instanceof Response) {
|
||||
$msg = sprintf('The controller must return a response (%s given).', $this->varToString($response));
|
||||
|
||||
if (null === $response) {
|
||||
$msg .= ' Did you forget to add a return statement somewhere in your controller?';
|
||||
}
|
||||
throw new \LogicException($msg);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->filterResponse($response, $request, $type);
|
||||
}
|
||||
|
||||
|
||||
private function filterResponse(Response $response, Request $request, $type)
|
||||
{
|
||||
$event = new FilterResponseEvent($this, $request, $type, $response);
|
||||
|
||||
$this->dispatcher->dispatch(KernelEvents::RESPONSE, $event);
|
||||
|
||||
return $event->getResponse();
|
||||
}
|
||||
|
||||
|
||||
private function handleException(\Exception $e, $request, $type)
|
||||
{
|
||||
$event = new GetResponseForExceptionEvent($this, $request, $type, $e);
|
||||
$this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event);
|
||||
|
||||
if (!$event->hasResponse()) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->filterResponse($event->getResponse(), $request, $type);
|
||||
} catch (\Exception $e) {
|
||||
return $event->getResponse();
|
||||
}
|
||||
}
|
||||
|
||||
private function varToString($var)
|
||||
{
|
||||
if (is_object($var)) {
|
||||
return sprintf('Object(%s)', get_class($var));
|
||||
}
|
||||
|
||||
if (is_array($var)) {
|
||||
$a = array();
|
||||
foreach ($var as $k => $v) {
|
||||
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
||||
}
|
||||
|
||||
return sprintf("Array(%s)", implode(', ', $a));
|
||||
}
|
||||
|
||||
if (is_resource($var)) {
|
||||
return sprintf('Resource(%s)', get_resource_type($var));
|
||||
}
|
||||
|
||||
if (null === $var) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
if (false === $var) {
|
||||
return 'false';
|
||||
}
|
||||
|
||||
if (true === $var) {
|
||||
return 'true';
|
||||
}
|
||||
|
||||
return (string) $var;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle
|
||||
{
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpKernel\HttpKernel as BaseHttpKernel;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
|
||||
class HttpKernel extends BaseHttpKernel
|
||||
{
|
||||
protected $container;
|
||||
|
||||
private $esiSupport;
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver)
|
||||
{
|
||||
parent::__construct($dispatcher, $controllerResolver);
|
||||
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
||||
{
|
||||
$request->headers->set('X-Php-Ob-Level', ob_get_level());
|
||||
|
||||
$this->container->enterScope('request');
|
||||
$this->container->set('request', $request, 'request');
|
||||
|
||||
try {
|
||||
$response = parent::handle($request, $type, $catch);
|
||||
} catch (\Exception $e) {
|
||||
$this->container->leaveScope('request');
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$this->container->leaveScope('request');
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
public function forward($controller, array $attributes = array(), array $query = array())
|
||||
{
|
||||
$attributes['_controller'] = $controller;
|
||||
$subRequest = $this->container->get('request')->duplicate($query, null, $attributes);
|
||||
|
||||
return $this->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
|
||||
}
|
||||
|
||||
|
||||
public function render($controller, array $options = array())
|
||||
{
|
||||
$options = array_merge(array(
|
||||
'attributes' => array(),
|
||||
'query' => array(),
|
||||
'ignore_errors' => !$this->container->getParameter('kernel.debug'),
|
||||
'alt' => array(),
|
||||
'standalone' => false,
|
||||
'comment' => '',
|
||||
), $options);
|
||||
|
||||
if (!is_array($options['alt'])) {
|
||||
$options['alt'] = array($options['alt']);
|
||||
}
|
||||
|
||||
if (null === $this->esiSupport) {
|
||||
$this->esiSupport = $this->container->has('esi') && $this->container->get('esi')->hasSurrogateEsiCapability($this->container->get('request'));
|
||||
}
|
||||
|
||||
if ($this->esiSupport && (true === $options['standalone'] || 'esi' === $options['standalone'])) {
|
||||
$uri = $this->generateInternalUri($controller, $options['attributes'], $options['query']);
|
||||
|
||||
$alt = '';
|
||||
if ($options['alt']) {
|
||||
$alt = $this->generateInternalUri($options['alt'][0], isset($options['alt'][1]) ? $options['alt'][1] : array(), isset($options['alt'][2]) ? $options['alt'][2] : array());
|
||||
}
|
||||
|
||||
return $this->container->get('esi')->renderIncludeTag($uri, $alt, $options['ignore_errors'], $options['comment']);
|
||||
}
|
||||
|
||||
if ('js' === $options['standalone']) {
|
||||
$uri = $this->generateInternalUri($controller, $options['attributes'], $options['query'], false);
|
||||
$defaultContent = null;
|
||||
|
||||
if ($template = $this->container->getParameter('templating.hinclude.default_template')) {
|
||||
$defaultContent = $this->container->get('templating')->render($template);
|
||||
}
|
||||
|
||||
return $this->renderHIncludeTag($uri, $defaultContent);
|
||||
}
|
||||
|
||||
$request = $this->container->get('request');
|
||||
|
||||
if (0 === strpos($controller, '/')) {
|
||||
$subRequest = Request::create($request->getUriForPath($controller), 'get', array(), $request->cookies->all(), array(), $request->server->all());
|
||||
if ($session = $request->getSession()) {
|
||||
$subRequest->setSession($session);
|
||||
}
|
||||
} else {
|
||||
$options['attributes']['_controller'] = $controller;
|
||||
|
||||
if (!isset($options['attributes']['_format'])) {
|
||||
$options['attributes']['_format'] = $request->getRequestFormat();
|
||||
}
|
||||
|
||||
$options['attributes']['_route'] = '_internal';
|
||||
$subRequest = $request->duplicate($options['query'], null, $options['attributes']);
|
||||
$subRequest->setMethod('GET');
|
||||
}
|
||||
|
||||
$level = ob_get_level();
|
||||
try {
|
||||
$response = $this->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false);
|
||||
|
||||
if (!$response->isSuccessful()) {
|
||||
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %s).', $request->getUri(), $response->getStatusCode()));
|
||||
}
|
||||
|
||||
if (!$response instanceof StreamedResponse) {
|
||||
return $response->getContent();
|
||||
}
|
||||
|
||||
$response->sendContent();
|
||||
} catch (\Exception $e) {
|
||||
if ($options['alt']) {
|
||||
$alt = $options['alt'];
|
||||
unset($options['alt']);
|
||||
$options['attributes'] = isset($alt[1]) ? $alt[1] : array();
|
||||
$options['query'] = isset($alt[2]) ? $alt[2] : array();
|
||||
|
||||
return $this->render($alt[0], $options);
|
||||
}
|
||||
|
||||
if (!$options['ignore_errors']) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
while (ob_get_level() > $level) {
|
||||
ob_get_clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function generateInternalUri($controller, array $attributes = array(), array $query = array(), $secure = true)
|
||||
{
|
||||
if (0 === strpos($controller, '/')) {
|
||||
return $controller;
|
||||
}
|
||||
|
||||
$path = http_build_query($attributes, '', '&');
|
||||
$uri = $this->container->get('router')->generate($secure ? '_internal' : '_internal_public', array(
|
||||
'controller' => $controller,
|
||||
'path' => $path ?: 'none',
|
||||
'_format' => $this->container->get('request')->getRequestFormat(),
|
||||
));
|
||||
|
||||
if ($queryString = http_build_query($query, '', '&')) {
|
||||
$uri .= '?'.$queryString;
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
|
||||
public function renderHIncludeTag($uri, $defaultContent = null)
|
||||
{
|
||||
return sprintf('<hx:include src="%s">%s</hx:include>', $uri, $defaultContent);
|
||||
}
|
||||
|
||||
public function hasEsiSupport()
|
||||
{
|
||||
return $this->esiSupport;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace { return $loader; }
|
||||
|
@@ -6,7 +6,6 @@ framework:
|
||||
#esi: ~
|
||||
#translator: { fallback: %locale% }
|
||||
secret: %secret%
|
||||
charset: UTF-8
|
||||
router:
|
||||
resource: "%kernel.root_dir%/config/routing.yml"
|
||||
strict_parameters: %kernel.debug%
|
||||
@@ -15,8 +14,8 @@ framework:
|
||||
validation: { enable_annotations: true }
|
||||
templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
|
||||
default_locale: %locale%
|
||||
session:
|
||||
auto_start: true
|
||||
trust_proxy_headers: false # Should Request object should trust proxy headers (X_FORWARDED_FOR/HTTP_CLIENT_IP)
|
||||
session: ~
|
||||
|
||||
# Twig Configuration
|
||||
twig:
|
||||
|
@@ -1,15 +1,12 @@
|
||||
KekRozsakAdminBundle:
|
||||
resource: "@KekRozsakAdminBundle/Controller/DefaultController.php"
|
||||
type: annotation
|
||||
resource: "@KekRozsakAdminBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
KekRozsakFrontBundle:
|
||||
resource: "@KekRozsakFrontBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
KekRozsakSecurityBundle:
|
||||
resource: "@KekRozsakSecurityBundle/Controller/DefaultController.php"
|
||||
type: annotation
|
||||
resource: "@KekRozsakSecurityBundle/Controller/"
|
||||
type: annotation
|
||||
|
||||
KekRozsakFrontBundle_Default:
|
||||
resource: "@KekRozsakFrontBundle/Controller/DefaultController.php"
|
||||
type: annotation
|
||||
|
||||
KekRozsakFrontBundle_Forum:
|
||||
resource: "@KekRozsakFrontBundle/Controller/ForumController.php"
|
||||
type: annotation
|
||||
|
@@ -5,7 +5,7 @@ jms_security_extra:
|
||||
security:
|
||||
encoders:
|
||||
Symfony\Component\Security\Core\User\User: plaintext
|
||||
KekRozsak\FrontBundle\Entity\User:
|
||||
KekRozsak\SecurityBundle\Entity\User:
|
||||
id: kek_rozsak_security.encoder.crypt
|
||||
|
||||
role_hierarchy:
|
||||
@@ -15,7 +15,7 @@ security:
|
||||
providers:
|
||||
user_db:
|
||||
entity:
|
||||
class: KekRozsak\FrontBundle\Entity\User
|
||||
class: KekRozsak\SecurityBundle\Entity\User
|
||||
property: username
|
||||
|
||||
firewalls:
|
||||
@@ -29,6 +29,7 @@ security:
|
||||
|
||||
members:
|
||||
pattern: ^/
|
||||
|
||||
form_login:
|
||||
check_path: /login_check
|
||||
login_path: /login
|
||||
@@ -42,7 +43,7 @@ security:
|
||||
- { path: ^/$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/cikk/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/jelentkezes, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/most-varj, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/most_varj, roles: IS_AUTHENTICATED_ANONYMOUSLY }
|
||||
- { path: ^/, roles: [ IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED ] }
|
||||
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
|
||||
#- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
|
||||
|
23
app/upgrade.php
Normal file
23
app/upgrade.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// This script is very conservative in what it uses to avoid breaks at all costs
|
||||
|
||||
use Sensio\Bundle\DistributionBundle\Upgrade\Upgrade;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
|
||||
// We don't use the app autoloader in case it is not up to date
|
||||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
$upgrade = new Upgrade();
|
||||
$output = new ConsoleOutput();
|
||||
|
||||
$skeletonDir = __DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton';
|
||||
|
||||
$files = array(
|
||||
__DIR__.'/console' => $skeletonDir.'/app/console',
|
||||
__DIR__.'/autoload.php' => $skeletonDir.'/app/autoload.php',
|
||||
);
|
||||
|
||||
foreach ($files as $file => $skeleton) {
|
||||
$upgrade->outputConsoleDiff($output, $file, $skeleton);
|
||||
}
|
Reference in New Issue
Block a user