@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at upstream/main 43 lines 1.0 kB view raw
1<?php 2 3final 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}