From cc7db7fab1a0d70ff2d40c8def01dac6aa66e1c5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 12 Jun 2013 14:41:00 +0200 Subject: [PATCH] Fixed handling of HTML code in i18n input fields --- wcfsetup/install/files/js/WCF.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 99c5278017..3e50c118a4 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -3108,6 +3108,13 @@ WCF.MultipleLanguageInput = Class.extend({ this._values = values; this._availableLanguages = availableLanguages; + // unescape values + if ($.getLength(this._values)) { + for (var $key in this._values) { + this._values[$key] = WCF.String.unescapeHTML(this._values[$key]); + } + } + // default to current user language this._languageID = LANGUAGE_ID; if (this._element.length == 0) { @@ -3328,7 +3335,7 @@ WCF.MultipleLanguageInput = Class.extend({ this._values[$languageID] = ''; } - $('').appendTo($form); + $('').appendTo($form); } // remove name attribute to prevent conflict with i18n values @@ -3424,6 +3431,16 @@ WCF.String = { */ ucfirst: function(string) { return String(string).substring(0, 1).toUpperCase() + string.substring(1); + }, + + /** + * Unescapes special HTML-characters within a string + * + * @param string string + * @return string + */ + unescapeHTML: function (string) { + return String(string).replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); } }; -- 2.20.1