3 * MediaWiki is the to-be base class for this whole project
10 function setVal( $key, &$value ) {
11 $this->param
[strtolower( $key )] = $value;
14 function getVal( $key, $default = "" ) {
15 $key = strtolower( $key );
16 if( isset( $this->params
[$key] ) ) {
17 return $this->params
[$key];
22 function initializeArticle( &$title, $request, $action ) {
23 if( NS_MEDIA
== $title->getNamespace() ) {
24 $title = Title
::makeTitle( NS_IMAGE
, $title->getDBkey() );
27 $ns = $title->getNamespace();
29 // Namespace might change when using redirects
30 $article = new Article( $title );
31 if( $action == 'view' && !$request->getVal( 'oldid' ) ) {
32 $rTitle = Title
::newFromRedirect( $article->fetchContent() );
34 # Reload from the page pointed to later
35 $article->mContentLoaded
= false;
36 $ns = $rTitle->getNamespace();
37 $wasRedirected = true;
41 // Categories and images are handled by a different class
42 if( $ns == NS_IMAGE
) {
43 $b4 = $title->getPrefixedText();
45 require_once( 'includes/ImagePage.php' );
46 $article = new ImagePage( $title );
47 if( isset( $wasRedirected ) && $request->getVal( 'redirect' ) != 'no' ) {
48 $article->mTitle
= $rTitle;
49 $article->mRedirectedFrom
= $b4;
51 } elseif( $ns == NS_CATEGORY
) {
53 require_once( 'includes/CategoryPage.php' );
54 $article = new CategoryPage( $title );
59 function performAction( $action, &$output, &$article, &$title, &$user, &$request ) {
62 $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
76 case 'deletetrackback':
84 if( !$this->getVal( 'EnableDublinCoreRdf' ) ) {
85 wfHttpError( 403, 'Forbidden', wfMsg( 'nodublincore' ) );
87 require_once( 'includes/Metadata.php' );
88 wfDublinCoreRdf( $article );
91 case 'creativecommons':
92 if( !$this->getVal( 'EnableCreativeCommonsRdf' ) ) {
93 wfHttpError( 403, 'Forbidden', wfMsg( 'nocreativecommons' ) );
95 require_once( 'includes/Metadata.php' );
96 wfCreativeCommonsRdf( $article );
100 require_once( 'includes/Credits.php' );
101 showCreditsPage( $article );
104 if( !$this->getVal( 'CommandLineMode' ) && !$request->checkSessionCookie() ) {
105 # Send a cookie so anons get talk message notifications
106 User
::SetupSession();
110 $internal = $request->getVal( 'internaledit' );
111 $external = $request->getVal( 'externaledit' );
112 $section = $request->getVal( 'section' );
113 $oldid = $request->getVal( 'oldid' );
114 if( !$this->getVal( 'UseExternalEditor' ) ||
$action=='submit' ||
$internal ||
115 $section ||
$oldid ||
( !$user->getOption( 'externaleditor' ) && !$external ) ) {
116 require_once( 'includes/EditPage.php' );
117 $editor = new EditPage( $article );
119 } elseif( $this->getVal( 'UseExternalEditor' ) && ( $external ||
$user->getOption( 'externaleditor' ) ) ) {
120 require_once( 'includes/ExternalEdit.php' );
121 $mode = $request->getVal( 'mode' );
122 $extedit = new ExternalEdit( $article, $mode );
127 if( $_SERVER['REQUEST_URI'] == $title->getInternalURL( 'action=history' ) ) {
128 $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
130 require_once( 'includes/PageHistory.php' );
131 $history = new PageHistory( $article );
135 require_once( 'includes/RawPage.php' );
136 $raw = new RawPage( $article );
140 if( wfRunHooks( 'UnknownAction', array( $action, $article ) ) ) {
141 $output->errorpage( 'nosuchaction', 'nosuchactiontext' );
146 }; # End of class MediaWiki