http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97930

Revision: 97930
Author:   ialex
Date:     2011-09-23 17:21:08 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
Use local context instead of global variables

Modified Paths:
--------------
    trunk/phase3/includes/LogEventsList.php

Modified: trunk/phase3/includes/LogEventsList.php
===================================================================
--- trunk/phase3/includes/LogEventsList.php     2011-09-23 17:14:31 UTC (rev 
97929)
+++ trunk/phase3/includes/LogEventsList.php     2011-09-23 17:21:08 UTC (rev 
97930)
@@ -821,15 +821,15 @@
 
        // Call ONLY after calling $this->limitType() already!
        public function getFilterParams() {
-               global $wgFilterLogTypes, $wgUser, $wgRequest;
+               global $wgFilterLogTypes;
                $filters = array();
                if( count($this->types) ) {
                        return $filters;
                }
                foreach( $wgFilterLogTypes as $type => $default ) {
                        // Avoid silly filtering
-                       if( $type !== 'patrol' || $wgUser->useNPPatrol() ) {
-                               $hide = $wgRequest->getInt( "hide_{$type}_log", 
$default );
+                       if( $type !== 'patrol' || 
$this->getUser()->useNPPatrol() ) {
+                               $hide = $this->getRequest()->getInt( 
"hide_{$type}_log", $default );
                                $filters[$type] = $hide;
                                if( $hide )
                                        $this->mConds[] = 'log_type != ' . 
$this->mDb->addQuotes( $type );
@@ -846,13 +846,13 @@
         *   empty string means no restriction
         */
        private function limitType( $types ) {
-               global $wgLogRestrictions, $wgUser;
+               global $wgLogRestrictions;
                // If $types is not an array, make it an array
                $types = ($types === '') ? array() : (array)$types;
                // Don't even show header for private logs; don't recognize 
it...
                foreach ( $types as $type ) {
                        if( isset( $wgLogRestrictions[$type] )
-                               && 
!$wgUser->isAllowed($wgLogRestrictions[$type])
+                               && 
!$this->getUser()->isAllowed($wgLogRestrictions[$type])
                        ) {
                                $types = array_diff( $types, array( $type ) );
                        }
@@ -892,12 +892,12 @@
                           but for now it won't pass anywhere behind the 
optimizer */
                        $this->mConds[] = "NULL";
                } else {
-                       global $wgUser;
                        $this->mConds['log_user'] = $userid;
                        // Paranoia: avoid brute force searches (bug 17342)
-                       if( !$wgUser->isAllowed( 'deletedhistory' ) || 
$wgUser->isBlocked() ) {
+                       $user = $this->getUser();
+                       if( !$user->isAllowed( 'deletedhistory' ) || 
$user->isBlocked() ) {
                                $this->mConds[] = 
$this->mDb->bitAnd('log_deleted', LogPage::DELETED_USER) . ' = 0';
-                       } elseif( !$wgUser->isAllowed( 'suppressrevision' ) || 
$wgUser->isBlocked() ) {
+                       } elseif( !$user->isAllowed( 'suppressrevision' ) || 
$user->isBlocked() ) {
                                $this->mConds[] = 
$this->mDb->bitAnd('log_deleted', LogPage::SUPPRESSED_USER) .
                                        ' != ' . LogPage::SUPPRESSED_USER;
                        }
@@ -913,7 +913,7 @@
         * @param $pattern String
         */
        private function limitTitle( $page, $pattern ) {
-               global $wgMiserMode, $wgUser;
+               global $wgMiserMode;
 
                $title = Title::newFromText( $page );
                if( strlen( $page ) == 0 || !$title instanceof Title ) {
@@ -944,9 +944,10 @@
                        $this->mConds['log_title'] = $title->getDBkey();
                }
                // Paranoia: avoid brute force searches (bug 17342)
-               if( !$wgUser->isAllowed( 'deletedhistory' ) || 
$wgUser->isBlocked() ) {
+               $user = $this->getUser();
+               if( !$user->isAllowed( 'deletedhistory' ) || $user->isBlocked() 
) {
                        $this->mConds[] = $db->bitAnd('log_deleted', 
LogPage::DELETED_ACTION) . ' = 0';
-               } elseif( !$wgUser->isAllowed( 'suppressrevision' ) || 
$wgUser->isBlocked() ) {
+               } elseif( !$user->isAllowed( 'suppressrevision' ) || 
$user->isBlocked() ) {
                        $this->mConds[] = $db->bitAnd('log_deleted', 
LogPage::SUPPRESSED_ACTION) .
                                ' != ' . LogPage::SUPPRESSED_ACTION;
                }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to