mirror of https://github.com/MISP/MISP
Merge branch 'feature/test_attribute_date' into feature/test
commit
ffcdcaf823
|
@ -921,7 +921,7 @@ class EventsController extends AppController {
|
|||
if ($this->request->is('post') || $this->request->is('put')) {
|
||||
// Performs all the actions required to publish an event
|
||||
$result = $this->Event->publish($id);
|
||||
if (Configure::read('MISP.background_jobs')) {
|
||||
if (!Configure::read('MISP.background_jobs')) {
|
||||
if (!is_array($result)) {
|
||||
// redirect to the view event page
|
||||
$this->Session->setFlash(__('Event published, but NO mail sent to any participants.', true));
|
||||
|
|
|
@ -119,7 +119,7 @@ class ShadowAttributesController extends AppController {
|
|||
$event = $this->Event->read(null, $shadow['event_id']);
|
||||
|
||||
if (!$this->_isSiteAdmin()) {
|
||||
if ((($event['Event']['orgc'] != $this->Auth->user('org')) && ($this->Auth->user('org') != $shadow['org'])) || (!$this->userRole['perm_modify'])) {
|
||||
if (($event['Event']['orgc'] != $this->Auth->user('org')) || (!$this->userRole['perm_modify'])) {
|
||||
$this->Session->setFlash('You don\'t have permission to do that');
|
||||
$this->redirect(array('controller' => 'events', 'action' => 'index'));
|
||||
}
|
||||
|
|
|
@ -861,7 +861,7 @@ class Event extends AppModel {
|
|||
// $conditions['AND'][] = array('Event.published =' => 1);
|
||||
|
||||
// do not expose all the data ...
|
||||
$fields = array('Event.id', 'Event.org', 'Event.date', 'Event.threat_level_id', 'Event.info', 'Event.published', 'Event.uuid', 'Event.attribute_count', 'Event.analysis', 'Event.timestamp', 'Event.distribution', 'Event.proposal_email_lock', 'Event.orgc', 'Event.user_id', 'Event.locked');
|
||||
$fields = array('Event.id', 'Event.org', 'Event.date', 'Event.threat_level_id', 'Event.info', 'Event.published', 'Event.uuid', 'Event.attribute_count', 'Event.analysis', 'Event.timestamp', 'Event.distribution', 'Event.proposal_email_lock', 'Event.orgc', 'Event.user_id', 'Event.locked', 'Event.publish_timestamp');
|
||||
$fieldsAtt = array('Attribute.id', 'Attribute.type', 'Attribute.category', 'Attribute.value', 'Attribute.to_ids', 'Attribute.uuid', 'Attribute.event_id', 'Attribute.distribution', 'Attribute.timestamp', 'Attribute.comment');
|
||||
$fieldsShadowAtt = array('ShadowAttribute.id', 'ShadowAttribute.type', 'ShadowAttribute.category', 'ShadowAttribute.value', 'ShadowAttribute.to_ids', 'ShadowAttribute.uuid', 'ShadowAttribute.event_id', 'ShadowAttribute.old_id', 'ShadowAttribute.comment', 'ShadowAttribute.org');
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ class Event extends AppModel {
|
|||
|
||||
// The mail body, h() is NOT needed as we are sending plain-text mails.
|
||||
$body = "";
|
||||
$body .= '----------------------------------------------' . "\n";
|
||||
$body .= '==============================================' . "\n";
|
||||
$appendlen = 20;
|
||||
$body .= 'URL : ' . Configure::read('CyDefSIG.baseurl') . '/events/view/' . $event['Event']['id'] . "\n";
|
||||
$body .= 'Event : ' . $event['Event']['id'] . "\n";
|
||||
|
@ -1024,19 +1024,22 @@ class Event extends AppModel {
|
|||
$user['org'] = $org;
|
||||
$relatedEvents = $this->getRelatedEvents($user, false);
|
||||
if (!empty($relatedEvents)) {
|
||||
$body .= '----------------------------------------------' . "\n";
|
||||
$body .= '==============================================' . "\n";
|
||||
$body .= 'Related to : '. "\n";
|
||||
foreach ($relatedEvents as &$relatedEvent) {
|
||||
$body .= Configure::read('CyDefSIG.baseurl') . '/events/view/' . $relatedEvent['Event']['id'] . ' (' . $relatedEvent['Event']['date'] . ') ' ."\n";
|
||||
}
|
||||
$body .= '----------------------------------------------' . "\n";
|
||||
$body .= '==============================================' . "\n";
|
||||
}
|
||||
$body .= 'Attributes :' . "\n";
|
||||
$body .= 'Attributes (* infront of the attribute type :' . "\n";
|
||||
$bodyTempOther = "";
|
||||
|
||||
if (isset($event['Attribute'])) {
|
||||
foreach ($event['Attribute'] as &$attribute) {
|
||||
$line = '- ' . $attribute['type'] . str_repeat(' ', $appendlen - 2 - strlen($attribute['type'])) . ': ' . $attribute['value'] . "\n";
|
||||
if (isset($event['Event']['publish_timestamp']) && isset($attribute['timestamp']) && $attribute['timestamp'] > $event['Event']['publish_timestamp']) {
|
||||
$line = '*' . $attribute['type'] . str_repeat(' ', $appendlen - 2 - strlen($attribute['type'])) . ': ' . $attribute['value'] ."\n";
|
||||
} else {
|
||||
$line = $attribute['type'] . str_repeat(' ', $appendlen - 2 - strlen($attribute['type'])) . ': ' . $attribute['value'] . "\n";
|
||||
}
|
||||
if ('other' == $attribute['type']) // append the 'other' attribute types to the bottom.
|
||||
$bodyTempOther .= $line;
|
||||
else $body .= $line;
|
||||
|
@ -1046,7 +1049,7 @@ class Event extends AppModel {
|
|||
$body .= "\n";
|
||||
}
|
||||
$body .= $bodyTempOther; // append the 'other' attribute types to the bottom.
|
||||
$body .= '----------------------------------------------' . "\n";
|
||||
$body .= '==============================================' . "\n";
|
||||
// find out whether the event is private, to limit the alerted user's list to the org only
|
||||
if ($event['Event']['distribution'] == 0) {
|
||||
$eventIsPrivate = true;
|
||||
|
@ -1470,8 +1473,9 @@ class Event extends AppModel {
|
|||
$this->recursive = 0;
|
||||
$event = $this->read(null, $id);
|
||||
// update the DB to set the published flag
|
||||
$fieldList = array('published', 'id', 'info');
|
||||
$fieldList = array('published', 'id', 'info', 'publish_timestamp');
|
||||
$event['Event']['published'] = 1;
|
||||
$event['Event']['publish_timestamp'] = time();
|
||||
$this->save($event, array('fieldList' => $fieldList));
|
||||
$uploaded = false;
|
||||
if ('true' == Configure::read('CyDefSIG.sync') && $event['Event']['distribution'] > 1) {
|
||||
|
|
|
@ -6,7 +6,6 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
|
|||
echo $this->element('side_menu', array('menuList' => 'event', 'menuItem' => 'viewEvent', 'mayModify' => $mayModify, 'mayPublish' => $mayPublish));
|
||||
?>
|
||||
|
||||
|
||||
<div class="events view">
|
||||
|
||||
<?php
|
||||
|
@ -134,6 +133,7 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
|
|||
if (!empty($event['Attribute'])):?>
|
||||
<table class="table table-striped table-condensed">
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Category</th>
|
||||
<th>Type</th>
|
||||
<th>Value</th>
|
||||
|
@ -151,6 +151,12 @@ if (!empty($event['Attribute'])):?>
|
|||
if (count($attribute['ShadowAttribute'])) $extra .= 'highlight1';
|
||||
?>
|
||||
<tr>
|
||||
<td class= "short <?php echo $extra; ?>">
|
||||
<?php
|
||||
if (isset($attribute['timestamp'])) echo date('Y-m-d', $attribute['timestamp']);
|
||||
else echo ' ';
|
||||
?>
|
||||
</td>
|
||||
<?php if($first): ?>
|
||||
<td class= "short <?php echo $extra; ?>" title="<?php if('' != $attribute['category']) echo $categoryDefinitions[$attribute['category']]['desc'];?>">
|
||||
<?php
|
||||
|
@ -249,6 +255,7 @@ if (!empty($event['Attribute'])):?>
|
|||
$extra = 'highlight2';
|
||||
foreach ($attribute['ShadowAttribute'] as $shadowAttribute): ?>
|
||||
<tr class="highlight2">
|
||||
<td class= "short <?php echo $extra; ?>"> </td>
|
||||
<td class="short highlight2" title="
|
||||
<?php if('' != $shadowAttribute['category']) echo $categoryDefinitions[$shadowAttribute['category']]['desc'];?>
|
||||
">
|
||||
|
@ -333,6 +340,11 @@ if (!empty($event['Attribute'])):?>
|
|||
//if ($remain === end($remaining)) $extra .= ' highlightBottom';
|
||||
?>
|
||||
<tr class="highlight2">
|
||||
<td class= "short <?php echo $extra; ?>">
|
||||
<?php
|
||||
echo ' ';
|
||||
?>
|
||||
</td>
|
||||
<td class="highlight2" title="<?php if('' != $remain['category']) echo $categoryDefinitions[$remain['category']]['desc'];?>">
|
||||
<?php
|
||||
echo h($remain['category']);
|
||||
|
|
Loading…
Reference in New Issue