(bug 9243) Avoid exit to make MW handle page exceptions properly
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 2 Jan 2009 11:36:52 +0000 (11:36 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 2 Jan 2009 11:36:52 +0000 (11:36 +0000)
includes/Article.php
includes/Wiki.php
includes/diff/DifferenceEngine.php

index 456e3d9..d7cde1c 100644 (file)
@@ -847,7 +847,7 @@ class Article {
                                $wgOut->loginToUse();
                                $wgOut->output();
                                wfProfileOut( __METHOD__ );
-                               exit;
+                               throw new MWException("Permission Error: you do not have access to view this page");
                        }
 
                        # We're looking at an old revision
index 9bb54c3..9060f23 100644 (file)
@@ -145,7 +145,7 @@ class MediaWiki {
                if( !is_null( $title ) && !$title->userCanRead() ) {
                        $output->loginToUse();
                        $output->output();
-                       exit;
+                       throw new MWException("Permission Error: you do not have access to view this page");
                }
        }
 
index 52b6c09..048b0b3 100644 (file)
@@ -148,11 +148,11 @@ CONTROL;
                $wgOut->setSubtitle( wfMsgExt( 'difference', array( 'parseinline' ) ) );
                $wgOut->setRobotPolicy( 'noindex,nofollow' );
 
-               if ( !( $this->mOldPage->userCanRead() && $this->mNewPage->userCanRead() ) ) {
+               if ( !$this->mOldPage->userCanRead() || !$this->mNewPage->userCanRead() ) {
                        $wgOut->loginToUse();
                        $wgOut->output();
                        wfProfileOut( __METHOD__ );
-                       exit;
+                       throw new MWException("Permission Error: you do not have access to view this page");
                }
 
                $sk = $wgUser->getSkin();
@@ -423,11 +423,11 @@ CONTROL;
 
                # Check if user is allowed to look at this page. If not, bail out.
                #
-               if ( !( $this->mTitle->userCanRead() ) ) {
+               if ( !$this->mTitle->userCanRead() ) {
                        $wgOut->loginToUse();
                        $wgOut->output();
                        wfProfileOut( __METHOD__ );
-                       exit;
+                       throw new MWException("Permission Error: you do not have access to view this page");
                }
 
                # Prepare the header box