Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92692320
PhabricatorHelpEditorProtocolController.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, Nov 22, 20:07
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 20:07 (2 d)
Engine
blob
Format
Raw Data
Handle
22487976
Attached To
rPH Phabricator
PhabricatorHelpEditorProtocolController.php
View Options
<?php
final
class
PhabricatorHelpEditorProtocolController
extends
PhabricatorHelpController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$dialog
=
id
(
new
AphrontDialogView
())
->
setUser
(
$viewer
)
->
setMethod
(
'GET'
)
->
setSubmitURI
(
'/settings/panel/display/'
)
->
setTitle
(
pht
(
'Unsupported Editor Protocol'
))
->
appendParagraph
(
pht
(
'Your configured editor URI uses an unsupported protocol. Change '
.
'your settings to use a supported protocol, or ask your '
.
'administrator to add support for the chosen protocol by '
.
'configuring: %s'
,
phutil_tag
(
'tt'
,
array
(),
'uri.allowed-editor-protocols'
)))
->
addSubmitButton
(
pht
(
'Change Settings'
))
->
addCancelButton
(
'/'
);
return
id
(
new
AphrontDialogResponse
())
->
setDialog
(
$dialog
);
}
public
static
function
hasAllowedProtocol
(
$uri
)
{
$uri
=
new
PhutilURI
(
$uri
);
$editor_protocol
=
$uri
->
getProtocol
();
if
(!
$editor_protocol
)
{
// The URI must have a protocol.
return
false
;
}
$allowed_key
=
'uri.allowed-editor-protocols'
;
$allowed_protocols
=
PhabricatorEnv
::
getEnvConfig
(
$allowed_key
);
if
(
empty
(
$allowed_protocols
[
$editor_protocol
]))
{
// The protocol must be on the allowed protocol whitelist.
return
false
;
}
return
true
;
}
}
Event Timeline
Log In to Comment