*Don't show the whole edit form if they are not allowed to create pages. Display...
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 31 Aug 2007 19:44:36 +0000 (19:44 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 31 Aug 2007 19:44:36 +0000 (19:44 +0000)
includes/EditPage.php

index f244b39..a5afb44 100644 (file)
@@ -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 );