mirror of https://github.com/MISP/MISP
Attribute search now correctly searches attribute comments too for contained expressions, fixes #342
parent
2e28dd2dde
commit
2e1dfca943
|
@ -1179,6 +1179,11 @@ class AttributesController extends AppController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($toInclude) {
|
||||
array_push($temp, array('LOWER(Attribute.comment) LIKE' => '%' . $saveWord . '%'));
|
||||
} else {
|
||||
array_push($temp2, array('LOWER(Attribute.comment) NOT LIKE' => '%' . $saveWord . '%'));
|
||||
}
|
||||
}
|
||||
if ($i == 1 && $saveWord != '') $keyWordText = $saveWord;
|
||||
else if (($i > 1 && $i < 10) && $saveWord != '') $keyWordText = $keyWordText . ', ' . $saveWord;
|
||||
|
|
|
@ -170,6 +170,8 @@ class EventsController extends AppController {
|
|||
}
|
||||
$includeIDs = array_keys($includeIDs);
|
||||
$excludeIDs = array_keys($excludeIDs);
|
||||
// return -1 as the only value in includedIDs if both arrays are empty. This will mean that no events will be shown if there was no hit
|
||||
if (empty($includeIDs) && empty($excludeIDs)) $includeIDs[] = -1;
|
||||
return array($includeIDs, $excludeIDs);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,14 @@ foreach ($attributes as $attribute):
|
|||
?>
|
||||
</td>
|
||||
<td onclick="document.location ='document.location ='/events/view/<?php echo $attribute['Event']['id'];?>';">
|
||||
<?php echo h($attribute['Attribute']['comment']); ?>
|
||||
<?php
|
||||
$sigDisplay = nl2br(h($attribute['Attribute']['comment']));
|
||||
if ($isSearch == 1 && !empty($replacePairs)) {
|
||||
// highlight the keywords if there are any
|
||||
$sigDisplay = $this->Highlight->highlighter($sigDisplay, $replacePairs);
|
||||
}
|
||||
echo $sigDisplay;
|
||||
?>
|
||||
</td>
|
||||
<td class="short" onclick="document.location ='document.location ='/events/view/<?php echo $attribute['Event']['id'];?>';">
|
||||
<?php echo $attribute['Attribute']['to_ids'] ? 'Yes' : 'No'; ?>
|
||||
|
|
Loading…
Reference in New Issue