Index: includes/AutoLoader.php =================================================================== --- includes/AutoLoader.php (revision 40286) +++ includes/AutoLoader.php (working copy) @@ -473,6 +473,7 @@ 'SpecialRecentchanges' => 'includes/specials/SpecialRecentchanges.php', 'SpecialRecentchangeslinked' => 'includes/specials/SpecialRecentchangeslinked.php', 'SpecialSearch' => 'includes/specials/SpecialSearch.php', + 'SpecialSuffixindex' => 'includes/specials/SpecialSuffixindex.php', 'SpecialVersion' => 'includes/specials/SpecialVersion.php', 'UncategorizedCategoriesPage' => 'includes/specials/SpecialUncategorizedcategories.php', 'UncategorizedPagesPage' => 'includes/specials/SpecialUncategorizedpages.php', Index: includes/DefaultSettings.php =================================================================== --- includes/DefaultSettings.php (revision 40286) +++ includes/DefaultSettings.php (working copy) @@ -2799,6 +2799,7 @@ 'Allpages' => 'pages', 'Prefixindex' => 'pages', + 'Suffixindex' => 'pages', 'Listredirects' => 'pages', 'Categories' => 'pages', 'Disambiguations' => 'pages', Index: includes/specials/SpecialSuffixindex.php =================================================================== --- includes/specials/SpecialSuffixindex.php (revision 0) +++ includes/specials/SpecialSuffixindex.php (revision 0) @@ -0,0 +1,189 @@ +setHeaders(); + $this->outputHeader(); + + # GET values + $from = $wgRequest->getVal( 'from' ); + $suffix = $wgRequest->getVal( 'suffix' ); + $namespace = $wgRequest->getInt( 'namespace' ); + $namespaces = $wgContLang->getNamespaces(); + + $wgOut->setPagetitle( ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) ) + ? wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) + : wfMsg( 'allarticles' ) + ); + + if( isset( $par ) ){ + $this->showSuffixChunk( $namespace, $par, $from ); + } elseif( isset( $suffix ) ){ + $this->showSuffixChunk( $namespace, $suffix, $from ); + } elseif( isset( $from ) ){ + $this->showSuffixChunk( $namespace, $from, $from ); + } else { + $wgOut->addHtml( $this->namespaceSuffixForm( $namespace, null ) ); + } + } + + /** + * HTML for the top form + * @param integer $namespace A namespace constant (default NS_MAIN). + * @param string $from dbKey we are starting listing at. + */ + function namespaceSuffixForm( $namespace = NS_MAIN, $from = '' ) { + global $wgScript; + $t = $this->getTitle(); + + $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) ); + $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); + $out .= Xml::hidden( 'title', $t->getPrefixedText() ); + $out .= Xml::openElement( 'fieldset' ); + $out .= Xml::element( 'legend', null, wfMsg( 'allpages' ) ); + $out .= Xml::openElement( 'table', array( 'id' => 'nsselect', 'class' => 'allpages' ) ); + $out .= " + " . + Xml::label( wfMsg( 'allpagesend' ), 'nsfrom' ) . + " + " . + Xml::input( 'from', 30, str_replace('_',' ',$from), array( 'id' => 'nsfrom' ) ) . + " + + + " . + Xml::label( wfMsg( 'namespace' ), 'namespace' ) . + " + " . + Xml::namespaceSelector( $namespace, null ) . ' ' . + Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . + " + "; + $out .= Xml::closeElement( 'table' ); + $out .= Xml::closeElement( 'fieldset' ); + $out .= Xml::closeElement( 'form' ); + $out .= Xml::closeElement( 'div' ); + return $out; + } + + /** + * @param integer $namespace (Default NS_MAIN) + * @param string $from list all pages from this name (default FALSE) + */ + function showSuffixChunk( $namespace = NS_MAIN, $suffix, $from = null ) { + global $wgOut, $wgUser, $wgContLang; + + $sk = $wgUser->getSkin(); + + if (!isset($from)) $from = $suffix; + + $fromList = $this->getNamespaceKeyAndText($namespace, $from); + $suffixList = $this->getNamespaceKeyAndText($namespace, $suffix); + $namespaces = $wgContLang->getNamespaces(); + $align = $wgContLang->isRtl() ? 'left' : 'right'; + + if ( !$suffixList || !$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, $suffixKey, $suffix ) = $suffixList; + 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 \'%'. strtolower( $dbr->escapeLike( $suffixKey ) ) . '\'', + 'page_title >= ' . $dbr->addQuotes( $fromKey ), + ), + __METHOD__, + array( + 'ORDER BY' => 'page_title', + 'LIMIT' => $this->maxPerPage + 1, + 'USE INDEX' => 'name_title', + ) + ); + + ### FIXME: side link to previous + + $n = 0; + if( $res->numRows() > 0 ) { + $out = ''; + + while( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) { + $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
'; + } else { + $out = ''; + } + } + + if ( $this->including() ) { + $out2 = ''; + } else { + $nsForm = $this->namespaceSuffixForm( $namespace, $suffix ); + $self = $this->getTitle(); + $out2 = ''; + $out2 .= '
' . $nsForm; + $out2 .= '' . + $sk->makeKnownLinkObj( $self, + wfMsg ( 'allpages' ) ); + if( isset( $res ) && $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) { + $namespaceparam = $namespace ? "&namespace=$namespace" : ""; + $out2 .= " | " . $sk->makeKnownLinkObj( + $self, + wfMsgHtml( 'nextpage', htmlspecialchars( $s->page_title ) ), + "from=" . wfUrlEncode( $s->page_title ) . + "&suffix=" . wfUrlEncode( $suffix ) . $namespaceparam ); + } + $out2 .= "

