mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 16:19:06 +01:00
Fix content-type on Ajax return
This commit is contained in:
parent
5c10277861
commit
16373e6904
2 changed files with 7 additions and 1 deletions
|
@ -1703,8 +1703,13 @@ class LSsession {
|
|||
* @retval void
|
||||
*/
|
||||
public static function displayAjaxReturn($data=array(), $pretty=false) {
|
||||
// Adjust content-type
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// If redirection set, just redirect user before handling messages/errors to
|
||||
// keep it in session and show it on next page
|
||||
if (isset($data['LSredirect']) && (!LSdebugDefined()) ) {
|
||||
echo json_encode($data);
|
||||
echo json_encode($data, (($pretty||isset($_REQUEST['pretty']))?JSON_PRETTY_PRINT:0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -457,6 +457,7 @@ class LStemplate extends LSlog_staticLoggerClass {
|
|||
public static function fatal_error($error=null) {
|
||||
http_response_code(500);
|
||||
if (LSsession :: get('api_mode')) {
|
||||
header('Content-Type: application/json');
|
||||
$errors = array(_("A fatal error occured. If problem persist, please contact support."));
|
||||
if ($error)
|
||||
$errors[] = $error;
|
||||
|
|
Loading…
Reference in a new issue