Drop usage of deprecated dol_htmlentities function

This commit is contained in:
Marcos García de La Fuente 2015-02-25 22:48:45 +01:00
parent e3853a648f
commit f2fededd2c
9 changed files with 32 additions and 32 deletions

View File

@ -176,7 +176,7 @@ if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
} }
} }
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)?dol_htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND):'').'">'; print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)?htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND):'').'">';
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
@ -187,7 +187,7 @@ print '<td colspan="2">'.$langs->trans("AntiVirusParam").'<br>';
print $langs->trans("AntiVirusParamExample"); print $langs->trans("AntiVirusParamExample");
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" size="72" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_PARAM)?dol_htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM):'').'">'; print '<input type="text" name="MAIN_ANTIVIRUS_PARAM" size="72" value="'.(! empty($conf->global->MAIN_ANTIVIRUS_PARAM)?htmlentities($conf->global->MAIN_ANTIVIRUS_PARAM):'').'">';
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';

View File

@ -4446,7 +4446,7 @@ class Form
$ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">'; $ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
} }
$ret.=dol_htmlentities($object->$fieldref); $ret.=htmlentities($object->$fieldref);
if ($morehtmlref) if ($morehtmlref)
{ {
$ret.=' '.$morehtmlref; $ret.=' '.$morehtmlref;

View File

@ -249,7 +249,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
$newsql=preg_replace('/__ENTITY__/i',(!empty($entity)?$entity:$conf->entity),$sql); $newsql=preg_replace('/__ENTITY__/i',(!empty($entity)?$entity:$conf->entity),$sql);
// Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes)
if (! $silent) print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n"; if (! $silent) print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n";
dol_syslog('Admin.lib::run_sql Request '.($i+1), LOG_DEBUG); dol_syslog('Admin.lib::run_sql Request '.($i+1), LOG_DEBUG);
$sqlmodified=0; $sqlmodified=0;

View File

@ -517,7 +517,7 @@ function dol_escape_htmltag($stringtoescape,$keepb=0)
$tmp=dol_html_entity_decode($stringtoescape,ENT_COMPAT,'UTF-8'); $tmp=dol_html_entity_decode($stringtoescape,ENT_COMPAT,'UTF-8');
if ($keepb) $tmp=strtr($tmp, array("\r"=>'\\r',"\n"=>'\\n')); if ($keepb) $tmp=strtr($tmp, array("\r"=>'\\r',"\n"=>'\\n'));
else $tmp=strtr($tmp, array("\r"=>'\\r',"\n"=>'\\n',"<b>"=>'','</b>'=>'')); else $tmp=strtr($tmp, array("\r"=>'\\r',"\n"=>'\\n',"<b>"=>'','</b>'=>''));
return dol_htmlentities($tmp,ENT_COMPAT,'UTF-8'); return htmlentities($tmp,ENT_COMPAT,'UTF-8');
} }
@ -2473,8 +2473,8 @@ function dol_print_error($db='',$error='')
} }
$out.="<b>".$langs->trans("UserAgent").":</b> ".$_SERVER["HTTP_USER_AGENT"]."<br>\n"; $out.="<b>".$langs->trans("UserAgent").":</b> ".$_SERVER["HTTP_USER_AGENT"]."<br>\n";
$out.="<br>\n"; $out.="<br>\n";
$out.="<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"],ENT_COMPAT,'UTF-8')."<br>\n"; $out.="<b>".$langs->trans("RequestedUrl").":</b> ".htmlentities($_SERVER["REQUEST_URI"],ENT_COMPAT,'UTF-8')."<br>\n";
$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?dol_htmlentities($_SERVER["HTTP_REFERER"],ENT_COMPAT,'UTF-8'):'')."<br>\n"; $out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?htmlentities($_SERVER["HTTP_REFERER"],ENT_COMPAT,'UTF-8'):'')."<br>\n";
$out.="<b>".$langs->trans("MenuManager").":</b> ".(isset($conf->standard_menu)?$conf->standard_menu:'')."<br>\n"; $out.="<b>".$langs->trans("MenuManager").":</b> ".(isset($conf->standard_menu)?$conf->standard_menu:'')."<br>\n";
$out.="<br>\n"; $out.="<br>\n";
$syslog.="url=".$_SERVER["REQUEST_URI"]; $syslog.="url=".$_SERVER["REQUEST_URI"];
@ -3859,13 +3859,13 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8',$
$newstring=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF. $newstring=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
if ($removelasteolbr) $newstring=preg_replace('/<br>$/i','',$newstring); // Remove last <br> (remove only last one) if ($removelasteolbr) $newstring=preg_replace('/<br>$/i','',$newstring); // Remove last <br> (remove only last one)
$newstring=strtr($newstring,array('&'=>'__and__','<'=>'__lt__','>'=>'__gt__','"'=>'__dquot__')); $newstring=strtr($newstring,array('&'=>'__and__','<'=>'__lt__','>'=>'__gt__','"'=>'__dquot__'));
$newstring=dol_htmlentities($newstring,ENT_COMPAT,$pagecodefrom); // Make entity encoding $newstring=htmlentities($newstring,ENT_COMPAT,$pagecodefrom); // Make entity encoding
$newstring=strtr($newstring,array('__and__'=>'&','__lt__'=>'<','__gt__'=>'>','__dquot__'=>'"')); $newstring=strtr($newstring,array('__and__'=>'&','__lt__'=>'<','__gt__'=>'>','__dquot__'=>'"'));
} }
else else
{ {
if ($removelasteolbr) $newstring=preg_replace('/(\r\n|\r|\n)$/i','',$newstring); // Remove last \n (may remove several) if ($removelasteolbr) $newstring=preg_replace('/(\r\n|\r|\n)$/i','',$newstring); // Remove last \n (may remove several)
$newstring=dol_nl2br(dol_htmlentities($newstring,ENT_COMPAT,$pagecodefrom),$nl2brmode); $newstring=dol_nl2br(htmlentities($newstring,ENT_COMPAT,$pagecodefrom),$nl2brmode);
} }
// Other substitutions that htmlentities does not do // Other substitutions that htmlentities does not do
//$newstring=str_replace(chr(128),'&euro;',$newstring); // 128 = 0x80. Not in html entity table. // Seems useles with TCPDF. Make bug with UTF8 languages //$newstring=str_replace(chr(128),'&euro;',$newstring); // 128 = 0x80. Not in html entity table. // Seems useles with TCPDF. Make bug with UTF8 languages

