[MediaWiki-commits] [Gerrit] mediawiki...Cargo[master]: Fix for HTML-encoding in "template" format

2017-12-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/395598 )

Change subject: Fix for HTML-encoding in "template" format
..


Fix for HTML-encoding in "template" format

Change-Id: If0f61a1caba26b8b108d57e0f8b44c9f37370a15
---
M formats/CargoTemplateFormat.php
1 file changed, 12 insertions(+), 1 deletion(-)

Approvals:
  Yaron Koren: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/formats/CargoTemplateFormat.php b/formats/CargoTemplateFormat.php
index 3363f4a..a658188 100644
--- a/formats/CargoTemplateFormat.php
+++ b/formats/CargoTemplateFormat.php
@@ -18,7 +18,18 @@
foreach ( $fieldDescriptions as $fieldName => $fieldDescription 
) {
if ( array_key_exists( $fieldName, $row ) ) {
$paramName = $namedArgs ? $fieldName : 
$fieldNum;
-   $wikiText .= '|' . $paramName . '=' . 
$row[$fieldName];
+   // HTML-decode the Wikitext values, which were
+   // encoded in CargoSQLQuery::run().
+   // We do this only for the "template" format
+   // because it's the only one that uses the
+   // unformatted values - the formatted values
+   // do this HTML-encoding on their own.
+   if ( $fieldDescription->mType == 'Wikitext' ) {
+   $value = htmlspecialchars_decode( 
$row[$fieldName] );
+   } else {
+   $value = $row[$fieldName];
+   }
+   $wikiText .= '|' . $paramName . '=' . $value;
$fieldNum++;
}
}

-- 
To view, visit https://gerrit.wikimedia.org/r/395598
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If0f61a1caba26b8b108d57e0f8b44c9f37370a15
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren 
Gerrit-Reviewer: Yaron Koren 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Cargo[master]: Fix for HTML-encoding in "template" format

2017-12-05 Thread Yaron Koren (Code Review)
Yaron Koren has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395598 )

Change subject: Fix for HTML-encoding in "template" format
..

Fix for HTML-encoding in "template" format

Change-Id: If0f61a1caba26b8b108d57e0f8b44c9f37370a15
---
M formats/CargoTemplateFormat.php
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/98/395598/2

diff --git a/formats/CargoTemplateFormat.php b/formats/CargoTemplateFormat.php
index 3363f4a..a658188 100644
--- a/formats/CargoTemplateFormat.php
+++ b/formats/CargoTemplateFormat.php
@@ -18,7 +18,18 @@
foreach ( $fieldDescriptions as $fieldName => $fieldDescription 
) {
if ( array_key_exists( $fieldName, $row ) ) {
$paramName = $namedArgs ? $fieldName : 
$fieldNum;
-   $wikiText .= '|' . $paramName . '=' . 
$row[$fieldName];
+   // HTML-decode the Wikitext values, which were
+   // encoded in CargoSQLQuery::run().
+   // We do this only for the "template" format
+   // because it's the only one that uses the
+   // unformatted values - the formatted values
+   // do this HTML-encoding on their own.
+   if ( $fieldDescription->mType == 'Wikitext' ) {
+   $value = htmlspecialchars_decode( 
$row[$fieldName] );
+   } else {
+   $value = $row[$fieldName];
+   }
+   $wikiText .= '|' . $paramName . '=' . $value;
$fieldNum++;
}
}

-- 
To view, visit https://gerrit.wikimedia.org/r/395598
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If0f61a1caba26b8b108d57e0f8b44c9f37370a15
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits