mirror of https://github.com/MISP/MISP
chg: [internal] Add object code cleanup
parent
ef3d0e33b7
commit
fd37c0b0c7
|
@ -343,10 +343,16 @@ class ObjectsController extends AppController
|
|||
$template = $this->MispObject->prepareTemplate($template);
|
||||
$element = array();
|
||||
foreach ($template['ObjectTemplateElement'] as $templateElement) {
|
||||
if ($templateElement['object_relation'] == $object_relation) {
|
||||
if ($templateElement['object_relation'] === $object_relation) {
|
||||
$element = $templateElement;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($element)) {
|
||||
throw new NotFoundException(__("Object template do not contains object relation $object_relation"));
|
||||
}
|
||||
|
||||
$distributionData = $this->MispObject->Event->Attribute->fetchDistributionData($this->Auth->user());
|
||||
$this->layout = false;
|
||||
$this->set('distributionData', $distributionData);
|
||||
|
|
|
@ -13,14 +13,13 @@
|
|||
</td>
|
||||
<td class="short" title="<?php echo h($element['description']); ?>">
|
||||
<?php
|
||||
$formSettings = array(
|
||||
'type' => 'hidden',
|
||||
'value' => $element['object_relation'],
|
||||
'label' => false,
|
||||
'div' => false
|
||||
);
|
||||
echo $this->Form->input('Attribute.' . $k . '.object_relation', $formSettings);
|
||||
if ($action == 'edit') {
|
||||
echo $this->Form->input('Attribute.' . $k . '.object_relation', array(
|
||||
'type' => 'hidden',
|
||||
'value' => $element['object_relation'],
|
||||
'label' => false,
|
||||
'div' => false
|
||||
));
|
||||
if ($action === 'edit') {
|
||||
echo $this->Form->input('Attribute.' . $k . '.uuid', array(
|
||||
'type' => 'hidden',
|
||||
'label' => false,
|
||||
|
@ -28,13 +27,12 @@
|
|||
'value' => !empty($element['uuid']) ? $element['uuid'] : ''
|
||||
));
|
||||
}
|
||||
$formSettings = array(
|
||||
'type' => 'hidden',
|
||||
'value' => $element['type'],
|
||||
'label' => false,
|
||||
'div' => false
|
||||
);
|
||||
echo $this->Form->input('Attribute.' . $k . '.type', $formSettings);
|
||||
echo $this->Form->input('Attribute.' . $k . '.type', array(
|
||||
'type' => 'hidden',
|
||||
'value' => $element['type'],
|
||||
'label' => false,
|
||||
'div' => false
|
||||
));
|
||||
echo '<span class="bold">' . Inflector::humanize(h($element['object_relation'])) . '</span>';
|
||||
if (!empty($template['ObjectTemplate']['requirements']['required']) && in_array($element['object_relation'], $template['ObjectTemplate']['requirements']['required'], true)) {
|
||||
echo '<span class="red" style="vertical-align: super;font-size: 8px;margin-left: 2px;" title="' . __('Required') . '"><i class="fas fa-asterisk"></i></span>';
|
||||
|
@ -47,14 +45,13 @@
|
|||
</td>
|
||||
<td class="short">
|
||||
<?php
|
||||
$formSettings = array(
|
||||
'options' => array_combine($element['categories'], $element['categories']),
|
||||
'default' => $element['default_category'],
|
||||
'style' => 'margin-bottom:0px;',
|
||||
'label' => false,
|
||||
'div' => false
|
||||
);
|
||||
echo $this->Form->input('Attribute.' . $k . '.category', $formSettings);
|
||||
echo $this->Form->input('Attribute.' . $k . '.category', array(
|
||||
'options' => array_combine($element['categories'], $element['categories']),
|
||||
'default' => $element['default_category'],
|
||||
'style' => 'margin-bottom:0px;width:180px',
|
||||
'label' => false,
|
||||
'div' => false
|
||||
));
|
||||
?>
|
||||
</td>
|
||||
<td class="short">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="object_value_field">
|
||||
<?php
|
||||
if ($element['type'] == 'malware-sample' || $element['type'] == 'attachment'):
|
||||
if ($element['type'] === 'malware-sample' || $element['type'] === 'attachment'):
|
||||
if ($action != 'edit'):
|
||||
echo $this->Form->file('Attribute.' . $k . '.Attachment', array(
|
||||
'class' => 'Attribute_attachment'
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
)
|
||||
);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
enableDisableObjectRows([<?php echo h($k); ?>]);
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue