mirror of https://github.com/MISP/MISP
fixes inconsistent relatedAttributes and relatedEvents arrays with
different correlation implementationspull/61/head
parent
bc0dbd5b97
commit
fd05d14602
|
@ -121,7 +121,7 @@ class EventsController extends AppController {
|
|||
}
|
||||
else {
|
||||
foreach ($relatedAttributes2 as $relatedAttribute2) {
|
||||
$relatedAttributes[$relatedAttribute2['Correlation']['1_attribute_id']][] = $relatedAttribute2;
|
||||
$relatedAttributes[$relatedAttribute2['Correlation']['1_attribute_id']][] = array('Attribute' => $relatedAttribute2['Correlation']);
|
||||
}
|
||||
|
||||
foreach ($this->Event->data['Attribute'] as $attribute) {
|
||||
|
@ -141,8 +141,8 @@ class EventsController extends AppController {
|
|||
foreach ($relatedAttributes as &$relatedAttribute) {
|
||||
if (null == $relatedAttribute) continue;
|
||||
foreach ($relatedAttribute as &$item) {
|
||||
$relatedEventsIds[] = $item['Correlation']['event_id'];
|
||||
$relatedEventsDates[$item['Correlation']['event_id']] = $item['Correlation']['date'];
|
||||
$relatedEventsIds[] = $item['Attribute']['event_id'];
|
||||
$relatedEventsDates[$item['Attribute']['event_id']] = $item['Attribute']['date'];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ class EventsController extends AppController {
|
|||
if (isset($relatedEventsDates)) {
|
||||
$relatedEventsDates = array_unique($relatedEventsDates);
|
||||
foreach ($relatedEventsDates as $key => $relatedEventsDate) {
|
||||
$relatedEvents[] = array('id' => $key, 'date' => $relatedEventsDate);
|
||||
$relatedEvents[] = array('Event' => array('id' => $key, 'date' => $relatedEventsDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ class EventsController extends AppController {
|
|||
$relatedEvents = $this->Event->find('all', $find_params);
|
||||
}
|
||||
}
|
||||
$this->set('correlation', Configure::read('CyDefSIG.correlation'));
|
||||
|
||||
$this->set('relatedAttributes', $relatedAttributes);
|
||||
|
||||
// passing decriptions for model fields
|
||||
|
|
|
@ -73,13 +73,8 @@
|
|||
<ul>
|
||||
<?php foreach ($relatedEvents as $relatedEvent): ?>
|
||||
<li><?php
|
||||
if ('db' == Configure::read('CyDefSIG.correlation')) { // TODO array key
|
||||
$link_text = $relatedEvent['date'].' ('.$relatedEvent['id'].')';
|
||||
echo $this->Html->link($link_text, array('controller' => 'events', 'action' => 'view', $relatedEvent['id']));
|
||||
} else {
|
||||
$link_text = $relatedEvent['Event']['date'].' ('.$relatedEvent['Event']['id'].')';
|
||||
echo $this->Html->link($link_text, array('controller' => 'events', 'action' => 'view', $relatedEvent['Event']['id']));
|
||||
}
|
||||
$link_text = $relatedEvent['Event']['date'].' ('.$relatedEvent['Event']['id'].')';
|
||||
echo $this->Html->link($link_text, array('controller' => 'events', 'action' => 'view', $relatedEvent['Event']['id']));
|
||||
?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
@ -143,11 +138,7 @@
|
|||
$first = 0;
|
||||
if (isset($relatedAttributes[$attribute['id']]) && (null != $relatedAttributes[$attribute['id']])) {
|
||||
foreach ($relatedAttributes[$attribute['id']] as $relatedAttribute) {
|
||||
if ('db' == Configure::read('CyDefSIG.correlation')) { // TODO array key
|
||||
echo $this->Html->link($relatedAttribute['Correlation']['event_id'], array('controller' => 'events', 'action' => 'view', $relatedAttribute['Correlation']['event_id']));
|
||||
} else {
|
||||
echo $this->Html->link($relatedAttribute['Attribute']['event_id'], array('controller' => 'events', 'action' => 'view', $relatedAttribute['Attribute']['event_id']));
|
||||
}
|
||||
echo $this->Html->link($relatedAttribute['Attribute']['event_id'], array('controller' => 'events', 'action' => 'view', $relatedAttribute['Attribute']['event_id']));
|
||||
echo ' ';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue