Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/aphront/response/Aphront403Response.php
12241 views
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('Yikes!'))
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
}
44
45