Moving image and category detection
This commit is contained in:
parent
89e89e69b9
commit
a2ddb0c688
2 changed files with 16 additions and 10 deletions
|
|
@ -16,6 +16,20 @@ class MediaWiki {
|
|||
return $default ;
|
||||
}
|
||||
|
||||
function setCorrectArticleClass ( &$article , &$title , $namespace ) {
|
||||
// Categories and images are handled by a different class
|
||||
if ( $namespace == NS_IMAGE ) {
|
||||
unset($article);
|
||||
require_once( 'includes/ImagePage.php' );
|
||||
return new ImagePage( $title );
|
||||
} elseif ( $namespace == NS_CATEGORY ) {
|
||||
unset($article);
|
||||
require_once( 'includes/CategoryPage.php' );
|
||||
return new CategoryPage( $title );
|
||||
}
|
||||
return $article ;
|
||||
}
|
||||
|
||||
function performAction ( $action , &$output , &$article , &$title , &$user , &$request ) {
|
||||
switch( $action ) {
|
||||
case 'view':
|
||||
|
|
|
|||
12
index.php
12
index.php
|
|
@ -167,20 +167,12 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
|
|||
}
|
||||
}
|
||||
|
||||
// Categories and images are handled by a different class
|
||||
if ( $ns == NS_IMAGE ) {
|
||||
unset($wgArticle);
|
||||
require_once( 'includes/ImagePage.php' );
|
||||
$wgArticle = new ImagePage( $wgTitle );
|
||||
} elseif ( $ns == NS_CATEGORY ) {
|
||||
unset($wgArticle);
|
||||
require_once( 'includes/CategoryPage.php' );
|
||||
$wgArticle = new CategoryPage( $wgTitle );
|
||||
}
|
||||
|
||||
require_once ( "includes/Wiki.php" ) ;
|
||||
$mediaWiki = new MediaWiki() ;
|
||||
|
||||
$wgArticle =& $mediaWiki->setCorrectArticleClass ( $wgArticle , $wgTitle , $ns ) ;
|
||||
|
||||
if ( in_array( $action, $wgDisabledActions ) ) {
|
||||
$wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue