From f5d0aa40e6aa0023bc9fa686c3c20c67aa244c43 Mon Sep 17 00:00:00 2001 From: Oliver Georgi Date: Sun, 29 Jan 2017 18:26:31 +0100 Subject: [PATCH] Fixed the problem where CP bullet list cannot have duplicate items --- include/inc_front/content/cnt4.article.inc.php | 3 +-- include/inc_lang/backend/de/lang.inc.php | 1 + include/inc_lang/backend/en/lang.inc.php | 1 + include/inc_lib/content/cnt4.readform.inc.php | 2 +- include/inc_lib/general.inc.php | 12 ++++++++---- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/inc_front/content/cnt4.article.inc.php b/include/inc_front/content/cnt4.article.inc.php index 827b9928c..0a7ec8d92 100644 --- a/include/inc_front/content/cnt4.article.inc.php +++ b/include/inc_front/content/cnt4.article.inc.php @@ -42,8 +42,7 @@ $crow["acontent_template"] = render_cnt_template($crow["acontent_template"], 'TITLE', html($crow['acontent_title'])); $crow["acontent_template"] = render_cnt_template($crow["acontent_template"], 'SUBTITLE', html($crow['acontent_subtitle'])); -$crow['bullets'] = convertStringToArray($crow["acontent_text"], LF); - +$crow['bullets'] = convertStringToArray($crow["acontent_text"], LF, false); if(count($crow['bullets'])) { diff --git a/include/inc_lang/backend/de/lang.inc.php b/include/inc_lang/backend/de/lang.inc.php index d9e054b26..f2c371384 100644 --- a/include/inc_lang/backend/de/lang.inc.php +++ b/include/inc_lang/backend/de/lang.inc.php @@ -1465,3 +1465,4 @@ $BL['be_suppress_render_caption'] = 'Ausgabe der Bildunterschrift unterdrücken'; $BL['be_cnt_attribute_class'] = 'CSS Klasse [class]'; $BL['be_cnt_attribute_id'] = 'CSS ID [id]'; +$BL['be_cnt_avoid_duplicates'] = 'allow unique values only'; diff --git a/include/inc_lang/backend/en/lang.inc.php b/include/inc_lang/backend/en/lang.inc.php index 809341b18..15b3d71f5 100644 --- a/include/inc_lang/backend/en/lang.inc.php +++ b/include/inc_lang/backend/en/lang.inc.php @@ -1474,3 +1474,4 @@ $BL['be_suppress_render_caption'] = 'suppress rendering of the caption'; $BL['be_cnt_attribute_class'] = 'CSS class'; $BL['be_cnt_attribute_id'] = 'CSS id'; +$BL['be_cnt_avoid_duplicates'] = 'Nur eindeutige Werte zulassen'; diff --git a/include/inc_lib/content/cnt4.readform.inc.php b/include/inc_lib/content/cnt4.readform.inc.php index bc4d3c6d3..c5dfd0bdb 100644 --- a/include/inc_lib/content/cnt4.readform.inc.php +++ b/include/inc_lib/content/cnt4.readform.inc.php @@ -17,7 +17,7 @@ // ---------------------------------------------------------------- // Content Type Bullet List Table -$content["text"] = html_specialchars(slweg($_POST["ctext"], 65500)); +$content["text"] = html(slweg($_POST["ctext"], 65500)); $cbullet = explode(LF, $content["text"]); if(count($cbullet)) { foreach($cbullet as $key => $value) { diff --git a/include/inc_lib/general.inc.php b/include/inc_lib/general.inc.php index 155698e32..61e60f285 100755 --- a/include/inc_lib/general.inc.php +++ b/include/inc_lib/general.inc.php @@ -1053,13 +1053,17 @@ function getJavaScriptSourceLink($src, $prefix=' ') { function convertStringToArray($string='', $seperator=',', $mode='UNIQUE', $rmvDblWSp=true) { // clean up a seperator seperated string and return as array - if(trim($string) == '') return array(); + if(trim($string) === '') { + return array(); + } // replace all duplicate white chars by single space - if($rmvDblWSp) $string = preg_replace('/\s\s+/', ' ', $string); + if($rmvDblWSp) { + $string = preg_replace('/\s\s+/', ' ', $string); + } $string = explode($seperator, $string); $string = array_map('trim', $string); - $string = array_diff($string, array('',NULL,false)); - if($mode=='UNIQUE') { + $string = array_diff($string, array('', NULL, false)); + if($mode === 'UNIQUE') { $string = array_unique($string); } return $string;