コード例 #1
0
 /**
  * Output a message that informs the user that they cannot create an account because
  * there is a block on them or their IP which prevents account creation.  Note that
  * User::isBlockedFromCreateAccount(), which gets this block, ignores the 'hardblock'
  * setting on blocks (bug 13611).
  * @param $block Block the block causing this error
  */
 function userBlockedMessage(Block $block)
 {
     global $wgOut;
     # Let's be nice about this, it's likely that this feature will be used
     # for blocking large numbers of innocent people, e.g. range blocks on
     # schools. Don't blame it on the user. There's a small chance that it
     # really is the user's fault, i.e. the username is blocked and they
     # haven't bothered to log out before trying to create an account to
     # evade it, but we'll leave that to their guilty conscience to figure
     # out.
     $wgOut->setPageTitle(wfMsg('cantcreateaccounttitle'));
     $block_reason = $block->mReason;
     if (strval($block_reason) === '') {
         $block_reason = wfMsg('blockednoreason');
     }
     $wgOut->addWikiMsg('cantcreateaccount-text', $block->getTarget(), $block_reason, $block->getBlocker()->getName());
     $wgOut->returnToMain(false);
 }
コード例 #2
0
ファイル: Exception.php プロジェクト: yusufchang/app
 public function __construct(Block $block)
 {
     global $wgLang, $wgRequest;
     $blocker = $block->getBlocker();
     if ($blocker instanceof User) {
         // local user
         $blockerUserpage = $block->getBlocker()->getUserPage();
         $link = "[[{$blockerUserpage->getPrefixedText()}|{$blockerUserpage->getText()}]]";
     } else {
         // foreign user
         $link = $blocker;
     }
     $reason = $block->mReason;
     if ($reason == '') {
         $reason = wfMsg('blockednoreason');
     }
     /* $ip returns who *is* being blocked, $intended contains who was meant to be blocked.
      * This could be a username, an IP range, or a single IP. */
     $intended = $block->getTarget();
     parent::__construct('blockedtitle', $block->mAuto ? 'autoblockedtext' : 'blockedtext', array($link, $reason, $wgRequest->getIP(), $block->getByName(), $block->getId(), $wgLang->formatExpiry($block->mExpiry), $intended, $wgLang->timeanddate(wfTimestamp(TS_MW, $block->mTimestamp), true)));
 }
コード例 #3
0
 /**
  * @static
  * @param Block $block instance of Block class includes/Block.php
  * @param User $user instance of User class includes/User.php
  * @return bool true 'cause it's a hook
  */
 public static function eventlogBlockIp($block, $user)
 {
     self::log("block", "block", $user->getID(), $user->getName(), $block->getBlocker(), $block->getTarget(), $block->mReason);
     return true;
 }