mirror of https://github.com/MISP/MISP
chg: [UI] Simplify getEventInfoById controller and template
parent
542831ec4a
commit
5d9843bfb5
|
@ -5594,24 +5594,25 @@ class EventsController extends AppController
|
|||
|
||||
public function getEventInfoById($id)
|
||||
{
|
||||
$user = $this->_closeSession();
|
||||
if (empty($id)) {
|
||||
throw new MethodNotAllowedException(__('Invalid ID.'));
|
||||
}
|
||||
$event = $this->Event->fetchSimpleEvent($this->Auth->user(), $id, [
|
||||
$event = $this->Event->fetchSimpleEvent($user, $id, [
|
||||
'fields' => ['Event.id', 'Event.info', 'Event.threat_level_id', 'Event.analysis'],
|
||||
'contain' => ['EventTag' => ['Tag.id', 'Tag.name', 'Tag.colour'], 'ThreatLevel.name'],
|
||||
]);
|
||||
if ($this->_isRest()) {
|
||||
return $this->RestResponse->viewData($event, $this->response->type());
|
||||
} else {
|
||||
if ($this->request->is('ajax')) {
|
||||
$this->layout = false;
|
||||
}
|
||||
$this->set('analysisLevels', $this->Event->analysisLevels);
|
||||
$this->set('validUuid', Validation::uuid($id));
|
||||
$this->set('id', $id);
|
||||
$this->set('event', $event);
|
||||
}
|
||||
|
||||
if ($this->request->is('ajax')) {
|
||||
$this->layout = false;
|
||||
}
|
||||
$this->set('analysisLevels', $this->Event->analysisLevels);
|
||||
$this->set('validUuid', Validation::uuid($id));
|
||||
$this->set('id', $id);
|
||||
$this->set('event', $event);
|
||||
}
|
||||
|
||||
public function enrichEvent($id)
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
}
|
||||
echo '</div>';
|
||||
} else {
|
||||
$data = Hash::extract($event, $fieldData);
|
||||
$data = Hash::get($event, $fieldData);
|
||||
if ($fieldData === 'Event.analysis') {
|
||||
$data[0] = $analysisLevels[intval($data[0])];
|
||||
$data = $analysisLevels[intval($data)];
|
||||
}
|
||||
if ($fieldData === 'Event.id') {
|
||||
echo '<span class="blue bold">' . $field . '</span>: <a href="' . $baseurl . '/events/view/' . $data[0] . '">' . h($data[0]) . '</a><br>';
|
||||
echo '<span class="blue bold">' . $field . '</span>: <a href="' . $baseurl . '/events/view/' . $data . '">' . h($data) . '</a><br>';
|
||||
} else {
|
||||
echo '<span class="blue bold">' . $field . '</span>: ' . h($data[0]) . '<br>';
|
||||
echo '<span class="blue bold">' . $field . '</span>: ' . h($data) . '<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue