mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
Merge branch '3.8'
Conflicts: lib/Alchemy/Phrasea/Controller/Admin/Publications.php lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php lib/Alchemy/Phrasea/Controller/Api/V1.php lib/Alchemy/Phrasea/Controller/Lightbox.php lib/Alchemy/Phrasea/Controller/Permalink.php lib/Alchemy/Phrasea/Controller/Prod/Feed.php lib/Alchemy/Phrasea/Controller/Prod/Order.php lib/Alchemy/Phrasea/Controller/Prod/Push.php lib/Alchemy/Phrasea/Controller/Prod/Share.php lib/Alchemy/Phrasea/Controller/Root/Login.php lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php lib/Alchemy/Phrasea/Controller/Root/Session.php lib/Alchemy/Phrasea/Controller/Setup.php lib/Alchemy/Phrasea/Core/CLIProvider/LessBuilderServiceProvider.php lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php lib/Alchemy/Phrasea/Core/Provider/TaskManagerServiceProvider.php lib/classes/Feed/Entry/Item.php lib/classes/record/adapter.php lib/classes/task/Scheduler.php lib/classes/task/manager.php lib/classes/task/period/RecordMover.php lib/classes/task/period/archive.php lib/classes/task/period/cindexer.php lib/classes/task/period/ftp.php lib/classes/task/period/ftpPull.php lib/classes/task/period/subdef.php lib/classes/task/period/writemeta.php tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php tests/classes/Feed/Entry/Feed_Entry_ItemTest.php tests/classes/PhraseanetPHPUnitAbstract.php
This commit is contained in:
@@ -185,7 +185,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -214,7 +214,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(
|
||||||
@@ -245,7 +245,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'];
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -351,7 +351,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');
|
||||||
}
|
}
|
||||||
@@ -369,7 +369,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) {
|
||||||
@@ -377,12 +377,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'));
|
||||||
}
|
}
|
||||||
@@ -392,7 +392,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());
|
||||||
@@ -542,7 +542,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']);
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
|
@@ -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());
|
||||||
|
@@ -48,7 +48,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']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -55,14 +55,14 @@ abstract class Command extends SymfoCommand implements CommandInterface
|
|||||||
$handler = new StreamHandler('php://stdout', $level);
|
$handler = new StreamHandler('php://stdout', $level);
|
||||||
|
|
||||||
$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;
|
||||||
|
@@ -26,7 +26,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');
|
||||||
});
|
});
|
||||||
|
@@ -24,7 +24,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');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -32,7 +32,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -29,7 +29,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'));
|
||||||
});
|
});
|
||||||
@@ -40,117 +40,117 @@ class Databox implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/{databox_id}/delete/', 'controller.admin.databox:deleteBase')
|
$controllers->post('/{databox_id}/delete/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/unmount/', 'controller.admin.databox:unmountDatabase')
|
$controllers->post('/{databox_id}/unmount/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/empty/', 'controller.admin.databox:emptyDatabase')
|
$controllers->post('/{databox_id}/empty/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->get('/{databox_id}/collections/order/', 'controller.admin.databox:getReorder')
|
$controllers->get('/{databox_id}/collections/order/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/collections/order/', 'controller.admin.databox:setReorder')
|
$controllers->post('/{databox_id}/collections/order/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/collection/', 'controller.admin.databox:createCollection')
|
$controllers->post('/{databox_id}/collection/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->get('/{databox_id}/cgus/', 'controller.admin.databox:getDatabaseCGU')
|
$controllers->get('/{databox_id}/cgus/', 'controller.admin.databox: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/', 'controller.admin.databox:setLabels')
|
$controllers->post('/{databox_id}/labels/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/cgus/', 'controller.admin.databox:updateDatabaseCGU')
|
$controllers->post('/{databox_id}/cgus/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->get('/{databox_id}/informations/documents/', 'controller.admin.databox:progressBarInfos')
|
$controllers->get('/{databox_id}/informations/documents/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->get('/{databox_id}/informations/details/', 'controller.admin.databox:getDetails')
|
$controllers->get('/{databox_id}/informations/details/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/collection/{collection_id}/mount/', 'controller.admin.databox:mountCollection')
|
$controllers->post('/{databox_id}/collection/{collection_id}/mount/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->get('/{databox_id}/collection/', 'controller.admin.databox:getNewCollection')
|
$controllers->get('/{databox_id}/collection/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/logo/', 'controller.admin.databox:sendLogoPdf')
|
$controllers->post('/{databox_id}/logo/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/logo/delete/', 'controller.admin.databox:deleteLogoPdf')
|
$controllers->post('/{databox_id}/logo/delete/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/clear-logs/', 'controller.admin.databox:clearLogs')
|
$controllers->post('/{databox_id}/clear-logs/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/reindex/', 'controller.admin.databox:reindex')
|
$controllers->post('/{databox_id}/reindex/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/indexable/', 'controller.admin.databox:setIndexable')
|
$controllers->post('/{databox_id}/indexable/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
$controllers->post('/{databox_id}/view-name/', 'controller.admin.databox:changeViewName')
|
$controllers->post('/{databox_id}/view-name/', 'controller.admin.databox: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');
|
||||||
|
|
||||||
|
@@ -31,7 +31,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');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -40,19 +40,19 @@ class Databoxes implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/', 'controller.admin.databoxes:createDatabase')
|
$controllers->post('/', 'controller.admin.databoxes: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();
|
||||||
});
|
});
|
||||||
|
|
||||||
$controllers->post('/mount/', 'controller.admin.databoxes:databaseMount')
|
$controllers->post('/mount/', 'controller.admin.databoxes: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();
|
||||||
});
|
});
|
||||||
|
|
||||||
$controllers->post('/upgrade/', 'controller.admin.databoxes:databasesUpgrade')
|
$controllers->post('/upgrade/', 'controller.admin.databoxes: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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -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');
|
||||||
|
@@ -30,11 +30,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 {
|
||||||
\Session_Logger::updateClientInfos($app, 3);
|
\Session_Logger::updateClientInfos($app, 3);
|
||||||
} catch (SessionNotFound $e) {
|
} catch (SessionNotFound $e) {
|
||||||
@@ -102,7 +102,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 {
|
||||||
\Session_Logger::updateClientInfos($app, 3);
|
\Session_Logger::updateClientInfos($app, 3);
|
||||||
} catch (SessionNotFound $e) {
|
} catch (SessionNotFound $e) {
|
||||||
@@ -162,7 +162,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'));
|
||||||
@@ -196,7 +196,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);
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,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);
|
||||||
}
|
}
|
||||||
@@ -249,7 +249,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);
|
||||||
}
|
}
|
||||||
@@ -260,7 +260,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);
|
||||||
}
|
}
|
||||||
@@ -315,7 +315,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'));
|
||||||
}
|
}
|
||||||
@@ -338,7 +338,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);
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -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());
|
||||||
|
@@ -31,24 +31,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);
|
||||||
|
|
||||||
@@ -62,14 +62,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 {
|
||||||
@@ -90,58 +90,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']);
|
||||||
@@ -197,7 +197,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();
|
||||||
@@ -205,7 +205,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);
|
||||||
@@ -243,7 +243,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 {
|
||||||
@@ -266,7 +266,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);
|
||||||
|
|
||||||
@@ -341,7 +341,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";
|
||||||
@@ -398,7 +398,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();
|
||||||
|
|
||||||
@@ -573,11 +573,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'));
|
||||||
}
|
}
|
||||||
@@ -595,7 +595,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);
|
||||||
|
|
||||||
@@ -729,7 +729,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)) {
|
||||||
@@ -861,7 +861,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');
|
||||||
|
|
||||||
@@ -880,7 +880,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');
|
||||||
|
|
||||||
|
@@ -30,7 +30,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);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -40,7 +40,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'];
|
||||||
|
|
||||||
@@ -147,7 +147,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'));
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ class Baskets implements ControllerProviderInterface
|
|||||||
$selectedBasket = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket')->findUserBasket($app, $selectedBasketId, $app['authentication']->getUser(), true);
|
$selectedBasket = $app['EM']->getRepository('Alchemy\Phrasea\Model\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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -30,7 +30,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'));
|
||||||
}
|
}
|
||||||
@@ -101,9 +101,9 @@ class Root implements ControllerProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -356,7 +356,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);
|
||||||
|
@@ -32,13 +32,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);
|
||||||
|
@@ -34,7 +34,7 @@ class BasketController 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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -25,7 +25,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');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -27,7 +27,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -31,13 +31,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'));
|
||||||
|
|
||||||
@@ -229,7 +229,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');
|
||||||
@@ -268,7 +268,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'));
|
||||||
|
|
||||||
|
@@ -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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -27,7 +27,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.');
|
||||||
|
@@ -43,7 +43,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');
|
||||||
});
|
});
|
||||||
@@ -191,7 +191,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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -29,7 +29,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');
|
||||||
@@ -48,7 +48,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());
|
||||||
|
|
||||||
|
@@ -30,14 +30,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'];
|
||||||
|
@@ -29,7 +29,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -32,7 +32,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -93,9 +93,9 @@ class Query implements ControllerProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -29,7 +29,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -33,7 +33,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');
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ class Root implements ControllerProviderInterface
|
|||||||
$app['firewall']->requireAuthentication();
|
$app['firewall']->requireAuthentication();
|
||||||
});
|
});
|
||||||
|
|
||||||
$controllers->get('/', function(Application $app) {
|
$controllers->get('/', function (Application $app) {
|
||||||
try {
|
try {
|
||||||
\Session_Logger::updateClientInfos($app, 1);
|
\Session_Logger::updateClientInfos($app, 1);
|
||||||
} catch (SessionNotFound $e) {
|
} catch (SessionNotFound $e) {
|
||||||
@@ -58,7 +58,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);
|
||||||
|
@@ -33,15 +33,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'));
|
||||||
|
|
||||||
@@ -109,7 +109,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));
|
||||||
@@ -120,7 +120,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'))
|
||||||
@@ -151,7 +151,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);
|
||||||
@@ -181,7 +181,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()) {
|
||||||
@@ -199,7 +199,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 {
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ class TOU implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/deny/{sbas_id}/', 'controller.prod.tou:denyTermsOfUse')
|
$controllers->post('/deny/{sbas_id}/', 'controller.prod.tou: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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -32,12 +32,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);
|
||||||
|
|
||||||
@@ -68,7 +68,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);
|
||||||
@@ -91,7 +91,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'));
|
||||||
@@ -114,7 +114,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');
|
||||||
|
|
||||||
@@ -175,7 +175,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');
|
||||||
|
|
||||||
@@ -229,7 +229,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';
|
||||||
|
|
||||||
@@ -248,7 +248,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 {
|
||||||
|
@@ -29,7 +29,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -46,7 +46,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');
|
||||||
});
|
});
|
||||||
@@ -188,7 +188,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();
|
||||||
|
@@ -34,7 +34,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -33,7 +33,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -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();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@@ -25,7 +25,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');
|
||||||
});
|
});
|
||||||
|
@@ -25,7 +25,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');
|
||||||
});
|
});
|
||||||
|
@@ -24,7 +24,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');
|
||||||
});
|
});
|
||||||
|
@@ -25,12 +25,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');
|
||||||
|
|
||||||
|
@@ -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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -31,7 +31,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -24,7 +24,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');
|
||||||
});
|
});
|
||||||
|
@@ -26,7 +26,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');
|
||||||
});
|
});
|
||||||
|
@@ -28,7 +28,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -28,7 +28,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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -30,7 +30,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');
|
||||||
|
@@ -31,7 +31,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'))
|
||||||
@@ -42,7 +42,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'))));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -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')
|
||||||
|
@@ -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;
|
||||||
|
@@ -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 {
|
||||||
|
@@ -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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -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']);
|
||||||
|
@@ -31,7 +31,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'],
|
||||||
@@ -48,7 +48,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;
|
||||||
|
@@ -22,7 +22,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);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
|
@@ -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];
|
||||||
|
@@ -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'],
|
||||||
|
@@ -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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -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();
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -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 ||
|
||||||
|
@@ -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(),
|
||||||
|
@@ -694,16 +694,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') . ' ) ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -714,7 +714,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());
|
||||||
|
|
||||||
|
@@ -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)),
|
||||||
));
|
));
|
||||||
|
@@ -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');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -626,7 +626,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) {
|
||||||
|
|
||||||
|
@@ -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(
|
||||||
|
@@ -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(
|
||||||
|
@@ -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
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -36,10 +36,10 @@ 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)
|
||||||
{
|
{
|
||||||
|
@@ -680,7 +680,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();
|
||||||
|
|
||||||
@@ -900,9 +900,9 @@ class API_V1_adapter extends API_V1_Abstract
|
|||||||
$this->app['EM']->flush();
|
$this->app['EM']->flush();
|
||||||
|
|
||||||
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();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -1908,7 +1908,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);
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -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"];
|
||||||
|
@@ -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'];
|
||||||
|
@@ -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" :
|
||||||
@@ -911,7 +911,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'];
|
||||||
@@ -938,7 +938,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'];
|
||||||
|
@@ -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
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -737,7 +737,7 @@ class Browser
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if(stripos($this->_agent, 'trident') !== false) {
|
} elseif (stripos($this->_agent, 'trident') !== false) {
|
||||||
// >= IE 11
|
// >= IE 11
|
||||||
$this->setBrowser(self::BROWSER_IE);
|
$this->setBrowser(self::BROWSER_IE);
|
||||||
|
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
use Symfony\Component\Process\ExecutableFinder;
|
|
||||||
|
|
||||||
class patch_3819 implements patchInterface
|
class patch_3819 implements patchInterface
|
||||||
{
|
{
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
use Symfony\Component\Process\ExecutableFinder;
|
|
||||||
|
|
||||||
class patch_3820 implements patchInterface
|
class patch_3820 implements patchInterface
|
||||||
{
|
{
|
||||||
|
@@ -67,14 +67,14 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
self::$DI['app'] = self::$DI->share(function() {
|
self::$DI['app'] = self::$DI->share(function () {
|
||||||
|
|
||||||
$environment = 'test';
|
$environment = 'test';
|
||||||
$app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Api.php';
|
$app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Api.php';
|
||||||
|
|
||||||
$app['debug'] = true;
|
$app['debug'] = true;
|
||||||
|
|
||||||
$app['EM'] = $app->share($app->extend('EM', function($em) {
|
$app['EM'] = $app->share($app->extend('EM', function ($em) {
|
||||||
@unlink('/tmp/db.sqlite');
|
@unlink('/tmp/db.sqlite');
|
||||||
copy(__DIR__ . '/../../../../db-ref.sqlite', '/tmp/db.sqlite');
|
copy(__DIR__ . '/../../../../db-ref.sqlite', '/tmp/db.sqlite');
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ class ApiRootTest extends \PhraseanetWebTestCaseAbstract
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
self::$DI['app'] = self::$DI->share(function() {
|
self::$DI['app'] = self::$DI->share(function () {
|
||||||
$environment = 'test';
|
$environment = 'test';
|
||||||
$app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Api.php';
|
$app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Api.php';
|
||||||
|
|
||||||
|
@@ -154,7 +154,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
{
|
{
|
||||||
$app = new Application('test');
|
$app = new Application('test');
|
||||||
$sessionId = null;
|
$sessionId = null;
|
||||||
$app->post('/prod/upload/', function(Application $app) use (&$sessionId) {
|
$app->post('/prod/upload/', function (Application $app) use (&$sessionId) {
|
||||||
$sessionId = $app['session']->getId();
|
$sessionId = $app['session']->getId();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
unlink($app['phraseanet.configuration.config-compiled-path']);
|
unlink($app['phraseanet.configuration.config-compiled-path']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$app->get('/', function(Application $app, Request $request) {
|
$app->get('/', function (Application $app, Request $request) {
|
||||||
return 'Hello';
|
return 'Hello';
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
{
|
{
|
||||||
$app = new Application('test');
|
$app = new Application('test');
|
||||||
|
|
||||||
$app->get('/', function(Application $app, Request $request) {
|
$app->get('/', function (Application $app, Request $request) {
|
||||||
return $app['locale'];
|
return $app['locale'];
|
||||||
});
|
});
|
||||||
unset($app['exception_handler']);
|
unset($app['exception_handler']);
|
||||||
@@ -363,7 +363,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
private function getApp()
|
private function getApp()
|
||||||
{
|
{
|
||||||
$app = new Application('test');
|
$app = new Application('test');
|
||||||
$app->get('/', function(Application $app, Request $request) {
|
$app->get('/', function (Application $app, Request $request) {
|
||||||
|
|
||||||
$app['session']->set('usr_id', 5);
|
$app['session']->set('usr_id', 5);
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ class MinifierTest extends \PhraseanetPHPUnitAbstract
|
|||||||
{
|
{
|
||||||
$groups = require __DIR__ . '/../../../../../lib/conf.d/minifyGroupsConfig.php';
|
$groups = require __DIR__ . '/../../../../../lib/conf.d/minifyGroupsConfig.php';
|
||||||
|
|
||||||
return array_map(function($group){return array($group);}, array_keys($groups));
|
return array_map(function ($group) {return array($group);}, array_keys($groups));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -37,7 +37,7 @@ class ExportTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
public function testTestFtpConnexion()
|
public function testTestFtpConnexion()
|
||||||
{
|
{
|
||||||
$framework = $this;
|
$framework = $this;
|
||||||
self::$DI['app']['phraseanet.ftp.client'] = self::$DI['app']->protect(function($host, $port = 21, $timeout = 90, $ssl = false, $proxy = false, $proxyport = false) use ($framework) {
|
self::$DI['app']['phraseanet.ftp.client'] = self::$DI['app']->protect(function ($host, $port = 21, $timeout = 90, $ssl = false, $proxy = false, $proxyport = false) use ($framework) {
|
||||||
return $framework->getMockBuilder('\ftpclient')
|
return $framework->getMockBuilder('\ftpclient')
|
||||||
->setMethods(array('login', 'close'))
|
->setMethods(array('login', 'close'))
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
@@ -59,7 +59,7 @@ class ExportTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
public function testFtpConnexionNoXMLHTTPRequests()
|
public function testFtpConnexionNoXMLHTTPRequests()
|
||||||
{
|
{
|
||||||
$framework = $this;
|
$framework = $this;
|
||||||
self::$DI['app']['phraseanet.ftp.client'] = self::$DI['app']->protect(function($host, $port = 21, $timeout = 90, $ssl = false, $proxy = false, $proxyport = false) use ($framework) {
|
self::$DI['app']['phraseanet.ftp.client'] = self::$DI['app']->protect(function ($host, $port = 21, $timeout = 90, $ssl = false, $proxy = false, $proxyport = false) use ($framework) {
|
||||||
$ftpStub = $framework->getMockBuilder('\ftpclient')
|
$ftpStub = $framework->getMockBuilder('\ftpclient')
|
||||||
->setMethods(array('login', 'close'))
|
->setMethods(array('login', 'close'))
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
@@ -87,7 +87,7 @@ class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
|
|
||||||
$boolean = false;
|
$boolean = false;
|
||||||
|
|
||||||
$app->get('/unit-test-route', function(Application $app) use (&$boolean) {
|
$app->get('/unit-test-route', function (Application $app) use (&$boolean) {
|
||||||
$boolean = $app['authentication']->isAuthenticated();
|
$boolean = $app['authentication']->isAuthenticated();
|
||||||
|
|
||||||
return new Response();
|
return new Response();
|
||||||
@@ -136,7 +136,7 @@ class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
|
|
||||||
$boolean = false;
|
$boolean = false;
|
||||||
|
|
||||||
$app->get('/unit-test-route', function(Application $app) use (&$boolean) {
|
$app->get('/unit-test-route', function (Application $app) use (&$boolean) {
|
||||||
$boolean = $app['authentication']->isAuthenticated();
|
$boolean = $app['authentication']->isAuthenticated();
|
||||||
|
|
||||||
return new Response();
|
return new Response();
|
||||||
|
@@ -63,8 +63,8 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
|
|||||||
$client->request('GET', '/', array(), array(), array('HTTP_ACCEPT_LANGUAGE' => 'fr-FR,fr;q=0.9'));
|
$client->request('GET', '/', array(), array(), array('HTTP_ACCEPT_LANGUAGE' => 'fr-FR,fr;q=0.9'));
|
||||||
|
|
||||||
$settedCookie = null;
|
$settedCookie = null;
|
||||||
foreach($client->getResponse()->headers->getCookies() as $cookie) {
|
foreach ($client->getResponse()->headers->getCookies() as $cookie) {
|
||||||
if($cookie->getName() === 'locale') {
|
if ($cookie->getName() === 'locale') {
|
||||||
$settedCookie = $cookie;
|
$settedCookie = $cookie;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
|
|||||||
|
|
||||||
$app['dispatcher']->addSubscriber(new PhraseaLocaleSubscriber($app));
|
$app['dispatcher']->addSubscriber(new PhraseaLocaleSubscriber($app));
|
||||||
|
|
||||||
$app->get('/', function(Application $app, Request $request) {
|
$app->get('/', function (Application $app, Request $request) {
|
||||||
return $app['locale'] ? $app['locale'] : '';
|
return $app['locale'] ? $app['locale'] : '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ class DelivererTest extends \PHPUnit_Framework_TestCase
|
|||||||
$mailer = $this->getMailerMock();
|
$mailer = $this->getMailerMock();
|
||||||
$mailer->expects($this->once())
|
$mailer->expects($this->once())
|
||||||
->method('send')
|
->method('send')
|
||||||
->will($this->returnCallback(function($email) use (&$catchEmail) {
|
->will($this->returnCallback(function ($email) use (&$catchEmail) {
|
||||||
$catchEmail = $email;
|
$catchEmail = $email;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ class DelivererTest extends \PHPUnit_Framework_TestCase
|
|||||||
$mailer = $this->getMailerMock();
|
$mailer = $this->getMailerMock();
|
||||||
$mailer->expects($this->once())
|
$mailer->expects($this->once())
|
||||||
->method('send')
|
->method('send')
|
||||||
->will($this->returnCallback(function($email) use (&$catchEmail) {
|
->will($this->returnCallback(function ($email) use (&$catchEmail) {
|
||||||
$catchEmail = $email;
|
$catchEmail = $email;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ class DelivererTest extends \PHPUnit_Framework_TestCase
|
|||||||
$mailer = $this->getMailerMock();
|
$mailer = $this->getMailerMock();
|
||||||
$mailer->expects($this->once())
|
$mailer->expects($this->once())
|
||||||
->method('send')
|
->method('send')
|
||||||
->will($this->returnCallback(function($email) use (&$catchEmail) {
|
->will($this->returnCallback(function ($email) use (&$catchEmail) {
|
||||||
$catchEmail = $email;
|
$catchEmail = $email;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ class DelivererTest extends \PHPUnit_Framework_TestCase
|
|||||||
$mailer = $this->getMailerMock();
|
$mailer = $this->getMailerMock();
|
||||||
$mailer->expects($this->once())
|
$mailer->expects($this->once())
|
||||||
->method('send')
|
->method('send')
|
||||||
->will($this->returnCallback(function($email) use (&$catchEmail) {
|
->will($this->returnCallback(function ($email) use (&$catchEmail) {
|
||||||
$catchEmail = $email;
|
$catchEmail = $email;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ class DelivererTest extends \PHPUnit_Framework_TestCase
|
|||||||
$mailer = $this->getMailerMock();
|
$mailer = $this->getMailerMock();
|
||||||
$mailer->expects($this->once())
|
$mailer->expects($this->once())
|
||||||
->method('send')
|
->method('send')
|
||||||
->will($this->returnCallback(function($email) use (&$catchEmail) {
|
->will($this->returnCallback(function ($email) use (&$catchEmail) {
|
||||||
$catchEmail = $email;
|
$catchEmail = $email;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ class DelivererTest extends \PHPUnit_Framework_TestCase
|
|||||||
$mailer = $this->getMailerMock();
|
$mailer = $this->getMailerMock();
|
||||||
$mailer->expects($this->once())
|
$mailer->expects($this->once())
|
||||||
->method('send')
|
->method('send')
|
||||||
->will($this->returnCallback(function($email) use (&$catchEmail) {
|
->will($this->returnCallback(function ($email) use (&$catchEmail) {
|
||||||
$catchEmail = $email;
|
$catchEmail = $email;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ class DelivererTest extends \PHPUnit_Framework_TestCase
|
|||||||
$mailer = $this->getMailerMock();
|
$mailer = $this->getMailerMock();
|
||||||
$mailer->expects($this->once())
|
$mailer->expects($this->once())
|
||||||
->method('send')
|
->method('send')
|
||||||
->will($this->returnCallback(function($email) use (&$catchEmail) {
|
->will($this->returnCallback(function ($email) use (&$catchEmail) {
|
||||||
$catchEmail = $email;
|
$catchEmail = $email;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@ abstract class AbstractSetupTester extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
rename(__DIR__ . '/../../../../../config/configuration.yml', __DIR__ . '/../../../../../config/configuration.yml.test');
|
rename(__DIR__ . '/../../../../../config/configuration.yml', __DIR__ . '/../../../../../config/configuration.yml.test');
|
||||||
|
|
||||||
$this->tearDownHandlers[] = function() {
|
$this->tearDownHandlers[] = function () {
|
||||||
rename(__DIR__ . '/../../../../../config/configuration.yml.test', __DIR__ . '/../../../../../config/configuration.yml');
|
rename(__DIR__ . '/../../../../../config/configuration.yml.test', __DIR__ . '/../../../../../config/configuration.yml');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ abstract class AbstractSetupTester extends \PHPUnit_Framework_TestCase
|
|||||||
\$dbname = 'ab_unitTests';
|
\$dbname = 'ab_unitTests';
|
||||||
");
|
");
|
||||||
|
|
||||||
$this->tearDownHandlers[] = function() {
|
$this->tearDownHandlers[] = function () {
|
||||||
@unlink(__DIR__ . '/../../../../../config/_GV.php');
|
@unlink(__DIR__ . '/../../../../../config/_GV.php');
|
||||||
@unlink(__DIR__ . '/../../../../../config/connexion.inc');
|
@unlink(__DIR__ . '/../../../../../config/connexion.inc');
|
||||||
};
|
};
|
||||||
@@ -67,7 +67,7 @@ abstract class AbstractSetupTester extends \PHPUnit_Framework_TestCase
|
|||||||
\$dbname = '".$credentials['dbname']."';
|
\$dbname = '".$credentials['dbname']."';
|
||||||
");
|
");
|
||||||
|
|
||||||
$this->tearDownHandlers[] = function() {
|
$this->tearDownHandlers[] = function () {
|
||||||
@unlink(__DIR__ . '/../../../../../config/config.inc');
|
@unlink(__DIR__ . '/../../../../../config/config.inc');
|
||||||
@unlink(__DIR__ . '/../../../../../config/connexion.inc');
|
@unlink(__DIR__ . '/../../../../../config/connexion.inc');
|
||||||
};
|
};
|
||||||
|
@@ -83,7 +83,7 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
|
|||||||
|
|
||||||
self::$DI['app']['authentication']->setUser($stubAuthenticatedUser);
|
self::$DI['app']['authentication']->setUser($stubAuthenticatedUser);
|
||||||
|
|
||||||
self::$DI['client'] = self::$DI->share(function($DI) {
|
self::$DI['client'] = self::$DI->share(function ($DI) {
|
||||||
return new Client($DI['app'], array());
|
return new Client($DI['app'], array());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -348,7 +348,7 @@ class databox_fieldTest extends PhraseanetPHPUnitAbstract
|
|||||||
|
|
||||||
$this->object_mono->set_label($code, null)->save();
|
$this->object_mono->set_label($code, null)->save();
|
||||||
$this->assertEquals($this->object_mono->get_name(), $this->object_mono->get_label($code));
|
$this->assertEquals($this->object_mono->get_name(), $this->object_mono->get_label($code));
|
||||||
|
|
||||||
$this->object_mono->set_label($code, '')->save();
|
$this->object_mono->set_label($code, '')->save();
|
||||||
$this->assertEquals($this->object_mono->get_name(), $this->object_mono->get_label($code));
|
$this->assertEquals($this->object_mono->get_name(), $this->object_mono->get_label($code));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user