set correct content type for JSON requests

This commit is contained in:
Roland Gruber 2016-01-16 19:17:19 +00:00
parent edef026b24
commit f2168738bd
3 changed files with 24 additions and 9 deletions

View File

@ -5,7 +5,8 @@ March 2016 5.3
- Personal/Unix: support K5KEY hash type for smbk5pwd
- New NIS netgroup module for hosts
- fixed bugs:
-> autoload errors in tree view
-> Autoload errors in tree view
-> Set correct content type on JSON requests (174)
- LAM Pro:
-> Support for LDAP views based on nsview object class
-> Password notification jobs support to print expiration date in email

View File

@ -4,7 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2010 Cedric Dugas and Olivier Refalo
2011 - 2015 Roland Gruber
2011 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -30,6 +30,10 @@ if (strtolower(session_module_name()) == 'files') {
session_save_path(dirname(__FILE__) . '/../../sess');
}
if (!headers_sent()) {
header('Content-Type: application/json; charset=utf-8');
}
@session_start();
setlanguage();

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2011 - 2015 Roland Gruber
Copyright (C) 2011 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -58,6 +58,7 @@ class lamAjax {
* Manages an AJAX request.
*/
public static function handleRequest() {
lamAjax::setHeader();
// check token
validateSecurityToken(false);
@ -89,6 +90,15 @@ class lamAjax {
}
}
/**
* Sets JSON HTTP header.
*/
private function setHeader() {
if (!headers_sent()) {
header('Content-Type: application/json; charset=utf-8');
}
}
/**
* Manages a password change request on the edit account page.
*