Index: trunk/extensions/VariablePage/VariablePage.body.php |
— | — | @@ -28,10 +28,23 @@ |
29 | 29 | if ( strlen( $utm_campaign )) $query[ 'utm_campaign' ] = $utm_campaign; |
30 | 30 | if ( strlen( $referrer )) $query[ 'referrer' ] = $referrer; |
31 | 31 | |
32 | | - $tracking = '?' . wfArrayToCGI( $query ); |
| 32 | + // determine the URL to which we will redirect the user |
| 33 | + $url = $this->determinePage( $wgVariablePagePossibilities ); |
33 | 34 | |
34 | | - $url = $this->determinePage( $wgVariablePagePossibilities ); |
35 | | - $wgOut->redirect( $url . $tracking ); |
| 35 | + // check if we have a pre-existing query string in the URL, merge it with our previously generated query |
| 36 | + $query_start = strpos( $url, '?' ); |
| 37 | + if ( $query_start ) { |
| 38 | + $query_str = substr( $url, $query_start + 1 ); |
| 39 | + $url = substr( $url, 0, $query_start ); |
| 40 | + foreach ( explode( "&", $query_str ) as $params ) { |
| 41 | + list( $key, $value ) = explode( "=", $params ); |
| 42 | + $query_orig[ $key ] = $value; |
| 43 | + } |
| 44 | + $query = array_merge( $query, $query_orig ); |
| 45 | + } |
| 46 | + |
| 47 | + $full_query = $wgRequest->appendQueryArray( $query, true ); |
| 48 | + $wgOut->redirect( $url . '?' . $full_query ); |
36 | 49 | } |
37 | 50 | |
38 | 51 | /** |