This commit is contained in:
Romain Neutron
2013-10-30 19:35:23 +01:00
parent 36f7b24f26
commit 9b471fdf76
129 changed files with 473 additions and 477 deletions

View File

@@ -182,7 +182,7 @@ class Application extends SilexApplication
$this['charset'] = 'UTF-8'; $this['charset'] = 'UTF-8';
$this['debug'] = $this->share(function(Application $app) { $this['debug'] = $this->share(function (Application $app) {
return Application::ENV_PROD !== $app->getEnvironment(); return Application::ENV_PROD !== $app->getEnvironment();
}); });
@@ -209,7 +209,7 @@ class Application extends SilexApplication
}); });
$this->register(new MediaAlchemystServiceProvider()); $this->register(new MediaAlchemystServiceProvider());
$this['media-alchemyst.configuration'] = $this->share(function(Application $app) { $this['media-alchemyst.configuration'] = $this->share(function (Application $app) {
$configuration = array(); $configuration = array();
foreach (array( foreach (array(
@@ -240,7 +240,7 @@ class Application extends SilexApplication
return $configuration; return $configuration;
}); });
$this['media-alchemyst.logger'] = $this->share(function(Application $app) { $this['media-alchemyst.logger'] = $this->share(function (Application $app) {
return $app['monolog']; return $app['monolog'];
}); });
@@ -344,7 +344,7 @@ class Application extends SilexApplication
return $transport; return $transport;
}); });
$this['imagine.factory'] = $this->share(function(Application $app) { $this['imagine.factory'] = $this->share(function (Application $app) {
if ($app['phraseanet.registry']->get('GV_imagine_driver') != '') { if ($app['phraseanet.registry']->get('GV_imagine_driver') != '') {
return $app['phraseanet.registry']->get('GV_imagine_driver'); return $app['phraseanet.registry']->get('GV_imagine_driver');
} }
@@ -362,7 +362,7 @@ class Application extends SilexApplication
}); });
$app = $this; $app = $this;
$this['phraseanet.logger'] = $this->protect(function($databox) use ($app) { $this['phraseanet.logger'] = $this->protect(function ($databox) use ($app) {
try { try {
return \Session_Logger::load($app, $databox); return \Session_Logger::load($app, $databox);
} catch (\Exception_Session_LoggerNotFound $e) { } catch (\Exception_Session_LoggerNotFound $e) {
@@ -370,12 +370,12 @@ class Application extends SilexApplication
} }
}); });
$this['date-formatter'] = $this->share(function(Application $app) { $this['date-formatter'] = $this->share(function (Application $app) {
return new \phraseadate($app); return new \phraseadate($app);
}); });
$this['xpdf.pdftotext'] = $this->share( $this['xpdf.pdftotext'] = $this->share(
$this->extend('xpdf.pdftotext', function(PdfToText $pdftotext, Application $app){ $this->extend('xpdf.pdftotext', function (PdfToText $pdftotext, Application $app) {
if ($app['phraseanet.registry']->get('GV_pdfmaxpages')) { if ($app['phraseanet.registry']->get('GV_pdfmaxpages')) {
$pdftotext->setPageQuantity($app['phraseanet.registry']->get('GV_pdfmaxpages')); $pdftotext->setPageQuantity($app['phraseanet.registry']->get('GV_pdfmaxpages'));
} }
@@ -385,7 +385,7 @@ class Application extends SilexApplication
); );
$this['dispatcher'] = $this->share( $this['dispatcher'] = $this->share(
$this->extend('dispatcher', function($dispatcher, Application $app){ $this->extend('dispatcher', function ($dispatcher, Application $app) {
$dispatcher->addListener(KernelEvents::REQUEST, array($app, 'initSession'), 254); $dispatcher->addListener(KernelEvents::REQUEST, array($app, 'initSession'), 254);
$dispatcher->addListener(KernelEvents::RESPONSE, array($app, 'addUTF8Charset'), -128); $dispatcher->addListener(KernelEvents::RESPONSE, array($app, 'addUTF8Charset'), -128);
$dispatcher->addSubscriber(new LogoutSubscriber()); $dispatcher->addSubscriber(new LogoutSubscriber());
@@ -535,7 +535,7 @@ class Application extends SilexApplication
private function setupUrlGenerator() private function setupUrlGenerator()
{ {
$this['url_generator'] = $this->share($this->extend('url_generator', function($urlGenerator, $app) { $this['url_generator'] = $this->share($this->extend('url_generator', function ($urlGenerator, $app) {
if ($app['phraseanet.configuration']->isSetup()) { if ($app['phraseanet.configuration']->isSetup()) {
$data = parse_url($app['phraseanet.configuration']['main']['servername']); $data = parse_url($app['phraseanet.configuration']['main']['servername']);

View File

@@ -22,7 +22,7 @@ use Alchemy\Phrasea\Core\Event\Subscriber\ApiExceptionHandlerSubscriber;
use Silex\Application as SilexApplication; use Silex\Application as SilexApplication;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
return call_user_func(function($environment = PhraseaApplication::ENV_PROD) { return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
$app = new PhraseaApplication($environment); $app = new PhraseaApplication($environment);
$app->loadPlugins(); $app->loadPlugins();
@@ -34,7 +34,7 @@ return call_user_func(function($environment = PhraseaApplication::ENV_PROD) {
$app->register(new \API_V1_Timer()); $app->register(new \API_V1_Timer());
$app['dispatcher']->dispatch(PhraseaEvents::API_LOAD_START, new ApiLoadStartEvent()); $app['dispatcher']->dispatch(PhraseaEvents::API_LOAD_START, new ApiLoadStartEvent());
$app->get('/api/', function(Request $request, SilexApplication $app) { $app->get('/api/', function (Request $request, SilexApplication $app) {
$apiAdapter = new \API_V1_adapter($app); $apiAdapter = new \API_V1_adapter($app);
$result = new \API_V1_result($app, $request, $apiAdapter); $result = new \API_V1_result($app, $request, $apiAdapter);

View File

@@ -20,7 +20,7 @@ use Alchemy\Phrasea\Core\Event\Subscriber\DebuggerSubscriber;
use Silex\Provider\WebProfilerServiceProvider; use Silex\Provider\WebProfilerServiceProvider;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
return call_user_func(function($environment = PhraseaApplication::ENV_PROD) { return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
$app = new PhraseaApplication($environment); $app = new PhraseaApplication($environment);
$app->loadPlugins(); $app->loadPlugins();
@@ -57,7 +57,7 @@ return call_user_func(function($environment = PhraseaApplication::ENV_PROD) {
} }
$app['dispatcher'] = $app->share( $app['dispatcher'] = $app->share(
$app->extend('dispatcher', function($dispatcher, PhraseaApplication $app){ $app->extend('dispatcher', function ($dispatcher, PhraseaApplication $app) {
$dispatcher->addSubscriber(new BridgeExceptionSubscriber($app)); $dispatcher->addSubscriber(new BridgeExceptionSubscriber($app));
$dispatcher->addSubscriber(new FirewallSubscriber()); $dispatcher->addSubscriber(new FirewallSubscriber());
$dispatcher->addSubscriber(new JsonRequestSubscriber()); $dispatcher->addSubscriber(new JsonRequestSubscriber());

View File

@@ -46,7 +46,7 @@ class CLI extends Application
return new Console\Application($name, $version); return new Console\Application($name, $version);
}); });
$this['dispatcher']->addListener('phraseanet.notification.sent', function() use ($app) { $this['dispatcher']->addListener('phraseanet.notification.sent', function () use ($app) {
$app['swiftmailer.spooltransport']->getSpool()->flushQueue($app['swiftmailer.transport']); $app['swiftmailer.spooltransport']->getSpool()->flushQueue($app['swiftmailer.transport']);
}); });

View File

@@ -39,14 +39,14 @@ abstract class Command extends SymfoCommand implements CommandInterface
$handler = new StreamHandler('php://stdout'); $handler = new StreamHandler('php://stdout');
$this->container['monolog'] = $this->container->share( $this->container['monolog'] = $this->container->share(
$this->container->extend('monolog', function($logger, $app) use ($handler) { $this->container->extend('monolog', function ($logger, $app) use ($handler) {
$logger->pushHandler($handler); $logger->pushHandler($handler);
return $logger; return $logger;
}) })
); );
$this->container['task-manager.logger'] = $this->container->share( $this->container['task-manager.logger'] = $this->container->share(
$this->container->extend('task-manager.logger', function($logger, $app) use ($handler) { $this->container->extend('task-manager.logger', function ($logger, $app) use ($handler) {
$logger->pushHandler($handler); $logger->pushHandler($handler);
return $logger; return $logger;

View File

@@ -25,7 +25,7 @@ class Collection implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('admin') $app['firewall']->requireAccessToModule('admin')
->requireRightOnBase($app['request']->attributes->get('bas_id'), 'canadmin'); ->requireRightOnBase($app['request']->attributes->get('bas_id'), 'canadmin');
}); });

View File

@@ -23,7 +23,7 @@ class ConnectedUsers implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('Admin'); $app['firewall']->requireAccessToModule('Admin');
}); });

View File

@@ -31,7 +31,7 @@ class Dashboard implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAdmin(); $app['firewall']->requireAdmin();
}); });

View File

@@ -28,7 +28,7 @@ class Databox implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('admin') $app['firewall']->requireAccessToModule('admin')
->requireAccessToSbas($request->attributes->get('databox_id')); ->requireAccessToSbas($request->attributes->get('databox_id'));
}); });
@@ -65,7 +65,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/delete/', $this->call('deleteBase')) $controllers->post('/{databox_id}/delete/', $this->call('deleteBase'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_delete'); })->bind('admin_database_delete');
@@ -84,7 +84,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/unmount/', $this->call('unmountDatabase')) $controllers->post('/{databox_id}/unmount/', $this->call('unmountDatabase'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_unmount'); })->bind('admin_database_unmount');
@@ -103,7 +103,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/empty/', $this->call('emptyDatabase')) $controllers->post('/{databox_id}/empty/', $this->call('emptyDatabase'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_empty'); })->bind('admin_database_empty');
@@ -122,7 +122,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->get('/{databox_id}/collections/order/', $this->call('getReorder')) $controllers->get('/{databox_id}/collections/order/', $this->call('getReorder'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_display_collections_order'); })->bind('admin_database_display_collections_order');
@@ -141,7 +141,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/collections/order/', $this->call('setReorder')) $controllers->post('/{databox_id}/collections/order/', $this->call('setReorder'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_submit_collections_order'); })->bind('admin_database_submit_collections_order');
@@ -160,7 +160,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/collection/', $this->call('createCollection')) $controllers->post('/{databox_id}/collection/', $this->call('createCollection'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
}) })
->bind('admin_database_submit_collection'); ->bind('admin_database_submit_collection');
@@ -180,13 +180,13 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->get('/{databox_id}/cgus/', $this->call('getDatabaseCGU')) $controllers->get('/{databox_id}/cgus/', $this->call('getDatabaseCGU'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_modify_struct'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_modify_struct');
})->bind('admin_database_display_cgus'); })->bind('admin_database_display_cgus');
$controllers->post('/{databox_id}/labels/', $this->call('setLabels')) $controllers->post('/{databox_id}/labels/', $this->call('setLabels'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_databox_labels'); })->bind('admin_databox_labels');
@@ -205,7 +205,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/cgus/', $this->call('updateDatabaseCGU')) $controllers->post('/{databox_id}/cgus/', $this->call('updateDatabaseCGU'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_modify_struct'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_modify_struct');
})->bind('admin_database_submit_cgus'); })->bind('admin_database_submit_cgus');
@@ -224,7 +224,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->get('/{databox_id}/informations/documents/', $this->call('progressBarInfos')) $controllers->get('/{databox_id}/informations/documents/', $this->call('progressBarInfos'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_display_document_information'); })->bind('admin_database_display_document_information');
@@ -243,7 +243,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->get('/{databox_id}/informations/details/', $this->call('getDetails')) $controllers->get('/{databox_id}/informations/details/', $this->call('getDetails'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_display_document_details'); })->bind('admin_database_display_document_details');
@@ -263,7 +263,7 @@ class Databox implements ControllerProviderInterface
$controllers->post('/{databox_id}/collection/{collection_id}/mount/', $this->call('mountCollection')) $controllers->post('/{databox_id}/collection/{collection_id}/mount/', $this->call('mountCollection'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->assert('collection_id', '\d+') ->assert('collection_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_mount_collection'); })->bind('admin_database_mount_collection');
@@ -282,7 +282,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->get('/{databox_id}/collection/', $this->call('getNewCollection')) $controllers->get('/{databox_id}/collection/', $this->call('getNewCollection'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_display_new_collection_form'); })->bind('admin_database_display_new_collection_form');
@@ -301,7 +301,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/logo/', $this->call('sendLogoPdf')) $controllers->post('/{databox_id}/logo/', $this->call('sendLogoPdf'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_submit_logo'); })->bind('admin_database_submit_logo');
@@ -320,7 +320,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/logo/delete/', $this->call('deleteLogoPdf')) $controllers->post('/{databox_id}/logo/delete/', $this->call('deleteLogoPdf'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_delete_logo'); })->bind('admin_database_delete_logo');
@@ -339,7 +339,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/clear-logs/', $this->call('clearLogs')) $controllers->post('/{databox_id}/clear-logs/', $this->call('clearLogs'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_clear_logs'); })->bind('admin_database_clear_logs');
@@ -358,7 +358,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/reindex/', $this->call('reindex')) $controllers->post('/{databox_id}/reindex/', $this->call('reindex'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_reindex'); })->bind('admin_database_reindex');
@@ -377,7 +377,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/indexable/', $this->call('setIndexable')) $controllers->post('/{databox_id}/indexable/', $this->call('setIndexable'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_set_indexable'); })->bind('admin_database_set_indexable');
@@ -396,7 +396,7 @@ class Databox implements ControllerProviderInterface
*/ */
$controllers->post('/{databox_id}/view-name/', $this->call('changeViewName')) $controllers->post('/{databox_id}/view-name/', $this->call('changeViewName'))
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage'); $app['firewall']->requireRightOnSbas($request->attributes->get('databox_id'), 'bas_manage');
})->bind('admin_database_rename'); })->bind('admin_database_rename');

View File

@@ -29,7 +29,7 @@ class Databoxes implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('admin'); $app['firewall']->requireAccessToModule('admin');
}); });
@@ -64,7 +64,7 @@ class Databoxes implements ControllerProviderInterface
*/ */
$controllers->post('/', $this->call('createDatabase')) $controllers->post('/', $this->call('createDatabase'))
->bind('admin_database_new') ->bind('admin_database_new')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireAdmin(); $app['firewall']->requireAdmin();
}); });
@@ -83,7 +83,7 @@ class Databoxes implements ControllerProviderInterface
*/ */
$controllers->post('/mount/', $this->call('databaseMount')) $controllers->post('/mount/', $this->call('databaseMount'))
->bind('admin_database_mount') ->bind('admin_database_mount')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireAdmin(); $app['firewall']->requireAdmin();
}); });
@@ -102,7 +102,7 @@ class Databoxes implements ControllerProviderInterface
*/ */
$controllers->post('/upgrade/', $this->call('databasesUpgrade')) $controllers->post('/upgrade/', $this->call('databasesUpgrade'))
->bind('admin_databases_upgrade') ->bind('admin_databases_upgrade')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireAdmin(); $app['firewall']->requireAdmin();
}); });

View File

@@ -27,7 +27,7 @@ class Fields implements ControllerProviderInterface
$app['admin.fields.controller'] = $this; $app['admin.fields.controller'] = $this;
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall'] $app['firewall']
->requireAccessToModule('admin') ->requireAccessToModule('admin')
->requireRight('bas_modify_struct'); ->requireRight('bas_modify_struct');

View File

@@ -29,12 +29,12 @@ class Publications implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('admin') $app['firewall']->requireAccessToModule('admin')
->requireRight('bas_chupub'); ->requireRight('bas_chupub');
}); });
$controllers->get('/list/', function(PhraseaApplication $app) { $controllers->get('/list/', function (PhraseaApplication $app) {
$feeds = \Feed_Collection::load_all( $feeds = \Feed_Collection::load_all(
$app, $app['authentication']->getUser() $app, $app['authentication']->getUser()
@@ -44,7 +44,7 @@ class Publications implements ControllerProviderInterface
->render('admin/publications/list.html.twig', array('feeds' => $feeds)); ->render('admin/publications/list.html.twig', array('feeds' => $feeds));
})->bind('admin_feeds_list'); })->bind('admin_feeds_list');
$controllers->post('/create/', function(PhraseaApplication $app, Request $request) { $controllers->post('/create/', function (PhraseaApplication $app, Request $request) {
$feed = \Feed_Adapter::create( $feed = \Feed_Adapter::create(
$app, $app['authentication']->getUser(), $request->request->get('title'), $request->request->get('subtitle') $app, $app['authentication']->getUser(), $request->request->get('title'), $request->request->get('subtitle')
@@ -59,7 +59,7 @@ class Publications implements ControllerProviderInterface
return $app->redirectPath('admin_feeds_list'); return $app->redirectPath('admin_feeds_list');
})->bind('admin_feeds_create'); })->bind('admin_feeds_create');
$controllers->get('/feed/{id}/', function(PhraseaApplication $app, Request $request, $id) { $controllers->get('/feed/{id}/', function (PhraseaApplication $app, Request $request, $id) {
$feed = new \Feed_Adapter($app, $id); $feed = new \Feed_Adapter($app, $id);
return $app['twig'] return $app['twig']
@@ -68,7 +68,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed') ->bind('admin_feeds_feed')
->assert('id', '\d+'); ->assert('id', '\d+');
$controllers->post('/feed/{id}/update/', function(PhraseaApplication $app, Request $request, $id) { $controllers->post('/feed/{id}/update/', function (PhraseaApplication $app, Request $request, $id) {
$feed = new \Feed_Adapter($app, $id); $feed = new \Feed_Adapter($app, $id);
@@ -84,7 +84,7 @@ class Publications implements ControllerProviderInterface
$feed->set_public($request->request->get('public')); $feed->set_public($request->request->get('public'));
return $app->redirectPath('admin_feeds_list'); return $app->redirectPath('admin_feeds_list');
})->before(function(Request $request) use ($app) { })->before(function (Request $request) use ($app) {
$feed = new \Feed_Adapter($app, $request->attributes->get('id')); $feed = new \Feed_Adapter($app, $request->attributes->get('id'));
if (!$feed->is_owner($app['authentication']->getUser())) { if (!$feed->is_owner($app['authentication']->getUser())) {
@@ -94,7 +94,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed_update') ->bind('admin_feeds_feed_update')
->assert('id', '\d+'); ->assert('id', '\d+');
$controllers->post('/feed/{id}/iconupload/', function(PhraseaApplication $app, Request $request, $id) { $controllers->post('/feed/{id}/iconupload/', function (PhraseaApplication $app, Request $request, $id) {
$datas = array( $datas = array(
'success' => false, 'success' => false,
'message' => '', 'message' => '',
@@ -162,7 +162,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed_icon') ->bind('admin_feeds_feed_icon')
->assert('id', '\d+'); ->assert('id', '\d+');
$controllers->post('/feed/{id}/addpublisher/', function(PhraseaApplication $app, $id) { $controllers->post('/feed/{id}/addpublisher/', function (PhraseaApplication $app, $id) {
$error = ''; $error = '';
try { try {
$request = $app['request']; $request = $app['request'];
@@ -178,7 +178,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed_add_publisher') ->bind('admin_feeds_feed_add_publisher')
->assert('id', '\d+'); ->assert('id', '\d+');
$controllers->post('/feed/{id}/removepublisher/', function(PhraseaApplication $app, $id) { $controllers->post('/feed/{id}/removepublisher/', function (PhraseaApplication $app, $id) {
try { try {
$request = $app['request']; $request = $app['request'];
@@ -196,7 +196,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed_remove_publisher') ->bind('admin_feeds_feed_remove_publisher')
->assert('id', '\d+'); ->assert('id', '\d+');
$controllers->post('/feed/{id}/delete/', function(PhraseaApplication $app, $id) { $controllers->post('/feed/{id}/delete/', function (PhraseaApplication $app, $id) {
$feed = new \Feed_Adapter($app, $id); $feed = new \Feed_Adapter($app, $id);
$feed->delete(); $feed->delete();

View File

@@ -29,11 +29,11 @@ class Root implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('admin'); $app['firewall']->requireAccessToModule('admin');
}); });
$controllers->get('/', function(Application $app, Request $request) { $controllers->get('/', function (Application $app, Request $request) {
try { try {
\User_Adapter::updateClientInfos($app, 3); \User_Adapter::updateClientInfos($app, 3);
} catch (SessionNotFound $e) { } catch (SessionNotFound $e) {
@@ -101,7 +101,7 @@ class Root implements ControllerProviderInterface
)); ));
})->bind('admin'); })->bind('admin');
$controllers->get('/tree/', function(Application $app, Request $request) { $controllers->get('/tree/', function (Application $app, Request $request) {
try { try {
\User_Adapter::updateClientInfos($app, 3); \User_Adapter::updateClientInfos($app, 3);
} catch (SessionNotFound $e) { } catch (SessionNotFound $e) {
@@ -161,7 +161,7 @@ class Root implements ControllerProviderInterface
return $app['twig']->render('admin/tree.html.twig', $params); return $app['twig']->render('admin/tree.html.twig', $params);
})->bind('admin_display_tree'); })->bind('admin_display_tree');
$controllers->get('/test-paths/', function(Application $app, Request $request) { $controllers->get('/test-paths/', function (Application $app, Request $request) {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) { if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed')); $app->abort(400, _('Bad request format, only JSON is allowed'));
@@ -195,7 +195,7 @@ class Root implements ControllerProviderInterface
}) })
->bind('admin_test_paths'); ->bind('admin_test_paths');
$controllers->get('/structure/{databox_id}/', function(Application $app, Request $request, $databox_id) { $controllers->get('/structure/{databox_id}/', function (Application $app, Request $request, $databox_id) {
if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) { if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) {
$app->abort(403); $app->abort(403);
} }
@@ -222,7 +222,7 @@ class Root implements ControllerProviderInterface
})->assert('databox_id', '\d+') })->assert('databox_id', '\d+')
->bind('database_display_stucture'); ->bind('database_display_stucture');
$controllers->post('/structure/{databox_id}/', function(Application $app, Request $request, $databox_id) { $controllers->post('/structure/{databox_id}/', function (Application $app, Request $request, $databox_id) {
if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) { if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) {
$app->abort(403); $app->abort(403);
} }
@@ -248,7 +248,7 @@ class Root implements ControllerProviderInterface
})->assert('databox_id', '\d+') })->assert('databox_id', '\d+')
->bind('database_submit_stucture'); ->bind('database_submit_stucture');
$controllers->get('/statusbit/{databox_id}/', function(Application $app, Request $request, $databox_id) { $controllers->get('/statusbit/{databox_id}/', function (Application $app, Request $request, $databox_id) {
if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) { if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) {
$app->abort(403); $app->abort(403);
} }
@@ -259,7 +259,7 @@ class Root implements ControllerProviderInterface
})->assert('databox_id', '\d+') })->assert('databox_id', '\d+')
->bind('database_display_statusbit'); ->bind('database_display_statusbit');
$controllers->get('/statusbit/{databox_id}/status/{bit}/', function(Application $app, Request $request, $databox_id, $bit) { $controllers->get('/statusbit/{databox_id}/status/{bit}/', function (Application $app, Request $request, $databox_id, $bit) {
if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) { if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) {
$app->abort(403); $app->abort(403);
} }
@@ -314,7 +314,7 @@ class Root implements ControllerProviderInterface
->assert('bit', '\d+') ->assert('bit', '\d+')
->bind('database_display_statusbit_form'); ->bind('database_display_statusbit_form');
$controllers->post('/statusbit/{databox_id}/status/{bit}/delete/', function(Application $app, Request $request, $databox_id, $bit) { $controllers->post('/statusbit/{databox_id}/status/{bit}/delete/', function (Application $app, Request $request, $databox_id, $bit) {
if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) { if (!$request->isXmlHttpRequest() || !array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
$app->abort(400, _('Bad request format, only JSON is allowed')); $app->abort(400, _('Bad request format, only JSON is allowed'));
} }
@@ -337,7 +337,7 @@ class Root implements ControllerProviderInterface
->assert('databox_id', '\d+') ->assert('databox_id', '\d+')
->assert('bit', '\d+'); ->assert('bit', '\d+');
$controllers->post('/statusbit/{databox_id}/status/{bit}/', function(Application $app, Request $request, $databox_id, $bit) { $controllers->post('/statusbit/{databox_id}/status/{bit}/', function (Application $app, Request $request, $databox_id, $bit) {
if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) { if (!$app['authentication']->getUser()->ACL()->has_right_on_sbas($databox_id, 'bas_modify_struct')) {
$app->abort(403); $app->abort(403);
} }

View File

@@ -35,7 +35,7 @@ class Setup implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAdmin(); $app['firewall']->requireAdmin();
}); });

View File

@@ -28,12 +28,12 @@ class Subdefs implements ControllerProviderInterface
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('admin') $app['firewall']->requireAccessToModule('admin')
->requireRightOnSbas($request->attributes->get('sbas_id'), 'bas_modify_struct'); ->requireRightOnSbas($request->attributes->get('sbas_id'), 'bas_modify_struct');
}); });
$controllers->get('/{sbas_id}/', function(Application $app, $sbas_id) { $controllers->get('/{sbas_id}/', function (Application $app, $sbas_id) {
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
return $app['twig']->render('admin/subdefs.html.twig', array( return $app['twig']->render('admin/subdefs.html.twig', array(
@@ -44,7 +44,7 @@ class Subdefs implements ControllerProviderInterface
->bind('admin_subdefs_subdef') ->bind('admin_subdefs_subdef')
->assert('sbas_id', '\d+'); ->assert('sbas_id', '\d+');
$controllers->post('/{sbas_id}/', function(Application $app, Request $request, $sbas_id) { $controllers->post('/{sbas_id}/', function (Application $app, Request $request, $sbas_id) {
$delete_subdef = $request->request->get('delete_subdef'); $delete_subdef = $request->request->get('delete_subdef');
$toadd_subdef = $request->request->get('add_subdef'); $toadd_subdef = $request->request->get('add_subdef');
$Parmsubdefs = $request->request->get('subdefs', array()); $Parmsubdefs = $request->request->get('subdefs', array());

View File

@@ -25,15 +25,15 @@ class TaskManager implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('taskmanager'); $app['firewall']->requireRight('taskmanager');
}); });
$controllers->get('/', function(Application $app, Request $request) { $controllers->get('/', function (Application $app, Request $request) {
return $app->redirectPath('admin_tasks_list'); return $app->redirectPath('admin_tasks_list');
})->bind('admin_tasks'); })->bind('admin_tasks');
$controllers->get('/tasks/', function(Application $app, Request $request) { $controllers->get('/tasks/', function (Application $app, Request $request) {
if ($request->getContentType() == 'json') { if ($request->getContentType() == 'json') {
return $app->json($app['task-manager']->toArray()); return $app->json($app['task-manager']->toArray());
@@ -48,7 +48,7 @@ class TaskManager implements ControllerProviderInterface
} }
})->bind('admin_tasks_list'); })->bind('admin_tasks_list');
$controllers->post('/tasks/create/', function(Application $app, Request $request) { $controllers->post('/tasks/create/', function (Application $app, Request $request) {
if (!class_exists($className = $request->request->get('tcl'))) { if (!class_exists($className = $request->request->get('tcl'))) {
$app->abort(400, sprintf('Unknown task %s', $className)); $app->abort(400, sprintf('Unknown task %s', $className));
} }
@@ -68,7 +68,7 @@ class TaskManager implements ControllerProviderInterface
/* /*
* route /admin/scheduler/stop * route /admin/scheduler/stop
*/ */
$controllers->get('/scheduler/stop', function(Application $app, Request $request) use ($app) { $controllers->get('/scheduler/stop', function (Application $app, Request $request) use ($app) {
try { try {
$app['task-manager']->setSchedulerState(\task_manager::STATE_TOSTOP); $app['task-manager']->setSchedulerState(\task_manager::STATE_TOSTOP);
@@ -80,7 +80,7 @@ class TaskManager implements ControllerProviderInterface
return $app->json(array('success' => false)); return $app->json(array('success' => false));
})->bind('admin_tasks_scheduler_stop'); })->bind('admin_tasks_scheduler_stop');
$controllers->get('/scheduler/log', function(Application $app, Request $request) { $controllers->get('/scheduler/log', function (Application $app, Request $request) {
$logdir = $app['root.path'] . '/logs/'; $logdir = $app['root.path'] . '/logs/';
$rname = '/scheduler((\.log)|(-.*\.log))$/'; $rname = '/scheduler((\.log)|(-.*\.log))$/';
@@ -102,7 +102,7 @@ class TaskManager implements ControllerProviderInterface
return $app->redirectPath('admin_tasks_scheduler_log'); return $app->redirectPath('admin_tasks_scheduler_log');
} }
return $app->stream(function() use ($finder, $app) { return $app->stream(function () use ($finder, $app) {
foreach ($finder->getIterator() as $file) { foreach ($finder->getIterator() as $file) {
printf("<h4>%s\n", $file->getRealPath()); printf("<h4>%s\n", $file->getRealPath());
printf("&nbsp;<a href=\"".$app->path('admin_tasks_scheduler_log', array('clr' => $file->getFilename()))."\">%s</a>" printf("&nbsp;<a href=\"".$app->path('admin_tasks_scheduler_log', array('clr' => $file->getFilename()))."\">%s</a>"
@@ -118,7 +118,7 @@ class TaskManager implements ControllerProviderInterface
}, 200, array('Content-Type' => 'text/html')); }, 200, array('Content-Type' => 'text/html'));
})->bind('admin_tasks_scheduler_log'); })->bind('admin_tasks_scheduler_log');
$controllers->get('/task/{id}/log', function(Application $app, Request $request, $id) { $controllers->get('/task/{id}/log', function (Application $app, Request $request, $id) {
$logdir = $app['root.path'] . '/logs/'; $logdir = $app['root.path'] . '/logs/';
$rname = '/task_' . $id . '((\.log)|(-.*\.log))$/'; $rname = '/task_' . $id . '((\.log)|(-.*\.log))$/';
@@ -140,7 +140,7 @@ class TaskManager implements ControllerProviderInterface
return $app->redirectPath('admin_tasks_task_log', array('id' => $id)); return $app->redirectPath('admin_tasks_task_log', array('id' => $id));
} }
return $app->stream(function() use ($finder, $id) { return $app->stream(function () use ($finder, $id) {
foreach ($finder->getIterator() as $file) { foreach ($finder->getIterator() as $file) {
printf("<h4>%s\n", $file->getRealPath()); printf("<h4>%s\n", $file->getRealPath());
printf("&nbsp;<a href=\"/admin/task-manager/task/%s/log?clr=%s\">%s</a>" printf("&nbsp;<a href=\"/admin/task-manager/task/%s/log?clr=%s\">%s</a>"
@@ -158,7 +158,7 @@ class TaskManager implements ControllerProviderInterface
}); });
})->bind('admin_tasks_task_log'); })->bind('admin_tasks_task_log');
$controllers->get('/task/{id}/delete', function(Application $app, Request $request, $id) { $controllers->get('/task/{id}/delete', function (Application $app, Request $request, $id) {
try { try {
$task = $app['task-manager']->getTask($id); $task = $app['task-manager']->getTask($id);
@@ -175,7 +175,7 @@ class TaskManager implements ControllerProviderInterface
} }
})->bind('admin_tasks_task_delete'); })->bind('admin_tasks_task_delete');
$controllers->get('/task/{id}/tostart', function(Application $app, Request $request, $id) { $controllers->get('/task/{id}/tostart', function (Application $app, Request $request, $id) {
$ret = false; $ret = false;
try { try {
@@ -192,7 +192,7 @@ class TaskManager implements ControllerProviderInterface
return $app->json($ret); return $app->json($ret);
})->bind('admin_tasks_task_start'); })->bind('admin_tasks_task_start');
$controllers->get('/task/{id}/tostop', function(Application $app, Request $request, $id) { $controllers->get('/task/{id}/tostop', function (Application $app, Request $request, $id) {
$ret = false; $ret = false;
try { try {
@@ -213,7 +213,7 @@ class TaskManager implements ControllerProviderInterface
return $app->json($ret); return $app->json($ret);
})->bind('admin_tasks_task_stop'); })->bind('admin_tasks_task_stop');
$controllers->get('/task/{id}/resetcrashcounter/', function(Application $app, Request $request, $id) { $controllers->get('/task/{id}/resetcrashcounter/', function (Application $app, Request $request, $id) {
try { try {
$task = $app['task-manager']->getTask($id); $task = $app['task-manager']->getTask($id);
@@ -230,7 +230,7 @@ class TaskManager implements ControllerProviderInterface
* route /admin/task-manager/task/{id}/save * route /admin/task-manager/task/{id}/save
* return json * return json
*/ */
$controllers->post('/task/{id}/save/', function(Application $app, Request $request, $id) { $controllers->post('/task/{id}/save/', function (Application $app, Request $request, $id) {
$dom = new \DOMDocument('1.0', 'UTF-8'); $dom = new \DOMDocument('1.0', 'UTF-8');
$dom->strictErrorChecking = true; $dom->strictErrorChecking = true;
@@ -259,7 +259,7 @@ class TaskManager implements ControllerProviderInterface
* route /admin/task-manager/task/{id}/facility/ * route /admin/task-manager/task/{id}/facility/
* call callback(s) of a task, for ex. to transform gui(form) to xml settings * call callback(s) of a task, for ex. to transform gui(form) to xml settings
*/ */
$controllers->post('/task/{id}/facility/', function(Application $app, Request $request, $id) { $controllers->post('/task/{id}/facility/', function (Application $app, Request $request, $id) {
$ret = ''; $ret = '';
try { try {
@@ -299,7 +299,7 @@ class TaskManager implements ControllerProviderInterface
return $ret; return $ret;
})->bind('admin_tasks_task_facility'); })->bind('admin_tasks_task_facility');
$controllers->get('/task/{id}', function(Application $app, Request $request, $id) { $controllers->get('/task/{id}', function (Application $app, Request $request, $id) {
$task = $app['task-manager']->getTask($id); $task = $app['task-manager']->getTask($id);
@@ -315,7 +315,7 @@ class TaskManager implements ControllerProviderInterface
* route /admin/task/checkxml/ * route /admin/task/checkxml/
* check if the xml is valid * check if the xml is valid
*/ */
$controllers->post('/task/checkxml/', function(Application $app, Request $request) { $controllers->post('/task/checkxml/', function (Application $app, Request $request) {
$ret = array('ok' => true, 'err' => null); $ret = array('ok' => true, 'err' => null);
$dom = new \DOMDocument('1.0', 'UTF-8'); $dom = new \DOMDocument('1.0', 'UTF-8');
$dom->strictErrorChecking = true; $dom->strictErrorChecking = true;

View File

@@ -29,24 +29,24 @@ class Users implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('admin') $app['firewall']->requireAccessToModule('admin')
->requireRight('manageusers'); ->requireRight('manageusers');
}); });
$controllers->post('/rights/', function(Application $app) { $controllers->post('/rights/', function (Application $app) {
$rights = new UserHelper\Edit($app, $app['request']); $rights = new UserHelper\Edit($app, $app['request']);
return $app['twig']->render('admin/editusers.html.twig', $rights->get_users_rights()); return $app['twig']->render('admin/editusers.html.twig', $rights->get_users_rights());
}); });
$controllers->get('/rights/', function(Application $app) { $controllers->get('/rights/', function (Application $app) {
$rights = new UserHelper\Edit($app, $app['request']); $rights = new UserHelper\Edit($app, $app['request']);
return $app['twig']->render('admin/editusers.html.twig', $rights->get_users_rights()); return $app['twig']->render('admin/editusers.html.twig', $rights->get_users_rights());
}); });
$controllers->post('/rights/reset/', function(Application $app, Request $request) { $controllers->post('/rights/reset/', function (Application $app, Request $request) {
try { try {
$datas = array('error' => false); $datas = array('error' => false);
@@ -60,14 +60,14 @@ class Users implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
})->bind('admin_users_rights_reset'); })->bind('admin_users_rights_reset');
$controllers->post('/delete/', function(Application $app) { $controllers->post('/delete/', function (Application $app) {
$module = new UserHelper\Edit($app, $app['request']); $module = new UserHelper\Edit($app, $app['request']);
$module->delete_users(); $module->delete_users();
return $app->redirectPath('admin_users_search'); return $app->redirectPath('admin_users_search');
}); });
$controllers->post('/rights/apply/', function(Application $app) { $controllers->post('/rights/apply/', function (Application $app) {
$datas = array('error' => true); $datas = array('error' => true);
try { try {
@@ -88,58 +88,58 @@ class Users implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
})->bind('admin_users_rights_apply'); })->bind('admin_users_rights_apply');
$controllers->post('/rights/quotas/', function(Application $app) { $controllers->post('/rights/quotas/', function (Application $app) {
$rights = new UserHelper\Edit($app, $app['request']); $rights = new UserHelper\Edit($app, $app['request']);
return $app['twig']->render('admin/editusers_quotas.html.twig', $rights->get_quotas()); return $app['twig']->render('admin/editusers_quotas.html.twig', $rights->get_quotas());
}); });
$controllers->post('/rights/quotas/apply/', function(Application $app) { $controllers->post('/rights/quotas/apply/', function (Application $app) {
$rights = new UserHelper\Edit($app, $app['request']); $rights = new UserHelper\Edit($app, $app['request']);
$rights->apply_quotas(); $rights->apply_quotas();
return $app->json(array('message' => '', 'error' => false)); return $app->json(array('message' => '', 'error' => false));
}); });
$controllers->post('/rights/time/', function(Application $app) { $controllers->post('/rights/time/', function (Application $app) {
$rights = new UserHelper\Edit($app, $app['request']); $rights = new UserHelper\Edit($app, $app['request']);
return $app['twig']->render('admin/editusers_timelimit.html.twig', $rights->get_time()); return $app['twig']->render('admin/editusers_timelimit.html.twig', $rights->get_time());
}); });
$controllers->post('/rights/time/sbas/', function(Application $app) { $controllers->post('/rights/time/sbas/', function (Application $app) {
$rights = new UserHelper\Edit($app, $app['request']); $rights = new UserHelper\Edit($app, $app['request']);
return $app['twig']->render('admin/editusers_timelimit_sbas.html.twig', $rights->get_time_sbas()); return $app['twig']->render('admin/editusers_timelimit_sbas.html.twig', $rights->get_time_sbas());
}); });
$controllers->post('/rights/time/apply/', function(Application $app) { $controllers->post('/rights/time/apply/', function (Application $app) {
$rights = new UserHelper\Edit($app, $app['request']); $rights = new UserHelper\Edit($app, $app['request']);
$rights->apply_time(); $rights->apply_time();
return $app->json(array('message' => '', 'error' => false)); return $app->json(array('message' => '', 'error' => false));
}); });
$controllers->post('/rights/masks/', function(Application $app) { $controllers->post('/rights/masks/', function (Application $app) {
$rights = new UserHelper\Edit($app, $app['request']); $rights = new UserHelper\Edit($app, $app['request']);
return $app['twig']->render('admin/editusers_masks.html.twig', $rights->get_masks()); return $app['twig']->render('admin/editusers_masks.html.twig', $rights->get_masks());
}); });
$controllers->post('/rights/masks/apply/', function(Application $app) { $controllers->post('/rights/masks/apply/', function (Application $app) {
$rights = new UserHelper\Edit($app, $app['request']); $rights = new UserHelper\Edit($app, $app['request']);
$rights->apply_masks(); $rights->apply_masks();
return $app->json(array('message' => '', 'error' => false)); return $app->json(array('message' => '', 'error' => false));
}); });
$controllers->match('/search/', function(Application $app) { $controllers->match('/search/', function (Application $app) {
$users = new UserHelper\Manage($app, $app['request']); $users = new UserHelper\Manage($app, $app['request']);
return $app['twig']->render('admin/users.html.twig', $users->search()); return $app['twig']->render('admin/users.html.twig', $users->search());
})->bind('admin_users_search'); })->bind('admin_users_search');
$controllers->post('/search/export/', function() use ($app) { $controllers->post('/search/export/', function () use ($app) {
$request = $app['request']; $request = $app['request'];
$users = new UserHelper\Manage($app, $app['request']); $users = new UserHelper\Manage($app, $app['request']);
@@ -195,7 +195,7 @@ class Users implements ControllerProviderInterface
return $response; return $response;
})->bind('admin_users_search_export'); })->bind('admin_users_search_export');
$controllers->post('/apply_template/', function() use ($app) { $controllers->post('/apply_template/', function () use ($app) {
$users = new UserHelper\Edit($app, $app['request']); $users = new UserHelper\Edit($app, $app['request']);
$users->apply_template(); $users->apply_template();
@@ -203,7 +203,7 @@ class Users implements ControllerProviderInterface
return $app->redirectPath('admin_users_search'); return $app->redirectPath('admin_users_search');
})->bind('admin_users_apply_template'); })->bind('admin_users_apply_template');
$controllers->get('/typeahead/search/', function(Application $app) { $controllers->get('/typeahead/search/', function (Application $app) {
$request = $app['request']; $request = $app['request'];
$user_query = new \User_Query($app); $user_query = new \User_Query($app);
@@ -241,7 +241,7 @@ class Users implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
}); });
$controllers->post('/create/', function(Application $app) { $controllers->post('/create/', function (Application $app) {
$datas = array('error' => false, 'message' => '', 'data' => null); $datas = array('error' => false, 'message' => '', 'data' => null);
try { try {
@@ -264,7 +264,7 @@ class Users implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
}); });
$controllers->post('/export/csv/', function(Application $app) { $controllers->post('/export/csv/', function (Application $app) {
$request = $app['request']; $request = $app['request'];
$user_query = new \User_Query($app); $user_query = new \User_Query($app);
@@ -339,7 +339,7 @@ class Users implements ControllerProviderInterface
return $response; return $response;
})->bind('admin_users_export_csv'); })->bind('admin_users_export_csv');
$controllers->get('/demands/', function(Application $app, Request $request) { $controllers->get('/demands/', function (Application $app, Request $request) {
$lastMonth = time() - (3 * 4 * 7 * 24 * 60 * 60); $lastMonth = time() - (3 * 4 * 7 * 24 * 60 * 60);
$sql = "DELETE FROM demand WHERE date_modif < :date"; $sql = "DELETE FROM demand WHERE date_modif < :date";
@@ -396,7 +396,7 @@ class Users implements ControllerProviderInterface
)); ));
})->bind('users_display_demands'); })->bind('users_display_demands');
$controllers->post('/demands/', function(Application $app, Request $request) { $controllers->post('/demands/', function (Application $app, Request $request) {
$templates = $deny = $accept = $options = array(); $templates = $deny = $accept = $options = array();
@@ -571,11 +571,11 @@ class Users implements ControllerProviderInterface
return $app->redirectPath('users_display_demands', array('success' => 1)); return $app->redirectPath('users_display_demands', array('success' => 1));
})->bind('users_submit_demands'); })->bind('users_submit_demands');
$controllers->get('/import/file/', function(Application $app, Request $request) { $controllers->get('/import/file/', function (Application $app, Request $request) {
return $app['twig']->render('admin/user/import/file.html.twig'); return $app['twig']->render('admin/user/import/file.html.twig');
})->bind('users_display_import_file'); })->bind('users_display_import_file');
$controllers->post('/import/file/', function(Application $app, Request $request) { $controllers->post('/import/file/', function (Application $app, Request $request) {
if ((null === $file = $request->files->get('files')) || !$file->isValid()) { if ((null === $file = $request->files->get('files')) || !$file->isValid()) {
return $app->redirectPath('users_display_import_file', array('error' => 'file-invalid')); return $app->redirectPath('users_display_import_file', array('error' => 'file-invalid'));
} }
@@ -593,7 +593,7 @@ class Users implements ControllerProviderInterface
$roughColumns = array_shift($lines); $roughColumns = array_shift($lines);
$columnsSanitized = array_map(function($columnName) { $columnsSanitized = array_map(function ($columnName) {
return trim(mb_strtolower($columnName)); return trim(mb_strtolower($columnName));
}, $roughColumns); }, $roughColumns);
@@ -727,7 +727,7 @@ class Users implements ControllerProviderInterface
)); ));
})->bind('users_submit_import_file'); })->bind('users_submit_import_file');
$controllers->post('/import/', function(Application $app, Request $request) { $controllers->post('/import/', function (Application $app, Request $request) {
$nbCreation = 0; $nbCreation = 0;
if ((null === $serializedColumns = $request->request->get('sr_columns')) || ('' === $serializedColumns)) { if ((null === $serializedColumns = $request->request->get('sr_columns')) || ('' === $serializedColumns)) {
@@ -859,7 +859,7 @@ class Users implements ControllerProviderInterface
return $app->redirectPath('admin_users_search', array('user-updated' => $nbCreation)); return $app->redirectPath('admin_users_search', array('user-updated' => $nbCreation));
})->bind('users_submit_import'); })->bind('users_submit_import');
$controllers->get('/import/example/csv/', function(Application $app, Request $request) { $controllers->get('/import/example/csv/', function (Application $app, Request $request) {
$file = new \SplFileInfo($app['root.path'] . '/lib/Fixtures/exampleImportUsers.csv'); $file = new \SplFileInfo($app['root.path'] . '/lib/Fixtures/exampleImportUsers.csv');
@@ -878,7 +878,7 @@ class Users implements ControllerProviderInterface
return $response; return $response;
})->bind('users_import_csv'); })->bind('users_import_csv');
$controllers->get('/import/example/rtf/', function(Application $app, Request $request) { $controllers->get('/import/example/rtf/', function (Application $app, Request $request) {
$file = new \SplFileInfo($app['root.path'] . '/lib/Fixtures/Fields.rtf'); $file = new \SplFileInfo($app['root.path'] . '/lib/Fixtures/Fields.rtf');

View File

@@ -28,7 +28,7 @@ class Oauth2 implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$app['oauth'] = $app->share(function($app) { $app['oauth'] = $app->share(function ($app) {
return new \API_OAuth2_Adapter($app); return new \API_OAuth2_Adapter($app);
}); });
@@ -38,7 +38,7 @@ class Oauth2 implements ControllerProviderInterface
* Authorization endpoint - used to obtain authorization from the * Authorization endpoint - used to obtain authorization from the
* resource owner via user-agent redirection. * resource owner via user-agent redirection.
*/ */
$authorize_func = function() use ($app) { $authorize_func = function () use ($app) {
$request = $app['request']; $request = $app['request'];
$oauth2_adapter = $app['oauth']; $oauth2_adapter = $app['oauth'];
@@ -145,7 +145,7 @@ class Oauth2 implements ControllerProviderInterface
* TOKEN ENDPOINT * TOKEN ENDPOINT
* Token endpoint - used to exchange an authorization grant for an access token. * Token endpoint - used to exchange an authorization grant for an access token.
*/ */
$controllers->post('/token', function(\Silex\Application $app, Request $request) { $controllers->post('/token', function (\Silex\Application $app, Request $request) {
if ( ! $request->isSecure()) { if ( ! $request->isSecure()) {
throw new HttpException(400, 'This route requires the use of the https scheme', null, array('content-type' => 'application/json')); throw new HttpException(400, 'This route requires the use of the https scheme', null, array('content-type' => 'application/json'));
} }

View File

@@ -50,7 +50,7 @@ class V1 implements ControllerProviderInterface
* @ throws \API_V1_exception_unauthorized * @ throws \API_V1_exception_unauthorized
* @ throws \API_V1_exception_forbidden * @ throws \API_V1_exception_forbidden
*/ */
$controllers->before(function($request) use ($app) { $controllers->before(function ($request) use ($app) {
$context = new Context(Context::CONTEXT_OAUTH2_TOKEN); $context = new Context(Context::CONTEXT_OAUTH2_TOKEN);
$app['dispatcher']->dispatch(PhraseaEvents::PRE_AUTHENTICATE, new PreAuthenticate($request, $context)); $app['dispatcher']->dispatch(PhraseaEvents::PRE_AUTHENTICATE, new PreAuthenticate($request, $context));
@@ -165,7 +165,7 @@ class V1 implements ControllerProviderInterface
/** /**
* Method Not Allowed Closure * Method Not Allowed Closure
*/ */
$bad_request_exception = function() { $bad_request_exception = function () {
throw new \API_V1_exception_badrequest(); throw new \API_V1_exception_badrequest();
}; };
@@ -189,7 +189,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->get('/monitor/scheduler/', function(SilexApplication $app, Request $request) { $controllers->get('/monitor/scheduler/', function (SilexApplication $app, Request $request) {
return $app['api']->get_scheduler($app)->get_response(); return $app['api']->get_scheduler($app)->get_response();
})->before($mustBeAdmin); })->before($mustBeAdmin);
@@ -203,7 +203,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->get('/monitor/tasks/', function(SilexApplication $app, Request $request) { $controllers->get('/monitor/tasks/', function (SilexApplication $app, Request $request) {
return $app['api']->get_task_list($app)->get_response(); return $app['api']->get_task_list($app)->get_response();
})->before($mustBeAdmin); })->before($mustBeAdmin);
@@ -217,7 +217,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->get('/monitor/task/{task_id}/', function(SilexApplication $app, Request $request, $task_id) { $controllers->get('/monitor/task/{task_id}/', function (SilexApplication $app, Request $request, $task_id) {
return $app['api']->get_task($app, $task_id)->get_response(); return $app['api']->get_task($app, $task_id)->get_response();
})->before($mustBeAdmin)->assert('task_id', '\d+'); })->before($mustBeAdmin)->assert('task_id', '\d+');
@@ -232,7 +232,7 @@ class V1 implements ControllerProviderInterface
* - name (string) change the name of the task * - name (string) change the name of the task
* - autostart (boolean) start task when scheduler starts * - autostart (boolean) start task when scheduler starts
*/ */
$controllers->post('/monitor/task/{task_id}/', function(SilexApplication $app, Request $request, $task_id) { $controllers->post('/monitor/task/{task_id}/', function (SilexApplication $app, Request $request, $task_id) {
return $app['api']->set_task_property($app, $task_id)->get_response(); return $app['api']->set_task_property($app, $task_id)->get_response();
})->before($mustBeAdmin)->assert('task_id', '\d+'); })->before($mustBeAdmin)->assert('task_id', '\d+');
@@ -246,7 +246,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->post('/monitor/task/{task_id}/start/', function(SilexApplication $app, Request $request, $task_id) { $controllers->post('/monitor/task/{task_id}/start/', function (SilexApplication $app, Request $request, $task_id) {
return $app['api']->start_task($app, $task_id)->get_response(); return $app['api']->start_task($app, $task_id)->get_response();
})->before($mustBeAdmin); })->before($mustBeAdmin);
@@ -260,7 +260,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->post('/monitor/task/{task_id}/stop/', function(SilexApplication $app, Request $request, $task_id) { $controllers->post('/monitor/task/{task_id}/stop/', function (SilexApplication $app, Request $request, $task_id) {
return $app['api']->stop_task($app, $task_id)->get_response(); return $app['api']->stop_task($app, $task_id)->get_response();
})->before($mustBeAdmin); })->before($mustBeAdmin);
@@ -274,7 +274,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->get('/monitor/phraseanet/', function(SilexApplication $app, Request $request) { $controllers->get('/monitor/phraseanet/', function (SilexApplication $app, Request $request) {
return $app['api']->get_phraseanet_monitor($app)->get_response(); return $app['api']->get_phraseanet_monitor($app)->get_response();
})->before($mustBeAdmin); })->before($mustBeAdmin);
@@ -286,7 +286,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->get('/databoxes/list/', function(SilexApplication $app, Request $request) { $controllers->get('/databoxes/list/', function (SilexApplication $app, Request $request) {
return $app['api']->get_databoxes($request)->get_response(); return $app['api']->get_databoxes($request)->get_response();
}); });
@@ -298,7 +298,7 @@ class V1 implements ControllerProviderInterface
* Parameters ; * Parameters ;
* DATABOX_ID : required INT * DATABOX_ID : required INT
*/ */
$controllers->get('/databoxes/{databox_id}/collections/', function(SilexApplication $app, $databox_id) { $controllers->get('/databoxes/{databox_id}/collections/', function (SilexApplication $app, $databox_id) {
return $app['api'] return $app['api']
->get_databox_collections($app['request'], $databox_id) ->get_databox_collections($app['request'], $databox_id)
->get_response(); ->get_response();
@@ -315,7 +315,7 @@ class V1 implements ControllerProviderInterface
* DATABOX_ID : required INT * DATABOX_ID : required INT
* *
*/ */
$controllers->get('/databoxes/{databox_id}/status/', function(SilexApplication $app, $databox_id) { $controllers->get('/databoxes/{databox_id}/status/', function (SilexApplication $app, $databox_id) {
return $app['api'] return $app['api']
->get_databox_status($app['request'], $databox_id) ->get_databox_status($app['request'], $databox_id)
->get_response(); ->get_response();
@@ -331,7 +331,7 @@ class V1 implements ControllerProviderInterface
* Parameters ; * Parameters ;
* DATABOX_ID : required INT * DATABOX_ID : required INT
*/ */
$controllers->get('/databoxes/{databox_id}/metadatas/', function(SilexApplication $app, $databox_id) { $controllers->get('/databoxes/{databox_id}/metadatas/', function (SilexApplication $app, $databox_id) {
return $app['api'] return $app['api']
->get_databox_metadatas($app['request'], $databox_id) ->get_databox_metadatas($app['request'], $databox_id)
->get_response(); ->get_response();
@@ -347,7 +347,7 @@ class V1 implements ControllerProviderInterface
* Parameters ; * Parameters ;
* DATABOX_ID : required INT * DATABOX_ID : required INT
*/ */
$controllers->get('/databoxes/{databox_id}/termsOfUse/', function(SilexApplication $app, $databox_id) { $controllers->get('/databoxes/{databox_id}/termsOfUse/', function (SilexApplication $app, $databox_id) {
return $app['api'] return $app['api']
->get_databox_terms($app['request'], $databox_id) ->get_databox_terms($app['request'], $databox_id)
->get_response(); ->get_response();
@@ -355,11 +355,11 @@ class V1 implements ControllerProviderInterface
$controllers->get('/databoxes/{any_id}/termsOfUse/', $bad_request_exception); $controllers->get('/databoxes/{any_id}/termsOfUse/', $bad_request_exception);
$controllers->get('/quarantine/list/', function(SilexApplication $app, Request $request) { $controllers->get('/quarantine/list/', function (SilexApplication $app, Request $request) {
return $app['api']->list_quarantine($app, $request)->get_response(); return $app['api']->list_quarantine($app, $request)->get_response();
}); });
$controllers->get('/quarantine/item/{lazaret_id}/', function($lazaret_id, SilexApplication $app, Request $request) { $controllers->get('/quarantine/item/{lazaret_id}/', function ($lazaret_id, SilexApplication $app, Request $request) {
return $app['api']->list_quarantine_item($lazaret_id, $app, $request)->get_response(); return $app['api']->list_quarantine_item($lazaret_id, $app, $request)->get_response();
}); });
@@ -371,7 +371,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->post('/records/add/', function(SilexApplication $app, Request $request) { $controllers->post('/records/add/', function (SilexApplication $app, Request $request) {
return $app['api']->add_record($app, $request)->get_response(); return $app['api']->add_record($app, $request)->get_response();
}); });
@@ -391,7 +391,7 @@ class V1 implements ControllerProviderInterface
* Array containing an array of records and stories collection * Array containing an array of records and stories collection
* *
*/ */
$controllers->match('/search/', function() use ($app) { $controllers->match('/search/', function () use ($app) {
return $app['api']->search($app['request'])->get_response(); return $app['api']->search($app['request'])->get_response();
}); });
@@ -411,11 +411,11 @@ class V1 implements ControllerProviderInterface
* Array of record objects * Array of record objects
* *
*/ */
$controllers->match('/records/search/', function(SilexApplication $app) { $controllers->match('/records/search/', function (SilexApplication $app) {
return $app['api']->search_records($app['request'])->get_response(); return $app['api']->search_records($app['request'])->get_response();
}); });
$controllers->get('/records/{databox_id}/{record_id}/caption/', function(SilexApplication $app, $databox_id, $record_id) { $controllers->get('/records/{databox_id}/{record_id}/caption/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api'] return $app['api']
->caption_records($app['request'], $databox_id, $record_id) ->caption_records($app['request'], $databox_id, $record_id)
->get_response(); ->get_response();
@@ -433,7 +433,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT * RECORD_ID : required INT
* *
*/ */
$controllers->get('/records/{databox_id}/{record_id}/metadatas/', function(SilexApplication $app, $databox_id, $record_id) { $controllers->get('/records/{databox_id}/{record_id}/metadatas/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api'] return $app['api']
->get_record_metadatas($app['request'], $databox_id, $record_id) ->get_record_metadatas($app['request'], $databox_id, $record_id)
->get_response(); ->get_response();
@@ -451,7 +451,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT * RECORD_ID : required INT
* *
*/ */
$controllers->get('/records/{databox_id}/{record_id}/status/', function(SilexApplication $app, $databox_id, $record_id) { $controllers->get('/records/{databox_id}/{record_id}/status/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api'] return $app['api']
->get_record_status($app['request'], $databox_id, $record_id) ->get_record_status($app['request'], $databox_id, $record_id)
->get_response(); ->get_response();
@@ -469,7 +469,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT * RECORD_ID : required INT
* *
*/ */
$controllers->get('/records/{databox_id}/{record_id}/related/', function(SilexApplication $app, $databox_id, $record_id) { $controllers->get('/records/{databox_id}/{record_id}/related/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api'] return $app['api']
->get_record_related($app['request'], $databox_id, $record_id) ->get_record_related($app['request'], $databox_id, $record_id)
->get_response(); ->get_response();
@@ -487,7 +487,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT * RECORD_ID : required INT
* *
*/ */
$controllers->get('/records/{databox_id}/{record_id}/embed/', function(SilexApplication $app, $databox_id, $record_id) { $controllers->get('/records/{databox_id}/{record_id}/embed/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api'] return $app['api']
->get_record_embed($app['request'], $databox_id, $record_id) ->get_record_embed($app['request'], $databox_id, $record_id)
->get_response(); ->get_response();
@@ -505,7 +505,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT * RECORD_ID : required INT
* *
*/ */
$controllers->post('/records/{databox_id}/{record_id}/setmetadatas/', function(SilexApplication $app, $databox_id, $record_id) { $controllers->post('/records/{databox_id}/{record_id}/setmetadatas/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api'] return $app['api']
->set_record_metadatas($app['request'], $databox_id, $record_id) ->set_record_metadatas($app['request'], $databox_id, $record_id)
->get_response(); ->get_response();
@@ -523,7 +523,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT * RECORD_ID : required INT
* *
*/ */
$controllers->post('/records/{databox_id}/{record_id}/setstatus/', function(SilexApplication $app, $databox_id, $record_id) { $controllers->post('/records/{databox_id}/{record_id}/setstatus/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api'] return $app['api']
->set_record_status($app['request'], $databox_id, $record_id) ->set_record_status($app['request'], $databox_id, $record_id)
->get_response(); ->get_response();
@@ -541,7 +541,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT * RECORD_ID : required INT
* *
*/ */
$controllers->post('/records/{databox_id}/{record_id}/setcollection/', function(SilexApplication $app, $databox_id, $record_id) { $controllers->post('/records/{databox_id}/{record_id}/setcollection/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api'] return $app['api']
->set_record_collection($app['request'], $databox_id, $record_id) ->set_record_collection($app['request'], $databox_id, $record_id)
->get_response(); ->get_response();
@@ -549,7 +549,7 @@ class V1 implements ControllerProviderInterface
$controllers->post('/records/{wrong_databox_id}/{wrong_record_id}/setcollection/', $bad_request_exception); $controllers->post('/records/{wrong_databox_id}/{wrong_record_id}/setcollection/', $bad_request_exception);
$controllers->get('/records/{databox_id}/{record_id}/', function(SilexApplication $app, $databox_id, $record_id) { $controllers->get('/records/{databox_id}/{record_id}/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api'] return $app['api']
->get_record($app['request'], $databox_id, $record_id) ->get_record($app['request'], $databox_id, $record_id)
->get_response(); ->get_response();
@@ -565,7 +565,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->get('/baskets/list/', function(SilexApplication $app) { $controllers->get('/baskets/list/', function (SilexApplication $app) {
return $app['api']->search_baskets($app['request'])->get_response(); return $app['api']->search_baskets($app['request'])->get_response();
}); });
@@ -577,7 +577,7 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->post('/baskets/add/', function(SilexApplication $app) { $controllers->post('/baskets/add/', function (SilexApplication $app) {
return $app['api']->create_basket($app['request'])->get_response(); return $app['api']->create_basket($app['request'])->get_response();
}); });
@@ -590,7 +590,7 @@ class V1 implements ControllerProviderInterface
* BASKET_ID : required INT * BASKET_ID : required INT
* *
*/ */
$controllers->get('/baskets/{basket_id}/content/', function(SilexApplication $app, $basket_id) { $controllers->get('/baskets/{basket_id}/content/', function (SilexApplication $app, $basket_id) {
return $app['api']->get_basket($app['request'], $basket_id)->get_response(); return $app['api']->get_basket($app['request'], $basket_id)->get_response();
})->assert('basket_id', '\d+'); })->assert('basket_id', '\d+');
@@ -605,7 +605,7 @@ class V1 implements ControllerProviderInterface
* BASKET_ID : required INT * BASKET_ID : required INT
* *
*/ */
$controllers->post('/baskets/{basket_id}/setname/', function(SilexApplication $app, $basket_id) { $controllers->post('/baskets/{basket_id}/setname/', function (SilexApplication $app, $basket_id) {
return $app['api'] return $app['api']
->set_basket_title($app['request'], $basket_id) ->set_basket_title($app['request'], $basket_id)
->get_response(); ->get_response();
@@ -622,7 +622,7 @@ class V1 implements ControllerProviderInterface
* BASKET_ID : required INT * BASKET_ID : required INT
* *
*/ */
$controllers->post('/baskets/{basket_id}/setdescription/', function(SilexApplication $app, $basket_id) { $controllers->post('/baskets/{basket_id}/setdescription/', function (SilexApplication $app, $basket_id) {
return $app['api'] return $app['api']
->set_basket_description($app['request'], $basket_id) ->set_basket_description($app['request'], $basket_id)
->get_response(); ->get_response();
@@ -639,7 +639,7 @@ class V1 implements ControllerProviderInterface
* BASKET_ID : required INT * BASKET_ID : required INT
* *
*/ */
$controllers->post('/baskets/{basket_id}/delete/', function(SilexApplication $app, $basket_id) { $controllers->post('/baskets/{basket_id}/delete/', function (SilexApplication $app, $basket_id) {
return $app['api']->delete_basket($app['request'], $basket_id)->get_response(); return $app['api']->delete_basket($app['request'], $basket_id)->get_response();
})->assert('basket_id', '\d+'); })->assert('basket_id', '\d+');
@@ -653,19 +653,19 @@ class V1 implements ControllerProviderInterface
* Parameters : * Parameters :
* *
*/ */
$controllers->get('/feeds/list/', function(SilexApplication $app) { $controllers->get('/feeds/list/', function (SilexApplication $app) {
return $app['api'] return $app['api']
->search_publications($app['request'], $app['authentication']->getUser()) ->search_publications($app['request'], $app['authentication']->getUser())
->get_response(); ->get_response();
}); });
$controllers->get('/feeds/content/', function(SilexApplication $app) { $controllers->get('/feeds/content/', function (SilexApplication $app) {
return $app['api'] return $app['api']
->get_publications($app['request'], $app['authentication']->getUser()) ->get_publications($app['request'], $app['authentication']->getUser())
->get_response(); ->get_response();
}); });
$controllers->get('/feeds/entry/{entry_id}/', function(SilexApplication $app, $entry_id) { $controllers->get('/feeds/entry/{entry_id}/', function (SilexApplication $app, $entry_id) {
return $app['api'] return $app['api']
->get_feed_entry($app['request'], $entry_id, $app['authentication']->getUser()) ->get_feed_entry($app['request'], $entry_id, $app['authentication']->getUser())
->get_response(); ->get_response();
@@ -682,7 +682,7 @@ class V1 implements ControllerProviderInterface
* PUBLICATION_ID : required INT * PUBLICATION_ID : required INT
* *
*/ */
$controllers->get('/feeds/{feed_id}/content/', function(SilexApplication $app, $feed_id) { $controllers->get('/feeds/{feed_id}/content/', function (SilexApplication $app, $feed_id) {
return $app['api'] return $app['api']
->get_publication($app['request'], $feed_id, $app['authentication']->getUser()) ->get_publication($app['request'], $feed_id, $app['authentication']->getUser())
->get_response(); ->get_response();
@@ -700,7 +700,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT * RECORD_ID : required INT
* *
*/ */
$controllers->get('/stories/{databox_id}/{story_id}/embed/', function($databox_id, $story_id) use ($app) { $controllers->get('/stories/{databox_id}/{story_id}/embed/', function ($databox_id, $story_id) use ($app) {
$result = $app['api']->get_story_embed($app['request'], $databox_id, $story_id); $result = $app['api']->get_story_embed($app['request'], $databox_id, $story_id);
return $result->get_response(); return $result->get_response();
@@ -709,7 +709,7 @@ class V1 implements ControllerProviderInterface
$controllers->get('/stories/{any_id}/{anyother_id}/embed/', $bad_request_exception); $controllers->get('/stories/{any_id}/{anyother_id}/embed/', $bad_request_exception);
$controllers->get('/stories/{databox_id}/{story_id}/', function($databox_id, $story_id) use ($app) { $controllers->get('/stories/{databox_id}/{story_id}/', function ($databox_id, $story_id) use ($app) {
$result = $app['api']->get_story($app['request'], $databox_id, $story_id); $result = $app['api']->get_story($app['request'], $databox_id, $story_id);
return $result->get_response(); return $result->get_response();
@@ -717,7 +717,7 @@ class V1 implements ControllerProviderInterface
$controllers->get('/stories/{any_id}/{anyother_id}/', $bad_request_exception); $controllers->get('/stories/{any_id}/{anyother_id}/', $bad_request_exception);
$controllers->get('/stories/{databox_id}/{story_id}/', function($databox_id, $story_id) use ($app) { $controllers->get('/stories/{databox_id}/{story_id}/', function ($databox_id, $story_id) use ($app) {
$result = $app['api']->get_story($app['request'], $databox_id, $story_id); $result = $app['api']->get_story($app['request'], $databox_id, $story_id);
return $result->get_response(); return $result->get_response();

View File

@@ -25,7 +25,7 @@ class Baskets implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) { $controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });
@@ -260,7 +260,7 @@ class Baskets implements ControllerProviderInterface
$selectedBasket = $app['EM']->getRepository('\Entities\Basket')->findUserBasket($app, $selectedBasketId, $app['authentication']->getUser(), true); $selectedBasket = $app['EM']->getRepository('\Entities\Basket')->findUserBasket($app, $selectedBasketId, $app['authentication']->getUser(), true);
} }
$basketCollections = $baskets->partition(function($key, $basket) { $basketCollections = $baskets->partition(function ($key, $basket) {
return (Boolean) $basket->getPusherId(); return (Boolean) $basket->getPusherId();
}); });

View File

@@ -26,7 +26,7 @@ class Root implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
if (!$app['authentication']->isAuthenticated() && null !== $request->query->get('nolog')) { if (!$app['authentication']->isAuthenticated() && null !== $request->query->get('nolog')) {
return $app->redirectPath('login_authenticate_as_guest', array('redirect' => 'client')); return $app->redirectPath('login_authenticate_as_guest', array('redirect' => 'client'));
} }
@@ -151,9 +151,9 @@ class Root implements ControllerProviderInterface
$result = $app['phraseanet.SE']->query($query, ($currentPage - 1) * $perPage, $perPage); $result = $app['phraseanet.SE']->query($query, ($currentPage - 1) * $perPage, $perPage);
foreach ($options->getDataboxes() as $databox) { foreach ($options->getDataboxes() as $databox) {
$colls = array_map(function(\collection $collection) { $colls = array_map(function (\collection $collection) {
return $collection->get_coll_id(); return $collection->get_coll_id();
}, array_filter($options->getCollections(), function(\collection $collection) use ($databox) { }, array_filter($options->getCollections(), function (\collection $collection) use ($databox) {
return $collection->get_databox()->get_sbas_id() == $databox->get_sbas_id(); return $collection->get_databox()->get_sbas_id() == $databox->get_sbas_id();
})); }));
@@ -406,7 +406,7 @@ class Root implements ControllerProviderInterface
$iterator = $finder $iterator = $finder
->directories() ->directories()
->depth(0) ->depth(0)
->filter(function(\SplFileInfo $fileinfo) { ->filter(function (\SplFileInfo $fileinfo) {
return ctype_xdigit($fileinfo->getBasename()); return ctype_xdigit($fileinfo->getBasename());
}) })
->in($cssPath); ->in($cssPath);

View File

@@ -31,13 +31,13 @@ class Datafiles extends AbstractDelivery
$that = $this; $that = $this;
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
if (!$app['authentication']->isAuthenticated()) { if (!$app['authentication']->isAuthenticated()) {
$app->abort(403, 'You are not autorized to see this'); $app->abort(403, 'You are not autorized to see this');
} }
}); });
$controllers->get('/{sbas_id}/{record_id}/{subdef}/', function($sbas_id, $record_id, $subdef, PhraseaApplication $app) use ($that) { $controllers->get('/{sbas_id}/{record_id}/{subdef}/', function ($sbas_id, $record_id, $subdef, PhraseaApplication $app) use ($that) {
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$record = new \record_adapter($app, $sbas_id, $record_id); $record = new \record_adapter($app, $sbas_id, $record_id);

View File

@@ -25,7 +25,7 @@ class Lightbox implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
if (!$request->query->has('LOG')) { if (!$request->query->has('LOG')) {
return; return;
} }
@@ -58,7 +58,7 @@ class Lightbox implements ControllerProviderInterface
} }
}); });
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });
@@ -92,7 +92,7 @@ class Lightbox implements ControllerProviderInterface
}) })
->bind('lightbox'); ->bind('lightbox');
$controllers->get('/ajax/NOTE_FORM/{sselcont_id}/', function(SilexApplication $app, $sselcont_id) { $controllers->get('/ajax/NOTE_FORM/{sselcont_id}/', function (SilexApplication $app, $sselcont_id) {
if (!$app['browser']->isMobile()) { if (!$app['browser']->isMobile()) {
return new Response(''); return new Response('');
@@ -112,7 +112,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_ajax_note_form') ->bind('lightbox_ajax_note_form')
->assert('sselcont_id', '\d+'); ->assert('sselcont_id', '\d+');
$controllers->get('/ajax/LOAD_BASKET_ELEMENT/{sselcont_id}/', function(SilexApplication $app, $sselcont_id) { $controllers->get('/ajax/LOAD_BASKET_ELEMENT/{sselcont_id}/', function (SilexApplication $app, $sselcont_id) {
/* @var $repository \Repositories\BasketElementRepository */ /* @var $repository \Repositories\BasketElementRepository */
$repository = $app['EM']->getRepository('\Entities\BasketElement'); $repository = $app['EM']->getRepository('\Entities\BasketElement');
@@ -158,7 +158,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_ajax_load_basketelement') ->bind('lightbox_ajax_load_basketelement')
->assert('sselcont_id', '\d+'); ->assert('sselcont_id', '\d+');
$controllers->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function(SilexApplication $app, $entry_id, $item_id) { $controllers->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function (SilexApplication $app, $entry_id, $item_id) {
$entry = \Feed_Entry_Adapter::load_from_id($app, $entry_id); $entry = \Feed_Entry_Adapter::load_from_id($app, $entry_id);
$item = new \Feed_Entry_Item($app['phraseanet.appbox'], $entry, $item_id); $item = new \Feed_Entry_Item($app['phraseanet.appbox'], $entry, $item_id);
@@ -339,7 +339,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_feed_entry') ->bind('lightbox_feed_entry')
->assert('entry_id', '\d+'); ->assert('entry_id', '\d+');
$controllers->get('/ajax/LOAD_REPORT/{ssel_id}/', function(SilexApplication $app, $ssel_id) { $controllers->get('/ajax/LOAD_REPORT/{ssel_id}/', function (SilexApplication $app, $ssel_id) {
$template = 'lightbox/basket_content_report.html.twig'; $template = 'lightbox/basket_content_report.html.twig';
@@ -400,7 +400,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_ajax_set_note') ->bind('lightbox_ajax_set_note')
->assert('sselcont_id', '\d+'); ->assert('sselcont_id', '\d+');
$controllers->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function(SilexApplication $app, $sselcont_id) { $controllers->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function (SilexApplication $app, $sselcont_id) {
$request = $app['request']; $request = $app['request'];
$agreement = $request->request->get('agreement'); $agreement = $request->request->get('agreement');
@@ -463,7 +463,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_ajax_set_element_agreement') ->bind('lightbox_ajax_set_element_agreement')
->assert('sselcont_id', '\d+'); ->assert('sselcont_id', '\d+');
$controllers->post('/ajax/SET_RELEASE/{ssel_id}/', function(SilexApplication $app, $ssel_id) { $controllers->post('/ajax/SET_RELEASE/{ssel_id}/', function (SilexApplication $app, $ssel_id) {
$repository = $app['EM']->getRepository('\Entities\Basket'); $repository = $app['EM']->getRepository('\Entities\Basket');

View File

@@ -45,7 +45,7 @@ class Permalink extends AbstractDelivery
return $record; return $record;
}; };
$deliverPermaview = function($sbas_id, $record_id, $token, $subdef, PhraseaApplication $app) use ($retrieveRecord) { $deliverPermaview = function ($sbas_id, $record_id, $token, $subdef, PhraseaApplication $app) use ($retrieveRecord) {
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$record = $retrieveRecord($app, $databox, $token, $record_id, $subdef); $record = $retrieveRecord($app, $databox, $token, $record_id, $subdef);
@@ -61,7 +61,7 @@ class Permalink extends AbstractDelivery
return $app['twig']->render('overview.html.twig', $params); return $app['twig']->render('overview.html.twig', $params);
}; };
$deliverPermalink = function(PhraseaApplication $app, $sbas_id, $record_id, $token, $subdef) use ($that, $retrieveRecord) { $deliverPermalink = function (PhraseaApplication $app, $sbas_id, $record_id, $token, $subdef) use ($that, $retrieveRecord) {
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$record = $retrieveRecord($app, $databox, $token, $record_id, $subdef); $record = $retrieveRecord($app, $databox, $token, $record_id, $subdef);
@@ -113,7 +113,7 @@ class Permalink extends AbstractDelivery
return $response; return $response;
}; };
$controllers->get('/v1/{sbas_id}/{record_id}/caption/', function(PhraseaApplication $app, Request $request, $sbas_id, $record_id) { $controllers->get('/v1/{sbas_id}/{record_id}/caption/', function (PhraseaApplication $app, Request $request, $sbas_id, $record_id) {
$token = $request->query->get('token'); $token = $request->query->get('token');
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
@@ -138,7 +138,7 @@ class Permalink extends AbstractDelivery
->assert('sbas_id', '\d+') ->assert('sbas_id', '\d+')
->assert('record_id', '\d+'); ->assert('record_id', '\d+');
$controllers->get('/v1/{label}/{sbas_id}/{record_id}/{token}/{subdef}/view/', function(PhraseaApplication $app, $label, $sbas_id, $record_id, $token, $subdef) use ($deliverPermaview) { $controllers->get('/v1/{label}/{sbas_id}/{record_id}/{token}/{subdef}/view/', function (PhraseaApplication $app, $label, $sbas_id, $record_id, $token, $subdef) use ($deliverPermaview) {
return $deliverPermaview($sbas_id, $record_id, $token, $subdef, $app); return $deliverPermaview($sbas_id, $record_id, $token, $subdef, $app);
}) })
->bind('permalinks_permaview_old') ->bind('permalinks_permaview_old')
@@ -154,7 +154,7 @@ class Permalink extends AbstractDelivery
->assert('sbas_id', '\d+') ->assert('sbas_id', '\d+')
->assert('record_id', '\d+'); ->assert('record_id', '\d+');
$controllers->get('/v1/{label}/{sbas_id}/{record_id}/{token}/{subdef}/', function(PhraseaApplication $app, $label, $sbas_id, $record_id, $token, $subdef) use ($deliverPermalink) { $controllers->get('/v1/{label}/{sbas_id}/{record_id}/{token}/{subdef}/', function (PhraseaApplication $app, $label, $sbas_id, $record_id, $token, $subdef) use ($deliverPermalink) {
return $deliverPermalink($app, $sbas_id, $record_id, $token, $subdef); return $deliverPermalink($app, $sbas_id, $record_id, $token, $subdef);
}) })
->bind('permalinks_permalink_old') ->bind('permalinks_permalink_old')

View File

@@ -33,7 +33,7 @@ class Basket implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });

View File

@@ -23,7 +23,7 @@ class Bridge implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('bas_chupub'); $app['firewall']->requireRight('bas_chupub');
}); });

View File

@@ -26,7 +26,7 @@ class Download implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });

View File

@@ -30,13 +30,13 @@ class Edit implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall'] $app['firewall']
->requireNotGuest() ->requireNotGuest()
->requireRight('modifyrecord'); ->requireRight('modifyrecord');
}); });
$controllers->post('/', function(Application $app, Request $request) { $controllers->post('/', function (Application $app, Request $request) {
$records = RecordsRequest::fromRequest($app, $request, RecordsRequest::FLATTEN_YES_PRESERVE_STORIES, array('canmodifrecord')); $records = RecordsRequest::fromRequest($app, $request, RecordsRequest::FLATTEN_YES_PRESERVE_STORIES, array('canmodifrecord'));
@@ -228,7 +228,7 @@ class Edit implements ControllerProviderInterface
return $app['twig']->render('prod/actions/edit_default.html.twig', $params); return $app['twig']->render('prod/actions/edit_default.html.twig', $params);
}); });
$controllers->get('/vocabulary/{vocabulary}/', function(Application $app, Request $request, $vocabulary) { $controllers->get('/vocabulary/{vocabulary}/', function (Application $app, Request $request, $vocabulary) {
$datas = array('success' => false, 'message' => '', 'results' => array()); $datas = array('success' => false, 'message' => '', 'results' => array());
$sbas_id = (int) $request->query->get('sbas_id'); $sbas_id = (int) $request->query->get('sbas_id');
@@ -267,7 +267,7 @@ class Edit implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
}); });
$controllers->post('/apply/', function(Application $app, Request $request) { $controllers->post('/apply/', function (Application $app, Request $request) {
$records = RecordsRequest::fromRequest($app, $request, RecordsRequest::FLATTEN_YES_PRESERVE_STORIES, array('canmodifrecord')); $records = RecordsRequest::fromRequest($app, $request, RecordsRequest::FLATTEN_YES_PRESERVE_STORIES, array('canmodifrecord'));

View File

@@ -32,7 +32,7 @@ class Export implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireNotGuest(); $app['firewall']->requireNotGuest();
}); });

View File

@@ -31,14 +31,14 @@ class Feed implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });
/** /**
* I got a selection of docs, which publications are available forthese docs ? * I got a selection of docs, which publications are available forthese docs ?
*/ */
$controllers->post('/requestavailable/', function(Application $app, Request $request) { $controllers->post('/requestavailable/', function (Application $app, Request $request) {
$feeds = \Feed_Collection::load_all($app, $app['authentication']->getUser()); $feeds = \Feed_Collection::load_all($app, $app['authentication']->getUser());
$publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub')); $publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub'));
@@ -48,7 +48,7 @@ class Feed implements ControllerProviderInterface
/** /**
* I've selected a publication for my docs, let's publish them * I've selected a publication for my docs, let's publish them
*/ */
$controllers->post('/entry/create/', function(Application $app, Request $request) { $controllers->post('/entry/create/', function (Application $app, Request $request) {
try { try {
$feed = new \Feed_Adapter($app, $request->request->get('feed_id')); $feed = new \Feed_Adapter($app, $request->request->get('feed_id'));
$publisher = \Feed_Publisher_Adapter::getPublisher($app['phraseanet.appbox'], $feed, $app['authentication']->getUser()); $publisher = \Feed_Publisher_Adapter::getPublisher($app['phraseanet.appbox'], $feed, $app['authentication']->getUser());
@@ -73,11 +73,11 @@ class Feed implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
}) })
->bind('prod_feeds_entry_create') ->bind('prod_feeds_entry_create')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('bas_chupub'); $app['firewall']->requireRight('bas_chupub');
}); });
$controllers->get('/entry/{id}/edit/', function(Application $app, Request $request, $id) { $controllers->get('/entry/{id}/edit/', function (Application $app, Request $request, $id) {
$entry = \Feed_Entry_Adapter::load_from_id($app, $id); $entry = \Feed_Entry_Adapter::load_from_id($app, $id);
if (!$entry->is_publisher($app['authentication']->getUser())) { if (!$entry->is_publisher($app['authentication']->getUser())) {
@@ -92,11 +92,11 @@ class Feed implements ControllerProviderInterface
}) })
->bind('feed_entry_edit') ->bind('feed_entry_edit')
->assert('id', '\d+') ->assert('id', '\d+')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('bas_chupub'); $app['firewall']->requireRight('bas_chupub');
}); });
$controllers->post('/entry/{id}/update/', function(Application $app, Request $request, $id) { $controllers->post('/entry/{id}/update/', function (Application $app, Request $request, $id) {
$datas = array('error' => true, 'message' => '', 'datas' => ''); $datas = array('error' => true, 'message' => '', 'datas' => '');
try { try {
$app['phraseanet.appbox']->get_connection()->beginTransaction(); $app['phraseanet.appbox']->get_connection()->beginTransaction();
@@ -167,11 +167,11 @@ class Feed implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
}) })
->bind('prod_feeds_entry_update') ->bind('prod_feeds_entry_update')
->assert('id', '\d+')->before(function(Request $request) use ($app) { ->assert('id', '\d+')->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('bas_chupub'); $app['firewall']->requireRight('bas_chupub');
}); });
$controllers->post('/entry/{id}/delete/', function(Application $app, Request $request, $id) { $controllers->post('/entry/{id}/delete/', function (Application $app, Request $request, $id) {
$datas = array('error' => true, 'message' => ''); $datas = array('error' => true, 'message' => '');
try { try {
$app['phraseanet.appbox']->get_connection()->beginTransaction(); $app['phraseanet.appbox']->get_connection()->beginTransaction();
@@ -198,11 +198,11 @@ class Feed implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
}) })
->bind('feed_entry_delete') ->bind('feed_entry_delete')
->assert('id', '\d+')->before(function(Request $request) use ($app) { ->assert('id', '\d+')->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('bas_chupub'); $app['firewall']->requireRight('bas_chupub');
}); });
$controllers->get('/', function(Application $app, Request $request) { $controllers->get('/', function (Application $app, Request $request) {
$request = $app['request']; $request = $app['request'];
$page = (int) $request->query->get('page'); $page = (int) $request->query->get('page');
$page = $page > 0 ? $page : 1; $page = $page > 0 ? $page : 1;
@@ -220,7 +220,7 @@ class Feed implements ControllerProviderInterface
return new Response($datas); return new Response($datas);
})->bind('prod_feeds'); })->bind('prod_feeds');
$controllers->get('/feed/{id}/', function(Application $app, Request $request, $id) { $controllers->get('/feed/{id}/', function (Application $app, Request $request, $id) {
$page = (int) $request->query->get('page'); $page = (int) $request->query->get('page');
$page = $page > 0 ? $page : 1; $page = $page > 0 ? $page : 1;
@@ -234,7 +234,7 @@ class Feed implements ControllerProviderInterface
->bind('prod_feeds_feed') ->bind('prod_feeds_feed')
->assert('id', '\d+'); ->assert('id', '\d+');
$controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) { $controllers->get('/subscribe/aggregated/', function (Application $app, Request $request) {
$renew = ($request->query->get('renew') === 'true'); $renew = ($request->query->get('renew') === 'true');
$feeds = \Feed_Collection::load_all($app, $app['authentication']->getUser()); $feeds = \Feed_Collection::load_all($app, $app['authentication']->getUser());
@@ -249,7 +249,7 @@ class Feed implements ControllerProviderInterface
return $app->json($output); return $app->json($output);
})->bind('prod_feeds_subscribe_aggregated'); })->bind('prod_feeds_subscribe_aggregated');
$controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) { $controllers->get('/subscribe/{id}/', function (Application $app, Request $request, $id) {
$renew = ($request->query->get('renew') === 'true'); $renew = ($request->query->get('renew') === 'true');
$feed = \Feed_Adapter::load_with_user($app, $app['authentication']->getUser(), $id); $feed = \Feed_Adapter::load_with_user($app, $app['authentication']->getUser(), $id);

View File

@@ -26,7 +26,7 @@ class Language implements ControllerProviderInterface
{ {
$controller = $app['controllers_factory']; $controller = $app['controllers_factory'];
$controller->get("/", function(Application $app) { $controller->get("/", function (Application $app) {
$out = array(); $out = array();
$out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.'); $out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.');

View File

@@ -42,7 +42,7 @@ class Lazaret implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication() $app['firewall']->requireAuthentication()
->requireRight('addrecord'); ->requireRight('addrecord');
}); });
@@ -275,7 +275,7 @@ class Lazaret implements ControllerProviderInterface
/* @var $record \record_adapter */ /* @var $record \record_adapter */
//Post record creation //Post record creation
$callBack = function($element, $visa, $code) use (&$record) { $callBack = function ($element, $visa, $code) use (&$record) {
$record = $element; $record = $element;
}; };

View File

@@ -28,7 +28,7 @@ class MoveCollection implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication() $app['firewall']->requireAuthentication()
->requireRight('addrecord') ->requireRight('addrecord')
->requireRight('deleterecord'); ->requireRight('deleterecord');
@@ -44,7 +44,7 @@ class MoveCollection implements ControllerProviderInterface
{ {
$records = RecordsRequest::fromRequest($app, $request, false, array('candeleterecord')); $records = RecordsRequest::fromRequest($app, $request, false, array('candeleterecord'));
$sbas_ids = array_map(function(\databox $databox) { $sbas_ids = array_map(function (\databox $databox) {
return $databox->get_sbas_id(); return $databox->get_sbas_id();
}, $records->databoxes()); }, $records->databoxes());

View File

@@ -35,7 +35,7 @@ class Order implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication() $app['firewall']->requireAuthentication()
->requireRight('order'); ->requireRight('order');
}); });
@@ -54,7 +54,7 @@ class Order implements ControllerProviderInterface
* return : HTML Response * return : HTML Response
*/ */
$controllers->get('/', $this->call('displayOrders')) $controllers->get('/', $this->call('displayOrders'))
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireOrdersAdmin(); $app['firewall']->requireOrdersAdmin();
}) })
->bind('prod_orders'); ->bind('prod_orders');
@@ -89,7 +89,7 @@ class Order implements ControllerProviderInterface
* return : HTML Response * return : HTML Response
*/ */
$controllers->get('/{order_id}/', $this->call('displayOneOrder')) $controllers->get('/{order_id}/', $this->call('displayOneOrder'))
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireOrdersAdmin(); $app['firewall']->requireOrdersAdmin();
}) })
->bind('prod_order') ->bind('prod_order')
@@ -109,7 +109,7 @@ class Order implements ControllerProviderInterface
* return : HTML Response | JSON Response * return : HTML Response | JSON Response
*/ */
$controllers->post('/{order_id}/send/', $this->call('sendOrder')) $controllers->post('/{order_id}/send/', $this->call('sendOrder'))
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireOrdersAdmin(); $app['firewall']->requireOrdersAdmin();
}) })
->bind('prod_order_send') ->bind('prod_order_send')
@@ -129,7 +129,7 @@ class Order implements ControllerProviderInterface
* return : HTML Response | JSON Response * return : HTML Response | JSON Response
*/ */
$controllers->post('/{order_id}/deny/', $this->call('denyOrder')) $controllers->post('/{order_id}/deny/', $this->call('denyOrder'))
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireOrdersAdmin(); $app['firewall']->requireOrdersAdmin();
}) })
->bind('prod_order_deny') ->bind('prod_order_deny')
@@ -180,7 +180,7 @@ class Order implements ControllerProviderInterface
} }
} }
$noAdmins = $collectionHasOrderAdmins->forAll(function($key, $hasAdmin) { $noAdmins = $collectionHasOrderAdmins->forAll(function ($key, $hasAdmin) {
return false === $hasAdmin; return false === $hasAdmin;
}); });

View File

@@ -29,14 +29,14 @@ class Printer implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->post('/', function(Application $app) { $controllers->post('/', function (Application $app) {
$printer = new RecordHelper\Printer($app, $app['request']); $printer = new RecordHelper\Printer($app, $app['request']);
return $app['twig']->render('prod/actions/printer_default.html.twig', array('printer' => $printer, 'message' => '')); return $app['twig']->render('prod/actions/printer_default.html.twig', array('printer' => $printer, 'message' => ''));
} }
); );
$controllers->post('/print.pdf', function(Application $app) { $controllers->post('/print.pdf', function (Application $app) {
$printer = new RecordHelper\Printer($app, $app['request']); $printer = new RecordHelper\Printer($app, $app['request']);
$request = $app['request']; $request = $app['request'];

View File

@@ -28,7 +28,7 @@ class Property implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireNotGuest(); $app['firewall']->requireNotGuest();
}); });

View File

@@ -29,7 +29,7 @@ class Push implements ControllerProviderInterface
protected function getUserFormatter() protected function getUserFormatter()
{ {
return function(\User_Adapter $user) { return function (\User_Adapter $user) {
$subtitle = array_filter(array($user->get_job(), $user->get_company())); $subtitle = array_filter(array($user->get_job(), $user->get_company()));
return array( return array(
@@ -48,7 +48,7 @@ class Push implements ControllerProviderInterface
{ {
$userFormatter = $this->getUserFormatter(); $userFormatter = $this->getUserFormatter();
return function(\Entities\UsrList $List) use ($userFormatter, $app) { return function (\Entities\UsrList $List) use ($userFormatter, $app) {
$entries = array(); $entries = array();
foreach ($List->getEntries() as $entry) { foreach ($List->getEntries() as $entry) {
@@ -71,7 +71,7 @@ class Push implements ControllerProviderInterface
protected function getUsersInSelectionExtractor() protected function getUsersInSelectionExtractor()
{ {
return function(array $selection) { return function (array $selection) {
$Users = new \Doctrine\Common\Collections\ArrayCollection(); $Users = new \Doctrine\Common\Collections\ArrayCollection();
foreach ($selection as $record) { foreach ($selection as $record) {
@@ -99,7 +99,7 @@ class Push implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication() $app['firewall']->requireAuthentication()
->requireRight('push'); ->requireRight('push');
}); });
@@ -110,7 +110,7 @@ class Push implements ControllerProviderInterface
$userSelection = $this->getUsersInSelectionExtractor(); $userSelection = $this->getUsersInSelectionExtractor();
$controllers->post('/sendform/', function(Application $app) use ($userSelection) { $controllers->post('/sendform/', function (Application $app) use ($userSelection) {
$push = new RecordHelper\Push($app, $app['request']); $push = new RecordHelper\Push($app, $app['request']);
$repository = $app['EM']->getRepository('\Entities\UsrList'); $repository = $app['EM']->getRepository('\Entities\UsrList');
@@ -128,7 +128,7 @@ class Push implements ControllerProviderInterface
return $app['twig']->render('prod/actions/Push.html.twig', $params); return $app['twig']->render('prod/actions/Push.html.twig', $params);
}); });
$controllers->post('/validateform/', function(Application $app) use ($userSelection) { $controllers->post('/validateform/', function (Application $app) use ($userSelection) {
$push = new RecordHelper\Push($app, $app['request']); $push = new RecordHelper\Push($app, $app['request']);
$repository = $app['EM']->getRepository('\Entities\UsrList'); $repository = $app['EM']->getRepository('\Entities\UsrList');
@@ -146,7 +146,7 @@ class Push implements ControllerProviderInterface
return $app['twig']->render('prod/actions/Push.html.twig', $params); return $app['twig']->render('prod/actions/Push.html.twig', $params);
}); });
$controllers->post('/send/', function(Application $app) { $controllers->post('/send/', function (Application $app) {
$request = $app['request']; $request = $app['request'];
$ret = array( $ret = array(
@@ -261,7 +261,7 @@ class Push implements ControllerProviderInterface
return $app->json($ret); return $app->json($ret);
})->bind('prod_push_send'); })->bind('prod_push_send');
$controllers->post('/validate/', function(Application $app) { $controllers->post('/validate/', function (Application $app) {
$request = $app['request']; $request = $app['request'];
$ret = array( $ret = array(
@@ -463,7 +463,7 @@ class Push implements ControllerProviderInterface
return $app->json($ret); return $app->json($ret);
})->bind('prod_push_validate'); })->bind('prod_push_validate');
$controllers->get('/user/{usr_id}/', function(Application $app, $usr_id) use ($userFormatter) { $controllers->get('/user/{usr_id}/', function (Application $app, $usr_id) use ($userFormatter) {
$datas = null; $datas = null;
$request = $app['request']; $request = $app['request'];
@@ -487,7 +487,7 @@ class Push implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
})->assert('usr_id', '\d+'); })->assert('usr_id', '\d+');
$controllers->get('/list/{list_id}/', function(Application $app, $list_id) use ($listFormatter) { $controllers->get('/list/{list_id}/', function (Application $app, $list_id) use ($listFormatter) {
$datas = null; $datas = null;
$repository = $app['EM']->getRepository('\Entities\UsrList'); $repository = $app['EM']->getRepository('\Entities\UsrList');
@@ -503,7 +503,7 @@ class Push implements ControllerProviderInterface
->bind('prod_push_lists_list') ->bind('prod_push_lists_list')
->assert('list_id', '\d+'); ->assert('list_id', '\d+');
$controllers->post('/add-user/', function(Application $app, Request $request) use ($userFormatter) { $controllers->post('/add-user/', function (Application $app, Request $request) use ($userFormatter) {
$result = array('success' => false, 'message' => '', 'user' => null); $result = array('success' => false, 'message' => '', 'user' => null);
try { try {
@@ -568,13 +568,13 @@ class Push implements ControllerProviderInterface
return $app->json($result); return $app->json($result);
})->bind('prod_push_do_add_user'); })->bind('prod_push_do_add_user');
$controllers->get('/add-user/', function(Application $app, Request $request) { $controllers->get('/add-user/', function (Application $app, Request $request) {
$params = array('callback' => $request->query->get('callback')); $params = array('callback' => $request->query->get('callback'));
return $app['twig']->render('prod/User/Add.html.twig', $params); return $app['twig']->render('prod/User/Add.html.twig', $params);
})->bind('prod_push_add_user'); })->bind('prod_push_add_user');
$controllers->get('/search-user/', function(Application $app) use ($userFormatter, $listFormatter) { $controllers->get('/search-user/', function (Application $app) use ($userFormatter, $listFormatter) {
$request = $app['request']; $request = $app['request'];
$query = new \User_Query($app); $query = new \User_Query($app);
@@ -611,7 +611,7 @@ class Push implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
}); });
$controllers->match('/edit-list/{list_id}/', function(Application $app, Request $request, $list_id) { $controllers->match('/edit-list/{list_id}/', function (Application $app, Request $request, $list_id) {
$repository = $app['EM']->getRepository('\Entities\UsrList'); $repository = $app['EM']->getRepository('\Entities\UsrList');

View File

@@ -30,7 +30,7 @@ class Query implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });
@@ -119,9 +119,9 @@ class Query implements ControllerProviderInterface
$result = $app['phraseanet.SE']->query($query, (($page - 1) * $perPage), $perPage); $result = $app['phraseanet.SE']->query($query, (($page - 1) * $perPage), $perPage);
foreach ($options->getDataboxes() as $databox) { foreach ($options->getDataboxes() as $databox) {
$colls = array_map(function(\collection $collection) { $colls = array_map(function (\collection $collection) {
return $collection->get_coll_id(); return $collection->get_coll_id();
}, array_filter($options->getCollections(), function(\collection $collection) use ($databox) { }, array_filter($options->getCollections(), function (\collection $collection) use ($databox) {
return $collection->get_databox()->get_sbas_id() == $databox->get_sbas_id(); return $collection->get_databox()->get_sbas_id() == $databox->get_sbas_id();
})); }));

View File

@@ -28,7 +28,7 @@ class Records implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireNotGuest(); $app['firewall']->requireNotGuest();
}); });

View File

@@ -31,7 +31,7 @@ class Root implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
if (!$app['authentication']->isAuthenticated() && null !== $request->query->get('nolog')) { if (!$app['authentication']->isAuthenticated() && null !== $request->query->get('nolog')) {
return $app->redirectPath('login_authenticate_as_guest'); return $app->redirectPath('login_authenticate_as_guest');
} }
@@ -39,7 +39,7 @@ class Root implements ControllerProviderInterface
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });
$controllers->get('/', function(Application $app) { $controllers->get('/', function (Application $app) {
try { try {
\User_Adapter::updateClientInfos($app, 1); \User_Adapter::updateClientInfos($app, 1);
} catch (SessionNotFound $e) { } catch (SessionNotFound $e) {
@@ -56,7 +56,7 @@ class Root implements ControllerProviderInterface
$iterator = $finder $iterator = $finder
->directories() ->directories()
->depth(0) ->depth(0)
->filter(function(\SplFileInfo $fileinfo) { ->filter(function (\SplFileInfo $fileinfo) {
return ctype_xdigit($fileinfo->getBasename()); return ctype_xdigit($fileinfo->getBasename());
}) })
->in($cssPath); ->in($cssPath);

View File

@@ -26,7 +26,7 @@ class Share implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireNotGuest(); $app['firewall']->requireNotGuest();
}); });
@@ -44,7 +44,7 @@ class Share implements ControllerProviderInterface
* return : HTML Response * return : HTML Response
*/ */
$controllers->get('/record/{base_id}/{record_id}/', $this->call('shareRecord')) $controllers->get('/record/{base_id}/{record_id}/', $this->call('shareRecord'))
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas(\phrasea::sbasFromBas($app, $request->attributes->get('base_id')), 'bas_chupub'); $app['firewall']->requireRightOnSbas(\phrasea::sbasFromBas($app, $request->attributes->get('base_id')), 'bas_chupub');
}) })
->bind('share_record'); ->bind('share_record');

View File

@@ -31,15 +31,15 @@ class Story implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });
$controllers->get('/create/', function(Application $app) { $controllers->get('/create/', function (Application $app) {
return $app['twig']->render('prod/Story/Create.html.twig', array()); return $app['twig']->render('prod/Story/Create.html.twig', array());
})->bind('prod_stories_create'); })->bind('prod_stories_create');
$controllers->post('/', function(Application $app, Request $request) { $controllers->post('/', function (Application $app, Request $request) {
/* @var $request \Symfony\Component\HttpFoundation\Request */ /* @var $request \Symfony\Component\HttpFoundation\Request */
$collection = \collection::get_from_base_id($app, $request->request->get('base_id')); $collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
@@ -107,7 +107,7 @@ class Story implements ControllerProviderInterface
} }
})->bind('prod_stories_do_create'); })->bind('prod_stories_do_create');
$controllers->get('/{sbas_id}/{record_id}/', function(Application $app, $sbas_id, $record_id) { $controllers->get('/{sbas_id}/{record_id}/', function (Application $app, $sbas_id, $record_id) {
$Story = new \record_adapter($app, $sbas_id, $record_id); $Story = new \record_adapter($app, $sbas_id, $record_id);
$html = $app['twig']->render('prod/WorkZone/Story.html.twig', array('Story' => $Story)); $html = $app['twig']->render('prod/WorkZone/Story.html.twig', array('Story' => $Story));
@@ -118,7 +118,7 @@ class Story implements ControllerProviderInterface
->assert('sbas_id', '\d+') ->assert('sbas_id', '\d+')
->assert('record_id', '\d+'); ->assert('record_id', '\d+');
$controllers->post('/{sbas_id}/{record_id}/addElements/', function(Application $app, Request $request, $sbas_id, $record_id) { $controllers->post('/{sbas_id}/{record_id}/addElements/', function (Application $app, Request $request, $sbas_id, $record_id) {
$Story = new \record_adapter($app, $sbas_id, $record_id); $Story = new \record_adapter($app, $sbas_id, $record_id);
if (!$app['authentication']->getUser()->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord')) if (!$app['authentication']->getUser()->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
@@ -149,7 +149,7 @@ class Story implements ControllerProviderInterface
} }
})->assert('sbas_id', '\d+')->assert('record_id', '\d+'); })->assert('sbas_id', '\d+')->assert('record_id', '\d+');
$controllers->post('/{sbas_id}/{record_id}/delete/{child_sbas_id}/{child_record_id}/', function(Application $app, Request $request, $sbas_id, $record_id, $child_sbas_id, $child_record_id) { $controllers->post('/{sbas_id}/{record_id}/delete/{child_sbas_id}/{child_record_id}/', function (Application $app, Request $request, $sbas_id, $record_id, $child_sbas_id, $child_record_id) {
$Story = new \record_adapter($app, $sbas_id, $record_id); $Story = new \record_adapter($app, $sbas_id, $record_id);
$record = new \record_adapter($app, $child_sbas_id, $child_record_id); $record = new \record_adapter($app, $child_sbas_id, $child_record_id);
@@ -179,7 +179,7 @@ class Story implements ControllerProviderInterface
/** /**
* Get the Basket reorder form * Get the Basket reorder form
*/ */
$controllers->get('/{sbas_id}/{record_id}/reorder/', function(Application $app, $sbas_id, $record_id) { $controllers->get('/{sbas_id}/{record_id}/reorder/', function (Application $app, $sbas_id, $record_id) {
$story = new \record_adapter($app, $sbas_id, $record_id); $story = new \record_adapter($app, $sbas_id, $record_id);
if (!$story->is_grouping()) { if (!$story->is_grouping()) {
@@ -197,7 +197,7 @@ class Story implements ControllerProviderInterface
->assert('sbas_id', '\d+') ->assert('sbas_id', '\d+')
->assert('record_id', '\d+'); ->assert('record_id', '\d+');
$controllers->post('/{sbas_id}/{record_id}/reorder/', function(Application $app, $sbas_id, $record_id) { $controllers->post('/{sbas_id}/{record_id}/reorder/', function (Application $app, $sbas_id, $record_id) {
$ret = array('success' => false, 'message' => _('An error occured')); $ret = array('success' => false, 'message' => _('An error occured'));
try { try {

View File

@@ -44,7 +44,7 @@ class TOU implements ControllerProviderInterface
*/ */
$controllers->post('/deny/{sbas_id}/', $this->call('denyTermsOfUse')) $controllers->post('/deny/{sbas_id}/', $this->call('denyTermsOfUse'))
->bind('deny_tou') ->bind('deny_tou')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });

View File

@@ -30,12 +30,12 @@ class Tools implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication() $app['firewall']->requireAuthentication()
->requireRight('doctools'); ->requireRight('doctools');
}); });
$controllers->get('/', function(Application $app, Request $request) { $controllers->get('/', function (Application $app, Request $request) {
$records = RecordsRequest::fromRequest($app, $request, false); $records = RecordsRequest::fromRequest($app, $request, false);
@@ -66,7 +66,7 @@ class Tools implements ControllerProviderInterface
return $app['twig']->render('prod/actions/Tools/index.html.twig', $var); return $app['twig']->render('prod/actions/Tools/index.html.twig', $var);
}); });
$controllers->post('/rotate/', function(Application $app, Request $request) { $controllers->post('/rotate/', function (Application $app, Request $request) {
$return = array('success' => true, 'errorMessage' => ''); $return = array('success' => true, 'errorMessage' => '');
$records = RecordsRequest::fromRequest($app, $request, false); $records = RecordsRequest::fromRequest($app, $request, false);
@@ -89,7 +89,7 @@ class Tools implements ControllerProviderInterface
return $app->json($return); return $app->json($return);
})->bind('prod_tools_rotate'); })->bind('prod_tools_rotate');
$controllers->post('/image/', function(Application $app, Request $request) { $controllers->post('/image/', function (Application $app, Request $request) {
$return = array('success' => true); $return = array('success' => true);
$selection = RecordsRequest::fromRequest($app, $request, false, array('canmodifrecord')); $selection = RecordsRequest::fromRequest($app, $request, false, array('canmodifrecord'));
@@ -112,7 +112,7 @@ class Tools implements ControllerProviderInterface
return $app->json($return); return $app->json($return);
})->bind('prod_tools_image'); })->bind('prod_tools_image');
$controllers->post('/hddoc/', function(Application $app, Request $request) { $controllers->post('/hddoc/', function (Application $app, Request $request) {
$success = false; $success = false;
$message = _('An error occured'); $message = _('An error occured');
@@ -173,7 +173,7 @@ class Tools implements ControllerProviderInterface
)); ));
})->bind('prod_tools_hd_substitution'); })->bind('prod_tools_hd_substitution');
$controllers->post('/chgthumb/', function(Application $app, Request $request) { $controllers->post('/chgthumb/', function (Application $app, Request $request) {
$success = false; $success = false;
$message = _('An error occured'); $message = _('An error occured');
@@ -227,7 +227,7 @@ class Tools implements ControllerProviderInterface
)); ));
})->bind('prod_tools_thumbnail_substitution'); })->bind('prod_tools_thumbnail_substitution');
$controllers->post('/thumb-extractor/confirm-box/', function(Application $app, Request $request) { $controllers->post('/thumb-extractor/confirm-box/', function (Application $app, Request $request) {
$return = array('error' => false, 'datas' => ''); $return = array('error' => false, 'datas' => '');
$template = 'prod/actions/Tools/confirm.html.twig'; $template = 'prod/actions/Tools/confirm.html.twig';
@@ -246,7 +246,7 @@ class Tools implements ControllerProviderInterface
return $app->json($return); return $app->json($return);
}); });
$controllers->post('/thumb-extractor/apply/', function(Application $app, Request $request) { $controllers->post('/thumb-extractor/apply/', function (Application $app, Request $request) {
$return = array('success' => false, 'message' => ''); $return = array('success' => false, 'message' => '');
try { try {

View File

@@ -28,7 +28,7 @@ class Tooltip implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });

View File

@@ -45,7 +45,7 @@ class Upload implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication() $app['firewall']->requireAuthentication()
->requireRight('addrecord'); ->requireRight('addrecord');
}); });
@@ -220,7 +220,7 @@ class Upload implements ControllerProviderInterface
$reasons = array(); $reasons = array();
$elementCreated = null; $elementCreated = null;
$callback = function($element, $visa, $code) use (&$reasons, &$elementCreated) { $callback = function ($element, $visa, $code) use (&$reasons, &$elementCreated) {
foreach ($visa->getResponses() as $response) { foreach ($visa->getResponses() as $response) {
if (!$response->isOk()) { if (!$response->isOk()) {
$reasons[] = $response->getMessage(); $reasons[] = $response->getMessage();

View File

@@ -33,7 +33,7 @@ class UsrLists implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });

View File

@@ -32,7 +32,7 @@ class WorkZone implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });

View File

@@ -141,7 +141,7 @@ class RecordsRequest extends ArrayCollection
public function stories() public function stories()
{ {
return new ArrayCollection( return new ArrayCollection(
array_filter($this->toArray(), function(\record_adapter $record) { array_filter($this->toArray(), function (\record_adapter $record) {
return $record->is_grouping(); return $record->is_grouping();
}) })
); );

View File

@@ -23,7 +23,7 @@ class Activity implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) { $controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
$app['firewall']->requireAccessToModule('report'); $app['firewall']->requireAccessToModule('report');
}); });

View File

@@ -23,7 +23,7 @@ class Export implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) { $controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
$app['firewall']->requireAccessToModule('report'); $app['firewall']->requireAccessToModule('report');
}); });

View File

@@ -22,7 +22,7 @@ class Informations implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) { $controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
$app['firewall']->requireAccessToModule('report'); $app['firewall']->requireAccessToModule('report');
}); });

View File

@@ -23,12 +23,12 @@ class Root implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) { $controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
$app['firewall']->requireAccessToModule('report'); $app['firewall']->requireAccessToModule('report');
}); });
$controllers->get('/', function(Application $app) { $controllers->get('/', function (Application $app) {
return $app->redirectPath('report_dashboard'); return $app->redirectPath('report_dashboard');
})->bind('report'); })->bind('report');

View File

@@ -33,7 +33,7 @@ class Account implements ControllerProviderInterface
$app['account.controller'] = $this; $app['account.controller'] = $this;
$controllers->before(function() use ($app) { $controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });

View File

@@ -30,7 +30,7 @@ class Developers implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) { $controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });

View File

@@ -51,7 +51,7 @@ class Login implements ControllerProviderInterface
{ {
$items = array(); $items = array();
foreach(\Feed_Entry_Item::loadLatest($app, 20) as $item) { foreach (\Feed_Entry_Item::loadLatest($app, 20) as $item) {
$record = $item->get_record(); $record = $item->get_record();
$preview = $record->get_subdef('preview'); $preview = $record->get_subdef('preview');
$permalink = $preview->get_permalink(); $permalink = $preview->get_permalink();
@@ -92,7 +92,7 @@ class Login implements ControllerProviderInterface
$app['login.controller'] = $this; $app['login.controller'] = $this;
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
if ($request->getPathInfo() == $app->path('homepage')) { if ($request->getPathInfo() == $app->path('homepage')) {
return; return;
} }
@@ -100,7 +100,7 @@ class Login implements ControllerProviderInterface
// Displays the homepage // Displays the homepage
$controllers->get('/', 'login.controller:login') $controllers->get('/', 'login.controller:login')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
if (null !== $request->query->get('postlog')) { if (null !== $request->query->get('postlog')) {
@@ -125,14 +125,14 @@ class Login implements ControllerProviderInterface
// Authentication end point // Authentication end point
$controllers->post('/authenticate/', 'login.controller:authenticate') $controllers->post('/authenticate/', 'login.controller:authenticate')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
}) })
->bind('login_authenticate'); ->bind('login_authenticate');
// Guest access end point // Guest access end point
$controllers->match('/authenticate/guest/', 'login.controller:authenticateAsGuest') $controllers->match('/authenticate/guest/', 'login.controller:authenticateAsGuest')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
}) })
->bind('login_authenticate_as_guest') ->bind('login_authenticate_as_guest')
@@ -140,67 +140,67 @@ class Login implements ControllerProviderInterface
// Authenticate with an AuthProvider // Authenticate with an AuthProvider
$controllers->get('/provider/{providerId}/authenticate/', 'login.controller:authenticateWithProvider') $controllers->get('/provider/{providerId}/authenticate/', 'login.controller:authenticateWithProvider')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
}) })
->bind('login_authentication_provider_authenticate'); ->bind('login_authentication_provider_authenticate');
// AuthProviders callbacks // AuthProviders callbacks
$controllers->get('/provider/{providerId}/callback/', 'login.controller:authenticationCallback') $controllers->get('/provider/{providerId}/callback/', 'login.controller:authenticationCallback')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
})->bind('login_authentication_provider_callback'); })->bind('login_authentication_provider_callback');
// Logout end point // Logout end point
$controllers->get('/logout/', 'login.controller:logout') $controllers->get('/logout/', 'login.controller:logout')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
})->bind('logout'); })->bind('logout');
// Registration end point ; redirects to classic registration or AuthProvider registration // Registration end point ; redirects to classic registration or AuthProvider registration
$controllers->get('/register/', 'login.controller:displayRegisterForm') $controllers->get('/register/', 'login.controller:displayRegisterForm')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
})->bind('login_register'); })->bind('login_register');
// Classic registration end point // Classic registration end point
$controllers->match('/register-classic/', 'login.controller:doRegistration') $controllers->match('/register-classic/', 'login.controller:doRegistration')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
}) })
->bind('login_register_classic'); ->bind('login_register_classic');
// Provide a JSON serialization of registration fields configuration // Provide a JSON serialization of registration fields configuration
$controllers->get('/registration-fields/', function(PhraseaApplication $app, Request $request) { $controllers->get('/registration-fields/', function (PhraseaApplication $app, Request $request) {
return $app->json($app['registration.fields']); return $app->json($app['registration.fields']);
})->bind('login_registration_fields'); })->bind('login_registration_fields');
// Unlocks an email address that is currently locked // Unlocks an email address that is currently locked
$controllers->get('/register-confirm/', 'login.controller:registerConfirm') $controllers->get('/register-confirm/', 'login.controller:registerConfirm')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
})->bind('login_register_confirm'); })->bind('login_register_confirm');
// Displays a form to send an account unlock email again // Displays a form to send an account unlock email again
$controllers->get('/send-mail-confirm/', 'login.controller:sendConfirmMail') $controllers->get('/send-mail-confirm/', 'login.controller:sendConfirmMail')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
})->bind('login_send_mail'); })->bind('login_send_mail');
// Forgot password end point // Forgot password end point
$controllers->match('/forgot-password/', 'login.controller:forgotPassword') $controllers->match('/forgot-password/', 'login.controller:forgotPassword')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
})->bind('login_forgot_password'); })->bind('login_forgot_password');
// Renew password end point // Renew password end point
$controllers->match('/renew-password/', 'login.controller:renewPassword') $controllers->match('/renew-password/', 'login.controller:renewPassword')
->before(function(Request $request) use ($app) { ->before(function (Request $request) use ($app) {
$app['firewall']->requireNotAuthenticated(); $app['firewall']->requireNotAuthenticated();
})->bind('login_renew_password'); })->bind('login_renew_password');
// Displays Terms of use // Displays Terms of use
$controllers->get('/cgus', function(PhraseaApplication $app, Request $request) { $controllers->get('/cgus', function (PhraseaApplication $app, Request $request) {
return $app['twig']->render('login/cgus.html.twig', array_merge( return $app['twig']->render('login/cgus.html.twig', array_merge(
array('cgus' => \databox_cgu::getHome($app)), array('cgus' => \databox_cgu::getHome($app)),
self::getDefaultTemplateVariables($app) self::getDefaultTemplateVariables($app)

View File

@@ -27,7 +27,7 @@ class RSSFeeds implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$display_feed = function(Application $app, $feed, $format, $page, $user = null) { $display_feed = function (Application $app, $feed, $format, $page, $user = null) {
$total = $feed->get_count_total_entries(); $total = $feed->get_count_total_entries();
$perPage = 5; $perPage = 5;
$entries = $feed->get_entries((($page - 1) * $perPage), $perPage); $entries = $feed->get_entries((($page - 1) * $perPage), $perPage);
@@ -76,7 +76,7 @@ class RSSFeeds implements ControllerProviderInterface
return $response; return $response;
}; };
$controllers->get('/feed/{id}/{format}/', function(Application $app, $id, $format) use ($display_feed) { $controllers->get('/feed/{id}/{format}/', function (Application $app, $id, $format) use ($display_feed) {
$feed = new \Feed_Adapter($app, $id); $feed = new \Feed_Adapter($app, $id);
if (!$feed->is_public()) { if (!$feed->is_public()) {
@@ -94,7 +94,7 @@ class RSSFeeds implements ControllerProviderInterface
->assert('id', '\d+') ->assert('id', '\d+')
->assert('format', '(rss|atom)'); ->assert('format', '(rss|atom)');
$controllers->get('/userfeed/{token}/{id}/{format}/', function(Application $app, $token, $id, $format) use ($display_feed) { $controllers->get('/userfeed/{token}/{id}/{format}/', function (Application $app, $token, $id, $format) use ($display_feed) {
$token = new \Feed_Token($app, $token, $id); $token = new \Feed_Token($app, $token, $id);
$feed = $token->get_feed(); $feed = $token->get_feed();
@@ -109,7 +109,7 @@ class RSSFeeds implements ControllerProviderInterface
->assert('id', '\d+') ->assert('id', '\d+')
->assert('format', '(rss|atom)'); ->assert('format', '(rss|atom)');
$controllers->get('/userfeed/aggregated/{token}/{format}/', function(Application $app, $token, $format) use ($display_feed) { $controllers->get('/userfeed/aggregated/{token}/{format}/', function (Application $app, $token, $format) use ($display_feed) {
$token = new \Feed_TokenAggregate($app, $token); $token = new \Feed_TokenAggregate($app, $token);
$feed = $token->get_feed(); $feed = $token->get_feed();
@@ -123,7 +123,7 @@ class RSSFeeds implements ControllerProviderInterface
->bind('feed_user_aggregated') ->bind('feed_user_aggregated')
->assert('format', '(rss|atom)'); ->assert('format', '(rss|atom)');
$controllers->get('/aggregated/{format}/', function(Application $app, $format) use ($display_feed) { $controllers->get('/aggregated/{format}/', function (Application $app, $format) use ($display_feed) {
$feeds = \Feed_Collection::load_public_feeds($app); $feeds = \Feed_Collection::load_public_feeds($app);
$feed = $feeds->get_aggregate(); $feed = $feeds->get_aggregate();
@@ -136,7 +136,7 @@ class RSSFeeds implements ControllerProviderInterface
->bind('feed_public_aggregated') ->bind('feed_public_aggregated')
->assert('format', '(rss|atom)'); ->assert('format', '(rss|atom)');
$controllers->get('/cooliris/', function(Application $app) use ($display_feed) { $controllers->get('/cooliris/', function (Application $app) use ($display_feed) {
$feeds = \Feed_Collection::load_public_feeds($app); $feeds = \Feed_Collection::load_public_feeds($app);
$feed = $feeds->get_aggregate(); $feed = $feeds->get_aggregate();

View File

@@ -39,7 +39,7 @@ class Session implements ControllerProviderInterface
->bind('update_session'); ->bind('update_session');
$controllers->post('/delete/{id}', $this->call('deleteSession')) $controllers->post('/delete/{id}', $this->call('deleteSession'))
->before(function() use ($app) { ->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}) })
->bind('delete_session'); ->bind('delete_session');

View File

@@ -30,7 +30,7 @@ class Setup implements ControllerProviderInterface
$app['controller.setup'] = $this; $app['controller.setup'] = $this;
$controllers->get('/', function(Application $app) { $controllers->get('/', function (Application $app) {
return $app->redirectPath('install_root'); return $app->redirectPath('install_root');
})->bind('setup'); })->bind('setup');

View File

@@ -22,7 +22,7 @@ class Thesaurus implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) { $controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
$app['firewall']->requireAccessToModule('thesaurus'); $app['firewall']->requireAccessToModule('thesaurus');
}); });

View File

@@ -24,7 +24,7 @@ class Xmlhttp implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function() use ($app) { $controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
$app['firewall']->requireAccessToModule('thesaurus'); $app['firewall']->requireAccessToModule('thesaurus');
}); });

View File

@@ -26,7 +26,7 @@ class Notifications implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireNotGuest(); $app['firewall']->requireNotGuest();
}); });

View File

@@ -26,7 +26,7 @@ class Preferences implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) { $controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication(); $app['firewall']->requireAuthentication();
}); });

View File

@@ -29,7 +29,7 @@ class ConnectionTest implements ControllerProviderInterface
/** /**
* @todo : check this as it would lead to a security issue * @todo : check this as it would lead to a security issue
*/ */
$controllers->get('/mysql/', function(Application $app) { $controllers->get('/mysql/', function (Application $app) {
$request = $app['request']; $request = $app['request'];
$hostname = $request->query->get('hostname', '127.0.0.1'); $hostname = $request->query->get('hostname', '127.0.0.1');

View File

@@ -30,7 +30,7 @@ class PathFileTest implements ControllerProviderInterface
/** /**
* @todo : check this as it would lead to a security issue * @todo : check this as it would lead to a security issue
*/ */
$controllers->get('/path/', function(Application $app, Request $request) { $controllers->get('/path/', function (Application $app, Request $request) {
return $app->json(array( return $app->json(array(
'exists' => file_exists($request->query->get('path')) 'exists' => file_exists($request->query->get('path'))
, 'file' => is_file($request->query->get('path')) , 'file' => is_file($request->query->get('path'))
@@ -41,7 +41,7 @@ class PathFileTest implements ControllerProviderInterface
)); ));
}); });
$controllers->get('/url/', function(Application $app, Request $request) { $controllers->get('/url/', function (Application $app, Request $request) {
return $app->json(array('code' => \http_query::getHttpCodeFromUrl($request->query->get('url')))); return $app->json(array('code' => \http_query::getHttpCodeFromUrl($request->query->get('url'))));
}); });

View File

@@ -20,39 +20,39 @@ class LessBuilderServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(Application $app)
{ {
$app['phraseanet.less-assets'] = $app->share(function($app) { $app['phraseanet.less-assets'] = $app->share(function ($app) {
return array( return array(
$app['root.path'] . '/www/assets/bootstrap/img/glyphicons-halflings-white.png' => $app['root.path'] . '/www/skins/build/bootstrap/img/glyphicons-halflings-white.png', $app['root.path'] . '/www/assets/bootstrap/img/glyphicons-halflings-white.png' => $app['root.path'] . '/www/skins/build/bootstrap/img/glyphicons-halflings-white.png',
$app['root.path'] . '/www/assets/bootstrap/img/glyphicons-halflings.png' => $app['root.path'] . '/www/skins/build/bootstrap/img/glyphicons-halflings.png', $app['root.path'] . '/www/assets/bootstrap/img/glyphicons-halflings.png' => $app['root.path'] . '/www/skins/build/bootstrap/img/glyphicons-halflings.png',
); );
}); });
$app['phraseanet.less-mapping.base'] = $app->share(function($app) { $app['phraseanet.less-mapping.base'] = $app->share(function ($app) {
return array( return array(
$app['root.path'] . '/www/assets/bootstrap/less/bootstrap.less' => $app['root.path'] . '/www/skins/build/bootstrap/css/bootstrap.css', $app['root.path'] . '/www/assets/bootstrap/less/bootstrap.less' => $app['root.path'] . '/www/skins/build/bootstrap/css/bootstrap.css',
$app['root.path'] . '/www/assets/bootstrap/less/responsive.less' => $app['root.path'] . '/www/skins/build/bootstrap/css/bootstrap-responsive.css', $app['root.path'] . '/www/assets/bootstrap/less/responsive.less' => $app['root.path'] . '/www/skins/build/bootstrap/css/bootstrap-responsive.css',
); );
}); });
$app['phraseanet.less-mapping.customizable'] = $app->share(function($app) { $app['phraseanet.less-mapping.customizable'] = $app->share(function ($app) {
return array( return array(
$app['root.path'] . '/www/skins/login/less/login.less' => $app['root.path'] . '/www/skins/build/login.css', $app['root.path'] . '/www/skins/login/less/login.less' => $app['root.path'] . '/www/skins/build/login.css',
$app['root.path'] . '/www/skins/account/account.less' => $app['root.path'] . '/www/skins/build/account.css', $app['root.path'] . '/www/skins/account/account.less' => $app['root.path'] . '/www/skins/build/account.css',
); );
}); });
$app['phraseanet.less-mapping'] = $app->share(function($app) { $app['phraseanet.less-mapping'] = $app->share(function ($app) {
return array_merge( return array_merge(
$app['phraseanet.less-mapping.base'], $app['phraseanet.less-mapping.base'],
$app['phraseanet.less-mapping.customizable'] $app['phraseanet.less-mapping.customizable']
); );
}); });
$app['phraseanet.less-compiler'] = $app->share(function($app) { $app['phraseanet.less-compiler'] = $app->share(function ($app) {
return new LessCompiler($app['filesystem'], $app['driver.recess']); return new LessCompiler($app['filesystem'], $app['driver.recess']);
}); });
$app['phraseanet.less-builder'] = $app->share(function($app) { $app['phraseanet.less-builder'] = $app->share(function ($app) {
return new LessBuilder($app['phraseanet.less-compiler'], $app['filesystem']); return new LessBuilder($app['phraseanet.less-compiler'], $app['filesystem']);
}); });
} }

View File

@@ -71,7 +71,7 @@ class PhraseaLocaleSubscriber implements EventSubscriberInterface
) )
); );
$this->app['locale'] = $this->app->share(function(Application $app) use ($event) { $this->app['locale'] = $this->app->share(function (Application $app) use ($event) {
if (isset($app['phraseanet.registry'])) { if (isset($app['phraseanet.registry'])) {
$event->getRequest()->setDefaultLocale( $event->getRequest()->setDefaultLocale(
$app['phraseanet.registry']->get('GV_default_lng', 'en_GB') $app['phraseanet.registry']->get('GV_default_lng', 'en_GB')

View File

@@ -32,15 +32,15 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(Application $app)
{ {
$app['authentication'] = $app->share(function (Application $app){ $app['authentication'] = $app->share(function (Application $app) {
return new Authenticator($app, $app['browser'], $app['session'], $app['EM']); return new Authenticator($app, $app['browser'], $app['session'], $app['EM']);
}); });
$app['authentication.token-validator'] = $app->share(function (Application $app){ $app['authentication.token-validator'] = $app->share(function (Application $app) {
return new TokenValidator($app); return new TokenValidator($app);
}); });
$app['authentication.persistent-manager'] = $app->share(function (Application $app){ $app['authentication.persistent-manager'] = $app->share(function (Application $app) {
return new CookieManager($app['auth.password-encoder'], $app['EM'], $app['browser']); return new CookieManager($app['auth.password-encoder'], $app['EM'], $app['browser']);
}); });
@@ -128,7 +128,7 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
public function boot(Application $app) public function boot(Application $app)
{ {
$app['dispatcher'] = $app->share( $app['dispatcher'] = $app->share(
$app->extend('dispatcher', function($dispatcher, Application $app){ $app->extend('dispatcher', function ($dispatcher, Application $app) {
$dispatcher->addSubscriber(new PersistentCookieSubscriber($app)); $dispatcher->addSubscriber(new PersistentCookieSubscriber($app));
return $dispatcher; return $dispatcher;

View File

@@ -21,7 +21,7 @@ class BorderManagerServiceProvider implements ServiceProviderInterface
public function register(Application $app) public function register(Application $app)
{ {
$app['border-manager'] = $app->share(function(Application $app) { $app['border-manager'] = $app->share(function (Application $app) {
$borderManager = new Manager($app); $borderManager = new Manager($app);
try { try {

View File

@@ -19,7 +19,7 @@ class BrowserServiceProvider implements ServiceProviderInterface
public function register(Application $app) public function register(Application $app)
{ {
$app['browser'] = $app->share(function($app) { $app['browser'] = $app->share(function ($app) {
return new \Browser(); return new \Browser();
}); });
} }

View File

@@ -32,7 +32,7 @@ class CacheServiceProvider implements ServiceProviderInterface
return new Factory(); return new Factory();
}); });
$app['phraseanet.cache-service'] = $app->share(function(Application $app) { $app['phraseanet.cache-service'] = $app->share(function (Application $app) {
return new CacheManager( return new CacheManager(
$app['phraseanet.cache-compiler'], $app['phraseanet.cache-compiler'],
$app['phraseanet.cache-registry'], $app['phraseanet.cache-registry'],
@@ -41,13 +41,13 @@ class CacheServiceProvider implements ServiceProviderInterface
); );
}); });
$app['cache'] = $app->share(function(Application $app) { $app['cache'] = $app->share(function (Application $app) {
$conf = $app['phraseanet.configuration']['main']['cache']; $conf = $app['phraseanet.configuration']['main']['cache'];
return $app['phraseanet.cache-service']->factory('cache', $conf['type'], $conf['options']); return $app['phraseanet.cache-service']->factory('cache', $conf['type'], $conf['options']);
}); });
$app['opcode-cache'] = $app->share(function(Application $app) { $app['opcode-cache'] = $app->share(function (Application $app) {
$conf = $app['phraseanet.configuration']['main']['opcodecache']; $conf = $app['phraseanet.configuration']['main']['opcodecache'];
return $app['phraseanet.cache-service']->factory('cache', $conf['type'], $conf['options']); return $app['phraseanet.cache-service']->factory('cache', $conf['type'], $conf['options']);

View File

@@ -32,7 +32,7 @@ class ConfigurationServiceProvider implements ServiceProviderInterface
$app['phraseanet.configuration.config-path'] = $app['root.path'] . '/config/configuration.yml'; $app['phraseanet.configuration.config-path'] = $app['root.path'] . '/config/configuration.yml';
$app['phraseanet.configuration.config-compiled-path'] = $app['root.path'] . '/tmp/configuration-compiled.php'; $app['phraseanet.configuration.config-compiled-path'] = $app['root.path'] . '/tmp/configuration-compiled.php';
$app['phraseanet.configuration'] = $app->share(function(SilexApplication $app) { $app['phraseanet.configuration'] = $app->share(function (SilexApplication $app) {
return new Configuration( return new Configuration(
$app['phraseanet.configuration.yaml-parser'], $app['phraseanet.configuration.yaml-parser'],
$app['phraseanet.configuration.compiler'], $app['phraseanet.configuration.compiler'],
@@ -49,7 +49,7 @@ class ConfigurationServiceProvider implements ServiceProviderInterface
public function boot(SilexApplication $app) public function boot(SilexApplication $app)
{ {
$app['dispatcher'] = $app->share( $app['dispatcher'] = $app->share(
$app->extend('dispatcher', function($dispatcher, SilexApplication $app){ $app->extend('dispatcher', function ($dispatcher, SilexApplication $app) {
$dispatcher->addSubscriber(new TrustedProxySubscriber($app['phraseanet.configuration'])); $dispatcher->addSubscriber(new TrustedProxySubscriber($app['phraseanet.configuration']));
return $dispatcher; return $dispatcher;

View File

@@ -21,7 +21,7 @@ class ConfigurationTesterServiceProvider implements ServiceProviderInterface
public function register(SilexApplication $app) public function register(SilexApplication $app)
{ {
$app['phraseanet.configuration-tester'] = $app->share(function(Application $app) { $app['phraseanet.configuration-tester'] = $app->share(function (Application $app) {
return new ConfigurationTester($app); return new ConfigurationTester($app);
}); });
} }

View File

@@ -24,7 +24,7 @@ class FileServeServiceProvider implements ServiceProviderInterface
*/ */
public function register(Application $app) public function register(Application $app)
{ {
$app['phraseanet.xsendfile-factory'] = $app->share(function($app) { $app['phraseanet.xsendfile-factory'] = $app->share(function ($app) {
return XSendFileFactory::create($app); return XSendFileFactory::create($app);
}); });
@@ -39,7 +39,7 @@ class FileServeServiceProvider implements ServiceProviderInterface
public function boot(Application $app) public function boot(Application $app)
{ {
$app['dispatcher'] = $app->share( $app['dispatcher'] = $app->share(
$app->extend('dispatcher', function($dispatcher, Application $app){ $app->extend('dispatcher', function ($dispatcher, Application $app) {
$dispatcher->addSubscriber(new XSendFileSubscriber($app)); $dispatcher->addSubscriber(new XSendFileSubscriber($app));
return $dispatcher; return $dispatcher;

View File

@@ -19,17 +19,17 @@ class LocaleServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(Application $app)
{ {
$app['locale'] = $app->share(function(Application $app){ $app['locale'] = $app->share(function (Application $app) {
return $app['phraseanet.registry']->get('GV_default_lng', 'en_GB'); return $app['phraseanet.registry']->get('GV_default_lng', 'en_GB');
}); });
$app['locale.I18n'] = function(Application $app){ $app['locale.I18n'] = function (Application $app) {
$data = explode('_', $app['locale']); $data = explode('_', $app['locale']);
return $data[0]; return $data[0];
}; };
$app['locale.l10n'] = function(Application $app){ $app['locale.l10n'] = function (Application $app) {
$data = explode('_', $app['locale']); $data = explode('_', $app['locale']);
return $data[1]; return $data[1];

View File

@@ -22,7 +22,7 @@ class NotificationDelivererServiceProvider implements ServiceProviderInterface
return $app['phraseanet.registry']->get('GV_email_prefix'); return $app['phraseanet.registry']->get('GV_email_prefix');
}); });
$app['notification.deliverer'] = $app->share(function($app) { $app['notification.deliverer'] = $app->share(function ($app) {
return new Deliverer( return new Deliverer(
$app['mailer'], $app['mailer'],
$app['dispatcher'], $app['dispatcher'],

View File

@@ -40,7 +40,7 @@ class ORMServiceProvider implements ServiceProviderInterface
return new MonologSQLLogger($logger, 'yaml'); return new MonologSQLLogger($logger, 'yaml');
}); });
$app['EM'] = $app->share(function(Application $app) { $app['EM'] = $app->share(function (Application $app) {
$config = new ORMConfiguration(); $config = new ORMConfiguration();

View File

@@ -19,7 +19,7 @@ class PhraseaVersionServiceProvider implements ServiceProviderInterface
{ {
public function register(SilexApplication $app) public function register(SilexApplication $app)
{ {
$app['phraseanet.version'] = $app->share(function(SilexApplication $app) { $app['phraseanet.version'] = $app->share(function (SilexApplication $app) {
return new Version(); return new Version();
}); });
} }

View File

@@ -19,19 +19,19 @@ class PhraseanetServiceProvider implements ServiceProviderInterface
{ {
public function register(SilexApplication $app) public function register(SilexApplication $app)
{ {
$app['phraseanet.appbox'] = $app->share(function(SilexApplication $app) { $app['phraseanet.appbox'] = $app->share(function (SilexApplication $app) {
return new \appbox($app); return new \appbox($app);
}); });
$app['phraseanet.registry'] = $app->share(function(SilexApplication $app) { $app['phraseanet.registry'] = $app->share(function (SilexApplication $app) {
return new \registry($app); return new \registry($app);
}); });
$app['firewall'] = $app->share(function(SilexApplication $app) { $app['firewall'] = $app->share(function (SilexApplication $app) {
return new Firewall($app); return new Firewall($app);
}); });
$app['events-manager'] = $app->share(function(SilexApplication $app) { $app['events-manager'] = $app->share(function (SilexApplication $app) {
$events = new \eventsmanager_broker($app); $events = new \eventsmanager_broker($app);
$events->start(); $events->start();

View File

@@ -23,7 +23,7 @@ class PluginServiceProvider implements ServiceProviderInterface
public function boot(Application $app) public function boot(Application $app)
{ {
$app['twig'] = $app->share( $app['twig'] = $app->share(
$app->extend('twig', function($twig, Application $app){ $app->extend('twig', function ($twig, Application $app) {
$function = new \Twig_SimpleFunction('plugin_asset', array('Alchemy\Phrasea\Plugin\Management\AssetsManager', 'twigPluginAsset')); $function = new \Twig_SimpleFunction('plugin_asset', array('Alchemy\Phrasea\Plugin\Management\AssetsManager', 'twigPluginAsset'));
$twig->addFunction($function); $twig->addFunction($function);

View File

@@ -20,11 +20,11 @@ class RegistrationServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(Application $app)
{ {
$app['registration.fields'] = $app->share(function (Application $app){ $app['registration.fields'] = $app->share(function (Application $app) {
return isset($app['phraseanet.configuration']['registration-fields']) ? $app['phraseanet.configuration']['registration-fields'] : array(); return isset($app['phraseanet.configuration']['registration-fields']) ? $app['phraseanet.configuration']['registration-fields'] : array();
}); });
$app['registration.enabled'] = $app->share(function (Application $app){ $app['registration.enabled'] = $app->share(function (Application $app) {
require_once __DIR__ . '/../../../../classes/deprecated/inscript.api.php'; require_once __DIR__ . '/../../../../classes/deprecated/inscript.api.php';
$bases = giveMeBases($app); $bases = giveMeBases($app);

View File

@@ -22,7 +22,7 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
public function register(Application $app) public function register(Application $app)
{ {
$app['phraseanet.SE'] = $app->share(function($app) { $app['phraseanet.SE'] = $app->share(function ($app) {
$engineClass = $app['phraseanet.configuration']['main']['search-engine']['type']; $engineClass = $app['phraseanet.configuration']['main']['search-engine']['type'];
$engineOptions = $app['phraseanet.configuration']['main']['search-engine']['options']; $engineOptions = $app['phraseanet.configuration']['main']['search-engine']['options'];
@@ -34,7 +34,7 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
return $engineClass::create($app, $engineOptions); return $engineClass::create($app, $engineOptions);
}); });
$app['phraseanet.SE.logger'] = $app->share(function(Application $app) { $app['phraseanet.SE.logger'] = $app->share(function (Application $app) {
return new SearchEngineLogger($app); return new SearchEngineLogger($app);
}); });
} }

View File

@@ -20,14 +20,14 @@ class TaskManagerServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(Application $app)
{ {
$app['task-manager.logger'] = $app->share(function(Application $app) { $app['task-manager.logger'] = $app->share(function (Application $app) {
$logger = new Logger('task-manager logger'); $logger = new Logger('task-manager logger');
$logger->pushHandler(new NullHandler()); $logger->pushHandler(new NullHandler());
return $logger; return $logger;
}); });
$app['task-manager'] = $app->share(function(Application $app) { $app['task-manager'] = $app->share(function (Application $app) {
return new \task_manager($app, $app['task-manager.logger']); return new \task_manager($app, $app['task-manager.logger']);
}); });
} }

View File

@@ -18,7 +18,7 @@ class TokensServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(Application $app)
{ {
$app['tokens'] = $app->share(function($app) { $app['tokens'] = $app->share(function ($app) {
return new \random($app); return new \random($app);
}); });
} }

View File

@@ -18,7 +18,7 @@ class UnicodeServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(Application $app)
{ {
$app['unicode'] = $app->share(function($app) { $app['unicode'] = $app->share(function ($app) {
return new \unicode(); return new \unicode();
}); });
} }

View File

@@ -39,7 +39,7 @@ class Printer extends RecordHelper
{ {
parent::__construct($app, $Request); parent::__construct($app, $Request);
$grep = function(\record_adapter $record) { $grep = function (\record_adapter $record) {
try { try {
return $record->get_thumbnail()->get_type() == \media_subdef::TYPE_IMAGE || return $record->get_thumbnail()->get_type() == \media_subdef::TYPE_IMAGE ||

View File

@@ -19,7 +19,7 @@ class TagProvider extends ExiftoolTagProvider
{ {
parent::__construct(); parent::__construct();
$this['Phraseanet'] = $this->share(function(){ $this['Phraseanet'] = $this->share(function () {
return array( return array(
'PdfText' => new \Alchemy\Phrasea\Metadata\Tag\PdfText(), 'PdfText' => new \Alchemy\Phrasea\Metadata\Tag\PdfText(),
'TfArchivedate' => new \Alchemy\Phrasea\Metadata\Tag\TfArchivedate(), 'TfArchivedate' => new \Alchemy\Phrasea\Metadata\Tag\TfArchivedate(),

View File

@@ -697,16 +697,16 @@ class PhraseaEngine implements SearchEngineInterface
} }
} }
if ($this->options->getFields()) { if ($this->options->getFields()) {
$this->queries[$sbas] .= ' IN (' . implode(' OR ', array_map(function(\databox_field $field) { $this->queries[$sbas] .= ' IN (' . implode(' OR ', array_map(function (\databox_field $field) {
return $field->get_name(); return $field->get_name();
}, $this->options->getFields())) . ')'; }, $this->options->getFields())) . ')';
} }
if (($this->options->getMinDate() || $this->options->getMaxDate()) && $this->options->getDateFields()) { if (($this->options->getMinDate() || $this->options->getMaxDate()) && $this->options->getDateFields()) {
if ($this->options->getMinDate()) { if ($this->options->getMinDate()) {
$this->queries[$sbas] .= ' AND ( ' . implode(' >= ' . $this->options->getMinDate()->format('Y-m-d') . ' OR ', array_map(function(\databox_field $field){ return $field->get_name(); }, $this->options->getDateFields())) . ' >= ' . $this->options->getMinDate()->format('Y-m-d') . ' ) '; $this->queries[$sbas] .= ' AND ( ' . implode(' >= ' . $this->options->getMinDate()->format('Y-m-d') . ' OR ', array_map(function (\databox_field $field) { return $field->get_name(); }, $this->options->getDateFields())) . ' >= ' . $this->options->getMinDate()->format('Y-m-d') . ' ) ';
} }
if ($this->options->getMaxDate()) { if ($this->options->getMaxDate()) {
$this->queries[$sbas] .= ' AND ( ' . implode(' <= ' . $this->options->getMaxDate()->format('Y-m-d') . ' OR ', array_map(function(\databox_field $field){ return $field->get_name(); }, $this->options->getDateFields())) . ' <= ' . $this->options->getMaxDate()->format('Y-m-d') . ' ) '; $this->queries[$sbas] .= ' AND ( ' . implode(' <= ' . $this->options->getMaxDate()->format('Y-m-d') . ' OR ', array_map(function (\databox_field $field) { return $field->get_name(); }, $this->options->getDateFields())) . ' <= ' . $this->options->getMaxDate()->format('Y-m-d') . ' ) ';
} }
} }
} }
@@ -717,7 +717,7 @@ class PhraseaEngine implements SearchEngineInterface
$this->singleParse($sbas, $this->queries[$sbas]); $this->singleParse($sbas, $this->queries[$sbas]);
} }
$base_ids = array_map(function(\collection $collection) { $base_ids = array_map(function (\collection $collection) {
return $collection->get_base_id(); return $collection->get_base_id();
}, $this->options->getCollections()); }, $this->options->getCollections());

View File

@@ -38,7 +38,7 @@ class SearchEngineLogger
':date' => date("Y-m-d H:i:s"), ':date' => date("Y-m-d H:i:s"),
':query' => $query, ':query' => $query,
':nbresults' => $answers, ':nbresults' => $answers,
':colls' => implode(',', array_map(function($coll_id) { ':colls' => implode(',', array_map(function ($coll_id) {
return (int) $coll_id; return (int) $coll_id;
}, $coll_ids)), }, $coll_ids)),
)); ));

View File

@@ -473,12 +473,12 @@ class SearchEngineOptions
$value = $value->format(DATE_ATOM); $value = $value->format(DATE_ATOM);
} }
if (in_array($key, array('date_fields', 'fields'))) { if (in_array($key, array('date_fields', 'fields'))) {
$value = array_map(function(\databox_field $field) { $value = array_map(function (\databox_field $field) {
return $field->get_databox()->get_sbas_id() . '_' . $field->get_id(); return $field->get_databox()->get_sbas_id() . '_' . $field->get_id();
}, $value); }, $value);
} }
if (in_array($key, array('collections', 'business_fields'))) { if (in_array($key, array('collections', 'business_fields'))) {
$value = array_map(function($collection) { $value = array_map(function ($collection) {
return $collection->get_base_id(); return $collection->get_base_id();
}, $value); }, $value);
} }
@@ -529,7 +529,7 @@ class SearchEngineOptions
} }
break; break;
case in_array($key, array('date_fields', 'fields')): case in_array($key, array('date_fields', 'fields')):
$value = array_map(function($serialized) use ($app) { $value = array_map(function ($serialized) use ($app) {
$data = explode('_', $serialized); $data = explode('_', $serialized);
return \databox_field::get_instance($app, $app['phraseanet.appbox']->get_databox($data[0]), $data[1]); return \databox_field::get_instance($app, $app['phraseanet.appbox']->get_databox($data[0]), $data[1]);
@@ -537,7 +537,7 @@ class SearchEngineOptions
}, $value); }, $value);
break; break;
case in_array($key, array('collections', 'business_fields')): case in_array($key, array('collections', 'business_fields')):
$value = array_map(function($base_id) use ($app) { $value = array_map(function ($base_id) use ($app) {
return \collection::get_from_base_id($app, $base_id); return \collection::get_from_base_id($app, $base_id);
}, $value); }, $value);
break; break;
@@ -620,7 +620,7 @@ class SearchEngineOptions
$options->setLocale($app['locale.I18n']); $options->setLocale($app['locale.I18n']);
if (is_array($request->get('bases'))) { if (is_array($request->get('bases'))) {
$bas = array_map(function($base_id) use ($app) { $bas = array_map(function ($base_id) use ($app) {
return \collection::get_from_base_id($app, $base_id); return \collection::get_from_base_id($app, $base_id);
}, $request->get('bases')); }, $request->get('bases'));
} elseif (!$app['authentication']->isAuthenticated()) { } elseif (!$app['authentication']->isAuthenticated()) {
@@ -629,7 +629,7 @@ class SearchEngineOptions
$bas = $app['authentication']->getUser()->ACL()->get_granted_base(); $bas = $app['authentication']->getUser()->ACL()->get_granted_base();
} }
$bas = array_filter($bas, function($collection) use ($app) { $bas = array_filter($bas, function ($collection) use ($app) {
if ($app['authentication']->isAuthenticated()) { if ($app['authentication']->isAuthenticated()) {
return $app['authentication']->getUser()->ACL()->has_access_to_base($collection->get_base_id()); return $app['authentication']->getUser()->ACL()->has_access_to_base($collection->get_base_id());
} else { } else {
@@ -646,7 +646,7 @@ class SearchEngineOptions
} }
if ($app['authentication']->isAuthenticated() && $app['authentication']->getUser()->ACL()->has_right('modifyrecord')) { if ($app['authentication']->isAuthenticated() && $app['authentication']->getUser()->ACL()->has_right('modifyrecord')) {
$BF = array_filter($bas, function($collection) use ($app) { $BF = array_filter($bas, function ($collection) use ($app) {
return $app['authentication']->getUser()->ACL()->has_right_on_base($collection->get_base_id(), 'canmodifrecord'); return $app['authentication']->getUser()->ACL()->has_right_on_base($collection->get_base_id(), 'canmodifrecord');
}); });

View File

@@ -625,7 +625,7 @@ class SphinxSearchEngine implements SearchEngineInterface
$this->sphinx->SetFilter('parent_record_id', array($options->getSearchType())); $this->sphinx->SetFilter('parent_record_id', array($options->getSearchType()));
if ($options->getDateFields() && ($options->getMaxDate() || $options->getMinDate())) { if ($options->getDateFields() && ($options->getMaxDate() || $options->getMinDate())) {
foreach (array_unique(array_map(function(\databox_field $field) { foreach (array_unique(array_map(function (\databox_field $field) {
return $field->get_name(); return $field->get_name();
}, $options->getDateFields())) as $field) { }, $options->getDateFields())) as $field) {

View File

@@ -35,7 +35,7 @@ class Migration31 implements MigrationInterface
require __DIR__ . '/../../../../../../config/_GV.php'; require __DIR__ . '/../../../../../../config/_GV.php';
$GV = require __DIR__ . '/../../../../../../lib/conf.d/_GV_template.inc'; $GV = require __DIR__ . '/../../../../../../lib/conf.d/_GV_template.inc';
$retrieve_old_credentials = function() { $retrieve_old_credentials = function () {
require __DIR__ . '/../../../../../../config/connexion.inc'; require __DIR__ . '/../../../../../../config/connexion.inc';
return array( return array(

View File

@@ -35,7 +35,7 @@ class Migration35 implements MigrationInterface
$config['registration-fields'][$key]['required'] = (boolean) $field['required']; $config['registration-fields'][$key]['required'] = (boolean) $field['required'];
} }
$retrieve_old_credentials = function() { $retrieve_old_credentials = function () {
require __DIR__ . '/../../../../../../config/connexion.inc'; require __DIR__ . '/../../../../../../config/connexion.inc';
return array( return array(
@@ -52,7 +52,7 @@ class Migration35 implements MigrationInterface
$config['main']['database'][$key] = (string) $value; $config['main']['database'][$key] = (string) $value;
} }
$retrieve_old_parameters = function() { $retrieve_old_parameters = function () {
require __DIR__ . '/../../../../../../config/config.inc'; require __DIR__ . '/../../../../../../config/config.inc';
return array( return array(

View File

@@ -20,7 +20,7 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com * @link www.phraseanet.com
*/ */
class API_OAuth2_Exception_Redirect_Unauthorized extends API_OAuth2_Exception_Redirect class API_OAuth2_Exception_Redirect_TemporaryUnavailable extends API_OAuth2_Exception_Redirect
{ {
/** /**
* *
@@ -39,7 +39,7 @@ class API_OAuth2_Exception_Redirect_Unauthorized extends API_OAuth2_Exception_Re
* @param string $redirect_uri * @param string $redirect_uri
* @param string $state * @param string $state
* @param string $error_uri * @param string $error_uri
* @return API_OAuth2_Exception_Redirect_Unauthorized * @return API_OAuth2_Exception_Redirect_TemporaryUnavailable
*/ */
public function __construct($redirect_uri, $state = null, $error_uri = null) public function __construct($redirect_uri, $state = null, $error_uri = null)
{ {

View File

@@ -686,7 +686,7 @@ class API_V1_adapter extends API_V1_Abstract
$reasons = $output = null; $reasons = $output = null;
$callback = function($element, $visa, $code) use (&$reasons, &$output) { $callback = function ($element, $visa, $code) use (&$reasons, &$output) {
if (!$visa->isValid()) { if (!$visa->isValid()) {
$reasons = array(); $reasons = array();
@@ -899,9 +899,9 @@ class API_V1_adapter extends API_V1_Abstract
$search_result = $this->app['phraseanet.SE']->query($query, $offsetStart, $perPage); $search_result = $this->app['phraseanet.SE']->query($query, $offsetStart, $perPage);
foreach ($options->getDataboxes() as $databox) { foreach ($options->getDataboxes() as $databox) {
$colls = array_map(function(\collection $collection) { $colls = array_map(function (\collection $collection) {
return $collection->get_coll_id(); return $collection->get_coll_id();
}, array_filter($options->getCollections(), function(\collection $collection) use ($databox) { }, array_filter($options->getCollections(), function (\collection $collection) use ($databox) {
return $collection->get_databox()->get_sbas_id() == $databox->get_sbas_id(); return $collection->get_databox()->get_sbas_id() == $databox->get_sbas_id();
})); }));
@@ -1905,7 +1905,7 @@ class API_V1_adapter extends API_V1_Abstract
$caption = $story->get_caption(); $caption = $story->get_caption();
$format = function(caption_record $caption, $dcField) { $format = function (caption_record $caption, $dcField) {
$field = $caption->get_dc_field($dcField); $field = $caption->get_dc_field($dcField);

View File

@@ -173,7 +173,7 @@ class Bridge_Api
*/ */
public function list_elements($type, $offset_start = 0, $quantity = 10) public function list_elements($type, $offset_start = 0, $quantity = 10)
{ {
$action = function(Bridge_Api $obj) use ($type, $offset_start, $quantity ) { $action = function (Bridge_Api $obj) use ($type, $offset_start, $quantity) {
return $obj->get_connector()->list_elements($type, $offset_start, $quantity); return $obj->get_connector()->list_elements($type, $offset_start, $quantity);
}; };
@@ -189,7 +189,7 @@ class Bridge_Api
*/ */
public function list_containers($type, $offset_start = 0, $quantity = 10) public function list_containers($type, $offset_start = 0, $quantity = 10)
{ {
$action = function(Bridge_Api $obj) use ($type, $offset_start, $quantity ) { $action = function (Bridge_Api $obj) use ($type, $offset_start, $quantity) {
return $obj->get_connector()->list_containers($type, $offset_start, $quantity); return $obj->get_connector()->list_containers($type, $offset_start, $quantity);
}; };
@@ -205,7 +205,7 @@ class Bridge_Api
*/ */
public function update_element($object, $object_id, Array $datas) public function update_element($object, $object_id, Array $datas)
{ {
$action = function(Bridge_Api $obj) use ($object, $object_id, $datas) { $action = function (Bridge_Api $obj) use ($object, $object_id, $datas) {
return $obj->get_connector()->update_element($object, $object_id, $datas); return $obj->get_connector()->update_element($object, $object_id, $datas);
}; };
@@ -220,7 +220,7 @@ class Bridge_Api
*/ */
public function create_container($container_type, Request $request) public function create_container($container_type, Request $request)
{ {
$action = function(Bridge_Api $obj) use ($container_type, $request) { $action = function (Bridge_Api $obj) use ($container_type, $request) {
return $obj->get_connector()->create_container($container_type, $request); return $obj->get_connector()->create_container($container_type, $request);
}; };
@@ -237,7 +237,7 @@ class Bridge_Api
*/ */
public function add_element_to_container($element_type, $element_id, $destination, $container_id) public function add_element_to_container($element_type, $element_id, $destination, $container_id)
{ {
$action = function(Bridge_Api $obj) use ($element_type, $element_id, $destination, $container_id) { $action = function (Bridge_Api $obj) use ($element_type, $element_id, $destination, $container_id) {
return $obj->get_connector()->add_element_to_container($element_type, $element_id, $destination, $container_id); return $obj->get_connector()->add_element_to_container($element_type, $element_id, $destination, $container_id);
}; };
@@ -252,7 +252,7 @@ class Bridge_Api
*/ */
public function delete_object($object, $object_id) public function delete_object($object, $object_id)
{ {
$action = function(Bridge_Api $obj) use ($object, $object_id) { $action = function (Bridge_Api $obj) use ($object, $object_id) {
return $obj->get_connector()->delete_object($object, $object_id); return $obj->get_connector()->delete_object($object, $object_id);
}; };
@@ -265,7 +265,7 @@ class Bridge_Api
*/ */
public function acceptable_records() public function acceptable_records()
{ {
$action = function(Bridge_Api $obj) { $action = function (Bridge_Api $obj) {
return $obj->get_connector()->acceptable_records(); return $obj->get_connector()->acceptable_records();
}; };
@@ -280,7 +280,7 @@ class Bridge_Api
*/ */
public function get_element_from_id($element_id, $type) public function get_element_from_id($element_id, $type)
{ {
$action = function(Bridge_Api $obj) use ($element_id, $type) { $action = function (Bridge_Api $obj) use ($element_id, $type) {
return $obj->get_connector()->get_element_from_id($element_id, $type); return $obj->get_connector()->get_element_from_id($element_id, $type);
}; };
@@ -295,7 +295,7 @@ class Bridge_Api
*/ */
public function get_container_from_id($element_id, $type) public function get_container_from_id($element_id, $type)
{ {
$action = function(Bridge_Api $obj) use ($element_id, $type) { $action = function (Bridge_Api $obj) use ($element_id, $type) {
return $obj->get_connector()->get_container_from_id($element_id, $type); return $obj->get_connector()->get_container_from_id($element_id, $type);
}; };
@@ -308,7 +308,7 @@ class Bridge_Api
*/ */
public function get_category_list() public function get_category_list()
{ {
$action = function(Bridge_Api $obj) { $action = function (Bridge_Api $obj) {
return $obj->get_connector()->get_category_list(); return $obj->get_connector()->get_category_list();
}; };
@@ -323,7 +323,7 @@ class Bridge_Api
*/ */
public function get_element_status(Bridge_Element $element) public function get_element_status(Bridge_Element $element)
{ {
$action = function(Bridge_Api $obj) use ($element) { $action = function (Bridge_Api $obj) use ($element) {
return $obj->get_connector()->get_element_status($element); return $obj->get_connector()->get_element_status($element);
}; };
@@ -337,7 +337,7 @@ class Bridge_Api
*/ */
public function map_connector_to_element_status($status) public function map_connector_to_element_status($status)
{ {
$action = function(Bridge_Api $obj) use ($status) { $action = function (Bridge_Api $obj) use ($status) {
return $obj->get_connector()->map_connector_to_element_status($status); return $obj->get_connector()->map_connector_to_element_status($status);
}; };
@@ -351,7 +351,7 @@ class Bridge_Api
*/ */
public function get_error_message_from_status($connector_status) public function get_error_message_from_status($connector_status)
{ {
$action = function(Bridge_Api $obj) use ($connector_status) { $action = function (Bridge_Api $obj) use ($connector_status) {
return $obj->get_connector()->get_error_message_from_status($connector_status); return $obj->get_connector()->get_error_message_from_status($connector_status);
}; };
@@ -366,7 +366,7 @@ class Bridge_Api
*/ */
public function upload(record_adapter $record, array $options = array()) public function upload(record_adapter $record, array $options = array())
{ {
$action = function(Bridge_Api $obj) use ($record, $options) { $action = function (Bridge_Api $obj) use ($record, $options) {
return $obj->get_connector()->upload($record, $options); return $obj->get_connector()->upload($record, $options);
}; };

View File

@@ -370,7 +370,7 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
); );
if ( ! $this->is_valid_object_id($object_id)) if ( ! $this->is_valid_object_id($object_id))
throw new Bridge_Exception_InvalidObjectId($object_id); throw new Bridge_Exception_ActionInvalidObjectId($object_id);
switch ($object) { switch ($object) {
case self::ELEMENT_TYPE_VIDEO : case self::ELEMENT_TYPE_VIDEO :
@@ -804,7 +804,7 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
public function check_upload_constraints(Array $datas, record_adapter $record) public function check_upload_constraints(Array $datas, record_adapter $record)
{ {
$errors = $this->check_record_constraints($record); $errors = $this->check_record_constraints($record);
$check = function($field) use (&$errors, $datas, $record) { $check = function ($field) use (&$errors, $datas, $record) {
$key = $record->get_serialize_key(); $key = $record->get_serialize_key();
$required = ! ! $field["required"]; $required = ! ! $field["required"];
$name = $field["name"]; $name = $field["name"];
@@ -830,7 +830,7 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
public function check_update_constraints(Array $datas) public function check_update_constraints(Array $datas)
{ {
$errors = array(); $errors = array();
$check = function($field) use (&$errors, $datas) { $check = function ($field) use (&$errors, $datas) {
$required = ! ! $field["required"]; $required = ! ! $field["required"];
$name = $field["name"]; $name = $field["name"];
$length = (int) $field["length"]; $length = (int) $field["length"];

View File

@@ -697,7 +697,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
public function check_upload_constraints(array $datas, record_adapter $record) public function check_upload_constraints(array $datas, record_adapter $record)
{ {
$errors = $this->check_record_constraints($record); $errors = $this->check_record_constraints($record);
$check = function($field) use (&$errors, $datas, $record) { $check = function ($field) use (&$errors, $datas, $record) {
$key = $record->get_serialize_key(); $key = $record->get_serialize_key();
$name = $field['name']; $name = $field['name'];
$length = (int) $field['length']; $length = (int) $field['length'];
@@ -720,7 +720,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
public function check_update_constraints(Array $datas) public function check_update_constraints(Array $datas)
{ {
$errors = array(); $errors = array();
$check = function($field) use (&$errors, $datas) { $check = function ($field) use (&$errors, $datas) {
$name = $field['name']; $name = $field['name'];
$length = (int) $field['length']; $length = (int) $field['length'];
$required = ! ! $field['required']; $required = ! ! $field['required'];

View File

@@ -304,7 +304,7 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter
} }
if ( ! $this->is_valid_object_id($object_id)) if ( ! $this->is_valid_object_id($object_id))
throw new Bridge_Exception_InvalidObjectId($object_id); throw new Bridge_Exception_ActionInvalidObjectId($object_id);
switch ($object) { switch ($object) {
case "video" : case "video" :
@@ -912,7 +912,7 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter
{ {
$errors = $this->check_record_constraints($record); $errors = $this->check_record_constraints($record);
$check = function($field) use (&$errors, $datas, $record) { $check = function ($field) use (&$errors, $datas, $record) {
$key = $record->get_serialize_key(); $key = $record->get_serialize_key();
$name = $field['name']; $name = $field['name'];
$length = (int) $field['length']; $length = (int) $field['length'];
@@ -939,7 +939,7 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter
public function check_update_constraints(Array $datas) public function check_update_constraints(Array $datas)
{ {
$errors = array(); $errors = array();
$check = function($field) use (&$errors, $datas) { $check = function ($field) use (&$errors, $datas) {
$name = $field['name']; $name = $field['name'];
$length = (int) $field['length']; $length = (int) $field['length'];
$required = ! ! $field['required']; $required = ! ! $field['required'];

View File

@@ -15,7 +15,7 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com * @link www.phraseanet.com
*/ */
class Bridge_Exception_InvalidObjectId extends Bridge_Exception class Bridge_Exception_ActionInvalidObjectId extends Bridge_Exception
{ {
} }

Some files were not shown because too many files have changed in this diff Show More