]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Add CraueConfig for internal settings
authorJeremy Benoist <jeremy.benoist@gmail.com>
Thu, 21 Jan 2016 07:53:09 +0000 (08:53 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Sun, 31 Jan 2016 13:48:26 +0000 (14:48 +0100)
29 files changed:
app/AppKernel.php
app/DoctrineMigrations/Version20160120200534_settings.php [new file with mode: 0644]
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml [new file with mode: 0644]
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml [new file with mode: 0644]
app/Resources/CraueConfigBundle/views/Settings/modify.html.twig [new file with mode: 0644]
app/config/config.yml
app/config/parameters.yml.dist
app/config/routing.yml
app/config/security.yml
app/config/tests/parameters.yml.dist.mysql
app/config/tests/parameters.yml.dist.pgsql
app/config/tests/parameters.yml.dist.sqlite
composer.json
src/Wallabag/CoreBundle/Controller/ConfigController.php
src/Wallabag/CoreBundle/Controller/StaticController.php
src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
src/Wallabag/CoreBundle/Helper/EntriesExport.php
src/Wallabag/CoreBundle/Resources/config/services.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
src/Wallabag/ImportBundle/Import/PocketImport.php
src/Wallabag/ImportBundle/Resources/config/services.yml
src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
src/Wallabag/UserBundle/Resources/config/services.yml

index 7e76a9e9053dc1ba6f12537b5a96207e7bb44807..82d3aa38e3aada99550e48bc50b04df49cf78e2c 100644 (file)
@@ -33,6 +33,7 @@ class AppKernel extends Kernel
             new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
             new Wallabag\ImportBundle\WallabagImportBundle(),
             new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
+            new Craue\ConfigBundle\CraueConfigBundle(),
         ];
 
         if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
