From: Alexander Ebert Date: Wed, 12 Jun 2013 12:41:00 +0000 (+0200) Subject: Fixed handling of HTML code in i18n input fields X-Git-Tag: 2.0.0_Beta_4~58^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cc7db7fab1a0d70ff2d40c8def01dac6aa66e1c5;p=GitHub%2FWoltLab%2FWCF.git Fixed handling of HTML code in i18n input fields --- 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, '>'); } };