- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/settings, roles: ROLE_SUPER_ADMIN }
- { path: ^/annotations, roles: ROLE_USER }
- { path: ^/, roles: ROLE_USER }
{
$this->checkUserAction($entry);
+ $this->generateEntryUuid($entry);
+
return $this->render(
'WallabagCoreBundle:Entry:entry.html.twig',
['entry' => $entry]
private function checkIfEntryAlreadyExists(Entry $entry)
{
return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId());
+
+ }
+
+ /*
+ * Share entry content.
+ *
+ * @param Entry $entry
+ *
+ * @Route("/share/{uuid}", requirements={"uuid" = ".+"}, name="share")
+ *
+ * @return \Symfony\Component\HttpFoundation\Response
+ */
+ public function shareEntry(Entry $entry)
+ {
+ return $this->render(
+ '@WallabagCore/themes/share.html.twig',
+ array('entry' => $entry)
+ );
+ }
+
+ /**
+ * @param Entry $entry
+ */
+ private function generateEntryUuid(Entry $entry)
+ {
+ $entry->generateUuid();
+ $em = $this->getDoctrine()->getManager();
+ $em->persist($entry);
+ $em->flush();
}
}
*/
private $id;
+ /**
+ * @var int
+ *
+ * @ORM\Column(name="uuid", type="text", nullable=true)
+ *
+ * @Groups({"entries_for_user", "export_all"})
+ */
+ private $uuid;
+
/**
* @var string
*
}
$this->updatedAt = new \DateTime();
+
+ $this->generateUuid();
}
/**
{
return $this->language;
}
+
+ /**
+ * @return int
+ */
+ public function getUuid()
+ {
+ return $this->uuid;
+ }
+
+ /**
+ * @param int $uuid
+ *
+ * @return Entry
+ */
+ public function setUuid($uuid)
+ {
+ $this->uuid = $uuid;
+
+ return $this;
+ }
+
+ public function generateUuid()
+ {
+ if (empty($this->uuid) || is_null($this->uuid)) {
+ $this->uuid = uniqid();
+ }
+ }
}
</a>
<div class="collapsible-body">
<ul>
+ {% if craue_setting('share_twitter') %}
+ <li>
+ <a href="{{ path('share', {'uuid': entry.uuid }) }}" target="_blank" class="tool public" title="public">
+ <span>public</span>
+ </a>
+ </li>
+ {% endif %}
{% if craue_setting('share_twitter') %}
<li>
<a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="twitter">
</li>
{% endif %}
-
<li class="bold">
<a class="waves-effect collapsible-header">
<i class="material-icons small">file_download</i>
--- /dev/null
+<html>
+ <head>
+ <title>{{ entry.title | raw }}</title>
+ <style>
+ body {
+ margin: 10px;
+ font-family: 'Roboto',Verdana,Geneva,sans-serif;
+ font-size: 16px;
+ color: #000;
+ }
+ header {
+ text-align: center;
+ }
+
+ header h1 {
+ font-size: 1.3em;
+ }
+
+ a,
+ a:hover,
+ a:visited {
+ color: #000;
+ }
+
+ article {
+ margin: 0 auto;
+ width: 600px;
+ }
+ </style>
+ </head>
+ <body>
+ <header>
+ <h1>{{ entry.title | raw }}</h1>
+ </header>
+ <article>
+ {{ entry.content | raw }}
+ </article>
+ </body>
+</html>