From c8c91d0c23c9d9de5a1470e7f386d135b00ab1ea Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Tue, 10 Jan 2006 21:45:56 +0000 Subject: [PATCH] Brion-style conformity :-) --- includes/Wiki.php | 39 +++++++++++++++++++-------------------- index.php | 22 +++++++++++----------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/includes/Wiki.php b/includes/Wiki.php index 72240dcf46..ffb46d6da7 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -2,23 +2,22 @@ class MediaWiki { - var $params = array () ; + var $params = array(); - function setVal ( $key , &$value ) { - $this->param[strtolower($key)] = $value ; + function setVal( $key, &$value ) { + $this->param[strtolower( $key )] = $value; } - function getVal ( $key , $default = "" ) { - $key = strtolower ( $key ) ; - if ( isset ( $this->params[$key] ) ) { - return $this->params[$key] ; + function getVal( $key, $default = "" ) { + $key = strtolower( $key ); + if( isset( $this->params[$key] ) ) { + return $this->params[$key]; } - return $default ; + return $default; } - function initializeArticle ( &$title , $action ) { - global $wgRequest ; - if ( NS_MEDIA == $title->getNamespace() ) { + function initializeArticle( &$title, $request, $action ) { + if( NS_MEDIA == $title->getNamespace() ) { $title = Title::makeTitle( NS_IMAGE, $title->getDBkey() ); } @@ -36,19 +35,19 @@ class MediaWiki { } // Categories and images are handled by a different class - if ( $ns == NS_IMAGE ) { + if( $ns == NS_IMAGE ) { unset($article); require_once( 'includes/ImagePage.php' ); return new ImagePage( $title ); - } elseif ( $ns == NS_CATEGORY ) { + } elseif( $ns == NS_CATEGORY ) { unset($article); require_once( 'includes/CategoryPage.php' ); return new CategoryPage( $title ); } - return $article ; + return $article; } - function performAction ( $action , &$output , &$article , &$title , &$user , &$request ) { + function performAction( $action, &$output, &$article, &$title, &$user, &$request ) { switch( $action ) { case 'view': $output->setSquidMaxage( $this->getVal('SquidMaxage') ); @@ -104,11 +103,11 @@ class MediaWiki { $section = $request->getVal( 'section' ); $oldid = $request->getVal( 'oldid' ); if(!$this->getVal('UseExternalEditor') || $action=='submit' || $internal || - $section || $oldid || (!$user->getOption('externaleditor') && !$external)) { + $section || $oldid ||(!$user->getOption('externaleditor') && !$external)) { require_once( 'includes/EditPage.php' ); $editor = new EditPage( $article ); $editor->submit(); - } elseif($this->getVal('UseExternalEditor') && ($external || $user->getOption('externaleditor'))) { + } elseif($this->getVal('UseExternalEditor') &&($external || $user->getOption('externaleditor'))) { require_once( 'includes/ExternalEdit.php' ); $mode = $request->getVal( 'mode' ); $extedit = new ExternalEdit( $article, $mode ); @@ -116,7 +115,7 @@ class MediaWiki { } break; case 'history': - if ($_SERVER['REQUEST_URI'] == $title->getInternalURL('action=history')) { + if($_SERVER['REQUEST_URI'] == $title->getInternalURL('action=history')) { $output->setSquidMaxage( $this->getVal('SquidMaxage') ); } require_once( 'includes/PageHistory.php' ); @@ -129,13 +128,13 @@ class MediaWiki { $raw->view(); break; default: - if (wfRunHooks('UnknownAction', array($action, $article))) { + if(wfRunHooks('UnknownAction', array($action, $article))) { $output->errorpage( 'nosuchaction', 'nosuchactiontext' ); } } } -} ; # End of class MediaWiki +}; # End of class MediaWiki ?> diff --git a/index.php b/index.php index 8f82ac459b..373b17a728 100644 --- a/index.php +++ b/index.php @@ -152,20 +152,20 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) { } else { - require_once ( "includes/Wiki.php" ) ; + require_once( "includes/Wiki.php" ) ; $mediaWiki = new MediaWiki() ; - $wgArticle =& $mediaWiki->initializeArticle ( $wgTitle , $action ) ; + $wgArticle =& $mediaWiki->initializeArticle( $wgTitle, $wgRequest, $action ); - if ( in_array( $action, $wgDisabledActions ) ) { + if( in_array( $action, $wgDisabledActions ) ) { $wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' ); } else { - $mediaWiki->setVal ( "SquidMaxage" , $wgSquidMaxage ) ; - $mediaWiki->setVal ( "EnableDublinCoreRdf" , $wgEnableDublinCoreRdf ) ; - $mediaWiki->setVal ( "EnableCreativeCommonsRdf" , $wgEnableCreativeCommonsRdf ) ; - $mediaWiki->setVal ( "CommandLineMode" , $wgCommandLineMode ) ; - $mediaWiki->setVal ( "UseExternalEditor" , $wgUseExternalEditor ) ; - $mediaWiki->performAction ( $action , $wgOut , $wgArticle , $wgTitle , $wgUser , $wgRequest ) ; + $mediaWiki->setVal( "SquidMaxage", $wgSquidMaxage ); + $mediaWiki->setVal( "EnableDublinCoreRdf", $wgEnableDublinCoreRdf ); + $mediaWiki->setVal( "EnableCreativeCommonsRdf", $wgEnableCreativeCommonsRdf ); + $mediaWiki->setVal( "CommandLineMode", $wgCommandLineMode ); + $mediaWiki->setVal( "UseExternalEditor", $wgUseExternalEditor ); + $mediaWiki->performAction( $action, $wgOut, $wgArticle, $wgTitle, $wgUser, $wgRequest ); } @@ -176,7 +176,7 @@ wfProfileOut( 'main-action' ); # user, and that means doing this before OutputPage::output(). Note that for page saves, # the client will wait until the script exits anyway before following the redirect. wfProfileIn( 'main-updates' ); -foreach ( $wgDeferredUpdateList as $up ) { +foreach( $wgDeferredUpdateList as $up ) { $up->doUpdate(); } wfProfileOut( 'main-updates' ); @@ -189,7 +189,7 @@ $wgLoadBalancer->commitAll(); $wgOut->output(); -foreach ( $wgPostCommitUpdateList as $up ) { +foreach( $wgPostCommitUpdateList as $up ) { $up->doUpdate(); } -- 2.20.1