コード例 #1
0
 public function testReport()
 {
     $mockMessage = $this->getMockMessage();
     $title = 'Foo';
     $params = array('Baz');
     global $wgOut;
     $wgOut = $this->getMockBuilder('OutputPage')->disableOriginalConstructor()->getMock();
     $wgOut->expects($this->once())->method('showErrorPage')->with($title, $mockMessage, $params);
     $wgOut->expects($this->once())->method('output');
     $e = new ErrorPageError($title, $mockMessage, $params);
     $e->report();
 }
コード例 #2
0
 /**
  * Just like ErrorPageError::report() but additionally set
  * a 400 HTTP status code (bug 33646).
  */
 public function report()
 {
     global $wgOut;
     // bug 33646: a badtitle error page need to return an error code
     // to let mobile browser now that it is not a normal page.
     $wgOut->setStatusCode(400);
     parent::report();
 }
コード例 #3
0
ファイル: UserNotLoggedIn.php プロジェクト: paladox/mediawiki
 /**
  * Redirect to Special:Userlogin if the specified message is compatible. Otherwise,
  * show an error page as usual.
  */
 public function report()
 {
     // If an unsupported message is used, don't try redirecting to Special:Userlogin,
     // since the message may not be compatible.
     if (!in_array($this->msg, LoginHelper::getValidErrorMessages())) {
         parent::report();
     }
     // Message is valid. Redirec to Special:Userlogin
     $context = RequestContext::getMain();
     $output = $context->getOutput();
     $query = $context->getRequest()->getValues();
     // Title will be overridden by returnto
     unset($query['title']);
     // Redirect to Special:Userlogin
     $output->redirect(SpecialPage::getTitleFor('Userlogin')->getFullURL(['returnto' => $context->getTitle()->getFullText(), 'returntoquery' => wfArrayToCgi($query), 'warning' => $this->msg]));
     $output->output();
 }
コード例 #4
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)));
 }
コード例 #5
0
 public function __construct(Block $block)
 {
     // @todo FIXME: Implement a more proper way to get context here.
     $params = $block->getPermissionsError(RequestContext::getMain());
     parent::__construct('blockedtitle', array_shift($params), $params);
 }
コード例 #6
0
 public function __construct()
 {
     parent::__construct('readonly', 'readonlytext', wfReadOnlyReason() ?: []);
 }
コード例 #7
0
 public function report()
 {
     global $wgOut;
     $wgOut->setStatusCode(429);
     parent::report();
 }
コード例 #8
0
 public function __construct()
 {
     parent::__construct('centralauth-readonly', 'centralauth-readonlytext');
 }
コード例 #9
0
ファイル: Exception.php プロジェクト: biribogos/wikihow-src
 /**
  * @param string $reasonMsg A message key containing the reason for the error.
  *        Optional, default: 'exception-nologin-text'
  * @param string $titleMsg A message key to set the page title.
  *        Optional, default: 'exception-nologin'
  * @param array $params Parameters to wfMessage().
  *        Optional, default: array()
  */
 public function __construct($reasonMsg = 'exception-nologin-text', $titleMsg = 'exception-nologin', $params = array())
 {
     parent::__construct($titleMsg, $reasonMsg, $params);
 }
コード例 #10
0
 public function __construct($message)
 {
     parent::__construct('moderation', $message);
 }