';
diff --git a/htdocs/lib/doleditor.class.php b/htdocs/lib/doleditor.class.php
index 4b00c8034c8..f91abb1f85c 100644
--- a/htdocs/lib/doleditor.class.php
+++ b/htdocs/lib/doleditor.class.php
@@ -33,15 +33,15 @@
class DolEditor
{
var $editor;
-
-
+
+
/**
\brief DolEditor
\param htmlname Nom formulaire html WYSIWIG
\param content Contenu édition WYSIWIG
\param height Hauteur en pixel de la zone édition
\param toolbarname Nom barre de menu éditeur
- \param toolbarlocation Emplacement de la barre de menu :
+ \param toolbarlocation Emplacement de la barre de menu :
'In' chaque fenêtre d'édition a ça propre barre d'outils
'Out:nom' partage de la barre d'outils où 'nom' est le nom du DIV qui affiche la barre
\param toolbarstartexpanded visible ou non au démarrage
@@ -50,13 +50,15 @@ class DolEditor
function DolEditor($htmlname,$content,$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true)
{
global $conf,$langs;
-
+
dolibarr_syslog("DolEditor::DolEditor modulepart=".$modulepart);
-
+
require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php");
+
$content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
-
+ //print "\n".$conf->global->MAIN_MOTD."\n".$content;exit;
+
$this->editor = new FCKeditor($htmlname);
$this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ;
$this->editor->Value = $content;
@@ -65,7 +67,7 @@ class DolEditor
$this->editor->Config['AutoDetectLanguage'] = 'true';
$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
-
+
// Rem: Le forcage de ces 2 parametres ne semble pas fonctionner.
// Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart.
// Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ?
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 5d442461702..1551c13e0bf 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -2457,7 +2457,8 @@ function dol_nl2br($stringtoencode,$nl2brmode=0)
}
/**
- * \brief This function is called to encode a string into a HTML string. All entities except <> are converted.
+ * \brief This function is called to encode a string into a HTML string.
+ * All entities except &,<,> are converted. This permits to encode special chars to entities with no double encoded for already encoded HTML strings.
* This function also remove last CR/BR.
* \param stringtoencode String to encode
* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example)
@@ -2474,9 +2475,9 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8')
//$trans = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT); var_dump($trans);
$newstring=eregi_replace(' " by " ". It's same and avoid pb with FPDF.
$newstring=eregi_replace(' $','',$newstring); // Replace " " by " ". It's same and avoid pb with FPDF.
- $newstring=strtr($newstring,array('<'=>'__lt__','>'=>'__gt__'));
+ $newstring=strtr($newstring,array('&'=>'__and__','<'=>'__lt__','>'=>'__gt__','"'=>'__dquot__'));
$newstring=@htmlentities($newstring,ENT_COMPAT,$pagecodefrom); // Make entity encoding
- $newstring=strtr($newstring,array('__lt__'=>'<','__gt__'=>'>'));
+ $newstring=strtr($newstring,array('__and__'=>'&','__lt__'=>'<','__gt__'=>'>','__dquot__'=>'"'));
// If already HTML, CR should be so we don't change \n
}
else {