Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F949795
PhamePostNotLiveController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhamePostNotLiveController.php
View Options
<?php
final
class
PhamePostNotLiveController
extends
PhamePostController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$post
=
id
(
new
PhamePostQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
executeOne
();
if
(!
$post
)
{
return
new
Aphront404Response
();
}
$reasons
=
array
();
if
(!
$post
->
getBlog
())
{
$reasons
[]
=
phutil_tag
(
'p'
,
array
(),
pht
(
'You can not view the live version of this post because it '
.
'is not associated with a blog. Move the post to a blog in order to '
.
'view it live.'
));
}
if
(
$post
->
isDraft
())
{
$reasons
[]
=
phutil_tag
(
'p'
,
array
(),
pht
(
'You can not view the live version of this post because it '
.
'is still a draft. Use "Preview/Publish" to publish the post.'
));
}
if
(
$reasons
)
{
$cancel_uri
=
$this
->
getApplicationURI
(
'/post/view/'
.
$post
->
getID
().
'/'
);
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$viewer
)
->
setTitle
(
pht
(
'Post Not Live'
))
->
addCancelButton
(
$cancel_uri
);
foreach
(
$reasons
as
$reason
)
{
$dialog
->
appendChild
(
$reason
);
}
return
id
(
new
AphrontDialogResponse
())->
setDialog
(
$dialog
);
}
// No reason this can't go live, maybe an old link. Kick them live and see
// what happens.
$live_uri
=
$post
->
getViewURI
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$live_uri
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jun 17, 1:46 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
224880
Default Alt Text
PhamePostNotLiveController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment