diff options
24 files changed, 195 insertions, 87 deletions
diff --git a/app/config/config.yml b/app/config/config.yml index b5d82ed9..fbebfee7 100644 --- a/app/config/config.yml +++ b/app/config/config.yml | |||
@@ -64,6 +64,7 @@ twig: | |||
64 | strict_variables: "%kernel.debug%" | 64 | strict_variables: "%kernel.debug%" |
65 | form_themes: | 65 | form_themes: |
66 | - "LexikFormFilterBundle:Form:form_div_layout.html.twig" | 66 | - "LexikFormFilterBundle:Form:form_div_layout.html.twig" |
67 | exception_controller: wallabag_core.exception_controller:showAction | ||
67 | 68 | ||
68 | # Doctrine Configuration | 69 | # Doctrine Configuration |
69 | doctrine: | 70 | doctrine: |
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 3873d2d3..cc7c2c94 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -2,6 +2,8 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Command; | 3 | namespace Wallabag\CoreBundle\Command; |
4 | 4 | ||
5 | use FOS\UserBundle\Event\UserEvent; | ||
6 | use FOS\UserBundle\FOSUserEvents; | ||
5 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | 7 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
6 | use Symfony\Component\Console\Helper\Table; | 8 | use Symfony\Component\Console\Helper\Table; |
7 | use Symfony\Component\Console\Input\ArrayInput; | 9 | use Symfony\Component\Console\Input\ArrayInput; |
@@ -236,14 +238,9 @@ class InstallCommand extends ContainerAwareCommand | |||
236 | 238 | ||
237 | $em->persist($user); | 239 | $em->persist($user); |
238 | 240 | ||
239 | $config = new Config($user); | 241 | // dispatch a created event so the associated config will be created |
240 | $config->setTheme($this->getContainer()->getParameter('wallabag_core.theme')); | 242 | $event = new UserEvent($user); |
241 | $config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page')); | 243 | $this->getContainer()->get('event_dispatcher')->dispatch(FOSUserEvents::USER_CREATED, $event); |
242 | $config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit')); | ||
243 | $config->setReadingSpeed($this->getContainer()->getParameter('wallabag_core.reading_speed')); | ||
244 | $config->setLanguage($this->getContainer()->getParameter('wallabag_core.language')); | ||
245 | |||
246 | $em->persist($config); | ||
247 | 244 | ||
248 | $this->defaultOutput->writeln(''); | 245 | $this->defaultOutput->writeln(''); |
249 | 246 | ||
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 4f75511b..75a9af0b 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -2,6 +2,8 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Controller; | 3 | namespace Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use FOS\UserBundle\Event\UserEvent; | ||
6 | use FOS\UserBundle\FOSUserEvents; | ||
5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 8 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
7 | use Symfony\Component\HttpFoundation\JsonResponse; | 9 | use Symfony\Component\HttpFoundation\JsonResponse; |
@@ -133,18 +135,11 @@ class ConfigController extends Controller | |||
133 | $newUserForm->handleRequest($request); | 135 | $newUserForm->handleRequest($request); |
134 | 136 | ||
135 | if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { | 137 | if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { |
136 | $userManager->updateUser($newUser, true); | 138 | $userManager->updateUser($newUser); |
137 | 139 | ||
138 | $config = new Config($newUser); | 140 | // dispatch a created event so the associated config will be created |
139 | $config->setTheme($this->getParameter('wallabag_core.theme')); | 141 | $event = new UserEvent($newUser, $request); |
140 | $config->setItemsPerPage($this->getParameter('wallabag_core.items_on_page')); | 142 | $this->get('event_dispatcher')->dispatch(FOSUserEvents::USER_CREATED, $event); |
141 | $config->setRssLimit($this->getParameter('wallabag_core.rss_limit')); | ||
142 | $config->setLanguage($this->getParameter('wallabag_core.language')); | ||
143 | $config->setReadingSpeed($this->getParameter('wallabag_core.reading_speed')); | ||
144 | |||
145 | $em->persist($config); | ||
146 | |||
147 | $em->flush(); | ||
148 | 143 | ||
149 | $this->get('session')->getFlashBag()->add( | 144 | $this->get('session')->getFlashBag()->add( |
150 | 'notice', | 145 | 'notice', |
@@ -238,6 +233,7 @@ class ConfigController extends Controller | |||
238 | ->getRepository('WallabagCoreBundle:Config') | 233 | ->getRepository('WallabagCoreBundle:Config') |
239 | ->findOneByUser($this->getUser()); | 234 | ->findOneByUser($this->getUser()); |
240 | 235 | ||
236 | // should NEVER HAPPEN ... | ||
241 | if (!$config) { | 237 | if (!$config) { |
242 | $config = new Config($this->getUser()); | 238 | $config = new Config($this->getUser()); |
243 | } | 239 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/ExceptionController.php b/src/Wallabag/CoreBundle/Controller/ExceptionController.php new file mode 100644 index 00000000..abfa9c2f --- /dev/null +++ b/src/Wallabag/CoreBundle/Controller/ExceptionController.php | |||
@@ -0,0 +1,40 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Controller; | ||
4 | |||
5 | use Symfony\Bundle\TwigBundle\Controller\ExceptionController as BaseExceptionController; | ||
6 | use Symfony\Component\HttpFoundation\Request; | ||
7 | |||
8 | /** | ||
9 | * This controller allow us to customize the error template. | ||
10 | * The only modified line from the parent template is for "WallabagCoreBundle". | ||
11 | */ | ||
12 | class ExceptionController extends BaseExceptionController | ||
13 | { | ||
14 | protected function findTemplate(Request $request, $format, $code, $showException) | ||
15 | { | ||
16 | $name = $showException ? 'exception' : 'error'; | ||
17 | if ($showException && 'html' == $format) { | ||
18 | $name = 'exception_full'; | ||
19 | } | ||
20 | |||
21 | // For error pages, try to find a template for the specific HTTP status code and format | ||
22 | if (!$showException) { | ||
23 | $template = sprintf('WallabagCoreBundle:Exception:%s.%s.twig', $name, $format); | ||
24 | if ($this->templateExists($template)) { | ||
25 | return $template; | ||
26 | } | ||
27 | } | ||
28 | |||
29 | // try to find a template for the given format | ||
30 | $template = sprintf('@Twig/Exception/%s.%s.twig', $name, $format); | ||
31 | if ($this->templateExists($template)) { | ||
32 | return $template; | ||
33 | } | ||
34 | |||
35 | // default to a generic HTML exception | ||
36 | $request->setRequestFormat('html'); | ||
37 | |||
38 | return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name); | ||
39 | } | ||
40 | } | ||
diff --git a/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php b/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php index 6ea2a4f3..40b5673d 100644 --- a/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php +++ b/src/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverter.php | |||
@@ -49,7 +49,7 @@ class UsernameRssTokenConverter implements ParamConverterInterface | |||
49 | $em = $this->registry->getManagerForClass($configuration->getClass()); | 49 | $em = $this->registry->getManagerForClass($configuration->getClass()); |
50 | 50 | ||
51 | // Check, if class name is what we need | 51 | // Check, if class name is what we need |
52 | if ('Wallabag\UserBundle\Entity\User' !== $em->getClassMetadata($configuration->getClass())->getName()) { | 52 | if (null !== $em && 'Wallabag\UserBundle\Entity\User' !== $em->getClassMetadata($configuration->getClass())->getName()) { |
53 | return false; | 53 | return false; |
54 | } | 54 | } |
55 | 55 | ||
@@ -69,9 +69,8 @@ class UsernameRssTokenConverter implements ParamConverterInterface | |||
69 | $username = $request->attributes->get('username'); | 69 | $username = $request->attributes->get('username'); |
70 | $rssToken = $request->attributes->get('token'); | 70 | $rssToken = $request->attributes->get('token'); |
71 | 71 | ||
72 | // Check, if route attributes exists | 72 | if (!$request->attributes->has('username') || !$request->attributes->has('token')) { |
73 | if (null === $username || null === $rssToken) { | 73 | return false; |
74 | throw new \InvalidArgumentException('Route attribute is missing'); | ||
75 | } | 74 | } |
76 | 75 | ||
77 | // Get actual entity manager for class | 76 | // Get actual entity manager for class |
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 23e6d3ca..d1139846 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -88,17 +88,6 @@ services: | |||
88 | arguments: | 88 | arguments: |
89 | - WallabagCoreBundle:Tag | 89 | - WallabagCoreBundle:Tag |
90 | 90 | ||
91 | wallabag_core.registration_confirmed: | ||
92 | class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener | ||
93 | arguments: | ||
94 | - "@doctrine.orm.entity_manager" | ||
95 | - "%wallabag_core.theme%" | ||
96 | - "%wallabag_core.items_on_page%" | ||
97 | - "%wallabag_core.rss_limit%" | ||
98 | - "%wallabag_core.language%" | ||
99 | tags: | ||
100 | - { name: kernel.event_subscriber } | ||
101 | |||
102 | wallabag_core.helper.entries_export: | 91 | wallabag_core.helper.entries_export: |
103 | class: Wallabag\CoreBundle\Helper\EntriesExport | 92 | class: Wallabag\CoreBundle\Helper\EntriesExport |
104 | arguments: | 93 | arguments: |
@@ -133,3 +122,9 @@ services: | |||
133 | host: '%redis_host%' | 122 | host: '%redis_host%' |
134 | port: '%redis_port%' | 123 | port: '%redis_port%' |
135 | schema: tcp | 124 | schema: tcp |
125 | |||
126 | wallabag_core.exception_controller: | ||
127 | class: Wallabag\CoreBundle\Controller\ExceptionController | ||
128 | arguments: | ||
129 | - '@twig' | ||
130 | - '%kernel.debug%' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index f8526cfe..72374a4a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -352,7 +352,7 @@ import: | |||
352 | # 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:" | 352 | # 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:" |
353 | # firefox: | 353 | # firefox: |
354 | # page_title: 'Import > Firefox' | 354 | # page_title: 'Import > Firefox' |
355 | # 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." | 355 | # 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." |
356 | # 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." | 356 | # 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." |
357 | #chrome: | 357 | #chrome: |
358 | # page_title: 'Import > Chrome' | 358 | # page_title: 'Import > Chrome' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index b0abe0cd..3013e780 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -352,7 +352,7 @@ import: | |||
352 | # 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:" | 352 | # 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:" |
353 | firefox: | 353 | firefox: |
354 | page_title: 'Aus Firefox importieren' | 354 | page_title: 'Aus Firefox importieren' |
355 | # 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." | 355 | # 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." |
356 | # 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." | 356 | # 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." |
357 | chrome: | 357 | chrome: |
358 | page_title: 'Aus Chrome importieren' | 358 | page_title: 'Aus Chrome importieren' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 02fbd507..7bd85cd6 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -352,7 +352,7 @@ import: | |||
352 | 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:" | 352 | 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:" |
353 | firefox: | 353 | firefox: |
354 | page_title: 'Import > Firefox' | 354 | page_title: 'Import > Firefox' |
355 | 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." | 355 | 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." |
356 | 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." | 356 | 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." |
357 | chrome: | 357 | chrome: |
358 | page_title: 'Import > Chrome' | 358 | page_title: 'Import > Chrome' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index b7f6ab24..cab0f302 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -352,7 +352,7 @@ import: | |||
352 | # 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:" | 352 | # 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:" |
353 | firefox: | 353 | firefox: |
354 | page_title: 'Importar > Firefox' | 354 | page_title: 'Importar > Firefox' |
355 | # 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." | 355 | # 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." |
356 | # 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." | 356 | # 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." |
357 | chrome: | 357 | chrome: |
358 | page_title: 'Importar > Chrome' | 358 | page_title: 'Importar > Chrome' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index e195a8c5..202f9d2d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -352,7 +352,7 @@ import: | |||
352 | # 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:" | 352 | # 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:" |
353 | firefox: | 353 | firefox: |
354 | page_title: 'درون‌ریزی > Firefox' | 354 | page_title: 'درون‌ریزی > Firefox' |
355 | # 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." | 355 | # 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." |
356 | # 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." | 356 | # 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." |
357 | chrome: | 357 | chrome: |
358 | page_title: 'درون‌ریزی > Chrome' | 358 | page_title: 'درون‌ریزی > Chrome' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 9fe1855d..591b598b 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -352,7 +352,7 @@ import: | |||
352 | enabled: "Les imports sont asynchrones. Une fois l'import commencé un worker externe traitera les messages un par un. Le service activé est :" | 352 | enabled: "Les imports sont asynchrones. Une fois l'import commencé un worker externe traitera les messages un par un. Le service activé est :" |
353 | firefox: | 353 | firefox: |
354 | page_title: 'Import > Firefox' | 354 | page_title: 'Import > Firefox' |
355 | 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>" | 355 | 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>" |
356 | 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." | 356 | 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." |
357 | chrome: | 357 | chrome: |
358 | page_title: 'Import > Chrome' | 358 | page_title: 'Import > Chrome' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 34254813..b767e580 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -351,7 +351,7 @@ import: | |||
351 | # 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:" | 351 | # 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:" |
352 | firefox: | 352 | firefox: |
353 | page_title: 'Importa da > Firefox' | 353 | page_title: 'Importa da > Firefox' |
354 | # 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." | 354 | # 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." |
355 | # 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." | 355 | # 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." |
356 | chrome: | 356 | chrome: |
357 | page_title: 'Importa da > Chrome' | 357 | page_title: 'Importa da > Chrome' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index f6cea17f..39eac642 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -19,14 +19,14 @@ menu: | |||
19 | unread: 'Pas legits' | 19 | unread: 'Pas legits' |
20 | starred: 'Favorits' | 20 | starred: 'Favorits' |
21 | archive: 'Legits' | 21 | archive: 'Legits' |
22 | all_articles: 'Tots los articles' | 22 | all_articles: 'Totes los articles' |
23 | config: 'Configuracion' | 23 | config: 'Configuracion' |
24 | tags: 'Etiquetas' | 24 | tags: 'Etiquetas' |
25 | internal_settings: 'Configuracion interna' | 25 | internal_settings: 'Configuracion interna' |
26 | import: 'Importar' | 26 | import: 'Importar' |
27 | howto: 'Ajuda' | 27 | howto: 'Ajuda' |
28 | developer: 'Desvolopador' | 28 | developer: 'Desvolopador' |
29 | logout: 'Déconnexion' | 29 | logout: 'Desconnexion' |
30 | about: 'A prepaus' | 30 | about: 'A prepaus' |
31 | search: 'Cercar' | 31 | search: 'Cercar' |
32 | save_link: 'Enregistrar un novèl article' | 32 | save_link: 'Enregistrar un novèl article' |
@@ -73,8 +73,8 @@ config: | |||
73 | form_rss: | 73 | form_rss: |
74 | 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." | 74 | 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." |
75 | token_label: 'Geton RSS' | 75 | token_label: 'Geton RSS' |
76 | no_token: 'Aucun jeton généré' | 76 | no_token: 'Pas cap de geton generat' |
77 | token_create: 'Pas cap de geton generat' | 77 | token_create: 'Creatz vòstre geton' |
78 | token_reset: 'Reïnicializatz vòstre geton' | 78 | token_reset: 'Reïnicializatz vòstre geton' |
79 | rss_links: 'URL de vòstres fluxes RSS' | 79 | rss_links: 'URL de vòstres fluxes RSS' |
80 | rss_link: | 80 | rss_link: |
@@ -188,7 +188,7 @@ entry: | |||
188 | re_fetch_content: 'Tornar cargar lo contengut' | 188 | re_fetch_content: 'Tornar cargar lo contengut' |
189 | delete: 'Suprimir' | 189 | delete: 'Suprimir' |
190 | add_a_tag: 'Ajustar una etiqueta' | 190 | add_a_tag: 'Ajustar una etiqueta' |
191 | share_content: 'Partatjar' | 191 | share_content: 'Partejar' |
192 | share_email_label: 'Corrièl' | 192 | share_email_label: 'Corrièl' |
193 | public_link: 'ligam public' | 193 | public_link: 'ligam public' |
194 | delete_public_link: 'suprimir lo ligam public' | 194 | delete_public_link: 'suprimir lo ligam public' |
@@ -225,7 +225,7 @@ about: | |||
225 | developped_by: 'Desvolopat per' | 225 | developped_by: 'Desvolopat per' |
226 | website: 'Site web' | 226 | website: 'Site web' |
227 | many_contributors: 'E un fum de contributors ♥ <a href="https://github.com/wallabag/wallabag/graphs/contributors">sur Github</a>' | 227 | many_contributors: 'E un fum de contributors ♥ <a href="https://github.com/wallabag/wallabag/graphs/contributors">sur Github</a>' |
228 | project_website: 'Site web del projète' | 228 | project_website: 'Site web del projècte' |
229 | license: 'Licéncia' | 229 | license: 'Licéncia' |
230 | version: 'Version' | 230 | version: 'Version' |
231 | getting_help: | 231 | getting_help: |
@@ -246,7 +246,7 @@ about: | |||
246 | 246 | ||
247 | howto: | 247 | howto: |
248 | page_title: 'Ajuda' | 248 | page_title: 'Ajuda' |
249 | page_description: "I a mai d'un biai d'enregistrar un article :" | 249 | page_description: "I a mai d'un biais d'enregistrar un article :" |
250 | top_menu: | 250 | top_menu: |
251 | browser_addons: 'Extensions de navigator' | 251 | browser_addons: 'Extensions de navigator' |
252 | mobile_apps: 'Aplicacions mobil' | 252 | mobile_apps: 'Aplicacions mobil' |
@@ -345,26 +345,26 @@ import: | |||
345 | page_title: 'Importar > Wallabag v2' | 345 | page_title: 'Importar > Wallabag v2' |
346 | 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\"" | 346 | 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\"" |
347 | readability: | 347 | readability: |
348 | page_title: 'Importer > Readability' | 348 | page_title: 'Importar > Readability' |
349 | 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)." | 349 | 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)." |
350 | how_to: "Mercés de seleccionar vòstre Readability fichièr e de clicar sul boton dejós per lo telecargar e l'importar." | 350 | how_to: "Mercés de seleccionar vòstre Readability fichièr e de clicar sul boton dejós per lo telecargar e l'importar." |
351 | worker: | 351 | worker: |
352 | # 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:" | 352 | 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 : " |
353 | firefox: | 353 | firefox: |
354 | page_title: 'Importer > Firefox' | 354 | page_title: 'Importar > Firefox' |
355 | # 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." | 355 | 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." |
356 | # 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." | 356 | 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." |
357 | chrome: | 357 | chrome: |
358 | page_title: 'Importer > Chrome' | 358 | page_title: 'Importar > Chrome' |
359 | # 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>" | 359 | 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>" |
360 | # 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." | 360 | 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." |
361 | instapaper: | 361 | instapaper: |
362 | page_title: 'Importer > Instapaper' | 362 | page_title: 'Importar > Instapaper' |
363 | # 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").' | 363 | 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\")." |
364 | # how_to: 'Please select your Instapaper export and click on the below button to upload and import it.' | 364 | how_to: "Mercés de causir vòstre fichièr Instapaper e de clicar sul boton dejós per lo telecargar e l'importar" |
365 | 365 | ||
366 | developer: | 366 | developer: |
367 | page_title: 'Desvolopador' | 367 | page_title: 'Desvolopaire' |
368 | welcome_message: "Benvenguda sus l'API de wallabag" | 368 | welcome_message: "Benvenguda sus l'API de wallabag" |
369 | documentation: 'Documentacion' | 369 | documentation: 'Documentacion' |
370 | how_to_first_app: 'Cossà crear vòstra primièra aplicacion' | 370 | how_to_first_app: 'Cossà crear vòstra primièra aplicacion' |
@@ -388,16 +388,18 @@ developer: | |||
388 | page_title: 'Desvlopador > Novèl client' | 388 | page_title: 'Desvlopador > Novèl client' |
389 | page_description: "Anatz crear un novèl client. Mercés de cumplir l'url de redireccion cap a vòstra aplicacion." | 389 | page_description: "Anatz crear un novèl client. Mercés de cumplir l'url de redireccion cap a vòstra aplicacion." |
390 | form: | 390 | form: |
391 | name_label: "Nom del client" | ||
391 | redirect_uris_label: 'URLs de redireccion' | 392 | redirect_uris_label: 'URLs de redireccion' |
392 | save_label: 'Crear un novèl client' | 393 | save_label: 'Crear un novèl client' |
393 | action_back: 'Retorn' | 394 | action_back: 'Retorn' |
394 | client_parameter: | 395 | client_parameter: |
395 | page_title: 'Desvolopador > Los paramètres de vòstre client' | 396 | page_title: 'Desvolopador > Los paramètres de vòstre client' |
396 | page_description: 'Vaquà los paramètres de vòstre client' | 397 | page_description: 'Vaquà los paramètres de vòstre client' |
398 | field_name: 'Nom del client' | ||
397 | field_id: 'ID Client' | 399 | field_id: 'ID Client' |
398 | field_secret: 'Clau secreta' | 400 | field_secret: 'Clau secreta' |
399 | back: 'Retour' | 401 | back: 'Retour' |
400 | read_howto: 'Legir \"cossà crear ma primièra aplicacion\"' | 402 | read_howto: 'Legir "cossà crear ma primièra aplicacion"' |
401 | howto: | 403 | howto: |
402 | page_title: 'Desvolopador > Cossà crear ma primièra aplicacion' | 404 | page_title: 'Desvolopador > Cossà crear ma primièra aplicacion' |
403 | description: | 405 | description: |
@@ -427,10 +429,10 @@ flashes: | |||
427 | notice: | 429 | notice: |
428 | entry_already_saved: 'Article ja salvargardat lo %date%' | 430 | entry_already_saved: 'Article ja salvargardat lo %date%' |
429 | entry_saved: 'Article enregistrat' | 431 | entry_saved: 'Article enregistrat' |
430 | # entry_saved_failed: 'Entry saved but fetching content failed' | 432 | entry_saved_failed: 'Article salvat mai fracàs de la recuperacion del contengut' |
431 | entry_updated: 'Article mes a jorn' | 433 | entry_updated: 'Article mes a jorn' |
432 | entry_reloaded: 'Article recargat' | 434 | entry_reloaded: 'Article recargat' |
433 | # entry_reload_failed: 'Entry reloaded but fetching content failed' | 435 | entry_reload_failed: "L'article es estat cargat de nòu mai la recuperacion del contengut a fracassat" |
434 | entry_archived: 'Article marcat coma legit' | 436 | entry_archived: 'Article marcat coma legit' |
435 | entry_unarchived: 'Article marcat coma pas legit' | 437 | entry_unarchived: 'Article marcat coma pas legit' |
436 | entry_starred: 'Article apondut dins los favorits' | 438 | entry_starred: 'Article apondut dins los favorits' |
@@ -444,10 +446,10 @@ flashes: | |||
444 | failed: "L'importacion a fracassat, mercés de tornar ensajar" | 446 | failed: "L'importacion a fracassat, mercés de tornar ensajar" |
445 | failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr." | 447 | failed_on_file: "Errorr pendent du tractament de l'import. Mercés de verificar vòstre fichièr." |
446 | summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents." | 448 | summary: "Rapòrt d'import: %imported% importats, %skipped% ja presents." |
447 | # summary_with_queue: 'Import summary: %queued% queued.' | 449 | summary_with_queue: "Rapòrt d'import : %queued% en espèra de tractament." |
448 | error: | 450 | error: |
449 | # 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. | 451 | 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." |
450 | # 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. | 452 | 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." |
451 | developer: | 453 | developer: |
452 | notice: | 454 | notice: |
453 | client_created: 'Novèl client creat' | 455 | client_created: 'Novèl client creat' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 5fd12b10..50da9ff2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -352,7 +352,7 @@ import: | |||
352 | 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:" | 352 | 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:" |
353 | firefox: | 353 | firefox: |
354 | page_title: 'Import > Firefox' | 354 | page_title: 'Import > Firefox' |
355 | 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." | 355 | 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." |
356 | 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." | 356 | 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." |
357 | chrome: | 357 | chrome: |
358 | page_title: 'Import > Chrome' | 358 | page_title: 'Import > Chrome' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 9002b724..315d6aa0 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -352,7 +352,7 @@ import: | |||
352 | # 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:" | 352 | # 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:" |
353 | # firefox: | 353 | # firefox: |
354 | # page_title: 'Import > Firefox' | 354 | # page_title: 'Import > Firefox' |
355 | # 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." | 355 | # 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." |
356 | # 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." | 356 | # 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." |
357 | # chrome: | 357 | # chrome: |
358 | # page_title: 'Import > Chrome' | 358 | # page_title: 'Import > Chrome' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 1121a2ef..e46c17c8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -352,7 +352,7 @@ import: | |||
352 | # 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:" | 352 | # 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:" |
353 | firefox: | 353 | firefox: |
354 | page_title: 'İçe Aktar > Firefox' | 354 | page_title: 'İçe Aktar > Firefox' |
355 | # 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." | 355 | # 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." |
356 | # 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." | 356 | # 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." |
357 | chrome: | 357 | chrome: |
358 | page_title: 'İçe Aktar > Chrome' | 358 | page_title: 'İçe Aktar > Chrome' |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Exception/error.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Exception/error.html.twig new file mode 100644 index 00000000..b52634fd --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Exception/error.html.twig | |||
@@ -0,0 +1,24 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title %}{{ 'error.page_title'|trans }}{% endblock %} | ||
4 | |||
5 | {% block body_class %}login{% endblock %} | ||
6 | |||
7 | {% block menu %}{% endblock %} | ||
8 | {% block messages %}{% endblock %} | ||
9 | {% block header %}{% endblock %} | ||
10 | |||
11 | {% block content %} | ||
12 | <main class="valign-wrapper"> | ||
13 | <div class="valign row"> | ||
14 | <div class="card sw"> | ||
15 | <div class="center"><img src="{{ asset('bundles/wallabagcore/themes/_global/img/logo-w.png') }}" alt="wallabag logo" /></div> | ||
16 | <h2>{{ status_code }}: {{ status_text }}</h2> | ||
17 | <p>{{ exception.message }}</p> | ||
18 | </div> | ||
19 | </div> | ||
20 | </main> | ||
21 | {% endblock %} | ||
22 | |||
23 | {% block footer %} | ||
24 | {% endblock %} | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Exception/error.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Exception/error.html.twig new file mode 100644 index 00000000..6be78edb --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Exception/error.html.twig | |||
@@ -0,0 +1,30 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title %}{{ 'error.page_title'|trans }}{% endblock %} | ||
4 | |||
5 | {% block body_class %}login{% endblock %} | ||
6 | |||
7 | {% block menu %}{% endblock %} | ||
8 | {% block messages %}{% endblock %} | ||
9 | |||
10 | {% block content %} | ||
11 | <main class="valign-wrapper"> | ||
12 | <div class="valign row"> | ||
13 | <div class="card sw"> | ||
14 | <div class="center"><img src="{{ asset('bundles/wallabagcore/themes/_global/img/logo-other_themes.png') }}" alt="wallabag logo" /></div> | ||
15 | <div class="card-content"> | ||
16 | <div class="row"> | ||
17 | <h5>{{ status_code }}: {{ status_text }}</h5> | ||
18 | <p>{{ exception.message }}</p> | ||
19 | {# {% for trace in exception.trace %} | ||
20 | <p>{{ trace.class }} - {{ trace.type }} - {{ trace.file }} - {{ trace.line }}</p> | ||
21 | {% endfor %} #} | ||
22 | </div> | ||
23 | </div> | ||
24 | </div> | ||
25 | </div> | ||
26 | </main> | ||
27 | {% endblock %} | ||
28 | |||
29 | {% block footer %} | ||
30 | {% endblock %} | ||
diff --git a/src/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListener.php b/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php index 10586126..15f4ac3d 100644 --- a/src/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListener.php +++ b/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php | |||
@@ -1,39 +1,49 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\EventListener; | 3 | namespace Wallabag\UserBundle\EventListener; |
4 | 4 | ||
5 | use Doctrine\ORM\EntityManager; | 5 | use Doctrine\ORM\EntityManager; |
6 | use FOS\UserBundle\Event\FilterUserResponseEvent; | 6 | use FOS\UserBundle\Event\UserEvent; |
7 | use FOS\UserBundle\FOSUserEvents; | 7 | use FOS\UserBundle\FOSUserEvents; |
8 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; | 8 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
9 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; | 9 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
10 | use Wallabag\CoreBundle\Entity\Config; | 10 | use Wallabag\CoreBundle\Entity\Config; |
11 | 11 | ||
12 | class RegistrationConfirmedListener implements EventSubscriberInterface | 12 | /** |
13 | * This listener will create the associated configuration when a user register. | ||
14 | * This configuration will be created right after the registration (no matter if it needs an email validation). | ||
15 | */ | ||
16 | class CreateConfigListener implements EventSubscriberInterface | ||
13 | { | 17 | { |
14 | private $em; | 18 | private $em; |
15 | private $theme; | 19 | private $theme; |
16 | private $itemsOnPage; | 20 | private $itemsOnPage; |
17 | private $rssLimit; | 21 | private $rssLimit; |
18 | private $language; | 22 | private $language; |
23 | private $readingSpeed; | ||
19 | 24 | ||
20 | public function __construct(EntityManager $em, $theme, $itemsOnPage, $rssLimit, $language) | 25 | public function __construct(EntityManager $em, $theme, $itemsOnPage, $rssLimit, $language, $readingSpeed) |
21 | { | 26 | { |
22 | $this->em = $em; | 27 | $this->em = $em; |
23 | $this->theme = $theme; | 28 | $this->theme = $theme; |
24 | $this->itemsOnPage = $itemsOnPage; | 29 | $this->itemsOnPage = $itemsOnPage; |
25 | $this->rssLimit = $rssLimit; | 30 | $this->rssLimit = $rssLimit; |
26 | $this->language = $language; | 31 | $this->language = $language; |
32 | $this->readingSpeed = $readingSpeed; | ||
27 | } | 33 | } |
28 | 34 | ||
29 | public static function getSubscribedEvents() | 35 | public static function getSubscribedEvents() |
30 | { | 36 | { |
31 | return [ | 37 | return [ |
32 | FOSUserEvents::REGISTRATION_CONFIRMED => 'authenticate', | 38 | // when a user register using the normal form |
39 | FOSUserEvents::REGISTRATION_COMPLETED => 'createConfig', | ||
40 | // when we manually create a user using the command line | ||
41 | // OR when we create it from the config UI | ||
42 | FOSUserEvents::USER_CREATED => 'createConfig', | ||
33 | ]; | 43 | ]; |
34 | } | 44 | } |
35 | 45 | ||
36 | public function authenticate(FilterUserResponseEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null) | 46 | public function createConfig(UserEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null) |
37 | { | 47 | { |
38 | if (!$event->getUser()->isEnabled()) { | 48 | if (!$event->getUser()->isEnabled()) { |
39 | return; | 49 | return; |
@@ -44,6 +54,8 @@ class RegistrationConfirmedListener implements EventSubscriberInterface | |||
44 | $config->setItemsPerPage($this->itemsOnPage); | 54 | $config->setItemsPerPage($this->itemsOnPage); |
45 | $config->setRssLimit($this->rssLimit); | 55 | $config->setRssLimit($this->rssLimit); |
46 | $config->setLanguage($this->language); | 56 | $config->setLanguage($this->language); |
57 | $config->setReadingSpeed($this->readingSpeed); | ||
58 | |||
47 | $this->em->persist($config); | 59 | $this->em->persist($config); |
48 | $this->em->flush(); | 60 | $this->em->flush(); |
49 | } | 61 | } |
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml index 05830555..eb9c8e67 100644 --- a/src/Wallabag/UserBundle/Resources/config/services.yml +++ b/src/Wallabag/UserBundle/Resources/config/services.yml | |||
@@ -20,3 +20,15 @@ services: | |||
20 | factory: [ "@doctrine.orm.default_entity_manager", getRepository ] | 20 | factory: [ "@doctrine.orm.default_entity_manager", getRepository ] |
21 | arguments: | 21 | arguments: |
22 | - WallabagUserBundle:User | 22 | - WallabagUserBundle:User |
23 | |||
24 | wallabag_user.create_config: | ||
25 | class: Wallabag\UserBundle\EventListener\CreateConfigListener | ||
26 | arguments: | ||
27 | - "@doctrine.orm.entity_manager" | ||
28 | - "%wallabag_core.theme%" | ||
29 | - "%wallabag_core.items_on_page%" | ||
30 | - "%wallabag_core.rss_limit%" | ||
31 | - "%wallabag_core.language%" | ||
32 | - "%wallabag_core.reading_speed%" | ||
33 | tags: | ||
34 | - { name: kernel.event_subscriber } | ||
diff --git a/src/Wallabag/UserBundle/Resources/views/Registration/checkEmail.html.twig b/src/Wallabag/UserBundle/Resources/views/Registration/check_email.html.twig index 50937276..50937276 100644 --- a/src/Wallabag/UserBundle/Resources/views/Registration/checkEmail.html.twig +++ b/src/Wallabag/UserBundle/Resources/views/Registration/check_email.html.twig | |||
diff --git a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php index e29b58b5..2e6fccfb 100644 --- a/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php +++ b/tests/Wallabag/CoreBundle/ParamConverter/UsernameRssTokenConverterTest.php | |||
@@ -125,16 +125,14 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase | |||
125 | $this->assertTrue($converter->supports($params)); | 125 | $this->assertTrue($converter->supports($params)); |
126 | } | 126 | } |
127 | 127 | ||
128 | /** | ||
129 | * @expectedException InvalidArgumentException | ||
130 | * @expectedExceptionMessage Route attribute is missing | ||
131 | */ | ||
132 | public function testApplyEmptyRequest() | 128 | public function testApplyEmptyRequest() |
133 | { | 129 | { |
134 | $params = new ParamConverter([]); | 130 | $params = new ParamConverter([]); |
135 | $converter = new UsernameRssTokenConverter(); | 131 | $converter = new UsernameRssTokenConverter(); |
136 | 132 | ||
137 | $converter->apply(new Request(), $params); | 133 | $res = $converter->apply(new Request(), $params); |
134 | |||
135 | $this->assertFalse($res); | ||
138 | } | 136 | } |
139 | 137 | ||
140 | /** | 138 | /** |
diff --git a/tests/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListenerTest.php b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php index e45722fa..0cebd3e4 100644 --- a/tests/Wallabag/CoreBundle/EventListener/RegistrationConfirmedListenerTest.php +++ b/tests/Wallabag/UserBundle/EventListener/CreateConfigListenerTest.php | |||
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Tests\Wallabag\CoreBundle\EventListener; | 3 | namespace Tests\Wallabag\UserBundle\EventListener; |
4 | 4 | ||
5 | use FOS\UserBundle\Event\FilterUserResponseEvent; | 5 | use FOS\UserBundle\Event\FilterUserResponseEvent; |
6 | use FOS\UserBundle\FOSUserEvents; | 6 | use FOS\UserBundle\FOSUserEvents; |
@@ -8,10 +8,10 @@ use Symfony\Component\EventDispatcher\EventDispatcher; | |||
8 | use Symfony\Component\HttpFoundation\Request; | 8 | use Symfony\Component\HttpFoundation\Request; |
9 | use Symfony\Component\HttpFoundation\Response; | 9 | use Symfony\Component\HttpFoundation\Response; |
10 | use Wallabag\CoreBundle\Entity\Config; | 10 | use Wallabag\CoreBundle\Entity\Config; |
11 | use Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener; | 11 | use Wallabag\UserBundle\EventListener\CreateConfigListener; |
12 | use Wallabag\UserBundle\Entity\User; | 12 | use Wallabag\UserBundle\Entity\User; |
13 | 13 | ||
14 | class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase | 14 | class CreateConfigListenerTest extends \PHPUnit_Framework_TestCase |
15 | { | 15 | { |
16 | private $em; | 16 | private $em; |
17 | private $listener; | 17 | private $listener; |
@@ -25,12 +25,13 @@ class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase | |||
25 | ->disableOriginalConstructor() | 25 | ->disableOriginalConstructor() |
26 | ->getMock(); | 26 | ->getMock(); |
27 | 27 | ||
28 | $this->listener = new RegistrationConfirmedListener( | 28 | $this->listener = new CreateConfigListener( |
29 | $this->em, | 29 | $this->em, |
30 | 'baggy', | 30 | 'baggy', |
31 | 20, | 31 | 20, |
32 | 50, | 32 | 50, |
33 | 'fr' | 33 | 'fr', |
34 | 1 | ||
34 | ); | 35 | ); |
35 | 36 | ||
36 | $this->dispatcher = new EventDispatcher(); | 37 | $this->dispatcher = new EventDispatcher(); |
@@ -55,7 +56,7 @@ class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase | |||
55 | $this->em->expects($this->never())->method('flush'); | 56 | $this->em->expects($this->never())->method('flush'); |
56 | 57 | ||
57 | $this->dispatcher->dispatch( | 58 | $this->dispatcher->dispatch( |
58 | FOSUserEvents::REGISTRATION_CONFIRMED, | 59 | FOSUserEvents::REGISTRATION_COMPLETED, |
59 | $event | 60 | $event |
60 | ); | 61 | ); |
61 | } | 62 | } |
@@ -76,6 +77,7 @@ class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase | |||
76 | $config->setItemsPerPage(20); | 77 | $config->setItemsPerPage(20); |
77 | $config->setRssLimit(50); | 78 | $config->setRssLimit(50); |
78 | $config->setLanguage('fr'); | 79 | $config->setLanguage('fr'); |
80 | $config->setReadingSpeed(1); | ||
79 | 81 | ||
80 | $this->em->expects($this->once()) | 82 | $this->em->expects($this->once()) |
81 | ->method('persist') | 83 | ->method('persist') |
@@ -84,7 +86,7 @@ class RegistrationConfirmedListenerTest extends \PHPUnit_Framework_TestCase | |||
84 | ->method('flush'); | 86 | ->method('flush'); |
85 | 87 | ||
86 | $this->dispatcher->dispatch( | 88 | $this->dispatcher->dispatch( |
87 | FOSUserEvents::REGISTRATION_CONFIRMED, | 89 | FOSUserEvents::REGISTRATION_COMPLETED, |
88 | $event | 90 | $event |
89 | ); | 91 | ); |
90 | } | 92 | } |