Allow for separate headers upon conditional

This commit is contained in:
pblasquez
2016-04-28 14:42:06 -07:00
parent 21e2b45cec
commit 4cc9203baa
3 changed files with 6 additions and 5 deletions
@@ -11,9 +11,9 @@
* option) any later version. Please see LICENSE.txt at the top level of * option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details. * the source code distribution for details.
*/ */
header('Content-type: application/json');
if (is_admin() === false) { if (is_admin() === false) {
header('Content-type: text/plain');
die('ERROR: You need to be admin'); die('ERROR: You need to be admin');
} }
@@ -25,5 +25,6 @@ if (is_numeric($template_id) && $template_id > 0) {
} }
$output = array('rule_id' => $rules); $output = array('rule_id' => $rules);
header('Content-type: application/json');
echo _json_encode($output); echo _json_encode($output);
} }
@@ -11,9 +11,9 @@
* option) any later version. Please see LICENSE.txt at the top level of * option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details. * the source code distribution for details.
*/ */
header('Content-type: application/json');
if (is_admin() === false) { if (is_admin() === false) {
header('Content-type: text/plain');
die('ERROR: You need to be admin'); die('ERROR: You need to be admin');
} }
@@ -129,5 +129,5 @@ else if ($sub_type == 'del-maintenance') {
'message' => $message, 'message' => $message,
); );
}//end if }//end if
header('Content-type: application/json');
echo _json_encode($response); echo _json_encode($response);
+2 -2
View File
@@ -11,9 +11,9 @@
* option) any later version. Please see LICENSE.txt at the top level of * option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details. * the source code distribution for details.
*/ */
header('Content-type: application/json');
if (is_admin() === false) { if (is_admin() === false) {
header('Content-type: text/plain');
die('ERROR: You need to be admin'); die('ERROR: You need to be admin');
} }
@@ -51,5 +51,5 @@ if (file_exists($config['install_dir']."/includes/alerts/transport.".$transport.
} }
} }
} }
header('Content-type: application/json');
echo _json_encode(array('status' => $status)); echo _json_encode(array('status' => $status));