]> git.agnieray.net Git - galette.git/commitdiff
Fix dynamic translations escaping
authorJohan Cwiklinski <johan@x-tnd.be>
Sat, 7 Oct 2023 08:45:13 +0000 (10:45 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Sat, 7 Oct 2023 08:45:13 +0000 (10:45 +0200)
galette/lib/Galette/Controllers/DynamicTranslationsController.php
galette/lib/Galette/Repository/Repository.php
galette/templates/default/pages/configuration_dynamic_translations.html.twig

index 06b6c93646be4d9e633fd263c488b0f967efe95c..5b8c64692f2d207570c4b97428a49c7158c600cc 100644 (file)
@@ -172,7 +172,6 @@ class DynamicTranslationsController extends AbstractController
     public function doDynamicTranslations(Request $request, Response $response): Response
     {
         $post = $request->getParsedBody();
-        $post['text_orig'] = htmlspecialchars($post['text_orig'], ENT_QUOTES);
         if (isset($post['redirect_uri'])) {
             $redirect_url = $post['redirect_uri'];
             unset($post['redirect_uri']);
@@ -186,7 +185,7 @@ class DynamicTranslationsController extends AbstractController
 
         if (isset($post['trans']) && isset($post['text_orig'])) {
             if (isset($post['new']) && $post['new'] == 'true') {
-                //create translation if it does not exists yet
+                //create translation if it does not exist yet
                 $res = $this->l10n->addDynamicTranslation(
                     $post['text_orig']
                 );
index f2886c2954e7c07ef34ecba6f6c1eaf222525efe..1d70b94c97d0621f53570c7847901da9898b1083 100644 (file)
@@ -151,7 +151,7 @@ abstract class Repository
     /**
      * Add default values in database
      *
-     * @param boolean $check_first Check first if it seem initialized, defaults to true
+     * @param boolean $check_first Check first if it seems initialized, defaults to true
      *
      * @return boolean
      */
index e568ec695fbf7251dce67258e4c32f3e069a20d5..30540c4a2d11b97debc28d902bd4e30f005a654f 100644 (file)
@@ -29,7 +29,7 @@
             </div>
     {% endif %}
             <div class="ui top attached accordion-styled header">
-                {{ _T("Translation of '%s' label")|replace({'%s': text_orig|escape}) }}
+                {{ _T("Translation of '%s' label")|replace({'%s': text_orig}) }}
             </div>
             <div class="ui bottom attached accordion-styled segment">
                 <div class="active content field">
                             <td class="three wide"><label for="text_trans_{{ text.key }}">{{ text.name }}</label></td>
                             <td class="thirteen wide">
                                 <input type="text" name="text_trans_{{ text.key }}" id="text_trans_{{ text.key }}" value="{% if text.text %}{{ text.text|escape }}{% endif %}"/>
-                                <input type=hidden name="text_orig" value="{{ text_orig|escape }}"/>
                             </td>
                         </tr>
     {% endfor %}
                     </table>
+                    <input type=hidden name="text_orig" value="{{ text_orig|escape }}"/>
                 </div>
             </div>
     {% if mode != 'ajax' %}