"; + } + + $wgOut->addHtml( $out2 . $out ); + } +} Index: includes/SpecialPage.php =================================================================== --- includes/SpecialPage.php (revision 40286) +++ includes/SpecialPage.php (working copy) @@ -123,6 +123,7 @@ 'Protectedtitles' => array( 'SpecialPage', 'Protectedtitles' ), 'Allpages' => 'SpecialAllpages', 'Prefixindex' => 'SpecialPrefixindex', + 'Suffixindex' => 'SpecialSuffixindex', 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ), 'Specialpages' => array( 'UnlistedSpecialPage', 'Specialpages' ), 'Contributions' => array( 'SpecialPage', 'Contributions' ), Index: languages/messages/MessagesEn.php =================================================================== --- languages/messages/MessagesEn.php (revision 40286) +++ languages/messages/MessagesEn.php (working copy) @@ -396,6 +396,7 @@ 'Protectedpages' => array( 'ProtectedPages' ), 'Protectedtitles' => array( 'ProtectedTitles' ), 'Allpages' => array( 'AllPages' ), + 'Suffixindex' => array( 'SuffixIndex' ) , 'Prefixindex' => array( 'PrefixIndex' ) , 'Ipblocklist' => array( 'IPBlockList' ), 'Specialpages' => array( 'SpecialPages' ), @@ -2002,6 +2003,8 @@ 'mostrevisions-summary' => '', # do not translate or duplicate this message to other languages 'prefixindex' => 'Prefix index', 'prefixindex-summary' => '', # do not translate or duplicate this message to other languages +'suffixindex' => 'Suffix index', +'suffixindex-summary' => '', # do not translate or duplicate this message to other languages 'shortpages' => 'Short pages', 'shortpages-summary' => '', # do not translate or duplicate this message to other languages 'longpages' => 'Long pages', @@ -2067,6 +2070,7 @@ 'nextpage' => 'Next page ($1)', 'prevpage' => 'Previous page ($1)', 'allpagesfrom' => 'Display pages starting at:', +'allpagesend' => 'Display pages ending with:', 'allpagesto' => 'Display pages ending at:', 'allarticles' => 'All pages', 'allinnamespace' => 'All pages ($1 namespace)', Index: RELEASE-NOTES =================================================================== --- RELEASE-NOTES (revision 40286) +++ RELEASE-NOTES (working copy) @@ -106,6 +106,7 @@ * (bug 11884) Now support Flash EXIF attribute * Show thumbnails in the file history list, patch by User:Agbad * Added support of piped wikilinks using double-width brackets +* Special:Suffixindex is implemented, adding a page similar to Prefixindex, but looking for pages ending with a string === Bug fixes in 1.14 ===