Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97582998
PholioInlineThumbController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 5, 11:19
Size
1007 B
Mime Type
text/x-php
Expires
Tue, Jan 7, 11:19 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23430865
Attached To
rPH Phabricator
PholioInlineThumbController.php
View Options
<?php
/**
* @group pholio
*/
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
());
}
}
Event Timeline
Log In to Comment