Browse Source

uppgrade to 2.1.7 and fix code for upgrade

Sevajol Bastien 11 years ago
parent
commit
15d7c389cf
100 changed files with 3123 additions and 3021 deletions
  1. 11 7
      app/AppKernel.php
  2. 5 1
      app/Resources/translations/validators.fr.yml
  3. 646 0
      app/SymfonyRequirements.php
  4. 5 49
      app/autoload.php
  5. 540 321
      app/bootstrap.php.cache
  6. 23 77
      app/check.php
  7. 12 3
      app/config/config_prod.yml
  8. 2 1
      app/config/config_test.yml
  9. 0 16
      app/config/parameters.ini
  10. 12 12
      app/config/routing.yml
  11. 3 3
      app/config/routing_dev.yml
  12. 7 6
      app/config/security.yml
  13. 0 127
      bin/vendors
  14. 50 0
      composer.json
  15. 1632 0
      composer.lock
  16. BIN
      composer.phar
  17. 0 64
      deps
  18. 0 15
      deps.lock
  19. 1 1
      src/Acme/DemoBundle/Controller/DemoController.php
  20. 2 2
      src/Acme/DemoBundle/Form/ContactType.php
  21. 0 58
      src/Muzich/AdminBundle/Admin/ElementAdmin.php
  22. 0 41
      src/Muzich/AdminBundle/Admin/ElementTypeAdmin.php
  23. 0 56
      src/Muzich/AdminBundle/Admin/GroupAdmin.php
  24. 0 48
      src/Muzich/AdminBundle/Admin/RegistrationTokenAdmin.php
  25. 0 46
      src/Muzich/AdminBundle/Admin/TagAdmin.php
  26. 0 95
      src/Muzich/AdminBundle/Admin/UserAdmin.php
  27. 0 15
      src/Muzich/AdminBundle/Controller/DefaultController.php
  28. 0 9
      src/Muzich/AdminBundle/Controller/ElementAdminController.php
  29. 0 9
      src/Muzich/AdminBundle/Controller/ElementTypeAdminController.php
  30. 0 9
      src/Muzich/AdminBundle/Controller/GroupAdminController.php
  31. 0 427
      src/Muzich/AdminBundle/Controller/ModerateController.php
  32. 0 9
      src/Muzich/AdminBundle/Controller/RegistrationTokenAdminController.php
  33. 0 9
      src/Muzich/AdminBundle/Controller/TagAdminController.php
  34. 0 9
      src/Muzich/AdminBundle/Controller/UserAdminController.php
  35. 0 29
      src/Muzich/AdminBundle/DependencyInjection/Configuration.php
  36. 0 28
      src/Muzich/AdminBundle/DependencyInjection/MuzichAdminExtension.php
  37. 0 10
      src/Muzich/AdminBundle/MuzichAdminBundle.php
  38. 0 49
      src/Muzich/AdminBundle/Resources/config/routing.yml
  39. 0 7
      src/Muzich/AdminBundle/Resources/config/services.yml
  40. 0 1
      src/Muzich/AdminBundle/Resources/views/Default/index.html.twig
  41. 0 34
      src/Muzich/AdminBundle/Resources/views/Moderate/comments.html.twig
  42. 0 41
      src/Muzich/AdminBundle/Resources/views/Moderate/elements.html.twig
  43. 0 39
      src/Muzich/AdminBundle/Resources/views/Moderate/index.html.twig
  44. 0 14
      src/Muzich/AdminBundle/Resources/views/Moderate/layout.html.twig
  45. 0 44
      src/Muzich/AdminBundle/Resources/views/Moderate/tags.html.twig
  46. 0 17
      src/Muzich/AdminBundle/Tests/Controller/DefaultControllerTest.php
  47. 0 44
      src/Muzich/CoreBundle/Admin/ElementAdmin.php
  48. 2 2
      src/Muzich/CoreBundle/Controller/CoreController.php
  49. 3 3
      src/Muzich/CoreBundle/Controller/ElementController.php
  50. 2 2
      src/Muzich/CoreBundle/Controller/SearchController.php
  51. 3 4
      src/Muzich/CoreBundle/Entity/Element.php
  52. 2 3
      src/Muzich/CoreBundle/Entity/Group.php
  53. 1 2
      src/Muzich/CoreBundle/Entity/RegistrationToken.php
  54. 3 3
      src/Muzich/CoreBundle/Entity/User.php
  55. 2 2
      src/Muzich/CoreBundle/Entity/UsersTagsFavorites.php
  56. 1 1
      src/Muzich/CoreBundle/Extension/MyTwigExtension.php
  57. 11 7
      src/Muzich/CoreBundle/Form/Element/ElementAddForm.php
  58. 14 9
      src/Muzich/CoreBundle/Form/Group/GroupForm.php
  59. 8 6
      src/Muzich/CoreBundle/Form/Search/ElementSearchForm.php
  60. 8 6
      src/Muzich/CoreBundle/Form/Tag/TagFavoritesForm.php
  61. 2 2
      src/Muzich/CoreBundle/Managers/TagManager.php
  62. 9 2
      src/Muzich/CoreBundle/Resources/config/security.yml
  63. 0 7
      src/Muzich/CoreBundle/Resources/config/validation.yml
  64. 19 6
      src/Muzich/CoreBundle/Resources/views/Form/errors.html.twig
  65. 2 2
      src/Muzich/CoreBundle/Resources/views/Language/languages.html.twig
  66. 17 15
      src/Muzich/CoreBundle/Resources/views/Layout/flash_messages.html.twig
  67. 1 1
      src/Muzich/CoreBundle/Searcher/ElementSearcher.php
  68. 2 2
      src/Muzich/CoreBundle/Searcher/GlobalSearcher.php
  69. 1 1
      src/Muzich/CoreBundle/Searcher/Searcher.php
  70. 2 2
      src/Muzich/CoreBundle/Searcher/UserAndGroupSearcher.php
  71. 1 1
      src/Muzich/CoreBundle/Util/TagLike.php
  72. 1 1
      src/Muzich/CoreBundle/Validator/GroupOwnedOrPublic.php
  73. 4 2
      src/Muzich/CoreBundle/Validator/GroupOwnedOrPublicValidator.php
  74. 4 2
      src/Muzich/CoreBundle/Validator/TagsValidator.php
  75. 13 9
      src/Muzich/CoreBundle/lib/Controller.php
  76. 2 2
      src/Muzich/CoreBundle/lib/FunctionalTest.php
  77. 1 1
      src/Muzich/CoreBundle/lib/Tag.php
  78. 1 1
      src/Muzich/CoreBundle/lib/UnitTest.php
  79. 2 2
      src/Muzich/GroupBundle/Controller/DefaultController.php
  80. 2 2
      src/Muzich/IndexBundle/Controller/IndexController.php
  81. 14 9
      src/Muzich/UserBundle/Controller/UserController.php
  82. 3 2
      src/Muzich/UserBundle/Entity/UserManager.php
  83. 4 3
      src/Muzich/UserBundle/Form/Type/RegistrationFormType.php
  84. 3 3
      src/Muzich/UserBundle/Resources/views/Security/change_password_form.html.twig
  85. 2 2
      src/Muzich/UserBundle/Resources/views/User/preference_form.html.twig
  86. 0 2
      vendor/assetic/.gitignore
  87. 0 13
      vendor/assetic/.travis.yml
  88. 0 36
      vendor/assetic/CHANGELOG-1.0.md
  89. 0 283
      vendor/assetic/README.md
  90. 0 21
      vendor/assetic/composer.json
  91. 0 32
      vendor/assetic/docs/en/build.md
  92. 0 129
      vendor/assetic/docs/en/concepts.md
  93. 0 145
      vendor/assetic/docs/en/define.md
  94. 0 7
      vendor/assetic/docs/en/index.md
  95. 0 21
      vendor/assetic/docs/en/introduction.md
  96. 0 30
      vendor/assetic/docs/ja/build.md
  97. 0 121
      vendor/assetic/docs/ja/concepts.md
  98. 0 140
      vendor/assetic/docs/ja/define.md
  99. 0 7
      vendor/assetic/docs/ja/index.md
  100. 0 0
      vendor/assetic/docs/ja/introduction.md

+ 11 - 7
app/AppKernel.php View File

@@ -13,24 +13,28 @@ class AppKernel extends Kernel
13 13
             new Symfony\Bundle\TwigBundle\TwigBundle(),
14 14
             new Symfony\Bundle\MonologBundle\MonologBundle(),
15 15
             new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
16
-            new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
16
+            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
17 17
             new Symfony\Bundle\AsseticBundle\AsseticBundle(),
18 18
             new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
19
+            new JMS\AopBundle\JMSAopBundle(),
20
+            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
21
+            
19 22
             new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
20 23
             new FOS\UserBundle\FOSUserBundle(),
21
-            new Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle(),
24
+            new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
22 25
             new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
23
-            new Sonata\jQueryBundle\SonatajQueryBundle(),
24
-            new Sonata\BluePrintBundle\SonataBluePrintBundle(),
25
-            new Sonata\AdminBundle\SonataAdminBundle(),
26
-            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
26
+            //new Sonata\jQueryBundle\SonatajQueryBundle(),
27
+            //new Sonata\BluePrintBundle\SonataBluePrintBundle(),
28
+            //new Sonata\AdminBundle\SonataAdminBundle(),
29
+            //new Knp\Bundle\MenuBundle\KnpMenuBundle(),
27 30
             new Gregwar\ImageBundle\GregwarImageBundle(),
31
+            
28 32
             new Muzich\CoreBundle\MuzichCoreBundle(),
29 33
             new Muzich\UserBundle\MuzichUserBundle(),
30 34
             new Muzich\IndexBundle\MuzichIndexBundle(),
31 35
             new Muzich\HomeBundle\MuzichHomeBundle(),
32 36
             new Muzich\MynetworkBundle\MuzichMynetworkBundle(),
33
-            new Muzich\AdminBundle\MuzichAdminBundle(),
37
+            //new Muzich\AdminBundle\MuzichAdminBundle(),
34 38
             new Muzich\GroupBundle\MuzichGroupBundle(),
35 39
             new Muzich\FavoriteBundle\MuzichFavoriteBundle(),
36 40
             new Muzich\CommentBundle\MuzichCommentBundle(),

+ 5 - 1
app/Resources/translations/validators.fr.yml View File

@@ -39,4 +39,8 @@ error:
39 39
       
40 40
 registration:
41 41
   token:
42
-    error:               Le code saisie pour l'inscription est incorrect ou n'est plus utilisable
42
+    error:               Le code saisie pour l'inscription est incorrect ou n'est plus utilisable
43
+    
44
+group_malchoisis:        Le groupe est mal choisis
45
+group_invalid:           Le groupe est invalide
46
+tags_saisinco:           Tags saisis incorrects

+ 646 - 0
app/SymfonyRequirements.php View File

@@ -0,0 +1,646 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+/*
13
+ * Users of PHP 5.2 should be able to run the requirements checks.
14
+ * This is why the file and all classes must be compatible with PHP 5.2+
15
+ * (e.g. not using namespaces and closures).
16
+ *
17
+ * ************** CAUTION **************
18
+ *
19
+ * DO NOT EDIT THIS FILE as it will be overriden by Composer as part of
20
+ * the installation/update process. The original file resides in the
21
+ * SensioDistributionBundle.
22
+ *
23
+ * ************** CAUTION **************
24
+ */
25
+
26
+/**
27
+ * Represents a single PHP requirement, e.g. an installed extension.
28
+ * It can be a mandatory requirement or an optional recommendation.
29
+ * There is a special subclass, named PhpIniRequirement, to check a php.ini configuration.
30
+ *
31
+ * @author Tobias Schultze <http://tobion.de>
32
+ */
33
+class Requirement
34
+{
35
+    private $fulfilled;
36
+    private $testMessage;
37
+    private $helpText;
38
+    private $helpHtml;
39
+    private $optional;
40
+
41
+    /**
42
+     * Constructor that initializes the requirement.
43
+     *
44
+     * @param Boolean      $fulfilled     Whether the requirement is fulfilled
45
+     * @param string       $testMessage   The message for testing the requirement
46
+     * @param string       $helpHtml      The help text formatted in HTML for resolving the problem
47
+     * @param string|null  $helpText      The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
48
+     * @param Boolean      $optional      Whether this is only an optional recommendation not a mandatory requirement
49
+     */
50
+    public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
51
+    {
52
+        $this->fulfilled = (Boolean) $fulfilled;
53
+        $this->testMessage = (string) $testMessage;
54
+        $this->helpHtml = (string) $helpHtml;
55
+        $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
56
+        $this->optional = (Boolean) $optional;
57
+    }
58
+
59
+    /**
60
+     * Returns whether the requirement is fulfilled.
61
+     *
62
+     * @return Boolean true if fulfilled, otherwise false
63
+     */
64
+    public function isFulfilled()
65
+    {
66
+        return $this->fulfilled;
67
+    }
68
+
69
+    /**
70
+     * Returns the message for testing the requirement.
71
+     *
72
+     * @return string The test message
73
+     */
74
+    public function getTestMessage()
75
+    {
76
+        return $this->testMessage;
77
+    }
78
+
79
+    /**
80
+     * Returns the help text for resolving the problem
81
+     *
82
+     * @return string The help text
83
+     */
84
+    public function getHelpText()
85
+    {
86
+        return $this->helpText;
87
+    }
88
+
89
+    /**
90
+     * Returns the help text formatted in HTML.
91
+     *
92
+     * @return string The HTML help
93
+     */
94
+    public function getHelpHtml()
95
+    {
96
+        return $this->helpHtml;
97
+    }
98
+
99
+    /**
100
+     * Returns whether this is only an optional recommendation and not a mandatory requirement.
101
+     *
102
+     * @return Boolean true if optional, false if mandatory
103
+     */
104
+    public function isOptional()
105
+    {
106
+        return $this->optional;
107
+    }
108
+}
109
+
110
+/**
111
+ * Represents a PHP requirement in form of a php.ini configuration.
112
+ *
113
+ * @author Tobias Schultze <http://tobion.de>
114
+ */
115
+class PhpIniRequirement extends Requirement
116
+{
117
+    /**
118
+     * Constructor that initializes the requirement.
119
+     *
120
+     * @param string            $cfgName            The configuration name used for ini_get()
121
+     * @param Boolean|callback  $evaluation         Either a Boolean indicating whether the configuration should evaluate to true or false,
122
+                                                    or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
123
+     * @param Boolean           $approveCfgAbsence  If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
124
+                                                    This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
125
+                                                    Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
126
+     * @param string|null       $testMessage        The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
127
+     * @param string|null       $helpHtml           The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
128
+     * @param string|null       $helpText           The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
129
+     * @param Boolean           $optional           Whether this is only an optional recommendation not a mandatory requirement
130
+     */
131
+    public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null, $optional = false)
132
+    {
133
+        $cfgValue = ini_get($cfgName);
134
+
135
+        if (is_callable($evaluation)) {
136
+            if (null === $testMessage || null === $helpHtml) {
137
+                throw new InvalidArgumentException('You must provide the parameters testMessage and helpHtml for a callback evaluation.');
138
+            }
139
+
140
+            $fulfilled = call_user_func($evaluation, $cfgValue);
141
+        } else {
142
+            if (null === $testMessage) {
143
+                $testMessage = sprintf('%s %s be %s in php.ini',
144
+                    $cfgName,
145
+                    $optional ? 'should' : 'must',
146
+                    $evaluation ? 'enabled' : 'disabled'
147
+                );
148
+            }
149
+
150
+            if (null === $helpHtml) {
151
+                $helpHtml = sprintf('Set <strong>%s</strong> to <strong>%s</strong> in php.ini<a href="#phpini">*</a>.',
152
+                    $cfgName,
153
+                    $evaluation ? 'on' : 'off'
154
+                );
155
+            }
156
+
157
+            $fulfilled = $evaluation == $cfgValue;
158
+        }
159
+
160
+        parent::__construct($fulfilled || ($approveCfgAbsence && false === $cfgValue), $testMessage, $helpHtml, $helpText, $optional);
161
+    }
162
+}
163
+
164
+/**
165
+ * A RequirementCollection represents a set of Requirement instances.
166
+ *
167
+ * @author Tobias Schultze <http://tobion.de>
168
+ */
169
+class RequirementCollection implements IteratorAggregate
170
+{
171
+    private $requirements = array();
172
+
173
+    /**
174
+     * Gets the current RequirementCollection as an Iterator.
175
+     *
176
+     * @return Traversable A Traversable interface
177
+     */
178
+    public function getIterator()
179
+    {
180
+        return new ArrayIterator($this->requirements);
181
+    }
182
+
183
+    /**
184
+     * Adds a Requirement.
185
+     *
186
+     * @param Requirement $requirement A Requirement instance
187
+     */
188
+    public function add(Requirement $requirement)
189
+    {
190
+        $this->requirements[] = $requirement;
191
+    }
192
+
193
+    /**
194
+     * Adds a mandatory requirement.
195
+     *
196
+     * @param Boolean      $fulfilled     Whether the requirement is fulfilled
197
+     * @param string       $testMessage   The message for testing the requirement
198
+     * @param string       $helpHtml      The help text formatted in HTML for resolving the problem
199
+     * @param string|null  $helpText      The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
200
+     */
201
+    public function addRequirement($fulfilled, $testMessage, $helpHtml, $helpText = null)
202
+    {
203
+        $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, false));
204
+    }
205
+
206
+    /**
207
+     * Adds an optional recommendation.
208
+     *
209
+     * @param Boolean      $fulfilled     Whether the recommendation is fulfilled
210
+     * @param string       $testMessage   The message for testing the recommendation
211
+     * @param string       $helpHtml      The help text formatted in HTML for resolving the problem
212
+     * @param string|null  $helpText      The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
213
+     */
214
+    public function addRecommendation($fulfilled, $testMessage, $helpHtml, $helpText = null)
215
+    {
216
+        $this->add(new Requirement($fulfilled, $testMessage, $helpHtml, $helpText, true));
217
+    }
218
+
219
+    /**
220
+     * Adds a mandatory requirement in form of a php.ini configuration.
221
+     *
222
+     * @param string            $cfgName            The configuration name used for ini_get()
223
+     * @param Boolean|callback  $evaluation         Either a Boolean indicating whether the configuration should evaluate to true or false,
224
+                                                    or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
225
+     * @param Boolean           $approveCfgAbsence  If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
226
+                                                    This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
227
+                                                    Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
228
+     * @param string            $testMessage        The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
229
+     * @param string            $helpHtml           The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
230
+     * @param string|null       $helpText           The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
231
+     */
232
+    public function addPhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
233
+    {
234
+        $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, false));
235
+    }
236
+
237
+    /**
238
+     * Adds an optional recommendation in form of a php.ini configuration.
239
+     *
240
+     * @param string            $cfgName            The configuration name used for ini_get()
241
+     * @param Boolean|callback  $evaluation         Either a Boolean indicating whether the configuration should evaluate to true or false,
242
+                                                    or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
243
+     * @param Boolean           $approveCfgAbsence  If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
244
+                                                    This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
245
+                                                    Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
246
+     * @param string            $testMessage        The message for testing the requirement (when null and $evaluation is a Boolean a default message is derived)
247
+     * @param string            $helpHtml           The help text formatted in HTML for resolving the problem (when null and $evaluation is a Boolean a default help is derived)
248
+     * @param string|null       $helpText           The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
249
+     */
250
+    public function addPhpIniRecommendation($cfgName, $evaluation, $approveCfgAbsence = false, $testMessage = null, $helpHtml = null, $helpText = null)
251
+    {
252
+        $this->add(new PhpIniRequirement($cfgName, $evaluation, $approveCfgAbsence, $testMessage, $helpHtml, $helpText, true));
253
+    }
254
+
255
+    /**
256
+     * Adds a requirement collection to the current set of requirements.
257
+     *
258
+     * @param RequirementCollection $collection A RequirementCollection instance
259
+     */
260
+    public function addCollection(RequirementCollection $collection)
261
+    {
262
+        $this->requirements = array_merge($this->requirements, $collection->all());
263
+    }
264
+
265
+    /**
266
+     * Returns both requirements and recommendations.
267
+     *
268
+     * @return array Array of Requirement instances
269
+     */
270
+    public function all()
271
+    {
272
+        return $this->requirements;
273
+    }
274
+
275
+    /**
276
+     * Returns all mandatory requirements.
277
+     *
278
+     * @return array Array of Requirement instances
279
+     */
280
+    public function getRequirements()
281
+    {
282
+        $array = array();
283
+        foreach ($this->requirements as $req) {
284
+            if (!$req->isOptional()) {
285
+                $array[] = $req;
286
+            }
287
+        }
288
+
289
+        return $array;
290
+    }
291
+
292
+    /**
293
+     * Returns the mandatory requirements that were not met.
294
+     *
295
+     * @return array Array of Requirement instances
296
+     */
297
+    public function getFailedRequirements()
298
+    {
299
+        $array = array();
300
+        foreach ($this->requirements as $req) {
301
+            if (!$req->isFulfilled() && !$req->isOptional()) {
302
+                $array[] = $req;
303
+            }
304
+        }
305
+
306
+        return $array;
307
+    }
308
+
309
+    /**
310
+     * Returns all optional recommmendations.
311
+     *
312
+     * @return array Array of Requirement instances
313
+     */
314
+    public function getRecommendations()
315
+    {
316
+        $array = array();
317
+        foreach ($this->requirements as $req) {
318
+            if ($req->isOptional()) {
319
+                $array[] = $req;
320
+            }
321
+        }
322
+
323
+        return $array;
324
+    }
325
+
326
+    /**
327
+     * Returns the recommendations that were not met.
328
+     *
329
+     * @return array Array of Requirement instances
330
+     */
331
+    public function getFailedRecommendations()
332
+    {
333
+        $array = array();
334
+        foreach ($this->requirements as $req) {
335
+            if (!$req->isFulfilled() && $req->isOptional()) {
336
+                $array[] = $req;
337
+            }
338
+        }
339
+
340
+        return $array;
341
+    }
342
+
343
+    /**
344
+     * Returns whether a php.ini configuration is not correct.
345
+     *
346
+     * @return Boolean php.ini configuration problem?
347
+     */
348
+    public function hasPhpIniConfigIssue()
349
+    {
350
+        foreach ($this->requirements as $req) {
351
+            if (!$req->isFulfilled() && $req instanceof PhpIniRequirement) {
352
+                return true;
353
+            }
354
+        }
355
+
356
+        return false;
357
+    }
358
+
359
+    /**
360
+     * Returns the PHP configuration file (php.ini) path.
361
+     *
362
+     * @return string|false php.ini file path
363
+     */
364
+    public function getPhpIniConfigPath()
365
+    {
366
+        return get_cfg_var('cfg_file_path');
367
+    }
368
+}
369
+
370
+/**
371
+ * This class specifies all requirements and optional recommendations that
372
+ * are necessary to run the Symfony Standard Edition.
373
+ *
374
+ * @author Tobias Schultze <http://tobion.de>
375
+ * @author Fabien Potencier <fabien@symfony.com>
376
+ */
377
+class SymfonyRequirements extends RequirementCollection
378
+{
379
+    const REQUIRED_PHP_VERSION = '5.3.3';
380
+
381
+    /**
382
+     * Constructor that initializes the requirements.
383
+     */
384
+    public function __construct()
385
+    {
386
+        /* mandatory requirements follow */
387
+
388
+        $installedPhpVersion = phpversion();
389
+
390
+        $this->addRequirement(
391
+            version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
392
+            sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
393
+            sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
394
+                Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
395
+                $installedPhpVersion, self::REQUIRED_PHP_VERSION),
396
+            sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
397
+        );
398
+
399
+        $this->addRequirement(
400
+            version_compare($installedPhpVersion, '5.3.16', '!='),
401
+            'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
402
+            'Install PHP 5.3.17 or newer (or downgrade to an earlier PHP version)'
403
+        );
404
+
405
+        $this->addRequirement(
406
+            is_dir(__DIR__.'/../vendor/composer'),
407
+            'Vendor libraries must be installed',
408
+            'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. ' .
409
+                'Then run "<strong>php composer.phar install</strong>" to install them.'
410
+        );
411
+
412
+        $baseDir = basename(__DIR__);
413
+
414
+        $this->addRequirement(
415
+            is_writable(__DIR__.'/cache'),
416
+            "$baseDir/cache/ directory must be writable",
417
+            "Change the permissions of the \"<strong>$baseDir/cache/</strong>\" directory so that the web server can write into it."
418
+        );
419
+
420
+        $this->addRequirement(
421
+            is_writable(__DIR__.'/logs'),
422
+            "$baseDir/logs/ directory must be writable",
423
+            "Change the permissions of the \"<strong>$baseDir/logs/</strong>\" directory so that the web server can write into it."
424
+        );
425
+
426
+        $this->addPhpIniRequirement(
427
+            'date.timezone', true, false,
428
+            'date.timezone setting must be set',
429
+            'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
430
+        );
431
+
432
+        if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
433
+            $this->addRequirement(
434
+                (in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())),
435
+                sprintf('Configured default timezone "%s" must be supported by your installation of PHP', date_default_timezone_get()),
436
+                'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
437
+            );
438
+        }
439
+
440
+        $this->addRequirement(
441
+            function_exists('json_encode'),
442
+            'json_encode() must be available',
443
+            'Install and enable the <strong>JSON</strong> extension.'
444
+        );
445
+
446
+        $this->addRequirement(
447
+            function_exists('session_start'),
448
+            'session_start() must be available',
449
+            'Install and enable the <strong>session</strong> extension.'
450
+        );
451
+
452
+        $this->addRequirement(
453
+            function_exists('ctype_alpha'),
454
+            'ctype_alpha() must be available',
455
+            'Install and enable the <strong>ctype</strong> extension.'
456
+        );
457
+
458
+        $this->addRequirement(
459
+            function_exists('token_get_all'),
460
+            'token_get_all() must be available',
461
+            'Install and enable the <strong>Tokenizer</strong> extension.'
462
+        );
463
+
464
+        $this->addRequirement(
465
+            function_exists('simplexml_import_dom'),
466
+            'simplexml_import_dom() must be available',
467
+            'Install and enable the <strong>SimpleXML</strong> extension.'
468
+        );
469
+
470
+        if (function_exists('apc_store') && ini_get('apc.enabled')) {
471
+            $this->addRequirement(
472
+                version_compare(phpversion('apc'), '3.0.17', '>='),
473
+                'APC version must be at least 3.0.17',
474
+                'Upgrade your <strong>APC</strong> extension (3.0.17+).'
475
+            );
476
+        }
477
+
478
+        $this->addPhpIniRequirement('detect_unicode', false);
479
+
480
+        if (extension_loaded('suhosin')) {
481
+            $this->addPhpIniRequirement(
482
+                'suhosin.executor.include.whitelist',
483
+                create_function('$cfgValue', 'return false !== stripos($cfgValue, "phar");'),
484
+                false,
485
+                'suhosin.executor.include.whitelist must be configured correctly in php.ini',
486
+                'Add "<strong>phar</strong>" to <strong>suhosin.executor.include.whitelist</strong> in php.ini<a href="#phpini">*</a>.'
487
+            );
488
+        }
489
+
490
+        if (extension_loaded('xdebug')) {
491
+            $this->addPhpIniRequirement(
492
+                'xdebug.show_exception_trace', false, true
493
+            );
494
+
495
+            $this->addPhpIniRequirement(
496
+                'xdebug.scream', false, true
497
+            );
498
+        }
499
+
500
+        $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
501
+
502
+        $this->addRequirement(
503
+            null !== $pcreVersion,
504
+            'PCRE extension must be available',
505
+            'Install the <strong>PCRE</strong> extension (version 8.0+).'
506
+        );
507
+
508
+        /* optional recommendations follow */
509
+
510
+        $this->addRecommendation(
511
+            file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),
512
+            'Requirements file should be up-to-date',
513
+            'Your requirements file is outdated. Run composer install and re-check your configuration.'
514
+        );
515
+
516
+        $this->addRecommendation(
517
+            version_compare($installedPhpVersion, '5.3.4', '>='),
518
+            'You should use at least PHP 5.3.4 due to PHP bug #52083 in earlier versions',
519
+            'Your project might malfunction randomly due to PHP bug #52083 ("Notice: Trying to get property of non-object"). Install PHP 5.3.4 or newer.'
520
+        );
521
+        
522
+        $this->addRecommendation(
523
+            version_compare($installedPhpVersion, '5.3.8', '>='),
524
+            'When using annotations you should have at least PHP 5.3.8 due to PHP bug #55156',
525
+            'Install PHP 5.3.8 or newer if your project uses annotations.'
526
+        );
527
+
528
+        $this->addRecommendation(
529
+            version_compare($installedPhpVersion, '5.4.0', '!='),
530
+            'You should not use PHP 5.4.0 due to the PHP bug #61453',
531
+            'Your project might not work properly due to the PHP bug #61453 ("Cannot dump definitions which have method calls"). Install PHP 5.4.1 or newer.'
532
+        );
533
+
534
+        if (null !== $pcreVersion) {
535
+            $this->addRecommendation(
536
+                $pcreVersion >= 8.0,
537
+                sprintf('PCRE extension should be at least version 8.0 (%s installed)', $pcreVersion),
538
+                '<strong>PCRE 8.0+</strong> is preconfigured in PHP since 5.3.2 but you are using an outdated version of it. Symfony probably works anyway but it is recommended to upgrade your PCRE extension.'
539
+            );
540
+        }
541
+
542
+        $this->addRecommendation(
543
+            class_exists('DomDocument'),
544
+            'PHP-XML module should be installed',
545
+            'Install and enable the <strong>PHP-XML</strong> module.'
546
+        );
547
+
548
+        $this->addRecommendation(
549
+            function_exists('mb_strlen'),
550
+            'mb_strlen() should be available',
551
+            'Install and enable the <strong>mbstring</strong> extension.'
552
+        );
553
+
554
+        $this->addRecommendation(
555
+            function_exists('iconv'),
556
+            'iconv() should be available',
557
+            'Install and enable the <strong>iconv</strong> extension.'
558
+        );
559
+
560
+        $this->addRecommendation(
561
+            function_exists('utf8_decode'),
562
+            'utf8_decode() should be available',
563
+            'Install and enable the <strong>XML</strong> extension.'
564
+        );
565
+
566
+        if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
567
+            $this->addRecommendation(
568
+                function_exists('posix_isatty'),
569
+                'posix_isatty() should be available',
570
+                'Install and enable the <strong>php_posix</strong> extension (used to colorize the CLI output).'
571
+            );
572
+        }
573
+
574
+        $this->addRecommendation(
575
+            class_exists('Locale'),
576
+            'intl extension should be available',
577
+            'Install and enable the <strong>intl</strong> extension (used for validators).'
578
+        );
579
+
580
+        if (class_exists('Collator')) {
581
+            $this->addRecommendation(
582
+                null !== new Collator('fr_FR'),
583
+                'intl extension should be correctly configured',
584
+                'The intl extension does not behave properly. This problem is typical on PHP 5.3.X x64 WIN builds.'
585
+            );
586
+        }
587
+
588
+        if (class_exists('Locale')) {
589
+            if (defined('INTL_ICU_VERSION')) {
590
+                $version = INTL_ICU_VERSION;
591
+            } else {
592
+                $reflector = new ReflectionExtension('intl');
593
+
594
+                ob_start();
595
+                $reflector->info();
596
+                $output = strip_tags(ob_get_clean());
597
+
598
+                preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
599
+                $version = $matches[1];
600
+            }
601
+
602
+            $this->addRecommendation(
603
+                version_compare($version, '4.0', '>='),
604
+                'intl ICU version should be at least 4+',
605
+                'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
606
+            );
607
+        }
608
+
609
+        $accelerator =
610
+            (function_exists('apc_store') && ini_get('apc.enabled'))
611
+            ||
612
+            function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
613
+            ||
614
+            function_exists('xcache_set')
615
+        ;
616
+
617
+        $this->addRecommendation(
618
+            $accelerator,
619
+            'a PHP accelerator should be installed',
620
+            'Install and enable a <strong>PHP accelerator</strong> like APC (highly recommended).'
621
+        );
622
+
623
+        $this->addPhpIniRecommendation('short_open_tag', false);
624
+
625
+        $this->addPhpIniRecommendation('magic_quotes_gpc', false, true);
626
+
627
+        $this->addPhpIniRecommendation('register_globals', false, true);
628
+
629
+        $this->addPhpIniRecommendation('session.auto_start', false);
630
+
631
+        $this->addRecommendation(
632
+            class_exists('PDO'),
633
+            'PDO should be installed',
634
+            'Install <strong>PDO</strong> (mandatory for Doctrine).'
635
+        );
636
+
637
+        if (class_exists('PDO')) {
638
+            $drivers = PDO::getAvailableDrivers();
639
+            $this->addRecommendation(
640
+                count($drivers),
641
+                sprintf('PDO should have some drivers installed (currently available: %s)', count($drivers) ? implode(', ', $drivers) : 'none'),
642
+                'Install <strong>PDO drivers</strong> (mandatory for Doctrine).'
643
+            );
644
+        }
645
+    }
646
+}

