X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FEntryController.php;h=624576b5bee67a43be98418a72e5c4ce93831233;hb=543da3e0b7592b1a00a7c5baec1554460609d63f;hp=e500ad752af6f0af4e30a502542634a2bc5fafca;hpb=f1be7af446052c6fed7033664c6c6350f558961b;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index e500ad75..624576b5 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -226,6 +226,10 @@ class EntryController extends Controller $repository = $this->get('wallabag_core.entry_repository'); switch ($type) { + case 'untagged': + $qb = $repository->getBuilderForUntaggedByUser($this->getUser()->getId()); + + break; case 'starred': $qb = $repository->getBuilderForStarredByUser($this->getUser()->getId()); break; @@ -465,8 +469,12 @@ class EntryController extends Controller { $this->checkUserAction($entry); - if ('' === $entry->getUuid() || null === $entry->getUuid()) { - $this->generateEntryUuid($entry); + if (null === $entry->getUuid()) { + $entry->generateUuid(); + + $em = $this->getDoctrine()->getManager(); + $em->persist($entry); + $em->flush(); } return $this->redirect($this->generateUrl('share_entry', [ @@ -488,6 +496,7 @@ class EntryController extends Controller $this->checkUserAction($entry); $entry->cleanUuid(); + $em = $this->getDoctrine()->getManager(); $em->persist($entry); $em->flush(); @@ -498,31 +507,39 @@ class EntryController extends Controller } /** - * Share entry content. + * Ability to view a content publicly. * * @param Entry $entry * * @Route("/share/{uuid}", requirements={"uuid" = ".+"}, name="share_entry") - * @Cache(maxage="25200", public=true) + * @Cache(maxage="25200", smaxage="25200", public=true) * * @return \Symfony\Component\HttpFoundation\Response */ public function shareEntryAction(Entry $entry) { + if (!$this->get('craue_config')->get('share_public')) { + throw $this->createAccessDeniedException('Sharing an entry is disabled for this user.'); + } + return $this->render( '@WallabagCore/themes/share.html.twig', - array('entry' => $entry) + ['entry' => $entry] ); } /** - * @param Entry $entry + * Shows untagged articles for current user. + * + * @param Request $request + * @param int $page + * + * @Route("/untagged/list/{page}", name="untagged", defaults={"page" = "1"}) + * + * @return \Symfony\Component\HttpFoundation\Response */ - private function generateEntryUuid(Entry $entry) + public function showUntaggedEntriesAction(Request $request, $page) { - $entry->generateUuid(); - $em = $this->getDoctrine()->getManager(); - $em->persist($entry); - $em->flush(); + return $this->showEntries('untagged', $request, $page); } }