When a user is prohibited from creating a page, a title of "View source" makes no...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 2 Jan 2008 02:49:31 +0000 (02:49 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 2 Jan 2008 02:49:31 +0000 (02:49 +0000)
RELEASE-NOTES
includes/EditPage.php
includes/OutputPage.php

index 9ab08d1..f2ca88a 100644 (file)
@@ -112,6 +112,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Add HTML ID's mw-read-only-warning and mw-anon-edit-warning to warnings when
   editing to allow CSS styling.
 * Parser now returns list of sections
+* When a user is prohibited from creating a page, a title of "View source"
+  makes no sense, and there should be no "Return to [[Page]]" link.
 
 === Bug fixes in 1.12 ===
 
index ab4b86a..8fa5417 100644 (file)
@@ -389,8 +389,7 @@ class EditPage {
                # array_diff returns elements in $permErrors that are not in $remove.
                $permErrors = array_diff( $permErrors, $remove );
 
-               if ( !empty($permErrors) )
-               {
+               if ( !empty($permErrors) ) {
                        wfDebug( "$fname: User can't edit\n" );
                        $wgOut->readOnlyPage( $this->getContent(), true, $permErrors );
                        wfProfileOut( $fname );
index 3ce9451..6e50960 100644 (file)
@@ -1037,8 +1037,12 @@ class OutputPage {
 
                if ( !empty($reasons) ) {
                        // Permissions error
-                       $this->setPageTitle( wfMsg( 'viewsource' ) );
-                       $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
+                       if( $source ) {
+                               $this->setPageTitle( wfMsg( 'viewsource' ) );
+                               $this->setSubtitle( wfMsg( 'viewsourcefor', $skin->makeKnownLinkObj( $wgTitle ) ) );
+                       } else {
+                               $this->setPageTitle( wfMsg( 'badaccess' ) );
+                       }
                        $this->addWikiText( $this->formatPermissionsErrorMessage( $reasons ) );
                } else {
                        // Wiki is read only
@@ -1071,7 +1075,12 @@ class OutputPage {
                        $this->addHTML( $skin->formatTemplates( $article->getUsedTemplates() ) );
                }
 
-               $this->returnToMain( false, $wgTitle );
+               # If the title doesn't exist, it's fairly pointless to print a return
+               # link to it.  After all, you just tried editing it and couldn't, so
+               # what's there to do there?
+               if( $wgTitle->exists() ) {
+                       $this->returnToMain( false, $wgTitle );
+               }
        }
 
        /** @deprecated */