From 396b28f3d881f5debd888ba9bb9b47c2d478a76f Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 15 Dec 2008 18:02:47 +0100 Subject: update to Mediawiki 1.13.3; some cleanups --- includes/SpecialPrefixindex.php | 149 ---------------------------------------- 1 file changed, 149 deletions(-) delete mode 100644 includes/SpecialPrefixindex.php (limited to 'includes/SpecialPrefixindex.php') diff --git a/includes/SpecialPrefixindex.php b/includes/SpecialPrefixindex.php deleted file mode 100644 index bfab21b6..00000000 --- a/includes/SpecialPrefixindex.php +++ /dev/null @@ -1,149 +0,0 @@ -getVal( 'from' ); - $prefix = $wgRequest->getVal( 'prefix' ); - $namespace = $wgRequest->getInt( 'namespace' ); - $namespaces = $wgContLang->getNamespaces(); - - $indexPage = new SpecialPrefixIndex(); - - $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 ); - } elseif ( isset($prefix) ) { - $indexPage->showChunk( $namespace, $prefix, $specialPage->including(), $from ); - } elseif ( isset($from) ) { - $indexPage->showChunk( $namespace, $from, $specialPage->including(), $from ); - } else { - $wgOut->addHtml($indexPage->namespaceForm ( $namespace, null )); - } -} - -/** - * implements Special:Prefixindex - * @addtogroup SpecialPage - */ -class SpecialPrefixindex extends SpecialAllpages { - // Inherit $maxPerPage - - // Define other properties - protected $name = 'Prefixindex'; - protected $nsfromMsg = 'allpagesprefix'; - -/** - * @param integer $namespace (Default NS_MAIN) - * @param string $from list all pages from this name (default FALSE) - */ -function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = null ) { - global $wgOut, $wgUser, $wgContLang; - - $fname = 'indexShowChunk'; - - $sk = $wgUser->getSkin(); - - if (!isset($from)) $from = $prefix; - - $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; - - ### FIXME: should complain if $fromNs != $namespace - - $dbr = wfGetDB( DB_SLAVE ); - - $res = $dbr->select( 'page', - array( 'page_namespace', 'page_title', 'page_is_redirect' ), - array( - 'page_namespace' => $namespace, - 'page_title LIKE \'' . $dbr->escapeLike( $prefixKey ) .'%\'', - 'page_title >= ' . $dbr->addQuotes( $fromKey ), - ), - $fname, - array( - 'ORDER BY' => 'page_title', - 'LIMIT' => $this->maxPerPage + 1, - 'USE INDEX' => 'name_title', - ) - ); - - ### FIXME: side link to previous - - $n = 0; - $out = ''; - - while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) { - $t = Title::makeTitle( $s->page_namespace, $s->page_title ); - if( $t ) { - $link = ($s->page_is_redirect ? '
' : '' ) . - $sk->makeKnownLinkObj( $t, htmlspecialchars( $t->getText() ), false, false ) . - ($s->page_is_redirect ? '
' : '' ); - } else { - $link = '[[' . htmlspecialchars( $s->page_title ) . ']]'; - } - if( $n % 3 == 0 ) { - $out .= ''; - } - $out .= ""; - $n++; - if( $n % 3 == 0 ) { - $out .= ''; - } - } - if( ($n % 3) != 0 ) { - $out .= ''; - } - $out .= '
$link
'; - } - - if ( $including ) { - $out2 = ''; - } else { - $nsForm = $this->namespaceForm ( $namespace, $prefix ); - $out2 = ''; - $out2 .= '
' . $nsForm; - $out2 .= '' . - $sk->makeKnownLink( $wgContLang->specialPage( $this->name ), - wfMsg ( 'allpages' ) ); - if ( isset($dbr) && $dbr && ($n == $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) { - $namespaceparam = $namespace ? "&namespace=$namespace" : ""; - $out2 .= " | " . $sk->makeKnownLink( - $wgContLang->specialPage( $this->name ), - wfMsg ( 'nextpage', $s->page_title ), - "from=" . wfUrlEncode ( $s->page_title ) . - "&prefix=" . wfUrlEncode ( $prefix ) . $namespaceparam ); - } - $out2 .= "

"; - } - - $wgOut->addHtml( $out2 . $out ); -} -} - - -- cgit v1.2.3-54-g00ecf