X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSpecialPrefixindex.php;h=bfab21b6ac056db942adc38da763999ce21e89db;hb=1ca04031afd2e1969962c8ed35b29e92aef5cb93;hp=bbfc2782dc50e45b4c3fb0e0e4b0313083666039;hpb=e04123f1e2ba2b9ec91c8d0b8b5ff3e9cc66d007;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialPrefixindex.php b/includes/SpecialPrefixindex.php index bbfc2782dc..bfab21b6ac 100644 --- a/includes/SpecialPrefixindex.php +++ b/includes/SpecialPrefixindex.php @@ -1,11 +1,8 @@ getVal( 'from' ); $prefix = $wgRequest->getVal( 'prefix' ); $namespace = $wgRequest->getInt( 'namespace' ); - $namespaces = $wgContLang->getNamespaces(); $indexPage = new SpecialPrefixIndex(); - if( !in_array($namespace, array_keys($namespaces)) ) - $namespace = 0; - - $wgOut->setPagetitle( $namespace > 0 ? - wfMsg( 'allinnamespace', $namespaces[$namespace] ) : - wfMsg( 'allarticles' ) - ); - - + $wgOut->setPagetitle( ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) ) + ? wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) + : wfMsg( 'allarticles' ) + ); if ( isset($par) ) { $indexPage->showChunk( $namespace, $par, $specialPage->including(), $from ); @@ -44,12 +35,16 @@ function wfSpecialPrefixIndex( $par=NULL, $specialPage ) { } } +/** + * implements Special:Prefixindex + * @addtogroup SpecialPage + */ class SpecialPrefixindex extends SpecialAllpages { - var $maxPerPage=960; - var $topLevelMax=50; - var $name='Prefixindex'; - # Determines, which message describes the input field 'nsfrom', used in function namespaceForm (see superclass SpecialAllpages) - var $nsfromMsg='allpagesprefix'; + // Inherit $maxPerPage + + // Define other properties + protected $name = 'Prefixindex'; + protected $nsfromMsg = 'allpagesprefix'; /** * @param integer $namespace (Default NS_MAIN) @@ -66,16 +61,22 @@ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = n $fromList = $this->getNamespaceKeyAndText($namespace, $from); $prefixList = $this->getNamespaceKeyAndText($namespace, $prefix); + $namespaces = $wgContLang->getNamespaces(); + $align = $wgContLang->isRtl() ? 'left' : 'right'; if ( !$prefixList || !$fromList ) { $out = wfMsgWikiHtml( 'allpagesbadtitle' ); + } elseif ( !in_array( $namespace, array_keys( $namespaces ) ) ) { + // Show errormessage and reset to NS_MAIN + $out = wfMsgExt( 'allpages-bad-ns', array( 'parseinline' ), $namespace ); + $namespace = NS_MAIN; } else { list( $namespace, $prefixKey, $prefix ) = $prefixList; - list( $fromNs, $fromKey, $from ) = $fromList; + list( /* $fromNs */, $fromKey, $from ) = $fromList; ### FIXME: should complain if $fromNs != $namespace - $dbr =& wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->select( 'page', array( 'page_namespace', 'page_title', 'page_is_redirect' ), @@ -97,7 +98,6 @@ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = n $n = 0; $out = ''; - $namespaces = $wgContLang->getFormattedNamespaces(); while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) { $t = Title::makeTitle( $s->page_namespace, $s->page_title ); if( $t ) { @@ -127,8 +127,8 @@ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = n } else { $nsForm = $this->namespaceForm ( $namespace, $prefix ); $out2 = '
'; - $out2 .= '
' . $nsForm; - $out2 .= '' . + $out2 .= '
' . $nsForm; + $out2 .= '' . $sk->makeKnownLink( $wgContLang->specialPage( $this->name ), wfMsg ( 'allpages' ) ); if ( isset($dbr) && $dbr && ($n == $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) { @@ -146,4 +146,4 @@ function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = n } } -?> +