diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 30a5242d474..3c5e061b207 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -162,7 +162,7 @@ class Adherent extends CommonObject $infos.= $langs->trans("Birthday").": $this->naiss\n"; $infos.= $langs->trans("Photo").": $this->photo\n"; $infos.= $langs->trans("Public").": ".yn($this->public)."\n"; - if ($msgishtml) $infos = dol_htmlentities($infos); + if ($msgishtml) $infos = dol_htmlentitiesbr($infos); // Substitutions $patterns = array ( diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 7a6ed6d8207..cc6a3e4520a 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -118,7 +118,7 @@ if ($id) } else { - print ''; + print ''; } } else diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 81536b9b198..27bffebd9c2 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -224,7 +224,7 @@ if ($_GET["action"] == 'create') else { print ''; } print ''; @@ -361,7 +361,7 @@ if ($rowid > 0) else { print ''; } print ""; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index bb1846cccc3..b086687a512 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -208,7 +208,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') } else { - print ''; + print ''; } print ''; @@ -225,7 +225,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') } else { - print ''; + print ''; } print ''; print ''; diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 7e5006f9558..154a084db91 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -126,7 +126,7 @@ if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC) else { print ''; } diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 86f0fa255a3..2d6c4e4c617 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -180,7 +180,7 @@ if ($user->rights->categorie->creer) else { print ''; } diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index f41672b7f16..9b5c454d70e 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -711,7 +711,7 @@ if ($_GET["id"]) } else { - print ''; + print ''; } print ''; @@ -794,7 +794,7 @@ if ($_GET["id"]) // Note print ''.$langs->trans("Note").''; - print dol_htmlentities($act->note); + print dol_htmlentitiesbr($act->note); print ''; print ''; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 1b2e3b03ebf..edccf83ab6b 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -260,7 +260,7 @@ if ($resql) print $actionstatic->getNomUrl(1,4); print ''; - print ''; + print ''; print dolibarr_print_date($obj->dp,"day"); $late=0; if ($obj->percent == 0 && $obj->dp && date("U",$obj->dp) < time()) $late=1; @@ -270,13 +270,13 @@ if ($resql) if ($late) print img_warning($langs->trans("Late")); print ''; - print ''; + print ''; print dolibarr_print_date($obj->da2,"day"); print ''; // Titre print ''; - print dolibarr_trunc($obj->label,12); + print dolibarr_trunc($obj->label,10); print ''; // Société @@ -284,7 +284,7 @@ if ($resql) $societestatic->id=$obj->socid; $societestatic->client=$obj->client; $societestatic->nom=$obj->societe; - print $societestatic->getNomUrl(1,'',8); + print $societestatic->getNomUrl(1,'',6); print ''; // Contact @@ -294,7 +294,7 @@ if ($resql) $contactstatic->name=$obj->name; $contactstatic->firstname=$obj->firstname; $contactstatic->id=$obj->fk_contact; - print $contactstatic->getNomUrl(1,'',8); + print $contactstatic->getNomUrl(1,'',6); } else { diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index ebab542fb13..7fef6262443 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -661,7 +661,7 @@ else else { print ''; + print dol_htmlentitiesbr_decode($mil->body).''; } print ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 20597666966..d11ea6cb211 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1133,12 +1133,12 @@ if ($_GET['propalid'] > 0) else $text.= img_object($langs->trans('ShowProduct'),'product'); $text.= ' '.$objp->ref.''; $text.= ' - '.$objp->product; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':$objp->description); + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); print $html->textwithtooltip($text,$description,3,'','',$i); print_date_range($objp->date_start,$objp->date_end); if ($conf->global->PRODUIT_DESC_IN_FORM) { - print ($objp->description && $objp->description!=$objp->product)?'
'.stripslashes(nl2br($objp->description)):''; + print ($objp->description && $objp->description!=$objp->product)?'
'.dol_htmlentitiesbr($objp->description):''; } print ''; @@ -1353,7 +1353,7 @@ if ($_GET['propalid'] > 0) } else { - print ''; + print ''; } } print ''; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 38d477ad6dd..26343f6c81c 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1364,13 +1364,13 @@ else else $text.= img_object($langs->trans('ShowProduct'),'product'); $text.= ' '.$objp->ref.''; $text.= ' - '.$objp->product; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':$objp->description); + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); print $html->textwithtooltip($text,$description,3,'','',$i); // Todo: voir si on insert ou pas en option les dates de debut et de fin de service //print_date_range($objp->date_start,$objp->date_end); if ($conf->global->PRODUIT_DESC_IN_FORM) { - print ($objp->description && $objp->description!=$objp->product)?'
'.stripslashes(nl2br($objp->description)):''; + print ($objp->description && $objp->description!=$objp->product)?'
'.dol_htmlentitiesbr($objp->description):''; } print ''; @@ -1512,7 +1512,7 @@ else } else { - print ''; + print ''; } print ''; print ''; diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 19c87fc672f..d01bfe62a5b 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -225,7 +225,7 @@ if ($_GET["action"] == 'create') else { print ''; + print dol_htmlentitiesbr_decode($account->comment).''; } print ''; @@ -464,7 +464,7 @@ else else { print ''; + print dol_htmlentitiesbr_decode($account->comment).''; } print ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index fa4204e778a..d9c1a0a4f95 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2363,13 +2363,13 @@ else else $text.= img_object($langs->trans('ShowProduct'),'product'); $text.= ' '.$objp->ref.''; $text.= ' - '.$objp->product; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':$objp->description); + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); //print $description; print $html->textwithtooltip($text,$description,3,'','',$i); print_date_range($objp->date_start,$objp->date_end); if ($conf->global->PRODUIT_DESC_IN_FORM) { - print ($objp->description && $objp->description!=$objp->product)?'
'.stripslashes(nl2br($objp->description)):''; + print ($objp->description && $objp->description!=$objp->product)?'
'.dol_htmlentitiesbr($objp->description):''; } print ''; @@ -2505,7 +2505,10 @@ else } else { - print ''; + print ''; } print ''; print ''; diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php index 493a54e752e..93de2ccb650 100644 --- a/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php +++ b/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php @@ -215,11 +215,11 @@ Class pdf_expedition_rouget extends ModelePdfExpedition } // Description de la ligne produit - $libelleproduitservice=dol_htmlentities($this->expe->lignes[$i]->description); + $libelleproduitservice=dol_htmlentitiesbr($this->expe->lignes[$i]->description,1); if ($this->expe->lignes[$i]->description&&$this->expe->lignes[$i]->description!=$com->lignes[$i]->libelle) { - if ($libelleproduitservice) $libelleproduitservice.="\n"; - $libelleproduitservice.=dol_htmlentities($this->expe->lignes[$i]->description); + if ($libelleproduitservice) $libelleproduitservice.="
"; + $libelleproduitservice.=dol_htmlentitiesbr($this->expe->lignes[$i]->description,1); } // Si ligne associée à un code produit if ($this->expe->lignes[$i]->fk_product) diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 0135c7a214c..9fa055a06d6 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -621,7 +621,7 @@ elseif ($_GET["id"] > 0) } else { - print ''; + print ''; } print ''; print ''; @@ -758,7 +758,7 @@ elseif ($_GET["id"] > 0) } else { - print ''; + print ''; } print ''; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 48ee8dac50b..d4679cd4f55 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -707,11 +707,11 @@ else $text.= ' '.$objp->ref_fourn.''; $text.= ' ('.$objp->ref.')'; $text.= ' - '.$objp->product; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':$objp->description); + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); print $html->textwithtooltip($text,$description,3,'','',$i); if ($conf->global->PRODUIT_DESC_IN_FORM) { - print ($objp->description && $objp->description!=$objp->product)?'
'.stripslashes(nl2br($objp->description)):''; + print ($objp->description && $objp->description!=$objp->product)?'
'.dol_htmlentitiesbr($objp->description):''; } print ""; @@ -781,7 +781,7 @@ else } else { - print ''; + print ''; } print ''; print ''; diff --git a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php index 14f1f1347a7..eb14574658f 100644 --- a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php +++ b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php @@ -239,11 +239,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $curY = $nexY; // Description de la ligne produit - $libelleproduitservice=dol_htmlentities($com->lignes[$i]->libelle); + $libelleproduitservice=dol_htmlentitiesbr($com->lignes[$i]->libelle,1); if ($com->lignes[$i]->desc&&$com->lignes[$i]->desc!=$com->lignes[$i]->libelle) { - if ($libelleproduitservice) $libelleproduitservice.="\n"; - $libelleproduitservice.=dol_htmlentities($com->lignes[$i]->desc); + if ($libelleproduitservice) $libelleproduitservice.="
"; + $libelleproduitservice.=dol_htmlentitiesbr($com->lignes[$i]->desc,1); } // Si ligne associée à un code produit if ($com->lignes[$i]->fk_product) @@ -253,7 +253,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end) { // Affichage durée si il y en a une - $libelleproduitservice.=dol_htmlentities("\n(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")"); + $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")",1); } $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 294d6ad2506..1b6acd708ec 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -63,59 +63,60 @@ class Form } - /** + /** \brief Affiche un texte+picto avec tooltip sur texte ou sur picto \param text Texte à afficher \param htmltext Contenu html du tooltip, codé en html \param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2, 4=tooltip sur les 2 et forcé en Ajax \param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est après \param img Code img du picto - \return string Code html du texte,picto - */ - function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$i=1,$width='200',$shiftX='10') - { - global $conf; + \return string Code html du tooltip (texte+picto) + */ + function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$i=1,$width='200',$shiftX='10') + { + global $conf; if (! $htmltext) return $text; $paramfortooltiptext =''; - $paramfortooltippicto =''; - - // Sanitize tooltip - $htmltext=ereg_replace("'","\'",$htmltext); - $htmltext=ereg_replace("'","\'",$htmltext); - $htmltext=ereg_replace("\r","",$htmltext); - $htmltext=ereg_replace("\n","
",$htmltext); - - if ($conf->use_javascript_ajax && $tooltipon == 4) - { - $s = '
'."\n"; - $s.= $text; - $s.= '
'."\n"; - $s.= ''."\n"; - $s.= ''."\n"; - } - else - { - if ($conf->use_javascript_ajax) - { - $htmltext=eregi_replace('"',"\'",$htmltext); - if ($tooltipon==1 || $tooltipon==3) - { - $paramfortooltiptext.=' onmouseover="showtip(\''.$htmltext.'\')"'; - $paramfortooltiptext.=' onMouseout="hidetip()"'; - } - if ($tooltipon==2 || $tooltipon==3) - { - $paramfortooltippicto.=' onmouseover="showtip(\''.$htmltext.'\')"'; - $paramfortooltippicto.=' onMouseout="hidetip()"'; - } - } + $paramfortooltippicto =''; + + // Sanitize tooltip + $htmltext=ereg_replace("'","\'",$htmltext); + $htmltext=ereg_replace("'","\'",$htmltext); + $htmltext=ereg_replace("\r","",$htmltext); + $htmltext=ereg_replace("
\n","
",$htmltext); + $htmltext=ereg_replace("\n","",$htmltext); + + if ($conf->use_javascript_ajax && $tooltipon == 4) + { + $s = '
'."\n"; + $s.= $text; + $s.= '
'."\n"; + $s.= ''."\n"; + $s.= ''."\n"; + } + else + { + if ($conf->use_javascript_ajax) + { + $htmltext=eregi_replace('"',"\'",$htmltext); + if ($tooltipon==1 || $tooltipon==3) + { + $paramfortooltiptext.=' onmouseover="showtip(\''.$htmltext.'\')"'; + $paramfortooltiptext.=' onMouseout="hidetip()"'; + } + if ($tooltipon==2 || $tooltipon==3) + { + $paramfortooltippicto.=' onmouseover="showtip(\''.$htmltext.'\')"'; + $paramfortooltippicto.=' onMouseout="hidetip()"'; + } + } $s=""; $s.=''; diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php index 8a870659f3b..aff85ce6c01 100644 --- a/htdocs/includes/modules/commande/pdf_einstein.modules.php +++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php @@ -231,19 +231,19 @@ class pdf_einstein extends ModelePDFCommandes $curY = $nexY; // Description de la ligne produit - $libelleproduitservice=dol_htmlentities($com->lignes[$i]->libelle); + $libelleproduitservice=dol_htmlentitiesbr($com->lignes[$i]->libelle,1); if ($com->lignes[$i]->desc && $com->lignes[$i]->desc!=$com->lignes[$i]->libelle) { - if ($libelleproduitservice) $libelleproduitservice.="\n"; + if ($libelleproduitservice) $libelleproduitservice.="
"; if ($com->lignes[$i]->desc == '(CREDIT_NOTE)' && $com->lignes[$i]->fk_remise_except) { $discount=new DiscountAbsolute($this->db); $discount->fetch($com->lignes[$i]->fk_remise_except); - $libelleproduitservice=$langs->trans("DiscountFromCreditNote",$discount->ref_facture_source); + $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1); } else { - $libelleproduitservice.=dol_htmlentities($com->lignes[$i]->desc); + $libelleproduitservice.=dol_htmlentitiesbr($com->lignes[$i]->desc,1); } } // Si ligne associée à un code produit @@ -269,7 +269,7 @@ class pdf_einstein extends ModelePDFCommandes if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end) { // Affichage durée si il y en a une - $libelleproduitservice.=dol_htmlentities("\n(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")"); + $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end).")",1); } $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index b7ef49f4734..f67dd88b0cd 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -16,8 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * or see http://www.gnu.org/ - * - * $Id$ */ /** @@ -25,7 +23,7 @@ \ingroup facture \brief Fichier de la classe permettant de g�n�rer les factures au mod�le Crabe \author Laurent Destailleur - \version $Revision$ + \version $Id$ */ require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php"); @@ -206,7 +204,7 @@ class pdf_crabe extends ModelePDFFactures { $tab_top = 88; - $pdf->SetFont('Arial','', 9); // Dans boucle pour g�rer multi-page + $pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page $pdf->SetXY ($this->posxdesc-1, $tab_top); $pdf->MultiCell(190, 3, $fac->note_public, 0, 'J'); $nexY = $pdf->GetY(); @@ -234,31 +232,32 @@ class pdf_crabe extends ModelePDFFactures $curY = $nexY; // Description de la ligne produit - $libelleproduitservice=dol_htmlentities($fac->lignes[$i]->libelle); + $libelleproduitservice=dol_htmlentitiesbr($fac->lignes[$i]->libelle,1); if ($fac->lignes[$i]->desc&&$fac->lignes[$i]->desc!=$fac->lignes[$i]->libelle) { - if ($libelleproduitservice) $libelleproduitservice.="\n"; + if ($libelleproduitservice) $libelleproduitservice.="
"; if ($fac->lignes[$i]->desc == '(CREDIT_NOTE)' && $fac->lignes[$i]->fk_remise_except) { $discount=new DiscountAbsolute($this->db); $discount->fetch($fac->lignes[$i]->fk_remise_except); - $libelleproduitservice=$langs->trans("DiscountFromCreditNote",$discount->ref_facture_source); + $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1); } else - { - if ($fac->lignes[$i]->produit_id) + { + if ($fac->lignes[$i]->produit_id) { - $libelleproduitservice.=dol_htmlentities($fac->lignes[$i]->desc); + $libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1); } else { - // On v�rifie si les lignes personnalis�es sont format�es avec fckeditor - $libelleproduitservice.=dol_htmlentities($fac->lignes[$i]->desc); + // On verifie si les lignes personnalisees sont formatees avec fckeditor + $libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1); } } } - // Si ligne associ�e � un code produit + + // Si ligne associee a un code produit if ($fac->lignes[$i]->produit_id) { $prodser = new Product($this->db); @@ -284,8 +283,9 @@ class pdf_crabe extends ModelePDFFactures if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end) { // Affichage duree si il y en a une - $libelleproduitservice.=dol_htmlentities("\n(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")"); + $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end).")",1); } + //if ($i==0) { print $libelleproduitservice; exit; } $pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index 1cced0b71b7..b5b59015da5 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -233,20 +233,20 @@ class pdf_propale_azur extends ModelePDFPropales $curY = $nexY; // Description de la ligne produit - $libelleproduitservice=dol_htmlentities($propale->lignes[$i]->libelle); + $libelleproduitservice=dol_htmlentitiesbr($propale->lignes[$i]->libelle,1); if ($propale->lignes[$i]->desc && $propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle) { - if ($libelleproduitservice) $libelleproduitservice.="\n"; + if ($libelleproduitservice) $libelleproduitservice.="
"; if ($propale->lignes[$i]->desc == '(CREDIT_NOTE)' && $propale->lignes[$i]->fk_remise_except) { $discount=new DiscountAbsolute($this->db); $discount->fetch($propale->lignes[$i]->fk_remise_except); - $libelleproduitservice=$langs->trans("DiscountFromCreditNote",$discount->ref_facture_source); + $libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1); } else { - $libelleproduitservice.=dol_htmlentities($propale->lignes[$i]->desc); + $libelleproduitservice.=dol_htmlentitiesbr($propale->lignes[$i]->desc,1); } } // Si ligne associée à un code produit @@ -271,7 +271,7 @@ class pdf_propale_azur extends ModelePDFPropales if ($propale->lignes[$i]->date_start && $propale->lignes[$i]->date_end) { // Affichage durée si il y en a une - $libelleproduitservice.=dol_htmlentities("\n(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end).")"); + $libelleproduitservice.="
".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end).")",1); } $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page diff --git a/htdocs/lib/doleditor.class.php b/htdocs/lib/doleditor.class.php index 4bbf1a2daa6..b4eefcda2b9 100644 --- a/htdocs/lib/doleditor.class.php +++ b/htdocs/lib/doleditor.class.php @@ -56,7 +56,7 @@ class DolEditor require_once(DOL_DOCUMENT_ROOT."/includes/fckeditor/fckeditor.php"); - $content=dol_htmlentities($content); // If content is not HTML, we convert to HTML. + $content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML. $this->editor = new FCKeditor($htmlname); $this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ; diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 1e505b8eb15..df5e43cce59 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -1555,8 +1555,9 @@ function print_liste_field_titre($name, $file, $field, $begin="", $options="", $ // If this is a sort field if ($field) { - print " "; - if (! $sortorder) + //print " "; + print ''; + if (! $sortorder) { print ''.img_down("A-Z",0).''; print ''.img_up("Z-A",0).''; @@ -2534,24 +2535,51 @@ function hexbin($hexa){ return $bin; } -/* -* \brief Cette fonction est appelée pour coder ou non une chaine en html. -* \param stringtoencode String to encode -* \param htmlinfo 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection -* \remarks Selon qu'on compte l'afficher dans le PDF avec: -* writeHTMLCell -> a besoin d'etre encodé en HTML -* MultiCell -> ne doit pas etre encodé en HTML +/** +* \brief Replace CRLF in string with a HTML BR tag. +* \param string2encode String to encode +* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br +* \return string String encoded */ -function dol_htmlentities($stringtoencode,$htmlinfo=-1) +function dol_nl2br($stringtoencode,$nl2brmode=0) { - if ($htmlinfo == 1) return $stringtoencode; - if ($htmlinfo == 0) return nl2br(htmlentities($stringtoencode)); - if ($htmlinfo == -1) + if (! $nl2brmode) return nl2br($stringtoencode); + else { - if (dol_textishtml($stringtoencode)) return $stringtoencode; - else return nl2br(htmlentities($stringtoencode)); + $ret=ereg_replace("\r","",$stringtoencode); + $ret=ereg_replace("\n","
",$ret); + return $ret; } - return $stringtoencode; +} + +/** +* \brief This function is called to encode a string into a HTML string +* \param stringtoencode String to encode +* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br +* \remarks For PDF usage, you can show text by 2 ways: +* - writeHTMLCell -> param must be encoded into HTML. +* - MultiCell -> param must not be encoded into HTML. +* Because writeHTMLCell convert also \n into
, if function +* is used to build PDF, nl2br must be 1. +*/ +function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0) +{ + if (dol_textishtml($stringtoencode)) return $stringtoencode; + else return dol_nl2br(htmlentities($stringtoencode),$nl2brmode); +} + +/* +* \brief This function is called to decode a HTML string +* \param stringtodecode String to decode +*/ +function dol_htmlentitiesbr_decode($stringtodecode) +{ + $ret=html_entity_decode($stringtodecode); + $ret=eregi_replace("\r\n".'
',"
",$ret); + $ret=eregi_replace('
'."\r\n","\r\n",$ret); + $ret=eregi_replace('
'."\n","\n",$ret); + $ret=eregi_replace('
',"\n",$ret); + return $ret; } /** diff --git a/htdocs/livraison/mods/pdf/pdf_typhon.modules.php b/htdocs/livraison/mods/pdf/pdf_typhon.modules.php index 0fee25d56e9..76a1f47d72b 100644 --- a/htdocs/livraison/mods/pdf/pdf_typhon.modules.php +++ b/htdocs/livraison/mods/pdf/pdf_typhon.modules.php @@ -197,11 +197,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder $curY = $nexY; // Description de la ligne produit - $libelleproduitservice=dol_htmlentities($delivery->lignes[$i]->label); - if ($delivery->lignes[$i]->description&&$delivery->lignes[$i]->description!=$delivery->lignes[$i]->label) + $libelleproduitservice=dol_htmlentitiesbr($delivery->lignes[$i]->label,1); + if ($delivery->lignes[$i]->description && $delivery->lignes[$i]->description!=$delivery->lignes[$i]->label) { - if ($libelleproduitservice) $libelleproduitservice.="\n"; - $libelleproduitservice.=dol_htmlentities($delivery->lignes[$i]->description); + if ($libelleproduitservice) $libelleproduitservice.="
"; + $libelleproduitservice.=dol_htmlentitiesbr($delivery->lignes[$i]->description,1); } // Si ligne associée à un code produit if ($delivery->lignes[$i]->fk_product) @@ -226,7 +226,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder if ($delivery->lignes[$i]->date_start && $delivery->lignes[$i]->date_end) { // Affichage durée si il y en a une - $libelleproduitservice.="\n(".$langs->transnoentities("From")." ".dolibarr_print_date($delivery->lignes[$i]->date_start)." ".$langs->transnoentities("to")." ".dolibarr_print_date($delivery->lignes[$i]->date_end).")"; + $libelleproduitservice.="
".dol_htmlentitiesbr("(".$langs->transnoentities("From")." ".dolibarr_print_date($delivery->lignes[$i]->date_start)." ".$langs->transnoentities("to")." ".dolibarr_print_date($delivery->lignes[$i]->date_end).")",1); } $pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index e76da39f4f9..020d9e2cf89 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -983,7 +983,7 @@ if ($_GET["id"] || $_GET["ref"]) else { print '"; } print "
"; @@ -1029,7 +1029,7 @@ if ($_GET["id"] || $_GET["ref"]) else { print '"; } print ""; diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 18529acbabd..89d4a94848a 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -161,7 +161,7 @@ if ($_GET["action"] == 'create') } else { - print ''; + print ''; } print ''; @@ -414,7 +414,7 @@ else } else { - print ''; + print ''; } print ''; diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 6346f9ddfe9..daacdadb17e 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -168,7 +168,7 @@ if ($_GET["action"] == 'edit') } else { - print ''; + print ''; } print ''; print ''; print ''; diff --git a/htdocs/societe/socnote.php b/htdocs/societe/socnote.php index 38cc1d00f10..5b8f1a4c593 100644 --- a/htdocs/societe/socnote.php +++ b/htdocs/societe/socnote.php @@ -106,7 +106,7 @@ if ($socid > 0) } else { - print ''; + print ''; } } else diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index 8f2aafb0d7d..d2a4d4c10f6 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -411,7 +411,7 @@ else else { print ''; } print ''; diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 59d4e449f50..8240f4ecece 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -122,7 +122,7 @@ if ($id) } else { - print ''; + print ''; } } else
'.$langs->trans('Note').''; @@ -180,7 +180,7 @@ if ($_GET["action"] == 'edit') } else { - print ''; + print ''; } print '