r111099 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111098‎ | r111099 | r111100 >
Date:21:22, 9 February 2012
Author:foxtrott
Status:deferred
Tags:
Comment:
bugfix (positional parameters not working for formedit, forminput)
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -173,6 +173,7 @@
174174 // set defaults
175175 $inFormName = $inValue = $inButtonStr = $inQueryStr = '';
176176 $inQueryArr = array();
 177+ $positionalParameters = false;
177178 $inAutocompletionSource = '';
178179 $inRemoteAutocompletion = false;
179180 $inSize = 25;
@@ -182,7 +183,7 @@
183184 $elements = explode( '=', $param, 2 );
184185
185186 // set param_name and value
186 - if ( count( $elements ) > 1 ) {
 187+ if ( count( $elements ) > 1 && !$positionalParameters ) {
187188 $param_name = trim( $elements[0] );
188189
189190 // parse (and sanitize) parameter values
@@ -221,7 +222,7 @@
222223 } elseif ( $param_name == null && $value == 'popup' ) {
223224 SFUtils::loadScriptsForPopupForm( $parser );
224225 $classStr = 'popupforminput';
225 - } elseif ( $param_name !== null ) {
 226+ } elseif ( $param_name !== null && !$positionalParameters ) {
226227
227228 $value = urlencode($value);
228229 parse_str("$param_name=$value", $arr);
@@ -229,6 +230,7 @@
230231
231232 } elseif ( $i == 0 ) {
232233 $inFormName = $value;
 234+ $positionalParameters = true;
233235 } elseif ( $i == 1 ) {
234236 $inSize = $value;
235237 } elseif ( $i == 2 ) {
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -896,14 +896,18 @@
897897 $inQueryStr = $inTargetName = '';
898898 $classStr = "";
899899 $inQueryArr = array();
 900+
 901+ $positionalParameters = false;
 902+
900903 // assign params
901904 // - support unlabelled params, for backwards compatibility
902905 // - parse and sanitize all parameter values
903906 foreach ( $params as $i => $param ) {
 907+
904908 $elements = explode( '=', $param, 2 );
905909
906910 // set param_name and value
907 - if ( count( $elements ) > 1 ) {
 911+ if ( count( $elements ) > 1 && !$positionalParameters ) {
908912 $param_name = trim( $elements[0] );
909913
910914 // parse (and sanitize) parameter values
@@ -936,12 +940,13 @@
937941 } elseif ( $param_name == null && $value == 'popup' ) {
938942 self::loadScriptsForPopupForm( $parser );
939943 $classStr = 'popupformlink';
940 - } elseif ( $param_name !== null ) {
 944+ } elseif ( $param_name !== null && !$positionalParameters ) {
941945 $value = urlencode($value);
942946 parse_str("$param_name=$value", $arr);
943947 $inQueryArr = self::array_merge_recursive_distinct( $inQueryArr, $arr );
944 - }elseif ( $i == 0 ) {
 948+ } elseif ( $i == 0 ) {
945949 $inFormName = $value;
 950+ $positionalParameters = true;
946951 } elseif ( $i == 1 ) {
947952 $inLinkStr = $value;
948953 } elseif ( $i == 2 ) {