+ 5 - 49
app/autoload.php View File

@@ -1,60 +1,16 @@
1 1
 <?php
2 2
 
3
-use Symfony\Component\ClassLoader\UniversalClassLoader;
4 3
 use Doctrine\Common\Annotations\AnnotationRegistry;
5 4
 
6
-$loader = new UniversalClassLoader();
7
-$loader->registerNamespaces(array(
8
-    'Symfony'          => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
9
-    'Sensio'           => __DIR__.'/../vendor/bundles',
10
-    'JMS'              => __DIR__.'/../vendor/bundles',
11
-    'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
12
-    'Doctrine\\DBAL'   => __DIR__.'/../vendor/doctrine-dbal/lib',
13
-    'Doctrine'         => __DIR__.'/../vendor/doctrine/lib',
14
-    'Monolog'          => __DIR__.'/../vendor/monolog/src',
15
-    'Assetic'          => __DIR__.'/../vendor/assetic/src',
16
-    'Metadata'         => __DIR__.'/../vendor/metadata/src',
17
-    'FOS'              => __DIR__.'/../vendor/bundles',
18
-    'Gregwar'          => __DIR__.'/../vendor/bundles',
19
-    'Doctrine\\Common\\DataFixtures' => __DIR__.'/../vendor/doctrine-fixtures/lib',
20
-    'Doctrine\\Common'               => __DIR__.'/../vendor/doctrine-common/lib',
21
-    'Stof'             => __DIR__.'/../vendor/bundles',
22
-    'Gedmo'            => __DIR__.'/../vendor/gedmo-doctrine-extensions/lib',
23
-    'WhiteOctober'     => __DIR__.'/../vendor/bundles',
24
-    'Pagerfanta'       => __DIR__.'/../vendor/pagerfanta/src',
25
-    'Sonata'           => __DIR__.'/../vendor/bundles',
26
-    'Knp'              => array(
27
-                         __DIR__.'/../vendor/bundles',
28
-                         __DIR__.'/../vendor/knp/menu/src',
29
-    ),
30
-));
31
-$loader->registerPrefixes(array(
32
-    'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
33
-    'Twig_'            => __DIR__.'/../vendor/twig/lib',
34
-));
5
+$loader = include __DIR__.'/../vendor/autoload.php';
35 6
 
36 7
 // intl
