* Removed existence of Title object check since not having it would make other things...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 7 Nov 2011 13:51:40 +0000 (13:51 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 7 Nov 2011 13:51:40 +0000 (13:51 +0000)
* Moved isArticleRelated() check one level up
* And pass the User object to Title::quickUserCan()

includes/OutputPage.php

index 0a81ecd..8d17e8b 100644 (file)
@@ -2841,9 +2841,10 @@ $templates
                }
 
                # Universal edit button
-               if ( $wgUniversalEditButton ) {
-                       if ( $this->isArticleRelated() && $this->getTitle() && $this->getTitle()->quickUserCan( 'edit' )
-                               && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create' ) ) ) {
+               if ( $wgUniversalEditButton && $this->isArticleRelated() ) {
+                       $user = $this->getUser();
+                       if ( $this->getTitle()->quickUserCan( 'edit', $user )
+                               && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
                                // Original UniversalEditButton
                                $msg = $this->msg( 'edit' )->text();
                                $tags[] = Html::element( 'link', array(