class MediaWiki {
+ var $GET ; # Stores the $_GET variables at time of creation, can be changed
var $params = array();
+ /**
+ * Constructor
+ */
+ function MediaWiki () {
+ $this->GET = $_GET ;
+ }
+
function setVal( $key, &$value ) {
$this->param[strtolower( $key )] = $value;
}
/**
* Initialize the object to be known as $wgArticle for special cases
*/
- function initializeSpecialCases ( &$title ) {
- if ( NS_SPECIAL == $title->getNamespace() ) {
+ function initializeSpecialCases ( &$title , &$output , $action ) {
+ if ( ( $action == 'view' ) &&
+ (!isset( $this->GET['title'] ) || $title->getPrefixedDBKey() != $this->GET['title'] ) &&
+ !count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) )
+ {
+ /* Redirect to canonical url, make it a 301 to allow caching */
+ $output->setSquidMaxage( 1200 );
+ $output->redirect( $title->getFullURL(), '301');
+ } else if ( NS_SPECIAL == $title->getNamespace() ) {
# actions that need to be made when we have a special pages
SpecialPage::executePath( $title );
} else {
$wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
$wgOut->errorpage( 'badtitle', 'badtitletext' );
}
-} else if ( ( $action == 'view' ) &&
- (!isset( $_GET['title'] ) || $wgTitle->getPrefixedDBKey() != $_GET['title'] ) &&
- !count( array_diff( array_keys( $_GET ), array( 'action', 'title' ) ) ) )
-{
- /* redirect to canonical url, make it a 301 to allow caching */
- $wgOut->setSquidMaxage( 1200 );
- $wgOut->redirect( $wgTitle->getFullURL(), '301');
-} else if ( $mediaWiki->initializeSpecialCases( $wgTitle ) ) {
+} else if ( $mediaWiki->initializeSpecialCases( $wgTitle , $wgOutput , $action ) ) {
# Do nothing, everything was already done by $mediaWiki
} else {
- $wgArticle =& $mediaWiki->initializeArticle( $wgTitle, $wgRequest, $action );
+ $wgArticle = $mediaWiki->initializeArticle( $wgTitle, $wgRequest, $action );
if( in_array( $action, $wgDisabledActions ) ) {
$wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );