Cleanup namepaces, variables uses

This commit is contained in:
Romain Neutron
2012-09-28 16:06:28 +02:00
parent 372861deb4
commit 1700565862
232 changed files with 593 additions and 1446 deletions

View File

@@ -23,11 +23,6 @@ use Alchemy\Phrasea\Command\RescanTechnicalDatas;
use Alchemy\Phrasea\Command\BuildMissingSubdefs; use Alchemy\Phrasea\Command\BuildMissingSubdefs;
use Alchemy\Phrasea\Command\RecordAdd; use Alchemy\Phrasea\Command\RecordAdd;
use Alchemy\Phrasea\Command\CreateCollection; 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; use Alchemy\Phrasea\CLI;
require_once dirname(__FILE__) . '/../lib/classes/bootstrap.class.php'; require_once dirname(__FILE__) . '/../lib/classes/bootstrap.class.php';

View File

@@ -38,7 +38,6 @@ abstract class AbstractDelivery implements ControllerProviderInterface
$log_id = null; $log_id = null;
try { try {
$registry = $app['phraseanet.registry'];
$logger = $app['phraseanet.logger']($record->get_databox()); $logger = $app['phraseanet.logger']($record->get_databox());
$log_id = $logger->get_id(); $log_id = $logger->get_id();
@@ -48,7 +47,7 @@ abstract class AbstractDelivery implements ControllerProviderInterface
$referrer = $_SERVER['HTTP_REFERER']; $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) { } catch (\Exception $e) {
} }

View File

@@ -214,8 +214,6 @@ class Databoxes implements ControllerProviderInterface
return $app->redirect('/admin/databoxes/?error=special-chars'); 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'))) { if ((null === $request->request->get('new_settings')) && (null !== $dataTemplate = $request->request->get('new_data_template'))) {
$configuration = $app['phraseanet.configuration']; $configuration = $app['phraseanet.configuration'];
@@ -227,16 +225,16 @@ class Databoxes implements ControllerProviderInterface
$user = $connexion->get('user'); $user = $connexion->get('user');
$password = $connexion->get('password'); $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 { 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) { } catch (\PDOException $e) {
return $app->redirect('/admin/databoxes/?success=0&error=database-failed'); return $app->redirect('/admin/databoxes/?success=0&error=database-failed');
} }
try { try {
$base = \databox::create($app, $connbas, $dataTemplate, $registry); $base = \databox::create($app, $connbas, $dataTemplate, $app['phraseanet.registry']);
$base->registerAdmin($app['phraseanet.user']); $base->registerAdmin($app['phraseanet.user']);
$app['phraseanet.user']->ACL()->delete_data_from_cache(); $app['phraseanet.user']->ACL()->delete_data_from_cache();
@@ -255,10 +253,10 @@ class Databoxes implements ControllerProviderInterface
&& (null !== $dataTemplate = $request->request->get('new_data_template'))) { && (null !== $dataTemplate = $request->request->get('new_data_template'))) {
try { try {
$data_template = new \SplFileInfo($registry->get('GV_RootPath') . 'lib/conf.d/data_templates/' . $dataTemplate . '.xml'); $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(), $registry); $connbas = new \connection_pdo('databox_creation', $hostname, $port, $userDb, $passwordDb, $dbName, array(), $app['phraseanet.registry']);
try { try {
$base = \databox::create($app, $connbas, $data_template, $registry); $base = \databox::create($app, $connbas, $data_template, $app['phraseanet.registry']);
$base->registerAdmin($app['phraseanet.user']); $base->registerAdmin($app['phraseanet.user']);
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');
@@ -288,8 +286,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');
} }
$registry = $app['phraseanet.registry'];
if ((null === $request->request->get('new_settings'))) { if ((null === $request->request->get('new_settings'))) {
try { try {
$configuration = $app['phraseanet.configuration']; $configuration = $app['phraseanet.configuration'];
@@ -301,7 +297,7 @@ class Databoxes implements ControllerProviderInterface
$password = $connexion->get('password'); $password = $connexion->get('password');
$app['phraseanet.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, $app['phraseanet.registry']);
$base->registerAdmin($app['phraseanet.user']); $base->registerAdmin($app['phraseanet.user']);
$app['phraseanet.appbox']->get_connection()->commit(); $app['phraseanet.appbox']->get_connection()->commit();
@@ -321,7 +317,7 @@ class Databoxes implements ControllerProviderInterface
try { try {
$app['phraseanet.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, $app['phraseanet.registry']);
$base->registerAdmin($app['phraseanet.user']); $base->registerAdmin($app['phraseanet.user']);
$app['phraseanet.appbox']->get_connection()->commit(); $app['phraseanet.appbox']->get_connection()->commit();

View File

@@ -84,9 +84,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']; $logdir = \p4string::addEndSlash($app['phraseanet.registry']->get('GV_RootPath') . 'logs');
$registry = $app['phraseanet.registry'];
$logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
$rname = '/scheduler((\.log)|(-.*\.log))$/'; $rname = '/scheduler((\.log)|(-.*\.log))$/';
@@ -128,9 +126,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']; $logdir = \p4string::addEndSlash($app['phraseanet.registry']->get('GV_RootPath') . 'logs');
$registry = $app['phraseanet.registry'];
$logdir = \p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
$rname = '/task_' . $id . '((\.log)|(-.*\.log))$/'; $rname = '/task_' . $id . '((\.log)|(-.*\.log))$/';

View File

@@ -27,8 +27,6 @@ class Users implements ControllerProviderInterface
public function connect(Application $app) public function connect(Application $app)
{ {
$appbox = $app['phraseanet.appbox'];
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->post('/rights/', function(Application $app) { $controllers->post('/rights/', function(Application $app) {
@@ -194,7 +192,7 @@ class Users implements ControllerProviderInterface
return $app->redirect('/admin/users/search/'); 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']; $request = $app['request'];
$user_query = new \User_Query($app); $user_query = new \User_Query($app);
@@ -257,7 +255,7 @@ class Users implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
}); });
$controllers->post('/export/csv/', function(Application $app) use ($appbox) { $controllers->post('/export/csv/', function(Application $app) {
$request = $app['request']; $request = $app['request'];
$user_query = new \User_Query($app); $user_query = new \User_Query($app);
@@ -333,12 +331,12 @@ class Users implements ControllerProviderInterface
return $response; return $response;
}); });
$controllers->get('/demands/', function(Application $app, Request $request) use ($appbox) { $controllers->get('/demands/', function(Application $app, Request $request) {
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$lastMonth = time() - (3 * 4 * 7 * 24 * 60 * 60); $lastMonth = time() - (3 * 4 * 7 * 24 * 60 * 60);
$sql = "DELETE FROM demand WHERE date_modif < :date"; $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->execute(array(':date' => date('Y-m-d', $lastMonth)));
$stmt->closeCursor(); $stmt->closeCursor();
@@ -346,7 +344,7 @@ class Users implements ControllerProviderInterface
$sql = 'SELECT usr_id, usr_login FROM usr WHERE model_of = :usr_id'; $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())); $stmt->execute(array(':usr_id' => $user->get_id()));
$models = $stmt->fetchAll(\PDO::FETCH_ASSOC); $models = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor(); $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 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(); $stmt->execute();
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
@@ -392,7 +390,7 @@ class Users implements ControllerProviderInterface
)); ));
})->bind('users_display_demands'); })->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(); $templates = $deny = $accept = $options = array();
@@ -463,7 +461,7 @@ class Users implements ControllerProviderInterface
WHERE usr_id = :usr_id WHERE usr_id = :usr_id
AND (base_id = " . implode(' OR base_id = ', $base_ids) . ")"; 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->execute(array(':usr_id' => $usr));
$stmt->closeCursor(); $stmt->closeCursor();
} }
@@ -473,7 +471,7 @@ class Users implements ControllerProviderInterface
WHERE usr_id = :usr_id WHERE usr_id = :usr_id
AND base_id = :base_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) { foreach ($deny as $usr => $bases) {
$cache_to_update[$usr] = true; $cache_to_update[$usr] = true;
@@ -515,7 +513,7 @@ class Users implements ControllerProviderInterface
$done[$usr][$bas] = true; $done[$usr][$bas] = true;
$sql = "DELETE FROM demand WHERE usr_id = :usr_id AND base_id = :base_id"; $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->execute(array(':usr_id' => $usr, ':base_id' => $bas));
$stmt->closeCursor(); $stmt->closeCursor();
} }
@@ -530,7 +528,7 @@ class Users implements ControllerProviderInterface
foreach ($done as $usr => $bases) { foreach ($done as $usr => $bases) {
$sql = 'SELECT usr_mail FROM usr WHERE usr_id = :usr_id'; $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)); $stmt->execute(array(':usr_id' => $usr));
$row = $stmt->fetch(\PDO::FETCH_ASSOC); $row = $stmt->fetch(\PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();

View File

@@ -55,7 +55,6 @@ class Bridge implements ControllerProviderInterface
$controllers->post('/manager/', function(Application $app) { $controllers->post('/manager/', function(Application $app) {
$route = new RecordHelper\Bridge($app, $app['request']); $route = new RecordHelper\Bridge($app, $app['request']);
$appbox = $app['phraseanet.appbox'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$params = array( $params = array(
@@ -69,7 +68,6 @@ 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'];
$connector = \Bridge_Api::get_connector_by_name($app['phraseanet.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());
@@ -78,7 +76,6 @@ class Bridge implements ControllerProviderInterface
$controllers->get('/callback/{api_name}/', function(Application $app, $api_name) { $controllers->get('/callback/{api_name}/', function(Application $app, $api_name) {
$error_message = ''; $error_message = '';
try { try {
$appbox = $app['phraseanet.appbox'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$api = \Bridge_Api::get_by_api_name($app, $api_name); $api = \Bridge_Api::get_by_api_name($app, $api_name);
$connector = $api->get_connector(); $connector = $api->get_connector();
@@ -112,7 +109,6 @@ class Bridge implements ControllerProviderInterface
}); });
$controllers->get('/adapter/{account_id}/logout/', function(Application $app, $account_id) { $controllers->get('/adapter/{account_id}/logout/', function(Application $app, $account_id) {
$appbox = $app['phraseanet.appbox'];
$account = \Bridge_Account::load_account($app, $account_id); $account = \Bridge_Account::load_account($app, $account_id);
$app['require_connection']($account); $app['require_connection']($account);
$account->get_api()->get_connector()->disconnect(); $account->get_api()->get_connector()->disconnect();
@@ -124,7 +120,6 @@ class Bridge implements ControllerProviderInterface
$page = max((int) $app['request']->query->get('page'), 0); $page = max((int) $app['request']->query->get('page'), 0);
$quantity = 10; $quantity = 10;
$offset_start = max(($page - 1) * $quantity, 0); $offset_start = max(($page - 1) * $quantity, 0);
$appbox = $app['phraseanet.appbox'];
$account = \Bridge_Account::load_account($app, $account_id); $account = \Bridge_Account::load_account($app, $account_id);
$elements = \Bridge_Element::get_elements_by_account($app, $account, $offset_start, $quantity); $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); $page = max((int) $app['request']->query->get('page'), 0);
$quantity = 5; $quantity = 5;
$offset_start = max(($page - 1) * $quantity, 0); $offset_start = max(($page - 1) * $quantity, 0);
$appbox = $app['phraseanet.appbox'];
$account = \Bridge_Account::load_account($app, $account_id); $account = \Bridge_Account::load_account($app, $account_id);
$app['require_connection']($account); $app['require_connection']($account);
@@ -169,7 +163,6 @@ class Bridge implements ControllerProviderInterface
$page = max((int) $app['request']->query->get('page'), 0); $page = max((int) $app['request']->query->get('page'), 0);
$quantity = 5; $quantity = 5;
$offset_start = max(($page - 1) * $quantity, 0); $offset_start = max(($page - 1) * $quantity, 0);
$appbox = $app['phraseanet.appbox'];
$account = \Bridge_Account::load_account($app, $account_id); $account = \Bridge_Account::load_account($app, $account_id);
$app['require_connection']($account); $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) { $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); $account = \Bridge_Account::load_account($app, $account_id);
$app['require_connection']($account); $app['require_connection']($account);
@@ -253,7 +245,6 @@ class Bridge implements ControllerProviderInterface
})->assert('account_id', '\d+'); })->assert('account_id', '\d+');
$controllers->post('/action/{account_id}/{action}/{element_type}/', function(Application $app, $account_id, $action, $element_type) { $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); $account = \Bridge_Account::load_account($app, $account_id);
$app['require_connection']($account); $app['require_connection']($account);
@@ -356,7 +347,6 @@ class Bridge implements ControllerProviderInterface
$controllers->get('/upload/', function(Application $app) { $controllers->get('/upload/', function(Application $app) {
$request = $app['request']; $request = $app['request'];
$appbox = $app['phraseanet.appbox'];
$account = \Bridge_Account::load_account($app, $request->query->get('account_id')); $account = \Bridge_Account::load_account($app, $request->query->get('account_id'));
$app['require_connection']($account); $app['require_connection']($account);
@@ -381,7 +371,6 @@ class Bridge implements ControllerProviderInterface
$controllers->post('/upload/', function(Application $app) { $controllers->post('/upload/', function(Application $app) {
$errors = array(); $errors = array();
$request = $app['request']; $request = $app['request'];
$appbox = $app['phraseanet.appbox'];
$account = \Bridge_Account::load_account($app, $request->request->get('account_id')); $account = \Bridge_Account::load_account($app, $request->request->get('account_id'));
$app['require_connection']($account); $app['require_connection']($account);

View File

@@ -228,12 +228,11 @@ 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.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.')
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p> . '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
<div><input type="text" readonly="readonly" class="input_select_copy" value="' . $feeds->get_aggregate()->get_user_link($registry, $user, \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>', <div><input type="text" readonly="readonly" class="input_select_copy" value="' . $feeds->get_aggregate()->get_user_link($app['phraseanet.registry'], $user, \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>',
'titre' => _('publications::votre rss personnel') 'titre' => _('publications::votre rss personnel')
); );
@@ -244,12 +243,11 @@ 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.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.')
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p> . '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
<div><input type="text" style="width:100%" value="' . $feed->get_user_link($registry, $user, \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>', <div><input type="text" style="width:100%" value="' . $feed->get_user_link($app['phraseanet.registry'], $user, \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>',
'titre' => _('publications::votre rss personnel') 'titre' => _('publications::votre rss personnel')
); );

View File

@@ -27,13 +27,12 @@ class Language implements ControllerProviderInterface
$controller = $app['controllers_factory']; $controller = $app['controllers_factory'];
$controller->get("/", function(Application $app) { $controller->get("/", function(Application $app) {
$registry = $app['phraseanet.registry'];
$out = array(); $out = array();
$out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.'); $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['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['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['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
$out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier'); $out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier');
$out['hideMessage'] = _('phraseanet::Ne plus afficher ce message'); $out['hideMessage'] = _('phraseanet::Ne plus afficher ce message');

View File

@@ -146,14 +146,10 @@ class Push implements ControllerProviderInterface
); );
try { try {
$registry = $app['phraseanet.registry'];
$pusher = new RecordHelper\Push($app, $app['request']); $pusher = new RecordHelper\Push($app, $app['request']);
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$appbox = $app['phraseanet.appbox'];
$push_name = $request->request->get('name'); $push_name = $request->request->get('name');
if (trim($push_name) === '') { if (trim($push_name) === '') {
@@ -216,7 +212,7 @@ class Push implements ControllerProviderInterface
$app['EM']->flush(); $app['EM']->flush();
$url = $registry->get('GV_ServerName') $url = $app['phraseanet.registry']->get('GV_ServerName')
. 'lightbox/index.php?LOG=' . 'lightbox/index.php?LOG='
. \random::getUrlToken($app, \random::TYPE_VIEW, $user_receiver->get_id(), null, $Basket->getId()); . \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) { $controllers->post('/validate/', function(Application $app) {
$request = $app['request']; $request = $app['request'];
$appbox = $app['phraseanet.appbox'];
$ret = array( $ret = array(
'success' => false, 'success' => false,
'message' => _('Unable to send the documents') 'message' => _('Unable to send the documents')
); );
$registry = $app['phraseanet.registry'];
$app['EM']->beginTransaction(); $app['EM']->beginTransaction();
try { try {
@@ -339,8 +332,6 @@ class Push implements ControllerProviderInterface
$Validation = $Basket->getValidation(); $Validation = $Basket->getValidation();
} }
$appbox = $app['phraseanet.appbox'];
$found = false; $found = false;
foreach ($participants as $key => $participant) { foreach ($participants as $key => $participant) {
if ($participant['usr_id'] == $user->get_id()) { if ($participant['usr_id'] == $user->get_id()) {
@@ -419,7 +410,7 @@ class Push implements ControllerProviderInterface
$app['EM']->flush(); $app['EM']->flush();
$url = $registry->get('GV_ServerName') $url = $app['phraseanet.registry']->get('GV_ServerName')
. 'lightbox/index.php?LOG=' . 'lightbox/index.php?LOG='
. \random::getUrlToken($app, \random::TYPE_VIEW, $participant_user->get_id(), null, $Basket->getId()); . \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); return $app->json($result);
} }
$appbox = $app['phraseanet.appbox'];
$user = null; $user = null;
$email = $request->request->get('email'); $email = $request->request->get('email');

View File

@@ -37,9 +37,6 @@ class Query implements ControllerProviderInterface
$controllers->post('/', function(Application $app, Request $request) { $controllers->post('/', function(Application $app, Request $request) {
$appbox = $app['phraseanet.appbox'];
$registry = $app['phraseanet.registry'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$query = (string) $request->request->get('qry'); $query = (string) $request->request->get('qry');
@@ -196,7 +193,7 @@ class Query implements ControllerProviderInterface
$json['results'] = $app['twig']->render($template, array( $json['results'] = $app['twig']->render($template, array(
'results' => $result, '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(), 'highlight' => $search_engine->get_query(),
'searchEngine' => $search_engine, 'searchEngine' => $search_engine,
'suggestions' => $prop 'suggestions' => $prop

View File

@@ -42,10 +42,8 @@ class Root implements ControllerProviderInterface
\User_Adapter::updateClientInfos($app, 1); \User_Adapter::updateClientInfos($app, 1);
$appbox = $app['phraseanet.appbox'];
$registry = $app['phraseanet.registry'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$cssPath = $registry->get('GV_RootPath') . 'www/skins/prod/'; $cssPath = $app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/prod/';
$css = array(); $css = array();
$cssfile = false; $cssfile = false;
@@ -78,15 +76,15 @@ class Root implements ControllerProviderInterface
$queries_topics = ''; $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']); $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']); $queries_topics = \queries::tree_topics($app['locale.I18n']);
} }
$sbas = $bas2sbas = array(); $sbas = $bas2sbas = array();
foreach ($appbox->get_databoxes() as $databox) { foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
$sbas_id = $databox->get_sbas_id(); $sbas_id = $databox->get_sbas_id();
$sbas['s' + $sbas_id] = array( $sbas['s' + $sbas_id] = array(
@@ -109,13 +107,13 @@ class Root implements ControllerProviderInterface
'cssfile' => $cssfile, 'cssfile' => $cssfile,
'module' => 'prod', 'module' => 'prod',
'events' => $app['events-manager'], 'events' => $app['events-manager'],
'GV_defaultQuery_type' => $registry->get('GV_defaultQuery_type'), 'GV_defaultQuery_type' => $app['phraseanet.registry']->get('GV_defaultQuery_type'),
'GV_multiAndReport' => $registry->get('GV_multiAndReport'), 'GV_multiAndReport' => $app['phraseanet.registry']->get('GV_multiAndReport'),
'GV_thesaurus' => $registry->get('GV_thesaurus'), 'GV_thesaurus' => $app['phraseanet.registry']->get('GV_thesaurus'),
'cgus_agreement' => \databox_cgu::askAgreement($app), 'cgus_agreement' => \databox_cgu::askAgreement($app),
'css' => $css, 'css' => $css,
'feeds' => $feeds, 'feeds' => $feeds,
'GV_google_api' => $registry->get('GV_google_api'), 'GV_google_api' => $app['phraseanet.registry']->get('GV_google_api'),
'queries_topics' => $queries_topics, 'queries_topics' => $queries_topics,
'search_status' => \databox_status::getSearchStatus($app), 'search_status' => \databox_status::getSearchStatus($app),
'queries_history' => \queries::history($app['phraseanet.appbox'], $app['phraseanet.user']->get_id()), 'queries_history' => \queries::history($app['phraseanet.appbox'], $app['phraseanet.user']->get_id()),

View File

@@ -238,8 +238,6 @@ class Upload implements ControllerProviderInterface
} else { } else {
$params = array('lazaret_file' => $elementCreated); $params = array('lazaret_file' => $elementCreated);
$appbox = $app['phraseanet.appbox'];
$eventsManager = $app['events-manager']; $eventsManager = $app['events-manager'];
$eventsManager->trigger('__UPLOAD_QUARANTINE__', $params); $eventsManager->trigger('__UPLOAD_QUARANTINE__', $params);

View File

@@ -262,8 +262,6 @@ class Account implements ControllerProviderInterface
*/ */
public function resetEmail(Application $app, Request $request) public function resetEmail(Application $app, Request $request)
{ {
$appbox = $app['phraseanet.appbox'];
if (null !== $token = $request->request->get('token')) { if (null !== $token = $request->request->get('token')) {
try { try {
$datas = \random::helloToken($app, $token); $datas = \random::helloToken($app, $token);
@@ -363,8 +361,6 @@ class Account implements ControllerProviderInterface
*/ */
public function renewPassword(Application $app, Request $request) 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 ((null !== $password = $request->request->get('form_password')) && (null !== $passwordConfirm = $request->request->get('form_password_confirm'))) {
if ($password !== $passwordConfirm) { if ($password !== $passwordConfirm) {
return $app->redirect('/account/reset-password/?pass-error=pass-match'); 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')); $app->abort(400, _('Bad request format, only JSON is allowed'));
} }
$appbox = $app['phraseanet.appbox'];
$error = false; $error = false;
try { try {
@@ -479,7 +474,6 @@ class Account implements ControllerProviderInterface
*/ */
public function displayAccount(Application $app, Request $request) public function displayAccount(Application $app, Request $request)
{ {
$appbox = $app['phraseanet.appbox'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$evtMngr = $app['events-manager']; $evtMngr = $app['events-manager'];
@@ -518,7 +512,6 @@ class Account implements ControllerProviderInterface
*/ */
public function updateAccount(Application $app, Request $request) public function updateAccount(Application $app, Request $request)
{ {
$appbox = $app['phraseanet.appbox'];
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
$evtMngr = $app['events-manager']; $evtMngr = $app['events-manager'];
$notice = 'account-update-bad'; $notice = 'account-update-bad';
@@ -526,7 +519,7 @@ class Account implements ControllerProviderInterface
$demands = (array) $request->request->get('demand', array()); $demands = (array) $request->request->get('demand', array());
if (0 !== count($demands)) { if (0 !== count($demands)) {
$register = new \appbox_register($appbox); $register = new \appbox_register($app['phraseanet.appbox']);
foreach ($demands as $baseId) { foreach ($demands as $baseId) {
try { try {
@@ -575,7 +568,7 @@ class Account implements ControllerProviderInterface
} }
try { try {
$appbox->get_connection()->beginTransaction(); $app['phraseanet.appbox']->get_connection()->beginTransaction();
$user->set_gender($request->request->get("form_gender")) $user->set_gender($request->request->get("form_gender"))
->set_firstname($request->request->get("form_firstname")) ->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_ftp_dir_prefix($request->request->get("form_prefixFTPfolder"))
->set_defaultftpdatas($defaultDatas); ->set_defaultftpdatas($defaultDatas);
$appbox->get_connection()->commit(); $app['phraseanet.appbox']->get_connection()->commit();
$notice = 'account-update-ok'; $notice = 'account-update-ok';
} catch (Exception $e) { } catch (Exception $e) {
$appbox->get_connection()->rollBack(); $app['phraseanet.appbox']->get_connection()->rollBack();
} }
} }

View File

@@ -245,7 +245,6 @@ class Developers 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'];
$error = false; $error = false;
$accessToken = null; $accessToken = null;
@@ -258,7 +257,7 @@ class Developers implements ControllerProviderInterface
if ($token instanceof \API_OAuth2_Token) { if ($token instanceof \API_OAuth2_Token) {
$token->renew(); $token->renew();
} else { } else {
$token = \API_OAuth2_Token::create($appbox, $account); $token = \API_OAuth2_Token::create($app['phraseanet.appbox'], $account);
} }
$accessToken = $token->get_value(); $accessToken = $token->get_value();

View File

@@ -211,8 +211,6 @@ class Login implements ControllerProviderInterface
*/ */
public function sendConfirmMail(Application $app, Request $request) public function sendConfirmMail(Application $app, Request $request)
{ {
$appbox = $app['phraseanet.appbox'];
if (null === $usrId = $request->query->get('usr_id')) { if (null === $usrId = $request->query->get('usr_id')) {
$app->abort(400, sprintf(_('Request to send you the confirmation mail failed, please retry'))); $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) public function registerConfirm(Application $app, Request $request)
{ {
$appbox = $app['phraseanet.appbox'];
if (null === $code = $request->query->get('code')) { if (null === $code = $request->query->get('code')) {
return $app->redirect('/login/?redirect=/prod&error=code-not-found'); return $app->redirect('/login/?redirect=/prod&error=code-not-found');
} }
@@ -270,7 +266,7 @@ class Login implements ControllerProviderInterface
$user->set_mail_locked(false); $user->set_mail_locked(false);
\random::removeToken($app, $code); \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); $list = $appboxRegister->get_collection_awaiting_for_user($app, $user);
@@ -299,8 +295,6 @@ class Login implements ControllerProviderInterface
*/ */
public function renewPassword(Application $app, Request $request) public function renewPassword(Application $app, Request $request)
{ {
$appbox = $app['phraseanet.appbox'];
if (null !== $mail = $request->request->get('mail')) { if (null !== $mail = $request->request->get('mail')) {
if (!\PHPMailer::ValidateAddress($mail)) { if (!\PHPMailer::ValidateAddress($mail)) {
return $app->redirect('/login/forgot-password/?error=invalidmail'); return $app->redirect('/login/forgot-password/?error=invalidmail');
@@ -682,23 +676,20 @@ class Login implements ControllerProviderInterface
*/ */
public function login(Application $app, Request $request) public function login(Application $app, Request $request)
{ {
$appbox = $app['phraseanet.appbox']; require_once($app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php');
$registry = $app['phraseanet.registry']; 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');
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');
} }
$warning = $request->query->get('error', ''); $warning = $request->query->get('error', '');
try { try {
$appbox->get_connection(); $app['phraseanet.appbox']->get_connection();
} catch (\Exception $e) { } catch (\Exception $e) {
$warning = 'no-connection'; $warning = 'no-connection';
} }
if (!!$registry->get('GV_maintenance')) { if (!!$app['phraseanet.registry']->get('GV_maintenance')) {
$warning = 'maintenance'; $warning = 'maintenance';
} }
@@ -756,10 +747,10 @@ class Login implements ControllerProviderInterface
} }
$captchaSys = ''; $captchaSys = '';
if (!$registry->get('GV_maintenance') if (!$app['phraseanet.registry']->get('GV_maintenance')
&& $registry->get('GV_captchas') && $app['phraseanet.registry']->get('GV_captchas')
&& trim($registry->get('GV_captcha_private_key')) !== '' && trim($app['phraseanet.registry']->get('GV_captcha_private_key')) !== ''
&& trim($registry->get('GV_captcha_public_key')) !== '' && trim($app['phraseanet.registry']->get('GV_captcha_public_key')) !== ''
&& $request->query->get('error') == 'captcha') { && $request->query->get('error') == 'captcha') {
$captchaSys = '<div style="margin:0;float: left;width:330px;"><div id="recaptcha_image" style="float: left;margin:10px 15px 5px"></div> $captchaSys = '<div style="margin:0;float: left;width:330px;"><div id="recaptcha_image" style="float: left;margin:10px 15px 5px"></div>
<div style="text-align:center;float: left;margin:0 15px 5px;width:300px;"> <div style="text-align:center;float: left;margin:0 15px 5px;width:300px;">
@@ -768,7 +759,7 @@ class Login implements ControllerProviderInterface
<div style="text-align:center;float: left;width:300px;margin:0 15px 0px;"> <div style="text-align:center;float: left;width:300px;margin:0 15px 0px;">
<span class="recaptcha_only_if_image">' . _('login::captcha: recopier les mots ci dessous') . ' : </span> <span class="recaptcha_only_if_image">' . _('login::captcha: recopier les mots ci dessous') . ' : </span>
<input name="recaptcha_response_field" id="recaptcha_response_field" value="" type="text" style="width:180px;"/> <input name="recaptcha_response_field" id="recaptcha_response_field" value="" type="text" style="width:180px;"/>
</div>' . recaptcha_get_html($registry->get('GV_captcha_public_key')) . '</div>'; </div>' . recaptcha_get_html($app['phraseanet.registry']->get('GV_captcha_public_key')) . '</div>';
} }
$public_feeds = \Feed_Collection::load_public_feeds($app); $public_feeds = \Feed_Collection::load_public_feeds($app);
@@ -783,7 +774,7 @@ class Login implements ControllerProviderInterface
'captcha_system' => $captchaSys, 'captcha_system' => $captchaSys,
'login' => new \login(), 'login' => new \login(),
'feeds' => $feeds, '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) public function authenticate(Application $app, Request $request)
{ {
$appbox = $app['phraseanet.appbox']; $conn = $app['phraseanet.appbox']->get_connection();
$conn = $appbox->get_connection();
$registry = $app['phraseanet.registry'];
$is_guest = false; $is_guest = false;
@@ -818,13 +807,13 @@ class Login implements ControllerProviderInterface
} else { } else {
$captcha = false; $captcha = false;
if ($registry->get('GV_captchas') if ($app['phraseanet.registry']->get('GV_captchas')
&& '' !== $privateKey = trim($registry->get('GV_captcha_private_key')) && '' !== $privateKey = trim($app['phraseanet.registry']->get('GV_captcha_private_key'))
&& trim($registry->get('GV_captcha_public_key')) !== '' && trim($app['phraseanet.registry']->get('GV_captcha_public_key')) !== ''
&& null !== $challenge = $request->request->get("recaptcha_challenge_field") && null !== $challenge = $request->request->get("recaptcha_challenge_field")
&& null !== $captachResponse = $request->request->get("recaptcha_response_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); $checkCaptcha = recaptcha_check_answer($privateKey, $_SERVER["REMOTE_ADDR"], $challenge, $captachResponse);

View File

@@ -32,8 +32,6 @@ class RSSFeeds implements ControllerProviderInterface
$perPage = 5; $perPage = 5;
$entries = $feed->get_entries((($page - 1) * $perPage), $perPage); $entries = $feed->get_entries((($page - 1) * $perPage), $perPage);
$registry = $app['phraseanet.registry'];
if ($format == \Feed_Adapter::FORMAT_RSS) { if ($format == \Feed_Adapter::FORMAT_RSS) {
$content = new \Feed_XML_RSS(); $content = new \Feed_XML_RSS();
} }
@@ -47,9 +45,9 @@ class RSSFeeds implements ControllerProviderInterface
} }
if ($user instanceof \User_Adapter) 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 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_updated_on(new \DateTime());
$content->set_title($feed->get_title()); $content->set_title($feed->get_title());
@@ -59,14 +57,14 @@ class RSSFeeds implements ControllerProviderInterface
if ($user instanceof \User_Adapter) { if ($user instanceof \User_Adapter) {
if ($page > 1) 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)) 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 { } else {
if ($page > 1) 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)) 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) foreach ($entries->get_entries() as $entry)
$content->set_item($entry); $content->set_item($entry);

View File

@@ -211,23 +211,22 @@ class Installer implements ControllerProviderInterface
} }
} }
$registry = $app['phraseanet.registry'];
\setup::create_global_values($app); \setup::create_global_values($app);
// $appbox->set_registry($registry); // $appbox->set_registry($registry);
$registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->request->get('datapath_noweb')), \registry::TYPE_STRING); $app['phraseanet.registry']->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->request->get('datapath_noweb')), \registry::TYPE_STRING);
$registry->set('GV_ServerName', $servername, \registry::TYPE_STRING); $app['phraseanet.registry']->set('GV_ServerName', $servername, \registry::TYPE_STRING);
$registry->set('GV_cli', $request->request->get('binary_php'), \registry::TYPE_STRING); $app['phraseanet.registry']->set('GV_cli', $request->request->get('binary_php'), \registry::TYPE_STRING);
$registry->set('GV_imagick', $request->request->get('binary_convert'), \registry::TYPE_STRING); $app['phraseanet.registry']->set('GV_imagick', $request->request->get('binary_convert'), \registry::TYPE_STRING);
$registry->set('GV_pathcomposite', $request->request->get('binary_composite'), \registry::TYPE_STRING); $app['phraseanet.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); $app['phraseanet.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); $app['phraseanet.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); $app['phraseanet.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); $app['phraseanet.registry']->set('GV_unoconv', $request->request->get('binary_unoconv'), \registry::TYPE_STRING);
$registry->set('GV_ffmpeg', $request->request->get('binary_ffmpeg'), \registry::TYPE_STRING); $app['phraseanet.registry']->set('GV_ffmpeg', $request->request->get('binary_ffmpeg'), \registry::TYPE_STRING);
$registry->set('GV_mp4box', $request->request->get('binary_MP4Box'), \registry::TYPE_STRING); $app['phraseanet.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_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); $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)) { if ($databox_name && !\p4string::hasAccent($databox_name)) {
$template = new \SplFileInfo(__DIR__ . '/../../../../conf.d/data_templates/' . $request->request->get('db_template') . '.xml'); $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() $user->ACL()
->give_access_to_sbas(array($databox->get_sbas_id())) ->give_access_to_sbas(array($databox->get_sbas_id()))
->update_rights_to_sbas( ->update_rights_to_sbas(

View File

@@ -55,9 +55,8 @@ class Upgrader implements ControllerProviderInterface
session_write_close(); session_write_close();
ignore_user_abort(true); ignore_user_abort(true);
$appbox = $app['phraseanet.appbox'];
$upgrader = new \Setup_Upgrade($app); $upgrader = new \Setup_Upgrade($app);
$appbox->forceUpgrade($upgrader, $app); $app['phraseanet.appbox']->forceUpgrade($upgrader, $app);
/** /**
* @todo Show recomandation instead of redirect * @todo Show recomandation instead of redirect

View File

@@ -38,7 +38,6 @@ class BorderManager extends ServiceAbstract
*/ */
protected function init() protected function init()
{ {
$appbox = $this->app['phraseanet.appbox'];
$borderManager = new Manager($this->app); $borderManager = new Manager($this->app);
if ($this->app['xpdf.pdf2text']) { if ($this->app['xpdf.pdf2text']) {
@@ -84,7 +83,7 @@ class BorderManager extends ServiceAbstract
$databoxes = array(); $databoxes = array();
foreach ($checker['databoxes'] as $sbas_id) { foreach ($checker['databoxes'] as $sbas_id) {
try { try {
$databoxes[] = $appbox->get_databox($sbas_id); $databoxes[] = $this->app['phraseanet.appbox']->get_databox($sbas_id);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new \InvalidArgumentException('Invalid databox option'); throw new \InvalidArgumentException('Invalid databox option');
} }

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Helper\User; namespace Alchemy\Phrasea\Helper\User;
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Helper\Helper; use Alchemy\Phrasea\Helper\Helper;
/** /**
@@ -173,10 +172,9 @@ class Manage extends Helper
if ($sendCredentials) { if ($sendCredentials) {
$urlToken = \random::getUrlToken($this->app, \random::TYPE_PASSWORD, $createdUser->get_id()); $urlToken = \random::getUrlToken($this->app, \random::TYPE_PASSWORD, $createdUser->get_id());
$registry = $this->app['phraseanet.registry'];
if (false !== $urlToken) { 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()); \mail::send_credentials($this->app, $url, $createdUser->get_login(), $createdUser->get_email());
} }
} }

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Out\Module; namespace Alchemy\Phrasea\Out\Module;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Out\Tool\PhraseaPDF; use Alchemy\Phrasea\Out\Tool\PhraseaPDF;
/** /**
@@ -311,7 +310,6 @@ class PDF
protected function print_preview($withtdm, $write_caption) protected function print_preview($withtdm, $write_caption)
{ {
$registry = $this->app['phraseanet.registry'];
$user = $this->app['phraseanet.user']; $user = $this->app['phraseanet.user'];
if ($withtdm === true) { if ($withtdm === true) {
@@ -340,7 +338,7 @@ class PDF
$RIGHT_TEXT = ""; $RIGHT_TEXT = "";
$RIGHT_IMG = NULL; $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() . ""; . $rec->get_sbas_id() . "";
if (!is_file($LEFT__IMG)) { if (!is_file($LEFT__IMG)) {
@@ -361,7 +359,7 @@ class PDF
if ($vn == "" || $vn == "1") { if ($vn == "" || $vn == "1") {
$RIGHT_TEXT = \phrasea::bas_names($rec->get_base_id(), $this->app); $RIGHT_TEXT = \phrasea::bas_names($rec->get_base_id(), $this->app);
} elseif ($vn == "2") { } 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(); $xtmp = $this->pdf->GetX();

View File

@@ -77,13 +77,6 @@ class API_OAuth2_Account
*/ */
protected $token; protected $token;
/**
* Constructor
*
* @param appbox $appbox
* @param int $account_id
* @return API_OAuth2_Account
*/
public function __construct(Application $app, $account_id) public function __construct(Application $app, $account_id)
{ {
$this->app = $app; $this->app = $app;
@@ -230,13 +223,6 @@ class API_OAuth2_Account
return; 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) public static function create(Application $app, User_Adapter $user, API_OAuth2_Application $application)
{ {
$sql = 'INSERT INTO api_accounts $sql = 'INSERT INTO api_accounts
@@ -261,13 +247,6 @@ class API_OAuth2_Account
return new self($app, $account_id); 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) public static function load_with_user(Application $app, API_OAuth2_Application $application, User_Adapter $user)
{ {
$sql = 'SELECT api_account_id FROM api_accounts $sql = 'SELECT api_account_id FROM api_accounts

View File

@@ -664,12 +664,6 @@ class API_OAuth2_Application
return new self($app, $row['application_id']); 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) public static function load_dev_app_by_user(Application $app, User_Adapter $user)
{ {
$sql = 'SELECT a.application_id $sql = 'SELECT a.application_id
@@ -689,12 +683,6 @@ class API_OAuth2_Application
return $apps; 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) public static function load_app_by_user(Application $app, user_adapter $user)
{ {
$sql = 'SELECT a.application_id $sql = 'SELECT a.application_id

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Border\Attribute\Status; use Alchemy\Phrasea\Border\Attribute\Status;
use Alchemy\Phrasea\Border\Manager as BorderManager; use Alchemy\Phrasea\Border\Manager as BorderManager;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@@ -320,160 +319,158 @@ class API_V1_adapter extends API_V1_Abstract
*/ */
protected function get_gv_info(Application $app) protected function get_gv_info(Application $app)
{ {
$registry = $app['phraseanet.registry'];
return array( return array(
'global_values' => array( 'global_values' => array(
'serverName' => $registry->get('GV_ServerName'), 'serverName' => $app['phraseanet.registry']->get('GV_ServerName'),
'title' => $registry->get('GV_homeTitle'), 'title' => $app['phraseanet.registry']->get('GV_homeTitle'),
'keywords' => $registry->get('GV_metaKeywords'), 'keywords' => $app['phraseanet.registry']->get('GV_metaKeywords'),
'description' => $registry->get('GV_metaDescription'), 'description' => $app['phraseanet.registry']->get('GV_metaDescription'),
'httpServer' => array( 'httpServer' => array(
'logErrors' => $registry->get('GV_log_errors'), 'logErrors' => $app['phraseanet.registry']->get('GV_log_errors'),
'phpTimezone' => ini_get('date.timezone'), 'phpTimezone' => ini_get('date.timezone'),
'siteId' => $registry->get('GV_sit'), 'siteId' => $app['phraseanet.registry']->get('GV_sit'),
'staticUrl' => $registry->get('GV_STATIC_URL'), 'staticUrl' => $app['phraseanet.registry']->get('GV_STATIC_URL'),
'defaultLanguage' => $registry->get('id_GV_default_lng'), 'defaultLanguage' => $app['phraseanet.registry']->get('id_GV_default_lng'),
'allowIndexing' => $registry->get('GV_allow_search_engine'), 'allowIndexing' => $app['phraseanet.registry']->get('GV_allow_search_engine'),
'modes' => array( 'modes' => array(
'XsendFile' => $registry->get('GV_modxsendfile'), 'XsendFile' => $app['phraseanet.registry']->get('GV_modxsendfile'),
'nginxXAccelRedirect' => $registry->get('GV_X_Accel_Redirect'), 'nginxXAccelRedirect' => $app['phraseanet.registry']->get('GV_X_Accel_Redirect'),
'nginxXAccelRedirectMountPoint' => $registry->get('GV_X_Accel_Redirect_mount_point'), 'nginxXAccelRedirectMountPoint' => $app['phraseanet.registry']->get('GV_X_Accel_Redirect_mount_point'),
'h264Streaming' => $registry->get('GV_h264_streaming'), 'h264Streaming' => $app['phraseanet.registry']->get('GV_h264_streaming'),
'authTokenDirectory' => $registry->get('GV_mod_auth_token_directory'), 'authTokenDirectory' => $app['phraseanet.registry']->get('GV_mod_auth_token_directory'),
'authTokenDirectoryPath' => $registry->get('GV_mod_auth_token_directory_path'), 'authTokenDirectoryPath' => $app['phraseanet.registry']->get('GV_mod_auth_token_directory_path'),
'authTokenPassphrase' => $registry->get('GV_mod_auth_token_passphrase'), 'authTokenPassphrase' => $app['phraseanet.registry']->get('GV_mod_auth_token_passphrase'),
), ),
'files' => array( 'files' => array(
'owner' => $registry->get('GV_filesOwner'), 'owner' => $app['phraseanet.registry']->get('GV_filesOwner'),
'group' => $registry->get('GV_filesOwner'), 'group' => $app['phraseanet.registry']->get('GV_filesOwner'),
) )
), ),
'maintenance' => array( 'maintenance' => array(
'alertMessage' => $registry->get('GV_message'), 'alertMessage' => $app['phraseanet.registry']->get('GV_message'),
'displayMessage' => $registry->get('GV_message_on'), 'displayMessage' => $app['phraseanet.registry']->get('GV_message_on'),
), ),
'webServices' => array( 'webServices' => array(
'googleApi' => $registry->get('GV_google_api'), 'googleApi' => $app['phraseanet.registry']->get('GV_google_api'),
'googleAnalyticsId' => $registry->get('GV_googleAnalytics'), 'googleAnalyticsId' => $app['phraseanet.registry']->get('GV_googleAnalytics'),
'googleChromeFrameDisclaimer' => $registry->get('GV_display_gcf'), 'googleChromeFrameDisclaimer' => $app['phraseanet.registry']->get('GV_display_gcf'),
'i18nWebService' => $registry->get('GV_i18n_service'), 'i18nWebService' => $app['phraseanet.registry']->get('GV_i18n_service'),
'recaptacha' => array( 'recaptacha' => array(
'active' => $registry->get('GV_captchas'), 'active' => $app['phraseanet.registry']->get('GV_captchas'),
'publicKey' => $registry->get('GV_captcha_public_key'), 'publicKey' => $app['phraseanet.registry']->get('GV_captcha_public_key'),
'privateKey' => $registry->get('GV_captcha_private_key'), 'privateKey' => $app['phraseanet.registry']->get('GV_captcha_private_key'),
), ),
'youtube' => array( 'youtube' => array(
'active' => $registry->get('GV_youtube_api'), 'active' => $app['phraseanet.registry']->get('GV_youtube_api'),
'clientId' => $registry->get('GV_youtube_client_id'), 'clientId' => $app['phraseanet.registry']->get('GV_youtube_client_id'),
'clientSecret' => $registry->get('GV_youtube_client_secret'), 'clientSecret' => $app['phraseanet.registry']->get('GV_youtube_client_secret'),
'devKey' => $registry->get('GV_youtube_dev_key'), 'devKey' => $app['phraseanet.registry']->get('GV_youtube_dev_key'),
), ),
'flickr' => array( 'flickr' => array(
'active' => $registry->get('GV_flickr_api'), 'active' => $app['phraseanet.registry']->get('GV_flickr_api'),
'clientId' => $registry->get('GV_flickr_client_id'), 'clientId' => $app['phraseanet.registry']->get('GV_flickr_client_id'),
'clientSecret' => $registry->get('GV_flickr_client_secret'), 'clientSecret' => $app['phraseanet.registry']->get('GV_flickr_client_secret'),
), ),
'dailymtotion' => array( 'dailymtotion' => array(
'active' => $registry->get('GV_dailymotion_api'), 'active' => $app['phraseanet.registry']->get('GV_dailymotion_api'),
'clientId' => $registry->get('GV_dailymotion_client_id'), 'clientId' => $app['phraseanet.registry']->get('GV_dailymotion_client_id'),
'clientSecret' => $registry->get('GV_dailymotion_client_secret'), 'clientSecret' => $app['phraseanet.registry']->get('GV_dailymotion_client_secret'),
) )
), ),
'navigator' => array( 'navigator' => array(
'active' => $registry->get('GV_client_navigator'), 'active' => $app['phraseanet.registry']->get('GV_client_navigator'),
), ),
'homepage' => array( 'homepage' => array(
'viewType' => $registry->get('GV_home_publi'), 'viewType' => $app['phraseanet.registry']->get('GV_home_publi'),
), ),
'report' => array( 'report' => array(
'anonymous' => $registry->get('GV_anonymousReport'), 'anonymous' => $app['phraseanet.registry']->get('GV_anonymousReport'),
), ),
'events' => array( 'events' => array(
'events' => $registry->get('GV_events'), 'events' => $app['phraseanet.registry']->get('GV_events'),
'notifications' => $registry->get('GV_notifications'), 'notifications' => $app['phraseanet.registry']->get('GV_notifications'),
), ),
'upload' => array( 'upload' => array(
'allowedFileExtension' => $registry->get('GV_appletAllowedFileEx'), 'allowedFileExtension' => $app['phraseanet.registry']->get('GV_appletAllowedFileEx'),
), ),
'filesystem' => array( 'filesystem' => array(
'noWeb' => $registry->get('GV_base_datapath_noweb'), 'noWeb' => $app['phraseanet.registry']->get('GV_base_datapath_noweb'),
), ),
'searchEngine' => array( 'searchEngine' => array(
'configuration' => array( 'configuration' => array(
'defaultQuery' => $registry->get('GV_defaultQuery'), 'defaultQuery' => $app['phraseanet.registry']->get('GV_defaultQuery'),
'defaultQueryType' => $registry->get('GV_defaultQuery_type'), 'defaultQueryType' => $app['phraseanet.registry']->get('GV_defaultQuery_type'),
), ),
'sphinx' => array( 'sphinx' => array(
'active' => $registry->get('GV_sphinx'), 'active' => $app['phraseanet.registry']->get('GV_sphinx'),
'host' => $registry->get('GV_sphinx_host'), 'host' => $app['phraseanet.registry']->get('GV_sphinx_host'),
'port' => $registry->get('GV_sphinx_port'), 'port' => $app['phraseanet.registry']->get('GV_sphinx_port'),
'realtimeHost' => $registry->get('GV_sphinx_rt_host'), 'realtimeHost' => $app['phraseanet.registry']->get('GV_sphinx_rt_host'),
'realtimePort' => $registry->get('GV_sphinx_rt_port'), 'realtimePort' => $app['phraseanet.registry']->get('GV_sphinx_rt_port'),
), ),
'phrasea' => array( 'phrasea' => array(
'minChar' => $registry->get('GV_min_letters_truncation'), 'minChar' => $app['phraseanet.registry']->get('GV_min_letters_truncation'),
'sort' => $registry->get('GV_phrasea_sort'), 'sort' => $app['phraseanet.registry']->get('GV_phrasea_sort'),
), ),
), ),
'binary' => array( 'binary' => array(
'phpCli' => $registry->get('GV_cli'), 'phpCli' => $app['phraseanet.registry']->get('GV_cli'),
'phpIni' => $registry->get('GV_PHP_INI'), 'phpIni' => $app['phraseanet.registry']->get('GV_PHP_INI'),
'imagick' => $registry->get('GV_imagick'), 'imagick' => $app['phraseanet.registry']->get('GV_imagick'),
'swfExtract' => $registry->get('GV_swf_extract'), 'swfExtract' => $app['phraseanet.registry']->get('GV_swf_extract'),
'pdf2swf' => $registry->get('GV_pdf2swf'), 'pdf2swf' => $app['phraseanet.registry']->get('GV_pdf2swf'),
'swfRender' => $registry->get('GV_swf_render'), 'swfRender' => $app['phraseanet.registry']->get('GV_swf_render'),
'unoconv' => $registry->get('GV_unoconv'), 'unoconv' => $app['phraseanet.registry']->get('GV_unoconv'),
'ffmpeg' => $registry->get('GV_ffmpeg'), 'ffmpeg' => $app['phraseanet.registry']->get('GV_ffmpeg'),
'mp4box' => $registry->get('GV_mp4box'), 'mp4box' => $app['phraseanet.registry']->get('GV_mp4box'),
'pdftotext' => $registry->get('GV_pdftotext'), 'pdftotext' => $app['phraseanet.registry']->get('GV_pdftotext'),
'pdfmaxpages' => $registry->get('GV_pdfmaxpages'),), 'pdfmaxpages' => $app['phraseanet.registry']->get('GV_pdfmaxpages'),),
'mainConfiguration' => array( 'mainConfiguration' => array(
'adminMail' => $registry->get('GV_adminMail'), 'adminMail' => $app['phraseanet.registry']->get('GV_adminMail'),
'viewBasAndCollName' => $registry->get('GV_view_bas_and_coll'), 'viewBasAndCollName' => $app['phraseanet.registry']->get('GV_view_bas_and_coll'),
'chooseExportTitle' => $registry->get('GV_choose_export_title'), 'chooseExportTitle' => $app['phraseanet.registry']->get('GV_choose_export_title'),
'defaultExportTitle' => $registry->get('GV_default_export_title'), 'defaultExportTitle' => $app['phraseanet.registry']->get('GV_default_export_title'),
'socialTools' => $registry->get('GV_social_tools'),), 'socialTools' => $app['phraseanet.registry']->get('GV_social_tools'),),
'modules' => array( 'modules' => array(
'thesaurus' => $registry->get('GV_thesaurus'), 'thesaurus' => $app['phraseanet.registry']->get('GV_thesaurus'),
'storyMode' => $registry->get('GV_multiAndReport'), 'storyMode' => $app['phraseanet.registry']->get('GV_multiAndReport'),
'docSubsitution' => $registry->get('GV_seeOngChgDoc'), 'docSubsitution' => $app['phraseanet.registry']->get('GV_seeOngChgDoc'),
'subdefSubstitution' => $registry->get('GV_seeNewThumb'),), 'subdefSubstitution' => $app['phraseanet.registry']->get('GV_seeNewThumb'),),
'email' => array( 'email' => array(
'defaultMailAddress' => $registry->get('GV_defaulmailsenderaddr'), 'defaultMailAddress' => $app['phraseanet.registry']->get('GV_defaulmailsenderaddr'),
'smtp' => array( 'smtp' => array(
'active' => $registry->get('GV_smtp'), 'active' => $app['phraseanet.registry']->get('GV_smtp'),
'auth' => $registry->get('GV_smtp_auth'), 'auth' => $app['phraseanet.registry']->get('GV_smtp_auth'),
'host' => $registry->get('GV_smtp_host'), 'host' => $app['phraseanet.registry']->get('GV_smtp_host'),
'port' => $registry->get('GV_smtp_port'), 'port' => $app['phraseanet.registry']->get('GV_smtp_port'),
'secure' => $registry->get('GV_smtp_secure'), 'secure' => $app['phraseanet.registry']->get('GV_smtp_secure'),
'user' => $registry->get('GV_smtp_user'), 'user' => $app['phraseanet.registry']->get('GV_smtp_user'),
'password' => $registry->get('GV_smtp_password'), 'password' => $app['phraseanet.registry']->get('GV_smtp_password'),
), ),
), ),
'ftp' => array( 'ftp' => array(
'active' => $registry->get('GV_activeFTP'), 'active' => $app['phraseanet.registry']->get('GV_activeFTP'),
'activeForUser' => $registry->get('GV_ftp_for_user'),), 'activeForUser' => $app['phraseanet.registry']->get('GV_ftp_for_user'),),
'client' => array( 'client' => array(
'maxSizeDownload' => $registry->get('GV_download_max'), 'maxSizeDownload' => $app['phraseanet.registry']->get('GV_download_max'),
'tabSearchMode' => $registry->get('GV_ong_search'), 'tabSearchMode' => $app['phraseanet.registry']->get('GV_ong_search'),
'tabAdvSearchPosition' => $registry->get('GV_ong_advsearch'), 'tabAdvSearchPosition' => $app['phraseanet.registry']->get('GV_ong_advsearch'),
'tabTopicsPosition' => $registry->get('GV_ong_topics'), 'tabTopicsPosition' => $app['phraseanet.registry']->get('GV_ong_topics'),
'tabOngActifPosition' => $registry->get('GV_ong_actif'), 'tabOngActifPosition' => $app['phraseanet.registry']->get('GV_ong_actif'),
'renderTopicsMode' => $registry->get('GV_client_render_topics'), 'renderTopicsMode' => $app['phraseanet.registry']->get('GV_client_render_topics'),
'displayRolloverPreview' => $registry->get('GV_rollover_reg_preview'), 'displayRolloverPreview' => $app['phraseanet.registry']->get('GV_rollover_reg_preview'),
'displayRolloverBasket' => $registry->get('GV_rollover_chu'), 'displayRolloverBasket' => $app['phraseanet.registry']->get('GV_rollover_chu'),
'collRenderMode' => $registry->get('GV_client_coll_ckbox'), 'collRenderMode' => $app['phraseanet.registry']->get('GV_client_coll_ckbox'),
'viewSizeBaket' => $registry->get('GV_viewSizeBaket'), 'viewSizeBaket' => $app['phraseanet.registry']->get('GV_viewSizeBaket'),
'clientAutoShowProposals' => $registry->get('GV_clientAutoShowProposals'), 'clientAutoShowProposals' => $app['phraseanet.registry']->get('GV_clientAutoShowProposals'),
'needAuth2DL' => $registry->get('GV_needAuth2DL'),), 'needAuth2DL' => $app['phraseanet.registry']->get('GV_needAuth2DL'),),
'inscription' => array( 'inscription' => array(
'autoSelectDB' => $registry->get('GV_autoselectDB'), 'autoSelectDB' => $app['phraseanet.registry']->get('GV_autoselectDB'),
'autoRegister' => $registry->get('GV_autoregister'), 'autoRegister' => $app['phraseanet.registry']->get('GV_autoregister'),
), ),
'push' => array( 'push' => array(
'validationReminder' => $registry->get('GV_validation_reminder'), 'validationReminder' => $app['phraseanet.registry']->get('GV_validation_reminder'),
'expirationValue' => $registry->get('GV_val_expiration'), 'expirationValue' => $app['phraseanet.registry']->get('GV_val_expiration'),
), ),
) )
); );

View File

@@ -504,12 +504,6 @@ class Bridge_Api
return new $classname($registry, $auth); return new $classname($registry, $auth);
} }
/**
*
* @param appbox $appbox
* @param string $name
* @return Bridge_Api
*/
public static function get_by_api_name(Application $app, $name) public static function get_by_api_name(Application $app, $name)
{ {
$name = strtolower($name); $name = strtolower($name);
@@ -552,12 +546,6 @@ class Bridge_Api
return $results; return $results;
} }
/**
*
* @param appbox $appbox
* @param string $name
* @return Bridge_Api
*/
public static function create(Application $app, $name) public static function create(Application $app, $name)
{ {
$sql = 'INSERT INTO bridge_apis $sql = 'INSERT INTO bridge_apis

View File

@@ -109,13 +109,6 @@ class Bridge_Element
const STATUS_PENDING = 'pending'; const STATUS_PENDING = 'pending';
const STATUS_ERROR = 'error'; 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) public function __construct(Application $app, Bridge_Account $account, $id)
{ {
$this->app = $app; $this->app = $app;
@@ -446,13 +439,6 @@ class Bridge_Element
return; 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) 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 $sql = 'SELECT id FROM bridge_elements WHERE account_id = :account_id
@@ -473,17 +459,6 @@ class Bridge_Element
return $results; 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()) public static function create(Application $app, Bridge_Account $account, record_adapter $record, $title, $status, $type, Array $datas = array())
{ {
$sql = 'INSERT INTO bridge_elements $sql = 'INSERT INTO bridge_elements

View File

@@ -59,12 +59,6 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
const CACHE_USER_TOKEN = 'usr_token'; const CACHE_USER_TOKEN = 'usr_token';
const MAX_ENTRIES = 20; const MAX_ENTRIES = 20;
/**
*
* @param appbox $appbox
* @param int $id
* @return Feed_Adapter
*/
public function __construct(Application $app, $id) public function __construct(Application $app, $id)
{ {
$this->app = $app; $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'); throw new \Alchemy\Phrasea\Exception\InvalidArgumentException('File does not exists');
} }
$registry = $this->app['phraseanet.registry']; $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';
$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';
copy($file, $config_file); copy($file, $config_file);
copy($file, $www_file); copy($file, $www_file);
@@ -192,10 +184,9 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
public function reset_icon() public function reset_icon()
{ {
$registry = $this->app['phraseanet.registry']; $config_file = $this->app['phraseanet.registry']->get('GV_RootPath')
$config_file = $registry->get('GV_RootPath')
. 'config/feed_' . $this->get_id() . '.jpg'; . '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'; . 'www/custom/feed_' . $this->get_id() . '.jpg';
if (is_file($config_file)) if (is_file($config_file))
@@ -440,14 +431,6 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
return $this; 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) public static function create(Application $app, User_Adapter $user, $title, $subtitle)
{ {
$sql = 'INSERT INTO feeds (id, title, subtitle, created_on, updated_on) $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; 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) public static function load_with_user(Application $app, User_Adapter $user, $id)
{ {
$feed = new self($app, $id); $feed = new self($app, $id);

View File

@@ -25,12 +25,6 @@ class Feed_Aggregate extends Feed_Abstract implements Feed_Interface
*/ */
protected $feeds; protected $feeds;
/**
*
* @param appbox $appbox
* @param array $feeds
* @return Feed_Aggregate
*/
public function __construct(Application $app, Array $feeds) public function __construct(Application $app, Array $feeds)
{ {
$this->title = 'AGGREGGATE'; $this->title = 'AGGREGGATE';

View File

@@ -170,11 +170,9 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
public function get_link() public function get_link()
{ {
$registry = $this->app['phraseanet.registry'];
$href = sprintf( $href = sprintf(
'%slightbox/feeds/entry/%d/' '%slightbox/feeds/entry/%d/'
, $registry->get('GV_ServerName') , $this->app['phraseanet.registry']->get('GV_ServerName')
, $this->get_id() , $this->get_id()
); );
@@ -496,17 +494,6 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
return; 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 public static function create(Application $app, Feed_Adapter $feed
, Feed_Publisher_Adapter $publisher, $title, $subtitle, $author_name, $author_mail) , Feed_Publisher_Adapter $publisher, $title, $subtitle, $author_name, $author_mail)
{ {

View File

@@ -249,7 +249,6 @@ 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.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"';
@@ -271,7 +270,7 @@ class Session_Authentication_Native implements Session_Authentication_Interface
$stmt->execute(array(':login' => $this->login, ':ip' => $ip)); $stmt->execute(array(':login' => $this->login, ':ip' => $ip));
$stmt->closeCursor(); $stmt->closeCursor();
} elseif ($row_count > 9) { } 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'); 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) protected function is_captcha_activated(registryInterface $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')) !== ''
&& trim($registry->get('GV_captcha_public_key') !== '')); && trim($registry->get('GV_captcha_public_key') !== ''));

View File

@@ -37,12 +37,6 @@ class Session_Authentication_PersistentCookie implements Session_Authentication_
*/ */
protected $ses_id; protected $ses_id;
/**
*
* @param Application $appbox
* @param type $persistent_cookie
* @return Session_Authentication_PersistentCookie
*/
public function __construct(Application $app, $persistent_cookie) public function __construct(Application $app, $persistent_cookie)
{ {
$this->app= $app; $this->app= $app;

View File

@@ -32,12 +32,6 @@ class Session_Authentication_Token implements Session_Authentication_Interface
protected $token; protected $token;
protected $user; protected $user;
/**
*
* @param appbox $appbox
* @param type $token
* @return Session_Authentication_Token
*/
public function __construct(Application $app, $token) public function __construct(Application $app, $token)
{ {
$this->app = $app; $this->app = $app;

View File

@@ -100,7 +100,6 @@ class Session_Logger
public static function create(Application $app, databox $databox, Browser $browser) public static function create(Application $app, databox $databox, Browser $browser)
{ {
$colls = array(); $colls = array();
$registry = $app['phraseanet.registry'];
if ($app['phraseanet.user']) { if ($app['phraseanet.user']) {
$bases = $app['phraseanet.user']->ACL()->get_granted_base(array(), array($databox->get_sbas_id())); $bases = $app['phraseanet.user']->ACL()->get_granted_base(array(), array($databox->get_sbas_id()));

View File

@@ -52,11 +52,6 @@ class Setup_Upgrade
*/ */
protected $completed_steps = 0; protected $completed_steps = 0;
/**
*
* @param appbox $appbox
* @return Setup_Upgrade
*/
public function __construct(Application $app, $force = false) public function __construct(Application $app, $force = false)
{ {
if ($force) { if ($force) {

View File

@@ -434,8 +434,6 @@ 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.registry'];
$token = $title = false; $token = $title = false;
if (!$renew) { if (!$renew) {
@@ -455,7 +453,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
$token = random::getUrlToken($this->app, \random::TYPE_RSS, $this->id); $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; return $this;
} }
$registry = $this->app['phraseanet.registry'];
$sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id'; $sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':id' => $this->id)); $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) { foreach (self::$def_values as $k => $v) {
if (!isset($this->_prefs[$k])) { if (!isset($this->_prefs[$k])) {
if ($k == 'start_page_query' && $registry->get('GV_defaultQuery')) { if ($k == 'start_page_query' && $this->app['phraseanet.registry']->get('GV_defaultQuery')) {
$v = $registry->get('GV_defaultQuery'); $v = $this->app['phraseanet.registry']->get('GV_defaultQuery');
} }
$this->_prefs[$k] = $v; $this->_prefs[$k] = $v;
@@ -1464,7 +1460,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public static function updateClientInfos(Application $app, $app_id) public static function updateClientInfos(Application $app, $app_id)
{ {
$appbox = $app['phraseanet.appbox'];
if (!$app->isAuthenticated()) { if (!$app->isAuthenticated()) {
return; return;
} }
@@ -1501,7 +1496,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
foreach ($sbas_ids as $sbas_id) { foreach ($sbas_ids as $sbas_id) {
try { 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); $connbas = connection::getPDOConnection($app, $sbas_id);
$sql = 'SELECT appli FROM log WHERE id = :log_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) public static function set_sys_admins(Application $app, $admins)
{ {
try { try {
$appbox = $app['phraseanet.appbox'];
$sql = "UPDATE usr SET create_db='0' WHERE create_db='1' AND usr_id != :usr_id"; $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->execute(array(':usr_id' => $app['phraseanet.user']->get_id()));
$stmt->closeCursor(); $stmt->closeCursor();
$sql = "UPDATE usr SET create_db='1' WHERE usr_id IN (" . implode(',', $admins) . ")"; $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->execute();
$stmt->closeCursor(); $stmt->closeCursor();
@@ -1581,9 +1574,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
{ {
$users = self::get_sys_admins($app); $users = self::get_sys_admins($app);
$appbox = $app['phraseanet.appbox']; foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
foreach ($appbox->get_databoxes() as $databox) {
foreach (array_keys($users) as $usr_id) { foreach (array_keys($users) as $usr_id) {
$user = User_Adapter::getInstance($usr_id, $app); $user = User_Adapter::getInstance($usr_id, $app);
$user->ACL()->give_access_to_sbas(array($databox->get_sbas_id())); $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() public function get_locale()
{ {
$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);
$stmt->execute(array(':usr_id' => $this->get_id())); $stmt->execute(array(':usr_id' => $this->get_id()));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $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; return $locale;
} }
@@ -1690,9 +1679,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public static function salt_password(Application $app, $password, $nonce) public static function salt_password(Application $app, $password, $nonce)
{ {
$registry = $app['phraseanet.registry']; return hash_hmac('sha512', $password . $nonce, $app['phraseanet.registry']->get('GV_sit'));
return hash_hmac('sha512', $password . $nonce, $registry->get('GV_sit'));
} }
protected $nonce; protected $nonce;

View File

@@ -9,11 +9,8 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Version; use Alchemy\Phrasea\Core\Version;
use Alchemy\Phrasea\Cache\Manager as CacheManager;
use Doctrine\ORM\EntityManager;
use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Alchemyst;
use MediaAlchemyst\Specification\Image as ImageSpecification; use MediaAlchemyst\Specification\Image as ImageSpecification;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
@@ -145,10 +142,8 @@ class appbox extends base
$collection->update_logo($pathfile); $collection->update_logo($pathfile);
} }
$registry = $this->app['phraseanet.registry']; $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();
$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();
foreach (array($file, $custom_path) as $target) { foreach (array($file, $custom_path) as $target) {
@@ -205,9 +200,8 @@ class appbox extends base
} }
} }
$registry = $this->app['phraseanet.registry']; $file = $this->app['phraseanet.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 = $this->app['phraseanet.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';
foreach (array($file, $custom_path) as $target) { foreach (array($file, $custom_path) as $target) {
@@ -323,8 +317,6 @@ class appbox extends base
$upgrader->add_steps(7 + count($this->get_databoxes())); $upgrader->add_steps(7 + count($this->get_databoxes()));
$registry = $this->app['phraseanet.registry'];
/** /**
* Step 1 * Step 1
*/ */
@@ -352,8 +344,8 @@ class appbox extends base
$finder = new Symfony\Component\Finder\Finder(); $finder = new Symfony\Component\Finder\Finder();
$finder->in(array( $finder->in(array(
$registry->get('GV_RootPath') . 'tmp/cache_minify/', $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/cache_minify/',
$registry->get('GV_RootPath') . 'tmp/cache_minify/', $this->app['phraseanet.registry']->get('GV_RootPath') . 'tmp/cache_minify/',
))->ignoreVCS(true)->ignoreDotFiles(true); ))->ignoreVCS(true)->ignoreDotFiles(true);
foreach ($finder as $file) { foreach ($finder as $file) {
@@ -374,7 +366,7 @@ class appbox extends base
'config/status/' => 'www/custom/status/', 'config/status/' => 'www/custom/status/',
'config/wm/' => 'www/custom/wm/', 'config/wm/' => 'www/custom/wm/',
) as $source => $target) { ) 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); $upgrader->add_steps_complete(1);

View File

@@ -538,8 +538,6 @@ abstract class base implements cache_cacheableInterface
$correct_table = array('fields' => array(), 'indexes' => array(), 'collation' => array()); $correct_table = array('fields' => array(), 'indexes' => array(), 'collation' => array());
$alter = $alter_pre = $return = array(); $alter = $alter_pre = $return = array();
$registry = $this->app['phraseanet.registry'];
foreach ($table->fields->field as $field) { foreach ($table->fields->field as $field) {
$expr = trim((string) $field->type); $expr = trim((string) $field->type);
@@ -770,11 +768,9 @@ abstract class base implements cache_cacheableInterface
$list_patches = array(); $list_patches = array();
$registry = $this->app['phraseanet.registry'];
$upgrader->add_steps(1)->set_current_message(_('Looking for patches')); $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) { foreach ($iterator as $fileinfo) {
if ( ! $fileinfo->isDot()) { if ( ! $fileinfo->isDot()) {

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
@@ -39,8 +38,6 @@ class cache_databox
$date = new \DateTime('-3 seconds'); $date = new \DateTime('-3 seconds');
$registry = $app['phraseanet.registry'];
$last_update = null; $last_update = null;
try { try {
@@ -64,7 +61,7 @@ class cache_databox
$sql = 'SELECT type, value FROM memcached WHERE site_id = :site_id'; $sql = 'SELECT type, value FROM memcached WHERE site_id = :site_id';
$stmt = $connsbas->prepare($sql); $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); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
@@ -92,7 +89,7 @@ class cache_databox
WHERE site_id = :site_id AND type="record" AND value = :value'; WHERE site_id = :site_id AND type="record" AND value = :value';
$params = array( $params = array(
':site_id' => $registry->get('GV_ServerName') ':site_id' => $app['phraseanet.registry']->get('GV_ServerName')
, ':value' => $row['value'] , ':value' => $row['value']
); );
@@ -116,7 +113,7 @@ class cache_databox
WHERE site_id = :site_id AND type="structure" AND value = :value'; WHERE site_id = :site_id AND type="structure" AND value = :value';
$params = array( $params = array(
':site_id' => $registry->get('GV_ServerName') ':site_id' => $app['phraseanet.registry']->get('GV_ServerName')
, ':value' => $row['value'] , ':value' => $row['value']
); );
@@ -156,14 +153,13 @@ class cache_databox
$connbas = \connection::getPDOConnection($app, $sbas_id); $connbas = \connection::getPDOConnection($app, $sbas_id);
$registry = $app['phraseanet.registry'];
$sql = 'SELECT distinct site_id as site_id $sql = 'SELECT distinct site_id as site_id
FROM clients FROM clients
WHERE site_id != :site_id'; WHERE site_id != :site_id';
$stmt = $connbas->prepare($sql); $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); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
@@ -185,11 +181,10 @@ class cache_databox
{ {
$connbas = $databox->get_connection(); $connbas = $databox->get_connection();
$registry = $app['phraseanet.registry'];
$sql = 'SELECT site_id FROM clients WHERE site_id = :site_id'; $sql = 'SELECT site_id FROM clients WHERE site_id = :site_id';
$stmt = $connbas->prepare($sql); $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(); $rowCount = $stmt->rowCount();
$stmt->closeCursor(); $stmt->closeCursor();
@@ -199,7 +194,7 @@ class cache_databox
$sql = 'INSERT INTO clients (site_id) VALUES (:site_id)'; $sql = 'INSERT INTO clients (site_id) VALUES (:site_id)';
$stmt = $connbas->prepare($sql); $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(); $stmt->closeCursor();
return; return;

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Vocabulary; use Alchemy\Phrasea\Vocabulary;
/** /**
@@ -195,8 +194,7 @@ class caption_Field_Value implements cache_cacheableInterface
$this->record->get_caption()->delete_data_from_cache(); $this->record->get_caption()->delete_data_from_cache();
try { try {
$registry = $this->app['phraseanet.registry']; $sphinx_rt = sphinxrt::get_instance($this->app['phraseanet.registry']);
$sphinx_rt = sphinxrt::get_instance($registry);
$sbas_params = phrasea::sbas_params($this->app); $sbas_params = phrasea::sbas_params($this->app);
@@ -279,8 +277,7 @@ class caption_Field_Value implements cache_cacheableInterface
$this->delete_data_from_cache(); $this->delete_data_from_cache();
try { try {
$registry = $this->app['phraseanet.registry']; $sphinx_rt = sphinxrt::get_instance($this->app['phraseanet.registry']);
$sphinx_rt = sphinxrt::get_instance($registry);
$sbas_params = phrasea::sbas_params($this->app); $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(); $this->record->get_caption()->delete_data_from_cache();
$sbas_id = $this->databox_field->get_databox()->get_sbas_id(); $sbas_id = $this->databox_field->get_databox()->get_sbas_id();
try { try {
$registry = $this->app['phraseanet.registry'];
$sbas_params = phrasea::sbas_params($this->app); $sbas_params = phrasea::sbas_params($this->app);
if (isset($sbas_params[$sbas_id])) { 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( $sphinx_rt->replace_in_metas(
"metas_realtime" . $sbas_crc "metas_realtime" . $sbas_crc
, $this->id , $this->id

View File

@@ -446,7 +446,6 @@ class collection implements cache_cacheableInterface
public function unmount_collection(Application $app) public function unmount_collection(Application $app)
{ {
$appbox = $app['phraseanet.appbox'];
$params = array(':base_id' => $this->get_base_id()); $params = array(':base_id' => $this->get_base_id());
$query = new User_Query($app); $query = new User_Query($app);
@@ -466,26 +465,26 @@ class collection implements cache_cacheableInterface
} }
$sql = "DELETE FROM basusr WHERE base_id = :base_id"; $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->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
$sql = "DELETE FROM sselcont WHERE base_id = :base_id"; $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->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
$sql = "DELETE FROM bas WHERE base_id = :base_id"; $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->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
$sql = "DELETE FROM demand WHERE base_id = :base_id"; $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->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
phrasea::reset_baseDatas($appbox); phrasea::reset_baseDatas($app['phraseanet.appbox']);
return $this; return $this;
} }
@@ -601,11 +600,10 @@ class collection implements cache_cacheableInterface
if ( ! isset(self::$_logos[$base_id_key])) { if ( ! isset(self::$_logos[$base_id_key])) {
$registry = $app['phraseanet.registry']; if (is_file($app['phraseanet.registry']->get('GV_RootPath') . 'config/minilogos/' . $base_id)) {
if (is_file($registry->get('GV_RootPath') . 'config/minilogos/' . $base_id)) {
$name = phrasea::bas_names($base_id, $app); $name = phrasea::bas_names($base_id, $app);
self::$_logos[$base_id_key] = '<img title="' . $name self::$_logos[$base_id_key] = '<img title="' . $name
. '" src="' . $registry->get('GV_STATIC_URL') . '" src="' . $app['phraseanet.registry']->get('GV_STATIC_URL')
. '/custom/minilogos/' . $base_id . '" />'; . '/custom/minilogos/' . $base_id . '" />';
} elseif ($printname) { } elseif ($printname) {
self::$_logos[$base_id_key] = phrasea::bas_names($base_id, $app); self::$_logos[$base_id_key] = phrasea::bas_names($base_id, $app);

View File

@@ -10,8 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Version;
use Alchemy\Phrasea\Core\Configuration;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
class databox extends base class databox extends base

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
@@ -51,13 +50,12 @@ class databox_cgu
private static function getUnvalidated(Application $app, $home = false) private static function getUnvalidated(Application $app, $home = false)
{ {
$terms = array(); $terms = array();
$appbox = $app['phraseanet.appbox'];
if ( ! $home) { if ( ! $home) {
$user = $app['phraseanet.user']; $user = $app['phraseanet.user'];
} }
foreach ($appbox->get_databoxes() as $databox) { foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
try { try {
$cgus = $databox->get_cgus(); $cgus = $databox->get_cgus();

View File

@@ -66,13 +66,12 @@ class databox_status
$path = $url = false; $path = $url = false;
$sbas_params = phrasea::sbas_params($app); $sbas_params = phrasea::sbas_params($app);
$registry = $app['phraseanet.registry'];
if ( ! isset($sbas_params[$sbas_id])) { if ( ! isset($sbas_params[$sbas_id])) {
return; 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"]); $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); $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) 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; $switch = in_array($switch, array('on', 'off')) ? $switch : false;
if ( ! $switch) { if ( ! $switch) {
@@ -406,13 +403,12 @@ class databox_status
$name = "-stat_" . $bit . "_" . ($switch == 'on' ? '1' : '0') . ".gif"; $name = "-stat_" . $bit . "_" . ($switch == 'on' ? '1' : '0') . ".gif";
try { 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) { } catch (FileException $e) {
throw new Exception_Upload_CannotWriteFile(); throw new Exception_Upload_CannotWriteFile();
} }
$custom_path = $app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/status/';
$custom_path = $registry->get('GV_RootPath') . 'www/custom/status/';
$app['filesystem']->mkdir($custom_path, 0750); $app['filesystem']->mkdir($custom_path, 0750);

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; 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) function whatCanIDelete(Application $app, $lst)
{ {
$appbox = $app['phraseanet.appbox'];
$usr_id = $app['phraseanet.user']->get_id(); $usr_id = $app['phraseanet.user']->get_id();
$conn = $appbox->get_connection(); $conn = $app['phraseanet.appbox']->get_connection();
$nbdocsel = 0; $nbdocsel = 0;
$nbgrp = 0; $nbgrp = 0;

View File

@@ -1,7 +1,6 @@
<?php <?php
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
class eventsmanager_broker class eventsmanager_broker
{ {

View File

@@ -1,7 +1,5 @@
<?php <?php
use Alchemy\Phrasea\Core\Configuration;
abstract class eventsmanager_notifyAbstract extends eventsmanager_eventAbstract abstract class eventsmanager_notifyAbstract extends eventsmanager_eventAbstract
{ {
protected $events = array('__EVENT__'); protected $events = array('__EVENT__');

View File

@@ -22,8 +22,7 @@ class geonames
public function name_from_id($geonameid) public function name_from_id($geonameid)
{ {
$registry = $this->app['phraseanet.registry']; $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'get_name.php?geonameid=' . 'get_name.php?geonameid='
. $geonameid; . $geonameid;
@@ -48,8 +47,7 @@ class geonames
return ''; return '';
} }
$registry = $this->app['phraseanet.registry']; $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'get_name.php?geonameid=' . 'get_name.php?geonameid='
. $geonameid; . $geonameid;
@@ -68,8 +66,7 @@ class geonames
public function get_country_code($geonameid) public function get_country_code($geonameid)
{ {
$registry = $this->app['phraseanet.registry']; $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'get_name.php?geonameid=' . 'get_name.php?geonameid='
. $geonameid; . $geonameid;
@@ -107,8 +104,7 @@ class geonames
return $output; return $output;
} }
$registry = $this->app['phraseanet.registry']; $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'find_city.php?city=' . 'find_city.php?city='
. urlencode($cityName) . '&maxResult=30'; . urlencode($cityName) . '&maxResult=30';
@@ -154,8 +150,7 @@ class geonames
'latitude' => '' 'latitude' => ''
); );
$registry = $this->app['phraseanet.registry']; $url = $this->app['phraseanet.registry']->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'geoip.php?ip=' . 'geoip.php?ip='
. urlencode($ip); . urlencode($ip);

View File

@@ -1,7 +1,6 @@
<?php <?php
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
class liste class liste
{ {

View File

@@ -7,12 +7,11 @@ class mail
public static function mail_test(Application $app, $email) public static function mail_test(Application $app, $email)
{ {
$registry = $app['phraseanet.registry']; $from = array('email' => $app['phraseanet.registry']->get('GV_defaulmailsenderaddr'), 'name' => $app['phraseanet.registry']->get('GV_defaulmailsenderaddr'));
$from = array('email' => $registry->get('GV_defaulmailsenderaddr'), 'name' => $registry->get('GV_defaulmailsenderaddr'));
$subject = _('mail:: test d\'envoi d\'email'); $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); $to = array('email' => $email, 'name' => $email);
@@ -72,8 +71,7 @@ class mail
public static function register_confirm(Application $app, $email, $accept, $deny) public static function register_confirm(Application $app, $email, $accept, $deny)
{ {
$registry = $app['phraseanet.registry']; $subject = sprintf(_('login::register:email: Votre compte %s'), $app['phraseanet.registry']->get('GV_homeTitle'));
$subject = sprintf(_('login::register:email: Votre compte %s'), $registry->get('GV_homeTitle'));
$body = '<div>' . _('login::register:email: Voici un compte rendu du traitement de vos demandes d\'acces :') . "</div>\n"; $body = '<div>' . _('login::register:email: Voici un compte rendu du traitement de vos demandes d\'acces :') . "</div>\n";
@@ -91,11 +89,10 @@ class mail
public static function reset_email(Application $app, $email, $usr_id) public static function reset_email(Application $app, $email, $usr_id)
{ {
$registry = $app['phraseanet.registry'];
$date = new DateTime('1 day'); $date = new DateTime('1 day');
$token = random::getUrlToken($app, \random::TYPE_EMAIL, $usr_id, $date, $email); $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'); $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) 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'), $app['phraseanet.registry']->get('GV_homeTitle'));
$subject = sprintf(_('Update of your email address on %s'), $registry->get('GV_homeTitle'));
$body = "<div>" . sprintf(_('Dear %s,'), $display_name) . "</div>\n<br/>\n"; $body = "<div>" . sprintf(_('Dear %s,'), $display_name) . "</div>\n<br/>\n";
$body .= "<div>" . _('Your contact email address has been updated') . "</div>\n<br/>\n"; $body .= "<div>" . _('Your contact email address has been updated') . "</div>\n<br/>\n";
@@ -134,9 +130,7 @@ class mail
public static function send_credentials(Application $app, $url, $login, $email) public static function send_credentials(Application $app, $url, $login, $email)
{ {
$registry = $app['phraseanet.registry']; $subject = sprintf(_('Your account on %s'), $app['phraseanet.registry']->get('GV_homeTitle'));
$subject = sprintf(_('Your account on %s'), $registry->get('GV_homeTitle'));
$body = "<div>" . sprintf(_('Your account with the login %s as been created'), $login) . "</div><br/>\n\n"; $body = "<div>" . sprintf(_('Your account with the login %s as been created'), $login) . "</div><br/>\n\n";
$body .= "<div>" . _('Please follow this url to setup your password') . "</div>\n"; $body .= "<div>" . _('Please follow this url to setup your password') . "</div>\n";
@@ -149,13 +143,11 @@ class mail
public static function mail_confirm_registered(Application $app, $email) public static function mail_confirm_registered(Application $app, $email)
{ {
$registry = $app['phraseanet.registry'];
$subject = _('login::register: sujet email : confirmation de votre adresse email'); $subject = _('login::register: sujet email : confirmation de votre adresse email');
$body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n"; $body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n";
$body .= "<br/><div>" . _('login::register: vous pouvez maintenant vous connecter a l\'adresse suivante : ') . "</div>\n"; $body .= "<br/><div>" . _('login::register: vous pouvez maintenant vous connecter a l\'adresse suivante : ') . "</div>\n";
$body .= "<div><a href='" . $registry->get('GV_ServerName') . "' target='_blank'>" . $registry->get('GV_ServerName') . "</a></div>\n"; $body .= "<div><a href='" . $app['phraseanet.registry']->get('GV_ServerName') . "' target='_blank'>" . $app['phraseanet.registry']->get('GV_ServerName') . "</a></div>\n";
$to = array('email' => $email, 'name' => $email); $to = array('email' => $email, 'name' => $email);
@@ -183,14 +175,13 @@ class mail
public static function mail_confirmation(Application $app, $email, $usr_id) public static function mail_confirmation(Application $app, $email, $usr_id)
{ {
$registry = $app['phraseanet.registry'];
$expire = new DateTime('+3 days'); $expire = new DateTime('+3 days');
$token = random::getUrlToken($app, \random::TYPE_PASSWORD, $usr_id, $expire, $email); $token = random::getUrlToken($app, \random::TYPE_PASSWORD, $usr_id, $expire, $email);
$subject = _('login::register: sujet email : confirmation de votre adresse email'); $subject = _('login::register: sujet email : confirmation de votre adresse email');
$body = "<div>" . _('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.') . "</div>\n"; $body = "<div>" . _('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.') . "</div>\n";
$body .= "<br/>\n<div><a href='" . $registry->get('GV_ServerName') . "register-confirm/?code=" . $token . "' target='_blank'>" . $registry->get('GV_ServerName') . "register-confirm/code=" . $token . "</a></div>\n"; $body .= "<br/>\n<div><a href='" . $app['phraseanet.registry']->get('GV_ServerName') . "register-confirm/?code=" . $token . "' target='_blank'>" . $app['phraseanet.registry']->get('GV_ServerName') . "register-confirm/code=" . $token . "</a></div>\n";
$to = array('email' => $email, 'name' => $email); $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) 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'])) { if ( ! isset($to['email']) || ! PHPMailer::ValidateAddress($to['email'])) {
return false; return false;
} }
@@ -216,7 +205,7 @@ class mail
$body .= '<div style="font-style:italic;">' . _('si cet email contient des liens non cliquables copiez/collez ces liens dans votre navigateur.') . '</div>'; $body .= '<div style="font-style:italic;">' . _('si cet email contient des liens non cliquables copiez/collez ces liens dans votre navigateur.') . '</div>';
$body .= "<br/>\n"; $body .= "<br/>\n";
$body .= '<div style="font-style:italic;">' . _('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante') . "</div>\n"; $body .= '<div style="font-style:italic;">' . _('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante') . "</div>\n";
$body .= '<div><a href="' . $registry->get('GV_ServerName') . '">' . $registry->get('GV_ServerName') . "</a></div>\n"; $body .= '<div><a href="' . $app['phraseanet.registry']->get('GV_ServerName') . '">' . $app['phraseanet.registry']->get('GV_ServerName') . "</a></div>\n";
$body = '<body>' . $body . '</body>'; $body = '<body>' . $body . '</body>';
$body = str_replace('https://', 'http://', $body); $body = str_replace('https://', 'http://', $body);
@@ -225,23 +214,21 @@ class mail
$mail->CharSet = 'utf-8'; $mail->CharSet = 'utf-8';
$mail->Encoding = 'base64'; //'quoted-printable'; $mail->Encoding = 'base64'; //'quoted-printable';
$registry = $app['phraseanet.registry']; if ($app['phraseanet.registry']->get('GV_smtp')) {
if ($registry->get('GV_smtp')) {
$mail->IsSMTP(); $mail->IsSMTP();
if ($registry->get('GV_smtp_host') != '') if ($app['phraseanet.registry']->get('GV_smtp_host') != '')
$mail->Host = $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; $mail->SMTPAuth = true;
if ($registry->get('GV_smtp_secure') === true) { if ($app['phraseanet.registry']->get('GV_smtp_secure') === true) {
$mail->SMTPSecure = "ssl"; $mail->SMTPSecure = "ssl";
} }
$mail->Host = $registry->get('GV_smtp_host'); $mail->Host = $app['phraseanet.registry']->get('GV_smtp_host');
$mail->Port = $registry->get('GV_smtp_port'); $mail->Port = $app['phraseanet.registry']->get('GV_smtp_port');
$mail->Username = $registry->get('GV_smtp_user'); $mail->Username = $app['phraseanet.registry']->get('GV_smtp_user');
$mail->Password = $registry->get('GV_smtp_password'); $mail->Password = $app['phraseanet.registry']->get('GV_smtp_password');
} }
} }
@@ -250,7 +237,7 @@ class mail
$mail->AddAddress($to['email'], $to['name']); $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; $mail->Subject = $subject;

View File

@@ -276,13 +276,11 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
*/ */
protected function find_substitute_file() protected function find_substitute_file()
{ {
$registry = $this->app['phraseanet.registry'];
if ($this->record->is_grouping()) { if ($this->record->is_grouping()) {
$this->mime = 'image/png'; $this->mime = 'image/png';
$this->width = 256; $this->width = 256;
$this->height = 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->file = 'regroup_thumb.png';
$this->url = '/skins/icons/substitution/regroup_thumb.png'; $this->url = '/skins/icons/substitution/regroup_thumb.png';
} else { } else {
@@ -292,7 +290,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->mime = 'image/png'; $this->mime = 'image/png';
$this->width = 256; $this->width = 256;
$this->height = 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->file = str_replace('+', '%20', $mime) . '.png';
$this->url = '/skins/icons/substitution/' . $this->file; $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; $this->is_physically_present = false;
if ( ! file_exists($this->path . $this->file)) { 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->file = 'substitution.png';
$this->url = '/skins/icons/' . $this->file; $this->url = '/skins/icons/' . $this->file;
} }

View File

@@ -22,13 +22,12 @@ class module_client
public function getLanguage(Application $app, $lng) public function getLanguage(Application $app, $lng)
{ {
$registry = $app['phraseanet.registry'];
$out = array(); $out = array();
$out['createWinInvite'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?'); $out['createWinInvite'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?');
$out['chuNameEmpty'] = _('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['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['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['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['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
$out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier'); $out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier');

View File

@@ -49,10 +49,6 @@ class module_console_checkExtension extends Command
return 1; return 1;
} }
$appbox = $this->getService('phraseanet.appbox');
$registry = $this->container['phraseanet.registry'];
$usrId = $input->getArgument('usr_id'); $usrId = $input->getArgument('usr_id');
try { try {
@@ -175,7 +171,7 @@ class module_console_checkExtension extends Command
, $base["sbas_id"] , $base["sbas_id"]
, $base["searchcoll"] , $base["searchcoll"]
, $base["arrayq"] , $base["arrayq"]
, $registry->get('GV_sit') , $this->container['phraseanet.registry']->get('GV_sit')
, $usrId , $usrId
, false , false
, PHRASEA_MULTIDOC_DOCONLY , PHRASEA_MULTIDOC_DOCONLY

View File

@@ -42,9 +42,8 @@ class module_console_fieldsDelete extends Command
protected function doExecute(InputInterface $input, OutputInterface $output) protected function doExecute(InputInterface $input, OutputInterface $output)
{ {
$appbox = $this->getService('phraseanet.appbox');
try { 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) { } catch (\Exception $e) {
$output->writeln("<error>Invalid databox id </error>"); $output->writeln("<error>Invalid databox id </error>");

View File

@@ -38,9 +38,7 @@ class module_console_fieldsList extends Command
protected function doExecute(InputInterface $input, OutputInterface $output) protected function doExecute(InputInterface $input, OutputInterface $output)
{ {
$appbox = $this->getService('phraseanet.appbox'); foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
foreach ($appbox->get_databoxes() as $databox) {
/* @var $databox \databox */ /* @var $databox \databox */
$output->writeln( $output->writeln(
sprintf( sprintf(

View File

@@ -54,10 +54,8 @@ class module_console_fieldsMerge extends Command
{ {
$output->writeln(""); $output->writeln("");
$appbox = $this->getService('phraseanet.appbox');
try { 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) { } catch (\Exception $e) {
$output->writeln("<error>Invalid databox id </error>"); $output->writeln("<error>Invalid databox id </error>");

View File

@@ -45,9 +45,8 @@ class module_console_fieldsRename extends Command
{ {
$new_name = $input->getArgument('name'); $new_name = $input->getArgument('name');
$appbox = $this->getService('phraseanet.appbox');
try { 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) { } catch (\Exception $e) {
$output->writeln("<error>Invalid databox id </error>"); $output->writeln("<error>Invalid databox id </error>");

View File

@@ -41,9 +41,6 @@ class module_console_sphinxGenerateSuggestion extends Command
define('FREQ_THRESHOLD', 10); define('FREQ_THRESHOLD', 10);
define('SUGGEST_DEBUG', 0); define('SUGGEST_DEBUG', 0);
$appbox = $this->getService('phraseanet.appbox');
$registry = $this->container['phraseanet.registry'];
$params = phrasea::sbas_params($this->container); $params = phrasea::sbas_params($this->container);
foreach ($params as $sbas_id => $p) { 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"); $output->writeln("process Databox " . $databox->get_viewname() . " / $index\n");

View File

@@ -47,11 +47,9 @@ class module_console_systemBackupDB extends Command
{ {
$output->write('Phraseanet is going to be backup...', true); $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 ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
foreach ($appbox->get_databoxes() as $databox) {
$ok = $this->dump_base($databox, $input, $output) && $ok; $ok = $this->dump_base($databox, $input, $output) && $ok;
} }

View File

@@ -52,7 +52,7 @@ class module_console_systemConfigCheck extends Command
$registry = $this->container['phraseanet.registry']; $registry = $this->container['phraseanet.registry'];
$output->writeln(_('*** CHECK BINARY CONFIGURATION ***')); $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(""); $output->writeln("");
} else { } else {
$registry = new Setup_Registry(); $registry = new Setup_Registry();

View File

@@ -128,13 +128,11 @@ class module_console_systemExport extends Command
$output->writeln("Export datas from selected base_ids"); $output->writeln("Export datas from selected base_ids");
} }
$appbox = $this->getService('phraseanet.appbox');
$total = $errors = 0; $total = $errors = 0;
$unicode = new \unicode(); $unicode = new \unicode();
foreach ($appbox->get_databoxes() as $databox) { foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
$output->writeln(sprintf("Processing <info>%s</info>", $databox->get_viewname())); $output->writeln(sprintf("Processing <info>%s</info>", $databox->get_viewname()));
if (count($restrictSbasIds) > 0 && ! in_array($databox->get_sbas_id(), $restrictSbasIds)) { if (count($restrictSbasIds) > 0 && ! in_array($databox->get_sbas_id(), $restrictSbasIds)) {

View File

@@ -44,16 +44,14 @@ class module_console_systemMailCheck extends Command
protected function doExecute(InputInterface $input, OutputInterface $output) protected function doExecute(InputInterface $input, OutputInterface $output)
{ {
$appbox = $this->getService('phraseanet.appbox');
$output->writeln("Processing..."); $output->writeln("Processing...");
$bad_users = User_Adapter::get_wrong_email_users($this->container); $bad_users = User_Adapter::get_wrong_email_users($this->container);
foreach ($bad_users as $email => $users) { foreach ($bad_users as $email => $users) {
if ($input->getOption('list')) { if ($input->getOption('list')) {
$this->write_infos($email, $users, $output, $appbox); $this->write_infos($email, $users, $output, $this->getService('phraseanet.appbox'));
} elseif ($this->manage_group($email, $users, $output, $appbox) === false) { } elseif ($this->manage_group($email, $users, $output, $this->getService('phraseanet.appbox')) === false) {
break; break;
} }

View File

@@ -98,15 +98,14 @@ class module_console_systemUpgrade extends Command
if ($continue == 'y') { if ($continue == 'y') {
try { try {
$output->write('<info>Upgrading...</info>', true); $output->write('<info>Upgrading...</info>', true);
$appbox = $this->getService('phraseanet.appbox');
if (count(User_Adapter::get_wrong_email_users($this->container)) > 0) { if (count(User_Adapter::get_wrong_email_users($this->container)) > 0) {
return $output->writeln(sprintf('<error>You have to fix your database before upgrade with the system:mailCheck command </error>')); return $output->writeln(sprintf('<error>You have to fix your database before upgrade with the system:mailCheck command </error>'));
} }
$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) { foreach ($upgrader->getRecommendations() as $recommendation) {
list($message, $command) = $recommendation; list($message, $command) = $recommendation;

View File

@@ -46,7 +46,6 @@ class module_console_tasklist extends Command
} }
try { try {
$appbox = $this->getService('phraseanet.appbox');
$task_manager = new task_manager($this->container); $task_manager = new task_manager($this->container);
$tasks = $task_manager->getTasks(); $tasks = $task_manager->getTasks();

View File

@@ -81,7 +81,6 @@ class module_console_taskrun extends Command
throw new \RuntimeException('Argument must be an Id.'); throw new \RuntimeException('Argument must be an Id.');
} }
$appbox = $this->getService('phraseanet.appbox');
$task_manager = new task_manager($this->container); $task_manager = new task_manager($this->container);
if ($input->getOption('runner') === task_abstract::RUNNER_MANUAL) { if ($input->getOption('runner') === task_abstract::RUNNER_MANUAL) {

View File

@@ -629,13 +629,12 @@ class module_report
*/ */
protected function setReport() protected function setReport()
{ {
$registry = $this->app['phraseanet.registry'];
$this->report['dbid'] = $this->sbas_id; $this->report['dbid'] = $this->sbas_id;
$this->report['periode'] = $this->periode; $this->report['periode'] = $this->periode;
$this->report['dbname'] = $this->dbname; $this->report['dbname'] = $this->dbname;
$this->report['dmin'] = $this->dmin; $this->report['dmin'] = $this->dmin;
$this->report['dmax'] = $this->dmax; $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['filter'] = $this->tab_filter;
$this->report['posting_filter'] = $this->posting_filter; $this->report['posting_filter'] = $this->posting_filter;
$this->report['active_column'] = $this->active_column; $this->report['active_column'] = $this->active_column;
@@ -861,8 +860,7 @@ class module_report
{ {
$tab = array(); $tab = array();
$appbox = $app['phraseanet.appbox']; $databox = $app['phraseanet.appbox']->get_databox((int) $sbasid);
$databox = $appbox->get_databox((int) $sbasid);
foreach ($databox->get_meta_structure() as $databox_field) { foreach ($databox->get_meta_structure() as $databox_field) {
/* @var $databox_field \databox_field */ /* @var $databox_field \databox_field */

View File

@@ -292,8 +292,7 @@ class module_report_activity extends module_report
$filter = $s->getFilters(); $filter = $s->getFilters();
$conn = $s->getConnBas(); $conn = $s->getConnBas();
$appbox = $this->app['phraseanet.appbox']; $databox = $this->app['phraseanet.appbox']->get_databox($this->sbas_id);
$databox = $appbox->get_databox($this->sbas_id);
$params = array(); $params = array();
$date_filter = $filter->getDateFilter(); $date_filter = $filter->getDateFilter();
@@ -363,7 +362,6 @@ class module_report_activity extends module_report
{ {
$this->title = _('report:: telechargements par jour'); $this->title = _('report:: telechargements par jour');
$registry = $this->app['phraseanet.registry'];
$s = new module_report_sql($this->app, $this); $s = new module_report_sql($this->app, $this);
$filter = $s->getFilters(); $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) public static function topTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$conn = connection::getPDOConnection($app, $sbas_id); $conn = connection::getPDOConnection($app, $sbas_id);
$registry = $app['phraseanet.registry'];
$result = array(); $result = array();
$result['top_ten_doc'] = array(); $result['top_ten_doc'] = array();
$result['top_ten_prev'] = array(); $result['top_ten_prev'] = array();
$result['top_ten_poiddoc'] = array(); $result['top_ten_poiddoc'] = array();
$result['top_ten_poidprev'] = 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); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$params = array_merge($params, $datefilter['params']); $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) public static function activity(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$conn = connection::getPDOConnection($app, $sbas_id); $conn = connection::getPDOConnection($app, $sbas_id);
$registry = $app['phraseanet.registry'];
$res = array(); $res = array();
$datefilter = $datefilter =
module_report_sqlfilter::constructDateFilter($dmin, $dmax); module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = $collfilter =
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); 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']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = " $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) public static function activityDay(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$conn = connection::getPDOConnection($app, $sbas_id); $conn = connection::getPDOConnection($app, $sbas_id);
$registry = $app['phraseanet.registry'];
$result = array(); $result = array();
$res = array(); $res = array();
$datefilter = $datefilter =
@@ -885,7 +880,7 @@ class module_report_activity extends module_report
$collfilter = $collfilter =
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); 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']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = " $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) public static function activityQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$conn = connection::getPDOConnection($app, $sbas_id); $conn = connection::getPDOConnection($app, $sbas_id);
$registry = $app['phraseanet.registry'];
$result = array(); $result = array();
$datefilter = $datefilter =
module_report_sqlfilter::constructDateFilter($dmin, $dmax); module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = $collfilter =
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); 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']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = " $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) public static function activiteTopQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$conn = connection::getPDOConnection($app, $sbas_id); $conn = connection::getPDOConnection($app, $sbas_id);
$registry = $app['phraseanet.registry'];
$result = array(); $result = array();
$datefilter = $datefilter =
module_report_sqlfilter::constructDateFilter($dmin, $dmax); module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = $collfilter =
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); 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']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
$sql = " $sql = "

View File

@@ -151,12 +151,11 @@ class module_report_connexion extends module_report
public static function getNbConn(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function getNbConn(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$conn = connection::getPDOConnection($app, $sbas_id); $conn = connection::getPDOConnection($app, $sbas_id);
$registry = $app['phraseanet.registry'];
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $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']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);
$finalfilter = $datefilter['sql'] . ' AND '; $finalfilter = $datefilter['sql'] . ' AND ';

View File

@@ -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) public static function getInstance(Application $app, $sbasid, $sbas_coll, $dmin, $dmax)
{ {
$appbox = $app['phraseanet.appbox'];
$cache_id = 'feed_' . md5($sbasid . '_' . $sbas_coll . '_' . $dmin . '_' . $dmax); $cache_id = 'feed_' . md5($sbasid . '_' . $sbas_coll . '_' . $dmin . '_' . $dmax);
try { try {
return $appbox->get_data_from_cache($cache_id); return $app['phraseanet.appbox']->get_data_from_cache($cache_id);
} catch (Exception $e) { } catch (Exception $e) {
} }
$tmp = new self($app, $sbasid, $sbas_coll, $dmin, $dmax); $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; 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->report['nb_conn'] = module_report_connexion::getNbConn(
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection $this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection
); );
$registry = $this->app['phraseanet.registry']; if ($this->app['phraseanet.registry']->get('GV_anonymousReport') == false) {
if ($registry->get('GV_anonymousReport') == false) {
/** /**
* get Top ten user of * get Top ten user of
* number of dl doc, prev * 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_preview'] = $topdl['preview'];
$this->report['top_dl_document'] = $topdl['document']; $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 // get users that ask the most questions
$this->report['ask'] = module_report_activity::activityQuestion( $this->report['ask'] = module_report_activity::activityQuestion(
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection $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->report['activity_edited'] = module_report_activity::activiteEditedDocument(
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection $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 //get users that add the most documents
$this->report['top_ten_added'] = module_report_activity::activiteAddedTopTenUser( $this->report['top_ten_added'] = module_report_activity::activiteAddedTopTenUser(
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection $this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection

View File

@@ -174,9 +174,8 @@ class module_report_download extends module_report
public static function getNbDl(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id) public static function getNbDl(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$conn = connection::getPDOConnection($app, $sbas_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); $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $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) public static function getTopDl(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
{ {
$appbox = $app['phraseanet.appbox']; $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
$databox = $appbox->get_databox((int) $sbas_id);
$conn = $databox->get_connection(); $conn = $databox->get_connection();
$registry = $app['phraseanet.registry']; $params = array(':site_id' => $app['phraseanet.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);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id); $collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array_merge($params, $datefilter['params'], $collfilter['params']); $params = array_merge($params, $datefilter['params'], $collfilter['params']);

View File

@@ -63,9 +63,8 @@ class module_report_sqlfilter
public function getReportFilter() public function getReportFilter()
{ {
$finalfilter = ''; $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']) { if ($this->filter['date']) {
$finalfilter .= $this->filter['date']['sql'] . ' AND '; $finalfilter .= $this->filter['date']['sql'] . ' AND ';
@@ -86,13 +85,12 @@ class module_report_sqlfilter
public function getGvSitFilter() public function getGvSitFilter()
{ {
$registry = $this->app['phraseanet.registry'];
$params = array(); $params = array();
$sql = ''; $sql = '';
if ($registry->is_set('GV_sit')) { if ($this->app['phraseanet.registry']->is_set('GV_sit')) {
$sql = 'log.site = :log_site_gv_filter'; $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); return array('sql' => $sql, 'params' => $params);

View File

@@ -9,8 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
class p4file class p4file
{ {

View File

@@ -70,12 +70,10 @@ 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 = $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) {
$registry->un_set($datas['name']); $app['phraseanet.registry']->un_set($datas['name']);
eval('$test = defined("' . $datas["name"] . '");'); eval('$test = defined("' . $datas["name"] . '");');
if ( ! $test) { if ( ! $test) {
continue; continue;
@@ -97,10 +95,10 @@ class patch_320aa implements patchInterface
$type = registry::TYPE_STRING; $type = registry::TYPE_STRING;
break; 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; return true;
} }

View File

@@ -9,7 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
/** /**

View File

@@ -75,24 +75,22 @@ class phrasea
public function getHome(Application $app, $type = 'PUBLI', $context = 'prod') public function getHome(Application $app, $type = 'PUBLI', $context = 'prod')
{ {
$appbox = $app['phraseanet.appbox'];
$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($app['phraseanet.registry']->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php")) {
require($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($registry->get('GV_RootPath') . 'config/help.php')) {// on verifie si il y a une home personnalisee sans langage } elseif (file_exists($app['phraseanet.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'); require($app['phraseanet.registry']->get('GV_RootPath') . 'config/help.php');
} else { } 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 ($type == 'PUBLI') {
if ($context == 'prod') if ($context == 'prod')
require($registry->get('GV_RootPath') . "www/prod/homeinterpubbask.php"); require($app['phraseanet.registry']->get('GV_RootPath') . "www/prod/homeinterpubbask.php");
else 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'))) { if (in_array($type, array('QUERY', 'LAST_QUERY'))) {
@@ -141,7 +139,7 @@ class phrasea
$parm["datemax"] = ''; $parm["datemax"] = '';
$parm["recordtype"] = ''; $parm["recordtype"] = '';
$parm["datefield"] = ''; $parm["datefield"] = '';
$parm["sort"] = $registry->get('GV_phrasea_sort'); $parm["sort"] = $app['phraseanet.registry']->get('GV_phrasea_sort');
$parm["stemme"] = ''; $parm["stemme"] = '';
$parm["dateminfield"] = array(); $parm["dateminfield"] = array();
$parm["datemaxfield"] = array(); $parm["datemaxfield"] = array();
@@ -150,7 +148,7 @@ class phrasea
$parm["ord"] = 0; $parm["ord"] = 0;
} }
require($registry->get('GV_RootPath') . 'www/' . $context . "/answer.php"); require($app['phraseanet.registry']->get('GV_RootPath') . 'www/' . $context . "/answer.php");
} }
return; return;
@@ -170,9 +168,8 @@ class phrasea
return self::$_sbas_params; return self::$_sbas_params;
} }
$appbox = $app['phraseanet.appbox'];
try { 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; return self::$_sbas_params;
} catch (Exception $e) { } catch (Exception $e) {
@@ -182,7 +179,7 @@ class phrasea
self::$_sbas_params = array(); self::$_sbas_params = array();
$sql = 'SELECT sbas_id, host, port, user, pwd, dbname FROM sbas'; $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(); $stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
@@ -191,7 +188,7 @@ class phrasea
self::$_sbas_params[$row['sbas_id']] = $row; 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; return self::$_sbas_params;
} }
@@ -250,12 +247,11 @@ class phrasea
public static function sbasFromBas(Application $app, $base_id) public static function sbasFromBas(Application $app, $base_id)
{ {
if (!self::$_bas2sbas) { if (!self::$_bas2sbas) {
$appbox = $app['phraseanet.appbox'];
try { 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) { } catch (Exception $e) {
$sql = 'SELECT base_id, sbas_id FROM bas'; $sql = 'SELECT base_id, sbas_id FROM bas';
$stmt = $appbox->get_connection()->prepare($sql); $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(); $stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
@@ -264,7 +260,7 @@ class phrasea
self::$_bas2sbas[$row['base_id']] = (int) $row['sbas_id']; 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) public static function sbas_names($sbas_id, Application $app)
{ {
if (!self::$_sbas_names) { if (!self::$_sbas_names) {
$appbox = $app['phraseanet.appbox'];
try { 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) { } catch (Exception $e) {
$sql = 'SELECT sbas_id, viewname, dbname FROM sbas'; $sql = 'SELECT sbas_id, viewname, dbname FROM sbas';
$stmt = $appbox->get_connection()->prepare($sql); $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(); $stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
@@ -355,7 +350,7 @@ class phrasea
$row['viewname'] = trim($row['viewname']); $row['viewname'] = trim($row['viewname']);
self::$_sbas_names[$row['sbas_id']] = $row['viewname'] ? $row['viewname'] : $row['dbname']; 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) public static function bas_names($base_id, Application $app)
{ {
if (!self::$_bas_names) { if (!self::$_bas_names) {
$appbox = $app['phraseanet.appbox'];
try { 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) { } catch (Exception $e) {
foreach ($appbox->get_databoxes() as $databox) { foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) { foreach ($databox->get_collections() as $collection) {
self::$_bas_names[$collection->get_base_id()] = $collection->get_name(); 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);
} }
} }

View File

@@ -9,8 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
* *

View File

@@ -394,7 +394,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
{ {
$dstatus = databox_status::getDisplayStatus($this->app); $dstatus = databox_status::getDisplayStatus($this->app);
$sbas_id = $this->get_sbas_id(); $sbas_id = $this->get_sbas_id();
$appbox = $this->app['phraseanet.appbox'];
$user = $this->app['phraseanet.user']; $user = $this->app['phraseanet.user'];
$status = ''; $status = '';
@@ -1351,7 +1350,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$story = new self($app, $databox->get_sbas_id(), $story_id); $story = new self($app, $databox->get_sbas_id(), $story_id);
try { try {
$appbox = $app['phraseanet.appbox'];
$log_id = $app['phraseanet.logger']($databox)->get_id(); $log_id = $app['phraseanet.logger']($databox)->get_id();
$sql = 'INSERT INTO log_docs (id, log_id, date, record_id, action, final, comment) $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); $record = new self($app, $databox->get_sbas_id(), $record_id);
try { try {
$appbox = $app['phraseanet.appbox'];
$log_id = $app['phraseanet.logger']($databox)->get_id(); $log_id = $app['phraseanet.logger']($databox)->get_id();
$sql = 'INSERT INTO log_docs (id, log_id, date, record_id, action, final, comment) $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(); $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']; $conn = $this->app['phraseanet.appbox']->get_connection();
$registry = $this->app['phraseanet.registry'];
$conn = $appbox->get_connection();
$ftodel = array(); $ftodel = array();
foreach ($this->get_subdefs() as $subdef) { foreach ($this->get_subdefs() as $subdef) {
@@ -1611,7 +1606,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$stmt->closeCursor(); $stmt->closeCursor();
try { try {
$sphinx_rt = sphinxrt::get_instance($registry); $sphinx_rt = sphinxrt::get_instance($this->app['phraseanet.registry']);
$sbas_params = phrasea::sbas_params($this->app); $sbas_params = phrasea::sbas_params($this->app);
@@ -2050,8 +2045,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
*/ */
public function get_grouping_parents() public function get_grouping_parents()
{ {
$appbox = $this->app['phraseanet.appbox'];
$sql = 'SELECT r.record_id $sql = 'SELECT r.record_id
FROM regroup g FROM regroup g
INNER JOIN (record r INNER JOIN (record r

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
@@ -79,15 +78,13 @@ class record_exportElement extends record_adapter
$this->downloadable = $downloadable = array(); $this->downloadable = $downloadable = array();
$this->orderable = $orderable = array(); $this->orderable = $orderable = array();
$appbox = $this->app['phraseanet.appbox'];
$sd = $this->get_subdefs(); $sd = $this->get_subdefs();
$sbas_id = phrasea::sbasFromBas($this->app, $this->base_id); $sbas_id = phrasea::sbasFromBas($this->app, $this->base_id);
$user = $this->app['phraseanet.user']; $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(); $subdefs = array();

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *

View File

@@ -316,8 +316,6 @@ class record_preview extends record_adapter
$tab = array(); $tab = array();
$appbox = $this->app['phraseanet.appbox'];
$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');
@@ -333,7 +331,7 @@ class record_preview extends record_adapter
if ( ! $report) { if ( ! $report) {
$sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")'; $sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")';
$params[':usr_id'] = $user->get_id(); $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'; $sql .= 'ORDER BY d.date, usrid DESC';
@@ -403,14 +401,11 @@ class record_preview extends record_adapter
return $this->view_popularity; return $this->view_popularity;
} }
$appbox = $this->app['phraseanet.appbox'];
$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 = $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; $this->view_popularity = false;
return $this->view_popularity; return $this->view_popularity;
@@ -442,7 +437,7 @@ class record_preview extends record_adapter
$stmt->execute( $stmt->execute(
array( array(
':record_id' => $this->get_record_id(), ':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); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -496,14 +491,11 @@ class record_preview extends record_adapter
return $this->refferer_popularity; return $this->refferer_popularity;
} }
$appbox = $this->app['phraseanet.appbox'];
$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 = $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; $this->refferer_popularity = false;
return $this->refferer_popularity; return $this->refferer_popularity;
@@ -527,22 +519,22 @@ class record_preview extends record_adapter
foreach ($rs as $row) { foreach ($rs as $row) {
if ($row['referrer'] == 'NO REFERRER') if ($row['referrer'] == 'NO REFERRER')
$row['referrer'] = _('report::acces direct'); $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'); $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'); $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'); $row['referrer'] = _('report:: page d\'accueil');
if (strpos($row['referrer'], 'http://apps.cooliris.com/') !== false) if (strpos($row['referrer'], 'http://apps.cooliris.com/') !== false)
$row['referrer'] = _('report:: visualiseur cooliris'); $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) if (strpos($row['referrer'], '/view/') !== false)
$row['referrer'] = _('report::presentation page preview'); $row['referrer'] = _('report::presentation page preview');
else else
$row['referrer'] = _('report::acces direct'); $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) if (strpos($row['referrer'], '/view/') !== false)
$row['referrer'] = _('report::presentation page preview'); $row['referrer'] = _('report::presentation page preview');
else else
@@ -579,15 +571,12 @@ class record_preview extends record_adapter
return $this->download_popularity; return $this->download_popularity;
} }
$appbox = $this->app['phraseanet.appbox'];
$user = $this->app['phraseanet.user']; $user = $this->app['phraseanet.user'];
$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');
$ret = false; $ret = false;
if ( ! $report && ! $registry->get('GV_google_api')) { if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) {
$this->download_popularity = false; $this->download_popularity = false;
return $this->download_popularity; return $this->download_popularity;
@@ -621,7 +610,7 @@ class record_preview extends record_adapter
$stmt->execute( $stmt->execute(
array( array(
':record_id' => $this->get_record_id(), ':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); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);

View File

@@ -73,7 +73,6 @@ class recordutils_image extends recordutils
*/ */
public static function stamp(Application $app, \media_subdef $subdef) public static function stamp(Application $app, \media_subdef $subdef)
{ {
$registry = $app['phraseanet.registry'];
$base_id = $subdef->get_record()->get_base_id(); $base_id = $subdef->get_record()->get_base_id();
if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) { if ($subdef->get_type() !== \media_subdef::TYPE_IMAGE) {
@@ -84,7 +83,7 @@ class recordutils_image extends recordutils
return $subdef->get_pathfile(); return $subdef->get_pathfile();
} }
if ( ! $registry->get('GV_imagick')) { if ( ! $app['phraseanet.registry']->get('GV_imagick')) {
return $subdef->get_pathfile(); return $subdef->get_pathfile();
} }
@@ -102,7 +101,7 @@ class recordutils_image extends recordutils
$pathIn = $subdef->get_path() . $subdef->get_file(); $pathIn = $subdef->get_path() . $subdef->get_file();
$pathOut = $subdef->get_path() . 'stamp_' . $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) { if ($xpprefs->query('/baseprefs/stamp')->length == 0) {
return $subdef->get_pathfile(); return $subdef->get_pathfile();
@@ -158,7 +157,7 @@ class recordutils_image extends recordutils
$text_xpos = 0; $text_xpos = 0;
$text_width = $image_width; $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; $logopos = null;
$imlogo = null; // gd image $imlogo = null; // gd image
$logo_phywidth = $logo_phyheight = 0; // physical size $logo_phywidth = $logo_phyheight = 0; // physical size
@@ -287,7 +286,7 @@ class recordutils_image extends recordutils
$newh = $image_height + $stampheight; $newh = $image_height + $stampheight;
$cmd = $registry->get('GV_imagick'); $cmd = $app['phraseanet.registry']->get('GV_imagick');
$cmd .= ' -extent "' . $image_width . 'x' . $newh $cmd .= ' -extent "' . $image_width . 'x' . $newh
. '" -draw "image SrcOver 0,' . $image_height . ' ' . '" -draw "image SrcOver 0,' . $image_height . ' '
. $image_width . ',' . $stampheight . '\'' . $pathTmpStamp . '\'"'; . $image_width . ',' . $stampheight . '\'' . $pathTmpStamp . '\'"';
@@ -313,7 +312,6 @@ class recordutils_image extends recordutils
*/ */
public static function watermark(Application $app, \media_subdef $subdef) public static function watermark(Application $app, \media_subdef $subdef)
{ {
$registry = $app['phraseanet.registry'];
$base_id = $subdef->get_record()->get_base_id(); $base_id = $subdef->get_record()->get_base_id();
if ($subdef->get_name() !== 'preview') { if ($subdef->get_name() !== 'preview') {
@@ -340,10 +338,10 @@ class recordutils_image extends recordutils
return $pathOut; return $pathOut;
} }
if ($registry->get('GV_pathcomposite') && if ($app['phraseanet.registry']->get('GV_pathcomposite') &&
file_exists($registry->get('GV_RootPath') . 'config/wm/' . $base_id)) { // si il y a un WM file_exists($app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id)) { // si il y a un WM
$cmd = $registry->get('GV_pathcomposite') . " "; $cmd = $app['phraseanet.registry']->get('GV_pathcomposite') . " ";
$cmd .= $registry->get('GV_RootPath') . 'config/wm/' . $base_id . " "; $cmd .= $app['phraseanet.registry']->get('GV_RootPath') . 'config/wm/' . $base_id . " ";
$cmd .= " \"" . $pathIn . "\" "; # <<-- la preview original $cmd .= " \"" . $pathIn . "\" "; # <<-- la preview original
$cmd .= " -strip -watermark 90% -gravity center "; $cmd .= " -strip -watermark 90% -gravity center ";
$cmd .= " \"" . $pathOut . "\""; # <-- la preview temporaire $cmd .= " \"" . $pathOut . "\""; # <-- la preview temporaire
@@ -364,9 +362,9 @@ class recordutils_image extends recordutils
fclose($pipes[2]); fclose($pipes[2]);
$return_value = proc_close($process); $return_value = proc_close($process);
} }
} elseif ($registry->get('GV_imagick')) { } elseif ($app['phraseanet.registry']->get('GV_imagick')) {
$collname = phrasea::bas_names($base_id, $app); $collname = phrasea::bas_names($base_id, $app);
$cmd = $registry->get('GV_imagick'); $cmd = $app['phraseanet.registry']->get('GV_imagick');
$tailleimg = @getimagesize($pathIn); $tailleimg = @getimagesize($pathIn);
$max = ($tailleimg[0] > $tailleimg[1] ? $tailleimg[0] : $tailleimg[1]); $max = ($tailleimg[0] > $tailleimg[1] ? $tailleimg[0] : $tailleimg[1]);

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; 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() protected function query()
{ {
$registry = $this->app['phraseanet.registry'];
$dateLog = date("Y-m-d H:i:s"); $dateLog = date("Y-m-d H:i:s");
$nbanswers = 0; $nbanswers = 0;
@@ -408,7 +405,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
, $sbas_id , $sbas_id
, $this->colls[$sbas_id] , $this->colls[$sbas_id]
, $this->arrayq[$sbas_id] , $this->arrayq[$sbas_id]
, $registry->get('GV_sit') , $this->app['phraseanet.registry']->get('GV_sit')
, (string) $this->app['phraseanet.user']->get_id() , (string) $this->app['phraseanet.user']->get_id()
, false , false
, $this->opt_search_type == 1 ? PHRASEA_MULTIDOC_REGONLY : PHRASEA_MULTIDOC_DOCONLY , $this->opt_search_type == 1 ? PHRASEA_MULTIDOC_REGONLY : PHRASEA_MULTIDOC_DOCONLY

View File

@@ -1725,16 +1725,15 @@ class searchEngine_adapter_phrasea_queryParser
public function addsimple($t, $type, $nodetype, $pnum, $tree, $depth) public function addsimple($t, $type, $nodetype, $pnum, $tree, $depth)
{ {
$nok = 0; $nok = 0;
$registry = $this->app['phraseanet.registry'];
$w = $t["VALUE"]; $w = $t["VALUE"];
if ($w != "?" && $w != "*") { // on laisse passer les 'isolés' pour les traiter plus tard comme des mots vides 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 ++ ) { for ($i = 0; $i < strlen($w); $i ++ ) {
$c = substr($w, $i, 1); $c = substr($w, $i, 1);
if ($c == "?" || $c == "*") { 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 != "") if ($this->errmsg != "")
$this->errmsg .= sprintf("\\n"); $this->errmsg .= sprintf("\\n");
$this->errmsg .= _('qparser:: Formulation incorrecte, necessite plus de caractere : ') . "<br>" . $registry->get('GV_min_letters_truncation'); $this->errmsg .= _('qparser:: Formulation incorrecte, necessite plus de caractere : ') . "<br>" . $this->app['phraseanet.registry']->get('GV_min_letters_truncation');
return(null); return(null);
} }

View File

@@ -11,7 +11,6 @@ require_once __DIR__ . '/../../../../vendor/sphinx/sphinxapi.php';
*/ */
use Alchemy\Phrasea\Application; 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) public function __construct(Application $app)
{ {
$this->app = $app; $this->app = $app;
$registry = $this->app['phraseanet.registry'];
$this->sphinx = new SphinxClient (); $this->sphinx = new SphinxClient ();
$this->sphinx->SetArrayResult(true); $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); $this->sphinx->SetConnectTimeout(1);
return $this; return $this;

View File

@@ -9,8 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
* @package searchEngine * @package searchEngine

View File

@@ -229,7 +229,7 @@ class set_export extends set_abstract
$this->ftp_datas = array(); $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; $display_ftp = $display_download;
$this->total_ftp = $this->total_download; $this->total_ftp = $this->total_download;
@@ -249,7 +249,7 @@ class set_export extends set_abstract
) )
GROUP BY usr_id "; GROUP BY usr_id ";
$params = array(); $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, $sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP,
usr.pwdFTP,usr.destFTP,prefixFTPfolder, usr.pwdFTP,usr.destFTP,prefixFTPfolder,
usr.passifFTP,usr.retryFTP,usr.usr_mail usr.passifFTP,usr.retryFTP,usr.usr_mail
@@ -397,8 +397,6 @@ class set_export extends set_abstract
$includeBusinessFields = !!$includeBusinessFields; $includeBusinessFields = !!$includeBusinessFields;
$registry = $this->app['phraseanet.registry'];
$unicode = new unicode(); $unicode = new unicode();
$files = array(); $files = array();
@@ -628,7 +626,7 @@ class set_export extends set_abstract
$files[$id]["export_name"] = $tmp_name; $files[$id]["export_name"] = $tmp_name;
if (in_array('caption', $subdefs)) { 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() . '/'; . time() . $this->app['phraseanet.user']->get_id() . '/';
$filesystem->mkdir($caption_dir, 0750); $filesystem->mkdir($caption_dir, 0750);
@@ -649,7 +647,7 @@ class set_export extends set_abstract
$files[$id]["subdefs"]['caption']['businessfields'] = $BF ? '1' : '0'; $files[$id]["subdefs"]['caption']['businessfields'] = $BF ? '1' : '0';
} }
if (in_array('caption-yaml', $subdefs)) { 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() . '/'; . time() . $this->app['phraseanet.user']->get_id() . '/';
$filesystem->mkdir($caption_dir, 0750); $filesystem->mkdir($caption_dir, 0750);

View File

@@ -9,8 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
* *

View File

@@ -10,9 +10,7 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Controller\RecordsRequest; 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) public function deny_elements(Array $elements_ids)
{ {
$conn = $app['phraseanet.appbox']->get_connection(); $conn = $this->app['phraseanet.appbox']->get_connection();
$n = 0; $n = 0;
@@ -480,7 +478,7 @@ class set_order extends set_abstract
} }
if ($n > 0) { if ($n > 0) {
$evt_mngr = $app['events-manager']; $evt_mngr = $this->app['events-manager'];
$params = array( $params = array(
'from' => $this->app['phraseanet.user']->get_id(), 'from' => $this->app['phraseanet.user']->get_id(),

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *

View File

@@ -37,7 +37,6 @@ class sphinx_configuration
{ {
$available_charsets = array(); $available_charsets = array();
$dir = __DIR__ . '/charsetTable/'; $dir = __DIR__ . '/charsetTable/';
$registry = $this->app['phraseanet.registry'];
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
if ($file->isDir() || strpos($file->getPathname(), '/.svn/') !== false) { if ($file->isDir() || strpos($file->getPathname(), '/.svn/') !== false) {
continue; continue;

View File

@@ -9,7 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Monolog\Logger; use Monolog\Logger;
@@ -53,10 +52,8 @@ class task_Scheduler
*/ */
public function run() public function run()
{ {
$registry = $this->dependencyContainer['phraseanet.registry'];
//prevent scheduler to fail if GV_cli is not provided //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'); throw new \RuntimeException('PHP cli is not provided in registry');
} }
@@ -75,7 +72,7 @@ class task_Scheduler
$this->method = self::METHOD_FORK; $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 ++ ) { for ($try = 1; true; $try ++ ) {
$lockfile = ($lockdir . 'scheduler.lock'); $lockfile = ($lockdir . 'scheduler.lock');
@@ -217,10 +214,10 @@ class task_Scheduler
$taskPoll[$tkey] = array( $taskPoll[$tkey] = array(
"task" => $task, "task" => $task,
"current_status" => $status, "current_status" => $status,
"cmd" => $registry->get('GV_cli'), "cmd" => $this->dependencyContainer['phraseanet.registry']->get('GV_cli'),
"args" => array( "args" => array(
'-f', '-f',
$registry->get('GV_RootPath') . 'bin/console', $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'bin/console',
'--', '--',
'-q', '-q',
'task:run', 'task:run',
@@ -331,7 +328,7 @@ class task_Scheduler
$taskPoll[$tkey]["cmd"] . ' ' . implode(' ', $taskPoll[$tkey]["args"]) $taskPoll[$tkey]["cmd"] . ' ' . implode(' ', $taskPoll[$tkey]["args"])
, $descriptors , $descriptors
, $taskPoll[$tkey]["pipes"] , $taskPoll[$tkey]["pipes"]
, $registry->get('GV_RootPath') . "bin/" , $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . "bin/"
, null , null
, array('bypass_shell' => true) , array('bypass_shell' => true)
); );

View File

@@ -9,8 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3

View File

@@ -9,8 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3

View File

@@ -9,7 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
use Monolog\Logger; use Monolog\Logger;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;

View File

@@ -8,8 +8,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3

View File

@@ -9,8 +9,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3

View File

@@ -8,10 +8,8 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Metadata\Tag as PhraseaTag; use Alchemy\Phrasea\Metadata\Tag as PhraseaTag;
use Alchemy\Phrasea\Border\Attribute as BorderAttribute; use Alchemy\Phrasea\Border\Attribute as BorderAttribute;
use MediaVorus\MediaVorus;
use PHPExiftool\Driver\Metadata\Metadata; use PHPExiftool\Driver\Metadata\Metadata;
use PHPExiftool\Driver\Metadata\MetadataBag; use PHPExiftool\Driver\Metadata\MetadataBag;
use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Exception\IOException;
@@ -197,8 +195,6 @@ class task_period_archive extends task_abstract
*/ */
public function getInterfaceHTML() public function getInterfaceHTML()
{ {
$appbox = $this->dependencyContainer['phraseanet.appbox'];
ob_start(); ob_start();
?> ?>
<form id="graphicForm" name="graphicForm" onsubmit="return(false);" method="post"> <form id="graphicForm" name="graphicForm" onsubmit="return(false);" method="post">
@@ -207,7 +203,7 @@ class task_period_archive extends task_abstract
<select name="base_id"> <select name="base_id">
<option value="">...</option> <option value="">...</option>
<?php <?php
foreach ($appbox->get_databoxes() as $databox) { foreach ($this->dependencyContainer['phraseanet.appbox']->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) { foreach ($databox->get_collections() as $collection) {
print("<option value=\"" . $collection->get_base_id() . "\">" . $databox->get_viewname() . " / " . $collection->get_name() . "</option>"); print("<option value=\"" . $collection->get_base_id() . "\">" . $databox->get_viewname() . " / " . $collection->get_name() . "</option>");
} }
@@ -261,8 +257,7 @@ class task_period_archive extends task_abstract
{ {
$this->debug = false; $this->debug = false;
$appbox = $this->dependencyContainer['phraseanet.appbox']; $conn = $this->dependencyContainer['phraseanet.appbox']->get_connection();
$conn = $appbox->get_connection();
$this->sxTaskSettings = simplexml_load_string($this->settings); $this->sxTaskSettings = simplexml_load_string($this->settings);
@@ -275,7 +270,7 @@ class task_period_archive extends task_abstract
return 'tostop'; return 'tostop';
} }
$databox = $appbox->get_databox($this->sbas_id); $databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($this->sbas_id);
$this->TColls = array(); $this->TColls = array();
$collection = null; $collection = null;
@@ -498,9 +493,8 @@ class task_period_archive extends task_abstract
{ {
clearstatcache(); clearstatcache();
$appbox = $this->dependencyContainer['phraseanet.appbox'];
connection::getPDOConnection($this->dependencyContainer); connection::getPDOConnection($this->dependencyContainer);
$appbox->get_databox($this->sbas_id)->get_connection(); $this->dependencyContainer['phraseanet.appbox']->get_databox($this->sbas_id)->get_connection();
$path_in = p4string::delEndSlash(trim((string) ($this->sxTaskSettings->hotfolder))); $path_in = p4string::delEndSlash(trim((string) ($this->sxTaskSettings->hotfolder)));
if (false === $this->dependencyContainer['filesystem']->exists($path_in . "/.phrasea.xml")) { if (false === $this->dependencyContainer['filesystem']->exists($path_in . "/.phrasea.xml")) {
@@ -1408,7 +1402,6 @@ class task_period_archive extends task_abstract
*/ */
private function archiveGrp(\DOMDocument $dom, \DOMElement $node, $path, $path_archived, $path_error, array &$nodesToDel) private function archiveGrp(\DOMDocument $dom, \DOMElement $node, $path, $path_archived, $path_error, array &$nodesToDel)
{ {
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$xpath = new DOMXPath($dom); $xpath = new DOMXPath($dom);
// grp folders stay in place // grp folders stay in place
@@ -1433,10 +1426,8 @@ class task_period_archive extends task_abstract
// if the .grp does not have a representative doc, let's use a generic file // if the .grp does not have a representative doc, let's use a generic file
if ( ! ($rep = $node->getAttribute('grp_representation'))) { if ( ! ($rep = $node->getAttribute('grp_representation'))) {
$registry = $this->dependencyContainer['phraseanet.registry'];
try { try {
$this->dependencyContainer['filesystem']->copy(p4string::addEndSlash($registry->get('GV_RootPath')) . 'www/skins/icons/substitution/regroup_doc.png', $genericdoc = ($path . '/group.jpg'), true); $this->dependencyContainer['filesystem']->copy(p4string::addEndSlash($this->dependencyContainer['phraseanet.registry']->get('GV_RootPath')) . 'www/skins/icons/substitution/regroup_doc.png', $genericdoc = ($path . '/group.jpg'), true);
} catch (IOException $e) { } catch (IOException $e) {
$this->log($e->getMessage()); $this->log($e->getMessage());
} }
@@ -1461,7 +1452,7 @@ class task_period_archive extends task_abstract
try { try {
$databox = $appbox->get_databox($this->sbas_id); $databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($this->sbas_id);
$collection = collection::get_from_coll_id($this->dependencyContainer, $databox, (int) $cid); $collection = collection::get_from_coll_id($this->dependencyContainer, $databox, (int) $cid);
if ($captionFileName === null) { if ($captionFileName === null) {
$story = $this->createStory($collection, $path . '/' . $representationFileName, null); $story = $this->createStory($collection, $path . '/' . $representationFileName, null);
@@ -1831,7 +1822,6 @@ class task_period_archive extends task_abstract
{ {
$ret = false; $ret = false;
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$file = $node->getAttribute('name'); $file = $node->getAttribute('name');
$cid = $node->getAttribute('cid'); $cid = $node->getAttribute('cid');
$captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null; $captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null;
@@ -1862,7 +1852,7 @@ class task_period_archive extends task_abstract
} }
try { try {
$databox = $appbox->get_databox($this->sbas_id); $databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($this->sbas_id);
$collection = collection::get_from_coll_id($this->dependencyContainer, $databox, (int) $cid); $collection = collection::get_from_coll_id($this->dependencyContainer, $databox, (int) $cid);
if ($captionFileName === null) { if ($captionFileName === null) {

View File

@@ -435,8 +435,7 @@ class task_period_cindexer extends task_abstract
$args_nopwd[] = '--run'; $args_nopwd[] = '--run';
} }
$registry = $this->dependencyContainer['phraseanet.registry']; $logdir = p4string::addEndSlash($this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'logs');
$logdir = p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
$this->new_status = NULL; // new status to set at the end $this->new_status = NULL; // new status to set at the end
$this->exception = NULL; // exception to throw at the end $this->exception = NULL; // exception to throw at the end

View File

@@ -304,7 +304,6 @@ 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 = $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"];
@@ -340,13 +339,13 @@ class task_period_ftp extends task_appboxAbstract
if (($ses_id = phrasea_create_session($usr_id)) == null) { if (($ses_id = phrasea_create_session($usr_id)) == null) {
$this->logger->addDebug("Unable to create session"); $this->logger->addDebug("Unable to create session");
continue; return;
} }
if ( ! ($ph_session = phrasea_open_session($ses_id, $usr_id))) { if ( ! ($ph_session = phrasea_open_session($ses_id, $usr_id))) {
$this->logger->addDebug("Unable to open session"); $this->logger->addDebug("Unable to open session");
phrasea_close_session($ses_id); phrasea_close_session($ses_id);
continue; return;
} }
try { try {
@@ -417,14 +416,14 @@ class task_period_ftp extends task_appboxAbstract
if ($subdef == 'caption') { if ($subdef == 'caption') {
$desc = $record->get_caption()->serialize(\caption_record::SERIALIZE_XML, $ftp_export["businessfields"]); $desc = $record->get_caption()->serialize(\caption_record::SERIALIZE_XML, $ftp_export["businessfields"]);
$localfile = $registry->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand()); $localfile = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand());
if (file_put_contents($localfile, $desc) === false) { if (file_put_contents($localfile, $desc) === false) {
throw new Exception('Impossible de creer un fichier temporaire'); throw new Exception('Impossible de creer un fichier temporaire');
} }
} elseif ($subdef == 'caption-yaml') { } elseif ($subdef == 'caption-yaml') {
$desc = $record->get_caption()->serialize(\caption_record::SERIALIZE_YAML, $ftp_export["businessfields"]); $desc = $record->get_caption()->serialize(\caption_record::SERIALIZE_YAML, $ftp_export["businessfields"]);
$localfile = $registry->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand()); $localfile = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/' . md5($desc . time() . mt_rand());
if (file_put_contents($localfile, $desc) === false) { if (file_put_contents($localfile, $desc) === false) {
throw new Exception('Impossible de creer un fichier temporaire'); throw new Exception('Impossible de creer un fichier temporaire');
} }
@@ -513,7 +512,7 @@ class task_period_ftp extends task_appboxAbstract
$buffer .= $root . '/' . $folder . $filename . "\n"; $buffer .= $root . '/' . $folder . $filename . "\n";
} }
$tmpfile = $registry->get('GV_RootPath') . 'tmp/tmpftpbuffer' . $date->format('U') . '.txt'; $tmpfile = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/tmpftpbuffer' . $date->format('U') . '.txt';
file_put_contents($tmpfile, $buffer); file_put_contents($tmpfile, $buffer);
@@ -604,7 +603,6 @@ class task_period_ftp extends task_appboxAbstract
public function send_mails(appbox $appbox, $id) public function send_mails(appbox $appbox, $id)
{ {
$conn = $appbox->get_connection(); $conn = $appbox->get_connection();
$registry = $this->dependencyContainer['phraseanet.registry'];
$sql = 'SELECT filename, base_id, record_id, subdef, error, done' $sql = 'SELECT filename, base_id, record_id, subdef, error, done'
. ' FROM ftp_export_elements WHERE ftp_export_id = :export_id'; . ' FROM ftp_export_elements WHERE ftp_export_id = :export_id';
@@ -671,7 +669,7 @@ class task_period_ftp extends task_appboxAbstract
$subject = sprintf( $subject = sprintf(
_('task::ftp:Status about your FTP transfert from %1$s to %2$s') _('task::ftp:Status about your FTP transfert from %1$s to %2$s')
, $registry->get('GV_homeTitle'), $ftp_server , $this->dependencyContainer['phraseanet.registry']->get('GV_homeTitle'), $ftp_server
); );
mail::ftp_sent($this->dependencyContainer, $sendermail, $subject, $sender_message); mail::ftp_sent($this->dependencyContainer, $sendermail, $subject, $sender_message);

View File

@@ -8,8 +8,6 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Alchemy\Phrasea\Core\Configuration;
/** /**
* *
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3

Some files were not shown because too many files have changed in this diff Show More