37 8
 if (!function_exists('intl_get_error_code')) {
38
-    require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
9
+    require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
39 10
 
40
-    $loader->registerPrefixFallbacks(array(__DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs'));
11
+    $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
41 12
 }
42 13
 
43
-$loader->registerNamespaceFallbacks(array(
44
-    __DIR__.'/../src',
45
-));
46
-$loader->register();
47
-
48
-AnnotationRegistry::registerLoader(function($class) use ($loader) {
49
-    $loader->loadClass($class);
50
-    return class_exists($class, false);
51
-});
52
-AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
53
-
54
-// Swiftmailer needs a special autoloader to allow
55
-// the lazy loading of the init file (which is expensive)
56
-
57
-//require_once __DIR__.'/../vendor/swiftmailer/lib/classes/Swift.php';
58
-require __DIR__.'/../vendor/swiftmailer/lib/swift_required.php';
59
-//Swift::registerAutoload(__DIR__.'/../vendor/swiftmailer/lib/swift_init.php');
14
+AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
60 15
 
16
+return $loader;

File diff suppressed because it is too large
+ 540 - 321
app/bootstrap.php.cache


+ 23 - 77
app/check.php View File

@@ -1,105 +1,51 @@
1 1
 <?php
2 2
 
3
-if (!$iniPath = get_cfg_var('cfg_file_path')) {
4
-    $iniPath = 'WARNING: not using a php.ini file';
5
-}
3
+require_once dirname(__FILE__).'/SymfonyRequirements.php';
4
+
5
+$symfonyRequirements = new SymfonyRequirements();
6
+
7
+$iniPath = $symfonyRequirements->getPhpIniConfigPath();
6 8
 
7 9
 echo "********************************\n";
8 10
 echo "*                              *\n";
9 11
 echo "*  Symfony requirements check  *\n";
10 12
 echo "*                              *\n";
11 13
 echo "********************************\n\n";
12
-echo sprintf("php.ini used by PHP: %s\n\n", $iniPath);
13 14
 
14
-echo "** WARNING **\n";
15
+echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
16
+
17
+echo "** ATTENTION **\n";
15 18
 echo "*  The PHP CLI can use a different php.ini file\n";
16 19
 echo "*  than the one used with your web server.\n";
17 20
 if ('\\' == DIRECTORY_SEPARATOR) {
18 21
     echo "*  (especially on the Windows platform)\n";
19 22
 }
20
-echo "*  If this is the case, please ALSO launch this\n";
21
-echo "*  utility from your web server.\n";
22
-echo "** WARNING **\n";
23
-
24
-// mandatory
25
-echo_title("Mandatory requirements");
26
-check(version_compare(phpversion(), '5.3.2', '>='), sprintf('Checking that PHP version is at least 5.3.2 (%s installed)', phpversion()), 'Install PHP 5.3.2 or newer (current version is '.phpversion(), true);
27
-check(ini_get('date.timezone'), 'Checking that the "date.timezone" setting is set', 'Set the "date.timezone" setting in php.ini (like Europe/Paris)', true);
28
-check(is_writable(__DIR__.'/../app/cache'), sprintf('Checking that app/cache/ directory is writable'), 'Change the permissions of the app/cache/ directory so that the web server can write in it', true);
29
-check(is_writable(__DIR__.'/../app/logs'), sprintf('Checking that the app/logs/ directory is writable'), 'Change the permissions of the app/logs/ directory so that the web server can write in it', true);
30
-check(function_exists('json_encode'), 'Checking that the json_encode() is available', 'Install and enable the json extension', true);
31
-check(class_exists('SQLite3') || in_array('sqlite', PDO::getAvailableDrivers()), 'Checking that the SQLite3 or PDO_SQLite extension is available', 'Install and enable the SQLite3 or PDO_SQLite extension.', true);
32
-check(function_exists('session_start'), 'Checking that the session_start() is available', 'Install and enable the session extension', true);
33
-check(function_exists('ctype_alpha'), 'Checking that the ctype_alpha() is available', 'Install and enable the ctype extension', true);
34
-check(!(function_exists('apc_store') && ini_get('apc.enabled')) || version_compare(phpversion('apc'), '3.0.17', '>='), 'Checking that the APC version is at least 3.0.17', 'Upgrade your APC extension (3.0.17+)', true);
35
-
36
-// warnings
37
-echo_title("Optional checks");
38
-check(class_exists('DomDocument'), 'Checking that the PHP-XML module is installed', 'Install and enable the php-xml module', false);
39
-check(defined('LIBXML_COMPACT'), 'Checking that the libxml version is at least 2.6.21', 'Upgrade your php-xml module with a newer libxml', false);
40
-check(function_exists('token_get_all'), 'Checking that the token_get_all() function is available', 'Install and enable the Tokenizer extension (highly recommended)', false);
41
-check(function_exists('mb_strlen'), 'Checking that the mb_strlen() function is available', 'Install and enable the mbstring extension', false);
42
-check(function_exists('iconv'), 'Checking that the iconv() function is available', 'Install and enable the iconv extension', false);
43
-check(function_exists('utf8_decode'), 'Checking that the utf8_decode() is available', 'Install and enable the XML extension', false);
44
-check(function_exists('curl_init'), 'Checking that the curl_init() is available', 'Install and enable the curl (php5-curl package) extension', false);
45
-if (PHP_OS != 'WINNT') {
46
-    check(function_exists('posix_isatty'), 'Checking that the posix_isatty() is available', 'Install and enable the php_posix extension (used to colorized the CLI output)', false);
47
-}
48
-check(class_exists('Locale'), 'Checking that the intl extension is available', 'Install and enable the intl extension (used for validators)', false);
49
-if (class_exists('Locale')) {
50
-    $version = '';
51
-
52
-    if (defined('INTL_ICU_VERSION')) {
53
-        $version =  INTL_ICU_VERSION;
54
-    } else {
55
-        $reflector = new \ReflectionExtension('intl');
56
-
57
-        ob_start();
58
-        $reflector->info();
59
-        $output = strip_tags(ob_get_clean());
23
+echo "*  To be on the safe side, please also launch the requirements check\n";
24
+echo "*  from your web server using the web/config.php script.\n";
60 25
 
61
-        preg_match('/^ICU version +(?:=> )?(.*)$/m', $output, $matches);
62
-        $version = $matches[1];
63
-    }
26
+echo_title('Mandatory requirements');
64 27
 
65
-    check(version_compare($version, '4.0', '>='), 'Checking that the intl ICU version is at least 4+', 'Upgrade your intl extension with a newer ICU version (4+)', false);
28
+foreach ($symfonyRequirements->getRequirements() as $req) {
29
+    echo_requirement($req);
66 30
 }
67 31
 
68
-$accelerator = 
69
-    (function_exists('apc_store') && ini_get('apc.enabled'))
70
-    ||
71
-    function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
72
-    ||
73
-    function_exists('xcache_set')
74
-;
75
-check($accelerator, 'Checking that a PHP accelerator is installed', 'Install a PHP accelerator like APC (highly recommended)', false);
76
-
77
-check(!ini_get('short_open_tag'), 'Checking that php.ini has short_open_tag set to off', 'Set short_open_tag to off in php.ini', false);
78
-check(!ini_get('magic_quotes_gpc'), 'Checking that php.ini has magic_quotes_gpc set to off', 'Set magic_quotes_gpc to off in php.ini', false);
79
-check(!ini_get('register_globals'), 'Checking that php.ini has register_globals set to off', 'Set register_globals to off in php.ini', false);
80
-check(!ini_get('session.auto_start'), 'Checking that php.ini has session.auto_start set to off', 'Set session.auto_start to off in php.ini', false);
81
-
82
-echo_title("Optional checks (Doctrine)");
32
+echo_title('Optional recommendations');
83 33
 
84
-check(class_exists('PDO'), 'Checking that PDO is installed', 'Install PDO (mandatory for Doctrine)', false);
85
-if (class_exists('PDO')) {
86
-    $drivers = PDO::getAvailableDrivers();
87
-    check(count($drivers), 'Checking that PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)');
34
+foreach ($symfonyRequirements->getRecommendations() as $req) {
35
+    echo_requirement($req);
88 36
 }
89 37
 
90 38
 /**
91
- * Checks a configuration.
39
+ * Prints a Requirement instance
92 40
  */
93
-function check($boolean, $message, $help = '', $fatal = false)
41
+function echo_requirement(Requirement $requirement)
94 42
 {
95
-    echo $boolean ? "  OK        " : sprintf("\n\n[[%s]] ", $fatal ? ' ERROR ' : 'WARNING');
96
-    echo sprintf("$message%s\n", $boolean ? '' : ': FAILED');
43
+    $result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
44
+    echo ' ' . str_pad($result, 9);
45
+    echo $requirement->getTestMessage() . "\n";
97 46
 
98
-    if (!$boolean) {
99
-        echo "            *** $help ***\n";
100
-        if ($fatal) {
101
-            exit("You must fix this problem before resuming the check.\n");
102
-        }
47
+    if (!$requirement->isFulfilled()) {
48
+        echo sprintf("          %s\n\n", $requirement->getHelpText());
103 49
     }
104 50
 }
105 51
 

+ 12 - 3
app/config/config_prod.yml View File

@@ -1,10 +1,19 @@
1 1
 imports:
2 2
     - { resource: config.yml }
3 3
 
4
+# In production environment you should know that the parameters for URL generation
5
+# always pass the requirements. Otherwise it would break your link (or even site with
6
+# strict_requirements = true). So we can disable the requirements check completely for
7
+# enhanced performance with strict_requirements = null.
8
+framework:
9
+    router:
10
+        strict_requirements: null
11
+
4 12
 #doctrine:
5
-#    metadata_cache_driver: apc
6
-#    result_cache_driver: apc
7
-#    query_cache_driver: apc
13
+# orm:
14
+# metadata_cache_driver: apc
15
+# result_cache_driver: apc
16
+# query_cache_driver: apc
8 17
 
9 18
 monolog:
10 19
     handlers:

+ 2 - 1
app/config/config_test.yml View File

@@ -4,7 +4,8 @@ imports:
4 4
 framework:
5 5
     test: ~
6 6
     session:
7
-        storage_id: session.storage.filesystem
7
+        # UPGRADE 2.1
8
+        storage_id: session.storage.mock_file 
8 9
 
9 10
 web_profiler:
10 11
     toolbar: false

+ 0 - 16
app/config/parameters.ini View File

@@ -1,16 +0,0 @@
1
-; These parameters can be imported into other config files
2
-; by enclosing the key with % (like %database_user%)
3
-; Comments start with ';', as in php.ini
4
-[parameters]
5
-    database_driver="pdo_mysql"
6
-    database_host="localhost"
7
-    database_port="3306"
8
-    database_name="muzich"
9
-    database_user="muzich"
10
-    database_password="muzich"
11
-    mailer_transport="smtp"
12
-    mailer_host="localhost"
13
-    mailer_user=""
14
-    mailer_password=""
15
-    locale="fr"
16
-    secret="***REMOVED***"

+ 12 - 12
app/config/routing.yml View File

@@ -2,18 +2,18 @@
2 2
 #_internal:
3 3
 #   resource: "@FrameworkBundle/Resources/config/routing/internal.xml"
4 4
 #   prefix:   /_internal
5
-  
6
-admin:
7
-    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
8
-    prefix: /admin
9
-
10
-_sonata_admin:
11
-    resource: .
12
-    type: sonata_admin
13
-    prefix: /admin
14
-  
15
-MuzichAdminBundle:
16
-  resource: "@MuzichAdminBundle/Resources/config/routing.yml"
5
+# 
6
+#admin:
7
+#    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
8
+#    prefix: /admin
9
+#
10
+#_sonata_admin:
11
+#    resource: .
12
+#    type: sonata_admin
13
+#    prefix: /admin
14
+#  
15
+#MuzichAdminBundle:
16
+#  resource: "@MuzichAdminBundle/Resources/config/routing.yml"
17 17
   
18 18
 MuzichIndexBundle:
19 19
   resource: "@MuzichIndexBundle/Resources/config/routing.yml"

+ 3 - 3
app/config/routing_dev.yml View File

@@ -11,9 +11,9 @@ _demo:
11 11
     type:     annotation
12 12
     prefix:   /demo
13 13
 
14
-_assetic:
15
-    resource: .
16
-    type:     assetic
14
+#_assetic:
15
+#    resource: .
16
+#    type:     assetic
17 17
 
18 18
 _wdt:
19 19
     resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"

+ 7 - 6
app/config/security.yml View File

@@ -1,12 +1,13 @@
1 1
 imports:
2 2
     - { resource: "@MuzichCoreBundle/Resources/config/security.yml" }
3 3
 
4
-security:
5
-    encoders:
6
-        'FOS\UserBundle\Model\UserInterface':
7
-            algorithm: sha512
8
-            encode_as_base64: false
9
-            iterations: 10
4
+#security:
5
+#    providers:
6
+#            in_memory:
7
+#                memory:
8
+#                    users:
9
+#                        user:  { password: userpass, roles: [ 'ROLE_USER' ] }
10
+#                        admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
10 11
 
11 12
 #security:
12 13
 #    encoders:

+ 0 - 127
bin/vendors View File

@@ -1,127 +0,0 @@
1
-#!/usr/bin/env php
2
-<?php
3
-
4
-/*
5
- * This file is part of the Symfony Standard Edition.
6
- *
7
- * (c) Fabien Potencier <fabien@symfony.com>
8
- *
9
- * For the full copyright and license information, please view the LICENSE
10
- * file that was distributed with this source code.
11
- */
12
-
13
-$rootDir = dirname(__DIR__);
14
-$vendorDir = $rootDir.'/vendor';
15
-
16
-array_shift($argv);
17
-if (!isset($argv[0])) {
18
-    exit(<<<EOF
19
-Symfony2 vendors script management.
20
-
21
-Specify a command to run:
22
-
23
- install: install vendors as specified in deps or deps.lock (recommended)
24
- update:  update vendors to their latest versions (as specified in deps)
25
-
26
-
27
-EOF
28
-    );
29
-}
30
-
31
-if (!in_array($command = array_shift($argv), array('install', 'update'))) {
32
-    exit(sprintf("Command \"%s\" does not exist.\n", $command));
33
-}
34
-
35
-/*
36
- * Check wether this project is based on the Standard Edition that was
37
- * shipped with vendors or not.
38
- */
39
-if (is_dir($vendorDir.'/symfony') && !is_dir($vendorDir.'/symfony/.git') && !in_array('--reinstall', $argv)) {
40
-    exit(<<<EOF
41
-Your project seems to be based on a Standard Edition that includes vendors.
42
-
43
-Try to run ./bin/vendors install --reinstall
44
-
45
-
46
-EOF
47
-    );
48
-}
49
-
50
-if (!is_dir($vendorDir)) {
51
-    mkdir($vendorDir, 0777, true);
52
-}
53
-
54
-// versions
55
-$versions = array();
56
-if ('install' === $command && file_exists($rootDir.'/deps.lock')) {
57
-    foreach (file($rootDir.'/deps.lock', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
58
-        $parts = array_values(array_filter(explode(' ', $line)));
59
-        if (2 !== count($parts)) {
60
-            exit(sprintf('The deps version file is not valid (near "%s")', $line));
61
-        }
62
-        $versions[$parts[0]] = $parts[1];
63
-    }
64
-}
65
-
66
-$newversions = array();
67
-$deps = parse_ini_file($rootDir.'/deps', true, INI_SCANNER_RAW);
68
-if (false === $deps) {
69
-    exit("The deps file is not valid ini syntax. Perhaps missing a trailing newline?\n");
70
-}
71
-foreach ($deps as $name => $dep) {
72
-    $dep = array_map('trim', $dep);
73
-
74
-    // revision
75
-    if (isset($versions[$name])) {
76
-        $rev = $versions[$name];
77
-    } else {
78
-        $rev = isset($dep['version']) ? $dep['version'] : 'origin/HEAD';
79
-    }
80
-
81
-    // install dir
82
-    $installDir = isset($dep['target']) ? $vendorDir.'/'.$dep['target'] : $vendorDir.'/'.$name;
83
-    if (in_array('--reinstall', $argv)) {
84
-        if (PHP_OS == 'WINNT') {
85
-            system(sprintf('rmdir /S /Q %s', escapeshellarg(realpath($installDir))));
86
-        } else {
87
-            system(sprintf('rm -rf %s', escapeshellarg($installDir)));
88
-        }
89
-    }
90
-
91
-    echo "> Installing/Updating $name\n";
92
-
93
-    // url
94
-    if (!isset($dep['git'])) {
95
-        exit(sprintf('The "git" value for the "%s" dependency must be set.', $name));
96
-    }
97
-    $url = $dep['git'];
98
-
99
-    if (!is_dir($installDir)) {
100
-        system(sprintf('git clone %s %s', escapeshellarg($url), escapeshellarg($installDir)));
101
-    }
102
-
103
-    system(sprintf('cd %s && git fetch origin && git reset --hard %s', escapeshellarg($installDir), escapeshellarg($rev)));
104
-
105
-    if ('update' === $command) {
106
-        ob_start();
107
-        system(sprintf('cd %s && git log -n 1 --format=%%H', escapeshellarg($installDir)));
108
-        $newversions[] = trim($name.' '.ob_get_clean());
109
-    }
110
-}
111
-
112
-// update?
113
-if ('update' === $command) {
114
-    file_put_contents($rootDir.'/deps.lock', implode("\n", $newversions));
115
-}
116
-
117
-// php on windows can't use the shebang line from system()
118
-$interpreter = PHP_OS == 'WINNT' ? 'php.exe' : '';
119
-
120
-// Update the bootstrap files
121
-system(sprintf('%s %s', $interpreter, escapeshellarg($rootDir.'/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php')));
122
-
123
-// Update assets
124
-system(sprintf('%s %s assets:install %s', $interpreter, escapeshellarg($rootDir.'/app/console'), escapeshellarg($rootDir.'/web/')));
125
-
126
-// Remove the cache
127
-system(sprintf('%s %s cache:clear --no-warmup', $interpreter, escapeshellarg($rootDir.'/app/console')));

+ 50 - 0
composer.json View File

@@ -0,0 +1,50 @@
1
+{
2
+    "name": "symfony/framework-standard-edition",
3
+    "description": "The \"Symfony Standard Edition\" distribution",
4
+    "autoload": {
5
+        "psr-0": { "": "src/" }
6
+    },
7
+    "require": {
8
+        "php": ">=5.3.3",
9
+        "symfony/symfony": "2.1.*",
10
+        "doctrine/orm": ">=2.2.3,<2.4-dev",
11
+        "doctrine/doctrine-bundle": "1.1.*",
12
+        "twig/extensions": "1.0.*@dev",
13
+        "symfony/assetic-bundle": "2.1.*",
14
+        "symfony/swiftmailer-bundle": "2.1.*",
15
+        "symfony/monolog-bundle": "2.1.*",
16
+        "sensio/distribution-bundle": "2.1.*",
17
+        "sensio/framework-extra-bundle": "2.1.*",
18
+        "sensio/generator-bundle": "2.1.*",
19
+        "jms/security-extra-bundle": "1.2.*",
20
+        "jms/di-extra-bundle": "1.1.*",
21
+        "kriswallsmith/assetic": "1.1.*@dev",
22
+        
23
+        "friendsofsymfony/user-bundle": "*",
24
+        "doctrine/data-fixtures" : "dev-master",
25
+        "doctrine/doctrine-fixtures-bundle": "dev-master",
26
+        "stof/doctrine-extensions-bundle": "dev-master",
27
+        "gregwar/image-bundle": "dev-master"
28
+    },
29
+    "scripts": {
30
+        "post-install-cmd": [
31
+            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
32
+            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
33
+            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
34
+            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
35
+        ],
36
+        "post-update-cmd": [
37
+            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
38
+            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
39
+            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
40
+            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
41
+        ]
42
+    },
43
+    "extra": {
44
+        "symfony-app-dir": "app",
45
+        "symfony-web-dir": "web",
46
+        "branch-alias": {
47
+            "dev-master": "2.1-dev"
48
+        }
49
+    }
50
+}

File diff suppressed because it is too large
+ 1632 - 0
composer.lock


BIN
composer.phar View File


+ 0 - 64
deps View File

@@ -1,64 +0,0 @@
1
-[symfony]
2
-    git=http://github.com/symfony/symfony.git
3
-    version=v2.0.22
4
-
5
-[twig]
6
-    git=http://github.com/fabpot/Twig.git
7
-    version=v1.10.3
8
-
9
-[monolog]
10
-    git=http://github.com/Seldaek/monolog.git
11
-    version=1.2.1
12
-
13
-[doctrine-common]
14
-    git=http://github.com/doctrine/common.git
15
-    version=2.1.4
16
-
17
-[doctrine-dbal]
18
-    git=http://github.com/doctrine/dbal.git
19
-    version=2.1.7
20
-
21
-[doctrine]
22
-    git=http://github.com/doctrine/doctrine2.git
23
-    version=2.1.7
24
-
25
-[swiftmailer]
26
-    git=http://github.com/swiftmailer/swiftmailer.git
27
-    version=v4.2.2
28
-
29
-[assetic]
30
-    git=http://github.com/kriswallsmith/assetic.git
31
-    version=v1.0.4
32
-
33
-[twig-extensions]
34
-    git=http://github.com/fabpot/Twig-extensions.git
35
-    version=v1.0.0-alpha
36
-
37
-[metadata]
38
-    git=http://github.com/schmittjoh/metadata.git
39
-    version=1.0.0
40
-
41
-[SensioFrameworkExtraBundle]
42
-    git=http://github.com/sensio/SensioFrameworkExtraBundle.git
43
-    target=/bundles/Sensio/Bundle/FrameworkExtraBundle
44
-    version=origin/2.0
45
-
46
-[JMSSecurityExtraBundle]
47
-    git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git
48
-    target=/bundles/JMS/SecurityExtraBundle
49
-    version=origin/1.0.x
50
-
51
-[SensioDistributionBundle]
52
-    git=http://github.com/sensio/SensioDistributionBundle.git
53
-    target=/bundles/Sensio/Bundle/DistributionBundle
54
-    version=origin/2.0
55
-
56
-[SensioGeneratorBundle]
57
-    git=http://github.com/sensio/SensioGeneratorBundle.git
58
-    target=/bundles/Sensio/Bundle/GeneratorBundle
59
-    version=origin/2.0
60
-
61
-[AsseticBundle]
62
-    git=http://github.com/symfony/AsseticBundle.git
63
-    target=/bundles/Symfony/Bundle/AsseticBundle
64
-    version=origin/2.0

+ 0 - 15
deps.lock View File

@@ -1,15 +0,0 @@
1
-symfony v2.0.22
2
-twig v1.10.3
3
-monolog 1.2.1
4
-doctrine-common 2.1.4
5
-doctrine-dbal 2.1.7
6
-doctrine 2.1.7
7
-swiftmailer v4.2.2
8
-assetic v1.0.4
9
-twig-extensions v1.0.0-alpha
10
-metadata 1.0.0
11
-SensioFrameworkExtraBundle v2.0.22
12
-JMSSecurityExtraBundle e752f888c51425f71382c056961f10f2be642102
13
-SensioDistributionBundle v2.0.22
14
-SensioGeneratorBundle v2.0.22
15
-AsseticBundle 6f15728c1aefa5246caa83730e3dbf70b0d46052

+ 1 - 1
src/Acme/DemoBundle/Controller/DemoController.php View File

@@ -40,7 +40,7 @@ class DemoController extends Controller
40 40
 
41 41
         $request = $this->get('request');
42 42
         if ('POST' == $request->getMethod()) {
43
-            $form->bindRequest($request);
43
+            $form->bind($request);
44 44
             if ($form->isValid()) {
45 45
                 $mailer = $this->get('mailer');
46 46
                 // .. setup a message and send it

+ 2 - 2
src/Acme/DemoBundle/Form/ContactType.php View File

@@ -3,11 +3,11 @@
3 3
 namespace Acme\DemoBundle\Form;
4 4
 
5 5
 use Symfony\Component\Form\AbstractType;
6
-use Symfony\Component\Form\FormBuilder;
6
+use Symfony\Component\Form\FormBuilderInterface;
7 7
 
8 8
 class ContactType extends AbstractType
9 9
 {
10
-    public function buildForm(FormBuilder $builder, array $options)
10
+    public function buildForm(FormBuilderInterface $builder, array $options)
11 11
     {
12 12
         $builder->add('email', 'email');
13 13
         $builder->add('message', 'textarea');

+ 0 - 58
src/Muzich/AdminBundle/Admin/ElementAdmin.php View File

@@ -1,58 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Admin;
4
-
5
-use Sonata\AdminBundle\Admin\Admin;
6
-use Sonata\AdminBundle\Form\FormMapper;
7
-use Sonata\AdminBundle\Datagrid\DatagridMapper;
8
-use Sonata\AdminBundle\Datagrid\ListMapper;
9
-
10
-class ElementAdmin extends Admin
11
-{
12
-  
13
-  protected function configureListFields(ListMapper $listMapper)
14
-  {
15
-    $listMapper
16
-      ->addIdentifier('name')
17
-      ->add('owner', 'many_to_one')
18
-      ->add('type')
19
-      ->add('tags')
20
-      ->add('_action', 'actions', array(
21
-        'actions' => array(
22
-          'view' => array(),
23
-          'edit' => array(),
24
-        )
25
-      ))
26
-    ;
27
-  }
28
-  
29
-  protected function configureDatagridFilters(DatagridMapper $datagrid)
30
-  {
31
-    $datagrid
32
-      ->add('name')
33
-      ->add('url')
34
-      ->add('tags')
35
-      ->add('type')
36
-    ;
37
-  }
38
-  
39
-  protected function configureFormFields(FormMapper $formMapper)
40
-  {
41
-    $formMapper
42
-      ->add('type', 'sonata_type_model', array(), array('edit' => 'list'))
43
-      ->add('name')
44
-      ->add('url')
45
-      ->add('owner', 'sonata_type_model', array(), array('edit' => 'list'))
46
-      ->add('group', 'sonata_type_model', array('required' => false), array('edit' => 'list'))
47
-      ->add('embed', null, array('required' => false))
48
-      ->add('tags', null, array('required' => false))
49
-      
50
-    ;
51
-  }
52
-
53
-//  public function validate(ErrorElement $errorElement, $object)
54
-//  {
55
-//     
56
-//  }
57
-  
58
-}

+ 0 - 41
src/Muzich/AdminBundle/Admin/ElementTypeAdmin.php View File

@@ -1,41 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Admin;
4
-
5
-use Sonata\AdminBundle\Admin\Admin;
6
-use Sonata\AdminBundle\Form\FormMapper;
7
-use Sonata\AdminBundle\Datagrid\DatagridMapper;
8
-use Sonata\AdminBundle\Datagrid\ListMapper;
9
-
10
-class ElementTypeAdmin extends Admin
11
-{
12
-  
13
-  protected function configureListFields(ListMapper $listMapper)
14
-  {
15
-    $listMapper
16
-      ->addIdentifier('id')
17
-      ->add('name')
18
-    ;
19
-  }
20
-  
21
-  protected function configureDatagridFilters(DatagridMapper $datagrid)
22
-  {
23
-    $datagrid
24
-      ->add('name')
25
-    ;
26
-  }
27
-  
28
-  protected function configureFormFields(FormMapper $formMapper)
29
-  {
30
-    $formMapper
31
-      ->add('id')
32
-      ->add('name')
33
-    ;
34
-  }
35
-
36
-//  public function validate(ErrorElement $errorElement, $object)
37
-//  {
38
-//     
39
-//  }
40
-  
41
-}

+ 0 - 56
src/Muzich/AdminBundle/Admin/GroupAdmin.php View File

@@ -1,56 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Admin;
4
-
5
-use Sonata\AdminBundle\Admin\Admin;
6
-use Sonata\AdminBundle\Form\FormMapper;
7
-use Sonata\AdminBundle\Datagrid\DatagridMapper;
8
-use Sonata\AdminBundle\Datagrid\ListMapper;
9
-
10
-class GroupAdmin extends Admin
11
-{
12
-  
13
-  protected function configureListFields(ListMapper $listMapper)
14
-  {
15
-    $listMapper
16
-      ->addIdentifier('name')
17
-      ->add('open')
18
-      ->add('owner', 'many_to_one')
19
-      ->add('tags')
20
-      ->add('_action', 'actions', array(
21
-        'actions' => array(
22
-          'view' => array(),
23
-          'edit' => array(),
24
-        )
25
-      ))
26
-    ;
27
-  }
28
-  
29
-  protected function configureDatagridFilters(DatagridMapper $datagrid)
30
-  {
31
-    $datagrid
32
-      ->add('name')
33
-      ->add('tags')
34
-    ;
35
-  }
36
-  
37
-  protected function configureFormFields(FormMapper $formMapper)
38
-  {
39
-    $formMapper
40
-      ->add('name')
41
-      ->add('description')
42
-      ->add('open', null, array('required' => false))
43
-      ->add('owner', 'sonata_type_model', array(), array('edit' => 'list'))
44
-      // Attention, il semble que le lien pointe vers des records de la table de relation
45
-      // il faudra utiliser le many to many, quand j'y arriverai ...
46
-      //->add('tags', null, array('required' => false))
47
-      
48
-    ;
49
-  }
50
-
51
-//  public function validate(ErrorElement $errorElement, $object)
52
-//  {
53
-//     
54
-//  }
55
-  
56
-}

+ 0 - 48
src/Muzich/AdminBundle/Admin/RegistrationTokenAdmin.php View File

@@ -1,48 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Admin;
4
-
5
-use Sonata\AdminBundle\Admin\Admin;
6
-use Sonata\AdminBundle\Form\FormMapper;
7
-use Sonata\AdminBundle\Datagrid\DatagridMapper;
8
-use Sonata\AdminBundle\Datagrid\ListMapper;
9
-
10
-class RegistrationTokenAdmin extends Admin
11
-{
12
-  
13
-  protected function configureListFields(ListMapper $listMapper)
14
-  {
15
-    $listMapper
16
-      ->addIdentifier('id')
17
-      ->addIdentifier('token')
18
-      ->add('used')
19
-      ->add('count')
20
-      ->add('count_max')
21
-      ->add('_action', 'actions', array(
22
-        'actions' => array(
23
-          'view' => array(),
24
-          'edit' => array(),
25
-        )
26
-      ))
27
-    ;
28
-  }
29
-  
30
-  protected function configureDatagridFilters(DatagridMapper $datagrid)
31
-  {
32
-    $datagrid
33
-      ->add('token')
34
-      ->add('used')
35
-    ;
36
-  }
37
-  
38
-  protected function configureFormFields(FormMapper $formMapper)
39
-  {
40
-    $formMapper
41
-      ->add('token')
42
-      ->add('count')
43
-      ->add('count_max')
44
-      ->add('used')
45
-    ;
46
-  }
47
-  
48
-}

+ 0 - 46
src/Muzich/AdminBundle/Admin/TagAdmin.php View File

@@ -1,46 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Admin;
4
-
5
-use Sonata\AdminBundle\Admin\Admin;
6
-use Sonata\AdminBundle\Form\FormMapper;
7
-use Sonata\AdminBundle\Datagrid\DatagridMapper;
8
-use Sonata\AdminBundle\Datagrid\ListMapper;
9
-
10
-class TagAdmin extends Admin
11
-{
12
-  
13
-  protected function configureListFields(ListMapper $listMapper)
14
-  {
15
-    $listMapper
16
-      ->addIdentifier('id')
17
-      ->addIdentifier('name')
18
-      ->add('_action', 'actions', array(
19
-        'actions' => array(
20
-          'view' => array(),
21
-          'edit' => array(),
22
-        )
23
-      ))
24
-    ;
25
-  }
26
-  
27
-  protected function configureDatagridFilters(DatagridMapper $datagrid)
28
-  {
29
-    $datagrid
30
-      ->add('name')
31
-    ;
32
-  }
33
-  
34
-  protected function configureFormFields(FormMapper $formMapper)
35
-  {
36
-    $formMapper
37
-      ->add('name')
38
-    ;
39
-  }
40
-
41
-//  public function validate(ErrorElement $errorElement, $object)
42
-//  {
43
-//     
44
-//  }
45
-  
46
-}

+ 0 - 95
src/Muzich/AdminBundle/Admin/UserAdmin.php View File

@@ -1,95 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Admin;
4
-
5
-use Sonata\AdminBundle\Admin\Admin;
6
-use Sonata\AdminBundle\Form\FormMapper;
7
-use Sonata\AdminBundle\Datagrid\DatagridMapper;
8
-use Sonata\AdminBundle\Datagrid\ListMapper;
9
-
10
-use FOS\UserBundle\Model\UserManagerInterface;
11
-
12
-class UserAdmin extends Admin
13
-{
14
-  
15
-  protected $userManager;
16
-  
17
-  protected function configureListFields(ListMapper $listMapper)
18
-  {
19
-    $listMapper
20
-      ->addIdentifier('username')
21
-      ->add('email')
22
-      ->add('enabled')
23
-      ->add('_action', 'actions', array(
24
-        'actions' => array(
25
-          'view' => array(),
26
-          'edit' => array(),
27
-        )
28
-      ))
29
-    ;
30
-  }
31
-  
32
-  protected function configureDatagridFilters(DatagridMapper $datagrid)
33
-  {
34
-    $datagrid
35
-      ->add('username')
36
-      ->add('email')
37
-      ->add('enabled')
38
-    ;
39
-  }
40
-//  
41
-//  protected function configureFormFields(FormMapper $formMapper)
42
-//  {
43
-//    $formMapper
44
-//      ->add('email')
45
-//      ->add('enabled', null, array('required' => false))
46
-//      //->add('password')
47
-//      ->add('confirmationToken', null, array('required' => false))
48
-//    ;
49
-//  }
50
-//
51
-////  public function validate(ErrorElement $errorElement, $object)
52
-////  {
53
-////     
54
-////  }
55
-  
56
-  protected function configureFormFields(FormMapper $formMapper)
57
-  {
58
-      $formMapper
59
-          ->with('General')
60
-              ->add('username')
61
-              ->add('email')
62
-              ->add('plainPassword', 'text')
63
-          ->end()
64
-//          ->with('Groups')
65
-//              ->add('groups', 'sonata_type_model', array('required' => false))
66
-//          ->end()
67
-          ->with('Management')
68
-//              ->add('roles', 'sonata_security_roles', array( 'multiple' => true))
69
-              ->add('locked', null, array('required' => false))
70
-              ->add('expired', null, array('required' => false))
71
-              ->add('enabled', null, array('required' => false))
72
-              ->add('credentialsExpired', null, array('required' => false))
73
-          ->end()
74
-      ;
75
-  }
76
-  public function preUpdate($user)
77
-  {
78
-      $this->getUserManager()->updateCanonicalFields($user);
79
-      $this->getUserManager()->updatePassword($user);
80
-  }
81
-
82
-  public function setUserManager(UserManagerInterface $userManager)
83
-  {
84
-      $this->userManager = $userManager;
85
-  }
86
-
87
-  /**
88
-   * @return UserManagerInterface
89
-   */
90
-  public function getUserManager()
91
-  {
92
-      return $this->userManager;
93
-  }
94
-  
95
-}

+ 0 - 15
src/Muzich/AdminBundle/Controller/DefaultController.php View File

@@ -1,15 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Controller;
4
-
5
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
-
7
-
8
-class DefaultController extends Controller
9
-{
10
-    
11
-    public function indexAction($name)
12
-    {
13
-        return $this->render('MuzichAdminBundle:Default:index.html.twig', array('name' => $name));
14
-    }
15
-}

+ 0 - 9
src/Muzich/AdminBundle/Controller/ElementAdminController.php View File

@@ -1,9 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Controller;
4
-
5
-use Sonata\AdminBundle\Controller\CRUDController as Controller;
6
-
7
-class ElementAdminController extends Controller
8
-{
9
-}

+ 0 - 9
src/Muzich/AdminBundle/Controller/ElementTypeAdminController.php View File

@@ -1,9 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Controller;
4
-
5
-use Sonata\AdminBundle\Controller\CRUDController as Controller;
6
-
7
-class ElementTypeAdminController extends Controller
8
-{
9
-}

+ 0 - 9
src/Muzich/AdminBundle/Controller/GroupAdminController.php View File

@@ -1,9 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Controller;
4
-
5
-use Sonata\AdminBundle\Controller\CRUDController as Controller;
6
-
7
-class GroupAdminController extends Controller
8
-{
9
-}

+ 0 - 427
src/Muzich/AdminBundle/Controller/ModerateController.php View File

@@ -1,427 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Controller;
4
-
5
-use Muzich\CoreBundle\lib\Controller;
6
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
7
-//use Muzich\CoreBundle\Util\TagLike;
8
-use Muzich\CoreBundle\Entity\UsersTagsFavorites;
9
-use Muzich\CoreBundle\Entity\GroupsTagsFavorites;
10
-use Muzich\CoreBundle\Managers\TagManager;
11
-use Muzich\CoreBundle\Propagator\EventElement;
12
-use Muzich\CoreBundle\Managers\CommentsManager;
13
-
14
-class ModerateController extends Controller
15
-{
16
-    
17
-  /**
18
-   *
19
-   * @Template()
20
-   */
21
-  public function indexAction()
22
-  {
23
-    $count_tags = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
24
-      ->countToModerate();
25
-    $count_elements = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
26
-      ->countToModerate();
27
-    $count_comments = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
28
-      ->countForCommentToModerate();
29
-    
30
-    return array(
31
-      'count_tags' => $count_tags,
32
-      'count_elements' => $count_elements,
33
-      'count_comments' => $count_comments
34
-    );
35
-  }
36
-    
37
-  /**
38
-   *
39
-   * @Template()
40
-   */
41
-  public function tagsAction()
42
-  {
43
-    // Récupération des tags
44
-    $tags = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
45
-      ->getToModerate();
46
-    
47
-    // TODO: Ajouter a chaque tag la liste des tags ressemblant
48
-    
49
-    return array(
50
-      'tags' => $tags
51
-    );
52
-  }
53
-  
54
-  public function tagAcceptAction($tag_id)
55
-  {
56
-    if (($response = $this->mustBeConnected(true)))
57
-    {
58
-      return $response;
59
-    }
60
-    
61
-    if (!($tag = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneBy(array(
62
-      'id'         => $tag_id,
63
-      'tomoderate' => true
64
-    ))))
65
-    {
66
-      return $this->jsonResponse(array(
67
-        'status'  => 'error',
68
-        'message' => 'NotFound'
69
-      ));
70
-    }
71
-    
72
-    $tagManager = new TagManager();
73
-    if (!$tagManager->moderateTag($this->getDoctrine(), $tag, true))
74
-    {
75
-      return $this->jsonResponse(array(
76
-        'status'  => 'error',
77
-        'message' => 'NotFound'
78
-      ));
79
-    }
80
-    
81
-    return $this->jsonResponse(array(
82
-      'status' => 'success'
83
-    ));
84
-  }
85
-  
86
-  public function tagRefuseAction($tag_id)
87
-  {
88
-    if (($response = $this->mustBeConnected(true)))
89
-    {
90
-      return $response;
91
-    }
92
-    
93
-    if (!($tag = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneBy(array(
94
-      'id'         => $tag_id,
95
-      'tomoderate' => true
96
-    ))))
97
-    {
98
-      return $this->jsonResponse(array(
99
-        'status'  => 'error',
100
-        'message' => 'NotFound'
101
-      ));
102
-    }
103
-    
104
-    $tagManager = new TagManager();
105
-    if (!$tagManager->moderateTag($this->getDoctrine(), $tag, false))
106
-    {
107
-      return $this->jsonResponse(array(
108
-        'status'  => 'error',
109
-        'message' => 'NotFound'
110
-      ));
111
-    }
112
-    
113
-    // Tout c'est bien passé, on incremente ceci dit le compteur
114
-    // de tag refusés par la modération pour le ou les utilisateurs
115
-    // ayant fait la demande d'ajout
116
-    $uids = json_decode($tag->getPrivateids(), true);
117
-    
118
-    $users = $this->getDoctrine()->getEntityManager()
119
-      ->createQuery('
120
-        SELECT u FROM MuzichCoreBundle:User u
121
-        WHERE u.id IN (:uids)'
122
-      )
123
-      ->setParameter('uids', $uids)
124
-      ->getResult()
125
-    ;
126
-    
127
-    // Pour chacun on augmente le compteur
128
-    foreach ($users as $user)
129
-    {
130
-      $user->addModeratedTagCount();
131
-      $this->getDoctrine()->getEntityManager()->persist($user);
132
-    }
133
-    
134
-    $this->getDoctrine()->getEntityManager()->flush();
135
-    
136
-    return $this->jsonResponse(array(
137
-      'status' => 'success'
138
-    ));
139
-  }
140
-  
141
-  /**
142
-   * Cette action est plus délicate, elle consiste a remplacer le tag en question
143
-   * par un autre.
144
-   *
145
-   * @param int $tag_id
146
-   * @param int $tag_new_id
147
-   * @return view 
148
-   */
149
-  public function tagReplaceAction($tag_id, $tag_new_id)
150
-  {
151
-    if (($response = $this->mustBeConnected(true)))
152
-    {
153
-      return $response;
154
-    }
155
-    
156
-    if (!($tag = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneBy(array(
157
-      'id'         => $tag_id,
158
-      'tomoderate' => true
159
-    ))))
160
-    {
161
-      return $this->jsonResponse(array(
162
-        'status'  => 'error',
163
-        'message' => 'NotFound'
164
-      ));
165
-    }
166
-    
167
-    $tag_array = json_decode($tag_new_id);
168
-    if (!array_key_exists(0, $tag_array))
169
-    {
170
-      return $this->jsonResponse(array(
171
-        'status'  => 'error',
172
-        'message' => 'netTagError'
173
-      ));
174
-    }
175
-    $tag_new_id = $tag_array[0];
176
-    
177
-    $tagManager = new TagManager();
178
-    if (!$tagManager->moderateTag($this->getDoctrine(), $tag, false, $tag_new_id))
179
-    {
180
-      return $this->jsonResponse(array(
181
-        'status'  => 'error',
182
-        'message' => 'NotFound'
183
-      ));
184
-    }
185
-    
186
-    return $this->jsonResponse(array(
187
-      'status' => 'success'
188
-    ));
189
-    
190
-  }
191
-  
192
-  /**
193
-   *
194
-   * @Template()
195
-   */
196
-  public function elementsAction()
197
-  {
198
-    // Récupération des elements
199
-    $elements = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
200
-      ->getToModerate();
201
-    
202
-    return array(
203
-      'elements' => $elements
204
-    );
205
-  }
206
-  
207
-  /**
208
-   * 
209
-   */
210
-  public function deleteElementAction($element_id)
211
-  {
212
-    if (($response = $this->mustBeConnected(true)))
213
-    {
214
-      return $response;
215
-    }
216
-    
217
-    if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
218
-      ->findOneById($element_id))
219
-    )
220
-    {
221
-      return $this->jsonResponse(array(
222
-        'status' => 'error',
223
-        'errors' => array('NotFound')
224
-      ));
225
-    }
226
-    
227
-    $event = new EventElement($this->container);
228
-    $event->elementRemoved($element);
229
-    $element->getOwner()->addModeratedElementCount();
230
-
231
-    $this->getDoctrine()->getEntityManager()->persist($element->getOwner());
232
-    $this->getDoctrine()->getEntityManager()->remove($element);
233
-    $this->getDoctrine()->getEntityManager()->flush();
234
-    
235
-    return $this->jsonResponse(array(
236
-      'status' => 'success'
237
-    ));
238
-  }
239
-  
240
-  public function cleanElementAction($element_id)
241
-  {
242
-    if (($response = $this->mustBeConnected(true)))
243
-    {
244
-      return $response;
245
-    }
246
-    
247
-    if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
248
-      ->findOneById($element_id))
249
-    )
250
-    {
251
-      return $this->jsonResponse(array(
252
-        'status' => 'error',
253
-        'errors' => array('NotFound')
254
-      ));
255
-    }
256
-    
257
-    $user_ids = $element->getReportIds();
258
-    $element->setReportIds(null);
259
-    $element->setCountReport(null);
260
-    $this->getDoctrine()->getEntityManager()->persist($element);
261
-    
262
-    $users = $this->getDoctrine()->getEntityManager()
263
-      ->createQuery('
264
-        SELECT u FROM MuzichCoreBundle:User u
265
-        WHERE u.id IN (:uids)'
266
-      )
267
-      ->setParameter('uids', $user_ids)
268
-      ->getResult()
269
-    ;
270
-    
271
-    foreach ($users as $user)
272
-    {
273
-      $user->addBadReport();
274
-      $this->getDoctrine()->getEntityManager()->persist($user);
275
-    }
276
-    
277
-    $this->getDoctrine()->getEntityManager()->flush();
278
-    
279
-    return $this->jsonResponse(array(
280
-      'status' => 'success'
281
-    ));
282
-  }
283
-  
284
-  /**
285
-   *
286
-   * @Template()
287
-   */
288
-  public function commentsAction()
289
-  {
290
-    // Récupération des elements
291
-    $elements = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
292
-      ->getForCommentToModerate();
293
-    
294
-    $comments = array();
295
-    foreach ($elements as $element)
296
-    {
297
-      $cm = new CommentsManager($element->getComments());
298
-      foreach ($cm->getAlertedComments() as $comment)
299
-      {
300
-        $comments[] = array(
301
-          'element_id' => $element->getId(),
302
-          'comment'    => $comment
303
-        );
304
-      }
305
-      
306
-    }
307
-    
308
-    return array(
309
-      'comments' => $comments
310
-    );
311
-  }
312
-  
313
-  /**
314
-   * Considérer le commentaire signalé comme étant tout a fait acceptable
315
-   * 
316
-   * Ceci induit:
317
-   * * Que le commentaire en question ne soit plus signalé 
318
-   * * Que le ou les ids d'utilisateurs qui l'ont signalé comme soit "pénalisé
319
-   * 
320
-   * @param int $element_id
321
-   * @param date $date 
322
-   * 
323
-   * @return Response
324
-   */
325
-  public function commentCleanAction($element_id, $date)
326
-  {
327
-    if (($response = $this->mustBeConnected(true)))
328
-    {
329
-      return $response;
330
-    }
331
-    
332
-    if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
333
-      ->findOneById($element_id))
334
-    )
335
-    {
336
-      return $this->jsonResponse(array(
337
-        'status' => 'error',
338
-        'errors' => array('NotFound')
339
-      ));
340
-    }
341
-    
342
-    $cm = new CommentsManager($element->getComments());
343
-    // On nettoie le commentaire et on récupère les ids des "signaleurs"
344
-    $ids = $cm->cleanAlertsOnComment($date);
345
-    $element->setComments($cm->get());
346
-    $element->setCountCommentReport($cm->countCommentAlert());
347
-    
348
-    $this->getDoctrine()->getEntityManager()->persist($element);
349
-    
350
-    // On récupère les user qui ont signalés ce commentaire
351
-    $users = $this->getDoctrine()->getEntityManager()
352
-      ->createQuery('
353
-        SELECT u FROM MuzichCoreBundle:User u
354
-        WHERE u.id IN (:uids)'
355
-      )
356
-      ->setParameter('uids', $ids)
357
-      ->getResult()
358
-    ;
359
-    
360
-    // Pour chacun on augmente le compteur de signalements inutiles
361
-    foreach ($users as $user)
362
-    {
363
-      $user->addBadReport();
364
-      $this->getDoctrine()->getEntityManager()->persist($user);
365
-    }
366
-    
367
-    $this->getDoctrine()->getEntityManager()->flush();
368
-    
369
-    return $this->jsonResponse(array(
370
-      'status' => 'success'
371
-    ));
372
-  }
373
-  
374
-  /**
375
-   * Considérer le commentaire signalé comme étant tout a fait acceptable
376
-   * 
377
-   * Ceci induit:
378
-   * * Que le commentaire en question ne soit plus signalé 
379
-   * * Que le ou les ids d'utilisateurs qui l'ont signalé comme soit "pénalisé
380
-   * 
381
-   * @param int $element_id
382
-   * @param date $date 
383
-   * 
384
-   * @return Response
385
-   */
386
-  public function commentRefuseAction($element_id, $date)
387
-  {
388
-    if (($response = $this->mustBeConnected(true)))
389
-    {
390
-      return $response;
391
-    }
392
-    
393
-    if (!($element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
394
-      ->findOneById($element_id))
395
-    )
396
-    {
397
-      return $this->jsonResponse(array(
398
-        'status' => 'error',
399
-        'errors' => array('NotFound')
400
-      ));
401
-    }
402
-    
403
-    $cm = new CommentsManager($element->getComments());
404
-    $comment = $cm->get($cm->getIndexWithDate($date));
405
-    // On supprime le commentaire
406
-    $cm->deleteWithDate($date);
407
-    $element->setComments($cm->get());
408
-    $element->setCountCommentReport($cm->countCommentAlert());
409
-    
410
-    // On récupère l'auteur du commentaire pour lui incrémenté son compteur
411
-    // de contenu modéré
412
-    $user = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
413
-      ->findOneBy(array(
414
-        'id' => $comment['u']['i']
415
-      ));
416
-    
417
-    $user->addModeratedCommentCount();
418
-    
419
-    $this->getDoctrine()->getEntityManager()->persist($user);
420
-    $this->getDoctrine()->getEntityManager()->persist($element);
421
-    $this->getDoctrine()->getEntityManager()->flush();
422
-    
423
-    return $this->jsonResponse(array(
424
-      'status' => 'success'
425
-    ));
426
-  }
427
-}

+ 0 - 9
src/Muzich/AdminBundle/Controller/RegistrationTokenAdminController.php View File

@@ -1,9 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Controller;
4
-
5
-use Sonata\AdminBundle\Controller\CRUDController as Controller;
6
-
7
-class RegistrationTokenAdminController extends Controller
8
-{
9
-}

+ 0 - 9
src/Muzich/AdminBundle/Controller/TagAdminController.php View File

@@ -1,9 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Controller;
4
-
5
-use Sonata\AdminBundle\Controller\CRUDController as Controller;
6
-
7
-class TagAdminController extends Controller
8
-{
9
-}

+ 0 - 9
src/Muzich/AdminBundle/Controller/UserAdminController.php View File

@@ -1,9 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Controller;
4
-
5
-use Sonata\AdminBundle\Controller\CRUDController as Controller;
6
-
7
-class UserAdminController extends Controller
8
-{
9
-}

+ 0 - 29
src/Muzich/AdminBundle/DependencyInjection/Configuration.php View File

@@ -1,29 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\DependencyInjection;
4
-
5
-use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6
-use Symfony\Component\Config\Definition\ConfigurationInterface;
7
-
8
-/**
9
- * This is the class that validates and merges configuration from your app/config files
10
- *
11
- * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
12
- */
13
-class Configuration implements ConfigurationInterface
14
-{
15
-    /**
16
-     * {@inheritDoc}
17
-     */
18
-    public function getConfigTreeBuilder()
19
-    {
20
-        $treeBuilder = new TreeBuilder();
21
-        $rootNode = $treeBuilder->root('muzich_admin');
22
-
23
-        // Here you should define the parameters that are allowed to
24
-        // configure your bundle. See the documentation linked above for
25
-        // more information on that topic.
26
-
27
-        return $treeBuilder;
28
-    }
29
-}

+ 0 - 28
src/Muzich/AdminBundle/DependencyInjection/MuzichAdminExtension.php View File

@@ -1,28 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\DependencyInjection;
4
-
5
-use Symfony\Component\DependencyInjection\ContainerBuilder;
6
-use Symfony\Component\Config\FileLocator;
7
-use Symfony\Component\HttpKernel\DependencyInjection\Extension;
8
-use Symfony\Component\DependencyInjection\Loader;
9
-
10
-/**
11
- * This is the class that loads and manages your bundle configuration
12
- *
13
- * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
14
- */
15
-class MuzichAdminExtension extends Extension
16
-{
17
-    /**
18
-     * {@inheritDoc}
19
-     */
20
-    public function load(array $configs, ContainerBuilder $container)
21
-    {
22
-        $configuration = new Configuration();
23
-        $config = $this->processConfiguration($configuration, $configs);
24
-
25
-        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
26
-        $loader->load('services.yml');
27
-    }
28
-}

+ 0 - 10
src/Muzich/AdminBundle/MuzichAdminBundle.php View File

@@ -1,10 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle;
4
-
5
-use Symfony\Component\HttpKernel\Bundle\Bundle;
6
-
7
-class MuzichAdminBundle extends Bundle
8
-{
9
-  
10
-}

+ 0 - 49
src/Muzich/AdminBundle/Resources/config/routing.yml View File

@@ -1,49 +0,0 @@
1
-MuzichAdminBundle_moderate_index:
2
-  pattern:  /admin/moderate
3
-  defaults: { _controller: MuzichAdminBundle:Moderate:index }
4
-
5
-##
6
-
7
-MuzichAdminBundle_moderate_tags:
8
-  pattern:  /admin/moderate/tags
9
-  defaults: { _controller: MuzichAdminBundle:Moderate:tags }
10
-  
11
-MuzichAdminBundle_moderate_tags_accept_tag:
12
-  pattern:  /admin/moderate/tags/{tag_id}/accept
13
-  defaults: { _controller: MuzichAdminBundle:Moderate:tagAccept }
14
-  
15
-MuzichAdminBundle_moderate_tags_refuse_tag:
16
-  pattern:  /admin/moderate/tags/{tag_id}/refuse
17
-  defaults: { _controller: MuzichAdminBundle:Moderate:tagRefuse }
18
-  
19
-MuzichAdminBundle_moderate_tags_replace_tag:
20
-  pattern:  /admin/moderate/tags/{tag_id}/replace/{tag_new_id}
21
-  defaults: { _controller: MuzichAdminBundle:Moderate:tagReplace, tag_new_id: null }
22
-  
23
-##
24
-
25
-moderate_elements_index:
26
-  pattern:  /admin/moderate/elements
27
-  defaults: { _controller: MuzichAdminBundle:Moderate:elements }
28
-  
29
-moderate_element_delete:
30
-  pattern:  /admin/moderate/element/delete/{element_id}
31
-  defaults: { _controller: MuzichAdminBundle:Moderate:deleteElement }
32
-  
33
-moderate_element_clean:
34
-  pattern:  /admin/moderate/element/clean/{element_id}
35
-  defaults: { _controller: MuzichAdminBundle:Moderate:cleanElement }
36
-  
37
-##
38
-
39
-moderate_comments_index:
40
-  pattern:  /admin/moderate/comments
41
-  defaults: { _controller: MuzichAdminBundle:Moderate:comments }
42
-
43
-moderate_comment_clean:
44
-  pattern:  /admin/moderate/comment/{element_id}/{date}/clean
45
-  defaults: { _controller: MuzichAdminBundle:Moderate:commentClean }
46
-
47
-moderate_comment_refuse:
48
-  pattern:  /admin/moderate/comment/{element_id}/{date}/refuse
49
-  defaults: { _controller: MuzichAdminBundle:Moderate:commentRefuse }

+ 0 - 7
src/Muzich/AdminBundle/Resources/config/services.yml View File

@@ -1,7 +0,0 @@
1
-parameters:
2
-#    muzich_admin.example.class: Muzich\AdminBundle\Example
3
-
4
-services:
5
-#    muzich_admin.example:
6
-#        class: %muzich_admin.example.class%
7
-#        arguments: [@service_id, "plain_value", %parameter%]

+ 0 - 1
src/Muzich/AdminBundle/Resources/views/Default/index.html.twig View File

@@ -1 +0,0 @@
1
-Hello {{ name }}!

+ 0 - 34
src/Muzich/AdminBundle/Resources/views/Moderate/comments.html.twig View File

@@ -1,34 +0,0 @@
1
-{% extends "MuzichAdminBundle:Moderate:layout.html.twig" %}
2
-
3
-{% block title %}{% endblock %}
4
-
5
-{% block content %}
6
-
7
-  <h2>{{ 'moderate.comments.title'|trans({}, 'adminui') }}</h2>
8
-    
9
-  <ul id="moderate_comments">
10
-    {% for comment in comments %}
11
-      <li class="comment" id="mod_comment_{{ comment.element_id }}_{{ comment.comment.d|date_epurate }}">
12
-        
13
-        <a href="{{ path('moderate_comment_clean', {
14
-          'element_id' : comment.element_id,
15
-          'date'       : comment.comment.d
16
-        }) }}" class="accept">
17
-         [V]
18
-        </a>
19
-        <a href="{{ path('moderate_comment_refuse', {
20
-          'element_id' : comment.element_id,
21
-          'date'       : comment.comment.d
22
-        }) }}" class="refuse">
23
-         [X]
24
-        </a>
25
-        
26
-        <strong>{{ comment.comment.u.s }}</strong>: 
27
-        
28
-        {{ comment.comment.c }}
29
-        
30
-      </li>
31
-    {% endfor %}
32
-  </ul>
33
-
34
-{% endblock %}

