Fixed iconurl integration

This commit is contained in:
Andrey
2013-06-12 11:29:41 +02:00
parent ec5a38d5f5
commit 9a5baff4a0
4 changed files with 36 additions and 39 deletions

View File

@@ -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);