r23825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23824‎ | r23825 | r23826 >
Date:04:54, 7 July 2007
Author:robchurch
Status:old
Tags:
Comment:
Clean up OutputPage::readOnlyPage() -- most of these specific reasons should probably be moved to callers
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -962,33 +962,30 @@
963963 if( $protected ) {
964964 $this->setPageTitle( wfMsg( 'viewsource' ) );
965965 $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
966 -
967966 list( $cascadeSources, /* $restrictions */ ) = $wgTitle->getCascadeProtectionSources();
968967
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
971971 if( $wgTitle->getNamespace() == NS_MEDIAWIKI ) {
 972+ // User isn't allowed to edit the interface
972973 $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
984982 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();
990986 $this->addWikiText( wfMsg( 'namespaceprotectedtext', $ns,
991 - implode( ',', $wgNamespaceProtection[$wgTitle->getNamespace()] ) ) );
 987+ implode( ', ', $wgNamespaceProtection[ $wgTitle->getNamespace() ] ) ) );
992988 } else {
 989+ // Standard protection
993990 $this->addWikiText( wfMsg( 'protectedpagetext' ) );
994991 }
995992 } else {
@@ -1009,8 +1006,8 @@
10101007 htmlspecialchars( $source ) . "\n</textarea>";
10111008 $this->addHTML( $text );
10121009 }
1013 - $article = new Article($wgTitle);
1014 - $this->addHTML( $skin->formatTemplates($article->getUsedTemplates()) );
 1010+ $article = new Article( $wgTitle );
 1011+ $this->addHTML( $skin->formatTemplates( $article->getUsedTemplates() ) );
10151012
10161013 $this->returnToMain( false );
10171014 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r23912Merged revisions 23662-23909 via svnmerge from...david18:11, 9 July 2007

Status & tagging log