<?php
-/**
- * MediaWiki is the to-be base class for this whole project
-*/
-
class MediaWiki {
var $params = array();
-
- /**
- * Stores parameters (to avoid using globals)
- */
+
function setVal( $key, &$value ) {
$this->param[strtolower( $key )] = $value;
}
-
- /**
- * Retrieves parameters
- */
+
function getVal( $key, $default = "" ) {
$key = strtolower( $key );
if( isset( $this->params[$key] ) ) {
return $default;
}
- /**
- * Creates the article to be known as $wgArticle
- */
- function initializeArticle( &$title, &$request, $action ) {
- // Fix Media namespace
+ function initializeArticle( &$title, $request, $action ) {
if( NS_MEDIA == $title->getNamespace() ) {
$title = Title::makeTitle( NS_IMAGE, $title->getDBkey() );
}
# Reload from the page pointed to later
$article->mContentLoaded = false;
$ns = $rTitle->getNamespace();
- $wasRedirected = true;
}
}
// Categories and images are handled by a different class
if( $ns == NS_IMAGE ) {
- $b4 = $title->getPrefixedText();
unset($article);
require_once( 'includes/ImagePage.php' );
- $article = new ImagePage( $title );
- if( isset( $wasRedirected ) ) {
- $article->mTitle = $rTitle;
- $article->mRedirectedFrom = $b4;
- }
+ return new ImagePage( $title );
} elseif( $ns == NS_CATEGORY ) {
unset($article);
require_once( 'includes/CategoryPage.php' );
- $article = new CategoryPage( $title );
+ return new CategoryPage( $title );
}
return $article;
}
- /**
- * Performs any of a wide range of passed actions
- */
function performAction( $action, &$output, &$article, &$title, &$user, &$request ) {
switch( $action ) {
case 'view':