diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index 396dfb6ea9..def0cf4bfc 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -631,6 +631,8 @@ class Application extends SilexApplication $twig->addFilter('stripdoublequotes', new \Twig_Filter_Function('stripdoublequotes')); $twig->addFilter('get_collection_logo', new \Twig_Filter_Function('collection::getLogo')); $twig->addFilter('floor', new \Twig_Filter_Function('floor')); + $twig->addFilter('ceil', new \Twig_Filter_Function('ceil')); + $twig->addFilter('max', new \Twig_Filter_Function('max')); $twig->addFilter('min', new \Twig_Filter_Function('min')); $twig->addFilter('bas_labels', new \Twig_Filter_Function('phrasea::bas_labels')); $twig->addFilter('sbas_names', new \Twig_Filter_Function('phrasea::sbas_names')); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php index d78c7f97ab..59cacb7e90 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php @@ -83,18 +83,20 @@ class Lazaret implements ControllerProviderInterface $baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['canaddrecord'])); $lazaretFiles = null; + $perPage = 10; + $page = max(1, $request->query->get('page', 1)); + $offset = ($page - 1) * $perPage; if (count($baseIds) > 0) { $lazaretRepository = $app['EM']->getRepository('Phraseanet:LazaretFile'); - - $lazaretFiles = $lazaretRepository->findPerPage( - $baseIds, $request->query->get('offset', 0), $request->query->get('limit', 10) - ); + $lazaretFiles = $lazaretRepository->findPerPage($baseIds, $offset, $perPage); } - return $app['twig']->render( - 'prod/upload/lazaret.html.twig', ['lazaretFiles' => $lazaretFiles] - ); + return $app['twig']->render('prod/upload/lazaret.html.twig', array( + 'lazaretFiles' => $lazaretFiles, + 'currentPage' => $page, + 'perPage' => $perPage, + )); } /** diff --git a/lib/Alchemy/Phrasea/Model/Entities/Basket.php b/lib/Alchemy/Phrasea/Model/Entities/Basket.php index f12d3940dc..28c0042456 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/Basket.php +++ b/lib/Alchemy/Phrasea/Model/Entities/Basket.php @@ -493,7 +493,7 @@ class Basket $totSize += $basket_element->getRecord($app) ->get_subdef('document') ->get_size(); - } catch (Exception $e) { + } catch (\Exception $e) { } } diff --git a/lib/Alchemy/Phrasea/Model/Repositories/LazaretFileRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/LazaretFileRepository.php index 9985050cd7..1359d0e58f 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/LazaretFileRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/LazaretFileRepository.php @@ -12,6 +12,7 @@ namespace Alchemy\Phrasea\Model\Repositories; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Tools\Pagination\Paginator; /** * LazaretFileRepository @@ -21,12 +22,11 @@ use Doctrine\ORM\EntityRepository; */ class LazaretFileRepository extends EntityRepository { - public function findPerPage(array $base_ids, $offset = 0, $perPage = 10) { $base_ids = implode(', ', array_map(function ($int) { - return (int) $int; - }, $base_ids)); + return (int) $int; + }, $base_ids)); $dql = ' SELECT f @@ -38,8 +38,6 @@ class LazaretFileRepository extends EntityRepository $query->setFirstResult($offset) ->setMaxResults($perPage); - $paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($query, true); - - return $paginator; + return new Paginator($query, true); } } diff --git a/lib/classes/ACL.php b/lib/classes/ACL.php index 9b792c7a4b..4f19600fe9 100644 --- a/lib/classes/ACL.php +++ b/lib/classes/ACL.php @@ -234,7 +234,7 @@ class ACL implements cache_cacheableInterface $subdef_class = $record->get_databox()->get_subdef_structure() ->get_subdef($record->get_type(), $subdef_name) ->get_class(); - } catch (Exception $e) { + } catch (\Exception $e) { return false; } @@ -741,7 +741,7 @@ class ACL implements cache_cacheableInterface try { $ret[$sbas_id] = $this->app['phraseanet.appbox']->get_databox((int) $sbas_id); - } catch (Exception $e) { + } catch (\Exception $e) { } } @@ -792,7 +792,7 @@ class ACL implements cache_cacheableInterface $this->_rights_records_document = $tmp_rights['document']; return $this; - } catch (Exception $e) { + } catch (\Exception $e) { } $sql = 'SELECT sbas_id, record_id, preview, document @@ -834,7 +834,7 @@ class ACL implements cache_cacheableInterface $this->is_admin = $this->get_data_from_cache(self::CACHE_IS_ADMIN); return $this; - } catch (Exception $e) { + } catch (\Exception $e) { } $sql = 'SELECT create_db @@ -928,7 +928,7 @@ class ACL implements cache_cacheableInterface $this->_limited = $this->get_data_from_cache(self::CACHE_LIMITS_BAS); return $this; - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/API/OAuth2/Adapter.php b/lib/classes/API/OAuth2/Adapter.php index 61835dcdcd..b0afbd086a 100644 --- a/lib/classes/API/OAuth2/Adapter.php +++ b/lib/classes/API/OAuth2/Adapter.php @@ -181,7 +181,7 @@ class API_OAuth2_Adapter extends OAuth2 } return ($application->get_client_secret() === $client_secret); - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -226,7 +226,7 @@ class API_OAuth2_Adapter extends OAuth2 , 'oauth_token' => $token->get_value() ]; - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -295,7 +295,7 @@ class API_OAuth2_Adapter extends OAuth2 , 'expires' => $code->get_expires() , 'account_id' => $code->get_account()->get_id() ]; - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -346,7 +346,7 @@ class API_OAuth2_Adapter extends OAuth2 , 'expires' => $token->get_expires()->format('U') , 'client_id' => $token->get_account()->get_application()->get_client_id() ]; - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -508,7 +508,7 @@ class API_OAuth2_Adapter extends OAuth2 try { $user = User_Adapter::getInstance($usr_id, $this->app); $account = API_OAuth2_Account::load_with_user($this->app, $this->client, $user); - } catch (Exception $e) { + } catch (\Exception $e) { $account = $this->createAccount($usr_id); } @@ -575,7 +575,7 @@ class API_OAuth2_Adapter extends OAuth2 $token->set_session_id($ses_id); return true; - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/API/V1/adapter.php b/lib/classes/API/V1/adapter.php index d94ec654c4..b65ac29949 100644 --- a/lib/classes/API/V1/adapter.php +++ b/lib/classes/API/V1/adapter.php @@ -1088,9 +1088,9 @@ class API_V1_adapter extends API_V1_Abstract } $record->set_metadatas($metadatas); - $result->set_datas(["record_metadatas" => $this->list_record_caption($record->get_caption())]); - } catch (Exception $e) { - $result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('An error occured')); + $result->set_datas(array("record_metadatas" => $this->list_record_caption($record->get_caption()))); + } catch (\Exception $e) { + $result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, _('An error occured')); } return $result; @@ -1135,7 +1135,7 @@ class API_V1_adapter extends API_V1_Abstract $this->list_record_status($databox, $record->get_status()) ] ); - } catch (Exception $e) { + } catch (\Exception $e) { $result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('An error occured')); } @@ -1161,7 +1161,7 @@ class API_V1_adapter extends API_V1_Abstract $record->move_to_collection($collection, $this->app['phraseanet.appbox']); $result->set_datas(["record" => $this->list_record($record)]); - } catch (Exception $e) { + } catch (\Exception $e) { $result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $e->getMessage()); } @@ -1183,9 +1183,9 @@ class API_V1_adapter extends API_V1_Abstract try { $record = $databox->get_record($record_id); $result->set_datas(['record' => $this->list_record($record)]); - } catch (NotFoundHttpException $e) { + } catch (\NotFoundHttpException $e) { $result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('Record Not Found')); - } catch (Exception $e) { + } catch (\Exception $e) { $result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('An error occured')); } @@ -1207,9 +1207,9 @@ class API_V1_adapter extends API_V1_Abstract try { $story = $databox->get_record($story_id); $result->set_datas(['story' => $this->list_story($story)]); - } catch (NotFoundHttpException $e) { + } catch (\NotFoundHttpException $e) { $result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('Story Not Found')); - } catch (Exception $e) { + } catch (\Exception $e) { $result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('An error occured')); } diff --git a/lib/classes/Bridge/Account.php b/lib/classes/Bridge/Account.php index e4110f7a15..f2304c4136 100644 --- a/lib/classes/Bridge/Account.php +++ b/lib/classes/Bridge/Account.php @@ -328,7 +328,7 @@ class Bridge_Account if ( ! isset($apis[$api_id])) { try { $apis[$api_id] = new Bridge_Api($app, $api_id); - } catch (Exception $e) { + } catch (\Exception $e) { continue; } } diff --git a/lib/classes/Bridge/Api.php b/lib/classes/Bridge/Api.php index 8a8ce90a40..14753a4db1 100644 --- a/lib/classes/Bridge/Api.php +++ b/lib/classes/Bridge/Api.php @@ -430,7 +430,7 @@ class Bridge_Api $ret = $action($this); return $ret; - } catch (Exception $e) { + } catch (\Exception $e) { $this->get_connector()->handle_Exception($e); if ($e instanceof Bridge_Exception_ActionAuthNeedReconnect) { @@ -524,7 +524,7 @@ class Bridge_Api foreach ($rs as $row) { try { $results[] = new Bridge_Api($app, $row['id']); - } catch (Exception $e) { + } catch (\Exception $e) { } } diff --git a/lib/classes/Bridge/Api/Flickr.php b/lib/classes/Bridge/Api/Flickr.php index c18e09d896..2b402744b8 100644 --- a/lib/classes/Bridge/Api/Flickr.php +++ b/lib/classes/Bridge/Api/Flickr.php @@ -457,7 +457,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf $this->get_element_from_id($ticket["dist_id"], $element->get_type()); $element->set_dist_id($ticket["dist_id"]); } - } catch (Exception $e) { + } catch (\Exception $e) { return self::UPLOAD_STATE_FAILED; } diff --git a/lib/classes/Bridge/Element.php b/lib/classes/Bridge/Element.php index 9e26f779b8..8f241a9368 100644 --- a/lib/classes/Bridge/Element.php +++ b/lib/classes/Bridge/Element.php @@ -295,7 +295,7 @@ class Bridge_Element if (! $this->connector_element) { try { $this->connector_element = $this->account->get_api()->get_element_from_id($this->dist_id, $this->type); - } catch (Exception $e) { + } catch (\Exception $e) { return null; } } diff --git a/lib/classes/User/Adapter.php b/lib/classes/User/Adapter.php index 4e53b6184d..5d1be742f4 100644 --- a/lib/classes/User/Adapter.php +++ b/lib/classes/User/Adapter.php @@ -315,7 +315,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface try { self::$_instance[$id] = $app['phraseanet.appbox']->get_data_from_cache('_user_' . $id); self::$_instance[$id]->set_app($app); - } catch (Exception $e) { + } catch (\Exception $e) { self::$_instance[$id] = new self($id, $app); $app['phraseanet.appbox']->set_data_to_cache(self::$_instance[$id], '_user_' . $id); } @@ -1132,7 +1132,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface ':value' => $value ]); $this->delete_data_from_cache(); - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -1229,7 +1229,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $stmt->closeCursor(); return true; - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/appbox.php b/lib/classes/appbox.php index aa569f34cf..b63d6db145 100644 --- a/lib/classes/appbox.php +++ b/lib/classes/appbox.php @@ -436,7 +436,7 @@ class appbox extends base { try { return $this->get_data_from_cache(self::CACHE_SBAS_IDS); - } catch (Exception $e) { + } catch (\Exception $e) { } $sql = 'SELECT sbas_id FROM sbas'; diff --git a/lib/classes/base.php b/lib/classes/base.php index d4ea96d5b5..fe41b81d1e 100644 --- a/lib/classes/base.php +++ b/lib/classes/base.php @@ -312,7 +312,7 @@ abstract class base implements cache_cacheableInterface $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); - } catch (Exception $e) { + } catch (\Exception $e) { $recommends[] = [ 'message' => $app->trans('Erreur lors de la tentative ; errreur : %message%', ['%message%' => $e->getMessage()]), 'sql' => $sql @@ -368,7 +368,7 @@ abstract class base implements cache_cacheableInterface return true; } - } catch (Exception $e) { + } catch (\Exception $e) { throw new Exception('Unable to set the database version : '.$e->getMessage()); } @@ -534,7 +534,7 @@ abstract class base implements cache_cacheableInterface $stmt = $this->get_connection()->prepare($def['sql']); $stmt->execute($def['params']); $stmt->closeCursor(); - } catch (Exception $e) { + } catch (\Exception $e) { $recommends[] = [ 'message' => $this->app->trans('Erreur lors de la tentative ; errreur : %message%', ['%message%' => $e->getMessage()]), 'sql' => $def['sql'] @@ -748,7 +748,7 @@ abstract class base implements cache_cacheableInterface $stmt = $this->get_connection()->prepare($a); $stmt->execute(); $stmt->closeCursor(); - } catch (Exception $e) { + } catch (\Exception $e) { $return[] = [ 'message' => $this->app->trans('Erreur lors de la tentative ; errreur : %message%', ['%message%' => $e->getMessage()]), 'sql' => $a @@ -761,7 +761,7 @@ abstract class base implements cache_cacheableInterface $stmt = $this->get_connection()->prepare($a); $stmt->execute(); $stmt->closeCursor(); - } catch (Exception $e) { + } catch (\Exception $e) { $return[] = [ 'message' => $this->app->trans('Erreur lors de la tentative ; errreur : %message%', ['%message%' => $e->getMessage()]), 'sql' => $a diff --git a/lib/classes/caption/field.php b/lib/classes/caption/field.php index 2807589976..e5a07c248a 100644 --- a/lib/classes/caption/field.php +++ b/lib/classes/caption/field.php @@ -334,7 +334,7 @@ class caption_field implements cache_cacheableInterface */ $app['phraseanet.SE']->updateRecord($record); unset($record); - } catch (Exception $e) { + } catch (\Exception $e) { } } @@ -388,7 +388,7 @@ class caption_field implements cache_cacheableInterface $app['phraseanet.SE']->updateRecord($record); unset($caption_field); unset($record); - } catch (Exception $e) { + } catch (\Exception $e) { } } diff --git a/lib/classes/caption/record.php b/lib/classes/caption/record.php index 749e699668..ff6eccf287 100644 --- a/lib/classes/caption/record.php +++ b/lib/classes/caption/record.php @@ -67,7 +67,7 @@ class caption_record implements caption_interface, cache_cacheableInterface $fields = []; try { $fields = $this->get_data_from_cache(); - } catch (Exception $e) { + } catch (\Exception $e) { $sql = "SELECT m.id as meta_id, s.id as structure_id FROM metadatas m, metadatas_structure s WHERE m.record_id = :record_id AND s.id = m.meta_struct_id diff --git a/lib/classes/collection.php b/lib/classes/collection.php index dbdb488832..6d3d013b57 100644 --- a/lib/classes/collection.php +++ b/lib/classes/collection.php @@ -64,7 +64,7 @@ class collection implements cache_cacheableInterface $this->labels = $datas['labels']; return $this; - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/connection.php b/lib/classes/connection.php index f2aa52072b..46f476c5ee 100644 --- a/lib/classes/connection.php +++ b/lib/classes/connection.php @@ -143,7 +143,7 @@ class connection try { self::$_PDO_instance[$name] = new connection_pdo($name, $hostname, $port, $user, $password, $dbname, [], $app['debug']); - } catch (Exception $e) { + } catch (\Exception $e) { throw new Exception('Connection not available'); } } diff --git a/lib/classes/connection/pdoStatementDebugger.php b/lib/classes/connection/pdoStatementDebugger.php index 1fba80087e..9f5a2b2a16 100644 --- a/lib/classes/connection/pdoStatementDebugger.php +++ b/lib/classes/connection/pdoStatementDebugger.php @@ -30,7 +30,7 @@ class connection_pdoStatementDebugger $exception = null; try { $result = $this->statement->execute($params); - } catch (Exception $e) { + } catch (\Exception $e) { $exception = $e; } $time = microtime(true) - $start; diff --git a/lib/classes/databox.php b/lib/classes/databox.php index 33a4c0ebab..d6de47733e 100644 --- a/lib/classes/databox.php +++ b/lib/classes/databox.php @@ -208,7 +208,7 @@ class databox extends base foreach ($this->get_available_collections() as $coll_id) { try { $ret[] = collection::get_from_coll_id($this->app, $this, $coll_id); - } catch (Exception $e) { + } catch (\Exception $e) { } } @@ -220,7 +220,7 @@ class databox extends base { try { return $this->get_data_from_cache(self::CACHE_COLLECTIONS); - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -533,7 +533,7 @@ class databox extends base $stmt = $connection->prepare($sql); $stmt->execute(); $stmt->closeCursor(); - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -650,7 +650,7 @@ class databox extends base try { $metaStructData = $this->get_data_from_cache(self::CACHE_META_STRUCT); - } catch (Exception $e) { + } catch (\Exception $e) { $sql = 'SELECT id, name FROM metadatas_structure ORDER BY sorter ASC'; $stmt = $this->get_connection()->prepare($sql); $stmt->execute(); @@ -958,7 +958,7 @@ class databox extends base try { $meta_struct_field->set_tag(\databox_field::loadClassFromTagName($src))->save(); - } catch (Exception $e) { + } catch (\Exception $e) { } } @@ -1003,7 +1003,7 @@ class databox extends base if ( ! empty($row['logo'])) { file_put_contents($this->app['root.path'] . '/config/minilogos/' . $base_id, $row['logo']); } - } catch (Exception $e) { + } catch (\Exception $e) { unset($e); } } @@ -1134,7 +1134,7 @@ class databox extends base $this->thesaurus = $this->get_data_from_cache(self::CACHE_THESAURUS); return $this->thesaurus; - } catch (Exception $e) { + } catch (\Exception $e) { unset($e); } @@ -1146,7 +1146,7 @@ class databox extends base $stmt->closeCursor(); $this->thesaurus = $row['thesaurus']; $this->set_data_to_cache($this->thesaurus, self::CACHE_THESAURUS); - } catch (Exception $e) { + } catch (\Exception $e) { unset($e); } @@ -1171,7 +1171,7 @@ class databox extends base { try { return $this->get_data_from_cache(self::CACHE_STRUCTURE); - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -1362,7 +1362,7 @@ class databox extends base $this->cgus = $this->get_data_from_cache(self::CACHE_CGUS); return $this; - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/databox/cgu.php b/lib/classes/databox/cgu.php index a6f12cca78..31ce60e79f 100644 --- a/lib/classes/databox/cgu.php +++ b/lib/classes/databox/cgu.php @@ -67,7 +67,7 @@ class databox_cgu if ($userValidation) $terms[$name] = ['sbas_id' => $databox->get_sbas_id(), 'terms' => $value, 'date' => $update]; - } catch (Exception $e) { + } catch (\Exception $e) { } } diff --git a/lib/classes/databox/field.php b/lib/classes/databox/field.php index cf7d9313af..93ee32d6b1 100644 --- a/lib/classes/databox/field.php +++ b/lib/classes/databox/field.php @@ -275,7 +275,7 @@ class databox_field implements cache_cacheableInterface if ( ! isset(self::$_instance[$instance_id]) || (self::$_instance[$instance_id] instanceof self) === false) { try { self::$_instance[$instance_id] = $databox->get_data_from_cache($cache_key); - } catch (Exception $e) { + } catch (\Exception $e) { self::$_instance[$instance_id] = new self($app, $databox, $id); $databox->set_data_to_cache(self::$_instance[$instance_id], $cache_key); } diff --git a/lib/classes/databox/status.php b/lib/classes/databox/status.php index 6919be9000..9ba255b976 100644 --- a/lib/classes/databox/status.php +++ b/lib/classes/databox/status.php @@ -137,7 +137,7 @@ class databox_status foreach ($sbas_ids as $databox) { try { $statuses[$databox->get_sbas_id()] = $databox->get_statusbits(); - } catch (Exception $e) { + } catch (\Exception $e) { } } @@ -166,7 +166,7 @@ class databox_status } try { $statuses[$databox->get_sbas_id()] = $databox->get_statusbits(); - } catch (Exception $e) { + } catch (\Exception $e) { } } diff --git a/lib/classes/eventsmanager/broker.php b/lib/classes/eventsmanager/broker.php index 2ba1e65d48..695a4a4702 100644 --- a/lib/classes/eventsmanager/broker.php +++ b/lib/classes/eventsmanager/broker.php @@ -112,7 +112,7 @@ class eventsmanager_broker $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); - } catch (Exception $e) { + } catch (\Exception $e) { return false; } diff --git a/lib/classes/eventsmanager/notify/autoregister.php b/lib/classes/eventsmanager/notify/autoregister.php index ad6521aff3..687a9cd676 100644 --- a/lib/classes/eventsmanager/notify/autoregister.php +++ b/lib/classes/eventsmanager/notify/autoregister.php @@ -73,7 +73,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract $mailColl[$row['usr_id']][] = $row['base_id']; } - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -104,7 +104,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract try { $registered_user = User_Adapter::getInstance($params['usr_id'], $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return; } @@ -115,7 +115,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract if ($this->shouldSendNotificationFor($usr_id)) { try { $admin_user = User_Adapter::getInstance($usr_id, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { continue; } @@ -142,7 +142,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract $usr_id = (string) $sx->usr_id; try { User_Adapter::getInstance($usr_id, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } @@ -193,7 +193,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract try { $receiver = Receiver::fromUser($to); $readyToSend = true; - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/eventsmanager/notify/bridgeuploadfail.php b/lib/classes/eventsmanager/notify/bridgeuploadfail.php index 7fdf9eeb0a..0b07e37526 100644 --- a/lib/classes/eventsmanager/notify/bridgeuploadfail.php +++ b/lib/classes/eventsmanager/notify/bridgeuploadfail.php @@ -120,7 +120,7 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract try { $account = Bridge_Account::load_account($this->app, $account_id); $record = new record_adapter($this->app, $sbas_id, $rid); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } diff --git a/lib/classes/eventsmanager/notify/order.php b/lib/classes/eventsmanager/notify/order.php index 75ca544b0d..02f8f8e71c 100644 --- a/lib/classes/eventsmanager/notify/order.php +++ b/lib/classes/eventsmanager/notify/order.php @@ -63,7 +63,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract $users = $query->on_base_ids($base_ids) ->who_have_right(['order_master']) ->execute()->get_results(); - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -140,7 +140,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract try { User_Adapter::getInstance($usr_id, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } diff --git a/lib/classes/eventsmanager/notify/orderdeliver.php b/lib/classes/eventsmanager/notify/orderdeliver.php index 2fca925580..9ddc59e934 100644 --- a/lib/classes/eventsmanager/notify/orderdeliver.php +++ b/lib/classes/eventsmanager/notify/orderdeliver.php @@ -146,7 +146,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract try { User_Adapter::getInstance($from, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } @@ -154,7 +154,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract try { $basket = $this->app['converter.basket']->convert($ssel_id); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } $ret = [ diff --git a/lib/classes/eventsmanager/notify/ordernotdelivered.php b/lib/classes/eventsmanager/notify/ordernotdelivered.php index 892bdb3dc4..2619997e88 100644 --- a/lib/classes/eventsmanager/notify/ordernotdelivered.php +++ b/lib/classes/eventsmanager/notify/ordernotdelivered.php @@ -82,7 +82,7 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac $emitter = Emitter::fromUser($user_from); $readyToSend = true; - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -109,7 +109,7 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac try { User_Adapter::getInstance($from, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } diff --git a/lib/classes/eventsmanager/notify/push.php b/lib/classes/eventsmanager/notify/push.php index 46d35cd893..f6236cedaa 100644 --- a/lib/classes/eventsmanager/notify/push.php +++ b/lib/classes/eventsmanager/notify/push.php @@ -121,7 +121,7 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract try { User_Adapter::getInstance($from, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } diff --git a/lib/classes/eventsmanager/notify/register.php b/lib/classes/eventsmanager/notify/register.php index 272dd666b7..95db73148a 100644 --- a/lib/classes/eventsmanager/notify/register.php +++ b/lib/classes/eventsmanager/notify/register.php @@ -74,7 +74,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract $mailColl[$row['usr_id']][] = $row['base_id']; } - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -152,7 +152,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract try { User_Adapter::getInstance($usr_id, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } diff --git a/lib/classes/eventsmanager/notify/validate.php b/lib/classes/eventsmanager/notify/validate.php index 260d72ee05..2d513b0a8f 100644 --- a/lib/classes/eventsmanager/notify/validate.php +++ b/lib/classes/eventsmanager/notify/validate.php @@ -139,7 +139,7 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract try { User_Adapter::getInstance($from, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } @@ -148,7 +148,7 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract try { $basket = $this->app['converter.basket']->convert($ssel_id); $basket_name = trim($basket->getName()) ? : $this->app->trans('Une selection'); - } catch (Exception $e) { + } catch (\Exception $e) { $basket_name = $this->app->trans('Une selection'); } diff --git a/lib/classes/eventsmanager/notify/validationdone.php b/lib/classes/eventsmanager/notify/validationdone.php index ffd22decd7..2b3f3b4d7f 100644 --- a/lib/classes/eventsmanager/notify/validationdone.php +++ b/lib/classes/eventsmanager/notify/validationdone.php @@ -133,7 +133,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract try { $registered_user = User_Adapter::getInstance($from, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } @@ -141,7 +141,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract try { $basket = $this->app['converter.basket']->convert($ssel_id); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } diff --git a/lib/classes/eventsmanager/notify/validationreminder.php b/lib/classes/eventsmanager/notify/validationreminder.php index 9ea3a806ce..10b3ac9f3a 100644 --- a/lib/classes/eventsmanager/notify/validationreminder.php +++ b/lib/classes/eventsmanager/notify/validationreminder.php @@ -89,7 +89,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra try { $user_from = User_Adapter::getInstance($params['from'], $this->app); $user_to = User_Adapter::getInstance($params['to'], $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return false; } @@ -138,7 +138,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra try { User_Adapter::getInstance($from, $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { return []; } @@ -147,7 +147,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra try { $basket = $this->app['converter.basket']->convert($ssel_id); $basket_name = trim($basket->getName()) ? : $this->app->trans('Une selection'); - } catch (Exception $e) { + } catch (\Exception $e) { $basket_name = $this->app->trans('Une selection'); } diff --git a/lib/classes/ftpclient.php b/lib/classes/ftpclient.php index 93aaf5dcfe..6cffd73a07 100644 --- a/lib/classes/ftpclient.php +++ b/lib/classes/ftpclient.php @@ -209,7 +209,7 @@ class ftpclient echo "Resume seems not to be supported, try again from scratch\n
"; try { $this->unlink($remotefile); - } catch (Exception $e) { + } catch (\Exception $e) { echo $e; } $ret = $this->nb_put($remotefile, $localfile, 0); @@ -252,7 +252,7 @@ class ftpclient echo "Resume seems not to be supported, try again from scratch\n
"; try { $this->unlink($localfile); - } catch (Exception $e) { + } catch (\Exception $e) { echo $e; } $ret = $this->nb_get($localfile, $remotefile, 0); diff --git a/lib/classes/media/Permalink/Adapter.php b/lib/classes/media/Permalink/Adapter.php index 9596bf02d6..d5c06766b8 100644 --- a/lib/classes/media/Permalink/Adapter.php +++ b/lib/classes/media/Permalink/Adapter.php @@ -254,7 +254,7 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea $this->label = $datas['label']; return $this; - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -303,7 +303,7 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea { try { return new self($app, $databox, $media_subdef); - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/media/subdef.php b/lib/classes/media/subdef.php index f29b98abbe..b4ee096a34 100644 --- a/lib/classes/media/subdef.php +++ b/lib/classes/media/subdef.php @@ -173,7 +173,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface $this->creation_date = $datas['creation_date']; return $this; - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/module/console/sphinxGenerateSuggestion.php b/lib/classes/module/console/sphinxGenerateSuggestion.php index c2476cf5a0..8e0b66e16e 100644 --- a/lib/classes/module/console/sphinxGenerateSuggestion.php +++ b/lib/classes/module/console/sphinxGenerateSuggestion.php @@ -71,7 +71,7 @@ class module_console_sphinxGenerateSuggestion extends Command try { $connbas = connection::getPDOConnection($this->container, $sbas_id); - } catch (Exception $e) { + } catch (\Exception $e) { continue; } diff --git a/lib/classes/module/console/systemMailCheck.php b/lib/classes/module/console/systemMailCheck.php index 9cd894bd79..b0ba27ca1b 100644 --- a/lib/classes/module/console/systemMailCheck.php +++ b/lib/classes/module/console/systemMailCheck.php @@ -90,7 +90,7 @@ class module_console_systemMailCheck extends Command $tmp_user->set_email(null); unset($users[$id]); - } catch (Exception $e) { + } catch (\Exception $e) { $output->writeln('Wrong id'); } } diff --git a/lib/classes/module/console/systemTemplateGenerator.php b/lib/classes/module/console/systemTemplateGenerator.php index 8397efb6b8..49b892ef8c 100644 --- a/lib/classes/module/console/systemTemplateGenerator.php +++ b/lib/classes/module/console/systemTemplateGenerator.php @@ -49,7 +49,7 @@ class module_console_systemTemplateGenerator extends Command $this->container['twig']->loadTemplate(str_replace($tplDir, '', $file->getPathname())); $output->writeln('' . $file . ''); $n_ok ++; - } catch (Exception $e) { + } catch (\Exception $e) { $output->writeln('' . $e->getMessage() . ''); $n_error ++; } diff --git a/lib/classes/module/report.php b/lib/classes/module/report.php index 76768a3ce1..82a58abcbe 100644 --- a/lib/classes/module/report.php +++ b/lib/classes/module/report.php @@ -850,7 +850,7 @@ class module_report $this->setReport(); return $this->report; - } catch (Exception $e) { + } catch (\Exception $e) { echo $e->getMessage(); } } diff --git a/lib/classes/module/report/add.php b/lib/classes/module/report/add.php index fe74843a3c..344e20c462 100644 --- a/lib/classes/module/report/add.php +++ b/lib/classes/module/report/add.php @@ -80,7 +80,7 @@ class module_report_add extends module_report try { $user = User_Adapter::getInstance($value, $this->app); $caption = $user->get_display_name(); - } catch (Exception $e) { + } catch (\Exception $e) { } } elseif ($field == 'date') diff --git a/lib/classes/module/report/dashboard.php b/lib/classes/module/report/dashboard.php index 9a83c5398f..46fd433548 100644 --- a/lib/classes/module/report/dashboard.php +++ b/lib/classes/module/report/dashboard.php @@ -328,7 +328,7 @@ class module_report_dashboard implements module_report_dashboard_componentInterf $this->app, $sbasid, $coll, $this->dmin, $this->dmax ); } - } catch (Exception $e) { + } catch (\Exception $e) { } $i ++; diff --git a/lib/classes/module/report/dashboard/feed.php b/lib/classes/module/report/dashboard/feed.php index 606a92eb39..d6a9d5f413 100644 --- a/lib/classes/module/report/dashboard/feed.php +++ b/lib/classes/module/report/dashboard/feed.php @@ -76,7 +76,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI $result->setApplication($app); return $result; - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/module/report/download.php b/lib/classes/module/report/download.php index 62f76ca364..76d54e8207 100644 --- a/lib/classes/module/report/download.php +++ b/lib/classes/module/report/download.php @@ -113,7 +113,7 @@ class module_report_download extends module_report if (array_key_exists('record_id', $row)) { try { $record = new \record_adapter($app, $this->sbas_id, $row['record_id']); - } catch (Exception_Record_AdapterNotFound $e) { + } catch (\Exception_Record_AdapterNotFound $e) { continue; } diff --git a/lib/classes/module/report/edit.php b/lib/classes/module/report/edit.php index 4be42cace2..3476de21de 100644 --- a/lib/classes/module/report/edit.php +++ b/lib/classes/module/report/edit.php @@ -80,7 +80,7 @@ class module_report_edit extends module_report try { $user = User_Adapter::getInstance($value, $this->app); $caption = $user->get_display_name(); - } catch (Exception $e) { + } catch (\Exception $e) { } } elseif ($field == 'date') { diff --git a/lib/classes/module/report/nav.php b/lib/classes/module/report/nav.php index 727f2bf0e8..03e4c5bb5e 100644 --- a/lib/classes/module/report/nav.php +++ b/lib/classes/module/report/nav.php @@ -496,7 +496,7 @@ class module_report_nav extends module_report try { $record = new record_adapter($this->app, $sbas_id, $rid); - } catch (Exception_Record_AdapterNotFound $e) { + } catch (\Exception_Record_AdapterNotFound $e) { return $this->report; } diff --git a/lib/classes/module/report/push.php b/lib/classes/module/report/push.php index abdfba042b..218090222e 100644 --- a/lib/classes/module/report/push.php +++ b/lib/classes/module/report/push.php @@ -81,7 +81,7 @@ class module_report_push extends module_report try { $user = User_Adapter::getInstance($value, $this->app); $caption = $user->get_display_name(); - } catch (Exception $e) { + } catch (\Exception $e) { } } elseif ($field == 'date') { diff --git a/lib/classes/module/report/sent.php b/lib/classes/module/report/sent.php index 8c51e0d806..77ff15b5e1 100644 --- a/lib/classes/module/report/sent.php +++ b/lib/classes/module/report/sent.php @@ -81,7 +81,7 @@ class module_report_sent extends module_report try { $user = User_Adapter::getInstance($value, $this->app); $caption = $user->get_display_name(); - } catch (Exception $e) { + } catch (\Exception $e) { } } elseif ($field == 'date') { diff --git a/lib/classes/module/report/validate.php b/lib/classes/module/report/validate.php index e737db090c..ed2db855a2 100644 --- a/lib/classes/module/report/validate.php +++ b/lib/classes/module/report/validate.php @@ -81,7 +81,7 @@ class module_report_validate extends module_report try { $user = User_Adapter::getInstance($value, $this->app); $caption = $user->get_display_name(); - } catch (Exception $e) { + } catch (\Exception $e) { } } elseif ($field == 'date') { diff --git a/lib/classes/patch/320alpha4b.php b/lib/classes/patch/320alpha4b.php index 0672877a2e..0a6c0b7f78 100644 --- a/lib/classes/patch/320alpha4b.php +++ b/lib/classes/patch/320alpha4b.php @@ -69,7 +69,7 @@ class patch_320alpha4b implements patchInterface $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/phrasea.php b/lib/classes/phrasea.php index d59e578321..a1dc39eb7a 100644 --- a/lib/classes/phrasea.php +++ b/lib/classes/phrasea.php @@ -49,7 +49,7 @@ class phrasea self::$_sbas_params = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_PARAMS); return self::$_sbas_params; - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -98,7 +98,7 @@ class phrasea if (!self::$_bas2sbas) { try { self::$_bas2sbas = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_FROM_BAS); - } catch (Exception $e) { + } catch (\Exception $e) { $sql = 'SELECT base_id, sbas_id FROM bas'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); @@ -189,7 +189,7 @@ class phrasea if (!self::$_sbas_names) { try { self::$_sbas_names = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_NAMES); - } catch (Exception $e) { + } catch (\Exception $e) { foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { self::$_sbas_names[$databox->get_sbas_id()] = $databox->get_viewname(); } @@ -205,7 +205,7 @@ class phrasea if (!self::$_sbas_labels) { try { self::$_sbas_labels = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_LABELS); - } catch (Exception $e) { + } catch (\Exception $e) { foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { self::$_sbas_labels[$databox->get_sbas_id()] = [ 'fr' => $databox->get_label('fr'), @@ -230,7 +230,7 @@ class phrasea if (!self::$_bas_labels) { try { self::$_bas_labels = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_BAS_LABELS); - } catch (Exception $e) { + } catch (\Exception $e) { foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { foreach ($databox->get_collections() as $collection) { self::$_bas_labels[$collection->get_base_id()] = [ diff --git a/lib/classes/random.php b/lib/classes/random.php index a1c9cc00bc..656228ee4e 100644 --- a/lib/classes/random.php +++ b/lib/classes/random.php @@ -76,7 +76,7 @@ class random $stmt->closeCursor(); return true; - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -185,7 +185,7 @@ class random $stmt->closeCursor(); return true; - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -205,7 +205,7 @@ class random $stmt->closeCursor(); return true; - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index c756ee847a..6d756ae8f2 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -183,7 +183,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface $this->base_id = $datas['base_id']; return $this; - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -513,7 +513,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface try { return $this->get_subdef('thumbnailGIF'); - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -559,7 +559,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface { try { return $this->get_data_from_cache(self::CACHE_STATUS); - } catch (Exception $e) { + } catch (\Exception $e) { } $sql = 'SELECT BIN(status) as status FROM record @@ -705,7 +705,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface { try { return $this->get_data_from_cache(self::CACHE_SUBDEFS); - } catch (Exception $e) { + } catch (\Exception $e) { } @@ -750,7 +750,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface if (!$this->technical_datas) { try { $this->technical_datas = $this->get_data_from_cache(self::CACHE_TECHNICAL_DATAS); - } catch (Exception $e) { + } catch (\Exception $e) { $this->technical_datas = []; $connbas = $this->get_databox()->get_connection(); $sql = 'SELECT name, value FROM technical_datas WHERE record_id = :record_id'; @@ -935,7 +935,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface $this->get_subdef('preview'); return $this->get_subdef('preview')->is_physically_present(); - } catch (Exception $e) { + } catch (\Exception $e) { unset($e); } @@ -1203,7 +1203,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface ':coll_id' => $collection->get_coll_id() ]); $stmt->closeCursor(); - } catch (Exception $e) { + } catch (\Exception $e) { unset($e); } @@ -1258,7 +1258,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface ':coll_id' => $file->getCollection()->get_coll_id() ]); $stmt->closeCursor(); - } catch (Exception $e) { + } catch (\Exception $e) { unset($e); } diff --git a/lib/classes/record/preview.php b/lib/classes/record/preview.php index da6a65bd1d..311263ff0b 100644 --- a/lib/classes/record/preview.php +++ b/lib/classes/record/preview.php @@ -370,7 +370,7 @@ class record_preview extends record_adapter try { $user = \User_Adapter::getInstance($row['usr_id'], $this->app); - } catch (Exception $e) { + } catch (\Exception $e) { } diff --git a/lib/classes/recordutils/image.php b/lib/classes/recordutils/image.php index f216a704f8..037ad98c4e 100644 --- a/lib/classes/recordutils/image.php +++ b/lib/classes/recordutils/image.php @@ -59,7 +59,7 @@ class recordutils_image extends recordutils if (MediaInterface::TYPE_IMAGE === $image->getType()) { $rotation = $image->getOrientation(); } - } catch (Exception $e) { + } catch (\Exception $e) { // getting orientation failed but we don't care the reason } diff --git a/lib/classes/set/export.php b/lib/classes/set/export.php index f2fb0613e5..0a850ba7ea 100644 --- a/lib/classes/set/export.php +++ b/lib/classes/set/export.php @@ -93,7 +93,7 @@ class set_export extends set_abstract try { $record = new record_adapter($this->app, $basrec[0], $basrec[1]); - } catch (Exception_Record_AdapterNotFound $e) { + } catch (\Exception_Record_AdapterNotFound $e) { continue; } diff --git a/lib/classes/set/selection.php b/lib/classes/set/selection.php index 9038d16423..bb8a330f60 100644 --- a/lib/classes/set/selection.php +++ b/lib/classes/set/selection.php @@ -100,7 +100,7 @@ class set_selection extends set_abstract if ($num_rows == 0) { $to_remove[] = $id; } - } catch (Exception $e) { + } catch (\Exception $e) { } } @@ -125,7 +125,7 @@ class set_selection extends set_abstract if (count($basrec) == 2) { try { $record = new record_adapter($this->app, (int) $basrec[0], (int) $basrec[1], count($this->elements)); - } catch (Exception $e) { + } catch (\Exception $e) { continue; } if ($record->is_grouping() && $flatten_groupings === true) { diff --git a/templates/web/prod/upload/lazaret.html.twig b/templates/web/prod/upload/lazaret.html.twig index 6983f43581..a544038944 100644 --- a/templates/web/prod/upload/lazaret.html.twig +++ b/templates/web/prod/upload/lazaret.html.twig @@ -2,10 +2,27 @@ {% if lazaretFiles is not none %} {% if lazaretFiles|length > 0 %} -
- +
+
+ +
+
+ + {% set items = lazaretFiles | length %} + {% set pages = (items / perPage) | ceil | min(10) %} + + {% for i in 1..pages %} + + {% endfor %} +