From 4d325a63d35573f055c4b2202f7b72756b5adb98 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 19 Mar 2010 13:08:11 +0000 Subject: [PATCH] xajax uses xml to transport the label, therefore we have to replace not only CR, LF (not allowed unencoded in Javascript strings) but also all utf-8 C0 and C1 plus CR and LF --- etemplate/inc/class.link_widget.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etemplate/inc/class.link_widget.inc.php b/etemplate/inc/class.link_widget.inc.php index 320217a34d..859fe1a78b 100644 --- a/etemplate/inc/class.link_widget.inc.php +++ b/etemplate/inc/class.link_widget.inc.php @@ -634,7 +634,9 @@ class link_widget foreach($found as $id => $option) { if (!is_array($option)) $option = array('label' => $option); - $option['label'] = str_replace(array("\r","\n"),array(" "," "),$option['label']); + // xajax uses xml to transport the label, therefore we have to replace not only CR, LF + // (not allowed unencoded in Javascript strings) but also all utf-8 C0 and C1 plus CR and LF + $option['label'] = preg_replace('/[\000-\037\177-\237]/u',' ',$option['label']); $script .= "opt = select.options[select.options.length] = new Option('".addslashes($option['label'])."','".addslashes($id)."');\n"; if (count($option) > 1) {