From 5dcd4dba47dcccc5b519db2af8582d9b963adb4d Mon Sep 17 00:00:00 2001 From: chrisr3d Date: Mon, 18 Mar 2019 18:17:55 +0100 Subject: [PATCH] fix: [enrichment] Fixed $event variable handling + monkey typo --- app/Controller/EventsController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index afa385346..21f8efd30 100644 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -5084,7 +5084,7 @@ class EventsController extends AppController $event['Object'] = $objects; $this->set('event', $event); if (!empty($result['results'])) { - $this->__handleSimplifiedFormat($attribute, $module, $options, $result, $type, $render_name = 'resolved_misp_format'); + $this->__handleSimplifiedFormat($attribute, $module, $options, $result, $type, $event = true, $render_name = 'resolved_misp_format'); } else { $this->set('menuItem', 'enrichmentResults'); $this->set('title', 'Enrichment Results'); @@ -5113,10 +5113,10 @@ class EventsController extends AppController if (!is_array($result)) { throw new Exception($result); } - $this->__handleSimplifedFormat($attribute, $module, $options, $result, $type); + $this->__handleSimplifiedFormat($attribute, $module, $options, $result, $type); } - private function __handleSimplififedFormat($attribute, $module, $options, $result, $type, $renderName = 'resolved_attributes') + private function __handleSimplifiedFormat($attribute, $module, $options, $result, $type, $event = false, $renderName = 'resolved_attributes') { $resultArray = $this->Event->handleModuleResult($result, $attribute[0]['Attribute']['event_id']); if (isset($result['comment']) && $result['comment'] != "") { @@ -5154,7 +5154,9 @@ class EventsController extends AppController $this->set('distributions', $distributions); $this->set('sgs', $sgs); $this->set('type', $type); - $this->set('event', array('Event' => $attribute[0]['Event'])); + if (!$event){ + $this->set('event', array('Event' => $attribute[0]['Event'])); + } $this->set('resultArray', $resultArray); $this->set('typeList', array_keys($this->Event->Attribute->typeDefinitions)); $this->set('defaultCategories', $this->Event->Attribute->defaultCategories);