diff --git a/app/DoctrineMigrations/Version20160120200534_settings.php b/app/DoctrineMigrations/Version20160120200534_settings.php
new file mode 100644 (file)
index 0000000..34809ff
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+
+/**
+ * Auto-generated Migration: Please modify to your needs!
+ */
+class Version20160120200534_settings extends AbstractMigration
+{
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        // this up() migration is auto-generated, please modify it to your needs
+        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
+
+        $this->addSql('CREATE TABLE craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_B95BA9425E237E06 (name), PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
+        $this->addSql("INSERT INTO `craue_config_setting` (`name`, `value`, `section`) VALUES
+            ('download_pictures',     '1',                                              'entry'),
+            ('carrot',                '1',                                              'entry'),
+            ('share_diaspora',        '1',                                              'entry'),
+            ('diaspora_url',          'http://diasporapod.com',                         'entry'),
+            ('share_shaarli',         '1',                                              'entry'),
+            ('shaarli_url',           'http://myshaarli.com',                           'entry'),
+            ('share_mail',            '1',                                              'entry'),
+            ('share_twitter',         '1',                                              'entry'),
+            ('export_epub',           '1',                                              'export'),
+            ('export_mobi',           '1',                                              'export'),
+            ('export_pdf',            '1',                                              'export'),
+            ('pocket_consumer_key',   NULL,                                             'import'),
+            ('show_printlink',        '1',                                              'entry'),
+            ('wallabag_support_url',  'https://www.wallabag.org/pages/support.html',    'misc'),
+            ('wallabag_url',          'http://v2.wallabag.org',                         'misc')"
+        );
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        // this down() migration is auto-generated, please modify it to your needs
+        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
+
+        $this->addSql('DROP TABLE craue_config_setting');
+    }
+}
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
new file mode 100644 (file)
index 0000000..ea90460
--- /dev/null
@@ -0,0 +1,15 @@
+download_pictures: Download pictures on your server
+carrot: Enable share to Carrot
+diaspora_url: Diaspora URL, if the service is enabled
+export_epub: Enable ePub export
+export_mobi: Enable .mobi export
+export_pdf: Enable PDF export
+pocket_consumer_key: Consumer key for Pocket to import contents (https://getpocket.com/developer/docs/authentication)
+shaarli_url: URL de Shaarli, if the service is enabled
+share_diaspora: Enable share to Diaspora
+share_mail: Enable share by email
+share_shaarli: Enable share to Shaarli
+share_twitter: Enable share to Twitter
+show_printlink: Display a link to print content
+wallabag_support_url: Support URL for wallabag
+wallabag_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 (file)
index 0000000..1960004
--- /dev/null
@@ -0,0 +1,15 @@
+download_pictures: Télécharger les images sur le serveur
+carrot: Activer le partage vers Carrot
+diaspora_url: URL de Diaspora, si le service Diaspora est activé
+export_epub: Activer l'export ePub
+export_mobi: Activer l'export .mobi
+export_pdf: Activer l'export PDF
+pocket_consumer_key: Clé d'authentification Pocket pour importer les données (https://getpocket.com/developer/docs/authentication)
+shaarli_url: URL de Shaarli, si le service Diaspora est activé
+share_diaspora: Activer le partage vers Diaspora
+share_mail: Activer le partage par email
+share_shaarli: Activer le partage vers Shaarli
+share_twitter: Activer le partage vers Twitter
+show_printlink: Afficher un lien pour imprimer
+wallabag_support_url: URL de support de wallabag
+wallabag_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 (file)
index 0000000..f44db42
--- /dev/null
@@ -0,0 +1,43 @@
+{% extends "WallabagCoreBundle::layout.html.twig" %}
+
+{% block title %}{% trans %}internal settings{% endtrans %}{% endblock %}
+
+{% block content %}
+    <div class="row">
+        <div class="col s12">
+            <div class="card-panel settings">
+                {{ form_start(form, {'attr': {'class': 'craue_config_settings_modify'}}) }}
+                    {{ form_errors(form) }}
+
+                    <div class="row">
+                        <div class="div_tabs col s12">
+                            <ul class="tabs">
+                                {% for section in sections | craue_sortSections %}
+                                    <li class="tab col s3"><a href="#set-{{ section }}">{{ section | trans({}, 'CraueConfigBundle') }}</a></li>
+                                {% endfor %}
+                            </ul>
+                        </div>
+
+                        {% for section in sections | craue_sortSections %}
+                            <div id="set-{{ section }}" class="col s12">
+                                {% for setting in form.settings if setting.section.vars.value == section %}
+                                        {{ form_row(setting.name) }}
+                                        {{ form_row(setting.section) }}
+                                        {{ form_row(setting.value, {
+                                            'label': setting.name.vars.value | trans({}, 'CraueConfigBundle'),
+                                        }) }}
+                                {% endfor %}
+                            </div>
+                        {% endfor %}
+                </div>
+
+                <button class="btn waves-effect waves-light" type="submit" name="action">
+                    {{ 'modify_settings' | trans({}, 'CraueConfigBundle') }}
+                </button>
+
+                {{ form_rest(form) }}
+                {{ form_end(form) }}
+            </div>
+        </div>
+    </div>
+{% endblock %}
index 58e1dd6663374f47692f28834c9960b54e75b7d1..3c278ea6350e4e0f6cfd711ec8d7865b088bd265 100644 (file)
@@ -28,6 +28,8 @@ framework:
     assets: ~
 
 wallabag_core:
+    version: 2.0.0-alpha.1
+    paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb"
     languages:
         en: 'English'
         fr: 'Français'
@@ -46,28 +48,6 @@ wallabag_import:
 twig:
     debug:            "%kernel.debug%"
     strict_variables: "%kernel.debug%"
-    globals:
-        share_twitter: %share_twitter%
-        share_mail: %share_mail%
-        share_shaarli: %share_shaarli%
-        shaarli_url: %shaarli_url%
-        share_diaspora: %share_diaspora%
-        diaspora_url: %diaspora_url%
-        flattr: %flattr%
-        flattrable: 1
-        flattred: 2
-        carrot: %carrot%
-        show_printlink: %show_printlink%
-        export_epub: %export_epub%
-        export_mobi: %export_mobi%
-        export_pdf: %export_pdf%
-        export_csv: %export_csv%
-        export_json: %export_json%
-        export_txt: %export_txt%
-        export_xml: %export_xml%
-        version: %app.version%
-        twofactor_auth: %twofactor_auth%
-        paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb"
     form_themes:
         - "LexikFormFilterBundle:Form:form_div_layout.html.twig"
 
index 52d26cb4d4cb123de82862899849108f682120f2..3eeedb7805f2bdb1d8d99b9a8c99f8a16649b6a1 100644 (file)
@@ -37,32 +37,6 @@ parameters:
     # A secret key that's used to generate certain security-related tokens
     secret:            ThisTokenIsNotSoSecretChangeIt
 
-    # wallabag misc
-    app.version: 2.0.0-alpha
+    # two factor stuff
     twofactor_auth: true
     twofactor_sender: no-reply@wallabag.org
-
-    download_pictures: false # if true, pictures will be stored into data/assets for each article
-
-    # Entry view
-    share_twitter: true
-    share_mail: true
-    share_shaarli: true
-    shaarli_url: http://myshaarli.com
-    share_diaspora: true
-    diaspora_url: http://diasporapod.com
-    flattr: true
-    carrot: true
-    show_printlink: true
-    export_epub: true
-    export_mobi: true
-    export_pdf: true
-    export_csv: true
-    export_json: true
-    export_txt: true
-    export_xml: true
-    wallabag_url: http://v2.wallabag.org
-    wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
-
-    # pocket import
-    pocket_consumer_key: xxxxxxxx
index 84b98d2323621be0e315ab6e3df3f378c8075808..c491d35dc305eaa6f722bdd9a35251caf005aad3 100644 (file)
@@ -22,7 +22,9 @@ rest :
 
 homepage:
     path: "/{page}"
-    defaults: { _controller: WallabagCoreBundle:Entry:showUnread, page : 1 }
+    defaults:
+        _controller: WallabagCoreBundle:Entry:showUnread
+        page : 1
     requirements:
         page: \d+
 
@@ -31,3 +33,8 @@ fos_user:
 
 fos_oauth_server_token:
     resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml"
+
+craue_config_settings_modify:
+    path: /settings
+    defaults:
+        _controller: CraueConfigBundle:Settings:modify
index a99a7d80daac75d9b5a3f33f86a94a15eb57f6a0..6f20490b8e4d4a31f2a05ffd33d8a3ff7254f3de 100644 (file)
@@ -58,3 +58,4 @@ security:
         - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: ^/, roles: ROLE_USER }
+        - { path: ^/settings, roles: ROLE_SUPER_ADMIN }
index 073f6c27ece0f89af414f4a48a64c1e22a5fea03..3244fd3a20b45d411d1187276956a8280f506ba9 100644 (file)
@@ -27,32 +27,6 @@ parameters:
     # A secret key that's used to generate certain security-related tokens
     secret:            ThisTokenIsNotSoSecretChangeIt
 
-    # wallabag misc
-    app.version: 2.0.0-alpha
+    # two factor stuff
     twofactor_auth: true
     twofactor_sender: no-reply@wallabag.org
-
-    download_pictures: false # if true, pictures will be stored into data/assets for each article
-
-    # Entry view
-    share_twitter: true
-    share_mail: true
-    share_shaarli: true
-    shaarli_url: http://myshaarli.com
-    share_diaspora: true
-    diaspora_url: http://diasporapod.com
-    flattr: true
-    carrot: true
-    show_printlink: true
-    export_epub: true
-    export_mobi: true
-    export_pdf: true
-    export_csv: true
-    export_json: true
-    export_txt: true
-    export_xml: true
-    wallabag_url: http://v2.wallabag.org
-    wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
-
-    # pocket import
-    pocket_consumer_key: xxxxxxxx
index 24a1818a85c0a5a384bb608b8864779cedd0f05b..cee34473414dc17e8ef9120510793271ad00fc07 100644 (file)
@@ -27,32 +27,6 @@ parameters:
     # A secret key that's used to generate certain security-related tokens
     secret:            ThisTokenIsNotSoSecretChangeIt
 
-    # wallabag misc
-    app.version: 2.0.0-alpha
+    # two factor stuff
     twofactor_auth: true
     twofactor_sender: no-reply@wallabag.org
