aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle/Controller/PocketController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/ImportBundle/Controller/PocketController.php')
-rw-r--r--src/Wallabag/ImportBundle/Controller/PocketController.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php
index 71ceb427..f952867b 100644
--- a/src/Wallabag/ImportBundle/Controller/PocketController.php
+++ b/src/Wallabag/ImportBundle/Controller/PocketController.php
@@ -47,8 +47,12 @@ class PocketController extends Controller
47 return $this->redirect($this->generateUrl('import_pocket')); 47 return $this->redirect($this->generateUrl('import_pocket'));
48 } 48 }
49 49
50 $form = $request->request->get('form');
51
50 $this->get('session')->set('import.pocket.code', $requestToken); 52 $this->get('session')->set('import.pocket.code', $requestToken);
51 $this->get('session')->set('mark_as_read', $request->request->get('form')['mark_as_read']); 53 if (null !== $form && \array_key_exists('mark_as_read', $form)) {
54 $this->get('session')->set('mark_as_read', $form['mark_as_read']);
55 }
52 56
53 return $this->redirect( 57 return $this->redirect(
54 'https://getpocket.com/auth/authorize?request_token=' . $requestToken . '&redirect_uri=' . $this->generateUrl('import_pocket_callback', [], UrlGeneratorInterface::ABSOLUTE_URL), 58 'https://getpocket.com/auth/authorize?request_token=' . $requestToken . '&redirect_uri=' . $this->generateUrl('import_pocket_callback', [], UrlGeneratorInterface::ABSOLUTE_URL),
@@ -80,11 +84,11 @@ class PocketController extends Controller
80 if (true === $pocket->setMarkAsRead($markAsRead)->import()) { 84 if (true === $pocket->setMarkAsRead($markAsRead)->import()) {
81 $summary = $pocket->getSummary(); 85 $summary = $pocket->getSummary();
82 $message = $this->get('translator')->trans('flashes.import.notice.summary', [ 86 $message = $this->get('translator')->trans('flashes.import.notice.summary', [
83 '%imported%' => $summary['imported'], 87 '%imported%' => null !== $summary && \array_key_exists('imported', $summary) ? $summary['imported'] : 0,
84 '%skipped%' => $summary['skipped'], 88 '%skipped%' => null !== $summary && \array_key_exists('skipped', $summary) ? $summary['skipped'] : 0,
85 ]); 89 ]);
86 90
87 if (0 < $summary['queued']) { 91 if (null !== $summary && \array_key_exists('queued', $summary) && 0 < $summary['queued']) {
88 $message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [ 92 $message = $this->get('translator')->trans('flashes.import.notice.summary_with_queue', [
89 '%queued%' => $summary['queued'], 93 '%queued%' => $summary['queued'],
90 ]); 94 ]);