From 8517451008a54f33d71b05c2dd994ce6b4e9aaa6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Jul 2011 17:43:33 +0000 Subject: [PATCH] Fix: Clean message string --- htdocs/lib/functions.lib.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index deee3fc1ed5..0ffdc176611 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -29,7 +29,7 @@ * \file htdocs/lib/functions.lib.php * \brief A set of functions for Dolibarr * This file contains all frequently used functions. - * \version $Id: functions.lib.php,v 1.539 2011/07/06 09:25:05 eldy Exp $ + * \version $Id: functions.lib.php,v 1.540 2011/07/06 17:43:33 eldy Exp $ */ // For compatibility during upgrade @@ -3880,9 +3880,20 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb if ($iserror) { + // Remove div from texts $mesgstring=preg_replace('/<\/div>
/','
',$mesgstring); $mesgstring=preg_replace('/
/','',$mesgstring); $mesgstring=preg_replace('/<\/div>/','',$mesgstring); + // Remove div from texts array + $newmesgarray=array(); + foreach($mesgarray as $val) + { + $tmpmesgstring=preg_replace('/<\/div>
/','
',$val); + $tmpmesgstring=preg_replace('/
/','',$tmpmesgstring); + $tmpmesgstring=preg_replace('/<\/div>/','',$tmpmesgstring); + $newmesgarray[]=$tmpmesgstring; + } + $mesgarray=$newmesgarray; print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded); } else print get_htmloutput_mesg($mesgstring,$mesgarray,'ok',$keepembedded);