Remove get_registry method

This commit is contained in:
Romain Neutron
2012-09-28 14:19:48 +02:00
parent 65589f3b21
commit 58af2b4c9c
52 changed files with 109 additions and 146 deletions

View File

@@ -418,7 +418,7 @@ class Lightbox implements ControllerProviderInterface
$evt_mngr = $app['events-manager']; $evt_mngr = $app['events-manager'];
$expires = new \DateTime('+10 days'); $expires = new \DateTime('+10 days');
$url = $app['phraseanet.appbox']->get_registry()->get('GV_ServerName') $url = $app['phraseanet.registry']->get('GV_ServerName')
. 'lightbox/index.php?LOG=' . \random::getUrlToken( . 'lightbox/index.php?LOG=' . \random::getUrlToken(
$app, \random::TYPE_VALIDATE $app, \random::TYPE_VALIDATE
, $basket->getValidation()->getInitiator($app)->get_id() , $basket->getValidation()->getInitiator($app)->get_id()

View File

@@ -62,7 +62,7 @@ return call_user_func(function($environment = 'prod') {
$custom_template = sprintf( $custom_template = sprintf(
"%sconfig/templates/web/api/auth/end_user_authorization/%s.html.twig" "%sconfig/templates/web/api/auth/end_user_authorization/%s.html.twig"
, $app['phraseanet.appbox']->get_registry()->get('GV_RootPath') , $app['phraseanet.registry']->get('GV_RootPath')
, $client->get_id() , $client->get_id()
); );

View File

@@ -652,10 +652,9 @@ class Databox implements ControllerProviderInterface
*/ */
public function mountCollection(Application $app, Request $request, $databox_id, $collection_id) public function mountCollection(Application $app, Request $request, $databox_id, $collection_id)
{ {
$appbox = $app['phraseanet.appbox'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$appbox->get_connection()->beginTransaction(); $app['phraseanet.appbox']->get_connection()->beginTransaction();
try { try {
$baseId = \collection::mount_collection($app, $app['phraseanet.appbox']->get_databox($databox_id), $collection_id, $user); $baseId = \collection::mount_collection($app, $app['phraseanet.appbox']->get_databox($databox_id), $collection_id, $user);
@@ -676,11 +675,11 @@ class Databox implements ControllerProviderInterface
$n += 50; $n += 50;
} }
$appbox->get_connection()->commit(); $app['phraseanet.appbox']->get_connection()->commit();
return $app->redirect('/admin/databox/' . $databox_id . '/?mount=ok'); return $app->redirect('/admin/databox/' . $databox_id . '/?mount=ok');
} catch (\Exception $e) { } catch (\Exception $e) {
$appbox->get_connection()->rollBack(); $app['phraseanet.appbox']->get_connection()->rollBack();
return $app->redirect('/admin/databox/' . $databox_id . '/?mount=ko'); return $app->redirect('/admin/databox/' . $databox_id . '/?mount=ko');
} }
@@ -899,7 +898,7 @@ class Databox implements ControllerProviderInterface
$app->abort(400, _('Bad request format, only JSON is allowed')); $app->abort(400, _('Bad request format, only JSON is allowed'));
} }
$appbox = $app['phraseanet.appbox']; $app['phraseanet.appbox'] = $app['phraseanet.appbox'];
$ret = array( $ret = array(
'success' => false, 'success' => false,
@@ -914,10 +913,10 @@ class Databox implements ControllerProviderInterface
); );
try { try {
$databox = $appbox->get_databox($databox_id); $databox = $app['phraseanet.appbox']->get_databox($databox_id);
$datas = $databox->get_indexed_record_amount(); $datas = $databox->get_indexed_record_amount();
$ret['indexable'] = $appbox->is_databox_indexable($databox); $ret['indexable'] = $app['phraseanet.appbox']->is_databox_indexable($databox);
$ret['viewname'] = (($databox->get_dbname() == $databox->get_viewname()) ? _('admin::base: aucun alias') : $databox->get_viewname()); $ret['viewname'] = (($databox->get_dbname() == $databox->get_viewname()) ? _('admin::base: aucun alias') : $databox->get_viewname());
$ret['records'] = $databox->get_record_amount(); $ret['records'] = $databox->get_record_amount();
$ret['sbas_id'] = $databox_id; $ret['sbas_id'] = $databox_id;

View File

@@ -288,7 +288,6 @@ class Databoxes implements ControllerProviderInterface
return $app->redirect('/admin/databoxes/?success=0&error=special-chars'); return $app->redirect('/admin/databoxes/?success=0&error=special-chars');
} }
$appbox = $app['phraseanet.appbox'];
$registry = $app['phraseanet.registry']; $registry = $app['phraseanet.registry'];
if ((null === $request->request->get('new_settings'))) { if ((null === $request->request->get('new_settings'))) {
@@ -301,14 +300,14 @@ class Databoxes implements ControllerProviderInterface
$user = $connexion->get('user'); $user = $connexion->get('user');
$password = $connexion->get('password'); $password = $connexion->get('password');
$appbox->get_connection()->beginTransaction(); $app['phraseanet.appbox']->get_connection()->beginTransaction();
$base = \databox::mount($app, $hostname, $port, $user, $password, $dbName, $registry); $base = \databox::mount($app, $hostname, $port, $user, $password, $dbName, $registry);
$base->registerAdmin($app['phraseanet.user']); $base->registerAdmin($app['phraseanet.user']);
$appbox->get_connection()->commit(); $app['phraseanet.appbox']->get_connection()->commit();
return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1'); return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1');
} catch (\Exception $e) { } catch (\Exception $e) {
$appbox->get_connection()->rollBack(); $app['phraseanet.appbox']->get_connection()->rollBack();
return $app->redirect('/admin/databoxes/?success=0&error=mount-failed'); return $app->redirect('/admin/databoxes/?success=0&error=mount-failed');
} }
} }
@@ -321,14 +320,14 @@ class Databoxes implements ControllerProviderInterface
&& (null !== $passwordDb = $request->request->get('new_password'))) { && (null !== $passwordDb = $request->request->get('new_password'))) {
try { try {
$appbox->get_connection()->beginTransaction(); $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, $registry);
$base->registerAdmin($app['phraseanet.user']); $base->registerAdmin($app['phraseanet.user']);
$appbox->get_connection()->commit(); $app['phraseanet.appbox']->get_connection()->commit();
return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1'); return $app->redirect('/admin/databox/' . $base->get_sbas_id() . '/?success=1&reload-tree=1');
} catch (\Exception $e) { } catch (\Exception $e) {
$appbox->get_connection()->rollBack(); $app['phraseanet.appbox']->get_connection()->rollBack();
return $app->redirect('/admin/databoxes/?success=0&error=mount-failed'); return $app->redirect('/admin/databoxes/?success=0&error=mount-failed');
} }

View File

