Commit ccf68589 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Merge branch '5868-html-is-not-escaped-in-departments-descriptions' into '1.2.1-fixes'

Resolve "HTML is not escaped in departments descriptions" in 1.2.1-fixes

See merge request fusiondirectory/fd!359
Showing with 8 additions and 9 deletions
+8 -9
...@@ -238,9 +238,9 @@ class baseSelector ...@@ -238,9 +238,9 @@ class baseSelector
$this->tree .= "<li><a$selected $link>". $this->tree .= "<li><a$selected $link>".
'<img class="center" '. '<img class="center" '.
'src="'.htmlentities($config->department_info[$base]['img'], ENT_COMPAT, 'UTF-8').'" '. 'src="'.htmlentities($config->department_info[$base]['img'], ENT_COMPAT, 'UTF-8').'" '.
'alt="'.$config->department_info[$base]['name'].'"/>&nbsp;'. 'alt="'.htmlentities($config->department_info[$base]['name'], ENT_COMPAT, 'UTF-8').'"/>&nbsp;'.
$this->gennonbreaks($config->department_info[$base]['name']). $this->escape($config->department_info[$base]['name']).
($config->department_info[$base]['description'] == '' ? '' : '&nbsp;<span class="informal">['.$this->gennonbreaks($config->department_info[$base]['description']).']</span>'). (($config->department_info[$base]['description'] == '') ? '' : '&nbsp;<span class="informal">['.$this->escape($config->department_info[$base]['description']).']</span>').
'</a>'; '</a>';
$last_indent = $indent; $last_indent = $indent;
...@@ -267,13 +267,13 @@ class baseSelector ...@@ -267,13 +267,13 @@ class baseSelector
/*! /*!
* \brief Replace all space of the string by non-breaking space * \brief Replace all space of the string by non-breaking space and escapes HTML
* *
* \param String $string The string which his space will be replaced * \param String $string The string which his space will be replaced
*/ */
function gennonbreaks($string) function escape($string)
{ {
return str_replace('-', '&#8209;', str_replace(' ', '&nbsp;', $string)); return str_replace(' ', '&nbsp;', htmlentities($string, ENT_COMPAT, 'UTF-8'));
} }
/*! /*!
......
...@@ -93,10 +93,9 @@ class departmentManagement extends simpleManagement ...@@ -93,10 +93,9 @@ class departmentManagement extends simpleManagement
{ {
$ou = $ou[0]; $ou = $ou[0];
if ($dn == $base) { if ($dn == $base) {
$ou = "."; $ou = '.';
} }
$dn = func_get_arg(1); return '<a href="?plug='.$_GET['plug'].'&amp;PID='.$pid.'&amp;act=listing_open_'.$row.'" title="'.htmlentities($dn, ENT_COMPAT, 'UTF-8').'">'.htmlentities($ou, ENT_COMPAT, 'UTF-8').'</a>';
return "<a href='?plug=".$_GET['plug']."&amp;PID=$pid&amp;act=listing_open_$row' title='$dn'>$ou</a>";
} }
// Finally remove departments and update departmnet browsers // Finally remove departments and update departmnet browsers
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment