FIX CVE-2024-55227 CSRF when MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY is

on (hidden option not on by default)
This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-01-08 17:41:45 +01:00
parent a1003a1a90
commit c0250e4c91
91 changed files with 326 additions and 189 deletions

View File

@ -189,9 +189,9 @@ class AccountingJournal extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowAccountingJournal");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip"';
}

View File

@ -529,9 +529,9 @@ class BookKeeping extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowTransaction");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -2382,9 +2382,9 @@ class Adherent extends CommonObject
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$langs->load("users");
$label = $langs->trans("ShowUser");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
}

View File

@ -780,7 +780,7 @@ class AdherentType extends CommonObject
}
}
$linkstart = '<a href="'.$url.'"';
$linkstart .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkstart .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkstart .= $dataparams.' class="'.$classfortooltip.'">';
$linkend = '</a>';

View File

@ -163,9 +163,9 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UserMailRequired").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">';
print '<td class="center" width="100">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('USER_MAIL_REQUIRED');
} else {
@ -181,9 +181,9 @@ print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UserHideInactive").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">';
print '<td class="center" width="100">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('USER_HIDE_INACTIVE_IN_COMBOBOX');
} else {
@ -325,7 +325,7 @@ foreach ($dirmodels as $reldir) {
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
}
print '</td>';

View File

@ -1408,9 +1408,9 @@ class Asset extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowAsset");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -619,9 +619,9 @@ class AssetModel extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowAssetModel");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1159,9 +1159,9 @@ class BOM extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowBillOfMaterials");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -387,9 +387,9 @@ class BOMLine extends CommonObjectLine
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowBillOfMaterialsLine");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -756,9 +756,9 @@ class Availabilities extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowAvailabilities");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -742,9 +742,9 @@ class Calendar extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowCalendar");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -319,9 +319,9 @@ class Bookmark extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowBookmark");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1811,9 +1811,9 @@ class Categorie extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.' '.$forced_color.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ' class="'.$forced_color.($morecss ? ' '.$morecss : '').'"';

View File

@ -1658,6 +1658,7 @@ class ActionComm extends CommonObject
$datas['note'] .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '<br>', $texttoshow));
$datas['note'] .= '</div>';
}
// show categories for this record only in ajax to not overload lists
if (isModEnabled('category') && !$nofetch) {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
@ -1767,6 +1768,7 @@ class ActionComm extends CommonObject
$tooltip .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '<br>', $texttoshow));
$tooltip .= '</div>';
}
$linkclose = '';
$classfortooltip = 'classfortooltip';
$dataparams = '';
@ -1784,9 +1786,9 @@ class ActionComm extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowAction");
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
$linkclose .= ' alt="'.dolPrintHTMLForAttribute($tooltip).'"';
}
$linkclose .= ($tooltip ? ' title="'.dol_escape_htmltag($tooltip, 1).'"' : ' title="tocomplete"');
$linkclose .= ($tooltip ? ' title="'.dolPrintHTMLForAttribute($tooltip).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classname.' '.$classfortooltip.'"';
} else {
$linkclose .= ' class="'.$classname.'"';

View File

@ -852,9 +852,9 @@ class Mailing extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowEMailing");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -3831,9 +3831,9 @@ class Propal extends CommonObject
if (empty($notooltip) && $user->hasRight('propal', 'lire')) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("Proposal");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -3898,9 +3898,9 @@ class Commande extends CommonOrder
if (empty($notooltip) && $user->hasRight('commande', 'lire')) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("Order");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
$target_value = array('_self', '_blank', '_parent', '_top');

View File

@ -1597,9 +1597,9 @@ class Account extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("BankAccount");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -724,9 +724,9 @@ class PaymentVarious extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -463,9 +463,9 @@ class CashControl extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -2109,9 +2109,9 @@ class Facture extends CommonInvoice
if (empty($notooltip) && $user->hasRight("facture", "read")) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("Invoice");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -964,9 +964,9 @@ class RemiseCheque extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowCheckReceipt");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1415,9 +1415,9 @@ class Paiement extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("Payment");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -688,9 +688,9 @@ class ChargeSociales extends CommonObject
if (empty($notooltip) && $user->hasRight("facture", "read")) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("SocialContribution");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip"';
}

