2012-01-15 10:07:56 +01:00
|
|
|
<?php
|
|
|
|
|
2012-11-29 08:57:13 +01:00
|
|
|
final class Aphront403Response extends AphrontHTMLResponse {
|
2012-01-15 10:07:56 +01:00
|
|
|
|
2012-02-22 19:21:39 +01:00
|
|
|
private $forbiddenText;
|
|
|
|
public function setForbiddenText($text) {
|
|
|
|
$this->forbiddenText = $text;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
private function getForbiddenText() {
|
|
|
|
return $this->forbiddenText;
|
|
|
|
}
|
|
|
|
|
2012-01-15 10:07:56 +01:00
|
|
|
public function getHTTPResponseCode() {
|
|
|
|
return 403;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildResponseString() {
|
2012-02-22 19:21:39 +01:00
|
|
|
$forbidden_text = $this->getForbiddenText();
|
|
|
|
if (!$forbidden_text) {
|
|
|
|
$forbidden_text =
|
2014-09-27 02:40:09 +02:00
|
|
|
pht('You do not have privileges to access the requested page.');
|
2012-02-22 19:21:39 +01:00
|
|
|
}
|
2014-09-27 02:40:09 +02:00
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
$dialog = id(new AphrontDialogView())
|
|
|
|
->setUser($user)
|
|
|
|
->setTitle(pht('403 Forbidden'))
|
|
|
|
->addCancelButton('/', pht('Peace Out'))
|
|
|
|
->appendParagraph($forbidden_text);
|
|
|
|
|
|
|
|
$view = id(new PhabricatorStandardPageView())
|
|
|
|
->setTitle(pht('403 Forbidden'))
|
|
|
|
->setRequest($request)
|
|
|
|
->setDeviceReady(true)
|
|
|
|
->appendChild($dialog);
|
2012-01-15 10:07:56 +01:00
|
|
|
|
|
|
|
return $view->render();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|