aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/AppKernel.php1
-rw-r--r--app/DoctrineMigrations/.gitkeep0
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml19
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml19
-rw-r--r--app/Resources/CraueConfigBundle/views/Settings/modify.html.twig43
-rw-r--r--app/config/config.yml29
-rw-r--r--app/config/parameters.yml.dist37
-rw-r--r--app/config/routing.yml9
-rw-r--r--app/config/security.yml1
-rw-r--r--app/config/tests/parameters.yml.dist.mysql37
-rw-r--r--app/config/tests/parameters.yml.dist.pgsql37
-rw-r--r--app/config/tests/parameters.yml.dist.sqlite37
-rw-r--r--composer.json7
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php118
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php9
-rw-r--r--src/Wallabag/CoreBundle/Controller/RssController.php2
-rw-r--r--src/Wallabag/CoreBundle/Controller/StaticController.php5
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php133
-rw-r--r--src/Wallabag/CoreBundle/DependencyInjection/Configuration.php16
-rw-r--r--src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php7
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php7
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml12
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/base.html.twig4
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig19
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig3
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig16
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig14
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig25
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig3
-rw-r--r--src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php1
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/SettingsControllerTest.php32
-rw-r--r--src/Wallabag/ImportBundle/Controller/PocketController.php1
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php5
-rw-r--r--src/Wallabag/ImportBundle/Resources/config/services.yml2
-rw-r--r--src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig6
-rw-r--r--src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php11
-rw-r--r--src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php12
-rw-r--r--src/Wallabag/UserBundle/Resources/config/services.yml3
-rw-r--r--src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php12
40 files changed, 510 insertions, 245 deletions
diff --git a/app/AppKernel.php b/app/AppKernel.php
index 7e76a9e9..82d3aa38 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -33,6 +33,7 @@ class AppKernel extends Kernel
33 new KPhoen\RulerZBundle\KPhoenRulerZBundle(), 33 new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
34 new Wallabag\ImportBundle\WallabagImportBundle(), 34 new Wallabag\ImportBundle\WallabagImportBundle(),
35 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), 35 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
36 new Craue\ConfigBundle\CraueConfigBundle(),
36 ]; 37 ];
37 38
38 if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { 39 if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
diff --git a/app/DoctrineMigrations/.gitkeep b/app/DoctrineMigrations/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/app/DoctrineMigrations/.gitkeep
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
new file mode 100644
index 00000000..b5385dc3
--- /dev/null
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
@@ -0,0 +1,19 @@
1download_pictures: Download pictures on your server
2carrot: Enable share to Carrot
3diaspora_url: Diaspora URL, if the service is enabled
4export_epub: Enable ePub export
5export_mobi: Enable .mobi export
6export_pdf: Enable PDF export
7export_csv: Enable CSV export
8export_json: Enable JSON export
9export_txt: Enable TXT export
10export_xml: Enable XML export
11pocket_consumer_key: Consumer key for Pocket to import contents (https://getpocket.com/developer/docs/authentication)
12shaarli_url: URL de Shaarli, if the service is enabled
13share_diaspora: Enable share to Diaspora
14share_mail: Enable share by email
15share_shaarli: Enable share to Shaarli
16share_twitter: Enable share to Twitter
17show_printlink: Display a link to print content
18wallabag_support_url: Support URL for wallabag
19wallabag_url: URL of *your* wallabag instance
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
new file mode 100644
index 00000000..cdd56acd
--- /dev/null
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
@@ -0,0 +1,19 @@
1download_pictures: Télécharger les images sur le serveur
2carrot: Activer le partage vers Carrot
3diaspora_url: URL de Diaspora, si le service Diaspora est activé
4export_epub: Activer l'export ePub
5export_mobi: Activer l'export .mobi
6export_pdf: Activer l'export PDF
7export_csv: Activer l'export CSV
8export_json: Activer l'export JSON
9export_txt: Activer l'export TXT
10export_xml: Activer l'export XML
11pocket_consumer_key: Clé d'authentification Pocket pour importer les données (https://getpocket.com/developer/docs/authentication)
12shaarli_url: URL de Shaarli, si le service Shaarli est activé
13share_diaspora: Activer le partage vers Diaspora
14share_mail: Activer le partage par email
15share_shaarli: Activer le partage vers Shaarli
16share_twitter: Activer le partage vers Twitter
17show_printlink: Afficher un lien pour imprimer
18wallabag_support_url: URL de support de wallabag
19wallabag_url: URL de *votre* instance de wallabag
diff --git a/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig b/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig
new file mode 100644
index 00000000..f44db420
--- /dev/null
+++ b/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig
@@ -0,0 +1,43 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{% trans %}internal settings{% endtrans %}{% endblock %}
4
5{% block content %}
6 <div class="row">
7 <div class="col s12">
8 <div class="card-panel settings">
9 {{ form_start(form, {'attr': {'class': 'craue_config_settings_modify'}}) }}
10 {{ form_errors(form) }}
11
12 <div class="row">
13 <div class="div_tabs col s12">
14 <ul class="tabs">
15 {% for section in sections | craue_sortSections %}
16 <li class="tab col s3"><a href="#set-{{ section }}">{{ section | trans({}, 'CraueConfigBundle') }}</a></li>
17 {% endfor %}
18 </ul>
19 </div>
20
21 {% for section in sections | craue_sortSections %}
22 <div id="set-{{ section }}" class="col s12">
23 {% for setting in form.settings if setting.section.vars.value == section %}
24 {{ form_row(setting.name) }}
25 {{ form_row(setting.section) }}
26 {{ form_row(setting.value, {
27 'label': setting.name.vars.value | trans({}, 'CraueConfigBundle'),
28 }) }}
29 {% endfor %}
30 </div>
31 {% endfor %}
32 </div>
33
34 <button class="btn waves-effect waves-light" type="submit" name="action">
35 {{ 'modify_settings' | trans({}, 'CraueConfigBundle') }}
36 </button>
37
38 {{ form_rest(form) }}
39 {{ form_end(form) }}
40 </div>
41 </div>
42 </div>
43{% endblock %}
diff --git a/app/config/config.yml b/app/config/config.yml
index a6cfc67d..dc6bccee 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -28,11 +28,17 @@ framework:
28 assets: ~ 28 assets: ~
29 29
30wallabag_core: 30wallabag_core:
31 version: 2.0.0-alpha.2
32 paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb"
31 languages: 33 languages:
32 en: 'English' 34 en: 'English'
33 fr: 'Français' 35 fr: 'Français'
34 de: 'Deutsch' 36 de: 'Deutsch'
35 tr: 'Türkçe' 37 tr: 'Türkçe'
38 items_on_page: 12
39 theme: material
40 language: en
41 rss_limit: 50
36 42
37wallabag_import: 43wallabag_import:
38 allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain'] 44 allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain']
@@ -42,29 +48,6 @@ wallabag_import:
42twig: 48twig:
43 debug: "%kernel.debug%" 49 debug: "%kernel.debug%"
44 strict_variables: "%kernel.debug%" 50 strict_variables: "%kernel.debug%"
45 globals:
46 share_twitter: %share_twitter%
47 share_mail: %share_mail%
48 share_shaarli: %share_shaarli%
49 shaarli_url: %shaarli_url%
50 share_diaspora: %share_diaspora%
51 diaspora_url: %diaspora_url%
52 flattr: %flattr%
53 flattrable: 1
54 flattred: 2
55 carrot: %carrot%
56 show_printlink: %show_printlink%
57 export_epub: %export_epub%
58 export_mobi: %export_mobi%
59 export_pdf: %export_pdf%
60 export_csv: %export_csv%
61 export_json: %export_json%
62 export_txt: %export_txt%
63 export_xml: %export_xml%
64 version: %app.version%
65 twofactor_auth: %twofactor_auth%
66 warning_message: %warning_message%
67 paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb"
68 form_themes: 51 form_themes:
69 - "LexikFormFilterBundle:Form:form_div_layout.html.twig" 52 - "LexikFormFilterBundle:Form:form_div_layout.html.twig"
70 53
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist
index ac4a4cc8..79654e9e 100644
--- a/app/config/parameters.yml.dist
+++ b/app/config/parameters.yml.dist
@@ -37,43 +37,8 @@ parameters:
37 # A secret key that's used to generate certain security-related tokens 37 # A secret key that's used to generate certain security-related tokens
38 secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv 38 secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv
39 39
40 # wallabag misc 40 # two factor stuff
41 app.version: 2.0.0-alpha
42 twofactor_auth: true 41 twofactor_auth: true
43 twofactor_sender: no-reply@wallabag.org 42 twofactor_sender: no-reply@wallabag.org
44 43
45 # message to display at the bottom of the page
46 warning_message: >
47 You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a>
48
49 download_pictures: false # if true, pictures will be stored into data/assets for each article
50
51 # Entry view
52 share_twitter: true
53 share_mail: true
54 share_shaarli: true
55 shaarli_url: http://myshaarli.com
56 share_diaspora: true
57 diaspora_url: http://diasporapod.com
58 flattr: true
59 carrot: true
60 show_printlink: true
61 export_epub: true
62 export_mobi: true
63 export_pdf: true
64 export_csv: true
65 export_json: true
66 export_txt: true
67 export_xml: true
68 wallabag_url: http://v2.wallabag.org
69 wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
70
71 # default user config
72 items_on_page: 12
73 theme: material
74 language: en
75 from_email: no-reply@wallabag.org 44 from_email: no-reply@wallabag.org
76 rss_limit: 50
77
78 # pocket import
79 pocket_consumer_key: xxxxxxxx
diff --git a/app/config/routing.yml b/app/config/routing.yml
index 84b98d23..c491d35d 100644
--- a/app/config/routing.yml
+++ b/app/config/routing.yml
@@ -22,7 +22,9 @@ rest :
22 22
23homepage: 23homepage:
24 path: "/{page}" 24 path: "/{page}"
25 defaults: { _controller: WallabagCoreBundle:Entry:showUnread, page : 1 } 25 defaults:
26 _controller: WallabagCoreBundle:Entry:showUnread
27 page : 1
26 requirements: 28 requirements:
27 page: \d+ 29 page: \d+
28 30
@@ -31,3 +33,8 @@ fos_user:
31 33
32fos_oauth_server_token: 34fos_oauth_server_token:
33 resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml" 35 resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml"
36
37craue_config_settings_modify:
38 path: /settings
39 defaults:
40 _controller: CraueConfigBundle:Settings:modify
diff --git a/app/config/security.yml b/app/config/security.yml
index a99a7d80..7c10889f 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -57,4 +57,5 @@ security:
57 - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } 57 - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
58 - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } 58 - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
59 - { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } 59 - { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
60 - { path: ^/settings, roles: ROLE_SUPER_ADMIN }
60 - { path: ^/, roles: ROLE_USER } 61 - { path: ^/, roles: ROLE_USER }
diff --git a/app/config/tests/parameters.yml.dist.mysql b/app/config/tests/parameters.yml.dist.mysql
index 3b9262bb..dceb5dea 100644
--- a/app/config/tests/parameters.yml.dist.mysql
+++ b/app/config/tests/parameters.yml.dist.mysql
@@ -27,43 +27,8 @@ parameters:
27 # A secret key that's used to generate certain security-related tokens 27 # A secret key that's used to generate certain security-related tokens
28 secret: ThisTokenIsNotSoSecretChangeIt 28 secret: ThisTokenIsNotSoSecretChangeIt
29 29
30 # wallabag misc 30 # two factor stuff
31 app.version: 2.0.0-alpha
32 twofactor_auth: true 31 twofactor_auth: true
33 twofactor_sender: no-reply@wallabag.org 32 twofactor_sender: no-reply@wallabag.org
34 33
35 # message to display at the bottom of the page
36 warning_message: >
37 You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a>
38
39 download_pictures: false # if true, pictures will be stored into data/assets for each article
40
41 # Entry view
42 share_twitter: true
43 share_mail: true
44 share_shaarli: true
45 shaarli_url: http://myshaarli.com
46 share_diaspora: true
47 diaspora_url: http://diasporapod.com
48 flattr: true
49 carrot: true
50 show_printlink: true
51 export_epub: true
52 export_mobi: true
53 export_pdf: true
54 export_csv: true
55 export_json: true
56 export_txt: true
57 export_xml: true
58 wallabag_url: http://v2.wallabag.org
59 wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
60
61 # default user config
62 items_on_page: 12
63 theme: material
64 language: en_US
65 from_email: no-reply@wallabag.org 34 from_email: no-reply@wallabag.org
66 rss_limit: 50
67
68 # pocket import
69 pocket_consumer_key: xxxxxxxx
diff --git a/app/config/tests/parameters.yml.dist.pgsql b/app/config/tests/parameters.yml.dist.pgsql
index a5aef028..e07db610 100644
--- a/app/config/tests/parameters.yml.dist.pgsql
+++ b/app/config/tests/parameters.yml.dist.pgsql
@@ -27,43 +27,8 @@ parameters:
27 # A secret key that's used to generate certain security-related tokens 27 # A secret key that's used to generate certain security-related tokens
28 secret: ThisTokenIsNotSoSecretChangeIt 28 secret: ThisTokenIsNotSoSecretChangeIt
29 29
30 # wallabag misc 30 # two factor stuff
31 app.version: 2.0.0-alpha
32 twofactor_auth: true 31 twofactor_auth: true
33 twofactor_sender: no-reply@wallabag.org 32 twofactor_sender: no-reply@wallabag.org
34 33
35 # message to display at the bottom of the page
36 warning_message: >
37 You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a>
38
39 download_pictures: false # if true, pictures will be stored into data/assets for each article
40
41 # Entry view
42 share_twitter: true
43 share_mail: true
44 share_shaarli: true
45 shaarli_url: http://myshaarli.com
46 share_diaspora: true
47 diaspora_url: http://diasporapod.com
48 flattr: true
49 carrot: true
50 show_printlink: true
51 export_epub: true
52 export_mobi: true
53 export_pdf: true
54 export_csv: true
55 export_json: true
56 export_txt: true
57 export_xml: true
58 wallabag_url: http://v2.wallabag.org
59 wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
60
61 # default user config
62 items_on_page: 12
63 theme: material
64 language: en_US
65 from_email: no-reply@wallabag.org 34 from_email: no-reply@wallabag.org
66 rss_limit: 50
67
68 # pocket import
69 pocket_consumer_key: xxxxxxxx
diff --git a/app/config/tests/parameters.yml.dist.sqlite b/app/config/tests/parameters.yml.dist.sqlite
index cdafb1b1..01589d28 100644
--- a/app/config/tests/parameters.yml.dist.sqlite
+++ b/app/config/tests/parameters.yml.dist.sqlite
@@ -27,43 +27,8 @@ parameters:
27 # A secret key that's used to generate certain security-related tokens 27 # A secret key that's used to generate certain security-related tokens
28 secret: ThisTokenIsNotSoSecretChangeIt 28 secret: ThisTokenIsNotSoSecretChangeIt
29 29
30 # wallabag misc 30 # two factor stuff
31 app.version: 2.0.0-alpha
32 twofactor_auth: true 31 twofactor_auth: true
33 twofactor_sender: no-reply@wallabag.org 32 twofactor_sender: no-reply@wallabag.org
34 33
35 # message to display at the bottom of the page
36 warning_message: >
37 You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a>
38
39 download_pictures: false # if true, pictures will be stored into data/assets for each article
40
41 # Entry view
42 share_twitter: true
43 share_mail: true
44 share_shaarli: true
45 shaarli_url: http://myshaarli.com
46 share_diaspora: true
47 diaspora_url: http://diasporapod.com
48 flattr: true
49 carrot: true
50 show_printlink: true
51 export_epub: true
52 export_mobi: true
53 export_pdf: true
54 export_csv: true
55 export_json: true
56 export_txt: true
57 export_xml: true
58 wallabag_url: http://v2.wallabag.org
59 wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
60
61 # default user config
62 items_on_page: 12
63 theme: material
64 language: en_US
65 from_email: no-reply@wallabag.org 34 from_email: no-reply@wallabag.org
66 rss_limit: 50
67
68 # pocket import
69 pocket_consumer_key: xxxxxxxx
diff --git a/composer.json b/composer.json
index d84e1f8b..497b8012 100644
--- a/composer.json
+++ b/composer.json
@@ -54,8 +54,8 @@
54 "pagerfanta/pagerfanta": "~1.0.3", 54 "pagerfanta/pagerfanta": "~1.0.3",
55 "lexik/form-filter-bundle": "~5.0", 55 "lexik/form-filter-bundle": "~5.0",
56 "j0k3r/graby": "~1.0", 56 "j0k3r/graby": "~1.0",
57 "friendsofsymfony/user-bundle": "dev-master", 57 "friendsofsymfony/user-bundle": "~2.0@dev",
58 "friendsofsymfony/oauth-server-bundle": "^1.5@dev", 58 "friendsofsymfony/oauth-server-bundle": "^1.5",
59 "stof/doctrine-extensions-bundle": "^1.2@dev", 59 "stof/doctrine-extensions-bundle": "^1.2@dev",
60 "scheb/two-factor-bundle": "~2.0", 60 "scheb/two-factor-bundle": "~2.0",
61 "grandt/phpepub": "~4.0", 61 "grandt/phpepub": "~4.0",
@@ -63,7 +63,8 @@
63 "kphoen/rulerz-bundle": "~0.10", 63 "kphoen/rulerz-bundle": "~0.10",
64 "guzzlehttp/guzzle": "^5.2.0", 64 "guzzlehttp/guzzle": "^5.2.0",
65 "doctrine/doctrine-migrations-bundle": "^1.0", 65 "doctrine/doctrine-migrations-bundle": "^1.0",
66 "paragonie/random_compat": "~1.0" 66 "paragonie/random_compat": "~1.0",
67 "craue/config-bundle": "~1.4"
67 }, 68 },
68 "require-dev": { 69 "require-dev": {
69 "doctrine/doctrine-fixtures-bundle": "~2.2", 70 "doctrine/doctrine-fixtures-bundle": "~2.2",
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 63032dbb..e6a06eea 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -12,6 +12,7 @@ use Symfony\Component\Console\Output\OutputInterface;
12use Symfony\Component\Console\Question\ConfirmationQuestion; 12use Symfony\Component\Console\Question\ConfirmationQuestion;
13use Symfony\Component\Console\Question\Question; 13use Symfony\Component\Console\Question\Question;
14use Wallabag\CoreBundle\Entity\Config; 14use Wallabag\CoreBundle\Entity\Config;
15use Craue\ConfigBundle\Entity\Setting;
15 16
16class InstallCommand extends ContainerAwareCommand 17class InstallCommand extends ContainerAwareCommand
17{ 18{
@@ -204,13 +205,122 @@ class InstallCommand extends ContainerAwareCommand
204 $em->persist($user); 205 $em->persist($user);
205 206
206 $config = new Config($user); 207 $config = new Config($user);
207 $config->setTheme($this->getContainer()->getParameter('theme')); 208 $config->setTheme($this->getContainer()->getParameter('wallabag_core.theme'));
208 $config->setItemsPerPage($this->getContainer()->getParameter('items_on_page')); 209 $config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page'));
209 $config->setRssLimit($this->getContainer()->getParameter('rss_limit')); 210 $config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit'));
210 $config->setLanguage($this->getContainer()->getParameter('language')); 211 $config->setLanguage($this->getContainer()->getParameter('wallabag_core.language'));
211 212
212 $em->persist($config); 213 $em->persist($config);
213 214
215 // cleanup before insert new stuff
216 $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute();
217
218 $settings = [
219 [
220 'name' => 'download_pictures',
221 'value' => '1',
222 'section' => 'entry',
223 ],
224 [
225 'name' => 'carrot',
226 'value' => '1',
227 'section' => 'entry',
228 ],
229 [
230 'name' => 'share_diaspora',
231 'value' => '1',
232 'section' => 'entry',
233 ],
234 [
235 'name' => 'diaspora_url',
236 'value' => 'http://diasporapod.com',
237 'section' => 'entry',
238 ],
239 [
240 'name' => 'share_shaarli',
241 'value' => '1',
242 'section' => 'entry',
243 ],
244 [
245 'name' => 'shaarli_url',
246 'value' => 'http://myshaarli.com',
247 'section' => 'entry',
248 ],
249 [
250 'name' => 'share_mail',
251 'value' => '1',
252 'section' => 'entry',
253 ],
254 [
255 'name' => 'share_twitter',
256 'value' => '1',
257 'section' => 'entry',
258 ],
259 [
260 'name' => 'export_epub',
261 'value' => '1',
262 'section' => 'export',
263 ],
264 [
265 'name' => 'export_mobi',
266 'value' => '1',
267 'section' => 'export',
268 ],
269 [
270 'name' => 'export_pdf',
271 'value' => '1',
272 'section' => 'export',
273 ],
274 [
275 'name' => 'export_csv',
276 'value' => '1',
277 'section' => 'export',
278 ],
279 [
280 'name' => 'export_json',
281 'value' => '1',
282 'section' => 'export',
283 ],
284 [
285 'name' => 'export_txt',
286 'value' => '1',
287 'section' => 'export',
288 ],
289 [
290 'name' => 'export_xml',
291 'value' => '1',
292 'section' => 'export',
293 ],
294 [
295 'name' => 'pocket_consumer_key',
296 'value' => null,
297 'section' => 'import',
298 ],
299 [
300 'name' => 'show_printlink',
301 'value' => '1',
302 'section' => 'entry',
303 ],
304 [
305 'name' => 'wallabag_support_url',
306 'value' => 'https://www.wallabag.org/pages/support.html',
307 'section' => 'misc',
308 ],
309 [
310 'name' => 'wallabag_url',
311 'value' => 'http://v2.wallabag.org',
312 'section' => 'misc',
313 ],
314 ];
315
316 foreach ($settings as $setting) {
317 $newSetting = new Setting();
318 $newSetting->setName($setting['name']);
319 $newSetting->setValue($setting['value']);
320 $newSetting->setSection($setting['section']);
321 $em->persist($newSetting);
322 }
323
214 $em->flush(); 324 $em->flush();
215 325
216 $this->defaultOutput->writeln(''); 326 $this->defaultOutput->writeln('');
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index b01aaa7f..b7799746 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -133,10 +133,10 @@ class ConfigController extends Controller
133 $userManager->updateUser($newUser, true); 133 $userManager->updateUser($newUser, true);
134 134
135 $config = new Config($newUser); 135 $config = new Config($newUser);
136 $config->setTheme($this->container->getParameter('theme')); 136 $config->setTheme($this->getParameter('wallabag_core.theme'));
137 $config->setItemsPerPage($this->container->getParameter('items_on_page')); 137 $config->setItemsPerPage($this->getParameter('wallabag_core.items_on_page'));
138 $config->setRssLimit($this->container->getParameter('rss_limit')); 138 $config->setRssLimit($this->getParameter('wallabag_core.rss_limit'));
139 $config->setLanguage($this->container->getParameter('language')); 139 $config->setLanguage($this->getParameter('wallabag_core.language'));
140 140
141 $em->persist($config); 141 $em->persist($config);
142 142
@@ -163,6 +163,7 @@ class ConfigController extends Controller
163 'username' => $user->getUsername(), 163 'username' => $user->getUsername(),
164 'token' => $config->getRssToken(), 164 'token' => $config->getRssToken(),
165 ), 165 ),
166 'twofactor_auth' => $this->getParameter('twofactor_auth'),
166 )); 167 ));
167 } 168 }
168 169
diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php
index 2b7ef598..a4f7a200 100644
--- a/src/Wallabag/CoreBundle/Controller/RssController.php
+++ b/src/Wallabag/CoreBundle/Controller/RssController.php
@@ -84,7 +84,7 @@ class RssController extends Controller
84 $pagerAdapter = new DoctrineORMAdapter($qb->getQuery()); 84 $pagerAdapter = new DoctrineORMAdapter($qb->getQuery());
85 $entries = new Pagerfanta($pagerAdapter); 85 $entries = new Pagerfanta($pagerAdapter);
86 86
87 $perPage = $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit'); 87 $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit');
88 $entries->setMaxPerPage($perPage); 88 $entries->setMaxPerPage($perPage);
89 89
90 return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array( 90 return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
diff --git a/src/Wallabag/CoreBundle/Controller/StaticController.php b/src/Wallabag/CoreBundle/Controller/StaticController.php
index 9ada371b..5b7bd56e 100644
--- a/src/Wallabag/CoreBundle/Controller/StaticController.php
+++ b/src/Wallabag/CoreBundle/Controller/StaticController.php
@@ -25,7 +25,10 @@ class StaticController extends Controller
25 { 25 {
26 return $this->render( 26 return $this->render(
27 'WallabagCoreBundle:Static:about.html.twig', 27 'WallabagCoreBundle:Static:about.html.twig',
28 array() 28 array(
29 'version' => $this->getParameter('wallabag_core.version'),
30 'paypal_url' => $this->getParameter('wallabag_core.paypal_url'),
31 )
29 ); 32 );
30 } 33 }
31 34
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
new file mode 100644
index 00000000..5e89c2a9
--- /dev/null
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
@@ -0,0 +1,133 @@
1<?php
2
3namespace Wallabag\CoreBundle\DataFixtures\ORM;
4
5use Doctrine\Common\DataFixtures\AbstractFixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager;
8use Craue\ConfigBundle\Entity\Setting;
9
10class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
11{
12 /**
13 * {@inheritdoc}
14 */
15 public function load(ObjectManager $manager)
16 {
17 $settings = [
18 [
19 'name' => 'download_pictures',
20 'value' => '1',
21 'section' => 'entry',
22 ],
23 [
24 'name' => 'carrot',
25 'value' => '1',
26 'section' => 'entry',
27 ],
28 [
29 'name' => 'share_diaspora',
30 'value' => '1',
31 'section' => 'entry',
32 ],
33 [
34 'name' => 'diaspora_url',
35 'value' => 'http://diasporapod.com',
36 'section' => 'entry',
37 ],
38 [
39 'name' => 'share_shaarli',
40 'value' => '1',
41 'section' => 'entry',
42 ],
43 [
44 'name' => 'shaarli_url',
45 'value' => 'http://myshaarli.com',
46 'section' => 'entry',
47 ],
48 [
49 'name' => 'share_mail',
50 'value' => '1',
51 'section' => 'entry',
52 ],
53 [
54 'name' => 'share_twitter',
55 'value' => '1',
56 'section' => 'entry',
57 ],
58 [
59 'name' => 'export_epub',
60 'value' => '1',
61 'section' => 'export',
62 ],
63 [
64 'name' => 'export_mobi',
65 'value' => '1',
66 'section' => 'export',
67 ],
68 [
69 'name' => 'export_pdf',
70 'value' => '1',
71 'section' => 'export',
72 ],
73 [
74 'name' => 'export_csv',
75 'value' => '1',
76 'section' => 'export',
77 ],
78 [
79 'name' => 'export_json',
80 'value' => '1',
81 'section' => 'export',
82 ],
83 [
84 'name' => 'export_txt',
85 'value' => '1',
86 'section' => 'export',
87 ],
88 [
89 'name' => 'export_xml',
90 'value' => '1',
91 'section' => 'export',
92 ],
93 [
94 'name' => 'pocket_consumer_key',
95 'value' => null,
96 'section' => 'import',
97 ],
98 [
99 'name' => 'show_printlink',
100 'value' => '1',
101 'section' => 'entry',
102 ],
103 [
104 'name' => 'wallabag_support_url',
105 'value' => 'https://www.wallabag.org/pages/support.html',
106 'section' => 'misc',
107 ],
108 [
109 'name' => 'wallabag_url',
110 'value' => 'http://v2.wallabag.org',
111 'section' => 'misc',
112 ],
113 ];
114
115 foreach ($settings as $setting) {
116 $newSetting = new Setting();
117 $newSetting->setName($setting['name']);
118 $newSetting->setValue($setting['value']);
119 $newSetting->setSection($setting['section']);
120 $manager->persist($newSetting);
121 }
122
123 $manager->flush();
124 }
125
126 /**
127 * {@inheritdoc}
128 */
129 public function getOrder()
130 {
131 return 50;
132 }
133}
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
index 32acd1f1..bc405fdc 100644
--- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
+++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
@@ -17,6 +17,22 @@ class Configuration implements ConfigurationInterface
17 ->arrayNode('languages') 17 ->arrayNode('languages')
18 ->prototype('scalar')->end() 18 ->prototype('scalar')->end()
19 ->end() 19 ->end()
20 ->integerNode('items_on_page')
21 ->defaultValue(12)
22 ->end()
23 ->scalarNode('theme')
24 ->defaultValue('material')
25 ->end()
26 ->scalarNode('language')
27 ->defaultValue('en')
28 ->end()
29 ->integerNode('rss_limit')
30 ->defaultValue(50)
31 ->end()
32 ->scalarNode('version')
33 ->end()
34 ->scalarNode('paypal_url')
35 ->end()
20 ->end() 36 ->end()
21 ; 37 ;
22 38
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
index 9ff9b732..9b4703e4 100644
--- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
+++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
@@ -13,7 +13,14 @@ class WallabagCoreExtension extends Extension
13 { 13 {
14 $configuration = new Configuration(); 14 $configuration = new Configuration();
15 $config = $this->processConfiguration($configuration, $configs); 15 $config = $this->processConfiguration($configuration, $configs);
16
16 $container->setParameter('wallabag_core.languages', $config['languages']); 17 $container->setParameter('wallabag_core.languages', $config['languages']);
18 $container->setParameter('wallabag_core.items_on_page', $config['items_on_page']);
19 $container->setParameter('wallabag_core.theme', $config['theme']);
20 $container->setParameter('wallabag_core.language', $config['language']);
21 $container->setParameter('wallabag_core.rss_limit', $config['rss_limit']);
22 $container->setParameter('wallabag_core.version', $config['version']);
23 $container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
17 24
18 $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); 25 $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
19 $loader->load('services.yml'); 26 $loader->load('services.yml');
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index 31a80d6e..965a40b6 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -8,6 +8,7 @@ use JMS\Serializer\SerializerBuilder;
8use PHPePub\Core\EPub; 8use PHPePub\Core\EPub;
9use PHPePub\Core\Structure\OPF\DublinCore; 9use PHPePub\Core\Structure\OPF\DublinCore;
10use Symfony\Component\HttpFoundation\Response; 10use Symfony\Component\HttpFoundation\Response;
11use Craue\ConfigBundle\Util\Config;
11 12
12/** 13/**
13 * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest. 14 * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest.
@@ -27,12 +28,12 @@ class EntriesExport
27 </div'; 28 </div';
28 29
29 /** 30 /**
30 * @param string $wallabagUrl Wallabag instance url 31 * @param Config $craueConfig CraueConfig instance to get wallabag instance url from database
31 * @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE 32 * @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE
32 */ 33 */
33 public function __construct($wallabagUrl, $logoPath) 34 public function __construct(Config $craueConfig, $logoPath)
34 { 35 {
35 $this->wallabagUrl = $wallabagUrl; 36 $this->wallabagUrl = $craueConfig->get('wallabag_url');
36 $this->logoPath = $logoPath; 37 $this->logoPath = $logoPath;
37 } 38 }
38 39
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index 7d24d488..a8796fe4 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -3,7 +3,7 @@ services:
3 class: Wallabag\CoreBundle\Helper\DetectActiveTheme 3 class: Wallabag\CoreBundle\Helper\DetectActiveTheme
4 arguments: 4 arguments:
5 - "@security.token_storage" 5 - "@security.token_storage"
6 - %theme% # default theme from parameters.yml 6 - %wallabag_core.theme%
7 7
8 # custom form type 8 # custom form type
9 wallabag_core.form.type.config: 9 wallabag_core.form.type.config:
@@ -76,17 +76,17 @@ services:
76 class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener 76 class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener
77 arguments: 77 arguments:
78 - "@doctrine.orm.entity_manager" 78 - "@doctrine.orm.entity_manager"
79 - %theme% 79 - %wallabag_core.theme%
80 - %items_on_page% 80 - %wallabag_core.items_on_page%
81 - %rss_limit% 81 - %wallabag_core.rss_limit%
82 - %language% 82 - %wallabag_core.language%
83 tags: 83 tags:
84 - { name: kernel.event_subscriber } 84 - { name: kernel.event_subscriber }
85 85
86 wallabag_core.helper.entries_export: 86 wallabag_core.helper.entries_export:
87 class: Wallabag\CoreBundle\Helper\EntriesExport 87 class: Wallabag\CoreBundle\Helper\EntriesExport
88 arguments: 88 arguments:
89 - %wallabag_url% 89 - "@craue_config"
90 - src/Wallabag/CoreBundle/Resources/public/themes/_global/img/appicon/apple-touch-icon-152.png 90 - src/Wallabag/CoreBundle/Resources/public/themes/_global/img/appicon/apple-touch-icon-152.png
91 91
92 wallabag.operator.array.matches: 92 wallabag.operator.array.matches:
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 20f4352b..cc814cc4 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -13,6 +13,7 @@ archive: 'Lus'
13all: 'Tous les articles' 13all: 'Tous les articles'
14tags: 'Tags' 14tags: 'Tags'
15config: 'Configuration' 15config: 'Configuration'
16internal settings: 'Configuration interne'
16import: 'Importer' 17import: 'Importer'
17howto: 'Aide' 18howto: 'Aide'
18logout: 'Déconnexion' 19logout: 'Déconnexion'
diff --git a/src/Wallabag/CoreBundle/Resources/views/base.html.twig b/src/Wallabag/CoreBundle/Resources/views/base.html.twig
index 9e515a17..1742b4aa 100644
--- a/src/Wallabag/CoreBundle/Resources/views/base.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/base.html.twig
@@ -68,10 +68,8 @@
68 68
69 {% block footer %}{% endblock %} 69 {% block footer %}{% endblock %}
70 70
71 {% if warning_message %}
72 <div id="warning_message"> 71 <div id="warning_message">
73 {{ warning_message | raw }} 72 You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a>
74 </div> 73 </div>
75 {% endif %}
76 </body> 74 </body>
77</html> 75</html>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig
index c23d0e27..27a88287 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig
@@ -11,16 +11,15 @@
11 <li><a title="{% if entry.isArchived == 0 %}{% trans %}Mark as read{% endtrans %}{% else %}{% trans %}Mark as unread{% endtrans %}{% endif %}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% if entry.isArchived == 0 %}{% trans %}Mark as read{% endtrans %}{% else %}{% trans %}Mark as unread{% endtrans %}{% endif %}</span></a></li> 11 <li><a title="{% if entry.isArchived == 0 %}{% trans %}Mark as read{% endtrans %}{% else %}{% trans %}Mark as unread{% endtrans %}{% endif %}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% if entry.isArchived == 0 %}{% trans %}Mark as read{% endtrans %}{% else %}{% trans %}Mark as unread{% endtrans %}{% endif %}</span></a></li>
12 <li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li> 12 <li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li>
13 <li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li> 13 <li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li>
14 {% if share_twitter %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}Tweet{% endtrans %}"><span>{% trans %}Tweet{% endtrans %}</span></a></li>{% endif %} 14 {% if craue_setting('share_twitter') %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}Tweet{% endtrans %}"><span>{% trans %}Tweet{% endtrans %}</span></a></li>{% endif %}
15 {% if share_mail %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</span></a></li>{% endif %} 15 {% if craue_setting('share_mail') %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</span></a></li>{% endif %}
16 {% if share_shaarli %}<li><a href="{{ shaarli_url }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans %}shaarli{% endtrans %}"><span>{% trans %}shaarli{% endtrans %}</span></a></li>{% endif %} 16 {% if craue_setting('share_shaarli') %}<li><a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans %}shaarli{% endtrans %}"><span>{% trans %}shaarli{% endtrans %}</span></a></li>{% endif %}
17 {% if share_diaspora %}<li><a href="{{ diaspora_url }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank" class="tool diaspora icon-image icon-image--diaspora" title="{% trans %}diaspora{% endtrans %}"><span>{% trans %}diaspora{% endtrans %}</span></a></li>{% endif %} 17 {% if craue_setting('share_diaspora') %}<li><a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank" class="tool diaspora icon-image icon-image--diaspora" title="{% trans %}diaspora{% endtrans %}"><span>{% trans %}diaspora{% endtrans %}</span></a></li>{% endif %}
18 {# {% if flattr %}{% if flattr.status == flattrable %}<li><a href="http://flattr.com/submit/auto?url={{ entry.url }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans %}flattr{% endtrans %}"><span>{% trans %}flattr{% endtrans %}</span></a></li>{% elseif flattr.status == flattred %}<li><a href="{{ flattr.flattrItemURL }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans %}flattr{% endtrans %}><span>{% trans %}flattr{% endtrans %}</span> ({{ flattr.numFlattrs }})</a></li>{% endif %}{% endif %} #} 18 {% if craue_setting('carrot') %}<li><a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" class="tool carrot icon-image icon-image--carrot" target="_blank" title="{% trans %}carrot{% endtrans %}"><span>Carrot</span></a></li>{% endif %}
19 {% if carrot %}<li><a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" class="tool carrot icon-image icon-image--carrot" target="_blank" title="{% trans %}carrot{% endtrans %}"><span>Carrot</span></a></li>{% endif %} 19 {% if craue_setting('show_printlink') %}<li><a title="{% trans %}Print{% endtrans %}" class="tool icon icon-print" href="javascript: window.print();"><span>{% trans %}Print{% endtrans %}</span></a></li>{% endif %}
20 {% if show_printlink %}<li><a title="{% trans %}Print{% endtrans %}" class="tool icon icon-print" href="javascript: window.print();"><span>{% trans %}Print{% endtrans %}</span></a></li>{% endif %} 20 {% if craue_setting('export_epub') %}<li><a href="?epub&amp;method=id&amp;value={{ entry.id }}" title="Generate ePub file">EPUB</a></li>{% endif %}
21 {% if export_epub %}<li><a href="?epub&amp;method=id&amp;value={{ entry.id }}" title="Generate ePub file">EPUB</a></li>{% endif %} 21 {% if craue_setting('export_mobi') %}<li><a href="?mobi&amp;method=id&amp;value={{ entry.id }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
22 {% if export_mobi %}<li><a href="?mobi&amp;method=id&amp;value={{ entry.id }}" title="Generate Mobi file">MOBI</a></li>{% endif %} 22 {% if craue_setting('export_pdf') %}<li><a href="?pdf&amp;method=id&amp;value={{ entry.id }}" title="Generate PDF file">PDF</a></li>{% endif %}
23 {% if export_pdf %}<li><a href="?pdf&amp;method=id&amp;value={{ entry.id }}" title="Generate PDF file">PDF</a></li>{% endif %}
24 <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans %}Does this article appear wrong?{% endtrans %}" class="tool bad-display icon icon-delete"><span>{% trans %}Does this article appear wrong?{% endtrans %}</span></a></li> 23 <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans %}Does this article appear wrong?{% endtrans %}" class="tool bad-display icon icon-delete"><span>{% trans %}Does this article appear wrong?{% endtrans %}</span></a></li>
25 </ul> 24 </ul>
26 </div> 25 </div>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
index 3aead497..b630070c 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
@@ -51,6 +51,9 @@
51 </div> 51 </div>
52 </li> 52 </li>
53 <li><a href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li> 53 <li><a href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li>
54 {% if is_granted('ROLE_SUPER_ADMIN') %}
55 <li><a href="{{ path('craue_config_settings_modify') }}">{% trans %}internal settings{% endtrans %}</a></li>
56 {% endif %}
54 <li><a href="{{ path('import') }}">{% trans %}import{% endtrans %}</a></li> 57 <li><a href="{{ path('import') }}">{% trans %}import{% endtrans %}</a></li>
55 <li><a href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li> 58 <li><a href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li>
56 <li><a href="{{ path('about') }}">{% trans %}about{% endtrans %}</a></li> 59 <li><a href="{{ path('about') }}">{% trans %}about{% endtrans %}</a></li>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
index 8743dc1d..1cae90a4 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
@@ -11,14 +11,14 @@
11 <div class="row"> 11 <div class="row">
12 <div class="div_tabs col s12"> 12 <div class="div_tabs col s12">
13 <ul class="tabs"> 13 <ul class="tabs">
14 <li class="tab col s3"><a class="active" href="#set1">{% trans %}Settings{% endtrans %}</a></li> 14 <li class="tab col s3"><a class="active" href="#set1">{% trans %}Settings{% endtrans %}</a></li>
15 <li class="tab col s3"><a href="#set2">{% trans %}RSS{% endtrans %}</a></li> 15 <li class="tab col s3"><a href="#set2">{% trans %}RSS{% endtrans %}</a></li>
16 <li class="tab col s3"><a href="#set3">{% trans %}User information{% endtrans %}</a></li> 16 <li class="tab col s3"><a href="#set3">{% trans %}User information{% endtrans %}</a></li>
17 <li class="tab col s3"><a href="#set4">{% trans %}Password{% endtrans %}</a></li> 17 <li class="tab col s3"><a href="#set4">{% trans %}Password{% endtrans %}</a></li>
18 <li class="tab col s3"><a href="#set5">{% trans %}Tagging rules{% endtrans %}</a></li> 18 <li class="tab col s3"><a href="#set5">{% trans %}Tagging rules{% endtrans %}</a></li>
19 {% if is_granted('ROLE_SUPER_ADMIN') %} 19 {% if is_granted('ROLE_SUPER_ADMIN') %}
20 <li class="tab col s3"><a href="#set6">{% trans %}Add a user{% endtrans %}</a></li> 20 <li class="tab col s3"><a href="#set6">{% trans %}Add a user{% endtrans %}</a></li>
21 {% endif %} 21 {% endif %}
22 </ul> 22 </ul>
23 </div> 23 </div>
24 24
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
index 6de800b9..c86b8d88 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
@@ -99,13 +99,13 @@
99 {% endif %} 99 {% endif %}
100 <h4 class="center">{% trans %}Export{% endtrans %}</h4> 100 <h4 class="center">{% trans %}Export{% endtrans %}</h4>
101 <ul> 101 <ul>
102 {% if export_epub %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub' }) }}">{% trans %}EPUB{% endtrans %}</a></li>{% endif %} 102 {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub' }) }}">{% trans %}EPUB{% endtrans %}</a></li>{% endif %}
103 {% if export_mobi %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi' }) }}">{% trans %}MOBI{% endtrans %}</a></li>{% endif %} 103 {% if craue_setting('export_mobi') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'mobi' }) }}">{% trans %}MOBI{% endtrans %}</a></li>{% endif %}
104 {% if export_pdf %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf' }) }}">{% trans %}PDF{% endtrans %}</a></li>{% endif %} 104 {% if craue_setting('export_pdf') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'pdf' }) }}">{% trans %}PDF{% endtrans %}</a></li>{% endif %}
105 {% if export_xml %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml' }) }}">{% trans %}XML{% endtrans %}</a></li>{% endif %} 105 {% if craue_setting('export_xml') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'xml' }) }}">{% trans %}XML{% endtrans %}</a></li>{% endif %}
106 {% if export_csv %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json' }) }}">{% trans %}JSON{% endtrans %}</a></li>{% endif %} 106 {% if craue_setting('export_csv') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'json' }) }}">{% trans %}JSON{% endtrans %}</a></li>{% endif %}
107 {% if export_json %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv' }) }}">{% trans %}CSV{% endtrans %}</a></li>{% endif %} 107 {% if craue_setting('export_json') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'csv' }) }}">{% trans %}CSV{% endtrans %}</a></li>{% endif %}
108 {% if export_txt %}<li class="bold"><del><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt' }) }}">{% trans %}TXT{% endtrans %}</a></del></li>{% endif %} 108 {% if craue_setting('export_txt') %}<li class="bold"><del><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'txt' }) }}">{% trans %}TXT{% endtrans %}</a></del></li>{% endif %}
109 </ul> 109 </ul>
110 </div> 110 </div>
111 111
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
index 31963ae8..dad96187 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
@@ -97,12 +97,11 @@
97 </a> 97 </a>
98 <div class="collapsible-body"> 98 <div class="collapsible-body">
99 <ul> 99 <ul>
100 {% if share_twitter %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}twitter{% endtrans %}"><span>{% trans %}twitter{% endtrans %}</span></a></li>{% endif %} 100 {% if craue_setting('share_twitter') %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}twitter{% endtrans %}"><span>{% trans %}twitter{% endtrans %}</span></a></li>{% endif %}
101 {% if share_shaarli %}<li><a href="{{ shaarli_url }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans %}shaarli{% endtrans %}"><span>{% trans %}shaarli{% endtrans %}</span></a></li>{% endif %} 101 {% if craue_setting('share_shaarli') %}<li><a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans %}shaarli{% endtrans %}"><span>{% trans %}shaarli{% endtrans %}</span></a></li>{% endif %}
102 {% if share_diaspora %}<li><a href="{{ diaspora_url }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank" class="tool diaspora icon-image icon-image--diaspora" title="{% trans %}diaspora*{% endtrans %}"><span>{% trans %}diaspora*{% endtrans %}</span></a></li>{% endif %} 102 {% if craue_setting('share_diaspora') %}<li><a href="{{ craue_setting('diaspora_url') }}/bookmarklet?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}&notes=&v=1&noui=1&jump=doclose" target="_blank" class="tool diaspora icon-image icon-image--diaspora" title="{% trans %}diaspora*{% endtrans %}"><span>{% trans %}diaspora*{% endtrans %}</span></a></li>{% endif %}
103 {# {% if flattr %}{% if flattr.status == flattrable %}<li><a href="http://flattr.com/submit/auto?url={{ entry.url }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans %}flattr{% endtrans %}"><span>{% trans %}flattr{% endtrans %}</span></a></li>{% elseif flattr.status == flattred %}<li><a href="{{ flattr.flattrItemURL }}" class="tool flattr icon icon-flattr" target="_blank" title="{% trans %}flattr{% endtrans %}><span>{% trans %}flattr{% endtrans %}</span> ({{ flattr.numFlattrs }})</a></li>{% endif %}{% endif %} #} 103 {% if craue_setting('carrot') %}<li><a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" class="tool carrot icon-image icon-image--carrot" target="_blank" title="{% trans %}carrot{% endtrans %}"><span>Carrot</span></a></li>{% endif %}
104 {% if carrot %}<li><a href="https://secure.carrot.org/GiveAndGetBack.do?url={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" class="tool carrot icon-image icon-image--carrot" target="_blank" title="{% trans %}carrot{% endtrans %}"><span>Carrot</span></a></li>{% endif %} 104 {% if craue_setting('share_mail') %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</span></a></li>{% endif %}
105 {% if share_mail %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</span></a></li>{% endif %}
106 </ul> 105 </ul>
107 </div> 106 </div>
108 </li> 107 </li>
@@ -114,13 +113,13 @@
114 </a> 113 </a>
115 <div class="collapsible-body"> 114 <div class="collapsible-body">
116 <ul> 115 <ul>
117 {% if export_epub %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'epub' }) }}" title="Generate ePub file">EPUB</a></li>{% endif %} 116 {% if craue_setting('export_epub') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'epub' }) }}" title="Generate ePub file">EPUB</a></li>{% endif %}
118 {% if export_mobi %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'mobi' }) }}" title="Generate Mobi file">MOBI</a></li>{% endif %} 117 {% if craue_setting('export_mobi') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'mobi' }) }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
119 {% if export_pdf %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %} 118 {% if craue_setting('export_pdf') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %}
120 {% if export_csv %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>{% endif %} 119 {% if craue_setting('export_csv') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>{% endif %}
121 {% if export_json %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'json' }) }}" title="Generate JSON file">JSON</a></li>{% endif %} 120 {% if craue_setting('export_json') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'json' }) }}" title="Generate JSON file">JSON</a></li>{% endif %}
122 {% if export_txt %}<li><del><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'txt' }) }}" title="Generate TXT file">TXT</a></del></li>{% endif %} 121 {% if craue_setting('export_txt') %}<li><del><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'txt' }) }}" title="Generate TXT file">TXT</a></del></li>{% endif %}
123 {% if export_xml %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'xml' }) }}" title="Generate XML file">XML</a></li>{% endif %} 122 {% if craue_setting('export_xml') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'xml' }) }}" title="Generate XML file">XML</a></li>{% endif %}
124 </ul> 123 </ul>
125 </div> 124 </div>
126 </li> 125 </li>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
index a8b6dc3f..dff9e612 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
@@ -45,6 +45,9 @@
45 <li class="bold border-bottom {% if currentRoute == 'all' %}active{% endif %}"><a class="waves-effect" href="{{ path('all') }}">{% trans %}all{% endtrans %}</a></li> 45 <li class="bold border-bottom {% if currentRoute == 'all' %}active{% endif %}"><a class="waves-effect" href="{{ path('all') }}">{% trans %}all{% endtrans %}</a></li>
46 <li class="bold border-bottom {% if currentRoute == 'tags' %}active{% endif %}"><a class="waves-effect" href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li> 46 <li class="bold border-bottom {% if currentRoute == 'tags' %}active{% endif %}"><a class="waves-effect" href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li>
47 <li class="bold {% if currentRoute == 'config' %}active{% endif %}"><a class="waves-effect" href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li> 47 <li class="bold {% if currentRoute == 'config' %}active{% endif %}"><a class="waves-effect" href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li>
48 {% if is_granted('ROLE_SUPER_ADMIN') %}
49 <li class="bold border-bottom {% if currentRoute == 'craue_config_settings_modify' %}active{% endif %}"><a class="waves-effect" href="{{ path('craue_config_settings_modify') }}">{% trans %}internal settings{% endtrans %}</a></li>
50 {% endif %}
48 <li class="bold {% if currentRoute == 'import' %}active{% endif %}"><a class="waves-effect" href="{{ path('import') }}">{% trans %}import{% endtrans %}</a></li> 51 <li class="bold {% if currentRoute == 'import' %}active{% endif %}"><a class="waves-effect" href="{{ path('import') }}">{% trans %}import{% endtrans %}</a></li>
49 <li class="bold {% if currentRoute == 'howto' %}active{% endif %}"><a class="waves-effect" href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li> 52 <li class="bold {% if currentRoute == 'howto' %}active{% endif %}"><a class="waves-effect" href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li>
50 <li class="bold"><a class="waves-effect" class="icon icon-power" href="{{ path('fos_user_security_logout') }}" title="{% trans %}logout{% endtrans %}">{% trans %}logout{% endtrans %}</a></li> 53 <li class="bold"><a class="waves-effect" class="icon icon-power" href="{{ path('fos_user_security_logout') }}" title="{% trans %}logout{% endtrans %}">{% trans %}logout{% endtrans %}</a></li>
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
index 7d75e2b7..a79d7b90 100644
--- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
@@ -81,6 +81,7 @@ class InstallCommandTest extends WallabagCoreTestCase
81 81
82 $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay()); 82 $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay());
83 $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay()); 83 $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay());
84 $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay());
84 $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay()); 85 $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay());
85 $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay()); 86 $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay());
86 87
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/SettingsControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/SettingsControllerTest.php
new file mode 100644
index 00000000..354aedba
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Tests/Controller/SettingsControllerTest.php
@@ -0,0 +1,32 @@
1<?php
2
3namespace Wallabag\CoreBundle\Tests\Controller;
4
5use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
6
7/**
8 * The controller `SettingsController` does not exist.
9 * This test cover security against the internal settings page managed by CraueConfigBundle
10 */
11class SettingsControllerTest extends WallabagCoreTestCase
12{
13 public function testSettingsWithAdmin()
14 {
15 $this->logInAs('admin');
16 $client = $this->getClient();
17
18 $crawler = $client->request('GET', '/settings');
19
20 $this->assertEquals(200, $client->getResponse()->getStatusCode());
21 }
22
23 public function testSettingsWithNormalUser()
24 {
25 $this->logInAs('bob');
26 $client = $this->getClient();
27
28 $crawler = $client->request('GET', '/settings');
29
30 $this->assertEquals(403, $client->getResponse()->getStatusCode());
31 }
32}
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php
index 7aee302f..1c1b4fa8 100644
--- a/src/Wallabag/ImportBundle/Controller/PocketController.php
+++ b/src/Wallabag/ImportBundle/Controller/PocketController.php
@@ -15,6 +15,7 @@ class PocketController extends Controller
15 { 15 {
16 return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ 16 return $this->render('WallabagImportBundle:Pocket:index.html.twig', [
17 'import' => $this->get('wallabag_import.pocket.import'), 17 'import' => $this->get('wallabag_import.pocket.import'),
18 'has_consumer_key' => '' == trim($this->get('craue_config')->get('pocket_consumer_key')) ? false : true,
18 ]); 19 ]);
19 } 20 }
20 21
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 617d5514..22932238 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -11,6 +11,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
11use Wallabag\CoreBundle\Entity\Entry; 11use Wallabag\CoreBundle\Entity\Entry;
12use Wallabag\CoreBundle\Entity\Tag; 12use Wallabag\CoreBundle\Entity\Tag;
13use Wallabag\CoreBundle\Helper\ContentProxy; 13use Wallabag\CoreBundle\Helper\ContentProxy;
14use Craue\ConfigBundle\Util\Config;
14 15
15class PocketImport implements ImportInterface 16class PocketImport implements ImportInterface
16{ 17{
@@ -24,12 +25,12 @@ class PocketImport implements ImportInterface
24 private $importedEntries = 0; 25 private $importedEntries = 0;
25 protected $accessToken; 26 protected $accessToken;
26 27
27 public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, $consumerKey) 28 public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, Config $craueConfig)
28 { 29 {
29 $this->user = $tokenStorage->getToken()->getUser(); 30 $this->user = $tokenStorage->getToken()->getUser();
30 $this->em = $em; 31 $this->em = $em;
31 $this->contentProxy = $contentProxy; 32 $this->contentProxy = $contentProxy;
32 $this->consumerKey = $consumerKey; 33 $this->consumerKey = $craueConfig->get('pocket_consumer_key');
33 $this->logger = new NullLogger(); 34 $this->logger = new NullLogger();
34 } 35 }
35 36
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml
index 6a11892e..e0942b1a 100644
--- a/src/Wallabag/ImportBundle/Resources/config/services.yml
+++ b/src/Wallabag/ImportBundle/Resources/config/services.yml
@@ -17,7 +17,7 @@ services:
17 - "@security.token_storage" 17 - "@security.token_storage"
18 - "@doctrine.orm.entity_manager" 18 - "@doctrine.orm.entity_manager"
19 - "@wallabag_core.content_proxy" 19 - "@wallabag_core.content_proxy"
20 - %pocket_consumer_key% 20 - "@craue_config"
21 calls: 21 calls:
22 - [ setClient, [ "@wallabag_import.pocket.client" ] ] 22 - [ setClient, [ "@wallabag_import.pocket.client" ] ]
23 - [ setLogger, [ "@logger" ]] 23 - [ setLogger, [ "@logger" ]]
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
index 643ad775..e0e36f38 100644
--- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
+++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
@@ -5,6 +5,12 @@
5<div class="row"> 5<div class="row">
6 <div class="col s12"> 6 <div class="col s12">
7 <div class="card-panel settings"> 7 <div class="card-panel settings">
8 {% if not has_consumer_key %}
9 <div class="card-panel red darken-1">
10 {% trans %}Pocket import isn't configured. You need to define pocket_consumer_key.{% endtrans %}
11 </div>
12 {% endif %}
13
8 <blockquote>{{ import.description|trans }}</blockquote> 14 <blockquote>{{ import.description|trans }}</blockquote>
9 <p>{% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %}</p> 15 <p>{% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %}</p>
10 <form method="post" action="{{ path('import_pocket_auth') }}"> 16 <form method="post" action="{{ path('import_pocket_auth') }}">
diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
index 76225fe4..25359d56 100644
--- a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
+++ b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
@@ -55,11 +55,20 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
55 ->disableOriginalConstructor() 55 ->disableOriginalConstructor()
56 ->getMock(); 56 ->getMock();
57 57
58 $config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
59 ->disableOriginalConstructor()
60 ->getMock();
61
62 $config->expects($this->any())
63 ->method('get')
64 ->with('pocket_consumer_key')
65 ->willReturn($consumerKey);
66
58 $pocket = new PocketImportMock( 67 $pocket = new PocketImportMock(
59 $this->tokenStorage, 68 $this->tokenStorage,
60 $this->em, 69 $this->em,
61 $this->contentProxy, 70 $this->contentProxy,
62 $consumerKey 71 $config
63 ); 72 );
64 73
65 $this->logHandler = new TestHandler(); 74 $this->logHandler = new TestHandler();
diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
index 6b108dd3..98017f43 100644
--- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
+++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
@@ -4,6 +4,7 @@ namespace Wallabag\UserBundle\Mailer;
4 4
5use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; 5use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
6use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; 6use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface;
7use Craue\ConfigBundle\Util\Config;
7 8
8/** 9/**
9 * Custom mailer for TwoFactorBundle email. 10 * Custom mailer for TwoFactorBundle email.
@@ -47,7 +48,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface
47 private $supportUrl; 48 private $supportUrl;
48 49
49 /** 50 /**
50 * Url for the wallabag instance. 51 * Url for the wallabag instance (only used for image in the HTML email template)
51 * 52 *
52 * @var string 53 * @var string
53 */ 54 */
@@ -60,17 +61,16 @@ class AuthCodeMailer implements AuthCodeMailerInterface
60 * @param \Twig_Environment $twig 61 * @param \Twig_Environment $twig
61 * @param string $senderEmail 62 * @param string $senderEmail
62 * @param string $senderName 63 * @param string $senderName
63 * @param string $supportUrl 64 * @param Config $craueConfig Craue\Config instance to get wallabag support url from database
64 * @param string $wallabagUrl
65 */ 65 */
66 public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) 66 public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, Config $craueConfig)
67 { 67 {
68 $this->mailer = $mailer; 68 $this->mailer = $mailer;
69 $this->twig = $twig; 69 $this->twig = $twig;
70 $this->senderEmail = $senderEmail; 70 $this->senderEmail = $senderEmail;
71 $this->senderName = $senderName; 71 $this->senderName = $senderName;
72 $this->supportUrl = $supportUrl; 72 $this->supportUrl = $craueConfig->get('wallabag_support_url');
73 $this->wallabagUrl = $wallabagUrl; 73 $this->wallabagUrl = $craueConfig->get('wallabag_url');
74 } 74 }
75 75
76 /** 76 /**
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml
index 8321473a..9a589332 100644
--- a/src/Wallabag/UserBundle/Resources/config/services.yml
+++ b/src/Wallabag/UserBundle/Resources/config/services.yml
@@ -11,8 +11,7 @@ services:
11 - "@twig" 11 - "@twig"
12 - "%scheb_two_factor.email.sender_email%" 12 - "%scheb_two_factor.email.sender_email%"
13 - "%scheb_two_factor.email.sender_name%" 13 - "%scheb_two_factor.email.sender_name%"
14 - "%wallabag_support_url%" 14 - "@craue_config"
15 - "%wallabag_url%"
16 15
17 wallabag_user.password_resetting: 16 wallabag_user.password_resetting:
18 class: Wallabag\UserBundle\EventListener\PasswordResettingListener 17 class: Wallabag\UserBundle\EventListener\PasswordResettingListener
diff --git a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php
index e3f43a7e..562a1ed2 100644
--- a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php
+++ b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php
@@ -26,6 +26,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase
26 protected $mailer; 26 protected $mailer;
27 protected $spool; 27 protected $spool;
28 protected $twig; 28 protected $twig;
29 protected $config;
29 30
30 protected function setUp() 31 protected function setUp()
31 { 32 {
@@ -43,6 +44,14 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase
43TWIG; 44TWIG;
44 45
45 $this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig' => $twigTemplate))); 46 $this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig' => $twigTemplate)));
47
48 $this->config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
49 ->disableOriginalConstructor()
50 ->getMock();
51
52 $this->config->expects($this->any())
53 ->method('get')
54 ->willReturn('http://0.0.0.0/support');
46 } 55 }
47 56
48 public function testSendEmail() 57 public function testSendEmail()
@@ -58,8 +67,7 @@ TWIG;
58 $this->twig, 67 $this->twig,
59 'nobody@test.io', 68 'nobody@test.io',
60 'wallabag test', 69 'wallabag test',
61 'http://0.0.0.0/support', 70 $this->config
62 'http://0.0.0.0'
63 ); 71 );
64 72
65 $authCodeMailer->sendAuthCode($user); 73 $authCodeMailer->sendAuthCode($user);