From cea2f119256047a6cdb99461d8e1479baf6de6b5 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 31 Aug 2007 19:44:36 +0000 Subject: [PATCH] *Don't show the whole edit form if they are not allowed to create pages. Display permission error. (bug 11140) --- includes/EditPage.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ); -- 2.20.1