mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Cleanup controllers
This commit is contained in:
@@ -28,20 +28,20 @@ class MustacheLoader implements ControllerProviderInterface
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->get('/', function(Application $app, Request $request) {
|
||||
$template_name = $request->query->get('template');
|
||||
$template_name = $request->query->get('template');
|
||||
|
||||
if ( ! preg_match('/^[a-zA-Z0-9-_]+$/', $template_name)) {
|
||||
throw new \Exception_BadRequest('Wrong template name : ' . $template_name);
|
||||
}
|
||||
if (!preg_match('/^[a-zA-Z0-9-_]+$/', $template_name)) {
|
||||
throw new \Exception_BadRequest('Wrong template name : ' . $template_name);
|
||||
}
|
||||
|
||||
$template_path = realpath(__DIR__ . '/../../../../../templates/web/Mustache/Prod/' . $template_name . '.Mustache.html');
|
||||
$template_path = realpath(__DIR__ . '/../../../../../templates/web/Mustache/Prod/' . $template_name . '.Mustache.html');
|
||||
|
||||
if ( ! file_exists($template_path)) {
|
||||
throw new \Exception_NotFound('Template does not exists : ' . $template_path);
|
||||
}
|
||||
if (!file_exists($template_path)) {
|
||||
throw new \Exception_NotFound('Template does not exists : ' . $template_path);
|
||||
}
|
||||
|
||||
return new \Symfony\Component\HttpFoundation\Response(file_get_contents($template_path));
|
||||
});
|
||||
return new \Symfony\Component\HttpFoundation\Response(file_get_contents($template_path));
|
||||
});
|
||||
|
||||
return $controllers;
|
||||
}
|
||||
|
Reference in New Issue
Block a user