/**
  * Get blocking information
  * @private
  * @param bool $bFromSlave Specify whether to check slave or master. To improve performance,
  *  non-critical checks are done against slaves. Check when actually saving should be done against
  *  master.
  */
 function getBlockedStatus($bFromSlave = true)
 {
     global $wgEnableSorbs, $wgProxyWhitelist;
     if (-1 != $this->mBlockedby) {
         wfDebug("User::getBlockedStatus: already loaded.\n");
         return;
     }
     wfProfileIn(__METHOD__);
     wfDebug(__METHOD__ . ": checking...\n");
     $this->mBlockedby = 0;
     $this->mHideName = 0;
     $ip = wfGetIP();
     if ($this->isAllowed('ipblock-exempt')) {
         # Exempt from all types of IP-block
         $ip = '';
     }
     # User/IP blocking
     $this->mBlock = new Block();
     $this->mBlock->fromMaster(!$bFromSlave);
     if ($this->mBlock->load($ip, $this->mId)) {
         wfDebug(__METHOD__ . ": Found block.\n");
         $this->mBlockedby = $this->mBlock->mBy;
         $this->mBlockreason = $this->mBlock->mReason;
         $this->mHideName = $this->mBlock->mHideName;
         if ($this->isLoggedIn()) {
             $this->spreadBlock();
         }
     } else {
         $this->mBlock = null;
         wfDebug(__METHOD__ . ": No block.\n");
     }
     # Proxy blocking
     if (!$this->isAllowed('proxyunbannable') && !in_array($ip, $wgProxyWhitelist)) {
         # Local list
         if (wfIsLocallyBlockedProxy($ip)) {
             $this->mBlockedby = wfMsg('proxyblocker');
             $this->mBlockreason = wfMsg('proxyblockreason');
         }
         # DNSBL
         if (!$this->mBlockedby && $wgEnableSorbs && !$this->getID()) {
             if ($this->inSorbsBlacklist($ip)) {
                 $this->mBlockedby = wfMsg('sorbs');
                 $this->mBlockreason = wfMsg('sorbsreason');
             }
         }
     }
     # Extensions
     wfRunHooks('GetBlockedStatus', array(&$this));
     wfProfileOut(__METHOD__);
 }
Beispiel #2
0
 /**
  * Get blocking information
  * @private
  * @param bool $bFromSlave Specify whether to check slave or master. To improve performance,
  *  non-critical checks are done against slaves. Check when actually saving should be done against
  *  master.
  */
 function getBlockedStatus($bFromSlave = true)
 {
     global $wgEnableSorbs, $wgProxyWhitelist;
     if (-1 != $this->mBlockedby) {
         wfDebug("User::getBlockedStatus: already loaded.\n");
         return;
     }
     $fname = 'User::getBlockedStatus';
     wfProfileIn($fname);
     wfDebug("{$fname}: checking...\n");
     $this->mBlockedby = 0;
     $ip = wfGetIP();
     # User/IP blocking
     $block = new Block();
     $block->fromMaster(!$bFromSlave);
     if ($block->load($ip, $this->mId)) {
         wfDebug("{$fname}: Found block.\n");
         $this->mBlockedby = $block->mBy;
         $this->mBlockreason = $block->mReason;
         if ($this->isLoggedIn()) {
             $this->spreadBlock();
         }
     } else {
         wfDebug("{$fname}: No block.\n");
     }
     # Proxy blocking
     # FIXME ? proxyunbannable is to deprecate the old isSysop()
     if (!$this->isAllowed('proxyunbannable') && !in_array($ip, $wgProxyWhitelist)) {
         # Local list
         if (wfIsLocallyBlockedProxy($ip)) {
             $this->mBlockedby = wfMsg('proxyblocker');
             $this->mBlockreason = wfMsg('proxyblockreason');
         }
         # DNSBL
         if (!$this->mBlockedby && $wgEnableSorbs && !$this->getID()) {
             if ($this->inSorbsBlacklist($ip)) {
                 $this->mBlockedby = wfMsg('sorbs');
                 $this->mBlockreason = wfMsg('sorbsreason');
             }
         }
     }
     # Extensions
     wfRunHooks('GetBlockedStatus', array(&$this));
     wfProfileOut($fname);
 }
Beispiel #3
0
 /**
  * Get blocking information
  * @private
  * @param $bFromSlave \bool Whether to check the slave database first. To
  *                    improve performance, non-critical checks are done
  *                    against slaves. Check when actually saving should be
  *                    done against master.
  */
 function getBlockedStatus($bFromSlave = true)
 {
     global $wgEnableSorbs, $wgProxyWhitelist;
     if (-1 != $this->mBlockedby) {
         wfDebug("User::getBlockedStatus: already loaded.\n");
         return;
     }
     wfProfileIn(__METHOD__);
     wfDebug(__METHOD__ . ": checking...\n");
     // Initialize data...
     // Otherwise something ends up stomping on $this->mBlockedby when
     // things get lazy-loaded later, causing false positive block hits
     // due to -1 !== 0. Probably session-related... Nothing should be
     // overwriting mBlockedby, surely?
     $this->load();
     $this->mBlockedby = 0;
     $this->mHideName = 0;
     $this->mAllowUsertalk = 0;
     $ip = wfGetIP();
     if ($this->isAllowed('ipblock-exempt')) {
         # Exempt from all types of IP-block
         $ip = '';
     }
     # User/IP blocking
     $this->mBlock = new Block();
     $this->mBlock->fromMaster(!$bFromSlave);
     if ($this->mBlock->load($ip, $this->mId)) {
         wfDebug(__METHOD__ . ": Found block.\n");
         $this->mBlockedby = $this->mBlock->mBy;
         $this->mBlockreason = $this->mBlock->mReason;
         $this->mHideName = $this->mBlock->mHideName;
         $this->mAllowUsertalk = $this->mBlock->mAllowUsertalk;
         if ($this->isLoggedIn()) {
             $this->spreadBlock();
         }
     } else {
         // Bug 13611: don't remove mBlock here, to allow account creation blocks to
         // apply to users. Note that the existence of $this->mBlock is not used to
         // check for edit blocks, $this->mBlockedby is instead.
     }
     # Proxy blocking
     if (!$this->isAllowed('proxyunbannable') && !in_array($ip, $wgProxyWhitelist)) {
         # Local list
         if (wfIsLocallyBlockedProxy($ip)) {
             $this->mBlockedby = wfMsg('proxyblocker');
             $this->mBlockreason = wfMsg('proxyblockreason');
         }
         # DNSBL
         if (!$this->mBlockedby && $wgEnableSorbs && !$this->getID()) {
             if ($this->inSorbsBlacklist($ip)) {
                 $this->mBlockedby = wfMsg('sorbs');
                 $this->mBlockreason = wfMsg('sorbsreason');
             }
         }
     }
     # Extensions
     wfRunHooks('GetBlockedStatus', array(&$this));
     wfProfileOut(__METHOD__);
 }