forked from science-ation/science-ation
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:
parent
1ab43fef68
commit
71509f3f16
@ -37,12 +37,20 @@
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($array[$k]) == 1) {
|
/* Special cases, leave these as arrays of entries */
|
||||||
$array[$k] = $array[$k][0];
|
if($k == 'award' || $k == 'prize') {
|
||||||
} else {
|
foreach($array[$k] as &$a) {
|
||||||
/* Leave it alone */
|
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])) {
|
if(is_array($array[$k])) {
|
||||||
xml_dearray($array[$k]);
|
xml_dearray($array[$k]);
|
||||||
}
|
}
|
||||||
@ -116,11 +124,9 @@
|
|||||||
|
|
||||||
/* Undo variable to array */
|
/* Undo variable to array */
|
||||||
$ret['awards'] = $ret['awards']['award'];
|
$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['error'] = 0;
|
||||||
$ret['message'] = '';
|
$ret['message'] = '';
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user