Fix the downloaded prize array for awards with >1 prize. For STO this

actually doesn't matter there's only one prize for each award.
This commit is contained in:
dave 2010-02-12 14:16:19 +00:00
parent 1ab43fef68
commit 71509f3f16

View File

@ -37,12 +37,20 @@
exit;
}
if(count($array[$k]) == 1) {
$array[$k] = $array[$k][0];
} else {
/* Leave it alone */
/* Special cases, leave these as arrays of entries */
if($k == 'award' || $k == 'prize') {
foreach($array[$k] as &$a) {
xml_dearray($a);
}
continue;
}
if(count($array[$k]) != 1) {
echo "Unexpected multielement array, stop.";
exit;
};
$array[$k] = $array[$k][0];
if(is_array($array[$k])) {
xml_dearray($array[$k]);
}
@ -116,11 +124,9 @@
/* Undo variable to array */
$ret['awards'] = $ret['awards']['award'];
foreach($ret['awards'] as &$a)
$a['prizes'] = $a['prizes']['prize'];
/* Turn the awards into an array if it was dearrayed (in the case there is only one */
if(!is_array($ret['awards'])) {
$ret['awards'] = array($ret['awards']);
}
$ret['error'] = 0;
$ret['message'] = '';
break;