+ 0 - 41
src/Muzich/AdminBundle/Resources/views/Moderate/elements.html.twig View File

@@ -1,41 +0,0 @@
1
-{% extends "MuzichAdminBundle:Moderate:layout.html.twig" %}
2
-
3
-{% block title %}{% endblock %}
4
-
5
-{% block content %}
6
-
7
-  <h2>{{ 'moderate.elements.title'|trans({}, 'adminui') }}</h2>
8
-    
9
-  <ul id="moderate_elements">
10
-    {% for element in elements %}
11
-      <li class="element" id="mod_element_{{ element.id }}">
12
-        
13
-        <div class="controls">
14
-          <a class="delete" href="{{ path('moderate_element_delete', {'element_id':element.id}) }}" >
15
-            {{ 'moderate.elements.action.delete'|trans({}, 'adminui') }}
16
-          </a>
17
-            -
18
-          <a class="clean" href="{{ path('moderate_element_clean', {'element_id':element.id}) }}" >
19
-             {{ 'moderate.elements.action.clean'|trans({}, 'adminui') }}
20
-          </a>
21
-        </div>
22
-        
23
-        <div class="element">
24
-          <ul>
25
-            <li><strong>Name</strong>: {{ element.name }}</li>
26
-            <li><strong>url</strong>: <a href="{{ element.url }}" target="_blank">{{ element.url }}</a></li>
27
-            {#% if element.embed %}
28
-              {% autoescape false %}
29
-                <li>
30
-                  {{ element.embed }}
31
-                </li>
32
-              {% endautoescape %}
33
-            {% endif %#}
34
-          </ul>
35
-        </div>
36
-        
37
-      </li>
38
-    {% endfor %}
39
-  </ul>
40
-
41
-{% endblock %}

+ 0 - 39
src/Muzich/AdminBundle/Resources/views/Moderate/index.html.twig View File

@@ -1,39 +0,0 @@
1
-{% extends "MuzichAdminBundle:Moderate:layout.html.twig" %}
2
-
3
-{% block title %}{% endblock %}
4
-
5
-{% block content %}
6
-
7
-  <h2>{{ 'moderate.title'|trans({}, 'adminui') }}</h2>
8
-  
9
-  <h3>{{ 'moderate.tags.title'|trans({}, 'adminui') }}</h3>
10
-  
11
-  <ul>
12
-    <li>
13
-      <a href="{{ path('MuzichAdminBundle_moderate_tags') }}">
14
-        {{ 'moderate.tags.to_moderate'|trans({'%count%' : count_tags}, 'adminui') }}
15
-      </a>
16
-    </li>
17
-  </ul>
18
-  
19
-  <h3>{{ 'moderate.elements.title'|trans({}, 'adminui') }}</h3>
20
-  
21
-  <ul>
22
-    <li>
23
-      <a href="{{ path('moderate_elements_index') }}">
24
-        {{ 'moderate.elements.to_moderate'|trans({'%count%' : count_elements}, 'adminui') }}
25
-      </a>
26
-    </li>
27
-  </ul>
28
-  
29
-  <h3>{{ 'moderate.comments.title'|trans({}, 'adminui') }}</h3>
30
-  
31
-  <ul>
32
-    <li>
33
-      <a href="{{ path('moderate_comments_index') }}">
34
-        {{ 'moderate.comments.to_moderate'|trans({'%count%' : count_comments}, 'adminui') }}
35
-      </a>
36
-    </li>
37
-  </ul>
38
-  
39
-{% endblock %}

+ 0 - 14
src/Muzich/AdminBundle/Resources/views/Moderate/layout.html.twig View File

@@ -1,14 +0,0 @@
1
-{% extends 'MuzichCoreBundle::layout.html.twig' %}
2
-
3
-{% block css %}
4
-  <link href="{{ asset('bundles/muzichmoderate/css/moderate.css') }}" rel="stylesheet" media="screen" type="text/css" />
5
-{% endblock %}
6
-{% block js %}
7
-  <script src="{{ asset('bundles/muzichmoderate/js/moderate.js') }}" type="text/javascript"></script>
8
-{% endblock %}
9
-
10
-{% block main_content %}
11
-  
12
-  {% block content %}{% endblock %}
13
-  
14
-{% endblock %}

+ 0 - 44
src/Muzich/AdminBundle/Resources/views/Moderate/tags.html.twig View File

@@ -1,44 +0,0 @@
1
-{% extends "MuzichAdminBundle:Moderate:layout.html.twig" %}
2
-
3
-{% block title %}{% endblock %}
4
-
5
-{% block content %}
6
-
7
-  <h2>{{ 'moderate.tags.title'|trans({}, 'adminui') }}</h2>
8
-    
9
-  <ul id="moderate_tags">
10
-    {% for tag in tags %}
11
-      <li class="tag">
12
-        <a href="{{ path('MuzichAdminBundle_moderate_tags_accept_tag', {'tag_id' : tag.id}) }}" class="accept">
13
-         [V]
14
-        </a>
15
-        <a href="{{ path('MuzichAdminBundle_moderate_tags_refuse_tag', {'tag_id' : tag.id}) }}" class="refuse">
16
-         [X]
17
-        </a>
18
-        <a href="{{ path('MuzichAdminBundle_moderate_tags_replace_tag', {
19
-          'tag_id' : tag.id
20
-        }) }}" class="replace">
21
-         [R]
22
-        </a>
23
-        <span class="name">
24
-          {{ tag.name }}
25
-        </span>
26
-          
27
-        <form action="#" name="moderate_tag_{{ tag.id }}">
28
-          {% include "MuzichCoreBundle:Tag:tagsPrompt.html.twig" with { 
29
-            'form_name'     : 'moderate_tag_' ~ tag.id 
30
-          } %}
31
-            
32
-            <input type="hidden" class="tagBox_tags_ids" name="tagBox_tags_ids" />
33
-            
34
-        </form>
35
-          
36
-        <p>
37
-          {{ tag.arguments }}
38
-        </p>
39
-          
40
-      </li>
41
-    {% endfor %}
42
-  </ul>
43
-
44
-{% endblock %}

