mirror of https://github.com/MISP/MISP
fix: [decaying] Do not access existing keys anymore
parent
8a6dbd033e
commit
0c8b7b5820
|
@ -3182,7 +3182,7 @@ class Attribute extends AppModel
|
|||
}
|
||||
if ($options['includeDecayScore']) {
|
||||
$this->DecayingModel = ClassRegistry::init('DecayingModel');
|
||||
$this->DecayingModel->attachScoresToAttribute($user, $results[$key], $options['decayingModel']);
|
||||
$this->DecayingModel->attachScoresToAttribute($user, $results[$key]['Attribute'], $options['decayingModel']);
|
||||
if ($options['excludeDecayed']) { // filter out decayed attribute
|
||||
$decayed_flag = true;
|
||||
foreach ($results[$key]['Attribute']['decay_score'] as $decayResult) {
|
||||
|
|
|
@ -254,7 +254,7 @@ class DecayingModel extends AppModel
|
|||
private function __include_formula_file_and_return_instance($filename='Polynomial.php')
|
||||
{
|
||||
$filename_no_extension = str_replace('.php', '', $filename);
|
||||
$filename = preg_replace('/[^a-zA-Z0-9_]+/', '-', $filename_no_extension) . '.php'; // sanitization
|
||||
$filename = preg_replace('/[^a-zA-Z0-9_]+/', '-', $filename_no_extension) . '.php'; // sanitization & TO BE REVIEWED
|
||||
$full_path = APP . 'Model/DecayingModelsFormulas/' . $filename;
|
||||
$expected_classname = $filename_no_extension;
|
||||
if (is_file($full_path)) {
|
||||
|
|
|
@ -43,16 +43,18 @@ abstract class DecayingModelBase
|
|||
$temp_mapping[$namespace_predicate] = $i;
|
||||
}
|
||||
}
|
||||
foreach ($attribute['AttributeTag'] as $tag) {
|
||||
$namespace_predicate = explode('=', $tag['Tag']['name'])[0];
|
||||
if (isset($temp_mapping[$namespace_predicate])) { // need to override event tag
|
||||
$overridden_tags[] = array(
|
||||
'EventTag' => $tags[$temp_mapping[$namespace_predicate]],
|
||||
'AttributeTag' => $tag
|
||||
);
|
||||
$tags[$temp_mapping[$namespace_predicate]] = $tag;
|
||||
} else {
|
||||
$tags[] = $tag;
|
||||
if (isset($attribute['AttributeTag'])) {
|
||||
foreach ($attribute['AttributeTag'] as $tag) {
|
||||
$namespace_predicate = explode('=', $tag['Tag']['name'])[0];
|
||||
if (isset($temp_mapping[$namespace_predicate])) { // need to override event tag
|
||||
$overridden_tags[] = array(
|
||||
'EventTag' => $tags[$temp_mapping[$namespace_predicate]],
|
||||
'AttributeTag' => $tag
|
||||
);
|
||||
$tags[$temp_mapping[$namespace_predicate]] = $tag;
|
||||
} else {
|
||||
$tags[] = $tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
return array('tags' => $tags, 'overridden' => $overridden_tags);
|
||||
|
|
Loading…
Reference in New Issue