Fixed big XSS problems in open survey module

This commit is contained in:
Marcos García de La Fuente 2014-01-05 04:50:54 +01:00
parent 45da8eb446
commit d23a8ea788
3 changed files with 19 additions and 21 deletions

View File

@ -193,24 +193,24 @@ $adresseadmin=$object->mail_admin;
print $langs->trans("Title") .'</td><td colspan="2">';
if ($action == 'edit')
{
print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag($object->titre).'">';
print '<input type="text" name="nouveautitre" size="40" value="'.dol_escape_htmltag(htmlentities($object->titre)).'">';
}
else print $object->titre;
else print htmlentities($object->titre);
print '</td></tr>';
// Auteur
print '<tr><td>';
print $langs->trans("Author") .'</td><td colspan="2">';
print $object->nom_admin;
print htmlentities($object->nom_admin);
print '</td></tr>';
// Description
print '<tr><td>'.$langs->trans("Description") .'</td><td colspan="2">';
if ($action == 'edit')
{
print '<textarea name="nouveauxcommentaires" rows="7" cols="80">'.$object->commentaires.'</textarea>'."\n";
print '<textarea name="nouveauxcommentaires" rows="7" cols="80">'. htmlentities($object->commentaires).'</textarea>'."\n";
}
else print dol_nl2br($object->commentaires);
else print dol_nl2br(htmlentities($object->commentaires));
print '</td></tr>';
// EMail
@ -308,7 +308,7 @@ $comments = $object->getComments();
if ($comments) {
foreach ($comments as $comment) {
print '<a href="'.dol_buildpath('/opensurvey/adminstuds.php',1).'?deletecomment='.$comment->id_comment.'&id='.$numsondage.'"> '.img_picto('', 'delete.png').'</a> ';
print $comment->usercomment.': '.dol_nl2br($comment->comment)." <br>";
print htmlentities($comment->usercomment).': '.dol_nl2br(htmlentities($comment->comment))." <br>";
}
}
else

View File

@ -556,16 +556,16 @@ print '<div class="corps"> '."\n";
//affichage du titre du sondage
$titre=str_replace("\\","",$object->titre);
print '<strong>'.$titre.'</strong><br>'."\n";
print '<strong>'.htmlentities($titre).'</strong><br>'."\n";
//affichage du nom de l'auteur du sondage
print $langs->trans("InitiatorOfPoll") .' : '.$object->nom_admin.'<br>'."\n";
print $langs->trans("InitiatorOfPoll") .' : '.htmlentities($object->nom_admin).'<br>'."\n";
//affichage des commentaires du sondage
if ($object->commentaires)
{
print '<br>'.$langs->trans("Description") .' :<br>'."\n";
$commentaires=dol_nl2br($object->commentaires);
$commentaires=dol_nl2br(htmlentities($object->commentaires));
print $commentaires;
print '<br>'."\n";
}
@ -695,7 +695,7 @@ if ($object->format=="D"||$object->format=="D+")
for ($i = 0; isset($toutsujet[$i]); $i++) {
$heures=explode('@', $toutsujet[$i]);
if (isset($heures[1])) {
print '<td class="heure">'.$heures[1].'</td>'."\n";
print '<td class="heure">'.htmlentities($heures[1]).'</td>'."\n";
} else {
print '<td class="heure"></td>'."\n";
}
@ -748,8 +748,7 @@ while ($compteur < $num)
print '<td><input type="image" name="effaceligne'.$compteur.'" value="Effacer" src="'.dol_buildpath('/opensurvey/img/cancel.png',1).'"></td>'."\n";
// Name
$nombase=str_replace("°","'",$obj->nom);
print '<td class="nom">'.$nombase.'</td>'."\n";
print '<td class="nom">'.htmlentities($obj->nom).'</td>'."\n";
// si la ligne n'est pas a changer, on affiche les données
if (! $testligneamodifier)
@ -1045,9 +1044,9 @@ if ($nbofcheckbox >= 2)
print '<p class="affichageresultats">'."\n";
if (isset($meilleurecolonne) && $compteursujet == "1") {
print "<img src=\"".dol_buildpath('/opensurvey/img/medaille.png',1)."\"> " . $langs->trans('TheBestChoice') . " : <b>$meilleursujet </b>" . $langs->trans("with") . " <b>$meilleurecolonne </b>" . $vote_str . ".\n";
print "<img src=\"".dol_buildpath('/opensurvey/img/medaille.png',1)."\"> " . $langs->trans('TheBestChoice') . " : <b>".htmlentities($meilleursujet)." </b>" . $langs->trans("with") . " <b>$meilleurecolonne </b>" . $vote_str . ".\n";
} elseif (isset($meilleurecolonne)) {
print "<img src=\"".dol_buildpath('/opensurvey/img/medaille.png',1)."\"> " . $langs->trans('TheBestChoices') . " : <b>$meilleursujet </b>" . $langs->trans("with") . " <b>$meilleurecolonne </b>" . $vote_str . ".\n";
print "<img src=\"".dol_buildpath('/opensurvey/img/medaille.png',1)."\"> " . $langs->trans('TheBestChoices') . " : <b>".htmlentities($meilleursujet)." </b>" . $langs->trans("with") . " <b>$meilleurecolonne </b>" . $vote_str . ".\n";
}
print '<br></p><br>'."\n";
}

View File

@ -240,16 +240,16 @@ print '<div class="corps"> '."\n";
//affichage du titre du sondage
$titre=str_replace("\\","",$object->titre);
print '<strong>'.$titre.'</strong><br>'."\n";
print '<strong>'.htmlentities($titre).'</strong><br>'."\n";
//affichage du nom de l'auteur du sondage
print $langs->trans("InitiatorOfPoll") .' : '.$object->nom_admin.'<br>'."\n";
print $langs->trans("InitiatorOfPoll") .' : '.htmlentities($object->nom_admin).'<br>'."\n";
//affichage des commentaires du sondage
if ($object->commentaires)
{
print '<br>'.$langs->trans("Description") .' :<br>'."\n";
$commentaires=dol_nl2br($object->commentaires);
$commentaires=dol_nl2br(htmlentities($object->commentaires));
print $commentaires;
print '<br>'."\n";
}
@ -339,7 +339,7 @@ if ($object->format=="D"||$object->format=="D+")
for ($i=0; isset($toutsujet[$i]); $i++) {
$heures=explode('@',$toutsujet[$i]);
if (isset($heures[1])) {
print '<td class="heure">'.$heures[1].'</td>'."\n";
print '<td class="heure">'.htmlentities($heures[1]).'</td>'."\n";
} else {
print '<td class="heure"></td>'."\n";
}
@ -392,8 +392,7 @@ if ($object->allow_spy) {
$mod_ok = (! empty($nombase) && in_array($nombase, $listofvoters));
// Name
$nombase=str_replace("°","'",$obj->nom);
print '<td class="nom">'.$nombase.'</td>'."\n";
print '<td class="nom">'.htmlentities($obj->nom).'</td>'."\n";
// si la ligne n'est pas a changer, on affiche les données
if (! $testligneamodifier)
@ -691,7 +690,7 @@ if ($comments)
foreach ($comments as $obj) {
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> ';
print $obj->usercomment.' :</span> <span class="comment">'.dol_nl2br($obj->comment)."</span></div>";
print htmlentities($obj->usercomment).' :</span> <span class="comment">'.dol_nl2br(htmlentities($obj->comment))."</span></div>";
}
}