diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php index 49c55fe43b..9cc1d585fd 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php @@ -124,12 +124,14 @@ class Publications implements ControllerProviderInterface ); $feed = $app["EM"]->find('Entities\Feed', $id); + if (null === $feed) { + $app->abort(404, "Feed not found"); + } + $request = $app["request"]; - if (!$feed->getOwner($app['authentication']->getUser())) { - $datas['message'] = 'You are not allowed to do that'; - - return $app->json($datas); + if (!$feed->isOwner($app['authentication']->getUser())) { + $app->abort(403, "Access Forbidden"); } try { @@ -170,6 +172,15 @@ class Publications implements ControllerProviderInterface unset($media); + $feed->setIconUrl(true); + $app['EM']->persist($feed); + $app['EM']->flush(); + + $baseDir = realpath(__DIR__ . '/../../../../../'); + + $app['filesystem']->copy($tmpname, $baseDir . '/config/feed_' . $feed->getId() . '.jpg'); + $app['filesystem']->copy($tmpname, 'custom/feed_' . $feed->getId() . '.jpg'); + $app['filesystem']->remove($tmpname); $datas['success'] = true; @@ -217,7 +228,7 @@ class Publications implements ControllerProviderInterface $publisher = $app["EM"]->find('Entities\FeedPublisher', $request->request->get('publisher_id')); if (null === $publisher) { - throw new \Exception_Feed_PublisherNotFound(); + $app->abort(404, "Feed Publisher not found"); } $user = $publisher->getUser($app); diff --git a/templates/web/admin/publications/fiche.html.twig b/templates/web/admin/publications/fiche.html.twig index ce47d325a9..75ea22fc7c 100644 --- a/templates/web/admin/publications/fiche.html.twig +++ b/templates/web/admin/publications/fiche.html.twig @@ -11,7 +11,11 @@