Fixes for r55979
authorAndrew Garrett <werdna@users.mediawiki.org>
Tue, 8 Sep 2009 19:39:04 +0000 (19:39 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Tue, 8 Sep 2009 19:39:04 +0000 (19:39 +0000)
* Use getUserPermissionsErrors, which also handles blocking and so on.
* Also check with create action, which also checks for title protection and what-not.

includes/Article.php

index 85a331e..efc3961 100644 (file)
@@ -1199,7 +1199,7 @@ class Article {
         * namespace, show the default message text. To be called from Article::view().
         */
        public function showMissingArticle() {
-               global $wgOut, $wgRequest;
+               global $wgOut, $wgRequest, $wgUser;
                # Show delete and move logs
                $this->showLogs();
 
@@ -1213,7 +1213,11 @@ class Article {
                        // Use the default message text
                        $text = $this->getContent();
                } else {
-                       if ( $this->mTitle->userCan( 'edit' ) )
+                       $createErrors = $this->mTitle->getUserPermissionsErrors( 'create', $wgUser );
+                       $editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
+                       $errors = array_merge( $createErrors, $editErrors );
+                       
+                       if ( !count($errors) )
                                $text = wfMsgNoTrans( 'noarticletext' );
                        else
                                $text = wfMsgNoTrans( 'noarticletext-nopermission' );