Skip to content

Commit

Permalink
Dev: Fixed issue : Remove token information from browse table
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Mar 1, 2015
1 parent b89746a commit cd5709b
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions application/controllers/admin/responses.php
Expand Up @@ -344,7 +344,7 @@ function browse($iSurveyID)
'submitdate', // Replaced by completed : TODO : add it if is a real date
'token', // Replaced by tokens.token
'id', // Allways adding it at start
'lastpage', // AFter id, before completed
'lastpage', // After id, before completed
);
// The column model must be built dynamically, since the columns will differ from survey to survey, depending on the questions.
$column_model = array();
Expand Down Expand Up @@ -528,10 +528,6 @@ public function getResponses_json($iSurveyID)
'token', // Replaced by tokens.token
'id', // Allways adding it at start
'lastpage',
// Token columns
'firstname',
'lastname',
'email',
);
$fields = createFieldMap($iSurveyID, 'full', true, false, $aData['language']);

Expand All @@ -547,6 +543,8 @@ public function getResponses_json($iSurveyID)
if ($aData['surveyinfo']['anonymized'] == "N" && tableExists("{{tokens_{$iSurveyID}}}") && Permission::model()->hasSurveyPermission($iSurveyID,'tokens','read'))
{
$oCriteria = SurveyDynamic::model($iSurveyID)->addTokenCriteria($oCriteria);
$aSpecificColumns=array_merge($aSpecificColumns,TokenDynamic::model($iSurveyID)->getTableSchema()->getColumnNames());

}

if (incompleteAnsFilterState() == "incomplete")
Expand Down Expand Up @@ -644,7 +642,11 @@ public function getResponses_json($iSurveyID)

if ($bHaveToken)
{
$aSurveyEntry[] = strip_tags($row['token']);
if(is_null($row['tid']))
$aSurveyEntry[] = strip_tags($row['token']);
else
$aSurveyEntry[] = "<a href='".Yii::app()->createUrl("admin/tokens",array("sa"=>"edit","surveyid"=>$surveyid,"tokenid"=>$row['tid']))."'>".strip_tags($row['token'])."</a>";

$aSurveyEntry[] = strip_tags($row['firstname']);
$aSurveyEntry[] = strip_tags($row['lastname']);
$aSurveyEntry[] = strip_tags($row['email']);
Expand All @@ -658,17 +660,6 @@ public function getResponses_json($iSurveyID)

if(in_array($row_index,$aSpecificColumns))
continue;
// Ignore these fields
/*
if (in_array($row_index, array( 'id', 'submitdate',
'token', 'email', 'firstname', 'lastname', 'tid',
'participant_id', 'emailstatus', 'blacklisted', 'language',
'remindersent', 'remindercount', 'usesleft', 'validfrom',
'validuntil', 'mpid', 'sent', 'completed'
))) {
continue;
}
*/
// Alternative to striptag : use CHtmlPurifier : but CHtmlPurifier use a lot of memory
$aSurveyEntry[] = strip_tags(getExtendedAnswer($iSurveyID, $row_index, $row_value, $oBrowseLanguage)); // This fix XSS and get the value
}
Expand Down

0 comments on commit cd5709b

Please sign in to comment.