Add array support to wfArrayToCGI(): when receiving parameters in the form of &foo...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sat, 24 May 2008 21:54:57 +0000 (21:54 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sat, 24 May 2008 21:54:57 +0000 (21:54 +0000)
includes/GlobalFunctions.php

index a9bf015..3294c8f 100644 (file)
@@ -999,7 +999,13 @@ function wfArrayToCGI( $array1, $array2 = NULL )
                        if ( '' != $cgi ) {
                                $cgi .= '&';
                        }
-                       $cgi .= urlencode( $key ) . '=' . urlencode( $value );
+                       if(is_array($value))
+                               foreach($value as $v)
+                                       $cgi .= urlencode( $key . '[]' ) . '=' .
+                                               urlencode( $v );
+                       else
+                               $cgi .= urlencode( $key ) . '=' .
+                                       urlencode( $value );
                }
        }
        return $cgi;