-
-    download_pictures: false # if true, pictures will be stored into data/assets for each article
-
-    # Entry view
-    share_twitter: true
-    share_mail: true
-    share_shaarli: true
-    shaarli_url: http://myshaarli.com
-    share_diaspora: true
-    diaspora_url: http://diasporapod.com
-    flattr: true
-    carrot: true
-    show_printlink: true
-    export_epub: true
-    export_mobi: true
-    export_pdf: true
-    export_csv: true
-    export_json: true
-    export_txt: true
-    export_xml: true
-    wallabag_url: http://v2.wallabag.org
-    wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
-
-    # pocket import
-    pocket_consumer_key: xxxxxxxx
index c739f89b08a213ac15c8e8ed4b46d85731e66a30..a1535bc978f79d54cc78417c68c0a951e7f3c57b 100644 (file)
@@ -27,32 +27,6 @@ parameters:
     # A secret key that's used to generate certain security-related tokens
     secret:            ThisTokenIsNotSoSecretChangeIt
 
-    # wallabag misc
-    app.version: 2.0.0-alpha
+    # two factor stuff
     twofactor_auth: true
     twofactor_sender: no-reply@wallabag.org
-
-    download_pictures: false # if true, pictures will be stored into data/assets for each article
-
-    # Entry view
-    share_twitter: true
-    share_mail: true
-    share_shaarli: true
-    shaarli_url: http://myshaarli.com
-    share_diaspora: true
-    diaspora_url: http://diasporapod.com
-    flattr: true
-    carrot: true
-    show_printlink: true
-    export_epub: true
-    export_mobi: true
-    export_pdf: true
-    export_csv: true
-    export_json: true
-    export_txt: true
-    export_xml: true
-    wallabag_url: http://v2.wallabag.org
-    wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
-
-    # pocket import
-    pocket_consumer_key: xxxxxxxx
index d84e1f8b8f1b04c6b7c25e870be4ca0f69573596..1c07c2092936c369d96862bb85b0e59f2e348af2 100644 (file)
@@ -55,7 +55,7 @@
         "lexik/form-filter-bundle": "~5.0",
         "j0k3r/graby": "~1.0",
         "friendsofsymfony/user-bundle": "dev-master",
-        "friendsofsymfony/oauth-server-bundle": "^1.5@dev",
+        "friendsofsymfony/oauth-server-bundle": "^1.5",
         "stof/doctrine-extensions-bundle": "^1.2@dev",
         "scheb/two-factor-bundle": "~2.0",
         "grandt/phpepub": "~4.0",
@@ -63,7 +63,8 @@
         "kphoen/rulerz-bundle": "~0.10",
         "guzzlehttp/guzzle": "^5.2.0",
         "doctrine/doctrine-migrations-bundle": "^1.0",
-        "paragonie/random_compat": "~1.0"
+        "paragonie/random_compat": "~1.0",
+        "craue/config-bundle": "~1.4"
     },
     "require-dev": {
         "doctrine/doctrine-fixtures-bundle": "~2.2",
index 4ece64312b66b0de467a8b6e9de338460d362c22..c7513f7960aaa6a0be9ed237bece200438ef626c 100644 (file)
@@ -163,6 +163,7 @@ class ConfigController extends Controller
                 'username' => $user->getUsername(),
                 'token' => $config->getRssToken(),
             ),
+            'twofactor_auth' => $this->getParameter('twofactor_auth'),
         ));
     }
 
index 9ada371b1c0a8f57e80072df6950a8564b8579bb..5b7bd56edc87079bafe43c39e5d27699571d518c 100644 (file)
@@ -25,7 +25,10 @@ class StaticController extends Controller
     {
         return $this->render(
             'WallabagCoreBundle:Static:about.html.twig',
-            array()
+            array(
+                'version' => $this->getParameter('wallabag_core.version'),
+                'paypal_url' => $this->getParameter('wallabag_core.paypal_url'),
+            )
         );
     }
 
index 4d5a63f86cbc6c01e2b48728a7207d0eacfa879b..bc405fdca095bd8cd430d46238f68774e723a4a9 100644 (file)
@@ -29,6 +29,10 @@ class Configuration implements ConfigurationInterface
                 ->integerNode('rss_limit')
                     ->defaultValue(50)
                 ->end()
+                ->scalarNode('version')
+                ->end()
+                ->scalarNode('paypal_url')
+                ->end()
             ->end()
         ;
 
index 73bbffe11bfeb350d7124580ed2d95007e6fa7e8..9b4703e4370f7bcda0e5241453250d804dbfd5f7 100644 (file)
@@ -19,6 +19,8 @@ class WallabagCoreExtension extends Extension
         $container->setParameter('wallabag_core.theme', $config['theme']);
         $container->setParameter('wallabag_core.language', $config['language']);
         $container->setParameter('wallabag_core.rss_limit', $config['rss_limit']);
+        $container->setParameter('wallabag_core.version', $config['version']);
+        $container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
 
         $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
         $loader->load('services.yml');
index 31a80d6e3283b12365f7fe2e228a20ffcde372b4..965a40b6a1ec190bb06c4f0bb0956fcd0f709ada 100644 (file)
@@ -8,6 +8,7 @@ use JMS\Serializer\SerializerBuilder;
 use PHPePub\Core\EPub;
 use PHPePub\Core\Structure\OPF\DublinCore;
 use Symfony\Component\HttpFoundation\Response;
+use Craue\ConfigBundle\Util\Config;
 
 /**
  * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest.
@@ -27,12 +28,12 @@ class EntriesExport
         </div';
 
     /**
-     * @param string $wallabagUrl Wallabag instance url
+     * @param Config $craueConfig CraueConfig instance to get wallabag instance url from database
      * @param string $logoPath    Path to the logo FROM THE BUNDLE SCOPE
      */
-    public function __construct($wallabagUrl, $logoPath)
+    public function __construct(Config $craueConfig, $logoPath)
     {
-        $this->wallabagUrl = $wallabagUrl;
+        $this->wallabagUrl = $craueConfig->get('wallabag_url');
         $this->logoPath = $logoPath;
     }
 
index 6a1afcc0032461a812317fb9895e70a14226b9ce..813f8a9610b42a5ccce4954006cc8a6961e06ff1 100644 (file)
@@ -3,7 +3,7 @@ services:
         class: Wallabag\CoreBundle\Helper\DetectActiveTheme
         arguments:
             - "@security.token_storage"
-            - %theme% # default theme from parameters.yml
+            - %wallabag_core.theme%
 
     # custom form type
     wallabag_core.form.type.config:
@@ -86,7 +86,7 @@ services:
     wallabag_core.helper.entries_export:
         class: Wallabag\CoreBundle\Helper\EntriesExport
         arguments:
-            - %wallabag_url%
+            - "@craue_config"
             - src/Wallabag/CoreBundle/Resources/public/themes/_global/img/appicon/apple-touch-icon-152.png
 
     wallabag.operator.array.matches:
index 20f4352b0aee68242269a95732137eaf3f1567b3..cc814cc4d07c4b085f3f4c4530d2112824a56a0c 100644 (file)
@@ -13,6 +13,7 @@ archive: 'Lus'
 all: 'Tous les articles'
 tags: 'Tags'
 config: 'Configuration'
+internal settings: 'Configuration interne'
 import: 'Importer'
 howto: 'Aide'
 logout: 'Déconnexion'
index c23d0e272540577c07360dcf12ec67a2e9aae8b8..27a88287b8550a46fad6cb8b7d1b9e92d930eba0 100644 (file)
             <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>
             <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>
             <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>
