MDL-85322 block_html: trust dashboard content in WS context
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
issueNumber: MDL-85322
|
||||
notes:
|
||||
block_html:
|
||||
- message: >-
|
||||
Treat Dashboard (pagetype 'my-index') as trusted in web services so
|
||||
get_content_for_external preserves embedded HTML (e.g. iframes) on user
|
||||
Dashboard.
|
||||
type: changed
|
||||
@@ -165,14 +165,24 @@ class block_html extends block_base {
|
||||
}
|
||||
|
||||
function content_is_trusted() {
|
||||
global $SCRIPT;
|
||||
|
||||
global $SCRIPT, $USER;
|
||||
if (!$context = context::instance_by_id($this->instance->parentcontextid, IGNORE_MISSING)) {
|
||||
return false;
|
||||
}
|
||||
//find out if this block is on the profile page
|
||||
if ($context->contextlevel == CONTEXT_USER) {
|
||||
if ($SCRIPT === '/my/index.php') {
|
||||
$usersubpage = my_get_page($USER->id);
|
||||
$usersubpage = $usersubpage->id ?? null;
|
||||
if (
|
||||
$SCRIPT === '/my/index.php' ||
|
||||
(
|
||||
defined('WS_SERVER') &&
|
||||
WS_SERVER &&
|
||||
!empty($this->page) &&
|
||||
$this->page->pagetype === 'my-index' &&
|
||||
$this->page->subpage === $usersubpage
|
||||
)
|
||||
) {
|
||||
// this is exception - page is completely private, nobody else may see content there
|
||||
// that is why we allow JS here
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user