diff --git a/lib/Alchemy/Phrasea/Application/Lightbox.php b/lib/Alchemy/Phrasea/Application/Lightbox.php index 6aaa885ae0..bfe88ef773 100644 --- a/lib/Alchemy/Phrasea/Application/Lightbox.php +++ b/lib/Alchemy/Phrasea/Application/Lightbox.php @@ -418,7 +418,7 @@ class Lightbox implements ControllerProviderInterface $evt_mngr = $app['events-manager']; $expires = new \DateTime('+10 days'); - $url = $app['phraseanet.appbox']->get_registry()->get('GV_ServerName') + $url = $app['phraseanet.registry']->get('GV_ServerName') . 'lightbox/index.php?LOG=' . \random::getUrlToken( $app, \random::TYPE_VALIDATE , $basket->getValidation()->getInitiator($app)->get_id() diff --git a/lib/Alchemy/Phrasea/Application/OAuth2.php b/lib/Alchemy/Phrasea/Application/OAuth2.php index bcce9bb95f..010442fa83 100644 --- a/lib/Alchemy/Phrasea/Application/OAuth2.php +++ b/lib/Alchemy/Phrasea/Application/OAuth2.php @@ -62,7 +62,7 @@ return call_user_func(function($environment = 'prod') { $custom_template = sprintf( "%sconfig/templates/web/api/auth/end_user_authorization/%s.html.twig" - , $app['phraseanet.appbox']->get_registry()->get('GV_RootPath') + , $app['phraseanet.registry']->get('GV_RootPath') , $client->get_id() ); diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php index 4f8d1eb467..587794c54f 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php @@ -652,10 +652,9 @@ class Databox implements ControllerProviderInterface */ public function mountCollection(Application $app, Request $request, $databox_id, $collection_id) { - $appbox = $app['phraseanet.appbox']; $user = $app['phraseanet.user']; - $appbox->get_connection()->beginTransaction(); + $app['phraseanet.appbox']->get_connection()->beginTransaction(); try { $baseId = \collection::mount_collection($app, $app['phraseanet.appbox']->get_databox($databox_id), $collection_id, $user); @@ -676,11 +675,11 @@ class Databox implements ControllerProviderInterface $n += 50; } - $appbox->get_connection()->commit(); + $app['phraseanet.appbox']->get_connection()->commit(); return $app->redirect('/admin/databox/' . $databox_id . '/?mount=ok'); } catch (\Exception $e) { - $appbox->get_connection()->rollBack(); + $app['phraseanet.appbox']->get_connection()->rollBack(); return $app->redirect('/admin/databox/' . $databox_id . '/?mount=ko'); } @@ -899,7 +898,7 @@ class Databox implements ControllerProviderInterface $app->abort(400, _('Bad request format, only JSON is allowed')); } - $appbox = $app['phraseanet.appbox']; + $app['phraseanet.appbox'] = $app['phraseanet.appbox']; $ret = array( 'success' => false, @@ -914,10 +913,10 @@ class Databox implements ControllerProviderInterface ); try { - $databox = $appbox->get_databox($databox_id); + $databox = $app['phraseanet.appbox']->get_databox($databox_id); $datas = $databox->get_indexed_record_amount(); - $ret['indexable'] = $appbox->is_databox_indexable($databox); + $ret['indexable'] = $app['phraseanet.appbox']->is_databox_indexable($databox); $ret['viewname'] = (($databox->get_dbname() == $databox->get_viewname()) ? _('admin::base: aucun alias') : $databox->get_viewname()); $ret['records'] = $databox->get_record_amount(); $ret['sbas_id'] = $databox_id; diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php index 4b1c2167cc..65766280c3 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php @@ -288,7 +288,6 @@ class Databoxes implements ControllerProviderInterface return $app->redirect('/admin/databoxes/?success=0&error=special-chars'); } - $appbox = $app['phraseanet.appbox']; $registry = $app['phraseanet.registry']; if ((null === $request->request->get('new_settings'))) { @@ -301,14 +300,14 @@ class Databoxes implements ControllerProviderInterface $user = $connexion->get('user'); $password = $connexion->get('password'); - $appbox->get_connection()->beginTransaction(); + $app['phraseanet.appbox']->get_connection()->beginTransaction(); $base = \databox::mount($app, $hostname, $port, $user, $password, $dbName, $registry); $base->registerAdmin($app['phraseanet.user']); - $appbox->get_connection()->commit(); + $app['phraseanet.appbox']->get_connection()->commit(); return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1'); } catch (\Exception $e) { - $appbox->get_connection()->rollBack(); + $app['phraseanet.appbox']->get_connection()->rollBack(); return $app->redirect('/admin/databoxes/?success=0&error=mount-failed'); } } @@ -321,14 +320,14 @@ class Databoxes implements ControllerProviderInterface && (null !== $passwordDb = $request->request->get('new_password'))) { try { - $appbox->get_connection()->beginTransaction(); + $app['phraseanet.appbox']->get_connection()->beginTransaction(); $base = \databox::mount($app, $hostname, $port, $userDb, $passwordDb, $dbName, $registry); $base->registerAdmin($app['phraseanet.user']); - $appbox->get_connection()->commit(); + $app['phraseanet.appbox']->get_connection()->commit(); return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1'); } catch (\Exception $e) { - $appbox->get_connection()->rollBack(); + $app['phraseanet.appbox']->get_connection()->rollBack(); return $app->redirect('/admin/databoxes/?success=0&error=mount-failed'); } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Root.php b/lib/Alchemy/Phrasea/Controller/Admin/Root.php index ace291267c..b07063cdc7 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Root.php @@ -38,7 +38,6 @@ class Root implements ControllerProviderInterface }); $controllers->get('/', function(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; $user = $app['phraseanet.user']; \User_Adapter::updateClientInfos($app, 3); @@ -70,7 +69,7 @@ class Root implements ControllerProviderInterface } $databoxes = $off_databoxes = array(); - foreach ($appbox->get_databoxes() as $databox) { + foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { try { if (!$user->ACL()->has_access_to_sbas($databox->get_sbas_id())) { continue; @@ -105,7 +104,6 @@ class Root implements ControllerProviderInterface })->bind('admin'); $controllers->get('/tree/', function(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; $user = $app['phraseanet.user']; \User_Adapter::updateClientInfos($app, 3); @@ -138,7 +136,7 @@ class Root implements ControllerProviderInterface } $databoxes = $off_databoxes = array(); - foreach ($appbox->get_databoxes() as $databox) { + foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { try { if (!$user->ACL()->has_access_to_sbas($databox->get_sbas_id())) { continue; diff --git a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php index 09b6b19d28..a83ccb1d62 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php @@ -85,7 +85,7 @@ class TaskManager implements ControllerProviderInterface $controllers->get('/scheduler/log', function(Application $app, Request $request) { $appbox = $app['phraseanet.appbox']; - $registry = $appbox->get_registry(); + $registry = $app['phraseanet.registry']; $logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs'); $rname = '/scheduler((\.log)|(-.*\.log))$/'; @@ -129,7 +129,7 @@ class TaskManager implements ControllerProviderInterface $controllers->get('/task/{id}/log', function(Application $app, Request $request, $id) { $appbox = $app['phraseanet.appbox']; - $registry = $appbox->get_registry(); + $registry = $app['phraseanet.registry']; $logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs'); $rname = '/task_' . $id . '((\.log)|(-.*\.log))$/'; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php index e3dc05fa9b..ba7ba9b5e7 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php @@ -70,7 +70,7 @@ class Bridge implements ControllerProviderInterface $controllers->get('/login/{api_name}/', function(Application $app, $api_name) { $appbox = $app['phraseanet.appbox']; - $connector = \Bridge_Api::get_connector_by_name($appbox->get_registry(), $api_name); + $connector = \Bridge_Api::get_connector_by_name($app['phraseanet.registry'], $api_name); return $app->redirect($connector->get_auth_url()); }); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Feed.php b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php index 33499535ba..94cf47c0ef 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Feed.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php @@ -228,7 +228,7 @@ class Feed implements ControllerProviderInterface $user = $app['phraseanet.user']; $feeds = \Feed_Collection::load_all($app, $user); - $registry = $app['phraseanet.appbox']->get_registry(); + $registry = $app['phraseanet.registry']; $output = array( 'texte' => '
' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') @@ -244,7 +244,7 @@ class Feed implements ControllerProviderInterface $renew = ($request->query->get('renew') === 'true'); $user = $app['phraseanet.user']; $feed = \Feed_Adapter::load_with_user($app, $user, $id); - $registry = $app['phraseanet.appbox']->get_registry(); + $registry = $app['phraseanet.registry']; $output = array( 'texte' => '
' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php index 7e1908f24a..195c7998ea 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -38,7 +38,7 @@ class Query implements ControllerProviderInterface $controllers->post('/', function(Application $app, Request $request) { $appbox = $app['phraseanet.appbox']; - $registry = $appbox->get_registry(); + $registry = $app['phraseanet.registry']; $user = $app['phraseanet.user']; diff --git a/lib/classes/ACL.class.php b/lib/classes/ACL.class.php index 749f99ff81..c79f677c1d 100644 --- a/lib/classes/ACL.class.php +++ b/lib/classes/ACL.class.php @@ -1439,7 +1439,7 @@ class ACL implements cache_cacheableInterface foreach ($this->get_granted_base(array(), array($databox->get_sbas_id())) as $collection) { $stmt->execute(array( - ':site_id' => $this->app['phraseanet.appbox']->get_registry()->get('GV_sit'), + ':site_id' => $this->app['phraseanet.registry']->get('GV_sit'), ':usr_id' => $this->user->get_id(), ':coll_id' => $collection->get_coll_id(), ':mask_and' => $this->get_mask_and($collection->get_base_id()), @@ -1467,7 +1467,7 @@ class ACL implements cache_cacheableInterface $sql = 'DELETE FROM collusr WHERE usr_id = :usr_id AND site = :site'; $params = array( ':usr_id' => $this->user->get_id() - , ':site' => $this->app['phraseanet.appbox']->get_registry()->get('GV_sit') + , ':site' => $this->app['phraseanet.registry']->get('GV_sit') ); $stmt = $databox->get_connection()->prepare($sql); $stmt->execute($params); diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php index bb12da919d..637b1f26ce 100644 --- a/lib/classes/API/V1/adapter.class.php +++ b/lib/classes/API/V1/adapter.class.php @@ -829,7 +829,7 @@ class API_V1_adapter extends API_V1_Abstract public function search_records(Request $request) { $user = $this->app['phraseanet.user']; - $registry = $this->app['phraseanet.appbox']->get_registry(); + $registry = $this->app['phraseanet.registry']; $result = new API_V1_result($request, $this); $search_type = ($request->get('search_type') @@ -1044,7 +1044,7 @@ class API_V1_adapter extends API_V1_Abstract $mimes = $request->get('mimes', array()); foreach ($record->get_embedable_medias($devices, $mimes) as $name => $media) { - $ret[] = $this->list_embedable_media($media, $this->app['phraseanet.appbox']->get_registry()); + $ret[] = $this->list_embedable_media($media, $this->app['phraseanet.registry']); } $result->set_datas(array("embed" => $ret)); diff --git a/lib/classes/Bridge/Api.class.php b/lib/classes/Bridge/Api.class.php index 63df23077c..7c5eb4fc98 100644 --- a/lib/classes/Bridge/Api.class.php +++ b/lib/classes/Bridge/Api.class.php @@ -77,7 +77,7 @@ class Bridge_Api if ( ! $row) throw new Bridge_Exception_ApiNotFound('Api Not Found'); - $this->connector = self::get_connector_by_name($this->app['phraseanet.appbox']->get_registry(), $row['name']); + $this->connector = self::get_connector_by_name($this->app['phraseanet.registry'], $row['name']); $this->disable_time = $row['disable_time'] ? new DateTime($row['disable_time']) : null; $this->updated_on = new DateTime($row['updated_on']); $this->created_on = new DateTime($row['created_on']); diff --git a/lib/classes/Feed/Adapter.class.php b/lib/classes/Feed/Adapter.class.php index 4a61b43b63..f3b57290bf 100644 --- a/lib/classes/Feed/Adapter.class.php +++ b/lib/classes/Feed/Adapter.class.php @@ -138,7 +138,7 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea $url = '/skins/icons/rss32.gif'; - $file = $this->app['phraseanet.appbox']->get_registry()->get('GV_RootPath') + $file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/feed_' . $this->get_id() . '.jpg'; if (file_exists($file)) { diff --git a/lib/classes/Session/Authentication/Native.class.php b/lib/classes/Session/Authentication/Native.class.php index fc19858b15..232f99115d 100644 --- a/lib/classes/Session/Authentication/Native.class.php +++ b/lib/classes/Session/Authentication/Native.class.php @@ -249,7 +249,7 @@ class Session_Authentication_Native implements Session_Authentication_Interface protected function check_and_revoke_badlogs($ip) { $conn = $this->app['phraseanet.appbox']->get_connection(); - $registry = $this->app['phraseanet.appbox']->get_registry(); + $registry = $this->app['phraseanet.registry']; $sql = 'SELECT id FROM badlog WHERE (login = :login OR ip = :ip) AND locked="1"'; @@ -285,7 +285,7 @@ class Session_Authentication_Native implements Session_Authentication_Interface */ protected function is_captcha_activated(registryInterface $registry) { - $registry = $this->app['phraseanet.appbox']->get_registry(); + $registry = $this->app['phraseanet.registry']; return ($registry->get('GV_captchas') && trim($registry->get('GV_captcha_private_key')) !== '' diff --git a/lib/classes/Session/Logger.class.php b/lib/classes/Session/Logger.class.php index b487283c40..4f66ed5730 100644 --- a/lib/classes/Session/Logger.class.php +++ b/lib/classes/Session/Logger.class.php @@ -156,7 +156,7 @@ class Session_Logger WHERE site = :site AND sit_session = :ses_id'; $params = array( - ':site' => $databox->get_registry()->get('GV_sit') + ':site' => $app['phraseanet.registry']->get('GV_sit') , ':ses_id' => $app['session']->get('phrasea_session_id') ); diff --git a/lib/classes/User/Adapter.class.php b/lib/classes/User/Adapter.class.php index 6406de92fe..113f7dcf41 100644 --- a/lib/classes/User/Adapter.class.php +++ b/lib/classes/User/Adapter.class.php @@ -434,7 +434,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface */ public function get_protected_rss_url($renew = false) { - $registry = $this->app['phraseanet.appbox']->get_registry(); + $registry = $this->app['phraseanet.registry']; $token = $title = false; @@ -1632,7 +1632,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function get_locale() { - $registry = $this->app['phraseanet.appbox']->get_registry(); + $registry = $this->app['phraseanet.registry']; $sql = "SELECT locale FROM usr WHERE usr_id = :usr_id"; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); diff --git a/lib/classes/appbox.class.php b/lib/classes/appbox.class.php index 39520c4bb4..c42ea78793 100644 --- a/lib/classes/appbox.class.php +++ b/lib/classes/appbox.class.php @@ -205,7 +205,7 @@ class appbox extends base } } - $registry = $databox->get_registry(); + $registry = $this->app['phraseanet.registry']; $file = $registry->get('GV_RootPath') . 'config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg'; $custom_path = $registry->get('GV_RootPath') . 'www/custom/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg'; @@ -323,7 +323,7 @@ class appbox extends base $upgrader->add_steps(7 + count($this->get_databoxes())); - $registry = $this->get_registry(); + $registry = $this->app['phraseanet.registry']; /** * Step 1 diff --git a/lib/classes/base.class.php b/lib/classes/base.class.php index 56ec18bb8d..6f631d6153 100644 --- a/lib/classes/base.class.php +++ b/lib/classes/base.class.php @@ -133,15 +133,6 @@ abstract class base implements cache_cacheableInterface return $this->host; } - /** - * - * @return registry - */ - public function get_registry() - { - return $this->app['phraseanet.registry']; - } - /** * * @return connection_pdo diff --git a/lib/classes/databox.class.php b/lib/classes/databox.class.php index 1ec9bc9219..f375c5f8a0 100644 --- a/lib/classes/databox.class.php +++ b/lib/classes/databox.class.php @@ -348,7 +348,7 @@ class databox extends base $n+=50; } - $params = array(':site_id' => $this->get_registry()->get('GV_sit')); + $params = array(':site_id' => $this->app['phraseanet.registry']->get('GV_sit')); $sql = 'DELETE FROM clients WHERE site_id = :site_id'; $stmt = $this->get_connection()->prepare($sql); diff --git a/lib/classes/eventsmanager/broker.class.php b/lib/classes/eventsmanager/broker.class.php index a561c04779..73035699e2 100644 --- a/lib/classes/eventsmanager/broker.class.php +++ b/lib/classes/eventsmanager/broker.class.php @@ -26,8 +26,8 @@ class eventsmanager_broker public function start() { $iterators_pool = array( - 'event' => (is_array($this->app['phraseanet.appbox']->get_registry()->get('GV_events')) ? $this->app['phraseanet.appbox']->get_registry()->get('GV_events') : array()), - 'notify' => (is_array($this->app['phraseanet.appbox']->get_registry()->get('GV_notifications')) ? $this->app['phraseanet.appbox']->get_registry()->get('GV_notifications') : array()) + 'event' => (is_array($this->app['phraseanet.registry']->get('GV_events')) ? $this->app['phraseanet.registry']->get('GV_events') : array()), + 'notify' => (is_array($this->app['phraseanet.registry']->get('GV_notifications')) ? $this->app['phraseanet.registry']->get('GV_notifications') : array()) ); foreach ($iterators_pool as $type => $iterators) { diff --git a/lib/classes/eventsmanager/notify/autoregister.class.php b/lib/classes/eventsmanager/notify/autoregister.class.php index 0133eb54f1..40bf4a2baa 100644 --- a/lib/classes/eventsmanager/notify/autoregister.class.php +++ b/lib/classes/eventsmanager/notify/autoregister.class.php @@ -125,8 +125,8 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract $to = array('email' => $admin_user->get_email(), 'name' => $dest); $from = array( - 'email' => $this->app['phraseanet.appbox']->get_registry()->get('GV_defaulmailsenderaddr'), - 'name' => $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle') + 'email' => $this->app['phraseanet.registry']->get('GV_defaulmailsenderaddr'), + 'name' => $this->app['phraseanet.registry']->get('GV_homeTitle') ); if (self::mail($to, $from, $datas)) @@ -196,7 +196,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract public function mail($to, $from, $datas) { $subject = sprintf(_('admin::register: Inscription automatique sur %s') - , $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle')); + , $this->app['phraseanet.registry']->get('GV_homeTitle')); $body = "