View File

@ -988,9 +988,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
$appli='Dolibarr'; $appli='Dolibarr';
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
if ($title && ! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/',$conf->global->MAIN_HTML_TITLE)) print '<title>'.dol_htmlentities($title).'</title>'; if ($title && ! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/',$conf->global->MAIN_HTML_TITLE)) print '<title>'.htmlentities($title).'</title>';
if ($title) print '<title>'.dol_htmlentities($appli.' - '.$title).'</title>'; if ($title) print '<title>'.htmlentities($appli.' - '.$title).'</title>';
else print "<title>".dol_htmlentities($appli)."</title>"; else print "<title>".htmlentities($appli)."</title>";
print "\n"; print "\n";
$ext=''; $ext='';

View File

@ -212,16 +212,16 @@ $adresseadmin=$object->mail_admin;
print $langs->trans("Title") .'</td><td colspan="2">'; print $langs->trans("Title") .'</td><td colspan="2">';
if ($action == 'edit') if ($action == 'edit')
{ {
print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(dol_htmlentities($object->titre)).'">'; print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(htmlentities($object->titre)).'">';
} }
else print dol_htmlentities($object->titre); else print htmlentities($object->titre);
print '</td></tr>'; print '</td></tr>';
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description") .'</td><td colspan="2">'; print '<tr><td valign="top">'.$langs->trans("Description") .'</td><td colspan="2">';
if ($action == 'edit') if ($action == 'edit')
{ {
$doleditor=new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires),'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120); $doleditor=new DolEditor('nouveauxcommentaires', htmlentities($object->commentaires),'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120);
$doleditor->Create(0,''); $doleditor->Create(0,'');
} }
else else
@ -229,7 +229,7 @@ else
if (empty($conf->fckeditor->enabled)) print dol_htmlentitiesbr($object->commentaires); if (empty($conf->fckeditor->enabled)) print dol_htmlentitiesbr($object->commentaires);
else else
{ {
$doleditor=new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires),'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120,1); $doleditor=new DolEditor('nouveauxcommentaires', htmlentities($object->commentaires),'',120,'dolibarr_notes','In',1,1,1,ROWS_7,120,1);
$doleditor->Create(0,''); $doleditor->Create(0,'');
} }
} }
@ -295,7 +295,7 @@ print $langs->trans("Author") .'</td><td colspan="2">';
if ($object->fk_user_creat) { if ($object->fk_user_creat) {
print $userstatic->getLoginUrl(1); print $userstatic->getLoginUrl(1);
} else { } else {
print dol_htmlentities($object->nom_admin); print htmlentities($object->nom_admin);
} }
print '</td></tr>'; print '</td></tr>';
@ -359,7 +359,7 @@ if ($comments) {
print '<a href="'.dol_buildpath('/opensurvey/card.php',1).'?deletecomment='.$comment->id_comment.'&id='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> '; print '<a href="'.dol_buildpath('/opensurvey/card.php',1).'?deletecomment='.$comment->id_comment.'&id='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> ';
} }
print dol_htmlentities($comment->usercomment).': '.dol_nl2br(dol_htmlentities($comment->comment))." <br>"; print htmlentities($comment->usercomment).': '.dol_nl2br(htmlentities($comment->comment))." <br>";
} }
} }
else else