View File

@ -783,9 +783,9 @@ class Tva extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1571,9 +1571,9 @@ class Contact extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowContact");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -2133,9 +2133,9 @@ class Contrat extends CommonObject
if (empty($notooltip) && $user->hasRight('contrat', 'lire')) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowContract");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}
$linkstart = '<a href="'.$url.'"';

View File

@ -450,7 +450,7 @@ class ContratLigne extends CommonObjectLine
}
$link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'"';
$link .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$link .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$link .= $dataparams.' class="'.$classfortooltip.'">';
$linkend = '</a>';

View File

@ -355,9 +355,9 @@ class Fiscalyear extends CommonObject
if (empty($notooltip) && $user->hasRight('accounting', 'fiscalyear', 'write')) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("FiscalPeriod");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -757,9 +757,9 @@ class TimeSpent extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowTimeSpent");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -2010,6 +2010,7 @@ function dolPrintText($s)
/**
* Return a string (that can be on several lines) ready to be output on a HTML page.
* To output a text inside an attribute, you can use dolPrintHTMLForAttribute() or dolPrintHTMLForTextArea() inside a textarea
* With dolPrintHTML(), only content not already in HTML is encoded with HTML.
*
* @param string $s String to print
* @param int $allowiframe Allow iframe tags
@ -2023,6 +2024,7 @@ function dolPrintHTML($s, $allowiframe = 0)
/**
* Return a string ready to be output on an HTML attribute (alt, title, data-html, ...)
* With dolPrintHTMLForAttribute(), the content is HTML encode, even if it is already HTML content.
*
* @param string $s String to print
* @return string String ready for HTML output
@ -2032,7 +2034,7 @@ function dolPrintHTMLForAttribute($s)
{
// The dol_htmlentitiesbr will convert simple text into html
// The dol_escape_htmltag will escape html chars.
return dol_escape_htmltag(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 0, 0, 0, array('br', 'b', 'font', 'span')), 1, -1, '', 0, 1);
return dol_escape_htmltag(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 0, 0, 0, array('br', 'b', 'font', 'hr', 'span')), 1, -1, '', 0, 1);
}
/**
@ -2071,7 +2073,7 @@ function dolPrintPassword($s)
* @param string $stringtoescape String to escape
* @param int $keepb 1=Replace b tags with escaped value (except if in $noescapetags), 0=Remove them completely
* @param int $keepn 1=Preserve \r\n strings, 0=Replace them with escaped value, -1=Remove them. Set to 1 when escaping for a <textarea>.
* @param string $noescapetags ''= or 'common' or list of tags to not escape.
* @param string $noescapetags '' (escape all html tags) or 'common' (do not escape some common tags) or list of tags to not escape.
* @param int $escapeonlyhtmltags 1=Escape only html tags, not the special chars like accents.
* @param int $cleanalsojavascript Clean also javascript. @TODO switch this option to 1 by default.
* @return string Escaped string
@ -2092,8 +2094,32 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta
if ($escapeonlyhtmltags) {
$tmp = htmlspecialchars_decode((string) $stringtoescape, ENT_COMPAT);
} else {
$tmp = html_entity_decode((string) $stringtoescape, ENT_COMPAT, 'UTF-8'); // This decode &egrave; into è so string is UTF8 (but &#39; is not decoded).
$tmp = str_ireplace('&#39;', '__SIMPLEQUOTE', $tmp);
// We make a manipulation by calling the html_entity_decode() to convert content into NON HTML UTF8 string.
// Because content can be or not already HTML.
// For example, this decode &egrave; into è so string is UTF8 (but numbers entities like &#39; is not decoded).
// In a future, we should not need this
$tmp = (string) $stringtoescape;
/*
// We protect the 6 special entities that we don't want to decode.
$tmp = str_ireplace('&lt', '__DONOTDECODELT', $tmp);
$tmp = str_ireplace('&gt', '__DONOTDECODEGT', $tmp);
$tmp = str_ireplace('&amp', '__DONOTDECODEAMP', $tmp);
$tmp = str_ireplace('&quot', '__DONOTDECODEQUOT', $tmp);
$tmp = str_ireplace('&apos', '__DONOTDECODEAPOS', $tmp);
$tmp = str_ireplace('&#39', '__DONOTDECODE39', $tmp);
$tmp = html_entity_decode((string) $tmp, ENT_COMPAT, 'UTF-8'); // Convert entities into UTF8
// We restore the 6 special entities that we don't want to have been decoded by previous command
$tmp = str_ireplace('__DONOTDECODELT', '&lt', $tmp);
$tmp = str_ireplace('__DONOTDECODEGT', '&gt', $tmp);
$tmp = str_ireplace('__DONOTDECODEAMP', '&amp', $tmp);
$tmp = str_ireplace('__DONOTDECODEQUOT', '&quot', $tmp);
$tmp = str_ireplace('__DONOTDECODEAPOS', '&apos', $tmp);
$tmp = str_ireplace('__DONOTDECODE39', '&#39', $tmp);
*/
$tmp = str_ireplace('&#39;', '__SIMPLEQUOTE', $tmp); // HTML 4
}
if (!$keepb) {
$tmp = strtr($tmp, array("<b>" => '', '</b>' => '', '<strong>' => '', '</strong>' => ''));
@ -2105,13 +2131,15 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta
}
if ($escapeonlyhtmltags) {
return htmlspecialchars($tmp, ENT_COMPAT, 'UTF-8');
$tmp = htmlspecialchars($tmp, ENT_COMPAT, 'UTF-8');
return $tmp;
} else {
// Escape tags to keep
// Now we protect all the tags we want to keep
$tmparrayoftags = array();
if ($noescapetags) {
$tmparrayoftags = explode(',', $noescapetags);
}
if (count($tmparrayoftags)) {
$reg = array();
$tmp = str_ireplace('__DOUBLEQUOTE', '', $tmp); // The keyword DOUBLEQUOTE is forbidden. Reserved, so we removed it if we find it.
@ -2147,8 +2175,20 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta
$diff = strcmp($tmpold, $tmp);
} while ($diff);
}
}
$tmp = str_ireplace('&lt', '__LESSTAN', $tmp);
$tmp = str_ireplace('&gt', '__GREATERTHAN', $tmp);
} else {
// var_dump($tmp);
//$tmp = str_ireplace('&lt', '__LESSTHAN', $tmp);
//$tmp = str_ireplace('&gt', '__GREATERTHAN', $tmp);
}
// Warning: htmlentities encode HTML tags like <abc>, but forget &lt; &gt; &quotes; &apos; &#39; &amp;
// So we do it ourself afterfor &lt; at &gt;
//$tmp = str_ireplace('&lt', '&amp;lt', $tmp);
//$tmp = str_ireplace('&gt', '&amp;gt', $tmp);
//var_dump("eeeeeeeeeeeeeeeeeeeee");
//var_dump($tmp);
$result = htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // Convert & into &amp; and more...
//print $result;
@ -2171,6 +2211,9 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapeta
$result = str_ireplace('__SIMPLEQUOTE', '&#39;', $result);
$result = str_ireplace('__LESSTAN', '&lt', $result);
$result = str_ireplace('__GREATERTHAN', '&gt', $result);
//$result="\n\n\n".var_export($tmp, true)."\n\n\n".var_export($result, true);
return $result;

