diff --git a/bin/console b/bin/console index d763d97f6c..dfb900c816 100755 --- a/bin/console +++ b/bin/console @@ -23,11 +23,6 @@ use Alchemy\Phrasea\Command\RescanTechnicalDatas; use Alchemy\Phrasea\Command\BuildMissingSubdefs; use Alchemy\Phrasea\Command\RecordAdd; use Alchemy\Phrasea\Command\CreateCollection; -use Alchemy\Phrasea\PhraseanetServiceProvider; -use Alchemy\Phrasea\Core\Provider\BrowserServiceProvider; -use Silex\Provider\UrlGeneratorServiceProvider; -use Silex\Provider\ValidatorServiceProvider; -use Silex\Provider\TwigServiceProvider; use Alchemy\Phrasea\CLI; require_once dirname(__FILE__) . '/../lib/classes/bootstrap.class.php'; diff --git a/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php b/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php index a4d4e6c01a..365843900b 100644 --- a/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php +++ b/lib/Alchemy/Phrasea/Controller/AbstractDelivery.php @@ -38,7 +38,6 @@ abstract class AbstractDelivery implements ControllerProviderInterface $log_id = null; try { - $registry = $app['phraseanet.registry']; $logger = $app['phraseanet.logger']($record->get_databox()); $log_id = $logger->get_id(); @@ -48,7 +47,7 @@ abstract class AbstractDelivery implements ControllerProviderInterface $referrer = $_SERVER['HTTP_REFERER']; } - $record->log_view($log_id, $referrer, $registry->get('GV_sit')); + $record->log_view($log_id, $referrer, $app['phraseanet.registry']->get('GV_sit')); } catch (\Exception $e) { } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php index 65766280c3..b9550b4695 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php @@ -214,8 +214,6 @@ class Databoxes implements ControllerProviderInterface return $app->redirect('/admin/databoxes/?error=special-chars'); } - $registry = $app['phraseanet.registry']; - if ((null === $request->request->get('new_settings')) && (null !== $dataTemplate = $request->request->get('new_data_template'))) { $configuration = $app['phraseanet.configuration']; @@ -227,16 +225,16 @@ class Databoxes implements ControllerProviderInterface $user = $connexion->get('user'); $password = $connexion->get('password'); - $dataTemplate = new \SplFileInfo($registry->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $dataTemplate . '.xml'); + $dataTemplate = new \SplFileInfo($app['phraseanet.registry']->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $dataTemplate . '.xml'); try { - $connbas = new \connection_pdo('databox_creation', $hostname, $port, $user, $password, $dbName, array(), $registry); + $connbas = new \connection_pdo('databox_creation', $hostname, $port, $user, $password, $dbName, array(), $app['phraseanet.registry']); } catch (\PDOException $e) { return $app->redirect('/admin/databoxes/?success=0&error=database-failed'); } try { - $base = \databox::create($app, $connbas, $dataTemplate, $registry); + $base = \databox::create($app, $connbas, $dataTemplate, $app['phraseanet.registry']); $base->registerAdmin($app['phraseanet.user']); $app['phraseanet.user']->ACL()->delete_data_from_cache(); @@ -255,10 +253,10 @@ class Databoxes implements ControllerProviderInterface && (null !== $dataTemplate = $request->request->get('new_data_template'))) { try { - $data_template = new \SplFileInfo($registry->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $dataTemplate . '.xml'); - $connbas = new \connection_pdo('databox_creation', $hostname, $port, $userDb, $passwordDb, $dbName, array(), $registry); + $data_template = new \SplFileInfo($app['phraseanet.registry']->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $dataTemplate . '.xml'); + $connbas = new \connection_pdo('databox_creation', $hostname, $port, $userDb, $passwordDb, $dbName, array(), $app['phraseanet.registry']); try { - $base = \databox::create($app, $connbas, $data_template, $registry); + $base = \databox::create($app, $connbas, $data_template, $app['phraseanet.registry']); $base->registerAdmin($app['phraseanet.user']); return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1'); @@ -288,8 +286,6 @@ class Databoxes implements ControllerProviderInterface return $app->redirect('/admin/databoxes/?success=0&error=special-chars'); } - $registry = $app['phraseanet.registry']; - if ((null === $request->request->get('new_settings'))) { try { $configuration = $app['phraseanet.configuration']; @@ -301,7 +297,7 @@ class Databoxes implements ControllerProviderInterface $password = $connexion->get('password'); $app['phraseanet.appbox']->get_connection()->beginTransaction(); - $base = \databox::mount($app, $hostname, $port, $user, $password, $dbName, $registry); + $base = \databox::mount($app, $hostname, $port, $user, $password, $dbName, $app['phraseanet.registry']); $base->registerAdmin($app['phraseanet.user']); $app['phraseanet.appbox']->get_connection()->commit(); @@ -321,7 +317,7 @@ class Databoxes implements ControllerProviderInterface try { $app['phraseanet.appbox']->get_connection()->beginTransaction(); - $base = \databox::mount($app, $hostname, $port, $userDb, $passwordDb, $dbName, $registry); + $base = \databox::mount($app, $hostname, $port, $userDb, $passwordDb, $dbName, $app['phraseanet.registry']); $base->registerAdmin($app['phraseanet.user']); $app['phraseanet.appbox']->get_connection()->commit(); diff --git a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php index a83ccb1d62..4d71dd19e9 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php @@ -84,9 +84,7 @@ class TaskManager implements ControllerProviderInterface }); $controllers->get('/scheduler/log', function(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; - $registry = $app['phraseanet.registry']; - $logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs'); + $logdir = \p4string::addEndSlash($app['phraseanet.registry']->get('GV_RootPath') . 'logs'); $rname = '/scheduler((\.log)|(-.*\.log))$/'; @@ -128,9 +126,7 @@ class TaskManager implements ControllerProviderInterface $controllers->get('/task/{id}/log', function(Application $app, Request $request, $id) { - $appbox = $app['phraseanet.appbox']; - $registry = $app['phraseanet.registry']; - $logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs'); + $logdir = \p4string::addEndSlash($app['phraseanet.registry']->get('GV_RootPath') . 'logs'); $rname = '/task_' . $id . '((\.log)|(-.*\.log))$/'; diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Users.php b/lib/Alchemy/Phrasea/Controller/Admin/Users.php index 85c8324c4c..efde2e7342 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Users.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Users.php @@ -27,8 +27,6 @@ class Users implements ControllerProviderInterface public function connect(Application $app) { - $appbox = $app['phraseanet.appbox']; - $controllers = $app['controllers_factory']; $controllers->post('/rights/', function(Application $app) { @@ -194,7 +192,7 @@ class Users implements ControllerProviderInterface return $app->redirect('/admin/users/search/'); }); - $controllers->get('/typeahead/search/', function(Application $app) use ($appbox) { + $controllers->get('/typeahead/search/', function(Application $app) { $request = $app['request']; $user_query = new \User_Query($app); @@ -257,7 +255,7 @@ class Users implements ControllerProviderInterface return $app->json($datas); }); - $controllers->post('/export/csv/', function(Application $app) use ($appbox) { + $controllers->post('/export/csv/', function(Application $app) { $request = $app['request']; $user_query = new \User_Query($app); @@ -333,12 +331,12 @@ class Users implements ControllerProviderInterface return $response; }); - $controllers->get('/demands/', function(Application $app, Request $request) use ($appbox) { + $controllers->get('/demands/', function(Application $app, Request $request) { $user = $app['phraseanet.user']; $lastMonth = time() - (3 * 4 * 7 * 24 * 60 * 60); $sql = "DELETE FROM demand WHERE date_modif < :date"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(array(':date' => date('Y-m-d', $lastMonth))); $stmt->closeCursor(); @@ -346,7 +344,7 @@ class Users implements ControllerProviderInterface $sql = 'SELECT usr_id, usr_login FROM usr WHERE model_of = :usr_id'; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $user->get_id())); $models = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -360,7 +358,7 @@ class Users implements ControllerProviderInterface WHERE (base_id='" . implode("' OR base_id='", $baslist) . "') ORDER BY demand.usr_id DESC,demand.base_id ASC "; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -392,7 +390,7 @@ class Users implements ControllerProviderInterface )); })->bind('users_display_demands'); - $controllers->post('/demands/', function(Application $app, Request $request) use ($appbox) { + $controllers->post('/demands/', function(Application $app, Request $request) { $templates = $deny = $accept = $options = array(); @@ -463,7 +461,7 @@ class Users implements ControllerProviderInterface WHERE usr_id = :usr_id AND (base_id = " . implode(' OR base_id = ', $base_ids) . ")"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $usr)); $stmt->closeCursor(); } @@ -473,7 +471,7 @@ class Users implements ControllerProviderInterface WHERE usr_id = :usr_id AND base_id = :base_id"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); foreach ($deny as $usr => $bases) { $cache_to_update[$usr] = true; @@ -515,7 +513,7 @@ class Users implements ControllerProviderInterface $done[$usr][$bas] = true; $sql = "DELETE FROM demand WHERE usr_id = :usr_id AND base_id = :base_id"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $usr, ':base_id' => $bas)); $stmt->closeCursor(); } @@ -530,7 +528,7 @@ class Users implements ControllerProviderInterface foreach ($done as $usr => $bases) { $sql = 'SELECT usr_mail FROM usr WHERE usr_id = :usr_id'; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $usr)); $row = $stmt->fetch(\PDO::FETCH_ASSOC); $stmt->closeCursor(); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php index ba7ba9b5e7..1c686dbc77 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php @@ -55,7 +55,6 @@ class Bridge implements ControllerProviderInterface $controllers->post('/manager/', function(Application $app) { $route = new RecordHelper\Bridge($app, $app['request']); - $appbox = $app['phraseanet.appbox']; $user = $app['phraseanet.user']; $params = array( @@ -69,7 +68,6 @@ 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($app['phraseanet.registry'], $api_name); return $app->redirect($connector->get_auth_url()); @@ -78,7 +76,6 @@ class Bridge implements ControllerProviderInterface $controllers->get('/callback/{api_name}/', function(Application $app, $api_name) { $error_message = ''; try { - $appbox = $app['phraseanet.appbox']; $user = $app['phraseanet.user']; $api = \Bridge_Api::get_by_api_name($app, $api_name); $connector = $api->get_connector(); @@ -112,7 +109,6 @@ class Bridge implements ControllerProviderInterface }); $controllers->get('/adapter/{account_id}/logout/', function(Application $app, $account_id) { - $appbox = $app['phraseanet.appbox']; $account = \Bridge_Account::load_account($app, $account_id); $app['require_connection']($account); $account->get_api()->get_connector()->disconnect(); @@ -124,7 +120,6 @@ class Bridge implements ControllerProviderInterface $page = max((int) $app['request']->query->get('page'), 0); $quantity = 10; $offset_start = max(($page - 1) * $quantity, 0); - $appbox = $app['phraseanet.appbox']; $account = \Bridge_Account::load_account($app, $account_id); $elements = \Bridge_Element::get_elements_by_account($app, $account, $offset_start, $quantity); @@ -145,7 +140,6 @@ class Bridge implements ControllerProviderInterface $page = max((int) $app['request']->query->get('page'), 0); $quantity = 5; $offset_start = max(($page - 1) * $quantity, 0); - $appbox = $app['phraseanet.appbox']; $account = \Bridge_Account::load_account($app, $account_id); $app['require_connection']($account); @@ -169,7 +163,6 @@ class Bridge implements ControllerProviderInterface $page = max((int) $app['request']->query->get('page'), 0); $quantity = 5; $offset_start = max(($page - 1) * $quantity, 0); - $appbox = $app['phraseanet.appbox']; $account = \Bridge_Account::load_account($app, $account_id); $app['require_connection']($account); @@ -189,7 +182,6 @@ class Bridge implements ControllerProviderInterface $controllers->get('/action/{account_id}/{action}/{element_type}/', function(Application $app, $account_id, $action, $element_type) { - $appbox = $app['phraseanet.appbox']; $account = \Bridge_Account::load_account($app, $account_id); $app['require_connection']($account); @@ -253,7 +245,6 @@ class Bridge implements ControllerProviderInterface })->assert('account_id', '\d+'); $controllers->post('/action/{account_id}/{action}/{element_type}/', function(Application $app, $account_id, $action, $element_type) { - $appbox = $app['phraseanet.appbox']; $account = \Bridge_Account::load_account($app, $account_id); $app['require_connection']($account); @@ -356,7 +347,6 @@ class Bridge implements ControllerProviderInterface $controllers->get('/upload/', function(Application $app) { $request = $app['request']; - $appbox = $app['phraseanet.appbox']; $account = \Bridge_Account::load_account($app, $request->query->get('account_id')); $app['require_connection']($account); @@ -381,7 +371,6 @@ class Bridge implements ControllerProviderInterface $controllers->post('/upload/', function(Application $app) { $errors = array(); $request = $app['request']; - $appbox = $app['phraseanet.appbox']; $account = \Bridge_Account::load_account($app, $request->request->get('account_id')); $app['require_connection']($account); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Feed.php b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php index 94cf47c0ef..2056671629 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Feed.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Feed.php @@ -228,12 +228,11 @@ class Feed implements ControllerProviderInterface $user = $app['phraseanet.user']; $feeds = \Feed_Collection::load_all($app, $user); - $registry = $app['phraseanet.registry']; $output = array( 'texte' => '

' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') . '

' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '

-
', +
', 'titre' => _('publications::votre rss personnel') ); @@ -244,12 +243,11 @@ 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.registry']; $output = array( 'texte' => '

' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') . '

' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '

-
', +
', 'titre' => _('publications::votre rss personnel') ); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Language.php b/lib/Alchemy/Phrasea/Controller/Prod/Language.php index d4d093b2b1..0266f05e61 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Language.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Language.php @@ -27,13 +27,12 @@ class Language implements ControllerProviderInterface $controller = $app['controllers_factory']; $controller->get("/", function(Application $app) { - $registry = $app['phraseanet.registry']; $out = array(); $out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.'); $out['confirmDel'] = _('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?'); $out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique'); - $out['serverName'] = $registry->get('GV_ServerName'); + $out['serverName'] = $app['phraseanet.registry']->get('GV_ServerName'); $out['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible'); $out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier'); $out['hideMessage'] = _('phraseanet::Ne plus afficher ce message'); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Push.php b/lib/Alchemy/Phrasea/Controller/Prod/Push.php index 512e9db176..ae658849b6 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Push.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Push.php @@ -146,14 +146,10 @@ class Push implements ControllerProviderInterface ); try { - $registry = $app['phraseanet.registry']; - $pusher = new RecordHelper\Push($app, $app['request']); $user = $app['phraseanet.user']; - $appbox = $app['phraseanet.appbox']; - $push_name = $request->request->get('name'); if (trim($push_name) === '') { @@ -216,7 +212,7 @@ class Push implements ControllerProviderInterface $app['EM']->flush(); - $url = $registry->get('GV_ServerName') + $url = $app['phraseanet.registry']->get('GV_ServerName') . 'lightbox/index.php?LOG=' . \random::getUrlToken($app, \random::TYPE_VIEW, $user_receiver->get_id(), null, $Basket->getId()); @@ -259,15 +255,12 @@ class Push implements ControllerProviderInterface $controllers->post('/validate/', function(Application $app) { $request = $app['request']; - $appbox = $app['phraseanet.appbox']; $ret = array( 'success' => false, 'message' => _('Unable to send the documents') ); - $registry = $app['phraseanet.registry']; - $app['EM']->beginTransaction(); try { @@ -339,8 +332,6 @@ class Push implements ControllerProviderInterface $Validation = $Basket->getValidation(); } - $appbox = $app['phraseanet.appbox']; - $found = false; foreach ($participants as $key => $participant) { if ($participant['usr_id'] == $user->get_id()) { @@ -419,7 +410,7 @@ class Push implements ControllerProviderInterface $app['EM']->flush(); - $url = $registry->get('GV_ServerName') + $url = $app['phraseanet.registry']->get('GV_ServerName') . 'lightbox/index.php?LOG=' . \random::getUrlToken($app, \random::TYPE_VIEW, $participant_user->get_id(), null, $Basket->getId()); @@ -531,8 +522,6 @@ class Push implements ControllerProviderInterface return $app->json($result); } - $appbox = $app['phraseanet.appbox']; - $user = null; $email = $request->request->get('email'); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php index 195c7998ea..1fb5f63569 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -37,9 +37,6 @@ class Query implements ControllerProviderInterface $controllers->post('/', function(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; - $registry = $app['phraseanet.registry']; - $user = $app['phraseanet.user']; $query = (string) $request->request->get('qry'); @@ -196,7 +193,7 @@ class Query implements ControllerProviderInterface $json['results'] = $app['twig']->render($template, array( 'results' => $result, - 'GV_social_tools' => $registry->get('GV_social_tools'), + 'GV_social_tools' => $app['phraseanet.registry']->get('GV_social_tools'), 'highlight' => $search_engine->get_query(), 'searchEngine' => $search_engine, 'suggestions' => $prop diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Root.php b/lib/Alchemy/Phrasea/Controller/Prod/Root.php index 40a179fc54..cebb907c79 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Root.php @@ -42,10 +42,8 @@ class Root implements ControllerProviderInterface \User_Adapter::updateClientInfos($app, 1); - $appbox = $app['phraseanet.appbox']; - $registry = $app['phraseanet.registry']; $user = $app['phraseanet.user']; - $cssPath = $registry->get('GV_RootPath') . 'www/skins/prod/'; + $cssPath = $app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/prod/'; $css = array(); $cssfile = false; @@ -78,15 +76,15 @@ class Root implements ControllerProviderInterface $queries_topics = ''; - if ($registry->get('GV_client_render_topics') == 'popups') { + if ($app['phraseanet.registry']->get('GV_client_render_topics') == 'popups') { $queries_topics = \queries::dropdown_topics($app['locale.I18n']); - } elseif ($registry->get('GV_client_render_topics') == 'tree') { + } elseif ($app['phraseanet.registry']->get('GV_client_render_topics') == 'tree') { $queries_topics = \queries::tree_topics($app['locale.I18n']); } $sbas = $bas2sbas = array(); - foreach ($appbox->get_databoxes() as $databox) { + foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { $sbas_id = $databox->get_sbas_id(); $sbas['s' + $sbas_id] = array( @@ -109,13 +107,13 @@ class Root implements ControllerProviderInterface 'cssfile' => $cssfile, 'module' => 'prod', 'events' => $app['events-manager'], - 'GV_defaultQuery_type' => $registry->get('GV_defaultQuery_type'), - 'GV_multiAndReport' => $registry->get('GV_multiAndReport'), - 'GV_thesaurus' => $registry->get('GV_thesaurus'), + 'GV_defaultQuery_type' => $app['phraseanet.registry']->get('GV_defaultQuery_type'), + 'GV_multiAndReport' => $app['phraseanet.registry']->get('GV_multiAndReport'), + 'GV_thesaurus' => $app['phraseanet.registry']->get('GV_thesaurus'), 'cgus_agreement' => \databox_cgu::askAgreement($app), 'css' => $css, 'feeds' => $feeds, - 'GV_google_api' => $registry->get('GV_google_api'), + 'GV_google_api' => $app['phraseanet.registry']->get('GV_google_api'), 'queries_topics' => $queries_topics, 'search_status' => \databox_status::getSearchStatus($app), 'queries_history' => \queries::history($app['phraseanet.appbox'], $app['phraseanet.user']->get_id()), diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php index 8428762b62..1fbe67ac7c 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php @@ -238,8 +238,6 @@ class Upload implements ControllerProviderInterface } else { $params = array('lazaret_file' => $elementCreated); - $appbox = $app['phraseanet.appbox']; - $eventsManager = $app['events-manager']; $eventsManager->trigger('__UPLOAD_QUARANTINE__', $params); diff --git a/lib/Alchemy/Phrasea/Controller/Root/Account.php b/lib/Alchemy/Phrasea/Controller/Root/Account.php index 7d4d18295b..ca5a27b19f 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Account.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Account.php @@ -262,8 +262,6 @@ class Account implements ControllerProviderInterface */ public function resetEmail(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; - if (null !== $token = $request->request->get('token')) { try { $datas = \random::helloToken($app, $token); @@ -363,8 +361,6 @@ class Account implements ControllerProviderInterface */ public function renewPassword(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; - if ((null !== $password = $request->request->get('form_password')) && (null !== $passwordConfirm = $request->request->get('form_password_confirm'))) { if ($password !== $passwordConfirm) { return $app->redirect('/account/reset-password/?pass-error=pass-match'); @@ -402,7 +398,6 @@ class Account implements ControllerProviderInterface $app->abort(400, _('Bad request format, only JSON is allowed')); } - $appbox = $app['phraseanet.appbox']; $error = false; try { @@ -479,7 +474,6 @@ class Account implements ControllerProviderInterface */ public function displayAccount(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; $user = $app['phraseanet.user']; $evtMngr = $app['events-manager']; @@ -518,7 +512,6 @@ class Account implements ControllerProviderInterface */ public function updateAccount(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; $user = $app['phraseanet.user']; $evtMngr = $app['events-manager']; $notice = 'account-update-bad'; @@ -526,7 +519,7 @@ class Account implements ControllerProviderInterface $demands = (array) $request->request->get('demand', array()); if (0 !== count($demands)) { - $register = new \appbox_register($appbox); + $register = new \appbox_register($app['phraseanet.appbox']); foreach ($demands as $baseId) { try { @@ -575,7 +568,7 @@ class Account implements ControllerProviderInterface } try { - $appbox->get_connection()->beginTransaction(); + $app['phraseanet.appbox']->get_connection()->beginTransaction(); $user->set_gender($request->request->get("form_gender")) ->set_firstname($request->request->get("form_firstname")) @@ -598,11 +591,11 @@ class Account implements ControllerProviderInterface ->set_ftp_dir_prefix($request->request->get("form_prefixFTPfolder")) ->set_defaultftpdatas($defaultDatas); - $appbox->get_connection()->commit(); + $app['phraseanet.appbox']->get_connection()->commit(); $notice = 'account-update-ok'; } catch (Exception $e) { - $appbox->get_connection()->rollBack(); + $app['phraseanet.appbox']->get_connection()->rollBack(); } } diff --git a/lib/Alchemy/Phrasea/Controller/Root/Developers.php b/lib/Alchemy/Phrasea/Controller/Root/Developers.php index 64b7fd9e50..08701bc7a7 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Developers.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Developers.php @@ -245,7 +245,6 @@ class Developers implements ControllerProviderInterface $app->abort(400, _('Bad request format, only JSON is allowed')); } - $appbox = $app['phraseanet.appbox']; $error = false; $accessToken = null; @@ -258,7 +257,7 @@ class Developers implements ControllerProviderInterface if ($token instanceof \API_OAuth2_Token) { $token->renew(); } else { - $token = \API_OAuth2_Token::create($appbox, $account); + $token = \API_OAuth2_Token::create($app['phraseanet.appbox'], $account); } $accessToken = $token->get_value(); diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index d913543269..46c16cf83f 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -211,8 +211,6 @@ class Login implements ControllerProviderInterface */ public function sendConfirmMail(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; - if (null === $usrId = $request->query->get('usr_id')) { $app->abort(400, sprintf(_('Request to send you the confirmation mail failed, please retry'))); } @@ -238,8 +236,6 @@ class Login implements ControllerProviderInterface */ public function registerConfirm(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; - if (null === $code = $request->query->get('code')) { return $app->redirect('/login/?redirect=/prod&error=code-not-found'); } @@ -270,7 +266,7 @@ class Login implements ControllerProviderInterface $user->set_mail_locked(false); \random::removeToken($app, $code); - $appboxRegister = new \appbox_register($appbox); + $appboxRegister = new \appbox_register($app['phraseanet.appbox']); $list = $appboxRegister->get_collection_awaiting_for_user($app, $user); @@ -299,8 +295,6 @@ class Login implements ControllerProviderInterface */ public function renewPassword(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; - if (null !== $mail = $request->request->get('mail')) { if (!\PHPMailer::ValidateAddress($mail)) { return $app->redirect('/login/forgot-password/?error=invalidmail'); @@ -682,23 +676,20 @@ class Login implements ControllerProviderInterface */ public function login(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; - $registry = $app['phraseanet.registry']; - - require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php'); - if ($registry->get('GV_captchas') && trim($registry->get('GV_captcha_private_key')) !== '' && trim($registry->get('GV_captcha_public_key')) !== '') { - include($registry->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php'); + require_once($app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php'); + if ($app['phraseanet.registry']->get('GV_captchas') && trim($app['phraseanet.registry']->get('GV_captcha_private_key')) !== '' && trim($app['phraseanet.registry']->get('GV_captcha_public_key')) !== '') { + include($app['phraseanet.registry']->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php'); } $warning = $request->query->get('error', ''); try { - $appbox->get_connection(); + $app['phraseanet.appbox']->get_connection(); } catch (\Exception $e) { $warning = 'no-connection'; } - if (!!$registry->get('GV_maintenance')) { + if (!!$app['phraseanet.registry']->get('GV_maintenance')) { $warning = 'maintenance'; } @@ -756,10 +747,10 @@ class Login implements ControllerProviderInterface } $captchaSys = ''; - if (!$registry->get('GV_maintenance') - && $registry->get('GV_captchas') - && trim($registry->get('GV_captcha_private_key')) !== '' - && trim($registry->get('GV_captcha_public_key')) !== '' + if (!$app['phraseanet.registry']->get('GV_maintenance') + && $app['phraseanet.registry']->get('GV_captchas') + && trim($app['phraseanet.registry']->get('GV_captcha_private_key')) !== '' + && trim($app['phraseanet.registry']->get('GV_captcha_public_key')) !== '' && $request->query->get('error') == 'captcha') { $captchaSys = '
@@ -768,7 +759,7 @@ class Login implements ControllerProviderInterface
' . _('login::captcha: recopier les mots ci dessous') . ' : -
' . recaptcha_get_html($registry->get('GV_captcha_public_key')) . '
'; +
' . recaptcha_get_html($app['phraseanet.registry']->get('GV_captcha_public_key')) . ''; } $public_feeds = \Feed_Collection::load_public_feeds($app); @@ -783,7 +774,7 @@ class Login implements ControllerProviderInterface 'captcha_system' => $captchaSys, 'login' => new \login(), 'feeds' => $feeds, - 'display_layout' => $registry->get('GV_home_publi') + 'display_layout' => $app['phraseanet.registry']->get('GV_home_publi') )); } @@ -796,9 +787,7 @@ class Login implements ControllerProviderInterface */ public function authenticate(Application $app, Request $request) { - $appbox = $app['phraseanet.appbox']; - $conn = $appbox->get_connection(); - $registry = $app['phraseanet.registry']; + $conn = $app['phraseanet.appbox']->get_connection(); $is_guest = false; @@ -818,13 +807,13 @@ class Login implements ControllerProviderInterface } else { $captcha = false; - if ($registry->get('GV_captchas') - && '' !== $privateKey = trim($registry->get('GV_captcha_private_key')) - && trim($registry->get('GV_captcha_public_key')) !== '' + if ($app['phraseanet.registry']->get('GV_captchas') + && '' !== $privateKey = trim($app['phraseanet.registry']->get('GV_captcha_private_key')) + && trim($app['phraseanet.registry']->get('GV_captcha_public_key')) !== '' && null !== $challenge = $request->request->get("recaptcha_challenge_field") && null !== $captachResponse = $request->request->get("recaptcha_response_field")) { - include($registry->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php'); + include($app['phraseanet.registry']->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php'); $checkCaptcha = recaptcha_check_answer($privateKey, $_SERVER["REMOTE_ADDR"], $challenge, $captachResponse); diff --git a/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php b/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php index 8ecdf845d1..2f37e1f7ab 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php +++ b/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php @@ -32,8 +32,6 @@ class RSSFeeds implements ControllerProviderInterface $perPage = 5; $entries = $feed->get_entries((($page - 1) * $perPage), $perPage); - $registry = $app['phraseanet.registry']; - if ($format == \Feed_Adapter::FORMAT_RSS) { $content = new \Feed_XML_RSS(); } @@ -47,9 +45,9 @@ class RSSFeeds implements ControllerProviderInterface } if ($user instanceof \User_Adapter) - $link = $feed->get_user_link($registry, $user, $format, $page); + $link = $feed->get_user_link($app['phraseanet.registry'], $user, $format, $page); else - $link = $feed->get_homepage_link($registry, $format, $page); + $link = $feed->get_homepage_link($app['phraseanet.registry'], $format, $page); $content->set_updated_on(new \DateTime()); $content->set_title($feed->get_title()); @@ -59,14 +57,14 @@ class RSSFeeds implements ControllerProviderInterface if ($user instanceof \User_Adapter) { if ($page > 1) - $content->set_previous_page($feed->get_user_link($registry, $user, $format, ($page - 1))); + $content->set_previous_page($feed->get_user_link($app['phraseanet.registry'], $user, $format, ($page - 1))); if ($total > ($page * $perPage)) - $content->set_next_page($feed->get_user_link($registry, $user, $format, ($page + 1))); + $content->set_next_page($feed->get_user_link($app['phraseanet.registry'], $user, $format, ($page + 1))); } else { if ($page > 1) - $content->set_previous_page($feed->get_homepage_link($registry, $format, ($page - 1))); + $content->set_previous_page($feed->get_homepage_link($app['phraseanet.registry'], $format, ($page - 1))); if ($total > ($page * $perPage)) - $content->set_next_page($feed->get_homepage_link($registry, $format, ($page + 1))); + $content->set_next_page($feed->get_homepage_link($app['phraseanet.registry'], $format, ($page + 1))); } foreach ($entries->get_entries() as $entry) $content->set_item($entry); diff --git a/lib/Alchemy/Phrasea/Controller/Setup/Installer.php b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php index 9e6e48f31f..c2030cb29e 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup/Installer.php +++ b/lib/Alchemy/Phrasea/Controller/Setup/Installer.php @@ -211,23 +211,22 @@ class Installer implements ControllerProviderInterface } } - $registry = $app['phraseanet.registry']; \setup::create_global_values($app); // $appbox->set_registry($registry); - $registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->request->get('datapath_noweb')), \registry::TYPE_STRING); - $registry->set('GV_ServerName', $servername, \registry::TYPE_STRING); - $registry->set('GV_cli', $request->request->get('binary_php'), \registry::TYPE_STRING); - $registry->set('GV_imagick', $request->request->get('binary_convert'), \registry::TYPE_STRING); - $registry->set('GV_pathcomposite', $request->request->get('binary_composite'), \registry::TYPE_STRING); - $registry->set('GV_swf_extract', $request->request->get('binary_swfextract'), \registry::TYPE_STRING); - $registry->set('GV_pdf2swf', $request->request->get('binary_pdf2swf'), \registry::TYPE_STRING); - $registry->set('GV_swf_render', $request->request->get('binary_swfrender'), \registry::TYPE_STRING); - $registry->set('GV_unoconv', $request->request->get('binary_unoconv'), \registry::TYPE_STRING); - $registry->set('GV_ffmpeg', $request->request->get('binary_ffmpeg'), \registry::TYPE_STRING); - $registry->set('GV_mp4box', $request->request->get('binary_MP4Box'), \registry::TYPE_STRING); - $registry->set('GV_pdftotext', $request->request->get('binary_xpdf'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->request->get('datapath_noweb')), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_ServerName', $servername, \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_cli', $request->request->get('binary_php'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_imagick', $request->request->get('binary_convert'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_pathcomposite', $request->request->get('binary_composite'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_swf_extract', $request->request->get('binary_swfextract'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_pdf2swf', $request->request->get('binary_pdf2swf'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_swf_render', $request->request->get('binary_swfrender'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_unoconv', $request->request->get('binary_unoconv'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_ffmpeg', $request->request->get('binary_ffmpeg'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_mp4box', $request->request->get('binary_MP4Box'), \registry::TYPE_STRING); + $app['phraseanet.registry']->set('GV_pdftotext', $request->request->get('binary_xpdf'), \registry::TYPE_STRING); $user = \User_Adapter::create($app, $request->request->get('email'), $request->request->get('password'), $request->request->get('email'), true); @@ -239,7 +238,7 @@ class Installer implements ControllerProviderInterface if ($databox_name && !\p4string::hasAccent($databox_name)) { $template = new \SplFileInfo(__DIR__ . '/../../../../conf.d/data_templates/' . $request->request->get('db_template') . '.xml'); - $databox = \databox::create($app, $connbas, $template, $registry); + $databox = \databox::create($app, $connbas, $template, $app['phraseanet.registry']); $user->ACL() ->give_access_to_sbas(array($databox->get_sbas_id())) ->update_rights_to_sbas( diff --git a/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php b/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php index e6ff528bc4..3491f26d90 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php +++ b/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php @@ -55,9 +55,8 @@ class Upgrader implements ControllerProviderInterface session_write_close(); ignore_user_abort(true); - $appbox = $app['phraseanet.appbox']; $upgrader = new \Setup_Upgrade($app); - $appbox->forceUpgrade($upgrader, $app); + $app['phraseanet.appbox']->forceUpgrade($upgrader, $app); /** * @todo Show recomandation instead of redirect diff --git a/lib/Alchemy/Phrasea/Core/Service/Border/BorderManager.php b/lib/Alchemy/Phrasea/Core/Service/Border/BorderManager.php index de5a8d800d..fbc720e61d 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Border/BorderManager.php +++ b/lib/Alchemy/Phrasea/Core/Service/Border/BorderManager.php @@ -38,7 +38,6 @@ class BorderManager extends ServiceAbstract */ protected function init() { - $appbox = $this->app['phraseanet.appbox']; $borderManager = new Manager($this->app); if ($this->app['xpdf.pdf2text']) { @@ -84,7 +83,7 @@ class BorderManager extends ServiceAbstract $databoxes = array(); foreach ($checker['databoxes'] as $sbas_id) { try { - $databoxes[] = $appbox->get_databox($sbas_id); + $databoxes[] = $this->app['phraseanet.appbox']->get_databox($sbas_id); } catch (\Exception $e) { throw new \InvalidArgumentException('Invalid databox option'); } diff --git a/lib/Alchemy/Phrasea/Helper/User/Manage.php b/lib/Alchemy/Phrasea/Helper/User/Manage.php index 9e8e645d3f..64eb3b2b75 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Manage.php +++ b/lib/Alchemy/Phrasea/Helper/User/Manage.php @@ -11,7 +11,6 @@ namespace Alchemy\Phrasea\Helper\User; -use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Helper\Helper; /** @@ -173,10 +172,9 @@ class Manage extends Helper if ($sendCredentials) { $urlToken = \random::getUrlToken($this->app, \random::TYPE_PASSWORD, $createdUser->get_id()); - $registry = $this->app['phraseanet.registry']; if (false !== $urlToken) { - $url = sprintf('%slogin/forgot-password/?token=%s', $registry->get('GV_ServerName'), $urlToken); + $url = sprintf('%slogin/forgot-password/?token=%s', $this->app['phraseanet.registry']->get('GV_ServerName'), $urlToken); \mail::send_credentials($this->app, $url, $createdUser->get_login(), $createdUser->get_email()); } } diff --git a/lib/Alchemy/Phrasea/Out/Module/PDF.php b/lib/Alchemy/Phrasea/Out/Module/PDF.php index 42a0ccdf58..c84e6ab7b7 100644 --- a/lib/Alchemy/Phrasea/Out/Module/PDF.php +++ b/lib/Alchemy/Phrasea/Out/Module/PDF.php @@ -12,7 +12,6 @@ namespace Alchemy\Phrasea\Out\Module; use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Out\Tool\PhraseaPDF; /** @@ -311,7 +310,6 @@ class PDF protected function print_preview($withtdm, $write_caption) { - $registry = $this->app['phraseanet.registry']; $user = $this->app['phraseanet.user']; if ($withtdm === true) { @@ -340,7 +338,7 @@ class PDF $RIGHT_TEXT = ""; $RIGHT_IMG = NULL; - $LEFT__IMG = $registry->get('GV_RootPath') . "config/minilogos/logopdf_" + $LEFT__IMG = $this->app['phraseanet.registry']->get('GV_RootPath') . "config/minilogos/logopdf_" . $rec->get_sbas_id() . ""; if (!is_file($LEFT__IMG)) { @@ -361,7 +359,7 @@ class PDF if ($vn == "" || $vn == "1") { $RIGHT_TEXT = \phrasea::bas_names($rec->get_base_id(), $this->app); } elseif ($vn == "2") { - $RIGHT_IMG = $registry->get('GV_RootPath') . "config/minilogos/" . $rec->get_base_id(); + $RIGHT_IMG = $this->app['phraseanet.registry']->get('GV_RootPath') . "config/minilogos/" . $rec->get_base_id(); } $xtmp = $this->pdf->GetX(); diff --git a/lib/classes/API/OAuth2/Account.class.php b/lib/classes/API/OAuth2/Account.class.php index 94ce99501f..57845bdf08 100644 --- a/lib/classes/API/OAuth2/Account.class.php +++ b/lib/classes/API/OAuth2/Account.class.php @@ -77,13 +77,6 @@ class API_OAuth2_Account */ protected $token; - /** - * Constructor - * - * @param appbox $appbox - * @param int $account_id - * @return API_OAuth2_Account - */ public function __construct(Application $app, $account_id) { $this->app = $app; @@ -230,13 +223,6 @@ class API_OAuth2_Account return; } - /** - * - * @param appbox $appbox - * @param User_Adapter $user - * @param API_OAuth2_Application $application - * @return API_OAuth2_Account - */ public static function create(Application $app, User_Adapter $user, API_OAuth2_Application $application) { $sql = 'INSERT INTO api_accounts @@ -261,13 +247,6 @@ class API_OAuth2_Account return new self($app, $account_id); } - /** - * - * @param appbox $appbox - * @param API_OAuth2_Application $application - * @param User_Adapter $user - * @return API_OAuth2_Account - */ public static function load_with_user(Application $app, API_OAuth2_Application $application, User_Adapter $user) { $sql = 'SELECT api_account_id FROM api_accounts diff --git a/lib/classes/API/OAuth2/Application.class.php b/lib/classes/API/OAuth2/Application.class.php index ed02c8c6fd..82680f383d 100644 --- a/lib/classes/API/OAuth2/Application.class.php +++ b/lib/classes/API/OAuth2/Application.class.php @@ -664,12 +664,6 @@ class API_OAuth2_Application return new self($app, $row['application_id']); } - /** - * - * @param appbox $appbox - * @param User_Adapter $user - * @return array - */ public static function load_dev_app_by_user(Application $app, User_Adapter $user) { $sql = 'SELECT a.application_id @@ -689,12 +683,6 @@ class API_OAuth2_Application return $apps; } - /** - * - * @param appbox $appbox - * @param user_adapter $user - * @return API_OAuth2_Application - */ public static function load_app_by_user(Application $app, user_adapter $user) { $sql = 'SELECT a.application_id diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php index 637b1f26ce..4ef0e699f7 100644 --- a/lib/classes/API/V1/adapter.class.php +++ b/lib/classes/API/V1/adapter.class.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Border\Attribute\Status; use Alchemy\Phrasea\Border\Manager as BorderManager; use Symfony\Component\HttpFoundation\Request; @@ -320,160 +319,158 @@ class API_V1_adapter extends API_V1_Abstract */ protected function get_gv_info(Application $app) { - $registry = $app['phraseanet.registry']; - return array( 'global_values' => array( - 'serverName' => $registry->get('GV_ServerName'), - 'title' => $registry->get('GV_homeTitle'), - 'keywords' => $registry->get('GV_metaKeywords'), - 'description' => $registry->get('GV_metaDescription'), + 'serverName' => $app['phraseanet.registry']->get('GV_ServerName'), + 'title' => $app['phraseanet.registry']->get('GV_homeTitle'), + 'keywords' => $app['phraseanet.registry']->get('GV_metaKeywords'), + 'description' => $app['phraseanet.registry']->get('GV_metaDescription'), 'httpServer' => array( - 'logErrors' => $registry->get('GV_log_errors'), + 'logErrors' => $app['phraseanet.registry']->get('GV_log_errors'), 'phpTimezone' => ini_get('date.timezone'), - 'siteId' => $registry->get('GV_sit'), - 'staticUrl' => $registry->get('GV_STATIC_URL'), - 'defaultLanguage' => $registry->get('id_GV_default_lng'), - 'allowIndexing' => $registry->get('GV_allow_search_engine'), + 'siteId' => $app['phraseanet.registry']->get('GV_sit'), + 'staticUrl' => $app['phraseanet.registry']->get('GV_STATIC_URL'), + 'defaultLanguage' => $app['phraseanet.registry']->get('id_GV_default_lng'), + 'allowIndexing' => $app['phraseanet.registry']->get('GV_allow_search_engine'), 'modes' => array( - 'XsendFile' => $registry->get('GV_modxsendfile'), - 'nginxXAccelRedirect' => $registry->get('GV_X_Accel_Redirect'), - 'nginxXAccelRedirectMountPoint' => $registry->get('GV_X_Accel_Redirect_mount_point'), - 'h264Streaming' => $registry->get('GV_h264_streaming'), - 'authTokenDirectory' => $registry->get('GV_mod_auth_token_directory'), - 'authTokenDirectoryPath' => $registry->get('GV_mod_auth_token_directory_path'), - 'authTokenPassphrase' => $registry->get('GV_mod_auth_token_passphrase'), + 'XsendFile' => $app['phraseanet.registry']->get('GV_modxsendfile'), + 'nginxXAccelRedirect' => $app['phraseanet.registry']->get('GV_X_Accel_Redirect'), + 'nginxXAccelRedirectMountPoint' => $app['phraseanet.registry']->get('GV_X_Accel_Redirect_mount_point'), + 'h264Streaming' => $app['phraseanet.registry']->get('GV_h264_streaming'), + 'authTokenDirectory' => $app['phraseanet.registry']->get('GV_mod_auth_token_directory'), + 'authTokenDirectoryPath' => $app['phraseanet.registry']->get('GV_mod_auth_token_directory_path'), + 'authTokenPassphrase' => $app['phraseanet.registry']->get('GV_mod_auth_token_passphrase'), ), 'files' => array( - 'owner' => $registry->get('GV_filesOwner'), - 'group' => $registry->get('GV_filesOwner'), + 'owner' => $app['phraseanet.registry']->get('GV_filesOwner'), + 'group' => $app['phraseanet.registry']->get('GV_filesOwner'), ) ), 'maintenance' => array( - 'alertMessage' => $registry->get('GV_message'), - 'displayMessage' => $registry->get('GV_message_on'), + 'alertMessage' => $app['phraseanet.registry']->get('GV_message'), + 'displayMessage' => $app['phraseanet.registry']->get('GV_message_on'), ), 'webServices' => array( - 'googleApi' => $registry->get('GV_google_api'), - 'googleAnalyticsId' => $registry->get('GV_googleAnalytics'), - 'googleChromeFrameDisclaimer' => $registry->get('GV_display_gcf'), - 'i18nWebService' => $registry->get('GV_i18n_service'), + 'googleApi' => $app['phraseanet.registry']->get('GV_google_api'), + 'googleAnalyticsId' => $app['phraseanet.registry']->get('GV_googleAnalytics'), + 'googleChromeFrameDisclaimer' => $app['phraseanet.registry']->get('GV_display_gcf'), + 'i18nWebService' => $app['phraseanet.registry']->get('GV_i18n_service'), 'recaptacha' => array( - 'active' => $registry->get('GV_captchas'), - 'publicKey' => $registry->get('GV_captcha_public_key'), - 'privateKey' => $registry->get('GV_captcha_private_key'), + 'active' => $app['phraseanet.registry']->get('GV_captchas'), + 'publicKey' => $app['phraseanet.registry']->get('GV_captcha_public_key'), + 'privateKey' => $app['phraseanet.registry']->get('GV_captcha_private_key'), ), 'youtube' => array( - 'active' => $registry->get('GV_youtube_api'), - 'clientId' => $registry->get('GV_youtube_client_id'), - 'clientSecret' => $registry->get('GV_youtube_client_secret'), - 'devKey' => $registry->get('GV_youtube_dev_key'), + 'active' => $app['phraseanet.registry']->get('GV_youtube_api'), + 'clientId' => $app['phraseanet.registry']->get('GV_youtube_client_id'), + 'clientSecret' => $app['phraseanet.registry']->get('GV_youtube_client_secret'), + 'devKey' => $app['phraseanet.registry']->get('GV_youtube_dev_key'), ), 'flickr' => array( - 'active' => $registry->get('GV_flickr_api'), - 'clientId' => $registry->get('GV_flickr_client_id'), - 'clientSecret' => $registry->get('GV_flickr_client_secret'), + 'active' => $app['phraseanet.registry']->get('GV_flickr_api'), + 'clientId' => $app['phraseanet.registry']->get('GV_flickr_client_id'), + 'clientSecret' => $app['phraseanet.registry']->get('GV_flickr_client_secret'), ), 'dailymtotion' => array( - 'active' => $registry->get('GV_dailymotion_api'), - 'clientId' => $registry->get('GV_dailymotion_client_id'), - 'clientSecret' => $registry->get('GV_dailymotion_client_secret'), + 'active' => $app['phraseanet.registry']->get('GV_dailymotion_api'), + 'clientId' => $app['phraseanet.registry']->get('GV_dailymotion_client_id'), + 'clientSecret' => $app['phraseanet.registry']->get('GV_dailymotion_client_secret'), ) ), 'navigator' => array( - 'active' => $registry->get('GV_client_navigator'), + 'active' => $app['phraseanet.registry']->get('GV_client_navigator'), ), 'homepage' => array( - 'viewType' => $registry->get('GV_home_publi'), + 'viewType' => $app['phraseanet.registry']->get('GV_home_publi'), ), 'report' => array( - 'anonymous' => $registry->get('GV_anonymousReport'), + 'anonymous' => $app['phraseanet.registry']->get('GV_anonymousReport'), ), 'events' => array( - 'events' => $registry->get('GV_events'), - 'notifications' => $registry->get('GV_notifications'), + 'events' => $app['phraseanet.registry']->get('GV_events'), + 'notifications' => $app['phraseanet.registry']->get('GV_notifications'), ), 'upload' => array( - 'allowedFileExtension' => $registry->get('GV_appletAllowedFileEx'), + 'allowedFileExtension' => $app['phraseanet.registry']->get('GV_appletAllowedFileEx'), ), 'filesystem' => array( - 'noWeb' => $registry->get('GV_base_datapath_noweb'), + 'noWeb' => $app['phraseanet.registry']->get('GV_base_datapath_noweb'), ), 'searchEngine' => array( 'configuration' => array( - 'defaultQuery' => $registry->get('GV_defaultQuery'), - 'defaultQueryType' => $registry->get('GV_defaultQuery_type'), + 'defaultQuery' => $app['phraseanet.registry']->get('GV_defaultQuery'), + 'defaultQueryType' => $app['phraseanet.registry']->get('GV_defaultQuery_type'), ), 'sphinx' => array( - 'active' => $registry->get('GV_sphinx'), - 'host' => $registry->get('GV_sphinx_host'), - 'port' => $registry->get('GV_sphinx_port'), - 'realtimeHost' => $registry->get('GV_sphinx_rt_host'), - 'realtimePort' => $registry->get('GV_sphinx_rt_port'), + 'active' => $app['phraseanet.registry']->get('GV_sphinx'), + 'host' => $app['phraseanet.registry']->get('GV_sphinx_host'), + 'port' => $app['phraseanet.registry']->get('GV_sphinx_port'), + 'realtimeHost' => $app['phraseanet.registry']->get('GV_sphinx_rt_host'), + 'realtimePort' => $app['phraseanet.registry']->get('GV_sphinx_rt_port'), ), 'phrasea' => array( - 'minChar' => $registry->get('GV_min_letters_truncation'), - 'sort' => $registry->get('GV_phrasea_sort'), + 'minChar' => $app['phraseanet.registry']->get('GV_min_letters_truncation'), + 'sort' => $app['phraseanet.registry']->get('GV_phrasea_sort'), ), ), 'binary' => array( - 'phpCli' => $registry->get('GV_cli'), - 'phpIni' => $registry->get('GV_PHP_INI'), - 'imagick' => $registry->get('GV_imagick'), - 'swfExtract' => $registry->get('GV_swf_extract'), - 'pdf2swf' => $registry->get('GV_pdf2swf'), - 'swfRender' => $registry->get('GV_swf_render'), - 'unoconv' => $registry->get('GV_unoconv'), - 'ffmpeg' => $registry->get('GV_ffmpeg'), - 'mp4box' => $registry->get('GV_mp4box'), - 'pdftotext' => $registry->get('GV_pdftotext'), - 'pdfmaxpages' => $registry->get('GV_pdfmaxpages'),), + 'phpCli' => $app['phraseanet.registry']->get('GV_cli'), + 'phpIni' => $app['phraseanet.registry']->get('GV_PHP_INI'), + 'imagick' => $app['phraseanet.registry']->get('GV_imagick'), + 'swfExtract' => $app['phraseanet.registry']->get('GV_swf_extract'), + 'pdf2swf' => $app['phraseanet.registry']->get('GV_pdf2swf'), + 'swfRender' => $app['phraseanet.registry']->get('GV_swf_render'), + 'unoconv' => $app['phraseanet.registry']->get('GV_unoconv'), + 'ffmpeg' => $app['phraseanet.registry']->get('GV_ffmpeg'), + 'mp4box' => $app['phraseanet.registry']->get('GV_mp4box'), + 'pdftotext' => $app['phraseanet.registry']->get('GV_pdftotext'), + 'pdfmaxpages' => $app['phraseanet.registry']->get('GV_pdfmaxpages'),), 'mainConfiguration' => array( - 'adminMail' => $registry->get('GV_adminMail'), - 'viewBasAndCollName' => $registry->get('GV_view_bas_and_coll'), - 'chooseExportTitle' => $registry->get('GV_choose_export_title'), - 'defaultExportTitle' => $registry->get('GV_default_export_title'), - 'socialTools' => $registry->get('GV_social_tools'),), + 'adminMail' => $app['phraseanet.registry']->get('GV_adminMail'), + 'viewBasAndCollName' => $app['phraseanet.registry']->get('GV_view_bas_and_coll'), + 'chooseExportTitle' => $app['phraseanet.registry']->get('GV_choose_export_title'), + 'defaultExportTitle' => $app['phraseanet.registry']->get('GV_default_export_title'), + 'socialTools' => $app['phraseanet.registry']->get('GV_social_tools'),), 'modules' => array( - 'thesaurus' => $registry->get('GV_thesaurus'), - 'storyMode' => $registry->get('GV_multiAndReport'), - 'docSubsitution' => $registry->get('GV_seeOngChgDoc'), - 'subdefSubstitution' => $registry->get('GV_seeNewThumb'),), + 'thesaurus' => $app['phraseanet.registry']->get('GV_thesaurus'), + 'storyMode' => $app['phraseanet.registry']->get('GV_multiAndReport'), + 'docSubsitution' => $app['phraseanet.registry']->get('GV_seeOngChgDoc'), + 'subdefSubstitution' => $app['phraseanet.registry']->get('GV_seeNewThumb'),), 'email' => array( - 'defaultMailAddress' => $registry->get('GV_defaulmailsenderaddr'), + 'defaultMailAddress' => $app['phraseanet.registry']->get('GV_defaulmailsenderaddr'), 'smtp' => array( - 'active' => $registry->get('GV_smtp'), - 'auth' => $registry->get('GV_smtp_auth'), - 'host' => $registry->get('GV_smtp_host'), - 'port' => $registry->get('GV_smtp_port'), - 'secure' => $registry->get('GV_smtp_secure'), - 'user' => $registry->get('GV_smtp_user'), - 'password' => $registry->get('GV_smtp_password'), + 'active' => $app['phraseanet.registry']->get('GV_smtp'), + 'auth' => $app['phraseanet.registry']->get('GV_smtp_auth'), + 'host' => $app['phraseanet.registry']->get('GV_smtp_host'), + 'port' => $app['phraseanet.registry']->get('GV_smtp_port'), + 'secure' => $app['phraseanet.registry']->get('GV_smtp_secure'), + 'user' => $app['phraseanet.registry']->get('GV_smtp_user'), + 'password' => $app['phraseanet.registry']->get('GV_smtp_password'), ), ), 'ftp' => array( - 'active' => $registry->get('GV_activeFTP'), - 'activeForUser' => $registry->get('GV_ftp_for_user'),), + 'active' => $app['phraseanet.registry']->get('GV_activeFTP'), + 'activeForUser' => $app['phraseanet.registry']->get('GV_ftp_for_user'),), 'client' => array( - 'maxSizeDownload' => $registry->get('GV_download_max'), - 'tabSearchMode' => $registry->get('GV_ong_search'), - 'tabAdvSearchPosition' => $registry->get('GV_ong_advsearch'), - 'tabTopicsPosition' => $registry->get('GV_ong_topics'), - 'tabOngActifPosition' => $registry->get('GV_ong_actif'), - 'renderTopicsMode' => $registry->get('GV_client_render_topics'), - 'displayRolloverPreview' => $registry->get('GV_rollover_reg_preview'), - 'displayRolloverBasket' => $registry->get('GV_rollover_chu'), - 'collRenderMode' => $registry->get('GV_client_coll_ckbox'), - 'viewSizeBaket' => $registry->get('GV_viewSizeBaket'), - 'clientAutoShowProposals' => $registry->get('GV_clientAutoShowProposals'), - 'needAuth2DL' => $registry->get('GV_needAuth2DL'),), + 'maxSizeDownload' => $app['phraseanet.registry']->get('GV_download_max'), + 'tabSearchMode' => $app['phraseanet.registry']->get('GV_ong_search'), + 'tabAdvSearchPosition' => $app['phraseanet.registry']->get('GV_ong_advsearch'), + 'tabTopicsPosition' => $app['phraseanet.registry']->get('GV_ong_topics'), + 'tabOngActifPosition' => $app['phraseanet.registry']->get('GV_ong_actif'), + 'renderTopicsMode' => $app['phraseanet.registry']->get('GV_client_render_topics'), + 'displayRolloverPreview' => $app['phraseanet.registry']->get('GV_rollover_reg_preview'), + 'displayRolloverBasket' => $app['phraseanet.registry']->get('GV_rollover_chu'), + 'collRenderMode' => $app['phraseanet.registry']->get('GV_client_coll_ckbox'), + 'viewSizeBaket' => $app['phraseanet.registry']->get('GV_viewSizeBaket'), + 'clientAutoShowProposals' => $app['phraseanet.registry']->get('GV_clientAutoShowProposals'), + 'needAuth2DL' => $app['phraseanet.registry']->get('GV_needAuth2DL'),), 'inscription' => array( - 'autoSelectDB' => $registry->get('GV_autoselectDB'), - 'autoRegister' => $registry->get('GV_autoregister'), + 'autoSelectDB' => $app['phraseanet.registry']->get('GV_autoselectDB'), + 'autoRegister' => $app['phraseanet.registry']->get('GV_autoregister'), ), 'push' => array( - 'validationReminder' => $registry->get('GV_validation_reminder'), - 'expirationValue' => $registry->get('GV_val_expiration'), + 'validationReminder' => $app['phraseanet.registry']->get('GV_validation_reminder'), + 'expirationValue' => $app['phraseanet.registry']->get('GV_val_expiration'), ), ) ); diff --git a/lib/classes/Bridge/Api.class.php b/lib/classes/Bridge/Api.class.php index 7c5eb4fc98..72f0b1c4ae 100644 --- a/lib/classes/Bridge/Api.class.php +++ b/lib/classes/Bridge/Api.class.php @@ -504,12 +504,6 @@ class Bridge_Api return new $classname($registry, $auth); } - /** - * - * @param appbox $appbox - * @param string $name - * @return Bridge_Api - */ public static function get_by_api_name(Application $app, $name) { $name = strtolower($name); @@ -552,12 +546,6 @@ class Bridge_Api return $results; } - /** - * - * @param appbox $appbox - * @param string $name - * @return Bridge_Api - */ public static function create(Application $app, $name) { $sql = 'INSERT INTO bridge_apis diff --git a/lib/classes/Bridge/Element.class.php b/lib/classes/Bridge/Element.class.php index 24e7434318..c3b4bd7d73 100644 --- a/lib/classes/Bridge/Element.class.php +++ b/lib/classes/Bridge/Element.class.php @@ -109,13 +109,6 @@ class Bridge_Element const STATUS_PENDING = 'pending'; const STATUS_ERROR = 'error'; - /** - * - * @param appbox $appbox - * @param Bridge_Account $account - * @param int $id - * @return Bridge_Element - */ public function __construct(Application $app, Bridge_Account $account, $id) { $this->app = $app; @@ -446,13 +439,6 @@ class Bridge_Element return; } - /** - * - * @param appbox $appbox - * @param Bridge_Account $account - * @param int $quantity - * @return Bridge_Element - */ public static function get_elements_by_account(Application $app, Bridge_Account $account, $offset_start = 0, $quantity = 50) { $sql = 'SELECT id FROM bridge_elements WHERE account_id = :account_id @@ -473,17 +459,6 @@ class Bridge_Element return $results; } - /** - * - * @param appbox $appbox - * @param Bridge_Account $account - * @param record_adapter $record - * @param string $title - * @param string $status - * @param string $type - * @param array $datas - * @return Bridge_Element - */ public static function create(Application $app, Bridge_Account $account, record_adapter $record, $title, $status, $type, Array $datas = array()) { $sql = 'INSERT INTO bridge_elements diff --git a/lib/classes/Feed/Adapter.class.php b/lib/classes/Feed/Adapter.class.php index f3b57290bf..8da8ccf7ba 100644 --- a/lib/classes/Feed/Adapter.class.php +++ b/lib/classes/Feed/Adapter.class.php @@ -59,12 +59,6 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea const CACHE_USER_TOKEN = 'usr_token'; const MAX_ENTRIES = 20; - /** - * - * @param appbox $appbox - * @param int $id - * @return Feed_Adapter - */ public function __construct(Application $app, $id) { $this->app = $app; @@ -161,10 +155,8 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea throw new \Alchemy\Phrasea\Exception\InvalidArgumentException('File does not exists'); } - $registry = $this->app['phraseanet.registry']; - - $config_file = $registry->get('GV_RootPath') . 'config/feed_' . $this->get_id() . '.jpg'; - $www_file = $registry->get('GV_RootPath') . 'www/custom/feed_' . $this->get_id() . '.jpg'; + $config_file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'config/feed_' . $this->get_id() . '.jpg'; + $www_file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/feed_' . $this->get_id() . '.jpg'; copy($file, $config_file); copy($file, $www_file); @@ -192,10 +184,9 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea public function reset_icon() { - $registry = $this->app['phraseanet.registry']; - $config_file = $registry->get('GV_RootPath') + $config_file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'config/feed_' . $this->get_id() . '.jpg'; - $www_file = $registry->get('GV_RootPath') + $www_file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/feed_' . $this->get_id() . '.jpg'; if (is_file($config_file)) @@ -440,14 +431,6 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea return $this; } - /** - * - * @param appbox $appbox - * @param User_Adapter $user - * @param string $title - * @param string $subtitle - * @return Feed_Adapter - */ public static function create(Application $app, User_Adapter $user, $title, $subtitle) { $sql = 'INSERT INTO feeds (id, title, subtitle, created_on, updated_on) @@ -465,13 +448,6 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea return $feed; } - /** - * - * @param appbox $appbox - * @param User_Adapter $user - * @param int $id - * @return Feed_Adapter - */ public static function load_with_user(Application $app, User_Adapter $user, $id) { $feed = new self($app, $id); diff --git a/lib/classes/Feed/Aggregate.class.php b/lib/classes/Feed/Aggregate.class.php index 67ffbfdd4d..76ba6dd8f5 100644 --- a/lib/classes/Feed/Aggregate.class.php +++ b/lib/classes/Feed/Aggregate.class.php @@ -25,12 +25,6 @@ class Feed_Aggregate extends Feed_Abstract implements Feed_Interface */ protected $feeds; - /** - * - * @param appbox $appbox - * @param array $feeds - * @return Feed_Aggregate - */ public function __construct(Application $app, Array $feeds) { $this->title = 'AGGREGGATE'; diff --git a/lib/classes/Feed/Entry/Adapter.class.php b/lib/classes/Feed/Entry/Adapter.class.php index c8ad644671..6a127d1119 100644 --- a/lib/classes/Feed/Entry/Adapter.class.php +++ b/lib/classes/Feed/Entry/Adapter.class.php @@ -170,11 +170,9 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa public function get_link() { - $registry = $this->app['phraseanet.registry']; - $href = sprintf( '%slightbox/feeds/entry/%d/' - , $registry->get('GV_ServerName') + , $this->app['phraseanet.registry']->get('GV_ServerName') , $this->get_id() ); @@ -496,17 +494,6 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa return; } - /** - * - * @param appbox $appbox - * @param Feed_Adapter $feed - * @param Feed_Publisher_Adapter $publisher - * @param string $title - * @param string $subtitle - * @param string $author_name - * @param string $author_mail - * @return Feed_Entry_Adapter - */ public static function create(Application $app, Feed_Adapter $feed , Feed_Publisher_Adapter $publisher, $title, $subtitle, $author_name, $author_mail) { diff --git a/lib/classes/Session/Authentication/Native.class.php b/lib/classes/Session/Authentication/Native.class.php index 232f99115d..593a1b99dd 100644 --- a/lib/classes/Session/Authentication/Native.class.php +++ b/lib/classes/Session/Authentication/Native.class.php @@ -249,7 +249,6 @@ 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.registry']; $sql = 'SELECT id FROM badlog WHERE (login = :login OR ip = :ip) AND locked="1"'; @@ -271,7 +270,7 @@ class Session_Authentication_Native implements Session_Authentication_Interface $stmt->execute(array(':login' => $this->login, ':ip' => $ip)); $stmt->closeCursor(); } elseif ($row_count > 9) { - if ($this->is_captcha_activated($registry)) + if ($this->is_captcha_activated($this->app['phraseanet.registry'])) throw new Exception_Session_RequireCaptcha('Require captcha'); } @@ -285,8 +284,6 @@ class Session_Authentication_Native implements Session_Authentication_Interface */ protected function is_captcha_activated(registryInterface $registry) { - $registry = $this->app['phraseanet.registry']; - return ($registry->get('GV_captchas') && trim($registry->get('GV_captcha_private_key')) !== '' && trim($registry->get('GV_captcha_public_key') !== '')); diff --git a/lib/classes/Session/Authentication/PersistentCookie.class.php b/lib/classes/Session/Authentication/PersistentCookie.class.php index 2be2fe9c06..271d8c3028 100644 --- a/lib/classes/Session/Authentication/PersistentCookie.class.php +++ b/lib/classes/Session/Authentication/PersistentCookie.class.php @@ -37,12 +37,6 @@ class Session_Authentication_PersistentCookie implements Session_Authentication_ */ protected $ses_id; - /** - * - * @param Application $appbox - * @param type $persistent_cookie - * @return Session_Authentication_PersistentCookie - */ public function __construct(Application $app, $persistent_cookie) { $this->app= $app; diff --git a/lib/classes/Session/Authentication/Token.class.php b/lib/classes/Session/Authentication/Token.class.php index 5b8f85d994..736a2cffc4 100644 --- a/lib/classes/Session/Authentication/Token.class.php +++ b/lib/classes/Session/Authentication/Token.class.php @@ -32,12 +32,6 @@ class Session_Authentication_Token implements Session_Authentication_Interface protected $token; protected $user; - /** - * - * @param appbox $appbox - * @param type $token - * @return Session_Authentication_Token - */ public function __construct(Application $app, $token) { $this->app = $app; diff --git a/lib/classes/Session/Logger.class.php b/lib/classes/Session/Logger.class.php index 4f66ed5730..e39d5506c1 100644 --- a/lib/classes/Session/Logger.class.php +++ b/lib/classes/Session/Logger.class.php @@ -100,7 +100,6 @@ class Session_Logger public static function create(Application $app, databox $databox, Browser $browser) { $colls = array(); - $registry = $app['phraseanet.registry']; if ($app['phraseanet.user']) { $bases = $app['phraseanet.user']->ACL()->get_granted_base(array(), array($databox->get_sbas_id())); diff --git a/lib/classes/Setup/Upgrade.class.php b/lib/classes/Setup/Upgrade.class.php index 85fff2521b..4149570960 100644 --- a/lib/classes/Setup/Upgrade.class.php +++ b/lib/classes/Setup/Upgrade.class.php @@ -52,11 +52,6 @@ class Setup_Upgrade */ protected $completed_steps = 0; - /** - * - * @param appbox $appbox - * @return Setup_Upgrade - */ public function __construct(Application $app, $force = false) { if ($force) { diff --git a/lib/classes/User/Adapter.class.php b/lib/classes/User/Adapter.class.php index 113f7dcf41..93b5b7f83f 100644 --- a/lib/classes/User/Adapter.class.php +++ b/lib/classes/User/Adapter.class.php @@ -434,8 +434,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface */ public function get_protected_rss_url($renew = false) { - $registry = $this->app['phraseanet.registry']; - $token = $title = false; if (!$renew) { @@ -455,7 +453,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $token = random::getUrlToken($this->app, \random::TYPE_RSS, $this->id); } - return new system_url($registry->get('GV_ServerName') . 'atom/' . $token); + return new system_url($this->app['phraseanet.registry']->get('GV_ServerName') . 'atom/' . $token); } /** @@ -1245,8 +1243,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface return $this; } - $registry = $this->app['phraseanet.registry']; - $sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id'; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(array(':id' => $this->id)); @@ -1259,8 +1255,8 @@ class User_Adapter implements User_Interface, cache_cacheableInterface foreach (self::$def_values as $k => $v) { if (!isset($this->_prefs[$k])) { - if ($k == 'start_page_query' && $registry->get('GV_defaultQuery')) { - $v = $registry->get('GV_defaultQuery'); + if ($k == 'start_page_query' && $this->app['phraseanet.registry']->get('GV_defaultQuery')) { + $v = $this->app['phraseanet.registry']->get('GV_defaultQuery'); } $this->_prefs[$k] = $v; @@ -1464,7 +1460,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public static function updateClientInfos(Application $app, $app_id) { - $appbox = $app['phraseanet.appbox']; if (!$app->isAuthenticated()) { return; } @@ -1501,7 +1496,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface foreach ($sbas_ids as $sbas_id) { try { - $logger = $app['phraseanet.logger']($appbox->get_databox($sbas_id)); + $logger = $app['phraseanet.logger']($app['phraseanet.appbox']->get_databox($sbas_id)); $connbas = connection::getPDOConnection($app, $sbas_id); $sql = 'SELECT appli FROM log WHERE id = :log_id'; @@ -1557,15 +1552,13 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public static function set_sys_admins(Application $app, $admins) { try { - $appbox = $app['phraseanet.appbox']; - $sql = "UPDATE usr SET create_db='0' WHERE create_db='1' AND usr_id != :usr_id"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $app['phraseanet.user']->get_id())); $stmt->closeCursor(); $sql = "UPDATE usr SET create_db='1' WHERE usr_id IN (" . implode(',', $admins) . ")"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); @@ -1581,9 +1574,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { $users = self::get_sys_admins($app); - $appbox = $app['phraseanet.appbox']; - - foreach ($appbox->get_databoxes() as $databox) { + foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { foreach (array_keys($users) as $usr_id) { $user = User_Adapter::getInstance($usr_id, $app); $user->ACL()->give_access_to_sbas(array($databox->get_sbas_id())); @@ -1632,15 +1623,13 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function get_locale() { - $registry = $this->app['phraseanet.registry']; - $sql = "SELECT locale FROM usr WHERE usr_id = :usr_id"; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(array(':usr_id' => $this->get_id())); $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $locale = $row['locale'] ? : $registry->get('GV_default_lng', 'en_GB'); + $locale = $row['locale'] ? : $this->app['phraseanet.registry']->get('GV_default_lng', 'en_GB'); return $locale; } @@ -1690,9 +1679,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public static function salt_password(Application $app, $password, $nonce) { - $registry = $app['phraseanet.registry']; - - return hash_hmac('sha512', $password . $nonce, $registry->get('GV_sit')); + return hash_hmac('sha512', $password . $nonce, $app['phraseanet.registry']->get('GV_sit')); } protected $nonce; diff --git a/lib/classes/appbox.class.php b/lib/classes/appbox.class.php index c42ea78793..6b58e3c133 100644 --- a/lib/classes/appbox.class.php +++ b/lib/classes/appbox.class.php @@ -9,11 +9,8 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\Version; -use Alchemy\Phrasea\Cache\Manager as CacheManager; -use Doctrine\ORM\EntityManager; use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Specification\Image as ImageSpecification; use Symfony\Component\Filesystem\Filesystem; @@ -145,10 +142,8 @@ class appbox extends base $collection->update_logo($pathfile); } - $registry = $this->app['phraseanet.registry']; - - $file = $registry->get('GV_RootPath') . 'config/' . $pic_type . '/' . $collection->get_base_id(); - $custom_path = $registry->get('GV_RootPath') . 'www/custom/' . $pic_type . '/' . $collection->get_base_id(); + $file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'config/' . $pic_type . '/' . $collection->get_base_id(); + $custom_path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/' . $pic_type . '/' . $collection->get_base_id(); foreach (array($file, $custom_path) as $target) { @@ -205,9 +200,8 @@ class appbox extends base } } - $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'; + $file = $this->app['phraseanet.registry']->get('GV_RootPath') . 'config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg'; + $custom_path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg'; foreach (array($file, $custom_path) as $target) { @@ -323,8 +317,6 @@ class appbox extends base $upgrader->add_steps(7 + count($this->get_databoxes())); - $registry = $this->app['phraseanet.registry']; - /** * Step 1 */ @@ -352,8 +344,8 @@ class appbox extends base $finder = new Symfony\Component\Finder\Finder(); $finder->in(array( - $registry->get('GV_RootPath') . 'tmp/cache_minify/', - $registry->get('GV_RootPath') . 'tmp/cache_minify/', + $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/cache_minify/', + $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/cache_minify/', ))->ignoreVCS(true)->ignoreDotFiles(true); foreach ($finder as $file) { @@ -374,7 +366,7 @@ class appbox extends base 'config/status/' => 'www/custom/status/', 'config/wm/' => 'www/custom/wm/', ) as $source => $target) { - $app['filesystem']->mirror($registry->get('GV_RootPath') . $source, $registry->get('GV_RootPath') . $target); + $app['filesystem']->mirror($this->app['phraseanet.registry']->get('GV_RootPath') . $source, $this->app['phraseanet.registry']->get('GV_RootPath') . $target); } $upgrader->add_steps_complete(1); diff --git a/lib/classes/base.class.php b/lib/classes/base.class.php index 6f631d6153..f7805921ec 100644 --- a/lib/classes/base.class.php +++ b/lib/classes/base.class.php @@ -538,8 +538,6 @@ abstract class base implements cache_cacheableInterface $correct_table = array('fields' => array(), 'indexes' => array(), 'collation' => array()); $alter = $alter_pre = $return = array(); - $registry = $this->app['phraseanet.registry']; - foreach ($table->fields->field as $field) { $expr = trim((string) $field->type); @@ -770,11 +768,9 @@ abstract class base implements cache_cacheableInterface $list_patches = array(); - $registry = $this->app['phraseanet.registry']; - $upgrader->add_steps(1)->set_current_message(_('Looking for patches')); - $iterator = new DirectoryIterator($registry->get('GV_RootPath') . 'lib/classes/patch/'); + $iterator = new DirectoryIterator($this->app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/patch/'); foreach ($iterator as $fileinfo) { if ( ! $fileinfo->isDot()) { diff --git a/lib/classes/cache/databox.class.php b/lib/classes/cache/databox.class.php index 5c4280b67a..272f746331 100644 --- a/lib/classes/cache/databox.class.php +++ b/lib/classes/cache/databox.class.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; /** * @@ -39,8 +38,6 @@ class cache_databox $date = new \DateTime('-3 seconds'); - $registry = $app['phraseanet.registry']; - $last_update = null; try { @@ -64,7 +61,7 @@ class cache_databox $sql = 'SELECT type, value FROM memcached WHERE site_id = :site_id'; $stmt = $connsbas->prepare($sql); - $stmt->execute(array(':site_id' => $registry->get('GV_ServerName'))); + $stmt->execute(array(':site_id' => $app['phraseanet.registry']->get('GV_ServerName'))); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -92,7 +89,7 @@ class cache_databox WHERE site_id = :site_id AND type="record" AND value = :value'; $params = array( - ':site_id' => $registry->get('GV_ServerName') + ':site_id' => $app['phraseanet.registry']->get('GV_ServerName') , ':value' => $row['value'] ); @@ -116,7 +113,7 @@ class cache_databox WHERE site_id = :site_id AND type="structure" AND value = :value'; $params = array( - ':site_id' => $registry->get('GV_ServerName') + ':site_id' => $app['phraseanet.registry']->get('GV_ServerName') , ':value' => $row['value'] ); @@ -156,14 +153,13 @@ class cache_databox $connbas = \connection::getPDOConnection($app, $sbas_id); - $registry = $app['phraseanet.registry']; $sql = 'SELECT distinct site_id as site_id FROM clients WHERE site_id != :site_id'; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':site_id' => $registry->get('GV_ServerName'))); + $stmt->execute(array(':site_id' => $app['phraseanet.registry']->get('GV_ServerName'))); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -185,11 +181,10 @@ class cache_databox { $connbas = $databox->get_connection(); - $registry = $app['phraseanet.registry']; $sql = 'SELECT site_id FROM clients WHERE site_id = :site_id'; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':site_id' => $registry->get('GV_ServerName'))); + $stmt->execute(array(':site_id' => $app['phraseanet.registry']->get('GV_ServerName'))); $rowCount = $stmt->rowCount(); $stmt->closeCursor(); @@ -199,7 +194,7 @@ class cache_databox $sql = 'INSERT INTO clients (site_id) VALUES (:site_id)'; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':site_id' => $registry->get('GV_ServerName'))); + $stmt->execute(array(':site_id' => $app['phraseanet.registry']->get('GV_ServerName'))); $stmt->closeCursor(); return; diff --git a/lib/classes/caption/Field/Value.class.php b/lib/classes/caption/Field/Value.class.php index dc114d5197..729bec2f2d 100644 --- a/lib/classes/caption/Field/Value.class.php +++ b/lib/classes/caption/Field/Value.class.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Vocabulary; /** @@ -195,8 +194,7 @@ class caption_Field_Value implements cache_cacheableInterface $this->record->get_caption()->delete_data_from_cache(); try { - $registry = $this->app['phraseanet.registry']; - $sphinx_rt = sphinxrt::get_instance($registry); + $sphinx_rt = sphinxrt::get_instance($this->app['phraseanet.registry']); $sbas_params = phrasea::sbas_params($this->app); @@ -279,8 +277,7 @@ class caption_Field_Value implements cache_cacheableInterface $this->delete_data_from_cache(); try { - $registry = $this->app['phraseanet.registry']; - $sphinx_rt = sphinxrt::get_instance($registry); + $sphinx_rt = sphinxrt::get_instance($this->app['phraseanet.registry']); $sbas_params = phrasea::sbas_params($this->app); @@ -309,8 +306,6 @@ class caption_Field_Value implements cache_cacheableInterface $this->record->get_caption()->delete_data_from_cache(); $sbas_id = $this->databox_field->get_databox()->get_sbas_id(); try { - $registry = $this->app['phraseanet.registry']; - $sbas_params = phrasea::sbas_params($this->app); if (isset($sbas_params[$sbas_id])) { @@ -323,7 +318,7 @@ class caption_Field_Value implements cache_cacheableInterface ) ); - $sphinx_rt = sphinxrt::get_instance($registry); + $sphinx_rt = sphinxrt::get_instance($this->app['phraseanet.registry']); $sphinx_rt->replace_in_metas( "metas_realtime" . $sbas_crc , $this->id diff --git a/lib/classes/collection.class.php b/lib/classes/collection.class.php index 703855e515..0d24be594f 100644 --- a/lib/classes/collection.class.php +++ b/lib/classes/collection.class.php @@ -446,7 +446,6 @@ class collection implements cache_cacheableInterface public function unmount_collection(Application $app) { - $appbox = $app['phraseanet.appbox']; $params = array(':base_id' => $this->get_base_id()); $query = new User_Query($app); @@ -466,26 +465,26 @@ class collection implements cache_cacheableInterface } $sql = "DELETE FROM basusr WHERE base_id = :base_id"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); $sql = "DELETE FROM sselcont WHERE base_id = :base_id"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); $sql = "DELETE FROM bas WHERE base_id = :base_id"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); $sql = "DELETE FROM demand WHERE base_id = :base_id"; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute($params); $stmt->closeCursor(); - phrasea::reset_baseDatas($appbox); + phrasea::reset_baseDatas($app['phraseanet.appbox']); return $this; } @@ -601,11 +600,10 @@ class collection implements cache_cacheableInterface if ( ! isset(self::$_logos[$base_id_key])) { - $registry = $app['phraseanet.registry']; - if (is_file($registry->get('GV_RootPath') . 'config/minilogos/' . $base_id)) { + if (is_file($app['phraseanet.registry']->get('GV_RootPath') . 'config/minilogos/' . $base_id)) { $name = phrasea::bas_names($base_id, $app); self::$_logos[$base_id_key] = ''; } elseif ($printname) { self::$_logos[$base_id_key] = phrasea::bas_names($base_id, $app); diff --git a/lib/classes/databox.class.php b/lib/classes/databox.class.php index f375c5f8a0..e21f3b13f4 100644 --- a/lib/classes/databox.class.php +++ b/lib/classes/databox.class.php @@ -10,8 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Version; -use Alchemy\Phrasea\Core\Configuration; use Symfony\Component\Filesystem\Filesystem; class databox extends base diff --git a/lib/classes/databox/cgu.class.php b/lib/classes/databox/cgu.class.php index 5ee5c7752a..91e85a59a8 100644 --- a/lib/classes/databox/cgu.class.php +++ b/lib/classes/databox/cgu.class.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; /** * @@ -51,13 +50,12 @@ class databox_cgu private static function getUnvalidated(Application $app, $home = false) { $terms = array(); - $appbox = $app['phraseanet.appbox']; if ( ! $home) { $user = $app['phraseanet.user']; } - foreach ($appbox->get_databoxes() as $databox) { + foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { try { $cgus = $databox->get_cgus(); diff --git a/lib/classes/databox/status.class.php b/lib/classes/databox/status.class.php index cec4f14628..e3fe6da995 100644 --- a/lib/classes/databox/status.class.php +++ b/lib/classes/databox/status.class.php @@ -66,13 +66,12 @@ class databox_status $path = $url = false; $sbas_params = phrasea::sbas_params($app); - $registry = $app['phraseanet.registry']; if ( ! isset($sbas_params[$sbas_id])) { return; } - $path = $this->path = $registry->get('GV_RootPath') . "config/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]); + $path = $this->path = $app['phraseanet.registry']->get('GV_RootPath') . "config/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]); $url = $this->url = "/custom/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]); $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); @@ -382,8 +381,6 @@ class databox_status public static function updateIcon(Application $app, $sbas_id, $bit, $switch, UploadedFile $file) { - $registry = $app['phraseanet.registry']; - $switch = in_array($switch, array('on', 'off')) ? $switch : false; if ( ! $switch) { @@ -406,13 +403,12 @@ class databox_status $name = "-stat_" . $bit . "_" . ($switch == 'on' ? '1' : '0') . ".gif"; try { - $file = $file->move($registry->get('GV_RootPath') . "config/status/", $path.$name); + $file = $file->move($app['phraseanet.registry']->get('GV_RootPath') . "config/status/", $path.$name); } catch (FileException $e) { throw new Exception_Upload_CannotWriteFile(); } - - $custom_path = $registry->get('GV_RootPath') . 'www/custom/status/'; + $custom_path = $app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/status/'; $app['filesystem']->mkdir($custom_path, 0750); diff --git a/lib/classes/deprecated/inscript.api.php b/lib/classes/deprecated/inscript.api.php index 0340af4e89..99840b6460 100644 --- a/lib/classes/deprecated/inscript.api.php +++ b/lib/classes/deprecated/inscript.api.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; /** * diff --git a/lib/classes/deprecated/prodUtils.php b/lib/classes/deprecated/prodUtils.php index 94b53a36db..97b01e3732 100644 --- a/lib/classes/deprecated/prodUtils.php +++ b/lib/classes/deprecated/prodUtils.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; /** * @@ -100,11 +99,9 @@ function deleteRecord(Application $app, $lst, $del_children) function whatCanIDelete(Application $app, $lst) { - $appbox = $app['phraseanet.appbox']; - $usr_id = $app['phraseanet.user']->get_id(); - $conn = $appbox->get_connection(); + $conn = $app['phraseanet.appbox']->get_connection(); $nbdocsel = 0; $nbgrp = 0; diff --git a/lib/classes/eventsmanager/broker.class.php b/lib/classes/eventsmanager/broker.class.php index 73035699e2..8e011b7c7b 100644 --- a/lib/classes/eventsmanager/broker.class.php +++ b/lib/classes/eventsmanager/broker.class.php @@ -1,7 +1,6 @@ app['phraseanet.registry']; - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') . 'get_name.php?geonameid=' . $geonameid; @@ -48,8 +47,7 @@ class geonames return ''; } - $registry = $this->app['phraseanet.registry']; - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') . 'get_name.php?geonameid=' . $geonameid; @@ -68,8 +66,7 @@ class geonames public function get_country_code($geonameid) { - $registry = $this->app['phraseanet.registry']; - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') . 'get_name.php?geonameid=' . $geonameid; @@ -107,8 +104,7 @@ class geonames return $output; } - $registry = $this->app['phraseanet.registry']; - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') . 'find_city.php?city=' . urlencode($cityName) . '&maxResult=30'; @@ -154,8 +150,7 @@ class geonames 'latitude' => '' ); - $registry = $this->app['phraseanet.registry']; - $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') + $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') . 'geoip.php?ip=' . urlencode($ip); diff --git a/lib/classes/liste.class.php b/lib/classes/liste.class.php index 37d34ce0c8..44962838de 100644 --- a/lib/classes/liste.class.php +++ b/lib/classes/liste.class.php @@ -1,7 +1,6 @@ $registry->get('GV_defaulmailsenderaddr'), 'name' => $registry->get('GV_defaulmailsenderaddr')); + $from = array('email' => $app['phraseanet.registry']->get('GV_defaulmailsenderaddr'), 'name' => $app['phraseanet.registry']->get('GV_defaulmailsenderaddr')); $subject = _('mail:: test d\'envoi d\'email'); - $message = sprintf(_('Ce mail est un test d\'envoi de mail depuis %s'), $registry->get('GV_ServerName')); + $message = sprintf(_('Ce mail est un test d\'envoi de mail depuis %s'), $app['phraseanet.registry']->get('GV_ServerName')); $to = array('email' => $email, 'name' => $email); @@ -72,8 +71,7 @@ class mail public static function register_confirm(Application $app, $email, $accept, $deny) { - $registry = $app['phraseanet.registry']; - $subject = sprintf(_('login::register:email: Votre compte %s'), $registry->get('GV_homeTitle')); + $subject = sprintf(_('login::register:email: Votre compte %s'), $app['phraseanet.registry']->get('GV_homeTitle')); $body = '
' . _('login::register:email: Voici un compte rendu du traitement de vos demandes d\'acces :') . "
\n"; @@ -91,11 +89,10 @@ class mail public static function reset_email(Application $app, $email, $usr_id) { - $registry = $app['phraseanet.registry']; $date = new DateTime('1 day'); $token = random::getUrlToken($app, \random::TYPE_EMAIL, $usr_id, $date, $email); - $url = $registry->get('GV_ServerName') . 'account/reset-email/?token=' . $token; + $url = $app['phraseanet.registry']->get('GV_ServerName') . 'account/reset-email/?token=' . $token; $subject = _('login::register: sujet email : confirmation de votre adresse email'); @@ -109,8 +106,7 @@ class mail public static function change_mail_information(Application $app, $display_name, $old_email, $new_email) { - $registry = $app['phraseanet.registry']; - $subject = sprintf(_('Update of your email address on %s'), $registry->get('GV_homeTitle')); + $subject = sprintf(_('Update of your email address on %s'), $app['phraseanet.registry']->get('GV_homeTitle')); $body = "
" . sprintf(_('Dear %s,'), $display_name) . "
\n
\n"; $body .= "
" . _('Your contact email address has been updated') . "
\n
\n"; @@ -134,9 +130,7 @@ class mail public static function send_credentials(Application $app, $url, $login, $email) { - $registry = $app['phraseanet.registry']; - - $subject = sprintf(_('Your account on %s'), $registry->get('GV_homeTitle')); + $subject = sprintf(_('Your account on %s'), $app['phraseanet.registry']->get('GV_homeTitle')); $body = "
" . sprintf(_('Your account with the login %s as been created'), $login) . "

\n\n"; $body .= "
" . _('Please follow this url to setup your password') . "
\n"; @@ -149,13 +143,11 @@ class mail public static function mail_confirm_registered(Application $app, $email) { - $registry = $app['phraseanet.registry']; - $subject = _('login::register: sujet email : confirmation de votre adresse email'); $body = "
" . _('login::register: merci d\'avoir confirme votre adresse email') . "
\n"; $body .= "
" . _('login::register: vous pouvez maintenant vous connecter a l\'adresse suivante : ') . "
\n"; - $body .= "
" . $registry->get('GV_ServerName') . "
\n"; + $body .= "
get('GV_ServerName') . "' target='_blank'>" . $app['phraseanet.registry']->get('GV_ServerName') . "
\n"; $to = array('email' => $email, 'name' => $email); @@ -183,14 +175,13 @@ class mail public static function mail_confirmation(Application $app, $email, $usr_id) { - $registry = $app['phraseanet.registry']; $expire = new DateTime('+3 days'); $token = random::getUrlToken($app, \random::TYPE_PASSWORD, $usr_id, $expire, $email); $subject = _('login::register: sujet email : confirmation de votre adresse email'); $body = "
" . _('login::register: email confirmation email Pour valider votre inscription a la base de donnees, merci de confirmer votre e-mail en suivant le lien ci-dessous.') . "
\n"; - $body .= "
\n
" . $registry->get('GV_ServerName') . "register-confirm/code=" . $token . "
\n"; + $body .= "
\n
get('GV_ServerName') . "register-confirm/?code=" . $token . "' target='_blank'>" . $app['phraseanet.registry']->get('GV_ServerName') . "register-confirm/code=" . $token . "
\n"; $to = array('email' => $email, 'name' => $email); @@ -204,8 +195,6 @@ class mail public static function send_mail(Application $app, $subject, $body, $to, $from = false, $files = array(), $reading_confirm_to = false) { - $registry = $app['phraseanet.registry']; - if ( ! isset($to['email']) || ! PHPMailer::ValidateAddress($to['email'])) { return false; } @@ -216,7 +205,7 @@ class mail $body .= '
' . _('si cet email contient des liens non cliquables copiez/collez ces liens dans votre navigateur.') . '
'; $body .= "
\n"; $body .= '
' . _('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante') . "
\n"; - $body .= '
' . $registry->get('GV_ServerName') . "
\n"; + $body .= '
' . $app['phraseanet.registry']->get('GV_ServerName') . "
\n"; $body = '' . $body . ''; $body = str_replace('https://', 'http://', $body); @@ -225,23 +214,21 @@ class mail $mail->CharSet = 'utf-8'; $mail->Encoding = 'base64'; //'quoted-printable'; - $registry = $app['phraseanet.registry']; - - if ($registry->get('GV_smtp')) { + if ($app['phraseanet.registry']->get('GV_smtp')) { $mail->IsSMTP(); - if ($registry->get('GV_smtp_host') != '') - $mail->Host = $registry->get('GV_smtp_host'); + if ($app['phraseanet.registry']->get('GV_smtp_host') != '') + $mail->Host = $app['phraseanet.registry']->get('GV_smtp_host'); - if ($registry->get('GV_smtp_auth')) { + if ($app['phraseanet.registry']->get('GV_smtp_auth')) { $mail->SMTPAuth = true; - if ($registry->get('GV_smtp_secure') === true) { + if ($app['phraseanet.registry']->get('GV_smtp_secure') === true) { $mail->SMTPSecure = "ssl"; } - $mail->Host = $registry->get('GV_smtp_host'); - $mail->Port = $registry->get('GV_smtp_port'); - $mail->Username = $registry->get('GV_smtp_user'); - $mail->Password = $registry->get('GV_smtp_password'); + $mail->Host = $app['phraseanet.registry']->get('GV_smtp_host'); + $mail->Port = $app['phraseanet.registry']->get('GV_smtp_port'); + $mail->Username = $app['phraseanet.registry']->get('GV_smtp_user'); + $mail->Password = $app['phraseanet.registry']->get('GV_smtp_password'); } } @@ -250,7 +237,7 @@ class mail $mail->AddAddress($to['email'], $to['name']); - $mail->SetFrom($registry->get('GV_defaulmailsenderaddr'), $registry->get('GV_homeTitle')); + $mail->SetFrom($app['phraseanet.registry']->get('GV_defaulmailsenderaddr'), $app['phraseanet.registry']->get('GV_homeTitle')); $mail->Subject = $subject; diff --git a/lib/classes/media/subdef.class.php b/lib/classes/media/subdef.class.php index b058f11c00..776b512a55 100644 --- a/lib/classes/media/subdef.class.php +++ b/lib/classes/media/subdef.class.php @@ -276,13 +276,11 @@ class media_subdef extends media_abstract implements cache_cacheableInterface */ protected function find_substitute_file() { - $registry = $this->app['phraseanet.registry']; - if ($this->record->is_grouping()) { $this->mime = 'image/png'; $this->width = 256; $this->height = 256; - $this->path = $registry->get('GV_RootPath') . 'www/skins/icons/substitution/'; + $this->path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/icons/substitution/'; $this->file = 'regroup_thumb.png'; $this->url = '/skins/icons/substitution/regroup_thumb.png'; } else { @@ -292,7 +290,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface $this->mime = 'image/png'; $this->width = 256; $this->height = 256; - $this->path = $registry->get('GV_RootPath') . 'www/skins/icons/substitution/'; + $this->path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/icons/substitution/'; $this->file = str_replace('+', '%20', $mime) . '.png'; $this->url = '/skins/icons/substitution/' . $this->file; } @@ -300,7 +298,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface $this->is_physically_present = false; if ( ! file_exists($this->path . $this->file)) { - $this->path = $registry->get('GV_RootPath') . 'www/skins/icons/'; + $this->path = $this->app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/icons/'; $this->file = 'substitution.png'; $this->url = '/skins/icons/' . $this->file; } diff --git a/lib/classes/module/client.class.php b/lib/classes/module/client.class.php index ec35ef8015..36b089cacd 100644 --- a/lib/classes/module/client.class.php +++ b/lib/classes/module/client.class.php @@ -22,13 +22,12 @@ class module_client public function getLanguage(Application $app, $lng) { - $registry = $app['phraseanet.registry']; $out = array(); $out['createWinInvite'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?'); $out['chuNameEmpty'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?'); $out['noDLok'] = _('export:: aucun document n\'est disponible au telechargement'); $out['confirmRedirectAuth'] = _('invite:: Redirection vers la zone d\'authentification, cliquez sur OK pour continuer ou annulez'); - $out['serverName'] = $registry->get('GV_ServerName'); + $out['serverName'] = $app['phraseanet.registry']->get('GV_ServerName'); $out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique'); $out['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible'); $out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier'); diff --git a/lib/classes/module/console/checkExtension.class.php b/lib/classes/module/console/checkExtension.class.php index b2404b0f4a..daf8c0720f 100644 --- a/lib/classes/module/console/checkExtension.class.php +++ b/lib/classes/module/console/checkExtension.class.php @@ -49,10 +49,6 @@ class module_console_checkExtension extends Command return 1; } - $appbox = $this->getService('phraseanet.appbox'); - - $registry = $this->container['phraseanet.registry']; - $usrId = $input->getArgument('usr_id'); try { @@ -175,7 +171,7 @@ class module_console_checkExtension extends Command , $base["sbas_id"] , $base["searchcoll"] , $base["arrayq"] - , $registry->get('GV_sit') + , $this->container['phraseanet.registry']->get('GV_sit') , $usrId , false , PHRASEA_MULTIDOC_DOCONLY diff --git a/lib/classes/module/console/fieldsDelete.class.php b/lib/classes/module/console/fieldsDelete.class.php index aeead42353..276079da6a 100644 --- a/lib/classes/module/console/fieldsDelete.class.php +++ b/lib/classes/module/console/fieldsDelete.class.php @@ -42,9 +42,8 @@ class module_console_fieldsDelete extends Command protected function doExecute(InputInterface $input, OutputInterface $output) { - $appbox = $this->getService('phraseanet.appbox'); try { - $databox = $appbox->get_databox((int) $input->getArgument('sbas_id')); + $databox = $this->getService('phraseanet.appbox')->get_databox((int) $input->getArgument('sbas_id')); } catch (\Exception $e) { $output->writeln("Invalid databox id "); diff --git a/lib/classes/module/console/fieldsList.class.php b/lib/classes/module/console/fieldsList.class.php index 8b0fd793ea..c6fd52765e 100644 --- a/lib/classes/module/console/fieldsList.class.php +++ b/lib/classes/module/console/fieldsList.class.php @@ -38,9 +38,7 @@ class module_console_fieldsList extends Command protected function doExecute(InputInterface $input, OutputInterface $output) { - $appbox = $this->getService('phraseanet.appbox'); - - foreach ($appbox->get_databoxes() as $databox) { + foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) { /* @var $databox \databox */ $output->writeln( sprintf( diff --git a/lib/classes/module/console/fieldsMerge.class.php b/lib/classes/module/console/fieldsMerge.class.php index e40131215f..838104d106 100644 --- a/lib/classes/module/console/fieldsMerge.class.php +++ b/lib/classes/module/console/fieldsMerge.class.php @@ -54,10 +54,8 @@ class module_console_fieldsMerge extends Command { $output->writeln(""); - $appbox = $this->getService('phraseanet.appbox'); - try { - $databox = $appbox->get_databox((int) $input->getArgument('sbas_id')); + $databox = $this->getService('phraseanet.appbox')->get_databox((int) $input->getArgument('sbas_id')); } catch (\Exception $e) { $output->writeln("Invalid databox id "); diff --git a/lib/classes/module/console/fieldsRename.class.php b/lib/classes/module/console/fieldsRename.class.php index a35aa2c7b9..b345e242a6 100644 --- a/lib/classes/module/console/fieldsRename.class.php +++ b/lib/classes/module/console/fieldsRename.class.php @@ -45,9 +45,8 @@ class module_console_fieldsRename extends Command { $new_name = $input->getArgument('name'); - $appbox = $this->getService('phraseanet.appbox'); try { - $databox = $appbox->get_databox((int) $input->getArgument('sbas_id')); + $databox = $this->getService('phraseanet.appbox')->get_databox((int) $input->getArgument('sbas_id')); } catch (\Exception $e) { $output->writeln("Invalid databox id "); diff --git a/lib/classes/module/console/sphinxGenerateSuggestion.class.php b/lib/classes/module/console/sphinxGenerateSuggestion.class.php index a1f80287db..377cc66eec 100644 --- a/lib/classes/module/console/sphinxGenerateSuggestion.class.php +++ b/lib/classes/module/console/sphinxGenerateSuggestion.class.php @@ -41,9 +41,6 @@ class module_console_sphinxGenerateSuggestion extends Command define('FREQ_THRESHOLD', 10); define('SUGGEST_DEBUG', 0); - $appbox = $this->getService('phraseanet.appbox'); - $registry = $this->container['phraseanet.registry']; - $params = phrasea::sbas_params($this->container); foreach ($params as $sbas_id => $p) { @@ -55,9 +52,9 @@ class module_console_sphinxGenerateSuggestion extends Command ) ); - $tmp_file = $registry->get('GV_RootPath') . 'tmp/dict' . $index . '.txt'; + $tmp_file = $this->container['phraseanet.registry']->get('GV_RootPath') . 'tmp/dict' . $index . '.txt'; - $databox = $appbox->get_databox($sbas_id); + $databox = $this->getService('phraseanet.appbox')->get_databox($sbas_id); $output->writeln("process Databox " . $databox->get_viewname() . " / $index\n"); diff --git a/lib/classes/module/console/systemBackupDB.class.php b/lib/classes/module/console/systemBackupDB.class.php index f38ba845ad..4af2b51e0d 100644 --- a/lib/classes/module/console/systemBackupDB.class.php +++ b/lib/classes/module/console/systemBackupDB.class.php @@ -47,11 +47,9 @@ class module_console_systemBackupDB extends Command { $output->write('Phraseanet is going to be backup...', true); - $appbox = $this->getService('phraseanet.appbox'); + $ok = $this->dump_base($this->getService('phraseanet.appbox'), $input, $output) && $ok; - $ok = $this->dump_base($appbox, $input, $output) && $ok; - - foreach ($appbox->get_databoxes() as $databox) { + foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) { $ok = $this->dump_base($databox, $input, $output) && $ok; } diff --git a/lib/classes/module/console/systemConfigCheck.class.php b/lib/classes/module/console/systemConfigCheck.class.php index c067e936cd..249ccc7878 100644 --- a/lib/classes/module/console/systemConfigCheck.class.php +++ b/lib/classes/module/console/systemConfigCheck.class.php @@ -52,7 +52,7 @@ class module_console_systemConfigCheck extends Command $registry = $this->container['phraseanet.registry']; $output->writeln(_('*** CHECK BINARY CONFIGURATION ***')); - $ok = $this->processConstraints(setup::check_binaries($registry), $output) && $ok; + $ok = $this->processConstraints(setup::check_binaries($this->container['phraseanet.registry']), $output) && $ok; $output->writeln(""); } else { $registry = new Setup_Registry(); diff --git a/lib/classes/module/console/systemExport.class.php b/lib/classes/module/console/systemExport.class.php index bb3923ad91..b838a7180e 100644 --- a/lib/classes/module/console/systemExport.class.php +++ b/lib/classes/module/console/systemExport.class.php @@ -128,13 +128,11 @@ class module_console_systemExport extends Command $output->writeln("Export datas from selected base_ids"); } - $appbox = $this->getService('phraseanet.appbox'); - $total = $errors = 0; $unicode = new \unicode(); - foreach ($appbox->get_databoxes() as $databox) { + foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) { $output->writeln(sprintf("Processing %s", $databox->get_viewname())); if (count($restrictSbasIds) > 0 && ! in_array($databox->get_sbas_id(), $restrictSbasIds)) { diff --git a/lib/classes/module/console/systemMailCheck.class.php b/lib/classes/module/console/systemMailCheck.class.php index a4a6910120..abccf165b0 100644 --- a/lib/classes/module/console/systemMailCheck.class.php +++ b/lib/classes/module/console/systemMailCheck.class.php @@ -44,16 +44,14 @@ class module_console_systemMailCheck extends Command protected function doExecute(InputInterface $input, OutputInterface $output) { - $appbox = $this->getService('phraseanet.appbox'); - $output->writeln("Processing..."); $bad_users = User_Adapter::get_wrong_email_users($this->container); foreach ($bad_users as $email => $users) { if ($input->getOption('list')) { - $this->write_infos($email, $users, $output, $appbox); - } elseif ($this->manage_group($email, $users, $output, $appbox) === false) { + $this->write_infos($email, $users, $output, $this->getService('phraseanet.appbox')); + } elseif ($this->manage_group($email, $users, $output, $this->getService('phraseanet.appbox')) === false) { break; } diff --git a/lib/classes/module/console/systemUpgrade.class.php b/lib/classes/module/console/systemUpgrade.class.php index 3f0864bc72..7e794252d3 100644 --- a/lib/classes/module/console/systemUpgrade.class.php +++ b/lib/classes/module/console/systemUpgrade.class.php @@ -98,15 +98,14 @@ class module_console_systemUpgrade extends Command if ($continue == 'y') { try { $output->write('Upgrading...', true); - $appbox = $this->getService('phraseanet.appbox'); if (count(User_Adapter::get_wrong_email_users($this->container)) > 0) { return $output->writeln(sprintf('You have to fix your database before upgrade with the system:mailCheck command ')); } - $upgrader = new Setup_Upgrade($appbox, $input->getOption('force')); + $upgrader = new Setup_Upgrade($this->getService('phraseanet.appbox'), $input->getOption('force')); - $appbox->forceUpgrade($upgrader); + $this->getService('phraseanet.appbox')->forceUpgrade($upgrader); foreach ($upgrader->getRecommendations() as $recommendation) { list($message, $command) = $recommendation; diff --git a/lib/classes/module/console/tasklist.class.php b/lib/classes/module/console/tasklist.class.php index 8063f60451..6a3290b7ad 100644 --- a/lib/classes/module/console/tasklist.class.php +++ b/lib/classes/module/console/tasklist.class.php @@ -46,7 +46,6 @@ class module_console_tasklist extends Command } try { - $appbox = $this->getService('phraseanet.appbox'); $task_manager = new task_manager($this->container); $tasks = $task_manager->getTasks(); diff --git a/lib/classes/module/console/taskrun.class.php b/lib/classes/module/console/taskrun.class.php index 820aada16e..deffbe4148 100644 --- a/lib/classes/module/console/taskrun.class.php +++ b/lib/classes/module/console/taskrun.class.php @@ -81,7 +81,6 @@ class module_console_taskrun extends Command throw new \RuntimeException('Argument must be an Id.'); } - $appbox = $this->getService('phraseanet.appbox'); $task_manager = new task_manager($this->container); if ($input->getOption('runner') === task_abstract::RUNNER_MANUAL) { diff --git a/lib/classes/module/report.class.php b/lib/classes/module/report.class.php index 7bacc8dc60..4a63dac2cd 100644 --- a/lib/classes/module/report.class.php +++ b/lib/classes/module/report.class.php @@ -629,13 +629,12 @@ class module_report */ protected function setReport() { - $registry = $this->app['phraseanet.registry']; $this->report['dbid'] = $this->sbas_id; $this->report['periode'] = $this->periode; $this->report['dbname'] = $this->dbname; $this->report['dmin'] = $this->dmin; $this->report['dmax'] = $this->dmax; - $this->report['server'] = $registry->get('GV_ServerName'); + $this->report['server'] = $this->app['phraseanet.registry']->get('GV_ServerName'); $this->report['filter'] = $this->tab_filter; $this->report['posting_filter'] = $this->posting_filter; $this->report['active_column'] = $this->active_column; @@ -861,8 +860,7 @@ class module_report { $tab = array(); - $appbox = $app['phraseanet.appbox']; - $databox = $appbox->get_databox((int) $sbasid); + $databox = $app['phraseanet.appbox']->get_databox((int) $sbasid); foreach ($databox->get_meta_structure() as $databox_field) { /* @var $databox_field \databox_field */ diff --git a/lib/classes/module/report/activity.class.php b/lib/classes/module/report/activity.class.php index 38aea8f660..00a2d6148f 100644 --- a/lib/classes/module/report/activity.class.php +++ b/lib/classes/module/report/activity.class.php @@ -292,8 +292,7 @@ class module_report_activity extends module_report $filter = $s->getFilters(); $conn = $s->getConnBas(); - $appbox = $this->app['phraseanet.appbox']; - $databox = $appbox->get_databox($this->sbas_id); + $databox = $this->app['phraseanet.appbox']->get_databox($this->sbas_id); $params = array(); $date_filter = $filter->getDateFilter(); @@ -363,7 +362,6 @@ class module_report_activity extends module_report { $this->title = _('report:: telechargements par jour'); - $registry = $this->app['phraseanet.registry']; $s = new module_report_sql($this->app, $this); $filter = $s->getFilters(); @@ -756,14 +754,13 @@ class module_report_activity extends module_report public static function topTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) { $conn = connection::getPDOConnection($app, $sbas_id); - $registry = $app['phraseanet.registry']; $result = array(); $result['top_ten_doc'] = array(); $result['top_ten_prev'] = array(); $result['top_ten_poiddoc'] = array(); $result['top_ten_poidprev'] = array(); - $params = array(':site_id' => $registry->get('GV_sit')); + $params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit')); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $params = array_merge($params, $datefilter['params']); @@ -837,14 +834,13 @@ class module_report_activity extends module_report public static function activity(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) { $conn = connection::getPDOConnection($app, $sbas_id); - $registry = $app['phraseanet.registry']; $res = array(); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); - $params = array(':site_id' => $registry->get('GV_sit')); + $params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit')); $params = array_merge($params, $datefilter['params'], $collfilter['params']); $sql = " @@ -877,7 +873,6 @@ class module_report_activity extends module_report public static function activityDay(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) { $conn = connection::getPDOConnection($app, $sbas_id); - $registry = $app['phraseanet.registry']; $result = array(); $res = array(); $datefilter = @@ -885,7 +880,7 @@ class module_report_activity extends module_report $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); - $params = array(':site_id' => $registry->get('GV_sit')); + $params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit')); $params = array_merge($params, $datefilter['params'], $collfilter['params']); $sql = " @@ -919,14 +914,13 @@ class module_report_activity extends module_report public static function activityQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) { $conn = connection::getPDOConnection($app, $sbas_id); - $registry = $app['phraseanet.registry']; $result = array(); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); - $params = array(':site_id' => $registry->get('GV_sit')); + $params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit')); $params = array_merge($params, $datefilter['params'], $collfilter['params']); $sql = " @@ -957,14 +951,13 @@ class module_report_activity extends module_report public static function activiteTopQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) { $conn = connection::getPDOConnection($app, $sbas_id); - $registry = $app['phraseanet.registry']; $result = array(); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); - $params = array(':site_id' => $registry->get('GV_sit')); + $params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit')); $params = array_merge($params, $datefilter['params'], $collfilter['params']); $sql = " diff --git a/lib/classes/module/report/connexion.class.php b/lib/classes/module/report/connexion.class.php index f0a0053cb5..5e0d4922fc 100644 --- a/lib/classes/module/report/connexion.class.php +++ b/lib/classes/module/report/connexion.class.php @@ -151,12 +151,11 @@ class module_report_connexion extends module_report public static function getNbConn(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) { $conn = connection::getPDOConnection($app, $sbas_id); - $registry = $app['phraseanet.registry']; $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); - $params = array(':site_id' => $registry->get('GV_sit')); + $params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit')); $params = array_merge($params, $datefilter['params'], $collfilter['params']); $finalfilter = $datefilter['sql'] . ' AND '; diff --git a/lib/classes/module/report/dashboard/feed.class.php b/lib/classes/module/report/dashboard/feed.class.php index e0220be0a3..419b495403 100644 --- a/lib/classes/module/report/dashboard/feed.class.php +++ b/lib/classes/module/report/dashboard/feed.class.php @@ -74,18 +74,17 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI */ public static function getInstance(Application $app, $sbasid, $sbas_coll, $dmin, $dmax) { - $appbox = $app['phraseanet.appbox']; $cache_id = 'feed_' . md5($sbasid . '_' . $sbas_coll . '_' . $dmin . '_' . $dmax); try { - return $appbox->get_data_from_cache($cache_id); + return $app['phraseanet.appbox']->get_data_from_cache($cache_id); } catch (Exception $e) { } $tmp = new self($app, $sbasid, $sbas_coll, $dmin, $dmax); - $appbox->set_data_to_cache($tmp, $cache_id); + $app['phraseanet.appbox']->set_data_to_cache($tmp, $cache_id); return $tmp; } @@ -144,8 +143,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI $this->report['nb_conn'] = module_report_connexion::getNbConn( $this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection ); - $registry = $this->app['phraseanet.registry']; - if ($registry->get('GV_anonymousReport') == false) { + if ($this->app['phraseanet.registry']->get('GV_anonymousReport') == false) { /** * get Top ten user of * number of dl doc, prev @@ -180,7 +178,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI $this->report['top_dl_preview'] = $topdl['preview']; $this->report['top_dl_document'] = $topdl['document']; - if ($registry->get('GV_anonymousReport') == false) { + if ($this->app['phraseanet.registry']->get('GV_anonymousReport') == false) { // get users that ask the most questions $this->report['ask'] = module_report_activity::activityQuestion( $this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection @@ -204,7 +202,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI $this->report['activity_edited'] = module_report_activity::activiteEditedDocument( $this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection ); - if ($registry->get('GV_anonymousReport') == false) { + if ($this->app['phraseanet.registry']->get('GV_anonymousReport') == false) { //get users that add the most documents $this->report['top_ten_added'] = module_report_activity::activiteAddedTopTenUser( $this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection diff --git a/lib/classes/module/report/download.class.php b/lib/classes/module/report/download.class.php index b2d70d2f7b..3f0ed71aab 100644 --- a/lib/classes/module/report/download.class.php +++ b/lib/classes/module/report/download.class.php @@ -174,9 +174,8 @@ class module_report_download extends module_report public static function getNbDl(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) { $conn = connection::getPDOConnection($app, $sbas_id); - $registry = $app['phraseanet.registry']; - $params = array(':site_id' => $registry->get('GV_sit')); + $params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit')); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $params = array_merge($params, $datefilter['params'], $collfilter['params']); @@ -210,13 +209,10 @@ class module_report_download extends module_report public static function getTopDl(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) { - $appbox = $app['phraseanet.appbox']; - $databox = $appbox->get_databox((int) $sbas_id); + $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $conn = $databox->get_connection(); - $registry = $app['phraseanet.registry']; - - $params = array(':site_id' => $registry->get('GV_sit')); + $params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit')); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $params = array_merge($params, $datefilter['params'], $collfilter['params']); diff --git a/lib/classes/module/report/sqlfilter.class.php b/lib/classes/module/report/sqlfilter.class.php index 9ba835ff5e..68c8864c5f 100644 --- a/lib/classes/module/report/sqlfilter.class.php +++ b/lib/classes/module/report/sqlfilter.class.php @@ -63,9 +63,8 @@ class module_report_sqlfilter public function getReportFilter() { $finalfilter = ''; - $registry = $this->app['phraseanet.registry']; - $params = array(':log_site' => $registry->get('GV_sit')); + $params = array(':log_site' => $this->app['phraseanet.registry']->get('GV_sit')); if ($this->filter['date']) { $finalfilter .= $this->filter['date']['sql'] . ' AND '; @@ -86,13 +85,12 @@ class module_report_sqlfilter public function getGvSitFilter() { - $registry = $this->app['phraseanet.registry']; $params = array(); $sql = ''; - if ($registry->is_set('GV_sit')) { + if ($this->app['phraseanet.registry']->is_set('GV_sit')) { $sql = 'log.site = :log_site_gv_filter'; - $params[':log_site_gv_filter'] = $registry->get('GV_sit'); + $params[':log_site_gv_filter'] = $this->app['phraseanet.registry']->get('GV_sit'); } return array('sql' => $sql, 'params' => $params); diff --git a/lib/classes/p4file.class.php b/lib/classes/p4file.class.php index de030cb507..917ca1a8ad 100644 --- a/lib/classes/p4file.class.php +++ b/lib/classes/p4file.class.php @@ -9,8 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; - class p4file { diff --git a/lib/classes/patch/320aa.class.php b/lib/classes/patch/320aa.class.php index 357b750bb9..7931c09798 100644 --- a/lib/classes/patch/320aa.class.php +++ b/lib/classes/patch/320aa.class.php @@ -70,12 +70,10 @@ class patch_320aa implements patchInterface define('GV_sphinx_rt_host', ''); define('GV_sphinx_rt_port', ''); - $registry = $app['phraseanet.registry']; - foreach ($GV as $section => $datas_section) { foreach ($datas_section['vars'] as $datas) { - $registry->un_set($datas['name']); + $app['phraseanet.registry']->un_set($datas['name']); eval('$test = defined("' . $datas["name"] . '");'); if ( ! $test) { continue; @@ -97,10 +95,10 @@ class patch_320aa implements patchInterface $type = registry::TYPE_STRING; break; } - $registry->set($datas['name'], $val, $type); + $app['phraseanet.registry']->set($datas['name'], $val, $type); } } - $registry->un_set('registry_loaded'); + $app['phraseanet.registry']->un_set('registry_loaded'); return true; } diff --git a/lib/classes/patch/370a3.class.php b/lib/classes/patch/370a3.class.php index 5ed4b7a226..e66f8e96bf 100644 --- a/lib/classes/patch/370a3.class.php +++ b/lib/classes/patch/370a3.class.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Application; /** diff --git a/lib/classes/phrasea.class.php b/lib/classes/phrasea.class.php index 3efe67039a..91b733c35f 100644 --- a/lib/classes/phrasea.class.php +++ b/lib/classes/phrasea.class.php @@ -75,24 +75,22 @@ class phrasea public function getHome(Application $app, $type = 'PUBLI', $context = 'prod') { - $appbox = $app['phraseanet.appbox']; - $registry = $app['phraseanet.registry']; $user = $app['phraseanet.user']; if ($type == 'HELP') { - if (file_exists($registry->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php")) { - require($registry->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php"); - } elseif (file_exists($registry->get('GV_RootPath') . 'config/help.php')) {// on verifie si il y a une home personnalisee sans langage - require($registry->get('GV_RootPath') . 'config/help.php'); + if (file_exists($app['phraseanet.registry']->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php")) { + require($app['phraseanet.registry']->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php"); + } elseif (file_exists($app['phraseanet.registry']->get('GV_RootPath') . 'config/help.php')) {// on verifie si il y a une home personnalisee sans langage + require($app['phraseanet.registry']->get('GV_RootPath') . 'config/help.php'); } else { - require($registry->get('GV_RootPath') . 'www/client/help.php'); + require($app['phraseanet.registry']->get('GV_RootPath') . 'www/client/help.php'); } } if ($type == 'PUBLI') { if ($context == 'prod') - require($registry->get('GV_RootPath') . "www/prod/homeinterpubbask.php"); + require($app['phraseanet.registry']->get('GV_RootPath') . "www/prod/homeinterpubbask.php"); else - require($registry->get('GV_RootPath') . "www/client/homeinterpubbask.php"); + require($app['phraseanet.registry']->get('GV_RootPath') . "www/client/homeinterpubbask.php"); } if (in_array($type, array('QUERY', 'LAST_QUERY'))) { @@ -141,7 +139,7 @@ class phrasea $parm["datemax"] = ''; $parm["recordtype"] = ''; $parm["datefield"] = ''; - $parm["sort"] = $registry->get('GV_phrasea_sort'); + $parm["sort"] = $app['phraseanet.registry']->get('GV_phrasea_sort'); $parm["stemme"] = ''; $parm["dateminfield"] = array(); $parm["datemaxfield"] = array(); @@ -150,7 +148,7 @@ class phrasea $parm["ord"] = 0; } - require($registry->get('GV_RootPath') . 'www/' . $context . "/answer.php"); + require($app['phraseanet.registry']->get('GV_RootPath') . 'www/' . $context . "/answer.php"); } return; @@ -170,9 +168,8 @@ class phrasea return self::$_sbas_params; } - $appbox = $app['phraseanet.appbox']; try { - self::$_sbas_params = $appbox->get_data_from_cache(self::CACHE_SBAS_PARAMS); + self::$_sbas_params = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_PARAMS); return self::$_sbas_params; } catch (Exception $e) { @@ -182,7 +179,7 @@ class phrasea self::$_sbas_params = array(); $sql = 'SELECT sbas_id, host, port, user, pwd, dbname FROM sbas'; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -191,7 +188,7 @@ class phrasea self::$_sbas_params[$row['sbas_id']] = $row; } - $appbox->set_data_to_cache(self::$_sbas_params, self::CACHE_SBAS_PARAMS); + $app['phraseanet.appbox']->set_data_to_cache(self::$_sbas_params, self::CACHE_SBAS_PARAMS); return self::$_sbas_params; } @@ -250,12 +247,11 @@ class phrasea public static function sbasFromBas(Application $app, $base_id) { if (!self::$_bas2sbas) { - $appbox = $app['phraseanet.appbox']; try { - self::$_bas2sbas = $appbox->get_data_from_cache(self::CACHE_SBAS_FROM_BAS); + self::$_bas2sbas = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_FROM_BAS); } catch (Exception $e) { $sql = 'SELECT base_id, sbas_id FROM bas'; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -264,7 +260,7 @@ class phrasea self::$_bas2sbas[$row['base_id']] = (int) $row['sbas_id']; } - $appbox->set_data_to_cache(self::$_bas2sbas, self::CACHE_SBAS_FROM_BAS); + $app['phraseanet.appbox']->set_data_to_cache(self::$_bas2sbas, self::CACHE_SBAS_FROM_BAS); } } @@ -341,12 +337,11 @@ class phrasea public static function sbas_names($sbas_id, Application $app) { if (!self::$_sbas_names) { - $appbox = $app['phraseanet.appbox']; try { - self::$_sbas_names = $appbox->get_data_from_cache(self::CACHE_SBAS_NAMES); + self::$_sbas_names = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_NAMES); } catch (Exception $e) { $sql = 'SELECT sbas_id, viewname, dbname FROM sbas'; - $stmt = $appbox->get_connection()->prepare($sql); + $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -355,7 +350,7 @@ class phrasea $row['viewname'] = trim($row['viewname']); self::$_sbas_names[$row['sbas_id']] = $row['viewname'] ? $row['viewname'] : $row['dbname']; } - $appbox->set_data_to_cache(self::$_sbas_names, self::CACHE_SBAS_NAMES); + $app['phraseanet.appbox']->set_data_to_cache(self::$_sbas_names, self::CACHE_SBAS_NAMES); } } @@ -365,17 +360,16 @@ class phrasea public static function bas_names($base_id, Application $app) { if (!self::$_bas_names) { - $appbox = $app['phraseanet.appbox']; try { - self::$_bas_names = $appbox->get_data_from_cache(self::CACHE_BAS_NAMES); + self::$_bas_names = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_BAS_NAMES); } catch (Exception $e) { - foreach ($appbox->get_databoxes() as $databox) { + foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { foreach ($databox->get_collections() as $collection) { self::$_bas_names[$collection->get_base_id()] = $collection->get_name(); } } - $appbox->set_data_to_cache(self::$_bas_names, self::CACHE_BAS_NAMES); + $app['phraseanet.appbox']->set_data_to_cache(self::$_bas_names, self::CACHE_BAS_NAMES); } } diff --git a/lib/classes/queries.class.php b/lib/classes/queries.class.php index 2b75f7f523..41b5f00c63 100644 --- a/lib/classes/queries.class.php +++ b/lib/classes/queries.class.php @@ -9,8 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; - /** * * diff --git a/lib/classes/record/adapter.class.php b/lib/classes/record/adapter.class.php index abf8d1e553..fc0c423598 100644 --- a/lib/classes/record/adapter.class.php +++ b/lib/classes/record/adapter.class.php @@ -394,7 +394,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface { $dstatus = databox_status::getDisplayStatus($this->app); $sbas_id = $this->get_sbas_id(); - $appbox = $this->app['phraseanet.appbox']; $user = $this->app['phraseanet.user']; $status = ''; @@ -1351,7 +1350,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface $story = new self($app, $databox->get_sbas_id(), $story_id); try { - $appbox = $app['phraseanet.appbox']; $log_id = $app['phraseanet.logger']($databox)->get_id(); $sql = 'INSERT INTO log_docs (id, log_id, date, record_id, action, final, comment) @@ -1405,7 +1403,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface $record = new self($app, $databox->get_sbas_id(), $record_id); try { - $appbox = $app['phraseanet.appbox']; $log_id = $app['phraseanet.logger']($databox)->get_id(); $sql = 'INSERT INTO log_docs (id, log_id, date, record_id, action, final, comment) @@ -1574,9 +1571,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface { $connbas = $this->get_databox()->get_connection(); $sbas_id = $this->get_databox()->get_sbas_id(); - $appbox = $this->app['phraseanet.appbox']; - $registry = $this->app['phraseanet.registry']; - $conn = $appbox->get_connection(); + $conn = $this->app['phraseanet.appbox']->get_connection(); $ftodel = array(); foreach ($this->get_subdefs() as $subdef) { @@ -1611,7 +1606,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface $stmt->closeCursor(); try { - $sphinx_rt = sphinxrt::get_instance($registry); + $sphinx_rt = sphinxrt::get_instance($this->app['phraseanet.registry']); $sbas_params = phrasea::sbas_params($this->app); @@ -2050,8 +2045,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface */ public function get_grouping_parents() { - $appbox = $this->app['phraseanet.appbox']; - $sql = 'SELECT r.record_id FROM regroup g INNER JOIN (record r diff --git a/lib/classes/record/exportElement.class.php b/lib/classes/record/exportElement.class.php index f59399ffa0..42a500f2c5 100644 --- a/lib/classes/record/exportElement.class.php +++ b/lib/classes/record/exportElement.class.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; /** * @@ -79,15 +78,13 @@ class record_exportElement extends record_adapter $this->downloadable = $downloadable = array(); $this->orderable = $orderable = array(); - $appbox = $this->app['phraseanet.appbox']; - $sd = $this->get_subdefs(); $sbas_id = phrasea::sbasFromBas($this->app, $this->base_id); $user = $this->app['phraseanet.user']; - $subdefgroups = $appbox->get_databox($sbas_id)->get_subdef_structure(); + $subdefgroups = $this->app['phraseanet.appbox']->get_databox($sbas_id)->get_subdef_structure(); $subdefs = array(); diff --git a/lib/classes/record/orderElement.class.php b/lib/classes/record/orderElement.class.php index ae5e0f44d6..5a6ac013b1 100644 --- a/lib/classes/record/orderElement.class.php +++ b/lib/classes/record/orderElement.class.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; /** * diff --git a/lib/classes/record/preview.class.php b/lib/classes/record/preview.class.php index 31e1edfb5c..f2d4fb43fb 100644 --- a/lib/classes/record/preview.class.php +++ b/lib/classes/record/preview.class.php @@ -316,8 +316,6 @@ class record_preview extends record_adapter $tab = array(); - $appbox = $this->app['phraseanet.appbox']; - $registry = $this->app['phraseanet.registry']; $user = $this->app['phraseanet.user']; $report = $user->ACL()->has_right_on_base($this->get_base_id(), 'canreport'); @@ -333,7 +331,7 @@ class record_preview extends record_adapter if ( ! $report) { $sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")'; $params[':usr_id'] = $user->get_id(); - $params[':site'] = $registry->get('GV_sit'); + $params[':site'] = $this->app['phraseanet.registry']->get('GV_sit'); } $sql .= 'ORDER BY d.date, usrid DESC'; @@ -403,14 +401,11 @@ class record_preview extends record_adapter return $this->view_popularity; } - $appbox = $this->app['phraseanet.appbox']; - $user = $this->app['phraseanet.user']; $report = $user->ACL()->has_right_on_base( $this->get_base_id(), 'canreport'); - $registry = $this->app['phraseanet.registry']; - if ( ! $report && ! $registry->get('GV_google_api')) { + if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) { $this->view_popularity = false; return $this->view_popularity; @@ -442,7 +437,7 @@ class record_preview extends record_adapter $stmt->execute( array( ':record_id' => $this->get_record_id(), - ':site' => $registry->get('GV_sit') + ':site' => $this->app['phraseanet.registry']->get('GV_sit') ) ); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); @@ -496,14 +491,11 @@ class record_preview extends record_adapter return $this->refferer_popularity; } - $appbox = $this->app['phraseanet.appbox']; - $user = $this->app['phraseanet.user']; $report = $user->ACL()->has_right_on_base( $this->get_base_id(), 'canreport'); - $registry = $this->app['phraseanet.registry']; - if ( ! $report && ! $registry->get('GV_google_api')) { + if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) { $this->refferer_popularity = false; return $this->refferer_popularity; @@ -527,22 +519,22 @@ class record_preview extends record_adapter foreach ($rs as $row) { if ($row['referrer'] == 'NO REFERRER') $row['referrer'] = _('report::acces direct'); - if ($row['referrer'] == $registry->get('GV_ServerName') . 'prod/') + if ($row['referrer'] == $this->app['phraseanet.registry']->get('GV_ServerName') . 'prod/') $row['referrer'] = _('admin::monitor: module production'); - if ($row['referrer'] == $registry->get('GV_ServerName') . 'client/') + if ($row['referrer'] == $this->app['phraseanet.registry']->get('GV_ServerName') . 'client/') $row['referrer'] = _('admin::monitor: module client'); - if (strpos($row['referrer'], $registry->get('GV_ServerName') . 'login/') !== false) + if (strpos($row['referrer'], $this->app['phraseanet.registry']->get('GV_ServerName') . 'login/') !== false) $row['referrer'] = _('report:: page d\'accueil'); if (strpos($row['referrer'], 'http://apps.cooliris.com/') !== false) $row['referrer'] = _('report:: visualiseur cooliris'); - if (strpos($row['referrer'], $registry->get('GV_ServerName') . 'document/') !== false) { + if (strpos($row['referrer'], $this->app['phraseanet.registry']->get('GV_ServerName') . 'document/') !== false) { if (strpos($row['referrer'], '/view/') !== false) $row['referrer'] = _('report::presentation page preview'); else $row['referrer'] = _('report::acces direct'); } - if (strpos($row['referrer'], $registry->get('GV_ServerName') . 'permalink/') !== false) { + if (strpos($row['referrer'], $this->app['phraseanet.registry']->get('GV_ServerName') . 'permalink/') !== false) { if (strpos($row['referrer'], '/view/') !== false) $row['referrer'] = _('report::presentation page preview'); else @@ -579,15 +571,12 @@ class record_preview extends record_adapter return $this->download_popularity; } - $appbox = $this->app['phraseanet.appbox']; - $user = $this->app['phraseanet.user']; - $registry = $this->app['phraseanet.registry']; $report = $user->ACL()->has_right_on_base( $this->get_base_id(), 'canreport'); $ret = false; - if ( ! $report && ! $registry->get('GV_google_api')) { + if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) { $this->download_popularity = false; return $this->download_popularity; @@ -621,7 +610,7 @@ class record_preview extends record_adapter $stmt->execute( array( ':record_id' => $this->get_record_id(), - ':site' => $registry->get('GV_sit') + ':site' => $this->app['phraseanet.registry']->get('GV_sit') ) ); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); diff --git a/lib/classes/recordutils/image.class.php b/lib/classes/recordutils/image.class.php index 216bb33ffe..603b1b33b5 100644 --- a/lib/classes/recordutils/image.class.php +++ b/lib/classes/recordutils/image.class.php @@ -73,7 +73,6 @@ class recordutils_image extends recordutils */ public static function stamp(Application $app, \media_subdef $subdef) { - $registry = $app['phraseanet.registry']; $base_id = $subdef->get_record()->get_base_id(); if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) { @@ -84,7 +83,7 @@ class recordutils_image extends recordutils return $subdef->get_pathfile(); } - if ( ! $registry->get('GV_imagick')) { + if ( ! $app['phraseanet.registry']->get('GV_imagick')) { return $subdef->get_pathfile(); } @@ -102,7 +101,7 @@ class recordutils_image extends recordutils $pathIn = $subdef->get_path() . $subdef->get_file(); $pathOut = $subdef->get_path() . 'stamp_' . $subdef->get_file(); - $pathTmpStamp = $registry->get('GV_RootPath') . 'tmp/' . time() . '-stamptmp_' . $subdef->get_file(); + $pathTmpStamp = $app['phraseanet.registry']->get('GV_RootPath') . 'tmp/' . time() . '-stamptmp_' . $subdef->get_file(); if ($xpprefs->query('/baseprefs/stamp')->length == 0) { return $subdef->get_pathfile(); @@ -158,7 +157,7 @@ class recordutils_image extends recordutils $text_xpos = 0; $text_width = $image_width; - $logofile = $registry->get('GV_RootPath') . 'config/stamp/' . $base_id; + $logofile = $app['phraseanet.registry']->get('GV_RootPath') . 'config/stamp/' . $base_id; $logopos = null; $imlogo = null; // gd image $logo_phywidth = $logo_phyheight = 0; // physical size @@ -287,7 +286,7 @@ class recordutils_image extends recordutils $newh = $image_height + $stampheight; - $cmd = $registry->get('GV_imagick'); + $cmd = $app['phraseanet.registry']->get('GV_imagick'); $cmd .= ' -extent "' . $image_width . 'x' . $newh . '" -draw "image SrcOver 0,' . $image_height . ' ' . $image_width . ',' . $stampheight . '\'' . $pathTmpStamp . '\'"'; @@ -313,7 +312,6 @@ class recordutils_image extends recordutils */ public static function watermark(Application $app, \media_subdef $subdef) { - $registry = $app['phraseanet.registry']; $base_id = $subdef->get_record()->get_base_id(); if ($subdef->get_name() !== 'preview') { @@ -340,10 +338,10 @@ class recordutils_image extends recordutils return $pathOut; } - if ($registry->get('GV_pathcomposite') && - file_exists($registry->get('GV_RootPath') . 'config/wm/' . $base_id)) { // si il y a un WM - $cmd = $registry->get('GV_pathcomposite') . " "; - $cmd .= $registry->get('GV_RootPath') . 'config/wm/' . $base_id . " "; + if ($app['phraseanet.registry']->get('GV_pathcomposite') && + file_exists($app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id)) { // si il y a un WM + $cmd = $app['phraseanet.registry']->get('GV_pathcomposite') . " "; + $cmd .= $app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id . " "; $cmd .= " \"" . $pathIn . "\" "; # <<-- la preview original $cmd .= " -strip -watermark 90% -gravity center "; $cmd .= " \"" . $pathOut . "\""; # <-- la preview temporaire @@ -364,9 +362,9 @@ class recordutils_image extends recordutils fclose($pipes[2]); $return_value = proc_close($process); } - } elseif ($registry->get('GV_imagick')) { + } elseif ($app['phraseanet.registry']->get('GV_imagick')) { $collname = phrasea::bas_names($base_id, $app); - $cmd = $registry->get('GV_imagick'); + $cmd = $app['phraseanet.registry']->get('GV_imagick'); $tailleimg = @getimagesize($pathIn); $max = ($tailleimg[0] > $tailleimg[1] ? $tailleimg[0] : $tailleimg[1]); diff --git a/lib/classes/searchEngine/adapter/phrasea/engine.class.php b/lib/classes/searchEngine/adapter/phrasea/engine.class.php index 733405dac6..5bc009862a 100644 --- a/lib/classes/searchEngine/adapter/phrasea/engine.class.php +++ b/lib/classes/searchEngine/adapter/phrasea/engine.class.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; /** * @@ -362,8 +361,6 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract */ protected function query() { - $registry = $this->app['phraseanet.registry']; - $dateLog = date("Y-m-d H:i:s"); $nbanswers = 0; @@ -408,7 +405,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract , $sbas_id , $this->colls[$sbas_id] , $this->arrayq[$sbas_id] - , $registry->get('GV_sit') + , $this->app['phraseanet.registry']->get('GV_sit') , (string) $this->app['phraseanet.user']->get_id() , false , $this->opt_search_type == 1 ? PHRASEA_MULTIDOC_REGONLY : PHRASEA_MULTIDOC_DOCONLY diff --git a/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php b/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php index 6a66792ff9..89783bf158 100644 --- a/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php +++ b/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php @@ -1725,16 +1725,15 @@ class searchEngine_adapter_phrasea_queryParser public function addsimple($t, $type, $nodetype, $pnum, $tree, $depth) { $nok = 0; - $registry = $this->app['phraseanet.registry']; $w = $t["VALUE"]; if ($w != "?" && $w != "*") { // on laisse passer les 'isolés' pour les traiter plus tard comme des mots vides for ($i = 0; $i < strlen($w); $i ++ ) { $c = substr($w, $i, 1); if ($c == "?" || $c == "*") { - if ($nok < $registry->get('GV_min_letters_truncation')) { + if ($nok < $this->app['phraseanet.registry']->get('GV_min_letters_truncation')) { if ($this->errmsg != "") $this->errmsg .= sprintf("\\n"); - $this->errmsg .= _('qparser:: Formulation incorrecte, necessite plus de caractere : ') . "
" . $registry->get('GV_min_letters_truncation'); + $this->errmsg .= _('qparser:: Formulation incorrecte, necessite plus de caractere : ') . "
" . $this->app['phraseanet.registry']->get('GV_min_letters_truncation'); return(null); } diff --git a/lib/classes/searchEngine/adapter/sphinx/engine.class.php b/lib/classes/searchEngine/adapter/sphinx/engine.class.php index c975c6763a..26e7f26c4a 100644 --- a/lib/classes/searchEngine/adapter/sphinx/engine.class.php +++ b/lib/classes/searchEngine/adapter/sphinx/engine.class.php @@ -11,7 +11,6 @@ require_once __DIR__ . '/../../../../vendor/sphinx/sphinxapi.php'; */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; /** * @@ -59,12 +58,11 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i public function __construct(Application $app) { $this->app = $app; - $registry = $this->app['phraseanet.registry']; $this->sphinx = new SphinxClient (); $this->sphinx->SetArrayResult(true); - $this->sphinx->SetServer($registry->get('GV_sphinx_host'), (int) $registry->get('GV_sphinx_port')); + $this->sphinx->SetServer($this->app['phraseanet.registry']->get('GV_sphinx_host'), (int) $this->app['phraseanet.registry']->get('GV_sphinx_port')); $this->sphinx->SetConnectTimeout(1); return $this; diff --git a/lib/classes/searchEngine/results.class.php b/lib/classes/searchEngine/results.class.php index 3f35b8cd4e..bafb2b74d2 100644 --- a/lib/classes/searchEngine/results.class.php +++ b/lib/classes/searchEngine/results.class.php @@ -9,8 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; - /** * * @package searchEngine diff --git a/lib/classes/set/export.class.php b/lib/classes/set/export.class.php index ef8f3e649c..767b238c02 100644 --- a/lib/classes/set/export.class.php +++ b/lib/classes/set/export.class.php @@ -229,7 +229,7 @@ class set_export extends set_abstract $this->ftp_datas = array(); - if ($registry->get('GV_activeFTP') && ($hasadminright || $registry->get('GV_ftp_for_user'))) { + if ($this->app['phraseanet.registry']->get('GV_activeFTP') && ($hasadminright || $this->app['phraseanet.registry']->get('GV_ftp_for_user'))) { $display_ftp = $display_download; $this->total_ftp = $this->total_download; @@ -249,7 +249,7 @@ class set_export extends set_abstract ) GROUP BY usr_id "; $params = array(); - } elseif ($registry->get('GV_ftp_for_user')) { + } elseif ($this->app['phraseanet.registry']->get('GV_ftp_for_user')) { $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP, usr.pwdFTP,usr.destFTP,prefixFTPfolder, usr.passifFTP,usr.retryFTP,usr.usr_mail @@ -397,8 +397,6 @@ class set_export extends set_abstract $includeBusinessFields = !!$includeBusinessFields; - $registry = $this->app['phraseanet.registry']; - $unicode = new unicode(); $files = array(); @@ -628,7 +626,7 @@ class set_export extends set_abstract $files[$id]["export_name"] = $tmp_name; if (in_array('caption', $subdefs)) { - $caption_dir = $registry->get('GV_RootPath') . 'tmp/desc_tmp/' + $caption_dir = $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/desc_tmp/' . time() . $this->app['phraseanet.user']->get_id() . '/'; $filesystem->mkdir($caption_dir, 0750); @@ -649,7 +647,7 @@ class set_export extends set_abstract $files[$id]["subdefs"]['caption']['businessfields'] = $BF ? '1' : '0'; } if (in_array('caption-yaml', $subdefs)) { - $caption_dir = $registry->get('GV_RootPath') . 'tmp/desc_tmp/' + $caption_dir = $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/desc_tmp/' . time() . $this->app['phraseanet.user']->get_id() . '/'; $filesystem->mkdir($caption_dir, 0750); diff --git a/lib/classes/set/exportftp.class.php b/lib/classes/set/exportftp.class.php index 2b3995f5ec..f16253f02c 100644 --- a/lib/classes/set/exportftp.class.php +++ b/lib/classes/set/exportftp.class.php @@ -9,8 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; - /** * * diff --git a/lib/classes/set/order.class.php b/lib/classes/set/order.class.php index e6fd0586e0..0924b6194e 100644 --- a/lib/classes/set/order.class.php +++ b/lib/classes/set/order.class.php @@ -10,9 +10,7 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Controller\RecordsRequest; -use Doctrine\Common\Collections\ArrayCollection; /** * @@ -458,7 +456,7 @@ class set_order extends set_abstract */ public function deny_elements(Array $elements_ids) { - $conn = $app['phraseanet.appbox']->get_connection(); + $conn = $this->app['phraseanet.appbox']->get_connection(); $n = 0; @@ -480,7 +478,7 @@ class set_order extends set_abstract } if ($n > 0) { - $evt_mngr = $app['events-manager']; + $evt_mngr = $this->app['events-manager']; $params = array( 'from' => $this->app['phraseanet.user']->get_id(), diff --git a/lib/classes/set/selection.class.php b/lib/classes/set/selection.class.php index 333aef9357..b5e5fb0cc4 100644 --- a/lib/classes/set/selection.class.php +++ b/lib/classes/set/selection.class.php @@ -10,7 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Configuration; /** * diff --git a/lib/classes/sphinx/configuration.class.php b/lib/classes/sphinx/configuration.class.php index ca9ceb692c..97efa66b99 100644 --- a/lib/classes/sphinx/configuration.class.php +++ b/lib/classes/sphinx/configuration.class.php @@ -37,7 +37,6 @@ class sphinx_configuration { $available_charsets = array(); $dir = __DIR__ . '/charsetTable/'; - $registry = $this->app['phraseanet.registry']; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { if ($file->isDir() || strpos($file->getPathname(), '/.svn/') !== false) { continue; diff --git a/lib/classes/task/Scheduler.class.php b/lib/classes/task/Scheduler.class.php index 39f5b0e6f7..56b2b86dee 100755 --- a/lib/classes/task/Scheduler.class.php +++ b/lib/classes/task/Scheduler.class.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Application; use Monolog\Logger; @@ -53,10 +52,8 @@ class task_Scheduler */ public function run() { - $registry = $this->dependencyContainer['phraseanet.registry']; - //prevent scheduler to fail if GV_cli is not provided - if ( ! is_executable($registry->get('GV_cli'))) { + if ( ! is_executable($this->dependencyContainer['phraseanet.registry']->get('GV_cli'))) { throw new \RuntimeException('PHP cli is not provided in registry'); } @@ -75,7 +72,7 @@ class task_Scheduler $this->method = self::METHOD_FORK; } - $lockdir = $registry->get('GV_RootPath') . 'tmp/locks/'; + $lockdir = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/locks/'; for ($try = 1; true; $try ++ ) { $lockfile = ($lockdir . 'scheduler.lock'); @@ -217,10 +214,10 @@ class task_Scheduler $taskPoll[$tkey] = array( "task" => $task, "current_status" => $status, - "cmd" => $registry->get('GV_cli'), + "cmd" => $this->dependencyContainer['phraseanet.registry']->get('GV_cli'), "args" => array( '-f', - $registry->get('GV_RootPath') . 'bin/console', + $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'bin/console', '--', '-q', 'task:run', @@ -331,7 +328,7 @@ class task_Scheduler $taskPoll[$tkey]["cmd"] . ' ' . implode(' ', $taskPoll[$tkey]["args"]) , $descriptors , $taskPoll[$tkey]["pipes"] - , $registry->get('GV_RootPath') . "bin/" + , $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . "bin/" , null , array('bypass_shell' => true) ); diff --git a/lib/classes/task/appboxAbstract.class.php b/lib/classes/task/appboxAbstract.class.php index ca6b51cc55..0b22e60e70 100755 --- a/lib/classes/task/appboxAbstract.class.php +++ b/lib/classes/task/appboxAbstract.class.php @@ -9,8 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; - /** * * @license http://opensource.org/licenses/gpl-3.0 GPLv3 diff --git a/lib/classes/task/databoxAbstract.class.php b/lib/classes/task/databoxAbstract.class.php index da1d35f984..5992ff9f3e 100755 --- a/lib/classes/task/databoxAbstract.class.php +++ b/lib/classes/task/databoxAbstract.class.php @@ -9,8 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; - /** * * @license http://opensource.org/licenses/gpl-3.0 GPLv3 diff --git a/lib/classes/task/manager.class.php b/lib/classes/task/manager.class.php index c6e68e311a..b4f5bb5b69 100755 --- a/lib/classes/task/manager.class.php +++ b/lib/classes/task/manager.class.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; use Monolog\Logger; use Alchemy\Phrasea\Application; diff --git a/lib/classes/task/period/RecordMover.class.php b/lib/classes/task/period/RecordMover.class.php index 05312c1964..6dc354a56c 100644 --- a/lib/classes/task/period/RecordMover.class.php +++ b/lib/classes/task/period/RecordMover.class.php @@ -8,8 +8,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; - /** * * @license http://opensource.org/licenses/gpl-3.0 GPLv3 diff --git a/lib/classes/task/period/apibridge.class.php b/lib/classes/task/period/apibridge.class.php index 171910d013..89af5cffdc 100755 --- a/lib/classes/task/period/apibridge.class.php +++ b/lib/classes/task/period/apibridge.class.php @@ -9,8 +9,6 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; - /** * * @license http://opensource.org/licenses/gpl-3.0 GPLv3 diff --git a/lib/classes/task/period/archive.class.php b/lib/classes/task/period/archive.class.php index 6e616593c1..bc38183a02 100755 --- a/lib/classes/task/period/archive.class.php +++ b/lib/classes/task/period/archive.class.php @@ -8,10 +8,8 @@ * file that was distributed with this source code. */ -use Alchemy\Phrasea\Core\Configuration; use Alchemy\Phrasea\Metadata\Tag as PhraseaTag; use Alchemy\Phrasea\Border\Attribute as BorderAttribute; -use MediaVorus\MediaVorus; use PHPExiftool\Driver\Metadata\Metadata; use PHPExiftool\Driver\Metadata\MetadataBag; use Symfony\Component\Filesystem\Exception\IOException; @@ -197,8 +195,6 @@ class task_period_archive extends task_abstract */ public function getInterfaceHTML() { - $appbox = $this->dependencyContainer['phraseanet.appbox']; - ob_start(); ?>
@@ -207,7 +203,7 @@ class task_period_archive extends task_abstract