mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Add Phraseanet Service Provider and Phraseanet Application
This commit is contained in:
25
lib/Alchemy/Phrasea/Application.php
Normal file
25
lib/Alchemy/Phrasea/Application.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea;
|
||||
|
||||
use Silex\Application as SilexApplication;
|
||||
|
||||
class Application extends SilexApplication
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->register(new \Alchemy\Phrasea\PhraseanetServiceProvider());
|
||||
|
||||
$this['debug'] = $this['phraseanet.core']->getEnv() !== 'prod';
|
||||
// $this->register(new \Silex\Provider\HttpCacheServiceProvider());
|
||||
// $this->register(new \Silex\Provider\MonologServiceProvider());
|
||||
// $this->register(new \Silex\Provider\SecurityServiceProvider());
|
||||
// $this->register(new \Silex\Provider\SessionServiceProvider());
|
||||
// $this->register(new \Silex\Provider\SwiftmailerServiceProvider());
|
||||
// $this->register(new \Silex\Provider\TwigServiceProvider());
|
||||
// $this->register(new \Silex\Provider\UrlGeneratorServiceProvider());
|
||||
}
|
||||
}
|
||||
|
@@ -21,9 +21,7 @@ use Alchemy\Phrasea\Controller\Utils as ControllerUtils;
|
||||
*/
|
||||
return call_user_func(
|
||||
function() {
|
||||
$app = new \Silex\Application();
|
||||
|
||||
$app['Core'] = \bootstrap::getCore();
|
||||
$app = new \Alchemy\Phrasea\Application();
|
||||
|
||||
$app->mount('/', new Controller\Root());
|
||||
$app->mount('/connected-users', new Controller\ConnectedUsers());
|
||||
|
@@ -23,17 +23,7 @@ use Symfony\Component\HttpKernel\Exception;
|
||||
*/
|
||||
return call_user_func(function() {
|
||||
|
||||
$app = new \Silex\Application();
|
||||
|
||||
/**
|
||||
* @var Alchemy\Phrasea\Core
|
||||
*/
|
||||
$app["Core"] = \bootstrap::getCore();
|
||||
|
||||
/**
|
||||
* @var appbox
|
||||
*/
|
||||
$app["appbox"] = \appbox::get_instance($app['Core']);
|
||||
$app = new \Alchemy\Phrasea\Application();
|
||||
|
||||
/**
|
||||
* @var API_OAuth2_Token
|
||||
@@ -45,7 +35,7 @@ return call_user_func(function() {
|
||||
* @var Closure
|
||||
*/
|
||||
$app['api'] = function () use ($app) {
|
||||
return new \API_V1_adapter(false, $app["appbox"], $app["Core"]);
|
||||
return new \API_V1_adapter(false, $app['phraseanet.appbox'], $app['phraseanet.core']);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -59,13 +49,13 @@ return call_user_func(function() {
|
||||
* @ throws \API_V1_exception_forbidden
|
||||
*/
|
||||
$app->before(function($request) use ($app) {
|
||||
$session = $app["appbox"]->get_session();
|
||||
$registry = $app['Core']->getRegistry();
|
||||
$oauth2_adapter = new \API_OAuth2_Adapter($app["appbox"]);
|
||||
$session = $app['phraseanet.appbox']->get_session();
|
||||
$registry = $app['phraseanet.core']->getRegistry();
|
||||
$oauth2_adapter = new \API_OAuth2_Adapter($app['phraseanet.appbox']);
|
||||
$oauth2_adapter->verifyAccessToken();
|
||||
|
||||
$user = \User_Adapter::getInstance($oauth2_adapter->get_usr_id(), $app["appbox"]);
|
||||
$app['token'] = \API_OAuth2_Token::load_by_oauth_token($app["appbox"], $oauth2_adapter->getToken());
|
||||
$user = \User_Adapter::getInstance($oauth2_adapter->get_usr_id(), $app['phraseanet.appbox']);
|
||||
$app['token'] = \API_OAuth2_Token::load_by_oauth_token($app['phraseanet.appbox'], $oauth2_adapter->getToken());
|
||||
|
||||
$oAuth2App = $app['token']->get_account()->get_application();
|
||||
/* @var $oAuth2App \API_OAuth2_Application */
|
||||
@@ -157,7 +147,7 @@ return call_user_func(function() {
|
||||
$pathInfo = $request->getPathInfo();
|
||||
$route = $parseRoute($pathInfo, $response);
|
||||
\API_V1_Log::create(
|
||||
$app["appbox"]
|
||||
$app['phraseanet.appbox']
|
||||
, $account
|
||||
, $request->getMethod() . " " . $pathInfo
|
||||
, $response->getStatusCode()
|
||||
@@ -732,7 +722,7 @@ return call_user_func(function() {
|
||||
$route = '/feeds/list/';
|
||||
$app->get(
|
||||
$route, function() use ($app) {
|
||||
$result = $app['api']->search_publications($app['request'], $app['Core']->getAuthenticatedUser());
|
||||
$result = $app['api']->search_publications($app['request'], $app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
return $result->get_response();
|
||||
}
|
||||
@@ -741,7 +731,7 @@ return call_user_func(function() {
|
||||
$route = '/feeds/content/';
|
||||
$app->get(
|
||||
$route, function() use ($app) {
|
||||
$result = $app['api']->get_publications($app['request'], $app['Core']->getAuthenticatedUser());
|
||||
$result = $app['api']->get_publications($app['request'], $app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
return $result->get_response();
|
||||
}
|
||||
@@ -750,7 +740,7 @@ return call_user_func(function() {
|
||||
$route = '/feeds/entry/{entry_id}/';
|
||||
$app->get(
|
||||
$route, function($entry_id) use ($app) {
|
||||
$result = $app['api']->get_feed_entry($app['request'], $entry_id, $app['Core']->getAuthenticatedUser());
|
||||
$result = $app['api']->get_feed_entry($app['request'], $entry_id, $app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
return $result->get_response();
|
||||
}
|
||||
@@ -769,7 +759,7 @@ return call_user_func(function() {
|
||||
$route = '/feeds/{feed_id}/content/';
|
||||
$app->get(
|
||||
$route, function($feed_id) use ($app) {
|
||||
$result = $app['api']->get_publication($app['request'], $feed_id, $app['Core']->getAuthenticatedUser());
|
||||
$result = $app['api']->get_publication($app['request'], $feed_id, $app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
return $result->get_response();
|
||||
}
|
||||
|
@@ -21,15 +21,13 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
return call_user_func(function() {
|
||||
|
||||
$app = new \Silex\Application();
|
||||
|
||||
$app["Core"] = \bootstrap::getCore();
|
||||
$app = new \Alchemy\Phrasea\Application();
|
||||
|
||||
$app->get(
|
||||
'/', function(Request $request) use ($app) {
|
||||
$registry = $app["Core"]->getRegistry();
|
||||
$registry = $app['phraseanet.core']->getRegistry();
|
||||
|
||||
$apiAdapter = new \API_V1_adapter(false, \appbox::get_instance($app['Core']), $app["Core"]);
|
||||
$apiAdapter = new \API_V1_adapter(false, $app['phraseanet.appbox'], $app['phraseanet.core']);
|
||||
|
||||
$result = new \API_V1_result($request, $apiAdapter);
|
||||
|
||||
|
@@ -22,19 +22,15 @@ use Alchemy\Phrasea\Controller\Exception as ControllerException;
|
||||
*/
|
||||
return call_user_func(
|
||||
function() {
|
||||
$app = new \Silex\Application();
|
||||
$app = new \Alchemy\Phrasea\Application();
|
||||
|
||||
$app['Core'] = \bootstrap::getCore();
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
|
||||
$app->get('/', function (\Silex\Application $app) use ($appbox) {
|
||||
$app->get('/', function (\Silex\Application $app) {
|
||||
\User_Adapter::updateClientInfos((6));
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
$current_user = $app['Core']->getAuthenticatedUser();
|
||||
$current_user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
/* @var $repository \Repositories\BasketRepository */
|
||||
|
||||
@@ -44,7 +40,7 @@ return call_user_func(
|
||||
);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$browser = \Browser::getInstance();
|
||||
|
||||
@@ -66,21 +62,21 @@ return call_user_func(
|
||||
}
|
||||
);
|
||||
|
||||
$app->get('/ajax/NOTE_FORM/{sselcont_id}/', function(\Silex\Application $app, $sselcont_id) use ($appbox) {
|
||||
$app->get('/ajax/NOTE_FORM/{sselcont_id}/', function(\Silex\Application $app, $sselcont_id) {
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
$browser = \Browser::getInstance();
|
||||
|
||||
if ( ! $browser->isMobile()) {
|
||||
return new Response('');
|
||||
}
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
/* @var $repository \Repositories\BasketElementRepository */
|
||||
$repository = $em->getRepository('\Entities\BasketElement');
|
||||
|
||||
$basket_element = $repository->findUserElement($sselcont_id, $app['Core']->getAuthenticatedUser());
|
||||
$basket_element = $repository->findUserElement($sselcont_id, $app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
$template = 'lightbox/note_form.twig';
|
||||
$output = $twig->render($template, array('basket_element' => $basket_element, 'module_name' => ''));
|
||||
@@ -93,14 +89,14 @@ return call_user_func(
|
||||
$browser = \Browser::getInstance();
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
/* @var $repository \Repositories\BasketElementRepository */
|
||||
$repository = $em->getRepository('\Entities\BasketElement');
|
||||
|
||||
$BasketElement = $repository->findUserElement($sselcont_id, $app['Core']->getAuthenticatedUser());
|
||||
$BasketElement = $repository->findUserElement($sselcont_id, $app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
if ($browser->isMobile()) {
|
||||
$output = $twig->render('lightbox/basket_element.twig', array(
|
||||
@@ -122,8 +118,7 @@ return call_user_func(
|
||||
$template_options = 'lightbox/IE6/sc_options_box.twig';
|
||||
$template_agreement = 'lightbox/IE6/agreement_box.twig';
|
||||
}
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$usr_id = $appbox->get_session()->get_usr_id();
|
||||
$usr_id = $app['phraseanet.appbox']->get_session()->get_usr_id();
|
||||
|
||||
$Basket = $BasketElement->getBasket();
|
||||
|
||||
@@ -138,7 +133,7 @@ return call_user_func(
|
||||
$ret['note_html'] = $twig->render($template_note, array('basket_element' => $BasketElement));
|
||||
$ret['caption'] = $twig->render($template_caption, array('view' => 'preview', 'record' => $BasketElement->getRecord()));
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($ret, 'json')
|
||||
@@ -151,11 +146,10 @@ return call_user_func(
|
||||
|
||||
$app->get('/ajax/LOAD_FEED_ITEM/{entry_id}/{item_id}/', function(\Silex\Application $app, $entry_id, $item_id) {
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$entry = \Feed_Entry_Adapter::load_from_id($appbox, $entry_id);
|
||||
$item = new \Feed_Entry_Item($appbox, $entry, $item_id);
|
||||
$entry = \Feed_Entry_Adapter::load_from_id($app['phraseanet.appbox'], $entry_id);
|
||||
$item = new \Feed_Entry_Item($app['phraseanet.appbox'], $entry, $item_id);
|
||||
|
||||
$browser = \Browser::getInstance();
|
||||
|
||||
@@ -175,7 +169,6 @@ return call_user_func(
|
||||
if ( ! $browser->isNewGeneration()) {
|
||||
$template_options = 'lightbox/IE6/feed_options_box.twig';
|
||||
}
|
||||
$usr_id = $appbox->get_session()->get_usr_id();
|
||||
|
||||
$ret = array();
|
||||
$ret['number'] = $item->get_record()->get_number();
|
||||
@@ -187,7 +180,7 @@ return call_user_func(
|
||||
|
||||
$ret['agreement_html'] = $ret['selector_html'] = $ret['note_html'] = '';
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($ret, 'json')
|
||||
@@ -198,23 +191,23 @@ return call_user_func(
|
||||
}
|
||||
)->assert('entry_id', '\d+')->assert('item_id', '\d+');
|
||||
|
||||
$app->get('/validate/{ssel_id}/', function (\Silex\Application $app, $ssel_id) use ($appbox) {
|
||||
$app->get('/validate/{ssel_id}/', function (\Silex\Application $app, $ssel_id) {
|
||||
|
||||
\User_Adapter::updateClientInfos((6));
|
||||
|
||||
$browser = \Browser::getInstance();
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
/* @var $repository \Repositories\BasketRepository */
|
||||
$basket_collection = $repository->findActiveValidationAndBasketByUser(
|
||||
$app['Core']->getAuthenticatedUser()
|
||||
$app['phraseanet.core']->getAuthenticatedUser()
|
||||
);
|
||||
|
||||
$basket = $repository->findUserBasket(
|
||||
$ssel_id
|
||||
, $app['Core']->getAuthenticatedUser()
|
||||
, $app['phraseanet.core']->getAuthenticatedUser()
|
||||
, false
|
||||
);
|
||||
|
||||
@@ -224,14 +217,14 @@ return call_user_func(
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->getIsAware() === false) {
|
||||
if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['phraseanet.core']->getAuthenticatedUser())->getIsAware() === false) {
|
||||
$basket = $em->merge($basket);
|
||||
$basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->setIsAware(true);
|
||||
$basket->getValidation()->getParticipant($app['phraseanet.core']->getAuthenticatedUser())->setIsAware(true);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$template = 'lightbox/validate.twig';
|
||||
|
||||
@@ -252,23 +245,23 @@ return call_user_func(
|
||||
}
|
||||
)->assert('ssel_id', '\d+');
|
||||
|
||||
$app->get('/compare/{ssel_id}/', function (\Silex\Application $app, $ssel_id) use ($appbox) {
|
||||
$app->get('/compare/{ssel_id}/', function (\Silex\Application $app, $ssel_id) {
|
||||
|
||||
\User_Adapter::updateClientInfos((6));
|
||||
|
||||
$browser = \Browser::getInstance();
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
/* @var $repository \Repositories\BasketRepository */
|
||||
$basket_collection = $repository->findActiveValidationAndBasketByUser(
|
||||
$app['Core']->getAuthenticatedUser()
|
||||
$app['phraseanet.core']->getAuthenticatedUser()
|
||||
);
|
||||
|
||||
$basket = $repository->findUserBasket(
|
||||
$ssel_id
|
||||
, $app['Core']->getAuthenticatedUser()
|
||||
, $app['phraseanet.core']->getAuthenticatedUser()
|
||||
, false
|
||||
);
|
||||
|
||||
@@ -278,14 +271,14 @@ return call_user_func(
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->getIsAware() === false) {
|
||||
if ($basket->getValidation() && $basket->getValidation()->getParticipant($app['phraseanet.core']->getAuthenticatedUser())->getIsAware() === false) {
|
||||
$basket = $em->merge($basket);
|
||||
$basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->setIsAware(true);
|
||||
$basket->getValidation()->getParticipant($app['phraseanet.core']->getAuthenticatedUser())->setIsAware(true);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$template = 'lightbox/validate.twig';
|
||||
|
||||
@@ -306,16 +299,16 @@ return call_user_func(
|
||||
}
|
||||
)->assert('ssel_id', '\d+');
|
||||
|
||||
$app->get('/feeds/entry/{entry_id}/', function (\Silex\Application $app, $entry_id) use ($appbox) {
|
||||
$app->get('/feeds/entry/{entry_id}/', function (\Silex\Application $app, $entry_id) {
|
||||
|
||||
\User_Adapter::updateClientInfos((6));
|
||||
|
||||
$browser = \Browser::getInstance();
|
||||
|
||||
$feed_entry = \Feed_Entry_Adapter::load_from_id($appbox, $entry_id);
|
||||
$feed_entry = \Feed_Entry_Adapter::load_from_id($app['phraseanet.appbox'], $entry_id);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$template = 'lightbox/feed.twig';
|
||||
|
||||
@@ -339,19 +332,19 @@ return call_user_func(
|
||||
|
||||
$app->get('/ajax/LOAD_REPORT/{ssel_id}/', function(\Silex\Application $app, $ssel_id) {
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$browser = \Browser::getInstance();
|
||||
|
||||
$template = 'lightbox/basket_content_report.twig';
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
/* @var $repository \Repositories\BasketRepository */
|
||||
$basket = $repository->findUserBasket(
|
||||
$ssel_id
|
||||
, $app['Core']->getAuthenticatedUser()
|
||||
, $app['phraseanet.core']->getAuthenticatedUser()
|
||||
, false
|
||||
);
|
||||
|
||||
@@ -372,14 +365,14 @@ return call_user_func(
|
||||
Return new Response('You must provide a note value', 400);
|
||||
}
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
/* @var $repository \Repositories\BasketElementRepository */
|
||||
$repository = $em->getRepository('\Entities\BasketElement');
|
||||
|
||||
$basket_element = $repository->findUserElement($sselcont_id, $app['Core']->getAuthenticatedUser());
|
||||
$basket_element = $repository->findUserElement($sselcont_id, $app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
$validationDatas = $basket_element->getUserValidationDatas($app['Core']->getAuthenticatedUser());
|
||||
$validationDatas = $basket_element->getUserValidationDatas($app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
$validationDatas->setNote($note);
|
||||
|
||||
@@ -388,7 +381,7 @@ return call_user_func(
|
||||
$em->flush();
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$browser = \Browser::getInstance();
|
||||
|
||||
@@ -404,7 +397,7 @@ return call_user_func(
|
||||
$output = array('error' => false, 'datas' => $datas);
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($output, 'json')
|
||||
@@ -432,8 +425,8 @@ return call_user_func(
|
||||
'datas' => _('Erreur lors de la mise a jour des donnes ')
|
||||
);
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$repository = $em->getRepository('\Entities\BasketElement');
|
||||
|
||||
/* @var $repository \Repositories\BasketElementRepository */
|
||||
@@ -473,7 +466,7 @@ return call_user_func(
|
||||
} catch (ControllerException $e) {
|
||||
$ret['datas'] = $e->getMessage();
|
||||
}
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($ret, 'json')
|
||||
@@ -483,11 +476,11 @@ return call_user_func(
|
||||
}
|
||||
)->assert('sselcont_id', '\d+');
|
||||
|
||||
$app->post('/ajax/SET_RELEASE/{ssel_id}/', function(\Silex\Application $app, $ssel_id) use ($appbox) {
|
||||
$app->post('/ajax/SET_RELEASE/{ssel_id}/', function(\Silex\Application $app, $ssel_id) {
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
@@ -512,11 +505,10 @@ return call_user_func(
|
||||
/* @var $basket \Entities\Basket */
|
||||
$participant = $basket->getValidation()->getParticipant($user);
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$evt_mngr = \eventsmanager_broker::getInstance($appbox, $app['Core']);
|
||||
$evt_mngr = \eventsmanager_broker::getInstance($app['phraseanet.appbox'], $app['phraseanet.core']);
|
||||
|
||||
$expires = new \DateTime('+10 days');
|
||||
$url = $appbox->get_registry()->get('GV_ServerName')
|
||||
$url = $app['phraseanet.appbox']->get_registry()->get('GV_ServerName')
|
||||
. 'lightbox/index.php?LOG=' . \random::getUrlToken(
|
||||
\random::TYPE_VALIDATE
|
||||
, $basket->getValidation()->getInitiator()->get_id()
|
||||
@@ -527,7 +519,7 @@ return call_user_func(
|
||||
$to = $basket->getValidation()->getInitiator()->get_id();
|
||||
$params = array(
|
||||
'ssel_id' => $basket->getId(),
|
||||
'from' => $app['Core']->getAuthenticatedUser()->get_id(),
|
||||
'from' => $app['phraseanet.core']->getAuthenticatedUser()->get_id(),
|
||||
'url' => $url,
|
||||
'to' => $to
|
||||
);
|
||||
@@ -545,7 +537,7 @@ return call_user_func(
|
||||
$datas = array('error' => true, 'datas' => $e->getMessage());
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
$response = new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
@@ -562,7 +554,7 @@ return call_user_func(
|
||||
$app->error(function($e) use($app) {
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
$registry = \registry::get_instance();
|
||||
|
||||
$template = 'lightbox/error.twig';
|
||||
|
@@ -29,18 +29,12 @@ use Silex\Provider\ValidatorServiceProvider;
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
return call_user_func(function() {
|
||||
$app = new \Silex\Application();
|
||||
|
||||
$app['Core'] = \bootstrap::getCore();
|
||||
|
||||
$app['appbox'] = function() use ($app) {
|
||||
return \appbox::get_instance($app['Core']);
|
||||
};
|
||||
$app = new \Alchemy\Phrasea\Application();
|
||||
|
||||
$app->register(new ValidatorServiceProvider());
|
||||
|
||||
$app['oauth'] = function($app) {
|
||||
return new \API_OAuth2_Adapter($app['appbox']);
|
||||
return new \API_OAuth2_Adapter($app['phraseanet.appbox']);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -50,7 +44,7 @@ return call_user_func(function() {
|
||||
*/
|
||||
$app['response'] = $app->protect(function ($template, $variable) use ($app) {
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$response = new Response(
|
||||
$twig->render($template, $variable)
|
||||
@@ -76,8 +70,8 @@ return call_user_func(function() {
|
||||
$request = $app['request'];
|
||||
$oauth2_adapter = $app['oauth'];
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$session = $app['appbox']->get_session();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
$session = $app['phraseanet.appbox']->get_session();
|
||||
|
||||
//Check for auth params, send error or redirect if not valid
|
||||
$params = $oauth2_adapter->getAuthorizationRequestParameters($request);
|
||||
@@ -86,7 +80,7 @@ return call_user_func(function() {
|
||||
$app_authorized = false;
|
||||
$errorMessage = false;
|
||||
|
||||
$client = \API_OAuth2_Application::load_from_client_id($app['appbox'], $params['client_id']);
|
||||
$client = \API_OAuth2_Application::load_from_client_id($app['phraseanet.appbox'], $params['client_id']);
|
||||
|
||||
$oauth2_adapter->setClient($client);
|
||||
|
||||
@@ -97,7 +91,7 @@ return call_user_func(function() {
|
||||
|
||||
$custom_template = sprintf(
|
||||
"%sconfig/templates/web/api/auth/end_user_authorization/%s.twig"
|
||||
, $app['appbox']->get_registry()->get('GV_RootPath')
|
||||
, $app['phraseanet.appbox']->get_registry()->get('GV_RootPath')
|
||||
, $client->get_id()
|
||||
);
|
||||
|
||||
@@ -113,14 +107,14 @@ return call_user_func(function() {
|
||||
try {
|
||||
$login = $request->get("login");
|
||||
$password = $request->get("password");
|
||||
$auth = new \Session_Authentication_Native($app['appbox'], $login, $password);
|
||||
$auth = new \Session_Authentication_Native($app['phraseanet.appbox'], $login, $password);
|
||||
$session->authenticate($auth);
|
||||
} catch (\Exception $e) {
|
||||
$params = array(
|
||||
"auth" => $oauth2_adapter
|
||||
, "session" => $session
|
||||
, "errorMessage" => true
|
||||
, "user" => $app['Core']->getAuthenticatedUser()
|
||||
, "user" => $app['phraseanet.core']->getAuthenticatedUser()
|
||||
);
|
||||
$html = $twig->render($template, $params);
|
||||
|
||||
@@ -131,7 +125,7 @@ return call_user_func(function() {
|
||||
"auth" => $oauth2_adapter
|
||||
, "session" => $session
|
||||
, "errorMessage" => $errorMessage
|
||||
, "user" => $app['Core']->getAuthenticatedUser()
|
||||
, "user" => $app['phraseanet.core']->getAuthenticatedUser()
|
||||
);
|
||||
$html = $twig->render($template, $params);
|
||||
|
||||
@@ -141,8 +135,8 @@ return call_user_func(function() {
|
||||
|
||||
//check if current client is already authorized by current user
|
||||
$user_auth_clients = \API_OAuth2_Application::load_authorized_app_by_user(
|
||||
$app['appbox']
|
||||
, $app['Core']->getAuthenticatedUser()
|
||||
$app['phraseanet.appbox']
|
||||
, $app['phraseanet.core']->getAuthenticatedUser()
|
||||
);
|
||||
|
||||
foreach ($user_auth_clients as $auth_client) {
|
||||
@@ -159,7 +153,7 @@ return call_user_func(function() {
|
||||
"auth" => $oauth2_adapter
|
||||
, "session" => $session
|
||||
, "errorMessage" => $errorMessage
|
||||
, "user" => $app['Core']->getAuthenticatedUser()
|
||||
, "user" => $app['phraseanet.core']->getAuthenticatedUser()
|
||||
);
|
||||
|
||||
$html = $twig->render($template, $params);
|
||||
@@ -173,7 +167,7 @@ return call_user_func(function() {
|
||||
//if native app show template
|
||||
if ($oauth2_adapter->isNativeApp($params['redirect_uri'])) {
|
||||
$params = $oauth2_adapter->finishNativeClientAuthorization($app_authorized, $params);
|
||||
$params['user'] = $app['Core']->getAuthenticatedUser();
|
||||
$params['user'] = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$html = $twig->render("api/auth/native_app_access_token.twig", $params);
|
||||
|
||||
return new Response($html, 200, array("content-type" => "text/html"));
|
||||
|
@@ -21,12 +21,9 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
*/
|
||||
return call_user_func(
|
||||
function() {
|
||||
$app = new \Alchemy\Phrasea\Application();
|
||||
|
||||
$app = new \Silex\Application();
|
||||
|
||||
$app['Core'] = \bootstrap::getCore();
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$session = $appbox->get_session();
|
||||
|
||||
$deliver_content = function(Request $request, \Session_Handler $session, \record_adapter $record, $subdef, $watermark, $stamp, $app) {
|
||||
@@ -94,7 +91,7 @@ return call_user_func(
|
||||
}
|
||||
}
|
||||
|
||||
$user = \User_Adapter::getInstance($session->get_usr_id(), \appbox::get_instance($app['Core']));
|
||||
$user = \User_Adapter::getInstance($session->get_usr_id(), $app['phraseanet.appbox']);
|
||||
|
||||
if ( ! $user->ACL()->has_access_to_subdef($record, $subdef)) {
|
||||
throw new \Exception_UnauthorizedAction();
|
||||
@@ -118,7 +115,7 @@ return call_user_func(
|
||||
|
||||
if ($watermark && ! $all_access) {
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$repository = $em->getRepository('\Entities\BasketElement');
|
||||
|
||||
@@ -148,7 +145,7 @@ return call_user_func(
|
||||
throw new \Exception('bad luck');
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$params = array(
|
||||
'subdef_name' => $subdef
|
||||
@@ -171,13 +168,13 @@ return call_user_func(
|
||||
$watermark = $stamp = false;
|
||||
|
||||
if ($session->is_authenticated()) {
|
||||
$user = \User_Adapter::getInstance($session->get_usr_id(), \appbox::get_instance($app['Core']));
|
||||
$user = \User_Adapter::getInstance($session->get_usr_id(), $app['phraseanet.appbox']);
|
||||
|
||||
$watermark = ! $user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark');
|
||||
|
||||
if ($watermark) {
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$repository = $em->getRepository('\Entities\BasketElement');
|
||||
|
||||
|
@@ -21,8 +21,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
return call_user_func(function() {
|
||||
$app = new \Silex\Application();
|
||||
$app['Core'] = \bootstrap::getCore();
|
||||
$app = new \Alchemy\Phrasea\Application();
|
||||
|
||||
$app->before(function(Request $request) {
|
||||
$request->setRequestFormat(
|
||||
@@ -71,7 +70,7 @@ return call_user_func(function() {
|
||||
);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
if ($e instanceof \Bridge_Exception_ApiConnectorNotConfigured) {
|
||||
$params = array_merge($params, array('account' => $app['current_account']));
|
||||
@@ -99,7 +98,7 @@ return call_user_func(function() {
|
||||
, 'message' => $e->getMessage()
|
||||
);
|
||||
|
||||
$json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
|
@@ -12,6 +12,8 @@
|
||||
namespace Alchemy\Phrasea\Application;
|
||||
|
||||
use Alchemy\Phrasea\Controller\Root as Controller;
|
||||
use Alchemy\Phrasea\Controller\Login\Authenticate as AuthenticateController;
|
||||
use Alchemy\Phrasea\Controller\Login\Login as LoginController;
|
||||
use Silex\Application as SilexApp;
|
||||
use Silex\Provider\ValidatorServiceProvider;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -32,7 +34,7 @@ return call_user_func(function() {
|
||||
$app->register(new ValidatorServiceProvider());
|
||||
|
||||
$app->before(function () use ($app) {
|
||||
$app['Core']['Firewall']->requireSetup($app);
|
||||
$app['phraseanet.core']['Firewall']->requireSetup($app);
|
||||
});
|
||||
|
||||
$app->get('/', function(SilexApp $app) {
|
||||
@@ -48,7 +50,7 @@ return call_user_func(function() {
|
||||
|
||||
$app->get('/robots.txt', function(SilexApp $app) {
|
||||
|
||||
if ($app['Core']['Registry']->get('GV_allow_search_engine') === true) {
|
||||
if ($app['phraseanet.core']['Registry']->get('GV_allow_search_engine') === true) {
|
||||
$buffer = "User-Agent: *\n" . "Allow: /\n";
|
||||
} else {
|
||||
$buffer = "User-Agent: *\n" . "Disallow: /\n";
|
||||
@@ -62,6 +64,8 @@ return call_user_func(function() {
|
||||
|
||||
$app->mount('/feeds/', new Controller\RSSFeeds());
|
||||
$app->mount('/account/', new Controller\Account());
|
||||
$app->mount('/login/authenticate/', new AuthenticateController());
|
||||
$app->mount('/login/', new LoginController());
|
||||
$app->mount('/developers/', new Controller\Developers());
|
||||
$app->mount('/login/', new Controller\Login());
|
||||
|
||||
|
@@ -21,18 +21,14 @@ use Alchemy\Phrasea\Controller\Utils as ControllerUtils;
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
return call_user_func(function() {
|
||||
$app = new \Silex\Application();
|
||||
|
||||
$app['Core'] = \bootstrap::getCore();
|
||||
$app = new \Alchemy\Phrasea\Application();
|
||||
|
||||
$app['install'] = false;
|
||||
$app['upgrade'] = false;
|
||||
|
||||
$app->before(function($a) use ($app) {
|
||||
if (\setup::is_installed()) {
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
|
||||
if ( ! $appbox->need_major_upgrade()) {
|
||||
if ( ! $app['phraseanet.appbox']->need_major_upgrade()) {
|
||||
throw new \Exception_Setup_PhraseaAlreadyInstalled();
|
||||
}
|
||||
|
||||
|
@@ -11,12 +11,12 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Admin;
|
||||
|
||||
use PHPExiftool\Driver\TagProvider;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Silex\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Silex\ControllerCollection;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -36,7 +36,7 @@ class Description implements ControllerProviderInterface
|
||||
$res = array();
|
||||
|
||||
if ($term) {
|
||||
$provider = new \PHPExiftool\Driver\TagProvider();
|
||||
$provider = new TagProvider();
|
||||
|
||||
$table = $provider->getLookupTable();
|
||||
$table['phraseanet'] = array(
|
||||
@@ -152,12 +152,11 @@ class Description implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
return new \Symfony\Component\HttpFoundation\JsonResponse($res);
|
||||
return $app->json($res);
|
||||
});
|
||||
|
||||
$controllers->post('/{sbas_id}/', function(Application $app, $sbas_id) {
|
||||
$Core = $app['Core'];
|
||||
$user = $Core->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$request = $app['request'];
|
||||
|
||||
@@ -165,7 +164,7 @@ class Description implements ControllerProviderInterface
|
||||
throw new \Exception_Forbidden('You are not allowed to access this zone');
|
||||
}
|
||||
|
||||
$databox = \databox::get_instance((int) $sbas_id);
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||
$fields = $databox->get_meta_structure();
|
||||
$available_dc_fields = $databox->get_available_dcfields();
|
||||
|
||||
@@ -231,18 +230,18 @@ class Description implements ControllerProviderInterface
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if ($error)
|
||||
if ($error) {
|
||||
$databox->get_connection()->rollBack();
|
||||
else
|
||||
} else {
|
||||
$databox->get_connection()->commit();
|
||||
}
|
||||
|
||||
return new RedirectResponse('/admin/description/' . $sbas_id . '/');
|
||||
return $app->redirect('/admin/description/' . $sbas_id . '/');
|
||||
})->assert('sbas_id', '\d+');
|
||||
|
||||
$controllers->get('/{sbas_id}/', function(Application $app, $sbas_id) {
|
||||
|
||||
$Core = $app['Core'];
|
||||
$user = $Core->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$request = $app['request'];
|
||||
|
||||
@@ -261,7 +260,7 @@ class Description implements ControllerProviderInterface
|
||||
'vocabularies' => \Alchemy\Phrasea\Vocabulary\Controller::getAvailable(),
|
||||
);
|
||||
|
||||
return new Response($Core->getTwig()->render('admin/databox/doc_structure.twig', $params));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render('admin/databox/doc_structure.twig', $params));
|
||||
})->assert('sbas_id', '\d+');
|
||||
|
||||
return $controllers;
|
||||
|
@@ -27,7 +27,7 @@ class Fields implements ControllerProviderInterface
|
||||
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
@@ -43,7 +43,7 @@ class Fields implements ControllerProviderInterface
|
||||
'is_multi' => $tag->isMulti(),
|
||||
);
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
@@ -63,7 +63,7 @@ class Fields implements ControllerProviderInterface
|
||||
'is_readonly' => ! $tag->isWritable(),
|
||||
);
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json'),
|
||||
|
@@ -27,7 +27,7 @@ class Publications implements ControllerProviderInterface
|
||||
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$session = $appbox->get_session();
|
||||
|
||||
$controllers = $app['controllers_factory'];
|
||||
@@ -38,7 +38,7 @@ class Publications implements ControllerProviderInterface
|
||||
|
||||
$template = 'admin/publications/list.html';
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, array('feeds' => $feeds));
|
||||
});
|
||||
@@ -62,7 +62,7 @@ class Publications implements ControllerProviderInterface
|
||||
$feed = new \Feed_Adapter($appbox, $id);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render('admin/publications/fiche.html.twig'
|
||||
, array(
|
||||
@@ -106,7 +106,7 @@ class Publications implements ControllerProviderInterface
|
||||
|
||||
$feed = new \Feed_Adapter($appbox, $id);
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$request = $app["request"];
|
||||
|
||||
@@ -128,7 +128,7 @@ class Publications implements ControllerProviderInterface
|
||||
throw new \Exception_BadRequest('Uploaded file is invalid');
|
||||
}
|
||||
|
||||
$media = $app['Core']['mediavorus']->guess($file);
|
||||
$media = $app['phraseanet.core']['mediavorus']->guess($file);
|
||||
|
||||
if ($media->getType() !== \MediaVorus\Media\Media::TYPE_IMAGE) {
|
||||
throw new \Exception_BadRequest('Bad filetype');
|
||||
@@ -144,7 +144,7 @@ class Publications implements ControllerProviderInterface
|
||||
$tmpname = tempnam(sys_get_temp_dir(), 'feed_icon');
|
||||
|
||||
try {
|
||||
$app['Core']['media-alchemyst']
|
||||
$app['phraseanet.core']['media-alchemyst']
|
||||
->open($media->getFile()->getPathname())
|
||||
->turnInto($tmpname, $spec)
|
||||
->close();
|
||||
@@ -156,7 +156,7 @@ class Publications implements ControllerProviderInterface
|
||||
|
||||
unset($media);
|
||||
|
||||
$app['Core']['file-system']->remove($tmpname);
|
||||
$app['phraseanet.core']['file-system']->remove($tmpname);
|
||||
|
||||
$datas['success'] = true;
|
||||
} catch (\Exception $e) {
|
||||
@@ -164,7 +164,7 @@ class Publications implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
return new Response(
|
||||
$app['Core']['Serializer']->serialize($datas, 'json'),
|
||||
$app['phraseanet.core']['Serializer']->serialize($datas, 'json'),
|
||||
200,
|
||||
array('Content-type' => 'application/json')
|
||||
);
|
||||
|
@@ -34,7 +34,7 @@ class Subdefs implements ControllerProviderInterface
|
||||
$controllers->get('/{sbas_id}/', function(Application $app, $sbas_id) {
|
||||
$databox = \databox::get_instance((int) $sbas_id);
|
||||
|
||||
return new response($app['Core']->getTwig()->render(
|
||||
return new response($app['phraseanet.core']->getTwig()->render(
|
||||
'admin/subdefs.twig', array(
|
||||
'databox' => $databox,
|
||||
'subdefs' => $databox->get_subdef_structure()
|
||||
|
@@ -29,27 +29,27 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->post('/rights/', function(Application $app) {
|
||||
$rights = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$template = 'admin/editusers.twig';
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, $rights->get_users_rights());
|
||||
}
|
||||
);
|
||||
|
||||
$controllers->get('/rights/', function(Application $app) {
|
||||
$rights = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$template = 'admin/editusers.twig';
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, $rights->get_users_rights());
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/rights/reset/', function(Application $app, Request $request) {
|
||||
try {
|
||||
$core = $app['Core'];
|
||||
$core = $app['phraseanet.core'];
|
||||
$datas = array('error' => false);
|
||||
|
||||
$helper = new UserHelper\Edit($core, $request);
|
||||
@@ -76,7 +76,7 @@ class Users implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
$controllers->post('/delete/', function(Application $app) {
|
||||
$module = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$module = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
$module->delete_users();
|
||||
|
||||
return $app->redirect('/admin/users/search/');
|
||||
@@ -87,7 +87,7 @@ class Users implements ControllerProviderInterface
|
||||
$datas = array('error' => true);
|
||||
|
||||
try {
|
||||
$rights = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
$rights->apply_rights();
|
||||
|
||||
if ($app['request']->get('template')) {
|
||||
@@ -101,7 +101,7 @@ class Users implements ControllerProviderInterface
|
||||
$datas['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
@@ -112,18 +112,18 @@ class Users implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
$controllers->post('/rights/quotas/', function(Application $app) {
|
||||
$rights = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$template = 'admin/editusers_quotas.twig';
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, $rights->get_quotas());
|
||||
}
|
||||
);
|
||||
|
||||
$controllers->post('/rights/quotas/apply/', function(Application $app) {
|
||||
$rights = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
$rights->apply_quotas();
|
||||
|
||||
return;
|
||||
@@ -131,18 +131,18 @@ class Users implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
$controllers->post('/rights/time/', function(Application $app) {
|
||||
$rights = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$template = 'admin/editusers_timelimit.twig';
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, $rights->get_time());
|
||||
}
|
||||
);
|
||||
|
||||
$controllers->post('/rights/time/apply/', function(Application $app) {
|
||||
$rights = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
$rights->apply_time();
|
||||
|
||||
return;
|
||||
@@ -150,18 +150,18 @@ class Users implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
$controllers->post('/rights/masks/', function(Application $app) {
|
||||
$rights = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$template = 'admin/editusers_masks.twig';
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, $rights->get_masks());
|
||||
}
|
||||
);
|
||||
|
||||
$controllers->post('/rights/masks/apply/', function(Application $app) {
|
||||
$rights = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$rights = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
$rights->apply_masks();
|
||||
|
||||
return;
|
||||
@@ -169,11 +169,11 @@ class Users implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
$controllers->match('/search/', function(Application $app) {
|
||||
$users = new UserHelper\Manage($app['Core'], $app['request']);
|
||||
$users = new UserHelper\Manage($app['phraseanet.core'], $app['request']);
|
||||
$template = 'admin/users.html';
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, $users->search());
|
||||
}
|
||||
@@ -182,12 +182,12 @@ class Users implements ControllerProviderInterface
|
||||
$controllers->post('/search/export/', function() use ($app) {
|
||||
$request = $app['request'];
|
||||
|
||||
$users = new UserHelper\Manage($app['Core'], $app['request']);
|
||||
$users = new UserHelper\Manage($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$template = 'admin/users.html';
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$userTable = array(
|
||||
array(
|
||||
@@ -242,7 +242,7 @@ class Users implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
$controllers->post('/apply_template/', function() use ($app) {
|
||||
$users = new UserHelper\Edit($app['Core'], $app['request']);
|
||||
$users = new UserHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$users->apply_template();
|
||||
|
||||
@@ -287,7 +287,7 @@ class Users implements ControllerProviderInterface
|
||||
);
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
@@ -301,7 +301,7 @@ class Users implements ControllerProviderInterface
|
||||
$datas = array('error' => false, 'message' => '', 'data' => null);
|
||||
try {
|
||||
$request = $app['request'];
|
||||
$module = new UserHelper\Manage($app['Core'], $app['request']);
|
||||
$module = new UserHelper\Manage($app['phraseanet.core'], $app['request']);
|
||||
if ($request->get('template') == '1') {
|
||||
$user = $module->create_template();
|
||||
} else {
|
||||
@@ -316,7 +316,7 @@ class Users implements ControllerProviderInterface
|
||||
$datas['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response($Serializer->serialize($datas, 'json'), 200, array("Content-Type" => "application/json"));
|
||||
}
|
||||
@@ -324,7 +324,7 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/export/csv/', function(Application $app) use ($appbox) {
|
||||
$request = $app['request'];
|
||||
$user_query = new \User_Query($appbox, $app['Core']);
|
||||
$user_query = new \User_Query($appbox, $app['phraseanet.core']);
|
||||
|
||||
$user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
|
||||
$like_value = $request->get('like_value');
|
||||
|
@@ -49,21 +49,21 @@ class Basket implements ControllerProviderInterface
|
||||
|
||||
/* @var $request \Symfony\Component\HttpFoundation\Request */
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$Basket = new \Entities\Basket();
|
||||
|
||||
$Basket->setName($request->get('name', ''));
|
||||
$Basket->setOwner($app['Core']->getAuthenticatedUser());
|
||||
$Basket->setOwner($app['phraseanet.core']->getAuthenticatedUser());
|
||||
$Basket->setDescription($request->get('desc'));
|
||||
|
||||
$em->persist($Basket);
|
||||
|
||||
$n = 0;
|
||||
|
||||
$helper = new \Alchemy\Phrasea\Helper\Record\Basket($app['Core'], $app['request']);
|
||||
$helper = new \Alchemy\Phrasea\Helper\Record\Basket($app['phraseanet.core'], $app['request']);
|
||||
|
||||
foreach ($helper->get_elements() as $record) {
|
||||
|
||||
@@ -92,7 +92,7 @@ class Basket implements ControllerProviderInterface
|
||||
)
|
||||
);
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -107,10 +107,10 @@ class Basket implements ControllerProviderInterface
|
||||
*
|
||||
*/
|
||||
$controllers->post('/{basket_id}/delete/', function(Application $app, Request $request, $basket_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
|
||||
|
||||
$em->remove($basket);
|
||||
$em->flush();
|
||||
@@ -122,7 +122,7 @@ class Basket implements ControllerProviderInterface
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -137,10 +137,10 @@ class Basket implements ControllerProviderInterface
|
||||
'/{basket_id}/delete/{basket_element_id}/'
|
||||
, function(Application $app, Request $request, $basket_id, $basket_element_id) {
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
|
||||
|
||||
foreach ($basket->getElements() as $basket_element) {
|
||||
/* @var $basket_element \Entities\BasketElement */
|
||||
@@ -157,7 +157,7 @@ class Basket implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -205,7 +205,7 @@ class Basket implements ControllerProviderInterface
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -218,13 +218,13 @@ class Basket implements ControllerProviderInterface
|
||||
*/
|
||||
$controllers->get('/{basket_id}/update/', function(Application $app, $basket_id) {
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response(
|
||||
$twig->render(
|
||||
@@ -241,13 +241,13 @@ class Basket implements ControllerProviderInterface
|
||||
'/{basket_id}/reorder/'
|
||||
, function(Application $app, $basket_id) {
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response(
|
||||
$twig->render(
|
||||
@@ -263,10 +263,10 @@ class Basket implements ControllerProviderInterface
|
||||
$ret = array('success' => false, 'message' => _('An error occured'));
|
||||
try {
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
|
||||
|
||||
$order = $app['request']->get('element');
|
||||
|
||||
@@ -284,7 +284,7 @@ class Basket implements ControllerProviderInterface
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response($Serializer->serialize($ret, 'json'), 200, array('Content-type' => 'application/json'));
|
||||
})->assert('basket_id', '\d+');
|
||||
@@ -297,10 +297,10 @@ class Basket implements ControllerProviderInterface
|
||||
* @returns JSON / HTML
|
||||
*/
|
||||
$controllers->post('/{basket_id}/archive/', function(Application $app, Request $request, $basket_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
|
||||
|
||||
$archive_status = ! ! $request->get('archive');
|
||||
|
||||
@@ -323,7 +323,7 @@ class Basket implements ControllerProviderInterface
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -337,17 +337,17 @@ class Basket implements ControllerProviderInterface
|
||||
$controllers->post(
|
||||
'/{basket_id}/addElements/'
|
||||
, function(Application $app, Request $request, $basket_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
/* @var $user \User_Adapter */
|
||||
|
||||
$n = 0;
|
||||
|
||||
$helper = new \Alchemy\Phrasea\Helper\Record\Basket($app['Core'], $app['request']);
|
||||
$helper = new \Alchemy\Phrasea\Helper\Record\Basket($app['phraseanet.core'], $app['request']);
|
||||
|
||||
foreach ($helper->get_elements() as $record) {
|
||||
if ($basket->hasRecord($record))
|
||||
@@ -386,7 +386,7 @@ class Basket implements ControllerProviderInterface
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -404,13 +404,13 @@ class Basket implements ControllerProviderInterface
|
||||
$controllers->post(
|
||||
'/{basket_id}/stealElements/'
|
||||
, function(Application $app, Request $request, $basket_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), true);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), true);
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
/* @var $user \User_Adapter */
|
||||
|
||||
$n = 0;
|
||||
@@ -437,7 +437,7 @@ class Basket implements ControllerProviderInterface
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -450,7 +450,7 @@ class Basket implements ControllerProviderInterface
|
||||
*/
|
||||
$controllers->get('/create/', function(Application $app) {
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response($twig->render('prod/Baskets/Create.html.twig', array()));
|
||||
});
|
||||
@@ -459,10 +459,10 @@ class Basket implements ControllerProviderInterface
|
||||
* Get a basket
|
||||
*/
|
||||
$controllers->get('/{basket_id}/', function(Application $app, Request $request, $basket_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), false);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), false);
|
||||
|
||||
if ($basket->getIsRead() === false) {
|
||||
$basket->setIsRead(true);
|
||||
@@ -470,14 +470,14 @@ class Basket implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ($basket->getValidation()) {
|
||||
if ($basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->getIsAware() === false) {
|
||||
$basket->getValidation()->getParticipant($app['Core']->getAuthenticatedUser())->setIsAware(true);
|
||||
if ($basket->getValidation()->getParticipant($app['phraseanet.core']->getAuthenticatedUser())->getIsAware() === false) {
|
||||
$basket->getValidation()->getParticipant($app['phraseanet.core']->getAuthenticatedUser())->setIsAware(true);
|
||||
$em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$params = array(
|
||||
'basket' => $basket,
|
||||
|
@@ -29,9 +29,9 @@ class Bridge implements ControllerProviderInterface
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$controllers = $app['controllers_factory'];
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$app['require_connection'] = $app->protect(function(\Bridge_Account $account) use ($app) {
|
||||
$app['current_account'] = function() use ($account) {
|
||||
@@ -48,8 +48,8 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/manager/'
|
||||
, function(Application $app) use ($twig) {
|
||||
$route = new RecordHelper\Bridge($app['Core'], $app['request']);
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$route = new RecordHelper\Bridge($app['phraseanet.core'], $app['request']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
|
||||
|
||||
$params = array(
|
||||
@@ -64,7 +64,7 @@ class Bridge implements ControllerProviderInterface
|
||||
});
|
||||
|
||||
$controllers->get('/login/{api_name}/', function($api_name) use ($app, $twig) {
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$connector = \Bridge_Api::get_connector_by_name($appbox->get_registry(), $api_name);
|
||||
|
||||
return $app->redirect($connector->get_auth_url());
|
||||
@@ -73,7 +73,7 @@ class Bridge implements ControllerProviderInterface
|
||||
$controllers->get('/callback/{api_name}/', function($api_name) use ($app, $twig) {
|
||||
$error_message = '';
|
||||
try {
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
|
||||
$api = \Bridge_Api::get_by_api_name($appbox, $api_name);
|
||||
$connector = $api->get_connector();
|
||||
@@ -108,7 +108,7 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/adapter/{account_id}/logout/'
|
||||
, function($account_id) use ($app, $twig) {
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$account = \Bridge_Account::load_account($appbox, $account_id);
|
||||
$app['require_connection']($account);
|
||||
$account->get_api()->get_connector()->disconnect();
|
||||
@@ -121,7 +121,7 @@ class Bridge implements ControllerProviderInterface
|
||||
$page = max((int) $app['request']->get('page'), 0);
|
||||
$quantity = 10;
|
||||
$offset_start = max(($page - 1) * $quantity, 0);
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$account = \Bridge_Account::load_account($appbox, $account_id);
|
||||
$elements = \Bridge_Element::get_elements_by_account($appbox, $account, $offset_start, $quantity);
|
||||
|
||||
@@ -144,7 +144,7 @@ class Bridge implements ControllerProviderInterface
|
||||
$page = max((int) $app['request']->get('page'), 0);
|
||||
$quantity = 5;
|
||||
$offset_start = max(($page - 1) * $quantity, 0);
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$account = \Bridge_Account::load_account($appbox, $account_id);
|
||||
|
||||
$app['require_connection']($account);
|
||||
@@ -170,7 +170,7 @@ class Bridge implements ControllerProviderInterface
|
||||
$page = max((int) $app['request']->get('page'), 0);
|
||||
$quantity = 5;
|
||||
$offset_start = max(($page - 1) * $quantity, 0);
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$account = \Bridge_Account::load_account($appbox, $account_id);
|
||||
|
||||
$app['require_connection']($account);
|
||||
@@ -192,7 +192,7 @@ class Bridge implements ControllerProviderInterface
|
||||
$controllers->get('/action/{account_id}/{action}/{element_type}/'
|
||||
, function($account_id, $action, $element_type) use ($app, $twig) {
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$account = \Bridge_Account::load_account($appbox, $account_id);
|
||||
|
||||
$app['require_connection']($account);
|
||||
@@ -258,7 +258,7 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/action/{account_id}/{action}/{element_type}/'
|
||||
, function($account_id, $action, $element_type) use ($app, $twig) {
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$account = \Bridge_Account::load_account($appbox, $account_id);
|
||||
|
||||
$app['require_connection']($account);
|
||||
@@ -362,11 +362,11 @@ class Bridge implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/upload/', function(Application $app) use ($twig) {
|
||||
$request = $app['request'];
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$account = \Bridge_Account::load_account($appbox, $request->get('account_id'));
|
||||
$app['require_connection']($account);
|
||||
|
||||
$route = new RecordHelper\Bridge($app['Core'], $app['request']);
|
||||
$route = new RecordHelper\Bridge($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$route->grep_records($account->get_api()->acceptable_records());
|
||||
|
||||
@@ -390,11 +390,11 @@ class Bridge implements ControllerProviderInterface
|
||||
, function(Application $app) use ($twig) {
|
||||
$errors = array();
|
||||
$request = $app['request'];
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$account = \Bridge_Account::load_account($appbox, $request->get('account_id'));
|
||||
$app['require_connection']($account);
|
||||
|
||||
$route = new RecordHelper\Bridge($app['Core'], $app['request']);
|
||||
$route = new RecordHelper\Bridge($app['phraseanet.core'], $app['request']);
|
||||
$route->grep_records($account->get_api()->acceptable_records());
|
||||
$connector = $account->get_api()->get_connector();
|
||||
|
||||
|
@@ -31,14 +31,14 @@ class Edit implements ControllerProviderInterface
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->post('/', function(Application $app, Request $request) {
|
||||
$handler = new RecordHelper\Edit($app['Core'], $request);
|
||||
$handler = new RecordHelper\Edit($app['phraseanet.core'], $request);
|
||||
|
||||
$handler->propose_editing();
|
||||
|
||||
$template = 'prod/actions/edit_default.twig';
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, array('edit' => $handler, 'message' => ''));
|
||||
}
|
||||
@@ -47,7 +47,7 @@ class Edit implements ControllerProviderInterface
|
||||
$controllers->get('/vocabulary/{vocabulary}/', function(Application $app, Request $request, $vocabulary) {
|
||||
$datas = array('success' => false, 'message' => '', 'results' => array());
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
$sbas_id = (int) $request->get('sbas_id');
|
||||
|
||||
@@ -68,7 +68,7 @@ class Edit implements ControllerProviderInterface
|
||||
|
||||
$query = $request->get('query');
|
||||
|
||||
$results = $VC->find($query, $app['Core']->getAuthenticatedUser(), $databox);
|
||||
$results = $VC->find($query, $app['phraseanet.core']->getAuthenticatedUser(), $databox);
|
||||
|
||||
$list = array();
|
||||
|
||||
@@ -89,13 +89,13 @@ class Edit implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
$controllers->post('/apply/', function(Application $app, Request $request) {
|
||||
$editing = new RecordHelper\Edit($app['Core'], $app['request']);
|
||||
$editing = new RecordHelper\Edit($app['phraseanet.core'], $app['request']);
|
||||
$editing->execute($request);
|
||||
|
||||
$template = 'prod/actions/edit_default.twig';
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, array('edit' => $editing, 'message' => ''));
|
||||
}
|
||||
|
@@ -29,50 +29,45 @@ class Feed implements ControllerProviderInterface
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$controllers = $app['controllers_factory'];
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
|
||||
/**
|
||||
* I got a selection of docs, which publications are available forthese docs ?
|
||||
*/
|
||||
$controllers->post('/requestavailable/', function(Application $app, Request $request) use ($appbox, $twig) {
|
||||
$user = $app["Core"]->getAuthenticatedUser();
|
||||
$feeds = \Feed_Collection::load_all($appbox, $user);
|
||||
$publishing = new RecordHelper\Feed($app['Core'], $request);
|
||||
$controllers->post('/requestavailable/', function(Application $app, Request $request) {
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$feeds = \Feed_Collection::load_all($app['phraseanet.appbox'], $user);
|
||||
$publishing = new RecordHelper\Feed($app['phraseanet.core'], $request);
|
||||
|
||||
$datas = $twig->render('prod/actions/publish/publish.html', array('publishing' => $publishing, 'feeds' => $feeds));
|
||||
|
||||
return new Response($datas);
|
||||
return new Response($app['phraseanet.core']->getTwig()->render('prod/actions/publish/publish.html', array('publishing' => $publishing, 'feeds' => $feeds)));
|
||||
});
|
||||
|
||||
/**
|
||||
* I've selected a publication for my ocs, let's publish them
|
||||
*/
|
||||
$controllers->post('/entry/create/', function(Application $app, Request $request) use ($appbox, $twig) {
|
||||
$controllers->post('/entry/create/', function(Application $app, Request $request) {
|
||||
try {
|
||||
$user = $app["Core"]->getAuthenticatedUser();
|
||||
$feed = new \Feed_Adapter($appbox, $request->get('feed_id'));
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher($appbox, $feed, $user);
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$feed = new \Feed_Adapter($app['phraseanet.appbox'], $request->get('feed_id'));
|
||||
$publisher = \Feed_Publisher_Adapter::getPublisher($app['phraseanet.appbox'], $feed, $user);
|
||||
|
||||
$title = $request->get('title');
|
||||
$subtitle = $request->get('subtitle');
|
||||
$author_name = $request->get('author_name');
|
||||
$author_mail = $request->get('author_mail');
|
||||
|
||||
$entry = \Feed_Entry_Adapter::create($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);
|
||||
|
||||
$publishing = new RecordHelper\Feed($app['Core'], $app['request']);
|
||||
$publishing = new RecordHelper\Feed($app['phraseanet.core'], $app['request']);
|
||||
|
||||
foreach ($publishing->get_elements() as $record) {
|
||||
$item = \Feed_Entry_Item::create($appbox, $entry, $record);
|
||||
$item = \Feed_Entry_Item::create($app['phraseanet.appbox'], $entry, $record);
|
||||
}
|
||||
$datas = array('error' => false, 'message' => false);
|
||||
} catch (\Exception $e) {
|
||||
$datas = array('error' => true, 'message' => _('An error occured'), 'details' => $e->getMessage());
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
@@ -81,31 +76,31 @@ class Feed implements ControllerProviderInterface
|
||||
);
|
||||
});
|
||||
|
||||
$controllers->get('/entry/{id}/edit/', function(Application $app, Request $request, $id) use ($appbox, $twig) {
|
||||
$controllers->get('/entry/{id}/edit/', function(Application $app, Request $request, $id) {
|
||||
|
||||
$user = $app["Core"]->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$entry = \Feed_Entry_Adapter::load_from_id($appbox, $id);
|
||||
$entry = \Feed_Entry_Adapter::load_from_id($app['phraseanet.appbox'], $id);
|
||||
|
||||
if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()) {
|
||||
throw new \Exception_UnauthorizedAction();
|
||||
}
|
||||
|
||||
$feeds = \Feed_Collection::load_all($appbox, $user);
|
||||
$feeds = \Feed_Collection::load_all($app['phraseanet.appbox'], $user);
|
||||
|
||||
$datas = $twig->render('prod/actions/publish/publish_edit.html', array('entry' => $entry, 'feeds' => $feeds));
|
||||
$datas = $app['phraseanet.core']->getTwig()->render('prod/actions/publish/publish_edit.html', array('entry' => $entry, 'feeds' => $feeds));
|
||||
|
||||
return new Response($datas);
|
||||
})->assert('id', '\d+');
|
||||
|
||||
$controllers->post('/entry/{id}/update/', function(Application $app, Request $request, $id) use ($appbox, $twig) {
|
||||
$controllers->post('/entry/{id}/update/', function(Application $app, Request $request, $id) {
|
||||
$datas = array('error' => true, 'message' => '', 'datas' => '');
|
||||
try {
|
||||
$appbox->get_connection()->beginTransaction();
|
||||
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
||||
|
||||
$user = $app["Core"]->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$entry = \Feed_Entry_Adapter::load_from_id($appbox, $id);
|
||||
$entry = \Feed_Entry_Adapter::load_from_id($app['phraseanet.appbox'], $id);
|
||||
|
||||
if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()) {
|
||||
throw new \Exception_UnauthorizedAction();
|
||||
@@ -125,7 +120,7 @@ class Feed implements ControllerProviderInterface
|
||||
$new_feed_id = $request->get('feed_id',$current_feed_id);
|
||||
if ($current_feed_id != $new_feed_id) {
|
||||
try {
|
||||
$new_feed = \Feed_Adapter::load_with_user($appbox, $user, $new_feed_id);
|
||||
$new_feed = \Feed_Adapter::load_with_user($app['phraseanet.appbox'], $user, $new_feed_id);
|
||||
} catch (\Exception_NotFound $e) {
|
||||
throw new \Exception_Forbidden('You have no access to this feed');
|
||||
}
|
||||
@@ -145,30 +140,30 @@ class Feed implements ControllerProviderInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$item = new \Feed_Entry_Item($appbox, $entry, $item_sort_datas[0]);
|
||||
$item = new \Feed_Entry_Item($app['phraseanet.appbox'], $entry, $item_sort_datas[0]);
|
||||
|
||||
$item->set_ord($item_sort_datas[1]);
|
||||
}
|
||||
$appbox->get_connection()->commit();
|
||||
$app['phraseanet.appbox']->get_connection()->commit();
|
||||
|
||||
$entry = $twig->render('prod/feeds/entry.html', array('entry' => $entry));
|
||||
$entry = $app['phraseanet.core']->getTwig()->render('prod/feeds/entry.html', array('entry' => $entry));
|
||||
|
||||
$datas = array('error' => false, 'message' => 'succes', 'datas' => $entry);
|
||||
} catch (\Exception_Feed_EntryNotFound $e) {
|
||||
$appbox->get_connection()->rollBack();
|
||||
$app['phraseanet.appbox']->get_connection()->rollBack();
|
||||
$datas['message'] = _('Feed entry not found');
|
||||
} catch (\Exception_NotFound $e) {
|
||||
$appbox->get_connection()->rollBack();
|
||||
$app['phraseanet.appbox']->get_connection()->rollBack();
|
||||
$datas['message'] = _('Feed not found');
|
||||
} catch (\Exception_Forbidden $e) {
|
||||
$appbox->get_connection()->rollBack();
|
||||
$app['phraseanet.appbox']->get_connection()->rollBack();
|
||||
$datas['message'] = _('You are not authorized to access this feed');
|
||||
} catch (\Exception $e) {
|
||||
$appbox->get_connection()->rollBack();
|
||||
$app['phraseanet.appbox']->get_connection()->rollBack();
|
||||
$datas['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
@@ -177,14 +172,14 @@ class Feed implements ControllerProviderInterface
|
||||
);
|
||||
})->assert('id', '\d+');
|
||||
|
||||
$controllers->post('/entry/{id}/delete/', function(Application $app, Request $request, $id) use ($appbox, $twig) {
|
||||
$controllers->post('/entry/{id}/delete/', function(Application $app, Request $request, $id) {
|
||||
$datas = array('error' => true, 'message' => '');
|
||||
try {
|
||||
$appbox->get_connection()->beginTransaction();
|
||||
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
||||
|
||||
$user = $app["Core"]->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$entry = \Feed_Entry_Adapter::load_from_id($appbox, $id);
|
||||
$entry = \Feed_Entry_Adapter::load_from_id($app['phraseanet.appbox'], $id);
|
||||
|
||||
if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()
|
||||
&& $entry->get_feed()->is_owner($user) === false) {
|
||||
@@ -193,17 +188,17 @@ class Feed implements ControllerProviderInterface
|
||||
|
||||
$entry->delete();
|
||||
|
||||
$appbox->get_connection()->commit();
|
||||
$app['phraseanet.appbox']->get_connection()->commit();
|
||||
$datas = array('error' => false, 'message' => 'succes');
|
||||
} catch (\Exception_Feed_EntryNotFound $e) {
|
||||
$appbox->get_connection()->rollBack();
|
||||
$app['phraseanet.appbox']->get_connection()->rollBack();
|
||||
$datas['message'] = _('Feed entry not found');
|
||||
} catch (\Exception $e) {
|
||||
$appbox->get_connection()->rollBack();
|
||||
$app['phraseanet.appbox']->get_connection()->rollBack();
|
||||
$datas['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
@@ -212,35 +207,16 @@ class Feed implements ControllerProviderInterface
|
||||
);
|
||||
})->assert('id', '\d+');
|
||||
|
||||
//$app->post('/entry/{id}/addelement/', function($id) use ($app, $appbox, $twig)
|
||||
// {
|
||||
//
|
||||
// });
|
||||
//
|
||||
//$app->post('/element/{id}/update/', function($id) use ($app, $appbox, $twig)
|
||||
// {
|
||||
//
|
||||
// });
|
||||
//
|
||||
//$app->post('/element/{id}/delete/', function($id) use ($app, $appbox, $twig)
|
||||
// {
|
||||
//
|
||||
// });
|
||||
//$app->get('/entry/{id}/', function($id) use ($app, $appbox, $twig)
|
||||
// {
|
||||
//
|
||||
// });
|
||||
|
||||
$controllers->get('/', function(Application $app, Request $request) use ($appbox, $twig) {
|
||||
$controllers->get('/', function(Application $app, Request $request) {
|
||||
$request = $app['request'];
|
||||
$page = (int) $request->get('page');
|
||||
$page = $page > 0 ? $page : 1;
|
||||
|
||||
$user = $app["Core"]->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$feeds = \Feed_Collection::load_all($appbox, $user);
|
||||
$feeds = \Feed_Collection::load_all($app['phraseanet.appbox'], $user);
|
||||
|
||||
$datas = $twig->render('prod/feeds/feeds.html'
|
||||
$datas = $app['phraseanet.core']->getTwig()->render('prod/feeds/feeds.html'
|
||||
, array(
|
||||
'feeds' => $feeds
|
||||
, 'feed' => $feeds->get_aggregate()
|
||||
@@ -251,27 +227,27 @@ class Feed implements ControllerProviderInterface
|
||||
return new Response($datas);
|
||||
});
|
||||
|
||||
$controllers->get('/feed/{id}/', function(Application $app, Request $request, $id) use ($appbox, $twig) {
|
||||
$controllers->get('/feed/{id}/', function(Application $app, Request $request, $id) {
|
||||
$page = (int) $request->get('page');
|
||||
$page = $page > 0 ? $page : 1;
|
||||
|
||||
$user = $app["Core"]->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$feed = \Feed_Adapter::load_with_user($appbox, $user, $id);
|
||||
$feeds = \Feed_Collection::load_all($appbox, $user);
|
||||
$feed = \Feed_Adapter::load_with_user($app['phraseanet.appbox'], $user, $id);
|
||||
$feeds = \Feed_Collection::load_all($app['phraseanet.appbox'], $user);
|
||||
|
||||
$datas = $twig->render('prod/feeds/feeds.html', array('feed' => $feed, 'feeds' => $feeds, 'page' => $page));
|
||||
$datas = $app['phraseanet.core']->getTwig()->render('prod/feeds/feeds.html', array('feed' => $feed, 'feeds' => $feeds, 'page' => $page));
|
||||
|
||||
return new Response($datas);
|
||||
})->assert('id', '\d+');
|
||||
|
||||
$controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) use ( $appbox, $twig) {
|
||||
$controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) {
|
||||
$renew = ($request->get('renew') === 'true');
|
||||
|
||||
$user = $app["Core"]->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$feeds = \Feed_Collection::load_all($appbox, $user);
|
||||
$registry = $appbox->get_registry();
|
||||
$feeds = \Feed_Collection::load_all($app['phraseanet.appbox'], $user);
|
||||
$registry = $app['phraseanet.appbox']->get_registry();
|
||||
|
||||
$output = array(
|
||||
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
||||
@@ -280,7 +256,7 @@ class Feed implements ControllerProviderInterface
|
||||
'titre' => _('publications::votre rss personnel')
|
||||
);
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($output, 'json')
|
||||
@@ -289,11 +265,11 @@ class Feed implements ControllerProviderInterface
|
||||
);
|
||||
});
|
||||
|
||||
$controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) use ($appbox, $twig) {
|
||||
$controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) {
|
||||
$renew = ($request->get('renew') === 'true');
|
||||
$user = $app["Core"]->getAuthenticatedUser();
|
||||
$feed = \Feed_Adapter::load_with_user($appbox, $user, $id);
|
||||
$registry = $appbox->get_registry();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$feed = \Feed_Adapter::load_with_user($app['phraseanet.appbox'], $user, $id);
|
||||
$registry = $app['phraseanet.appbox']->get_registry();
|
||||
|
||||
$output = array(
|
||||
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
||||
@@ -302,7 +278,7 @@ class Feed implements ControllerProviderInterface
|
||||
'titre' => _('publications::votre rss personnel')
|
||||
);
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($output, 'json')
|
||||
|
@@ -101,7 +101,7 @@ class Language implements ControllerProviderInterface
|
||||
$out['browserFeatureSupport'] = _('This feature is not supported by your browser');
|
||||
$out['noActiveBasket'] = _('No active basket');
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($out, 'json')
|
||||
|
@@ -155,8 +155,8 @@ class Lazaret implements ControllerProviderInterface
|
||||
*/
|
||||
public function listElement(Application $app, Request $request)
|
||||
{
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
/* @var $user \User_Adapter */
|
||||
$baseIds = array_keys($user->ACL()->get_granted_base(array('canaddrecord')));
|
||||
|
||||
@@ -170,7 +170,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
);
|
||||
}
|
||||
|
||||
$html = $app['Core']['Twig']->render(
|
||||
$html = $app['phraseanet.core']['Twig']->render(
|
||||
'prod/upload/lazaret.html.twig', array('lazaretFiles' => $lazaretFiles)
|
||||
);
|
||||
|
||||
@@ -236,7 +236,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
if (null === $baseId = $request->get('bas_id')) {
|
||||
$ret['message'] = _('You must give a destination collection');
|
||||
|
||||
return self::formatJson($app['Core']['Serializer'], $ret);
|
||||
return self::formatJson($app['phraseanet.core']['Serializer'], $ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
};
|
||||
|
||||
//Force creation record
|
||||
$app['Core']['border-manager']->process(
|
||||
$app['phraseanet.core']['border-manager']->process(
|
||||
$lazaretFile->getSession(), $borderFile, $callBack, Border\Manager::FORCE_RECORD
|
||||
);
|
||||
|
||||
@@ -311,8 +311,8 @@ class Lazaret implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
//Delete lazaret file
|
||||
$app['Core']['EM']->remove($lazaretFile);
|
||||
$app['Core']['EM']->flush();
|
||||
$app['phraseanet.core']['EM']->remove($lazaretFile);
|
||||
$app['phraseanet.core']['EM']->flush();
|
||||
|
||||
$ret['success'] = true;
|
||||
} catch (\Exception $e) {
|
||||
@@ -391,7 +391,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
if (null === $recordId = $request->get('record_id')) {
|
||||
$ret['message'] = _('You must give a destination record');
|
||||
|
||||
return self::formatJson($app['Core']['Serializer'], $ret);
|
||||
return self::formatJson($app['phraseanet.core']['Serializer'], $ret);
|
||||
}
|
||||
|
||||
$lazaretFile = $app['Core']['EM']->find('Entities\LazaretFile', $file_id);
|
||||
@@ -431,8 +431,8 @@ class Lazaret implements ControllerProviderInterface
|
||||
$record->substitute_subdef('document', $media);
|
||||
|
||||
//Delete lazaret file
|
||||
$app['Core']['EM']->remove($lazaretFile);
|
||||
$app['Core']['EM']->flush();
|
||||
$app['phraseanet.core']['EM']->remove($lazaretFile);
|
||||
$app['phraseanet.core']['EM']->flush();
|
||||
|
||||
$ret['success'] = true;
|
||||
} catch (\Exception $e) {
|
||||
@@ -460,7 +460,7 @@ class Lazaret implements ControllerProviderInterface
|
||||
*/
|
||||
public function thumbnailElement(Application $app, Request $request, $file_id)
|
||||
{
|
||||
$lazaretFile = $app['Core']['EM']->find('Entities\LazaretFile', $file_id);
|
||||
$lazaretFile = $app['phraseanet.core']['EM']->find('Entities\LazaretFile', $file_id);
|
||||
|
||||
/* @var $lazaretFile \Entities\LazaretFile */
|
||||
if (null === $lazaretFile) {
|
||||
|
@@ -32,12 +32,12 @@ class MoveCollection implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/', function(Application $app, Request $request) {
|
||||
$request = $app['request'];
|
||||
$move = new RecordHelper\MoveCollection($app['Core'], $app['request']);
|
||||
$move = new RecordHelper\MoveCollection($app['phraseanet.core'], $app['request']);
|
||||
$move->propose();
|
||||
|
||||
$template = 'prod/actions/collection_default.twig';
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, array('action' => $move, 'message' => ''));
|
||||
}
|
||||
|
@@ -31,23 +31,23 @@ class Printer implements ControllerProviderInterface
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->post('/', function(Application $app) {
|
||||
$printer = new RecordHelper\Printer($app['Core'], $app['request']);
|
||||
$printer = new RecordHelper\Printer($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$template = 'prod/actions/printer_default.html.twig';
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render($template, array('printer' => $printer, 'message' => ''));
|
||||
}
|
||||
);
|
||||
|
||||
$controllers->post('/print.pdf', function(Application $app) {
|
||||
$printer = new RecordHelper\Printer($app['Core'], $app['request']);
|
||||
$printer = new RecordHelper\Printer($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$request = $app['request'];
|
||||
|
||||
$session = \Session_Handler::getInstance(\appbox::get_instance($app['Core']));
|
||||
$session = \Session_Handler::getInstance($app['phraseanet.appbox']);
|
||||
|
||||
$layout = $request->get('lay');
|
||||
|
||||
|
@@ -103,9 +103,9 @@ class Push implements ControllerProviderInterface
|
||||
$userSelection = $this->getUsersInSelectionExtractor();
|
||||
|
||||
$controllers->post('/sendform/', function(Application $app) use ($userSelection) {
|
||||
$push = new RecordHelper\Push($app['Core'], $app['request']);
|
||||
$push = new RecordHelper\Push($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
|
||||
$RecommendedUsers = $userSelection($push->get_elements());
|
||||
@@ -113,7 +113,7 @@ class Push implements ControllerProviderInterface
|
||||
$params = array(
|
||||
'push' => $push,
|
||||
'message' => '',
|
||||
'lists' => $repository->findUserLists($app['Core']->getAuthenticatedUser()),
|
||||
'lists' => $repository->findUserLists($app['phraseanet.core']->getAuthenticatedUser()),
|
||||
'context' => 'Push',
|
||||
'RecommendedUsers' => $RecommendedUsers
|
||||
);
|
||||
@@ -121,16 +121,16 @@ class Push implements ControllerProviderInterface
|
||||
$template = 'prod/actions/Push.html.twig';
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response($twig->render($template, $params));
|
||||
}
|
||||
);
|
||||
|
||||
$controllers->post('/validateform/', function(Application $app) use ($userSelection) {
|
||||
$push = new RecordHelper\Push($app['Core'], $app['request']);
|
||||
$push = new RecordHelper\Push($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
|
||||
$RecommendedUsers = $userSelection($push->get_elements());
|
||||
@@ -138,7 +138,7 @@ class Push implements ControllerProviderInterface
|
||||
$params = array(
|
||||
'push' => $push,
|
||||
'message' => '',
|
||||
'lists' => $repository->findUserLists($app['Core']->getAuthenticatedUser()),
|
||||
'lists' => $repository->findUserLists($app['phraseanet.core']->getAuthenticatedUser()),
|
||||
'context' => 'Feedback',
|
||||
'RecommendedUsers' => $RecommendedUsers
|
||||
);
|
||||
@@ -146,7 +146,7 @@ class Push implements ControllerProviderInterface
|
||||
$template = 'prod/actions/Push.html.twig';
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response($twig->render($template, $params));
|
||||
}
|
||||
@@ -161,15 +161,15 @@ class Push implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
try {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$registry = $app['Core']->getRegistry();
|
||||
$registry = $app['phraseanet.core']->getRegistry();
|
||||
|
||||
$pusher = new RecordHelper\Push($app['Core'], $app['request']);
|
||||
$pusher = new RecordHelper\Push($app['phraseanet.core'], $app['request']);
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
$push_name = $request->get('name');
|
||||
|
||||
@@ -189,7 +189,7 @@ class Push implements ControllerProviderInterface
|
||||
throw new ControllerException(_('No elements to push'));
|
||||
}
|
||||
|
||||
$events_manager = \eventsmanager_broker::getInstance(\appbox::get_instance($app['Core']), $app['Core']);
|
||||
$events_manager = \eventsmanager_broker::getInstance($app['phraseanet.appbox'], $app['phraseanet.core']);
|
||||
|
||||
foreach ($receivers as $receiver) {
|
||||
try {
|
||||
@@ -271,7 +271,7 @@ class Push implements ControllerProviderInterface
|
||||
$ret['message'] = $e->getMessage() . $e->getFile() . $e->getLine();
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($ret, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($ret, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
@@ -279,25 +279,25 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$controllers->post('/validate/', function(Application $app) {
|
||||
$request = $app['request'];
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
$ret = array(
|
||||
'success' => false,
|
||||
'message' => _('Unable to send the documents')
|
||||
);
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$registry = $app['Core']->getRegistry();
|
||||
$registry = $app['phraseanet.core']->getRegistry();
|
||||
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$em->beginTransaction();
|
||||
|
||||
try {
|
||||
$pusher = new RecordHelper\Push($app['Core'], $app['request']);
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$pusher = new RecordHelper\Push($app['phraseanet.core'], $app['request']);
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$events_manager = \eventsmanager_broker::getInstance(\appbox::get_instance($app['Core']), $app['Core']);
|
||||
$events_manager = \eventsmanager_broker::getInstance($app['phraseanet.appbox'], $app['phraseanet.core']);
|
||||
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
@@ -346,7 +346,7 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
if ( ! $Basket->getValidation()) {
|
||||
$Validation = new \Entities\ValidationSession();
|
||||
$Validation->setInitiator($app['Core']->getAuthenticatedUser());
|
||||
$Validation->setInitiator($app['phraseanet.core']->getAuthenticatedUser());
|
||||
$Validation->setBasket($Basket);
|
||||
|
||||
$duration = (int) $request->get('duration');
|
||||
@@ -362,7 +362,7 @@ class Push implements ControllerProviderInterface
|
||||
$Validation = $Basket->getValidation();
|
||||
}
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
$found = false;
|
||||
foreach ($participants as $key => $participant) {
|
||||
@@ -483,7 +483,7 @@ class Push implements ControllerProviderInterface
|
||||
$em->rollback();
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($ret, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($ret, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
@@ -494,10 +494,10 @@ class Push implements ControllerProviderInterface
|
||||
$datas = null;
|
||||
|
||||
$request = $app['request'];
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$query = new \User_Query(\appbox::get_instance($app['Core']));
|
||||
$query = new \User_Query($app['phraseanet.appbox']);
|
||||
|
||||
$query->on_bases_where_i_am($user->ACL(), array('canpush'));
|
||||
|
||||
@@ -513,7 +513,7 @@ class Push implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
})->assert('usr_id', '\d+');
|
||||
@@ -521,8 +521,8 @@ class Push implements ControllerProviderInterface
|
||||
$controllers->get('/list/{list_id}/', function(Application $app, $list_id) use ($listFormatter) {
|
||||
$datas = null;
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
|
||||
@@ -532,7 +532,7 @@ class Push implements ControllerProviderInterface
|
||||
$datas = $listFormatter($list);
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
})->assert('list_id', '\d+');
|
||||
@@ -540,9 +540,9 @@ class Push implements ControllerProviderInterface
|
||||
$controllers->post('/add-user/', function(Application $app, Request $request) use ($userFormatter) {
|
||||
$result = array('success' => false, 'message' => '', 'user' => null);
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
$AdminUser = $app['Core']->getAuthenticatedUser();
|
||||
$AdminUser = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
try {
|
||||
/* @var $AdminUser \User_Adapter */
|
||||
@@ -566,7 +566,7 @@ class Push implements ControllerProviderInterface
|
||||
return new Response($Serializer->serialize($result, 'json'), 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
$user = null;
|
||||
$email = $request->get('email');
|
||||
@@ -612,15 +612,15 @@ class Push implements ControllerProviderInterface
|
||||
$controllers->get('/add-user/', function(Application $app, Request $request) {
|
||||
$params = array('callback' => $request->get('callback'));
|
||||
|
||||
return new Response($app['Core']['Twig']->render('prod/User/Add.html.twig', $params));
|
||||
return new Response($app['phraseanet.core']['Twig']->render('prod/User/Add.html.twig', $params));
|
||||
});
|
||||
|
||||
$controllers->get('/search-user/', function(Application $app) use ($userFormatter, $listFormatter) {
|
||||
$request = $app['request'];
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$query = new \User_Query(\appbox::get_instance($app['Core']));
|
||||
$query = new \User_Query($app['phraseanet.appbox']);
|
||||
|
||||
$query->on_bases_where_i_am($user->ACL(), array('canpush'));
|
||||
|
||||
@@ -651,7 +651,7 @@ class Push implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
@@ -659,14 +659,14 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$controllers->match('/edit-list/{list_id}/', function(Application $app, Request $request, $list_id) {
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
|
||||
$list = $repository->findUserListByUserAndId($user, $list_id);
|
||||
|
||||
$query = new \User_Query(\appbox::get_instance($app['Core']));
|
||||
$query = new \User_Query($app['phraseanet.appbox']);
|
||||
|
||||
$query->on_bases_where_i_am($user->ACL(), array('canpush'));
|
||||
|
||||
@@ -712,11 +712,11 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
if ($request->get('type') === 'fragment') {
|
||||
return new Response(
|
||||
$app['Core']->getTwig()->render('prod/actions/Feedback/ResultTable.html.twig', $params)
|
||||
$app['phraseanet.core']->getTwig()->render('prod/actions/Feedback/ResultTable.html.twig', $params)
|
||||
);
|
||||
} else {
|
||||
return new Response(
|
||||
$app['Core']->getTwig()->render('prod/actions/Feedback/list.html.twig', $params)
|
||||
$app['phraseanet.core']->getTwig()->render('prod/actions/Feedback/list.html.twig', $params)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -33,10 +33,10 @@ class Query implements ControllerProviderInterface
|
||||
|
||||
$controllers->match('/', function(Application $app, Request $request) {
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$registry = $appbox->get_registry();
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$query = (string) $request->get('qry');
|
||||
|
||||
@@ -209,7 +209,7 @@ class Query implements ControllerProviderInterface
|
||||
$json['prev_page'] = ($page > 1 && $result->get_count_available_results() > 0) ? ($page - 1) : false;
|
||||
$json['form'] = $form;
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($json, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($json, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-Type' => 'application/json'));
|
||||
});
|
||||
|
@@ -38,9 +38,9 @@ class Root implements ControllerProviderInterface
|
||||
|
||||
\User_Adapter::updateClientInfos(1);
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$registry = $app['Core']->getRegistry();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$registry = $app['phraseanet.core']->getRegistry();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$cssPath = $registry->get('GV_RootPath') . 'www/skins/prod/';
|
||||
|
||||
$css = array();
|
||||
@@ -99,17 +99,17 @@ class Root implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
$out = $twig->render('prod/index.html.twig', array(
|
||||
'module_name' => 'Production',
|
||||
'WorkZone' => new Helper\WorkZone($app['Core'], $app['request']),
|
||||
'module_prod' => new Helper\Prod($app['Core'], $app['request']),
|
||||
'WorkZone' => new Helper\WorkZone($app['phraseanet.core'], $app['request']),
|
||||
'module_prod' => new Helper\Prod($app['phraseanet.core'], $app['request']),
|
||||
'cssfile' => $cssfile,
|
||||
'module' => 'prod',
|
||||
'events' => \eventsmanager_broker::getInstance($appbox, $app['Core']),
|
||||
'events' => \eventsmanager_broker::getInstance($appbox, $app['phraseanet.core']),
|
||||
'GV_defaultQuery_type' => $registry->get('GV_defaultQuery_type'),
|
||||
'GV_multiAndReport' => $registry->get('GV_multiAndReport'),
|
||||
'GV_thesaurus' => $registry->get('GV_thesaurus'),
|
||||
|
@@ -37,16 +37,16 @@ class Story implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/create/', function(Application $app) {
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response($twig->render('prod/Story/Create.html.twig', array()));
|
||||
});
|
||||
|
||||
$controllers->post('/', function(Application $app, Request $request) {
|
||||
/* @var $request \Symfony\Component\HttpFoundation\Request */
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$collection = \collection::get_from_base_id($request->get('base_id'));
|
||||
|
||||
@@ -116,7 +116,7 @@ class Story implements ControllerProviderInterface
|
||||
)
|
||||
);
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -128,7 +128,7 @@ class Story implements ControllerProviderInterface
|
||||
$Story = new \record_adapter($sbas_id, $record_id);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$html = $twig->render('prod/WorkZone/Story.html.twig', array('Story' => $Story));
|
||||
|
||||
@@ -140,7 +140,7 @@ class Story implements ControllerProviderInterface
|
||||
, function(Application $app, Request $request, $sbas_id, $record_id) {
|
||||
$Story = new \record_adapter($sbas_id, $record_id);
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
if ( ! $user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
|
||||
throw new \Exception_Forbidden('You can not add document to this Story');
|
||||
@@ -178,7 +178,7 @@ class Story implements ControllerProviderInterface
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -193,7 +193,7 @@ class Story implements ControllerProviderInterface
|
||||
|
||||
$record = new \record_adapter($child_sbas_id, $child_record_id);
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
if ( ! $user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
|
||||
throw new \Exception_Forbidden('You can not add document to this Story');
|
||||
@@ -208,7 +208,7 @@ class Story implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -227,7 +227,7 @@ class Story implements ControllerProviderInterface
|
||||
'/{sbas_id}/{record_id}/reorder/'
|
||||
, function(Application $app, $sbas_id, $record_id) {
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$story = new \record_adapter($sbas_id, $record_id);
|
||||
|
||||
@@ -236,7 +236,7 @@ class Story implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response(
|
||||
$twig->render(
|
||||
@@ -253,7 +253,7 @@ class Story implements ControllerProviderInterface
|
||||
, function(Application $app, $sbas_id, $record_id) {
|
||||
$ret = array('success' => false, 'message' => _('An error occured'));
|
||||
try {
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
/* @var $user \User_Adapter */
|
||||
|
||||
$story = new \record_adapter($sbas_id, $record_id);
|
||||
@@ -288,7 +288,7 @@ class Story implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response($Serializer->serialize($ret, 'json'), 200, array('Content-type' => 'application/json'));
|
||||
})
|
||||
|
@@ -33,8 +33,8 @@ class TOU implements ControllerProviderInterface
|
||||
$ret = array('success' => false, 'message' => '');
|
||||
|
||||
try {
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$session = \Session_Handler::getInstance(\appbox::get_instance($app['Core']));
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$session = \Session_Handler::getInstance($app['phraseanet.appbox']);
|
||||
|
||||
$databox = \databox::get_instance((int) $sbas_id);
|
||||
|
||||
@@ -50,7 +50,7 @@ class TOU implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
$datas = $Serializer->serialize($ret, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-Type' => 'application/json'));
|
||||
|
@@ -33,7 +33,7 @@ class Tools implements ControllerProviderInterface
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->get('/', function(Application $app, Request $request) {
|
||||
$helper = new Helper\Record\Tools($app['Core'], $request);
|
||||
$helper = new Helper\Record\Tools($app['phraseanet.core'], $request);
|
||||
|
||||
$selection = $helper->get_elements();
|
||||
|
||||
@@ -72,13 +72,13 @@ class Tools implements ControllerProviderInterface
|
||||
'metadatas' => $metadatas,
|
||||
);
|
||||
|
||||
return new Response($app['Core']->getTwig()->render($template, $var));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render($template, $var));
|
||||
});
|
||||
|
||||
$controllers->post('/rotate/', function(Application $app, Request $request) {
|
||||
$return = array('success' => false, 'errorMessage' => '');
|
||||
|
||||
$helper = new Helper\Record\Tools($app['Core'], $request);
|
||||
$helper = new Helper\Record\Tools($app['phraseanet.core'], $request);
|
||||
|
||||
$rotation = in_array($request->get('rotation'), array('-90', '90', '180')) ? $request->get('rotation', 90) : 90;
|
||||
|
||||
@@ -93,7 +93,7 @@ class Tools implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$json = $app['Core']->getSerializer()->serialize($return, 'json');
|
||||
$json = $app['phraseanet.core']->getSerializer()->serialize($return, 'json');
|
||||
|
||||
return new Response($json, 200, array('content-type' => 'application/json'));
|
||||
});
|
||||
@@ -101,7 +101,7 @@ class Tools implements ControllerProviderInterface
|
||||
$controllers->post('/image/', function(Application $app, Request $request) {
|
||||
$return = array('success' => true);
|
||||
|
||||
$helper = new Helper\Record\Tools($app['Core'], $request);
|
||||
$helper = new Helper\Record\Tools($app['phraseanet.core'], $request);
|
||||
|
||||
$selection = $helper->get_elements();
|
||||
|
||||
@@ -120,7 +120,7 @@ class Tools implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$json = $app['Core']->getSerializer()->serialize($return, 'json');
|
||||
$json = $app['phraseanet.core']->getSerializer()->serialize($return, 'json');
|
||||
|
||||
return new Response($json, 200, array('content-type' => 'application/json'));
|
||||
});
|
||||
@@ -143,7 +143,7 @@ class Tools implements ControllerProviderInterface
|
||||
, $request->get('record_id')
|
||||
);
|
||||
|
||||
$media = $app['Core']['mediavorus']->guess($file);
|
||||
$media = $app['phraseanet.core']['mediavorus']->guess($file);
|
||||
|
||||
$record->substitute_subdef('document', $media);
|
||||
|
||||
@@ -167,7 +167,7 @@ class Tools implements ControllerProviderInterface
|
||||
, 'errorMessage' => $errorMessage
|
||||
);
|
||||
|
||||
return new Response($app['Core']->getTwig()->render($template, $var));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render($template, $var));
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -185,7 +185,7 @@ class Tools implements ControllerProviderInterface
|
||||
|
||||
if ($size && $fileName && $file->isValid()) {
|
||||
try {
|
||||
$rootPath = $app['Core']->getRegistry()->get('GV_RootPath');
|
||||
$rootPath = $app['phraseanet.core']->getRegistry()->get('GV_RootPath');
|
||||
$tmpFile = $rootPath . 'tmp/' . $fileName;
|
||||
rename($file->getPathname(), $tmpFile);
|
||||
|
||||
@@ -194,7 +194,7 @@ class Tools implements ControllerProviderInterface
|
||||
, $request->get('record_id')
|
||||
);
|
||||
|
||||
$media = $app['Core']['mediavorus']->guess($file);
|
||||
$media = $app['phraseanet.core']['mediavorus']->guess($file);
|
||||
|
||||
$record->substitute_subdef('thumbnail', $media);
|
||||
|
||||
@@ -213,7 +213,7 @@ class Tools implements ControllerProviderInterface
|
||||
, 'errorMessage' => $errorMessage
|
||||
);
|
||||
|
||||
return new Response($app['Core']->getTwig()->render($template, $var));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render($template, $var));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -227,13 +227,13 @@ class Tools implements ControllerProviderInterface
|
||||
'video_title' => $record->get_title()
|
||||
, 'image' => $request->get('image', '')
|
||||
);
|
||||
$return['datas'] = $app['Core']->getTwig()->render($template, $var);
|
||||
$return['datas'] = $app['phraseanet.core']->getTwig()->render($template, $var);
|
||||
} catch (\Exception $e) {
|
||||
$return['datas'] = _('an error occured');
|
||||
$return['error'] = true;
|
||||
}
|
||||
|
||||
$json = $app['Core']->getSerializer()->serialize($return, 'json');
|
||||
$json = $app['phraseanet.core']->getSerializer()->serialize($return, 'json');
|
||||
|
||||
return new Response($json, 201, array('content-type' => 'application/json'));
|
||||
});
|
||||
@@ -246,7 +246,7 @@ class Tools implements ControllerProviderInterface
|
||||
|
||||
$dataUri = DataURI\Parser::parse($request->get('image', ''));
|
||||
|
||||
$path = $app['Core']->getRegistry()->get('GV_RootPath') . 'tmp';
|
||||
$path = $app['phraseanet.core']->getRegistry()->get('GV_RootPath') . 'tmp';
|
||||
|
||||
$name = sprintf('extractor_thumb_%s', $record->get_serialize_key());
|
||||
|
||||
@@ -254,19 +254,19 @@ class Tools implements ControllerProviderInterface
|
||||
|
||||
file_put_contents($fileName, $dataUri->getData());
|
||||
|
||||
$media = $app['Core']['mediavorus']->guess(new \SplFileInfo($fileName));
|
||||
$media = $app['phraseanet.core']['mediavorus']->guess(new \SplFileInfo($fileName));
|
||||
|
||||
$record->substitute_subdef('thumbnail', $media);
|
||||
|
||||
unset($media);
|
||||
$app['Core']['file-system']->remove($fileName);
|
||||
$app['phraseanet.core']['file-system']->remove($fileName);
|
||||
|
||||
$return['success'] = true;
|
||||
} catch (\Exception $e) {
|
||||
$return['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
$json = $app['Core']->getSerializer()->serialize($return, 'json');
|
||||
$json = $app['phraseanet.core']->getSerializer()->serialize($return, 'json');
|
||||
|
||||
return new Response($json, 201, array('content-type' => 'application/json'));
|
||||
});
|
||||
|
@@ -28,17 +28,17 @@ class Tooltip implements ControllerProviderInterface
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$controllers = $app['controllers_factory'];
|
||||
$app['appbox'] = \appbox::get_instance($app['Core']);
|
||||
$app['appbox'] = $app['phraseanet.appbox'];
|
||||
|
||||
$controllers->post('/basket/{basket_id}/'
|
||||
, function(Application $app, $basket_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), false);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), false);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render('prod/Tooltip/Basket.html.twig', array('basket' => $basket));
|
||||
})->assert('basket_id', '\d+');
|
||||
@@ -48,17 +48,17 @@ class Tooltip implements ControllerProviderInterface
|
||||
$Story = new \record_adapter($sbas_id, $record_id);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return $twig->render('prod/Tooltip/Story.html.twig', array('Story' => $Story));
|
||||
})->assert('sbas_id', '\d+')->assert('record_id', '\d+');
|
||||
|
||||
$controllers->post('/user/{usr_id}/'
|
||||
, function(Application $app, $usr_id) {
|
||||
$user = \User_Adapter::getInstance($usr_id, \appbox::get_instance($app['Core']));
|
||||
$user = \User_Adapter::getInstance($usr_id, $app['phraseanet.appbox']);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response($twig->render(
|
||||
'prod/Tooltip/User.html.twig'
|
||||
@@ -72,7 +72,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
$record = new \record_adapter($sbas_id, $record_id);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response($twig->render(
|
||||
'prod/Tooltip/Preview.html.twig'
|
||||
@@ -99,7 +99,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response(
|
||||
$twig->render(
|
||||
@@ -120,7 +120,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
$document = $record->get_subdef('document');
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response(
|
||||
$twig->render(
|
||||
@@ -136,7 +136,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
$field = \databox_field::get_instance($databox, $field_id);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response(
|
||||
$twig->render(
|
||||
@@ -152,7 +152,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
$field = \databox_field::get_instance($databox, $field_id);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response(
|
||||
$twig->render(
|
||||
@@ -168,7 +168,7 @@ class Tooltip implements ControllerProviderInterface
|
||||
$field = \databox_field::get_instance($databox, $field_id);
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
return new Response(
|
||||
$twig->render(
|
||||
|
@@ -92,7 +92,7 @@ class Upload implements ControllerProviderInterface
|
||||
$collections = array();
|
||||
$rights = array('canaddrecord');
|
||||
|
||||
foreach ($app['Core']->getAuthenticatedUser()->ACL()->get_granted_base($rights) as $collection) {
|
||||
foreach ($app['phraseanet.core']->getAuthenticatedUser()->ACL()->get_granted_base($rights) as $collection) {
|
||||
$databox = $collection->get_databox();
|
||||
if ( ! isset($collections[$databox->get_sbas_id()])) {
|
||||
$collections[$databox->get_sbas_id()] = array(
|
||||
@@ -121,7 +121,7 @@ class Upload implements ControllerProviderInterface
|
||||
|
||||
$maxFileSize = min(UploadedFile::getMaxFilesize(), (int) $postMaxSize);
|
||||
|
||||
$html = $app['Core']['Twig']->render(
|
||||
$html = $app['phraseanet.core']['Twig']->render(
|
||||
'prod/upload/upload.html.twig', array(
|
||||
'collections' => $collections,
|
||||
'maxFileSize' => $maxFileSize,
|
||||
@@ -165,7 +165,7 @@ class Upload implements ControllerProviderInterface
|
||||
throw new \Exception_BadRequest('Missing base_id parameter');
|
||||
}
|
||||
|
||||
if ( ! $app['Core']->getAuthenticatedUser()->ACL()->has_right_on_base($base_id, 'canaddrecord')) {
|
||||
if ( ! $app['phraseanet.core']->getAuthenticatedUser()->ACL()->has_right_on_base($base_id, 'canaddrecord')) {
|
||||
throw new \Exception_Forbidden('User is not allowed to add record on this collection');
|
||||
}
|
||||
|
||||
@@ -185,17 +185,17 @@ class Upload implements ControllerProviderInterface
|
||||
$size = $file->getSize();
|
||||
$error = $file->getError();
|
||||
|
||||
$app['Core']['file-system']->rename($uploadedFilename, $renamedFilename);
|
||||
$app['phraseanet.core']['file-system']->rename($uploadedFilename, $renamedFilename);
|
||||
|
||||
$file = new UploadedFile($renamedFilename, $originalname, $clientMimeType, $size, $error);
|
||||
|
||||
$media = $app['Core']['mediavorus']->guess($file);
|
||||
$media = $app['phraseanet.core']['mediavorus']->guess($file);
|
||||
$collection = \collection::get_from_base_id($base_id);
|
||||
|
||||
$lazaretSession = new \Entities\LazaretSession();
|
||||
$lazaretSession->setUsrId($app['Core']->getAuthenticatedUser()->get_id());
|
||||
$lazaretSession->setUsrId($app['phraseanet.core']->getAuthenticatedUser()->get_id());
|
||||
|
||||
$app['Core']['EM']->persist($lazaretSession);
|
||||
$app['phraseanet.core']['EM']->persist($lazaretSession);
|
||||
|
||||
$packageFile = new Border\File($media, $collection, $file->getClientOriginalName());
|
||||
|
||||
@@ -226,11 +226,11 @@ class Upload implements ControllerProviderInterface
|
||||
$elementCreated = $element;
|
||||
};
|
||||
|
||||
$code = $app['Core']['border-manager']->process(
|
||||
$code = $app['phraseanet.core']['border-manager']->process(
|
||||
$lazaretSession, $packageFile, $callback, $forceBehavior
|
||||
);
|
||||
|
||||
$app['Core']['file-system']->rename($renamedFilename, $uploadedFilename);
|
||||
$app['phraseanet.core']['file-system']->rename($renamedFilename, $uploadedFilename);
|
||||
|
||||
if ( ! ! $forceBehavior) {
|
||||
$reasons = array();
|
||||
@@ -243,9 +243,9 @@ class Upload implements ControllerProviderInterface
|
||||
} else {
|
||||
$params = array('lazaret_file' => $elementCreated);
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
$eventsManager = \eventsmanager_broker::getInstance($appbox, $app['Core']);
|
||||
$eventsManager = \eventsmanager_broker::getInstance($appbox, $app['phraseanet.core']);
|
||||
$eventsManager->trigger('__UPLOAD_QUARANTINE__', $params);
|
||||
|
||||
$id = $elementCreated->getId();
|
||||
@@ -265,7 +265,7 @@ class Upload implements ControllerProviderInterface
|
||||
$datas['message'] = _('Unable to add file to Phraseanet');
|
||||
}
|
||||
|
||||
$response = self::getJsonResponse($app['Core']['Serializer'], $datas);
|
||||
$response = self::getJsonResponse($app['phraseanet.core']['Serializer'], $datas);
|
||||
|
||||
// IE 7 and 8 does not correctly handle json response in file API
|
||||
// let send them an html content-type header
|
||||
|
@@ -38,7 +38,7 @@ class UserPreferences implements ControllerProviderInterface
|
||||
$ret = array('success' => false, 'message' => _('Error while saving preference'));
|
||||
|
||||
try {
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$ret = $user->setPrefs($request->get('prop'), $request->get('value'));
|
||||
|
||||
@@ -52,7 +52,7 @@ class UserPreferences implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
$datas = $Serializer->serialize($ret, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-Type' => 'application/json'));
|
||||
|
@@ -47,11 +47,11 @@ class UsrLists implements ControllerProviderInterface
|
||||
$lists = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
|
||||
try {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
|
||||
$lists = $repository->findUserLists($app['Core']->getAuthenticatedUser());
|
||||
$lists = $repository->findUserLists($app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
$result = array();
|
||||
|
||||
@@ -106,12 +106,12 @@ class UsrLists implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
} else {
|
||||
|
||||
return new Response($app['Core']->getTwig()->render('prod/actions/Feedback/lists-all.html.twig', array('lists' => $lists)));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render('prod/actions/Feedback/lists-all.html.twig', array('lists' => $lists)));
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -135,13 +135,13 @@ class UsrLists implements ControllerProviderInterface
|
||||
throw new ControllerException(_('List name is required'));
|
||||
}
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$List = new \Entities\UsrList();
|
||||
|
||||
$Owner = new \Entities\UsrListOwner();
|
||||
$Owner->setRole(\Entities\UsrListOwner::ROLE_ADMIN);
|
||||
$Owner->setUser($app['Core']->getAuthenticatedUser());
|
||||
$Owner->setUser($app['phraseanet.core']->getAuthenticatedUser());
|
||||
$Owner->setList($List);
|
||||
|
||||
$List->setName($list_name);
|
||||
@@ -165,7 +165,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
@@ -178,8 +178,8 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$result = array();
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
|
||||
@@ -221,7 +221,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
'users' => $entries
|
||||
);
|
||||
|
||||
return new Response($app['Core']->getTwig()->render('prod/actions/Feedback/list.html.twig', $result));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render('prod/actions/Feedback/list.html.twig', $result));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -243,8 +243,8 @@ class UsrLists implements ControllerProviderInterface
|
||||
throw new ControllerException(_('List name is required'));
|
||||
}
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
|
||||
@@ -271,7 +271,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
@@ -281,12 +281,12 @@ class UsrLists implements ControllerProviderInterface
|
||||
* Delete a list
|
||||
*/
|
||||
$controllers->post('/list/{list_id}/delete/', function(Application $app, $list_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
try {
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$list = $repository->findUserListByUserAndId($user, $list_id);
|
||||
|
||||
@@ -314,7 +314,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
);
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
@@ -324,12 +324,12 @@ class UsrLists implements ControllerProviderInterface
|
||||
* Remove a usr_id from a list
|
||||
*/
|
||||
$controllers->post('/list/{list_id}/remove/{usr_id}/', function(Application $app, $list_id, $usr_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
try {
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$list = $repository->findUserListByUserAndId($user, $list_id);
|
||||
/* @var $list \Entities\UsrList */
|
||||
@@ -362,7 +362,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
);
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
@@ -372,8 +372,8 @@ class UsrLists implements ControllerProviderInterface
|
||||
* Adds a usr_id to a list
|
||||
*/
|
||||
$controllers->post('/list/{list_id}/add/', function(Application $app, Request $request, $list_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
try {
|
||||
if ( ! is_array($request->get('usr_ids'))) {
|
||||
@@ -392,7 +392,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
$inserted_usr_ids = array();
|
||||
|
||||
foreach ($request->get('usr_ids') as $usr_id) {
|
||||
$user_entry = \User_Adapter::getInstance($usr_id, \appbox::get_instance($app['Core']));
|
||||
$user_entry = \User_Adapter::getInstance($usr_id, $app['phraseanet.appbox']);
|
||||
|
||||
if ($list->has($user_entry))
|
||||
continue;
|
||||
@@ -436,7 +436,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
);
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
@@ -444,8 +444,8 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/list/{list_id}/share/', function(Application $app, Request $request, $list_id) {
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$list = null;
|
||||
|
||||
@@ -463,15 +463,15 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
}
|
||||
|
||||
return new Response($app['Core']->getTwig()->render('prod/actions/Feedback/List-Share.html.twig', array('list' => $list)));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render('prod/actions/Feedback/List-Share.html.twig', array('list' => $list)));
|
||||
})->assert('list_id', '\d+');
|
||||
|
||||
/**
|
||||
* Share a list to a user with an optionnal role
|
||||
*/
|
||||
$controllers->post('/list/{list_id}/share/{usr_id}/', function(Application $app, $list_id, $usr_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$availableRoles = array(
|
||||
\Entities\UsrListOwner::ROLE_USER,
|
||||
@@ -494,7 +494,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
throw new ControllerException(_('You are not authorized to do this'));
|
||||
}
|
||||
|
||||
$new_owner = \User_Adapter::getInstance($usr_id, \appbox::get_instance($app['Core']));
|
||||
$new_owner = \User_Adapter::getInstance($usr_id, $app['phraseanet.appbox']);
|
||||
|
||||
if ($list->hasAccess($new_owner)) {
|
||||
if ($new_owner->get_id() == $user->get_id()) {
|
||||
@@ -535,7 +535,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
);
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
@@ -544,8 +544,8 @@ class UsrLists implements ControllerProviderInterface
|
||||
* UnShare a list to a user
|
||||
*/
|
||||
$controllers->post('/list/{list_id}/unshare/{usr_id}/', function(Application $app, $list_id, $usr_id) {
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
try {
|
||||
$repository = $em->getRepository('\Entities\UsrList');
|
||||
@@ -580,7 +580,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
);
|
||||
}
|
||||
|
||||
$Json = $app['Core']['Serializer']->serialize($datas, 'json');
|
||||
$Json = $app['phraseanet.core']['Serializer']->serialize($datas, 'json');
|
||||
|
||||
return new Response($Json, 200, array('Content-Type' => 'application/json'));
|
||||
}
|
||||
|
@@ -36,13 +36,13 @@ class WorkZone implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/', function(Application $app) {
|
||||
$params = array(
|
||||
'WorkZone' => new Helper\WorkZone($app['Core'], $app['request'])
|
||||
'WorkZone' => new Helper\WorkZone($app['phraseanet.core'], $app['request'])
|
||||
, 'selected_type' => $app['request']->get('type')
|
||||
, 'selected_id' => $app['request']->get('id')
|
||||
, 'srt' => $app['request']->get('sort')
|
||||
);
|
||||
|
||||
return new Response($app['Core']->getTwig()->render('prod/WorkZone/WorkZone.html.twig', $params));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render('prod/WorkZone/WorkZone.html.twig', $params));
|
||||
});
|
||||
|
||||
$controllers->get('/Browse/', function(Application $app) {
|
||||
@@ -53,7 +53,7 @@ class WorkZone implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
return new Response(
|
||||
$app['Core']->getTwig()->render('prod/WorkZone/Browser/Browser.html.twig'
|
||||
$app['phraseanet.core']->getTwig()->render('prod/WorkZone/Browser/Browser.html.twig'
|
||||
, $params
|
||||
)
|
||||
);
|
||||
@@ -61,11 +61,11 @@ class WorkZone implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/Browse/Search/', function(Application $app) {
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$request = $app['request'];
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
|
||||
$BasketRepo = $em->getRepository('\Entities\Basket');
|
||||
@@ -97,21 +97,21 @@ class WorkZone implements ControllerProviderInterface
|
||||
, 'Type' => $request->get('Type')
|
||||
);
|
||||
|
||||
return new Response($app['Core']->getTwig()->render('prod/WorkZone/Browser/Results.html.twig', $params));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render('prod/WorkZone/Browser/Results.html.twig', $params));
|
||||
});
|
||||
|
||||
$controllers->get('/Browse/Basket/{basket_id}/', function(Application $app, Request $request, $basket_id) {
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$basket = $em->getRepository('\Entities\Basket')
|
||||
->findUserBasket($basket_id, $app['Core']->getAuthenticatedUser(), false);
|
||||
->findUserBasket($basket_id, $app['phraseanet.core']->getAuthenticatedUser(), false);
|
||||
|
||||
$params = array(
|
||||
'Basket' => $basket
|
||||
);
|
||||
|
||||
return new Response($app['Core']->getTwig()->render('prod/WorkZone/Browser/Basket.html.twig', $params));
|
||||
return new Response($app['phraseanet.core']->getTwig()->render('prod/WorkZone/Browser/Basket.html.twig', $params));
|
||||
})->assert('basket_id', '\d+');
|
||||
|
||||
$controllers->post(
|
||||
@@ -120,9 +120,9 @@ class WorkZone implements ControllerProviderInterface
|
||||
if ( ! $request->get('stories'))
|
||||
throw new \Exception_BadRequest();
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
|
||||
$StoryWZRepo = $em->getRepository('\Entities\StoryWZ');
|
||||
@@ -191,7 +191,7 @@ class WorkZone implements ControllerProviderInterface
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
@@ -204,9 +204,9 @@ class WorkZone implements ControllerProviderInterface
|
||||
, function(Application $app, Request $request, $sbas_id, $record_id) {
|
||||
$Story = new \record_adapter($sbas_id, $record_id);
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
$em = $app['phraseanet.core']->getEntityManager();
|
||||
|
||||
$repository = $em->getRepository('\Entities\StoryWZ');
|
||||
|
||||
@@ -226,7 +226,7 @@ class WorkZone implements ControllerProviderInterface
|
||||
);
|
||||
|
||||
if ($request->getRequestFormat() == 'json') {
|
||||
$datas = $app['Core']['Serializer']->serialize($data, 'json');
|
||||
$datas = $app['phraseanet.core']['Serializer']->serialize($data, 'json');
|
||||
|
||||
return new Response($datas, 200, array('Content-type' => 'application/json'));
|
||||
} else {
|
||||
|
@@ -30,7 +30,7 @@ class Account implements ControllerProviderInterface
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->before(function() use ($app) {
|
||||
$app['Core']['Firewall']->requireAuthentication($app);
|
||||
$app['phraseanet.core']['Firewall']->requireAuthentication($app);
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -394,7 +394,7 @@ class Account implements ControllerProviderInterface
|
||||
*/
|
||||
public function resetEmail(Application $app, Request $request)
|
||||
{
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
if (null !== $token = $request->get('token')) {
|
||||
try {
|
||||
@@ -622,14 +622,14 @@ class Account implements ControllerProviderInterface
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$error = false;
|
||||
|
||||
try {
|
||||
$account = \API_OAuth2_Account::load_with_user(
|
||||
$appbox
|
||||
, new \API_OAuth2_Application($appbox, $application_id)
|
||||
, $app['Core']->getAuthenticatedUser()
|
||||
, $app['phraseanet.core']->getAuthenticatedUser()
|
||||
);
|
||||
} catch (\Exception_NotFound $e) {
|
||||
$error = true;
|
||||
@@ -650,10 +650,10 @@ class Account implements ControllerProviderInterface
|
||||
*/
|
||||
public function accountAuthorizedApps(Application $app, Request $request)
|
||||
{
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
return $app['Core']['Twig']->render('account/authorized_apps.html.twig', array(
|
||||
"apps" => \API_OAuth2_Application::load_app_by_user(\appbox::get_instance($app['Core']), $user),
|
||||
return $app['phraseanet.core']['Twig']->render('account/authorized_apps.html.twig', array(
|
||||
"apps" => \API_OAuth2_Application::load_app_by_user($app['phraseanet.appbox'], $user),
|
||||
'user' => $user
|
||||
));
|
||||
}
|
||||
@@ -668,7 +668,7 @@ class Account implements ControllerProviderInterface
|
||||
*/
|
||||
public function accountSessionsAccess(Application $app, Request $request)
|
||||
{
|
||||
return new Response($app['Core']['Twig']->render('account/sessions.html.twig'));
|
||||
return new Response($app['phraseanet.core']['Twig']->render('account/sessions.html.twig'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -681,7 +681,7 @@ class Account implements ControllerProviderInterface
|
||||
*/
|
||||
public function accountAccess(Application $app, Request $request)
|
||||
{
|
||||
require_once $app['Core']['Registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php';
|
||||
require_once $app['phraseanet.core']['Registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php';
|
||||
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
|
||||
@@ -700,9 +700,9 @@ class Account implements ControllerProviderInterface
|
||||
*/
|
||||
public function displayAccount(Application $app, Request $request)
|
||||
{
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$evtMngr = \eventsmanager_broker::getInstance($appbox, $app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$evtMngr = \eventsmanager_broker::getInstance($appbox, $app['phraseanet.core']);
|
||||
|
||||
switch ($notice = $request->get('notice', '')) {
|
||||
case 'pass-ok':
|
||||
@@ -722,7 +722,7 @@ class Account implements ControllerProviderInterface
|
||||
break;
|
||||
}
|
||||
|
||||
return new Response($app['Core']['Twig']->render('account/account.html.twig', array(
|
||||
return new Response($app['phraseanet.core']['Twig']->render('account/account.html.twig', array(
|
||||
'geonames' => new \geonames(),
|
||||
'user' => $user,
|
||||
'notice' => $notice,
|
||||
@@ -741,9 +741,9 @@ class Account implements ControllerProviderInterface
|
||||
*/
|
||||
public function updateAccount(Application $app, Request $request)
|
||||
{
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$evtMngr = \eventsmanager_broker::getInstance($appbox, $app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
$evtMngr = \eventsmanager_broker::getInstance($appbox, $app['phraseanet.core']);
|
||||
$notice = 'account-update-bad';
|
||||
|
||||
$demands = (array) $request->get('demand', array());
|
||||
|
@@ -30,7 +30,7 @@ class Developers implements ControllerProviderInterface
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->before(function() use ($app) {
|
||||
$app['Core']['Firewall']->requireAuthentication($app);
|
||||
$app['phraseanet.core']['Firewall']->requireAuthentication($app);
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -191,7 +191,7 @@ class Developers implements ControllerProviderInterface
|
||||
$error = false;
|
||||
|
||||
try {
|
||||
$clientApp = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
|
||||
$clientApp = new \API_OAuth2_Application($app['phraseanet.appbox'], $id);
|
||||
$clientApp->delete();
|
||||
} catch (\Exception_NotFound $e) {
|
||||
$error = true;
|
||||
@@ -218,7 +218,7 @@ class Developers implements ControllerProviderInterface
|
||||
$error = false;
|
||||
|
||||
try {
|
||||
$clientApp = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
|
||||
$clientApp = new \API_OAuth2_Application($app['phraseanet.appbox'], $id);
|
||||
|
||||
if ($callback = $request->get("callback")) {
|
||||
$clientApp->set_redirect_uri($callback);
|
||||
@@ -247,13 +247,13 @@ class Developers implements ControllerProviderInterface
|
||||
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||
}
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$error = false;
|
||||
$accessToken = null;
|
||||
|
||||
try {
|
||||
$clientApp = new \API_OAuth2_Application($appbox, $id);
|
||||
$account = $clientApp->get_user_account($app['Core']->getAuthenticatedUser());
|
||||
$account = $clientApp->get_user_account($app['phraseanet.core']->getAuthenticatedUser());
|
||||
|
||||
$token = $account->get_token();
|
||||
|
||||
@@ -289,7 +289,7 @@ class Developers implements ControllerProviderInterface
|
||||
$error = false;
|
||||
|
||||
try {
|
||||
$clientApp = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
|
||||
$clientApp = new \API_OAuth2_Application($app['phraseanet.appbox'], $id);
|
||||
} catch (\Exception_NotFound $e) {
|
||||
$error = true;
|
||||
}
|
||||
@@ -324,7 +324,7 @@ class Developers implements ControllerProviderInterface
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$application = \API_OAuth2_Application::create(\appbox::get_instance($app['Core']), $app['Core']->getAuthenticatedUser(), $form->getName());
|
||||
$application = \API_OAuth2_Application::create($app['phraseanet.appbox'], $app['phraseanet.core']->getAuthenticatedUser(), $form->getName());
|
||||
$application
|
||||
->set_description($form->getDescription())
|
||||
->set_redirect_uri($form->getSchemeCallback() . $form->getCallback())
|
||||
@@ -339,7 +339,7 @@ class Developers implements ControllerProviderInterface
|
||||
"form" => $form
|
||||
);
|
||||
|
||||
return $app['Core']['Twig']->render('/developers/application.html.twig', $var);
|
||||
return $app['phraseanet.core']['Twig']->render('/developers/application.html.twig', $var);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -352,9 +352,9 @@ class Developers implements ControllerProviderInterface
|
||||
*/
|
||||
public function listApps(Application $app, Request $request)
|
||||
{
|
||||
return $app['Core']['Twig']->render('developers/applications.html.twig', array(
|
||||
return $app['phraseanet.core']['Twig']->render('developers/applications.html.twig', array(
|
||||
"apps" => \API_OAuth2_Application::load_dev_app_by_user(
|
||||
\appbox::get_instance($app['Core']), $app['Core']->getAuthenticatedUser()
|
||||
$app['phraseanet.appbox'], $app['phraseanet.core']->getAuthenticatedUser()
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ class Developers implements ControllerProviderInterface
|
||||
*/
|
||||
public function displayFormApp(Application $app, Request $request)
|
||||
{
|
||||
return $app['Core']['Twig']->render('developers/application_form.html.twig', array(
|
||||
return $app['phraseanet.core']['Twig']->render('developers/application_form.html.twig', array(
|
||||
"violations" => null,
|
||||
'form' => null,
|
||||
'request' => $request
|
||||
@@ -386,17 +386,17 @@ class Developers implements ControllerProviderInterface
|
||||
*/
|
||||
public function getApp(Application $app, Request $request, $id)
|
||||
{
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
$user = $app['phraseanet.core']->getAuthenticatedUser();
|
||||
|
||||
try {
|
||||
$client = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
|
||||
$client = new \API_OAuth2_Application($app['phraseanet.appbox'], $id);
|
||||
} catch (\Exception_NotFound $e) {
|
||||
$app->abort(404);
|
||||
}
|
||||
|
||||
$token = $client->get_user_account($user)->get_token()->get_value();
|
||||
|
||||
return $app['Core']['Twig']->render('developers/application.html.twig', array(
|
||||
return $app['phraseanet.core']['Twig']->render('developers/application.html.twig', array(
|
||||
"app" => $client,
|
||||
"user" => $user,
|
||||
"token" => $token
|
||||
|
@@ -27,7 +27,7 @@ class RSSFeeds implements ControllerProviderInterface
|
||||
|
||||
public function connect(Application $app)
|
||||
{
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
|
@@ -72,9 +72,9 @@ class Installer implements ControllerProviderInterface
|
||||
'/setup/index.html.twig'
|
||||
, array_merge($constraints_coll, array(
|
||||
'locale' => \Session_Handler::get_locale()
|
||||
, 'available_locales' => $app['Core']::getAvailableLanguages()
|
||||
, 'version_number' => $app['Core']['Version']->getNumber()
|
||||
, 'version_name' => $app['Core']['Version']->getName()
|
||||
, 'available_locales' => $app['phraseanet.core']::getAvailableLanguages()
|
||||
, 'version_number' => $app['phraseanet.core']['Version']->getNumber()
|
||||
, 'version_name' => $app['phraseanet.core']['Version']->getName()
|
||||
, 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/'
|
||||
))
|
||||
);
|
||||
@@ -128,10 +128,10 @@ class Installer implements ControllerProviderInterface
|
||||
'/setup/step2.html.twig'
|
||||
, array(
|
||||
'locale' => \Session_Handler::get_locale()
|
||||
, 'available_locales' => $app['Core']::getAvailableLanguages()
|
||||
, 'available_locales' => $app['phraseanet.core']::getAvailableLanguages()
|
||||
, 'available_templates' => \appbox::list_databox_templates()
|
||||
, 'version_number' => $app['Core']['Version']->getNumber()
|
||||
, 'version_name' => $app['Core']['Version']->getName()
|
||||
, 'version_number' => $app['phraseanet.core']['Version']->getNumber()
|
||||
, 'version_name' => $app['phraseanet.core']['Version']->getName()
|
||||
, 'warnings' => $warnings
|
||||
, 'error' => $request->get('error')
|
||||
, 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/'
|
||||
@@ -181,7 +181,7 @@ class Installer implements ControllerProviderInterface
|
||||
|
||||
try {
|
||||
|
||||
$appbox = \appbox::create($app['Core'], $setupRegistry, $conn, $appbox_name, true);
|
||||
$appbox = \appbox::create($app['phraseanet.core'], $setupRegistry, $conn, $appbox_name, true);
|
||||
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
|
||||
@@ -190,7 +190,7 @@ class Installer implements ControllerProviderInterface
|
||||
$confService = $configuration->getService($serviceName);
|
||||
|
||||
$ormService = \Alchemy\Phrasea\Core\Service\Builder::create(
|
||||
$app['Core']
|
||||
$app['phraseanet.core']
|
||||
, $confService
|
||||
);
|
||||
|
||||
@@ -231,7 +231,7 @@ class Installer implements ControllerProviderInterface
|
||||
|
||||
$user = \User_Adapter::create($appbox, $request->get('email'), $request->get('password'), $request->get('email'), true);
|
||||
|
||||
\phrasea::start($app['Core']);
|
||||
\phrasea::start($app['phraseanet.core']);
|
||||
|
||||
$auth = new \Session_Authentication_None($user);
|
||||
|
||||
|
@@ -33,17 +33,17 @@ class Upgrader implements ControllerProviderInterface
|
||||
$upgrade_status = \Setup_Upgrade::get_status();
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
$twig = $app['Core']->getTwig();
|
||||
$twig = $app['phraseanet.core']->getTwig();
|
||||
|
||||
$html = $twig->render(
|
||||
'/setup/upgrader.html.twig'
|
||||
, array(
|
||||
'locale' => \Session_Handler::get_locale()
|
||||
, 'upgrade_status' => $upgrade_status
|
||||
, 'available_locales' => $app['Core']::getAvailableLanguages()
|
||||
, 'bad_users' => \User_Adapter::get_wrong_email_users(\appbox::get_instance($app['Core']))
|
||||
, 'version_number' => $app['Core']['Version']->getNumber()
|
||||
, 'version_name' => $app['Core']['Version']->getName()
|
||||
, 'available_locales' => $app['phraseanet.core']::getAvailableLanguages()
|
||||
, 'bad_users' => \User_Adapter::get_wrong_email_users($app['phraseanet.appbox'])
|
||||
, 'version_number' => $app['phraseanet.core']['Version']->getNumber()
|
||||
, 'version_name' => $app['phraseanet.core']['Version']->getName()
|
||||
)
|
||||
);
|
||||
ini_set('display_errors', 'on');
|
||||
@@ -56,7 +56,7 @@ class Upgrader implements ControllerProviderInterface
|
||||
|
||||
$datas = \Setup_Upgrade::get_status();
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize($datas, 'json')
|
||||
@@ -71,7 +71,7 @@ class Upgrader implements ControllerProviderInterface
|
||||
session_write_close();
|
||||
ignore_user_abort(true);
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$upgrader = new \Setup_Upgrade($appbox);
|
||||
$appbox->forceUpgrade($upgrader);
|
||||
|
||||
|
@@ -75,7 +75,7 @@ class ConnectionTest implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
$datas = array(
|
||||
'connection' => $connection_ok
|
||||
|
@@ -32,7 +32,7 @@ class PathFileTest implements ControllerProviderInterface
|
||||
$controllers->get('/path/', function() use ($app) {
|
||||
$path = $app['request']->get('path');
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize(
|
||||
@@ -54,7 +54,7 @@ class PathFileTest implements ControllerProviderInterface
|
||||
$controllers->get('/url/', function() use ($app) {
|
||||
$url = $app['request']->get('url');
|
||||
|
||||
$Serializer = $app['Core']['Serializer'];
|
||||
$Serializer = $app['phraseanet.core']['Serializer'];
|
||||
|
||||
return new Response(
|
||||
$Serializer->serialize(
|
||||
|
@@ -11,6 +11,10 @@
|
||||
|
||||
namespace Alchemy\Phrasea;
|
||||
|
||||
use Alchemy\Phrasea\Cache\Manager as CacheManager;
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Alchemy\Phrasea\Core\Version;
|
||||
use Alchemy\Phrasea\Security\Firewall;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Serializer;
|
||||
@@ -53,13 +57,13 @@ class Core extends \Pimple
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Core\Configuration
|
||||
* @var Configuration
|
||||
*/
|
||||
private $configuration;
|
||||
|
||||
public function __construct($environement = null)
|
||||
{
|
||||
$this->configuration = Core\Configuration::build(null, $environement);
|
||||
$this->configuration = Configuration::build(null, $environement);
|
||||
|
||||
$core = $this;
|
||||
|
||||
@@ -74,7 +78,7 @@ class Core extends \Pimple
|
||||
* Set version
|
||||
*/
|
||||
$this['Version'] = $this->share(function() {
|
||||
return new Core\Version();
|
||||
return new Version();
|
||||
});
|
||||
|
||||
if ($this->configuration->isInstalled()) {
|
||||
@@ -98,11 +102,11 @@ class Core extends \Pimple
|
||||
|
||||
$file = new \SplFileInfo(__DIR__ . '/../../../tmp/cache_registry.yml');
|
||||
|
||||
return new \Alchemy\Phrasea\Cache\Manager($core, $file);
|
||||
return new CacheManager($core, $file);
|
||||
});
|
||||
|
||||
$this['Firewall'] = $this->share(function() {
|
||||
return new Security\Firewall();
|
||||
return new Firewall();
|
||||
});
|
||||
|
||||
/**
|
||||
|
26
lib/Alchemy/Phrasea/PhraseanetServiceProvider.php
Normal file
26
lib/Alchemy/Phrasea/PhraseanetServiceProvider.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Alchemy\Phrasea;
|
||||
|
||||
use Silex\Application as SilexApplication;
|
||||
use Silex\ServiceProviderInterface;
|
||||
|
||||
class PhraseanetServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
|
||||
public function register(SilexApplication $app)
|
||||
{
|
||||
$app['phraseanet.core'] = $app->share(function() {
|
||||
return \bootstrap::getCore();
|
||||
});
|
||||
|
||||
$app['phraseanet.appbox'] = $app->share(function($app) {
|
||||
return new \appbox($app['phraseanet.core']);
|
||||
});
|
||||
}
|
||||
|
||||
public function boot(SilexApplication $app)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user