From f4ef5af63ba9d57a049aef711de0b3afdf622d47 Mon Sep 17 00:00:00 2001 From: Daniel Reichelt Date: Tue, 9 Feb 2016 14:45:08 +0100 Subject: [PATCH] add function getFormFieldDataText() Previously webserver configs would contain CRLFs from system.default_vhostconf on admin_settings.php. This patch adds a new function which automatically gets recognized by getFormFieldData() and mangles textarea form elements through str_replace("\r\n", "\n", ...). --- .../text/function.getFormFieldDataText.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/functions/formfields/text/function.getFormFieldDataText.php diff --git a/lib/functions/formfields/text/function.getFormFieldDataText.php b/lib/functions/formfields/text/function.getFormFieldDataText.php new file mode 100644 index 00000000..a1f7f3ca --- /dev/null +++ b/lib/functions/formfields/text/function.getFormFieldDataText.php @@ -0,0 +1,26 @@ + (2016-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Functions + * + */ + +function getFormFieldDataText($fieldname, $fielddata, &$input) { + if(isset($input[$fieldname])) { + $newfieldvalue = str_replace("\r\n", "\n", $input[$fieldname]); + } else { + $newfieldvalue = $fielddata['default']; + } + + return $newfieldvalue; +}