Fix header() in api.php

Minor cleanup
This commit is contained in:
Ian Moore 2015-07-30 19:19:18 -04:00
parent 921c8175e6
commit 1a1b09b682
3 changed files with 14 additions and 19 deletions

View File

@ -381,7 +381,7 @@ if($vbox && $vbox->errors) {
if(isset($request['printr'])) {
print_r($response);
} else {
header('Content-type', 'application/json');
header('Content-type: application/json');
echo(json_encode($response));
}

View File

@ -1,6 +1,5 @@
/*
* Endpoint configuration for phpVirtualBox
* $Id$
*/
var vboxEndpointConfig = {
api: 'endpoints/api.php',

View File

@ -32,8 +32,6 @@ foreach($arrXml['TS']['context'] as $c) {
if(!is_array($m)) continue;
#if(@$m['translation_attr']['type'] == 'obsolete') continue;
$s = clean($m['source'],true);
unset($m['source']);
@ -51,10 +49,10 @@ foreach($arrXml['TS']['context'] as $c) {
}
}
} else if(is_array($m['translation'])) {
// assume unfinished
// assume unfinished
$m['translation'] = $s;
} else {
$m['translation'] = clean($m['translation']);
}
@ -62,14 +60,12 @@ foreach($arrXml['TS']['context'] as $c) {
if($phpStyle) {
$m['htmlized'] = htmlentities($s, ENT_NOQUOTES, 'UTF-8');
if(strlen($m['htmlized']) == strlen($s)) unset($m['htmlized']);
} else {
#unset($m['comment']);
}
// Messages for this context is an array
if(is_array(@$lang['contexts'][$c['name']]['messages'][$s])) {
// Translation for this message exists
// Translation for this message exists
if(isset($lang['contexts'][$c['name']]['messages'][$s]['translation'])) {
// Check to see if incoming translation has 'obsolete'
@ -79,7 +75,7 @@ foreach($arrXml['TS']['context'] as $c) {
if(@$lang['contexts'][$c['name']]['messages'][$s]['translation_attr']['type'] == 'obsolete') continue;
$lang['contexts'][$c['name']]['messages'][$s] = array($lang['contexts'][$c['name']]['messages'][$s]);
}
}
$lang['contexts'][$c['name']]['messages'][$s][] = $m;
@ -157,7 +153,7 @@ function xml2array($contents, $get_attributes=1, $priority = 'tag') {
$result = array();
$attributes_data = array();
if(isset($value)) {
if($priority == 'tag') $result = $value;
else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode
@ -189,7 +185,7 @@ function xml2array($contents, $get_attributes=1, $priority = 'tag') {
} else {//This section will make the value an array if multiple tags with the same name appear together
$current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array
$repeated_tag_index[$tag.'_'.$level] = 2;
if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
$current[$tag]['0_attr'] = $current[$tag.'_attr'];
unset($current[$tag.'_attr']);
@ -212,7 +208,7 @@ function xml2array($contents, $get_attributes=1, $priority = 'tag') {
// ...push the new element into that array.
$current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result;
if($priority == 'tag' and $get_attributes and $attributes_data) {
$current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
}
@ -223,11 +219,11 @@ function xml2array($contents, $get_attributes=1, $priority = 'tag') {
$repeated_tag_index[$tag.'_'.$level] = 1;
if($priority == 'tag' and $get_attributes) {
if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well
$current[$tag]['0_attr'] = $current[$tag.'_attr'];
unset($current[$tag.'_attr']);
}
if($attributes_data) {
$current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data;
}
@ -240,6 +236,6 @@ function xml2array($contents, $get_attributes=1, $priority = 'tag') {
$current = &$parent[$level-1];
}
}
return($xml_array);
}
}