Provide a rudimentary "Attached Files" curtain UI panel
[phabricator.git] / src / applications / files / controller / PhabricatorFileDocumentController.php
blob645b0e8e92ed1899a3703ff077ab82a5adf7a737
1 <?php
3 final class PhabricatorFileDocumentController
4 extends PhabricatorFileController {
6 public function shouldAllowPublic() {
7 return true;
10 public function handleRequest(AphrontRequest $request) {
11 $engine = id(new PhabricatorFileDocumentRenderingEngine())
12 ->setRequest($request)
13 ->setController($this);
15 $viewer = $request->getViewer();
17 $file_phid = $request->getURIData('phid');
19 $file = id(new PhabricatorFileQuery())
20 ->setViewer($viewer)
21 ->withPHIDs(array($file_phid))
22 ->executeOne();
23 if (!$file) {
24 return $engine->newErrorResponse(
25 pht(
26 'This file ("%s") does not exist or could not be loaded.',
27 $file_phid));
30 $ref = id(new PhabricatorDocumentRef())
31 ->setFile($file);
33 return $engine->newRenderResponse($ref);