rebase continue

pull/5974/head
Vito Piserchia 2020-08-17 17:25:02 +02:00
parent d6f7b07739
commit 7da8b32ada
25 changed files with 34 additions and 111 deletions

View File

@ -5,7 +5,6 @@ require_once 'AppShell.php';
class EventShell extends AppShell
{
public $uses = array('Event', 'Post', 'Attribute', 'Job', 'User', 'Task', 'Whitelist', 'Server', 'Organisation');
public $tasks = array('ConfigLoad');
public function doPublish()
{
@ -300,9 +299,9 @@ class EventShell extends AppShell
$user = $this->User->getAuthUser($userId);
if (empty($user)) die('Invalid user.');
$eventId = $this->args[1];
$modulesRaw = $this->args[2];
$modules = $this->args[2];
try {
$modules = json_decode($modulesRaw, true);
$modules = json_decode($modules);
} catch (Exception $e) {
die('Invalid module JSON');
}
@ -313,7 +312,7 @@ class EventShell extends AppShell
$data = array(
'worker' => 'default',
'job_type' => 'enrichment',
'job_input' => 'Event: ' . $eventId . ' modules: ' . $modulesRaw,
'job_input' => 'Event: ' . $eventId . ' modules: ' . $modules,
'status' => 0,
'retries' => 0,
'org' => $user['Organisation']['name'],
@ -336,7 +335,6 @@ class EventShell extends AppShell
} else {
$job['Job']['message'] = 'Enrichment finished, but no attributes added.';
}
echo $job['Job']['message'] . PHP_EOL;
$this->Job->save($job);
$log = ClassRegistry::init('Log');
$log->create();

View File

@ -294,7 +294,7 @@ class RestResponseComponent extends Component
$action = substr($action, 6);
$admin_routing = 'admin/';
}
$url = $this->baseurl . '/' . $admin_routing . $controller . '/' . $action;
$url = $baseurl . '/' . $admin_routing . $controller . '/' . $action;
$result[$url] = $data;
}
}

View File

@ -29,12 +29,12 @@ class ObjectTemplatesController extends AppController
$items = array();
$items[] = array(
'name' => __('All Objects'),
'value' => $this->baseurl . "/ObjectTemplates/objectChoice/" . h($event_id) . "/" . "0"
'value' => $baseurl . "/ObjectTemplates/objectChoice/" . h($event_id) . "/" . "0"
);
foreach($metas as $meta) {
$items[] = array(
'name' => $meta,
'value' => $this->baseurl . "/ObjectTemplates/objectChoice/" . h($event_id) . "/" . h($meta)
'value' => $baseurl . "/ObjectTemplates/objectChoice/" . h($event_id) . "/" . h($meta)
);
}

View File

@ -1745,7 +1745,7 @@ class ServersController extends AppController
'recommendBackup' => false,
'exitOnError' => false,
'requirements' => '',
'url' => $this->baseurl . '/'
'url' => $baseurl . '/'
);
foreach($actions as $id => $action) {
foreach($default_fields as $field => $value) {

View File

@ -171,7 +171,7 @@ class ShadowAttributesController extends AppController
$response['check_publish'] = true;
$this->set('name', $response['success']);
$this->set('message', $response['success']);
$this->set('url', $this->baseurl . '/shadow_attributes/accept/' . $id);
$this->set('url', $baseurl . '/shadow_attributes/accept/' . $id);
$this->set('_serialize', array('name', 'message', 'url'));
} else {
throw new MethodNotAllowedException($response['errors']);
@ -223,7 +223,7 @@ class ShadowAttributesController extends AppController
if ($this->_isRest()) {
$this->set('name', 'Proposal discarded.');
$this->set('message', 'Proposal discarded.');
$this->set('url', $this->baseurl . '/shadow_attributes/discard/' . $id);
$this->set('url', $baseurl . '/shadow_attributes/discard/' . $id);
$this->set('_serialize', array('name', 'message', 'url'));
} else {
$this->autoRender = false;

View File

@ -364,7 +364,7 @@ class TagsController extends AppController
if ($this->_isRest()) {
$this->set('name', 'Tag deleted.');
$this->set('message', 'Tag deleted.');
$this->set('url', $this->baseurl . '/tags/delete/' . $id);
$this->set('url', $baseurl . '/tags/delete/' . $id);
$this->set('_serialize', array('name', 'message', 'url'));
}
$this->Flash->success(__('Tag deleted'));

View File

@ -5878,7 +5878,7 @@ class Event extends AppModel
$option_fields = array('user', 'event_id', 'modules');
foreach ($option_fields as $option_field) {
if (empty($params[$option_field])) {
throw new MethodNotAllowedException(__('%s not set', $option_field));
throw new MethodNotAllowedException(__('%s not set', $params[$option_field]));
}
}
$event = $this->fetchEvent($params['user'], array('eventid' => $params['event_id'], 'includeAttachments' => 1, 'flatten' => 1));

View File

@ -35,7 +35,6 @@ class Log extends AppModel
'edit',
'email',
'enable',
'enrichment',
'error',
'export',
'fetchEvent',

View File

@ -107,7 +107,7 @@
if ($object['objectType'] == 0) {
if ($object['distribution'] == 4):
?>
<a href="<?php echo $baseurl; ?>/sharing_groups/view/<?php echo h($object['sharing_group_id']); ?>"><?php echo h($object['SharingGroup']['name']);?></a>
<a href="<?php echo $baseurl; ?>/sharing_groups/view/<?php echo h($object['sharing_group_id']); ?>"><?php echo h($object['SharingGroup']['name']);?></a>
<?php
else:
echo h($shortDist[$object['distribution']]);

View File

@ -36,27 +36,15 @@
),
array(
'text' => __('View Proposals'),
<<<<<<< HEAD
'url' => $baseurl . '/shadow_attributes/index/all:0'
||||||| parent of 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
'url' => '/shadow_attributes/index'
=======
'url' => $baseurl . '/shadow_attributes/index'
>>>>>>> 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
),
array(
'text' => __('Events with proposals'),
<<<<<<< HEAD
'url' => $baseurl . '/events/proposalEventIndex'
),
array(
'url' => $baseurl . '/event_delegations/index/context:pending',
'text' => __('View delegation requests')
||||||| parent of 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
'url' => '/events/proposalEventIndex'
=======
'url' => $baseurl . '/events/proposalEventIndex'
>>>>>>> 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
),
array(
'type' => 'separator'
@ -149,13 +137,7 @@
array(
'type' => 'root',
'text' => __('Global Actions'),
<<<<<<< HEAD
'url' => $baseurl . '/dashboards',
||||||| parent of 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
'url' => '/users/dashboard',
=======
'url' => $baseurl . '/users/dashboard',
>>>>>>> 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
'children' => array(
array(
'text' => __('News'),
@ -163,7 +145,6 @@
),
array(
'text' => __('My Profile'),
<<<<<<< HEAD
'url' => $baseurl . '/users/view/me'
),
array(
@ -173,21 +154,10 @@
array(
'text' => __('Set Setting'),
'url' => $baseurl . '/user_settings/setSetting'
||||||| parent of 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
'url' => '/users/view/me'
=======
'url' => $baseurl . '/users/view/me'
>>>>>>> 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
),
array(
'text' => __('Dashboard'),
<<<<<<< HEAD
'url' => $baseurl . '/dashboards'
||||||| parent of 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
'url' => '/users/dashboard'
=======
'url' => $baseurl . '/users/dashboard'
>>>>>>> 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
),
array(
'text' => __('Organisations'),
@ -316,7 +286,6 @@
'children' => array(
array(
'text' => __('List Users'),
<<<<<<< HEAD
'url' => $baseurl . '/admin/users/index'
),
array(
@ -326,11 +295,6 @@
array(
'text' => __('Set User Setting'),
'url' => $baseurl . '/user_settings/setSetting'
||||||| parent of 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
'url' => '/admin/users/index'
=======
'url' => $baseurl . '/admin/users/index'
>>>>>>> 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
),
array(
'text' => __('Add User'),
@ -338,17 +302,11 @@
),
array(
'text' => __('Contact Users'),
<<<<<<< HEAD
'url' => $baseurl . '/admin/users/email'
),
array(
'text' => __('User Registrations'),
'url' => $baseurl . '/users/registrations'
||||||| parent of 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
'url' => '/admin/users/email'
=======
'url' => $baseurl . '/admin/users/email'
>>>>>>> 927499acbc6971b60acf0bae81da62324316660f... Fixed baseurl in JS
),
array(
'type' => 'separator'

View File

@ -479,7 +479,7 @@
$clone.find('strong').text('Synchronization result:');
if (job_sent) {
$clone.find('#submoduleGitResult')
.html('> Synchronizing DB with <a href="<?php echo $baseurl . '/jobs/index/'; ?>" target="_blank">workers</a>...');
.html('> Synchronizing DB with <a href="<?php echo $baseurl . '/jobs/index/'; ?>" target="_blank">workers</a>...');
} else {
$clone.find('#submoduleGitResult')
.text(sync_result);

View File

@ -175,7 +175,7 @@
<script type="text/javascript">
function generate(i, type, id, progress, modified) {
$.ajax({
url: "<?php echo $baseurl; ?>/jobs/cache/" + type,
url: "<?php echo $baseurl; ?>/jobs/cache/" + type,
})
.done(function(data) {
jobsArray[i] = data;

View File

@ -46,8 +46,8 @@
<th><?php echo __('Similar Attributes');?></th>
<th><?php echo __('Category');?></th>
<th><?php echo __('Type');?></th>
<th><?php echo __('IDS');?><input type="checkbox" id="checkAllIDS" style="margin-top:0;margin-left:.3em"></th>
<th style="text-align:center;"><?php echo __('Disable Correlation');?><input type="checkbox" id="checkAllDC" style="margin-top:0;margin-left:.3em"></th>
<th><?php echo __('IDS');?><input type="checkbox" id="checkAllIDS" style="margin-top:23px;margin-left:3px"></th>
<th style="text-align:center;"><?php echo __('Disable Correlation');?><input type="checkbox" id="checkAllDC" style="margini:3px"></th>
<th><?php echo __('Distribution');?></th>
<th><?php echo __('Comment');?></th>
<th><?php echo __('Tags');?></th>

View File

@ -45,7 +45,7 @@ App::uses('AppHelper', 'View/Helper');
} else {
$result = sprintf(
'<a href="%s/organisations/view/%s"><span class="welcome">%s</span></a>',
$baseurl,
$baseurl,
(empty($options['id']) ? h($options['name']) : h($options['id'])),
h($options['name'])
);

View File

@ -105,11 +105,13 @@
foreach ($orgs as $org): ?>
<tr>
<td class="short" ondblclick="document.location.href ='<?php echo $baseurl . "/organisations/view/" . $org['Organisation']['id'];?>'"><?php echo h($org['Organisation']['id']); ?></td>
<td class="short" ondblclick="document.location.href ='<?php echo $baseurl . "/organisations/view/" . $org['Organisation']['id'];?>'">
<?php
echo $this->OrgImg->getOrgImg(array('name' => $org['Organisation']['name'], 'id' => $org['Organisation']['id'], 'size' => 24));
?>
</td>
<td class="short" ondblclick="document.location.href ='<?php echo $baseurl . "/organisations/view/" . $org['Organisation']['id'];?>'"><?php echo h($org['Organisation']['name']); ?></td>
<?php if ($isSiteAdmin): ?>
<td class="short" ondblclick="document.location.href ='<?php echo $baseurl . "/organisations/view/" . $org['Organisation']['id'];?>'"><?php echo h($org['Organisation']['uuid']); ?></td>
<?php endif; ?>
<td ondblclick="document.location.href ='<?php echo $baseurl . "/organisations/view/" . $org['Organisation']['id'];?>'"><?php echo h($org['Organisation']['description']); ?></td>

View File

@ -54,7 +54,7 @@ foreach ($sharingGroups as $k => $sharingGroup):
<td class="short"><?php echo h($sharingGroup['SharingGroup']['id']); ?></td>
<td class="short"><?php echo h($sharingGroup['SharingGroup']['uuid']); ?></td>
<td class="short"><?php echo h($sharingGroup['SharingGroup']['name']); ?></td>
<td class="short"><a href="<?php echo $baseurl; ?>/organisations/view/<?php echo h($sharingGroup['Organisation']['id']);?>"><?php echo h($sharingGroup['Organisation']['name']); ?></a></td>
<td class="short"><a href="<?php echo $baseurl; ?>/organisations/view/<?php echo h($sharingGroup['Organisation']['id']);?>"><?php echo h($sharingGroup['Organisation']['name']); ?></a></td>
<td><?php echo h($sharingGroup['SharingGroup']['description']); ?></td>
<?php
$combined = "";
@ -88,7 +88,7 @@ foreach ($sharingGroups as $k => $sharingGroup):
<?php echo $this->Html->link('', '/SharingGroups/edit/' . $sharingGroup['SharingGroup']['id'], array('class' => 'black fa fa-edit', 'title' => __('Edit'), 'aria-label' => __('Edit'))); ?>
<?php echo $this->Form->postLink('', '/SharingGroups/delete/' . $sharingGroup['SharingGroup']['id'], array('class' => 'black fa fa-trash', 'title' => __('Delete'), 'aria-label' => __('Delete')), __('Are you sure you want to delete %s?', h($sharingGroup['SharingGroup']['name']))); ?>
<?php endif; ?>
<a href="<?php echo $baseurl; ?>/sharing_groups/view/<?php echo $sharingGroup['SharingGroup']['id']; ?>" class="black fa fa-eye" title="<?php echo __('View');?>" aria-label="<?php echo __('View');?>"></a>
<a href="<?php echo $baseurl; ?>/sharing_groups/view/<?php echo $sharingGroup['SharingGroup']['id']; ?>" class="black fa fa-eye" title="<?php echo __('View');?>" aria-label="<?php echo __('View');?>"></a>
</td>
</tr>
<?php

View File

@ -21,12 +21,12 @@
endforeach;
?>
<dt><?php echo __('Created by');?></dt>
<dd><a href="<?php echo $baseurl; ?>/organisations/view/<?php echo $sg['Organisation']['id']; ?>"><?php echo h($sg['Organisation']['name']); ?></a></dd>
<dd><a href="<?php echo $baseurl; ?>/organisations/view/<?php echo $sg['Organisation']['id']; ?>"><?php echo h($sg['Organisation']['name']); ?></a></dd>
<?php
if ($sg['SharingGroup']['sync_user_id']):
?>
<dt><?php echo __('Synced by');?></dt>
<dd><a href="<?php echo $baseurl; ?>/organisations/view/<?php echo $sg['Organisation']['id']; ?>"><?php echo h($sg['Organisation']['name']); ?></a></dd>
<dd><a href="<?php echo $baseurl; ?>/organisations/view/<?php echo $sg['Organisation']['id']; ?>"><?php echo h($sg['Organisation']['name']); ?></a></dd>
<?php
endif;
?>
@ -47,7 +47,7 @@
foreach ($sg['SharingGroupOrg'] as $sgo):
?>
<tr>
<td><a href="<?php echo $baseurl; ?>/organisations/view/<?php echo h($sgo['Organisation']['id']); ?>"><?php echo h($sgo['Organisation']['name']); ?></a></td>
<td><a href="<?php echo $baseurl; ?>/organisations/view/<?php echo h($sgo['Organisation']['id']); ?>"><?php echo h($sgo['Organisation']['name']); ?></a></td>
<td><span class="<?php echo ($sgo['Organisation']['local'] ? 'icon-ok' : 'icon-remove'); ?>"></span></td>
<td><span class="<?php echo ($sgo['extend'] ? 'icon-ok' : 'icon-remove'); ?>"></span></td>
</tr>

View File

@ -50,7 +50,7 @@ $('.sightingsToggle').click(function() {
if (type == 'graph') {
loadSightingGraph(id, object_context);
} else if (type == 'add') {
$.get("<?php echo $baseurl; ?>/sightings/add/" + id, function(data) {
$.get("<?php echo $baseurl; ?>/sightings/add/" + id, function(data) {
$("#sightingsData").html(data);
});
} else {

View File

@ -35,3 +35,4 @@
echo $this->Form->end();
?>
</div>

View File

@ -35,3 +35,4 @@
echo $this->Form->end();
?>
</div>

View File

@ -420,12 +420,9 @@ function drawBarChart(data) {
}
$(document).ready(function() {
var rightBtns = '<div style="float:right;">'
rightBtns += '<span type="button" id="reloadDistributionGraph" title="Reload Distribution Graph" class="fas fa-sync useCursorPointer" aria-hidden="true" style="margin-left: 5px;" onclick="fetchDistributionData(function(data) { construct_piechart(data); });"></span>';
rightBtns += '<button type="button" class="close" style="margin-left: 5px;" onclick="$(\'.distribution_graph\').popover(\'hide\');">×</button>';
rightBtns += '</div>';
var rightBtn = '<div style="float:right;"><span type="button" id="reloadDistributionGraph" title="Reload Distribution Graph" class="fas fa-sync useCursorPointer" aria-hidden="true" style="margin-left: 5px;" onclick="fetchDistributionData(function(data) { construct_piechart(data); });"></span></div>';
var pop = $('.distribution_graph').popover({
title: "<b>Distribution graph</b> [atomic event]" + rightBtns,
title: "<b>Distribution graph</b> [atomic event]" + rightBtn,
html: true,
content: function() { return $('#distribution_graph_container').html(); },
template : '<div class="popover" role="tooltip" style="z-index: 1;"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content" style="padding-left: '+spanOffset_orig+'px; padding-right: '+spanOffset_orig*2+'px;"></div></div>'

View File

@ -2507,3 +2507,4 @@ function isPicture(filename) {
var validExtensions = ['jpg', 'jpeg', 'png', 'gif']
return validExtensions.includes(extension)
}

View File

@ -116,3 +116,4 @@ $(document).ready(() => keyboardShortcutsManager.init());
// Inits the click event on the keyboard shortcut triangle at the bottom of the screen.
$('#triangle').click(keyboardShortcutsManager.onTriangleClick);

View File

@ -1223,18 +1223,6 @@ function submitPopoverForm(context_id, referer, update_context_id, modal, popove
var contextNamingConvention = 'Attribute';
var closePopover = true;
switch (referer) {
case 'add':
url = baseurl + "/attributes/add/" + context_id;
break;
case 'edit':
url = baseurl + "/attributes/edit/" + context_id;
break;
case 'propose':
url = baseurl + "/shadow_attributes/add/" + context_id;
break;
case 'massEdit':
url = baseurl + "/attributes/editSelected/" + context_id;
break;
case 'addTextElement':
context = 'template';
contextNamingConvention = 'TemplateElementText';
@ -2561,9 +2549,8 @@ function serverSettingSubmitForm(name, setting, id) {
function updateOrgCreateImageField(string) {
string = encodeURIComponent(string);
var imgsrc = baseurl + '/img/orgs/' + string + '.png';
$.ajax({
url: imgsrc,
url: baseurl + '/img/orgs/' + string + '.png',
type:'HEAD',
error:
function(){
@ -2571,7 +2558,7 @@ function updateOrgCreateImageField(string) {
},
success:
function(){
$('#logoDiv').html('<img src="' + imgsrc + '" style="width:24px;height:24px;"></img>');
$('#logoDiv').html('<img src="' + baseurl + "/img/orgs/' + string + '.png" + '" style="width:24px;height:24px;"></img>');
}
});
}
@ -4087,29 +4074,6 @@ function loadTagTreemap() {
});
}
function loadSightingsData(timestamp) {
url = baseurl + "/sightings/toplist";
if (timestamp != undefined) {
url += '/' + timestamp;
}
$.ajax({
async:true,
beforeSend: function (XMLHttpRequest) {
$(".loading").show();
},
success:function (data, textStatus) {
$(".sightingsdiv").html(data);
},
complete:function() {
$(".loading").hide();
},
type:"get",
cache: false,
url: url,
>>>>>>> 67fd203dbedfcde42fbc43a483f65368e82d2bdd... rebase
});
}
function quickEditEvent(id, field) {
$.ajax({
async:true,

View File

@ -12,3 +12,4 @@
}
]
}