Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -1,23 +1,13 @@ |
2 | 2 | <?php |
3 | | -/** |
4 | | - * MediaWiki is the to-be base class for this whole project |
5 | | -*/ |
6 | 3 | |
7 | | - |
8 | 4 | class MediaWiki { |
9 | 5 | |
10 | 6 | var $params = array(); |
11 | | - |
12 | | - /** |
13 | | - * Stores parameters (to avoid using globals) |
14 | | - */ |
| 7 | + |
15 | 8 | function setVal( $key, &$value ) { |
16 | 9 | $this->param[strtolower( $key )] = $value; |
17 | 10 | } |
18 | | - |
19 | | - /** |
20 | | - * Retrieves parameters |
21 | | - */ |
| 11 | + |
22 | 12 | function getVal( $key, $default = "" ) { |
23 | 13 | $key = strtolower( $key ); |
24 | 14 | if( isset( $this->params[$key] ) ) { |
— | — | @@ -26,11 +16,7 @@ |
27 | 17 | return $default; |
28 | 18 | } |
29 | 19 | |
30 | | - /** |
31 | | - * Creates the article to be known as $wgArticle |
32 | | - */ |
33 | | - function initializeArticle( &$title, &$request, $action ) { |
34 | | - // Fix Media namespace |
| 20 | + function initializeArticle( &$title, $request, $action ) { |
35 | 21 | if( NS_MEDIA == $title->getNamespace() ) { |
36 | 22 | $title = Title::makeTitle( NS_IMAGE, $title->getDBkey() ); |
37 | 23 | } |
— | — | @@ -45,31 +31,22 @@ |
46 | 32 | # Reload from the page pointed to later |
47 | 33 | $article->mContentLoaded = false; |
48 | 34 | $ns = $rTitle->getNamespace(); |
49 | | - $wasRedirected = true; |
50 | 35 | } |
51 | 36 | } |
52 | 37 | |
53 | 38 | // Categories and images are handled by a different class |
54 | 39 | if( $ns == NS_IMAGE ) { |
55 | | - $b4 = $title->getPrefixedText(); |
56 | 40 | unset($article); |
57 | 41 | require_once( 'includes/ImagePage.php' ); |
58 | | - $article = new ImagePage( $title ); |
59 | | - if( isset( $wasRedirected ) ) { |
60 | | - $article->mTitle = $rTitle; |
61 | | - $article->mRedirectedFrom = $b4; |
62 | | - } |
| 42 | + return new ImagePage( $title ); |
63 | 43 | } elseif( $ns == NS_CATEGORY ) { |
64 | 44 | unset($article); |
65 | 45 | require_once( 'includes/CategoryPage.php' ); |
66 | | - $article = new CategoryPage( $title ); |
| 46 | + return new CategoryPage( $title ); |
67 | 47 | } |
68 | 48 | return $article; |
69 | 49 | } |
70 | 50 | |
71 | | - /** |
72 | | - * Performs any of a wide range of passed actions |
73 | | - */ |
74 | 51 | function performAction( $action, &$output, &$article, &$title, &$user, &$request ) { |
75 | 52 | switch( $action ) { |
76 | 53 | case 'view': |