r52417 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52416‎ | r52417 | r52418 >
Date:21:24, 25 June 2009
Author:yaron
Status:deferred
Tags:
Comment:
'includeonly free text' changed to 'onlyinclude free text'; fixed handling of HTML-escaped characters
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc
@@ -140,7 +140,7 @@
141141 // the parsing, so we have to assume that it will become a possibility
142142 $form_is_partial = false;
143143 $new_text = "";
144 - // flag for placing "<includeonly>" and "<noinclude>" tags in form output
 144+ // flag for placing "<onlyinclude>" tags in form output
145145 $includeonly_free_text = false;
146146
147147 // if we have existing content and we're not in an active replacement
@@ -578,7 +578,7 @@
579579 } else
580580 $cur_value = '';
581581 if ($cur_value && ! is_array($cur_value)) {
582 - $cur_value = str_replace('"', '&quot;', $cur_value);
 582+ $cur_value = htmlspecialchars($cur_value);
583583 }
584584
585585 if ($cur_value == null) {
@@ -599,7 +599,7 @@
600600 } else
601601 $cur_value = '';
602602 if ($cur_value) {
603 - $cur_value = str_replace('"', '&quot;', $cur_value);
 603+ $cur_value = htmlspecialchars($cur_value);
604604 }
605605 }
606606
@@ -750,7 +750,8 @@
751751 // form values, see if the current input is part of that formula,
752752 // and if so, substitute in the actual value
753753 if ($form_submitted && $generated_page_name != '') {
754 - $generated_page_name = str_replace('.', '_', $generated_page_name);
 754+ // this line appears unnecessary
 755+ //$generated_page_name = str_replace('.', '_', $generated_page_name);
755756 $generated_page_name = str_replace(' ', '_', $generated_page_name);
756757 $escaped_input_name = str_replace(' ', '_', $input_name);
757758 $generated_page_name = str_ireplace("<$escaped_input_name>", $cur_value_in_template, $generated_page_name);
@@ -977,10 +978,10 @@
978979 $form_is_partial = true;
979980 // replacement pages may have minimal matches...
980981 $source_page_matches_this_form = true;
981 - }
982 - elseif($tag == 'includeonly free text') {
983 - $includeonly_free_text = true;
984982 }
 983+ elseif($tag == 'includeonly free text' || $tag == 'onlyinclude free text') {
 984+ $onlyinclude_free_text = true;
 985+ }
985986 }
986987 $section = substr_replace($section, '', $brackets_loc, $brackets_end_loc + 3 - $brackets_loc);
987988 // =====================================================
@@ -1108,16 +1109,12 @@
11091110 } else {
11101111 $free_text = null;
11111112 }
1112 - // modify free text and data text to insert <noinclude> and <includeonly>
1113 - // tags, if necessary
1114 - if ($includeonly_free_text) {
1115 - $free_text = str_replace("<noinclude>",'', $free_text);
1116 - $free_text = str_replace("</noinclude>",'', $free_text);
1117 - $free_text = str_replace("<includeonly>",'', $free_text);
1118 - $free_text = str_replace("</includeonly>",'', $free_text);
 1113+ if ($onlyinclude_free_text) {
 1114+ // modify free text and data text to insert <onlyinclude> tags
 1115+ $free_text = str_replace("<onlyinclude>",'', $free_text);
 1116+ $free_text = str_replace("</onlyinclude>",'', $free_text);
11191117 $free_text = trim($free_text);
1120 - $data_text = str_replace('<free_text>','</noinclude><includeonly><free_text></includeonly><noinclude>', $data_text);
1121 - $data_text = "<noinclude>".$data_text."</noinclude>";
 1118+ $data_text = str_replace('<free_text>','<onlyinclude><free_text></onlyinclude>', $data_text);
11221119 }
11231120 // if the FCKeditor extension is installed, use that for the free text input
11241121 global $wgFCKEditorDir;

Status & tagging log