strict_variables: "%kernel.debug%"
form_themes:
- "LexikFormFilterBundle:Form:form_div_layout.html.twig"
+ exception_controller: wallabag_core.exception_controller:showAction
# Doctrine Configuration
doctrine:
- "@wallabag_core.tag_repository"
- "@security.token_storage"
- "%wallabag_core.cache_lifetime%"
+ - "@translator"
tags:
- { name: twig.extension }
ARG timezone='Europe/Paris'
RUN apt-get update && apt-get install -y \
- libmcrypt-dev libicu-dev libpq-dev libxml2-dev \
+ libmcrypt-dev libicu-dev libpq-dev libxml2-dev libpng12-dev libjpeg-dev \
+ && /usr/local/bin/docker-php-ext-configure gd --with-jpeg-dir=/usr/include \
&& docker-php-ext-install \
- iconv mcrypt mbstring intl pdo pdo_mysql pdo_pgsql
+ iconv mcrypt mbstring intl pdo pdo_mysql pdo_pgsql gd
RUN echo "date.timezone="$timezone > /usr/local/etc/php/conf.d/date_timezone.ini
Eigenschaften mit den kommentierten zu ersetzen (mit Werten
mit ``env.`` Präfix)
#. ``composer install`` die Projektabhängigkeiten
-#. ``php app/console wallabag:install``, um das Schema zu erstellen
+#. ``php bin/console wallabag:install``, um das Schema zu erstellen
#. ``docker-compose up`` um die Container laufen zu lassen
#. Schließlich öffne http://localhost:8080/, um dein frisch
installiertes wallabag zu finden.
#. Edit ``app/config/parameters.yml`` to replace ``database_*``
properties with commented ones (with values prefixed by ``env.``)
#. ``composer install`` the project dependencies
-#. ``php app/console wallabag:install`` to create the schema
+#. ``php bin/console wallabag:install`` to create the schema
#. ``docker-compose up`` to run the containers
#. Finally, browse to http://localhost:8080/ to find your freshly
installed wallabag.
#. Editer ``app/config/parameters.yml`` pour remplacer les propriétés ``database_*``
par les lignes commentées (celles avec des valeurs préfixées par ``env.``)
#. ``composer install`` pour installer les dépendances
-#. ``php app/console wallabag:install`` pour créer le schéma de la BDD
+#. ``php bin/console wallabag:install`` pour créer le schéma de la BDD
#. ``docker-compose up`` pour démarrer les conteneurs
#. Enfin, se rendre sur http://localhost:8080/ pour accéder à une installation
tout propre de wallabag.
namespace Wallabag\CoreBundle\Command;
+use FOS\UserBundle\Event\UserEvent;
+use FOS\UserBundle\FOSUserEvents;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\ArrayInput;
$em->persist($user);
- $config = new Config($user);
- $config->setTheme($this->getContainer()->getParameter('wallabag_core.theme'));
- $config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page'));
- $config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit'));
- $config->setReadingSpeed($this->getContainer()->getParameter('wallabag_core.reading_speed'));
- $config->setLanguage($this->getContainer()->getParameter('wallabag_core.language'));
-
- $em->persist($config);
+ // dispatch a created event so the associated config will be created
+ $event = new UserEvent($user);
+ $this->getContainer()->get('event_dispatcher')->dispatch(FOSUserEvents::USER_CREATED, $event);
$this->defaultOutput->writeln('');
namespace Wallabag\CoreBundle\Controller;
+use FOS\UserBundle\Event\UserEvent;
+use FOS\UserBundle\FOSUserEvents;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
// handle tagging rule
$taggingRule = new TaggingRule();
- $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, ['action' => $this->generateUrl('config').'#set5']);
+ $action = $this->generateUrl('config').'#set5';
+
+ if ($request->query->has('tagging-rule')) {
+ $taggingRule = $this->getDoctrine()
+ ->getRepository('WallabagCoreBundle:TaggingRule')
+ ->find($request->query->get('tagging-rule'));
+
+ if ($this->getUser()->getId() !== $taggingRule->getConfig()->getUser()->getId()) {
+ return $this->redirect($action);
+ }
+
+ $action = $this->generateUrl('config').'?tagging-rule='.$taggingRule->getId().'#set5';
+ }
+
+ $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, ['action' => $action]);
$newTaggingRule->handleRequest($request);
if ($newTaggingRule->isValid()) {
$newUserForm->handleRequest($request);
if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
- $userManager->updateUser($newUser, true);
-
- $config = new Config($newUser);
- $config->setTheme($this->getParameter('wallabag_core.theme'));
- $config->setItemsPerPage($this->getParameter('wallabag_core.items_on_page'));
- $config->setRssLimit($this->getParameter('wallabag_core.rss_limit'));
- $config->setLanguage($this->getParameter('wallabag_core.language'));
- $config->setReadingSpeed($this->getParameter('wallabag_core.reading_speed'));
+ $userManager->updateUser($newUser);
- $em->persist($config);
-
- $em->flush();
+ // dispatch a created event so the associated config will be created
+ $event = new UserEvent($newUser, $request);
+ $this->get('event_dispatcher')->dispatch(FOSUserEvents::USER_CREATED, $event);
$this->get('session')->getFlashBag()->add(
'notice',
*/
public function deleteTaggingRuleAction(TaggingRule $rule)
{
- if ($this->getUser()->getId() != $rule->getConfig()->getUser()->getId()) {
- throw $this->createAccessDeniedException('You can not access this tagging rule.');
- }
+ $this->validateRuleAction($rule);
$em = $this->getDoctrine()->getManager();
$em->remove($rule);
return $this->redirect($this->generateUrl('config').'#set5');
}
+ /**
+ * Edit a tagging rule.
+ *
+ * @param TaggingRule $rule
+ *
+ * @Route("/tagging-rule/edit/{id}", requirements={"id" = "\d+"}, name="edit_tagging_rule")
+ *
+ * @return RedirectResponse
+ */
+ public function editTaggingRuleAction(TaggingRule $rule)
+ {
+ $this->validateRuleAction($rule);
+
+ return $this->redirect($this->generateUrl('config').'?tagging-rule='.$rule->getId().'#set5');
+ }
+
+ /**
+ * Validate that a rule can be edited/deleted by the current user.
+ *
+ * @param TaggingRule $rule
+ */
+ private function validateRuleAction(TaggingRule $rule)
+ {
+ if ($this->getUser()->getId() != $rule->getConfig()->getUser()->getId()) {
+ throw $this->createAccessDeniedException('You can not access this tagging rule.');
+ }
+ }
+
/**
* Retrieve config for the current user.
* If no config were found, create a new one.
->getRepository('WallabagCoreBundle:Config')
->findOneByUser($this->getUser());
+ // should NEVER HAPPEN ...
if (!$config) {
$config = new Config($this->getUser());
}
--- /dev/null
+<?php
+
+namespace Wallabag\CoreBundle\Controller;
+
+use Symfony\Bundle\TwigBundle\Controller\ExceptionController as BaseExceptionController;
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+ * This controller allow us to customize the error template.
+ * The only modified line from the parent template is for "WallabagCoreBundle".
+ */
+class ExceptionController extends BaseExceptionController
+{
+ protected function findTemplate(Request $request, $format, $code, $showException)
+ {
+ $name = $showException ? 'exception' : 'error';
+ if ($showException && 'html' == $format) {
+ $name = 'exception_full';
+ }
+
+ // For error pages, try to find a template for the specific HTTP status code and format
+ if (!$showException) {
+ $template = sprintf('WallabagCoreBundle:Exception:%s.%s.twig', $name, $format);
+ if ($this->templateExists($template)) {
+ return $template;
+ }
+ }
+
+ // try to find a template for the given format
+ $template = sprintf('@Twig/Exception/%s.%s.twig', $name, $format);
+ if ($this->templateExists($template)) {
+ return $template;
+ }
+
+ // default to a generic HTML exception
+ $request->setRequestFormat('html');
+
+ return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
+ }
+}
$em = $this->registry->getManagerForClass($configuration->getClass());
// Check, if class name is what we need
- if ('Wallabag\UserBundle\Entity\User' !== $em->getClassMetadata($configuration->getClass())->getName()) {
+ if (null !== $em && 'Wallabag\UserBundle\Entity\User' !== $em->getClassMetadata($configuration->getClass())->getName()) {
return false;
}
$username = $request->attributes->get('username');
$rssToken = $request->attributes->get('token');
- // Check, if route attributes exists
- if (null === $username || null === $rssToken) {
- throw new \InvalidArgumentException('Route attribute is missing');
+ if (!$request->attributes->has('username') || !$request->attributes->has('token')) {
+ return false;
}
// Get actual entity manager for class
arguments:
- WallabagCoreBundle:Tag
- wallabag_core.registration_confirmed:
- class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener
- arguments:
- - "@doctrine.orm.entity_manager"
- - "%wallabag_core.theme%"
- - "%wallabag_core.items_on_page%"
- - "%wallabag_core.rss_limit%"
- - "%wallabag_core.language%"
- tags:
- - { name: kernel.event_subscriber }
-
wallabag_core.helper.entries_export:
class: Wallabag\CoreBundle\Helper\EntriesExport
arguments:
host: '%redis_host%'
port: '%redis_port%'
schema: tcp
+
+ wallabag_core.exception_controller:
+ class: Wallabag\CoreBundle\Controller\ExceptionController
+ arguments:
+ - '@twig'
+ - '%kernel.debug%'
# social: 'Social'
# powered_by: 'powered by'
about: 'Om'
+ # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
page_title: 'Opsætning'
# if_label: 'if'
# then_tag_as_label: 'then tag as'
# delete_rule_label: 'delete'
+ # edit_rule_label: 'edit'
# rule_label: 'Rule'
# tags_label: 'Tags'
# faq:
# enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:"
# firefox:
# page_title: 'Import > Firefox'
- # description: "This importer will import all your Firefox bookmarks. <p>For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+ # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
# how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
#chrome:
# page_title: 'Import > Chrome'
social: 'Soziales'
powered_by: 'angetrieben von'
about: 'Über'
+ # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
page_title: 'Einstellungen'
if_label: 'Wenn'
then_tag_as_label: 'dann tagge als'
delete_rule_label: 'löschen'
+ # edit_rule_label: 'edit'
rule_label: 'Regel'
tags_label: 'Tags'
faq:
# enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:"
firefox:
page_title: 'Aus Firefox importieren'
- # description: "This importer will import all your Firefox bookmarks. <p>For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+ # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
# how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
chrome:
page_title: 'Aus Chrome importieren'
social: 'Social'
powered_by: 'powered by'
about: 'About'
+ stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
page_title: 'Config'
if_label: 'if'
then_tag_as_label: 'then tag as'
delete_rule_label: 'delete'
+ edit_rule_label: 'edit'
rule_label: 'Rule'
tags_label: 'Tags'
faq:
enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:"
firefox:
page_title: 'Import > Firefox'
- description: "This importer will import all your Firefox bookmarks. <p>For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+ description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
chrome:
page_title: 'Import > Chrome'
social: 'Social'
powered_by: 'funciona por'
about: 'Acerca de'
+ # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
page_title: 'Configuración'
if_label: 'si'
then_tag_as_label: 'Etiquete como'
delete_rule_label: 'Borre'
+ # edit_rule_label: 'edit'
rule_label: 'Regla'
tags_label: 'Etiquetas'
faq:
# enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:"
firefox:
page_title: 'Importar > Firefox'
- # description: "This importer will import all your Firefox bookmarks. <p>For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+ # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
# how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
chrome:
page_title: 'Importar > Chrome'
social: 'شبکههای اجتماعی'
powered_by: 'توانمند با'
about: 'درباره'
+ # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
page_title: 'پیکربندی'
if_label: 'اگر'
then_tag_as_label: 'این برچسب را بزن'
delete_rule_label: 'پاک کن'
+ # edit_rule_label: 'edit'
rule_label: 'قانون'
tags_label: 'برچسبها'
faq:
# enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:"
firefox:
page_title: 'درونریزی > Firefox'
- # description: "This importer will import all your Firefox bookmarks. <p>For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+ # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
# how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
chrome:
page_title: 'درونریزی > Chrome'
social: 'Social'
powered_by: 'propulsé par'
about: 'À propos'
+ stats: Depuis le %user_creation% vous avez lu %nb_archives% articles. Ce qui fait %per_day% par jour !
config:
page_title: 'Configuration'
if_label: 'si'
then_tag_as_label: 'alors attribuer les tags'
delete_rule_label: 'supprimer'
+ edit_rule_label: 'éditer'
rule_label: 'Règle'
tags_label: 'Tags'
faq:
enabled: "Les imports sont asynchrones. Une fois l'import commencé un worker externe traitera les messages un par un. Le service activé est :"
firefox:
page_title: 'Import > Firefox'
- description: "Cet outil va vous permettre d'importer tous vos marques-pages de Firefox. <p>Pour Firefox, ouvrez le panneau des marques-pages (Ctrl+Maj+O), puis dans « Importation et sauvegarde », choisissez « Sauvegarde... ». Vous allez récupérer un fichier .json. </p>"
+ description: "Cet outil va vous permettre d'importer tous vos marques-pages de Firefox. Ouvrez le panneau des marques-pages (Ctrl+Maj+O), puis dans « Importation et sauvegarde », choisissez « Sauvegarde... ». Vous allez récupérer un fichier .json. </p>"
how_to: "Choisissez le fichier de sauvegarde de vos marques-page et cliquez sur le bouton pour l'importer. Soyez avertis que le processus peut prendre un temps assez long car tous les articles doivent être récupérés en ligne."
chrome:
page_title: 'Import > Chrome'
social: 'Social'
powered_by: 'powered by'
about: 'About'
+ # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
page_title: 'Configurazione'
if_label: 'se'
then_tag_as_label: 'allora tagga come'
delete_rule_label: 'elimina'
+ # edit_rule_label: 'edit'
rule_label: 'Regola'
tags_label: 'Tag'
faq:
# enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:"
firefox:
page_title: 'Importa da > Firefox'
- # description: "This importer will import all your Firefox bookmarks. <p>For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+ # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
# how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
chrome:
page_title: 'Importa da > Chrome'
unread: 'Pas legits'
starred: 'Favorits'
archive: 'Legits'
- all_articles: 'Tots los articles'
+ all_articles: 'Totes los articles'
config: 'Configuracion'
tags: 'Etiquetas'
internal_settings: 'Configuracion interna'
import: 'Importar'
howto: 'Ajuda'
developer: 'Desvolopador'
- logout: 'Déconnexion'
+ logout: 'Desconnexion'
about: 'A prepaus'
search: 'Cercar'
save_link: 'Enregistrar un novèl article'
social: 'Social'
powered_by: 'propulsat per'
about: 'A prepaus'
- page_title: 'Configuracion'
+ # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
+ page_title: 'Configuracion'
tab_menu:
settings: 'Paramètres'
rss: 'RSS'
form_rss:
description: "Los fluxes RSS fornits per wallabag vos permeton de legir vòstres articles salvagardats dins vòstre lector de fluxes preferit. Per los poder emplegar, vos cal, d'en primièr crear un geton."
token_label: 'Geton RSS'
- no_token: 'Aucun jeton généré'
- token_create: 'Pas cap de geton generat'
+ no_token: 'Pas cap de geton generat'
+ token_create: 'Creatz vòstre geton'
token_reset: 'Reïnicializatz vòstre geton'
rss_links: 'URL de vòstres fluxes RSS'
rss_link:
if_label: 'se'
then_tag_as_label: 'alara atribuir las etiquetas'
delete_rule_label: 'suprimir'
+ # edit_rule_label: 'edit'
rule_label: 'Règla'
tags_label: 'Etiquetas'
faq:
re_fetch_content: 'Tornar cargar lo contengut'
delete: 'Suprimir'
add_a_tag: 'Ajustar una etiqueta'
- share_content: 'Partatjar'
+ share_content: 'Partejar'
share_email_label: 'Corrièl'
public_link: 'ligam public'
delete_public_link: 'suprimir lo ligam public'
developped_by: 'Desvolopat per'
website: 'Site web'
many_contributors: 'E un fum de contributors ♥ <a href="https://github.com/wallabag/wallabag/graphs/contributors">sur Github</a>'
- project_website: 'Site web del projète'
+ project_website: 'Site web del projècte'
license: 'Licéncia'
version: 'Version'
getting_help:
howto:
page_title: 'Ajuda'
- page_description: "I a mai d'un biai d'enregistrar un article :"
+ page_description: "I a mai d'un biais d'enregistrar un article :"
top_menu:
browser_addons: 'Extensions de navigator'
mobile_apps: 'Aplicacions mobil'
page_title: 'Importar > Wallabag v2'
description: "Aquesta aisina importarà totas vòstras donadas d'una instància mai de wallabag v2. Anatz dins totes vòstres articles, puèi, sus la barra laterala, clicatz sus \"JSON\". Traparatz un fichièr \"All articles.json\""
readability:
- page_title: 'Importer > Readability'
+ page_title: 'Importar > Readability'
description: "Aquesta aisina importarà totas vòstres articles de Readability. Sus la pagina de l'aisina (https://www.readability.com/tools/), clicatz sus \"Export your data\" dins la seccion \"Data Export\". Recebretz un corrièl per telecargar un json (qu'acaba pas amb un .json de fach)."
how_to: "Mercés de seleccionar vòstre Readability fichièr e de clicar sul boton dejós per lo telecargar e l'importar."
worker:
- # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:"
+ enabled: "L'importacion se fa de manièra asincròna. Un còp l'importacion lançada, una aisina externa s'ocuparà dels messatges un per un. Lo servici actual es : "
firefox:
- page_title: 'Importer > Firefox'
- # description: "This importer will import all your Firefox bookmarks. <p>For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
- # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
+ page_title: 'Importar > Firefox'
+ description: "Aquesta aisina importarà totas vòstres favorits de Firefox. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+ how_to: "Mercés de causir lo fichièr de salvagarda e de clicar sul boton dejós per l'importar. Notatz que lo tractament pòt durar un moment ja que totes los articles an d'èsser recuperats."
chrome:
- page_title: 'Importer > Chrome'
- # description: "This importer will import all your Chrome bookmarks. The location of the file depends on your operating system : <ul><li>On Linux, go into the <code>~/.config/chromium/Default/</code> directory</li><li>On Windows, it should be at <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default</code></li><li>On OS X, it should be at <code>~/Library/Application Support/Google/Chrome/Default/Bookmarks</code></li></ul>Once you got there, copy the Bookmarks file someplace you'll find.<em><br>Note that if you have Chromium instead of Chrome, you'll have to correct paths accordingly.</em></p>"
- # how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
+ page_title: 'Importar > Chrome'
+ description: "Aquesta aisina importarà totas vòstres favorits de Chrome. L'emplaçament del fichièr depend de vòstre sistèma operatiu : <ul><li>Sus Linux, anatz al dorsièr <code>~/.config/chromium/Default/</code></li><li>Sus Windows, deu èsser dins <code>%LOCALAPPDATA%\\Google\\Chrome\\User Data\\Default</code></li><li>sus OS X, deu èsser dins <code>~/Library/Application Support/Google/Chrome/Default/Bookmarks</code></li></ul>Un còp enlà, copiatz lo fichièr de favorits dins un endrech que volètz.<em><br>Notatz que s'avètz Chromium al lòc de Chrome, vos cal cambiar lo camin segon aquesta situacion.</em></p>"
+ how_to: "Mercés de causir lo fichièr de salvagarda e de clicar sul boton dejós per l'importar. Notatz que lo tractament pòt durar un moment ja que totes los articles an d'èsser recuperats."
instapaper:
- page_title: 'Importer > Instapaper'
- # description: 'This importer will import all your Instapaper articles. On the settings (https://www.instapaper.com/user) page, click on "Download .CSV file" in the "Export" section. A CSV file will be downloaded (like "instapaper-export.csv").'
- # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.'
+ page_title: 'Importar > Instapaper'
+ description: "Aquesta aisina importarà totas vòstres articles d'Instapaper. Sus la pagina de paramètres (https://www.instapaper.com/user), clicatz sus \"Download .CSV file\" dins la seccion \"Export\". Un fichièr CSV serà telecargat (aital \"instapaper-export.csv\")."
+ how_to: "Mercés de causir vòstre fichièr Instapaper e de clicar sul boton dejós per lo telecargar e l'importar"
developer:
- page_title: 'Desvolopador'
+ page_title: 'Desvolopaire'
welcome_message: "Benvenguda sus l'API de wallabag"
documentation: 'Documentacion'
how_to_first_app: 'Cossí crear vòstra primièra aplicacion'
page_title: 'Desvlopador > Novèl client'
page_description: "Anatz crear un novèl client. Mercés de cumplir l'url de redireccion cap a vòstra aplicacion."
form:
+ name_label: "Nom del client"
redirect_uris_label: 'URLs de redireccion'
save_label: 'Crear un novèl client'
action_back: 'Retorn'
client_parameter:
page_title: 'Desvolopador > Los paramètres de vòstre client'
page_description: 'Vaquí los paramètres de vòstre client'
+ field_name: 'Nom del client'
field_id: 'ID Client'
field_secret: 'Clau secreta'
back: 'Retour'
- read_howto: 'Legir \"cossí crear ma primièra aplicacion\"'
+ read_howto: 'Legir "cossí crear ma primièra aplicacion"'
howto:
page_title: 'Desvolopador > Cossí crear ma primièra aplicacion'
description:
notice:
entry_already_saved: 'Article ja salvargardat lo %date%'
entry_saved: 'Article enregistrat'
- # entry_saved_failed: 'Entry saved but fetching content failed'
+ entry_saved_failed: 'Article salvat mai fracàs de la recuperacion del contengut'
entry_updated: 'Article mes a jorn'
entry_reloaded: 'Article recargat'
- # entry_reload_failed: 'Entry reloaded but fetching content failed'
+ entry_reload_failed: "L'article es estat cargat de nòu mai la recuperacion del contengut a fracassat"
entry_archived: 'Article marcat coma legit'
entry_unarchived: 'Article marcat coma pas legit'
entry_starred: 'Article apondut dins los favorits'
failed: "L'importacion a fracassat, mercés de tornar ensajar"
failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr."
summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents."
- # summary_with_queue: 'Import summary: %queued% queued.'
+ summary_with_queue: "Rapòrt d'import : %queued% en espèra de tractament."
error:
- # redis_enabled_not_installed: Redis is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check Redis configuration.
- # rabbit_enabled_not_installed: RabbitMQ is enabled for handle asynchronous import but it looks like <u>we can't connect to it</u>. Please check RabbitMQ configuration.
+ redis_enabled_not_installed: "Redis es capable d'importar de manièra asincròna mai sembla que <u>podèm pas nos conectar amb el</u>. Mercés de verificar la configuracion de Redis."
+ rabbit_enabled_not_installed: "RabbitMQ es capable d'importar de manièra asincròna mai sembla que <u>podèm pas nos conectar amb el</u>. Mercés de verificar la configuracion de RabbitMQ."
developer:
notice:
client_created: 'Novèl client creat'
social: 'Społeczność'
powered_by: 'Kontrolowany przez'
about: 'O nas'
+ # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
page_title: 'Konfiguracja'
if_label: 'jeżeli'
then_tag_as_label: 'wtedy otaguj jako'
delete_rule_label: 'usuń'
+ # edit_rule_label: 'edit'
rule_label: 'Reguła'
tags_label: 'Tagi'
faq:
enabled: "Import jest wykonywany asynchronicznie. Od momentu rozpoczęcia importu, zewnętrzna usługa może zajmować się na raz tylko jednym zadaniem. Bieżącą usługą jest:"
firefox:
page_title: 'Import > Firefox'
- description: "Ten importer zaimportuje wszystkie twoje zakładki z Firefoksa. <p>Dla Firefoksa, idź do twoich zakładek (Ctrl+Shift+O), następnie w \"Import i kopie zapasowe\", wybierz \"Utwórz kopię zapasową...\". Uzyskasz plik .json."
+ description: "Ten importer zaimportuje wszystkie twoje zakładki z Firefoksa. Idź do twoich zakładek (Ctrl+Shift+O), następnie w \"Import i kopie zapasowe\", wybierz \"Utwórz kopię zapasową...\". Uzyskasz plik .json."
how_to: "Wybierz swój plik z zakładkami i naciśnij poniższy przycisk, aby je zaimportować. Może to zająć dłuższą chwilę, zanim wszystkie artykuły zostaną przeniesione."
chrome:
page_title: 'Import > Chrome'
# social: 'Social'
# powered_by: 'powered by'
about: 'Despre'
+ # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
page_title: 'Configurație'
# if_label: 'if'
# then_tag_as_label: 'then tag as'
# delete_rule_label: 'delete'
+ # edit_rule_label: 'edit'
# rule_label: 'Rule'
# tags_label: 'Tags'
# faq:
# enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:"
# firefox:
# page_title: 'Import > Firefox'
- # description: "This importer will import all your Firefox bookmarks. <p>For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+ # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
# how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
# chrome:
# page_title: 'Import > Chrome'
social: 'Sosyal'
powered_by: 'powered by'
about: 'Hakkımızda'
+ # stats: Since %user_creation% you read %nb_archives% articles. That is about %per_day% a day!
config:
page_title: 'Yapılandırma'
# enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:"
firefox:
page_title: 'İçe Aktar > Firefox'
- # description: "This importer will import all your Firefox bookmarks. <p>For Firefox, just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
+ # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file."
# how_to: "Please choose the bookmark backup file and click on the button below to import it. Note that the process may take a long time since all articles have to be fetched."
chrome:
page_title: 'İçe Aktar > Chrome'
« {{ tagging_rule.rule }} »
{{ 'config.form_rules.then_tag_as_label'|trans }}
« {{ tagging_rule.tags|join(', ') }} »
+ <a href="{{ path('edit_tagging_rule', {id: tagging_rule.id}) }}" title="{{ 'config.form_rules.edit_rule_label'|trans }}" class="tool mode_edit">✎</a>
<a href="{{ path('delete_tagging_rule', {id: tagging_rule.id}) }}" title="{{ 'config.form_rules.delete_rule_label'|trans }}" class="tool delete icon-trash icon"></a>
</li>
{% endfor %}
--- /dev/null
+{% extends "WallabagCoreBundle::layout.html.twig" %}
+
+{% block title %}{{ 'error.page_title'|trans }}{% endblock %}
+
+{% block body_class %}login{% endblock %}
+
+{% block menu %}{% endblock %}
+{% block messages %}{% endblock %}
+{% block header %}{% endblock %}
+
+{% block content %}
+<main class="valign-wrapper">
+ <div class="valign row">
+ <div class="card sw">
+ <div class="center"><img src="{{ asset('bundles/wallabagcore/themes/_global/img/logo-w.png') }}" alt="wallabag logo" /></div>
+ <h2>{{ status_code }}: {{ status_text }}</h2>
+ <p>{{ exception.message }}</p>
+ </div>
+ </div>
+</main>
+{% endblock %}
+
+{% block footer %}
+{% endblock %}
« {{ tagging_rule.rule }} »
{{ 'config.form_rules.then_tag_as_label'|trans }}
« {{ tagging_rule.tags|join(', ') }} »
+ <a href="{{ path('edit_tagging_rule', {id: tagging_rule.id}) }}" title="{{ 'config.form_rules.edit_rule_label'|trans }}">
+ <i class="tool grey-text mode_edit material-icons">mode_edit</i>
+ </a>
<a href="{{ path('delete_tagging_rule', {id: tagging_rule.id}) }}" title="{{ 'config.form_rules.delete_rule_label'|trans }}">
<i class="tool grey-text delete material-icons">delete</i>
</a>
--- /dev/null
+{% extends "WallabagCoreBundle::layout.html.twig" %}
+
+{% block title %}{{ 'error.page_title'|trans }}{% endblock %}
+
+{% block body_class %}login{% endblock %}
+
+{% block menu %}{% endblock %}
+{% block messages %}{% endblock %}
+
+{% block content %}
+<main class="valign-wrapper">
+ <div class="valign row">
+ <div class="card sw">
+ <div class="center"><img src="{{ asset('bundles/wallabagcore/themes/_global/img/logo-other_themes.png') }}" alt="wallabag logo" /></div>
+ <div class="card-content">
+ <div class="row">
+ <h5>{{ status_code }}: {{ status_text }}</h5>
+ <p>{{ exception.message }}</p>
+ {# {% for trace in exception.trace %}
+ <p>{{ trace.class }} - {{ trace.type }} - {{ trace.file }} - {{ trace.line }}</p>
+ {% endfor %} #}
+ </div>
+ </div>
+ </div>
+ </div>
+</main>
+{% endblock %}
+
+{% block footer %}
+{% endblock %}
<footer class="page-footer cyan darken-2">
<div class="footer-copyright">
<div class="container">
- <p>{{ 'footer.wallabag.powered_by'|trans }} <a target="_blank" href="https://wallabag.org" class="grey-text text-lighten-4">wallabag</a></p>
- <a class="grey-text text-lighten-4 right" href="{{ path('about') }}">{{ 'footer.wallabag.about'|trans }}</a>
+ <div class="row">
+ <div class="col s8">
+ <p>
+ {{ display_stats() }}
+ </p>
+ </div>
+ <div class="col s4">
+ <p>
+ {{ 'footer.wallabag.powered_by'|trans }} <a target="_blank" href="https://wallabag.org" class="grey-text text-lighten-4">wallabag</a> –
+ <a class="grey-text text-lighten-4" href="{{ path('about') }}">{{ 'footer.wallabag.about'|trans|lower }}</a>
+ </p>
+ </div>
+ </div>
</div>
</div>
</footer>
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository;
+use Symfony\Component\Translation\TranslatorInterface;
class WallabagExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface
{
private $entryRepository;
private $tagRepository;
private $lifeTime;
+ private $translator;
- public function __construct(EntryRepository $entryRepository = null, TagRepository $tagRepository = null, TokenStorageInterface $tokenStorage = null, $lifeTime = 0)
+ public function __construct(EntryRepository $entryRepository, TagRepository $tagRepository, TokenStorageInterface $tokenStorage, $lifeTime, TranslatorInterface $translator)
{
$this->entryRepository = $entryRepository;
$this->tagRepository = $tagRepository;
$this->tokenStorage = $tokenStorage;
$this->lifeTime = $lifeTime;
+ $this->translator = $translator;
}
public function getFilters()
return array(
new \Twig_SimpleFunction('count_entries', [$this, 'countEntries']),
new \Twig_SimpleFunction('count_tags', [$this, 'countTags']),
+ new \Twig_SimpleFunction('display_stats', [$this, 'displayStats']),
);
}
return $this->tagRepository->countAllTags($user->getId());
}
+ /**
+ * Display a single line about reading stats.
+ *
+ * @return string
+ */
+ public function displayStats()
+ {
+ $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
+
+ if (null === $user || !is_object($user)) {
+ return 0;
+ }
+
+ $query = $this->entryRepository->getBuilderForArchiveByUser($user->getId())
+ ->select('e.id')
+ ->groupBy('e.id')
+ ->getQuery();
+
+ $query->useQueryCache(true);
+ $query->useResultCache(true);
+ $query->setResultCacheLifetime($this->lifeTime);
+
+ $nbArchives = count($query->getArrayResult());
+
+ $interval = $user->getCreatedAt()->diff(new \DateTime('now'));
+ $nbDays = (int) $interval->format('%a') ?: 1;
+
+ return $this->translator->trans('footer.stats', [
+ '%user_creation%' => $user->getCreatedAt()->format('F jS, Y'),
+ '%nb_archives%' => $nbArchives,
+ '%per_day%' => round($nbArchives / $nbDays, 2),
+ ]);
+ }
+
public function getName()
{
return 'wallabag_extension';
<?php
-namespace Wallabag\CoreBundle\EventListener;
+namespace Wallabag\UserBundle\EventListener;
use Doctrine\ORM\EntityManager;
-use FOS\UserBundle\Event\FilterUserResponseEvent;
+use FOS\UserBundle\Event\UserEvent;
use FOS\UserBundle\FOSUserEvents;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Wallabag\CoreBundle\Entity\Config;
-class RegistrationConfirmedListener implements EventSubscriberInterface
+/**
+ * This listener will create the associated configuration when a user register.
+ * This configuration will be created right after the registration (no matter if it needs an email validation).
+ */
+class CreateConfigListener implements EventSubscriberInterface
{
private $em;
private $theme;
private $itemsOnPage;
private $rssLimit;
private $language;
+ private $readingSpeed;
- public function __construct(EntityManager $em, $theme, $itemsOnPage, $rssLimit, $language)
+ public function __construct(EntityManager $em, $theme, $itemsOnPage, $rssLimit, $language, $readingSpeed)
{
$this->em = $em;
$this->theme = $theme;
$this->itemsOnPage = $itemsOnPage;
$this->rssLimit = $rssLimit;
$this->language = $language;
+ $this->readingSpeed = $readingSpeed;
}
public static function getSubscribedEvents()
{
return [
- FOSUserEvents::REGISTRATION_CONFIRMED => 'authenticate',
+ // when a user register using the normal form
+ FOSUserEvents::REGISTRATION_COMPLETED => 'createConfig',
+ // when we manually create a user using the command line
+ // OR when we create it from the config UI
+ FOSUserEvents::USER_CREATED => 'createConfig',
];
}
- public function authenticate(FilterUserResponseEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null)
+ public function createConfig(UserEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null)
{
if (!$event->getUser()->isEnabled()) {
return;
$config->setItemsPerPage($this->itemsOnPage);
$config->setRssLimit($this->rssLimit);
$config->setLanguage($this->language);
+ $config->setReadingSpeed($this->readingSpeed);
+
$this->em->persist($config);
$this->em->flush();
}
factory: [ "@doctrine.orm.default_entity_manager", getRepository ]
arguments:
- WallabagUserBundle:User
+
+ wallabag_user.create_config:
+ class: Wallabag\UserBundle\EventListener\CreateConfigListener
+ arguments:
+ - "@doctrine.orm.entity_manager"
+ - "%wallabag_core.theme%"
+ - "%wallabag_core.items_on_page%"
+ - "%wallabag_core.rss_limit%"
+ - "%wallabag_core.language%"
+ - "%wallabag_core.reading_speed%"
+ tags:
+ - { name: kernel.event_subscriber }
$crawler = $client->followRedirect();
- $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
- $this->assertContains('flashes.config.notice.config_saved', $alert[0]);
+ $this->assertContains('flashes.config.notice.config_saved', $crawler->filter('body')->extract(['_text'])[0]);
}
public function testChangeReadingSpeed()
$crawler = $client->followRedirect();
- $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
- $this->assertContains('flashes.config.notice.password_updated', $alert[0]);
+ $this->assertContains('flashes.config.notice.password_updated', $crawler->filter('body')->extract(['_text'])[0]);
}
public function dataForUserFailed()
$crawler = $client->followRedirect();
- $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
- $this->assertContains('flashes.config.notice.user_added', $alert[0]);
+ $this->assertContains('flashes.config.notice.user_added', $crawler->filter('body')->extract(['_text'])[0]);
$em = $client->getContainer()->get('doctrine.orm.entity_manager');
$user = $em
$crawler = $client->followRedirect();
- $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
- $this->assertContains('flashes.config.notice.rss_updated', $alert[0]);
+ $this->assertContains('flashes.config.notice.rss_updated', $crawler->filter('body')->extract(['_text'])[0]);
}
public function dataForRssFailed()
$crawler = $client->followRedirect();
- $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
- $this->assertContains('flashes.config.notice.tagging_rules_updated', $alert[0]);
+ $this->assertContains('flashes.config.notice.tagging_rules_updated', $crawler->filter('body')->extract(['_text'])[0]);
+
+ $editLink = $crawler->filter('.mode_edit')->last()->link();
+
+ $crawler = $client->click($editLink);
+ $this->assertEquals(302, $client->getResponse()->getStatusCode());
+ $this->assertContains('?tagging-rule=', $client->getResponse()->headers->get('location'));
+
+ $crawler = $client->followRedirect();
+
+ $form = $crawler->filter('button[id=tagging_rule_save]')->form();
+
+ $data = [
+ 'tagging_rule[rule]' => 'readingTime <= 30',
+ 'tagging_rule[tags]' => 'short reading',
+ ];
+
+ $client->submit($form, $data);
+
+ $this->assertEquals(302, $client->getResponse()->getStatusCode());
+
+ $crawler = $client->followRedirect();
+
+ $this->assertContains('flashes.config.notice.tagging_rules_updated', $crawler->filter('body')->extract(['_text'])[0]);
+
+ $this->assertContains('readingTime <= 30', $crawler->filter('body')->extract(['_text'])[0]);
$deleteLink = $crawler->filter('.delete')->last()->link();
$this->assertEquals(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
- $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
- $this->assertContains('flashes.config.notice.tagging_rules_deleted', $alert[0]);
+ $this->assertContains('flashes.config.notice.tagging_rules_deleted', $crawler->filter('body')->extract(['_text'])[0]);
}
public function dataForTaggingRuleFailed()
->getRepository('WallabagCoreBundle:TaggingRule')
->findAll()[0];
- $crawler = $client->request('GET', '/tagging-rule/delete/'.$rule->getId());
+ $crawler = $client->request('GET', '/tagging-rule/edit/'.$rule->getId());
+
+ $this->assertEquals(403, $client->getResponse()->getStatusCode());
+ $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
+ $this->assertContains('You can not access this tagging rule', $body[0]);
+ }
+
+ public function testEditingTaggingRuleFromAnOtherUser()
+ {
+ $this->logInAs('bob');
+ $client = $this->getClient();
+
+ $rule = $client->getContainer()->get('doctrine.orm.entity_manager')
+ ->getRepository('WallabagCoreBundle:TaggingRule')
+ ->findAll()[0];
+
+ $crawler = $client->request('GET', '/tagging-rule/edit/'.$rule->getId());
$this->assertEquals(403, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertTrue($converter->supports($params));
}
- /**
- * @expectedException InvalidArgumentException
- * @expectedExceptionMessage Route attribute is missing
- */
public function testApplyEmptyRequest()
{
$params = new ParamConverter([]);
$converter = new UsernameRssTokenConverter();
- $converter->apply(new Request(), $params);
+ $res = $converter->apply(new Request(), $params);
+
+ $this->assertFalse($res);
}
/**
{
public function testRemoveWww()
{
- $extension = new WallabagExtension();
+ $entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator);
$this->assertEquals('lemonde.fr', $extension->removeWww('www.lemonde.fr'));
$this->assertEquals('lemonde.fr', $extension->removeWww('lemonde.fr'));
<?php
-namespace Tests\Wallabag\CoreBundle\EventListener;
+namespace Tests\Wallabag\UserBundle\EventListener;
use FOS\UserBundle\Event\FilterUserResponseEvent;
use FOS\UserBundle\FOSUserEvents;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Wallabag\CoreBundle\Entity\Config;
-use Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener;
+use Wallabag\UserBundle\EventListener\CreateConfigListener;
use Wallabag\UserBundle\Entity\User;
-class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase
+class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase
{
private $em;
private $listener;
->disableOriginalConstructor()
->getMock();
- $this->listener = new RegistrationConfirmedListener(
+ $this->listener = new CreateConfigListener(
$this->em,
'baggy',
20,
50,
- 'fr'
+ 'fr',
+ 1
);
$this->dispatcher = new EventDispatcher();
$this->em->expects($this->never())->method('flush');
$this->dispatcher->dispatch(
- FOSUserEvents::REGISTRATION_CONFIRMED,
+ FOSUserEvents::REGISTRATION_COMPLETED,
$event
);
}
$config->setItemsPerPage(20);
$config->setRssLimit(50);
$config->setLanguage('fr');
+ $config->setReadingSpeed(1);
$this->em->expects($this->once())
->method('persist')
->method('flush');
$this->dispatcher->dispatch(
- FOSUserEvents::REGISTRATION_CONFIRMED,
+ FOSUserEvents::REGISTRATION_COMPLETED,
$event
);
}