Reverting r16861; incompatible change to message texts, breaks a lot of toggle displa...
[lhc/web/wiklou.git] / includes / OutputPage.php
index 0086770..0d55c2e 100644 (file)
@@ -769,6 +769,12 @@ class OutputPage {
         */
        function loginToUse() {
                global $wgUser, $wgTitle, $wgContLang;
+
+               if( $wgUser->isLoggedIn() ) {
+                       $this->permissionRequired( 'read' );
+                       return;
+               }
+
                $skin = $wgUser->getSkin();
                
                $this->setPageTitle( wfMsg( 'loginreqtitle' ) );
@@ -781,7 +787,11 @@ class OutputPage {
                $this->addHtml( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );
                $this->addHtml( "\n<!--" . $wgTitle->getPrefixedUrl() . "-->" );
                
-               $this->returnToMain();
+               # Don't return to the main page if the user can't read it
+               # otherwise we'll end up in a pointless loop
+               $mainPage = Title::newFromText( wfMsgForContent( 'mainpage' ) );
+               if( $mainPage->userCanRead() )
+                       $this->returnToMain( true, $mainPage );
        }
 
        /** @obsolete */