mirror of https://github.com/MISP/MISP
Merge branch '2.4' of github.com:MISP/MISP into 2.4
commit
9a911ac039
|
@ -1424,6 +1424,15 @@ class Event extends AppModel
|
|||
return $attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download event from remote server.
|
||||
*
|
||||
* @param int $eventId
|
||||
* @param array $server
|
||||
* @param null|HttpSocket $HttpSocket
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function downloadEventFromServer($eventId, $server, $HttpSocket=null)
|
||||
{
|
||||
$url = $server['Server']['url'];
|
||||
|
@ -1431,10 +1440,18 @@ class Event extends AppModel
|
|||
$request = $this->setupSyncRequest($server);
|
||||
$uri = $url . '/events/view/' . $eventId . '/deleted[]:0/deleted[]:1/excludeGalaxy:1';
|
||||
$response = $HttpSocket->get($uri, $data = '', $request);
|
||||
if ($response->isOk()) {
|
||||
return json_decode($response->body, true);
|
||||
|
||||
if ($response === false) {
|
||||
throw new Exception("Could not reach '$uri'.");
|
||||
} else if (!$response->isOk()) {
|
||||
throw new Exception("Fetching the '$uri' failed with HTTP error {$response->code}: {$response->reasonPhrase}");
|
||||
}
|
||||
return null;
|
||||
|
||||
$event = json_decode($response->body, true);
|
||||
if ($event === null) {
|
||||
throw new Exception('Could not parse event JSON: ' . json_last_error_msg(), json_last_error());
|
||||
}
|
||||
return $event;
|
||||
}
|
||||
|
||||
public function quickDelete($event)
|
||||
|
|
|
@ -2533,11 +2533,14 @@ class Server extends AppModel
|
|||
|
||||
private function __pullEvent($eventId, &$successes, &$fails, $eventModel, $server, $user, $jobId, $force = false)
|
||||
{
|
||||
$event = $eventModel->downloadEventFromServer(
|
||||
$eventId,
|
||||
$server
|
||||
);
|
||||
;
|
||||
try {
|
||||
$event = $eventModel->downloadEventFromServer($eventId, $server);
|
||||
} catch (Exception $e) {
|
||||
$this->logException('Failed downloading the event ' . $eventId, $e);
|
||||
$fails[$eventId] = __('failed downloading the event');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($event)) {
|
||||
if ($this->__checkIfEventIsBlockedBeforePull($event)) {
|
||||
return false;
|
||||
|
|
|
@ -817,7 +817,13 @@ class Sighting extends AppModel
|
|||
if (!empty($eventIds)) {
|
||||
// download each event and save sightings
|
||||
foreach ($eventIds as $k => $eventId) {
|
||||
$event = $this->Event->downloadEventFromServer($eventId, $server);
|
||||
try {
|
||||
$event = $this->Event->downloadEventFromServer($eventId, $server);
|
||||
} catch (Exception $e) {
|
||||
$this->logException('Failed downloading the event ' . $eventId, $e);
|
||||
continue;
|
||||
}
|
||||
|
||||
$sightings = array();
|
||||
if(!empty($event) && !empty($event['Event']['Attribute'])) {
|
||||
foreach($event['Event']['Attribute'] as $attribute) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<h3><?= __('Discussion') ?></h3>
|
||||
<div id="top">
|
||||
<h3><?= __('Discussion') ?></h3>
|
||||
<div class="pagination">
|
||||
<?php
|
||||
if (!empty($posts)):
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2a074f23fd861aeeee35fbb4adc2079193339109
|
||||
Subproject commit 8c3c224e6ad1d3fa848f0accaeab8161343fca4a
|
|
@ -1 +1 @@
|
|||
Subproject commit 067bd58464d843607a8452bc1f7c37903cc7f237
|
||||
Subproject commit 82fdf528e938c0cab96d05bbcad1085b34eb5f1e
|
Loading…
Reference in New Issue