-            {% 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 %}
-            {% 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 %}
-            {% 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 %}
-            {% 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 %}
-            {#  {% 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 %} #}
-            {% 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 %}
-            {% 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 %}
-            {% if export_epub %}<li><a href="?epub&amp;method=id&amp;value={{ entry.id }}" title="Generate ePub file">EPUB</a></li>{% endif %}
-            {% if export_mobi %}<li><a href="?mobi&amp;method=id&amp;value={{ entry.id }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
-            {% if export_pdf %}<li><a href="?pdf&amp;method=id&amp;value={{ entry.id }}" title="Generate PDF file">PDF</a></li>{% endif %}
+            {% 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 %}
+            {% 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 %}
+            {% 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 %}
+            {% 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 %}
+            {% 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 %}
+            {% 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 %}
+            {% if craue_setting('export_epub') %}<li><a href="?epub&amp;method=id&amp;value={{ entry.id }}" title="Generate ePub file">EPUB</a></li>{% endif %}
+            {% if craue_setting('export_mobi') %}<li><a href="?mobi&amp;method=id&amp;value={{ entry.id }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
+            {% if craue_setting('export_pdf') %}<li><a href="?pdf&amp;method=id&amp;value={{ entry.id }}" title="Generate PDF file">PDF</a></li>{% endif %}
             <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>
         </ul>
     </div>
index 3aead49756d0503d33e47243d9ace117f1a45f65..b630070caa063c45879cf8fd33b83b643e4f0a44 100644 (file)
@@ -51,6 +51,9 @@
             </div>
         </li>
         <li><a href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li>
+        {% if is_granted('ROLE_SUPER_ADMIN') %}
+            <li><a href="{{ path('craue_config_settings_modify') }}">{% trans %}internal settings{% endtrans %}</a></li>
+        {% endif %}
         <li><a href="{{ path('import') }}">{% trans %}import{% endtrans %}</a></li>
         <li><a href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li>
         <li><a href="{{ path('about') }}">{% trans %}about{% endtrans %}</a></li>
index 31963ae826ad2ecdc5f1d682d01296dce21ef4f4..dad96187cfe8b561772b0a6791dcb44abd2bff24 100644 (file)
             </a>
             <div class="collapsible-body">
                 <ul>
-                    {% 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 %}
-                    {% 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 %}
-                    {% 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 %}
-                    {# {% 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 %} #}
-                    {% 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 %}
-                    {% 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 %}
+                    {% 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 %}
+                    {% 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 %}
+                    {% 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 %}
+                    {% 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 %}
+                    {% 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 %}
                 </ul>
             </div>
         </li>
             </a>
             <div class="collapsible-body">
                 <ul>
-                    {% if export_epub %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'epub' }) }}" title="Generate ePub file">EPUB</a></li>{% endif %}
-                    {% if export_mobi %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'mobi' }) }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
-                    {% if export_pdf %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %}
-                    {% if export_csv %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>{% endif %}
-                    {% if export_json %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'json' }) }}" title="Generate JSON file">JSON</a></li>{% endif %}
-                    {% if export_txt %}<li><del><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'txt' }) }}" title="Generate TXT file">TXT</a></del></li>{% endif %}
-                    {% if export_xml %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'xml' }) }}" title="Generate XML file">XML</a></li>{% endif %}
+                    {% if craue_setting('export_epub') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'epub' }) }}" title="Generate ePub file">EPUB</a></li>{% endif %}
+                    {% if craue_setting('export_mobi') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'mobi' }) }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
+                    {% if craue_setting('export_pdf') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %}
+                    {% if craue_setting('export_csv') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>{% endif %}
+                    {% if craue_setting('export_json') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'json' }) }}" title="Generate JSON file">JSON</a></li>{% endif %}
+                    {% 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 %}
+                    {% if craue_setting('export_xml') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'xml' }) }}" title="Generate XML file">XML</a></li>{% endif %}
                 </ul>
             </div>
         </li>
index a8b6dc3f66ae66ddfe23cf58d80f3527f322e3a0..dff9e61278528eaa9c2ca86545ffec115676f4d1 100644 (file)
@@ -45,6 +45,9 @@
             <li class="bold border-bottom {% if currentRoute == 'all' %}active{% endif %}"><a class="waves-effect" href="{{ path('all') }}">{% trans %}all{% endtrans %}</a></li>
             <li class="bold border-bottom {% if currentRoute == 'tags' %}active{% endif %}"><a class="waves-effect" href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li>
             <li class="bold {% if currentRoute == 'config' %}active{% endif %}"><a class="waves-effect" href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li>
+            {% if is_granted('ROLE_SUPER_ADMIN') %}
+                <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>
+            {% endif %}
             <li class="bold {% if currentRoute == 'import' %}active{% endif %}"><a class="waves-effect" href="{{ path('import') }}">{% trans %}import{% endtrans %}</a></li>
             <li class="bold {% if currentRoute == 'howto' %}active{% endif %}"><a class="waves-effect" href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li>
             <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>
index 72b9047c8fdc3acc39267b67a4af11adc31f2634..0463a7399804d1b367cc251dbf65768b268ae3fc 100644 (file)
@@ -11,6 +11,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
 use Wallabag\CoreBundle\Entity\Entry;
 use Wallabag\CoreBundle\Entity\Tag;
 use Wallabag\CoreBundle\Helper\ContentProxy;
+use Craue\ConfigBundle\Util\Config;
 
 class PocketImport implements ImportInterface
 {
@@ -25,12 +26,12 @@ class PocketImport implements ImportInterface
     protected $accessToken;
     private $translator;
 
-    public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, $consumerKey)
+    public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, Config $craueConfig)
     {
         $this->user = $tokenStorage->getToken()->getUser();
         $this->em = $em;
         $this->contentProxy = $contentProxy;
-        $this->consumerKey = $consumerKey;
+        $this->consumerKey = $craueConfig->get('pocket_consumer_key');
         $this->logger = new NullLogger();
     }
 
index e4dde1003b07087ea33e4154833096fc4c737faf..dc53680802815be3b93dd04a9bab59bafbe38fd3 100644 (file)
@@ -17,7 +17,7 @@ services:
             - "@security.token_storage"
             - "@doctrine.orm.entity_manager"
             - "@wallabag_core.content_proxy"
-            - %pocket_consumer_key%
+            - "@craue_config"
         calls:
             - [ setClient, [ "@wallabag_import.pocket.client" ] ]
             - [ setLogger, [ "@logger" ]]
index 76225fe4f21be2b119f7b17b9c247a7e5f3d1dc4..25359d56bb1b7d7db5c1bb6dec3012972d960b36 100644 (file)
@@ -55,11 +55,20 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
 
+        $config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $config->expects($this->any())
+            ->method('get')
+            ->with('pocket_consumer_key')
+            ->willReturn($consumerKey);
+
         $pocket = new PocketImportMock(
             $this->tokenStorage,
             $this->em,
             $this->contentProxy,
-            $consumerKey
+            $config
         );
 
         $this->logHandler = new TestHandler();
index 6b108dd3ef2a7605720b3cab8c451e45557c8f88..4ab6051b6a0056191896792b9c90a9024c5fbd3e 100644 (file)
@@ -4,6 +4,7 @@ namespace Wallabag\UserBundle\Mailer;
 
 use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
 use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface;
+use Craue\ConfigBundle\Util\Config;
 
 /**
  * Custom mailer for TwoFactorBundle email.
@@ -60,17 +61,16 @@ class AuthCodeMailer implements AuthCodeMailerInterface
      * @param \Twig_Environment $twig
      * @param string            $senderEmail
      * @param string            $senderName
-     * @param string            $supportUrl
-     * @param string            $wallabagUrl
+     * @param Config            $craueConfig Craue\Config instance to get wallabag support url from database
      */
-    public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl)
+    public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, Config $craueConfig)
     {
         $this->mailer = $mailer;
         $this->twig = $twig;
         $this->senderEmail = $senderEmail;
         $this->senderName = $senderName;
-        $this->supportUrl = $supportUrl;
-        $this->wallabagUrl = $wallabagUrl;
+        $this->supportUrl = $craueConfig->get('wallabag_support_url');
+        $this->wallabagUrl = $craueConfig->get('wallabag_url');
     }
 
     /**
index bf9e036ae64a9b1dea8997afe1e3168486cfc596..d79d8fa2bacf2a5ecc1823e29d5a108ee7ba4b62 100644 (file)
@@ -6,8 +6,7 @@ services:
             - "@twig"
             - "%scheb_two_factor.email.sender_email%"
             - "%scheb_two_factor.email.sender_name%"
-            - "%wallabag_support_url%"
-            - "%wallabag_url%"
+            - "@craue_config"
 
     wallabag_user.password_resetting:
         class: Wallabag\UserBundle\EventListener\PasswordResettingListener