diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index 4a6ff71a74..9c5dbff282 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -160,7 +160,7 @@ class Application extends SilexApplication if ($this['debug'] === true) { ini_set('display_errors', 'on'); - if($this->getEnvironment() === 'dev') { + if ($this->getEnvironment() === 'dev') { ini_set('log_errors', 'on'); ini_set('error_log', __DIR__ . '/../../../logs/php_error.log'); } @@ -368,8 +368,8 @@ class Application extends SilexApplication $response = $event->getResponse(); foreach ($response->headers->getCookies(ResponseHeaderBag::COOKIES_ARRAY) as $cookie_domains) { - foreach($cookie_domains as $cookie_paths) { - foreach($cookie_paths as $cookie) { + foreach ($cookie_domains as $cookie_paths) { + foreach ($cookie_paths as $cookie) { $response->headers->removeCookie($cookie->getName(), $cookie->getPath(), $cookie->getDomain()); } } @@ -408,11 +408,12 @@ class Application extends SilexApplication return $event->getRequest()->getLocale(); } - foreach($app['bad-faith']->headerLists['accept_language']->items as $language) { + foreach ($app['bad-faith']->headerLists['accept_language']->items as $language) { $code = $language->lang.'_'.$language->sublang; - if(isset($languages[$code])) { + if (isset($languages[$code])) { $event->getRequest()->setLocale($code); + return $event->getRequest()->getLocale(); break; } @@ -499,8 +500,8 @@ class Application extends SilexApplication /** * Open user session * - * @param \Session_Authentication_Interface $auth - * @param integer $ses_id use previous phrasea session id + * @param \Session_Authentication_Interface $auth + * @param integer $ses_id use previous phrasea session id * @throws \Exception_InternalServerError */ public function openAccount(\Session_Authentication_Interface $auth, $ses_id = null) @@ -651,4 +652,3 @@ class Application extends SilexApplication $this->sessionCookieEnabled = false; } } - diff --git a/lib/Alchemy/Phrasea/Application/Api.php b/lib/Alchemy/Phrasea/Application/Api.php index bbd4e43fd9..b3a18e6c34 100644 --- a/lib/Alchemy/Phrasea/Application/Api.php +++ b/lib/Alchemy/Phrasea/Application/Api.php @@ -710,7 +710,6 @@ return call_user_func(function($environment = 'prod') { })->assert('databox_id', '\d+')->assert('story_id', '\d+'); $app->get('/stories/{any_id}/{anyother_id}/', $bad_request_exception); - /** * Route Errors */ diff --git a/lib/Alchemy/Phrasea/Application/ApiVersion.php b/lib/Alchemy/Phrasea/Application/ApiVersion.php index 5d9287b164..2561d67555 100644 --- a/lib/Alchemy/Phrasea/Application/ApiVersion.php +++ b/lib/Alchemy/Phrasea/Application/ApiVersion.php @@ -15,7 +15,6 @@ use Silex\Application as SilexApplication; use Alchemy\Phrasea\Application as PhraseaApplication; use Symfony\Component\HttpFoundation\Request; - return call_user_func(function($environment = 'prod') { $app = new PhraseaApplication($environment); diff --git a/lib/Alchemy/Phrasea/Application/Lightbox.php b/lib/Alchemy/Phrasea/Application/Lightbox.php index b8205d8ba3..f3393b1b7d 100644 --- a/lib/Alchemy/Phrasea/Application/Lightbox.php +++ b/lib/Alchemy/Phrasea/Application/Lightbox.php @@ -485,4 +485,4 @@ class Lightbox implements ControllerProviderInterface return $controllers; } -} \ No newline at end of file +} diff --git a/lib/Alchemy/Phrasea/Application/OAuth2.php b/lib/Alchemy/Phrasea/Application/OAuth2.php index ea155f48b6..25a2db9d47 100644 --- a/lib/Alchemy/Phrasea/Application/OAuth2.php +++ b/lib/Alchemy/Phrasea/Application/OAuth2.php @@ -83,7 +83,6 @@ return call_user_func(function($environment = 'prod') { $app->openAccount($auth); } catch (\Exception $e) { - return new Response($app['twig']->render($template, array("auth" => $oauth2_adapter))); } } else { diff --git a/lib/Alchemy/Phrasea/Border/Attribute/Status.php b/lib/Alchemy/Phrasea/Border/Attribute/Status.php index 4730fc20af..8125528bda 100644 --- a/lib/Alchemy/Phrasea/Border/Attribute/Status.php +++ b/lib/Alchemy/Phrasea/Border/Attribute/Status.php @@ -37,7 +37,7 @@ class Status implements AttributeInterface } else { throw new \InvalidArgumentException('Invalid status argument'); } - + $this->status = $status; } diff --git a/lib/Alchemy/Phrasea/CLI.php b/lib/Alchemy/Phrasea/CLI.php index be0a48179b..eb882f7fe7 100644 --- a/lib/Alchemy/Phrasea/CLI.php +++ b/lib/Alchemy/Phrasea/CLI.php @@ -25,10 +25,10 @@ class CLI extends Application /** * Registers the autoloader and necessary components. * - * @param string $name Name for this application. + * @param string $name Name for this application. * @param string|null $version Version number for this application. */ - function __construct($name, $version = null, $environment = null) + public function __construct($name, $version = null, $environment = null) { parent::__construct($environment); diff --git a/lib/Alchemy/Phrasea/Cache/Manager.php b/lib/Alchemy/Phrasea/Cache/Manager.php index 2af233fc74..a566838193 100644 --- a/lib/Alchemy/Phrasea/Cache/Manager.php +++ b/lib/Alchemy/Phrasea/Cache/Manager.php @@ -110,4 +110,3 @@ class Manager file_put_contents($this->cacheFile->getPathname(), $datas); } } - diff --git a/lib/Alchemy/Phrasea/Command/RecordAdd.php b/lib/Alchemy/Phrasea/Command/RecordAdd.php index 8343640418..41848ab6c8 100644 --- a/lib/Alchemy/Phrasea/Command/RecordAdd.php +++ b/lib/Alchemy/Phrasea/Command/RecordAdd.php @@ -71,6 +71,7 @@ class RecordAdd extends Command if (strtolower($continue) !== 'y') { $output->writeln('Aborted !'); + return; } diff --git a/lib/Alchemy/Phrasea/Command/Upgrade/DatasUpgraderInterface.php b/lib/Alchemy/Phrasea/Command/Upgrade/DatasUpgraderInterface.php index ad847b4cac..3e6459beac 100644 --- a/lib/Alchemy/Phrasea/Command/Upgrade/DatasUpgraderInterface.php +++ b/lib/Alchemy/Phrasea/Command/Upgrade/DatasUpgraderInterface.php @@ -32,4 +32,3 @@ interface DatasUpgraderInterface */ public function getTimeEstimation(); } - diff --git a/lib/Alchemy/Phrasea/Command/Upgrade/Step31.php b/lib/Alchemy/Phrasea/Command/Upgrade/Step31.php index 2be68a6ff1..5aea327d52 100644 --- a/lib/Alchemy/Phrasea/Command/Upgrade/Step31.php +++ b/lib/Alchemy/Phrasea/Command/Upgrade/Step31.php @@ -92,7 +92,7 @@ class Step31 implements DatasUpgraderInterface /** * Return a maximum of 100 recods without UUIDs * - * @param \databox $databox + * @param \databox $databox * @return array */ protected function getNullUUIDs(\databox $databox) @@ -115,7 +115,7 @@ class Step31 implements DatasUpgraderInterface * Update a record with a UUID * * @param \databox $databox - * @param array $record + * @param array $record */ protected function updateRecordUUID(\databox $databox, array $record) { diff --git a/lib/Alchemy/Phrasea/Command/Upgrade/Step35.php b/lib/Alchemy/Phrasea/Command/Upgrade/Step35.php index cf515efd8d..28c9944ca9 100644 --- a/lib/Alchemy/Phrasea/Command/Upgrade/Step35.php +++ b/lib/Alchemy/Phrasea/Command/Upgrade/Step35.php @@ -101,7 +101,6 @@ class Step35 implements DatasUpgraderInterface } while (count($rs) > 0); } - foreach ($this->app['phraseanet.appbox']->get_databoxes() as $databox) { $this->ensureDropMigrateColumn($databox); } @@ -133,7 +132,7 @@ class Step35 implements DatasUpgraderInterface * Update the metadatas of a record * * @param \record_adapter $record - * @param string $xml + * @param string $xml */ protected function updateMetadatas(\record_adapter $record, $xml) { @@ -200,7 +199,7 @@ class Step35 implements DatasUpgraderInterface * * @staticvar \PDO_statement $stmt * @param \databox $databox - * @param array $record + * @param array $record */ protected function setOriginalName(\databox $databox, array $record) { diff --git a/lib/Alchemy/Phrasea/Command/UpgradeDBDatas.php b/lib/Alchemy/Phrasea/Command/UpgradeDBDatas.php index fb77dd3e9e..bf724eaf22 100644 --- a/lib/Alchemy/Phrasea/Command/UpgradeDBDatas.php +++ b/lib/Alchemy/Phrasea/Command/UpgradeDBDatas.php @@ -102,7 +102,7 @@ EOF { $this->generateUpgradesFromOption($input); - if ( ! $this->upgrades) { + if (! $this->upgrades) { throw new \Exception('No upgrade available'); } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Collection.php b/lib/Alchemy/Phrasea/Controller/Admin/Collection.php index dc8490d442..9aa14487fc 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Collection.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Collection.php @@ -376,9 +376,9 @@ class Collection implements ControllerProviderInterface /** * Display collection information page * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id * @return Response */ public function getCollection(Application $app, Request $request, $bas_id) @@ -421,10 +421,10 @@ class Collection implements ControllerProviderInterface /** * Set new admin to handle orders * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return RedirectResponse */ public function setOrderAdmins(Application $app, Request $request, $bas_id) { @@ -471,9 +471,9 @@ class Collection implements ControllerProviderInterface /** * Empty a collection * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id * @return JsonResponse|RedirectResponse */ public function emptyCollection(Application $app, Request $request, $bas_id) @@ -499,7 +499,6 @@ class Collection implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $msg, @@ -513,10 +512,10 @@ class Collection implements ControllerProviderInterface /** * Delete the collection banner * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function deleteBanner(Application $app, Request $request, $bas_id) { @@ -532,7 +531,6 @@ class Collection implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $success ? _('Successful removal') : _('An error occured'), @@ -546,10 +544,10 @@ class Collection implements ControllerProviderInterface /** * Delete the collection stamp * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function deleteStamp(Application $app, Request $request, $bas_id) { @@ -565,7 +563,6 @@ class Collection implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $success ? _('Successful removal') : _('An error occured'), @@ -579,10 +576,10 @@ class Collection implements ControllerProviderInterface /** * Delete the collection watermark * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function deleteWatermark(Application $app, Request $request, $bas_id) { @@ -598,7 +595,6 @@ class Collection implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $success ? _('Successful removal') : _('An error occured'), @@ -612,10 +608,10 @@ class Collection implements ControllerProviderInterface /** * Delete the current collection logo * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function deleteLogo(Application $app, Request $request, $bas_id) { @@ -632,7 +628,6 @@ class Collection implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $success ? _('Successful removal') : _('An error occured'), @@ -646,10 +641,10 @@ class Collection implements ControllerProviderInterface /** * Set a collection banner * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return RedirectResponse */ public function setBanner(Application $app, Request $request, $bas_id) { @@ -681,10 +676,10 @@ class Collection implements ControllerProviderInterface /** * Set a collection stamp * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return RedirectResponse */ public function setStamp(Application $app, Request $request, $bas_id) { @@ -716,10 +711,10 @@ class Collection implements ControllerProviderInterface /** * Set a collection watermark * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return RedirectResponse */ public function setWatermark(Application $app, Request $request, $bas_id) { @@ -750,10 +745,10 @@ class Collection implements ControllerProviderInterface /** * Set collection minilogo * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return RedirectResponse */ public function setMiniLogo(Application $app, Request $request, $bas_id) { @@ -784,10 +779,10 @@ class Collection implements ControllerProviderInterface /** * Delete a Collection * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function delete(Application $app, Request $request, $bas_id) { @@ -810,7 +805,6 @@ class Collection implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $msg @@ -831,10 +825,10 @@ class Collection implements ControllerProviderInterface /** * Unmount a collection from application box * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function unmount(Application $app, Request $request, $bas_id) { @@ -862,10 +856,10 @@ class Collection implements ControllerProviderInterface /** * Rename a collection * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function rename(Application $app, Request $request, $bas_id) { @@ -897,10 +891,10 @@ class Collection implements ControllerProviderInterface /** * Set public presentation watermark * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function setPublicationDisplay(Application $app, Request $request, $bas_id) { @@ -932,10 +926,10 @@ class Collection implements ControllerProviderInterface /** * Enable a collection * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function enable(Application $app, Request $request, $bas_id) { @@ -963,10 +957,10 @@ class Collection implements ControllerProviderInterface /** * Disable a collection * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function disabled(Application $app, Request $request, $bas_id) { @@ -994,9 +988,9 @@ class Collection implements ControllerProviderInterface /** * Display suggested values * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id */ public function getSuggestedValues(Application $app, Request $request, $bas_id) { @@ -1035,7 +1029,7 @@ class Collection implements ControllerProviderInterface if ($ki == 'status') { $pref['status'] = $vi; - } else if ($ki != 'sugestedValues') { + } elseif ($ki != 'sugestedValues') { $pref['xml'] = $vi->asXML(); } @@ -1056,10 +1050,10 @@ class Collection implements ControllerProviderInterface /** * Register suggested values * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id + * @return JsonResponse|RedirectResponse */ public function submitSuggestedValues(Application $app, Request $request, $bas_id) { @@ -1078,7 +1072,6 @@ class Collection implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $success ? _('Successful update') : _('An error occured'), @@ -1092,9 +1085,9 @@ class Collection implements ControllerProviderInterface /** * Get document details in the requested collection * - * @param Application $app The silex application - * @param Request $request The current request - * @param integer $bas_id The collection base_id + * @param Application $app The silex application + * @param Request $request The current request + * @param integer $bas_id The collection base_id * @return Response */ public function getDetails(Application $app, Request $request, $bas_id) diff --git a/lib/Alchemy/Phrasea/Controller/Admin/ConnectedUsers.php b/lib/Alchemy/Phrasea/Controller/Admin/ConnectedUsers.php index 533bd5b0a7..70d8324663 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/ConnectedUsers.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/ConnectedUsers.php @@ -14,7 +14,6 @@ namespace Alchemy\Phrasea\Controller\Admin; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; class ConnectedUsers implements ControllerProviderInterface { @@ -27,7 +26,6 @@ class ConnectedUsers implements ControllerProviderInterface $app['firewall']->requireAccessToModule('Admin'); }); - $controllers->get('/', $this->call('listConnectedUsers')); return $controllers; @@ -74,7 +72,7 @@ class ConnectedUsers implements ControllerProviderInterface /** * Return module name according to its ID * - * @param integer $appId + * @param integer $appId * @return string * @return null */ diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php b/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php index 670ef33415..c76d4a47c2 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Dashboard.php @@ -121,9 +121,9 @@ class Dashboard implements ControllerProviderInterface /** * Display admin dashboard page * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function slash(Application $app, Request $request) { @@ -157,14 +157,13 @@ class Dashboard implements ControllerProviderInterface /** * Flush all cash services * - * @param Application $app - * @param Request $request - * @return RedirectResponse + * @param Application $app + * @param Request $request + * @return RedirectResponse */ public function flush(Application $app, Request $request) { if ($app['phraseanet.cache-service']->flushAll()) { - return $app->redirect('/admin/dashboard/?flush_cache=ok'); } @@ -174,9 +173,9 @@ class Dashboard implements ControllerProviderInterface /** * Test a mail address * - * @param Application $app - * @param Request $request - * @return RedirectResponse + * @param Application $app + * @param Request $request + * @return RedirectResponse */ public function sendMail(Application $app, Request $request) { @@ -205,9 +204,9 @@ class Dashboard implements ControllerProviderInterface /** * Reset admin rights * - * @param Application $app - * @param Request $request - * @return RedirectResponse + * @param Application $app + * @param Request $request + * @return RedirectResponse */ public function resetAdminRights(Application $app, Request $request) { @@ -219,9 +218,9 @@ class Dashboard implements ControllerProviderInterface /** * Grant to an user admin rights * - * @param Application $app - * @param Request $request - * @return RedirectResponse + * @param Application $app + * @param Request $request + * @return RedirectResponse */ public function addAdmins(Application $app, Request $request) { diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php index 9fed0d8082..0faca604c0 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php @@ -398,8 +398,8 @@ class Databox implements ControllerProviderInterface /** * - * @param \Silex\Application $app - * @param \Symfony\Component\HttpFoundation\Request $request + * @param \Silex\Application $app + * @param \Symfony\Component\HttpFoundation\Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function getDatabase(Application $app, Request $request, $databox_id) @@ -429,10 +429,10 @@ class Databox implements ControllerProviderInterface /** * Get databox CGU's * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return Response + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return Response */ public function getDatabaseCGU(Application $app, Request $request, $databox_id) { @@ -446,10 +446,10 @@ class Databox implements ControllerProviderInterface /** * Delete a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse|RedirectResponse */ public function deleteBase(Application $app, Request $request, $databox_id) { @@ -485,10 +485,10 @@ class Databox implements ControllerProviderInterface /** * Reindex databox content * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse|RedirectResponse */ public function reindex(Application $app, Request $request, $databox_id) { @@ -515,10 +515,10 @@ class Databox implements ControllerProviderInterface /** * Make a databox indexable * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse|RedirectResponse */ public function setIndexable(Application $app, Request $request, $databox_id) { @@ -545,10 +545,10 @@ class Databox implements ControllerProviderInterface /** * Update databox CGU's * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return RedirectResponse */ public function updateDatabaseCGU(Application $app, Request $request, $databox_id) { @@ -568,10 +568,10 @@ class Databox implements ControllerProviderInterface /** * Mount a collection on a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return RedirectResponse */ public function mountCollection(Application $app, Request $request, $databox_id, $collection_id) { @@ -609,10 +609,10 @@ class Databox implements ControllerProviderInterface /** * Set a new logo for a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return RedirectResponse */ public function sendLogoPdf(Application $app, Request $request, $databox_id) { @@ -639,10 +639,10 @@ class Databox implements ControllerProviderInterface /** * Delete an existing logo for a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse|RedirectResponse */ public function deleteLogoPdf(Application $app, Request $request, $databox_id) { @@ -669,10 +669,10 @@ class Databox implements ControllerProviderInterface /** * Clear databox logs * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse|RedirectResponse */ public function clearLogs(Application $app, Request $request, $databox_id) { @@ -699,10 +699,10 @@ class Databox implements ControllerProviderInterface /** * Change the name of a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse|RedirectResponse */ public function changeViewName(Application $app, Request $request, $databox_id) { @@ -733,10 +733,10 @@ class Databox implements ControllerProviderInterface /** * Unmount a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse|RedirectResponse */ public function unmountDatabase(Application $app, Request $request, $databox_id) { @@ -765,10 +765,10 @@ class Databox implements ControllerProviderInterface /** * Empty a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse|RedirectResponse */ public function emptyDatabase(Application $app, Request $request, $databox_id) { @@ -808,10 +808,10 @@ class Databox implements ControllerProviderInterface /** * Get number of indexed items for a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse */ public function progressBarInfos(Application $app, Request $request, $databox_id) { @@ -860,10 +860,10 @@ class Databox implements ControllerProviderInterface /** * Display page for reaorder collections on a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return Response + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return Response */ public function getReorder(Application $app, Request $request, $databox_id) { @@ -875,10 +875,10 @@ class Databox implements ControllerProviderInterface /** * Apply collection reorder changes * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return JsonResponse|RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return JsonResponse|RedirectResponse */ public function setReorder(Application $app, Request $request, $databox_id) { @@ -910,10 +910,10 @@ class Databox implements ControllerProviderInterface /** * Display page to create a new collection * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return Response + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return Response */ public function getNewCollection(Application $app, Request $request, $databox_id) { @@ -923,15 +923,14 @@ class Databox implements ControllerProviderInterface /** * Create a new collection * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return Response + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return Response */ public function createCollection(Application $app, Request $request, $databox_id) { if (($name = trim($request->request->get('name', ''))) === '') { - return $app->redirect('/admin/databox/' . $databox_id . '/collection/error=name'); } @@ -962,10 +961,10 @@ class Databox implements ControllerProviderInterface /** * Display page to get some details on a appbox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return Response + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return Response */ public function getDetails(Application $app, Request $request, $databox_id) { diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php index ba99422ae1..bcdc6a67f9 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php @@ -33,7 +33,6 @@ class Databoxes implements ControllerProviderInterface $app['firewall']->requireAccessToModule('admin'); }); - /** * Get Databases control panel * @@ -50,7 +49,6 @@ class Databoxes implements ControllerProviderInterface $controllers->get('/', $this->call('getDatabases')) ->bind('admin_databases'); - /** * Create Database * @@ -114,9 +112,9 @@ class Databoxes implements ControllerProviderInterface /** * Get Databases control panel * - * @param $app Application $app - * @param $request Request $request - * @return Response + * @param $app Application $app + * @param $request Request $request + * @return Response */ public function getDatabases(Application $app, Request $request) { @@ -194,10 +192,10 @@ class Databoxes implements ControllerProviderInterface /** * Create a new databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @param integer $databox_id The requested databox - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @param integer $databox_id The requested databox + * @return RedirectResponse */ public function createDatabase(Application $app, Request $request) { @@ -267,9 +265,9 @@ class Databoxes implements ControllerProviderInterface /** * Mount a databox * - * @param Application $app The silex application - * @param Request $request The current HTTP request - * @return RedirectResponse + * @param Application $app The silex application + * @param Request $request The current HTTP request + * @return RedirectResponse */ public function databaseMount(Application $app, Request $request) { @@ -299,6 +297,7 @@ class Databoxes implements ControllerProviderInterface return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1'); } catch (\Exception $e) { $app['phraseanet.appbox']->get_connection()->rollBack(); + return $app->redirect('/admin/databoxes/?success=0&error=mount-failed'); } } @@ -328,14 +327,13 @@ class Databoxes implements ControllerProviderInterface /** * Upgrade all databases * - * @param $app Application $app - * @param $request Request $request - * @return RedirectResponse + * @param $app Application $app + * @param $request Request $request + * @return RedirectResponse */ public function databasesUpgrade(Application $app, Request $request) { if (\phrasea::is_scheduler_started($app)) { - return $app->redirect('/admin/databoxes/?success=0&error=scheduler-started'); } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Description.php b/lib/Alchemy/Phrasea/Controller/Admin/Description.php index 26ce0ac2e5..51a1e5f707 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Description.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Description.php @@ -16,7 +16,6 @@ use PHPExiftool\Driver\TagProvider; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; /** * @@ -227,7 +226,6 @@ class Description implements ControllerProviderInterface $field = \databox_field::create($app, $databox, $request->request->get('newfield'), $request->request->get('newfield_multi')); } - if (is_array($request->request->get('todelete_ids'))) { foreach ($request->request->get('todelete_ids') as $id) { try { diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Setup.php b/lib/Alchemy/Phrasea/Controller/Admin/Setup.php index 9900634024..ace489dbc6 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Setup.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Setup.php @@ -77,9 +77,9 @@ class Setup implements ControllerProviderInterface /** * Display global values * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function getGlobals(Application $app, Request $request) { @@ -103,9 +103,9 @@ class Setup implements ControllerProviderInterface /** * Submit global values * - * @param Application $app - * @param Request $request - * @return RedirectResponse + * @param Application $app + * @param Request $request + * @return RedirectResponse */ public function postGlobals(Application $app, Request $request) { diff --git a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php index 782d41529b..5993dbedaf 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php @@ -32,8 +32,6 @@ class TaskManager implements ControllerProviderInterface return $app->redirect('/admin/task-manager/tasks/'); }); - - /* * route /admin/task-manager/tasks/ * tasks status in json @@ -43,7 +41,6 @@ class TaskManager implements ControllerProviderInterface $controllers->get('/tasks/', function(Application $app, Request $request) { if ($request->getContentType() == 'json') { - return $app->json($app['task-manager']->toArray()); } else { @@ -126,7 +123,6 @@ class TaskManager implements ControllerProviderInterface }, 200, array('Content-Type' => 'text/html')); }); - $controllers->get('/task/{id}/log', function(Application $app, Request $request, $id) { $logdir = \p4string::addEndSlash($app['phraseanet.registry']->get('GV_RootPath') . 'logs'); @@ -183,6 +179,7 @@ class TaskManager implements ControllerProviderInterface /* * todo : add a message back */ + return $app->redirect('/admin/task-manager/tasks/'); } }); @@ -246,7 +243,6 @@ class TaskManager implements ControllerProviderInterface return $app->json(true); } catch (\Exception $e) { - return $app->json(false); } }); @@ -279,7 +275,6 @@ class TaskManager implements ControllerProviderInterface return $app->json(true); } catch (\Exception $e) { - return new Response( 'Bad task ID', 404 // Not Found @@ -327,6 +322,7 @@ class TaskManager implements ControllerProviderInterface ); break; } + return $ret; }); @@ -339,6 +335,7 @@ class TaskManager implements ControllerProviderInterface $task = $app['task-manager']->getTask($id); $template = 'admin/task.html.twig'; + return $app['twig']->render($template, array( 'task' => $task, 'view' => 'XML' @@ -364,6 +361,7 @@ class TaskManager implements ControllerProviderInterface 412 // Precondition Failed ); } + return $ret; }); diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Users.php b/lib/Alchemy/Phrasea/Controller/Admin/Users.php index 36488d66e4..25f4ded3b2 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Users.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Users.php @@ -350,7 +350,6 @@ class Users implements ControllerProviderInterface $models = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); - $sql = " SELECT demand.date_modif,demand.base_id, usr.usr_id , usr.usr_login ,usr.usr_nom,usr.usr_prenom, usr.societe, usr.fonction, usr.usr_mail, usr.tel, usr.activite, @@ -434,7 +433,6 @@ class Users implements ControllerProviderInterface } } - if (count($templates) > 0 || count($deny) > 0 || count($accept) > 0) { $done = array(); $cache_to_update = array(); @@ -448,7 +446,6 @@ class Users implements ControllerProviderInterface $user->ACL()->apply_model($user_template, $base_ids); - if (!isset($done[$usr])) { $done[$usr] = array(); } @@ -575,7 +572,6 @@ class Users implements ControllerProviderInterface $controllers->post('/import/file/', function(Application $app, Request $request) { if ((null === $file = $request->files->get('files')) || !$file->isValid()) { - return $app->redirect('/admin/users/import/file/?error=file-invalid'); } @@ -604,12 +600,10 @@ class Users implements ControllerProviderInterface } if (!$loginDefined) { - return $app->redirect('/admin/users/import/file/?error=row-login'); } if (!$pwdDefined) { - return $app->redirect('/admin/users/import/file/?error=row-pwd'); } @@ -667,12 +661,10 @@ class Users implements ControllerProviderInterface } if (count($out['errors']) > 0) { - return $app['twig']->render('admin/user/import/file.html.twig', array( 'errors' => $out['errors'] )); - } else if ($nbUsrToAdd === 0) { - + } elseif ($nbUsrToAdd === 0) { return $app->redirect('/admin/users/import/file/?error=no-user'); } else { for ($i = 1; $i < sizeof($array); $i++) { @@ -905,4 +897,3 @@ class Users implements ControllerProviderInterface return $equivalenceToMysqlField; } } - diff --git a/lib/Alchemy/Phrasea/Controller/Datafiles.php b/lib/Alchemy/Phrasea/Controller/Datafiles.php index 581a19dd5d..066d0136c2 100644 --- a/lib/Alchemy/Phrasea/Controller/Datafiles.php +++ b/lib/Alchemy/Phrasea/Controller/Datafiles.php @@ -102,7 +102,6 @@ class Datafiles extends AbstractDelivery return $that->deliverContent($app['request'], $record, $subdef, $watermark, $stamp, $app); })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); - return $controllers; } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php index 892088258d..a6b8a24fc7 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php @@ -122,9 +122,9 @@ class Bridge implements ControllerProviderInterface $account->delete(); $success = true; - } catch(\Bridge_Exception_AccountNotFound $e) { + } catch (\Bridge_Exception_AccountNotFound $e) { $message = _('Account is not found.'); - } catch(\Exception $e) { + } catch (\Exception $e) { $message = _('Something went wrong, please contact an administrator'); } @@ -320,7 +320,6 @@ class Bridge implements ControllerProviderInterface $account->get_api()->create_container($container_type, $app['request']); } catch (\Exception $e) { - return $app->redirect('/prod/bridge/action/' . $account_id . '/' . $action . '/' . $element_type . '/?error=' . get_class($e) . ' : ' . $e->getMessage()); } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php b/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php index c35f8178de..b000fe7c6d 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php @@ -77,16 +77,15 @@ class DoDownload implements ControllerProviderInterface ->bind('execute_download') ->assert('token', '[a-zA-Z0-9]{8,16}'); - return $controllers; } /** * Prepare a set of documents for download * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function prepareDownload(Application $app, Request $request, $token) { @@ -96,21 +95,21 @@ class DoDownload implements ControllerProviderInterface $app->abort(404, 'Invalid token'); } - if (false === $list = @unserialize((string)$datas['datas'])) { + if (false === $list = @unserialize((string) $datas['datas'])) { $app->abort(500, 'Invalid datas'); } $records = array(); - foreach($list['files'] as $file) { - if(!is_array($file) || !isset($file['base_id']) || !isset($file['record_id'])) { + foreach ($list['files'] as $file) { + if (!is_array($file) || !isset($file['base_id']) || !isset($file['record_id'])) { continue; } $sbasId = \phrasea::sbasFromBas($app, $file['base_id']); try { $record = new \record_adapter($app, $sbasId, $file['record_id']); - } catch (\Exception $e){ + } catch (\Exception $e) { continue; } @@ -131,9 +130,9 @@ class DoDownload implements ControllerProviderInterface /** * Download a set of documents * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function downloadDocuments(Application $app, Request $request, $token) { @@ -149,7 +148,7 @@ class DoDownload implements ControllerProviderInterface $exportName = $list['export_name']; - if($list['count'] === 1) { + if ($list['count'] === 1) { $file = end($list['files']); $subdef = end($file['subdefs']); $exportName = sprintf('%s%s.%s', $file['export_name'], $subdef['ajout'], $subdef['exportExt']); @@ -161,7 +160,7 @@ class DoDownload implements ControllerProviderInterface $mime = 'application/zip'; } - if(!$app['filesystem']->exists($exportFile)) { + if (!$app['filesystem']->exists($exportFile)) { $app->abort(404, 'Download file not found'); } @@ -186,13 +185,12 @@ class DoDownload implements ControllerProviderInterface return $response; } - /** * Build a zip of downloaded documents * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function downloadExecute(Application $app, Request $request, $token) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Download.php b/lib/Alchemy/Phrasea/Controller/Prod/Download.php index 0612f35e50..d0691f1470 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Download.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Download.php @@ -52,9 +52,9 @@ class Download implements ControllerProviderInterface /** * Download a set of documents * - * @param Application $app - * @param Request $request - * @return RedirectResponse + * @param Application $app + * @param Request $request + * @return RedirectResponse */ public function checkDownload(Application $app, Request $request) { @@ -64,7 +64,7 @@ class Download implements ControllerProviderInterface $download = new \set_export($app, $lst, $ssttid); - if(0 === $download->get_total_download()) { + if (0 === $download->get_total_download()) { $app->abort(403); } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php index 0b9dce0aaa..d091385fc8 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php @@ -85,7 +85,6 @@ class Edit implements ControllerProviderInterface } } - /** * generate javascript sugg values */ @@ -117,7 +116,6 @@ class Edit implements ControllerProviderInterface unset($collection); } - /** * generate javascript status */ @@ -402,8 +400,6 @@ class Edit implements ControllerProviderInterface } } - - return $app['twig']->render('prod/actions/edit_default.html.twig', array('edit' => $editing, 'message' => '')); }); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Export.php b/lib/Alchemy/Phrasea/Controller/Prod/Export.php index 08195f8570..d30d5f4b8f 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Export.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Export.php @@ -106,9 +106,9 @@ class Export implements ControllerProviderInterface /** * Display form to export documents * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function displayMultiExport(Application $app, Request $request) { @@ -131,9 +131,9 @@ class Export implements ControllerProviderInterface /** * Test a FTP connexion * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function testFtpConnexion(Application $app, Request $request) { @@ -160,9 +160,9 @@ class Export implements ControllerProviderInterface /** * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function exportFtp(Application $app, Request $request) { @@ -210,7 +210,6 @@ class Export implements ControllerProviderInterface 'message' => _('Export saved in the waiting queue') )); } catch (\Exception $e) { - return $app->json(array( 'success' => false, 'message' => _('Something went wrong') @@ -221,8 +220,8 @@ class Export implements ControllerProviderInterface /** * Export document by mail * - * @param Application $app - * @param Request $request + * @param Application $app + * @param Request $request * @return JsonResponse */ public function exportMail(Application $app, Request $request) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php index db0ed07b60..a4fe0dd12f 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php @@ -401,7 +401,7 @@ class Lazaret implements ControllerProviderInterface * Empty lazaret * * @param Application $app - * @param Request $request + * @param Request $request * * @return Response */ @@ -516,7 +516,6 @@ class Lazaret implements ControllerProviderInterface /* @var $lazaretFile \Entities\LazaretFile */ if (null === $lazaretFile) { - return new Response(null, 404); } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php index 69c438f231..6bf550e449 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php @@ -72,11 +72,13 @@ class MoveCollection implements ControllerProviderInterface try { if (null === $request->request->get('base_id')) { $datas['message'] = _('Missing target collection'); + return $app->json($datas); } if (!$app['phraseanet.user']->ACL()->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) { $datas['message'] = sprintf(_("You do not have the permission to move records to %s"), \phrasea::bas_names($move->getBaseIdDestination(), $app)); + return $app->json($datas); } @@ -84,6 +86,7 @@ class MoveCollection implements ControllerProviderInterface $collection = \collection::get_from_base_id($app, $request->request->get('base_id')); } catch (\Exception_Databox_CollectionNotFound $e) { $datas['message'] = _('Invalid target collection'); + return $app->json($datas); } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Order.php b/lib/Alchemy/Phrasea/Controller/Prod/Order.php index 8fff8a7e1d..c7533072ea 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Order.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Order.php @@ -141,10 +141,10 @@ class Order implements ControllerProviderInterface /** * Create a new order * - * @param Application $app - * @param Request $request - * @param integer $order_id - * @return RedirectResponse|JsonResponse + * @param Application $app + * @param Request $request + * @param integer $order_id + * @return RedirectResponse|JsonResponse */ public function createOrder(Application $app, Request $request) { @@ -203,7 +203,6 @@ class Order implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $msg, @@ -219,10 +218,10 @@ class Order implements ControllerProviderInterface /** * Display list of orders * - * @param Application $app - * @param Request $request - * @param integer $order_id - * @return Response + * @param Application $app + * @param Request $request + * @param integer $order_id + * @return Response */ public function displayOrders(Application $app, Request $request) { @@ -249,10 +248,10 @@ class Order implements ControllerProviderInterface /** * Display a single order identified by its id * - * @param Application $app - * @param Request $request - * @param integer $order_id - * @return Response + * @param Application $app + * @param Request $request + * @param integer $order_id + * @return Response */ public function displayOneOrder(Application $app, Request $request, $order_id) { @@ -270,10 +269,10 @@ class Order implements ControllerProviderInterface /** * Send an order * - * @param Application $app - * @param Request $request - * @param integer $order_id - * @return RedirectResponse|JsonResponse + * @param Application $app + * @param Request $request + * @param integer $order_id + * @return RedirectResponse|JsonResponse */ public function sendOrder(Application $app, Request $request, $order_id) { @@ -293,7 +292,6 @@ class Order implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $success ? _('Order has been sent') : _('An error occured while sending, please retry or contact an admin if problem persists'), @@ -310,10 +308,10 @@ class Order implements ControllerProviderInterface /** * Deny an order * - * @param Application $app - * @param Request $request - * @param integer $order_id - * @return RedirectResponse|JsonResponse + * @param Application $app + * @param Request $request + * @param integer $order_id + * @return RedirectResponse|JsonResponse */ public function denyOrder(Application $app, Request $request, $order_id) { @@ -333,7 +331,6 @@ class Order implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( 'success' => $success, 'msg' => $success ? _('Order has been denied') : _('An error occured while denying, please retry or contact an admin if problem persists'), diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Property.php b/lib/Alchemy/Phrasea/Controller/Prod/Property.php index f9f4b75121..57605c84a2 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Property.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Property.php @@ -102,9 +102,9 @@ class Property implements ControllerProviderInterface /** * Display Status property * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function displayStatusProperty(Application $app, Request $request) { @@ -162,9 +162,9 @@ class Property implements ControllerProviderInterface /** * Display type property * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function displayTypeProperty(Application $app, Request $request) { @@ -200,9 +200,9 @@ class Property implements ControllerProviderInterface /** * Change record status * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function changeStatus(Application $app, Request $request) { @@ -235,8 +235,8 @@ class Property implements ControllerProviderInterface /** * Change record type * - * @param Application $app - * @param Request $request + * @param Application $app + * @param Request $request * @return type */ public function changeType(Application $app, Request $request) @@ -265,9 +265,9 @@ class Property implements ControllerProviderInterface /** * Set new status to selected record * - * @param \record_adapter $record - * @param array $postStatus - * @return array|null + * @param \record_adapter $record + * @param array $postStatus + * @return array|null */ private function updateRecordStatus(\record_adapter $record, Array $postStatus) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php index 4930639b3d..c6513e642d 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -88,9 +88,9 @@ class Query implements ControllerProviderInterface /** * Query Phraseanet to fetch records * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function query(Application $app, Request $request) { @@ -244,9 +244,9 @@ class Query implements ControllerProviderInterface /** * Get a preview answer train * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function queryAnswerTrain(Application $app, Request $request) { @@ -277,9 +277,9 @@ class Query implements ControllerProviderInterface /** * Get a preview reg train * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function queryRegTrain(Application $app, Request $request) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Records.php b/lib/Alchemy/Phrasea/Controller/Prod/Records.php index 4f9464b19c..12c9dfac7d 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Records.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Records.php @@ -103,15 +103,15 @@ class Records implements ControllerProviderInterface /** * Get record detailed view * - * @param Application $app - * @param Request $request - * @param integer $sbas_id - * @param integer $record_id - * @return JsonResponse + * @param Application $app + * @param Request $request + * @param integer $sbas_id + * @param integer $record_id + * @return JsonResponse */ public function getRecord(Application $app, Request $request) { - if(!$request->isXmlHttpRequest()){ + if (!$request->isXmlHttpRequest()) { $app->abort(400); } @@ -195,9 +195,9 @@ class Records implements ControllerProviderInterface /** * Delete a record or a list of records * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function doDeleteRecords(Application $app, Request $request) { @@ -240,9 +240,9 @@ class Records implements ControllerProviderInterface /** * Delete a record or a list of records * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function whatCanIDelete(Application $app, Request $request) { @@ -258,11 +258,11 @@ class Records implements ControllerProviderInterface /** * Renew url list of records * - * @param Application $app - * @param Request $request - * @param integer $databox_id - * @param integer $record_id - * @return JsonResponse + * @param Application $app + * @param Request $request + * @param integer $databox_id + * @param integer $record_id + * @return JsonResponse */ public function renewUrl(Application $app, Request $request) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Share.php b/lib/Alchemy/Phrasea/Controller/Prod/Share.php index a446c1138c..5b4aa1668b 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Share.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Share.php @@ -55,11 +55,11 @@ class Share implements ControllerProviderInterface /** * Share a record * - * @param Application $app - * @param Request $request - * @param integer $base_id - * @param integer $record_id - * @return Response + * @param Application $app + * @param Request $request + * @param integer $base_id + * @param integer $record_id + * @return Response */ public function shareRecord(Application $app, Request $request, $base_id, $record_id) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/TOU.php b/lib/Alchemy/Phrasea/Controller/Prod/TOU.php index b51852116a..980483f4c1 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/TOU.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/TOU.php @@ -70,9 +70,9 @@ class TOU implements ControllerProviderInterface /** * Deny database terms of use * - * @param Application $app - * @param Request $request - * @param integer $sbas_id + * @param Application $app + * @param Request $request + * @param integer $sbas_id * @return JsonResponse */ public function denyTermsOfUse(Application $app, Request $request, $sbas_id) @@ -100,9 +100,9 @@ class TOU implements ControllerProviderInterface /** * Display database terms of use * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function displayTermsOfUse(Application $app, Request $request) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php index f37b97a6e8..5ffe916d50 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php @@ -129,7 +129,6 @@ class Tools implements ControllerProviderInterface $tempoFile = $tempoFile . DIRECTORY_SEPARATOR . $fileName; copy($file->getPathname(), $tempoFile); - try { $record = new \record_adapter( $app, diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php index a3063affe2..955b11889f 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php @@ -136,7 +136,7 @@ class Tooltip implements ControllerProviderInterface try { $document = $record->get_subdef('document'); - } catch(\Exception $e) { + } catch (\Exception $e) { $document = null; } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php index 2d26aef41f..02a3cc9fc0 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php @@ -293,7 +293,7 @@ class Upload implements ControllerProviderInterface /** * Get current user's granted collections where he can upload * - * @param \User_Adapter $user + * @param \User_Adapter $user * @return array */ private function getGrantedCollections(\User_Adapter $user) diff --git a/lib/Alchemy/Phrasea/Controller/RecordsRequest.php b/lib/Alchemy/Phrasea/Controller/RecordsRequest.php index ea5c7435db..02c1e38bcf 100644 --- a/lib/Alchemy/Phrasea/Controller/RecordsRequest.php +++ b/lib/Alchemy/Phrasea/Controller/RecordsRequest.php @@ -26,10 +26,10 @@ class RecordsRequest extends ArrayCollection /** * Constructor * - * @param array $elements + * @param array $elements * @param ArrayCollection $received - * @param Basket $basket - * @param Boolean $flatten + * @param Basket $basket + * @param Boolean $flatten */ public function __construct(array $elements, ArrayCollection $received, Basket $basket = null, $flatten = false) { @@ -184,11 +184,11 @@ class RecordsRequest extends ArrayCollection /** * Create a new RecordRequest from current request * - * @param Application $app - * @param Request $request - * @param boolean $flattenStories - * @param array $rightsColl - * @param array $rightsDatabox + * @param Application $app + * @param Request $request + * @param boolean $flattenStories + * @param array $rightsColl + * @param array $rightsDatabox * @return RecordsRequest */ public static function fromRequest(Application $app, Request $request, $flattenStories = false, array $rightsColl = array(), array $rightsDatabox = array()) diff --git a/lib/Alchemy/Phrasea/Controller/Root/Account.php b/lib/Alchemy/Phrasea/Controller/Root/Account.php index 99040e9411..c2e5afaee8 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Account.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Account.php @@ -227,9 +227,9 @@ class Account implements ControllerProviderInterface /** * Reset Password * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function resetPassword(Application $app, Request $request) { @@ -255,9 +255,9 @@ class Account implements ControllerProviderInterface /** * Reset Email * - * @param Application $app - * @param Request $request - * @return RedirectResponse + * @param Application $app + * @param Request $request + * @return RedirectResponse */ public function resetEmail(Application $app, Request $request) { @@ -270,7 +270,6 @@ class Account implements ControllerProviderInterface return $app->redirect('/account/reset-email/?update=ok'); } catch (\Exception $e) { - return $app->redirect('/account/reset-email/?update=ko'); } } @@ -316,9 +315,9 @@ class Account implements ControllerProviderInterface /** * Display reset email form * - * @param Application $app - * @param Request $request - * @return Response + * @param Application $app + * @param Request $request + * @return Response */ public function displayResetEmailForm(Application $app, Request $request) { @@ -362,9 +361,9 @@ class Account implements ControllerProviderInterface /** * Submit the new password * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return RedirectResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return RedirectResponse */ public function renewPassword(Application $app, Request $request) { @@ -393,9 +392,9 @@ class Account implements ControllerProviderInterface /** * Display authorized applications that can access user informations * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return JsonResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return JsonResponse */ public function grantAccess(Application $app, Request $request, $application_id) { @@ -423,9 +422,9 @@ class Account implements ControllerProviderInterface /** * Display account base access * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function accountAccess(Application $app, Request $request) { @@ -439,9 +438,9 @@ class Account implements ControllerProviderInterface /** * Display authorized applications that can access user informations * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function accountAuthorizedApps(Application $app, Request $request) { @@ -453,9 +452,9 @@ class Account implements ControllerProviderInterface /** * Display account session accesss * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function accountSessionsAccess(Application $app, Request $request) { @@ -473,9 +472,9 @@ class Account implements ControllerProviderInterface /** * Display account form * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function displayAccount(Application $app, Request $request) { @@ -508,8 +507,8 @@ class Account implements ControllerProviderInterface /** * Update account informations * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request * @return Response */ public function updateAccount(Application $app, Request $request) diff --git a/lib/Alchemy/Phrasea/Controller/Root/Developers.php b/lib/Alchemy/Phrasea/Controller/Root/Developers.php index 15662f9462..4befdba149 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Developers.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Developers.php @@ -49,8 +49,6 @@ class Developers implements ControllerProviderInterface $controllers->get('/applications/', $this->call('listApps')) ->bind('developers_applications'); - - /** * Get the form to create a new application * @@ -83,7 +81,6 @@ class Developers implements ControllerProviderInterface $controllers->post('/application/', $this->call('newApp')) ->bind('submit_developers_application'); - /** * Get application information * @@ -176,10 +173,10 @@ class Developers implements ControllerProviderInterface /** * Delete application * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @param integer $id The application id - * @return JsonResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @param integer $id The application id + * @return JsonResponse */ public function deleteApp(Application $app, Request $request, $id) { @@ -202,10 +199,10 @@ class Developers implements ControllerProviderInterface /** * Change application callback * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @param integer $id The application id - * @return JsonResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @param integer $id The application id + * @return JsonResponse */ public function renewAppCallback(Application $app, Request $request, $id) { @@ -233,10 +230,10 @@ class Developers implements ControllerProviderInterface /** * Authorize application to use a grant password type * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @param integer $id The application id - * @return JsonResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @param integer $id The application id + * @return JsonResponse */ public function renewAccessToken(Application $app, Request $request, $id) { @@ -270,10 +267,10 @@ class Developers implements ControllerProviderInterface /** * Authorize application to use a grant password type * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @param integer $id The application id - * @return JsonResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @param integer $id The application id + * @return JsonResponse */ public function authorizeGrantpassword(Application $app, Request $request, $id) { @@ -296,9 +293,9 @@ class Developers implements ControllerProviderInterface /** * Create a new developer applications * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function newApp(Application $app, Request $request) { @@ -332,9 +329,9 @@ class Developers implements ControllerProviderInterface /** * List of apps created by the user * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function listApps(Application $app, Request $request) { @@ -346,9 +343,9 @@ class Developers implements ControllerProviderInterface /** * Display form application * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function displayFormApp(Application $app, Request $request) { @@ -362,10 +359,10 @@ class Developers implements ControllerProviderInterface /** * Get application information * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @param integer $id The application id - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @param integer $id The application id + * @return Response */ public function getApp(Application $app, Request $request, $id) { diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index df7d22a43a..8e6e97fb67 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -44,8 +44,6 @@ class Login implements ControllerProviderInterface } }); - - /** * Login * @@ -227,9 +225,9 @@ class Login implements ControllerProviderInterface /** * Send a confirmation mail after register * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return RedirectResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return RedirectResponse */ public function sendConfirmMail(Application $app, Request $request) { @@ -268,9 +266,9 @@ class Login implements ControllerProviderInterface /** * Validation of email adress * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return RedirectResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return RedirectResponse */ public function registerConfirm(Application $app, Request $request) { @@ -321,9 +319,9 @@ class Login implements ControllerProviderInterface /** * Submit the new password * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return RedirectResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return RedirectResponse */ public function renewPassword(Application $app, Request $request) { @@ -358,13 +356,10 @@ class Login implements ControllerProviderInterface && (null !== $passwordConfirm = $request->request->get('form_password_confirm'))) { if ($password !== $passwordConfirm) { - return $app->redirect($app['url_generator']->generate('login_forgot_password', array('pass-error' => 'pass-match'))); } elseif (strlen(trim($password)) < 8) { - return $app->redirect($app['url_generator']->generate('login_forgot_password', array('pass-error' => 'pass-short'))); } elseif (trim($password) !== str_replace(array("\r\n", "\n", "\r", "\t", " "), "_", $password)) { - return $app->redirect($app['url_generator']->generate('login_forgot_password', array('pass-error' => 'pass-invalid'))); } @@ -386,9 +381,9 @@ class Login implements ControllerProviderInterface /** * Get the fogot password form * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function displayForgotPasswordForm(Application $app, Request $request) { @@ -457,9 +452,9 @@ class Login implements ControllerProviderInterface /** * Get the register form * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function displayRegisterForm(Application $app, Request $request) { @@ -521,8 +516,6 @@ class Login implements ControllerProviderInterface } } - - $arrayVerif = $this->getRegisterFieldConfiguration($app); return $app['twig']->render('login/register.html.twig', array( @@ -539,9 +532,9 @@ class Login implements ControllerProviderInterface /** * Do the registration * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return RedirectResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return RedirectResponse */ public function register(Application $app, Request $request) { @@ -724,9 +717,9 @@ class Login implements ControllerProviderInterface /** * Logout from Phraseanet * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return RedirectResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return RedirectResponse */ public function logout(PhraseaApplication $app, Request $request) { @@ -748,9 +741,9 @@ class Login implements ControllerProviderInterface /** * Login into Phraseanet * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return Response + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return Response */ public function login(Application $app, Request $request) { @@ -862,9 +855,9 @@ class Login implements ControllerProviderInterface /** * Authenticate to phraseanet * - * @param Application $app A Silex application where the controller is mounted on - * @param Request $request The current request - * @return RedirectResponse + * @param Application $app A Silex application where the controller is mounted on + * @param Request $request The current request + * @return RedirectResponse */ public function authenticate(Application $app, Request $request) { @@ -1067,7 +1060,7 @@ class Login implements ControllerProviderInterface /** * Get required fields configuration * - * @param Application $app + * @param Application $app * @return boolean */ private function getRegisterFieldConfiguration(Application $app) diff --git a/lib/Alchemy/Phrasea/Controller/Root/Session.php b/lib/Alchemy/Phrasea/Controller/Root/Session.php index 24f13fa8df..bd7adb305f 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Session.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Session.php @@ -45,13 +45,13 @@ class Session implements ControllerProviderInterface /** * Check session state * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function updateSession(Application $app, Request $request) { - if(!$request->isXmlHttpRequest()) { + if (!$request->isXmlHttpRequest()) { $app->abort(400); } @@ -66,10 +66,12 @@ class Session implements ControllerProviderInterface $usr_id = $app['phraseanet.user']->get_id(); if ($usr_id != $request->request->get('usr')) { // I logged with another user $ret['status'] = 'disconnected'; + return $app->json($ret); } } else { $ret['status'] = 'disconnected'; + return $app->json($ret); } @@ -81,6 +83,7 @@ class Session implements ControllerProviderInterface if ($moduleId = (int) $request->request->get('module') < 1) { $ret['message'] = 'Missing or Invalid `module` parameter'; + return $app->json($ret); } @@ -121,7 +124,6 @@ class Session implements ControllerProviderInterface return $app->json($ret); } - /** * Prefix the method to call with the controller class name * diff --git a/lib/Alchemy/Phrasea/Controller/User/Notifications.php b/lib/Alchemy/Phrasea/Controller/User/Notifications.php index d48316bc32..6cb4e83778 100644 --- a/lib/Alchemy/Phrasea/Controller/User/Notifications.php +++ b/lib/Alchemy/Phrasea/Controller/User/Notifications.php @@ -68,9 +68,9 @@ class Notifications implements ControllerProviderInterface /** * Set notifications as readed * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function readNotifications(Application $app, Request $request) { @@ -86,7 +86,6 @@ class Notifications implements ControllerProviderInterface return $app->json(array('success' => true, 'message' => '')); } catch (\Exception $e) { - return $app->json(array('success' => false, 'message' => $e->getMessage())); } } @@ -94,9 +93,9 @@ class Notifications implements ControllerProviderInterface /** * Get all notifications * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function listNotifications(Application $app, Request $request) { @@ -105,6 +104,7 @@ class Notifications implements ControllerProviderInterface } $page = (int) $request->query->get('page', 1); + return $app->json($app['events-manager']->get_json_notifications(($page < 1 ? 1 : $page))); } diff --git a/lib/Alchemy/Phrasea/Controller/User/Preferences.php b/lib/Alchemy/Phrasea/Controller/User/Preferences.php index 1299f12e7b..78b3993243 100644 --- a/lib/Alchemy/Phrasea/Controller/User/Preferences.php +++ b/lib/Alchemy/Phrasea/Controller/User/Preferences.php @@ -68,9 +68,9 @@ class Preferences implements ControllerProviderInterface /** * Save temporary user preferences * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function saveTemporaryPref(Application $app, Request $request) { @@ -95,9 +95,9 @@ class Preferences implements ControllerProviderInterface /** * Save user preferenes * - * @param Application $app - * @param Request $request - * @return JsonResponse + * @param Application $app + * @param Request $request + * @return JsonResponse */ public function saveUserPref(Application $app, Request $request) { diff --git a/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php b/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php index a32d8da427..c7c59efdf7 100644 --- a/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php +++ b/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php @@ -30,7 +30,7 @@ class ConnectionTest implements ControllerProviderInterface * @todo : check this as it would lead to a security issue */ $controllers->get('/mysql/', function(Application $app) { - + $request = $app['request']; $hostname = $request->query->get('hostname', '127.0.0.1'); $port = (int) $request->query->get('port', 3306); diff --git a/lib/Alchemy/Phrasea/Core/Configuration.php b/lib/Alchemy/Phrasea/Core/Configuration.php index 8087a40a43..246dfbb155 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration.php +++ b/lib/Alchemy/Phrasea/Core/Configuration.php @@ -42,12 +42,12 @@ class Configuration /** * * @param ApplicationSpecification $specifications - * @param type $environment + * @param type $environment * @return Configuration */ public static function build($specifications = null, $environment = null) { - if ( ! $specifications) { + if (! $specifications) { $specifications = new ApplicationSpecification(); } @@ -56,8 +56,8 @@ class Configuration /** * - * @param SpecificationInterface $specifications - * @param type $environment + * @param SpecificationInterface $specifications + * @param type $environment * @return Configuration */ public function __construct(SpecificationInterface $specifications, $environment = null) @@ -104,7 +104,6 @@ class Configuration */ public function getEnvironnement() { - return $this->environment; } diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/Logout.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/Logout.php index 451e7da872..51ab856ac5 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/Logout.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/Logout.php @@ -29,4 +29,4 @@ class Logout implements EventSubscriberInterface PhraseaEvents::LOGOUT => 'onLogout', ); } -} \ No newline at end of file +} diff --git a/lib/Alchemy/Phrasea/Core/Provider/TaskManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/TaskManagerServiceProvider.php index 748d950d88..4f9da534e6 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/TaskManagerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/TaskManagerServiceProvider.php @@ -26,6 +26,7 @@ class TaskManagerServiceProvider implements ServiceProviderInterface ->getService($app['phraseanet.configuration']->getTaskManager()); $service = Builder::create($app, $configuration); + return $service->getDriver(); }); } diff --git a/lib/Alchemy/Phrasea/Core/Service/Border/BorderManager.php b/lib/Alchemy/Phrasea/Core/Service/Border/BorderManager.php index 8d3be79d76..20cf7a48ae 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Border/BorderManager.php +++ b/lib/Alchemy/Phrasea/Core/Service/Border/BorderManager.php @@ -48,7 +48,7 @@ class BorderManager extends ServiceAbstract $registeredCheckers = array(); - if ( ! ! $options['enabled']) { + if (! ! $options['enabled']) { foreach ($options['checkers'] as $checker) { if ( ! isset($checker['type'])) { diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php index 15e7cfd0d4..d527a47744 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php @@ -29,7 +29,7 @@ class ApcCache extends ServiceAbstract throw new \Exception('The APC cache requires the APC extension.'); } - if ( ! $this->cache) { + if (! $this->cache) { $this->cache = new CacheDriver\ApcCache(); $this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../'))); @@ -43,4 +43,3 @@ class ApcCache extends ServiceAbstract return 'apc'; } } - diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/ArrayCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/ArrayCache.php index 5e66465e8f..81b2a52eb6 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Cache/ArrayCache.php +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/ArrayCache.php @@ -26,7 +26,7 @@ class ArrayCache extends ServiceAbstract public function getDriver() { - if ( ! $this->cache) { + if (! $this->cache) { $this->cache = new CacheDriver\ArrayCache(); $this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../'))); @@ -40,4 +40,3 @@ class ArrayCache extends ServiceAbstract return 'array'; } } - diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php index 7cf4ea8907..b2a88b5021 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php @@ -43,7 +43,7 @@ class MemcacheCache extends ServiceAbstract throw new \Exception('The Memcache cache requires the Memcache extension.'); } - if ( ! $this->cache) { + if (! $this->cache) { $memcache = new \Memcache(); $memcache->addServer($this->host, $this->port); @@ -80,4 +80,3 @@ class MemcacheCache extends ServiceAbstract return $this->port; } } - diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php index 39904c473b..82673f98c5 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php @@ -47,7 +47,7 @@ class RedisCache extends ServiceAbstract throw new \Exception('The Redis cache requires the Redis extension.'); } - if ( ! $this->cache) { + if (! $this->cache) { $redis = new \Redis(); if ($redis->connect($this->host, $this->port)) { @@ -81,4 +81,3 @@ class RedisCache extends ServiceAbstract return $this->port; } } - diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/WinCacheCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/WinCacheCache.php index 2125ef7c59..2aca1f80a7 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Cache/WinCacheCache.php +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/WinCacheCache.php @@ -32,7 +32,7 @@ class WinCacheCache extends ServiceAbstract throw new \Exception('The WinCache cache requires the WinCache extension.'); } - if ( ! $this->cache) { + if (! $this->cache) { $this->cache = new CacheDriver\WinCacheCache(); $this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../'))); @@ -46,4 +46,3 @@ class WinCacheCache extends ServiceAbstract return 'wincache'; } } - diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/XcacheCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/XcacheCache.php index fd9f950acb..154c48e766 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Cache/XcacheCache.php +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/XcacheCache.php @@ -29,7 +29,7 @@ class XcacheCache extends ServiceAbstract throw new \Exception('The XCache cache requires the XCache extension.'); } - if ( ! $this->cache) { + if (! $this->cache) { $this->cache = new CacheDriver\XcacheCache(); $this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../'))); diff --git a/lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php b/lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php index 5176e27b10..0532a7550c 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php +++ b/lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php @@ -26,7 +26,7 @@ class FirePHP extends ServiceAbstract public function getDriver() { - if ( ! $this->logger) { + if (! $this->logger) { $this->logger = new Logger('FirePHP'); $this->logger->pushHandler(new FirePHPHandler()); diff --git a/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php b/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php index 0477661032..f02c849153 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php +++ b/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php @@ -44,7 +44,7 @@ class Monolog extends ServiceAbstract //defaut to main handler $handler = isset($options["handler"]) ? $options["handler"] : false; - if ( ! $handler) { + if (! $handler) { throw new \Exception(sprintf( "You must specify at least one handler for '%s' service" , __CLASS__ @@ -117,4 +117,3 @@ class Monolog extends ServiceAbstract return array('channel', 'handler', 'filename'); } } - diff --git a/lib/Alchemy/Phrasea/Helper/Prod.php b/lib/Alchemy/Phrasea/Helper/Prod.php index 235f30c4ed..6f29c3f336 100644 --- a/lib/Alchemy/Phrasea/Helper/Prod.php +++ b/lib/Alchemy/Phrasea/Helper/Prod.php @@ -29,7 +29,7 @@ class Prod extends Helper $bases = $fields = $dates = array(); - if ( ! $this->app['phraseanet.user'] instanceof \User_Adapter) { + if (! $this->app['phraseanet.user'] instanceof \User_Adapter) { return $search_datas; } @@ -80,7 +80,7 @@ class Prod extends Helper } } - if ( ! $bases[$sbas_id]['thesaurus']) { + if (! $bases[$sbas_id]['thesaurus']) { continue; } if ( ! $this->app['phraseanet.user']->ACL()->has_right_on_sbas($sbas_id, 'bas_modif_th')) { diff --git a/lib/Alchemy/Phrasea/Helper/WorkZone.php b/lib/Alchemy/Phrasea/Helper/WorkZone.php index 0f4dc60c7a..5bf44316a9 100644 --- a/lib/Alchemy/Phrasea/Helper/WorkZone.php +++ b/lib/Alchemy/Phrasea/Helper/WorkZone.php @@ -65,4 +65,3 @@ class WorkZone extends Helper $tmp_baskets = array(); } } - diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Audio.php b/lib/Alchemy/Phrasea/Media/Subdef/Audio.php index 5ba30bd0e2..4298130681 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/Audio.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/Audio.php @@ -49,7 +49,7 @@ class Audio extends Provider public function getMediaAlchemystSpec() { - if ( ! $this->spec) { + if (! $this->spec) { $this->spec = new \MediaAlchemyst\Specification\Audio(); } diff --git a/lib/Alchemy/Phrasea/Media/Subdef/FlexPaper.php b/lib/Alchemy/Phrasea/Media/Subdef/FlexPaper.php index b4833182c9..b9e1dfe71e 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/FlexPaper.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/FlexPaper.php @@ -38,7 +38,7 @@ class FlexPaper extends Provider public function getMediaAlchemystSpec() { - if ( ! $this->spec) { + if (! $this->spec) { $this->spec = new \MediaAlchemyst\Specification\Flash(); } diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Gif.php b/lib/Alchemy/Phrasea/Media/Subdef/Gif.php index 094af6a0f4..66df95867d 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/Gif.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/Gif.php @@ -40,7 +40,7 @@ class Gif extends Image public function getMediaAlchemystSpec() { - if ( ! $this->spec) { + if (! $this->spec) { $this->spec = new \MediaAlchemyst\Specification\Animation(); } diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Image.php b/lib/Alchemy/Phrasea/Media/Subdef/Image.php index baf1cae8ba..9a7f6ee2e3 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/Image.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/Image.php @@ -48,7 +48,7 @@ class Image extends Provider public function getMediaAlchemystSpec() { - if ( ! $this->spec) { + if (! $this->spec) { $this->spec = new ImageSpecification(); } diff --git a/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Enum.php b/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Enum.php index b50f42298c..cb145ebd1e 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Enum.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Enum.php @@ -39,7 +39,7 @@ class Enum implements OptionType public function setValue($value) { - if ( ! $value) { + if (! $value) { $this->value = null; return $this; diff --git a/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Multi.php b/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Multi.php index 2ac12dfad1..e1b5549d3e 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Multi.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Multi.php @@ -45,8 +45,7 @@ class Multi implements OptionType $this->available[$k] = false; } - if ( ! $value) { - + if (! $value) { return $this; } diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Video.php b/lib/Alchemy/Phrasea/Media/Subdef/Video.php index 809e123d99..c4781667df 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/Video.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/Video.php @@ -50,7 +50,7 @@ class Video extends Audio public function getMediaAlchemystSpec() { - if ( ! $this->spec) { + if (! $this->spec) { $this->spec = new \MediaAlchemyst\Specification\Video(); } @@ -66,4 +66,4 @@ class Video extends Audio return $this->spec; } -} \ No newline at end of file +} diff --git a/lib/Alchemy/Phrasea/Notification/Emitter.php b/lib/Alchemy/Phrasea/Notification/Emitter.php index 81b13f27f4..5a4073c258 100644 --- a/lib/Alchemy/Phrasea/Notification/Emitter.php +++ b/lib/Alchemy/Phrasea/Notification/Emitter.php @@ -46,7 +46,7 @@ class Emitter implements EmitterInterface * @param \User_Adapter $user * * @return Emitter - * + * * @throws InvalidArgumentException In case no valid email is found for user */ public static function fromUser(\User_Adapter $user) diff --git a/lib/Alchemy/Phrasea/PhraseanetServiceProvider.php b/lib/Alchemy/Phrasea/PhraseanetServiceProvider.php index b20e6181f0..ea0c5b5c29 100644 --- a/lib/Alchemy/Phrasea/PhraseanetServiceProvider.php +++ b/lib/Alchemy/Phrasea/PhraseanetServiceProvider.php @@ -36,7 +36,7 @@ class PhraseanetServiceProvider implements ServiceProviderInterface $app['firewall'] = $app->share(function(SilexApplication $app) { return new Firewall($app); }); - + $app['events-manager'] = $app->share(function(SilexApplication $app) { $events = new \eventsmanager_broker($app); $events->start(); diff --git a/lib/Alchemy/Phrasea/SearchEngine/AbstractConfigurationPanel.php b/lib/Alchemy/Phrasea/SearchEngine/AbstractConfigurationPanel.php index 7406fd845f..620673f93c 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/AbstractConfigurationPanel.php +++ b/lib/Alchemy/Phrasea/SearchEngine/AbstractConfigurationPanel.php @@ -15,7 +15,7 @@ abstract class AbstractConfigurationPanel implements ConfigurationPanelInterface { /** * Return the path to the file where the configuration is saved - * + * * @return string The path to the file */ public function getConfigPathFile() @@ -29,17 +29,17 @@ abstract class AbstractConfigurationPanel implements ConfigurationPanelInterface public function getAvailableDateFields(array $databoxes) { $date_fields = array(); - + foreach ($databoxes as $databox) { - foreach($databox->get_meta_structure() as $field) { + foreach ($databox->get_meta_structure() as $field) { if ($field->get_type() !== \databox_field::TYPE_DATE) { continue; } - + $date_fields[] = $field->get_name(); } } - + return $date_fields; } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/ConfigurationPanelInterface.php b/lib/Alchemy/Phrasea/SearchEngine/ConfigurationPanelInterface.php index c1f03693ad..36c50957fb 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/ConfigurationPanelInterface.php +++ b/lib/Alchemy/Phrasea/SearchEngine/ConfigurationPanelInterface.php @@ -19,48 +19,48 @@ interface ConfigurationPanelInterface { /** * Handles the GET request to the configuration panel - * - * @param Application $app - * @param Request $request - * @return Response + * + * @param Application $app + * @param Request $request + * @return Response */ public function get(Application $app, Request $request); /** * Handles the POST request to the configuration panel - * - * @param Application $app - * @param Request $request - * @return Response + * + * @param Application $app + * @param Request $request + * @return Response */ public function post(Application $app, Request $request); /** - * Return the associated search engine name - * + * Return the associated search engine name + * * @return string The name */ public function getName(); /** * Returns the configuration of the search engine - * + * * @return array The configuration */ public function getConfiguration(); /** * Saves the search engine configuration - * - * @param array $configuration + * + * @param array $configuration * @return ConfigurationPanelInterface */ public function saveConfiguration(array $configuration); /** * Return the names of the date fields - * - * @param array $databoxes + * + * @param array $databoxes * @return array An array of date fields names */ public function getAvailableDateFields(array $databoxes); diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php index d3709b4f3d..639c190c0f 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php @@ -60,7 +60,7 @@ class ConfigurationPanel extends AbstractConfigurationPanel foreach ($request->request->get('date_fields', array()) as $field) { $configuration['date_fields'][] = $field; } - + $configuration['default_sort'] = $request->request->get('default_sort'); file_put_contents($this->getConfigPathFile(), json_encode($configuration)); @@ -96,7 +96,7 @@ class ConfigurationPanel extends AbstractConfigurationPanel public function saveConfiguration(array $configuration) { file_put_contents($this->getConfigPathFile(), json_encode($configuration)); - + return $this; } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php index 7511824917..b1bed3ce1a 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php @@ -452,7 +452,7 @@ class PhraseaEngine implements SearchEngineInterface /** * Format proposals from QueryParser to HTML * - * @param array $proposals + * @param array $proposals * @return string */ private static function proposalsToHTML($proposals) @@ -480,7 +480,7 @@ class PhraseaEngine implements SearchEngineInterface /** * Factory * - * @param Application $app + * @param Application $app * @return PhraseaEngine */ public static function create(Application $app) @@ -491,7 +491,7 @@ class PhraseaEngine implements SearchEngineInterface /** * Executes the Phrasea query * - * @param string $query + * @param string $query * @return PhraseaEngine */ private function executeQuery($query) @@ -623,7 +623,7 @@ class PhraseaEngine implements SearchEngineInterface /** * Prepares the query * - * @param string $query + * @param string $query * @return PhraseaEngine */ private function addQuery($query) @@ -723,8 +723,8 @@ class PhraseaEngine implements SearchEngineInterface /** * Parses the query for search engine * - * @param integer $sbas - * @param string $query + * @param integer $sbas + * @param string $query * @return PhraseaEngine */ private function singleParse($sbas, $query) diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php index 194ae82a40..d858605506 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php @@ -143,7 +143,6 @@ class PhraseaEngineQueryParser if (is_array($tree["VALUE"])) { return(implode(" ", $tree["VALUE"])); } else { - return($tree["VALUE"]); } break; @@ -1140,7 +1139,6 @@ class PhraseaEngineQueryParser "LB" => $newTreeLB, "RB" => $newTreeRB); - return $tree; } @@ -1893,4 +1891,3 @@ class PhraseaEngineQueryParser } } } - diff --git a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php index ae4e1cdf2f..4611493192 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineInterface.php @@ -32,8 +32,8 @@ interface SearchEngineInterface /** * Check the status of the search engine * - * @return array An array of key/value parameters - * @throws RuntimeException if something is wrong + * @return array An array of key/value parameters + * @throws RuntimeException if something is wrong */ public function getStatus(); @@ -41,27 +41,27 @@ interface SearchEngineInterface * @return ConfigurationPanelInterface */ public function getConfigurationPanel(); - + /** * @return array an array of field names */ public function getAvailableDateFields(); - + /** * @return array an array containing criteria values as key and criteria names as value */ public function getAvailableSort(); - + /** - * @return string The default sort + * @return string The default sort */ public function getDefaultSort(); - + /** * @return array an array containing sort order values as key and sort order names as value */ public function getAvailableOrder(); - + /** * @return Boolean return true if the search engine supports stemmed search */ @@ -76,7 +76,7 @@ interface SearchEngineInterface /** * Add a record to index * - * @param \record_adapter $record + * @param \record_adapter $record * @return SearchEngineInterface * @throws RuntimeException */ @@ -85,7 +85,7 @@ interface SearchEngineInterface /** * Remove a record from index * - * @param \record_adapter $record + * @param \record_adapter $record * @return SearchEngineInterface * @throws RuntimeException */ @@ -94,7 +94,7 @@ interface SearchEngineInterface /** * Update a record in index * - * @param \record_adapter $record + * @param \record_adapter $record * @return SearchEngineInterface * @throws RuntimeException */ @@ -103,7 +103,7 @@ interface SearchEngineInterface /** * Add a story to index * - * @param \record_adapter $story + * @param \record_adapter $story * @return SearchEngineInterface * @throws RuntimeException */ @@ -112,7 +112,7 @@ interface SearchEngineInterface /** * Remove a story from index * - * @param \record_adapter $story + * @param \record_adapter $story * @return SearchEngineInterface * @throws RuntimeException */ @@ -121,7 +121,7 @@ interface SearchEngineInterface /** * Update a story in index * - * @param \record_adapter $story + * @param \record_adapter $story * @return SearchEngineInterface * @throws RuntimeException */ @@ -130,7 +130,7 @@ interface SearchEngineInterface /** * Add an entry to index * - * @param \Feed_Entry_Adapter $entry + * @param \Feed_Entry_Adapter $entry * @return SearchEngineInterface * @throws RuntimeException */ @@ -139,7 +139,7 @@ interface SearchEngineInterface /** * Remove an entry to index * - * @param \Feed_Entry_Adapter $entry + * @param \Feed_Entry_Adapter $entry * @return SearchEngineInterface * @throws RuntimeException */ @@ -147,8 +147,8 @@ interface SearchEngineInterface /** * Update an entry in the index - * - * @param \Feed_Entry_Adapter $entry + * + * @param \Feed_Entry_Adapter $entry * @return SearchEngineInterface * @throws RuntimeException */ @@ -156,8 +156,8 @@ interface SearchEngineInterface /** * Set options to search-engine - * - * @param SearchEngineOptions $options + * + * @param SearchEngineOptions $options * @return SearchEngineInterface * @throws RuntimeException */ @@ -165,7 +165,7 @@ interface SearchEngineInterface /** * Reset search-engine options - * + * * @return SearchEngineInterface * @throws RuntimeException */ @@ -173,7 +173,7 @@ interface SearchEngineInterface /** * - * @param string $query + * @param string $query * @param integer $offset * @param integer $perPage * @@ -194,8 +194,8 @@ interface SearchEngineInterface /** * Highlight the fields of a record * - * @param type $query - * @param type $fields + * @param type $query + * @param type $fields * @param \record_adapter $record * * @return array The array of highlighted fields @@ -225,4 +225,3 @@ interface SearchEngineInterface */ public function clearAllCache(\DateTime $date = null); } - diff --git a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineLogger.php b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineLogger.php index 2d4cfa9af3..149b9317e4 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineLogger.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineLogger.php @@ -44,7 +44,7 @@ class SearchEngineLogger )); $stmt->closeCursor(); - + return $this; } diff --git a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php index de1871c879..03e533a597 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php @@ -131,8 +131,8 @@ class SearchEngineOptions /** * - * @param const $sort_by - * @param const $sort_ord + * @param const $sort_by + * @param const $sort_ord * @return SearchEngineOptions */ public function setSort($sort_by, $sort_ord = self::SORT_MODE_DESC) @@ -146,7 +146,7 @@ class SearchEngineOptions /** * Allows business fields query on the given collections * - * @param array $collection An array of collection + * @param array $collection An array of collection * @return SearchEngineOptions */ public function allowBusinessFieldsOn(Array $collection) @@ -202,7 +202,7 @@ class SearchEngineOptions /** * Tells whether to use stemming or not * - * @param boolean $boolean + * @param boolean $boolean * @return SearchEngineOptions */ public function setStemming($boolean) @@ -225,7 +225,7 @@ class SearchEngineOptions /** * Set document type to search for * - * @param int $search_type + * @param int $search_type * @return SearchEngineOptions */ public function setSearchType($search_type) @@ -256,7 +256,7 @@ class SearchEngineOptions /** * Set the collections where to search for * - * @param array $collections An array of collection + * @param array $collections An array of collection * @return SearchEngineOptions */ public function onCollections(Array $collections) @@ -295,7 +295,7 @@ class SearchEngineOptions /** * - * @param array $fields An array of Databox fields + * @param array $fields An array of Databox fields */ public function setFields(Array $fields) { @@ -315,7 +315,7 @@ class SearchEngineOptions /** * - * @param array $status + * @param array $status * @return SearchEngineOptions */ public function setStatus(Array $status) @@ -353,7 +353,7 @@ class SearchEngineOptions /** * - * @param string $record_type + * @param string $record_type * @return SearchEngineOptions */ public function setRecordType($record_type) @@ -417,7 +417,7 @@ class SearchEngineOptions /** * - * @param string $max_date + * @param string $max_date * @return SearchEngineOptions */ public function setMaxDate(\DateTime $max_date = null) @@ -442,7 +442,7 @@ class SearchEngineOptions /** * - * @param array $fields + * @param array $fields * @return SearchEngineOptions */ public function setDateFields(Array $fields) @@ -491,7 +491,7 @@ class SearchEngineOptions /** * - * @param string $serialized + * @param string $serialized * @return SearchEngineOptions */ public static function hydrate(Application $app, $serialized) @@ -603,7 +603,7 @@ class SearchEngineOptions * Creates options based on a Symfony Request object * * @param Application $app - * @param Request $request + * @param Request $request * * @return SearchEngineOptions */ @@ -614,7 +614,6 @@ class SearchEngineOptions $options->disallowBusinessFields(); $options->setLocale($app['locale.I18n']); - if (is_array($request->get('bases'))) { $bas = array_map(function($base_id) use ($app) { return \collection::get_from_base_id($app, $base_id); @@ -669,7 +668,7 @@ class SearchEngineOptions $options->setFields($databoxFields); $options->setStatus($status); - + $options->onCollections($bas); $options->setSearchType($request->get('search_type')); diff --git a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineResult.php b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineResult.php index 1f82504089..30c3a13adb 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineResult.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineResult.php @@ -46,7 +46,7 @@ class SearchEngineResult /** * An collection of results - * + * * @return ArrayCollection */ public function getResults() @@ -56,7 +56,7 @@ class SearchEngineResult /** * The query related to these results - * + * * @return string */ public function getQuery() @@ -66,7 +66,7 @@ class SearchEngineResult /** * The duration of the query - * + * * @return float */ public function getDuration() @@ -76,8 +76,8 @@ class SearchEngineResult /** * Return the number of page depending on the amount displayed on each page - * - * @param integer $amountPerPage + * + * @param integer $amountPerPage * @return integer */ public function getTotalPages($amountPerPage) @@ -86,10 +86,10 @@ class SearchEngineResult } /** - * Return the number of the current page depending on the amount displayed + * Return the number of the current page depending on the amount displayed * on each page - * - * @param integer $amountPerPage + * + * @param integer $amountPerPage * @return integer */ public function getCurrentPage($amountPerPage) @@ -99,11 +99,11 @@ class SearchEngineResult /** * Return the number of results that can be returned by the search engine - * + * * The difference with 'total' is that this method return the actual number - * of results that can be fetched whereas 'total' returns the number of + * of results that can be fetched whereas 'total' returns the number of * results that matches the query (can be greater than available quantity) - * + * * @return int */ public function getAvailable() @@ -115,7 +115,7 @@ class SearchEngineResult * Return the number of items that match the query. Some items may be not * retrievable. To get the number of results that can be retrieved, use * the 'available' method - * + * * @return int */ public function getTotal() @@ -125,7 +125,7 @@ class SearchEngineResult /** * Return an error message returned by the search engine - * + * * @return string */ public function getError() @@ -135,7 +135,7 @@ class SearchEngineResult /** * Return a warning message returned by the search engine - * + * * @return string */ public function getWarning() @@ -145,7 +145,7 @@ class SearchEngineResult /** * Return a collection of SearchEngineSuggestion - * + * * @return ArrayCollection */ public function getSuggestions() @@ -155,7 +155,7 @@ class SearchEngineResult /** * Return HTML proposals - * + * * @return string */ public function getProposals() @@ -165,7 +165,7 @@ class SearchEngineResult /** * Return the index name where the query happened - * + * * @return string */ public function getIndexes() @@ -173,4 +173,3 @@ class SearchEngineResult return $this->indexes; } } - diff --git a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineSuggestion.php b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineSuggestion.php index 399afe25bd..946b8bd01e 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SearchEngineSuggestion.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SearchEngineSuggestion.php @@ -15,17 +15,17 @@ class SearchEngineSuggestion { /** - * @var string + * @var string */ private $query; /** - * @var string + * @var string */ private $suggestion; /** - * @var int + * @var int */ private $hits; @@ -38,7 +38,7 @@ class SearchEngineSuggestion /** * The query related to the suggestion - * + * * @return string */ public function getQuery() @@ -48,7 +48,7 @@ class SearchEngineSuggestion /** * The actual suggestion - * + * * @return string */ public function getSuggestion() @@ -58,7 +58,7 @@ class SearchEngineSuggestion /** * The number of hits - * + * * @return int */ public function getHits() diff --git a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/ConfigurationPanel.php b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/ConfigurationPanel.php index f0058216a9..b62e8fdc6a 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/ConfigurationPanel.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/ConfigurationPanel.php @@ -68,12 +68,12 @@ class ConfigurationPanel extends AbstractConfigurationPanel foreach ($request->request->get('date_fields', array()) as $field) { $configuration['date_fields'][] = $field; } - + $configuration['host'] = $request->request->get('host'); $configuration['host'] = $request->request->get('port'); $configuration['rt_host'] = $request->request->get('rt_host'); $configuration['rt_port'] = $request->request->get('rt_port'); - + $this->saveConfiguration($configuration); return $app->redirect($app['url_generator']->generate('admin_searchengine_get')); @@ -116,20 +116,20 @@ class ConfigurationPanel extends AbstractConfigurationPanel return $configuration; } - + /** * {@inheritdoc} */ public function saveConfiguration(array $configuration) { file_put_contents($this->getConfigPathFile(), json_encode($configuration)); - + return $this; } /** * Returns all the charset Sphinx Search supports - * + * * @return array An array of charsets */ public function getAvailableCharsets() @@ -158,9 +158,9 @@ class ConfigurationPanel extends AbstractConfigurationPanel /** * Generates Sphinx Search configuration depending on the service configuration - * - * @param array $databoxes The databoxes to index - * @param array $configuration The configuration + * + * @param array $databoxes The databoxes to index + * @param array $configuration The configuration * @return string The sphinx search configuration */ public function generateSphinxConf(array $databoxes, array $configuration) diff --git a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php index 12ad77a7aa..dce0de1fae 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/SphinxSearch/SphinxSearchEngine.php @@ -70,7 +70,7 @@ class SphinxSearchEngine implements SearchEngineInterface return $this; } - + /** * {@inheritdoc} */ @@ -238,8 +238,8 @@ class SphinxSearchEngine implements SearchEngineInterface ," . (int) $value->getDatabox_field()->isBusiness() . " ," . sprintf("%u", crc32($record->get_collection()->get_coll_id() . '_' . (int) $value->getDatabox_field()->isBusiness())) . " ," . $record->get_creation_date()->format('U') . " - " . $sql_date_fields . " - ,(" . implode(',', $status) . ") + " . $sql_date_fields . " + ,(" . implode(',', $status) . ") )"); } } @@ -257,8 +257,8 @@ class SphinxSearchEngine implements SearchEngineInterface ," . sprintf("%u", crc32($record->get_type())) . " ,0 ," . $record->get_creation_date()->format('U') . " - " . $sql_date_fields . " - ,(" . implode(',', $status) . ") + " . $sql_date_fields . " + ,(" . implode(',', $status) . ") )"; $this->rt_conn->exec($sql); @@ -316,7 +316,7 @@ class SphinxSearchEngine implements SearchEngineInterface { $this->removeRecord($record); $this->addRecord($record); - + return $this; } @@ -375,7 +375,7 @@ class SphinxSearchEngine implements SearchEngineInterface { $this->options = $options; $this->applyOptions($options); - + return $this; } @@ -386,7 +386,7 @@ class SphinxSearchEngine implements SearchEngineInterface { $this->options = new SearchEngineOptions(); $this->resetSphinx(); - + return $this; } @@ -394,7 +394,7 @@ class SphinxSearchEngine implements SearchEngineInterface { $this->sphinx->ResetGroupBy(); $this->sphinx->ResetFilters(); - + return $this; } @@ -457,7 +457,7 @@ class SphinxSearchEngine implements SearchEngineInterface $results->add($record); } catch (Exception $e) { - + } $resultOffset++; } @@ -526,7 +526,7 @@ class SphinxSearchEngine implements SearchEngineInterface /** * Return unique integer key for a databox * - * @param \databox $databox + * @param \databox $databox * @return int */ public function CRCdatabox(\databox $databox) @@ -545,7 +545,7 @@ class SphinxSearchEngine implements SearchEngineInterface * * Only apply filters and group by * - * @param SearchEngineOptions $options + * @param SearchEngineOptions $options * @return SphinxSearch */ protected function applyOptions(SearchEngineOptions $options) @@ -689,7 +689,7 @@ class SphinxSearchEngine implements SearchEngineInterface /** * Remove all keywords, operators, quotes from a query string * - * @param string $query + * @param string $query * @return string */ private function cleanupQuery($query) @@ -700,7 +700,7 @@ class SphinxSearchEngine implements SearchEngineInterface /** * Return a collection of suggestion corresponding a query * - * @param string $query + * @param string $query * @return ArrayCollection An array collection of SearchEngineSuggestion */ private function getSuggestions($query) @@ -1007,4 +1007,3 @@ class SphinxSearchEngine implements SearchEngineInterface } } - diff --git a/lib/Alchemy/Phrasea/Setup/Version/Migration/Migration35.php b/lib/Alchemy/Phrasea/Setup/Version/Migration/Migration35.php index 7710c047b0..129dd283f9 100644 --- a/lib/Alchemy/Phrasea/Setup/Version/Migration/Migration35.php +++ b/lib/Alchemy/Phrasea/Setup/Version/Migration/Migration35.php @@ -75,7 +75,6 @@ class Migration35 implements MigrationInterface rename(__DIR__ . '/../../../../../../config/connexion.inc', __DIR__ . '/../../../../../../config/connexion.inc.old'); rename(__DIR__ . '/../../../../../../config/config.inc', __DIR__ . '/../../../../../../config/config.inc.old'); - $this->app['phraseanet.configuration']->setConfigurations($configs); $this->app['phraseanet.configuration']->setEnvironnement('prod'); } diff --git a/lib/Alchemy/Phrasea/Setup/Version/Probe/Probe31.php b/lib/Alchemy/Phrasea/Setup/Version/Probe/Probe31.php index 66aeed8995..a6d5453543 100644 --- a/lib/Alchemy/Phrasea/Setup/Version/Probe/Probe31.php +++ b/lib/Alchemy/Phrasea/Setup/Version/Probe/Probe31.php @@ -28,6 +28,7 @@ class Probe31 implements ProbeInterface /** * We can not use registry to inject a path as the install is not yet done */ + return is_file(__DIR__ . "/../../../../../../config/connexion.inc") && is_file(__DIR__ . "/../../../../../../config/_GV.php"); } diff --git a/lib/Alchemy/Phrasea/Setup/Version/Probe/Probe35.php b/lib/Alchemy/Phrasea/Setup/Version/Probe/Probe35.php index 61445986c2..50b1a7ec03 100644 --- a/lib/Alchemy/Phrasea/Setup/Version/Probe/Probe35.php +++ b/lib/Alchemy/Phrasea/Setup/Version/Probe/Probe35.php @@ -28,6 +28,7 @@ class Probe35 implements ProbeInterface /** * We can not use registry to inject a path as the install is not yet done */ + return is_file(__DIR__ . "/../../../../../../config/connexion.inc") && is_file(__DIR__ . "/../../../../../../config/config.inc"); } diff --git a/lib/Alchemy/Phrasea/Twig/JSUniqueID.php b/lib/Alchemy/Phrasea/Twig/JSUniqueID.php index c3bd107d85..1962c31ad8 100644 --- a/lib/Alchemy/Phrasea/Twig/JSUniqueID.php +++ b/lib/Alchemy/Phrasea/Twig/JSUniqueID.php @@ -29,4 +29,4 @@ class JSUniqueID extends \Twig_Extension { return $prefix . 'id' . str_replace(array(',', '.'), '-', microtime(true)) . base_convert(mt_rand(0x19A100, 0x39AA3FF), 10, 36) . $suffix; } -} \ No newline at end of file +} diff --git a/lib/Alchemy/Phrasea/Vocabulary/Controller.php b/lib/Alchemy/Phrasea/Vocabulary/Controller.php index 41046110cb..7039a7f857 100644 --- a/lib/Alchemy/Phrasea/Vocabulary/Controller.php +++ b/lib/Alchemy/Phrasea/Vocabulary/Controller.php @@ -27,9 +27,9 @@ class Controller /** * Factory of ControlProvider * - * @param string $type + * @param string $type * @return \Alchemy\Phrasea\Vocabulary\ControlProvider\ControlProviderInterface - * @throws \Exception when ControlProvider is not found + * @throws \Exception when ControlProvider is not found */ public static function get(Application $app, $type) {