View File

@ -1105,9 +1105,9 @@ class Cronjob extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowCronJob");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -809,7 +809,7 @@ class Delivery extends CommonObject
//}
$linkstart = '<a href="'.$url.'"';
$linkstart .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkstart .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkstart .= $dataparams.' class="'.$classfortooltip.'">';
$linkend = '</a>';

View File

@ -1024,9 +1024,9 @@ class EcmFiles extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowFile");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.' '.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -638,9 +638,9 @@ class EmailCollector extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowEmailCollector");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -322,9 +322,9 @@ class EmailCollectorAction extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowEmailcollectorAction");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
/*

View File

@ -333,9 +333,9 @@ class EmailCollectorFilter extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowEmailcollectorFilter");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
/*

View File

@ -609,9 +609,9 @@ class ConferenceOrBooth extends ActionComm
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowConferenceOrBooth");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
//$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
//$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -852,9 +852,9 @@ class ConferenceOrBoothAttendee extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowConferenceOrBoothAttendee");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -2003,9 +2003,9 @@ class Expedition extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("Shipment");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -1861,9 +1861,9 @@ class ExpenseReport extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowExpenseReport");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -936,9 +936,9 @@ class Fichinter extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowIntervention");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1077,9 +1077,9 @@ class CommandeFournisseur extends CommonOrder
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowOrder");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -2924,9 +2924,9 @@ class FactureFournisseur extends CommonInvoice
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowSupplierInvoice");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -1420,9 +1420,9 @@ class ProductFournisseur extends Product
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("SupplierRef");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -710,9 +710,9 @@ class PaiementFourn extends Paiement
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("Payment");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1454,9 +1454,9 @@ class Holiday extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -467,9 +467,9 @@ class Establishment extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("Establishment");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -779,9 +779,9 @@ class Evaluation extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowEvaluation");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -741,9 +741,9 @@ class EvaluationLine extends CommonObjectLine
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowEvaluationdet");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -763,9 +763,9 @@ class Job extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowJob");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -821,9 +821,9 @@ class Skill extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowSkill");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -723,9 +723,9 @@ class Skilldet extends CommonObjectLine
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowSkilldet");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -769,9 +769,9 @@ class SkillRank extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowSkillRank");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -708,9 +708,9 @@ class IntracommReport extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -842,9 +842,9 @@ class KnowledgeRecord extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowKnowledgeRecord");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -630,9 +630,9 @@ class Loan extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -833,9 +833,9 @@ class MyObject extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1511,9 +1511,9 @@ class Mo extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMo");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -575,9 +575,9 @@ class Opensurveysondage extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1060,9 +1060,9 @@ class Partnership extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowPartnership");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -288,9 +288,9 @@ class PartnershipType extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -744,9 +744,9 @@ class ProductFournisseurPrice extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowProductFournisseurPrice");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -602,9 +602,9 @@ class Inventory extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowInventory");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -848,9 +848,9 @@ class Entrepot extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("Warehouse");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -1228,9 +1228,9 @@ class Productlot extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -827,9 +827,9 @@ class StockTransfer extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowStockTransfer");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -758,9 +758,9 @@ class StockTransferLine extends CommonObjectLine
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowStockTransferLine");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1483,9 +1483,9 @@ class Project extends CommonObject
if (empty($notooltip) && $user->hasRight('projet', 'lire')) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowProject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1030,9 +1030,9 @@ class Task extends CommonObjectLine
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowTask");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.' nowraponall"';
} else {
$linkclose .= ' class="nowraponall"';

View File

@ -1352,9 +1352,9 @@ class Reception extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("Reception");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip"';
}

View File

@ -799,9 +799,9 @@ class RecruitmentCandidature extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowRecruitmentCandidature");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -858,9 +858,9 @@ class RecruitmentJobPosition extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowRecruitmentJobPosition");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -957,9 +957,9 @@ class Dolresource extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -902,9 +902,9 @@ class PaymentSalary extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("SalaryPayment");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -614,9 +614,9 @@ class Salary extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -499,9 +499,9 @@ class CompanyPaymentMode extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowCompanyPaymentMode");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -3115,9 +3115,9 @@ class Societe extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowCompany");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').' refurl valignmiddle"';
$target_value = array('_self', '_blank', '_parent', '_top');
if (in_array($target, $target_value)) {

View File

@ -514,9 +514,9 @@ class SocieteAccount extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("WebsiteAccount");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -2600,9 +2600,9 @@ class SupplierProposal extends CommonObject
if (empty($notooltip) && $user->hasRight('propal', 'lire')) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowSupplierProposal");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}

View File

@ -499,9 +499,9 @@ class CTicketCategory extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -1651,9 +1651,9 @@ class Ticket extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowTicket");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -2126,12 +2126,12 @@ if ($action == 'create' || $action == 'adduserldap') {
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
} else {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit&token='.newToken(), '', true, $params);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken(), '', true, $params);
}
} elseif ($permissiontoeditpasswordandsee && !$object->ldap_sid &&
(!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $object->entity == 1))) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit', '', true, $params);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit', '', true, $params);
}
// If we have a password generator engine enabled

View File

@ -3170,9 +3170,9 @@ class User extends CommonObject
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$langs->load("users");
$label = $langs->trans("ShowUser");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams . ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -875,7 +875,7 @@ class UserGroup extends CommonObject
$label = $langs->trans("ShowGroup");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
}

View File

@ -767,9 +767,9 @@ class Target extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowTarget");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -887,9 +887,9 @@ class WebsitePage extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -661,9 +661,9 @@ class Workstation extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowWorkstation");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= ($label ? ' title="'.dolPrintHtmlForAttribute($label).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -494,9 +494,9 @@ class Hook extends CommonObject
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' alt="'.dolPrintHtmlForAttribute($label).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' title="'.dolPrintHtmlForAttribute($label).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');

View File

@ -760,13 +760,14 @@ class SecurityTest extends CommonClassTest
$this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'Test 23 - The string was not detected as evil - Can\'t find the string Bad string syntax when i should');
}
/**
* testDolPrintHTML.
* testDolPrintHTMLAndDolPrintHtmlForAttribute.
* This method include calls to dol_htmlwithnojs()
*
* @return int
*/
public function testDolPrintHTML()
public function testDolPrintHTMLAndDolPrintHtmlForAttribute()
{
global $conf;
@ -779,17 +780,62 @@ class SecurityTest extends CommonClassTest
$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions
// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
$stringtotest = "&quot;&gt;";
$stringfixed = "&quot;&gt;";
// dolPrintHTML - With dolPrintHTML(), only content not already in HTML is encoded with HTML.
$stringtotest = "< > <b>bold</b>";
$stringfixed = "&lt; &gt; <b>bold</b>";
//$result = dol_htmlentitiesbr($stringtotest);
//$result = dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0);
//$result = dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0));
//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0)), 1, 1, 'common', 0, 1);
//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1);
$result = dolPrintHTML($stringtotest);
print __METHOD__." result=".$result."\n";
$this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists
$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 1'); // Expected '' because should failed because login 'auto' does not exists
// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
$stringtotest = "&quot; &gt; &lt; <b>bold</b>";
$stringfixed = "&quot; &gt; &lt; <b>bold</b>";
//$result = dol_htmlentitiesbr($stringtotest);
//$result = dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0);
//$result = dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0));
//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1);
$result = dolPrintHTML($stringtotest);
print __METHOD__." result=".$result."\n";
$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 2'); // Expected '' because should failed because login 'auto' does not exists
// dolPrintHTMLForAttribute - With dolPrintHTMLForAttribute(), the content is HTML encode, even if it is already HTML content.
$stringtotest = "< > <b>bold</b>";
$stringfixed = "&lt; &gt; &lt;b&gt;bold&lt;/b&gt;";
//$result = dol_htmlentitiesbr($stringtotest);
//$result = dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0);
//$result = dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0));
//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1);
$result = dolPrintHTMLForAttribute($stringtotest);
print __METHOD__." result=".$result."\n";
$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 1'); // Expected '' because should failed because login 'auto' does not exists
// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
$stringtotest = "&quot; &gt; &lt; <b>bold</b>";
$stringfixed = "&amp;quot; &amp;gt; &amp;lt; &lt;b&gt;bold&lt;/b&gt;";
//$result = dol_htmlentitiesbr($stringtotest);
//$result = dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0);
//$result = dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0));
//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1);
$result = dolPrintHTMLForAttribute($stringtotest);
print __METHOD__." result=".$result."\n";
$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 2'); // Expected '' because should failed because login 'auto' does not exists
// dolPrintHTML
/*
//return dol_escape_htmltag(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 0, 0, 0, array('br', 'b', 'font', 'hr', 'span')), 1, -1, '', 0, 1);
$result = dolPrintHTMLForAttribute($stringtotest);
print __METHOD__." result=".$result."\n";
$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 2'); // Expected '' because should failed because login 'auto' does not exists
*/
// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
$stringtotest = "testA\n<h1>hhhh</h1><z>ddd</z><header>aaa</header><footer>bbb</footer>";

46
test/phpunit/test.php Executable file
View File

@ -0,0 +1,46 @@
#!/usr/bin/env php
<?php
/**
* \file scripts/company/sync_contacts_dolibarr2ldap.php
* \ingroup ldap company
* \brief Script to update all contacts from Dolibarr into a LDAP database
*/
include "../../htdocs/master.inc.php";
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
print ">>> dol_escape_htmltag(eée < > bb<b>bold) - should not happen</b>\n";
print dol_escape_htmltag("eée < > bb<b>bold</b>", 1);
print "\n";
print ">>> dol_escape_htmltag(eée &lt; &gt; bb<b>bold)</b>\n";
print dol_escape_htmltag("eée &lt; &gt; bb<b>bold</b>", 1);
print "\n";
print '>>> dol_escape_htmltag(&lt;script&gt;alert("azerty")&lt;/script&gt;)'."\n";
print dol_escape_htmltag('&lt;script&gt;alert("azerty")&lt;/script&gt;', 1);
print "\n";
print "\n";
// dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 1, 1, array())), 1, 1, 'common', 0, 1);
print ">>> dolPrintHtml(eée < > bb<b>bold</b>) - should not happen\n";
print dolPrintHtml("eée < > bb<b>bold</b>");
print "\n";
print ">>> dolPrintHtml(eée &lt; &gt; bb<b>bold</b>)\n";
print dolPrintHtml("eée &lt; &gt; bb<b>bold</b>");
print "\n";
print '>>> dolPrintHtml(&lt;script&gt;alert("azerty")&lt;/script&gt;)'."\n";
print dolPrintHtml('&lt;script&gt;alert("azerty")&lt;/script&gt;');
print "\n";
print "\n";
// dol_escape_htmltag(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 0, 0, 0, array('br', 'b', 'font', 'hr', 'span')), 1, -1, '', 0, 1);
print ">>> dolPrintHtmlForattribute(eée < > bb<b>bold</b>)\n";
print dolPrintHtmlForAttribute("eée < > bb<b>bold</b>");
print "\n";
print ">>> dolPrintHtmlForAttribute(eée &lt; &gt; bb<b>bold</b>)\n";
print dolPrintHtmlForAttribute("eée &lt; &gt; bb<b>bold</b>");
print "\n";
print '>>> dolPrintHtmlForattribute(&lt;script&gt;alert("azerty")&lt;/script&gt;)'."\n";
print dolPrintHtmlForAttribute('&lt;script&gt;alert("azerty")&lt;/script&gt;');
print "\n";