diff --git a/app/Config/routes.php b/app/Config/routes.php index 2d5dce530..0b52e108f 100755 --- a/app/Config/routes.php +++ b/app/Config/routes.php @@ -37,6 +37,7 @@ Router::connect('/users/admin_index/*', array('controller' => 'users', 'action' => 'index', 'admin' => true)); Router::connect('/roles/admin_index/*', array('controller' => 'roles', 'action' => 'index', 'admin' => true)); + Router::connect('/logs/admin_search/*', array('controller' => 'logs', 'action' => 'search', 'admin' => true)); // Router::connect('/roles/admin_add/*', array('controller' => 'roles', 'action' => 'add', 'admin' => true)); // Router::connect('/roles/admin_edit/*', array('controller' => 'roles', 'action' => 'edit', 'admin' => true)); Router::connect('/logs/admin_index/*', array('controller' => 'logs', 'action' => 'index', 'admin' => true)); diff --git a/app/Controller/AttributesController.php b/app/Controller/AttributesController.php index d4a33b468..148df2598 100755 --- a/app/Controller/AttributesController.php +++ b/app/Controller/AttributesController.php @@ -638,7 +638,6 @@ class AttributesController extends AppController { $this->set('categoryDefinitions', $this->Attribute->categoryDefinitions); // reset the paginate_conditions $this->Session->write('paginate_conditions',array()); - if ($this->request->is('post') && ($this->request->here == $fullAddress)) { $keyword = $this->request->data['Attribute']['keyword']; $keyword2 = $this->request->data['Attribute']['keyword2']; @@ -722,7 +721,7 @@ class AttributesController extends AppController { $conditions['Attribute.category ='] = $category; } // organisation search field - $i = 0; + $i = 1; $temp = array(); if (isset($org)) { $orgArray = explode("\n", $org); @@ -765,9 +764,10 @@ class AttributesController extends AppController { $attributeIdList = array(); $attributes = $this->paginate(); // if we searched for IOCs only, apply the whitelist to the search result! + if ($ioc) { $this->loadModel('Whitelist'); - $attributes = $this->Whitelist->removeWhitelistedFromAttributeArray($attributes); + $attributes = $this->Whitelist->removeWhitelistedFromArray($attributes, true); } foreach ($attributes as &$attribute) { @@ -781,6 +781,8 @@ class AttributesController extends AppController { // and store into session $this->Session->write('paginate_conditions', $this->paginate); $this->Session->write('paginate_conditions_keyword', $keyword); + $this->Session->write('paginate_conditions_keyword2', $keyword2); + $this->Session->write('paginate_conditions_org', $org); $this->Session->write('paginate_conditions_type', $type); $this->Session->write('paginate_conditions_category', $category); $this->Session->write('search_find_idlist', $idList); @@ -810,9 +812,13 @@ class AttributesController extends AppController { // get from Session $keyword = $this->Session->read('paginate_conditions_keyword'); + $keyword2 = $this->Session->read('paginate_conditions_keyword2'); + $org = $this->Session->read('paginate_conditions_org'); $type = $this->Session->read('paginate_conditions_type'); $category = $this->Session->read('paginate_conditions_category'); $this->set('keywordSearch', $keyword); + $this->set('keywordSearch2', $keyword2); + $this->set('orgSearch', $org); $this->set('typeSearch', $type); $this->set('isSearch', 1); $this->set('categorySearch', $category); diff --git a/app/View/Attributes/index.ctp b/app/View/Attributes/index.ctp index 84f0aac3c..b0748b61e 100755 --- a/app/View/Attributes/index.ctp +++ b/app/View/Attributes/index.ctp @@ -41,11 +41,13 @@ if ($isSearch == 1) { if ($isSearch == 1) { // sanitize data - foreach ($keywordArray as &$keywordArrayElement) { - $keywordArrayElement = h($keywordArrayElement); - } + if (isset($keywordArray)) { + foreach ($keywordArray as &$keywordArrayElement) { + $keywordArrayElement = h($keywordArrayElement); + } // build the $replacePairs variable used to highlight the keywords $replacePairs = $this->Highlight->build_replace_pairs($keywordArray); + } } foreach ($attributes as $attribute): diff --git a/app/View/Users/admin_add.ctp b/app/View/Users/admin_add.ctp index b7ad4dbc6..b69599248 100644 --- a/app/View/Users/admin_add.ctp +++ b/app/View/Users/admin_add.ctp @@ -23,16 +23,16 @@