@@ -38,7 +38,6 @@ class Root implements ControllerProviderInterface
}); });
$controllers->get('/', function(Application $app, Request $request) { $controllers->get('/', function(Application $app, Request $request) {
$appbox = $app['phraseanet.appbox'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
\User_Adapter::updateClientInfos($app, 3); \User_Adapter::updateClientInfos($app, 3);
@@ -70,7 +69,7 @@ class Root implements ControllerProviderInterface
} }
$databoxes = $off_databoxes = array(); $databoxes = $off_databoxes = array();
foreach ($appbox->get_databoxes() as $databox) { foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
try { try {
if (!$user->ACL()->has_access_to_sbas($databox->get_sbas_id())) { if (!$user->ACL()->has_access_to_sbas($databox->get_sbas_id())) {
continue; continue;
@@ -105,7 +104,6 @@ class Root implements ControllerProviderInterface
})->bind('admin'); })->bind('admin');
$controllers->get('/tree/', function(Application $app, Request $request) { $controllers->get('/tree/', function(Application $app, Request $request) {
$appbox = $app['phraseanet.appbox'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
\User_Adapter::updateClientInfos($app, 3); \User_Adapter::updateClientInfos($app, 3);
@@ -138,7 +136,7 @@ class Root implements ControllerProviderInterface
} }
$databoxes = $off_databoxes = array(); $databoxes = $off_databoxes = array();
foreach ($appbox->get_databoxes() as $databox) { foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
try { try {
if (!$user->ACL()->has_access_to_sbas($databox->get_sbas_id())) { if (!$user->ACL()->has_access_to_sbas($databox->get_sbas_id())) {
continue; continue;

View File

@@ -85,7 +85,7 @@ class TaskManager implements ControllerProviderInterface
$controllers->get('/scheduler/log', function(Application $app, Request $request) { $controllers->get('/scheduler/log', function(Application $app, Request $request) {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$registry = $appbox->get_registry(); $registry = $app['phraseanet.registry'];
$logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs'); $logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
$rname = '/scheduler((\.log)|(-.*\.log))$/'; $rname = '/scheduler((\.log)|(-.*\.log))$/';
@@ -129,7 +129,7 @@ class TaskManager implements ControllerProviderInterface
$controllers->get('/task/{id}/log', function(Application $app, Request $request, $id) { $controllers->get('/task/{id}/log', function(Application $app, Request $request, $id) {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$registry = $appbox->get_registry(); $registry = $app['phraseanet.registry'];
$logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs'); $logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
$rname = '/task_' . $id . '((\.log)|(-.*\.log))$/'; $rname = '/task_' . $id . '((\.log)|(-.*\.log))$/';

View File

@@ -70,7 +70,7 @@ class Bridge implements ControllerProviderInterface
$controllers->get('/login/{api_name}/', function(Application $app, $api_name) { $controllers->get('/login/{api_name}/', function(Application $app, $api_name) {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$connector = \Bridge_Api::get_connector_by_name($appbox->get_registry(), $api_name); $connector = \Bridge_Api::get_connector_by_name($app['phraseanet.registry'], $api_name);
return $app->redirect($connector->get_auth_url()); return $app->redirect($connector->get_auth_url());
}); });

View File

@@ -228,7 +228,7 @@ class Feed implements ControllerProviderInterface
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$feeds = \Feed_Collection::load_all($app, $user); $feeds = \Feed_Collection::load_all($app, $user);
$registry = $app['phraseanet.appbox']->get_registry(); $registry = $app['phraseanet.registry'];
$output = array( $output = array(
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') 'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
@@ -244,7 +244,7 @@ class Feed implements ControllerProviderInterface
$renew = ($request->query->get('renew') === 'true'); $renew = ($request->query->get('renew') === 'true');
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$feed = \Feed_Adapter::load_with_user($app, $user, $id); $feed = \Feed_Adapter::load_with_user($app, $user, $id);
$registry = $app['phraseanet.appbox']->get_registry(); $registry = $app['phraseanet.registry'];
$output = array( $output = array(
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') 'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')

View File

@@ -38,7 +38,7 @@ class Query implements ControllerProviderInterface
$controllers->post('/', function(Application $app, Request $request) { $controllers->post('/', function(Application $app, Request $request) {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$registry = $appbox->get_registry(); $registry = $app['phraseanet.registry'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];

View File

@@ -1439,7 +1439,7 @@ class ACL implements cache_cacheableInterface
foreach ($this->get_granted_base(array(), array($databox->get_sbas_id())) as $collection) { foreach ($this->get_granted_base(array(), array($databox->get_sbas_id())) as $collection) {
$stmt->execute(array( $stmt->execute(array(
':site_id' => $this->app['phraseanet.appbox']->get_registry()->get('GV_sit'), ':site_id' => $this->app['phraseanet.registry']->get('GV_sit'),
':usr_id' => $this->user->get_id(), ':usr_id' => $this->user->get_id(),
':coll_id' => $collection->get_coll_id(), ':coll_id' => $collection->get_coll_id(),
':mask_and' => $this->get_mask_and($collection->get_base_id()), ':mask_and' => $this->get_mask_and($collection->get_base_id()),
@@ -1467,7 +1467,7 @@ class ACL implements cache_cacheableInterface
$sql = 'DELETE FROM collusr WHERE usr_id = :usr_id AND site = :site'; $sql = 'DELETE FROM collusr WHERE usr_id = :usr_id AND site = :site';
$params = array( $params = array(
':usr_id' => $this->user->get_id() ':usr_id' => $this->user->get_id()
, ':site' => $this->app['phraseanet.appbox']->get_registry()->get('GV_sit') , ':site' => $this->app['phraseanet.registry']->get('GV_sit')
); );
$stmt = $databox->get_connection()->prepare($sql); $stmt = $databox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);

View File

@@ -829,7 +829,7 @@ class API_V1_adapter extends API_V1_Abstract
public function search_records(Request $request) public function search_records(Request $request)
{ {
$user = $this->app['phraseanet.user']; $user = $this->app['phraseanet.user'];
$registry = $this->app['phraseanet.appbox']->get_registry(); $registry = $this->app['phraseanet.registry'];
$result = new API_V1_result($request, $this); $result = new API_V1_result($request, $this);
$search_type = ($request->get('search_type') $search_type = ($request->get('search_type')
@@ -1044,7 +1044,7 @@ class API_V1_adapter extends API_V1_Abstract
$mimes = $request->get('mimes', array()); $mimes = $request->get('mimes', array());
foreach ($record->get_embedable_medias($devices, $mimes) as $name => $media) { foreach ($record->get_embedable_medias($devices, $mimes) as $name => $media) {
$ret[] = $this->list_embedable_media($media, $this->app['phraseanet.appbox']->get_registry()); $ret[] = $this->list_embedable_media($media, $this->app['phraseanet.registry']);
} }
$result->set_datas(array("embed" => $ret)); $result->set_datas(array("embed" => $ret));

View File

@@ -77,7 +77,7 @@ class Bridge_Api
if ( ! $row) if ( ! $row)
throw new Bridge_Exception_ApiNotFound('Api Not Found'); throw new Bridge_Exception_ApiNotFound('Api Not Found');
$this->connector = self::get_connector_by_name($this->app['phraseanet.appbox']->get_registry(), $row['name']); $this->connector = self::get_connector_by_name($this->app['phraseanet.registry'], $row['name']);
$this->disable_time = $row['disable_time'] ? new DateTime($row['disable_time']) : null; $this->disable_time = $row['disable_time'] ? new DateTime($row['disable_time']) : null;
$this->updated_on = new DateTime($row['updated_on']); $this->updated_on = new DateTime($row['updated_on']);
$this->created_on = new DateTime($row['created_on']); $this->created_on = new DateTime($row['created_on']);

View File

@@ -138,7 +138,7 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
$url = '/skins/icons/rss32.gif'; $url = '/skins/icons/rss32.gif';
$file = $this->app['phraseanet.appbox']->get_registry()->get('GV_RootPath') $file = $this->app['phraseanet.registry']->get('GV_RootPath')
. 'www/custom/feed_' . $this->get_id() . '.jpg'; . 'www/custom/feed_' . $this->get_id() . '.jpg';
if (file_exists($file)) { if (file_exists($file)) {

View File

@@ -249,7 +249,7 @@ class Session_Authentication_Native implements Session_Authentication_Interface
protected function check_and_revoke_badlogs($ip) protected function check_and_revoke_badlogs($ip)
{ {
$conn = $this->app['phraseanet.appbox']->get_connection(); $conn = $this->app['phraseanet.appbox']->get_connection();
$registry = $this->app['phraseanet.appbox']->get_registry(); $registry = $this->app['phraseanet.registry'];
$sql = 'SELECT id FROM badlog $sql = 'SELECT id FROM badlog
WHERE (login = :login OR ip = :ip) AND locked="1"'; WHERE (login = :login OR ip = :ip) AND locked="1"';
@@ -285,7 +285,7 @@ class Session_Authentication_Native implements Session_Authentication_Interface
*/ */
protected function is_captcha_activated(registryInterface $registry) protected function is_captcha_activated(registryInterface $registry)
{ {
$registry = $this->app['phraseanet.appbox']->get_registry(); $registry = $this->app['phraseanet.registry'];
return ($registry->get('GV_captchas') return ($registry->get('GV_captchas')
&& trim($registry->get('GV_captcha_private_key')) !== '' && trim($registry->get('GV_captcha_private_key')) !== ''

View File

@@ -156,7 +156,7 @@ class Session_Logger
WHERE site = :site AND sit_session = :ses_id'; WHERE site = :site AND sit_session = :ses_id';
$params = array( $params = array(
':site' => $databox->get_registry()->get('GV_sit') ':site' => $app['phraseanet.registry']->get('GV_sit')
, ':ses_id' => $app['session']->get('phrasea_session_id') , ':ses_id' => $app['session']->get('phrasea_session_id')
); );

View File

@@ -434,7 +434,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
*/ */
public function get_protected_rss_url($renew = false) public function get_protected_rss_url($renew = false)
{ {
$registry = $this->app['phraseanet.appbox']->get_registry(); $registry = $this->app['phraseanet.registry'];
$token = $title = false; $token = $title = false;
@@ -1632,7 +1632,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_locale() public function get_locale()
{ {
$registry = $this->app['phraseanet.appbox']->get_registry(); $registry = $this->app['phraseanet.registry'];
$sql = "SELECT locale FROM usr WHERE usr_id = :usr_id"; $sql = "SELECT locale FROM usr WHERE usr_id = :usr_id";
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);

View File

@@ -205,7 +205,7 @@ class appbox extends base
} }
} }
$registry = $databox->get_registry(); $registry = $this->app['phraseanet.registry'];
$file = $registry->get('GV_RootPath') . 'config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg'; $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'; $custom_path = $registry->get('GV_RootPath') . 'www/custom/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg';
@@ -323,7 +323,7 @@ class appbox extends base
$upgrader->add_steps(7 + count($this->get_databoxes())); $upgrader->add_steps(7 + count($this->get_databoxes()));
$registry = $this->get_registry(); $registry = $this->app['phraseanet.registry'];
/** /**
* Step 1 * Step 1

View File

@@ -133,15 +133,6 @@ abstract class base implements cache_cacheableInterface
return $this->host; return $this->host;
} }
/**
*
* @return registry
*/
public function get_registry()
{
return $this->app['phraseanet.registry'];
}
/** /**
* *
* @return connection_pdo * @return connection_pdo

View File

@@ -348,7 +348,7 @@ class databox extends base
$n+=50; $n+=50;
} }
$params = array(':site_id' => $this->get_registry()->get('GV_sit')); $params = array(':site_id' => $this->app['phraseanet.registry']->get('GV_sit'));
$sql = 'DELETE FROM clients WHERE site_id = :site_id'; $sql = 'DELETE FROM clients WHERE site_id = :site_id';
$stmt = $this->get_connection()->prepare($sql); $stmt = $this->get_connection()->prepare($sql);

View File

@@ -26,8 +26,8 @@ class eventsmanager_broker
public function start() public function start()
{ {
$iterators_pool = array( $iterators_pool = array(
'event' => (is_array($this->app['phraseanet.appbox']->get_registry()->get('GV_events')) ? $this->app['phraseanet.appbox']->get_registry()->get('GV_events') : array()), 'event' => (is_array($this->app['phraseanet.registry']->get('GV_events')) ? $this->app['phraseanet.registry']->get('GV_events') : array()),
'notify' => (is_array($this->app['phraseanet.appbox']->get_registry()->get('GV_notifications')) ? $this->app['phraseanet.appbox']->get_registry()->get('GV_notifications') : array()) 'notify' => (is_array($this->app['phraseanet.registry']->get('GV_notifications')) ? $this->app['phraseanet.registry']->get('GV_notifications') : array())
); );
foreach ($iterators_pool as $type => $iterators) { foreach ($iterators_pool as $type => $iterators) {

View File

@@ -125,8 +125,8 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
$to = array('email' => $admin_user->get_email(), 'name' => $dest); $to = array('email' => $admin_user->get_email(), 'name' => $dest);
$from = array( $from = array(
'email' => $this->app['phraseanet.appbox']->get_registry()->get('GV_defaulmailsenderaddr'), 'email' => $this->app['phraseanet.registry']->get('GV_defaulmailsenderaddr'),
'name' => $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle') 'name' => $this->app['phraseanet.registry']->get('GV_homeTitle')
); );
if (self::mail($to, $from, $datas)) if (self::mail($to, $from, $datas))
@@ -196,7 +196,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
public function mail($to, $from, $datas) public function mail($to, $from, $datas)
{ {
$subject = sprintf(_('admin::register: Inscription automatique sur %s') $subject = sprintf(_('admin::register: Inscription automatique sur %s')
, $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle')); , $this->app['phraseanet.registry']->get('GV_homeTitle'));
$body = "<div>" . _('admin::register: un utilisateur s\'est inscrit') $body = "<div>" . _('admin::register: un utilisateur s\'est inscrit')
. "</div>\n"; . "</div>\n";
@@ -261,7 +261,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
{ {
$bool = false; $bool = false;
$login = new \login(); $login = new \login();
if ( ! $this->app->isAuthenticated() || ! $login->register_enabled($this->app)) { if ( ! $this->app->isAuthenticated() || ! $login->register_enabled($this->app)) {
return false; return false;
} }

View File

@@ -87,8 +87,8 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract
$to = array('email' => $user->get_email(), 'name' => $name); $to = array('email' => $user->get_email(), 'name' => $name);
$from = array( $from = array(
'email' => $this->app['phraseanet.appbox']->get_registry()->get('GV_defaulmailsenderaddr'), 'email' => $this->app['phraseanet.registry']->get('GV_defaulmailsenderaddr'),
'name' => $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle') 'name' => $this->app['phraseanet.registry']->get('GV_homeTitle')
); );
if (self::mail($to, $from, $datas)) if (self::mail($to, $from, $datas))
@@ -160,7 +160,7 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract
public function mail($to, $from, $datas) public function mail($to, $from, $datas)
{ {
$subject = sprintf('Echec upload sur %s' $subject = sprintf('Echec upload sur %s'
, $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle')); , $this->app['phraseanet.registry']->get('GV_homeTitle'));
$sx = simplexml_load_string($datas); $sx = simplexml_load_string($datas);

View File

@@ -90,8 +90,8 @@ class eventsmanager_notify_downloadmailfail extends eventsmanager_notifyAbstract
$to = array('email' => $user->get_email(), 'name' => $name); $to = array('email' => $user->get_email(), 'name' => $name);
$from = array( $from = array(
'email' => $this->app['phraseanet.appbox']->get_registry()->get('GV_defaulmailsenderaddr'), 'email' => $this->app['phraseanet.registry']->get('GV_defaulmailsenderaddr'),
'name' => $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle') 'name' => $this->app['phraseanet.registry']->get('GV_homeTitle')
); );
if (parent::email()) if (parent::email())

View File

@@ -93,14 +93,14 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
); );
$token = \random::getUrlToken( $token = \random::getUrlToken(
$this->app, $this->app,
\random::TYPE_FEED_ENTRY \random::TYPE_FEED_ENTRY
, $user_to_notif->get_id() , $user_to_notif->get_id()
, null , null
, $entry->get_id() , $entry->get_id()
); );
$url = $this->app['phraseanet.appbox']->get_registry()->get('GV_ServerName') . 'lightbox/index.php?LOG=' . $token; $url = $this->app['phraseanet.registry']->get('GV_ServerName') . 'lightbox/index.php?LOG=' . $token;
if (self::mail($email, $from, $url, $entry)) if (self::mail($email, $from, $url, $entry))
$mailed = true; $mailed = true;

View File

@@ -108,8 +108,8 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
$to = array('email' => $user->get_email(), 'name' => $dest); $to = array('email' => $user->get_email(), 'name' => $dest);
$from = array( $from = array(
'email' => $this->app['phraseanet.appbox']->get_registry()->get('GV_defaulmailsenderaddr'), 'email' => $this->app['phraseanet.registry']->get('GV_defaulmailsenderaddr'),
'name' => $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle') 'name' => $this->app['phraseanet.registry']->get('GV_homeTitle')
); );
if (self::mail($to, $from, $datas)) { if (self::mail($to, $from, $datas)) {
@@ -183,7 +183,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
public function mail($to, $from, $datas) public function mail($to, $from, $datas)
{ {
$subject = sprintf(_('admin::register: Nouvelle commande sur %s') $subject = sprintf(_('admin::register: Nouvelle commande sur %s')
, $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle')); , $this->app['phraseanet.registry']->get('GV_homeTitle'));
$body = "<div>" $body = "<div>"
. _('admin::register: un utilisateur a commande des documents') . _('admin::register: un utilisateur a commande des documents')

View File

@@ -205,7 +205,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
_('%s vous a delivre votre commande, consultez la en ligne a l\'adresse suivante'), $from['name'] _('%s vous a delivre votre commande, consultez la en ligne a l\'adresse suivante'), $from['name']
) . "</div>\n"; ) . "</div>\n";
$body .= "<br/>\n" . $this->app['phraseanet.appbox']->get_registry()->get('GV_ServerName') . 'lightbox/validate/' . $ssel_id; $body .= "<br/>\n" . $this->app['phraseanet.registry']->get('GV_ServerName') . 'lightbox/validate/' . $ssel_id;
return mail::send_mail($this->app, $subject, $body, $to, $from, array()); return mail::send_mail($this->app, $subject, $body, $to, $from, array());
} }

View File

@@ -123,8 +123,8 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
$to = array('email' => $admin_user->get_email(), 'name' => $dest); $to = array('email' => $admin_user->get_email(), 'name' => $dest);
$from = array( $from = array(
'email' => $this->app['phraseanet.appbox']->get_registry()->get('GV_defaulmailsenderaddr'), 'email' => $this->app['phraseanet.registry']->get('GV_defaulmailsenderaddr'),
'name' => $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle') 'name' => $this->app['phraseanet.registry']->get('GV_homeTitle')
); );
if (self::mail($to, $from, $datas)) if (self::mail($to, $from, $datas))
@@ -159,7 +159,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
$ret = array( $ret = array(
'text' => sprintf( 'text' => sprintf(
_('%1$s demande votre approbation sur une ou plusieurs %2$scollections%3$s'), $sender, '<a href="' . $this->app['phraseanet.appbox']->get_registry()->get('GV_ServerName') . 'admin/?section=registrations" target="_blank">', '</a>' _('%1$s demande votre approbation sur une ou plusieurs %2$scollections%3$s'), $sender, '<a href="' . $this->app['phraseanet.registry']->get('GV_ServerName') . 'admin/?section=registrations" target="_blank">', '</a>'
) )
, 'class' => '' , 'class' => ''
); );
@@ -195,7 +195,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
public function mail($to, $from, $datas) public function mail($to, $from, $datas)
{ {
$subject = sprintf( $subject = sprintf(
_('admin::register: demande d\'inscription sur %s'), $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle') _('admin::register: demande d\'inscription sur %s'), $this->app['phraseanet.registry']->get('GV_homeTitle')
); );
$body = "<div>" $body = "<div>"
@@ -249,7 +249,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
$body .= "</ul>\n"; $body .= "</ul>\n";
$body .= "<br/>\n<div><a href='" . $this->app['phraseanet.appbox']->get_registry()->get('GV_ServerName') $body .= "<br/>\n<div><a href='" . $this->app['phraseanet.registry']->get('GV_ServerName')
. "login/?redirect=admin' target='_blank'>" . "login/?redirect=admin' target='_blank'>"
. _('admin::register: vous pourrez traiter ses demandes en ligne via l\'interface d\'administration') . _('admin::register: vous pourrez traiter ses demandes en ligne via l\'interface d\'administration')
. "</a></div>\n"; . "</a></div>\n";

View File

@@ -110,8 +110,8 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
$to = array('email' => $user->get_email(), 'name' => $user->get_display_name()); $to = array('email' => $user->get_email(), 'name' => $user->get_display_name());
$from = array( $from = array(
'email' => $this->app['phraseanet.appbox']->get_registry()->get('GV_defaulmailsenderaddr'), 'email' => $this->app['phraseanet.registry']->get('GV_defaulmailsenderaddr'),
'name' => $this->app['phraseanet.appbox']->get_registry()->get('GV_homeTitle') 'name' => $this->app['phraseanet.registry']->get('GV_homeTitle')
); );
if (self::mail($to, $from, $datas)) { if (self::mail($to, $from, $datas)) {

View File

@@ -145,7 +145,7 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
} }
$bask_link = '<a href="' $bask_link = '<a href="'
. $this->app['phraseanet.appbox']->get_registry()->get('GV_ServerName') . 'lightbox/validate/' . $this->app['phraseanet.registry']->get('GV_ServerName') . 'lightbox/validate/'
. (string) $sx->ssel_id . '/" target="_blank">' . (string) $sx->ssel_id . '/" target="_blank">'
. $basket_name . '</a>'; . $basket_name . '</a>';

View File

@@ -163,7 +163,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
$ret = array( $ret = array(
'text' => sprintf( 'text' => sprintf(
_('Rappel : Il vous reste %1$d jours pour valider %2$s de %3$s'), $this->app['phraseanet.appbox']->get_registry()->get('GV_validation_reminder'), $bask_link, $sender _('Rappel : Il vous reste %1$d jours pour valider %2$s de %3$s'), $this->app['phraseanet.registry']->get('GV_validation_reminder'), $bask_link, $sender
) )
, 'class' => ($unread == 1 ? 'reload_baskets' : '') , 'class' => ($unread == 1 ? 'reload_baskets' : '')
); );
@@ -202,7 +202,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
$body = "<div>" $body = "<div>"
. sprintf( . sprintf(
_('Il ne vous reste plus que %d jours pour terminer votre validation'), $this->app['phraseanet.appbox']->get_registry()->get('GV_validation_reminder')) _('Il ne vous reste plus que %d jours pour terminer votre validation'), $this->app['phraseanet.registry']->get('GV_validation_reminder'))
. "</div>\n"; . "</div>\n";
if (trim($url) != '') { if (trim($url) != '') {

View File

@@ -276,7 +276,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
*/ */
protected function find_substitute_file() protected function find_substitute_file()
{ {
$registry = $this->record->get_databox()->get_registry(); $registry = $this->app['phraseanet.registry'];
if ($this->record->is_grouping()) { if ($this->record->is_grouping()) {
$this->mime = 'image/png'; $this->mime = 'image/png';

View File

@@ -51,7 +51,7 @@ class module_console_checkExtension extends Command
$appbox = $this->getService('phraseanet.appbox'); $appbox = $this->getService('phraseanet.appbox');
$registry = $appbox->get_registry(); $registry = $this->container['phraseanet.registry'];
$usrId = $input->getArgument('usr_id'); $usrId = $input->getArgument('usr_id');

View File

@@ -42,7 +42,7 @@ class module_console_sphinxGenerateSuggestion extends Command
define('SUGGEST_DEBUG', 0); define('SUGGEST_DEBUG', 0);
$appbox = $this->getService('phraseanet.appbox'); $appbox = $this->getService('phraseanet.appbox');
$registry = $appbox->get_registry(); $registry = $this->container['phraseanet.registry'];
$params = phrasea::sbas_params($this->container); $params = phrasea::sbas_params($this->container);

View File

@@ -214,7 +214,7 @@ class module_report_download extends module_report
$databox = $appbox->get_databox((int) $sbas_id); $databox = $appbox->get_databox((int) $sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$registry = $databox->get_registry(); $registry = $app['phraseanet.registry'];
$params = array(':site_id' => $registry->get('GV_sit')); $params = array(':site_id' => $registry->get('GV_sit'));
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);

View File

@@ -56,8 +56,8 @@ class patch_303 implements patchInterface
public function apply(base $appbox, Application $app) public function apply(base $appbox, Application $app)
{ {
$this->update_users_log_datas($appbox); $this->update_users_log_datas($appbox, $app);
$this->update_users_search_datas($appbox); $this->update_users_search_datas($appbox, $app);
return true; return true;
} }
@@ -66,7 +66,7 @@ class patch_303 implements patchInterface
* *
* @return patch_303 * @return patch_303
*/ */
public function update_users_log_datas(appbox $appbox) public function update_users_log_datas(appbox $appbox, Application $app)
{ {
$col = array('fonction', 'societe', 'activite', 'pays'); $col = array('fonction', 'societe', 'activite', 'pays');
@@ -90,7 +90,7 @@ class patch_303 implements patchInterface
foreach ($appbox->get_databoxes() as $databox) { foreach ($appbox->get_databoxes() as $databox) {
foreach ($tab_usr as $id => $columns) { foreach ($tab_usr as $id => $columns) {
$f_req = array(); $f_req = array();
$params = array(':usr_id' => $id, ':site' => $appbox->get_registry()->get('GV_sit')); $params = array(':usr_id' => $id, ':site' => $app['phraseanet.registry']->get('GV_sit'));
foreach ($columns as $column => $value) { foreach ($columns as $column => $value) {
$column = trim($column); $column = trim($column);
$f_req[] = $column . " = :" . $column; $f_req[] = $column . " = :" . $column;
@@ -112,7 +112,7 @@ class patch_303 implements patchInterface
* *
* @return patch_303 * @return patch_303
*/ */
public function update_users_search_datas(appbox $appbox) public function update_users_search_datas(appbox $appbox, Application $app)
{ {
foreach ($appbox->get_databoxes() as $databox) { foreach ($appbox->get_databoxes() as $databox) {
$date_debut = '0000-00-00 00:00:00'; $date_debut = '0000-00-00 00:00:00';

View File

@@ -60,7 +60,7 @@ class patch_320aa implements patchInterface
} else { } else {
return; return;
} }
require __DIR__ . '/../../../lib/conf.d/_GV_template.inc'; require __DIR__ . '/../../../lib/conf.d/_GV_template.inc';
define('GV_STATIC_URL', ''); define('GV_STATIC_URL', '');
@@ -70,7 +70,7 @@ class patch_320aa implements patchInterface
define('GV_sphinx_rt_host', ''); define('GV_sphinx_rt_host', '');
define('GV_sphinx_rt_port', ''); define('GV_sphinx_rt_port', '');
$registry = $appbox->get_registry(); $registry = $app['phraseanet.registry'];
foreach ($GV as $section => $datas_section) { foreach ($GV as $section => $datas_section) {
foreach ($datas_section['vars'] as $datas) { foreach ($datas_section['vars'] as $datas) {

View File

@@ -76,7 +76,7 @@ class phrasea
public function getHome(Application $app, $type = 'PUBLI', $context = 'prod') public function getHome(Application $app, $type = 'PUBLI', $context = 'prod')
{ {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$registry = $appbox->get_registry(); $registry = $app['phraseanet.registry'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
if ($type == 'HELP') { if ($type == 'HELP') {
if (file_exists($registry->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php")) { if (file_exists($registry->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php")) {

View File

@@ -505,7 +505,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$this->base_id = $collection->get_base_id(); $this->base_id = $collection->get_base_id();
try { try {
$sphinx_rt = sphinxrt::get_instance($appbox->get_registry()); $sphinx_rt = sphinxrt::get_instance($this->app['phraseanet.registry']);
$sbas_id = $this->get_sbas_id(); $sbas_id = $this->get_sbas_id();
$sbas_params = phrasea::sbas_params($this->app); $sbas_params = phrasea::sbas_params($this->app);
@@ -1575,7 +1575,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$connbas = $this->get_databox()->get_connection(); $connbas = $this->get_databox()->get_connection();
$sbas_id = $this->get_databox()->get_sbas_id(); $sbas_id = $this->get_databox()->get_sbas_id();
$appbox = $this->app['phraseanet.appbox']; $appbox = $this->app['phraseanet.appbox'];
$registry = $appbox->get_registry(); $registry = $this->app['phraseanet.registry'];
$conn = $appbox->get_connection(); $conn = $appbox->get_connection();
$ftodel = array(); $ftodel = array();
@@ -2066,7 +2066,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
WHERE rid_child = :record_id'; WHERE rid_child = :record_id';
$params = array( $params = array(
':GV_site' => $appbox->get_registry()->get('GV_sit') ':GV_site' => $this->app['phraseanet.registry']->get('GV_sit')
, ':usr_id' => $this->app['phraseanet.user']->get_id() , ':usr_id' => $this->app['phraseanet.user']->get_id()
, ':record_id' => $this->get_record_id() , ':record_id' => $this->get_record_id()
); );

View File

@@ -317,7 +317,7 @@ class record_preview extends record_adapter
$tab = array(); $tab = array();
$appbox = $this->app['phraseanet.appbox']; $appbox = $this->app['phraseanet.appbox'];
$registry = $appbox->get_registry(); $registry = $this->app['phraseanet.registry'];
$user = $this->app['phraseanet.user']; $user = $this->app['phraseanet.user'];
$report = $user->ACL()->has_right_on_base($this->get_base_id(), 'canreport'); $report = $user->ACL()->has_right_on_base($this->get_base_id(), 'canreport');
@@ -408,7 +408,7 @@ class record_preview extends record_adapter
$user = $this->app['phraseanet.user']; $user = $this->app['phraseanet.user'];
$report = $user->ACL()->has_right_on_base( $report = $user->ACL()->has_right_on_base(
$this->get_base_id(), 'canreport'); $this->get_base_id(), 'canreport');
$registry = $appbox->get_registry(); $registry = $this->app['phraseanet.registry'];
if ( ! $report && ! $registry->get('GV_google_api')) { if ( ! $report && ! $registry->get('GV_google_api')) {
$this->view_popularity = false; $this->view_popularity = false;
@@ -501,7 +501,7 @@ class record_preview extends record_adapter
$user = $this->app['phraseanet.user']; $user = $this->app['phraseanet.user'];
$report = $user->ACL()->has_right_on_base( $report = $user->ACL()->has_right_on_base(
$this->get_base_id(), 'canreport'); $this->get_base_id(), 'canreport');
$registry = $appbox->get_registry(); $registry = $this->app['phraseanet.registry'];
if ( ! $report && ! $registry->get('GV_google_api')) { if ( ! $report && ! $registry->get('GV_google_api')) {
$this->refferer_popularity = false; $this->refferer_popularity = false;
@@ -582,7 +582,7 @@ class record_preview extends record_adapter
$appbox = $this->app['phraseanet.appbox']; $appbox = $this->app['phraseanet.appbox'];
$user = $this->app['phraseanet.user']; $user = $this->app['phraseanet.user'];
$registry = $appbox->get_registry(); $registry = $this->app['phraseanet.registry'];
$report = $user->ACL()->has_right_on_base( $report = $user->ACL()->has_right_on_base(
$this->get_base_id(), 'canreport'); $this->get_base_id(), 'canreport');

View File

@@ -243,10 +243,8 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
$query .= ' AND recordtype=' . $this->opt_record_type; $query .= ' AND recordtype=' . $this->opt_record_type;
} }
$appbox = $this->app['phraseanet.appbox'];
$sql = 'SELECT query, query_time FROM cache WHERE session_id = :ses_id'; $sql = 'SELECT query, query_time FROM cache WHERE session_id = :ses_id';
$stmt = $appbox->get_connection()->prepare($sql); $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':ses_id' => $this->app['session']->get('phrasea_session_id'))); $stmt->execute(array(':ses_id' => $this->app['session']->get('phrasea_session_id')));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
@@ -364,8 +362,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
*/ */
protected function query() protected function query()
{ {
$appbox = $this->app['phraseanet.appbox']; $registry = $this->app['phraseanet.registry'];
$registry = $appbox->get_registry();
$dateLog = date("Y-m-d H:i:s"); $dateLog = date("Y-m-d H:i:s");
$nbanswers = 0; $nbanswers = 0;
@@ -378,7 +375,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
, ':ses_id' => $this->app['session']->get('phrasea_session_id') , ':ses_id' => $this->app['session']->get('phrasea_session_id')
); );
$stmt = $appbox->get_connection()->prepare($sql); $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
@@ -424,7 +421,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
if ($this->results[$sbas_id]) if ($this->results[$sbas_id])
$nbanswers += $this->results[$sbas_id]["nbanswers"]; $nbanswers += $this->results[$sbas_id]["nbanswers"];
$logger = $this->app['phraseanet.logger']($appbox->get_databox($sbas_id)); $logger = $this->app['phraseanet.logger']($this->app['phraseanet.appbox']->get_databox($sbas_id));
$conn2 = connection::getPDOConnection($this->app, $sbas_id); $conn2 = connection::getPDOConnection($this->app, $sbas_id);
@@ -464,7 +461,6 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
*/ */
protected function singleParse($sbas) protected function singleParse($sbas)
{ {
$appbox = $this->app['phraseanet.appbox'];
$this->qp[$sbas] = new searchEngine_adapter_phrasea_queryParser($this->app, $this->app['locale']); $this->qp[$sbas] = new searchEngine_adapter_phrasea_queryParser($this->app, $this->app['locale']);
$this->qp[$sbas]->debug = false; $this->qp[$sbas]->debug = false;
if ($sbas == 'main') if ($sbas == 'main')
@@ -494,9 +490,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
$qry .= trim($query); $qry .= trim($query);
} }
$appbox = $this->app['phraseanet.appbox']; foreach ($this->app['phraseanet.appbox']->get_databoxes() as $databox) {
foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $coll) { foreach ($databox->get_collections() as $coll) {
if (in_array($coll->get_base_id(), $this->opt_bases)) { if (in_array($coll->get_base_id(), $this->opt_bases)) {
$this->queries[$databox->get_sbas_id()] = $qry; $this->queries[$databox->get_sbas_id()] = $qry;
@@ -550,7 +544,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
foreach ($this->queries as $sbas => $qryBas) foreach ($this->queries as $sbas => $qryBas)
$this->singleParse($sbas); $this->singleParse($sbas);
foreach ($appbox->get_databoxes() as $databox) { foreach ($this->app['phraseanet.appbox']->get_databoxes() as $databox) {
if ( ! isset($this->queries[$databox->get_sbas_id()])) if ( ! isset($this->queries[$databox->get_sbas_id()]))
continue; continue;

View File

@@ -102,10 +102,8 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
$filters = array(); $filters = array();
$appbox = $this->app['phraseanet.appbox'];
foreach ($sbas_ids as $sbas_id) { foreach ($sbas_ids as $sbas_id) {
$fields = $appbox->get_databox($sbas_id)->get_meta_structure(); $fields = $this->app['phraseanet.appbox']->get_databox($sbas_id)->get_meta_structure();
foreach ($fields as $field) { foreach ($fields as $field) {
if ( ! in_array($field->get_id(), $options->get_fields())) if ( ! in_array($field->get_id(), $options->get_fields()))
@@ -142,12 +140,11 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
$this->sphinx->SetFilter('crc_struct_id', $filters); $this->sphinx->SetFilter('crc_struct_id', $filters);
} }
$appbox = $this->app['phraseanet.appbox'];
/** /**
* @todo : enhance : check status better * @todo : enhance : check status better
*/ */
foreach ($sbas_ids as $sbas_id) { foreach ($sbas_ids as $sbas_id) {
$s_status = $appbox->get_databox($sbas_id)->get_statusbits(); $s_status = $this->app['phraseanet.appbox']->get_databox($sbas_id)->get_statusbits();
$status_opts = $options->get_status(); $status_opts = $options->get_status();
foreach ($s_status as $n => $status) { foreach ($s_status as $n => $status) {
if ( ! array_key_exists($n, $status_opts)) if ( ! array_key_exists($n, $status_opts))
@@ -485,14 +482,13 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
if ( ! $this->current_index) if ( ! $this->current_index)
$this->current_index = '*'; $this->current_index = '*';
$appbox = $this->app['phraseanet.appbox'];
$supposed_qry = mb_strtolower($this->query); $supposed_qry = mb_strtolower($this->query);
$pieces = explode(" ", str_replace(array("all", "last", "et", "ou", "sauf", "and", "or", "except", "in", "dans", "'", '"', "(", ")", "_", "-"), ' ', $supposed_qry)); $pieces = explode(" ", str_replace(array("all", "last", "et", "ou", "sauf", "and", "or", "except", "in", "dans", "'", '"', "(", ")", "_", "-"), ' ', $supposed_qry));
$clef = 'sph_sugg_' . crc32(serialize($this->options) . ' ' . $this->current_index . implode(' ', $pieces) . ' ' . ($only_last_word ? '1' : '0')); $clef = 'sph_sugg_' . crc32(serialize($this->options) . ' ' . $this->current_index . implode(' ', $pieces) . ' ' . ($only_last_word ? '1' : '0'));
try { try {
return $appbox->get_data_from_cache($clef); return $this->app['phraseanet.appbox']->get_data_from_cache($clef);
} catch (Exception $e) { } catch (Exception $e) {
} }
@@ -578,7 +574,7 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
$clef_unique_datas = 'sph_sugg_' . crc32(serialize($this->options) . $this->current_index . $f); $clef_unique_datas = 'sph_sugg_' . crc32(serialize($this->options) . $this->current_index . $f);
try { try {
$datas = $appbox->get_data_from_cache($clef_unique_datas); $datas = $this->app['phraseanet.appbox']->get_data_from_cache($clef_unique_datas);
} catch (Exception $e) { } catch (Exception $e) {
$datas = false; $datas = false;
} }
@@ -594,7 +590,7 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
if ($tmp_res !== false && isset($tmp_res['total_found'])) { if ($tmp_res !== false && isset($tmp_res['total_found'])) {
$found = (int) $tmp_res['total_found']; $found = (int) $tmp_res['total_found'];
} }
$appbox->set_data_to_cache($found, $clef_unique_datas, 3600); $this->app['phraseanet.appbox']->set_data_to_cache($found, $clef_unique_datas, 3600);
} }
if ($found > 0) { if ($found > 0) {
@@ -617,7 +613,7 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
unset($propals[$key]); unset($propals[$key]);
} }
$appbox->set_data_to_cache($propals, $clef, 3600); $this->app['phraseanet.appbox']->set_data_to_cache($propals, $clef, 3600);
return $propals; return $propals;
} }
@@ -649,7 +645,6 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
*/ */
public function build_excerpt($query, array $fields, record_adapter $record) public function build_excerpt($query, array $fields, record_adapter $record)
{ {
$appbox = $this->app['phraseanet.appbox'];
$selected_sbas_id = $record->get_sbas_id(); $selected_sbas_id = $record->get_sbas_id();
$index = ''; $index = '';

View File

@@ -35,9 +35,8 @@ class set_exportftp extends set_export
*/ */
public function export_ftp($usr_to, $host, $login, $password, $ssl, $retry, $passif, $destfolder, $makedirectory, $logfile) public function export_ftp($usr_to, $host, $login, $password, $ssl, $retry, $passif, $destfolder, $makedirectory, $logfile)
{ {
$appbox = $this->app['phraseanet.appbox'];
$user_f = $this->app['phraseanet.user']; $user_f = $this->app['phraseanet.user'];
$conn = $appbox->get_connection(); $conn = $this->app['phraseanet.appbox']->get_connection();
$email_dest = ''; $email_dest = '';
if ($usr_to) { if ($usr_to) {

View File

@@ -211,8 +211,7 @@ class set_order extends set_abstract
public function __construct(Application $app, $id) public function __construct(Application $app, $id)
{ {
$this->app = $app; $this->app = $app;
$appbox = $app['phraseanet.appbox']; $conn = $app['phraseanet.appbox']->get_connection();
$conn = $appbox->get_connection();
$sql = 'SELECT o.id, o.usr_id, o.created_on, o.`usage`, o.deadline, $sql = 'SELECT o.id, o.usr_id, o.created_on, o.`usage`, o.deadline,
COUNT(e.id) as total, o.ssel_id, COUNT(e2.id) as todo COUNT(e.id) as total, o.ssel_id, COUNT(e2.id) as todo
@@ -459,8 +458,7 @@ class set_order extends set_abstract
*/ */
public function deny_elements(Array $elements_ids) public function deny_elements(Array $elements_ids)
{ {
$appbox = $this->app['phraseanet.appbox']; $conn = $app['phraseanet.appbox']->get_connection();
$conn = $appbox->get_connection();
$n = 0; $n = 0;

View File

@@ -73,7 +73,6 @@ abstract class task_appboxAbstract extends task_abstract
break; break;
} }
$appbox = $this->dependencyContainer['phraseanet.appbox'];
try { try {
$this->loadSettings(simplexml_load_string($row['settings'])); $this->loadSettings(simplexml_load_string($row['settings']));
} catch (Exception $e) { } catch (Exception $e) {
@@ -81,7 +80,7 @@ abstract class task_appboxAbstract extends task_abstract
continue; continue;
} }
$process_ret = $this->process($appbox); $process_ret = $this->process($this->dependencyContainer['phraseanet.appbox']);
switch ($process_ret) { switch ($process_ret) {
case self::STATE_MAXMEGSREACHED: case self::STATE_MAXMEGSREACHED:

View File

@@ -85,10 +85,9 @@ abstract class task_databoxAbstract extends task_abstract
$this->sbas_id = (int) $row['sbas_id']; $this->sbas_id = (int) $row['sbas_id'];
$this->log('This task works now on ' . phrasea::sbas_names($this->sbas_id, $app)); $this->log('This task works now on ' . phrasea::sbas_names($this->sbas_id, $app));
$appbox = $this->dependencyContainer['phraseanet.appbox'];
try { try {
// get the records to process // get the records to process
$databox = $appbox->get_databox((int) $row['sbas_id']); $databox = $this->dependencyContainer['phraseanet.appbox']->get_databox((int) $row['sbas_id']);
} catch (Exception $e) { } catch (Exception $e) {
$this->log(sprintf('Warning : can\' connect to sbas(%s)', $row['sbas_id'])); $this->log(sprintf('Warning : can\' connect to sbas(%s)', $row['sbas_id']));
continue; continue;

View File

@@ -126,13 +126,13 @@ class task_manager
public function getSchedulerProcess() public function getSchedulerProcess()
{ {
$phpcli = $this->appbox->get_registry()->get('GV_cli'); $phpcli = $this->app['phraseanet.registry']->get('GV_cli');
$cmd = $phpcli . ' -f ' . $this->appbox->get_registry()->get('GV_RootPath') . "bin/console scheduler:start"; $cmd = $phpcli . ' -f ' . $this->app['phraseanet.registry']->get('GV_RootPath') . "bin/console scheduler:start";
return new Process($cmd); return new Process($cmd);
} }
public function setSchedulerState($status) public function setSchedulerState($status)
{ {
$av_status = array( $av_status = array(

View File

@@ -502,8 +502,7 @@ class task_period_RecordMover extends task_appboxAbstract
protected function processOneContent(appbox $appbox, Array $row) protected function processOneContent(appbox $appbox, Array $row)
{ {
$logsql = (int) ($this->sxTaskSettings->logsql) > 0; $logsql = (int) ($this->sxTaskSettings->logsql) > 0;
$appbox = $this->dependencyContainer['phraseanet.appbox']; $databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($row['sbas_id']);
$databox = $appbox->get_databox($row['sbas_id']);
$rec = new record_adapter($this->dependencyContainer, $row['sbas_id'], $row['record_id']); $rec = new record_adapter($this->dependencyContainer, $row['sbas_id'], $row['record_id']);
switch ($row['action']) { switch ($row['action']) {
@@ -512,7 +511,7 @@ class task_period_RecordMover extends task_appboxAbstract
// change collection ? // change collection ?
if (array_key_exists('coll', $row)) { if (array_key_exists('coll', $row)) {
$coll = collection::get_from_coll_id($this->dependencyContainer, $databox, $row['coll']); $coll = collection::get_from_coll_id($this->dependencyContainer, $databox, $row['coll']);
$rec->move_to_collection($coll, $appbox); $rec->move_to_collection($coll, $this->dependencyContainer['phraseanet.appbox']);
if ($logsql) { if ($logsql) {
$this->log(sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id())); $this->log(sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id()));
} }
@@ -574,8 +573,6 @@ class task_period_RecordMover extends task_appboxAbstract
*/ */
private function calcSQL($sxtask, $playTest = false) private function calcSQL($sxtask, $playTest = false)
{ {
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$sbas_id = (int) ($sxtask['sbas_id']); $sbas_id = (int) ($sxtask['sbas_id']);
$ret = array( $ret = array(
@@ -592,7 +589,7 @@ class task_period_RecordMover extends task_appboxAbstract
); );
try { try {
$dbox = $appbox->get_databox($sbas_id); $dbox = $this->dependencyContainer['phraseanet.appbox']->get_databox($sbas_id);
$ret['basename'] = $dbox->get_viewname(); $ret['basename'] = $dbox->get_viewname();
$ret['basename_htmlencoded'] = htmlentities($ret['basename']); $ret['basename_htmlencoded'] = htmlentities($ret['basename']);

View File

@@ -304,7 +304,7 @@ class task_period_ftp extends task_appboxAbstract
protected function processOneContent(appbox $appbox, Array $ftp_export) protected function processOneContent(appbox $appbox, Array $ftp_export)
{ {
$conn = $appbox->get_connection(); $conn = $appbox->get_connection();
$registry = $appbox->get_registry(); $registry = $app['phraseanet.registry'];
$id = $ftp_export['id']; $id = $ftp_export['id'];
$ftp_export[$id]["crash"] = $ftp_export["crash"]; $ftp_export[$id]["crash"] = $ftp_export["crash"];

View File

@@ -312,7 +312,6 @@ class task_period_outofdate extends task_abstract
// ==================================================================== // ====================================================================
public function getInterfaceHTML() public function getInterfaceHTML()
{ {
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$user = $this->dependencyContainer['phraseanet.user']; $user = $this->dependencyContainer['phraseanet.user'];
ob_start(); ob_start();
@@ -732,7 +731,6 @@ class task_period_outofdate extends task_abstract
{ {
$ret = NULL; $ret = NULL;
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$request = http_request::getInstance(); $request = http_request::getInstance();
$parm2 = $request->get_parms( $parm2 = $request->get_parms(
'ACT', 'bid' 'ACT', 'bid'
@@ -752,7 +750,7 @@ class task_period_outofdate extends task_abstract
if ($parm2['bid'] != '') { if ($parm2['bid'] != '') {
$sbas_id = (int) $parm2['bid']; $sbas_id = (int) $parm2['bid'];
try { try {
$databox = $appbox->get_databox($sbas_id); $databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($sbas_id);
$meta_struct = $databox->get_meta_structure(); $meta_struct = $databox->get_meta_structure();
foreach ($meta_struct as $meta) { foreach ($meta_struct as $meta) {

View File

@@ -263,7 +263,6 @@ class task_period_workflow01 extends task_databoxAbstract
public function getInterfaceHTML() public function getInterfaceHTML()
{ {
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$user = $this->dependencyContainer['phraseanet.user']; $user = $this->dependencyContainer['phraseanet.user'];
ob_start(); ob_start();
?> ?>
@@ -431,7 +430,6 @@ class task_period_workflow01 extends task_databoxAbstract
{ {
$request = http_request::getInstance(); $request = http_request::getInstance();
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$user = $this->dependencyContainer['phraseanet.user']; $user = $this->dependencyContainer['phraseanet.user'];
$parm = $request->get_parms("bid"); $parm = $request->get_parms("bid");
@@ -446,7 +444,7 @@ class task_period_workflow01 extends task_databoxAbstract
$sbas_id = (int) $parm['bid']; $sbas_id = (int) $parm['bid'];
try { try {
$databox = $appbox->get_databox($sbas_id); $databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($sbas_id);
foreach ($databox->get_meta_structure() as $meta) { foreach ($databox->get_meta_structure() as $meta) {
if ($meta->get_type() !== 'date') { if ($meta->get_type() !== 'date') {
continue; continue;

View File

@@ -173,7 +173,6 @@ class task_period_writemeta extends task_databoxAbstract
public function getInterfaceHTML() public function getInterfaceHTML()
{ {
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$sbas_ids = $this->dependencyContainer['phraseanet.user']->ACL()->get_granted_sbas(array('bas_manage')); $sbas_ids = $this->dependencyContainer['phraseanet.user']->ACL()->get_granted_sbas(array('bas_manage'));
ob_start(); ob_start();

View File

@@ -44,7 +44,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if app['phraseanet.appbox'].get_registry().get('GV_display_gcf', 1) and app['request'].cookies.get('gfc_box') == false %} {% if app['phraseanet.registry'].get('GV_display_gcf', 1) and app['request'].cookies.get('gfc_box') == false %}
<!--[if IE]> <!--[if IE]>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script>
<link href="https://www.google.com/css/modules/buttons/g-button.css" type="text/css" rel="stylesheet"> <link href="https://www.google.com/css/modules/buttons/g-button.css" type="text/css" rel="stylesheet">