mirror of https://github.com/MISP/MISP
fixes download-sync-bug when only one event is present on the remote
instancepull/61/head
parent
311a09e2b0
commit
9ae92ddd5c
|
@ -413,11 +413,19 @@ class Event extends AppModel {
|
|||
$xml = Xml::build($response->body);
|
||||
$eventArray = Xml::toArray($xml);
|
||||
$eventIds = array();
|
||||
foreach ($eventArray['response']['Event'] as &$event) {
|
||||
if (1 != $event['published']) {
|
||||
continue; // do not keep non-published events
|
||||
// different actions if it's only 1 event or more
|
||||
// only one event.
|
||||
if (isset($eventArray['response']['Event']['id'])) {
|
||||
$eventIds[] = $eventArray['response']['Event']['id'];
|
||||
}
|
||||
else {
|
||||
// multiple events, iterate over the array
|
||||
foreach ($eventArray['response']['Event'] as &$event) {
|
||||
if (1 != $event['published']) {
|
||||
continue; // do not keep non-published events
|
||||
}
|
||||
$eventIds[] = $event['id'];
|
||||
}
|
||||
$eventIds[] = $event['id'];
|
||||
}
|
||||
return $eventIds;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue