MISP/app/View/Attributes/index.ctp

161 lines
6.9 KiB
Plaintext
Raw Normal View History

2012-03-26 19:56:44 +02:00
<div class="attributes index">
2013-05-31 11:35:27 +02:00
<h2>Attributes</h2>
2012-12-17 17:21:57 +01:00
<?php
2012-12-18 20:25:12 +01:00
if ($isSearch == 1) {
echo "<h4>Results for all attributes";
if ($keywordSearch != null) echo " with the value containing \"<b>" . h($keywordSearch) . "</b>\"";
if ($keywordSearch2 != null) echo " excluding the events \"<b>" . h($keywordSearch2) . "</b>\"";
if ($categorySearch != "ALL") echo " of category \"<b>" . h($categorySearch) . "</b>\"";
if ($typeSearch != "ALL") echo " of type \"<b>" . h($typeSearch) . "</b>\"";
if (isset($orgSearch) && $orgSearch != '' && $orgSearch != null) echo " created by the organisation \"<b>" . h($orgSearch) . "</b>\"";
2012-12-18 20:25:12 +01:00
echo ":</h4>";
} ?>
2013-05-31 11:35:27 +02:00
<div class="pagination">
<ul>
<?php
$this->Paginator->options(array(
'update' => '.span12',
'evalScripts' => true,
'before' => '$(".progress").show()',
'complete' => '$(".progress").hide()',
));
echo $this->Paginator->prev('&laquo; ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
echo $this->Paginator->next(__('next') . ' &raquo;', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
?>
</ul>
</div>
<table class="table table-striped table-hover table-condensed">
<tr>
<th><?php echo $this->Paginator->sort('event_id');?></th>
<th><?php echo $this->Paginator->sort('category');?></th>
<th><?php echo $this->Paginator->sort('type');?></th>
<th><?php echo $this->Paginator->sort('value');?></th>
<th<?php echo ' title="' . $attrDescriptions['signature']['desc'] . '"';?>>
<?php echo $this->Paginator->sort('signature');?></th>
2013-05-31 11:35:27 +02:00
<th class="actions">Actions</th>
</tr>
<?php
$currentCount = 0;
if ($isSearch == 1) {
// sanitize data
foreach ($keywordArray as &$keywordArrayElement) {
$keywordArrayElement = h($keywordArrayElement);
}
// build the $replacePairs variable used to highlight the keywords
$replacePairs = $this->Highlight->build_replace_pairs($keywordArray);
}
2013-04-24 15:20:20 +02:00
foreach ($attributes as $attribute):
?>
<tr>
<td class="short">
2013-05-31 11:35:27 +02:00
<div id="<?php echo $attribute['Attribute']['id']?>" title="<?php echo h($attribute['Event']['info'])?>"
onclick="document.location='/events/view/<?php echo $attribute['Event']['id'];?>';">
<?php
if ($attribute['Event']['orgc'] == $me['org']) {
$class='class="SameOrgLink"';
} else {
$class='';
}
$currentCount++;
?>
<a href="/events/view/<?php echo $attribute['Event']['id'];?>" <?php echo $class;?>><?php echo $attribute['Event']['id'];?></a>
2013-04-24 15:20:20 +02:00
</div>
</td>
<td title="<?php echo $categoryDefinitions[$attribute['Attribute']['category']]['desc'];?>" class="short" onclick="document.location='/events/view/<?php echo $attribute['Event']['id'];?>';">
<?php echo $attribute['Attribute']['category']; ?>&nbsp;</td>
<td title="<?php echo $typeDefinitions[$attribute['Attribute']['type']]['desc'];?>" class="short" onclick="document.location='/events/view/<?php echo $attribute['Event']['id'];?>';">
<?php echo $attribute['Attribute']['type']; ?>&nbsp;</td>
<td onclick="document.location='/events/view/<?php echo $attribute['Event']['id'];?>';">
2012-12-18 20:25:12 +01:00
<?php
2013-04-24 15:20:20 +02:00
$sigDisplay = nl2br(h($attribute['Attribute']['value']));
if ($isSearch == 1 && !empty($replacePairs)) {
// highlight the keywords if there are any
$sigDisplay = $this->Highlight->highlighter($sigDisplay, $replacePairs);
2013-04-24 15:20:20 +02:00
}
2012-12-18 20:25:12 +01:00
if ('attachment' == $attribute['Attribute']['type'] || 'malware-sample' == $attribute['Attribute']['type']) {
?><a href="/attributes/download/<?php echo $attribute['Attribute']['id'];?>"><?php echo $sigDisplay; ?></a><?php
2012-12-18 20:25:12 +01:00
} elseif ('link' == $attribute['Attribute']['type']) {
?><a href="<?php echo nl2br(h($attribute['Attribute']['value']));?>"><?php echo $sigDisplay; ?></a><?php
2012-12-18 20:25:12 +01:00
} else {
echo $sigDisplay;
}
?>&nbsp;</td>
<td class="short" onclick="document.location ='document.location ='/events/view/<?php echo $attribute['Event']['id'];?>';">
<?php echo $attribute['Attribute']['to_ids'] ? 'Yes' : 'No'; ?>&nbsp;
</td>
2013-06-03 14:44:31 +02:00
<td class="short action-links"><?php
2012-12-18 20:25:12 +01:00
if ($isAdmin || ($isAclModify && $attribute['Event']['user_id'] == $me['id']) || ($isAclModifyOrg && $attribute['Event']['org'] == $me['org'])) {
?><a href="/attributes/edit/<?php echo $attribute['Attribute']['id'];?>" class="icon-edit" title="Edit"></a><?php
echo $this->Form->postLink('',array('action' => 'delete', $attribute['Attribute']['id']), array('class' => 'icon-trash', 'title' => 'Delete'), __('Are you sure you want to delete this attribute?'));
2012-12-18 20:25:12 +01:00
}
?>
<a href="/events/view/<?php echo $attribute['Attribute']['event_id'];?>" class="icon-list-alt" title="View"></a>
</td>
</tr>
2012-12-18 20:25:12 +01:00
<?php
endforeach;
?>
</table>
2013-05-31 11:35:27 +02:00
<p>
2013-05-31 11:35:27 +02:00
<?php
echo $this->Paginator->counter(array(
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
));
?>
</p>
<div class="pagination">
<ul>
<?php
echo $this->Paginator->prev('&laquo; ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
echo $this->Paginator->next(__('next') . ' &raquo;', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
?>
</ul>
</div>
</div>
<div class="actions">
2013-05-31 11:35:27 +02:00
<ul class="nav nav-list">
<li><a href="/events/index">List Events</a></li>
2013-06-01 08:46:21 +02:00
<?php if ($isAclAdd): ?>
<li><a href="/events/add">Add Event</a></li>
2013-06-01 08:46:21 +02:00
<?php endif; ?>
<li class="divider"></li>
<?php
2013-05-31 11:35:27 +02:00
if ($isSearch == 1){
$searchClass = 'class="active"';
$listClass = '';
} else {
$searchClass = '';
$listClass = 'class="active"';
}
2013-06-01 08:46:21 +02:00
?>
<li <?php echo $listClass;?>><a href="/attributes/index">List Attributes</a></li>
<li <?php echo $searchClass;?>><a href="/attributes/search">Search Attributes</a></li>
2013-06-01 08:46:21 +02:00
<?php if ($isSearch == 1): ?>
2013-05-31 11:35:27 +02:00
<li class="divider"></li>
<li><a href="/events/downloadSearchResult">Download results as XML</a></li>
2013-06-01 08:46:21 +02:00
<?php endif; ?>
<li class="divider"></li>
<li><a href="/events/export">Export</a></li>
2013-06-01 08:46:21 +02:00
<?php if ($isAclAuth): ?>
<li><a href="/events/automation">Automation</a></li>
2013-06-01 08:46:21 +02:00
<?php endif;?>
</ul>
2013-06-06 16:36:28 +02:00
</div>
<script type="text/javascript">
// tooltips
$(document).ready(function () {
$("td, div").tooltip({
'placement': 'top',
'container' : 'body',
delay: { show: 500, hide: 100 }
});
});
</script>