7 function setVal( $key, &$value ) {
8 $this->param
[strtolower( $key )] = $value;
11 function getVal( $key, $default = "" ) {
12 $key = strtolower( $key );
13 if( isset( $this->params
[$key] ) ) {
14 return $this->params
[$key];
19 function initializeArticle( &$title, $request, $action ) {
20 if( NS_MEDIA
== $title->getNamespace() ) {
21 $title = Title
::makeTitle( NS_IMAGE
, $title->getDBkey() );
24 $ns = $title->getNamespace();
26 // Namespace might change when using redirects
27 $article = new Article( $title );
28 if($action == 'view' && !$wgRequest->getVal( 'oldid' ) ) {
29 $rTitle = Title
::newFromRedirect( $article->fetchContent() );
31 # Reload from the page pointed to later
32 $article->mContentLoaded
= false;
33 $ns = $rTitle->getNamespace();
37 // Categories and images are handled by a different class
38 if( $ns == NS_IMAGE
) {
40 require_once( 'includes/ImagePage.php' );
41 return new ImagePage( $title );
42 } elseif( $ns == NS_CATEGORY
) {
44 require_once( 'includes/CategoryPage.php' );
45 return new CategoryPage( $title );
50 function performAction( $action, &$output, &$article, &$title, &$user, &$request ) {
53 $output->setSquidMaxage( $this->getVal('SquidMaxage') );
67 case 'deletetrackback':
75 if( !$this->getVal('EnableDublinCoreRdf') ) {
76 wfHttpError( 403, 'Forbidden', wfMsg( 'nodublincore' ) );
78 require_once( 'includes/Metadata.php' );
79 wfDublinCoreRdf( $article );
82 case 'creativecommons':
83 if( !$this->getVal('EnableCreativeCommonsRdf') ) {
84 wfHttpError( 403, 'Forbidden', wfMsg('nocreativecommons') );
86 require_once( 'includes/Metadata.php' );
87 wfCreativeCommonsRdf( $article );
91 require_once( 'includes/Credits.php' );
92 showCreditsPage( $article );
95 if( !$this->getVal('CommandLineMode') && !$request->checkSessionCookie() ) {
96 # Send a cookie so anons get talk message notifications
101 $internal = $request->getVal( 'internaledit' );
102 $external = $request->getVal( 'externaledit' );
103 $section = $request->getVal( 'section' );
104 $oldid = $request->getVal( 'oldid' );
105 if(!$this->getVal('UseExternalEditor') ||
$action=='submit' ||
$internal ||
106 $section ||
$oldid ||
(!$user->getOption('externaleditor') && !$external)) {
107 require_once( 'includes/EditPage.php' );
108 $editor = new EditPage( $article );
110 } elseif($this->getVal('UseExternalEditor') &&($external ||
$user->getOption('externaleditor'))) {
111 require_once( 'includes/ExternalEdit.php' );
112 $mode = $request->getVal( 'mode' );
113 $extedit = new ExternalEdit( $article, $mode );
118 if($_SERVER['REQUEST_URI'] == $title->getInternalURL('action=history')) {
119 $output->setSquidMaxage( $this->getVal('SquidMaxage') );
121 require_once( 'includes/PageHistory.php' );
122 $history = new PageHistory( $article );
126 require_once( 'includes/RawPage.php' );
127 $raw = new RawPage( $article );
131 if(wfRunHooks('UnknownAction', array($action, $article))) {
132 $output->errorpage( 'nosuchaction', 'nosuchactiontext' );
137 }; # End of class MediaWiki