32ace29074518adf8266817906f79bf7d9e8eaef
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];
23 * Initialize the object to be known as $wgArticle for special cases
25 function initializeSpecialCases ( &$title ) {
26 if ( NS_SPECIAL
== $title->getNamespace() ) {
27 # actions that need to be made when we have a special pages
28 SpecialPage
::executePath( $title );
30 /* No match to special cases */
33 /* Did match a special case */
38 * Initialize the object to be known as $wgArticle for "standard" actions
40 function initializeArticle( &$title, $request, $action ) {
41 if( NS_MEDIA
== $title->getNamespace() ) {
42 $title = Title
::makeTitle( NS_IMAGE
, $title->getDBkey() );
45 $ns = $title->getNamespace();
47 /* Namespace might change when using redirects */
48 $article = new Article( $title );
49 if( $action == 'view' && !$request->getVal( 'oldid' ) ) {
50 $rTitle = Title
::newFromRedirect( $article->fetchContent() );
52 # Reload from the page pointed to later
53 $article->mContentLoaded
= false;
54 $ns = $rTitle->getNamespace();
55 $wasRedirected = true;
59 /* Categories and images are handled by a different class */
60 if( $ns == NS_IMAGE
) {
61 $b4 = $title->getPrefixedText();
63 require_once( 'includes/ImagePage.php' );
64 $article = new ImagePage( $title );
65 if( isset( $wasRedirected ) && $request->getVal( 'redirect' ) != 'no' ) {
66 $article->mTitle
= $rTitle;
67 $article->mRedirectedFrom
= $b4;
69 } elseif( $ns == NS_CATEGORY
) {
71 require_once( 'includes/CategoryPage.php' );
72 $article = new CategoryPage( $title );
78 * Perform one of the "standard" actions
80 function performAction( $action, &$output, &$article, &$title, &$user, &$request ) {
83 $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
97 case 'deletetrackback':
105 if( !$this->getVal( 'EnableDublinCoreRdf' ) ) {
106 wfHttpError( 403, 'Forbidden', wfMsg( 'nodublincore' ) );
108 require_once( 'includes/Metadata.php' );
109 wfDublinCoreRdf( $article );
112 case 'creativecommons':
113 if( !$this->getVal( 'EnableCreativeCommonsRdf' ) ) {
114 wfHttpError( 403, 'Forbidden', wfMsg( 'nocreativecommons' ) );
116 require_once( 'includes/Metadata.php' );
117 wfCreativeCommonsRdf( $article );
121 require_once( 'includes/Credits.php' );
122 showCreditsPage( $article );
125 if( !$this->getVal( 'CommandLineMode' ) && !$request->checkSessionCookie() ) {
126 # Send a cookie so anons get talk message notifications
127 User
::SetupSession();
131 $internal = $request->getVal( 'internaledit' );
132 $external = $request->getVal( 'externaledit' );
133 $section = $request->getVal( 'section' );
134 $oldid = $request->getVal( 'oldid' );
135 if( !$this->getVal( 'UseExternalEditor' ) ||
$action=='submit' ||
$internal ||
136 $section ||
$oldid ||
( !$user->getOption( 'externaleditor' ) && !$external ) ) {
137 require_once( 'includes/EditPage.php' );
138 $editor = new EditPage( $article );
140 } elseif( $this->getVal( 'UseExternalEditor' ) && ( $external ||
$user->getOption( 'externaleditor' ) ) ) {
141 require_once( 'includes/ExternalEdit.php' );
142 $mode = $request->getVal( 'mode' );
143 $extedit = new ExternalEdit( $article, $mode );
148 if( $_SERVER['REQUEST_URI'] == $title->getInternalURL( 'action=history' ) ) {
149 $output->setSquidMaxage( $this->getVal( 'SquidMaxage' ) );
151 require_once( 'includes/PageHistory.php' );
152 $history = new PageHistory( $article );
156 require_once( 'includes/RawPage.php' );
157 $raw = new RawPage( $article );
161 if( wfRunHooks( 'UnknownAction', array( $action, $article ) ) ) {
162 $output->errorpage( 'nosuchaction', 'nosuchactiontext' );
167 }; # End of class MediaWiki