From b0b893eafd3c1d66b8681a4a6420603af42ec084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 20 Jan 2016 16:24:48 +0100 Subject: [#1604] First draft to fix SensioLabsInsight report --- app/config/parameters.yml.dist | 4 +- app/config/tests/parameters.yml.dist.mysql | 2 + app/config/tests/parameters.yml.dist.pgsql | 2 + app/config/tests/parameters.yml.dist.sqlite | 2 + .../Controller/WallabagRestController.php | 2 +- .../DependencyInjection/Configuration.php | 4 - src/Wallabag/CoreBundle/Command/InstallCommand.php | 1 - .../CoreBundle/Controller/EntryController.php | 2 +- src/Wallabag/CoreBundle/Filter/EntryFilterType.php | 98 ---------------------- .../CoreBundle/Form/Type/EditEntryType.php | 5 -- .../CoreBundle/Form/Type/EntryFilterType.php | 98 ++++++++++++++++++++++ .../CoreBundle/Resources/config/services.yml | 2 +- .../Resources/public/themes/baggy/css/main.css | 2 +- .../Resources/views/themes/baggy/README.md | 0 .../views/themes/baggy/Static/about.html.twig | 0 .../Resources/views/themes/material/README.md | 0 .../views/themes/material/Static/about.html.twig | 0 src/Wallabag/ImportBundle/Import/PocketImport.php | 4 - 18 files changed, 111 insertions(+), 117 deletions(-) delete mode 100644 src/Wallabag/CoreBundle/Filter/EntryFilterType.php create mode 100644 src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php mode change 100755 => 100644 src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md mode change 100755 => 100644 src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/about.html.twig mode change 100755 => 100644 src/Wallabag/CoreBundle/Resources/views/themes/material/README.md mode change 100755 => 100644 src/Wallabag/CoreBundle/Resources/views/themes/material/Static/about.html.twig diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 0c0cbff1..11d31b24 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -31,11 +31,13 @@ parameters: mailer_host: 127.0.0.1 mailer_user: ~ mailer_password: ~ + switftmailer_username: null + switftmailer_password: null locale: en # A secret key that's used to generate certain security-related tokens - secret: ThisTokenIsNotSoSecretChangeIt + secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv # wallabag misc app.version: 2.0.0-alpha diff --git a/app/config/tests/parameters.yml.dist.mysql b/app/config/tests/parameters.yml.dist.mysql index 88b1d2b4..bd45f091 100644 --- a/app/config/tests/parameters.yml.dist.mysql +++ b/app/config/tests/parameters.yml.dist.mysql @@ -21,6 +21,8 @@ parameters: mailer_host: 127.0.0.1 mailer_user: ~ mailer_password: ~ + switftmailer_username: null + switftmailer_password: null locale: en diff --git a/app/config/tests/parameters.yml.dist.pgsql b/app/config/tests/parameters.yml.dist.pgsql index 3c61142d..8352a1ad 100644 --- a/app/config/tests/parameters.yml.dist.pgsql +++ b/app/config/tests/parameters.yml.dist.pgsql @@ -21,6 +21,8 @@ parameters: mailer_host: 127.0.0.1 mailer_user: ~ mailer_password: ~ + switftmailer_username: null + switftmailer_password: null locale: en diff --git a/app/config/tests/parameters.yml.dist.sqlite b/app/config/tests/parameters.yml.dist.sqlite index 2f7699b5..617e9f04 100644 --- a/app/config/tests/parameters.yml.dist.sqlite +++ b/app/config/tests/parameters.yml.dist.sqlite @@ -21,6 +21,8 @@ parameters: mailer_host: 127.0.0.1 mailer_user: ~ mailer_password: ~ + switftmailer_username: null + switftmailer_password: null locale: en diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index d9035cac..84bc14a9 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -9,6 +9,7 @@ use Nelmio\ApiDocBundle\Annotation\ApiDoc; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; @@ -73,7 +74,6 @@ class WallabagRestController extends FOSRestController $order = $request->query->get('order', 'desc'); $page = (int) $request->query->get('page', 1); $perPage = (int) $request->query->get('perPage', 30); - $tags = $request->query->get('tags', []); $pager = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Entry') diff --git a/src/Wallabag/ApiBundle/DependencyInjection/Configuration.php b/src/Wallabag/ApiBundle/DependencyInjection/Configuration.php index cec45412..f70a5835 100644 --- a/src/Wallabag/ApiBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/ApiBundle/DependencyInjection/Configuration.php @@ -20,10 +20,6 @@ class Configuration implements ConfigurationInterface $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('wallabag_api'); - // Here you should define the parameters that are allowed to - // configure your bundle. See the documentation linked above for - // more information on that topic. - return $treeBuilder; } } diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index da099a19..63032dbb 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -64,7 +64,6 @@ class InstallCommand extends ContainerAwareCommand $fulfilled = true; - // @TODO: find a better way to check requirements $label = 'PCRE'; if (extension_loaded('pcre')) { $status = 'OK!'; diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 3e1b512f..747976e3 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -9,7 +9,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\CoreBundle\Filter\EntryFilterType; +use Wallabag\CoreBundle\Form\Type\EntryFilterType; use Wallabag\CoreBundle\Form\Type\EditEntryType; use Wallabag\CoreBundle\Form\Type\NewEntryType; diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php deleted file mode 100644 index c38be832..00000000 --- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php +++ /dev/null @@ -1,98 +0,0 @@ -repository = $entryRepository; - $this->user = $token->getToken()->getUser(); - } - - public function buildForm(FormBuilderInterface $builder, array $options) - { - $builder - ->add('readingTime', NumberRangeFilterType::class) - ->add('createdAt', DateRangeFilterType::class, array( - 'left_date_options' => array( - 'attr' => array( - 'placeholder' => 'dd/mm/yyyy', - ), - 'format' => 'dd/MM/yyyy', - 'widget' => 'single_text', - ), - 'right_date_options' => array( - 'attr' => array( - 'placeholder' => 'dd/mm/yyyy', - ), - 'format' => 'dd/MM/yyyy', - 'widget' => 'single_text', - ), - ) - ) - ->add('domainName', TextFilterType::class, array( - 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { - $value = $values['value']; - if (strlen($value) <= 2 || empty($value)) { - return; - } - $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); - - return $filterQuery->createCondition($expression); - }, - )) - ->add('isArchived', CheckboxFilterType::class) - ->add('isStarred', CheckboxFilterType::class) - ->add('previewPicture', CheckboxFilterType::class, array( - 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { - if (false === $values['value']) { - return; - } - - $expression = $filterQuery->getExpr()->isNotNull($field); - - return $filterQuery->createCondition($expression); - }, - )) - ->add('language', ChoiceFilterType::class, array( - 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), - 'choices_as_values' => true, - )) - ; - } - - public function getBlockPrefix() - { - return 'entry_filter'; - } - - public function configureOptions(OptionsResolver $resolver) - { - $resolver->setDefaults(array( - 'csrf_protection' => false, - 'validation_groups' => array('filtering'), - )); - } -} diff --git a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php index 0cb29881..2b1e1ef4 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EditEntryType.php @@ -16,11 +16,6 @@ class EditEntryType extends AbstractType $builder ->add('title', TextType::class, array('required' => true)) ->add('is_public', CheckboxType::class, array('required' => false)) - // @todo: add autocomplete - // ->add('tags', 'entity', array( - // 'class' => 'Wallabag\CoreBundle\Entity\Tag', - // 'choice_translation_domain' => true, - // )) ->add('save', SubmitType::class) ; } diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php new file mode 100644 index 00000000..ee10bc8b --- /dev/null +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -0,0 +1,98 @@ +repository = $entryRepository; + $this->user = $token->getToken()->getUser(); + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('readingTime', NumberRangeFilterType::class) + ->add('createdAt', DateRangeFilterType::class, array( + 'left_date_options' => array( + 'attr' => array( + 'placeholder' => 'dd/mm/yyyy', + ), + 'format' => 'dd/MM/yyyy', + 'widget' => 'single_text', + ), + 'right_date_options' => array( + 'attr' => array( + 'placeholder' => 'dd/mm/yyyy', + ), + 'format' => 'dd/MM/yyyy', + 'widget' => 'single_text', + ), + ) + ) + ->add('domainName', TextFilterType::class, array( + 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { + $value = $values['value']; + if (strlen($value) <= 2 || empty($value)) { + return; + } + $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); + + return $filterQuery->createCondition($expression); + }, + )) + ->add('isArchived', CheckboxFilterType::class) + ->add('isStarred', CheckboxFilterType::class) + ->add('previewPicture', CheckboxFilterType::class, array( + 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { + if (false === $values['value']) { + return; + } + + $expression = $filterQuery->getExpr()->isNotNull($field); + + return $filterQuery->createCondition($expression); + }, + )) + ->add('language', ChoiceFilterType::class, array( + 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), + 'choices_as_values' => true, + )) + ; + } + + public function getBlockPrefix() + { + return 'entry_filter'; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'csrf_protection' => false, + 'validation_groups' => array('filtering'), + )); + } +} diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 25d71cba..7d24d488 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -15,7 +15,7 @@ services: - { name: form.type } wallabag_core.filter.type.entry: - class: Wallabag\CoreBundle\Filter\EntryFilterType + class: Wallabag\CoreBundle\Form\Type\EntryFilterType arguments: - "@wallabag_core.entry_repository" - "@security.token_storage" diff --git a/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css b/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css index d3f92926..62f2964c 100755 --- a/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css +++ b/src/Wallabag/CoreBundle/Resources/public/themes/baggy/css/main.css @@ -564,7 +564,7 @@ img.preview { height: 100%; width: 100%; margin: 0; - margin-top: -30% !important; /* TODO: get rid of !important here; overridden by .messages selector */ + margin-top: -30% !important; padding: 2em; display: none; border-left: 1px #EEE solid; diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md old mode 100755 new mode 100644 diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/about.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/about.html.twig old mode 100755 new mode 100644 diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md b/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md old mode 100755 new mode 100644 diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/about.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/about.html.twig old mode 100755 new mode 100644 diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 72b9047c..617d5514 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -23,7 +23,6 @@ class PocketImport implements ImportInterface private $skippedEntries = 0; private $importedEntries = 0; protected $accessToken; - private $translator; public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, $consumerKey) { @@ -177,9 +176,6 @@ class PocketImport implements ImportInterface $this->client = $client; } - /** - * @todo move that in a more global place - */ private function assignTagsToEntry(Entry $entry, $tags) { foreach ($tags as $tag) { -- cgit v1.2.3 From 5f8a785719c1dfeacc0bccc0781a94bd396b80ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 20 Jan 2016 17:16:17 +0100 Subject: SensioLabsInsight fixes --- app/config/parameters.yml.dist | 2 -- app/config/tests/parameters.yml.dist.mysql | 2 -- app/config/tests/parameters.yml.dist.pgsql | 2 -- app/config/tests/parameters.yml.dist.sqlite | 2 -- src/Wallabag/CoreBundle/Controller/ConfigController.php | 2 +- src/Wallabag/CoreBundle/Controller/EntryController.php | 2 +- .../CoreBundle/Resources/views/themes/baggy/README.md | 2 +- .../Resources/views/themes/material/README.md | 2 +- web/favicon.ico | Bin 0 -> 34494 bytes 9 files changed, 4 insertions(+), 12 deletions(-) create mode 100644 web/favicon.ico diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 11d31b24..e474ec07 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -31,8 +31,6 @@ parameters: mailer_host: 127.0.0.1 mailer_user: ~ mailer_password: ~ - switftmailer_username: null - switftmailer_password: null locale: en diff --git a/app/config/tests/parameters.yml.dist.mysql b/app/config/tests/parameters.yml.dist.mysql index bd45f091..88b1d2b4 100644 --- a/app/config/tests/parameters.yml.dist.mysql +++ b/app/config/tests/parameters.yml.dist.mysql @@ -21,8 +21,6 @@ parameters: mailer_host: 127.0.0.1 mailer_user: ~ mailer_password: ~ - switftmailer_username: null - switftmailer_password: null locale: en diff --git a/app/config/tests/parameters.yml.dist.pgsql b/app/config/tests/parameters.yml.dist.pgsql index 8352a1ad..3c61142d 100644 --- a/app/config/tests/parameters.yml.dist.pgsql +++ b/app/config/tests/parameters.yml.dist.pgsql @@ -21,8 +21,6 @@ parameters: mailer_host: 127.0.0.1 mailer_user: ~ mailer_password: ~ - switftmailer_username: null - switftmailer_password: null locale: en diff --git a/app/config/tests/parameters.yml.dist.sqlite b/app/config/tests/parameters.yml.dist.sqlite index 617e9f04..2f7699b5 100644 --- a/app/config/tests/parameters.yml.dist.sqlite +++ b/app/config/tests/parameters.yml.dist.sqlite @@ -21,8 +21,6 @@ parameters: mailer_host: 127.0.0.1 mailer_user: ~ mailer_password: ~ - switftmailer_username: null - switftmailer_password: null locale: en diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 6c375909..b01aaa7f 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -198,7 +198,7 @@ class ConfigController extends Controller * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - public function deleteTaggingRule(TaggingRule $rule) + public function deleteTaggingRuleAction(TaggingRule $rule) { if ($this->getUser()->getId() != $rule->getConfig()->getUser()->getId()) { throw $this->createAccessDeniedException('You can not access this tagging ryle.'); diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 747976e3..ea77d138 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -81,7 +81,7 @@ class EntryController extends Controller * * @return \Symfony\Component\HttpFoundation\Response */ - public function addEntryViaBookmarklet(Request $request) + public function addEntryViaBookmarkletAction(Request $request) { $entry = new Entry($this->getUser()); $entry->setUrl($request->get('url')); diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md index 1f0054a4..3db07873 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/README.md @@ -1,3 +1,3 @@ # Baggy Theme -theme created by Thomas LEBEAU alias Courgette http://thomaslebeau.fr/ \ No newline at end of file +theme created by Thomas LEBEAU alias Courgette http://thomaslebeau.fr/ diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md b/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md index 534eea30..54e8a0e2 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/README.md @@ -2,4 +2,4 @@ Theme created by Danilow (@modos189) Alexandr http://modos189.ru/ -Used framework http://materializecss.com/ \ No newline at end of file +Used framework http://materializecss.com/ diff --git a/web/favicon.ico b/web/favicon.ico new file mode 100644 index 00000000..0346558b Binary files /dev/null and b/web/favicon.ico differ -- cgit v1.2.3