mirror of https://github.com/MISP/MISP
Merge branch '2.4' of https://github.com/MISP/MISP into 2.4
commit
5f2f51ed21
|
@ -502,6 +502,7 @@ class Feed extends AppModel
|
|||
foreach ($filterRules[$field][$prefix] as $temp) {
|
||||
if (stripos($object['name'], $temp) !== false) {
|
||||
$found = true;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -515,9 +516,6 @@ class Feed extends AppModel
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!$filterRules) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,13 @@ class Warninglist extends AppModel
|
|||
if ($redis !== false) {
|
||||
$key = 'misp:warninglist_entries_cache:' . $id;
|
||||
$redis->del($key);
|
||||
$redis->sAddArray($key, $warninglistEntries);
|
||||
if (method_exists($redis, 'saddArray')) {
|
||||
$redis->sAddArray($key, $warninglistEntries);
|
||||
} else {
|
||||
foreach ($warninglistEntries as $entry) {
|
||||
$redis->sAdd('misp:warninglist_entries_cache:' . $id, $entry);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -460,7 +466,7 @@ class Warninglist extends AppModel
|
|||
if (strpos($lv, ':') !== false) { // IPv6 CIDR must contain dot
|
||||
if ($this->__ipv6InCidr($value, $lv)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -470,12 +476,12 @@ class Warninglist extends AppModel
|
|||
|
||||
// Using solution from https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/IpUtils.php
|
||||
private function __ipv6InCidr($ip, $cidr)
|
||||
{
|
||||
{
|
||||
list($address, $netmask) = explode('/', $cidr);
|
||||
|
||||
|
||||
$bytesAddr = unpack('n*', inet_pton($address));
|
||||
$bytesTest = unpack('n*', inet_pton($ip));
|
||||
|
||||
|
||||
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; ++$i) {
|
||||
$left = $netmask - 16 * ($i - 1);
|
||||
$left = ($left <= 16) ? $left : 16;
|
||||
|
@ -484,7 +490,7 @@ class Warninglist extends AppModel
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,20 +24,22 @@
|
|||
if (!empty($data['html'])) {
|
||||
echo sprintf('<p>%s</p>', $data['html']);
|
||||
}
|
||||
$paginationData = array();
|
||||
if (!empty($data['paginationBaseurl'])) {
|
||||
$paginationData['paginationBaseurl'] = $data['paginationBaseurl'];
|
||||
$skipPagination = isset($data['skip_pagination']) && $data['skip_pagination'];
|
||||
if (!$skipPagination) {
|
||||
$paginationData = array();
|
||||
if (!empty($data['paginationBaseurl'])) {
|
||||
$paginationData['paginationBaseurl'] = $data['paginationBaseurl'];
|
||||
}
|
||||
echo $this->element('/genericElements/IndexTable/pagination', $paginationData);
|
||||
}
|
||||
echo $this->element('/genericElements/IndexTable/pagination', $paginationData);
|
||||
if (!empty($data['top_bar'])) {
|
||||
echo $this->element('/genericElements/ListTopBar/scaffold', array('data' => $data['top_bar']));
|
||||
}
|
||||
$rows = '';
|
||||
$row_element = $data['row_element'] ?: 'row';
|
||||
$options = isset($data['options']) ? $data['options'] : array();
|
||||
$actions = isset($data['actions']) ? $data['actions'] : array();
|
||||
foreach ($data['data'] as $k => $data_row) {
|
||||
$row_element = 'row';
|
||||
if (!empty($data['row_element'])) {
|
||||
$row_element = $data['row_element'];
|
||||
}
|
||||
$rows .= sprintf(
|
||||
'<tr data-row-id="%s">%s</tr>',
|
||||
h($k),
|
||||
|
@ -47,17 +49,20 @@
|
|||
'k' => $k,
|
||||
'row' => $data_row,
|
||||
'fields' => $data['fields'],
|
||||
'options' => empty($data['options']) ? array() : $data['options'],
|
||||
'actions' => empty($data['actions']) ? array() : $data['actions']
|
||||
'options' => $options,
|
||||
'actions' => $actions,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
echo sprintf(
|
||||
'<table class="table table-striped table-hover table-condensed">%s%s</table>',
|
||||
$this->element('/genericElements/IndexTable/headers', array('fields' => $data['fields'], 'paginator' => $this->Paginator, 'actions' => empty($data['actions']) ? false : true)),
|
||||
$rows
|
||||
);
|
||||
echo $this->element('/genericElements/IndexTable/pagination_counter', $paginationData);
|
||||
echo $this->element('/genericElements/IndexTable/pagination', $paginationData);
|
||||
?>
|
||||
|
||||
if (!$skipPagination) {
|
||||
echo $this->element('/genericElements/IndexTable/pagination_counter', $paginationData);
|
||||
echo $this->element('/genericElements/IndexTable/pagination', $paginationData);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue