Normalize request calls

This commit is contained in:
Romain Neutron
2012-08-23 11:46:20 +02:00
parent 299e920adc
commit 0f7056dfed
31 changed files with 341 additions and 341 deletions

View File

@@ -310,7 +310,7 @@ return call_user_func(
$output = array('error' => true, 'datas' => _('Erreur lors de l\'enregistrement des donnees')); $output = array('error' => true, 'datas' => _('Erreur lors de l\'enregistrement des donnees'));
$request = $app['request']; $request = $app['request'];
$note = $request->get('note'); $note = $request->request->get('note');
if (is_null($note)) { if (is_null($note)) {
Return new Response('You must provide a note value', 400); Return new Response('You must provide a note value', 400);
@@ -349,7 +349,7 @@ return call_user_func(
$app->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function(SilexApplication $app, $sselcont_id) { $app->post('/ajax/SET_ELEMENT_AGREEMENT/{sselcont_id}/', function(SilexApplication $app, $sselcont_id) {
$request = $app['request']; $request = $app['request'];
$agreement = $request->get('agreement'); $agreement = $request->request->get('agreement');
if (is_null($agreement)) { if (is_null($agreement)) {
Return new Response('You must provide an agreement value', 400); Return new Response('You must provide an agreement value', 400);

View File

@@ -33,7 +33,7 @@ class Description implements ControllerProviderInterface
$controllers->get('/metadatas/search/', function(Application $app, Request $request) { $controllers->get('/metadatas/search/', function(Application $app, Request $request) {
$term = trim(strtolower($request->get('term'))); $term = trim(strtolower($request->query->get('term')));
$res = array(); $res = array();
if ($term) { if ($term) {
@@ -162,35 +162,35 @@ class Description implements ControllerProviderInterface
$databox->get_connection()->beginTransaction(); $databox->get_connection()->beginTransaction();
try { try {
if (is_array($request->get('field_ids'))) { if (is_array($request->request->get('field_ids'))) {
foreach ($request->get('field_ids') as $id) { foreach ($request->request->get('field_ids') as $id) {
try { try {
$field = \databox_field::get_instance($databox, $id); $field = \databox_field::get_instance($databox, $id);
$field->set_name($request->get('name_' . $id)) $field->set_name($request->request->get('name_' . $id))
->set_thumbtitle($request->get('thumbtitle_' . $id)) ->set_thumbtitle($request->request->get('thumbtitle_' . $id))
->set_tag(\databox_field::loadClassFromTagName($request->get('src_' . $id))) ->set_tag(\databox_field::loadClassFromTagName($request->request->get('src_' . $id)))
->set_business($request->get('business_' . $id)) ->set_business($request->request->get('business_' . $id))
->set_indexable($request->get('indexable_' . $id)) ->set_indexable($request->request->get('indexable_' . $id))
->set_required($request->get('required_' . $id)) ->set_required($request->request->get('required_' . $id))
->set_separator($request->get('separator_' . $id)) ->set_separator($request->request->get('separator_' . $id))
->set_readonly($request->get('readonly_' . $id)) ->set_readonly($request->request->get('readonly_' . $id))
->set_type($request->get('type_' . $id)) ->set_type($request->request->get('type_' . $id))
->set_tbranch($request->get('tbranch_' . $id)) ->set_tbranch($request->request->get('tbranch_' . $id))
->set_report($request->get('report_' . $id)) ->set_report($request->request->get('report_' . $id))
->setVocabularyControl(null) ->setVocabularyControl(null)
->setVocabularyRestricted(false); ->setVocabularyRestricted(false);
try { try {
$vocabulary = VocabularyController::get($request->get('vocabulary_' . $id)); $vocabulary = VocabularyController::get($request->request->get('vocabulary_' . $id));
$field->setVocabularyControl($vocabulary); $field->setVocabularyControl($vocabulary);
$field->setVocabularyRestricted($request->get('vocabularyrestricted_' . $id)); $field->setVocabularyRestricted($request->request->get('vocabularyrestricted_' . $id));
} catch (\Exception $e) { } catch (\Exception $e) {
} }
$dces_element = null; $dces_element = null;
$class = 'databox_Field_DCES_' . $request->get('dces_' . $id); $class = 'databox_Field_DCES_' . $request->request->get('dces_' . $id);
if (class_exists($class)) { if (class_exists($class)) {
$dces_element = new $class(); $dces_element = new $class();
} }
@@ -202,12 +202,13 @@ class Description implements ControllerProviderInterface
} }
} }
if ($request->get('newfield')) { if ($request->request->get('newfield')) {
$field = \databox_field::create($databox, $request->get('newfield'), $request->get('newfield_multi')); $field = \databox_field::create($databox, $request->request->get('newfield'), $request->request->get('newfield_multi'));
} }
if (is_array($request->get('todelete_ids'))) {
foreach ($request->get('todelete_ids') as $id) { if (is_array($request->request->get('todelete_ids'))) {
foreach ($request->request->get('todelete_ids') as $id) {
try { try {
$field = \databox_field::get_instance($databox, $id); $field = \databox_field::get_instance($databox, $id);
$field->delete(); $field->delete();
@@ -225,7 +226,7 @@ class Description implements ControllerProviderInterface
return $app->redirect('/admin/description/' . $sbas_id . '/'); return $app->redirect('/admin/description/' . $sbas_id . '/');
})->before(function(Request $request) use ($app) { })->before(function(Request $request) use ($app) {
if (false === $app['phraseanet.core']->getAuthenticatedUser()->ACL() if (false === $app['phraseanet.core']->getAuthenticatedUser()->ACL()
->has_right_on_sbas($request->get('sbas_id'), 'bas_modify_struct')) { ->has_right_on_sbas($request->attributes->get('sbas_id'), 'bas_modify_struct')) {
throw new AccessDeniedHttpException('You are not allowed to access this zone'); throw new AccessDeniedHttpException('You are not allowed to access this zone');
} }
})->assert('sbas_id', '\d+'); })->assert('sbas_id', '\d+');
@@ -244,7 +245,7 @@ class Description implements ControllerProviderInterface
return new Response($app['twig']->render('admin/databox/doc_structure.html.twig', $params)); return new Response($app['twig']->render('admin/databox/doc_structure.html.twig', $params));
})->before(function(Request $request) use ($app) { })->before(function(Request $request) use ($app) {
if (false === $app['phraseanet.core']->getAuthenticatedUser()->ACL() if (false === $app['phraseanet.core']->getAuthenticatedUser()->ACL()
->has_right_on_sbas($request->get('sbas_id'), 'bas_modify_struct')) { ->has_right_on_sbas($request->attributes->get('sbas_id'), 'bas_modify_struct')) {
throw new AccessDeniedHttpException('You are not allowed to access this zone'); throw new AccessDeniedHttpException('You are not allowed to access this zone');
} }
})->assert('sbas_id', '\d+'); })->assert('sbas_id', '\d+');

View File

@@ -30,9 +30,9 @@ class Fields implements ControllerProviderInterface
$controllers->get('/checkmulti/', function(PhraseaApplication $app, Request $request) { $controllers->get('/checkmulti/', function(PhraseaApplication $app, Request $request) {
$multi = ($request->get('multi') === 'true'); $multi = ($request->query->get('multi') === 'true');
$tag = \databox_field::loadClassFromTagName($request->get('source')); $tag = \databox_field::loadClassFromTagName($request->query->get('source'));
$datas = array( $datas = array(
'result' => ($multi === $tag->isMulti()), 'result' => ($multi === $tag->isMulti()),
@@ -43,9 +43,9 @@ class Fields implements ControllerProviderInterface
}); });
$controllers->get('/checkreadonly/', function(PhraseaApplication $app, Request $request) { $controllers->get('/checkreadonly/', function(PhraseaApplication $app, Request $request) {
$readonly = ($request->get('readonly') === 'true'); $readonly = ($request->query->get('readonly') === 'true');
$tag = \databox_field::loadClassFromTagName($request->get('source')); $tag = \databox_field::loadClassFromTagName($request->query->get('source'));
$datas = array( $datas = array(
'result' => ($readonly !== $tag->isWritable()), 'result' => ($readonly !== $tag->isWritable()),

View File

@@ -43,13 +43,13 @@ class Publications implements ControllerProviderInterface
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
$feed = \Feed_Adapter::create( $feed = \Feed_Adapter::create(
$app['phraseanet.appbox'], $user, $request->get('title'), $request->get('subtitle') $app['phraseanet.appbox'], $user, $request->request->get('title'), $request->request->get('subtitle')
); );
if ($request->get('public') == '1') { if ($request->request->get('public') == '1') {
$feed->set_public(true); $feed->set_public(true);
} elseif ($request->get('base_id')) { } elseif ($request->request->get('base_id')) {
$feed->set_collection(\collection::get_from_base_id($request->get('base_id'))); $feed->set_collection(\collection::get_from_base_id($request->request->get('base_id')));
} }
return $app->redirect('/admin/publications/list/'); return $app->redirect('/admin/publications/list/');
@@ -59,7 +59,7 @@ class Publications implements ControllerProviderInterface
$feed = new \Feed_Adapter($app['phraseanet.appbox'], $id); $feed = new \Feed_Adapter($app['phraseanet.appbox'], $id);
return $app['twig'] return $app['twig']
->render('admin/publications/fiche.html.twig', array('feed' => $feed, 'error' => $app['request']->get('error'))); ->render('admin/publications/fiche.html.twig', array('feed' => $feed, 'error' => $app['request']->query->get('error')));
})->assert('id', '\d+'); })->assert('id', '\d+');
$controllers->post('/feed/{id}/update/', function(PhraseaApplication $app, Request $request, $id) { $controllers->post('/feed/{id}/update/', function(PhraseaApplication $app, Request $request, $id) {
@@ -67,22 +67,22 @@ class Publications implements ControllerProviderInterface
$feed = new \Feed_Adapter($app['phraseanet.appbox'], $id); $feed = new \Feed_Adapter($app['phraseanet.appbox'], $id);
try { try {
$collection = \collection::get_from_base_id($request->get('base_id')); $collection = \collection::get_from_base_id($request->request->get('base_id'));
} catch (\Exception $e) { } catch (\Exception $e) {
$collection = null; $collection = null;
} }
$feed->set_title($request->get('title')); $feed->set_title($request->request->get('title'));
$feed->set_subtitle($request->get('subtitle')); $feed->set_subtitle($request->request->get('subtitle'));
$feed->set_collection($collection); $feed->set_collection($collection);
$feed->set_public($request->get('public')); $feed->set_public($request->request->get('public'));
return $app->redirect('/admin/publications/list/'); return $app->redirect('/admin/publications/list/');
})->before(function(Request $request) use ($app) { })->before(function(Request $request) use ($app) {
$feed = new \Feed_Adapter($app['phraseanet.appbox'], $request->get('id')); $feed = new \Feed_Adapter($app['phraseanet.appbox'], $request->attributes->get('id'));
if ( ! $feed->is_owner($app['phraseanet.core']->getAuthenticatedUser())) { if ( ! $feed->is_owner($app['phraseanet.core']->getAuthenticatedUser())) {
return $app->redirect('/admin/publications/feed/' . $request->get('id') . '/?error=' . _('You are not the owner of this feed, you can not edit it')); return $app->redirect('/admin/publications/feed/' . $request->attributes->get('id') . '/?error=' . _('You are not the owner of this feed, you can not edit it'));
} }
}) })
->assert('id', '\d+'); ->assert('id', '\d+');
@@ -162,7 +162,7 @@ class Publications implements ControllerProviderInterface
$error = ''; $error = '';
try { try {
$request = $app['request']; $request = $app['request'];
$user = \User_Adapter::getInstance($request->get('usr_id'), $app['phraseanet.appbox']); $user = \User_Adapter::getInstance($request->request->get('usr_id'), $app['phraseanet.appbox']);
$feed = new \Feed_Adapter($app['phraseanet.appbox'], $id); $feed = new \Feed_Adapter($app['phraseanet.appbox'], $id);
$feed->add_publisher($user); $feed->add_publisher($user);
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -177,7 +177,7 @@ class Publications implements ControllerProviderInterface
$request = $app['request']; $request = $app['request'];
$feed = new \Feed_Adapter($app['phraseanet.appbox'], $id); $feed = new \Feed_Adapter($app['phraseanet.appbox'], $id);
$publisher = new \Feed_Publisher_Adapter($app['phraseanet.appbox'], $request->get('publisher_id')); $publisher = new \Feed_Publisher_Adapter($app['phraseanet.appbox'], $request->request->get('publisher_id'));
$user = $publisher->get_user(); $user = $publisher->get_user();
if ($feed->is_publisher($user) === true && $feed->is_owner($user) === false) if ($feed->is_publisher($user) === true && $feed->is_owner($user) === false)
$publisher->delete(); $publisher->delete();

View File

@@ -41,7 +41,7 @@ class Root implements ControllerProviderInterface
\User_Adapter::updateClientInfos(3); \User_Adapter::updateClientInfos(3);
$section = $request->get('section', false); $section = $request->query->get('section', false);
$available = array( $available = array(
'connected' 'connected'
@@ -83,7 +83,7 @@ class Root implements ControllerProviderInterface
'module' => 'admin' 'module' => 'admin'
, 'events' => \eventsmanager_broker::getInstance($appbox, $Core) , 'events' => \eventsmanager_broker::getInstance($appbox, $Core)
, 'module_name' => 'Admin' , 'module_name' => 'Admin'
, 'notice' => $request->get("notice") , 'notice' => $request->query->get("notice")
, 'feature' => $feature , 'feature' => $feature
, 'featured' => $featured , 'featured' => $featured
, 'databoxes' => $databoxes , 'databoxes' => $databoxes

View File

@@ -42,9 +42,9 @@ class Subdefs implements ControllerProviderInterface
})->assert('sbas_id', '\d+'); })->assert('sbas_id', '\d+');
$controllers->post('/{sbas_id}/', function(Application $app, Request $request, $sbas_id) { $controllers->post('/{sbas_id}/', function(Application $app, Request $request, $sbas_id) {
$delete_subdef = $request->get('delete_subdef'); $delete_subdef = $request->request->get('delete_subdef');
$toadd_subdef = $request->get('add_subdef'); $toadd_subdef = $request->request->get('add_subdef');
$Parmsubdefs = $request->get('subdefs', array()); $Parmsubdefs = $request->request->get('subdefs', array());
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
@@ -86,13 +86,13 @@ class Subdefs implements ControllerProviderInterface
$group = array_shift($post_sub_ex); $group = array_shift($post_sub_ex);
$name = implode('_', $post_sub_ex); $name = implode('_', $post_sub_ex);
$class = $request->get($post_sub . '_class'); $class = $request->request->get($post_sub . '_class');
$downloadable = $request->get($post_sub . '_downloadable'); $downloadable = $request->request->get($post_sub . '_downloadable');
$defaults = array('path', 'meta', 'mediatype'); $defaults = array('path', 'meta', 'mediatype');
foreach ($defaults as $def) { foreach ($defaults as $def) {
$parm_loc = $request->get($post_sub . '_' . $def); $parm_loc = $request->request->get($post_sub . '_' . $def);
if ($def == 'meta' && ! $parm_loc) { if ($def == 'meta' && ! $parm_loc) {
$parm_loc = "no"; $parm_loc = "no";
@@ -101,8 +101,8 @@ class Subdefs implements ControllerProviderInterface
$options[$def] = $parm_loc; $options[$def] = $parm_loc;
} }
$mediatype = $request->get($post_sub . '_mediatype'); $mediatype = $request->request->get($post_sub . '_mediatype');
$media = $request->get($post_sub . '_' . $mediatype, array()); $media = $request->request->get($post_sub . '_' . $mediatype, array());
foreach ($media as $option => $value) { foreach ($media as $option => $value) {

View File

@@ -76,7 +76,7 @@ class Users implements ControllerProviderInterface
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']); $rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
$rights->apply_rights(); $rights->apply_rights();
if ($app['request']->get('template')) { if ($app['request']->request->get('template')) {
$rights->apply_template(); $rights->apply_template();
} }
@@ -216,11 +216,11 @@ class Users implements ControllerProviderInterface
$user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
$like_value = $request->get('term'); $like_value = $request->query->get('term');
$rights = $request->get('filter_rights') ? : array(); $rights = $request->query->get('filter_rights') ? : array();
$have_right = $request->get('have_right') ? : array(); $have_right = $request->query->get('have_right') ? : array();
$have_not_right = $request->get('have_not_right') ? : array(); $have_not_right = $request->query->get('have_not_right') ? : array();
$on_base = $request->get('on_base') ? : array(); $on_base = $request->query->get('on_base') ? : array();
$elligible_users = $user_query $elligible_users = $user_query
->on_sbas_where_i_am($user->ACL(), $rights) ->on_sbas_where_i_am($user->ACL(), $rights)
@@ -255,7 +255,7 @@ class Users implements ControllerProviderInterface
try { try {
$request = $app['request']; $request = $app['request'];
$module = new UserHelper\Manage($app['phraseanet.core'], $app['request']); $module = new UserHelper\Manage($app['phraseanet.core'], $app['request']);
if ($request->get('template') == '1') { if ($request->request->get('template') == '1') {
$user = $module->create_template(); $user = $module->create_template();
} else { } else {
$user = $module->create_newuser(); $user = $module->create_newuser();
@@ -278,10 +278,10 @@ class Users implements ControllerProviderInterface
$user_query = new \User_Query($appbox, $app['phraseanet.core']); $user_query = new \User_Query($appbox, $app['phraseanet.core']);
$user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
$like_value = $request->get('like_value'); $like_value = $request->request->get('like_value');
$like_field = $request->get('like_field'); $like_field = $request->request->get('like_field');
$on_base = $request->get('base_id') ? : null; $on_base = $request->request->get('base_id') ? : null;
$on_sbas = $request->get('sbas_id') ? : null; $on_sbas = $request->request->get('sbas_id') ? : null;
$elligible_users = $user_query->on_bases_where_i_am($user->ACL(), array('canadmin')) $elligible_users = $user_query->on_bases_where_i_am($user->ACL(), array('canadmin'))
->like($like_field, $like_value) ->like($like_field, $like_value)

View File

@@ -145,7 +145,7 @@ class Basket implements ControllerProviderInterface
$params = array( $params = array(
'basket' => $basket, 'basket' => $basket,
'ordre' => $request->get('order') 'ordre' => $request->query->get('order')
); );
return $app['twig']->render('prod/WorkZone/Basket.html.twig', $params); return $app['twig']->render('prod/WorkZone/Basket.html.twig', $params);
@@ -160,9 +160,9 @@ class Basket implements ControllerProviderInterface
$Basket = new BasketEntity(); $Basket = new BasketEntity();
$Basket->setName($request->get('name', '')); $Basket->setName($request->request->get('name', ''));
$Basket->setOwner($app['phraseanet.core']->getAuthenticatedUser()); $Basket->setOwner($app['phraseanet.core']->getAuthenticatedUser());
$Basket->setDescription($request->get('desc')); $Basket->setDescription($request->request->get('desc'));
$em->persist($Basket); $em->persist($Basket);
@@ -264,8 +264,8 @@ class Basket implements ControllerProviderInterface
$basket = $em->getRepository('\Entities\Basket') $basket = $em->getRepository('\Entities\Basket')
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true); ->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
$basket->setName($request->get('name', '')); $basket->setName($request->request->get('name', ''));
$basket->setDescription($request->get('description')); $basket->setDescription($request->request->get('description'));
$em->merge($basket); $em->merge($basket);
$em->flush(); $em->flush();
@@ -320,7 +320,7 @@ class Basket implements ControllerProviderInterface
$basket = $em->getRepository('\Entities\Basket') $basket = $em->getRepository('\Entities\Basket')
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true); ->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
$order = $app['request']->get('element'); $order = $app['request']->request->get('element');
/* @var $basket \Entities\Basket */ /* @var $basket \Entities\Basket */
foreach ($basket->getElements() as $basketElement) { foreach ($basket->getElements() as $basketElement) {
@@ -347,7 +347,7 @@ class Basket implements ControllerProviderInterface
$basket = $em->getRepository('\Entities\Basket') $basket = $em->getRepository('\Entities\Basket')
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true); ->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
$archive_status = ! ! $request->get('archive'); $archive_status = ! ! $request->request->get('archive');
$basket->setArchived($archive_status); $basket->setArchived($archive_status);
@@ -439,7 +439,7 @@ class Basket implements ControllerProviderInterface
$n = 0; $n = 0;
foreach ($request->get('elements') as $bask_element_id) { foreach ($request->request->get('elements') as $bask_element_id) {
try { try {
$basket_element = $em->getRepository('\Entities\BasketElement') $basket_element = $em->getRepository('\Entities\BasketElement')
->findUserElement($bask_element_id, $user); ->findUserElement($bask_element_id, $user);

View File

@@ -114,7 +114,7 @@ class Bridge implements ControllerProviderInterface
})->assert('account_id', '\d+'); })->assert('account_id', '\d+');
$controllers->get('/adapter/{account_id}/load-records/', function(Application $app, $account_id) { $controllers->get('/adapter/{account_id}/load-records/', function(Application $app, $account_id) {
$page = max((int) $app['request']->get('page'), 0); $page = max((int) $app['request']->query->get('page'), 0);
$quantity = 10; $quantity = 10;
$offset_start = max(($page - 1) * $quantity, 0); $offset_start = max(($page - 1) * $quantity, 0);
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
@@ -127,8 +127,8 @@ class Bridge implements ControllerProviderInterface
'adapter_action' => 'load-records' 'adapter_action' => 'load-records'
, 'account' => $account , 'account' => $account
, 'elements' => $elements , 'elements' => $elements
, 'error_message' => $app['request']->get('error') , 'error_message' => $app['request']->query->get('error')
, 'notice_message' => $app['request']->get('notice') , 'notice_message' => $app['request']->query->get('notice')
); );
return new Response($app['twig']->render('prod/actions/Bridge/records_list.html.twig', $params)); return new Response($app['twig']->render('prod/actions/Bridge/records_list.html.twig', $params));
@@ -137,7 +137,7 @@ class Bridge implements ControllerProviderInterface
$controllers->get('/adapter/{account_id}/load-elements/{type}/' $controllers->get('/adapter/{account_id}/load-elements/{type}/'
, function($account_id, $type) use ($app) { , function($account_id, $type) use ($app) {
$page = max((int) $app['request']->get('page'), 0); $page = max((int) $app['request']->query->get('page'), 0);
$quantity = 5; $quantity = 5;
$offset_start = max(($page - 1) * $quantity, 0); $offset_start = max(($page - 1) * $quantity, 0);
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
@@ -152,8 +152,8 @@ class Bridge implements ControllerProviderInterface
, 'adapter_action' => 'load-elements' , 'adapter_action' => 'load-elements'
, 'account' => $account , 'account' => $account
, 'elements' => $elements , 'elements' => $elements
, 'error_message' => $app['request']->get('error') , 'error_message' => $app['request']->query->get('error')
, 'notice_message' => $app['request']->get('notice') , 'notice_message' => $app['request']->query->get('notice')
); );
return new Response($app['twig']->render('prod/actions/Bridge/element_list.html.twig', $params)); return new Response($app['twig']->render('prod/actions/Bridge/element_list.html.twig', $params));
@@ -163,7 +163,7 @@ class Bridge implements ControllerProviderInterface
$controllers->get('/adapter/{account_id}/load-containers/{type}/' $controllers->get('/adapter/{account_id}/load-containers/{type}/'
, function(Application $app, $account_id, $type) { , function(Application $app, $account_id, $type) {
$page = max((int) $app['request']->get('page'), 0); $page = max((int) $app['request']->query->get('page'), 0);
$quantity = 5; $quantity = 5;
$offset_start = max(($page - 1) * $quantity, 0); $offset_start = max(($page - 1) * $quantity, 0);
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
@@ -177,8 +177,8 @@ class Bridge implements ControllerProviderInterface
, 'adapter_action' => 'load-containers' , 'adapter_action' => 'load-containers'
, 'account' => $account , 'account' => $account
, 'elements' => $elements , 'elements' => $elements
, 'error_message' => $app['request']->get('error') , 'error_message' => $app['request']->query->get('error')
, 'notice_message' => $app['request']->get('notice') , 'notice_message' => $app['request']->query->get('notice')
); );
return new Response($app['twig']->render('prod/actions/Bridge/element_list.html.twig', $params)); return new Response($app['twig']->render('prod/actions/Bridge/element_list.html.twig', $params));
@@ -193,10 +193,10 @@ class Bridge implements ControllerProviderInterface
$app['require_connection']($account); $app['require_connection']($account);
$request = $app['request']; $request = $app['request'];
$elements = $request->get('elements_list', array()); $elements = $request->query->get('elements_list', array());
$elements = is_array($elements) ? $elements : explode(';', $elements); $elements = is_array($elements) ? $elements : explode(';', $elements);
$destination = $request->get('destination'); $destination = $request->query->get('destination');
$route_params = array(); $route_params = array();
$class = $account->get_api()->get_connector()->get_object_class_from_type($element_type); $class = $account->get_api()->get_connector()->get_object_class_from_type($element_type);
@@ -240,8 +240,8 @@ class Bridge implements ControllerProviderInterface
, 'constraint_errors' => null , 'constraint_errors' => null
, 'adapter_action' => $action , 'adapter_action' => $action
, 'elements' => $elements , 'elements' => $elements
, 'error_message' => $app['request']->get('error') , 'error_message' => $app['request']->query->get('error')
, 'notice_message' => $app['request']->get('notice') , 'notice_message' => $app['request']->query->get('notice')
); );
$params = array_merge($params, $route_params); $params = array_merge($params, $route_params);
@@ -259,10 +259,10 @@ class Bridge implements ControllerProviderInterface
$app['require_connection']($account); $app['require_connection']($account);
$request = $app['request']; $request = $app['request'];
$elements = $request->get('elements_list', array()); $elements = $request->request->get('elements_list', array());
$elements = is_array($elements) ? $elements : explode(';', $elements); $elements = is_array($elements) ? $elements : explode(';', $elements);
$destination = $request->get('destination'); $destination = $request->request->get('destination');
$class = $account->get_api()->get_connector()->get_object_class_from_type($element_type); $class = $account->get_api()->get_connector()->get_object_class_from_type($element_type);
$html = ''; $html = '';
@@ -288,7 +288,7 @@ class Bridge implements ControllerProviderInterface
, 'adapter_action' => $action , 'adapter_action' => $action
, 'error_message' => _('Request contains invalid datas') , 'error_message' => _('Request contains invalid datas')
, 'constraint_errors' => $errors , 'constraint_errors' => $errors
, 'notice_message' => $app['request']->get('notice') , 'notice_message' => $app['request']->request->get('notice')
); );
$template = 'prod/actions/Bridge/' . $account->get_api()->get_connector()->get_name() . '/' . $element_type . '_' . $action . ($destination ? '_' . $destination : '') . '.html.twig'; $template = 'prod/actions/Bridge/' . $account->get_api()->get_connector()->get_name() . '/' . $element_type . '_' . $action . ($destination ? '_' . $destination : '') . '.html.twig';
@@ -310,7 +310,7 @@ class Bridge implements ControllerProviderInterface
case 'createcontainer': case 'createcontainer':
try { try {
$container_type = $request->get('f_container_type'); $container_type = $request->request->get('f_container_type');
$account->get_api()->create_container($container_type, $app['request']); $account->get_api()->create_container($container_type, $app['request']);
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -323,7 +323,7 @@ class Bridge implements ControllerProviderInterface
break; break;
case 'moveinto': case 'moveinto':
try { try {
$container_id = $request->get('container_id'); $container_id = $request->request->get('container_id');
foreach ($elements as $element_id) { foreach ($elements as $element_id) {
$account->get_api()->add_element_to_container($element_type, $element_id, $destination, $container_id); $account->get_api()->add_element_to_container($element_type, $element_id, $destination, $container_id);
} }
@@ -357,7 +357,7 @@ class Bridge implements ControllerProviderInterface
$controllers->get('/upload/', function(Application $app) { $controllers->get('/upload/', function(Application $app) {
$request = $app['request']; $request = $app['request'];
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$account = \Bridge_Account::load_account($appbox, $request->get('account_id')); $account = \Bridge_Account::load_account($appbox, $request->query->get('account_id'));
$app['require_connection']($account); $app['require_connection']($account);
$route = new RecordHelper\Bridge($app['phraseanet.core'], $app['request']); $route = new RecordHelper\Bridge($app['phraseanet.core'], $app['request']);
@@ -367,8 +367,8 @@ class Bridge implements ControllerProviderInterface
$params = array( $params = array(
'route' => $route 'route' => $route
, 'account' => $account , 'account' => $account
, 'error_message' => $app['request']->get('error') , 'error_message' => $app['request']->query->get('error')
, 'notice_message' => $app['request']->get('notice') , 'notice_message' => $app['request']->query->get('notice')
, 'constraint_errors' => null , 'constraint_errors' => null
, 'adapter_action' => 'upload' , 'adapter_action' => 'upload'
); );
@@ -382,7 +382,7 @@ class Bridge implements ControllerProviderInterface
$errors = array(); $errors = array();
$request = $app['request']; $request = $app['request'];
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$account = \Bridge_Account::load_account($appbox, $request->get('account_id')); $account = \Bridge_Account::load_account($appbox, $request->request->get('account_id'));
$app['require_connection']($account); $app['require_connection']($account);
$route = new RecordHelper\Bridge($app['phraseanet.core'], $app['request']); $route = new RecordHelper\Bridge($app['phraseanet.core'], $app['request']);
@@ -404,7 +404,7 @@ class Bridge implements ControllerProviderInterface
, 'account' => $account , 'account' => $account
, 'error_message' => _('Request contains invalid datas') , 'error_message' => _('Request contains invalid datas')
, 'constraint_errors' => $errors , 'constraint_errors' => $errors
, 'notice_message' => $app['request']->get('notice') , 'notice_message' => $app['request']->request->get('notice')
, 'adapter_action' => 'upload' , 'adapter_action' => 'upload'
); );

View File

@@ -39,7 +39,7 @@ class Edit implements ControllerProviderInterface
$controllers->get('/vocabulary/{vocabulary}/', function(Application $app, Request $request, $vocabulary) { $controllers->get('/vocabulary/{vocabulary}/', function(Application $app, Request $request, $vocabulary) {
$datas = array('success' => false, 'message' => '', 'results' => array()); $datas = array('success' => false, 'message' => '', 'results' => array());
$sbas_id = (int) $request->get('sbas_id'); $sbas_id = (int) $request->query->get('sbas_id');
try { try {
if ($sbas_id === 0) { if ($sbas_id === 0) {
@@ -54,7 +54,7 @@ class Edit implements ControllerProviderInterface
return $app->json($datas); return $app->json($datas);
} }
$query = $request->get('query'); $query = $request->query->get('query');
$results = $VC->find($query, $app['phraseanet.core']->getAuthenticatedUser(), $databox); $results = $VC->find($query, $app['phraseanet.core']->getAuthenticatedUser(), $databox);

View File

@@ -46,13 +46,13 @@ class Feed implements ControllerProviderInterface
$controllers->post('/entry/create/', function(Application $app, Request $request) { $controllers->post('/entry/create/', function(Application $app, Request $request) {
try { try {
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
$feed = new \Feed_Adapter($app['phraseanet.appbox'], $request->get('feed_id')); $feed = new \Feed_Adapter($app['phraseanet.appbox'], $request->request->get('feed_id'));
$publisher = \Feed_Publisher_Adapter::getPublisher($app['phraseanet.appbox'], $feed, $user); $publisher = \Feed_Publisher_Adapter::getPublisher($app['phraseanet.appbox'], $feed, $user);
$title = $request->get('title'); $title = $request->request->get('title');
$subtitle = $request->get('subtitle'); $subtitle = $request->request->get('subtitle');
$author_name = $request->get('author_name'); $author_name = $request->request->get('author_name');
$author_mail = $request->get('author_mail'); $author_mail = $request->request->get('author_mail');
$entry = \Feed_Entry_Adapter::create($app['phraseanet.appbox'], $feed, $publisher, $title, $subtitle, $author_name, $author_mail); $entry = \Feed_Entry_Adapter::create($app['phraseanet.appbox'], $feed, $publisher, $title, $subtitle, $author_name, $author_mail);
@@ -99,10 +99,10 @@ class Feed implements ControllerProviderInterface
throw new \Exception_UnauthorizedAction(); throw new \Exception_UnauthorizedAction();
} }
$title = $request->get('title'); $title = $request->request->get('title');
$subtitle = $request->get('subtitle'); $subtitle = $request->request->get('subtitle');
$author_name = $request->get('author_name'); $author_name = $request->request->get('author_name');
$author_mail = $request->get('author_mail'); $author_mail = $request->request->get('author_mail');
$entry->set_author_email($author_mail) $entry->set_author_email($author_mail)
->set_author_name($author_name) ->set_author_name($author_name)
@@ -110,7 +110,7 @@ class Feed implements ControllerProviderInterface
->set_subtitle($subtitle); ->set_subtitle($subtitle);
$current_feed_id = $entry->get_feed()->get_id(); $current_feed_id = $entry->get_feed()->get_id();
$new_feed_id = $request->get('feed_id', $current_feed_id); $new_feed_id = $request->request->get('feed_id', $current_feed_id);
if ($current_feed_id != $new_feed_id) { if ($current_feed_id != $new_feed_id) {
try { try {
$new_feed = \Feed_Adapter::load_with_user($app['phraseanet.appbox'], $user, $new_feed_id); $new_feed = \Feed_Adapter::load_with_user($app['phraseanet.appbox'], $user, $new_feed_id);
@@ -125,7 +125,7 @@ class Feed implements ControllerProviderInterface
$entry->set_feed($new_feed); $entry->set_feed($new_feed);
} }
$items = explode(';', $request->get('sorted_lst')); $items = explode(';', $request->request->get('sorted_lst'));
foreach ($items as $item_sort) { foreach ($items as $item_sort) {
$item_sort_datas = explode('_', $item_sort); $item_sort_datas = explode('_', $item_sort);
@@ -190,7 +190,7 @@ class Feed implements ControllerProviderInterface
$controllers->get('/', function(Application $app, Request $request) { $controllers->get('/', function(Application $app, Request $request) {
$request = $app['request']; $request = $app['request'];
$page = (int) $request->get('page'); $page = (int) $request->query->get('page');
$page = $page > 0 ? $page : 1; $page = $page > 0 ? $page : 1;
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
@@ -209,7 +209,7 @@ class Feed implements ControllerProviderInterface
}); });
$controllers->get('/feed/{id}/', function(Application $app, Request $request, $id) { $controllers->get('/feed/{id}/', function(Application $app, Request $request, $id) {
$page = (int) $request->get('page'); $page = (int) $request->query->get('page');
$page = $page > 0 ? $page : 1; $page = $page > 0 ? $page : 1;
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
@@ -223,7 +223,7 @@ class Feed implements ControllerProviderInterface
})->assert('id', '\d+'); })->assert('id', '\d+');
$controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) { $controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) {
$renew = ($request->get('renew') === 'true'); $renew = ($request->query->get('renew') === 'true');
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
@@ -241,7 +241,7 @@ class Feed implements ControllerProviderInterface
}); });
$controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) { $controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) {
$renew = ($request->get('renew') === 'true'); $renew = ($request->query->get('renew') === 'true');
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
$feed = \Feed_Adapter::load_with_user($app['phraseanet.appbox'], $user, $id); $feed = \Feed_Adapter::load_with_user($app['phraseanet.appbox'], $user, $id);
$registry = $app['phraseanet.appbox']->get_registry(); $registry = $app['phraseanet.appbox']->get_registry();

View File

@@ -164,7 +164,7 @@ class Lazaret implements ControllerProviderInterface
$lazaretRepository = $em->getRepository('Entities\LazaretFile'); $lazaretRepository = $em->getRepository('Entities\LazaretFile');
$lazaretFiles = $lazaretRepository->findPerPage( $lazaretFiles = $lazaretRepository->findPerPage(
$baseIds, $request->get('offset', 0), $request->get('limit', 10) $baseIds, $request->query->get('offset', 0), $request->query->get('limit', 10)
); );
} }
@@ -227,11 +227,11 @@ class Lazaret implements ControllerProviderInterface
$ret = array('success' => false, 'message' => '', 'result' => array()); $ret = array('success' => false, 'message' => '', 'result' => array());
//Optional parameter //Optional parameter
$keepAttributes = ! ! $request->get('keep_attributes', false); $keepAttributes = ! ! $request->request->get('keep_attributes', false);
$attributesToKeep = $request->get('attributes', array()); $attributesToKeep = $request->request->get('attributes', array());
//Mandatory parameter //Mandatory parameter
if (null === $baseId = $request->get('bas_id')) { if (null === $baseId = $request->request->get('bas_id')) {
$ret['message'] = _('You must give a destination collection'); $ret['message'] = _('You must give a destination collection');
return $app->json($ret); return $app->json($ret);
@@ -386,7 +386,7 @@ class Lazaret implements ControllerProviderInterface
$ret = array('success' => false, 'message' => '', 'result' => array()); $ret = array('success' => false, 'message' => '', 'result' => array());
//Mandatory parameter //Mandatory parameter
if (null === $recordId = $request->get('record_id')) { if (null === $recordId = $request->request->get('record_id')) {
$ret['message'] = _('You must give a destination record'); $ret['message'] = _('You must give a destination record');
return $app->json($ret); return $app->json($ret);

View File

@@ -66,18 +66,18 @@ class MoveCollection implements ControllerProviderInterface
try { try {
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
if (null === $request->get('base_id')) { if (null === $request->request->get('base_id')) {
$datas['message'] = _('Missing target collection'); $datas['message'] = _('Missing target collection');
return $app->json($datas); return $app->json($datas);
} }
if ( ! $user->ACL()->has_right_on_base($request->get('base_id'), 'canaddrecord')) { if ( ! $user->ACL()->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) {
$datas['message'] = sprintf(_("You do not have the permission to move records to %s"), \phrasea::bas_names($move->getBaseIdDestination())); $datas['message'] = sprintf(_("You do not have the permission to move records to %s"), \phrasea::bas_names($move->getBaseIdDestination()));
return $app->json($datas); return $app->json($datas);
} }
try { try {
$collection = \collection::get_from_base_id($request->get('base_id')); $collection = \collection::get_from_base_id($request->request->get('base_id'));
} catch (\Exception_Databox_CollectionNotFound $e) { } catch (\Exception_Databox_CollectionNotFound $e) {
$datas['message'] = _('Invalid target collection'); $datas['message'] = _('Invalid target collection');
return $app->json($datas); return $app->json($datas);
@@ -86,7 +86,7 @@ class MoveCollection implements ControllerProviderInterface
foreach ($records as $record) { foreach ($records as $record) {
$record->move_to_collection($collection, $app['phraseanet.appbox']); $record->move_to_collection($collection, $app['phraseanet.appbox']);
if ($request->get("chg_coll_son") == "1") { if ($request->request->get("chg_coll_son") == "1") {
foreach ($record->get_children() as $child) { foreach ($record->get_children() as $child) {
if ($user->ACL()->has_right_on_base($child->get_base_id(), 'candeleterecord')) { if ($user->ACL()->has_right_on_base($child->get_base_id(), 'candeleterecord')) {
$child->move_to_collection($collection, $app['phraseanet.appbox']); $child->move_to_collection($collection, $app['phraseanet.appbox']);

View File

@@ -28,7 +28,7 @@ class MustacheLoader implements ControllerProviderInterface
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->get('/', function(Application $app, Request $request) { $controllers->get('/', function(Application $app, Request $request) {
$template_name = $request->get('template'); $template_name = $request->query->get('template');
if ( ! preg_match('/^[a-zA-Z0-9-_]+$/', $template_name)) { if ( ! preg_match('/^[a-zA-Z0-9-_]+$/', $template_name)) {
throw new \Exception_BadRequest('Wrong template name : ' . $template_name); throw new \Exception_BadRequest('Wrong template name : ' . $template_name);

View File

@@ -43,7 +43,7 @@ class Printer implements ControllerProviderInterface
$session = \Session_Handler::getInstance($app['phraseanet.appbox']); $session = \Session_Handler::getInstance($app['phraseanet.appbox']);
$layout = $request->get('lay'); $layout = $request->request->get('lay');
foreach ($printer->get_elements() as $record) { foreach ($printer->get_elements() as $record) {
$session->get_logger($record->get_databox()) $session->get_logger($record->get_databox())

View File

@@ -160,15 +160,15 @@ class Push implements ControllerProviderInterface
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$push_name = $request->get('name'); $push_name = $request->request->get('name');
if (trim($push_name) === '') { if (trim($push_name) === '') {
$push_name = sprintf(_('Push from %s'), $user->get_display_name()); $push_name = sprintf(_('Push from %s'), $user->get_display_name());
} }
$push_description = $request->get('push_description'); $push_description = $request->request->get('push_description');
$receivers = $request->get('participants'); $receivers = $request->request->get('participants');
if ( ! is_array($receivers) || count($receivers) === 0) { if ( ! is_array($receivers) || count($receivers) === 0) {
throw new ControllerException(_('No receivers specified')); throw new ControllerException(_('No receivers specified'));
@@ -233,8 +233,8 @@ class Push implements ControllerProviderInterface
, 'to_email' => $user_receiver->get_email() , 'to_email' => $user_receiver->get_email()
, 'to_name' => $user_receiver->get_display_name() , 'to_name' => $user_receiver->get_display_name()
, 'url' => $url , 'url' => $url
, 'accuse' => ! ! $request->get('recept', false) , 'accuse' => ! ! $request->request->get('recept', false)
, 'message' => $request->get('message') , 'message' => $request->request->get('message')
, 'ssel_id' => $Basket->getId() , 'ssel_id' => $Basket->getId()
); );
@@ -288,15 +288,15 @@ class Push implements ControllerProviderInterface
$repository = $em->getRepository('\Entities\Basket'); $repository = $em->getRepository('\Entities\Basket');
$validation_name = $request->get('name'); $validation_name = $request->request->get('name');
if (trim($validation_name) === '') { if (trim($validation_name) === '') {
$validation_name = sprintf(_('Validation from %s'), $user->get_display_name()); $validation_name = sprintf(_('Validation from %s'), $user->get_display_name());
} }
$validation_description = $request->get('validation_description'); $validation_description = $request->request->get('validation_description');
$participants = $request->get('participants'); $participants = $request->request->get('participants');
if ( ! is_array($participants) || count($participants) === 0) { if ( ! is_array($participants) || count($participants) === 0) {
throw new ControllerException(_('No participants specified')); throw new ControllerException(_('No participants specified'));
@@ -336,7 +336,7 @@ class Push implements ControllerProviderInterface
$Validation->setInitiator($app['phraseanet.core']->getAuthenticatedUser()); $Validation->setInitiator($app['phraseanet.core']->getAuthenticatedUser());
$Validation->setBasket($Basket); $Validation->setBasket($Basket);
$duration = (int) $request->get('duration'); $duration = (int) $request->request->get('duration');
if ($duration > 0) { if ($duration > 0) {
$date = new \DateTime('+' . $duration . ' day' . ($duration > 1 ? 's' : '')); $date = new \DateTime('+' . $duration . ' day' . ($duration > 1 ? 's' : ''));
@@ -440,8 +440,8 @@ class Push implements ControllerProviderInterface
, 'to_email' => $participant_user->get_email() , 'to_email' => $participant_user->get_email()
, 'to_name' => $participant_user->get_display_name() , 'to_name' => $participant_user->get_display_name()
, 'url' => $url , 'url' => $url
, 'accuse' => ! ! $request->get('recept', false) , 'accuse' => ! ! $request->request->get('recept', false)
, 'message' => $request->get('message') , 'message' => $request->request->get('message')
, 'ssel_id' => $Basket->getId() , 'ssel_id' => $Basket->getId()
); );
@@ -456,7 +456,7 @@ class Push implements ControllerProviderInterface
$message = sprintf( $message = sprintf(
_('%1$d records have been sent for validation to %2$d users') _('%1$d records have been sent for validation to %2$d users')
, count($pusher->get_elements()) , count($pusher->get_elements())
, count($request->get('participants')) , count($request->request->get('participants'))
); );
$ret = array( $ret = array(
@@ -528,16 +528,16 @@ class Push implements ControllerProviderInterface
if ( ! $AdminUser->ACL()->has_right('manageusers')) if ( ! $AdminUser->ACL()->has_right('manageusers'))
throw new ControllerException(_('You are not allowed to add users')); throw new ControllerException(_('You are not allowed to add users'));
if ( ! $request->get('firstname')) if ( ! $request->request->get('firstname'))
throw new ControllerException(_('First name is required')); throw new ControllerException(_('First name is required'));
if ( ! $request->get('lastname')) if ( ! $request->request->get('lastname'))
throw new ControllerException(_('Last name is required')); throw new ControllerException(_('Last name is required'));
if ( ! $request->get('email')) if ( ! $request->request->get('email'))
throw new ControllerException(_('Email is required')); throw new ControllerException(_('Email is required'));
if ( ! \mail::validateEmail($request->get('email'))) if ( ! \mail::validateEmail($request->request->get('email')))
throw new ControllerException(_('Email is invalid')); throw new ControllerException(_('Email is invalid'));
} catch (ControllerException $e) { } catch (ControllerException $e) {
$result['message'] = $e->getMessage(); $result['message'] = $e->getMessage();
@@ -548,7 +548,7 @@ class Push implements ControllerProviderInterface
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$user = null; $user = null;
$email = $request->get('email'); $email = $request->request->get('email');
try { try {
$usr_id = \User_Adapter::get_usr_id_from_email($email); $usr_id = \User_Adapter::get_usr_id_from_email($email);
@@ -567,15 +567,15 @@ class Push implements ControllerProviderInterface
$user = \User_Adapter::create($appbox, $email, $password, $email, false); $user = \User_Adapter::create($appbox, $email, $password, $email, false);
$user->set_firstname($request->get('firstname')) $user->set_firstname($request->request->get('firstname'))
->set_lastname($request->get('lastname')); ->set_lastname($request->request->get('lastname'));
if ($request->get('company')) if ($request->request->get('company'))
$user->set_company($request->get('company')); $user->set_company($request->request->get('company'));
if ($request->get('job')) if ($request->request->get('job'))
$user->set_company($request->get('job')); $user->set_company($request->request->get('job'));
if ($request->get('form_geonameid')) if ($request->request->get('form_geonameid'))
$user->set_geonameid($request->get('form_geonameid')); $user->set_geonameid($request->request->get('form_geonameid'));
$result['message'] = _('User successfully created'); $result['message'] = _('User successfully created');
$result['success'] = true; $result['success'] = true;
@@ -589,7 +589,7 @@ class Push implements ControllerProviderInterface
}); });
$controllers->get('/add-user/', function(Application $app, Request $request) { $controllers->get('/add-user/', function(Application $app, Request $request) {
$params = array('callback' => $request->get('callback')); $params = array('callback' => $request->query->get('callback'));
return new Response($app['twig']->render('prod/User/Add.html.twig', $params)); return new Response($app['twig']->render('prod/User/Add.html.twig', $params));
}); });
@@ -603,9 +603,9 @@ class Push implements ControllerProviderInterface
$query->on_bases_where_i_am($user->ACL(), array('canpush')); $query->on_bases_where_i_am($user->ACL(), array('canpush'));
$query->like(\User_Query::LIKE_FIRSTNAME, $request->get('query')) $query->like(\User_Query::LIKE_FIRSTNAME, $request->query->get('query'))
->like(\User_Query::LIKE_LASTNAME, $request->get('query')) ->like(\User_Query::LIKE_LASTNAME, $request->query->get('query'))
->like(\User_Query::LIKE_LOGIN, $request->get('query')) ->like(\User_Query::LIKE_LOGIN, $request->query->get('query'))
->like_match(\User_Query::LIKE_MATCH_OR); ->like_match(\User_Query::LIKE_MATCH_OR);
$result = $query->include_phantoms() $result = $query->include_phantoms()
@@ -614,7 +614,7 @@ class Push implements ControllerProviderInterface
$repository = $em->getRepository('\Entities\UsrList'); $repository = $em->getRepository('\Entities\UsrList');
$lists = $repository->findUserListLike($user, $request->get('query')); $lists = $repository->findUserListLike($user, $request->query->get('query'));
$datas = array(); $datas = array();

View File

@@ -27,14 +27,14 @@ class Query implements ControllerProviderInterface
{ {
$controllers = $app['controllers_factory']; $controllers = $app['controllers_factory'];
$controllers->match('/', function(Application $app, Request $request) { $controllers->post('/', function(Application $app, Request $request) {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
$registry = $appbox->get_registry(); $registry = $appbox->get_registry();
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
$query = (string) $request->get('qry'); $query = (string) $request->request->get('qry');
$mod = $user->getPrefs('view'); $mod = $user->getPrefs('view');
@@ -42,7 +42,7 @@ class Query implements ControllerProviderInterface
$options = new \searchEngine_options(); $options = new \searchEngine_options();
$bas = is_array($request->get('bas')) ? $request->get('bas') : array_keys($user->ACL()->get_granted_base()); $bas = is_array($request->request->get('bas')) ? $request->request->get('bas') : array_keys($user->ACL()->get_granted_base());
/* @var $user \User_Adapter */ /* @var $user \User_Adapter */
if ($user->ACL()->has_right('modifyrecord')) { if ($user->ACL()->has_right('modifyrecord')) {
@@ -60,20 +60,20 @@ class Query implements ControllerProviderInterface
$options->set_business_fields(array()); $options->set_business_fields(array());
} }
$status = is_array($request->get('status')) ? $request->get('status') : array(); $status = is_array($request->request->get('status')) ? $request->request->get('status') : array();
$fields = is_array($request->get('fields')) ? $request->get('fields') : array(); $fields = is_array($request->request->get('fields')) ? $request->request->get('fields') : array();
$options->set_fields($fields); $options->set_fields($fields);
$options->set_status($status); $options->set_status($status);
$options->set_bases($bas, $user->ACL()); $options->set_bases($bas, $user->ACL());
$options->set_search_type($request->get('search_type')); $options->set_search_type($request->request->get('search_type'));
$options->set_record_type($request->get('recordtype')); $options->set_record_type($request->request->get('recordtype'));
$options->set_min_date($request->get('datemin')); $options->set_min_date($request->request->get('datemin'));
$options->set_max_date($request->get('datemax')); $options->set_max_date($request->request->get('datemax'));
$options->set_date_fields(explode('|', $request->get('datefield'))); $options->set_date_fields(explode('|', $request->request->get('datefield')));
$options->set_sort($request->get('sort'), $request->get('ord', PHRASEA_ORDER_DESC)); $options->set_sort($request->request->get('sort'), $request->request->get('ord', PHRASEA_ORDER_DESC));
$options->set_use_stemming($request->get('stemme')); $options->set_use_stemming($request->request->get('stemme'));
$form = serialize($options); $form = serialize($options);
@@ -82,7 +82,7 @@ class Query implements ControllerProviderInterface
$search_engine = new \searchEngine_adapter($registry); $search_engine = new \searchEngine_adapter($registry);
$search_engine->set_options($options); $search_engine->set_options($options);
$page = (int) $request->get('pag'); $page = (int) $request->request->get('pag');
if ($page < 1) { if ($page < 1) {
$search_engine->set_is_first_page(true); $search_engine->set_is_first_page(true);

View File

@@ -40,7 +40,7 @@ class Story implements ControllerProviderInterface
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
$collection = \collection::get_from_base_id($request->get('base_id')); $collection = \collection::get_from_base_id($request->request->get('base_id'));
if ( ! $user->ACL()->has_right_on_base($collection->get_base_id(), 'canaddrecord')) { if ( ! $user->ACL()->has_right_on_base($collection->get_base_id(), 'canaddrecord')) {
throw new \Exception_Forbidden('You can not create a story on this collection'); throw new \Exception_Forbidden('You can not create a story on this collection');
@@ -48,7 +48,7 @@ class Story implements ControllerProviderInterface
$Story = \record_adapter::createStory($collection); $Story = \record_adapter::createStory($collection);
foreach (explode(';', $request->get('lst')) as $sbas_rec) { foreach (explode(';', $request->request->get('lst')) as $sbas_rec) {
$sbas_rec = explode('_', $sbas_rec); $sbas_rec = explode('_', $sbas_rec);
if (count($sbas_rec) !== 2) { if (count($sbas_rec) !== 2) {
@@ -73,7 +73,7 @@ class Story implements ControllerProviderInterface
foreach ($collection->get_databox()->get_meta_structure() as $meta) { foreach ($collection->get_databox()->get_meta_structure() as $meta) {
if ($meta->get_thumbtitle()) { if ($meta->get_thumbtitle()) {
$value = $request->get('name'); $value = $request->request->get('name');
} else { } else {
continue; continue;
} }
@@ -136,7 +136,7 @@ class Story implements ControllerProviderInterface
$n = 0; $n = 0;
foreach (explode(';', $request->get('lst')) as $sbas_rec) { foreach (explode(';', $request->request->get('lst')) as $sbas_rec) {
$sbas_rec = explode('_', $sbas_rec); $sbas_rec = explode('_', $sbas_rec);
if (count($sbas_rec) !== 2) if (count($sbas_rec) !== 2)
@@ -249,7 +249,7 @@ class Story implements ControllerProviderInterface
WHERE rid_parent = :parent_id AND rid_child = :children_id'; WHERE rid_parent = :parent_id AND rid_child = :children_id';
$stmt = $story->get_databox()->get_connection()->prepare($sql); $stmt = $story->get_databox()->get_connection()->prepare($sql);
foreach ($app['request']->get('element') as $record_id => $ord) { foreach ($app['request']->request->get('element') as $record_id => $ord) {
$params = array( $params = array(
':ord' => $ord, ':ord' => $ord,
':parent_id' => $story->get_record_id(), ':parent_id' => $story->get_record_id(),

View File

@@ -70,7 +70,7 @@ class Tools implements ControllerProviderInterface
$records = RecordsRequest::fromRequest($app, $request, false); $records = RecordsRequest::fromRequest($app, $request, false);
$rotation = in_array($request->get('rotation'), array('-90', '90', '180')) ? $request->get('rotation', 90) : 90; $rotation = in_array($request->request->get('rotation'), array('-90', '90', '180')) ? $request->request->get('rotation', 90) : 90;
foreach ($records as $record) { foreach ($records as $record) {
try { try {
@@ -101,7 +101,7 @@ class Tools implements ControllerProviderInterface
} }
} }
if ( ! $substituted || $request->get('ForceThumbSubstit') == '1') { if ( ! $substituted || $request->request->get('ForceThumbSubstit') == '1') {
$record->rebuild_subdefs(); $record->rebuild_subdefs();
} }
} }
@@ -123,15 +123,15 @@ class Tools implements ControllerProviderInterface
try { try {
$record = new \record_adapter( $record = new \record_adapter(
$request->get('sbas_id') $request->request->get('sbas_id')
, $request->get('record_id') , $request->request->get('record_id')
); );
$media = $app['phraseanet.core']['mediavorus']->guess($file); $media = $app['phraseanet.core']['mediavorus']->guess($file);
$record->substitute_subdef('document', $media); $record->substitute_subdef('document', $media);
if ((int) $request->get('ccfilename') === 1) { if ((int) $request->request->get('ccfilename') === 1) {
$record->set_original_name($fileName); $record->set_original_name($fileName);
} }
@@ -174,8 +174,8 @@ class Tools implements ControllerProviderInterface
rename($file->getPathname(), $tmpFile); rename($file->getPathname(), $tmpFile);
$record = new \record_adapter( $record = new \record_adapter(
$request->get('sbas_id') $request->request->get('sbas_id')
, $request->get('record_id') , $request->request->get('record_id')
); );
$media = $app['phraseanet.core']['mediavorus']->guess($file); $media = $app['phraseanet.core']['mediavorus']->guess($file);
@@ -206,10 +206,10 @@ class Tools implements ControllerProviderInterface
$template = 'prod/actions/Tools/confirm.html.twig'; $template = 'prod/actions/Tools/confirm.html.twig';
try { try {
$record = new \record_adapter($request->get('sbas_id'), $request->get('record_id')); $record = new \record_adapter($request->request->get('sbas_id'), $request->request->get('record_id'));
$var = array( $var = array(
'video_title' => $record->get_title() 'video_title' => $record->get_title()
, 'image' => $request->get('image', '') , 'image' => $request->request->get('image', '')
); );
$return['datas'] = $app['twig']->render($template, $var); $return['datas'] = $app['twig']->render($template, $var);
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -224,9 +224,9 @@ class Tools implements ControllerProviderInterface
$return = array('success' => false, 'message' => ''); $return = array('success' => false, 'message' => '');
try { try {
$record = new \record_adapter($request->get('sbas_id'), $request->get('record_id')); $record = new \record_adapter($request->request->get('sbas_id'), $request->request->get('record_id'));
$dataUri = DataURI\Parser::parse($request->get('image', '')); $dataUri = DataURI\Parser::parse($request->request->get('image', ''));
$path = $app['phraseanet.core']->getRegistry()->get('GV_RootPath') . 'tmp'; $path = $app['phraseanet.core']->getRegistry()->get('GV_RootPath') . 'tmp';

View File

@@ -102,13 +102,13 @@ class Tooltip implements ControllerProviderInterface
public function displayCaption(Application $app, $sbas_id, $record_id, $context) public function displayCaption(Application $app, $sbas_id, $record_id, $context)
{ {
$number = (int) $app['request']->get('number'); $number = (int) $app['request']->request->get('number');
$record = new \record_adapter($sbas_id, $record_id, $number); $record = new \record_adapter($sbas_id, $record_id, $number);
$search_engine = null; $search_engine = null;
if ($context == 'answer') { if ($context == 'answer') {
if (($search_engine_options = unserialize($app['request']->get('options_serial'))) !== false) { if (($search_engine_options = unserialize($app['request']->request->get('options_serial'))) !== false) {
$search_engine = new \searchEngine_adapter($app['phraseanet.appbox']->get_registry()); $search_engine = new \searchEngine_adapter($app['phraseanet.appbox']->get_registry());
$search_engine->set_options($search_engine_options); $search_engine->set_options($search_engine_options);
} }
@@ -119,7 +119,7 @@ class Tooltip implements ControllerProviderInterface
, array( , array(
'record' => $record, 'record' => $record,
'view' => $context, 'view' => $context,
'highlight' => $app['request']->get('query'), 'highlight' => $app['request']->request->get('query'),
'searchEngine' => $search_engine, 'searchEngine' => $search_engine,
) )
); );

View File

@@ -157,7 +157,7 @@ class Upload implements ControllerProviderInterface
throw new \Exception_BadRequest('Upload is limited to 1 file per request'); throw new \Exception_BadRequest('Upload is limited to 1 file per request');
} }
$base_id = $request->get('base_id'); $base_id = $request->request->get('base_id');
if ( ! $base_id) { if ( ! $base_id) {
throw new \Exception_BadRequest('Missing base_id parameter'); throw new \Exception_BadRequest('Missing base_id parameter');
@@ -197,7 +197,7 @@ class Upload implements ControllerProviderInterface
$packageFile = new File($media, $collection, $file->getClientOriginalName()); $packageFile = new File($media, $collection, $file->getClientOriginalName());
$postStatus = $request->get('status'); $postStatus = $request->request->get('status');
if (isset($postStatus[$collection->get_sbas_id()]) && is_array($postStatus[$collection->get_sbas_id()])) { if (isset($postStatus[$collection->get_sbas_id()]) && is_array($postStatus[$collection->get_sbas_id()])) {
$postStatus = $postStatus[$collection->get_sbas_id()]; $postStatus = $postStatus[$collection->get_sbas_id()];
@@ -209,7 +209,7 @@ class Upload implements ControllerProviderInterface
$packageFile->addAttribute(new Status(strrev($status))); $packageFile->addAttribute(new Status(strrev($status)));
} }
$forceBehavior = $request->get('forceAction'); $forceBehavior = $request->request->get('forceAction');
$reasons = array(); $reasons = array();
$elementCreated = null; $elementCreated = null;

View File

@@ -38,9 +38,9 @@ class UserPreferences implements ControllerProviderInterface
try { try {
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
$ret = $user->setPrefs($request->get('prop'), $request->get('value')); $ret = $user->setPrefs($request->request->get('prop'), $request->request->get('value'));
if ($ret == $request->get('value')) if ($ret == $request->request->get('value'))
$output = "1"; else $output = "1"; else
$output = "0"; $output = "0";

View File

@@ -172,7 +172,7 @@ class UsrLists implements ControllerProviderInterface
{ {
$request = $app['request']; $request = $app['request'];
$list_name = $request->get('name'); $list_name = $request->request->get('name');
$datas = array( $datas = array(
'success' => false 'success' => false
@@ -275,7 +275,7 @@ class UsrLists implements ControllerProviderInterface
); );
try { try {
$list_name = $request->get('name'); $list_name = $request->request->get('name');
if ( ! $list_name) { if ( ! $list_name) {
throw new ControllerException(_('List name is required')); throw new ControllerException(_('List name is required'));
@@ -399,8 +399,8 @@ class UsrLists implements ControllerProviderInterface
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
try { try {
if ( ! is_array($request->get('usr_ids'))) { if ( ! is_array($request->request->get('usr_ids'))) {
throw new Controller\Exception('Invalid or missing parameter usr_ids'); throw new ControllerException('Invalid or missing parameter usr_ids');
} }
$repository = $em->getRepository('\Entities\UsrList'); $repository = $em->getRepository('\Entities\UsrList');
@@ -414,7 +414,7 @@ class UsrLists implements ControllerProviderInterface
$inserted_usr_ids = array(); $inserted_usr_ids = array();
foreach ($request->get('usr_ids') as $usr_id) { foreach ($request->request->get('usr_ids') as $usr_id) {
$user_entry = \User_Adapter::getInstance($usr_id, $app['phraseanet.appbox']); $user_entry = \User_Adapter::getInstance($usr_id, $app['phraseanet.appbox']);
if ($list->has($user_entry)) if ($list->has($user_entry))
@@ -497,9 +497,9 @@ class UsrLists implements ControllerProviderInterface
UsrListOwner::ROLE_ADMIN, UsrListOwner::ROLE_ADMIN,
); );
if ( ! $app['request']->get('role')) if ( ! $app['request']->request->get('role'))
throw new \Exception_BadRequest('Missing role parameter'); throw new \Exception_BadRequest('Missing role parameter');
elseif ( ! in_array($app['request']->get('role'), $availableRoles)) elseif ( ! in_array($app['request']->request->get('role'), $availableRoles))
throw new \Exception_BadRequest('Role is invalid'); throw new \Exception_BadRequest('Role is invalid');
try { try {
@@ -530,7 +530,7 @@ class UsrLists implements ControllerProviderInterface
$em->persist($owner); $em->persist($owner);
} }
$role = $app['request']->get('role'); $role = $app['request']->request->get('role');
$owner->setRole($role); $owner->setRole($role);

View File

@@ -51,9 +51,9 @@ class WorkZone implements ControllerProviderInterface
{ {
$params = array( $params = array(
'WorkZone' => new WorkzoneHelper($app['phraseanet.core'], $app['request']) 'WorkZone' => new WorkzoneHelper($app['phraseanet.core'], $app['request'])
, 'selected_type' => $app['request']->get('type') , 'selected_type' => $app['request']->query->get('type')
, 'selected_id' => $app['request']->get('id') , 'selected_id' => $app['request']->query->get('id')
, 'srt' => $app['request']->get('sort') , 'srt' => $app['request']->query->get('sort')
); );
return $app['twig']->render('prod/WorkZone/WorkZone.html.twig', $params); return $app['twig']->render('prod/WorkZone/WorkZone.html.twig', $params);
@@ -75,16 +75,16 @@ class WorkZone implements ControllerProviderInterface
$BasketRepo = $em->getRepository('\Entities\Basket'); $BasketRepo = $em->getRepository('\Entities\Basket');
$Page = (int) $request->get('Page', 0); $Page = (int) $request->query->get('Page', 0);
$PerPage = 10; $PerPage = 10;
$offsetStart = max(($Page - 1) * $PerPage, 0); $offsetStart = max(($Page - 1) * $PerPage, 0);
$Baskets = $BasketRepo->findWorkzoneBasket( $Baskets = $BasketRepo->findWorkzoneBasket(
$user $user
, $request->get('Query') , $request->query->get('Query')
, $request->get('Year') , $request->query->get('Year')
, $request->get('Type') , $request->query->get('Type')
, $offsetStart , $offsetStart
, $PerPage , $PerPage
); );
@@ -97,9 +97,9 @@ class WorkZone implements ControllerProviderInterface
, 'Page' => $page , 'Page' => $page
, 'MaxPage' => $maxPage , 'MaxPage' => $maxPage
, 'Total' => count($Baskets) , 'Total' => count($Baskets)
, 'Query' => $request->get('Query') , 'Query' => $request->query->get('Query')
, 'Year' => $request->get('Year') , 'Year' => $request->query->get('Year')
, 'Type' => $request->get('Type') , 'Type' => $request->query->get('Type')
); );
return $app['twig']->render('prod/WorkZone/Browser/Results.html.twig', $params); return $app['twig']->render('prod/WorkZone/Browser/Results.html.twig', $params);
@@ -117,7 +117,7 @@ class WorkZone implements ControllerProviderInterface
public function attachStories(Application $app, Request $request) public function attachStories(Application $app, Request $request)
{ {
if ( ! $request->get('stories')) { if ( ! $request->request->get('stories')) {
throw new \Exception_BadRequest(); throw new \Exception_BadRequest();
} }
@@ -130,7 +130,7 @@ class WorkZone implements ControllerProviderInterface
$alreadyFixed = $done = 0; $alreadyFixed = $done = 0;
$stories = $request->get('stories', array()); $stories = $request->request->get('stories', array());
foreach ($stories as $element) { foreach ($stories as $element) {
$element = explode('_', $element); $element = explode('_', $element);

View File

@@ -251,7 +251,7 @@ class Account implements ControllerProviderInterface
*/ */
public function resetPassword(Application $app, Request $request) public function resetPassword(Application $app, Request $request)
{ {
if (null !== $passwordMsg = $request->get('pass-error')) { if (null !== $passwordMsg = $request->query->get('pass-error')) {
switch ($passwordMsg) { switch ($passwordMsg) {
case 'pass-match': case 'pass-match':
$passwordMsg = _('forms::les mots de passe ne correspondent pas'); $passwordMsg = _('forms::les mots de passe ne correspondent pas');
@@ -281,7 +281,7 @@ class Account implements ControllerProviderInterface
{ {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
if (null !== $token = $request->get('token')) { if (null !== $token = $request->request->get('token')) {
try { try {
$datas = \random::helloToken($token); $datas = \random::helloToken($token);
$user = \User_Adapter::getInstance((int) $datas['usr_id'], $appbox); $user = \User_Adapter::getInstance((int) $datas['usr_id'], $appbox);
@@ -295,9 +295,9 @@ class Account implements ControllerProviderInterface
} }
} }
if (null === ($password = $request->get('form_password')) if (null === ($password = $request->request->get('form_password'))
|| null === ($email = $request->get('form_email')) || null === ($email = $request->request->get('form_email'))
|| null === ($emailConfirm = $request->get('form_email_confirm'))) { || null === ($emailConfirm = $request->request->get('form_email_confirm'))) {
$app->abort(400, _('Could not perform request, please contact an administrator.')); $app->abort(400, _('Could not perform request, please contact an administrator.'));
} }
@@ -338,7 +338,7 @@ class Account implements ControllerProviderInterface
*/ */
public function displayResetEmailForm(Application $app, Request $request) public function displayResetEmailForm(Application $app, Request $request)
{ {
if (null !== $noticeMsg = $request->get('notice')) { if (null !== $noticeMsg = $request->query->get('notice')) {
switch ($noticeMsg) { switch ($noticeMsg) {
case 'mail-server': case 'mail-server':
$noticeMsg = _('phraseanet::erreur: echec du serveur de mail'); $noticeMsg = _('phraseanet::erreur: echec du serveur de mail');
@@ -355,7 +355,7 @@ class Account implements ControllerProviderInterface
} }
} }
if (null !== $updateMsg = $request->get('update')) { if (null !== $updateMsg = $request->query->get('update')) {
switch ($updateMsg) { switch ($updateMsg) {
case 'ok': case 'ok':
$updateMsg = _('admin::compte-utilisateur: L\'email a correctement ete mis a jour'); $updateMsg = _('admin::compte-utilisateur: L\'email a correctement ete mis a jour');
@@ -386,7 +386,7 @@ class Account implements ControllerProviderInterface
{ {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
if ((null !== $password = $request->get('form_password')) && (null !== $passwordConfirm = $request->get('form_password_confirm'))) { if ((null !== $password = $request->request->get('form_password')) && (null !== $passwordConfirm = $request->request->get('form_password_confirm'))) {
if ($password !== $passwordConfirm) { if ($password !== $passwordConfirm) {
return $app->redirect('/account/reset-password/?pass-error=pass-match'); return $app->redirect('/account/reset-password/?pass-error=pass-match');
@@ -401,7 +401,7 @@ class Account implements ControllerProviderInterface
try { try {
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
$auth = new \Session_Authentication_Native($appbox, $user->get_login(), $request->get('form_old_password', '')); $auth = new \Session_Authentication_Native($appbox, $user->get_login(), $request->request->get('form_old_password', ''));
$auth->challenge_password(); $auth->challenge_password();
$user->set_password($passwordConfirm); $user->set_password($passwordConfirm);
@@ -436,7 +436,7 @@ class Account implements ControllerProviderInterface
, $app['phraseanet.core']->getAuthenticatedUser() , $app['phraseanet.core']->getAuthenticatedUser()
); );
$account->set_revoked((bool) $request->get('revoke'), false); $account->set_revoked((bool) $request->query->get('revoke'), false);
} catch (\Exception_NotFound $e) { } catch (\Exception_NotFound $e) {
$error = true; $error = true;
} }
@@ -499,7 +499,7 @@ class Account implements ControllerProviderInterface
$user = $app['phraseanet.core']->getAuthenticatedUser(); $user = $app['phraseanet.core']->getAuthenticatedUser();
$evtMngr = \eventsmanager_broker::getInstance($appbox, $app['phraseanet.core']); $evtMngr = \eventsmanager_broker::getInstance($appbox, $app['phraseanet.core']);
switch ($notice = $request->get('notice', '')) { switch ($notice = $request->query->get('notice', '')) {
case 'pass-ok': case 'pass-ok':
$notice = _('login::notification: Mise a jour du mot de passe avec succes'); $notice = _('login::notification: Mise a jour du mot de passe avec succes');
break; break;
@@ -540,7 +540,7 @@ class Account implements ControllerProviderInterface
$evtMngr = \eventsmanager_broker::getInstance($appbox, $app['phraseanet.core']); $evtMngr = \eventsmanager_broker::getInstance($appbox, $app['phraseanet.core']);
$notice = 'account-update-bad'; $notice = 'account-update-bad';
$demands = (array) $request->get('demand', array()); $demands = (array) $request->request->get('demand', array());
if (0 !== count($demands)) { if (0 !== count($demands)) {
$register = new \appbox_register($appbox); $register = new \appbox_register($appbox);
@@ -577,7 +577,7 @@ class Account implements ControllerProviderInterface
if (0 === count(array_diff($accountFields, array_keys($request->request->all())))) { if (0 === count(array_diff($accountFields, array_keys($request->request->all())))) {
$defaultDatas = 0; $defaultDatas = 0;
if ($datas = (array) $request->get("form_defaultdataFTP", array())) { if ($datas = (array) $request->request->get("form_defaultdataFTP", array())) {
if (in_array('document', $datas)) { if (in_array('document', $datas)) {
$defaultDatas += 4; $defaultDatas += 4;
} }
@@ -594,25 +594,25 @@ class Account implements ControllerProviderInterface
try { try {
$appbox->get_connection()->beginTransaction(); $appbox->get_connection()->beginTransaction();
$user->set_gender($request->get("form_gender")) $user->set_gender($request->request->get("form_gender"))
->set_firstname($request->get("form_firstname")) ->set_firstname($request->request->get("form_firstname"))
->set_lastname($request->get("form_lastname")) ->set_lastname($request->request->get("form_lastname"))
->set_address($request->get("form_address")) ->set_address($request->request->get("form_address"))
->set_zip($request->get("form_zip")) ->set_zip($request->request->get("form_zip"))
->set_tel($request->get("form_phone")) ->set_tel($request->request->get("form_phone"))
->set_fax($request->get("form_fax")) ->set_fax($request->request->get("form_fax"))
->set_job($request->get("form_activity")) ->set_job($request->request->get("form_activity"))
->set_company($request->get("form_company")) ->set_company($request->request->get("form_company"))
->set_position($request->get("form_function")) ->set_position($request->request->get("form_function"))
->set_geonameid($request->get("form_geonameid")) ->set_geonameid($request->request->get("form_geonameid"))
->set_mail_notifications((bool) $request->get("mail_notifications")) ->set_mail_notifications((bool) $request->request->get("mail_notifications"))
->set_activeftp($request->get("form_activeFTP")) ->set_activeftp($request->request->get("form_activeFTP"))
->set_ftp_address($request->get("form_addrFTP")) ->set_ftp_address($request->request->get("form_addrFTP"))
->set_ftp_login($request->get("form_loginFTP")) ->set_ftp_login($request->request->get("form_loginFTP"))
->set_ftp_password($request->get("form_pwdFTP")) ->set_ftp_password($request->request->get("form_pwdFTP"))
->set_ftp_passif($request->get("form_passifFTP")) ->set_ftp_passif($request->request->get("form_passifFTP"))
->set_ftp_dir($request->get("form_destFTP")) ->set_ftp_dir($request->request->get("form_destFTP"))
->set_ftp_dir_prefix($request->get("form_prefixFTPfolder")) ->set_ftp_dir_prefix($request->request->get("form_prefixFTPfolder"))
->set_defaultftpdatas($defaultDatas); ->set_defaultftpdatas($defaultDatas);
$appbox->get_connection()->commit(); $appbox->get_connection()->commit();
@@ -623,7 +623,7 @@ class Account implements ControllerProviderInterface
} }
} }
$requestedNotifications = (array) $request->get('notifications', array()); $requestedNotifications = (array) $request->request->get('notifications', array());
foreach ($evtMngr->list_notifications_available($user->get_id()) as $notifications) { foreach ($evtMngr->list_notifications_available($user->get_id()) as $notifications) {
foreach ($notifications as $notification) { foreach ($notifications as $notification) {

View File

@@ -219,8 +219,8 @@ class Developers implements ControllerProviderInterface
try { try {
$clientApp = new \API_OAuth2_Application($app['phraseanet.appbox'], $id); $clientApp = new \API_OAuth2_Application($app['phraseanet.appbox'], $id);
if (null !== $request->get("callback")) { if (null !== $request->request->get("callback")) {
$clientApp->set_redirect_uri($request->get("callback")); $clientApp->set_redirect_uri($request->request->get("callback"));
} else { } else {
$error = true; $error = true;
} }
@@ -287,7 +287,7 @@ class Developers implements ControllerProviderInterface
try { try {
$clientApp = new \API_OAuth2_Application($app['phraseanet.appbox'], $id); $clientApp = new \API_OAuth2_Application($app['phraseanet.appbox'], $id);
$clientApp->set_grant_password((bool) $request->get('grant', false)); $clientApp->set_grant_password((bool) $request->request->get('grant', false));
} catch (\Exception_NotFound $e) { } catch (\Exception_NotFound $e) {
$error = true; $error = true;
} }
@@ -304,7 +304,7 @@ class Developers implements ControllerProviderInterface
*/ */
public function newApp(Application $app, Request $request) public function newApp(Application $app, Request $request)
{ {
if ($request->get('type') === \API_OAuth2_Application::DESKTOP_TYPE) { if ($request->request->get('type') === \API_OAuth2_Application::DESKTOP_TYPE) {
$form = new \API_OAuth2_Form_DevAppDesktop($app['request']); $form = new \API_OAuth2_Form_DevAppDesktop($app['request']);
} else { } else {
$form = new \API_OAuth2_Form_DevAppInternet($app['request']); $form = new \API_OAuth2_Form_DevAppInternet($app['request']);

View File

@@ -44,9 +44,8 @@ class Login implements ControllerProviderInterface
* return : HTML Response * return : HTML Response
*/ */
$controllers->get('/', $this->call('login')) $controllers->get('/', $this->call('login'))
->before(function() use ($app) { ->before(function(Request $request) use ($app) {
if (null !== $request->query->get('postlog')) {
if (null !== $app['request']->get('postlog')) {
// if isset postlog parameter, set cookie and log out current user // if isset postlog parameter, set cookie and log out current user
// then post login operation like getting baskets from an invit session // then post login operation like getting baskets from an invit session
@@ -54,13 +53,13 @@ class Login implements ControllerProviderInterface
$app['phraseanet.appbox']->get_session()->set_postlog(); $app['phraseanet.appbox']->get_session()->set_postlog();
return $app->redirect("/login/logout/?redirect=" . $app['request']->get('redirect', 'prod')); return $app->redirect("/login/logout/?redirect=" . $request->query->get('redirect', 'prod'));
} }
if ($app['phraseanet.core']->isAuthenticated()) { if ($app['phraseanet.core']->isAuthenticated()) {
return $app->redirect('/' . $app['request']->get('redirect', 'prod') . '/'); return $app->redirect('/' . $request->query->get('redirect', 'prod') . '/');
} }
}) })
->bind('homepage'); ->bind('homepage');
@@ -212,7 +211,7 @@ class Login implements ControllerProviderInterface
{ {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
if (null === $usrId = $request->get('usr_id')) { if (null === $usrId = $request->query->get('usr_id')) {
$app->abort(400, sprintf(_('Request to send you the confirmation mail failed, please retry'))); $app->abort(400, sprintf(_('Request to send you the confirmation mail failed, please retry')));
} }
@@ -239,7 +238,7 @@ class Login implements ControllerProviderInterface
{ {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
if (null === $code = $request->get('code')) { if (null === $code = $request->query->get('code')) {
return $app->redirect('/login/?redirect=/prod&error=code-not-found'); return $app->redirect('/login/?redirect=/prod&error=code-not-found');
} }
@@ -300,7 +299,7 @@ class Login implements ControllerProviderInterface
{ {
$appbox = $app['phraseanet.appbox']; $appbox = $app['phraseanet.appbox'];
if (null !== $mail = $request->get('mail')) { if (null !== $mail = $request->request->get('mail')) {
if ( ! \PHPMailer::ValidateAddress($mail)) { if ( ! \PHPMailer::ValidateAddress($mail)) {
return $app->redirect('/login/forgot-password/?error=invalidmail'); return $app->redirect('/login/forgot-password/?error=invalidmail');
} }
@@ -324,9 +323,9 @@ class Login implements ControllerProviderInterface
} }
} }
if ((null !== $token = $request->get('token')) if ((null !== $token = $request->request->get('token'))
&& (null !== $password = $request->get('form_password')) && (null !== $password = $request->request->get('form_password'))
&& (null !== $passwordConfirm = $request->get('form_password_confirm'))) { && (null !== $passwordConfirm = $request->request->get('form_password_confirm'))) {
if ($password !== $passwordConfirm) { if ($password !== $passwordConfirm) {
@@ -364,9 +363,9 @@ class Login implements ControllerProviderInterface
public function displayForgotPasswordForm(Application $app, Request $request) public function displayForgotPasswordForm(Application $app, Request $request)
{ {
$tokenize = false; $tokenize = false;
$errorMsg = $request->get('error'); $errorMsg = $request->query->get('error');
if (null !== $token = $request->get('token')) { if (null !== $token = $request->query->get('token')) {
try { try {
\random::helloToken($token); \random::helloToken($token);
$tokenize = true; $tokenize = true;
@@ -395,7 +394,7 @@ class Login implements ControllerProviderInterface
} }
} }
if (null !== $sentMsg = $request->get('sent')) { if (null !== $sentMsg = $request->query->get('sent')) {
switch ($sentMsg) { switch ($sentMsg) {
case 'ok': case 'ok':
$sentMsg = _('phraseanet:: Un email vient de vous etre envoye'); $sentMsg = _('phraseanet:: Un email vient de vous etre envoye');
@@ -403,7 +402,7 @@ class Login implements ControllerProviderInterface
} }
} }
if (null !== $passwordMsg = $request->get('pass-error')) { if (null !== $passwordMsg = $request->query->get('pass-error')) {
switch ($passwordMsg) { switch ($passwordMsg) {
case 'pass-match': case 'pass-match':
$passwordMsg = _('forms::les mots de passe ne correspondent pas'); $passwordMsg = _('forms::les mots de passe ne correspondent pas');
@@ -438,7 +437,7 @@ class Login implements ControllerProviderInterface
return $app->redirect('/login/?notice=no-register-available'); return $app->redirect('/login/?notice=no-register-available');
} }
$needed = $request->get('needed', array()); $needed = $request->query->get('needed', array());
foreach ($needed as $fields => $error) { foreach ($needed as $fields => $error) {
switch ($error) { switch ($error) {
@@ -480,7 +479,7 @@ class Login implements ControllerProviderInterface
'needed' => $needed, 'needed' => $needed,
'arrayVerif' => $arrayVerif, 'arrayVerif' => $arrayVerif,
'geonames' => new \geonames(), 'geonames' => new \geonames(),
'demandes' => $request->get('demand', array()), 'demandes' => $request->query->get('demand', array()),
'lng' => \Session_Handler::get_locale() 'lng' => \Session_Handler::get_locale()
))); )));
} }
@@ -512,7 +511,7 @@ class Login implements ControllerProviderInterface
} }
} }
if (($password = $request->get('form_password')) !== $request->get('form_password_confirm')) { if (($password = $request->request->get('form_password')) !== $request->request->get('form_password_confirm')) {
$needed['form_password'] = $needed['form_password_confirm'] = 'pass-match'; $needed['form_password'] = $needed['form_password_confirm'] = 'pass-match';
} elseif (strlen(trim($password)) < 5) { } elseif (strlen(trim($password)) < 5) {
$needed['form_password'] = 'pass-short'; $needed['form_password'] = 'pass-short';
@@ -520,11 +519,11 @@ class Login implements ControllerProviderInterface
$needed['form_password'] = 'pass-invalid'; $needed['form_password'] = 'pass-invalid';
} }
if (false === \PHPMailer::ValidateAddress($email = $request->get('form_email'))) { if (false === \PHPMailer::ValidateAddress($email = $request->request->get('form_email'))) {
$needed['form_email'] = 'mail-invalid'; $needed['form_email'] = 'mail-invalid';
} }
if (strlen($login = $request->get('form_login')) < 5) { if (strlen($login = $request->request->get('form_login')) < 5) {
$needed['form_login'] = 'login-short'; $needed['form_login'] = 'login-short';
} }
@@ -541,7 +540,7 @@ class Login implements ControllerProviderInterface
$needed['form_login'] = 'usr-login-exists'; $needed['form_login'] = 'usr-login-exists';
} }
if (sizeof($demands = $request->get('demand', array())) === 0) { if (sizeof($demands = $request->request->get('demand', array())) === 0) {
$needed['demandes'] = 'no-collections'; $needed['demandes'] = 'no-collections';
} }
@@ -576,19 +575,19 @@ class Login implements ControllerProviderInterface
} }
try { try {
$user = \User_Adapter::create($app['phraseanet.appbox'], $request->get('form_login'), $request->get("form_password"), $request->get("form_email"), false); $user = \User_Adapter::create($app['phraseanet.appbox'], $request->request->get('form_login'), $request->request->get("form_password"), $request->request->get("form_email"), false);
$user->set_gender($request->get('form_gender')) $user->set_gender($request->request->get('form_gender'))
->set_firstname($request->get('form_firstname')) ->set_firstname($request->request->get('form_firstname'))
->set_lastname($request->get('form_lastname')) ->set_lastname($request->request->get('form_lastname'))
->set_address($request->get('form_address')) ->set_address($request->request->get('form_address'))
->set_zip($request->get('form_zip')) ->set_zip($request->request->get('form_zip'))
->set_tel($request->get('form_phone')) ->set_tel($request->request->get('form_phone'))
->set_fax($request->get('form_fax')) ->set_fax($request->request->get('form_fax'))
->set_job($request->get('form_job')) ->set_job($request->request->get('form_job'))
->set_company($request->get('form_company')) ->set_company($request->request->get('form_company'))
->set_position($request->get('form_activity')) ->set_position($request->request->get('form_activity'))
->set_geonameid($request->get('form_geonameid')); ->set_geonameid($request->request->get('form_geonameid'));
$demandOK = array(); $demandOK = array();
@@ -653,7 +652,7 @@ class Login implements ControllerProviderInterface
*/ */
public function logout(Application $app, Request $request) public function logout(Application $app, Request $request)
{ {
$appRedirect = $request->get("app"); $appRedirect = $request->query->get("app");
try { try {
$session = $app['phraseanet.appbox']->get_session(); $session = $app['phraseanet.appbox']->get_session();
@@ -684,7 +683,7 @@ class Login implements ControllerProviderInterface
include($registry->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php'); include($registry->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php');
} }
$warning = $request->get('error', ''); $warning = $request->query->get('error', '');
try { try {
$appbox->get_connection(); $appbox->get_connection();
@@ -721,11 +720,11 @@ class Login implements ControllerProviderInterface
break; break;
} }
if (ctype_digit($request->get('usr'))) { if (ctype_digit($request->query->get('usr'))) {
$warning .= '<div class="notice"><a href="/login/send-mail-confirm/?usr_id=' . $request->get('usr') . '" target ="_self" style="color:black;text-decoration:none;">' . _('login:: Envoyer a nouveau le mail de confirmation') . '</a></div>'; $warning .= '<div class="notice"><a href="/login/send-mail-confirm/?usr_id=' . $request->query->get('usr') . '" target ="_self" style="color:black;text-decoration:none;">' . _('login:: Envoyer a nouveau le mail de confirmation') . '</a></div>';
} }
switch ($notice = $request->get('notice', '')) { switch ($notice = $request->query->get('notice', '')) {
case 'ok': case 'ok':
$notice = _('login::register: sujet email : confirmation de votre adresse email'); $notice = _('login::register: sujet email : confirmation de votre adresse email');
break; break;
@@ -754,7 +753,7 @@ class Login implements ControllerProviderInterface
&& $registry->get('GV_captchas') && $registry->get('GV_captchas')
&& trim($registry->get('GV_captcha_private_key')) !== '' && trim($registry->get('GV_captcha_private_key')) !== ''
&& trim($registry->get('GV_captcha_public_key')) !== '' && trim($registry->get('GV_captcha_public_key')) !== ''
&& $request->get('error') == 'captcha') { && $request->query->get('error') == 'captcha') {
$captchaSys = '<div style="margin:0;float: left;width:330px;"><div id="recaptcha_image" style="float: left;margin:10px 15px 5px"></div> $captchaSys = '<div style="margin:0;float: left;width:330px;"><div id="recaptcha_image" style="float: left;margin:10px 15px 5px"></div>
<div style="text-align:center;float: left;margin:0 15px 5px;width:300px;"> <div style="text-align:center;float: left;margin:0 15px 5px;width:300px;">
<a href="javascript:Recaptcha.reload()" class="link">' . _('login::captcha: obtenir une autre captcha') . '</a> <a href="javascript:Recaptcha.reload()" class="link">' . _('login::captcha: obtenir une autre captcha') . '</a>
@@ -772,8 +771,8 @@ class Login implements ControllerProviderInterface
'module_name' => _('Accueil'), 'module_name' => _('Accueil'),
'notice' => $notice, 'notice' => $notice,
'warning' => $warning, 'warning' => $warning,
'redirect' => $request->get('redirect'), 'redirect' => $request->query->get('redirect'),
'logged_out' => $request->get('logged_out'), 'logged_out' => $request->query->get('logged_out'),
'captcha_system' => $captchaSys, 'captcha_system' => $captchaSys,
'login' => new \login(), 'login' => new \login(),
'feeds' => $feeds, 'feeds' => $feeds,
@@ -796,11 +795,11 @@ class Login implements ControllerProviderInterface
$is_guest = false; $is_guest = false;
if (null !== $request->get('nolog') && \phrasea::guest_allowed()) { if (null !== $request->request->get('nolog') && \phrasea::guest_allowed()) {
$is_guest = true; $is_guest = true;
} }
if (((null !== $login = $request->get('login')) && (null !== $pwd = $request->get('pwd'))) || $is_guest) { if (((null !== $login = $request->request->get('login')) && (null !== $pwd = $request->request->get('pwd'))) || $is_guest) {
/** /**
* @todo dispatch an event that can be used to tweak the authentication * @todo dispatch an event that can be used to tweak the authentication
@@ -817,8 +816,8 @@ class Login implements ControllerProviderInterface
if ($registry->get('GV_captchas') if ($registry->get('GV_captchas')
&& '' !== $privateKey = trim($registry->get('GV_captcha_private_key')) && '' !== $privateKey = trim($registry->get('GV_captcha_private_key'))
&& trim($registry->get('GV_captcha_public_key')) !== '' && trim($registry->get('GV_captcha_public_key')) !== ''
&& null !== $challenge = $request->get("recaptcha_challenge_field") && null !== $challenge = $request->request->get("recaptcha_challenge_field")
&& null !== $captachResponse = $request->get("recaptcha_response_field")) { && null !== $captachResponse = $request->request->get("recaptcha_response_field")) {
include($registry->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php'); include($registry->get('GV_RootPath') . 'lib/vendor/recaptcha/recaptchalib.php');
@@ -835,33 +834,33 @@ class Login implements ControllerProviderInterface
$session->authenticate($auth); $session->authenticate($auth);
} catch (\Exception_Session_StorageClosed $e) { } catch (\Exception_Session_StorageClosed $e) {
return $app->redirect("/login/?redirect=" . $request->get('redirect') . "&error=session"); return $app->redirect("/login/?redirect=" . $request->request->get('redirect') . "&error=session");
} catch (\Exception_Session_RequireCaptcha $e) { } catch (\Exception_Session_RequireCaptcha $e) {
return $app->redirect("/login/?redirect=" . $request->get('redirect') . "&error=captcha"); return $app->redirect("/login/?redirect=" . $request->request->get('redirect') . "&error=captcha");
} catch (\Exception_Unauthorized $e) { } catch (\Exception_Unauthorized $e) {
return $app->redirect("/login/?redirect=" . $request->get('redirect') . "&error=auth"); return $app->redirect("/login/?redirect=" . $request->request->get('redirect') . "&error=auth");
} catch (\Exception_Session_MailLocked $e) { } catch (\Exception_Session_MailLocked $e) {
return $app->redirect("/login/?redirect=" . $request->get('redirect') . "&error=mail-not-confirmed&usr=" . $e->get_usr_id()); return $app->redirect("/login/?redirect=" . $request->request->get('redirect') . "&error=mail-not-confirmed&usr=" . $e->get_usr_id());
} catch (\Exception_Session_WrongToken $e) { } catch (\Exception_Session_WrongToken $e) {
return $app->redirect("/login/?redirect=" . $request->get('redirect') . "&error=token"); return $app->redirect("/login/?redirect=" . $request->request->get('redirect') . "&error=token");
} catch (\Exception_InternalServerError $e) { } catch (\Exception_InternalServerError $e) {
return $app->redirect("/login/?redirect=" . $request->get('redirect') . "&error=session"); return $app->redirect("/login/?redirect=" . $request->request->get('redirect') . "&error=session");
} catch (\Exception_ServiceUnavailable $e) { } catch (\Exception_ServiceUnavailable $e) {
return $app->redirect("/login/?redirect=" . $request->get('redirect') . "&error=maintenance"); return $app->redirect("/login/?redirect=" . $request->request->get('redirect') . "&error=maintenance");
} catch (\Exception_Session_BadSalinity $e) { } catch (\Exception_Session_BadSalinity $e) {
$date = new \DateTime('5 minutes'); $date = new \DateTime('5 minutes');
$usr_id = \User_Adapter::get_usr_id_from_login($request->get('login')); $usr_id = \User_Adapter::get_usr_id_from_login($request->request->get('login'));
$url = '/account/forgot-password/?token=' . \random::getUrlToken(\random::TYPE_PASSWORD, $usr_id, $date) . '&salt=1'; $url = '/account/forgot-password/?token=' . \random::getUrlToken(\random::TYPE_PASSWORD, $usr_id, $date) . '&salt=1';
return $app->redirect($url); return $app->redirect($url);
} catch (\Exception $e) { } catch (\Exception $e) {
return $app->redirect("/login/?redirect=" . $request->get('redirect') . "&error=" . _('An error occured')); return $app->redirect("/login/?redirect=" . $request->request->get('redirect') . "&error=" . _('An error occured'));
} }
if ($app['browser']->isMobile()) { if ($app['browser']->isMobile()) {
return $app->redirect("/lightbox/"); return $app->redirect("/lightbox/");
} elseif ($request->get('redirect')) { } elseif ($request->request->get('redirect')) {
return $app->redirect($request->get('redirect')); return $app->redirect($request->request->get('redirect'));
} elseif (true !== $app['browser']->isNewGeneration()) { } elseif (true !== $app['browser']->isNewGeneration()) {
return $app->redirect('/client/'); return $app->redirect('/client/');
} else { } else {

View File

@@ -87,7 +87,7 @@ class RSSFeeds implements ControllerProviderInterface
$request = $app['request']; $request = $app['request'];
$page = (int) $request->get('page'); $page = (int) $request->query->get('page');
$page = $page < 1 ? 1 : $page; $page = $page < 1 ? 1 : $page;
return $display_feed($feed, $format, $page); return $display_feed($feed, $format, $page);
@@ -102,7 +102,7 @@ class RSSFeeds implements ControllerProviderInterface
} }
$request = $app['request']; $request = $app['request'];
$page = (int) $request->get('page'); $page = (int) $request->query->get('page');
$page = $page < 1 ? 1 : $page; $page = $page < 1 ? 1 : $page;
return $display_feed($feed, $format, $page, $token->get_user()); return $display_feed($feed, $format, $page, $token->get_user());
@@ -118,7 +118,7 @@ class RSSFeeds implements ControllerProviderInterface
$request = $app['request']; $request = $app['request'];
$page = (int) $request->get('page'); $page = (int) $request->query->get('page');
$page = $page < 1 ? 1 : $page; $page = $page < 1 ? 1 : $page;
return $display_feed($feed, $format, $page, $token->get_user()); return $display_feed($feed, $format, $page, $token->get_user());
@@ -129,7 +129,7 @@ class RSSFeeds implements ControllerProviderInterface
$feed = $feeds->get_aggregate(); $feed = $feeds->get_aggregate();
$request = $app['request']; $request = $app['request'];
$page = (int) $request->get('page'); $page = (int) $request->query->get('page');
$page = $page < 1 ? 1 : $page; $page = $page < 1 ? 1 : $page;
return $display_feed($feed, $format, $page); return $display_feed($feed, $format, $page);
@@ -140,7 +140,7 @@ class RSSFeeds implements ControllerProviderInterface
$feed = $feeds->get_aggregate(); $feed = $feeds->get_aggregate();
$request = $app['request']; $request = $app['request'];
$page = (int) $request->get('page'); $page = (int) $request->query->get('page');
$page = $page < 1 ? 1 : $page; $page = $page < 1 ? 1 : $page;
return $display_feed($feed, \Feed_Adapter::FORMAT_COOLIRIS, $page); return $display_feed($feed, \Feed_Adapter::FORMAT_COOLIRIS, $page);

View File

@@ -129,7 +129,7 @@ class Installer implements ControllerProviderInterface
, 'version_number' => $app['phraseanet.core']['Version']->getNumber() , 'version_number' => $app['phraseanet.core']['Version']->getNumber()
, 'version_name' => $app['phraseanet.core']['Version']->getName() , 'version_name' => $app['phraseanet.core']['Version']->getName()
, 'warnings' => $warnings , 'warnings' => $warnings
, 'error' => $request->get('error') , 'error' => $request->query->get('error')
, 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/' , 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/'
, 'discovered_binaries' => \setup::discover_binaries() , 'discovered_binaries' => \setup::discover_binaries()
, 'rootpath' => dirname(dirname(dirname(dirname(__DIR__)))) . '/' , 'rootpath' => dirname(dirname(dirname(dirname(__DIR__)))) . '/'
@@ -145,13 +145,13 @@ class Installer implements ControllerProviderInterface
$conn = $connbas = null; $conn = $connbas = null;
$hostname = $request->get('ab_hostname'); $hostname = $request->request->get('ab_hostname');
$port = $request->get('ab_port'); $port = $request->request->get('ab_port');
$user_ab = $request->get('ab_user'); $user_ab = $request->request->get('ab_user');
$password = $request->get('ab_password'); $password = $request->request->get('ab_password');
$appbox_name = $request->get('ab_name'); $appbox_name = $request->request->get('ab_name');
$databox_name = $request->get('db_name'); $databox_name = $request->request->get('db_name');
try { try {
$conn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $password, $appbox_name, array(), $setupRegistry); $conn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $password, $appbox_name, array(), $setupRegistry);
@@ -206,20 +206,20 @@ class Installer implements ControllerProviderInterface
$appbox->set_registry($registry); $appbox->set_registry($registry);
$registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->get('datapath_noweb')), \registry::TYPE_STRING); $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_ServerName', $servername, \registry::TYPE_STRING);
$registry->set('GV_cli', $request->get('binary_php'), \registry::TYPE_STRING); $registry->set('GV_cli', $request->request->get('binary_php'), \registry::TYPE_STRING);
$registry->set('GV_imagick', $request->get('binary_convert'), \registry::TYPE_STRING); $registry->set('GV_imagick', $request->request->get('binary_convert'), \registry::TYPE_STRING);
$registry->set('GV_pathcomposite', $request->get('binary_composite'), \registry::TYPE_STRING); $registry->set('GV_pathcomposite', $request->request->get('binary_composite'), \registry::TYPE_STRING);
$registry->set('GV_swf_extract', $request->get('binary_swfextract'), \registry::TYPE_STRING); $registry->set('GV_swf_extract', $request->request->get('binary_swfextract'), \registry::TYPE_STRING);
$registry->set('GV_pdf2swf', $request->get('binary_pdf2swf'), \registry::TYPE_STRING); $registry->set('GV_pdf2swf', $request->request->get('binary_pdf2swf'), \registry::TYPE_STRING);
$registry->set('GV_swf_render', $request->get('binary_swfrender'), \registry::TYPE_STRING); $registry->set('GV_swf_render', $request->request->get('binary_swfrender'), \registry::TYPE_STRING);
$registry->set('GV_unoconv', $request->get('binary_unoconv'), \registry::TYPE_STRING); $registry->set('GV_unoconv', $request->request->get('binary_unoconv'), \registry::TYPE_STRING);
$registry->set('GV_ffmpeg', $request->get('binary_ffmpeg'), \registry::TYPE_STRING); $registry->set('GV_ffmpeg', $request->request->get('binary_ffmpeg'), \registry::TYPE_STRING);
$registry->set('GV_mp4box', $request->get('binary_MP4Box'), \registry::TYPE_STRING); $registry->set('GV_mp4box', $request->request->get('binary_MP4Box'), \registry::TYPE_STRING);
$registry->set('GV_pdftotext', $request->get('binary_xpdf'), \registry::TYPE_STRING); $registry->set('GV_pdftotext', $request->request->get('binary_xpdf'), \registry::TYPE_STRING);
$user = \User_Adapter::create($appbox, $request->get('email'), $request->get('password'), $request->get('email'), true); $user = \User_Adapter::create($appbox, $request->request->get('email'), $request->request->get('password'), $request->query->get('email'), true);
\phrasea::start($app['phraseanet.core']); \phrasea::start($app['phraseanet.core']);
@@ -228,7 +228,7 @@ class Installer implements ControllerProviderInterface
$appbox->get_session()->authenticate($auth); $appbox->get_session()->authenticate($auth);
if ($databox_name && ! \p4string::hasAccent($databox_name)) { if ($databox_name && ! \p4string::hasAccent($databox_name)) {
$template = new \SplFileInfo(__DIR__ . '/../../../../conf.d/data_templates/' . $request->get('db_template') . '.xml'); $template = new \SplFileInfo(__DIR__ . '/../../../../conf.d/data_templates/' . $request->query->get('db_template') . '.xml');
$databox = \databox::create($appbox, $connbas, $template, $registry); $databox = \databox::create($appbox, $connbas, $template, $registry);
$user->ACL() $user->ACL()
->give_access_to_sbas(array($databox->get_sbas_id())) ->give_access_to_sbas(array($databox->get_sbas_id()))
@@ -251,7 +251,7 @@ class Installer implements ControllerProviderInterface
) )
); );
$tasks = $request->get('create_task', array()); $tasks = $request->request->get('create_task', array());
foreach ($tasks as $task) { foreach ($tasks as $task) {
switch ($task) { switch ($task) {
case 'cindexer'; case 'cindexer';
@@ -267,7 +267,7 @@ class Installer implements ControllerProviderInterface
$password = $credentials['password']; $password = $credentials['password'];
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n<binpath>" $settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n<binpath>"
. str_replace('/phraseanet_indexer', '', $request->get('binary_phraseanet_indexer')) . str_replace('/phraseanet_indexer', '', $request->request->get('binary_phraseanet_indexer'))
. "</binpath><host>" . $host . "</host><port>" . "</binpath><host>" . $host . "</host><port>"
. $port . "</port><base>" . $port . "</port><base>"
. $appbox_name . "</base><user>" . $appbox_name . "</base><user>"

View File

@@ -30,11 +30,11 @@ class ConnectionTest implements ControllerProviderInterface
require_once __DIR__ . '/../../../../classes/connection/pdo.class.php'; require_once __DIR__ . '/../../../../classes/connection/pdo.class.php';
$request = $app['request']; $request = $app['request'];
$hostname = $request->get('hostname', '127.0.0.1'); $hostname = $request->query->get('hostname', '127.0.0.1');
$port = (int) $request->get('port', 3306); $port = (int) $request->query->get('port', 3306);
$user = $request->get('user'); $user = $request->query->get('user');
$password = $request->get('password'); $password = $request->query->get('password');
$dbname = $request->get('dbname'); $dbname = $request->query->get('dbname');
$connection_ok = $db_ok = $is_databox = $is_appbox = $empty = false; $connection_ok = $db_ok = $is_databox = $is_appbox = $empty = false;

View File

@@ -30,18 +30,18 @@ class PathFileTest implements ControllerProviderInterface
$controllers->get('/path/', function(Application $app, Request $request) { $controllers->get('/path/', function(Application $app, Request $request) {
return $app->json(array( return $app->json(array(
'exists' => file_exists($request->get('path')) 'exists' => file_exists($request->query->get('path'))
, 'file' => is_file($request->get('path')) , 'file' => is_file($request->query->get('path'))
, 'dir' => is_dir($request->get('path')) , 'dir' => is_dir($request->query->get('path'))
, 'readable' => is_readable($request->get('path')) , 'readable' => is_readable($request->query->get('path'))
, 'writeable' => is_writable($request->get('path')) , 'writeable' => is_writable($request->query->get('path'))
, 'executable' => is_executable($request->get('path')) , 'executable' => is_executable($request->query->get('path'))
)); ));
}); });
$controllers->get('/url/', function(Application $app, Request $request) { $controllers->get('/url/', function(Application $app, Request $request) {
return $app->json(array('code' => \http_query::getHttpCodeFromUrl($request->get('url')))); return $app->json(array('code' => \http_query::getHttpCodeFromUrl($request->query->get('url'))));
}); });
return $controllers; return $controllers;