r92410 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92409‎ | r92410 | r92411 >
Date:20:42, 17 July 2011
Author:yaron
Status:deferred
Tags:
Comment:
Fixed some formatting, and added HTML-escaping of values from query string, so that quotes are displayed correctly
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -794,18 +794,20 @@
795795 if ( isset( $template_instance_query_values ) &&
796796 $template_instance_query_values != null &&
797797 is_array( $template_instance_query_values ) ) {
798 - // If the field name contains an
799 - // apostrophe, the array sometimes
800 - // has the apostrophe escaped, and
801 - // sometimes not. For now, just check
802 - // for both versions.
803 - // @TODO - figure this out.
804 - $field_query_val = null;
805 - if ( array_key_exists( $escaped_field_name, $template_instance_query_values ) ) {
806 - $field_query_val = $template_instance_query_values[$escaped_field_name];
807 - } elseif ( array_key_exists( $field_name, $template_instance_query_values ) ) {
808 - $field_query_val = $template_instance_query_values[$field_name];
809 - }
 798+ // If the field name contains an
 799+ // apostrophe, the array sometimes
 800+ // has the apostrophe escaped, and
 801+ // sometimes not. For now, just check
 802+ // for both versions.
 803+ // @TODO - figure this out.
 804+ $field_query_val = null;
 805+ if ( array_key_exists( $escaped_field_name, $template_instance_query_values ) ) {
 806+ $field_query_val = $template_instance_query_values[$escaped_field_name];
 807+ } elseif ( array_key_exists( $field_name, $template_instance_query_values ) ) {
 808+ $field_query_val = $template_instance_query_values[$field_name];
 809+ }
 810+ // Escaping of quotes is necessary.
 811+ $field_query_val = htmlentities( $field_query_val );
810812 if ( $form_submitted || ( ! empty( $field_query_val ) && ! is_array( $field_query_val ) ) ) {
811813 $cur_value = $field_query_val;
812814 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r92417Partial revert of r92410 - removed HTML-escaping; this is the wrong place for ityaron22:45, 17 July 2011
r92420Follow-up to r92410 and r92417 - this is the wrong place for any sort of HTML...yaron00:26, 18 July 2011