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\RecordAdd;
use Alchemy\Phrasea\Command\CreateCollection;
use Alchemy\Phrasea\PhraseanetServiceProvider;
use Alchemy\Phrasea\Core\Provider\BrowserServiceProvider;
use Silex\Provider\UrlGeneratorServiceProvider;
use Silex\Provider\ValidatorServiceProvider;
use Silex\Provider\TwigServiceProvider;
use Alchemy\Phrasea\CLI;
require_once dirname(__FILE__) . '/../lib/classes/bootstrap.class.php';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -228,12 +228,11 @@ class Feed implements ControllerProviderInterface
$user = $app['phraseanet.user'];
$feeds = \Feed_Collection::load_all($app, $user);
$registry = $app['phraseanet.registry'];
$output = array(
'texte' => '<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>
<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')
);
@@ -244,12 +243,11 @@ class Feed implements ControllerProviderInterface
$renew = ($request->query->get('renew') === 'true');
$user = $app['phraseanet.user'];
$feed = \Feed_Adapter::load_with_user($app, $user, $id);
$registry = $app['phraseanet.registry'];
$output = array(
'texte' => '<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>
<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')
);

View File

@@ -27,13 +27,12 @@ class Language implements ControllerProviderInterface
$controller = $app['controllers_factory'];
$controller->get("/", function(Application $app) {
$registry = $app['phraseanet.registry'];
$out = array();
$out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.');
$out['confirmDel'] = _('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?');
$out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique');
$out['serverName'] = $registry->get('GV_ServerName');
$out['serverName'] = $app['phraseanet.registry']->get('GV_ServerName');
$out['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
$out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier');
$out['hideMessage'] = _('phraseanet::Ne plus afficher ce message');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -245,7 +245,6 @@ class Developers implements ControllerProviderInterface
$app->abort(400, _('Bad request format, only JSON is allowed'));
}
$appbox = $app['phraseanet.appbox'];
$error = false;
$accessToken = null;
@@ -258,7 +257,7 @@ class Developers implements ControllerProviderInterface
if ($token instanceof \API_OAuth2_Token) {
$token->renew();
} else {
$token = \API_OAuth2_Token::create($appbox, $account);
$token = \API_OAuth2_Token::create($app['phraseanet.appbox'], $account);
}
$accessToken = $token->get_value();

View File

@@ -211,8 +211,6 @@ class Login implements ControllerProviderInterface
*/
public function sendConfirmMail(Application $app, Request $request)
{
$appbox = $app['phraseanet.appbox'];
if (null === $usrId = $request->query->get('usr_id')) {
$app->abort(400, sprintf(_('Request to send you the confirmation mail failed, please retry')));
}
@@ -238,8 +236,6 @@ class Login implements ControllerProviderInterface
*/
public function registerConfirm(Application $app, Request $request)
{
$appbox = $app['phraseanet.appbox'];
if (null === $code = $request->query->get('code')) {
return $app->redirect('/login/?redirect=/prod&error=code-not-found');
}
@@ -270,7 +266,7 @@ class Login implements ControllerProviderInterface
$user->set_mail_locked(false);
\random::removeToken($app, $code);
$appboxRegister = new \appbox_register($appbox);
$appboxRegister = new \appbox_register($app['phraseanet.appbox']);
$list = $appboxRegister->get_collection_awaiting_for_user($app, $user);
@@ -299,8 +295,6 @@ class Login implements ControllerProviderInterface
*/
public function renewPassword(Application $app, Request $request)
{
$appbox = $app['phraseanet.appbox'];
if (null !== $mail = $request->request->get('mail')) {
if (!\PHPMailer::ValidateAddress($mail)) {
return $app->redirect('/login/forgot-password/?error=invalidmail');
@@ -682,23 +676,20 @@ class Login implements ControllerProviderInterface
*/
public function login(Application $app, Request $request)
{
$appbox = $app['phraseanet.appbox'];
$registry = $app['phraseanet.registry'];
require_once($registry->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php');
if ($registry->get('GV_captchas') && trim($registry->get('GV_captcha_private_key')) !== '' && trim($registry->get('GV_captcha_public_key')) !== '') {
include($registry->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php');
require_once($app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php');
if ($app['phraseanet.registry']->get('GV_captchas') && trim($app['phraseanet.registry']->get('GV_captcha_private_key')) !== '' && trim($app['phraseanet.registry']->get('GV_captcha_public_key')) !== '') {
include($app['phraseanet.registry']->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php');
}
$warning = $request->query->get('error', '');
try {
$appbox->get_connection();
$app['phraseanet.appbox']->get_connection();
} catch (\Exception $e) {
$warning = 'no-connection';
}
if (!!$registry->get('GV_maintenance')) {
if (!!$app['phraseanet.registry']->get('GV_maintenance')) {
$warning = 'maintenance';
}
@@ -756,10 +747,10 @@ class Login implements ControllerProviderInterface
}
$captchaSys = '';
if (!$registry->get('GV_maintenance')
&& $registry->get('GV_captchas')
&& trim($registry->get('GV_captcha_private_key')) !== ''
&& trim($registry->get('GV_captcha_public_key')) !== ''
if (!$app['phraseanet.registry']->get('GV_maintenance')
&& $app['phraseanet.registry']->get('GV_captchas')
&& trim($app['phraseanet.registry']->get('GV_captcha_private_key')) !== ''
&& trim($app['phraseanet.registry']->get('GV_captcha_public_key')) !== ''
&& $request->query->get('error') == 'captcha') {
$captchaSys = '<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;">
@@ -768,7 +759,7 @@ class Login implements ControllerProviderInterface
<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>
<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);
@@ -783,7 +774,7 @@ class Login implements ControllerProviderInterface
'captcha_system' => $captchaSys,
'login' => new \login(),
'feeds' => $feeds,
'display_layout' => $registry->get('GV_home_publi')
'display_layout' => $app['phraseanet.registry']->get('GV_home_publi')
));
}
@@ -796,9 +787,7 @@ class Login implements ControllerProviderInterface
*/
public function authenticate(Application $app, Request $request)
{
$appbox = $app['phraseanet.appbox'];
$conn = $appbox->get_connection();
$registry = $app['phraseanet.registry'];
$conn = $app['phraseanet.appbox']->get_connection();
$is_guest = false;
@@ -818,13 +807,13 @@ class Login implements ControllerProviderInterface
} else {
$captcha = false;
if ($registry->get('GV_captchas')
&& '' !== $privateKey = trim($registry->get('GV_captcha_private_key'))
&& trim($registry->get('GV_captcha_public_key')) !== ''
if ($app['phraseanet.registry']->get('GV_captchas')
&& '' !== $privateKey = trim($app['phraseanet.registry']->get('GV_captcha_private_key'))
&& trim($app['phraseanet.registry']->get('GV_captcha_public_key')) !== ''
&& null !== $challenge = $request->request->get("recaptcha_challenge_field")
&& null !== $captachResponse = $request->request->get("recaptcha_response_field")) {
include($registry->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php');
include($app['phraseanet.registry']->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php');
$checkCaptcha = recaptcha_check_answer($privateKey, $_SERVER["REMOTE_ADDR"], $challenge, $captachResponse);

View File

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

View File

@@ -211,23 +211,22 @@ class Installer implements ControllerProviderInterface
}
}
$registry = $app['phraseanet.registry'];
\setup::create_global_values($app);
// $appbox->set_registry($registry);
$registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->request->get('datapath_noweb')), \registry::TYPE_STRING);
$registry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
$registry->set('GV_cli', $request->request->get('binary_php'), \registry::TYPE_STRING);
$registry->set('GV_imagick', $request->request->get('binary_convert'), \registry::TYPE_STRING);
$registry->set('GV_pathcomposite', $request->request->get('binary_composite'), \registry::TYPE_STRING);
$registry->set('GV_swf_extract', $request->request->get('binary_swfextract'), \registry::TYPE_STRING);
$registry->set('GV_pdf2swf', $request->request->get('binary_pdf2swf'), \registry::TYPE_STRING);
$registry->set('GV_swf_render', $request->request->get('binary_swfrender'), \registry::TYPE_STRING);
$registry->set('GV_unoconv', $request->request->get('binary_unoconv'), \registry::TYPE_STRING);
$registry->set('GV_ffmpeg', $request->request->get('binary_ffmpeg'), \registry::TYPE_STRING);
$registry->set('GV_mp4box', $request->request->get('binary_MP4Box'), \registry::TYPE_STRING);
$registry->set('GV_pdftotext', $request->request->get('binary_xpdf'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->request->get('datapath_noweb')), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_ServerName', $servername, \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_cli', $request->request->get('binary_php'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_imagick', $request->request->get('binary_convert'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_pathcomposite', $request->request->get('binary_composite'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_swf_extract', $request->request->get('binary_swfextract'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_pdf2swf', $request->request->get('binary_pdf2swf'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_swf_render', $request->request->get('binary_swfrender'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_unoconv', $request->request->get('binary_unoconv'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_ffmpeg', $request->request->get('binary_ffmpeg'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_mp4box', $request->request->get('binary_MP4Box'), \registry::TYPE_STRING);
$app['phraseanet.registry']->set('GV_pdftotext', $request->request->get('binary_xpdf'), \registry::TYPE_STRING);
$user = \User_Adapter::create($app, $request->request->get('email'), $request->request->get('password'), $request->request->get('email'), true);
@@ -239,7 +238,7 @@ class Installer implements ControllerProviderInterface
if ($databox_name && !\p4string::hasAccent($databox_name)) {
$template = new \SplFileInfo(__DIR__ . '/../../../../conf.d/data_templates/' . $request->request->get('db_template') . '.xml');
$databox = \databox::create($app, $connbas, $template, $registry);
$databox = \databox::create($app, $connbas, $template, $app['phraseanet.registry']);
$user->ACL()
->give_access_to_sbas(array($databox->get_sbas_id()))
->update_rights_to_sbas(

View File

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

View File

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

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Helper\User;
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Helper\Helper;
/**
@@ -173,10 +172,9 @@ class Manage extends Helper
if ($sendCredentials) {
$urlToken = \random::getUrlToken($this->app, \random::TYPE_PASSWORD, $createdUser->get_id());
$registry = $this->app['phraseanet.registry'];
if (false !== $urlToken) {
$url = sprintf('%slogin/forgot-password/?token=%s', $registry->get('GV_ServerName'), $urlToken);
$url = sprintf('%slogin/forgot-password/?token=%s', $this->app['phraseanet.registry']->get('GV_ServerName'), $urlToken);
\mail::send_credentials($this->app, $url, $createdUser->get_login(), $createdUser->get_email());
}
}

View File

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

View File

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

View File

@@ -664,12 +664,6 @@ class API_OAuth2_Application
return new self($app, $row['application_id']);
}
/**
*
* @param appbox $appbox
* @param User_Adapter $user
* @return array
*/
public static function load_dev_app_by_user(Application $app, User_Adapter $user)
{
$sql = 'SELECT a.application_id
@@ -689,12 +683,6 @@ class API_OAuth2_Application
return $apps;
}
/**
*
* @param appbox $appbox
* @param user_adapter $user
* @return API_OAuth2_Application
*/
public static function load_app_by_user(Application $app, user_adapter $user)
{
$sql = 'SELECT a.application_id

View File

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

View File

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

View File

@@ -109,13 +109,6 @@ class Bridge_Element
const STATUS_PENDING = 'pending';
const STATUS_ERROR = 'error';
/**
*
* @param appbox $appbox
* @param Bridge_Account $account
* @param int $id
* @return Bridge_Element
*/
public function __construct(Application $app, Bridge_Account $account, $id)
{
$this->app = $app;
@@ -446,13 +439,6 @@ class Bridge_Element
return;
}
/**
*
* @param appbox $appbox
* @param Bridge_Account $account
* @param int $quantity
* @return Bridge_Element
*/
public static function get_elements_by_account(Application $app, Bridge_Account $account, $offset_start = 0, $quantity = 50)
{
$sql = 'SELECT id FROM bridge_elements WHERE account_id = :account_id
@@ -473,17 +459,6 @@ class Bridge_Element
return $results;
}
/**
*
* @param appbox $appbox
* @param Bridge_Account $account
* @param record_adapter $record
* @param string $title
* @param string $status
* @param string $type
* @param array $datas
* @return Bridge_Element
*/
public static function create(Application $app, Bridge_Account $account, record_adapter $record, $title, $status, $type, Array $datas = array())
{
$sql = 'INSERT INTO bridge_elements

View File

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

View File

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

View File

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

View File

@@ -249,7 +249,6 @@ class Session_Authentication_Native implements Session_Authentication_Interface
protected function check_and_revoke_badlogs($ip)
{
$conn = $this->app['phraseanet.appbox']->get_connection();
$registry = $this->app['phraseanet.registry'];
$sql = 'SELECT id FROM badlog
WHERE (login = :login OR ip = :ip) AND locked="1"';
@@ -271,7 +270,7 @@ class Session_Authentication_Native implements Session_Authentication_Interface
$stmt->execute(array(':login' => $this->login, ':ip' => $ip));
$stmt->closeCursor();
} elseif ($row_count > 9) {
if ($this->is_captcha_activated($registry))
if ($this->is_captcha_activated($this->app['phraseanet.registry']))
throw new Exception_Session_RequireCaptcha('Require captcha');
}
@@ -285,8 +284,6 @@ class Session_Authentication_Native implements Session_Authentication_Interface
*/
protected function is_captcha_activated(registryInterface $registry)
{
$registry = $this->app['phraseanet.registry'];
return ($registry->get('GV_captchas')
&& trim($registry->get('GV_captcha_private_key')) !== ''
&& trim($registry->get('GV_captcha_public_key') !== ''));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -66,13 +66,12 @@ class databox_status
$path = $url = false;
$sbas_params = phrasea::sbas_params($app);
$registry = $app['phraseanet.registry'];
if ( ! isset($sbas_params[$sbas_id])) {
return;
}
$path = $this->path = $registry->get('GV_RootPath') . "config/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
$path = $this->path = $app['phraseanet.registry']->get('GV_RootPath') . "config/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
$url = $this->url = "/custom/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]);
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
@@ -382,8 +381,6 @@ class databox_status
public static function updateIcon(Application $app, $sbas_id, $bit, $switch, UploadedFile $file)
{
$registry = $app['phraseanet.registry'];
$switch = in_array($switch, array('on', 'off')) ? $switch : false;
if ( ! $switch) {
@@ -406,13 +403,12 @@ class databox_status
$name = "-stat_" . $bit . "_" . ($switch == 'on' ? '1' : '0') . ".gif";
try {
$file = $file->move($registry->get('GV_RootPath') . "config/status/", $path.$name);
$file = $file->move($app['phraseanet.registry']->get('GV_RootPath') . "config/status/", $path.$name);
} catch (FileException $e) {
throw new Exception_Upload_CannotWriteFile();
}
$custom_path = $registry->get('GV_RootPath') . 'www/custom/status/';
$custom_path = $app['phraseanet.registry']->get('GV_RootPath') . 'www/custom/status/';
$app['filesystem']->mkdir($custom_path, 0750);

View File

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

View File

@@ -10,7 +10,6 @@
*/
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
/**
*
@@ -100,11 +99,9 @@ function deleteRecord(Application $app, $lst, $del_children)
function whatCanIDelete(Application $app, $lst)
{
$appbox = $app['phraseanet.appbox'];
$usr_id = $app['phraseanet.user']->get_id();
$conn = $appbox->get_connection();
$conn = $app['phraseanet.appbox']->get_connection();
$nbdocsel = 0;
$nbgrp = 0;

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,12 +7,11 @@ class mail
public static function mail_test(Application $app, $email)
{
$registry = $app['phraseanet.registry'];
$from = array('email' => $registry->get('GV_defaulmailsenderaddr'), 'name' => $registry->get('GV_defaulmailsenderaddr'));
$from = array('email' => $app['phraseanet.registry']->get('GV_defaulmailsenderaddr'), 'name' => $app['phraseanet.registry']->get('GV_defaulmailsenderaddr'));
$subject = _('mail:: test d\'envoi d\'email');
$message = sprintf(_('Ce mail est un test d\'envoi de mail depuis %s'), $registry->get('GV_ServerName'));
$message = sprintf(_('Ce mail est un test d\'envoi de mail depuis %s'), $app['phraseanet.registry']->get('GV_ServerName'));
$to = array('email' => $email, 'name' => $email);
@@ -72,8 +71,7 @@ class mail
public static function register_confirm(Application $app, $email, $accept, $deny)
{
$registry = $app['phraseanet.registry'];
$subject = sprintf(_('login::register:email: Votre compte %s'), $registry->get('GV_homeTitle'));
$subject = sprintf(_('login::register:email: Votre compte %s'), $app['phraseanet.registry']->get('GV_homeTitle'));
$body = '<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)
{
$registry = $app['phraseanet.registry'];
$date = new DateTime('1 day');
$token = random::getUrlToken($app, \random::TYPE_EMAIL, $usr_id, $date, $email);
$url = $registry->get('GV_ServerName') . 'account/reset-email/?token=' . $token;
$url = $app['phraseanet.registry']->get('GV_ServerName') . 'account/reset-email/?token=' . $token;
$subject = _('login::register: sujet email : confirmation de votre adresse email');
@@ -109,8 +106,7 @@ class mail
public static function change_mail_information(Application $app, $display_name, $old_email, $new_email)
{
$registry = $app['phraseanet.registry'];
$subject = sprintf(_('Update of your email address on %s'), $registry->get('GV_homeTitle'));
$subject = sprintf(_('Update of your email address on %s'), $app['phraseanet.registry']->get('GV_homeTitle'));
$body = "<div>" . sprintf(_('Dear %s,'), $display_name) . "</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)
{
$registry = $app['phraseanet.registry'];
$subject = sprintf(_('Your account on %s'), $registry->get('GV_homeTitle'));
$subject = sprintf(_('Your account on %s'), $app['phraseanet.registry']->get('GV_homeTitle'));
$body = "<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";
@@ -149,13 +143,11 @@ class mail
public static function mail_confirm_registered(Application $app, $email)
{
$registry = $app['phraseanet.registry'];
$subject = _('login::register: sujet email : confirmation de votre adresse email');
$body = "<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 .= "<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);
@@ -183,14 +175,13 @@ class mail
public static function mail_confirmation(Application $app, $email, $usr_id)
{
$registry = $app['phraseanet.registry'];
$expire = new DateTime('+3 days');
$token = random::getUrlToken($app, \random::TYPE_PASSWORD, $usr_id, $expire, $email);
$subject = _('login::register: sujet email : confirmation de votre adresse email');
$body = "<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);
@@ -204,8 +195,6 @@ class mail
public static function send_mail(Application $app, $subject, $body, $to, $from = false, $files = array(), $reading_confirm_to = false)
{
$registry = $app['phraseanet.registry'];
if ( ! isset($to['email']) || ! PHPMailer::ValidateAddress($to['email'])) {
return false;
}
@@ -216,7 +205,7 @@ class mail
$body .= '<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 .= '<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 = str_replace('https://', 'http://', $body);
@@ -225,23 +214,21 @@ class mail
$mail->CharSet = 'utf-8';
$mail->Encoding = 'base64'; //'quoted-printable';
$registry = $app['phraseanet.registry'];
if ($registry->get('GV_smtp')) {
if ($app['phraseanet.registry']->get('GV_smtp')) {
$mail->IsSMTP();
if ($registry->get('GV_smtp_host') != '')
$mail->Host = $registry->get('GV_smtp_host');
if ($app['phraseanet.registry']->get('GV_smtp_host') != '')
$mail->Host = $app['phraseanet.registry']->get('GV_smtp_host');
if ($registry->get('GV_smtp_auth')) {
if ($app['phraseanet.registry']->get('GV_smtp_auth')) {
$mail->SMTPAuth = true;
if ($registry->get('GV_smtp_secure') === true) {
if ($app['phraseanet.registry']->get('GV_smtp_secure') === true) {
$mail->SMTPSecure = "ssl";
}
$mail->Host = $registry->get('GV_smtp_host');
$mail->Port = $registry->get('GV_smtp_port');
$mail->Username = $registry->get('GV_smtp_user');
$mail->Password = $registry->get('GV_smtp_password');
$mail->Host = $app['phraseanet.registry']->get('GV_smtp_host');
$mail->Port = $app['phraseanet.registry']->get('GV_smtp_port');
$mail->Username = $app['phraseanet.registry']->get('GV_smtp_user');
$mail->Password = $app['phraseanet.registry']->get('GV_smtp_password');
}
}
@@ -250,7 +237,7 @@ class mail
$mail->AddAddress($to['email'], $to['name']);
$mail->SetFrom($registry->get('GV_defaulmailsenderaddr'), $registry->get('GV_homeTitle'));
$mail->SetFrom($app['phraseanet.registry']->get('GV_defaulmailsenderaddr'), $app['phraseanet.registry']->get('GV_homeTitle'));
$mail->Subject = $subject;

View File

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

View File

@@ -22,13 +22,12 @@ class module_client
public function getLanguage(Application $app, $lng)
{
$registry = $app['phraseanet.registry'];
$out = array();
$out['createWinInvite'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?');
$out['chuNameEmpty'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?');
$out['noDLok'] = _('export:: aucun document n\'est disponible au telechargement');
$out['confirmRedirectAuth'] = _('invite:: Redirection vers la zone d\'authentification, cliquez sur OK pour continuer ou annulez');
$out['serverName'] = $registry->get('GV_ServerName');
$out['serverName'] = $app['phraseanet.registry']->get('GV_ServerName');
$out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique');
$out['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
$out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier');

View File

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

View File

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

View File

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

View File

@@ -54,10 +54,8 @@ class module_console_fieldsMerge extends Command
{
$output->writeln("");
$appbox = $this->getService('phraseanet.appbox');
try {
$databox = $appbox->get_databox((int) $input->getArgument('sbas_id'));
$databox = $this->getService('phraseanet.appbox')->get_databox((int) $input->getArgument('sbas_id'));
} catch (\Exception $e) {
$output->writeln("<error>Invalid databox id </error>");

View File

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

View File

@@ -41,9 +41,6 @@ class module_console_sphinxGenerateSuggestion extends Command
define('FREQ_THRESHOLD', 10);
define('SUGGEST_DEBUG', 0);
$appbox = $this->getService('phraseanet.appbox');
$registry = $this->container['phraseanet.registry'];
$params = phrasea::sbas_params($this->container);
foreach ($params as $sbas_id => $p) {
@@ -55,9 +52,9 @@ class module_console_sphinxGenerateSuggestion extends Command
)
);
$tmp_file = $registry->get('GV_RootPath') . 'tmp/dict' . $index . '.txt';
$tmp_file = $this->container['phraseanet.registry']->get('GV_RootPath') . 'tmp/dict' . $index . '.txt';
$databox = $appbox->get_databox($sbas_id);
$databox = $this->getService('phraseanet.appbox')->get_databox($sbas_id);
$output->writeln("process Databox " . $databox->get_viewname() . " / $index\n");

View File

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

View File

@@ -52,7 +52,7 @@ class module_console_systemConfigCheck extends Command
$registry = $this->container['phraseanet.registry'];
$output->writeln(_('*** CHECK BINARY CONFIGURATION ***'));
$ok = $this->processConstraints(setup::check_binaries($registry), $output) && $ok;
$ok = $this->processConstraints(setup::check_binaries($this->container['phraseanet.registry']), $output) && $ok;
$output->writeln("");
} else {
$registry = new Setup_Registry();

View File

@@ -128,13 +128,11 @@ class module_console_systemExport extends Command
$output->writeln("Export datas from selected base_ids");
}
$appbox = $this->getService('phraseanet.appbox');
$total = $errors = 0;
$unicode = new \unicode();
foreach ($appbox->get_databoxes() as $databox) {
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
$output->writeln(sprintf("Processing <info>%s</info>", $databox->get_viewname()));
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)
{
$appbox = $this->getService('phraseanet.appbox');
$output->writeln("Processing...");
$bad_users = User_Adapter::get_wrong_email_users($this->container);
foreach ($bad_users as $email => $users) {
if ($input->getOption('list')) {
$this->write_infos($email, $users, $output, $appbox);
} elseif ($this->manage_group($email, $users, $output, $appbox) === false) {
$this->write_infos($email, $users, $output, $this->getService('phraseanet.appbox'));
} elseif ($this->manage_group($email, $users, $output, $this->getService('phraseanet.appbox')) === false) {
break;
}

View File

@@ -98,15 +98,14 @@ class module_console_systemUpgrade extends Command
if ($continue == 'y') {
try {
$output->write('<info>Upgrading...</info>', true);
$appbox = $this->getService('phraseanet.appbox');
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>'));
}
$upgrader = new Setup_Upgrade($appbox, $input->getOption('force'));
$upgrader = new Setup_Upgrade($this->getService('phraseanet.appbox'), $input->getOption('force'));
$appbox->forceUpgrade($upgrader);
$this->getService('phraseanet.appbox')->forceUpgrade($upgrader);
foreach ($upgrader->getRecommendations() as $recommendation) {
list($message, $command) = $recommendation;

View File

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

View File

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

View File

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

View File

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

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)
{
$conn = connection::getPDOConnection($app, $sbas_id);
$registry = $app['phraseanet.registry'];
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
$params = array(':site_id' => $registry->get('GV_sit'));
$params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit'));
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
$finalfilter = $datefilter['sql'] . ' AND ';

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

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

View File

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

View File

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

View File

@@ -70,12 +70,10 @@ class patch_320aa implements patchInterface
define('GV_sphinx_rt_host', '');
define('GV_sphinx_rt_port', '');
$registry = $app['phraseanet.registry'];
foreach ($GV as $section => $datas_section) {
foreach ($datas_section['vars'] as $datas) {
$registry->un_set($datas['name']);
$app['phraseanet.registry']->un_set($datas['name']);
eval('$test = defined("' . $datas["name"] . '");');
if ( ! $test) {
continue;
@@ -97,10 +95,10 @@ class patch_320aa implements patchInterface
$type = registry::TYPE_STRING;
break;
}
$registry->set($datas['name'], $val, $type);
$app['phraseanet.registry']->set($datas['name'], $val, $type);
}
}
$registry->un_set('registry_loaded');
$app['phraseanet.registry']->un_set('registry_loaded');
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,7 +11,6 @@ require_once __DIR__ . '/../../../../vendor/sphinx/sphinxapi.php';
*/
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration;
/**
*
@@ -59,12 +58,11 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
public function __construct(Application $app)
{
$this->app = $app;
$registry = $this->app['phraseanet.registry'];
$this->sphinx = new SphinxClient ();
$this->sphinx->SetArrayResult(true);
$this->sphinx->SetServer($registry->get('GV_sphinx_host'), (int) $registry->get('GV_sphinx_port'));
$this->sphinx->SetServer($this->app['phraseanet.registry']->get('GV_sphinx_host'), (int) $this->app['phraseanet.registry']->get('GV_sphinx_port'));
$this->sphinx->SetConnectTimeout(1);
return $this;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -8,10 +8,8 @@
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Core\Configuration;
use Alchemy\Phrasea\Metadata\Tag as PhraseaTag;
use Alchemy\Phrasea\Border\Attribute as BorderAttribute;
use MediaVorus\MediaVorus;
use PHPExiftool\Driver\Metadata\Metadata;
use PHPExiftool\Driver\Metadata\MetadataBag;
use Symfony\Component\Filesystem\Exception\IOException;
@@ -197,8 +195,6 @@ class task_period_archive extends task_abstract
*/
public function getInterfaceHTML()
{
$appbox = $this->dependencyContainer['phraseanet.appbox'];
ob_start();
?>
<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">
<option value="">...</option>
<?php
foreach ($appbox->get_databoxes() as $databox) {
foreach ($this->dependencyContainer['phraseanet.appbox']->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
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;
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$conn = $appbox->get_connection();
$conn = $this->dependencyContainer['phraseanet.appbox']->get_connection();
$this->sxTaskSettings = simplexml_load_string($this->settings);
@@ -275,7 +270,7 @@ class task_period_archive extends task_abstract
return 'tostop';
}
$databox = $appbox->get_databox($this->sbas_id);
$databox = $this->dependencyContainer['phraseanet.appbox']->get_databox($this->sbas_id);
$this->TColls = array();
$collection = null;
@@ -498,9 +493,8 @@ class task_period_archive extends task_abstract
{
clearstatcache();
$appbox = $this->dependencyContainer['phraseanet.appbox'];
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)));
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)
{
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$xpath = new DOMXPath($dom);
// 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 ( ! ($rep = $node->getAttribute('grp_representation'))) {
$registry = $this->dependencyContainer['phraseanet.registry'];
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) {
$this->log($e->getMessage());
}
@@ -1461,7 +1452,7 @@ class task_period_archive extends task_abstract
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);
if ($captionFileName === null) {
$story = $this->createStory($collection, $path . '/' . $representationFileName, null);
@@ -1831,7 +1822,6 @@ class task_period_archive extends task_abstract
{
$ret = false;
$appbox = $this->dependencyContainer['phraseanet.appbox'];
$file = $node->getAttribute('name');
$cid = $node->getAttribute('cid');
$captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null;
@@ -1862,7 +1852,7 @@ class task_period_archive extends task_abstract
}
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);
if ($captionFileName === null) {

View File

@@ -435,8 +435,7 @@ class task_period_cindexer extends task_abstract
$args_nopwd[] = '--run';
}
$registry = $this->dependencyContainer['phraseanet.registry'];
$logdir = p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
$logdir = p4string::addEndSlash($this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'logs');
$this->new_status = NULL; // new status to set 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)
{
$conn = $appbox->get_connection();
$registry = $app['phraseanet.registry'];
$id = $ftp_export['id'];
$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) {
$this->logger->addDebug("Unable to create session");
continue;
return;
}
if ( ! ($ph_session = phrasea_open_session($ses_id, $usr_id))) {
$this->logger->addDebug("Unable to open session");
phrasea_close_session($ses_id);
continue;
return;
}
try {
@@ -417,14 +416,14 @@ class task_period_ftp extends task_appboxAbstract
if ($subdef == 'caption') {
$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) {
throw new Exception('Impossible de creer un fichier temporaire');
}
} elseif ($subdef == 'caption-yaml') {
$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) {
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";
}
$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);
@@ -604,7 +603,6 @@ class task_period_ftp extends task_appboxAbstract
public function send_mails(appbox $appbox, $id)
{
$conn = $appbox->get_connection();
$registry = $this->dependencyContainer['phraseanet.registry'];
$sql = 'SELECT filename, base_id, record_id, subdef, error, done'
. ' FROM ftp_export_elements WHERE ftp_export_id = :export_id';
@@ -671,7 +669,7 @@ class task_period_ftp extends task_appboxAbstract
$subject = sprintf(
_('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);

View File

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

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