Skip to content

Commit 126cce4

Browse files
authored
Merge pull request #1 from Novusvetus/stringescaping
Fixed escaping of insertFormFieldTags
2 parents f300232 + 472d0e5 commit 126cce4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Contao/FormdataBackend.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*
88
* @package Efg
99
* @author Thomas Kuhn <mail@th-kuhn.de>
10+
* @author Marcel Rudolf <dev@novusvetus.de>
1011
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
1112
* @copyright Thomas Kuhn 2007-2014
1213
*
@@ -482,12 +483,17 @@ public function insertFormFieldTags()
482483

483484
$result = \Database::getInstance()->prepare("SELECT label,name,type FROM tl_form_field WHERE pid=?")->execute($intFormId);
484485

486+
$clean = function($string)
487+
{
488+
return addcslashes($string, '\'');
489+
};
490+
485491
while ($result->next()) {
486492
if (empty($result->label)) {
487493
continue;
488494
}
489495

490-
$strFields .= $result->label . ': {{form::' . $result->name . '}}<br/>';
496+
$strFields .= $clean($result->label) . ': {{form::' . $clean($result->name) . '}}<br/>';
491497
}
492498

493499
$GLOBALS['TL_LANG']['tl_form']['confirmationMailText'][1] = sprintf('<a style="text-decoration: underline;" onclick="javascript:document.getElementById(\'ctrl_confirmationMailText\').value+=\'<br/>%s\'.replace(/\<br\/\>/g,\'\\n\');">%s</a> ',

0 commit comments

Comments
 (0)