Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -962,33 +962,30 @@ |
963 | 963 | if( $protected ) { |
964 | 964 | $this->setPageTitle( wfMsg( 'viewsource' ) ); |
965 | 965 | $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) ); |
966 | | - |
967 | 966 | list( $cascadeSources, /* $restrictions */ ) = $wgTitle->getCascadeProtectionSources(); |
968 | 967 | |
969 | | - # Determine if protection is due to the page being a system message |
970 | | - # and show an appropriate explanation |
| 968 | + // Show an appropriate explanation depending upon the reason |
| 969 | + // for the protection...all of these should be moved to the |
| 970 | + // callers |
971 | 971 | if( $wgTitle->getNamespace() == NS_MEDIAWIKI ) { |
| 972 | + // User isn't allowed to edit the interface |
972 | 973 | $this->addWikiText( wfMsg( 'protectedinterface' ) ); |
973 | | - } if ( $cascadeSources && count($cascadeSources) > 0 ) { |
974 | | - $titles = ''; |
975 | | - |
976 | | - foreach ( $cascadeSources as $title ) { |
977 | | - $titles .= '* [[:' . $title->getPrefixedText() . "]]\n"; |
978 | | - } |
979 | | - |
980 | | - $notice = wfMsgExt( 'cascadeprotected', array('parsemag'), count($cascadeSources) ) . "\n$titles"; |
981 | | - |
982 | | - $this->addWikiText( $notice ); |
983 | | - } else if ( $wgTitle->isNamespaceProtected() ) { |
| 974 | + } elseif( $cascadeSources && ( $count = count( $cascadeSources ) ) > 0 ) { |
| 975 | + // Cascading protection |
| 976 | + $titles = ''; |
| 977 | + foreach( $cascadeSources as $title ) |
| 978 | + $titles .= "* [[:" . $title->getPrefixedText() . "]]\n"; |
| 979 | + $this->addWikiText( wfMsgExt( 'cascadeprotected', 'parsemag', $count ) . "\n{$titles}" ); |
| 980 | + } elseif( $wgTitle->isNamespaceProtected() ) { |
| 981 | + // Namespace protection |
984 | 982 | global $wgNamespaceProtection; |
985 | | - |
986 | | - $ns = ($wgTitle->getNamespace() == NS_MAIN) |
987 | | - ?wfMsg('nstab-main') |
988 | | - :$wgTitle->getNsText(); |
989 | | - |
| 983 | + $ns = $wgTitle->getNamespace() == NS_MAIN |
| 984 | + ? wfMsg( 'nstab-main' ) |
| 985 | + : $wgTitle->getNsText(); |
990 | 986 | $this->addWikiText( wfMsg( 'namespaceprotectedtext', $ns, |
991 | | - implode( ',', $wgNamespaceProtection[$wgTitle->getNamespace()] ) ) ); |
| 987 | + implode( ', ', $wgNamespaceProtection[ $wgTitle->getNamespace() ] ) ) ); |
992 | 988 | } else { |
| 989 | + // Standard protection |
993 | 990 | $this->addWikiText( wfMsg( 'protectedpagetext' ) ); |
994 | 991 | } |
995 | 992 | } else { |
— | — | @@ -1009,8 +1006,8 @@ |
1010 | 1007 | htmlspecialchars( $source ) . "\n</textarea>"; |
1011 | 1008 | $this->addHTML( $text ); |
1012 | 1009 | } |
1013 | | - $article = new Article($wgTitle); |
1014 | | - $this->addHTML( $skin->formatTemplates($article->getUsedTemplates()) ); |
| 1010 | + $article = new Article( $wgTitle ); |
| 1011 | + $this->addHTML( $skin->formatTemplates( $article->getUsedTemplates() ) ); |
1015 | 1012 | |
1016 | 1013 | $this->returnToMain( false ); |
1017 | 1014 | } |