当前位置: 首页>>代码示例>>PHP>>正文


PHP IContextSource::getUser方法代码示例

本文整理汇总了PHP中IContextSource::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP IContextSource::getUser方法的具体用法?PHP IContextSource::getUser怎么用?PHP IContextSource::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IContextSource的用法示例。


在下文中一共展示了IContextSource::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getReviewStatus

 protected function getReviewStatus(TMessage $message)
 {
     if (!$this->reviewMode) {
         return '';
     }
     $reviewers = (array) $message->getProperty('reviewers');
     $count = count($reviewers);
     if ($count === 0) {
         return '';
     }
     $userId = $this->context->getUser()->getId();
     $you = in_array($userId, $reviewers);
     $key = $you ? "y{$count}" : "n{$count}";
     // ->text() (and ->parse()) invokes the parser. Each call takes
     // about 70 KiB, so it makes sense to cache these messages which
     // have high repetition.
     if (isset($this->reviewStatusCache[$key])) {
         return $this->reviewStatusCache[$key];
     } elseif ($you) {
         $msg = wfMessage('translate-messagereview-reviewswithyou')->numParams($count)->text();
     } else {
         $msg = wfMessage('translate-messagereview-reviews')->numParams($count)->text();
     }
     $wrap = Html::rawElement('div', array('class' => 'mw-translate-messagereviewstatus'), $msg);
     $this->reviewStatusCache[$key] = $wrap;
     return $wrap;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:27,代码来源:MessageTable.php

示例2: addNavigationLinks

 /**
  * @param $context IContextSource
  * @param $pageType
  */
 public static function addNavigationLinks(IContextSource $context, $pageType)
 {
     $linkDefs = array('home' => 'Special:AbuseFilter', 'recentchanges' => 'Special:AbuseFilter/history', 'examine' => 'Special:AbuseFilter/examine', 'log' => 'Special:AbuseLog');
     if ($context->getUser()->isAllowed('abusefilter-modify')) {
         $linkDefs = array_merge($linkDefs, array('test' => 'Special:AbuseFilter/test', 'tools' => 'Special:AbuseFilter/tools', 'import' => 'Special:AbuseFilter/import'));
     }
     // Save some translator work
     $msgOverrides = array('recentchanges' => 'abusefilter-filter-log');
     $links = array();
     foreach ($linkDefs as $name => $page) {
         // Give grep a chance to find the usages:
         // abusefilter-topnav-home, abusefilter-topnav-test, abusefilter-topnav-examine
         // abusefilter-topnav-log, abusefilter-topnav-tools, abusefilter-topnav-import
         $msgName = "abusefilter-topnav-{$name}";
         if (isset($msgOverrides[$name])) {
             $msgName = $msgOverrides[$name];
         }
         $msg = wfMessage($msgName)->parse();
         $title = Title::newFromText($page);
         if ($name == $pageType) {
             $links[] = Xml::tags('strong', null, $msg);
         } else {
             $links[] = Linker::link($title, $msg);
         }
     }
     $linkStr = wfMessage('parentheses', $context->getLanguage()->pipeList($links))->text();
     $linkStr = wfMessage('abusefilter-topnav')->parse() . " {$linkStr}";
     $linkStr = Xml::tags('div', array('class' => 'mw-abusefilter-navigation'), $linkStr);
     $context->getOutput()->setSubtitle($linkStr);
 }
开发者ID:aahashderuffy,项目名称:extensions,代码行数:34,代码来源:AbuseFilter.class.php

示例3: __construct

 /**
  * Generates a brief review form for a page
  * @param \IContextSource|\RequestContext $context
  * @param FlaggableWikiPage $article
  * @param Revision $rev
  */
 public function __construct(IContextSource $context, FlaggableWikiPage $article, Revision $rev)
 {
     $this->user = $context->getUser();
     $this->request = $context->getRequest();
     $this->article = $article;
     $this->rev = $rev;
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:13,代码来源:RevisionReviewFormUI.php

示例4: buildEditLink

 /**
  * Return a link to the edit page, with the text
  * saying "view source" if the user can't edit the page
  *
  * @param Title $titleObj
  * @return string
  */
 private function buildEditLink(Title $titleObj)
 {
     if ($titleObj->quickUserCan('edit', $this->context->getUser())) {
         $linkMsg = 'editlink';
     } else {
         $linkMsg = 'viewsourcelink';
     }
     return $this->linkRenderer->makeLink($titleObj, $this->context->msg($linkMsg)->text(), [], ['action' => 'edit']);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:16,代码来源:TemplatesOnThisPageFormatter.php

示例5: useExternalEngine

 /**
  * Check whether external edit or diff should be used.
  *
  * @param $context IContextSource context to use
  * @param $type String can be either 'edit' or 'diff'
  * @return Bool
  */
 public static function useExternalEngine(IContextSource $context, $type)
 {
     global $wgUseExternalEditor;
     if (!$wgUseExternalEditor) {
         return false;
     }
     $pref = $type == 'diff' ? 'externaldiff' : 'externaleditor';
     $request = $context->getRequest();
     return !$request->getVal('internaledit') && ($context->getUser()->getOption($pref) || $request->getVal('externaledit'));
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:17,代码来源:ExternalEdit.php

示例6: newFromContext

	/**
	 * Fetch an appropriate changes list class for the specified context
	 * Some users might want to use an enhanced list format, for instance
	 *
	 * @param $context IContextSource to use
	 * @return ChangesList|EnhancedChangesList|OldChangesList derivative
	 */
	public static function newFromContext( IContextSource $context ) {
		$user = $context->getUser();
		$sk = $context->getSkin();
		$list = null;
		if ( wfRunHooks( 'FetchChangesList', array( $user, &$sk, &$list ) ) ) {
			$new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
			return $new ? new EnhancedChangesList( $context ) : new OldChangesList( $context );
		} else {
			return $list;
		}
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:18,代码来源:ChangesList.php

示例7: main

 private function main()
 {
     global $wgUseFileCache, $wgTitle, $wgUseAjax;
     wfProfileIn(__METHOD__);
     $request = $this->context->getRequest();
     // Send Ajax requests to the Ajax dispatcher.
     if ($wgUseAjax && $request->getVal('action', 'view') == 'ajax') {
         // Set a dummy title, because $wgTitle == null might break things
         $title = Title::makeTitle(NS_MAIN, 'AJAX');
         $this->context->setTitle($title);
         $wgTitle = $title;
         $dispatcher = new AjaxDispatcher();
         $dispatcher->performAction();
         wfProfileOut(__METHOD__);
         return;
     }
     // Get title from request parameters,
     // is set on the fly by parseTitle the first time.
     $title = $this->getTitle();
     $action = $this->getAction();
     $wgTitle = $title;
     if ($wgUseFileCache && $title->getNamespace() >= 0) {
         wfProfileIn('main-try-filecache');
         if (HTMLFileCache::useFileCache($this->context)) {
             // Try low-level file cache hit
             $cache = HTMLFileCache::newFromTitle($title, $action);
             if ($cache->isCacheGood()) {
                 // Check incoming headers to see if client has this cached
                 $timestamp = $cache->cacheTimestamp();
                 if (!$this->context->getOutput()->checkLastModified($timestamp)) {
                     $cache->loadFromFileCache($this->context);
                 }
                 // Do any stats increment/watchlist stuff
                 $this->context->getWikiPage()->doViewUpdates($this->context->getUser());
                 // Tell OutputPage that output is taken care of
                 $this->context->getOutput()->disable();
                 wfProfileOut('main-try-filecache');
                 wfProfileOut(__METHOD__);
                 return;
             }
         }
         wfProfileOut('main-try-filecache');
     }
     $this->performRequest();
     // Now commit any transactions, so that unreported errors after
     // output() don't roll back the whole DB transaction
     wfGetLBFactory()->commitMasterChanges();
     // Output everything!
     $this->context->getOutput()->output();
     wfProfileOut(__METHOD__);
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:51,代码来源:Wiki.php

示例8: main

 private function main()
 {
     global $wgUseFileCache, $wgTitle, $wgUseAjax;
     wfProfileIn(__METHOD__);
     $request = $this->context->getRequest();
     // Send Ajax requests to the Ajax dispatcher.
     if ($wgUseAjax && $request->getVal('action', 'view') == 'ajax') {
         // Set a dummy title, because $wgTitle == null might break things
         // Wikia change - start
         // @author macbre, wladek
         $title = Wikia::createTitleFromRequest($request);
         // Wikia change - end
         $this->context->setTitle($title);
         $wgTitle = $title;
         $dispatcher = new AjaxDispatcher();
         $dispatcher->performAction();
         wfProfileOut(__METHOD__);
         return;
     }
     // Get title from request parameters,
     // is set on the fly by parseTitle the first time.
     $title = $this->getTitle();
     $action = $this->getAction();
     $wgTitle = $title;
     if ($wgUseFileCache && $title->getNamespace() >= 0) {
         wfProfileIn('main-try-filecache');
         if (HTMLFileCache::useFileCache($this->context)) {
             // Try low-level file cache hit
             $cache = HTMLFileCache::newFromTitle($title, $action);
             if ($cache->isCacheGood()) {
                 // Check incoming headers to see if client has this cached
                 $timestamp = $cache->cacheTimestamp();
                 if (!$this->context->getOutput()->checkLastModified($timestamp)) {
                     $cache->loadFromFileCache($this->context);
                 }
                 // Do any stats increment/watchlist stuff
                 $this->context->getWikiPage()->doViewUpdates($this->context->getUser());
                 // Tell OutputPage that output is taken care of
                 $this->context->getOutput()->disable();
                 wfProfileOut('main-try-filecache');
                 wfProfileOut(__METHOD__);
                 return;
             }
         }
         wfProfileOut('main-try-filecache');
     }
     $this->performRequest();
     $this->finalCleanup();
     wfProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:50,代码来源:Wiki.php

示例9: buildSelector

 /**
  * Build protection level selector
  *
  * @param string $action Action to protect
  * @param string $selected Current protection level
  * @return string HTML fragment
  */
 function buildSelector($action, $selected)
 {
     // If the form is disabled, display all relevant levels. Otherwise,
     // just show the ones this user can use.
     $levels = MWNamespace::getRestrictionLevels($this->mTitle->getNamespace(), $this->disabled ? null : $this->mContext->getUser());
     $id = 'mwProtect-level-' . $action;
     $attribs = array('id' => $id, 'name' => $id, 'size' => count($levels)) + $this->disabledAttrib;
     $out = Xml::openElement('select', $attribs);
     foreach ($levels as $key) {
         $out .= Xml::option($this->getOptionLabel($key), $key, $key == $selected);
     }
     $out .= Xml::closeElement('select');
     return $out;
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:21,代码来源:ProtectionForm.php

示例10: buildSelector

 /**
  * Build protection level selector
  *
  * @param string $action Action to protect
  * @param string $selected Current protection level
  * @return string HTML fragment
  */
 function buildSelector($action, $selected)
 {
     // If the form is disabled, display all relevant levels. Otherwise,
     // just show the ones this user can use.
     $levels = MWNamespace::getRestrictionLevels($this->mTitle->getNamespace(), $this->disabled ? null : $this->mContext->getUser());
     $id = 'mwProtect-level-' . $action;
     $select = new XmlSelect($id, $id, $selected);
     $select->setAttribute('size', count($levels));
     if ($this->disabled) {
         $select->setAttribute('disabled', 'disabled');
     }
     foreach ($levels as $key) {
         $select->addOption($this->getOptionLabel($key), $key);
     }
     return $select->getHTML();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:23,代码来源:ProtectionForm.php

示例11: main

 private function main()
 {
     global $wgUseFileCache, $wgTitle, $wgUseAjax;
     wfProfileIn(__METHOD__);
     # Set title from request parameters
     $wgTitle = $this->getTitle();
     $action = $this->getAction();
     $user = $this->context->getUser();
     # Send Ajax requests to the Ajax dispatcher.
     if ($wgUseAjax && $action == 'ajax') {
         $dispatcher = new AjaxDispatcher();
         $dispatcher->performAction();
         wfProfileOut(__METHOD__);
         return;
     }
     if ($wgUseFileCache && $wgTitle->getNamespace() != NS_SPECIAL) {
         wfProfileIn('main-try-filecache');
         // Raw pages should handle cache control on their own,
         // even when using file cache. This reduces hits from clients.
         if (HTMLFileCache::useFileCache()) {
             /* Try low-level file cache hit */
             $cache = new HTMLFileCache($wgTitle, $action);
             if ($cache->isFileCacheGood()) {
                 /* Check incoming headers to see if client has this cached */
                 $timestamp = $cache->fileCacheTime();
                 if (!$this->context->getOutput()->checkLastModified($timestamp)) {
                     $cache->loadFromFileCache();
                 }
                 # Do any stats increment/watchlist stuff
                 $article = WikiPage::factory($wgTitle);
                 $article->doViewUpdates($user);
                 # Tell OutputPage that output is taken care of
                 $this->context->getOutput()->disable();
                 wfProfileOut('main-try-filecache');
                 wfProfileOut(__METHOD__);
                 return;
             }
         }
         wfProfileOut('main-try-filecache');
     }
     $this->performRequest();
     $this->finalCleanup();
     wfProfileOut(__METHOD__);
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:44,代码来源:Wiki.php

示例12: onGetEmailAuthentication

 public static function onGetEmailAuthentication(User &$user, IContextSource $context, &$disableEmailPrefs, &$emailauthenticated)
 {
     if ($user->getEmail()) {
         $emailTimestamp = $user->getEmailAuthenticationTimestamp();
         $optionNewEmail = $user->getGlobalAttribute('new_email');
         $msgKeyPrefixEmail = empty($optionNewEmail) && !$emailTimestamp ? 'usersignup-user-pref-unconfirmed-' : 'usersignup-user-pref-';
         if (empty($optionNewEmail) && $emailTimestamp) {
             $lang = $context->getLanguage();
             $displayUser = $context->getUser();
             $time = $lang->userTimeAndDate($emailTimestamp, $displayUser);
             $d = $lang->userDate($emailTimestamp, $displayUser);
             $t = $lang->userTime($emailTimestamp, $displayUser);
             $emailauthenticated = $context->msg($msgKeyPrefixEmail . 'emailauthenticated', $time, $d, $t)->parse() . '<br />';
             $disableEmailPrefs = false;
         } else {
             $disableEmailPrefs = true;
             $emailauthenticated = $context->msg($msgKeyPrefixEmail . 'emailnotauthenticated', array($optionNewEmail))->parse() . '<br />' . Linker::linkKnown(SpecialPage::getTitleFor('Confirmemail'), $context->msg('usersignup-user-pref-emailconfirmlink')->escaped()) . '<br />';
         }
     } else {
         $disableEmailPrefs = true;
         $emailauthenticated = $context->msg('usersignup-user-pref-noemailprefs')->escaped();
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:24,代码来源:UserLoginHooksHelper.class.php

示例13: submit

 /**
  * Really send a mail. Permissions should have been checked using
  * getPermissionsError(). It is probably also a good
  * idea to check the edit token and ping limiter in advance.
  *
  * @param array $data
  * @param IContextSource $context
  * @return Status|string|bool Status object, or potentially a String on error
  * or maybe even true on success if anything uses the EmailUser hook.
  */
 public static function submit(array $data, IContextSource $context)
 {
     $config = $context->getConfig();
     $target = self::getTarget($data['Target']);
     if (!$target instanceof User) {
         // Messages used here: notargettext, noemailtext, nowikiemailtext
         return $context->msg($target . 'text')->parseAsBlock();
     }
     $to = MailAddress::newFromUser($target);
     $from = MailAddress::newFromUser($context->getUser());
     $subject = $data['Subject'];
     $text = $data['Text'];
     // Add a standard footer and trim up trailing newlines
     $text = rtrim($text) . "\n\n-- \n";
     $text .= $context->msg('emailuserfooter', $from->name, $to->name)->inContentLanguage()->text();
     $error = '';
     if (!Hooks::run('EmailUser', array(&$to, &$from, &$subject, &$text, &$error))) {
         return $error;
     }
     if ($config->get('UserEmailUseReplyTo')) {
         /**
          * Put the generic wiki autogenerated address in the From:
          * header and reserve the user for Reply-To.
          *
          * This is a bit ugly, but will serve to differentiate
          * wiki-borne mails from direct mails and protects against
          * SPF and bounce problems with some mailers (see below).
          */
         $mailFrom = new MailAddress($config->get('PasswordSender'), wfMessage('emailsender')->inContentLanguage()->text());
         $replyTo = $from;
     } else {
         /**
          * Put the sending user's e-mail address in the From: header.
          *
          * This is clean-looking and convenient, but has issues.
          * One is that it doesn't as clearly differentiate the wiki mail
          * from "directly" sent mails.
          *
          * Another is that some mailers (like sSMTP) will use the From
          * address as the envelope sender as well. For open sites this
          * can cause mails to be flunked for SPF violations (since the
          * wiki server isn't an authorized sender for various users'
          * domains) as well as creating a privacy issue as bounces
          * containing the recipient's e-mail address may get sent to
          * the sending user.
          */
         $mailFrom = $from;
         $replyTo = null;
     }
     $status = UserMailer::send($to, $mailFrom, $subject, $text, array('replyTo' => $replyTo));
     if (!$status->isGood()) {
         return $status;
     } else {
         // if the user requested a copy of this mail, do this now,
         // unless they are emailing themselves, in which case one
         // copy of the message is sufficient.
         if ($data['CCMe'] && $to != $from) {
             $cc_subject = $context->msg('emailccsubject')->rawParams($target->getName(), $subject)->text();
             // target and sender are equal, because this is the CC for the sender
             Hooks::run('EmailUserCC', array(&$from, &$from, &$cc_subject, &$text));
             $ccStatus = UserMailer::send($from, $from, $cc_subject, $text);
             $status->merge($ccStatus);
         }
         Hooks::run('EmailUserComplete', array($to, $from, $subject, $text));
         return $status;
     }
 }
开发者ID:paladox,项目名称:2,代码行数:77,代码来源:SpecialEmailuser.php

示例14: processUnblock

 /**
  * Process the form
  *
  * @param $data Array
  * @param $context IContextSource
  * @throws ErrorPageError
  * @return Array( Array(message key, parameters) ) on failure, True on success
  */
 public static function processUnblock(array $data, IContextSource $context)
 {
     $performer = $context->getUser();
     $target = $data['Target'];
     $block = Block::newFromTarget($data['Target']);
     if (!$block instanceof Block) {
         return array(array('ipb_cant_unblock', $target));
     }
     # bug 15810: blocked admins should have limited access here.  This
     # won't allow sysops to remove autoblocks on themselves, but they
     # should have ipblock-exempt anyway
     $status = SpecialBlock::checkUnblockSelf($target, $performer);
     if ($status !== true) {
         throw new ErrorPageError('badaccess', $status);
     }
     # If the specified IP is a single address, and the block is a range block, don't
     # unblock the whole range.
     list($target, $type) = SpecialBlock::getTargetAndType($target);
     if ($block->getType() == Block::TYPE_RANGE && $type == Block::TYPE_IP) {
         $range = $block->getTarget();
         return array(array('ipb_blocked_as_range', $target, $range));
     }
     # If the name was hidden and the blocking user cannot hide
     # names, then don't allow any block removals...
     if (!$performer->isAllowed('hideuser') && $block->mHideName) {
         return array('unblock-hideuser');
     }
     # Delete block
     if (!$block->delete()) {
         return array('ipb_cant_unblock', htmlspecialchars($block->getTarget()));
     }
     # Unset _deleted fields as needed
     if ($block->mHideName) {
         # Something is deeply FUBAR if this is not a User object, but who knows?
         $id = $block->getTarget() instanceof User ? $block->getTarget()->getID() : User::idFromName($block->getTarget());
         RevisionDeleteUser::unsuppressUserName($block->getTarget(), $id);
     }
     # Redact the name (IP address) for autoblocks
     if ($block->getType() == Block::TYPE_AUTO) {
         $page = Title::makeTitle(NS_USER, '#' . $block->getId());
     } else {
         $page = $block->getTarget() instanceof User ? $block->getTarget()->getUserpage() : Title::makeTitle(NS_USER, $block->getTarget());
     }
     # Make log entry
     $log = new LogPage('block');
     $log->addEntry('unblock', $page, $data['Reason'], array(), $performer);
     return true;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:56,代码来源:SpecialUnblock.php

示例15: processForm

 /**
  * Given the form data, actually implement a block
  * @param  $data Array
  * @param  $context IContextSource
  * @return Bool|String
  */
 public static function processForm(array $data, IContextSource $context)
 {
     global $wgBlockAllowsUTEdit;
     $performer = $context->getUser();
     // Handled by field validator callback
     // self::validateTargetField( $data['Target'] );
     # This might have been a hidden field or a checkbox, so interesting data
     # can come from it
     $data['Confirm'] = !in_array($data['Confirm'], array('', '0', null, false), true);
     list($target, $type) = self::getTargetAndType($data['Target']);
     if ($type == Block::TYPE_USER) {
         $user = $target;
         $target = $user->getName();
         $userId = $user->getId();
         # Give admins a heads-up before they go and block themselves.  Much messier
         # to do this for IPs, but it's pretty unlikely they'd ever get the 'block'
         # permission anyway, although the code does allow for it.
         # Note: Important to use $target instead of $data['Target']
         # since both $data['PreviousTarget'] and $target are normalized
         # but $data['target'] gets overriden by (non-normalized) request variable
         # from previous request.
         if ($target === $performer->getName() && ($data['PreviousTarget'] !== $target || !$data['Confirm'])) {
             return array('ipb-blockingself');
         }
     } elseif ($type == Block::TYPE_RANGE) {
         $userId = 0;
     } elseif ($type == Block::TYPE_IP) {
         $target = $target->getName();
         $userId = 0;
     } else {
         # This should have been caught in the form field validation
         return array('badipaddress');
     }
     if (strlen($data['Expiry']) == 0 || strlen($data['Expiry']) > 50 || !self::parseExpiryInput($data['Expiry'])) {
         return array('ipb_expiry_invalid');
     }
     if (!isset($data['DisableEmail'])) {
         $data['DisableEmail'] = false;
     }
     # If the user has done the form 'properly', they won't even have been given the
     # option to suppress-block unless they have the 'hideuser' permission
     if (!isset($data['HideUser'])) {
         $data['HideUser'] = false;
     }
     if ($data['HideUser']) {
         if (!$performer->isAllowed('hideuser')) {
             # this codepath is unreachable except by a malicious user spoofing forms,
             # or by race conditions (user has oversight and sysop, loads block form,
             # and is de-oversighted before submission); so need to fail completely
             # rather than just silently disable hiding
             return array('badaccess-group0');
         }
         # Recheck params here...
         if ($type != Block::TYPE_USER) {
             $data['HideUser'] = false;
             # IP users should not be hidden
         } elseif (!in_array($data['Expiry'], array('infinite', 'infinity', 'indefinite'))) {
             # Bad expiry.
             return array('ipb_expiry_temp');
         } elseif ($user->getEditCount() > self::HIDEUSER_CONTRIBLIMIT) {
             # Typically, the user should have a handful of edits.
             # Disallow hiding users with many edits for performance.
             return array('ipb_hide_invalid');
         } elseif (!$data['Confirm']) {
             return array('ipb-confirmhideuser');
         }
     }
     # Create block object.
     $block = new Block();
     $block->setTarget($target);
     $block->setBlocker($performer);
     $block->mReason = $data['Reason'][0];
     $block->mExpiry = self::parseExpiryInput($data['Expiry']);
     $block->prevents('createaccount', $data['CreateAccount']);
     $block->prevents('editownusertalk', !$wgBlockAllowsUTEdit || $data['DisableUTEdit']);
     $block->prevents('sendemail', $data['DisableEmail']);
     $block->isHardblock($data['HardBlock']);
     $block->isAutoblocking($data['AutoBlock']);
     $block->mHideName = $data['HideUser'];
     if (!wfRunHooks('BlockIp', array(&$block, &$performer))) {
         return array('hookaborted');
     }
     # Try to insert block. Is there a conflicting block?
     $status = $block->insert();
     if (!$status) {
         # Show form unless the user is already aware of this...
         if (!$data['Confirm'] || array_key_exists('PreviousTarget', $data) && $data['PreviousTarget'] !== $target) {
             return array(array('ipb_already_blocked', $block->getTarget()));
             # Otherwise, try to update the block...
         } else {
             # This returns direct blocks before autoblocks/rangeblocks, since we should
             # be sure the user is blocked by now it should work for our purposes
             $currentBlock = Block::newFromTarget($target);
             if ($block->equals($currentBlock)) {
//.........这里部分代码省略.........
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:SpecialBlock.php


注:本文中的IContextSource::getUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。