+ 0 - 17
src/Muzich/AdminBundle/Tests/Controller/DefaultControllerTest.php View File

@@ -1,17 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\AdminBundle\Tests\Controller;
4
-
5
-use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6
-
7
-class DefaultControllerTest extends WebTestCase
8
-{
9
-    public function testIndex()
10
-    {
11
-        $client = static::createClient();
12
-
13
-        $crawler = $client->request('GET', '/hello/Fabien');
14
-
15
-        $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
16
-    }
17
-}

+ 0 - 44
src/Muzich/CoreBundle/Admin/ElementAdmin.php View File

@@ -1,44 +0,0 @@
1
-<?php
2
-
3
-namespace Muzich\CoreBundle\Admin;
4
-
5
-use Sonata\AdminBundle\Admin\Admin;
6
-use Sonata\AdminBundle\Form\FormMapper;
7
-use Sonata\AdminBundle\Datagrid\DatagridMapper;
8
-use Sonata\AdminBundle\Datagrid\ListMapper;
9
-use Sonata\AdminBundle\Show\ShowMapper;
10
-
11
-class ElementAdmin extends Admin
12
-{
13
-  
14
-  protected $baseRouteName = 'elements_admin';
15
-  
16
-  protected function configureListFields(ListMapper $listMapper)
17
-  {
18
-    $listMapper
19
-      ->addIdentifier('id')
20
-      ->add('name')
21
-      ->add('url')
22
-
23
-      // add custom action links
24
-      ->add('_action', 'actions', array(
25
-        'actions' => array(
26
-          'view' => array(),
27
-          'edit' => array(),
28
-        )
29
-      ))
30
-    ;
31
-  }
32
-  
33
-  protected function configureDatagridFilters(DatagridMapper $datagrid)
34
-  {
35
-    $datagrid
36
-      ->add('name')
37
-      ->add('url')
38
-      ->add('tags', null, array('label' => 'les tags'), null, array('expanded' => true, 'multiple' => true))
39
-    ;
40
-  }
41
-  
42
-}
43
-
44
-?>

+ 2 - 2
src/Muzich/CoreBundle/Controller/CoreController.php View File

@@ -34,7 +34,7 @@ class CoreController extends Controller
34 34
   {
35 35
     if($language != null)
36 36
     {
37
-      $old = $this->get('session')->getLocale();
37
+      $old = $this->container->get('request')->getLocale();
38 38
       $this->get('session')->setLocale($language);
39 39
     }
40 40
     
@@ -241,7 +241,7 @@ class CoreController extends Controller
241 241
     $element = new Element();
242 242
     $element->setType('none');
243 243
     $form = $this->getAddForm($element);
244
-    $form->bindRequest($this->getRequest());
244
+    $form->bind($this->getRequest());
245 245
         
246 246
     if ($form->isValid())
247 247
     {

+ 3 - 3
src/Muzich/CoreBundle/Controller/ElementController.php View File

@@ -128,7 +128,7 @@ class ElementController extends Controller
128 128
     $group = $element->getGroup();
129 129
     $element->setGroup(null);
130 130
     $form = $this->getAddForm($element);
131
-    $form->bindRequest($this->getRequest());
131
+    $form->bind($this->getRequest());
132 132
     
133 133
     $errors = array();
134 134
     $html = '';
@@ -344,7 +344,7 @@ class ElementController extends Controller
344 344
      */
345 345
     $es = $this->getElementSearcher(null, true);
346 346
     $search_form = $this->getSearchForm($es);
347
-    $search_form->bindRequest($this->getRequest());
347
+    $search_form->bind($this->getRequest());
348 348
     
349 349
     if ($search_form->isValid())
350 350
     {
@@ -397,7 +397,7 @@ class ElementController extends Controller
397 397
      */
398 398
     $es = $this->getElementSearcher(null, true);
399 399
     $search_form = $this->getSearchForm($es);
400
-    $search_form->bindRequest($this->getRequest());
400
+    $search_form->bind($this->getRequest());
401 401
     
402 402
     if ($search_form->isValid())
403 403
     {

+ 2 - 2
src/Muzich/CoreBundle/Controller/SearchController.php View File

@@ -78,7 +78,7 @@ class SearchController extends Controller
78 78
     if ($request->getMethod() == 'POST')
79 79
     {
80 80
       $form_submited = true;
81
-      $search_form->bindRequest($request);
81
+      $search_form->bind($request);
82 82
       // Si le formulaire est valide
83 83
       if ($search_form->isValid())
84 84
       {
@@ -356,7 +356,7 @@ class SearchController extends Controller
356 356
     
357 357
     if ($request->getMethod() == 'POST')
358 358
     {
359
-      $form->bindRequest($request);
359
+      $form->bind($request);
360 360
       if ($form->isValid())
361 361
       {
362 362
         $results = $searcher->getResults(

+ 3 - 4
src/Muzich/CoreBundle/Entity/Element.php View File

@@ -93,7 +93,7 @@ class Element
93 93
    * 
94 94
    * @ORM\Column(type="string", length=64)
95 95
    * @Assert\NotBlank()
96
-   * @Assert\MaxLength(1024)
96
+   * @Assert\Length(max = 255)
97 97
    */
98 98
   protected $type;
99 99
   
@@ -168,7 +168,7 @@ class Element
168 168
    * 
169 169
    * @ORM\Column(type="string", length=1024)
170 170
    * @Assert\NotBlank(message = "error.element.url.notblank")
171
-   * @Assert\MaxLength(limit = 1024, message = "error.element.url.tolong")
171
+   * @Assert\Length(max = 1024, maxMessage="error.element.url.tolong")
172 172
    * @Assert\Url(message = "error.element.url.invalid")
173 173
    * @var type string
174 174
    */
@@ -179,8 +179,7 @@ class Element
179 179
    * 
180 180
    * @ORM\Column(type = "string", length = 128)
181 181
    * @Assert\NotBlank(message = "error.element.name.notblank")
182
-   * @Assert\MinLength(limit = 3, message = "error.element.name.toshort")
183
-   * @Assert\MaxLength(limit = 64, message = "error.element.name.tolong")
182
+   * @Assert\Length(min = 3, max = 84, minMessage = "error.element.name.toshort", maxMessage = "error.element.name.tolong")
184 183
    * @var type string
185 184
    */
186 185
   protected $name;

+ 2 - 3
src/Muzich/CoreBundle/Entity/Group.php View File

@@ -38,8 +38,7 @@ class Group
38 38
    * 
39 39
    * @ORM\Column(type="string", length=128, unique=true)
40 40
    * @Assert\NotBlank()
41
-   * @Assert\MinLength(limit=3)
42
-   * @Assert\MaxLength(64)
41
+   * @Assert\Length(min = 3, max = 64)
43 42
    * @var type string
44 43
    */
45 44
   protected $name;
@@ -54,7 +53,7 @@ class Group
54 53
    * Description
55 54
    * 
56 55
    * @ORM\Column(type="text", nullable=true)
57
-   * @Assert\MaxLength(2048)
56
+   * @Assert\Length(max = 4096)
58 57
    * @var type string
59 58
    */
60 59
   protected $description;

+ 1 - 2
src/Muzich/CoreBundle/Entity/RegistrationToken.php View File

@@ -29,8 +29,7 @@ class RegistrationToken
29 29
    * 
30 30
    * @ORM\Column(type="string", length=32, unique=true)
31 31
    * @Assert\NotBlank()
32
-   * @Assert\MinLength(limit=3)
33
-   * @Assert\MaxLength(32)
32
+   * @Assert\Length(min = 3, max = 32)
34 33
    * @var type string
35 34
    */
36 35
   protected $token;

+ 3 - 3
src/Muzich/CoreBundle/Entity/User.php View File

@@ -640,7 +640,7 @@ class User extends BaseUser
640 640
 //  }
641 641
   
642 642
 //  /**
643
-//  * @ORM\prePersist
643
+//  * @ORM\PrePersist
644 644
 //  */
645 645
 //  public function setSlug()
646 646
 //  {
@@ -672,7 +672,7 @@ class User extends BaseUser
672 672
   /**
673 673
    * Retourn si l'user_id transmis est l'un des User suivis
674 674
    * 
675
-   * @param Symfony\Bundle\DoctrineBundle\Registry doctrine
675
+   * @param Doctrine\Bundle\DoctrineBundle\Registry doctrine
676 676
    * @param int $user_id 
677 677
    * @return boolean
678 678
    */
@@ -687,7 +687,7 @@ class User extends BaseUser
687 687
   /**
688 688
    * Retourn si l'group_id transmis est l'un des groupe suivis
689 689
    * 
690
-   * @param Symfony\Bundle\DoctrineBundle\Registry doctrine
690
+   * @param Doctrine\Bundle\DoctrineBundle\Registry doctrine
691 691
    * @param int $user_id 
692 692
    * @return boolean
693 693
    */

+ 2 - 2
src/Muzich/CoreBundle/Entity/UsersTagsFavorites.php View File

@@ -121,7 +121,7 @@ class UsersTagsFavorites
121 121
   }
122 122
   
123 123
   /**
124
-   * @ORM\prePersist
124
+   * @ORM\PrePersist
125 125
    */
126 126
   public function prePersist()
127 127
   {
@@ -129,7 +129,7 @@ class UsersTagsFavorites
129 129
   }
130 130
   
131 131
   /**
132
-   * @ORM\preRemove
132
+   * @ORM\PreRemove
133 133
    */
134 134
   public function preRemove()
135 135
   {

+ 1 - 1
src/Muzich/CoreBundle/Extension/MyTwigExtension.php View File

@@ -196,7 +196,7 @@ class MyTwigExtension extends \Twig_Extension {
196 196
   {
197 197
     $form_vars = $form->getVars();
198 198
     $count_error = count($form_vars['errors']);
199
-    foreach ($form->getChildren() as $form_children)
199
+    foreach ($form as $form_children)
200 200
     {
201 201
       $form_children_vars = $form_children->getVars();
202 202
       $count_error += count($form_children_vars['errors']);

+ 11 - 7
src/Muzich/CoreBundle/Form/Element/ElementAddForm.php View File

@@ -3,13 +3,14 @@
3 3
 namespace Muzich\CoreBundle\Form\Element;
4 4
 
5 5
 use Symfony\Component\Form\AbstractType;
6
-use Symfony\Component\Form\FormBuilder;
6
+use Symfony\Component\Form\FormBuilderInterface;
7
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
7 8
 
8 9
 class ElementAddForm extends AbstractType
9 10
 {
10 11
   private $name = null;
11 12
   
12
-  public function buildForm(FormBuilder $builder, array $options)
13
+  public function buildForm(FormBuilderInterface $builder, array $options)
13 14
   {    
14 15
     $builder->add('name', 'text', array(
15 16
       'required' => true,
@@ -44,15 +45,18 @@ class ElementAddForm extends AbstractType
44 45
     return 'element_add';
45 46
   }
46 47
   
47
-  public function getDefaultOptions(array $options)
48
+  public function setDefaultOptions(OptionsResolverInterface $resolver)
48 49
   {
49
-    return array(
50
+    $resolver->setDefaults(array(
50 51
       'name' => '',
51 52
       'url' => '',
52 53
       'tags' => '',
53 54
       'need_tags' => false,
54
-      //'groups' => array(),
55
-      'data_class' => 'Muzich\CoreBundle\Entity\Element'
56
-    );
55
+      //'data_class' => 'Muzich\CoreBundle\Entity\Element'
56
+    ));
57
+  
58
+    $resolver->setAllowedValues(array(
59
+      'need_tags'       => array(true, false)
60
+    ));
57 61
   }
58 62
 }

+ 14 - 9
src/Muzich/CoreBundle/Form/Group/GroupForm.php View File

@@ -3,11 +3,12 @@
3 3
 namespace Muzich\CoreBundle\Form\Group;
4 4
 
5 5
 use Symfony\Component\Form\AbstractType;
6
-use Symfony\Component\Form\FormBuilder;
6
+use Symfony\Component\Form\FormBuilderInterface;
7
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
7 8
 
8 9
 class GroupForm extends AbstractType
9 10
 {
10
-  public function buildForm(FormBuilder $builder, array $options)
11
+  public function buildForm(FormBuilderInterface $builder, array $options)
11 12
   {
12 13
     $builder->add('name', 'text', array(
13 14
       'required' => true,
@@ -29,14 +30,18 @@ class GroupForm extends AbstractType
29 30
     return 'group';
30 31
   }
31 32
   
32
-  public function getDefaultOptions(array $options)
33
+  public function setDefaultOptions(OptionsResolverInterface $resolver)
33 34
   {
34
-    return array(
35
-      'name' => '',
36
-      'open' => true,
37
-      'tags' => '',
38
-      'data_class' => 'Muzich\CoreBundle\Entity\Group'
39
-    );
35
+    $resolver->setDefaults(array(
36
+      'name'       => '',
37
+      'open'       => true,
38
+      'tags'       => '',
39
+      //'data_class' => 'Muzich\CoreBundle\Entity\Group'
40
+    ));
41
+  
42
+    $resolver->setAllowedValues(array(
43
+      'open'       => array(true, false)
44
+    ));
40 45
   }
41 46
 }
42 47
 

+ 8 - 6
src/Muzich/CoreBundle/Form/Search/ElementSearchForm.php View File

@@ -3,12 +3,13 @@
3 3
 namespace Muzich\CoreBundle\Form\Search;
4 4
 
5 5
 use Symfony\Component\Form\AbstractType;
6
-use Symfony\Component\Form\FormBuilder;
6
+use Symfony\Component\Form\FormBuilderInterface;
7 7
 use Muzich\CoreBundle\Searcher\ElementSearcher;
8
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
8 9
 
9 10
 class ElementSearchForm extends AbstractType
10 11
 {
11
-  public function buildForm(FormBuilder $builder, array $options)
12
+  public function buildForm(FormBuilderInterface $builder, array $options)
12 13
   {
13 14
     $builder->add('network', 'choice', array(
14 15
       'choices' => array(
@@ -30,10 +31,11 @@ class ElementSearchForm extends AbstractType
30 31
     return 'element_search_form';
31 32
   }
32 33
   
33
-  public function getDefaultOptions(array $options)
34
+  public function setDefaultOptions(OptionsResolverInterface $resolver)
34 35
   {
35
-    return array(
36
-      'tags' => ''
37
-    );
36
+    $resolver->setDefaults(array(
37
+      'tags'       => '',
38
+      //'data_class' => null
39
+    ));
38 40
   }
39 41
 }

+ 8 - 6
src/Muzich/CoreBundle/Form/Tag/TagFavoritesForm.php View File

@@ -3,11 +3,12 @@
3 3
 namespace Muzich\CoreBundle\Form\Tag;
4 4
 
5 5
 use Symfony\Component\Form\AbstractType;
6
-use Symfony\Component\Form\FormBuilder;
6
+use Symfony\Component\Form\FormBuilderInterface;
7
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
7 8
 
8 9
 class TagFavoritesForm extends AbstractType
9 10
 {
10
-  public function buildForm(FormBuilder $builder, array $options)
11
+  public function buildForm(FormBuilderInterface $builder, array $options)
11 12
   {    
12 13
     $builder->add('tags', 'hidden');
13 14
   }
@@ -17,10 +18,11 @@ class TagFavoritesForm extends AbstractType
17 18
     return 'tag_favorites_form';
18 19
   }
19 20
   
20
-  public function getDefaultOptions(array $options)
21
+  public function setDefaultOptions(OptionsResolverInterface $resolver)
21 22
   {
22
-    return array(
23
-      'tags' => '',
24
-    );
23
+    $resolver->setDefaults(array(
24
+      'tags'       => '',
25
+      //'data_class' => null
26
+    ));
25 27
   }
26 28
 }

+ 2 - 2
src/Muzich/CoreBundle/Managers/TagManager.php View File

@@ -6,7 +6,7 @@ use Muzich\CoreBundle\Entity\Tag;
6 6
 use Doctrine\ORM\EntityManager;
7 7
 use Symfony\Component\DependencyInjection\Container;
8 8
 use FOS\UserBundle\Util\CanonicalizerInterface;
9
-use Symfony\Bundle\DoctrineBundle\Registry;
9
+use Doctrine\Bundle\DoctrineBundle\Registry;
10 10
 use Muzich\CoreBundle\Util\StrictCanonicalizer;
11 11
 use Muzich\CoreBundle\Entity\UsersTagsFavorites;
12 12
 use Muzich\CoreBundle\Entity\GroupsTagsFavorites;
@@ -180,7 +180,7 @@ class TagManager
180 180
   
181 181
   /**
182 182
    * 
183
-   * @param \Symfony\Bundle\DoctrineBundle\Registry $doctrine
183
+   * @param \Doctrine\Bundle\DoctrineBundle\Registry $doctrine
184 184
    * @param \Muzich\CoreBundle\Entity\Tag $tag
185 185
    * @param type $accept
186 186
    * @param type $replacing_id

+ 9 - 2
src/Muzich/CoreBundle/Resources/config/security.yml View File

@@ -1,11 +1,16 @@
1 1
 parameters:
2 2
     # ... other parameters
3
-    security.acl.permission.map.class: Sonata\AdminBundle\Security\Acl\Permission\AdminPermissionMap
3
+    #security.acl.permission.map.class: Sonata\AdminBundle\Security\Acl\Permission\AdminPermissionMap
4 4
     
5 5
 security:
6 6
     providers:
7 7
         fos_userbundle:
8 8
             id: fos_user.user_manager
9
+    encoders:
10
+        "FOS\UserBundle\Model\UserInterface":
11
+            algorithm: sha512
12
+            encode_as_base64: false
13
+            iterations: 1
9 14
 
10 15
     firewalls:
11 16
         main:
@@ -36,7 +41,8 @@ security:
36 41
         
37 42
     role_hierarchy:
38 43
         ROLE_ADMIN:       ROLE_USER
39
-        ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_SONATA_ADMIN, ROLE_ALLOWED_TO_SWITCH]
44
+        #ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_SONATA_ADMIN, ROLE_ALLOWED_TO_SWITCH]
45
+        ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
40 46
         
41 47
     acl:
42 48
         connection: default
@@ -66,6 +72,7 @@ security:
66 72
         
67 73
         - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
68 74
         - { path: ^/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
75
+        - { path: ^/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
69 76
         
70 77
         ## Ouvert pour l'ajax (et le message de redirection en cas de déco)
71 78
         - { path: ^/(?:fr|en)/search-elements, role: IS_AUTHENTICATED_ANONYMOUSLY }

+ 0 - 7
src/Muzich/CoreBundle/Resources/config/validation.yml View File

@@ -1,7 +0,0 @@
1
-##
2
-
3
-Muzich\CoreBundle\Entity\User:
4
-  properties:
5
-    username:
6
-      - MinLength: { limit: 3}
7
-      - MaxLength: { limit: 32}

+ 19 - 6
src/Muzich/CoreBundle/Resources/views/Form/errors.html.twig View File

@@ -1,11 +1,24 @@
1 1
 {% block field_errors %}
2 2
 {% spaceless %}
3
-  {% if errors|length > 0 %}
4
-  <ul class="error_list">
5
-    {% for error in errors %}
6
-      <li>{{ error.messageTemplate|trans(error.messageParameters, 'validators') }}</li>
7
-    {% endfor %}
8
-  </ul>
3
+  
4
+  {% if compound %}
5
+    {# Edit du a migration to 2.1 #}
6
+      {% if errors|length > 0 %}
7
+      <ul class="error_list">
8
+        {% for error in errors %}
9
+          <li>{{ error.messageTemplate|trans(error.messageParameters, 'validators') }}</li>
10
+        {% endfor %}
11
+      </ul>
12
+      {% endif %}
13
+  {% else %}
14
+      {% if errors|length > 0 %}
15
+      <ul class="error_list">
16
+        {% for error in errors %}
17
+          <li>{{ error.messageTemplate|trans(error.messageParameters, 'validators') }}</li>
18
+        {% endfor %}
19
+      </ul>
9 20
   {% endif %}
21
+  {% endif %}
22
+  
10 23
 {% endspaceless %}
11 24
 {% endblock field_errors %}

+ 2 - 2
src/Muzich/CoreBundle/Resources/views/Language/languages.html.twig View File

@@ -1,4 +1,4 @@
1 1
 <div id="languages">
2
-  <a {% if app.session.locale == 'fr' %}class="selected"{% endif %} href="{{ path('change_language', {'language' : 'fr'}) }}">FR</a>
3
-  <a {% if app.session.locale == 'en' %}class="selected"{% endif %} href="{{ path('change_language', {'language' : 'en'}) }}">EN</a>
2
+  <a {% if app.request.locale == 'fr' %}class="selected"{% endif %} href="{{ path('change_language', {'language' : 'fr'}) }}">FR</a>
3
+  <a {% if app.request.locale == 'en' %}class="selected"{% endif %} href="{{ path('change_language', {'language' : 'en'}) }}">EN</a>
4 4
 </div>

+ 17 - 15
src/Muzich/CoreBundle/Resources/views/Layout/flash_messages.html.twig View File

@@ -1,16 +1,18 @@
1
-{% for key, flash in app.session.getFlashes() %}
2
-  <div class="{{ key }} message">
3
-    <a class="message-close" href="javascript:void(0);" title="fermer"><img alt="close" src="{{ asset('bundles/muzichcore/img/1317386146_cancel.png') }}" /></a>
4
-    <h3>{{ flash|trans({}, 'flash') }}</h3>
5
-  </div>
6
-
7
-  {% if key == 'success' %}
8
-  <script type="text/javascript" >
9
-    $(document).ready(function(){
10
-      window.setTimeout(function(){
11
-        $('div.success').slideUp();
12
-      }, 3000);
13
-    });
14
-  </script>
15
-  {% endif %}
1
+{% for key, flashMessages in app.session.flashbag.all() %}
2
+  {% for flashMessage in flashMessages %}
3
+    <div class="{{ key }} message">
4
+      <a class="message-close" href="javascript:void(0);" title="fermer"><img alt="close" src="{{ asset('bundles/muzichcore/img/1317386146_cancel.png') }}" /></a>
5
+      <h3>{{ flashMessage|trans({}, 'flash') }}</h3>
6
+    </div>
7
+  
8
+    {% if key == 'success' %}
9
+    <script type="text/javascript" >
10
+      $(document).ready(function(){
11
+        window.setTimeout(function(){
12
+          $('div.success').slideUp();
13
+        }, 3000);
14
+      });
15
+    </script>
16
+    {% endif %}
17
+  {% endfor %}
16 18
 {% endfor %}

+ 1 - 1
src/Muzich/CoreBundle/Searcher/ElementSearcher.php View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 namespace Muzich\CoreBundle\Searcher;
4 4
 
5
-use Symfony\Bundle\DoctrineBundle\Registry;
5
+use Doctrine\Bundle\DoctrineBundle\Registry;
6 6
 
7 7
 class ElementSearcher extends Searcher implements SearcherInterface
8 8
 {

+ 2 - 2
src/Muzich/CoreBundle/Searcher/GlobalSearcher.php View File

@@ -3,7 +3,7 @@
3 3
 namespace Muzich\CoreBundle\Searcher;
4 4
 
5 5
 use Symfony\Component\Validator\Constraints as Assert;
6
-use Symfony\Bundle\DoctrineBundle\Registry;
6
+use Doctrine\Bundle\DoctrineBundle\Registry;
7 7
 use Muzich\CoreBundle\Searcher\UserAndGroupSearcher;
8 8
 use Muzich\CoreBundle\Searcher\ElementSearcher;
9 9
 
@@ -19,7 +19,7 @@ class GlobalSearcher extends Searcher implements SearcherInterface
19 19
    * @var string
20 20
    * @Assert\NotBlank()
21 21
    * @Assert\Type("string")
22
-   * @Assert\MinLength(3)
22
+   * @Assert\Length(min = 3)
23 23
    */
24 24
   protected $string;
25 25
     

+ 1 - 1
src/Muzich/CoreBundle/Searcher/Searcher.php View File

@@ -3,7 +3,7 @@
3 3
 namespace Muzich\CoreBundle\Searcher;
4 4
 
5 5
 use Doctrine\ORM\Query;
6
-use Symfony\Bundle\DoctrineBundle\Registry;
6
+use Doctrine\Bundle\DoctrineBundle\Registry;
7 7
 
8 8
 /**
9 9
  * Objet utiliser pour cadrer la recherche.

+ 2 - 2
src/Muzich/CoreBundle/Searcher/UserAndGroupSearcher.php View File

@@ -3,7 +3,7 @@
3 3
 namespace Muzich\CoreBundle\Searcher;
4 4
 
5 5
 use Symfony\Component\Validator\Constraints as Assert;
6
-use Symfony\Bundle\DoctrineBundle\Registry;
6
+use Doctrine\Bundle\DoctrineBundle\Registry;
7 7
 
8 8
 /**
9 9
  * Objet de recherche
@@ -17,7 +17,7 @@ class UserAndGroupSearcher extends Searcher implements SearcherInterface
17 17
    * @var string
18 18
    * @Assert\NotBlank()
19 19
    * @Assert\Type("string")
20
-   * @Assert\MinLength(3)
20
+   * @Assert\Length(min = 3)
21 21
    */
22 22
   protected $string;
23 23
     

+ 1 - 1
src/Muzich/CoreBundle/Util/TagLike.php View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 namespace Muzich\CoreBundle\Util;
4 4
 
5
-use Symfony\Bundle\DoctrineBundle\Registry;
5
+use Doctrine\Bundle\DoctrineBundle\Registry;
6 6
 use Muzich\CoreBundle\Util\StrictCanonicalizer;
7 7
 
8 8
 /**

+ 1 - 1
src/Muzich/CoreBundle/Validator/GroupOwnedOrPublic.php View File

@@ -9,7 +9,7 @@ use Symfony\Component\Validator\Constraint;
9 9
  */
10 10
 class GroupOwnedOrPublic extends Constraint
11 11
 {
12
-  public $message = 'Le groupe est mal choisis';
12
+  public $message = 'group_malchoisis';
13 13
   public $entity;
14 14
   public $property;
15 15
 

+ 4 - 2
src/Muzich/CoreBundle/Validator/GroupOwnedOrPublicValidator.php View File

@@ -39,13 +39,15 @@ class GroupOwnedOrPublicValidator extends ConstraintValidator
39 39
       ;
40 40
       if (!$group)
41 41
       {
42
-        $this->setMessage('Le groupe est invalide');
42
+        //$this->setMessage('Le groupe est invalide'); UPGRADE 2.1
43
+        $this->context->addViolation('group_invalid');
43 44
         return false;
44 45
       }
45 46
       
46 47
       if (!$group->userCanAddElement($user))
47 48
       {
48
-        $this->setMessage('Le groupe est invalide');
49
+        //$this->setMessage('Le groupe est invalide'); UPGRADE 2.1
50
+        $this->context->addViolation('group_invalid');
49 51
         return false;
50 52
       }
51 53
     }

+ 4 - 2
src/Muzich/CoreBundle/Validator/TagsValidator.php View File

@@ -24,7 +24,8 @@ class TagsValidator extends ConstraintValidator
24 24
     {
25 25
       if (array_diff($value, array_unique($value)))
26 26
       {
27
-        $this->setMessage('Tags saisies incorrects');
27
+        //$this->setMessage('Tags saisies incorrects');UPGRADE 2.1
28
+        $this->context->addViolation('tags_saisinco');
28 29
         return false;
29 30
       }
30 31
 
@@ -37,7 +38,8 @@ class TagsValidator extends ConstraintValidator
37 38
 
38 39
       if ($count != count ($value))
39 40
       {
40
-        $this->setMessage('Tags saisies incorrects');
41
+        //$this->setMessage('Tags saisies incorrects');UPGRADE 2.1
42
+        $this->context->addViolation('tags_saisinco');
41 43
         return false;
42 44
       }
43 45
     }

+ 13 - 9
src/Muzich/CoreBundle/lib/Controller.php View File

@@ -47,7 +47,7 @@ class Controller extends BaseController
47 47
   }
48 48
   
49 49
   /**
50
-   * @desc Retourn l'objet ElementSearcher en cours.
50
+   * Retourn l'objet ElementSearcher en cours.
51 51
    * 
52 52
    * @param int $count Si renseigné impact le nombre d'éléments qui seront 
53 53
    * récupérés
@@ -117,7 +117,7 @@ class Controller extends BaseController
117 117
    * @param boolean $force_refresh
118 118
    * @return \Muzich\CoreBundle\Entity\User 
119 119
    */
120
-  protected function getUser($personal_query = false, $params = array(), $force_refresh = false)
120
+  public function getUser($personal_query = false, $params = array(), $force_refresh = false)
121 121
   {
122 122
     if (!$personal_query)
123 123
     {
@@ -153,7 +153,7 @@ class Controller extends BaseController
153 153
   }
154 154
   
155 155
   /**
156
-   * @desc Retourne l'id de l'utilisateur en cours
156
+   *  Retourne l'id de l'utilisateur en cours
157 157
    */
158 158
   protected function getUserId()
159 159
   {
@@ -329,13 +329,17 @@ class Controller extends BaseController
329 329
    */
330 330
   protected function getAddForm($element = array(), $name = null)
331 331
   {
332
+    //$form = new ElementAddForm();
333
+    //$form->setName($name);
334
+    //return $this->createForm(
335
+    //  $form,
336
+    //  $element,
337
+    //  array()
338
+    //);
339
+  
332 340
     $form = new ElementAddForm();
333 341
     $form->setName($name);
334
-    return $this->createForm(
335
-      $form,
336
-      $element,
337
-      array()
338
-    );
342
+    return $this->createForm($form, $element);
339 343
   }
340 344
   
341 345
   /**
@@ -403,7 +407,7 @@ class Controller extends BaseController
403 407
     
404 408
     if ($this->getUser() == 'anon.')
405 409
     {
406
-      $this->setFlash('info', 'user.session_expired');
410
+      $this->setFlash('error', 'user.session_expired');
407 411
       
408 412
       if ($this->getRequest()->isXmlHttpRequest())
409 413
       {

+ 2 - 2
src/Muzich/CoreBundle/lib/FunctionalTest.php View File

@@ -145,7 +145,7 @@ class FunctionalTest extends WebTestCase
145 145
       $pass2,
146 146
       $token
147 147
     );
148
-    $this->outputDebug();
148
+    
149 149
     $this->isResponseRedirection();
150 150
     $this->followRedirection();
151 151
     $this->isResponseSuccess();
@@ -326,7 +326,7 @@ class FunctionalTest extends WebTestCase
326 326
 
327 327
   /**
328 328
    *
329
-   * @return \Symfony\Bundle\DoctrineBundle\Registry
329
+   * @return \Doctrine\Bundle\DoctrineBundle\Registry
330 330
    */
331 331
   protected function getDoctrine()
332 332
   {

+ 1 - 1
src/Muzich/CoreBundle/lib/Tag.php View File

@@ -51,7 +51,7 @@ class Tag
51 51
   }
52 52
   
53 53
   /**
54
-   * @desc Range une liste de tags [0 => Tag] en fonction d'une
54
+   * Range une liste de tags [0 => Tag] en fonction d'une
55 55
    * réfèrence sous la forme [0 => tag_id, 1 => tag_id]
56 56
    * 
57 57
    * @param array $tags

+ 1 - 1
src/Muzich/CoreBundle/lib/UnitTest.php View File

@@ -25,7 +25,7 @@ class UnitTest extends \PHPUnit_Framework_TestCase
25 25
   
26 26
   /**
27 27
    *
28
-   * @return \Symfony\Bundle\DoctrineBundle\Registry
28
+   * @return \Doctrine\Bundle\DoctrineBundle\Registry
29 29
    */
30 30
   protected function getDoctrine()
31 31
   {

+ 2 - 2
src/Muzich/GroupBundle/Controller/DefaultController.php View File

@@ -71,7 +71,7 @@ class DefaultController extends Controller
71 71
     $new_group->setOwner($user);
72 72
     $form_new = $this->getGroupForm($new_group);
73 73
     
74
-    $form_new->bindRequest($request);
74
+    $form_new->bind($request);
75 75
     
76 76
     if ($form_new->isValid())
77 77
     {
@@ -171,7 +171,7 @@ class DefaultController extends Controller
171 171
     $group->setTags($group->getTagsIdsJson());
172 172
     $form = $this->getGroupForm($group);
173 173
     
174
-    $form->bindRequest($request);
174
+    $form->bind($request);
175 175
     
176 176
     if ($form->isValid())
177 177
     {

+ 2 - 2
src/Muzich/IndexBundle/Controller/IndexController.php View File

@@ -44,7 +44,7 @@ class IndexController extends Controller
44 44
     $request = $this->container->get('request');
45 45
     /* @var $request \Symfony\Component\HttpFoundation\Request */
46 46
     $session = $request->getSession();
47
-    /* @var $session \Symfony\Component\HttpFoundation\Session */
47
+    /* @var $session Symfony\Component\HttpFoundation\Session\Session */
48 48
 
49 49
     // get the error if any (works with forward and redirect -- see below)
50 50
     if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
@@ -73,7 +73,7 @@ class IndexController extends Controller
73 73
   public function presubscriptionAction(Request $request)
74 74
   {
75 75
     $form = $this->getPreSubscriptionForm();
76
-    $form->bindRequest($request);
76
+    $form->bind($request);
77 77
     if ($form->isValid())
78 78
     {
79 79
       $this->persist($form->getData());

+ 14 - 9
src/Muzich/UserBundle/Controller/UserController.php View File

@@ -24,7 +24,8 @@ class UserController extends Controller
24 24
     ));
25 25
     
26 26
     return $this->createFormBuilder(null, array(
27
-      'validation_constraint' => $collectionConstraint,
27
+      //'validation_constraint' => $collectionConstraint, UPGRADE 2.1
28
+      'constraints' => $collectionConstraint,
28 29
     ))
29 30
       ->add('email', 'text')
30 31
       ->getForm()
@@ -139,7 +140,7 @@ class UserController extends Controller
139 140
   protected function checkRegistrationInformations($form)
140 141
   {
141 142
     $errors = array();
142
-    $form->bindRequest($this->getRequest());
143
+    $form->bind($this->getRequest());
143 144
     $form_values = $this->getRequest()->request->get($form->getName());
144 145
     $user = $form->getData();
145 146
     
@@ -225,7 +226,7 @@ class UserController extends Controller
225 226
     }
226 227
     else
227 228
     {
228
-      $form->bindRequest($this->getRequest());
229
+      $form->bind($this->getRequest());
229 230
       $errors[] = $this->get('translator')->trans(
230 231
         'registration.token.error', 
231 232
         array(),
@@ -371,7 +372,7 @@ class UserController extends Controller
371 372
     
372 373
     if ($request->getMethod() == 'POST')
373 374
     {
374
-      $form->bindRequest($request);
375
+      $form->bind($request);
375 376
       if ($form->isValid())
376 377
       {
377 378
         $data = $form->getData();
@@ -442,7 +443,7 @@ class UserController extends Controller
442 443
     $request = $this->getRequest();
443 444
     $change_email_form = $this->getChangeEmailForm();
444 445
     
445
-    $change_email_form->bindRequest($request);
446
+    $change_email_form->bind($request);
446 447
     if ($change_email_form->isValid())
447 448
     {
448 449
       $data = $change_email_form->getData();
@@ -462,7 +463,11 @@ class UserController extends Controller
462 463
       // On renseigne en base l'email demandé
463 464
       $user->setEmailRequested($email);
464 465
       $user->setEmailRequestedDatetime(time());
465
-      $user->generateConfirmationToken();
466
+      
467
+      //$user->generateConfirmationToken(); UPGRADE FOSUserBundle 1.3
468
+      $tokenGenerator = $this->container->get('fos_user.util.token_generator');
469
+      $user->setConfirmationToken($tokenGenerator->generateToken());
470
+      
466 471
       $token = hash('sha256', $user->getConfirmationToken().$email);
467 472
       $url = $this->get('router')->generate('change_email_confirm', array('token' => $token), true);
468 473
       $rendered = $this->get('templating')->render('MuzichUserBundle:User:change_email_mail.txt.twig', array(
@@ -486,7 +491,7 @@ class UserController extends Controller
486 491
       $mailer = $this->get('mailer');
487 492
       $mailer->send($message);
488 493
       
489
-      $this->setFlash('info', 'user.changeemail.mail_send');
494
+      $this->setFlash('success', 'user.changeemail.mail_send');
490 495
       $em->flush();
491 496
       return new RedirectResponse($this->generateUrl('my_account'));
492 497
     }
@@ -613,7 +618,7 @@ class UserController extends Controller
613 618
   public function updateAvatarAction(Request $request)
614 619
   {
615 620
     $form = $this->getAvatarForm();
616
-    $form->bindRequest($request);
621
+    $form->bind($request);
617 622
     
618 623
     if ($form->isValid()) {
619 624
       $em = $this->getEntityManager();
@@ -635,7 +640,7 @@ class UserController extends Controller
635 640
   public function updatePreferencesAction(Request $request)
636 641
   {
637 642
     $form = $this->getPreferencesForm();
638
-    $form->bindRequest($request);
643
+    $form->bind($request);
639 644
     
640 645
     if ($form->isValid()) {
641 646
       $em = $this->getEntityManager();

+ 3 - 2
src/Muzich/UserBundle/Entity/UserManager.php View File

@@ -9,7 +9,8 @@ namespace Muzich\UserBundle\Entity;
9 9
 use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
10 10
 use FOS\UserBundle\Util\CanonicalizerInterface;
11 11
 use Doctrine\ORM\EntityManager;
12
-use FOS\UserBundle\Entity\UserManager as UserManagerBase;
12
+//use FOS\UserBundle\Entity\UserManager as UserManagerBase; UPGRADE FOSUserBundle 1.3
13
+use FOS\UserBundle\Doctrine\UserManager as UserManagerBase;
13 14
 
14 15
 /**
15 16
  */
@@ -29,7 +30,7 @@ class UserManager extends UserManagerBase
29 30
     $evm->addEventSubscriber($sluggableListener);
30 31
     // now this event manager should be passed to entity manager constructor
31 32
 
32
-    $this->em->getEventManager()->addEventSubscriber($sluggableListener);
33
+    $this->objectManager->getEventManager()->addEventSubscriber($sluggableListener);
33 34
   }
34 35
 
35 36
 }

+ 4 - 3
src/Muzich/UserBundle/Form/Type/RegistrationFormType.php View File

@@ -2,17 +2,18 @@
2 2
 
3 3
 namespace Muzich\UserBundle\Form\Type;
4 4
 
5
-use Symfony\Component\Form\FormBuilder;
5
+use Symfony\Component\Form\FormBuilderInterface;
6 6
 use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType;
7 7
 
8 8
 class RegistrationFormType extends BaseType
9 9
 {
10
-  public function buildForm(FormBuilder $builder, array $options)
10
+  public function buildForm(FormBuilderInterface $builder, array $options)
11 11
   {
12 12
     parent::buildForm($builder, $options);
13 13
 
14 14
     $builder->add('token', 'text', array(
15
-      "property_path" => false
15
+      //"property_path" => false UPGRADE 2.1
16
+      'mapped' => false,
16 17
     ));
17 18
     
18 19
     $builder->add('cgu_accepted', 'checkbox', array(

+ 3 - 3
src/Muzich/UserBundle/Resources/views/Security/change_password_form.html.twig View File

@@ -11,9 +11,9 @@
11 11
 {% endif %}
12 12
     
13 13
   <div class="field">
14
-    {{ form_errors(form.current) }}
15
-    {{ form_label(form.current, 'password.actual'|trans({}, 'userform')) }}
16
-    {{ form_widget(form.current, {'attr':{'class':'niceinput'}}) }}
14
+    {{ form_errors(form.current_password) }}
15
+    {{ form_label(form.current_password, 'password.actual'|trans({}, 'userform')) }}
16
+    {{ form_widget(form.current_password, {'attr':{'class':'niceinput'}}) }}
17 17
   </div>
18 18
 
19 19
   <div class="field">

+ 2 - 2
src/Muzich/UserBundle/Resources/views/User/preference_form.html.twig View File

@@ -1,14 +1,14 @@
1 1
 
2 2
 <div class="field">
3 3
   {{ form_errors(form.mail_newsletter) }}
4
-  {{ form_label(form.mail_newsletter, '') }}
4
+  {{ form_label(form.mail_newsletter, '-') }}
5 5
   {{ form_widget(form.mail_newsletter, {'attr':{}}) }}
6 6
   {{ 'mail_newsletter'|trans({}, 'userform') }}
7 7
 </div>
8 8
 
9 9
 <div class="field">
10 10
   {{ form_errors(form.mail_partner) }}
11
-  {{ form_label(form.mail_partner, '') }}
11
+  {{ form_label(form.mail_partner, '-') }}
12 12
   {{ form_widget(form.mail_partner, {'attr':{}}) }}
13 13
   {{ 'mail_partner'|trans({}, 'userform') }}
14 14
 </div> 

+ 0 - 2
vendor/assetic/.gitignore View File

@@ -1,2 +0,0 @@
1
-phpunit.xml
2
-vendor/

+ 0 - 13
vendor/assetic/.travis.yml View File

@@ -1,13 +0,0 @@
1
-language: php
2
-
3
-php:
4
-    - 5.3
5
-    - 5.4
6
-
7
-before_script:
8
-    - git clone https://github.com/kamicane/packager.git vendor/packager --quiet --depth 1
9
-    - git clone https://github.com/leafo/lessphp.git vendor/lessphp --quiet --depth 1
10
-    - git clone https://github.com/fabpot/Twig.git vendor/twig --quiet --depth 1
11
-    - svn checkout http://cssmin.googlecode.com/svn/trunk/ vendor/cssmin --quiet
12
-
13
-script: phpunit --configuration phpunit.travis.xml

+ 0 - 36
vendor/assetic/CHANGELOG-1.0.md View File

@@ -1,36 +0,0 @@
1
-1.0.4 (August 28, 2012)
2
------------------------
3
-
4
- * Fixed the Twig tag to avoid a fatal error when left unclosed
5
- * Added the HashableInterface for non-serialiable filters
6
- * Fixed a bug for compass on windows
7
-
8
-1.0.3 (March 2, 2012)
9
----------------------
10
-
11
- * Added "boring" option to Compass filter
12
- * Fixed accumulation of load paths in Compass filter
13
- * Fixed issues in CssImport and CssRewrite filters
14
-
15
-1.0.2 (August 26, 2011)
16
------------------------
17
-
18
- * Twig 1.2 compatibility
19
- * Fixed filtering of large LessCSS assets
20
- * Fixed escaping of commands on Windows
21
- * Misc fixes to Compass filter
22
- * Removed default CssEmbed charset
23
-
24
-1.0.1 (July 15, 2011)
25
----------------------
26
-
27
- * Fixed Twig error handling
28
- * Removed use of STDIN
29
- * Added inheritance of environment variables
30
- * Fixed Compass on Windows
31
- * Improved escaping of commands
32
-
33
-1.0.0 (July 10, 2011)
34
----------------------
35
-
36
- * Initial release

+ 0 - 283
vendor/assetic/README.md View File

@@ -1,283 +0,0 @@
1
-# Assetic ![project status](http://stillmaintained.com/kriswallsmith/assetic.png) #
2
-
3
-Assetic is an asset management framework for PHP.
4
-
5
-``` php
6
-<?php
7
-
8
-use Assetic\Asset\AssetCollection;
9
-use Assetic\Asset\FileAsset;
10
-use Assetic\Asset\GlobAsset;
11
-
12
-$js = new AssetCollection(array(
13
-    new GlobAsset('/path/to/js/*'),
14
-    new FileAsset('/path/to/another.js'),
15
-));
16
-
17
-// the code is merged when the asset is dumped
18
-echo $js->dump();
19
-```
20
-
21
-Assets
22
-------
23
-
24
-An Assetic asset is something with filterable content that can be loaded and
25
-dumped. An asset also includes metadata, some of which can be manipulated and
26
-some of which is immutable.
27
-
28
-| **Property** | **Accessor**    | **Mutator**   |
29
-|--------------|-----------------|---------------|
30
-| content      | getContent      | setContent    |
31
-| mtime        | getLastModified | n/a           |
32
-| source root  | getSourceRoot   | n/a           |
33
-| source path  | getSourcePath   | n/a           |
34
-| target path  | getTargetPath   | setTargetPath |
35
-
36
-Filters
37
--------
38
-
39
-Filters can be applied to manipulate assets.
40
-
41
-``` php
42
-<?php
43
-
44
-use Assetic\Asset\AssetCollection;
45
-use Assetic\Asset\FileAsset;
46
-use Assetic\Asset\GlobAsset;
47
-use Assetic\Filter\LessFilter;
48
-use Assetic\Filter\Yui;
49
-
50
-$css = new AssetCollection(array(
51
-    new FileAsset('/path/to/src/styles.less', array(new LessFilter())),
52
-    new GlobAsset('/path/to/css/*'),
53
-), array(
54
-    new Yui\CssCompressorFilter('/path/to/yuicompressor.jar'),
55
-));
56
-
57
-// this will echo CSS compiled by LESS and compressed by YUI
58
-echo $css->dump();
59
-```
60
-
61
-The filters applied to the collection will cascade to each asset leaf if you
62
-iterate over it.
63
-
64
-``` php
65
-<?php
66
-
67
-foreach ($css as $leaf) {
68
-    // each leaf is compressed by YUI
69
-    echo $leaf->dump();
70
-}
71
-```
72
-
73
-The core provides the following filters in the `Assetic\Filter` namespace:
74
-
75
- * `CoffeeScriptFilter`: compiles CoffeeScript into Javascript
76
- * `CssEmbedFilter`: embeds image data in your stylesheets
77
- * `CssImportFilter`: inlines imported stylesheets
78
- * `CssMinFilter`: minifies CSS
79
- * `CssRewriteFilter`: fixes relative URLs in CSS assets when moving to a new URL
80
- * `GoogleClosure\CompilerApiFilter`: compiles Javascript using the Google Closure Compiler API
81
- * `GoogleClosure\CompilerJarFilter`: compiles Javascript using the Google Closure Compiler JAR
82
- * `JpegoptimFilter`: optimize your JPEGs
83
- * `JpegtranFilter`: optimize your JPEGs
84
- * `LessFilter`: parses LESS into CSS (using less.js with node.js)
85
- * `LessphpFilter`: parses LESS into CSS (using lessphp)
86
- * `OptiPngFilter`: optimize your PNGs
87
- * `PngoutFilter`: optimize your PNGs
88
- * `CompassFilter`: Compass CSS authoring framework
89
- * `Sass\SassFilter`: parses SASS into CSS
90
- * `Sass\ScssFilter`: parses SCSS into CSS
91
- * `SprocketsFilter`: Sprockets Javascript dependency management
92
- * `StylusFilter`: parses STYL into CSS
93
- * `Yui\CssCompressorFilter`: compresses CSS using the YUI compressor
94
- * `Yui\JsCompressorFilter`: compresses Javascript using the YUI compressor
95
-
96
-Asset Manager
97
--------------
98
-
99
-An asset manager is provided for organizing assets.
100
-
101
-``` php
102
-<?php
103
-
104
-use Assetic\AssetManager;
105
-use Assetic\Asset\FileAsset;
106
-use Assetic\Asset\GlobAsset;
107
-
108
-$am = new AssetManager();
109
-$am->set('jquery', new FileAsset('/path/to/jquery.js'));
110
-$am->set('base_css', new GlobAsset('/path/to/css/*'));
111
-```
112
-
113
-The asset manager can also be used to reference assets to avoid duplication.
114
-
115
-``` php
116
-<?php
117
-
118
-use Assetic\Asset\AssetCollection;
119
-use Assetic\Asset\AssetReference;
120
-use Assetic\Asset\FileAsset;
121
-
122
-$am->set('my_plugin', new AssetCollection(array(
123
-    new AssetReference($am, 'jquery'),
124
-    new FileAsset('/path/to/jquery.plugin.js'),
125
-)));
126
-```
127
-
128
-Filter Manager
129
---------------
130
-
131
-A filter manager is also provided for organizing filters.
132
-
133
-``` php
134
-<?php
135
-
136
-use Assetic\FilterManager;
137
-use Assetic\Filter\Sass\SassFilter;
138
-use Assetic\Filter\Yui;
139
-
140
-$fm = new FilterManager();
141
-$fm->set('sass', new SassFilter('/path/to/parser/sass'));
142
-$fm->set('yui_css', new Yui\CssCompressorFilter('/path/to/yuicompressor.jar'));
143
-```
144
-
145
-Asset Factory
146
--------------
147
-
148
-If you'd rather not create all these objects by hand, you can use the asset
149
-factory, which will do most of the work for you.
150
-
151
-``` php
152
-<?php
153
-
154
-use Assetic\Factory\AssetFactory;
155
-
156
-$factory = new AssetFactory('/path/to/asset/directory/');
157
-$factory->setAssetManager($am);
158
-$factory->setFilterManager($fm);
159
-$factory->setDebug(true);
160
-
161
-$css = $factory->createAsset(array(
162
-    '@reset',         // load the asset manager's "reset" asset
163
-    'css/src/*.scss', // load every scss files from "/path/to/asset/directory/css/src/"
164
-), array(
165
-    'scss',           // filter through the filter manager's "scss" filter
166
-    '?yui_css',       // don't use this filter in debug mode
167
-));
168
-
169
-echo $css->dump();
170
-```
171
-
172
-Prefixing a filter name with a question mark, as `yui_css` is here, will cause
173
-that filter to be omitted when the factory is in debug mode.
174
-
175
-Caching
176
--------
177
-
178
-A simple caching mechanism is provided to avoid unnecessary work.
179
-
180
-``` php
181
-<?php
182
-
183
-use Assetic\Asset\AssetCache;
184
-use Assetic\Asset\FileAsset;
185
-use Assetic\Cache\FilesystemCache;
186
-use Assetic\Filter\Yui;
187
-
188
-$yui = new Yui\JsCompressorFilter('/path/to/yuicompressor.jar');
189
-$js = new AssetCache(
190
-    new FileAsset('/path/to/some.js', array($yui)),
191
-    new FilesystemCache('/path/to/cache')
192
-);
193
-
194
-// the YUI compressor will only run on the first call
195
-$js->dump();
196
-$js->dump();
197
-$js->dump();
198
-```
199
-
200
-Static Assets
201
--------------
202
-
203
-Alternatively you can just write filtered assets to your web directory and be
204
-done with it.
205
-
206
-``` php
207
-<?php
208
-
209
-use Assetic\AssetWriter;
210
-
211
-$writer = new AssetWriter('/path/to/web');
212
-$writer->writeManagerAssets($am);
213
-```
214
-
215
-Twig
216
-----
217
-
218
-To use the Assetic [Twig][3] extension you must register it to your Twig
219
-environment:
220
-
221
-``` php
222
-<?php
223
-
224
-$twig->addExtension(new AsseticExtension($factory, $debug));
225
-```
226
-
227
-Once in place, the extension exposes a stylesheets and a javascripts tag with a syntax similar
228
-to what the asset factory uses:
229
-
230
-``` html+jinja
231
-{% stylesheets '/path/to/sass/main.sass' filter='sass,?yui_css' output='css/all.css' %}
232
-    <link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
233
-{% endstylesheets %}
234
-```
235
-
236
-This example will render one `link` element on the page that includes a URL
237
-where the filtered asset can be found.
238
-
239
-When the extension is in debug mode, this same tag will render multiple `link`
240
-elements, one for each asset referenced by the `css/src/*.sass` glob. The
241
-specified filters will still be applied, unless they are marked as optional
242
-using the `?` prefix.
243
-
244
-This behavior can also be triggered by setting a `debug` attribute on the tag:
245
-
246
-``` html+jinja
247
-{% stylesheets 'css/*' debug=true %} ... {% stylesheets %}
248
-```
249
-
250
-These assets need to be written to the web directory so these URLs don't
251
-return 404 errors.
252
-
253
-``` php
254
-<?php
255
-
256
-use Assetic\AssetWriter;
257
-use Assetic\Extension\Twig\TwigFormulaLoader;
258
-use Assetic\Extension\Twig\TwigResource;
259
-use Assetic\Factory\LazyAssetManager;
260
-
261
-$am = new LazyAssetManager($factory);
262
-
263
-// enable loading assets from twig templates
264
-$am->setLoader('twig', new TwigFormulaLoader($twig));
265
-
266
-// loop through all your templates
267
-foreach ($templates as $template) {
268
-    $resource = new TwigResource($twigLoader, $template);
269
-    $am->addResource($resource, 'twig');
270
-}
271
-
272
-$writer = new AssetWriter('/path/to/web');
273
-$writer->writeManagerAssets($am);
274
-```
275
-
276
----
277
-
278
-Assetic is based on the Python [webassets][1] library (available on
279
-[GitHub][2]).
280
-
281
-[1]: http://elsdoerfer.name/docs/webassets
282
-[2]: https://github.com/miracle2k/webassets
283
-[3]: http://twig.sensiolabs.org

+ 0 - 21
vendor/assetic/composer.json View File

@@ -1,21 +0,0 @@
1
-{
2
-    "name": "kriswallsmith/assetic",
3
-    "description": "Asset Management for PHP",
4
-    "keywords": ["assets", "compression", "minification"],
5
-    "homepage": "https://github.com/kriswallsmith/assetic",
6
-    "type": "library",
7
-    "license": "MIT",
8
-    "authors": [
9
-        {
10
-            "name": "Kris Wallsmith",
11
-            "email": "kris.wallsmith@gmail.com",
12
-            "homepage": "http://kriswallsmith.net/"
13
-        }
14
-    ],
15
-    "require": {
16
-        "php": ">=5.3.1"
17
-    },
18
-    "autoload": {
19
-        "psr-0": { "Assetic": "src/" }
20
-    }
21
-}

+ 0 - 32
vendor/assetic/docs/en/build.md View File

@@ -1,32 +0,0 @@
1
-Building and Dumping Assets
2
----------------------------
3
-
4
-The is the simplest approach to using Assetic. It involves two steps:
5
-
6
- 1. Create a PHP script in your web directory that uses the Assetic OOP API to
7
-    create and output an asset.
8
- 2. Reference that file from your template.
9
-
10
-For example, you could create a file in your web directory at
11
-`assets/javascripts.php` with the following code:
12
-
13
-    use Assetic\Asset\AssetCollection;
14
-    use Assetic\Asset\FileAsset;
15
-    use Assetic\Filter\Yui\JsCompressorFilter as YuiCompressorFilter;
16
-
17
-    $js = new AssetCollection(array(
18
-        new FileAsset(__DIR__.'/jquery.js'),
19
-        new FileAsset(__DIR__.'/application.js'),
20
-    ), array(
21
-        new YuiCompressorFilter('/path/to/yuicompressor.jar'),
22
-    ));
23
-
24
-    header('Content-Type: application/js');
25
-    echo $js->dump();
26
-
27
-In your HTML template you would include this generated Javascript using a
28
-simple `<script>` tag:
29
-
30
-    <script src="/assets/javascripts.php"></script>
31
-
32
-Next: [Basic Concepts](concepts.md)

+ 0 - 129
vendor/assetic/docs/en/concepts.md View File

@@ -1,129 +0,0 @@
1
-In order to use the Assetic OOP API you must first understand the two central
2
-concepts of Assetic: assets and filters.
3
-
4
-### What is an Asset?
5
-
6
-As asset is an object that has content and metadata which can be loaded and
7
-dumped. Your assets will probably fall into three categories: Javascripts,
8
-stylesheets and images. Most assets will be loaded from files in your
9
-filesystem, but they can also be loaded via HTTP, a database, from a string,
10
-or virtually anything else. All that an asset has to do is fulfill Assetic's
11
-basic asset interface.
12
-
13
-### What is a Filter?
14
-
15
-A filter is an object that acts upon an asset's content when that asset is
16
-loaded and/or dumped. Similar to assets, a filter can do virtually anything,
17
-as long as it implements Assetic's filter interface. 
18
-
19
-Here is a list of some of the tools that can be applied to assets using a
20
-filter:
21
-
22
- * CoffeeScript
23
- * CssEmbed
24
- * CssMin
25
- * Google Closure Compiler
26
- * jpegoptim
27
- * jpegtran
28
- * Less
29
- * LessPHP
30
- * optipng
31
- * Packager
32
- * pngout
33
- * SASS
34
- * Sprockets (version 1)
35
- * Stylus
36
- * YUI Compressor
37
-
38
-### Using Assets and Filters
39
-
40
-You need to start by creating an asset object. This will probably mean
41
-instantiating a `FileAsset` instance, which takes a filesystem path as its
42
-first argument:
43
-
44
-    $asset = new Assetic\Asset\FileAsset('/path/to/main.css');
45
-
46
-Once you have an asset you can begin adding filters to it by calling
47
-`ensureFilter()`. For example, you can add a filter that applies the YUI
48
-Compressor to the contents of the asset:
49
-
50
-    $yui = new Assetic\Filter\Yui\CssCompressorFilter('/path/to/yui.jar');
51
-    $asset->ensureFilter($yui);
52
-
53
-Once you've added as many filters as you'd like you can output the finished
54
-asset to the browser:
55
-
56
-    header('Content-Type: text/css');
57
-    echo $asset->dump();
58
-
59
-### Asset Collections
60
-
61
-It is a good idea to combine assets of the same type into a single file to
62
-avoid unnecessary HTTP requests. You can do this in Assetic using the
63
-`AssetCollection` class. This class is just like any other asset in Assetic's
64
-eyes as it implements the asset interface, but under the hood it allows you to
65
-combine multiple assets into one.
66
-
67
-    use Assetic\Asset\AssetCollection;
68
-
69
-    $asset = new AssetCollection(array(
70
-        new FileAsset('/path/to/js/jquery.js'),
71
-        new FileAsset('/path/to/js/jquery.plugin.js'),
72
-        new FileAsset('/path/to/js/application.js'),
73
-    ));
74
-
75
-### Nested Asset Collections
76
-
77
-The collection class implements the asset interface and all assets passed into
78
-a collection must implement the same interface, which means you can easily
79
-nest collections within one another:
80
-
81
-    use Assetic\Asset\AssetCollection;
82
-    use Assetic\Asset\GlobAsset;
83
-    use Assetic\Asset\HttpAsset;
84
-
85
-    $asset = new AssetCollection(array(
86
-        new HttpAsset('http://example.com/jquery.min.js'),
87
-        new GlobAsset('/path/to/js/*'),
88
-    ));
89
-
90
-The `HttpAsset` class is a special asset class that loads a file over HTTP;
91
-`GlobAsset` is a special asset collection class that loads files based on a
92
-filesystem glob -- both implement the asset interface.
93
-
94
-This concept of nesting asset collection become even more powerful when you
95
-start applying different sets of filters to each collection. Imagine some of
96
-your application's stylesheets are written in SASS, while some are written in
97
-vanilla CSS. You can combine all of these into one seamless CSS asset:
98
-
99
-    use Assetic\Asset\AssetCollection;
100
-    use Assetic\Asset\GlobAsset;
101
-    use Assetic\Filter\SassFilter;
102
-    use Assetic\Filter\Yui\CssCompressorFilter;
103
-
104
-    $css = new AssetCollection(array(
105
-        new GlobAsset('/path/to/sass/*.sass', array(new SassFilter())),
106
-        new GlobAsset('/path/to/css/*.css'),
107
-    ), array(
108
-        new YuiCompressorFilter('/path/to/yuicompressor.jar'),
109
-    ));
110
-
111
-You'll notice I've also applied the YUI compressor filter to the combined
112
-asset so all CSS will be minified.
113
-
114
-### Iterating over an Asset Collection
115
-
116
-Once you have an asset collection you can iterate over it like you would a
117
-plain old PHP array:
118
-
119
-    echo "Source paths:\n";
120
-    foreach ($collection as $asset) {
121
-        echo ' - '.$asset->getSourcePath()."\n";
122
-    }
123
-
124
-The asset collection iterates recursively, which means you will only see the
125
-"leaf" assets during iteration. Iteration also includes a smart filter which
126
-ensures you only see each asset once, even if the same asset has been included
127
-multiple times.
128
-
129
-Next: [Defining Assets "On The Fly"](define.md)

+ 0 - 145
vendor/assetic/docs/en/define.md View File

@@ -1,145 +0,0 @@
1
-Defining Assets "On The Fly"
2
-----------------------------
3
-
4
-The second approach to using Assetic involves defining your application's
5
-assets "on the fly" in your templates, instead of in an isolated PHP file.
6
-Using this approach, your PHP template would look something like this:
7
-
8
-    <script src="<?php echo assetic_javascripts('js/*', 'yui_js') ?>"></script>
9
-
10
-This call to `assetic_javascripts()` serves a dual purpose. It will be read by
11
-the Assetic "formula loader" which will extract an asset "formula" that can be
12
-used to build, dump and output the asset. It will also be executed when the
13
-template is rendered, at which time the path to the output asset is output.
14
-
15
-Assetic includes the following templating helper functions:
16
-
17
- * `assetic_image()`
18
- * `assetic_javascripts()`
19
- * `assetic_stylesheets()`
20
-
21
-Defining assets on the fly is a much more sophisticated technique and
22
-therefore relies on services to do the heavy lifting. The main one being the
23
-asset factory.
24
-
25
-### Asset Factory
26
-
27
-The asset factory knows how to create asset objects using only arrays and
28
-scalar values as input. This is the same string syntax used by the `assetic_*`
29
-template helper functions.
30
-
31
-    use Assetic\Factory\AssetFactory;
32
-
33
-    $factory = new AssetFactory('/path/to/web');
34
-    $js = $factory->createAsset(array(
35
-        'js/jquery.js',
36
-        'js/jquery.plugin.js',
37
-        'js/application.js',
38
-    ));
39
-
40
-### Filter Manager
41
-
42
-You can also apply filters to asset created by the factory. To do this you
43
-must setup a `FilterManager`, which organizes filters by a name.
44
-
45
-    use Assetic\FilterManager;
46
-    use Assetic\Filter\GoogleClosure\ApiFilter as ClosureFilter;
47
-
48
-    $fm = new FilterManager();
49
-    $fm->set('closure', new ClosureFilter());
50
-    $factory->setFilterManager($fm);
51
-
52
-    $js = $factory->createAsset('js/*', 'closure');
53
-
54
-This code creates an instance of the Google Closure Compiler filter and
55
-assigns it the name `closure` using a filter manager. This filter manager is
56
-then injected into the asset factory, making the filter available as `closure`
57
-when creating assets.
58
-
59
-### Debug Mode
60
-
61
-The asset factory also introduces the concept of a debug mode. This mode
62
-allows you to omit certain filters from assets the factory creates depending
63
-on whether it is enabled or not.
64
-
65
-For example, the YUI Compressor is awesome, but it is only appropriate in a
66
-production environment as it is very difficult to debug minified Javascript.
67
-
68
-    use Asset\Factory\AssetFactory;
69
-
70
-    $factory = new AssetFactory('/path/to/web', true); // debug mode is on
71
-    $factory->setFilterManager($fm);
72
-    $js = $factory->createAsset('js/*', '?closure');
73
-
74
-By prefixing the `closure` filter's name with a question mark, we are telling
75
-the factory this filter is optional and should only be applied with debug mode
76
-is off.
77
-
78
-### Asset Manager and Asset References
79
-
80
-The asset factory provides another special string syntax that allows you to
81
-reference assets you defined elsewhere. These are called "asset references"
82
-and involve an asset manager which, similar to the filter manager, organizes
83
-assets by name.
84
-
85
-    use Assetic\AssetManager;
86
-    use Assetic\Asset\FileAsset;
87
-    use Assetic\Factory\AssetFactory;
88
-
89
-    $am = new AssetManager();
90
-    $am->set('jquery', new FileAsset('/path/to/jquery.js'));
91
-
92
-    $factory = new AssetFactory('/path/to/web');
93
-    $factory->setAssetManager($am);
94
-
95
-    $js = $factory->createAsset(array(
96
-        '@jquery',
97
-        'js/application.js',
98
-    ));
99
-
100
-### Extracting Assets from Templates
101
-
102
-Once you've defined a set of assets in your templates you must use the
103
-"formula loader" service to extract these asset definitions.
104
-
105
-    use Assetic\Factory\Loader\FunctionCallsFormulaLoader;
106
-    use Assetic\Factory\Resource\FileResource;
107
-
108
-    $loader = new FunctionCallsFormulaLoader($factory);
109
-    $formulae = $loader->load(new FileResource('/path/to/template.php'));
110
-
111
-These asset formulae aren't much use by themselves. They each include just
112
-enough information for the asset factory to create the intended asset object.
113
-In order for these to be useful they must be wrapped in the special
114
-`LazyAssetManager`.
115
-
116
-### The Lazy Asset Manager
117
-
118
-This service is a composition of the asset factory and one or more formula
119
-loaders. It acts as the glue between these services behind the scenes, but can
120
-be used just like a normal asset manager on the surface.
121
-
122
-    use Assetic\Asset\FileAsset;
123
-    use Assetic\Factory\LazyAssetManager;
124
-    use Assetic\Factory\Loader\FunctionCallsFormulaLoader;
125
-    use Assetic\Factory\Resource\DirectoryResource;
126
-
127
-    $am = new LazyAssetManager($factory);
128
-    $am->set('jquery', new FileAsset('/path/to/jquery.js'));
129
-    $am->setLoader('php', new FunctionCallsFormulaLoader($factory));
130
-    $am->addResource(new DirectoryResource('/path/to/templates', '/\.php$/'), 'php');
131
-
132
-### Asset Writer
133
-
134
-Finally, once you've create an asset manager that knows about every asset
135
-you've defined in your templates, you must use an asset writer to actually
136
-create the files your templates are going to be referencing.
137
-
138
-    use Assetic\AssetWriter;
139
-
140
-    $writer = new AssetWriter('/path/to/web');
141
-    $writer->writeManagerAssets($am);
142
-
143
-After running this script, all of the assets in your asset manager will be
144
-loaded into memory, filtered with their configured filters and dumped to your
145
-web directory as static files, ready to be served.

+ 0 - 7
vendor/assetic/docs/en/index.md View File

@@ -1,7 +0,0 @@
1
-Table Of Contents
2
------------------
3
-
4
- 1. [Introduction](introduction.md)
5
- 2. [Building and Dumping Assets](build.md)
6
- 3. [Basic Concepts](concepts.md)
7
- 4. [Defining Assets "On The Fly"](define.md)

+ 0 - 21
vendor/assetic/docs/en/introduction.md View File

@@ -1,21 +0,0 @@
1
-What is Assetic?
2
-----------------
3
-
4
-Assetic is an asset management framework for PHP 5.3. Assetic enables you to
5
-use a variety of third party tools that will help bring order to your
6
-application's Javascripts, stylesheets and images.
7
-
8
-How Do I Use Assetic?
9
----------------------
10
-
11
-There are two distinct approaches you can take when using Assetic:
12
-
13
- 1. Build, dump and output assets in PHP files that you reference directly
14
-    from your templates
15
- 2. Defining assets in your templates ("on the fly") and use a loader to
16
-    extract, dump and output them
17
-
18
-The first approach is simpler, but the second, with all its moving parts,
19
-offers more flexibility and opportunity for optimization.
20
-
21
-Next: [Building and Dumping Assets](build.md)

+ 0 - 30
vendor/assetic/docs/ja/build.md View File

@@ -1,30 +0,0 @@
1
-アセットのビルドとダンプ
2
----------------------------
3
-
4
-Asseticを使う一番単純な方法は、次の2ステップからなります。
5
-
6
- 1. 公開領域内にPHPスクリプトを作成し、Assetic OOP APIを使用してアセットの作成・出力を行う
7
- 2. テンプレートから上記のファイルを参照する
8
-
9
-例えば、公開領域内に`assets/javascripts.php`ファイルを作成し、
10
-下記のようなコードを記述します。
11
-
12
-    use Assetic\Asset\AssetCollection;
13
-    use Assetic\Asset\FileAsset;
14
-    use Assetic\Filter\Yui\JsCompressorFilter as YuiCompressorFilter;
15
-
16
-    $js = new AssetCollection(array(
17
-        new FileAsset(__DIR__.'/jquery.js'),
18
-        new FileAsset(__DIR__.'/application.js'),
19
-    ), array(
20
-        new YuiCompressorFilter('/path/to/yuicompressor.jar'),
21
-    ));
22
-
23
-    header('Content-Type: application/js');
24
-    echo $js->dump();
25
-
26
-HTMLテンプレート側では、単に`<script>`タグを用いて、生成されたJavascriptをインクルードすることになります。
27
-
28
-    <script src="/assets/javascripts.php"></script>
29
-
30
-Next: [コンセプト](concepts.md)

+ 0 - 121
vendor/assetic/docs/ja/concepts.md View File

@@ -1,121 +0,0 @@
1
-Assetic OOP APIを使用するためには、まず、[アセット」と「フィルタ」の2つの重要なコンセプトを理解する必要があります。
2
-
3
-### アセット
4
-
5
-アセットとは、読み込み、及びダンプが可能な、コンテンツとメタデータを内包しているオブジェクトの事を指します。
6
-大体の場合において3つのカテゴリー、すなわち、Javascriptとスタイルシート、画像のどれかに属することになるでしょう。
7
-読み込みの方法としては、ファイルシステムからがほとんどですが、
8
-HTTPやデータベース経由でも、文字列としてでも読み込みが可能で、事実上あらゆるものが読み込み可能です。
9
-Asseticのアセットインターフェースを満足させさえすれば良いのです。
10
-
11
-
12
-### フィルタ
13
- 
14
-フィルタは、アセットが読み込まれる、かつ/もしくは、ダンプされる際に、
15
-アセットコンテンツに対して作用するオブジェクトです。
16
-アセットと同様に、Asseticのフィルタインターフェースを実装することで、
17
-どのような作用も可能になります。
18
-
19
-フィルタを用いて、アセットに適用できるツール群の一覧です。
20
-
21
- * CoffeeScript
22
- * CssEmbed
23
- * CssMin
24
- * Google Closure Compiler
25
- * jpegoptim
26
- * jpegtran
27
- * Less
28
- * LessPHP
29
- * optipng
30
- * Packager
31
- * pngout
32
- * SASS
33
- * Sprockets (version 1)
34
- * Stylus
35
- * YUI Compressor
36
-
37
-
38
-### アセットとフィルタの使用
39
-
40
-まずはアセットオブジェクトを作成することから始まります。
41
-多くの場合は`FileAsset`をインスタンス化し、ファイルシステムのパスを第一引数に渡します。
42
-
43
-    $asset = new Assetic\Asset\FileAsset('/path/to/main.css');
44
-
45
-アセットオブジェクトを作成したら、`ensureFilter()`を呼び、フィルタを追加します。
46
-例えば、アセットコンテンツにYUI Compressorを適用してみましょう。
47
-
48
-    $yui = new Assetic\Filter\Yui\CssCompressorFilter('/path/to/yui.jar');
49
-    $asset->ensureFilter($yui);
50
-
51
-任意のフィルタを追加したら、完成したアセットをブラウザに出力してみましょう。
52
-
53
-    header('Content-Type: text/css');
54
-    echo $asset->dump();
55
-
56
-### アセットコレクション
57
-
58
-1つのファイルに同じ種類のアセットをまとめて、不要なHTTPリクエストを抑えてみるのも良いでしょう。
59
-Asseticでは`AsseticColletion`クラスを使用することで可能となります。
60
-Assetic内部的には、このクラス自体は他のアセットと同様に、アセットインターフェースを実装したものですが、
61
-複数のアセットを1つにまとめることが可能になります。
62
-
63
-    use Assetic\Asset\AssetCollection;
64
-
65
-    $asset = new AssetCollection(array(
66
-        new FileAsset('/path/to/js/jquery.js'),
67
-        new FileAsset('/path/to/js/jquery.plugin.js'),
68
-        new FileAsset('/path/to/js/application.js'),
69
-    ));
70
-
71
-### ネストしたアセットコレクション
72
-
73
-コレクションクラス自体がアセットインターフェースを実装し、コレクション内のアセットも同様に
74
-アセットインターフェースを実装しているので、簡単にネストすることができます。
75
-
76
-    use Assetic\Asset\AssetCollection;
77
-    use Assetic\Asset\GlobAsset;
78
-    use Assetic\Asset\HttpAsset;
79
-
80
-    $asset = new AssetCollection(array(
81
-        new HttpAsset('http://example.com/jquery.min.js'),
82
-        new GlobAsset('/path/to/js/*'),
83
-    ));
84
-
85
-`HttpAsset`は、HTTP経由でファイルを読み込むアセットクラス。
86
-`GlobAsset`は、ファイルシステムのglobを基にファイル群を読み込むアセットコレクションクラス。
87
-両者ともにアセットインターフェースを実装しています。
88
-
89
-このネストしたアセットコレクションという概念は、コレクションそれぞれに異なる
90
-フィルタ群を適用しようとしたときに、効果を発揮します。
91
-例えば、スタイルシートがSAASで記述されたものと、vanilla CSSを用いて記述されたものからなる
92
-アプリケーションを考えた場合、次のようにして、全てを1つのシームレスなCSSアセットにまとめることができます。
93
-
94
-    use Assetic\Asset\AssetCollection;
95
-    use Assetic\Asset\GlobAsset;
96
-    use Assetic\Filter\SassFilter;
97
-    use Assetic\Filter\Yui\CssCompressorFilter;
98
-
99
-    $css = new AssetCollection(array(
100
-        new GlobAsset('/path/to/sass/*.sass', array(new SassFilter())),
101
-        new GlobAsset('/path/to/css/*.css'),
102
-    ), array(
103
-        new YuiCompressorFilter('/path/to/yuicompressor.jar'),
104
-    ));
105
-
106
-上記の例では、1つにまとめられたCSSを、さらにYUI compressorフィルタを適用することで、全体を圧縮しています。
107
-
108
-### アセットコレクションのイテレーション
109
-
110
-アセットコレクションは、旧来のPHP配列のように、イテレートできます。
111
-
112
-    echo "Source paths:\n";
113
-    foreach ($collection as $asset) {
114
-        echo ' - '.$asset->getSourcePath()."\n";
115
-    }
116
-
117
-アセットコレクションのイテレーションは再帰的で、「葉」にあたるアセットの取得を行います。
118
-また、気の利いたフィルタを内蔵しているので、同じアセットがコレクション内に複数存在する場合でも、
119
-一度だけのインクルードが保証されます。
120
-
121
-Next: [アセットを「オンザフライ」で定義する](define.md)

+ 0 - 140
vendor/assetic/docs/ja/define.md View File

@@ -1,140 +0,0 @@
1
-アセットの「オンザフライ」な定義
2
-----------------------------------------
3
-
4
-Asseticの使用方法二つ目は、独立したPHPファイルを使用する代わりに、
5
-テンプレートで「オンザフライ」にアセット定義をする方法です。
6
-このアプローチでは、PHPテンプレートは下記のようになります。
7
-
8
-    <script src="<?php echo assetic_javascripts('js/*', 'yui_js') ?>"></script>
9
-
10
-`assetic_javascripts()`の呼び出しは2つの目的を兼ねています。
11
-まず、「フォーミュラローダー」により走査され、アセットの構築、ダンプ、及び出力を行うための「フォーミュラ(処方箋)」が抽出されます。
12
-また、テンプレートのレンダー時にも実行され、アセットの出力パスが出力されます。
13
-
14
-Asseticには下記のようなヘルパー関数があります。
15
-
16
- * `assetic_image()`
17
- * `assetic_javascripts()`
18
- * `assetic_stylesheets()`
19
-
20
-アセットをオンザフライに定義するということは、より高度なテクニックであり、
21
-そのため、重い仕事をするサービスに依存することになります。
22
-そのうちの重要なものがアセットファクトリです。
23
-
24
-### アセットファクトリ
25
-
26
-アセットファクトリは、アセットオブジェクトを、配列とスカラ値のみから、
27
-どのように作成するのか把握しています。
28
-`assetic_*`ヘルパー関数で使用する記法と同様のものとなります。
29
-
30
-    use Assetic\Factory\AssetFactory;
31
-
32
-    $factory = new AssetFactory('/path/to/web');
33
-    $js = $factory->createAsset(array(
34
-        'js/jquery.js',
35
-        'js/jquery.plugin.js',
36
-        'js/application.js',
37
-    ));
38
-
39
-### フィルタマネージャー
40
-
41
-ファクトリによって作成されたアセットに対しても、フィルタを適用することができます。
42
-そのためには、`FilterManager`を設定して、名前を定義しフィルタを構成します。
43
-
44
-    use Assetic\FilterManager;
45
-    use Assetic\Filter\GoogleClosure\ApiFilter as ClosureFilter;
46
-
47
-    $fm = new FilterManager();
48
-    $fm->set('closure', new ClosureFilter());
49
-    $factory->setFilterManager($fm);
50
-
51
-    $js = $factory->createAsset('js/*', 'closure');
52
-
53
-上記の例では、Google Closure Compilerフィルタをインスタンス化し、
54
-フィルタマネージャーを通じて`closure`という名前をつけています。
55
-このフィルタマネージャーをアセットファクトリに渡すことで、
56
-アセット作成時には、`closure`という名前でフィルタを使用できるようになります。
57
-
58
-### デバッグモード
59
-
60
-アセットファクトリは、デバッグモードというコンセプトも取り入れており、
61
-デバッグモードの設定により、ファクトリが作成するアセットから、
62
-特定のフィルタを除外することができます。
63
-
64
-たとえば、YUI Compressorは大変素晴らしいのですが、圧縮されたJavascriptを
65
-デバッグするのは大変難しく、プロダクション環境でのみの使用が適切でしょう。
66
-
67
-    use Asset\Factory\AssetFactory;
68
-
69
-    $factory = new AssetFactory('/path/to/web', true); // デバッグモードON
70
-    $factory->setFilterManager($fm);
71
-    $js = $factory->createAsset('js/*', '?closure');
72
-
73
-フィルタ名`closure`の前にクエスチョンマークを記述すると、ファクトリに対して、
74
-このフィルタはオプションであり、
75
-デバッグモードがOFFの時にのみ適用するように通知することができます。
76
-
77
-### アセットマネージャーとアセットリファレンス
78
-
79
-アセットファクトリにはもう一つ特別な記法があり、別の場所で定義した
80
-アセットを参照することができるようになります。
81
-これを「アセットリファレンス」と呼び、アセットマネージャーを通じて、
82
-フィルタマネージャーと同様の、名前によるアセットの構成が可能です。
83
-
84
-    use Assetic\AssetManager;
85
-    use Assetic\Asset\FileAsset;
86
-    use Assetic\Factory\AssetFactory;
87
-
88
-    $am = new AssetManager();
89
-    $am->set('jquery', new FileAsset('/path/to/jquery.js'));
90
-
91
-    $factory = new AssetFactory('/path/to/web');
92
-    $factory->setAssetManager($am);
93
-
94
-    $js = $factory->createAsset(array(
95
-        '@jquery',
96
-        'js/application.js',
97
-    ));
98
-
99
-### テンプレートからのアセット抽出
100
-
101
-テンプレート内でアセット群を定義したら、「フォーミュラローダー」サービスを使用して、
102
-アセットの定義を抽出します。
103
-
104
-    use Assetic\Factory\Loader\FunctionCallsFormulaLoader;
105
-    use Assetic\Factory\Resource\FileResource;
106
-
107
-    $loader = new FunctionCallsFormulaLoader($factory);
108
-    $formulae = $loader->load(new FileResource('/path/to/template.php'));
109
-
110
-これらのフォーミュラ自体は、それ自体で使途はあまりなく、
111
-アセットファクトリが目的のアセットオブジェクトを作成するに足る情報しか持っていません。
112
-`LazyAssetManager`でラップすることで有益なものとなります。
113
-
114
-### レイジーなアセットマネージャー
115
-
116
-このサービスは、アセットファクトリと、1つ以上のフォーミュラローダーから成っており、
117
-裏方のサービス間のグルとして動作しますが、表面上では、通常のアセットマネージャーと同じように使用することができます。
118
-
119
-    use Assetic\Asset\FileAsset;
120
-    use Assetic\Factory\LazyAssetManager;
121
-    use Assetic\Factory\Loader\FunctionCallsFormulaLoader;
122
-    use Assetic\Factory\Resource\DirectoryResource;
123
-
124
-    $am = new LazyAssetManager($factory);
125
-    $am->set('jquery', new FileAsset('/path/to/jquery.js'));
126
-    $am->setLoader('php', new FunctionCallsFormulaLoader($factory));
127
-    $am->addResource(new DirectoryResource('/path/to/templates', '/\.php$/'), 'php');
128
-
129
-### アセットライター
130
-
131
-作成したアセットマネージャーが、テンプレート内で定義した全てのアセットを把握したら、
132
-アセットライターを使用して、テンプレートが参照することになる実際のファイルを作成します。
133
-
134
-    use Assetic\AssetWriter;
135
-
136
-    $writer = new AssetWriter('/path/to/web');
137
-    $writer->writeManagerAssets($am);
138
-
139
-上記のスクリプトを実行すると、アセットマネージャー内のすべてのアセットがメモリに読み込まれ、
140
-指定したフィルタが適用された後、公開領域に静的ファイルとしてダンプされ、準備完了となります。

+ 0 - 7
vendor/assetic/docs/ja/index.md View File

@@ -1,7 +0,0 @@
1
-目次
2
------
3
-
4
- 1. [イントロダクション](introduction.md)
5
- 2. [アセットの構築とダンプ](build.md)
6
- 3. [コンセプト](concepts.md)
7
- 4. [アセットを「オンザフライ」で定義する](define.md)

+ 0 - 0
vendor/assetic/docs/ja/introduction.md View File


Some files were not shown because too many files changed in this diff