Fix bug #1618, patch by Mark Bergsma. Stop using hardcoded value for maximum number...
authorAntoine Musso <hashar@users.mediawiki.org>
Wed, 2 Mar 2005 16:29:36 +0000 (16:29 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Wed, 2 Mar 2005 16:29:36 +0000 (16:29 +0000)
includes/SpecialAllpages.php

index 55aaa80..eb7bbda 100644 (file)
@@ -43,11 +43,12 @@ function namespaceForm ( $namespace = NS_MAIN, $from = '' ) {
 
        $namespaceselect = '<select name="namespace">';
        $arr = $wgContLang->getNamespaces();
-       for ( $i = 0; $i <= 17; $i++ ) {
-               $namespacename = str_replace ( '_', ' ', $arr[$i] );
-               $n = ($i == 0) ? wfMsg ( 'articlenamespace' ) : $namespacename;
-               $sel = ($i == $namespace) ? ' selected="selected"' : '';
-               $namespaceselect .= "<option value='{$i}'{$sel}>{$n}</option>";
+       foreach ( $arr as $ns => $name ) {
+               if ( $ns < NS_MAIN ) continue;
+               $namespacename = str_replace ( '_', ' ', $name);
+               $n = ($ns == 0) ? wfMsg ( 'articlenamespace' ) : $namespacename;
+               $sel = ($ns == $namespace) ? ' selected="selected"' : '';
+               $namespaceselect .= "<option value='{$ns}'{$sel}>{$n}</option>";                
        }
        $namespaceselect .= '</select>';