From: Aaron Schulz Date: Fri, 31 Aug 2007 19:44:36 +0000 (+0000) Subject: *Don't show the whole edit form if they are not allowed to create pages. Display... X-Git-Tag: 1.31.0-rc.0~51573 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=cea2f119256047a6cdb99461d8e1479baf6de6b5;p=lhc%2Fweb%2Fwiklou.git *Don't show the whole edit form if they are not allowed to create pages. Display permission error. (bug 11140) --- diff --git a/includes/EditPage.php b/includes/EditPage.php index f244b3928c..a5afb44775 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -319,6 +319,8 @@ class EditPage { } $permErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser); + if( !$this->mTitle->exists() ) + $permErrors += $this->mTitle->getUserPermissionsErrors( 'create', $wgUser); # Ignore some permissions errors. $remove = array(); @@ -342,7 +344,7 @@ class EditPage { # array_diff returns elements in $permErrors that are not in $remove. $permErrors = array_diff( $permErrors, $remove ); - if ($permErrors != array()) + if ( !empty($permErrors) ) { wfDebug( "$fname: User can't edit\n" ); $wgOut->readOnlyPage( $this->getContent(), true, $permErrors );