This commit is contained in:
Romain Neutron
2013-10-31 14:19:09 +01:00
parent e4386660df
commit 13dd86c67f
80 changed files with 297 additions and 321 deletions

View File

@@ -14,7 +14,6 @@ namespace Alchemy\Phrasea\Command\Task;
use Alchemy\TaskManager\TaskManager;
use Alchemy\Phrasea\Command\Command;
use Alchemy\TaskManager\Event\TaskManagerSubscriber\LockFileSubscriber;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

View File

@@ -15,7 +15,6 @@ use Alchemy\Phrasea\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Alchemy\Phrasea\TaskManager\TaskManagerStatus;
class SchedulerState extends Command
{

View File

@@ -15,7 +15,6 @@ use Alchemy\Phrasea\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
class TaskStart extends Command
{

View File

@@ -15,7 +15,6 @@ use Alchemy\Phrasea\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
class TaskStop extends Command
{

View File

@@ -31,12 +31,12 @@ class Publications implements ControllerProviderInterface
$app['controller.admin.publications'] = $this;
$controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) {
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAccessToModule('admin')
->requireRight('bas_chupub');
});
$controllers->get('/list/', function(PhraseaApplication $app) {
$controllers->get('/list/', function (PhraseaApplication $app) {
$feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->getAllForUser(
$app['authentication']->getUser()
);
@@ -45,7 +45,7 @@ class Publications implements ControllerProviderInterface
->render('admin/publications/list.html.twig', array('feeds' => $feeds));
})->bind('admin_feeds_list');
$controllers->post('/create/', function(PhraseaApplication $app, Request $request) {
$controllers->post('/create/', function (PhraseaApplication $app, Request $request) {
if ('' === $title = trim($request->request->get('title', ''))) {
$app->abort(400, "Bad request");
}
@@ -78,7 +78,7 @@ class Publications implements ControllerProviderInterface
return $app->redirectPath('admin_feeds_list');
})->bind('admin_feeds_create');
$controllers->get('/feed/{id}/', function(PhraseaApplication $app, Request $request, $id) {
$controllers->get('/feed/{id}/', function (PhraseaApplication $app, Request $request, $id) {
$feed = $app["EM"]->find('Alchemy\Phrasea\Model\Entities\Feed', $id);
return $app['twig']
@@ -87,7 +87,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed')
->assert('id', '\d+');
$controllers->post('/feed/{id}/update/', function(PhraseaApplication $app, Request $request, $id) {
$controllers->post('/feed/{id}/update/', function (PhraseaApplication $app, Request $request, $id) {
if ('' === $title = trim($request->request->get('title', ''))) {
$app->abort(400, "Bad request");
@@ -108,7 +108,7 @@ class Publications implements ControllerProviderInterface
$app['EM']->flush();
return $app->redirectPath('admin_feeds_list');
})->before(function(Request $request) use ($app) {
})->before(function (Request $request) use ($app) {
$feed = $app["EM"]->find('Alchemy\Phrasea\Model\Entities\Feed', $request->attributes->get('id'));
if (!$feed->isOwner($app['authentication']->getUser())) {
@@ -118,7 +118,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed_update')
->assert('id', '\d+');
$controllers->post('/feed/{id}/iconupload/', function(PhraseaApplication $app, Request $request, $id) {
$controllers->post('/feed/{id}/iconupload/', function (PhraseaApplication $app, Request $request, $id) {
$datas = array(
'success' => false,
'message' => '',
@@ -192,7 +192,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed_icon')
->assert('id', '\d+');
$controllers->post('/feed/{id}/addpublisher/', function(PhraseaApplication $app, $id) {
$controllers->post('/feed/{id}/addpublisher/', function (PhraseaApplication $app, $id) {
$error = '';
try {
$request = $app['request'];
@@ -218,7 +218,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed_add_publisher')
->assert('id', '\d+');
$controllers->post('/feed/{id}/removepublisher/', function(PhraseaApplication $app, $id) {
$controllers->post('/feed/{id}/removepublisher/', function (PhraseaApplication $app, $id) {
try {
$request = $app['request'];
@@ -245,7 +245,7 @@ class Publications implements ControllerProviderInterface
->bind('admin_feeds_feed_remove_publisher')
->assert('id', '\d+');
$controllers->post('/feed/{id}/delete/', function(PhraseaApplication $app, $id) {
$controllers->post('/feed/{id}/delete/', function (PhraseaApplication $app, $id) {
$feed = $app["EM"]->find('Alchemy\Phrasea\Model\Entities\Feed', $id);
if (null === $feed) {

View File

@@ -27,7 +27,7 @@ class TaskManager implements ControllerProviderInterface
$controllers = $app['controllers_factory'];
$controllers
->before(function(Request $request) use ($app) {
->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('taskmanager');
})
->convert('task', function ($id) use ($app) {

View File

@@ -52,7 +52,7 @@ class V1 implements ControllerProviderInterface
* @ throws \API_V1_exception_unauthorized
* @ throws \API_V1_exception_forbidden
*/
$controllers->before(function($request) use ($app) {
$controllers->before(function ($request) use ($app) {
$context = new Context(Context::CONTEXT_OAUTH2_TOKEN);
$app['dispatcher']->dispatch(PhraseaEvents::PRE_AUTHENTICATE, new PreAuthenticate($request, $context));
@@ -167,7 +167,7 @@ class V1 implements ControllerProviderInterface
/**
* Method Not Allowed Closure
*/
$bad_request_exception = function() {
$bad_request_exception = function () {
throw new \API_V1_exception_badrequest();
};
@@ -191,7 +191,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->get('/monitor/scheduler/', function(SilexApplication $app, Request $request) {
$controllers->get('/monitor/scheduler/', function (SilexApplication $app, Request $request) {
return $app['api']->get_scheduler($app)->get_response();
})->before($mustBeAdmin);
@@ -205,7 +205,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->get('/monitor/tasks/', function(SilexApplication $app, Request $request) {
$controllers->get('/monitor/tasks/', function (SilexApplication $app, Request $request) {
return $app['api']->get_task_list($app)->get_response();
})->before($mustBeAdmin);
@@ -219,7 +219,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->get('/monitor/task/{task}/', function(SilexApplication $app, Request $request, $task) {
$controllers->get('/monitor/task/{task}/', function (SilexApplication $app, Request $request, $task) {
return $app['api']->get_task($app, $task)->get_response();
})
->convert('task', array($app['converter.task'], 'convert'))
@@ -236,7 +236,7 @@ class V1 implements ControllerProviderInterface
* - name (string) change the name of the task
* - autostart (boolean) start task when scheduler starts
*/
$controllers->post('/monitor/task/{task}/', function(SilexApplication $app, Request $request, $task) {
$controllers->post('/monitor/task/{task}/', function (SilexApplication $app, Request $request, $task) {
return $app['api']->set_task_property($app, $task)->get_response();
})
->convert('task', array($app['converter.task'], 'convert'))
@@ -252,7 +252,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->post('/monitor/task/{task}/start/', function(SilexApplication $app, Request $request, $task) {
$controllers->post('/monitor/task/{task}/start/', function (SilexApplication $app, Request $request, $task) {
return $app['api']->start_task($app, $task)->get_response();
})
->convert('task', array($app['converter.task'], 'convert'))
@@ -268,7 +268,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->post('/monitor/task/{task}/stop/', function(SilexApplication $app, Request $request, $task) {
$controllers->post('/monitor/task/{task}/stop/', function (SilexApplication $app, Request $request, $task) {
return $app['api']->stop_task($app, $task)->get_response();
})
->convert('task', array($app['converter.task'], 'convert'))
@@ -284,7 +284,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->get('/monitor/phraseanet/', function(SilexApplication $app, Request $request) {
$controllers->get('/monitor/phraseanet/', function (SilexApplication $app, Request $request) {
return $app['api']->get_phraseanet_monitor($app)->get_response();
})->before($mustBeAdmin);
@@ -296,7 +296,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->get('/databoxes/list/', function(SilexApplication $app, Request $request) {
$controllers->get('/databoxes/list/', function (SilexApplication $app, Request $request) {
return $app['api']->get_databoxes($request)->get_response();
});
@@ -308,7 +308,7 @@ class V1 implements ControllerProviderInterface
* Parameters ;
* DATABOX_ID : required INT
*/
$controllers->get('/databoxes/{databox_id}/collections/', function(SilexApplication $app, $databox_id) {
$controllers->get('/databoxes/{databox_id}/collections/', function (SilexApplication $app, $databox_id) {
return $app['api']
->get_databox_collections($app['request'], $databox_id)
->get_response();
@@ -325,7 +325,7 @@ class V1 implements ControllerProviderInterface
* DATABOX_ID : required INT
*
*/
$controllers->get('/databoxes/{databox_id}/status/', function(SilexApplication $app, $databox_id) {
$controllers->get('/databoxes/{databox_id}/status/', function (SilexApplication $app, $databox_id) {
return $app['api']
->get_databox_status($app['request'], $databox_id)
->get_response();
@@ -341,7 +341,7 @@ class V1 implements ControllerProviderInterface
* Parameters ;
* DATABOX_ID : required INT
*/
$controllers->get('/databoxes/{databox_id}/metadatas/', function(SilexApplication $app, $databox_id) {
$controllers->get('/databoxes/{databox_id}/metadatas/', function (SilexApplication $app, $databox_id) {
return $app['api']
->get_databox_metadatas($app['request'], $databox_id)
->get_response();
@@ -357,7 +357,7 @@ class V1 implements ControllerProviderInterface
* Parameters ;
* DATABOX_ID : required INT
*/
$controllers->get('/databoxes/{databox_id}/termsOfUse/', function(SilexApplication $app, $databox_id) {
$controllers->get('/databoxes/{databox_id}/termsOfUse/', function (SilexApplication $app, $databox_id) {
return $app['api']
->get_databox_terms($app['request'], $databox_id)
->get_response();
@@ -365,11 +365,11 @@ class V1 implements ControllerProviderInterface
$controllers->get('/databoxes/{any_id}/termsOfUse/', $bad_request_exception);
$controllers->get('/quarantine/list/', function(SilexApplication $app, Request $request) {
$controllers->get('/quarantine/list/', function (SilexApplication $app, Request $request) {
return $app['api']->list_quarantine($app, $request)->get_response();
});
$controllers->get('/quarantine/item/{lazaret_id}/', function($lazaret_id, SilexApplication $app, Request $request) {
$controllers->get('/quarantine/item/{lazaret_id}/', function ($lazaret_id, SilexApplication $app, Request $request) {
return $app['api']->list_quarantine_item($lazaret_id, $app, $request)->get_response();
});
@@ -381,7 +381,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->post('/records/add/', function(SilexApplication $app, Request $request) {
$controllers->post('/records/add/', function (SilexApplication $app, Request $request) {
return $app['api']->add_record($app, $request)->get_response();
});
@@ -401,7 +401,7 @@ class V1 implements ControllerProviderInterface
* Array containing an array of records and stories collection
*
*/
$controllers->match('/search/', function() use ($app) {
$controllers->match('/search/', function () use ($app) {
return $app['api']->search($app['request'])->get_response();
});
@@ -421,11 +421,11 @@ class V1 implements ControllerProviderInterface
* Array of record objects
*
*/
$controllers->match('/records/search/', function(SilexApplication $app) {
$controllers->match('/records/search/', function (SilexApplication $app) {
return $app['api']->search_records($app['request'])->get_response();
});
$controllers->get('/records/{databox_id}/{record_id}/caption/', function(SilexApplication $app, $databox_id, $record_id) {
$controllers->get('/records/{databox_id}/{record_id}/caption/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api']
->caption_records($app['request'], $databox_id, $record_id)
->get_response();
@@ -443,7 +443,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT
*
*/
$controllers->get('/records/{databox_id}/{record_id}/metadatas/', function(SilexApplication $app, $databox_id, $record_id) {
$controllers->get('/records/{databox_id}/{record_id}/metadatas/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api']
->get_record_metadatas($app['request'], $databox_id, $record_id)
->get_response();
@@ -461,7 +461,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT
*
*/
$controllers->get('/records/{databox_id}/{record_id}/status/', function(SilexApplication $app, $databox_id, $record_id) {
$controllers->get('/records/{databox_id}/{record_id}/status/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api']
->get_record_status($app['request'], $databox_id, $record_id)
->get_response();
@@ -479,7 +479,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT
*
*/
$controllers->get('/records/{databox_id}/{record_id}/related/', function(SilexApplication $app, $databox_id, $record_id) {
$controllers->get('/records/{databox_id}/{record_id}/related/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api']
->get_record_related($app['request'], $databox_id, $record_id)
->get_response();
@@ -497,7 +497,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT
*
*/
$controllers->get('/records/{databox_id}/{record_id}/embed/', function(SilexApplication $app, $databox_id, $record_id) {
$controllers->get('/records/{databox_id}/{record_id}/embed/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api']
->get_record_embed($app['request'], $databox_id, $record_id)
->get_response();
@@ -515,7 +515,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT
*
*/
$controllers->post('/records/{databox_id}/{record_id}/setmetadatas/', function(SilexApplication $app, $databox_id, $record_id) {
$controllers->post('/records/{databox_id}/{record_id}/setmetadatas/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api']
->set_record_metadatas($app['request'], $databox_id, $record_id)
->get_response();
@@ -533,7 +533,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT
*
*/
$controllers->post('/records/{databox_id}/{record_id}/setstatus/', function(SilexApplication $app, $databox_id, $record_id) {
$controllers->post('/records/{databox_id}/{record_id}/setstatus/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api']
->set_record_status($app['request'], $databox_id, $record_id)
->get_response();
@@ -551,7 +551,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT
*
*/
$controllers->post('/records/{databox_id}/{record_id}/setcollection/', function(SilexApplication $app, $databox_id, $record_id) {
$controllers->post('/records/{databox_id}/{record_id}/setcollection/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api']
->set_record_collection($app['request'], $databox_id, $record_id)
->get_response();
@@ -559,7 +559,7 @@ class V1 implements ControllerProviderInterface
$controllers->post('/records/{wrong_databox_id}/{wrong_record_id}/setcollection/', $bad_request_exception);
$controllers->get('/records/{databox_id}/{record_id}/', function(SilexApplication $app, $databox_id, $record_id) {
$controllers->get('/records/{databox_id}/{record_id}/', function (SilexApplication $app, $databox_id, $record_id) {
return $app['api']
->get_record($app['request'], $databox_id, $record_id)
->get_response();
@@ -575,7 +575,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->get('/baskets/list/', function(SilexApplication $app) {
$controllers->get('/baskets/list/', function (SilexApplication $app) {
return $app['api']->search_baskets($app['request'])->get_response();
});
@@ -587,7 +587,7 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->post('/baskets/add/', function(SilexApplication $app) {
$controllers->post('/baskets/add/', function (SilexApplication $app) {
return $app['api']->create_basket($app['request'])->get_response();
});
@@ -600,7 +600,7 @@ class V1 implements ControllerProviderInterface
* BASKET_ID : required INT
*
*/
$controllers->get('/baskets/{basket_id}/content/', function(SilexApplication $app, $basket_id) {
$controllers->get('/baskets/{basket_id}/content/', function (SilexApplication $app, $basket_id) {
return $app['api']->get_basket($app['request'], $basket_id)->get_response();
})->assert('basket_id', '\d+');
@@ -615,7 +615,7 @@ class V1 implements ControllerProviderInterface
* BASKET_ID : required INT
*
*/
$controllers->post('/baskets/{basket_id}/setname/', function(SilexApplication $app, $basket_id) {
$controllers->post('/baskets/{basket_id}/setname/', function (SilexApplication $app, $basket_id) {
return $app['api']
->set_basket_title($app['request'], $basket_id)
->get_response();
@@ -632,7 +632,7 @@ class V1 implements ControllerProviderInterface
* BASKET_ID : required INT
*
*/
$controllers->post('/baskets/{basket_id}/setdescription/', function(SilexApplication $app, $basket_id) {
$controllers->post('/baskets/{basket_id}/setdescription/', function (SilexApplication $app, $basket_id) {
return $app['api']
->set_basket_description($app['request'], $basket_id)
->get_response();
@@ -649,7 +649,7 @@ class V1 implements ControllerProviderInterface
* BASKET_ID : required INT
*
*/
$controllers->post('/baskets/{basket_id}/delete/', function(SilexApplication $app, $basket_id) {
$controllers->post('/baskets/{basket_id}/delete/', function (SilexApplication $app, $basket_id) {
return $app['api']->delete_basket($app['request'], $basket_id)->get_response();
})->assert('basket_id', '\d+');
@@ -663,19 +663,19 @@ class V1 implements ControllerProviderInterface
* Parameters :
*
*/
$controllers->get('/feeds/list/', function(SilexApplication $app) {
$controllers->get('/feeds/list/', function (SilexApplication $app) {
return $app['api']
->search_publications($app['request'], $app['authentication']->getUser())
->get_response();
});
$controllers->get('/feeds/content/', function(SilexApplication $app) {
$controllers->get('/feeds/content/', function (SilexApplication $app) {
return $app['api']
->get_publications($app['request'], $app['authentication']->getUser())
->get_response();
});
$controllers->get('/feeds/entry/{entry_id}/', function(SilexApplication $app, $entry_id) {
$controllers->get('/feeds/entry/{entry_id}/', function (SilexApplication $app, $entry_id) {
return $app['api']
->get_feed_entry($app['request'], $entry_id, $app['authentication']->getUser())
->get_response();
@@ -692,7 +692,7 @@ class V1 implements ControllerProviderInterface
* PUBLICATION_ID : required INT
*
*/
$controllers->get('/feeds/{feed_id}/content/', function(SilexApplication $app, $feed_id) {
$controllers->get('/feeds/{feed_id}/content/', function (SilexApplication $app, $feed_id) {
return $app['api']
->get_publication($app['request'], $feed_id, $app['authentication']->getUser())
->get_response();
@@ -710,7 +710,7 @@ class V1 implements ControllerProviderInterface
* RECORD_ID : required INT
*
*/
$controllers->get('/stories/{databox_id}/{story_id}/embed/', function($databox_id, $story_id) use ($app) {
$controllers->get('/stories/{databox_id}/{story_id}/embed/', function ($databox_id, $story_id) use ($app) {
$result = $app['api']->get_story_embed($app['request'], $databox_id, $story_id);
return $result->get_response();
@@ -719,7 +719,7 @@ class V1 implements ControllerProviderInterface
$controllers->get('/stories/{any_id}/{anyother_id}/embed/', $bad_request_exception);
$controllers->get('/stories/{databox_id}/{story_id}/', function($databox_id, $story_id) use ($app) {
$controllers->get('/stories/{databox_id}/{story_id}/', function ($databox_id, $story_id) use ($app) {
$result = $app['api']->get_story($app['request'], $databox_id, $story_id);
return $result->get_response();
@@ -727,7 +727,7 @@ class V1 implements ControllerProviderInterface
$controllers->get('/stories/{any_id}/{anyother_id}/', $bad_request_exception);
$controllers->get('/stories/{databox_id}/{story_id}/', function($databox_id, $story_id) use ($app) {
$controllers->get('/stories/{databox_id}/{story_id}/', function ($databox_id, $story_id) use ($app) {
$result = $app['api']->get_story($app['request'], $databox_id, $story_id);
return $result->get_response();

View File

@@ -29,7 +29,7 @@ class Lightbox implements ControllerProviderInterface
$controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) {
$controllers->before(function (Request $request) use ($app) {
if (!$request->query->has('LOG')) {
return;
}
@@ -62,7 +62,7 @@ class Lightbox implements ControllerProviderInterface
}
});
$controllers->before(function(Request $request) use ($app) {
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication();
});
@@ -96,7 +96,7 @@ class Lightbox implements ControllerProviderInterface
})
->bind('lightbox');
$controllers->get('/ajax/NOTE_FORM/{sselcont_id}/', function(SilexApplication $app, $sselcont_id) {
$controllers->get('/ajax/NOTE_FORM/{sselcont_id}/', function (SilexApplication $app, $sselcont_id) {
if (!$app['browser']->isMobile()) {
return new Response('');
@@ -116,7 +116,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_ajax_note_form')
->assert('sselcont_id', '\d+');
$controllers->get('/ajax/LOAD_BASKET_ELEMENT/{sselcont_id}/', function(SilexApplication $app, $sselcont_id) {
$controllers->get('/ajax/LOAD_BASKET_ELEMENT/{sselcont_id}/', function (SilexApplication $app, $sselcont_id) {
/* @var $repository Alchemy\Phrasea\Model\Repositories\BasketElementRepository */
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\BasketElement');
@@ -162,7 +162,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_ajax_load_basketelement')
->assert('sselcont_id', '\d+');
$controllers->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function(SilexApplication $app, $entry_id, $item_id) {
$controllers->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function (SilexApplication $app, $entry_id, $item_id) {
$entry = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedEntry')->find($entry_id);
$item = $entry->getItem($item_id);
@@ -344,7 +344,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_feed_entry')
->assert('entry_id', '\d+');
$controllers->get('/ajax/LOAD_REPORT/{ssel_id}/', function(SilexApplication $app, $ssel_id) {
$controllers->get('/ajax/LOAD_REPORT/{ssel_id}/', function (SilexApplication $app, $ssel_id) {
$template = 'lightbox/basket_content_report.html.twig';
@@ -405,7 +405,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_ajax_set_note')
->assert('sselcont_id', '\d+');
$controllers->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function(SilexApplication $app, $sselcont_id) {
$controllers->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function (SilexApplication $app, $sselcont_id) {
$request = $app['request'];
$agreement = $request->request->get('agreement');
@@ -468,7 +468,7 @@ class Lightbox implements ControllerProviderInterface
->bind('lightbox_ajax_set_element_agreement')
->assert('sselcont_id', '\d+');
$controllers->post('/ajax/SET_RELEASE/{ssel_id}/', function(SilexApplication $app, $ssel_id) {
$controllers->post('/ajax/SET_RELEASE/{ssel_id}/', function (SilexApplication $app, $ssel_id) {
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket');

View File

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

View File

@@ -36,18 +36,18 @@ class Feed implements ControllerProviderInterface
$controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) {
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication();
});
$controllers->post('/requestavailable/', function(Application $app, Request $request) {
$controllers->post('/requestavailable/', function (Application $app, Request $request) {
$feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->getAllForUser($app['authentication']->getUser());
$publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub'));
return $app['twig']->render('prod/actions/publish/publish.html.twig', array('publishing' => $publishing, 'feeds' => $feeds));
});
$controllers->post('/entry/create/', function(Application $app, Request $request) {
$controllers->post('/entry/create/', function (Application $app, Request $request) {
$feed = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->find($request->request->get('feed_id'));
if (null === $feed) {
@@ -95,11 +95,11 @@ class Feed implements ControllerProviderInterface
return $app->json($datas);
})
->bind('prod_feeds_entry_create')
->before(function(Request $request) use ($app) {
->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('bas_chupub');
});
$controllers->get('/entry/{id}/edit/', function(Application $app, Request $request, $id) {
$controllers->get('/entry/{id}/edit/', function (Application $app, Request $request, $id) {
$entry = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedEntry')->find($id);
if (!$entry->isPublisher($app['authentication']->getUser())) {
@@ -114,11 +114,11 @@ class Feed implements ControllerProviderInterface
})
->bind('feed_entry_edit')
->assert('id', '\d+')
->before(function(Request $request) use ($app) {
->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('bas_chupub');
});
$controllers->post('/entry/{id}/update/', function(Application $app, Request $request, $id) {
$controllers->post('/entry/{id}/update/', function (Application $app, Request $request, $id) {
$datas = array('error' => true, 'message' => '', 'datas' => '');
$entry = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedEntry')->find($id);
@@ -177,11 +177,11 @@ class Feed implements ControllerProviderInterface
));
})
->bind('prod_feeds_entry_update')
->assert('id', '\d+')->before(function(Request $request) use ($app) {
->assert('id', '\d+')->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('bas_chupub');
});
$controllers->post('/entry/{id}/delete/', function(Application $app, Request $request, $id) {
$controllers->post('/entry/{id}/delete/', function (Application $app, Request $request, $id) {
$datas = array('error' => true, 'message' => '');
$entry = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedEntry')->find($id);
@@ -199,11 +199,11 @@ class Feed implements ControllerProviderInterface
return $app->json(array('error' => false, 'message' => 'succes'));
})
->bind('prod_feeds_entry_delete')
->assert('id', '\d+')->before(function(Request $request) use ($app) {
->assert('id', '\d+')->before(function (Request $request) use ($app) {
$app['firewall']->requireRight('bas_chupub');
});
$controllers->get('/', function(Application $app, Request $request) {
$controllers->get('/', function (Application $app, Request $request) {
$request = $app['request'];
$page = (int) $request->query->get('page');
$page = $page > 0 ? $page : 1;
@@ -219,7 +219,7 @@ class Feed implements ControllerProviderInterface
return new Response($datas);
})->bind('prod_feeds');
$controllers->get('/feed/{id}/', function(Application $app, Request $request, $id) {
$controllers->get('/feed/{id}/', function (Application $app, Request $request, $id) {
$page = (int) $request->query->get('page');
$page = $page > 0 ? $page : 1;
@@ -236,7 +236,7 @@ class Feed implements ControllerProviderInterface
->bind('prod_feeds_feed')
->assert('id', '\d+');
$controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) {
$controllers->get('/subscribe/aggregated/', function (Application $app, Request $request) {
$renew = ($request->query->get('renew') === 'true');
$feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->getAllForUser($app['authentication']->getUser());
@@ -257,7 +257,7 @@ class Feed implements ControllerProviderInterface
return $app->json($output);
})->bind('prod_feeds_subscribe_aggregated');
$controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) {
$controllers->get('/subscribe/{id}/', function (Application $app, Request $request, $id) {
$renew = ($request->query->get('renew') === 'true');
$feed = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->find($id);

View File

@@ -41,13 +41,13 @@ class Order implements ControllerProviderInterface
$controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) {
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication()
->requireRight('order');
});
$controllers->get('/', 'controller.prod.order:displayOrders')
->before(function(Request $request) use ($app) {
->before(function (Request $request) use ($app) {
$app['firewall']->requireOrdersAdmin();
})
->bind('prod_orders');
@@ -56,21 +56,21 @@ class Order implements ControllerProviderInterface
->bind('prod_order_new');
$controllers->get('/{order_id}/', 'controller.prod.order:displayOneOrder')
->before(function(Request $request) use ($app) {
->before(function (Request $request) use ($app) {
$app['firewall']->requireOrdersAdmin();
})
->bind('prod_order')
->assert('order_id', '\d+');
$controllers->post('/{order_id}/send/', 'controller.prod.order:sendOrder')
->before(function(Request $request) use ($app) {
->before(function (Request $request) use ($app) {
$app['firewall']->requireOrdersAdmin();
})
->bind('prod_order_send')
->assert('order_id', '\d+');
$controllers->post('/{order_id}/deny/', 'controller.prod.order:denyOrder')
->before(function(Request $request) use ($app) {
->before(function (Request $request) use ($app) {
$app['firewall']->requireOrdersAdmin();
})
->bind('prod_order_deny')
@@ -135,7 +135,7 @@ class Order implements ControllerProviderInterface
}
}
$noAdmins = $collectionHasOrderAdmins->forAll(function($key, $hasAdmin) {
$noAdmins = $collectionHasOrderAdmins->forAll(function ($key, $hasAdmin) {
return false === $hasAdmin;
});

View File

@@ -35,7 +35,7 @@ class Push implements ControllerProviderInterface
{
protected function getUserFormatter()
{
return function(\User_Adapter $user) {
return function (\User_Adapter $user) {
$subtitle = array_filter(array($user->get_job(), $user->get_company()));
return array(
@@ -54,7 +54,7 @@ class Push implements ControllerProviderInterface
{
$userFormatter = $this->getUserFormatter();
return function(UsrList $List) use ($userFormatter, $app) {
return function (UsrList $List) use ($userFormatter, $app) {
$entries = array();
foreach ($List->getEntries() as $entry) {
@@ -77,7 +77,7 @@ class Push implements ControllerProviderInterface
protected function getUsersInSelectionExtractor()
{
return function(array $selection) {
return function (array $selection) {
$Users = new \Doctrine\Common\Collections\ArrayCollection();
foreach ($selection as $record) {
@@ -107,7 +107,7 @@ class Push implements ControllerProviderInterface
$controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) {
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireAuthentication()
->requireRight('push');
});
@@ -118,7 +118,7 @@ class Push implements ControllerProviderInterface
$userSelection = $this->getUsersInSelectionExtractor();
$controllers->post('/sendform/', function(Application $app) use ($userSelection) {
$controllers->post('/sendform/', function (Application $app) use ($userSelection) {
$push = new RecordHelper\Push($app, $app['request']);
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrList');
@@ -136,7 +136,7 @@ class Push implements ControllerProviderInterface
return $app['twig']->render('prod/actions/Push.html.twig', $params);
});
$controllers->post('/validateform/', function(Application $app) use ($userSelection) {
$controllers->post('/validateform/', function (Application $app) use ($userSelection) {
$push = new RecordHelper\Push($app, $app['request']);
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrList');
@@ -154,7 +154,7 @@ class Push implements ControllerProviderInterface
return $app['twig']->render('prod/actions/Push.html.twig', $params);
});
$controllers->post('/send/', function(Application $app) {
$controllers->post('/send/', function (Application $app) {
$request = $app['request'];
$ret = array(
@@ -269,7 +269,7 @@ class Push implements ControllerProviderInterface
return $app->json($ret);
})->bind('prod_push_send');
$controllers->post('/validate/', function(Application $app) {
$controllers->post('/validate/', function (Application $app) {
$request = $app['request'];
$ret = array(
@@ -471,7 +471,7 @@ class Push implements ControllerProviderInterface
return $app->json($ret);
})->bind('prod_push_validate');
$controllers->get('/user/{usr_id}/', function(Application $app, $usr_id) use ($userFormatter) {
$controllers->get('/user/{usr_id}/', function (Application $app, $usr_id) use ($userFormatter) {
$datas = null;
$request = $app['request'];
@@ -495,7 +495,7 @@ class Push implements ControllerProviderInterface
return $app->json($datas);
})->assert('usr_id', '\d+');
$controllers->get('/list/{list_id}/', function(Application $app, $list_id) use ($listFormatter) {
$controllers->get('/list/{list_id}/', function (Application $app, $list_id) use ($listFormatter) {
$datas = null;
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrList');
@@ -511,7 +511,7 @@ class Push implements ControllerProviderInterface
->bind('prod_push_lists_list')
->assert('list_id', '\d+');
$controllers->post('/add-user/', function(Application $app, Request $request) use ($userFormatter) {
$controllers->post('/add-user/', function (Application $app, Request $request) use ($userFormatter) {
$result = array('success' => false, 'message' => '', 'user' => null);
try {
@@ -576,13 +576,13 @@ class Push implements ControllerProviderInterface
return $app->json($result);
})->bind('prod_push_do_add_user');
$controllers->get('/add-user/', function(Application $app, Request $request) {
$controllers->get('/add-user/', function (Application $app, Request $request) {
$params = array('callback' => $request->query->get('callback'));
return $app['twig']->render('prod/User/Add.html.twig', $params);
})->bind('prod_push_add_user');
$controllers->get('/search-user/', function(Application $app) use ($userFormatter, $listFormatter) {
$controllers->get('/search-user/', function (Application $app) use ($userFormatter, $listFormatter) {
$request = $app['request'];
$query = new \User_Query($app);
@@ -619,7 +619,7 @@ class Push implements ControllerProviderInterface
return $app->json($datas);
});
$controllers->match('/edit-list/{list_id}/', function(Application $app, Request $request, $list_id) {
$controllers->match('/edit-list/{list_id}/', function (Application $app, Request $request, $list_id) {
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrList');

View File

@@ -27,12 +27,12 @@ class Share implements ControllerProviderInterface
$controllers = $app['controllers_factory'];
$controllers->before(function(Request $request) use ($app) {
$controllers->before(function (Request $request) use ($app) {
$app['firewall']->requireNotGuest();
});
$controllers->get('/record/{base_id}/{record_id}/', 'controller.prod.share:shareRecord')
->before(function(Request $request) use ($app) {
->before(function (Request $request) use ($app) {
$app['firewall']->requireRightOnSbas(\phrasea::sbasFromBas($app, $request->attributes->get('base_id')), 'bas_chupub');
})
->bind('share_record');

View File

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

View File

@@ -29,7 +29,7 @@ class RSSFeeds implements ControllerProviderInterface
$controllers = $app['controllers_factory'];
$controllers->get('/feed/{id}/{format}/', function(Application $app, $id, $format) {
$controllers->get('/feed/{id}/{format}/', function (Application $app, $id, $format) {
$feed = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->find($id);
if (null === $feed) {
@@ -51,7 +51,7 @@ class RSSFeeds implements ControllerProviderInterface
->assert('id', '\d+')
->assert('format', '(rss|atom)');
$controllers->get('/userfeed/{token}/{id}/{format}/', function(Application $app, $token, $id, $format) {
$controllers->get('/userfeed/{token}/{id}/{format}/', function (Application $app, $token, $id, $format) {
$token = $app["EM"]->find('Alchemy\Phrasea\Model\Entities\FeedToken', $id);
$request = $app['request'];
@@ -66,7 +66,7 @@ class RSSFeeds implements ControllerProviderInterface
->assert('id', '\d+')
->assert('format', '(rss|atom)');
$controllers->get('/userfeed/aggregated/{token}/{format}/', function(Application $app, $token, $format) {
$controllers->get('/userfeed/aggregated/{token}/{format}/', function (Application $app, $token, $format) {
$token = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\AggregateToken')->findOneBy(array("value" => $token));
$user = \User_Adapter::getInstance($token->getUsrId(), $app);
@@ -85,7 +85,7 @@ class RSSFeeds implements ControllerProviderInterface
->bind('feed_user_aggregated')
->assert('format', '(rss|atom)');
$controllers->get('/aggregated/{format}/', function(Application $app, $format) {
$controllers->get('/aggregated/{format}/', function (Application $app, $format) {
$feed = Aggregate::getPublic($app);
$request = $app['request'];
@@ -97,7 +97,7 @@ class RSSFeeds implements ControllerProviderInterface
->bind('feed_public_aggregated')
->assert('format', '(rss|atom)');
$controllers->get('/cooliris/', function(Application $app) {
$controllers->get('/cooliris/', function (Application $app) {
$feed = Aggregate::getPublic($app);
$request = $app['request'];

View File

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

View File

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

View File

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

View File

@@ -23,14 +23,14 @@ class TaskManagerServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
$app['task-manager.logger'] = $app->share(function(Application $app) {
$app['task-manager.logger'] = $app->share(function (Application $app) {
$logger = new Logger('task-manager logger');
$logger->pushHandler(new NullHandler());
return $logger;
});
$app['task-manager'] = $app->share(function(Application $app) {
$app['task-manager'] = $app->share(function (Application $app) {
$options = $app['task-manager.listener.options'];
return TaskManager::create(
@@ -45,7 +45,7 @@ class TaskManagerServiceProvider implements ServiceProviderInterface
);
});
$app['task-manager.task-list'] = $app->share(function(Application $app) {
$app['task-manager.task-list'] = $app->share(function (Application $app) {
$conf = $app['phraseanet.registry']->get('GV_PHP_INI', null);
$finder = new PhpExecutableFinder();
$php = $finder->find();

View File

@@ -19,7 +19,7 @@ class ConvertersServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
$app['converter.task'] = $app->share(function($app) {
$app['converter.task'] = $app->share(function ($app) {
return new TaskConverter($app['EM']);
});
}

View File

@@ -24,29 +24,29 @@ class FeedServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
$app['feed.user-link-generator'] = $app->share(function($app) {
$app['feed.user-link-generator'] = $app->share(function ($app) {
return new FeedLinkGenerator($app['url_generator'], $app['EM'], $app['tokens']);
});
$app['feed.aggregate-link-generator'] = $app->share(function($app) {
$app['feed.aggregate-link-generator'] = $app->share(function ($app) {
return new AggregateLinkGenerator($app['url_generator'], $app['EM'], $app['tokens']);
});
$app['feed.link-generator-collection'] = $app->share(function($app) {
$app['feed.link-generator-collection'] = $app->share(function ($app) {
$collection = new LinkGeneratorCollection();
$collection->pushGenerator($app['feed.user-link-generator']);
$collection->pushGenerator($app['feed.aggregate-link-generator']);
return $collection;
});
$app['feed.rss-formatter'] = $app->share(function($app) {
$app['feed.rss-formatter'] = $app->share(function ($app) {
return new RssFormatter($app['feed.link-generator-collection']);
});
$app['feed.atom-formatter'] = $app->share(function($app) {
$app['feed.atom-formatter'] = $app->share(function ($app) {
return new AtomFormatter($app['feed.link-generator-collection']);
});
$app['feed.cooliris-formatter'] = $app->share(function($app) {
$app['feed.cooliris-formatter'] = $app->share(function ($app) {
return new CoolirisFormatter($app['feed.link-generator-collection']);
});
$app['feed.formatter-strategy'] = $app->protect(function($type) use ($app) {
$app['feed.formatter-strategy'] = $app->protect(function ($type) use ($app) {
switch ($type) {
case 'rss':
return $app['feed.rss-formatter'];

View File

@@ -21,14 +21,14 @@ class ManipulatorServiceProvider implements ServiceProviderInterface
{
public function register(SilexApplication $app)
{
$app['manipulator.task'] = $app->share(function(SilexApplication $app) {
$app['manipulator.task'] = $app->share(function (SilexApplication $app) {
return new TaskManipulator($app['EM'], $app['task-manager.notifier']);
});
$app['manipulator.user'] = $app->share(function($app) {
$app['manipulator.user'] = $app->share(function ($app) {
return new UserManipulator($app['model.user-manager'], $app['auth.password-encoder'], $app['geonames.connector']);
});
$app['model.user-manager'] = $app->share(function($app) {
$app['model.user-manager'] = $app->share(function ($app) {
return new UserManager($app['EM'], $app['phraseanet.appbox']->get_connection());
});
}

View File

@@ -43,7 +43,7 @@ class ORMServiceProvider implements ServiceProviderInterface
return new MonologSQLLogger($logger, 'yaml');
});
$app['EM.driver'] = $app->share(function(Application $app) {
$app['EM.driver'] = $app->share(function (Application $app) {
AnnotationRegistry::registerFile(
$app['root.path'].'/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
);
@@ -71,7 +71,7 @@ class ORMServiceProvider implements ServiceProviderInterface
return $driverChain;
});
$app['EM.config'] = $app->share(function(Application $app) {
$app['EM.config'] = $app->share(function (Application $app) {
$config = new ORMConfiguration();
if ($app['debug']) {
@@ -99,27 +99,27 @@ class ORMServiceProvider implements ServiceProviderInterface
return $config;
});
$app['EM.opcode-cache-type'] = $app->share(function(Application $app) {
$app['EM.opcode-cache-type'] = $app->share(function (Application $app) {
return $app['phraseanet.configuration']['main']['opcodecache']['type'];
});
$app['EM.opcode-cache-options'] = $app->share(function(Application $app) {
$app['EM.opcode-cache-options'] = $app->share(function (Application $app) {
return $app['phraseanet.configuration']['main']['opcodecache']['options'];
});
$app['EM.cache-type'] = $app->share(function(Application $app) {
$app['EM.cache-type'] = $app->share(function (Application $app) {
return $app['phraseanet.configuration']['main']['cache']['type'];
});
$app['EM.cache-options'] = $app->share(function(Application $app) {
$app['EM.cache-options'] = $app->share(function (Application $app) {
return $app['phraseanet.configuration']['main']['cache']['options'];
});
$app['EM.events-manager'] = $app->share(function(Application $app) {
$app['EM.events-manager'] = $app->share(function (Application $app) {
$evm = new EventManager();
$evm->addEventSubscriber(new TimestampableListener());
return $evm;
});
$app['EM.dbal-conf'] = $app->share(function(Application $app) {
$app['EM.dbal-conf'] = $app->share(function (Application $app) {
if ('test' === $app->getEnvironment()) {
return $app['phraseanet.configuration']['main']['database-test'];
}
@@ -127,7 +127,7 @@ class ORMServiceProvider implements ServiceProviderInterface
return $app['phraseanet.configuration']['main']['database'];
});
$app['EM'] = $app->share(function(Application $app) {
$app['EM'] = $app->share(function (Application $app) {
try {
$em = EntityManager::create($app['EM.dbal-conf'], $app['EM.config'], $app['EM.events-manager']);
} catch (\Exception $e) {

View File

@@ -31,11 +31,11 @@ class TasksServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
$app['task-manager.notifier'] = $app->share(function(Application $app) {
$app['task-manager.notifier'] = $app->share(function (Application $app) {
return Notifier::create($app['task-manager.listener.options']);
});
$app['task-manager.listener.options'] = $app->share(function(Application $app) {
$app['task-manager.listener.options'] = $app->share(function (Application $app) {
if (isset($app['phraseanet.configuration']['task-manager']) && isset($app['phraseanet.configuration']['task-manager']['listener'])) {
$listenerConf = $app['phraseanet.configuration']['task-manager']['listener'];
} else {
@@ -50,15 +50,15 @@ class TasksServiceProvider implements ServiceProviderInterface
), $listenerConf);
});
$app['task-manager.job-factory'] = $app->share(function(Application $app) {
$app['task-manager.job-factory'] = $app->share(function (Application $app) {
return new JobFactory($app['dispatcher'],isset($app['task-manager.logger']) ? $app['task-manager.logger'] : $app['logger']);
});
$app['task-manager.status'] = $app->share(function(Application $app) {
$app['task-manager.status'] = $app->share(function (Application $app) {
return new TaskManagerStatus($app['phraseanet.configuration']);
});
$app['task-manager.live-information'] = $app->share(function(Application $app) {
$app['task-manager.live-information'] = $app->share(function (Application $app) {
return new LiveInformation($app['task-manager.status'], $app['task-manager.notifier']);
});
@@ -66,11 +66,11 @@ class TasksServiceProvider implements ServiceProviderInterface
return $app['root.path'].'/logs';
});
$app['task-manager.log-file.factory'] = $app->share(function(Application $app) {
$app['task-manager.log-file.factory'] = $app->share(function (Application $app) {
return new LogFileFactory($app['task-manager.log-file.root']);
});
$app['task-manager.available-jobs'] = $app->share(function(Application $app) {
$app['task-manager.available-jobs'] = $app->share(function (Application $app) {
return array(
new FtpJob(),
new ArchiveJob(),

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Table(name="AggregateTokens")

View File

@@ -561,6 +561,7 @@ class Feed implements FeedInterface
|| in_array($coll->get_base_id(), array_keys($user->ACL()->get_granted_base()))) {
return true;
}
return false;
}
}

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Table(name="FeedTokens")

View File

@@ -13,7 +13,6 @@ namespace Alchemy\Phrasea\Model\Entities;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Alchemy\Phrasea\Application;
/**
* @ORM\Table(name="FtpCredential")

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

View File

@@ -245,7 +245,7 @@ class UsrList
public function has(\User_Adapter $user, Application $app)
{
return $this->entries->exists(
function($key, $entry) use ($user, $app) {
function ($key, $entry) use ($user, $app) {
return $entry->getUser($app)->get_id() === $user->get_id();
}
);

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Manager;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Doctrine\Common\Persistence\ObjectManager;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Entities\UserSetting;
@@ -91,13 +90,13 @@ class UserManager
*/
private function cleanSettings(User $user)
{
foreach($user->getNotificationSettings() as $userNotificationSetting) {
foreach ($user->getNotificationSettings() as $userNotificationSetting) {
$this->objectManager->remove($userNotificationSetting);
}
$user->getNotificationSettings()->clear();
foreach($user->getSettings() as $userSetting) {
foreach ($user->getSettings() as $userSetting) {
$this->objectManager->remove($userSetting);
}
@@ -111,7 +110,7 @@ class UserManager
*/
private function cleanQueries(User $user)
{
foreach($user->getQueries() as $userQuery) {
foreach ($user->getQueries() as $userQuery) {
$this->objectManager->remove($userQuery);
}
@@ -140,7 +139,7 @@ class UserManager
$elements = $this->objectManager->getRepository('Alchemy\Phrasea\Model\Entities\FtpExport')
->findBy(array('usrId' => $user->getId()));
foreach($elements as $element) {
foreach ($elements as $element) {
$this->objectManager->remove($element);
}
}
@@ -155,7 +154,7 @@ class UserManager
$orders = $this->objectManager->getRepository('Alchemy\Phrasea\Model\Entities\Order')
->findBy(array('usrId' => $user->getId()));
foreach($orders as $order) {
foreach ($orders as $order) {
$this->objectManager->remove($order);
}
}

View File

@@ -15,10 +15,8 @@ use Alchemy\Geonames\Connector as GeonamesConnector;
use Alchemy\Geonames\Exception\ExceptionInterface as GeonamesExceptionInterface;
use Alchemy\Phrasea\Model\Manager\UserManager;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Repositories\UserRepository;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
/**

View File

@@ -66,7 +66,7 @@ class FeedItemRepository extends EntityRepository
$result = $query->getResult();
foreach($result as $item) {
foreach ($result as $item) {
try {
$record = $item->getRecord($app);
} catch (NotFoundHttpException $e) {

View File

@@ -3,8 +3,6 @@
namespace Alchemy\Phrasea\Model\Repositories;
use Doctrine\ORM\EntityRepository;
use Alchemy\Phrasea\Model\Entities\Feed;
use Alchemy\Phrasea\Model\Entities\FeedPublisher;
/**
* FeedPublisherRepository

View File

@@ -2,9 +2,7 @@
namespace Alchemy\Phrasea\Model\Repositories;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\EntityRepository;
use Alchemy\Phrasea\Model\Entities\Feed;
/**
* FeedRepository

View File

@@ -15,7 +15,7 @@ class LazaretFileRepository extends EntityRepository
public function findPerPage(array $base_ids, $offset = 0, $perPage = 10)
{
$base_ids = implode(', ', array_map(function($int) {
$base_ids = implode(', ', array_map(function ($int) {
return (int) $int;
}, $base_ids));

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Model\Repositories;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\EntityRepository;
/**

View File

@@ -46,7 +46,7 @@ class StoryWZRepository extends EntityRepository
$sortedStories[] = $story->getRecord($app)->get_title();
}
uasort($sortedStories, function($a, $b) {
uasort($sortedStories, function ($a, $b) {
if ($a == $b) {
return 0;
}

View File

@@ -1061,7 +1061,7 @@ class ArchiveJob extends AbstractJob
$record = null;
$postProcess = function($element, $visa, $code) use (&$record) {
$postProcess = function ($element, $visa, $code) use (&$record) {
$record = $element;
};

View File

@@ -118,7 +118,6 @@ class FtpJob extends AbstractJob
, " (" . date('r') . ")"
) . PHP_EOL;
$this->log('debug', $line);
try {

View File

@@ -105,6 +105,7 @@ class FtpPullJob extends AbstractJob
if (!$this->isStarted()) {
$ftp->close();
$this->log('debug', "Stopping");
return;
}

View File

@@ -87,7 +87,7 @@ class WriteMetadataJob extends AbstractJob
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row ) {
foreach ($rs as $row) {
$record_id = $row['record_id'];
$jeton = $row['jeton'];

View File

@@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\TaskManager\Log;
use Alchemy\Phrasea\Model\Entities\Task;
class LogFileFactory
class LogFilefactory
{
private $root;

View File

@@ -79,6 +79,7 @@ class TaskManagerStatus
{
if (!isset($this->conf['task-manager'])) {
$this->conf['task-manager'] = array('status' => static::STATUS_STARTED);
return;
}
if (!isset($this->conf['task-manager']['status'])) {

View File

@@ -77,7 +77,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$records = array();
$postProcessRecord = function($record) use (&$records) {
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
};
@@ -87,7 +87,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$phpunit = $this;
$postProcess = function($element, $visa, $code) use ($phpunit, &$records) {
$postProcess = function ($element, $visa, $code) use ($phpunit, &$records) {
$phpunit->assertInstanceOf('\\Alchemy\Phrasea\Model\Entities\\LazaretFile', $element);
$phpunit->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Visa', $visa);
$phpunit->assertEquals(Manager::LAZARET_CREATED, $code);
@@ -96,7 +96,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(Manager::LAZARET_CREATED, $this->object->process($this->session, File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']), $postProcess));
$postProcess = function($element, $visa, $code) use ($phpunit, &$records) {
$postProcess = function ($element, $visa, $code) use ($phpunit, &$records) {
$phpunit->assertInstanceOf('\\record_adapter', $element);
$phpunit->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Visa', $visa);
$phpunit->assertEquals(Manager::RECORD_CREATED, $code);
@@ -119,7 +119,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
$records = array();
$postProcessRecord = function($record) use (&$records) {
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
};
$this->assertEquals(Manager::LAZARET_CREATED, $this->object->process($this->session, File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']), NULL, Manager::FORCE_LAZARET));
@@ -139,7 +139,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
$records = array();
$postProcessRecord = function($record) use (&$records) {
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
};
@@ -252,7 +252,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
$lazaret = null;
$postProcessRecord = function($element) use (&$lazaret) {
$postProcessRecord = function ($element) use (&$lazaret) {
$lazaret = $element;
};
@@ -384,7 +384,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$phpunit = $this;
$application = self::$DI['app'];
$postProcess = function($element, $visa, $code) use ($phpunit, $application) {
$postProcess = function ($element, $visa, $code) use ($phpunit, $application) {
$phpunit->assertInstanceOf('\\Alchemy\Phrasea\Model\Entities\\LazaretFile', $element);
/* @var $element \Alchemy\Phrasea\Model\Entities\LazaretFile */
@@ -553,7 +553,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
$records = array();
$postProcessRecord = function($record) use (&$records) {
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
};

View File

@@ -564,7 +564,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract
public function removeBadItems(Array &$item_entries, Array $available_medium)
{
$remove = function($entry_item, $key) use (&$item_entries, $available_medium) {
$remove = function ($entry_item, $key) use (&$item_entries, $available_medium) {
$preview_sd = $entry_item->getRecord()->get_subdef('preview');
$url_preview = $preview_sd->get_permalink();
$thumbnail_sd = $entry_item->getRecord()->get_thumbnail();

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Tests\Phrasea\Model\Manipulator;
use Alchemy\Phrasea\Model\Manager\UserManager;
use Alchemy\Phrasea\Model\Entities\UserNotificationSetting;
use Alchemy\Phrasea\Model\Entities\UserQuery;
use Alchemy\Phrasea\Model\Entities\UserSetting;

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Tests\Phrasea\Model\Manipulator;
use Doctrine\Common\Collections\ArrayCollection;
use Alchemy\Phrasea\Model\Manipulator\UserManipulator;
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
use Alchemy\Phrasea\Model\Entities\User;

View File

@@ -2,10 +2,6 @@
namespace Alchemy\Tests\Phrasea\Model\Repositories;
use Alchemy\Phrasea\Model\Entities\FtpExport;
use Alchemy\Phrasea\Model\Entities\FtpExportElement;
use Gedmo\Timestampable\TimestampableListener;
class FeedItemRepositoryTest extends \PhraseanetPHPUnitAbstract
{
public function testIs_record_in_public_feedInPublicFeed()

View File

@@ -47,7 +47,6 @@ class LiveInformationTest extends \PhraseanetPHPUnitAbstract
$this->assertEquals($expected, $live->getManager());
}
public function testItReturnsWorkingTaskStatus()
{
$task = new Task();

View File

@@ -8,7 +8,6 @@ use Alchemy\Phrasea\Model\Entities\AggregateToken;
use Alchemy\Phrasea\Model\Entities\Feed;
use Alchemy\Phrasea\Model\Entities\FeedEntry;
use Alchemy\Phrasea\Model\Entities\FeedItem;
use Alchemy\Phrasea\Model\Entities\FeedPublisher;
use Alchemy\Phrasea\Model\Entities\FeedToken;
use Alchemy\Phrasea\Model\Entities\Task;
use Alchemy\Phrasea\Model\Entities\User;
@@ -129,7 +128,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$phpunit = $this;
self::$DI['app'] = self::$DI->share(function($DI) use ($phpunit) {
self::$DI['app'] = self::$DI->share(function ($DI) use ($phpunit) {
$environment = 'test';
$app = require __DIR__ . '/../../lib/Alchemy/Phrasea/Application/Root.php';
@@ -137,7 +136,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
return new CsrfTestProvider();
});
$app['url_generator'] = $app->share($app->extend('url_generator', function($generator, $app) {
$app['url_generator'] = $app->share($app->extend('url_generator', function ($generator, $app) {
$host = parse_url($app['phraseanet.configuration']['main']['servername'], PHP_URL_HOST);
$generator->setContext(new RequestContext('', 'GET', $host));
@@ -146,13 +145,13 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$app['debug'] = true;
$app['EM'] = $app->share($app->extend('EM', function($em) use ($phpunit) {
$app['EM'] = $app->share($app->extend('EM', function ($em) use ($phpunit) {
$phpunit::initializeSqliteDB();
return $em;
}));
$app['browser'] = $app->share($app->extend('browser', function($browser) {
$app['browser'] = $app->share($app->extend('browser', function ($browser) {
$browser->setUserAgent(PhraseanetPHPUnitAbstract::USER_AGENT_FIREFOX8MAC);
@@ -164,21 +163,21 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
->getMock();
$app['notification.deliverer']->expects($phpunit->any())
->method('deliver')
->will($phpunit->returnCallback(function() use ($phpunit) {
->will($phpunit->returnCallback(function () use ($phpunit) {
$phpunit->fail('Notification deliverer must be mocked');
}));
return $app;
});
self::$DI['cli'] = self::$DI->share(function($DI) use ($phpunit) {
self::$DI['cli'] = self::$DI->share(function ($DI) use ($phpunit) {
$app = new CLI('cli test', null, 'test');
$app['form.csrf_provider'] = $app->share(function () {
return new CsrfTestProvider();
});
$app['url_generator'] = $app->share($app->extend('url_generator', function($generator, $app) {
$app['url_generator'] = $app->share($app->extend('url_generator', function ($generator, $app) {
$host = parse_url($app['phraseanet.configuration']['main']['servername'], PHP_URL_HOST);
$generator->setContext(new RequestContext('', 'GET', $host));
@@ -193,7 +192,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
return $em;
}));
$app['browser'] = $app->share($app->extend('browser', function($browser) {
$app['browser'] = $app->share($app->extend('browser', function ($browser) {
$browser->setUserAgent(PhraseanetPHPUnitAbstract::USER_AGENT_FIREFOX8MAC);
@@ -205,14 +204,14 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
->getMock();
$app['notification.deliverer']->expects($phpunit->any())
->method('deliver')
->will($phpunit->returnCallback(function() use ($phpunit) {
->will($phpunit->returnCallback(function () use ($phpunit) {
$phpunit->fail('Notification deliverer must be mocked');
}));
return $app;
});
self::$DI['client'] = self::$DI->share(function($DI) {
self::$DI['client'] = self::$DI->share(function ($DI) {
return new Client($DI['app'], array());
});
@@ -293,7 +292,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$purger = new Doctrine\Common\DataFixtures\Purger\ORMPurger();
$executor = new Doctrine\Common\DataFixtures\Executor\ORMExecutor(self::$DI['app']['EM'], $purger);
$executor->execute($fixtureLoader->getFixtures(), $append);
self::$DI['client'] = self::$DI->share(function($DI) {
self::$DI['client'] = self::$DI->share(function ($DI) {
return new Client($DI['app'], array());
});
}
@@ -319,7 +318,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$app['browser']->setUserAgent($user_agent);
$app->register(new \Silex\Provider\TwigServiceProvider());
$app->setupTwig();
self::$DI['client'] = self::$DI->share(function($DI) use ($app) {
self::$DI['client'] = self::$DI->share(function ($DI) use ($app) {
return new Client($app, array());
});
}
@@ -950,7 +949,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
self::$DI['collection'] = $coll;
self::$DI['collection_no_access'] = self::$DI->share(function($DI) use ($application, $databox, $collection_no_acces) {
self::$DI['collection_no_access'] = self::$DI->share(function ($DI) use ($application, $databox, $collection_no_acces) {
if (!$collection_no_acces instanceof collection) {
$collection_no_acces = collection::create($application, $databox, $application['phraseanet.appbox'], 'BIBOO', $DI['user']);
}
@@ -969,7 +968,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
return $collection_no_acces;
});
self::$DI['collection_no_access_by_status'] = self::$DI->share(function($DI) use ($application, $databox, $collection_no_acces_by_status) {
self::$DI['collection_no_access_by_status'] = self::$DI->share(function ($DI) use ($application, $databox, $collection_no_acces_by_status) {
if (!$collection_no_acces_by_status instanceof collection) {
$collection_no_acces_by_status = collection::create($application, $databox, $application['phraseanet.appbox'], 'BIBOONOACCESBYSTATUS', $DI['user']);
}
@@ -1002,7 +1001,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$logger->pushHandler(new \Monolog\Handler\NullHandler());
self::$recordsInitialized = array();
$resolvePathfile = function($i) {
$resolvePathfile = function ($i) {
$finder = new Symfony\Component\Finder\Finder();
$name = $i < 10 ? 'test00' . $i . '.*' : 'test0' . $i . '.*';
@@ -1017,7 +1016,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
};
foreach (range(1, 24) as $i) {
self::$DI['record_' . $i] = self::$DI->share(function($DI) use ($logger, $resolvePathfile, $i) {
self::$DI['record_' . $i] = self::$DI->share(function ($DI) use ($logger, $resolvePathfile, $i) {
PhraseanetPHPUnitAbstract::$recordsInitialized[] = $i;
@@ -1032,7 +1031,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
}
foreach (range(1, 2) as $i) {
self::$DI['record_story_' . $i] = self::$DI->share(function($DI) use ($i) {
self::$DI['record_story_' . $i] = self::$DI->share(function ($DI) use ($i) {
PhraseanetPHPUnitAbstract::$recordsInitialized[] = 'story_' . $i;
@@ -1040,7 +1039,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
});
}
self::$DI['record_no_access'] = self::$DI->share(function($DI) {
self::$DI['record_no_access'] = self::$DI->share(function ($DI) {
PhraseanetPHPUnitAbstract::$recordsInitialized[] = 'no_access';
@@ -1049,7 +1048,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
return \record_adapter::createFromFile($file, $DI['app']);
});
self::$DI['record_no_access_by_status'] = self::$DI->share(function($DI) {
self::$DI['record_no_access_by_status'] = self::$DI->share(function ($DI) {
PhraseanetPHPUnitAbstract::$recordsInitialized[] = 'no_access_by_status';