Skip to content

Commit

Permalink
Fixed issue #10022 : [security] textarea input are not filtered in pu…
Browse files Browse the repository at this point in the history
…blic part

Dev: htmlspecialchars for all textarea
  • Loading branch information
Shnoulle committed Nov 7, 2015
1 parent 0add0cc commit 6890860
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions application/helpers/qanda_helper.php
Expand Up @@ -1925,7 +1925,7 @@ function do_listwithcomment($ia)
// --> END NEW FEATURE - SAVE
if (isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$fname2]) && $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$fname2])
{
$answer .= str_replace("\\", "", $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$fname2]);
$answer .= htmlspecialchars($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$fname2]);
}
$answer .= '</textarea>
</p>
Expand Down Expand Up @@ -1982,7 +1982,7 @@ function do_listwithcomment($ia)
// --> END NEW FEATURE - SAVE
if (isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$fname2]) && $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$fname2])
{
$answer .= str_replace("\\", "", $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$fname2]);
$answer .= htmlspecialchars( $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$fname2]);
}
$answer .= '</textarea>
<input class="radio" type="hidden" name="java'.$ia[1].'" id="java'.$ia[1].'" value="'.$_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]].'" /></p>';
Expand Down Expand Up @@ -2931,7 +2931,7 @@ function do_multipleshorttext($ia)
{
$dispVal = str_replace('.',$sSeparator,$dispVal);
}
$answer_main .= $dispVal;
$answer_main .= htmlspecialchars($dispVal);
}

$answer_main .= "</textarea>\n".$suffix."\n\t</span>\n"
Expand Down Expand Up @@ -3450,7 +3450,7 @@ function do_shortfreetext($ia)
{
$dispVal = str_replace('.',$sSeparator,$dispVal);
}
$answer .= $dispVal;
$answer .= htmlspecialchars($dispVal);
}

$answer .= "</textarea></p>\n";
Expand Down Expand Up @@ -3728,7 +3728,10 @@ function do_longfreetext($ia)
.'rows="'.$drows.'" cols="'.$tiwidth.'" '.$maxlength.' onkeyup="'.$checkconditionFunction.'(this.value, this.name, this.type)" >';
// --> END NEW FEATURE - SAVE

if ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]]) {$answer .= str_replace("\\", "", $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]]);}
if ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]])
{
$answer .= htmlspecialchars($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]]);
}

$answer .= "</textarea></p>\n";

Expand Down Expand Up @@ -3802,7 +3805,10 @@ function do_hugefreetext($ia)
.'rows="'.$drows.'" cols="'.$tiwidth.'" '.$maxlength.' onkeyup="'.$checkconditionFunction.'(this.value, this.name, this.type)" >';
// --> END NEW FEATURE - SAVE

if ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]]) {$answer .= str_replace("\\", "", $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]]);}
if ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]])
{
$answer .= htmlspecialchars($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]]);
}
$answer .= "</textarea>\n";
$answer .="</p>";
if (trim($aQuestionAttributes['time_limit']) != '')
Expand Down

0 comments on commit 6890860

Please sign in to comment.