mirror of https://github.com/MISP/MISP
Batch search for attributes
Implementation of request to be able to do batch attribute searchespull/63/head
parent
755f19c560
commit
f544ac2e08
|
@ -651,7 +651,14 @@ class AttributesController extends AppController {
|
|||
// search the db
|
||||
$conditions = array();
|
||||
if ($keyword) {
|
||||
$conditions['Attribute.value LIKE'] = '%' . $keyword . '%';
|
||||
$keywordArray = explode("\n", $keyword);
|
||||
$i = 0;
|
||||
$temp = array();
|
||||
foreach ($keywordArray as $keywordArrayElement){
|
||||
$keywordArrayElement = '%' . trim($keywordArrayElement) . '%';
|
||||
array_push($temp, array('Attribute.value LIKE' => $keywordArrayElement));
|
||||
}
|
||||
$conditions['OR'] = $temp;
|
||||
}
|
||||
if ($type != 'ALL') {
|
||||
$conditions['Attribute.type ='] = $type;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<fieldset>
|
||||
<legend><?php echo __('Search Attribute'); ?></legend>
|
||||
<?php
|
||||
echo $this->Form->input('keyword');
|
||||
echo $this->Form->input('keyword', array('type' => 'textarea'));
|
||||
echo $this->Form->input('type', array('between' => $this->Html->div('forminfo', '', array('id' => 'AttributeTypeDiv'))));
|
||||
echo $this->Form->input('category', array('between' => $this->Html->div('forminfo', '', array('id' => 'AttributeCategoryDiv'))));
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue