[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/aphront/response/ -> Aphront403Response.php (source)

   1  <?php
   2  
   3  final class Aphront403Response extends AphrontHTMLResponse {
   4  
   5    private $forbiddenText;
   6    public function setForbiddenText($text) {
   7      $this->forbiddenText = $text;
   8      return $this;
   9    }
  10    private function getForbiddenText() {
  11      return $this->forbiddenText;
  12    }
  13  
  14    public function getHTTPResponseCode() {
  15      return 403;
  16    }
  17  
  18    public function buildResponseString() {
  19      $forbidden_text = $this->getForbiddenText();
  20      if (!$forbidden_text) {
  21        $forbidden_text =
  22          pht('You do not have privileges to access the requested page.');
  23      }
  24  
  25      $request = $this->getRequest();
  26      $user = $request->getUser();
  27  
  28      $dialog = id(new AphrontDialogView())
  29        ->setUser($user)
  30        ->setTitle(pht('403 Forbidden'))
  31        ->addCancelButton('/', pht('Peace Out'))
  32        ->appendParagraph($forbidden_text);
  33  
  34      $view = id(new PhabricatorStandardPageView())
  35        ->setTitle(pht('403 Forbidden'))
  36        ->setRequest($request)
  37        ->setDeviceReady(true)
  38        ->appendChild($dialog);
  39  
  40      return $view->render();
  41    }
  42  
  43  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1