Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F29856932
DarkConsoleDataController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
DarkConsoleDataController.php
View Options
<?php
/**
* @group console
*/
final
class
DarkConsoleDataController
extends
PhabricatorController
{
private
$key
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
key
=
$data
[
'key'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$cache
=
new
PhabricatorKeyValueDatabaseCache
();
$cache
=
new
PhutilKeyValueCacheProfiler
(
$cache
);
$cache
->
setProfiler
(
PhutilServiceProfiler
::
getInstance
());
$result
=
$cache
->
getKey
(
'darkconsole:'
.
$this
->
key
);
if
(!
$result
)
{
return
new
Aphront400Response
();
}
$result
=
json_decode
(
$result
,
true
);
if
(!
is_array
(
$result
))
{
return
new
Aphront400Response
();
}
if
(
$result
[
'vers'
]
!=
DarkConsoleCore
::
STORAGE_VERSION
)
{
return
new
Aphront400Response
();
}
if
(
$result
[
'user'
]
!=
$user
->
getPHID
())
{
return
new
Aphront400Response
();
}
$output
=
array
();
$output
[
'tabs'
]
=
$result
[
'tabs'
];
$output
[
'panel'
]
=
array
();
foreach
(
$result
[
'data'
]
as
$class
=>
$data
)
{
try
{
$obj
=
newv
(
$class
,
array
());
$obj
->
setData
(
$data
);
$obj
->
setRequest
(
$request
);
$panel
=
$obj
->
renderPanel
();
if
(!
empty
(
$_COOKIE
[
'phsid'
]))
{
$panel
=
str_replace
(
$_COOKIE
[
'phsid'
],
'(session-key)'
,
$panel
);
}
$output
[
'panel'
][
$class
]
=
$panel
;
}
catch
(
Exception
$ex
)
{
$output
[
'panel'
][
$class
]
=
'error'
;
}
}
return
id
(
new
AphrontAjaxResponse
())->
setContent
(
$output
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Oct 16, 4:50 AM (1 d, 19 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
71/8d/d4f134c995e810a58fe0661c3574
Attached To
rPHAB Phabricator
Event Timeline
Log In to Comment