diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-12-22 13:00:37 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-15 09:35:38 +0100 |
commit | 5c895a7fd15822856fb407910264c5d95e1e223c (patch) | |
tree | a850ff9ccfd8067d4f8cdd341a2dda4324008afa /src/Wallabag/CoreBundle | |
parent | 619cc45359ead519b64129181a07e14160fbbfcb (diff) | |
download | wallabag-5c895a7fd15822856fb407910264c5d95e1e223c.tar.gz wallabag-5c895a7fd15822856fb407910264c5d95e1e223c.tar.zst wallabag-5c895a7fd15822856fb407910264c5d95e1e223c.zip |
Update bundle & stock file
- update stock file (AppKernel, app.php, etc ..) from SymfonyStandard edition)
- update bundle to latest release
- remove security on profiler
Diffstat (limited to 'src/Wallabag/CoreBundle')
10 files changed, 35 insertions, 38 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index f51ccaa4..d0cf91de 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -8,6 +8,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; | |||
8 | use Symfony\Component\HttpFoundation\Request; | 8 | use Symfony\Component\HttpFoundation\Request; |
9 | use Wallabag\CoreBundle\Entity\Config; | 9 | use Wallabag\CoreBundle\Entity\Config; |
10 | use Wallabag\CoreBundle\Entity\TaggingRule; | 10 | use Wallabag\CoreBundle\Entity\TaggingRule; |
11 | use Wallabag\CoreBundle\Form\Type\ConfigType; | ||
11 | use Wallabag\CoreBundle\Form\Type\ChangePasswordType; | 12 | use Wallabag\CoreBundle\Form\Type\ChangePasswordType; |
12 | use Wallabag\CoreBundle\Form\Type\NewUserType; | 13 | use Wallabag\CoreBundle\Form\Type\NewUserType; |
13 | use Wallabag\CoreBundle\Form\Type\RssType; | 14 | use Wallabag\CoreBundle\Form\Type\RssType; |
@@ -31,7 +32,7 @@ class ConfigController extends Controller | |||
31 | $user = $this->getUser(); | 32 | $user = $this->getUser(); |
32 | 33 | ||
33 | // handle basic config detail (this form is defined as a service) | 34 | // handle basic config detail (this form is defined as a service) |
34 | $configForm = $this->createForm('config', $config, array('action' => $this->generateUrl('config'))); | 35 | $configForm = $this->createForm(ConfigType::class, $config, array('action' => $this->generateUrl('config'))); |
35 | $configForm->handleRequest($request); | 36 | $configForm->handleRequest($request); |
36 | 37 | ||
37 | if ($configForm->isValid()) { | 38 | if ($configForm->isValid()) { |
@@ -51,7 +52,7 @@ class ConfigController extends Controller | |||
51 | } | 52 | } |
52 | 53 | ||
53 | // handle changing password | 54 | // handle changing password |
54 | $pwdForm = $this->createForm(new ChangePasswordType(), null, array('action' => $this->generateUrl('config').'#set4')); | 55 | $pwdForm = $this->createForm(ChangePasswordType::class, null, array('action' => $this->generateUrl('config').'#set4')); |
55 | $pwdForm->handleRequest($request); | 56 | $pwdForm->handleRequest($request); |
56 | 57 | ||
57 | if ($pwdForm->isValid()) { | 58 | if ($pwdForm->isValid()) { |
@@ -67,7 +68,7 @@ class ConfigController extends Controller | |||
67 | } | 68 | } |
68 | 69 | ||
69 | // handle changing user information | 70 | // handle changing user information |
70 | $userForm = $this->createForm(new UserInformationType(), $user, array( | 71 | $userForm = $this->createForm(UserInformationType::class, $user, array( |
71 | 'validation_groups' => array('Profile'), | 72 | 'validation_groups' => array('Profile'), |
72 | 'action' => $this->generateUrl('config').'#set3', | 73 | 'action' => $this->generateUrl('config').'#set3', |
73 | )); | 74 | )); |
@@ -85,7 +86,7 @@ class ConfigController extends Controller | |||
85 | } | 86 | } |
86 | 87 | ||
87 | // handle rss information | 88 | // handle rss information |
88 | $rssForm = $this->createForm(new RssType(), $config, array('action' => $this->generateUrl('config').'#set2')); | 89 | $rssForm = $this->createForm(RssType::class, $config, array('action' => $this->generateUrl('config').'#set2')); |
89 | $rssForm->handleRequest($request); | 90 | $rssForm->handleRequest($request); |
90 | 91 | ||
91 | if ($rssForm->isValid()) { | 92 | if ($rssForm->isValid()) { |
@@ -102,7 +103,7 @@ class ConfigController extends Controller | |||
102 | 103 | ||
103 | // handle tagging rule | 104 | // handle tagging rule |
104 | $taggingRule = new TaggingRule(); | 105 | $taggingRule = new TaggingRule(); |
105 | $newTaggingRule = $this->createForm(new TaggingRuleType(), $taggingRule, array('action' => $this->generateUrl('config').'#set5')); | 106 | $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, array('action' => $this->generateUrl('config').'#set5')); |
106 | $newTaggingRule->handleRequest($request); | 107 | $newTaggingRule->handleRequest($request); |
107 | 108 | ||
108 | if ($newTaggingRule->isValid()) { | 109 | if ($newTaggingRule->isValid()) { |
@@ -122,7 +123,7 @@ class ConfigController extends Controller | |||
122 | $newUser = $userManager->createUser(); | 123 | $newUser = $userManager->createUser(); |
123 | // enable created user by default | 124 | // enable created user by default |
124 | $newUser->setEnabled(true); | 125 | $newUser->setEnabled(true); |
125 | $newUserForm = $this->createForm(new NewUserType(), $newUser, array( | 126 | $newUserForm = $this->createForm(NewUserType::class, $newUser, array( |
126 | 'validation_groups' => array('Profile'), | 127 | 'validation_groups' => array('Profile'), |
127 | 'action' => $this->generateUrl('config').'#set5', | 128 | 'action' => $this->generateUrl('config').'#set5', |
128 | )); | 129 | )); |
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index c1b5a71b..83e5b57d 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -43,7 +43,7 @@ class EntryController extends Controller | |||
43 | { | 43 | { |
44 | $entry = new Entry($this->getUser()); | 44 | $entry = new Entry($this->getUser()); |
45 | 45 | ||
46 | $form = $this->createForm(new NewEntryType(), $entry); | 46 | $form = $this->createForm(NewEntryType::class, $entry); |
47 | 47 | ||
48 | $form->handleRequest($request); | 48 | $form->handleRequest($request); |
49 | 49 | ||
@@ -117,7 +117,7 @@ class EntryController extends Controller | |||
117 | { | 117 | { |
118 | $this->checkUserAction($entry); | 118 | $this->checkUserAction($entry); |
119 | 119 | ||
120 | $form = $this->createForm(new EditEntryType(), $entry); | 120 | $form = $this->createForm(EditEntryType::class, $entry); |
121 | 121 | ||
122 | $form->handleRequest($request); | 122 | $form->handleRequest($request); |
123 | 123 | ||
@@ -234,7 +234,7 @@ class EntryController extends Controller | |||
234 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); | 234 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); |
235 | } | 235 | } |
236 | 236 | ||
237 | $form = $this->get('form.factory')->create(new EntryFilterType($repository, $this->getUser())); | 237 | $form = $this->createForm(new EntryFilterType($repository, $this->getUser())); |
238 | 238 | ||
239 | if ($request->query->has($form->getName())) { | 239 | if ($request->query->has($form->getName())) { |
240 | // manually bind values from the request | 240 | // manually bind values from the request |
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 682cc6e6..ff4d64a8 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -21,7 +21,7 @@ class TagController extends Controller | |||
21 | public function addTagFormAction(Request $request, Entry $entry) | 21 | public function addTagFormAction(Request $request, Entry $entry) |
22 | { | 22 | { |
23 | $tag = new Tag(); | 23 | $tag = new Tag(); |
24 | $form = $this->createForm(new NewTagType(), $tag); | 24 | $form = $this->createForm(NewTagType::class, $tag); |
25 | $form->handleRequest($request); | 25 | $form->handleRequest($request); |
26 | 26 | ||
27 | if ($form->isValid()) { | 27 | if ($form->isValid()) { |
diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php index e0a1cb31..4430c971 100644 --- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php | |||
@@ -4,6 +4,11 @@ namespace Wallabag\CoreBundle\Filter; | |||
4 | 4 | ||
5 | use Doctrine\ORM\EntityRepository; | 5 | use Doctrine\ORM\EntityRepository; |
6 | use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; | 6 | use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; |
7 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\NumberRangeFilterType; | ||
8 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\DateRangeFilterType; | ||
9 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\TextFilterType; | ||
10 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\CheckboxFilterType; | ||
11 | use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; | ||
7 | use Symfony\Component\Form\AbstractType; | 12 | use Symfony\Component\Form\AbstractType; |
8 | use Symfony\Component\Form\FormBuilderInterface; | 13 | use Symfony\Component\Form\FormBuilderInterface; |
9 | use Symfony\Component\OptionsResolver\OptionsResolver; | 14 | use Symfony\Component\OptionsResolver\OptionsResolver; |
@@ -29,8 +34,8 @@ class EntryFilterType extends AbstractType | |||
29 | public function buildForm(FormBuilderInterface $builder, array $options) | 34 | public function buildForm(FormBuilderInterface $builder, array $options) |
30 | { | 35 | { |
31 | $builder | 36 | $builder |
32 | ->add('readingTime', 'filter_number_range') | 37 | ->add('readingTime', NumberRangeFilterType::class) |
33 | ->add('createdAt', 'filter_date_range', array( | 38 | ->add('createdAt', DateRangeFilterType::class, array( |
34 | 'left_date_options' => array( | 39 | 'left_date_options' => array( |
35 | 'attr' => array( | 40 | 'attr' => array( |
36 | 'placeholder' => 'dd/mm/yyyy', | 41 | 'placeholder' => 'dd/mm/yyyy', |
@@ -47,7 +52,7 @@ class EntryFilterType extends AbstractType | |||
47 | ), | 52 | ), |
48 | ) | 53 | ) |
49 | ) | 54 | ) |
50 | ->add('domainName', 'filter_text', array( | 55 | ->add('domainName', TextFilterType::class, array( |
51 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | 56 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
52 | $value = $values['value']; | 57 | $value = $values['value']; |
53 | if (strlen($value) <= 2 || empty($value)) { | 58 | if (strlen($value) <= 2 || empty($value)) { |
@@ -58,9 +63,9 @@ class EntryFilterType extends AbstractType | |||
58 | return $filterQuery->createCondition($expression); | 63 | return $filterQuery->createCondition($expression); |
59 | }, | 64 | }, |
60 | )) | 65 | )) |
61 | ->add('isArchived', 'filter_checkbox') | 66 | ->add('isArchived', CheckboxFilterType::class) |
62 | ->add('isStarred', 'filter_checkbox') | 67 | ->add('isStarred', CheckboxFilterType::class) |
63 | ->add('previewPicture', 'filter_checkbox', array( | 68 | ->add('previewPicture', CheckboxFilterType::class, array( |
64 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { | 69 | 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { |
65 | if (false === $values['value']) { | 70 | if (false === $values['value']) { |
66 | return; | 71 | return; |
@@ -71,8 +76,9 @@ class EntryFilterType extends AbstractType | |||
71 | return $filterQuery->createCondition($expression); | 76 | return $filterQuery->createCondition($expression); |
72 | }, | 77 | }, |
73 | )) | 78 | )) |
74 | ->add('language', 'filter_choice', array( | 79 | ->add('language', ChoiceFilterType::class, array( |
75 | 'choices' => $this->repository->findDistinctLanguageByUser($this->user->getId()), | 80 | 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), |
81 | 'choices_as_values' => true, | ||
76 | )) | 82 | )) |
77 | ; | 83 | ; |
78 | } | 84 | } |
diff --git a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php index 615b8169..7d05a5d8 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ChangePasswordType.php | |||
@@ -19,7 +19,7 @@ class ChangePasswordType extends AbstractType | |||
19 | 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')), | 19 | 'constraints' => new UserPassword(array('message' => 'Wrong value for your current password')), |
20 | )) | 20 | )) |
21 | ->add('new_password', RepeatedType::class, array( | 21 | ->add('new_password', RepeatedType::class, array( |
22 | 'type' => 'password', | 22 | 'type' => PasswordType::class, |
23 | 'invalid_message' => 'The password fields must match.', | 23 | 'invalid_message' => 'The password fields must match.', |
24 | 'required' => true, | 24 | 'required' => true, |
25 | 'first_options' => array('label' => 'New password'), | 25 | 'first_options' => array('label' => 'New password'), |
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 88082a04..a139f2df 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php | |||
@@ -36,7 +36,8 @@ class ConfigType extends AbstractType | |||
36 | )) | 36 | )) |
37 | ->add('items_per_page') | 37 | ->add('items_per_page') |
38 | ->add('language', ChoiceType::class, array( | 38 | ->add('language', ChoiceType::class, array( |
39 | 'choices' => $this->languages, | 39 | 'choices' => array_flip($this->languages), |
40 | 'choices_as_values' => true, | ||
40 | )) | 41 | )) |
41 | ->add('save', SubmitType::class) | 42 | ->add('save', SubmitType::class) |
42 | ; | 43 | ; |
diff --git a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php index e6fff976..ffbe9ba2 100644 --- a/src/Wallabag/CoreBundle/Form/Type/NewUserType.php +++ b/src/Wallabag/CoreBundle/Form/Type/NewUserType.php | |||
@@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type; | |||
4 | 4 | ||
5 | use Symfony\Component\Form\AbstractType; | 5 | use Symfony\Component\Form\AbstractType; |
6 | use Symfony\Component\Form\Extension\Core\Type\EmailType; | 6 | use Symfony\Component\Form\Extension\Core\Type\EmailType; |
7 | use Symfony\Component\Form\Extension\Core\Type\PasswordType; | ||
7 | use Symfony\Component\Form\Extension\Core\Type\RepeatedType; | 8 | use Symfony\Component\Form\Extension\Core\Type\RepeatedType; |
8 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | 9 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
9 | use Symfony\Component\Form\Extension\Core\Type\TextType; | 10 | use Symfony\Component\Form\Extension\Core\Type\TextType; |
@@ -18,7 +19,7 @@ class NewUserType extends AbstractType | |||
18 | $builder | 19 | $builder |
19 | ->add('username', TextType::class, array('required' => true)) | 20 | ->add('username', TextType::class, array('required' => true)) |
20 | ->add('plainPassword', RepeatedType::class, array( | 21 | ->add('plainPassword', RepeatedType::class, array( |
21 | 'type' => 'password', | 22 | 'type' => PasswordType::class, |
22 | 'constraints' => array( | 23 | 'constraints' => array( |
23 | new Constraints\Length(array( | 24 | new Constraints\Length(array( |
24 | 'min' => 8, | 25 | 'min' => 8, |
diff --git a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php index 296cec9e..5815b8c6 100644 --- a/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php +++ b/src/Wallabag/CoreBundle/Form/Type/TaggingRuleType.php | |||
@@ -19,7 +19,7 @@ class TaggingRuleType extends AbstractType | |||
19 | ; | 19 | ; |
20 | 20 | ||
21 | $tagsField = $builder | 21 | $tagsField = $builder |
22 | ->create('tags', 'text') | 22 | ->create('tags', TextType::class) |
23 | ->addModelTransformer(new StringToListTransformer(',')); | 23 | ->addModelTransformer(new StringToListTransformer(',')); |
24 | 24 | ||
25 | $builder->add($tagsField); | 25 | $builder->add($tagsField); |
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 80f737f8..e8dafc5d 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -12,19 +12,7 @@ services: | |||
12 | - %liip_theme.themes% | 12 | - %liip_theme.themes% |
13 | - %wallabag_core.languages% | 13 | - %wallabag_core.languages% |
14 | tags: | 14 | tags: |
15 | - { name: form.type, alias: config } | 15 | - { name: form.type } |
16 | |||
17 | wallabag_core.form.registration: | ||
18 | class: Wallabag\CoreBundle\Form\Type\RegistrationType | ||
19 | tags: | ||
20 | - { name: form.type, alias: wallabag_user_registration } | ||
21 | |||
22 | wallabag_core.form.type.forgot_password: | ||
23 | class: Wallabag\CoreBundle\Form\Type\ForgotPasswordType | ||
24 | arguments: | ||
25 | - "@doctrine" | ||
26 | tags: | ||
27 | - { name: form.type, alias: forgot_password } | ||
28 | 16 | ||
29 | wallabag_core.param_converter.username_rsstoken_converter: | 17 | wallabag_core.param_converter.username_rsstoken_converter: |
30 | class: Wallabag\CoreBundle\ParamConverter\UsernameRssTokenConverter | 18 | class: Wallabag\CoreBundle\ParamConverter\UsernameRssTokenConverter |
@@ -66,13 +54,13 @@ services: | |||
66 | # repository as a service | 54 | # repository as a service |
67 | wallabag_core.entry_repository: | 55 | wallabag_core.entry_repository: |
68 | class: Wallabag\CoreBundle\Repository\EntryRepository | 56 | class: Wallabag\CoreBundle\Repository\EntryRepository |
69 | factory: [ @doctrine.orm.default_entity_manager, getRepository ] | 57 | factory: [ "@doctrine.orm.default_entity_manager", getRepository ] |
70 | arguments: | 58 | arguments: |
71 | - WallabagCoreBundle:Entry | 59 | - WallabagCoreBundle:Entry |
72 | 60 | ||
73 | wallabag_core.tag_repository: | 61 | wallabag_core.tag_repository: |
74 | class: Wallabag\CoreBundle\Repository\TagRepository | 62 | class: Wallabag\CoreBundle\Repository\TagRepository |
75 | factory: [ @doctrine.orm.default_entity_manager, getRepository ] | 63 | factory: [ "@doctrine.orm.default_entity_manager", getRepository ] |
76 | arguments: | 64 | arguments: |
77 | - WallabagCoreBundle:Tag | 65 | - WallabagCoreBundle:Tag |
78 | 66 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig index d9850f7a..6ac6decb 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig | |||
@@ -164,7 +164,7 @@ | |||
164 | {% endfor %} | 164 | {% endfor %} |
165 | </ul> | 165 | </ul> |
166 | 166 | ||
167 | <form action="{{ path('config') }}" method="post" {{ form_enctype(form.new_tagging_rule) }}> | 167 | {{ form_start(form.new_tagging_rule) }} |
168 | {{ form_errors(form.new_tagging_rule) }} | 168 | {{ form_errors(form.new_tagging_rule) }} |
169 | 169 | ||
170 | <fieldset class="w500p inline"> | 170 | <fieldset class="w500p inline"> |