diff --git a/application/helpers/expressions/em_core_helper.php b/application/helpers/expressions/em_core_helper.php index 47a3a8da48d..4b2ac0f7a2d 100644 --- a/application/helpers/expressions/em_core_helper.php +++ b/application/helpers/expressions/em_core_helper.php @@ -1532,43 +1532,22 @@ public function GetPrettyPrintString() $descriptor .= ': '; } - if (version_compare(phpversion(), "5.2.3")>=0) + $messages[] = $descriptor . htmlspecialchars($question,ENT_QUOTES,'UTF-8',false); + if ($ansList != '') { - // 4th parameter to htmlspecialchars only became available in PHP version 5.2.3 - $messages[] = $descriptor . htmlspecialchars($question,ENT_QUOTES,'UTF-8',false); - if ($ansList != '') - { - $messages[] = htmlspecialchars($ansList,ENT_QUOTES,'UTF-8',false); - } - if ($code != '') { - if ($token[2] == 'SGQA' && preg_match('/^INSERTANS:/',$token[0])) { - $shown = $this->GetVarAttribute($token[0], 'shown', ''); - $messages[] = 'value=[' . htmlspecialchars($code,ENT_QUOTES,'UTF-8',false) . '] ' - . htmlspecialchars($shown,ENT_QUOTES,'UTF-8',false); - } - else { - $messages[] = 'value=' . htmlspecialchars($code,ENT_QUOTES,'UTF-8',false); - } - } + $messages[] = htmlspecialchars($ansList,ENT_QUOTES,'UTF-8',false); } - else - { - $messages[] = $descriptor . htmlspecialchars($question,ENT_QUOTES,'UTF-8'); - if ($ansList != '') - { - $messages[] = htmlspecialchars($ansList,ENT_QUOTES,'UTF-8'); + if ($code != '') { + if ($token[2] == 'SGQA' && preg_match('/^INSERTANS:/',$token[0])) { + $shown = $this->GetVarAttribute($token[0], 'shown', ''); + $messages[] = 'value=[' . htmlspecialchars($code,ENT_QUOTES,'UTF-8',false) . '] ' + . htmlspecialchars($shown,ENT_QUOTES,'UTF-8',false); } - if ($code != '') { - if ($token[2] == 'SGQA' && preg_match('/^INSERTANS:/',$token[0])) { - $shown = $this->GetVarAttribute($token[0], 'shown', ''); - $messages[] = 'value=[' . htmlspecialchars($code,ENT_QUOTES,'UTF-8') . '] ' - . htmlspecialchars($shown,ENT_QUOTES,'UTF-8'); - } - else { - $messages[] = 'value=' . htmlspecialchars($code,ENT_QUOTES,'UTF-8'); - } + else { + $messages[] = 'value=' . htmlspecialchars($code,ENT_QUOTES,'UTF-8',false); } } + if ($this->groupSeq == -1 || $groupSeq == -1 || $questionSeq == -1 || $this->questionSeq == -1) { $class = 'em-var-static'; } @@ -1589,12 +1568,15 @@ public function GetPrettyPrintString() $message = implode('; ',$messages); $message = str_replace(array('{','}'), array('{ ', ' }'), $message); - $stringParts[] = "hyperlinkSyntaxHighlighting && isset($gid) && isset($qid) && $qid>0) { + if ($this->hyperlinkSyntaxHighlighting && isset($gid) && isset($qid) && $qid>0) + { $editlink = Yii::app()->getController()->createUrl('admin/survey/sa/view/surveyid/' . $this->sid . '/gid/' . $gid . '/qid/' . $qid); - $stringParts[] = " data-link='{$editlink}'"; + $stringParts[] = ""; + } + else + { + $stringParts[] = ""; } - $stringParts[] = ">"; if ($this->sgqaNaming) { $sgqa = substr($jsName,4); @@ -1609,7 +1591,14 @@ public function GetPrettyPrintString() { $stringParts[] = $displayName; } - $stringParts[] = ""; + if ($this->hyperlinkSyntaxHighlighting && isset($gid) && isset($qid) && $qid>0) + { + $stringParts[] = ""; + } + else + { + $stringParts[] = ""; + } } break; case 'ASSIGN': diff --git a/application/helpers/viewHelper.php b/application/helpers/viewHelper.php index 1e769d5ab08..4bbe12cda3e 100644 --- a/application/helpers/viewHelper.php +++ b/application/helpers/viewHelper.php @@ -225,4 +225,33 @@ public static function purified($sHtml){ $oPurifier = new CHtmlPurifier(); return $oPurifier->purify($sHtml); } + /** + * Show clean string, leaving ONLY tag for Expression + * @param string : Html to clean + * @return string + */ + public static function stripTagsEM($sHtml) + { + $oPurifier = new CHtmlPurifier(); + $oPurifier->options = array( + 'HTML.Allowed'=>'span[title|class],a[class|title|href]', + 'Attr.AllowedClasses'=>array( + 'em-expression', + 'em-haveerror', + 'em-var-string', + 'em-function', + 'em-var-static', + 'em-var-before', + 'em-var-after', + 'em-var-inpage', + 'em-var-error', + '.em-error', + ), + 'URI.AllowedSchemes'=>array( // Maybe only local ? + 'http' => true, + 'https' => true, + ) + ); + return $oPurifier->purify($sHtml); + } } diff --git a/application/views/admin/survey/Question/questionbar_view.php b/application/views/admin/survey/Question/questionbar_view.php index 567b0fb4c0a..d3f9a2949a1 100644 --- a/application/views/admin/survey/Question/questionbar_view.php +++ b/application/views/admin/survey/Question/questionbar_view.php @@ -163,15 +163,15 @@