Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F113196215
PhamePostEditController.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
Fri, May 16, 01:24
Size
1 KB
Mime Type
text/x-php
Expires
Sun, May 18, 01:24 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
26176129
Attached To
rPH Phabricator
PhamePostEditController.php
View Options
<?php
final
class
PhamePostEditController
extends
PhamePostController
{
private
$blog
;
public
function
setBlog
(
PhameBlog
$blog
)
{
$this
->
blog
=
$blog
;
return
$this
;
}
public
function
getBlog
()
{
return
$this
->
blog
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
if
(
$id
)
{
$post
=
id
(
new
PhamePostQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$post
)
{
return
new
Aphront404Response
();
}
$blog_id
=
$post
->
getBlog
()->
getID
();
}
else
{
$blog_id
=
head
(
$request
->
getArr
(
'blog'
));
if
(!
$blog_id
)
{
$blog_id
=
$request
->
getStr
(
'blog'
);
}
}
$query
=
id
(
new
PhameBlogQuery
())
->
setViewer
(
$viewer
)
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
));
if
(
ctype_digit
(
$blog_id
))
{
$query
->
withIDs
(
array
(
$blog_id
));
}
else
{
$query
->
withPHIDs
(
array
(
$blog_id
));
}
$blog
=
$query
->
executeOne
();
if
(!
$blog
)
{
return
new
Aphront404Response
();
}
$this
->
setBlog
(
$blog
);
return
id
(
new
PhamePostEditEngine
())
->
setController
(
$this
)
->
setBlog
(
$blog
)
->
buildResponse
();
}
protected
function
buildApplicationCrumbs
()
{
$crumbs
=
parent
::
buildApplicationCrumbs
();
$blog
=
$this
->
getBlog
();
if
(
$blog
)
{
$crumbs
->
addTextCrumb
(
$blog
->
getName
(),
$blog
->
getViewURI
());
}
return
$crumbs
;
}
}
Event Timeline
Log In to Comment