mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 18:52:42 +01:00
8756d82cf6
Summary: I'm pretty sure that `@group` annotations are useless now... see D9855. Also fixed various other minor issues. Test Plan: Eye-ball it. Reviewers: #blessed_reviewers, epriestley, chad Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin, hach-que Differential Revision: https://secure.phabricator.com/D9859
46 lines
982 B
PHP
46 lines
982 B
PHP
<?php
|
|
|
|
final class PholioInlineThumbController extends PholioController {
|
|
|
|
private $imageid;
|
|
|
|
public function shouldAllowPublic() {
|
|
return true;
|
|
}
|
|
|
|
public function willProcessRequest(array $data) {
|
|
$this->imageid = idx($data, 'imageid');
|
|
}
|
|
|
|
public function processRequest() {
|
|
$request = $this->getRequest();
|
|
$user = $request->getUser();
|
|
|
|
$image = id(new PholioImage())->load($this->imageid);
|
|
|
|
if ($image == null) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
$mock = id(new PholioMockQuery())
|
|
->setViewer($user)
|
|
->withIDs(array($image->getMockID()))
|
|
->executeOne();
|
|
|
|
if (!$mock) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
$file = id(new PhabricatorFileQuery())
|
|
->setViewer($user)
|
|
->witHPHIDs(array($image->getFilePHID()))
|
|
->executeOne();
|
|
|
|
if (!$file) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
return id(new AphrontRedirectResponse())->setURI($file->getThumb60x45URI());
|
|
}
|
|
|
|
}
|