* 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 ===
# 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 );
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
$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 */