Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97554918
PhabricatorAuthContactNumberTestController.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, 05:45
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 05:45 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23339747
Attached To
rPH Phabricator
PhabricatorAuthContactNumberTestController.php
View Options
<?php
final
class
PhabricatorAuthContactNumberTestController
extends
PhabricatorAuthContactNumberController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
$number
=
id
(
new
PhabricatorAuthContactNumberQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$number
)
{
return
new
Aphront404Response
();
}
$id
=
$number
->
getID
();
$cancel_uri
=
$number
->
getURI
();
// NOTE: This is a global limit shared by all users.
PhabricatorSystemActionEngine
::
willTakeAction
(
array
(
id
(
new
PhabricatorAuthApplication
())->
getPHID
()),
new
PhabricatorAuthTestSMSAction
(),
1
);
if
(
$request
->
isFormPost
())
{
$uri
=
PhabricatorEnv
::
getURI
(
'/'
);
$uri
=
new
PhutilURI
(
$uri
);
$mail
=
id
(
new
PhabricatorMetaMTAMail
())
->
setMessageType
(
PhabricatorMailSMSMessage
::
MESSAGETYPE
)
->
addTos
(
array
(
$viewer
->
getPHID
()))
->
setSensitiveContent
(
false
)
->
setBody
(
pht
(
'This is a terse test text message from Phabricator (%s).'
,
$uri
->
getDomain
()))
->
save
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$mail
->
getURI
());
}
$number_display
=
phutil_tag
(
'strong'
,
array
(),
$number
->
getDisplayName
());
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Set Test Message'
))
->
appendParagraph
(
pht
(
'Send a test message to %s?'
,
$number_display
))
->
addSubmitButton
(
pht
(
'Send SMS'
))
->
addCancelButton
(
$cancel_uri
);
}
}
Event Timeline
Log In to Comment