mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:50 +01:00
fix an other CSP error, caused by json-responses send eg. from get_rows method on a GET request, filemanager opened in iframe from tracker
This commit is contained in:
parent
cb35a10b4c
commit
f49bbab26f
@ -216,6 +216,17 @@ class etemplate_new extends etemplate_widget_template
|
||||
{
|
||||
echo '<div id="popupMainDiv">'."\n";
|
||||
}
|
||||
// Send any accumulated json responses - after flush to avoid sending the buffer as a response
|
||||
if(egw_json_response::isJSONResponse())
|
||||
{
|
||||
$load_array['response'] = egw_json_response::get()->returnResult();
|
||||
/*$response = egw_json_response::get();
|
||||
echo '<script>egw_LAB.wait(function() {var json = egw.json(); json.handleResponse(';
|
||||
ob_flush();
|
||||
$response->sendResult();
|
||||
unset($response);
|
||||
echo ')});</script>';*/
|
||||
}
|
||||
echo '<div id="'.$dom_id.'" class="et2_container" data-etemplate="'.html::htmlspecialchars(json_encode($load_array), true).'"></div>';
|
||||
|
||||
if ($output_mode == 2)
|
||||
@ -224,17 +235,6 @@ class etemplate_new extends etemplate_widget_template
|
||||
echo $GLOBALS['egw']->framework->footer();
|
||||
}
|
||||
ob_flush();
|
||||
|
||||
// Send any accumulated json responses - after flush to avoid sending the buffer as a response
|
||||
if(egw_json_response::isJSONResponse())
|
||||
{
|
||||
$response = egw_json_response::get();
|
||||
echo '<script>egw_LAB.wait(function() {var json = egw.json(); json.handleResponse(';
|
||||
ob_flush();
|
||||
$response->sendResult();
|
||||
unset($response);
|
||||
echo ')});</script>';
|
||||
}
|
||||
}
|
||||
self::$request = null;
|
||||
}
|
||||
|
@ -284,6 +284,25 @@ class egw_json_response
|
||||
$inst->initResponseArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return json response data, after running beforeSendDataProcs
|
||||
*
|
||||
* Used to send json response with etemplate data in GET request
|
||||
*
|
||||
* @return array responseArray
|
||||
*/
|
||||
public static function returnResult()
|
||||
{
|
||||
$inst = self::get();
|
||||
|
||||
//Call each attached before send data proc
|
||||
foreach ($inst->beforeSendDataProcs as $proc)
|
||||
{
|
||||
call_user_func_array($proc['proc'], $proc['params']);
|
||||
}
|
||||
return $inst->initResponseArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* xAjax compatibility function
|
||||
*/
|
||||
|
@ -227,6 +227,11 @@
|
||||
}
|
||||
var et2 = new etemplate2(node, currentapp+".etemplate_new.ajax_process_content.etemplate");
|
||||
et2.load(data.name,data.url,data.data);
|
||||
if (typeof data.response != 'undefined')
|
||||
{
|
||||
var json_request = egw(window).json();
|
||||
json_request.handleResponse({response: data.response});
|
||||
}
|
||||
});
|
||||
|
||||
$j(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user