Let's not have another fatal error due to a simple oversight right before a release...
[lhc/web/wiklou.git] / redirect.php
index 11d3c10..c0e8746 100644 (file)
@@ -1,6 +1,23 @@
 <?php
-include_once( "./LocalSettings.php" );
-global $wpDropdown, $wgArticlePath;
-$url = str_replace( "$1", $wpDropdown, $wgArticlePath );
+unset( $DP );
+unset( $IP );
+$wgCommandLineMode = false;
+define( 'MEDIAWIKI', true );
+if ( isset( $_REQUEST['GLOBALS'] ) ) {
+       echo '<a href="http://www.hardened-php.net/index.76.html">$GLOBALS overwrite vulnerability</a>';
+       die( -1 );
+}
+
+require_once( './includes/Defines.php' );
+require_once( './LocalSettings.php' );
+global $wgArticlePath;
+
+require_once( 'includes/WebRequest.php' );
+$wgRequest = new WebRequest();
+
+$page = $wgRequest->getVal( 'wpDropdown' );
+
+$url = str_replace( "$1", urlencode( $page ), $wgArticlePath );
+
 header( "Location: {$url}" );
 ?>