diff options
Diffstat (limited to 'src')
4 files changed, 44 insertions, 24 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 744e1a60..da671a61 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php | |||
@@ -43,8 +43,8 @@ class WallabagRestController extends FOSRestController | |||
43 | { | 43 | { |
44 | $this->validateAuthentication(); | 44 | $this->validateAuthentication(); |
45 | 45 | ||
46 | $isArchived = (int) $request->query->get('archive'); | 46 | $isArchived = (null === $request->query->get('archive')) ? null : (bool) $request->query->get('archive'); |
47 | $isStarred = (int) $request->query->get('starred'); | 47 | $isStarred = (null === $request->query->get('starred')) ? null : (bool) $request->query->get('starred'); |
48 | $sort = $request->query->get('sort', 'created'); | 48 | $sort = $request->query->get('sort', 'created'); |
49 | $order = $request->query->get('order', 'desc'); | 49 | $order = $request->query->get('order', 'desc'); |
50 | $page = (int) $request->query->get('page', 1); | 50 | $page = (int) $request->query->get('page', 1); |
@@ -52,7 +52,7 @@ class WallabagRestController extends FOSRestController | |||
52 | 52 | ||
53 | $pager = $this->getDoctrine() | 53 | $pager = $this->getDoctrine() |
54 | ->getRepository('WallabagCoreBundle:Entry') | 54 | ->getRepository('WallabagCoreBundle:Entry') |
55 | ->findEntries($this->getUser()->getId(), (bool) $isArchived, (bool) $isStarred, $sort, $order); | 55 | ->findEntries($this->getUser()->getId(), $isArchived, $isStarred, $sort, $order); |
56 | 56 | ||
57 | $pager->setCurrentPage($page); | 57 | $pager->setCurrentPage($page); |
58 | $pager->setMaxPerPage($perPage); | 58 | $pager->setMaxPerPage($perPage); |
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index c5a5a519..2e4a59df 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -455,7 +455,13 @@ class InstallCommand extends ContainerAwareCommand | |||
455 | return false; | 455 | return false; |
456 | } | 456 | } |
457 | 457 | ||
458 | return in_array($databaseName, $schemaManager->listDatabases()); | 458 | try { |
459 | return in_array($databaseName, $schemaManager->listDatabases()); | ||
460 | } catch (\Doctrine\DBAL\Exception\ConnectionException $e) { | ||
461 | // it means we weren't able to get database list, assume the database doesn't exist | ||
462 | |||
463 | return false; | ||
464 | } | ||
459 | } | 465 | } |
460 | 466 | ||
461 | /** | 467 | /** |
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index fa633031..cba58858 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -49,8 +49,7 @@ class EntryController extends Controller | |||
49 | $form->handleRequest($request); | 49 | $form->handleRequest($request); |
50 | 50 | ||
51 | if ($form->isValid()) { | 51 | if ($form->isValid()) { |
52 | // check for existing entry, if it exists, redirect to it with a message | 52 | $existingEntry = $this->checkIfEntryAlreadyExists($entry); |
53 | $existingEntry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); | ||
54 | 53 | ||
55 | if (false !== $existingEntry) { | 54 | if (false !== $existingEntry) { |
56 | $this->get('session')->getFlashBag()->add( | 55 | $this->get('session')->getFlashBag()->add( |
@@ -86,7 +85,10 @@ class EntryController extends Controller | |||
86 | { | 85 | { |
87 | $entry = new Entry($this->getUser()); | 86 | $entry = new Entry($this->getUser()); |
88 | $entry->setUrl($request->get('url')); | 87 | $entry->setUrl($request->get('url')); |
89 | $this->updateEntry($entry); | 88 | |
89 | if (false === $this->checkIfEntryAlreadyExists($entry)) { | ||
90 | $this->updateEntry($entry); | ||
91 | } | ||
90 | 92 | ||
91 | return $this->redirect($this->generateUrl('homepage')); | 93 | return $this->redirect($this->generateUrl('homepage')); |
92 | } | 94 | } |
@@ -420,4 +422,16 @@ class EntryController extends Controller | |||
420 | throw $this->createAccessDeniedException('You can not access this entry.'); | 422 | throw $this->createAccessDeniedException('You can not access this entry.'); |
421 | } | 423 | } |
422 | } | 424 | } |
425 | |||
426 | /** | ||
427 | * Check for existing entry, if it exists, redirect to it with a message. | ||
428 | * | ||
429 | * @param $entry | ||
430 | * | ||
431 | * @return array|bool | ||
432 | */ | ||
433 | private function checkIfEntryAlreadyExists($entry) | ||
434 | { | ||
435 | return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); | ||
436 | } | ||
423 | } | 437 | } |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index a8fcbcf6..3e847b35 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -19,9 +19,9 @@ menu: | |||
19 | unread: 'Sin leer' | 19 | unread: 'Sin leer' |
20 | starred: 'Favoritos' | 20 | starred: 'Favoritos' |
21 | archive: 'Archivo' | 21 | archive: 'Archivo' |
22 | all_articles: 'Todos los artículos' | 22 | all_articles: 'Todos artículos' |
23 | config: 'Configuración' | 23 | config: 'Configuración' |
24 | tags: 'Tags' | 24 | tags: 'Etiquetas' |
25 | internal_settings: 'Configuración interna' | 25 | internal_settings: 'Configuración interna' |
26 | import: 'Importar' | 26 | import: 'Importar' |
27 | howto: 'Ayuda' | 27 | howto: 'Ayuda' |
@@ -62,18 +62,18 @@ config: | |||
62 | items_per_page_label: 'Número de artículos por página' | 62 | items_per_page_label: 'Número de artículos por página' |
63 | language_label: 'Idioma' | 63 | language_label: 'Idioma' |
64 | reading_speed: | 64 | reading_speed: |
65 | # label: 'Reading speed' | 65 | label: 'Velocidad de leer' |
66 | # help_message: 'You can use online tools to estimate your reading speed:' | 66 | help_message: 'Se puede usar las técnicas para calcular su velocidad de leer:' |
67 | # 100_word: 'I read ~100 words per minute' | 67 | 100_word: 'Leo ~100 palabras por minuto' |
68 | # 200_word: 'I read ~200 words per minute' | 68 | 200_word: 'Leo ~200 palabras por minuto' |
69 | # 300_word: 'I read ~300 words per minute' | 69 | 300_word: 'Leo ~300 palabras por minuto' |
70 | # 400_word: 'I read ~400 words per minute' | 70 | 400_word: 'Leo ~400 palabras por minuto' |
71 | form_rss: | 71 | form_rss: |
72 | description: 'Los feeds RSS de wallabag permiten leer los artículos guardados con su lector RSS favorito. Necesita generar un token primero' | 72 | description: 'Los feeds RSS de wallabag permiten leer los artículos guardados con su lector RSS favorito. Necesita generar un token primero' |
73 | token_label: 'RSS token' | 73 | token_label: 'RSS token' |
74 | # no_token: 'No token' | 74 | # no_token: 'No token' |
75 | token_create: 'Crear token' | 75 | token_create: 'Crear token' |
76 | token_reset: 'Resetear token' | 76 | token_reset: 'Reiniciar token' |
77 | rss_links: 'URL de su feed RSS' | 77 | rss_links: 'URL de su feed RSS' |
78 | rss_link: | 78 | rss_link: |
79 | unread: 'sin leer' | 79 | unread: 'sin leer' |
@@ -90,17 +90,17 @@ config: | |||
90 | new_password_label: 'Nueva contraseña' | 90 | new_password_label: 'Nueva contraseña' |
91 | repeat_new_password_label: 'Confirmar la nueva contraseña' | 91 | repeat_new_password_label: 'Confirmar la nueva contraseña' |
92 | form_rules: | 92 | form_rules: |
93 | # if_label: 'if' | 93 | if_label: 'si' |
94 | # then_tag_as_label: 'then tag as' | 94 | then_tag_as_label: 'Etiquete como' |
95 | # delete_rule_label: 'delete' | 95 | delete_rule_label: 'Borre' |
96 | rule_label: 'Regla' | 96 | rule_label: 'Regla' |
97 | tags_label: 'Tags' | 97 | tags_label: 'Etiquetas' |
98 | faq: | 98 | faq: |
99 | title: 'FAQ' | 99 | title: 'FAQ' |
100 | tagging_rules_definition_title: '¿Qué significa reglas de etiquetado autómaticas?' | 100 | tagging_rules_definition_title: '¿Qué significa reglas de etiquetado autómaticas?' |
101 | tagging_rules_definition_description: 'Son las reglas usadas por Wallabag para etiquetar automáticamente los nuevos artículos.<br />Cáda vez que un nuevo artículo es añadido, todas las reglas de etiquetado automáticas serán usadas para etiquetarlo, ayudandote a clasificar automáticamente los artículos.' | 101 | tagging_rules_definition_description: 'Son las reglas usadas por Wallabag para etiquetar automáticamente los nuevos artículos.<br />Cada vez que un nuevo artículo sea añadido, todas las reglas de etiquetado automáticas serán usadas para etiquetarlo, ayudándole a clasificar automáticamente los artículos.' |
102 | how_to_use_them_title: '¿Cómo se utilizan?' | 102 | how_to_use_them_title: '¿Cómo se utilizan?' |
103 | # how_to_use_them_description: 'Let assume you want to tag new entries as « <i>short reading</i> » when the reading time is inferior to 3 minutes.<br />In that case, you should put « readingTime <= 3 » in the <i>Rule</i> field and « <i>short reading</i> » in the <i>Tags</i> field.<br />Several tags can added simultaneously by separating them by a comma: « <i>short reading, must read</i> »<br />Complex rules can be written by using predefined operators: if « <i>readingTime >= 5 AND domainName = "github.com"</i> » then tag as « <i>long reading, github </i> »' | 103 | how_to_use_them_description: 'Supongamos que quiere etiquetar nuevos artículos como « <i>lectura corta</i> » cuando el tiempo de leer sea menos de 3 minutos. <br /> En este caso, debe poner Let assume you want to tag new entries as « <i>short reading</i> » when the reading time is inferior to 3 minutes.<br />In that case, you should put « readingTime <= 3 » in the <i>Rule</i> field and « <i>short reading</i> » in the <i>Tags</i> field.<br />Several tags can added simultaneously by separating them by a comma: « <i>short reading, must read</i> »<br />Complex rules can be written by using predefined operators: if « <i>readingTime >= 5 AND domainName = "github.com"</i> » then tag as « <i>long reading, github </i> »' |
104 | variables_available_title: '¿Qué variables y operadores se pueden utilizar para escribir las reglas?' | 104 | variables_available_title: '¿Qué variables y operadores se pueden utilizar para escribir las reglas?' |
105 | variables_available_description: 'Las siguientes variables y operadores se pueden utilizar para crear las reglas de etiquetado automáticas:' | 105 | variables_available_description: 'Las siguientes variables y operadores se pueden utilizar para crear las reglas de etiquetado automáticas:' |
106 | meaning: 'Significado' | 106 | meaning: 'Significado' |
@@ -301,9 +301,9 @@ quickstart: | |||
301 | gitter: 'En Gitter' | 301 | gitter: 'En Gitter' |
302 | 302 | ||
303 | tag: | 303 | tag: |
304 | page_title: 'Tags' | 304 | page_title: 'Etiquetas' |
305 | list: | 305 | list: |
306 | number_on_the_page: '{0} No hay ningun tag.|{1} Hay un tag.|]1,Inf[ Hay %count% tags.' | 306 | number_on_the_page: '{0} No hay ningun etiqueta.|{1} Hay un etiqueta.|]1,Inf[ Hay %count% etiquetas.' |
307 | 307 | ||
308 | import: | 308 | import: |
309 | page_title: 'Importar' | 309 | page_title: 'Importar' |