View File

@ -153,7 +153,7 @@ while ($i < min($num,$limit))
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'; print '<td>';
print '<a href="'.dol_buildpath('/opensurvey/card.php',1).'?id='.$obj->id_sondage.'">'.img_picto('','object_opensurvey').' '.$obj->id_sondage.'</a>'; print '<a href="'.dol_buildpath('/opensurvey/card.php',1).'?id='.$obj->id_sondage.'">'.img_picto('','object_opensurvey').' '.$obj->id_sondage.'</a>';
print '</td><td>'.dol_htmlentities($obj->titre).'</td><td>'; print '</td><td>'.htmlentities($obj->titre).'</td><td>';
$type=($obj->format=='A')?'classic':'date'; $type=($obj->format=='A')?'classic':'date';
print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1); print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate"); print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate");
@ -169,7 +169,7 @@ while ($i < min($num,$limit))
print $userstatic->getLoginUrl(1); print $userstatic->getLoginUrl(1);
} else { } else {
print dol_htmlentities($obj->nom_admin); print htmlentities($obj->nom_admin);
} }
print '</td>'; print '</td>';

View File

@ -258,7 +258,7 @@ print '<div class="corps"> '."\n";
//affichage du titre du sondage //affichage du titre du sondage
$titre=str_replace("\\","",$object->titre); $titre=str_replace("\\","",$object->titre);
print '<strong>'.dol_htmlentities($titre).'</strong><br><br>'."\n"; print '<strong>'.htmlentities($titre).'</strong><br><br>'."\n";
//affichage des commentaires du sondage //affichage des commentaires du sondage
if ($object->commentaires) if ($object->commentaires)
@ -362,7 +362,7 @@ if ($object->format=="D")
for ($i=0; isset($toutsujet[$i]); $i++) { for ($i=0; isset($toutsujet[$i]); $i++) {
$heures=explode('@',$toutsujet[$i]); $heures=explode('@',$toutsujet[$i]);
if (isset($heures[1])) { if (isset($heures[1])) {
print '<td class="heure">'.dol_htmlentities($heures[1]).'</td>'."\n"; print '<td class="heure">'.htmlentities($heures[1]).'</td>'."\n";
} else { } else {
print '<td class="heure"></td>'."\n"; print '<td class="heure"></td>'."\n";
} }
@ -418,7 +418,7 @@ while ($compteur < $num)
print '<tr>'."\n"; print '<tr>'."\n";
// Name // Name
print '<td class="nom">'.dol_htmlentities($obj->name).'</td>'."\n"; print '<td class="nom">'.htmlentities($obj->name).'</td>'."\n";
// si la ligne n'est pas a changer, on affiche les données // si la ligne n'est pas a changer, on affiche les données
if (! $testligneamodifier) if (! $testligneamodifier)
@ -677,7 +677,7 @@ if ($object->allow_spy) {
else else
{ {
$tmps=explode('@',$toutsujet[$i]); $tmps=explode('@',$toutsujet[$i]);
$meilleursujet .= dol_htmlentities($tmps[0]); $meilleursujet .= htmlentities($tmps[0]);
} }
$compteursujet++; $compteursujet++;
@ -717,7 +717,7 @@ if ($comments)
foreach ($comments as $obj) { foreach ($comments as $obj) {
print '<div class="comment"><span class="usercomment">'; print '<div class="comment"><span class="usercomment">';
if (in_array($obj->usercomment, $listofvoters)) print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> '; if (in_array($obj->usercomment, $listofvoters)) print '<a href="'.$_SERVER["PHP_SELF"].'?deletecomment='.$obj->id_comment.'&sondage='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> ';
print dol_htmlentities($obj->usercomment).':</span> <span class="comment">'.dol_nl2br(dol_htmlentities($obj->comment))."</span></div>"; print htmlentities($obj->usercomment).':</span> <span class="comment">'.dol_nl2br(htmlentities($obj->comment))."</span></div>";
} }
} }

View File

@ -451,9 +451,9 @@ $adresseadmin=$object->mail_admin;
print $langs->trans("Title") .'</td><td colspan="2">'; print $langs->trans("Title") .'</td><td colspan="2">';
if ($action == 'edit') if ($action == 'edit')
{ {
print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(dol_htmlentities($object->titre)).'">'; print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(htmlentities($object->titre)).'">';
} }
else print dol_htmlentities($object->titre); else print htmlentities($object->titre);
print '</td></tr>'; print '</td></tr>';
// Expire date // Expire date
@ -468,7 +468,7 @@ print $langs->trans("Author") .'</td><td colspan="2">';
if ($object->fk_user_creat) { if ($object->fk_user_creat) {
print $userstatic->getLoginUrl(1); print $userstatic->getLoginUrl(1);
} else { } else {
print dol_htmlentities($object->nom_admin); print htmlentities($object->nom_admin);
} }
print '</td></tr>'; print '</td></tr>';
@ -721,7 +721,7 @@ if ($object->format=="D")
for ($i = 0; isset($toutsujet[$i]); $i++) { for ($i = 0; isset($toutsujet[$i]); $i++) {
$heures=explode('@', $toutsujet[$i]); $heures=explode('@', $toutsujet[$i]);
if (isset($heures[1])) { if (isset($heures[1])) {
print '<td class="heure">'.dol_htmlentities($heures[1]).'</td>'."\n"; print '<td class="heure">'.htmlentities($heures[1]).'</td>'."\n";
} else { } else {
print '<td class="heure"></td>'."\n"; print '<td class="heure"></td>'."\n";
} }
@ -744,7 +744,7 @@ else
for ($i = 0; isset($toutsujet[$i]); $i++) for ($i = 0; isset($toutsujet[$i]); $i++)
{ {
$tmp=explode('@',$toutsujet[$i]); $tmp=explode('@',$toutsujet[$i]);
print '<td class="sujet">'.dol_htmlentities($tmp[0]).'</td>'."\n"; print '<td class="sujet">'.htmlentities($tmp[0]).'</td>'."\n";
} }
print '<td class="sujet"><a href="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'&ajoutsujet=1&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).'</a></td>'."\n"; print '<td class="sujet"><a href="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'&ajoutsujet=1&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_picto('',dol_buildpath('/opensurvey/img/add-16.png',1),'',1).'</a></td>'."\n";
@ -780,7 +780,7 @@ while ($compteur < $num)
} }
// Name // Name
print '</td><td class="nom">'.dol_htmlentities($obj->name).'</td>'."\n"; print '</td><td class="nom">'.htmlentities($obj->name).'</td>'."\n";
// si la ligne n'est pas a changer, on affiche les données // si la ligne n'est pas a changer, on affiche les données
if (! $testligneamodifier) if (! $testligneamodifier)
@ -1047,7 +1047,7 @@ for ($i = 0; $i < $nbcolonnes; $i++) {
else else
{ {
$tmps=explode('@',$toutsujet[$i]); $tmps=explode('@',$toutsujet[$i]);
$meilleursujet .= dol_htmlentities($tmps[0]); $meilleursujet .= htmlentities($tmps[0]);
} }
$compteursujet++; $compteursujet++;