fix: [CS] tab fixes

pull/4155/head
iglocska 2019-02-13 09:02:23 +01:00
parent 71e44d033e
commit e63d855cbd
27 changed files with 810 additions and 810 deletions

View File

@ -3,30 +3,30 @@
<div class="popover_choice_main" id ="popover_choice_main">
<table style="width:100%;">
<?php
foreach ($exports as $k => $export) {
$tr = 'style="border-bottom:1px solid black;" class="templateChoiceButton"';
$td = sprintf(
'class="" tabindex="0" title="%s" style="%s" data-type="%s"',
__('Export as %s', h($export)),
'padding-left:10px; text-align:center;width:100%;',
h($export)
);
$div = '<div style="height:100%;width:100%;">' . h($export) . '</div>';
$a = sprintf(
'<a href="%s" style="%s" download>%s</a>',
$baseurl . '/attributes/exportSearch/' . h($export),
'color: black; text-decoration: none;',
$div
);
$td = sprintf(
'<td class="export_choice_button" tabindex="0" title="%s", style="%s">%s</td>',
__('Export as %s', h($export)),
'padding-left:10px; text-align:center;width:100%;',
$a
);
echo sprintf('<tr %s>%s</tr>', $tr, $td);
}
?>
foreach ($exports as $k => $export) {
$tr = 'style="border-bottom:1px solid black;" class="templateChoiceButton"';
$td = sprintf(
'class="" tabindex="0" title="%s" style="%s" data-type="%s"',
__('Export as %s', h($export)),
'padding-left:10px; text-align:center;width:100%;',
h($export)
);
$div = '<div style="height:100%;width:100%;">' . h($export) . '</div>';
$a = sprintf(
'<a href="%s" style="%s" download>%s</a>',
$baseurl . '/attributes/exportSearch/' . h($export),
'color: black; text-decoration: none;',
$div
);
$td = sprintf(
'<td class="export_choice_button" tabindex="0" title="%s", style="%s">%s</td>',
__('Export as %s', h($export)),
'padding-left:10px; text-align:center;width:100%;',
$a
);
echo sprintf('<tr %s>%s</tr>', $tr, $td);
}
?>
</table>
</div>
<div role="button" tabindex="0" aria-label="<?php echo __('Cancel');?>" title="<?php echo __('Cancel');?>" class="templateChoiceButton templateChoiceButtonLast" onClick="cancelPopoverForm();"><?php echo __('Cancel');?></div>

View File

@ -2,17 +2,17 @@
<?php
foreach ($results as &$r):
foreach ($r as $k => &$v):
echo sprintf('<span class="bold blue">%s</span>: <br />', Inflector::humanize(h($k)));
if (is_array($v)) {
foreach ($v as $key => $value) {
if (!is_numeric($key)) {
echo '<div class="blue" style="margin-left:10px;">' . h($key) . ':</div>';
}
echo '<div class="red" style="margin-left:20px;"><pre class="red" style="border:0px;background-color:transparent;">' . h($value) . '</pre></div>';
}
} else {
echo '<div style="margin-left:20px;"><pre class="red" style="border:0px;background-color:transparent;">' . h($v) . '</pre></div>';
}
echo sprintf('<span class="bold blue">%s</span>: <br />', Inflector::humanize(h($k)));
if (is_array($v)) {
foreach ($v as $key => $value) {
if (!is_numeric($key)) {
echo '<div class="blue" style="margin-left:10px;">' . h($key) . ':</div>';
}
echo '<div class="red" style="margin-left:20px;"><pre class="red" style="border:0px;background-color:transparent;">' . h($value) . '</pre></div>';
}
} else {
echo '<div style="margin-left:20px;"><pre class="red" style="border:0px;background-color:transparent;">' . h($v) . '</pre></div>';
}
endforeach;
endforeach;
?>

View File

@ -4,26 +4,26 @@
if ($isSearch == 1) {
// The following block should serve as an example and food
// for thought on how to optimize i18n & l10n (especially for languages that are not SOV)
$filterOptions = array(
'value' => __(" with the value containing "),
'tags' => __(" being tagged with "),
'id' => __(" from the events "),
'tag' => __(" carrying the tag(s) "),
'type' => __(" of type "),
'category' => __(" of category "),
'org' => __(" created by organisation ")
);
$temp = '';
foreach ($filterOptions as $fo => $text) {
if (!empty($filters[$fo])) {
$filter_options_string = $filters[$fo];
if (is_array($filter_options_string)) {
$filter_options_string = implode(' OR ', $filter_options_string);
}
$temp .= sprintf('%s <b>%s</b>', $text, h($filter_options_string));
}
}
echo sprintf("<h4>%s%s</h4>", __("Results for all attributes"), $temp);
$filterOptions = array(
'value' => __(" with the value containing "),
'tags' => __(" being tagged with "),
'id' => __(" from the events "),
'tag' => __(" carrying the tag(s) "),
'type' => __(" of type "),
'category' => __(" of category "),
'org' => __(" created by organisation ")
);
$temp = '';
foreach ($filterOptions as $fo => $text) {
if (!empty($filters[$fo])) {
$filter_options_string = $filters[$fo];
if (is_array($filter_options_string)) {
$filter_options_string = implode(' OR ', $filter_options_string);
}
$temp .= sprintf('%s <b>%s</b>', $text, h($filter_options_string));
}
}
echo sprintf("<h4>%s%s</h4>", __("Results for all attributes"), $temp);
}
?>
<div class="pagination">
@ -42,82 +42,82 @@
?>
</ul>
</div>
<?php
$headers = array(
$this->Paginator->sort('date'),
$this->Paginator->sort('event_id'),
$this->Paginator->sort('Event.orgc_id', 'Org'),
$this->Paginator->sort('category'),
$this->Paginator->sort('type'),
$this->Paginator->sort('value'),
__('Tags'),
__('Galaxies'),
$this->Paginator->sort('comment'),
__('Correlate'),
__('Related Events'),
__('Feed hits'),
sprintf('<span title="%s">%s</th>', $attrDescriptions['signature']['desc'], $this->Paginator->sort('IDS')),
$this->Paginator->sort('distribution'),
__('Sightings'),
__('Activity'),
__('Actions')
);
foreach ($headers as $k => &$header) {
if ($k == (count($headers)-1)) {
$header = sprintf('<th title="%s">%s</th>', $attrDescriptions['signature']['desc'], $header);
} else {
$header = sprintf('<th>%s</th>', $header);
}
}
$rows = array(
sprintf('<tr>%s</tr>', implode('', $headers))
);
$currentCount = 0;
if ($isSearch == 1) {
// sanitize data
$toHighlight = array('value', 'comment');
$keywordArray = array();
foreach ($toHighlight as $highlightedElement) {
if (!empty($filters[$highlightedElement])) {
if (!is_array($filters[$highlightedElement])) {
$filters[$highlightedElement] = array($filters[$highlightedElement]);
}
foreach ($filters[$highlightedElement] as $highlightedString) {
$keywordArray[] = $highlightedString;
}
}
}
// build the $replacePairs variable used to highlight the keywords
$replacePairs = $this->Highlight->build_replace_pairs($keywordArray);
}
foreach ($attributes as $k => $attribute) {
$event = array(
'Event' => $attribute['Event'],
'Orgc' => $attribute['Event']['Orgc'],
);
$mayModify = ($isSiteAdmin || ($isAclModify && $event['Event']['user_id'] == $me['id'] && $attribute['Event']['orgc_id'] == $me['org_id']) || ($isAclModifyOrg && $attribute['Event']['orgc_id'] == $me['org_id']));
$mayPublish = ($isAclPublish && $attribute['Event']['orgc_id'] == $me['org_id']);
$mayChangeCorrelation = !Configure::read('MISP.completely_disable_correlation') && ($isSiteAdmin || ($mayModify && Configure::read('MISP.allow_disabling_correlation')));
$mayModify = $attribute['Event']['orgc_id'] === $me['org_id'] ? true : false;
if (!empty($attribute['Attribute']['RelatedAttribute'])) {
$event['RelatedAttribute'] = array($attribute['Attribute']['id'] => $attribute['Attribute']['RelatedAttribute']);
}
$rows[] = $this->element('/Events/View/row_attribute', array(
'object' => $attribute['Attribute'],
'k' => $k,
'mayModify' => $mayModify,
'mayChangeCorrelation' => $mayChangeCorrelation,
'page' => 1,
'fieldCount' => 11,
'includeRelatedTags' => 0,
'event' => $event,
'me' => $me,
'extended' => 1,
'disable_multi_select' => 1,
'context' => 'list'
));
}
echo sprintf('<table class="table table-striped table-hover table-condensed">%s</table>', implode('', $rows));
<?php
$headers = array(
$this->Paginator->sort('date'),
$this->Paginator->sort('event_id'),
$this->Paginator->sort('Event.orgc_id', 'Org'),
$this->Paginator->sort('category'),
$this->Paginator->sort('type'),
$this->Paginator->sort('value'),
__('Tags'),
__('Galaxies'),
$this->Paginator->sort('comment'),
__('Correlate'),
__('Related Events'),
__('Feed hits'),
sprintf('<span title="%s">%s</th>', $attrDescriptions['signature']['desc'], $this->Paginator->sort('IDS')),
$this->Paginator->sort('distribution'),
__('Sightings'),
__('Activity'),
__('Actions')
);
foreach ($headers as $k => &$header) {
if ($k == (count($headers)-1)) {
$header = sprintf('<th title="%s">%s</th>', $attrDescriptions['signature']['desc'], $header);
} else {
$header = sprintf('<th>%s</th>', $header);
}
}
$rows = array(
sprintf('<tr>%s</tr>', implode('', $headers))
);
$currentCount = 0;
if ($isSearch == 1) {
// sanitize data
$toHighlight = array('value', 'comment');
$keywordArray = array();
foreach ($toHighlight as $highlightedElement) {
if (!empty($filters[$highlightedElement])) {
if (!is_array($filters[$highlightedElement])) {
$filters[$highlightedElement] = array($filters[$highlightedElement]);
}
foreach ($filters[$highlightedElement] as $highlightedString) {
$keywordArray[] = $highlightedString;
}
}
}
// build the $replacePairs variable used to highlight the keywords
$replacePairs = $this->Highlight->build_replace_pairs($keywordArray);
}
foreach ($attributes as $k => $attribute) {
$event = array(
'Event' => $attribute['Event'],
'Orgc' => $attribute['Event']['Orgc'],
);
$mayModify = ($isSiteAdmin || ($isAclModify && $event['Event']['user_id'] == $me['id'] && $attribute['Event']['orgc_id'] == $me['org_id']) || ($isAclModifyOrg && $attribute['Event']['orgc_id'] == $me['org_id']));
$mayPublish = ($isAclPublish && $attribute['Event']['orgc_id'] == $me['org_id']);
$mayChangeCorrelation = !Configure::read('MISP.completely_disable_correlation') && ($isSiteAdmin || ($mayModify && Configure::read('MISP.allow_disabling_correlation')));
$mayModify = $attribute['Event']['orgc_id'] === $me['org_id'] ? true : false;
if (!empty($attribute['Attribute']['RelatedAttribute'])) {
$event['RelatedAttribute'] = array($attribute['Attribute']['id'] => $attribute['Attribute']['RelatedAttribute']);
}
$rows[] = $this->element('/Events/View/row_attribute', array(
'object' => $attribute['Attribute'],
'k' => $k,
'mayModify' => $mayModify,
'mayChangeCorrelation' => $mayChangeCorrelation,
'page' => 1,
'fieldCount' => 11,
'includeRelatedTags' => 0,
'event' => $event,
'me' => $me,
'extended' => 1,
'disable_multi_select' => 1,
'context' => 'list'
));
}
echo sprintf('<table class="table table-striped table-hover table-condensed">%s</table>', implode('', $rows));
?>
<p>
<?php
@ -157,30 +157,30 @@ $(document).ready(function () {
$('.screenshot').click(function() {
screenshotPopup($(this).attr('src'), $(this).attr('title'));
});
$('.addGalaxy').click(function() {
addGalaxyListener(this);
});
$('.sightings_advanced_add').click(function() {
var selected = [];
var object_context = $(this).data('object-context');
var object_id = $(this).data('object-id');
if (object_id == 'selected') {
$(".select_attribute").each(function() {
if ($(this).is(":checked")) {
selected.push($(this).data("id"));
}
});
object_id = selected.join('|');
}
url = "<?php echo $baseurl; ?>" + "/sightings/advanced/" + object_id + "/" + object_context;
genericPopup(url, '#screenshot_box');
});
$('.correlation-toggle').click(function() {
var attribute_id = $(this).data('attribute-id');
getPopup(attribute_id, 'attributes', 'toggleCorrelation', '', '#confirmation_box');
return false;
});
popoverStartup();
$('.addGalaxy').click(function() {
addGalaxyListener(this);
});
$('.sightings_advanced_add').click(function() {
var selected = [];
var object_context = $(this).data('object-context');
var object_id = $(this).data('object-id');
if (object_id == 'selected') {
$(".select_attribute").each(function() {
if ($(this).is(":checked")) {
selected.push($(this).data("id"));
}
});
object_id = selected.join('|');
}
url = "<?php echo $baseurl; ?>" + "/sightings/advanced/" + object_id + "/" + object_context;
genericPopup(url, '#screenshot_box');
});
$('.correlation-toggle').click(function() {
var attribute_id = $(this).data('attribute-id');
getPopup(attribute_id, 'attributes', 'toggleCorrelation', '', '#confirmation_box');
return false;
});
popoverStartup();
$(document).on('click', function (e) {
//did not click a popover toggle or popover
if ($(e.target).data('toggle') !== 'popover'

View File

@ -17,8 +17,8 @@
'rows' => 2,
'class' => 'input-xxlarge'));
echo $this->Form->input('type', array(
'div' => 'input clear',
'required' => false
'div' => 'input clear',
'required' => false
));
echo $this->Form->input('category', array('required' => false));
?>
@ -35,8 +35,8 @@
?>
</fieldset>
<?php
echo $this->Form->button('Search', array('class' => 'btn btn-primary'));
echo $this->Form->end();
echo $this->Form->button('Search', array('class' => 'btn btn-primary'));
echo $this->Form->end();
?>
</div>
<script type="text/javascript">
@ -201,5 +201,5 @@ $('.input-xxlarge').keydown(function (e) {
</script>
<?php
echo $this->element('side_menu', array('menuList' => 'event-collection', 'menuItem' => 'searchAttributes'));
echo $this->Js->writeBuffer();
echo $this->Js->writeBuffer();
?>

View File

@ -1,7 +1,7 @@
<?php
$tr_class = '';
if (empty($context)) {
$context = 'event';
$context = 'event';
}
$linkClass = 'blue';
if ($event['Event']['id'] != $object['event_id']) {
@ -111,23 +111,23 @@
<div id = "Attribute_<?php echo $object['id']; ?>_value_solid" class="inline-field-solid">
<span>
<?php
$spanExtra = '';
$popupButton = '';
if (Configure::read('Plugin.Enrichment_hover_enable') && isset($modules) && isset($modules['hover_type'][$object['type']])) {
$commonDataFields = sprintf(
'data-object-type="%s" data-object-id="%s"',
"Attribute",
h($object['id'])
);
$spanExtra = sprintf(' class="eventViewAttributeHover" %s', $commonDataFields);
$popupButton = sprintf('<i class="fa fa-search-plus useCursorPointer eventViewAttributePopup" %s></i>', $commonDataFields);
}
echo sprintf(
'<span%s style="white-space: pre-wrap;">%s</span> %s',
$spanExtra,
$this->element('/Events/View/value_field', array('object' => $object, 'linkClass' => $linkClass)),
$popupButton
);
$spanExtra = '';
$popupButton = '';
if (Configure::read('Plugin.Enrichment_hover_enable') && isset($modules) && isset($modules['hover_type'][$object['type']])) {
$commonDataFields = sprintf(
'data-object-type="%s" data-object-id="%s"',
"Attribute",
h($object['id'])
);
$spanExtra = sprintf(' class="eventViewAttributeHover" %s', $commonDataFields);
$popupButton = sprintf('<i class="fa fa-search-plus useCursorPointer eventViewAttributePopup" %s></i>', $commonDataFields);
}
echo sprintf(
'<span%s style="white-space: pre-wrap;">%s</span> %s',
$spanExtra,
$this->element('/Events/View/value_field', array('object' => $object, 'linkClass' => $linkClass)),
$popupButton
);
?>
</span>
<?php
@ -150,19 +150,19 @@
<?php echo $this->element('ajaxAttributeTags', array('attributeId' => $object['id'], 'attributeTags' => $object['AttributeTag'], 'tagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id']), 'context' => $context)); ?>
</div>
</td>
<?php
if (!empty($includeRelatedTags)) {
$element = '';
if (!empty($object['RelatedTags'])) {
$element = $this->element('ajaxAttributeTags', array('attributeId' => $object['id'], 'attributeTags' => $object['RelatedTags'], 'tagAccess' => false));
}
echo sprintf(
'<td class="shortish"><div %s>%s</div></td>',
'class="attributeRelatedTagContainer" id="#Attribute_' . h($object['id']) . 'Related_tr .attributeTagContainer"',
$element
);
}
?>
<?php
if (!empty($includeRelatedTags)) {
$element = '';
if (!empty($object['RelatedTags'])) {
$element = $this->element('ajaxAttributeTags', array('attributeId' => $object['id'], 'attributeTags' => $object['RelatedTags'], 'tagAccess' => false));
}
echo sprintf(
'<td class="shortish"><div %s>%s</div></td>',
'class="attributeRelatedTagContainer" id="#Attribute_' . h($object['id']) . 'Related_tr .attributeTagContainer"',
$element
);
}
?>
<td class="short" id="attribute_<?php echo h($object['id']); ?>_galaxy">
<?php
echo $this->element('galaxyQuickViewMini', array(

View File

@ -2,12 +2,12 @@
<button type="button" class="close" data-dismiss="alert">&times;</button>
<?php
$message = h($message);
if (strpos('$flashErrorMessage', $message) >= 0) {
$message = str_replace('$flashErrorMessage', '<span class="useCursorPointer underline bold" onClick="flashErrorPopover();">here</span>', $message);
}
echo $message;
if ($this->Session->read('flashErrorMessage')) {
echo sprintf('<div class="hidden" id="flashErrorMessage">%s</div>', $this->element('flashErrorMessage', array('message' => $this->Session->read('flashErrorMessage'))));
}
?>
if (strpos('$flashErrorMessage', $message) >= 0) {
$message = str_replace('$flashErrorMessage', '<span class="useCursorPointer underline bold" onClick="flashErrorPopover();">here</span>', $message);
}
echo $message;
if ($this->Session->read('flashErrorMessage')) {
echo sprintf('<div class="hidden" id="flashErrorMessage">%s</div>', $this->element('flashErrorMessage', array('message' => $this->Session->read('flashErrorMessage'))));
}
?>
</div>

View File

@ -1,8 +1,8 @@
<div style="width:100%;display:inline-block;">
<?php
if (empty($context)) {
$context = 'event';
}
if (empty($context)) {
$context = 'event';
}
$full = $isAclTagger && $tagAccess;
foreach ($attributeTags as $tag):
if (!isset($tag['Tag'])) $tag = array('Tag' => $tag);
@ -34,16 +34,16 @@
endforeach;
?>
<div style="float:left">
<?php
$addTagButton = '&nbsp;';
if ($full) {
$addTagButton = sprintf(
'<button id="addTagButton" class="btn btn-inverse noPrint" style="line-height:10px; padding: 4px 4px;" title="%s" onClick="popoverPopup(this, %s);">+</button>',
<?php
$addTagButton = '&nbsp;';
if ($full) {
$addTagButton = sprintf(
'<button id="addTagButton" class="btn btn-inverse noPrint" style="line-height:10px; padding: 4px 4px;" title="%s" onClick="popoverPopup(this, %s);">+</button>',
__("Add tag"),
sprintf("'%s/attribute', 'tags', 'selectTaxonomy'", h($attributeId))
);
}
echo $addTagButton;
?>
sprintf("'%s/attribute', 'tags', 'selectTaxonomy'", h($attributeId))
);
}
echo $addTagButton;
?>
</div>
</div>

View File

@ -1,8 +1,8 @@
<div style="width:100%;display:inline-block;">
<?php
if (empty($context)) {
$context = 'event';
}
if (empty($context)) {
$context = 'event';
}
$full = $isAclTagger && $tagAccess;
foreach ($tagCollection['TagCollectionTag'] as $tag):
if (!isset($tag['Tag'])) $tag = array('Tag' => $tag);
@ -22,15 +22,15 @@
endforeach;
?>
<div style="float:left">
<?php
$addTagButton = '&nbsp;';
if ($full) {
$addTagButton = sprintf(
'<button id="addTagButton" class="btn btn-inverse noPrint" style="line-height:10px; padding: 4px 4px;" onClick="popoverPopup(this, %s);">+</button>',
sprintf("'%s/tag_collection', 'tags', 'selectTaxonomy'", h($tagCollection['TagCollection']['id']))
);
}
echo $addTagButton;
?>
<?php
$addTagButton = '&nbsp;';
if ($full) {
$addTagButton = sprintf(
'<button id="addTagButton" class="btn btn-inverse noPrint" style="line-height:10px; padding: 4px 4px;" onClick="popoverPopup(this, %s);">+</button>',
sprintf("'%s/tag_collection', 'tags', 'selectTaxonomy'", h($tagCollection['TagCollection']['id']))
);
}
echo $addTagButton;
?>
</div>
</div>

View File

@ -153,7 +153,7 @@
<div id="filter_deleted" title="<?php echo __('Include deleted attributes');?>" role="button" tabindex="0" aria-label="<?php echo __('Include deleted attributes');?>" class="attribute_filter_text<?php if ($deleted) echo '_active'; ?>" onClick="toggleBoolFilter('<?php echo $urlHere;?>', 'deleted');"><?php echo __('Deleted');?></div>
<?php endif; ?>
<div id="show_context" title="<?php echo __('Show attribute context fields');?>" role="button" tabindex="0" aria-label="<?php echo __('Show attribute context fields');?>" class="attribute_filter_text" onClick="toggleContextFields();"><?php echo __('Context');?></div>
<div id="show_correlating_tags" title="<?php echo __('Also display the tags derived from correlations');?>" role="button" tabindex="0" aria-label="<?php echo __('Also display the tags derived from correlations');?>" class="attribute_filter_text<?php if ($includeRelatedTags) echo '_active'; ?>" onClick="toggleBoolFilter('<?php echo $urlHere;?>', 'includeRelatedTags');"><?php echo __('Related Tags');?></div>
<div id="show_correlating_tags" title="<?php echo __('Also display the tags derived from correlations');?>" role="button" tabindex="0" aria-label="<?php echo __('Also display the tags derived from correlations');?>" class="attribute_filter_text<?php if ($includeRelatedTags) echo '_active'; ?>" onClick="toggleBoolFilter('<?php echo $urlHere;?>', 'includeRelatedTags');"><?php echo __('Related Tags');?></div>
<div title="input filter" tabindex="0" aria-label="input filter" class="attribute_filter_text" style="padding-top:0px;">
<input type="text" id="attributesFilterField" style="height:20px;padding:0px;margin:0px;" class="form-control" data-eventid="<?php echo h($event['Event']['id']); ?>" value="<?php if ($filtered) echo h($passedArgsArray['all']); ?>"></input>
<span id="attributesFilterButton" role="button" class="icon-search" tabindex="0" aria-label="<?php echo __('Filter on attributes value');?>" onClick="filterAttributes('value', '<?php echo h($event['Event']['id']); ?>');"></span>
@ -188,12 +188,12 @@
<th><?php echo $this->Paginator->sort('type');?></th>
<th><?php echo $this->Paginator->sort('value');?></th>
<th><?php echo __('Tags');?></th>
<?php
if ($includeRelatedTags) {
echo sprintf('<th>%s</th>', __('Related Tags'));
}
$fieldCount += 1;
?>
<?php
if ($includeRelatedTags) {
echo sprintf('<th>%s</th>', __('Related Tags'));
}
$fieldCount += 1;
?>
<th><?php echo __('Galaxies');?></th>
<th><?php echo $this->Paginator->sort('comment');?></th>
<th><?php echo __('Correlate');?></th>
@ -222,7 +222,7 @@
'mayChangeCorrelation' => $mayChangeCorrelation,
'page' => $page,
'fieldCount' => $fieldCount,
'includeRelatedTags' => !empty($includeRelatedTags) ? 1 : 0
'includeRelatedTags' => !empty($includeRelatedTags) ? 1 : 0
));
if (!empty($focus) && ($object['objectType'] == 'object' || $object['objectType'] == 'attribute') && $object['uuid'] == $focus) {
$focusedRow = $k;
@ -287,7 +287,7 @@ attributes or the appropriate distribution level. If you think there is a mistak
var timer;
var lastSelected = false;
var deleted = <?php echo (!empty($deleted)) ? '1' : '0';?>;
var includeRelatedTags = <?php echo (!empty($includeRelatedTags)) ? '1' : '0';?>;
var includeRelatedTags = <?php echo (!empty($includeRelatedTags)) ? '1' : '0';?>;
$(document).ready(function() {
$('.addGalaxy').click(function() {
addGalaxyListener(this);
@ -385,27 +385,27 @@ attributes or the appropriate distribution level. If you think there is a mistak
}
});
$(".eventViewAttributeHover").mouseenter(function() {
$('.popover').remove();
type = $(this).attr('data-object-type');
id = $(this).attr('data-object-id');
if (type + "_" + id in ajaxResults["hover"]) {
$('#' + type + '_' + id + '_container').popover({
title: 'Lookup results:',
content: ajaxResults["hover"][type + "_" + id],
placement: 'top',
html: true,
trigger: 'hover',
container: 'body'
}).popover('show');
} else {
timer = setTimeout(function() {
runHoverLookup(type, id)
},
500
);
}
$('.popover').remove();
type = $(this).attr('data-object-type');
id = $(this).attr('data-object-id');
if (type + "_" + id in ajaxResults["hover"]) {
$('#' + type + '_' + id + '_container').popover({
title: 'Lookup results:',
content: ajaxResults["hover"][type + "_" + id],
placement: 'top',
html: true,
trigger: 'hover',
container: 'body'
}).popover('show');
} else {
timer = setTimeout(function() {
runHoverLookup(type, id)
},
500
);
}
}).mouseleave(function() {
clearTimeout(timer);
clearTimeout(timer);
});
</script>
<?php

View File

@ -1,4 +1,4 @@
<?php
<?php
$fixed_fields = array('synonyms', 'description', 'meta', 'authors', 'source');
foreach ($data as $galaxy):
?>
@ -12,9 +12,9 @@
?>
<div style="margin-left:8px;">
<span class="bold blue expandContainer">
<span class="collapse-status-container useCursorPointer">
<span class="collapse-status" style="font-size: 16px;">+</span>
</span>
<span class="collapse-status-container useCursorPointer">
<span class="collapse-status" style="font-size: 16px;">+</span>
</span>
<span><?php echo h($cluster['value']); ?></span>
<a href="<?php echo $baseurl; ?>/galaxy_clusters/view/<?php echo h($cluster['id']); ?>" class="icon-search" title="<?php echo __('View details about this cluster');?>"></a>&nbsp;
<a href="<?php echo $baseurl; ?>/events/index/searchtag:<?php echo h($cluster['tag_id']); ?>" class="icon-th-list" title="<?php echo __('View all events containing this cluster.');?>"></a>

View File

@ -2,12 +2,12 @@
<?php
if (!$worker_array['proc_accessible']):
?>
<div style="background-color:red !important;color:white;"><b><?php echo __('Warning');?></b>: <?php echo __('MISP cannot access your /proc directory to check the status of the worker processes, which means that dead workers will not be detected by the diagnostic tool. If you would like to regain this functionality, make sure that the open_basedir directive is not set, or that /proc is included in it.');?></div>
<div style="background-color:red !important;color:white;"><b><?php echo __('Warning');?></b>: <?php echo __('MISP cannot access your /proc directory to check the status of the worker processes, which means that dead workers will not be detected by the diagnostic tool. If you would like to regain this functionality, make sure that the open_basedir directive is not set, or that /proc is included in it.');?></div>
<?php
endif;
if (!$worker_array['controls']):
endif;
if (!$worker_array['controls']):
?>
<div><b><?php echo __('Note:');?></b>: <?php echo __('You have set the "manage_workers" variable to "false", therefore worker controls have been disabled.');?></div>
<div><b><?php echo __('Note:');?></b>: <?php echo __('You have set the "manage_workers" variable to "false", therefore worker controls have been disabled.');?></div>
<?php
endif;
foreach ($worker_array as $type => $data):
@ -102,9 +102,9 @@
<td style="<?php echo $style; ?>"><?php echo $message; ?></td>
<td class="actions short" style="<?php echo $style; ?>">
<?php
if ($worker_array['controls']) {
echo $this->Form->postLink('', '/servers/stopWorker/' . h($worker['pid']), array('class' => 'icon-trash' . $icon_modifier, 'title' => __('Stop (if still running) and remove this worker. This will immediately terminate any jobs that are being executed by it.')));
}
if ($worker_array['controls']) {
echo $this->Form->postLink('', '/servers/stopWorker/' . h($worker['pid']), array('class' => 'icon-trash' . $icon_modifier, 'title' => __('Stop (if still running) and remove this worker. This will immediately terminate any jobs that are being executed by it.')));
}
?>
</td>
</tr>
@ -114,11 +114,11 @@
?>
</table>
<?php
if ($worker_array['controls']) {
echo $this->Form->create('Server', array('url' => '/servers/startWorker/' . h($type)));
echo $this->Form->button(__('Start a worker'), array('class' => 'btn btn-inverse'));
echo $this->Form->end();
}
if ($worker_array['controls']) {
echo $this->Form->create('Server', array('url' => '/servers/startWorker/' . h($type)));
echo $this->Form->button(__('Start a worker'), array('class' => 'btn btn-inverse'));
echo $this->Form->end();
}
endforeach;
?>
@ -126,8 +126,8 @@
<?php
if ($worker_array['controls']) {
echo $this->Form->create('Server', array('url' => '/servers/restartWorkers'));
echo $this->Form->button(__('Restart all workers'), array('class' => 'btn btn-primary'));
echo $this->Form->end();
echo $this->Form->create('Server', array('url' => '/servers/restartWorkers'));
echo $this->Form->button(__('Restart all workers'), array('class' => 'btn btn-primary'));
echo $this->Form->end();
}
?>

View File

@ -252,13 +252,13 @@
));
if ($menuItem == 'searchAttributes2') {
echo $this->element('/side_menu_divider');
echo $this->element('/side_menu_link', array(
'onClick' => array(
'function' => 'getPopup',
'params' => array(0, 'attributes', 'exportSearch')
),
'text' => __('Download as...')
));
echo $this->element('/side_menu_link', array(
'onClick' => array(
'function' => 'getPopup',
'params' => array(0, 'attributes', 'exportSearch')
),
'text' => __('Download as...')
));
}
echo $this->element('/side_menu_divider');
echo $this->element('/side_menu_link', array(

View File

@ -4,83 +4,83 @@
To to make this functionality available for automated tools an authentication key is used.');?>
<br />You can use the <a href="<?php echo $baseurl;?>/servers/rest">ReST client</a> to test your API queries against your MISP and export the resulting tuned queries as curl or python scripts.
<strong><?php echo __('Make sure you keep your API key secret as it gives access to the all of the data that you normally have access to in MISP.');?></strong>
To view the old MISP automation page, click <a href="<?php echo $baseurl; ?>/events/automation/1">here</a>.
</p>
To view the old MISP automation page, click <a href="<?php echo $baseurl; ?>/events/automation/1">here</a>.
</p>
<p><?php echo __('Your current key is: <code>%s</code>.
You can %s this key.', $me['authkey'], $this->Html->link(__('reset'), array('controller' => 'users', 'action' => 'resetauthkey', 'me')));?>
</p>
<?php
$data = array(
'title' => __('Search'),
'description' => array(
__('It is possible to search the database for attributes based on a list of criteria.'),
__('To return an event or a list of events in a desired format, use the following syntax'),
__('Whilst a list of parameters is provided below, it isn\'t necessarily exhaustive, specific export formats could have additional parameters.')
),
'parameters' => array(
"returnFormat" => __('Set the return format of the search (Currently supported: json, xml, openioc, suricata, snort - more formats are being moved to restSearch with the goal being that all searches happen through this API). Can be passed as the first parameter after restSearch or via the JSON payload.'),
"limit" => __('Limit the number of results returned, depending on the scope (for example 10 attributes or 10 full events).'),
"page" => __('If a limit is set, sets the page to be returned. page 3, limit 100 will return records 201->300).'),
"value" => __('Search for the given value in the attributes\' value field.'),
"type" => __('The attribute type, any valid MISP attribute type is accepted.'),
"category" => __('The attribute category, any valid MISP attribute category is accepted.'),
"org" => __('Search by the creator organisation by supplying the organisation identifier.'),
"tags" => __('To include a tag in the results just write its names into this parameter. To exclude a tag prepend it with a \'!\'.'),
"quickfilter" => __('Enabling this (by passing "1" as the argument) will make the search ignore all of the other arguments, except for the auth key and value. MISP will return an xml / json (depending on the header sent) of all events that have a sub-string match on value in the event info, event orgc, or any of the attribute value1 / value2 fields, or in the attribute comment.'),
"from" => __('Events with the date set to a date after the one specified in the from field (format: 2015-02-15). This filter will use the date of the event.'),
"to" => __('Events with the date set to a date before the one specified in the to field (format: 2015-02-15). This filter will use the date of the event.'),
"eventid" => __('The events that should be included / excluded from the search'),
"withAttachments" => __('If set, encodes the attachments / zipped malware samples as base64 in the data field within each attribute'),
"metadata" => __('Only the metadata (event, tags, relations) is returned, attributes and proposals are omitted.'),
"uuid" => __('Restrict the results by uuid.'),
"publish_timestamp" => __('Restrict the results by the timestamp of the last publishing of the event. The input can be a timetamp or a short-hand time description (7d or 24h for example). You can also pass a list with two values to set a time range (for example ["14d", "7d"]).'),
<?php
$data = array(
'title' => __('Search'),
'description' => array(
__('It is possible to search the database for attributes based on a list of criteria.'),
__('To return an event or a list of events in a desired format, use the following syntax'),
__('Whilst a list of parameters is provided below, it isn\'t necessarily exhaustive, specific export formats could have additional parameters.')
),
'parameters' => array(
"returnFormat" => __('Set the return format of the search (Currently supported: json, xml, openioc, suricata, snort - more formats are being moved to restSearch with the goal being that all searches happen through this API). Can be passed as the first parameter after restSearch or via the JSON payload.'),
"limit" => __('Limit the number of results returned, depending on the scope (for example 10 attributes or 10 full events).'),
"page" => __('If a limit is set, sets the page to be returned. page 3, limit 100 will return records 201->300).'),
"value" => __('Search for the given value in the attributes\' value field.'),
"type" => __('The attribute type, any valid MISP attribute type is accepted.'),
"category" => __('The attribute category, any valid MISP attribute category is accepted.'),
"org" => __('Search by the creator organisation by supplying the organisation identifier.'),
"tags" => __('To include a tag in the results just write its names into this parameter. To exclude a tag prepend it with a \'!\'.'),
"quickfilter" => __('Enabling this (by passing "1" as the argument) will make the search ignore all of the other arguments, except for the auth key and value. MISP will return an xml / json (depending on the header sent) of all events that have a sub-string match on value in the event info, event orgc, or any of the attribute value1 / value2 fields, or in the attribute comment.'),
"from" => __('Events with the date set to a date after the one specified in the from field (format: 2015-02-15). This filter will use the date of the event.'),
"to" => __('Events with the date set to a date before the one specified in the to field (format: 2015-02-15). This filter will use the date of the event.'),
"eventid" => __('The events that should be included / excluded from the search'),
"withAttachments" => __('If set, encodes the attachments / zipped malware samples as base64 in the data field within each attribute'),
"metadata" => __('Only the metadata (event, tags, relations) is returned, attributes and proposals are omitted.'),
"uuid" => __('Restrict the results by uuid.'),
"publish_timestamp" => __('Restrict the results by the timestamp of the last publishing of the event. The input can be a timetamp or a short-hand time description (7d or 24h for example). You can also pass a list with two values to set a time range (for example ["14d", "7d"]).'),
"last" => __('(Deprecated synonym for publish_timestamp) Restrict the results by the timestamp of the last publishing of the event. The input can be a timetamp or a short-hand time description (7d or 24h for example). You can also pass a list with two values to set a time range (for example ["14d", "7d"]).'),
"timestamp" => __('Restrict the results by the timestamp (last edit). Any event with a timestamp newer than the given timestamp will be returned. In case you are dealing with /attributes as scope, the attribute\'s timestamp will be used for the lookup. The input can be a timetamp or a short-hand time description (7d or 24h for example). You can also pass a list with two values to set a time range (for example ["14d", "7d"]).'),
"published" => __('Set whether published or unpublished events should be returned. Do not set the parameter if you want both.'),
"enforceWarninglist" => __('Remove any attributes from the result that would cause a hit on a warninglist entry.'),
"to_ids" => __('By default (0) all attributes are returned that match the other filter parameters, irregardless of their to_ids setting. To restrict the returned data set to to_ids only attributes set this parameter to 1. You can only use the special "exclude" setting to only return attributes that have the to_ids flag disabled.'),
"deleted" => __('If this parameter is set to 1, it will return soft-deleted attributes along with active ones. By using "only" as a parameter it will limit the returned data set to soft-deleted data only.'),
"includeEventUuid" => __('Instead of just including the event ID, also include the event UUID in each of the attributes.'),
"event_timestamp" => __('Only return attributes from events that have received a modification after the given timestamp. The input can be a timetamp or a short-hand time description (7d or 24h for example). You can also pass a list with two values to set a time range (for example ["14d", "7d"]).'),
"sgReferenceOnly" => __('If this flag is set, sharing group objects will not be included, instead only the sharing group ID is set.'),
"eventinfo" => __("Filter on the event's info field."),
"searchall" => __("Search for a full or a substring (delimited by % for substrings) in the event info, event tags, attribute tags, attribute values or attribute comment fields."),
"requested_attributes" => __("CSV only, select the fields that you wish to include in the CSV export. By setting event level fields additionally, includeContext is not required to get event metadata."),
"includeContext" => __("CSV only, add additional event level data to the export. The additional fields can be added via requested_attributes too with more granularity.")
),
'url' => array(
$baseurl . '/attributes/restSearch',
$baseurl . '/events/restSearch'
)
);
echo sprintf('<h3>%s</h3>', $data['title']);
echo sprintf('<p>%s</p>', implode(" ", $data['description']));
echo sprintf("<pre>%s</pre>", implode("\n", $data['url']));
foreach ($data['parameters'] as $k => $v) {
echo sprintf('<span class="bold">%s</span>: %s<br />', $k, $v);
}
$description = 'To export all attributes of types ip-src and ip-dst that have a TLP marking and are not marked TLP:red, use the syntax below. String searches are by default exact lookups, but you can use mysql style "%" wildcards to do substring searches.';
$url = $baseurl . '/attributes/restSearch';
$headers = array(
'Accept: application/json',
'Content-type: application/json',
'Authorization: ' . $me['authkey']
);
$headers = implode("\n", $headers);
$body = json_encode(
array(
'returnFormat' => 'json',
'type' => array('OR' => array('ip-src', 'ip-dst')),
'tags' => array('NOT' => array('tlp:red'), 'OR' => array('tlp:%')),
), JSON_PRETTY_PRINT);
echo sprintf('<p>%s</p>URL:<pre>%s</pre>Headers:<pre>%s</pre>Body:<pre class="red">%s</pre>', $description, $url, $headers, $body);
?>
"timestamp" => __('Restrict the results by the timestamp (last edit). Any event with a timestamp newer than the given timestamp will be returned. In case you are dealing with /attributes as scope, the attribute\'s timestamp will be used for the lookup. The input can be a timetamp or a short-hand time description (7d or 24h for example). You can also pass a list with two values to set a time range (for example ["14d", "7d"]).'),
"published" => __('Set whether published or unpublished events should be returned. Do not set the parameter if you want both.'),
"enforceWarninglist" => __('Remove any attributes from the result that would cause a hit on a warninglist entry.'),
"to_ids" => __('By default (0) all attributes are returned that match the other filter parameters, irregardless of their to_ids setting. To restrict the returned data set to to_ids only attributes set this parameter to 1. You can only use the special "exclude" setting to only return attributes that have the to_ids flag disabled.'),
"deleted" => __('If this parameter is set to 1, it will return soft-deleted attributes along with active ones. By using "only" as a parameter it will limit the returned data set to soft-deleted data only.'),
"includeEventUuid" => __('Instead of just including the event ID, also include the event UUID in each of the attributes.'),
"event_timestamp" => __('Only return attributes from events that have received a modification after the given timestamp. The input can be a timetamp or a short-hand time description (7d or 24h for example). You can also pass a list with two values to set a time range (for example ["14d", "7d"]).'),
"sgReferenceOnly" => __('If this flag is set, sharing group objects will not be included, instead only the sharing group ID is set.'),
"eventinfo" => __("Filter on the event's info field."),
"searchall" => __("Search for a full or a substring (delimited by % for substrings) in the event info, event tags, attribute tags, attribute values or attribute comment fields."),
"requested_attributes" => __("CSV only, select the fields that you wish to include in the CSV export. By setting event level fields additionally, includeContext is not required to get event metadata."),
"includeContext" => __("CSV only, add additional event level data to the export. The additional fields can be added via requested_attributes too with more granularity.")
),
'url' => array(
$baseurl . '/attributes/restSearch',
$baseurl . '/events/restSearch'
)
);
echo sprintf('<h3>%s</h3>', $data['title']);
echo sprintf('<p>%s</p>', implode(" ", $data['description']));
echo sprintf("<pre>%s</pre>", implode("\n", $data['url']));
foreach ($data['parameters'] as $k => $v) {
echo sprintf('<span class="bold">%s</span>: %s<br />', $k, $v);
}
$description = 'To export all attributes of types ip-src and ip-dst that have a TLP marking and are not marked TLP:red, use the syntax below. String searches are by default exact lookups, but you can use mysql style "%" wildcards to do substring searches.';
$url = $baseurl . '/attributes/restSearch';
$headers = array(
'Accept: application/json',
'Content-type: application/json',
'Authorization: ' . $me['authkey']
);
$headers = implode("\n", $headers);
$body = json_encode(
array(
'returnFormat' => 'json',
'type' => array('OR' => array('ip-src', 'ip-dst')),
'tags' => array('NOT' => array('tlp:red'), 'OR' => array('tlp:%')),
), JSON_PRETTY_PRINT);
echo sprintf('<p>%s</p>URL:<pre>%s</pre>Headers:<pre>%s</pre>Body:<pre class="red">%s</pre>', $description, $url, $headers, $body);
?>
<h3><?php echo __('CSV specific parameters for the restSearch APIs');?></h3>
<p>
<b>requested_attributes</b>: <?php echo __('Limit the list of fields to be returned in the CSV.');?><br />
<b>includeContext</b>: <?php echo __('Include the event level meta-data with each attribute.');?><br />
<b>headerless</b>: <?php echo __('The CSV created when this setting is set to true will not contain the header row.'); ?>
<p>
<b>requested_attributes</b>: <?php echo __('Limit the list of fields to be returned in the CSV.');?><br />
<b>includeContext</b>: <?php echo __('Include the event level meta-data with each attribute.');?><br />
<b>headerless</b>: <?php echo __('The CSV created when this setting is set to true will not contain the header row.'); ?>
</p>
<?php
echo '<h3>' . __('URL parameters') . '</h3>';
@ -315,21 +315,21 @@
<b>searchDatefrom</b>: <?php echo __('Filters on the date, anything newer than the given date in YYYY-MM-DD format is taken - non-negatable');?><br />
<b>searchDateuntil</b>: <?php echo __('Filters on the date, anything older than the given date in YYYY-MM-DD format is taken - non-negatable');?><br /></p>
<?php
$data = array(
'title' => __('Freetext Import API'),
'description' => array(
__('The freetext import tool is also exposed to the API.'),
__('Simply POST the contents to be parsed and either directly create attributes out of them or simply return the parsing results.'),
__('Use the boolean (0/1) adhere_to_warninglists and return_meta_attributes url parameters to filter out values tripping over a warninglist and to decide whether to save the attributes parsed or simply return them as meta attributes.'),
__('The contents of the POST body should be the text to be parsed.')
),
'url' => array(
$baseurl . '/[event_id]/[adhere_to_warninglists]/[return_meta_attributes]'
)
);
echo sprintf('<h3>%s</h3>', $data['title']);
echo sprintf('<p>%s</p>', implode(" ", $data['description']));
echo sprintf("<pre>%s</pre>", implode("\n", $data['url']));
$data = array(
'title' => __('Freetext Import API'),
'description' => array(
__('The freetext import tool is also exposed to the API.'),
__('Simply POST the contents to be parsed and either directly create attributes out of them or simply return the parsing results.'),
__('Use the boolean (0/1) adhere_to_warninglists and return_meta_attributes url parameters to filter out values tripping over a warninglist and to decide whether to save the attributes parsed or simply return them as meta attributes.'),
__('The contents of the POST body should be the text to be parsed.')
),
'url' => array(
$baseurl . '/[event_id]/[adhere_to_warninglists]/[return_meta_attributes]'
)
);
echo sprintf('<h3>%s</h3>', $data['title']);
echo sprintf('<p>%s</p>', implode(" ", $data['description']));
echo sprintf("<pre>%s</pre>", implode("\n", $data['url']));
foreach ($command_line_functions as $clusterRef => $cluster) {
echo sprintf('<a id="%s"></a><h3>%s</h3>', $clusterRef, $cluster['header']);
echo sprintf('<p>%s:<br />', $cluster['description']);

View File

@ -2,115 +2,115 @@
<?php
echo $this->Form->create('Event', array('type' => 'file'));
?>
<fieldset>
<legend><?php echo __('Import analysis file'); ?></legend>
<?php
echo $this->Form->input('analysis_file', array(
'label' => '<b>Analysis file</b>',
'type' => 'file',
));
?>
<div class="input clear"></div>
<?php
// echo $this->Form->input('publish', array(
// 'checked' => false,
// 'label' => __('Publish imported events'),
// ));
?>
</fieldset>
<fieldset>
<legend><?php echo __('Import analysis file'); ?></legend>
<?php
echo $this->Form->input('analysis_file', array(
'label' => '<b>Analysis file</b>',
'type' => 'file',
));
?>
<div class="input clear"></div>
<?php
// echo $this->Form->input('publish', array(
// 'checked' => false,
// 'label' => __('Publish imported events'),
// ));
?>
</fieldset>
<?php
echo $this->Form->button(__('Upload'), array('class' => 'btn btn-primary'));
echo $this->Form->end();
echo $this->Form->button(__('Upload'), array('class' => 'btn btn-primary'));
echo $this->Form->end();
?>
<div id="afterUpload" style="display:none;">
<div id="object_templates" style="display:none;">
<div class="">
<?php
echo $this->Form->create('SelectedData', array('enctype' => 'application/Json'));
?>
<div style="display:none;">
<fieldset>
<?php
echo $this->Form->input('mactime_data', array(
'type' => 'text'
));
?>
<div class="input clear"></div>
<?php
?>
<?php
echo $this->Form->input('mactime_file_content', array(
'type' => 'text'
));
?>
<div class="input clear"></div>
<?php
?>
<?php
echo $this->Form->input('mactime_file_name', array(
'type' => 'text'
));
?>
<div class="input clear"></div>
<?php
?>
</fieldset>
</div>
<div id="afterUpload" style="display:none;">
<div id="object_templates" style="display:none;">
<div class="">
<?php
echo $this->Form->create('SelectedData', array('enctype' => 'application/Json'));
?>
<div style="display:none;">
<fieldset>
<?php
echo $this->Form->input('mactime_data', array(
'type' => 'text'
));
?>
<div class="input clear"></div>
<?php
?>
<?php
echo $this->Form->input('mactime_file_content', array(
'type' => 'text'
));
?>
<div class="input clear"></div>
<?php
?>
<?php
echo $this->Form->input('mactime_file_name', array(
'type' => 'text'
));
?>
<div class="input clear"></div>
<?php
?>
</fieldset>
</div>
<?php
echo $this->Form->button(__('Create Objects'), array('class' => 'btn btn-primary'));
echo $this->Form->end();
?>
</div>
</div>
<div style="clear:both;"></div>
<input id="file_name" type="hidden" value="<?php if($file_uploaded == "1") { echo h($file_name); } ?>">
<div id="accordion1" style="">
<h3>Select text for further analysis</h3>
<div id="textToSelect" class="raisedbox noselect">
<div id="fileContent" style="display:none;">
<p>
<?php
if($file_uploaded == "1")
{
echo h(nl2br($file_content));
}
?>
</p>
</div>
<table id="individualLines" class="selectedLines">
<thead>
<th>Select</th>
<th>Filepath</th>
<th>File Size</th>
<th>Activity Type</th>
<th>Time Accessed</th>
<th>Permissions</th>
</thead>
<tbody></tbody>
</table>
</div>
<?php
echo $this->Form->button(__('Create Objects'), array('class' => 'btn btn-primary'));
echo $this->Form->end();
?>
</div>
</div>
<div style="clear:both;"></div>
<input id="file_name" type="hidden" value="<?php if($file_uploaded == "1") { echo h($file_name); } ?>">
<div id="accordion1" style="">
<h3>Select text for further analysis</h3>
<div id="textToSelect" class="raisedbox noselect">
<div id="fileContent" style="display:none;">
<p>
<?php
if($file_uploaded == "1")
{
echo h(nl2br($file_content));
}
?>
</p>
</div>
<table id="individualLines" class="selectedLines">
<thead>
<th>Select</th>
<th>Filepath</th>
<th>File Size</th>
<th>Activity Type</th>
<th>Time Accessed</th>
<th>Permissions</th>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<div style="clear:both;"></div>
</div>
</div>
<div style="clear:both;"></div>
</div>
</div>
<?php
$event['Event']['id'] = $eventId;
echo $this->element('side_menu', array('menuList' => 'event', 'menuItem' => 'addAttribute', 'event' => $event));
$event['Event']['id'] = $eventId;
echo $this->element('side_menu', array('menuList' => 'event', 'menuItem' => 'addAttribute', 'event' => $event));
?>
<style>
.selectedLines td,
.selectedLines th {
border:solid 2px #0044cc;
}
.selectedLines
{
width: 100%;
}
.noselect {
.selectedLines td,
.selectedLines th {
border:solid 2px #0044cc;
}
.selectedLines
{
width: 100%;
}
.noselect {
cursor: default;
-webkit-touch-callout: none;
-webkit-user-select: none;
@ -126,53 +126,53 @@ var selText = clearText =fileContent = '';
var linesArray = [];
var rowSelected;
$("#accordion1").accordion({
heightStyle: "content"
heightStyle: "content"
})
$("#accordion2").accordion({
heightStyle: "content"
heightStyle: "content"
})
if(afterUpload == 1)
{
$('#afterUpload').show();
fileContent = $("#fileContent").text()
$('#SelectedDataMactimeFileContent').val(fileContent);
$('#SelectedDataMactimeFileName').val($("#file_name").val());
linesArray = $("#fileContent").text().trim().split("<br />");
$("#fileContent").empty();
for(var i=0; i<linesArray.length;i++)
{
processString(linesArray[i]);
$('#afterUpload').show();
fileContent = $("#fileContent").text()
$('#SelectedDataMactimeFileContent').val(fileContent);
$('#SelectedDataMactimeFileName').val($("#file_name").val());
linesArray = $("#fileContent").text().trim().split("<br />");
$("#fileContent").empty();
for(var i=0; i<linesArray.length;i++)
{
processString(linesArray[i]);
}
}
}
$("input[type='checkbox']").change(function (e) {
var SelectedData = new Array();
var i = 0;
$('#individualLines').find('tr').each(function () {
var SelectedData = new Array();
var i = 0;
$('#individualLines').find('tr').each(function () {
var row = $(this);
if (row.find('input[type="checkbox"]').is(':checked')) {
if (row.find('input[type="checkbox"]').is(':checked')) {
SelectedData[i]={
"filepath" : $(row).find('td:eq(1)').text(),
"file_size" :$(row).find('td:eq(2)').text(),
"activity_type" : $(row).find('td:eq(3)').text(),
"time_accessed" : $(row).find('td:eq(4)').text(),
"permissions" : $(row).find('td:eq(5)').text(),
"file_name" : $("#file_name").val()
}
i++;
}
SelectedData[i]={
"filepath" : $(row).find('td:eq(1)').text(),
"file_size" :$(row).find('td:eq(2)').text(),
"activity_type" : $(row).find('td:eq(3)').text(),
"time_accessed" : $(row).find('td:eq(4)').text(),
"permissions" : $(row).find('td:eq(5)').text(),
"file_name" : $("#file_name").val()
}
i++;
}
});
if(i > 0)
{
$('#object_templates').show();
SelectedData =JSON.stringify(SelectedData);
$('#SelectedDataMactimeData').val(SelectedData);
}
else
$('#object_templates').hide();
if(i > 0)
{
$('#object_templates').show();
SelectedData =JSON.stringify(SelectedData);
$('#SelectedDataMactimeData').val(SelectedData);
}
else
$('#object_templates').hide();
@ -181,64 +181,64 @@ $("input[type='checkbox']").change(function (e) {
function processString(text)
{
var time_accessed = "";
var size =activity_type = permissions = file_path = activity = time_accessed = "";
//full date and time expression
var Regx1 = /(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d\d?).+?(\d\d\d\d)\s([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/;
//time expressions
var Regx2 = new RegExp("([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");
var arr = Regx1.exec(text);
var time_accessed = "";
var size =activity_type = permissions = file_path = activity = time_accessed = "";
//full date and time expression
var Regx1 = /(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d\d?).+?(\d\d\d\d)\s([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/;
//time expressions
var Regx2 = new RegExp("([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");
var arr = Regx1.exec(text);
if(Regx2.exec(text) != null)
{
if(arr != null)
{
time_accessed = arr[0];
text = text.replace(arr[0],'').trim();
}
if(Regx2.exec(text) != null)
{
if(arr != null)
{
time_accessed = arr[0];
text = text.replace(arr[0],'').trim();
}
text = text.replace(/[\n\r]/g, '').trim();
seperate_analysis = text.split(/[ ]+/);
size = seperate_analysis[0];
activity_type = seperate_analysis[1];
if(activity_type.includes('a'))
{
activity = "Accessed";
}
if(activity_type.includes('b'))
{
activity += (activity != '')?',':'';
activity += "Created";
}
if(activity_type.includes('c'))
{
activity += (activity != '')?',':'';
activity += "Changed";
}
if(activity_type.includes('m'))
{
activity += (activity != '')?',':'';
activity += "Modified";
}
text = text.replace(/[\n\r]/g, '').trim();
seperate_analysis = text.split(/[ ]+/);
size = seperate_analysis[0];
activity_type = seperate_analysis[1];
if(activity_type.includes('a'))
{
activity = "Accessed";
}
if(activity_type.includes('b'))
{
activity += (activity != '')?',':'';
activity += "Created";
}
if(activity_type.includes('c'))
{
activity += (activity != '')?',':'';
activity += "Changed";
}
if(activity_type.includes('m'))
{
activity += (activity != '')?',':'';
activity += "Modified";
}
permissions = seperate_analysis[2];
filepath = seperate_analysis[6]
if(seperate_analysis[7])
{
filepath += seperate_analysis[7];
}
$("#individualLines").find('tbody')
.append($('<tr>')
.append($('<td>').html('<input type="checkbox" class="select"></input>'))
.append($('<td>').text(filepath))
.append($('<td>').text(size))
.append($('<td>').text(activity))
.append($('<td>').text(time_accessed))
.append($('<td>').text(permissions))
permissions = seperate_analysis[2];
filepath = seperate_analysis[6]
if(seperate_analysis[7])
{
filepath += seperate_analysis[7];
}
$("#individualLines").find('tbody')
.append($('<tr>')
.append($('<td>').html('<input type="checkbox" class="select"></input>'))
.append($('<td>').text(filepath))
.append($('<td>').text(size))
.append($('<td>').text(activity))
.append($('<td>').text(time_accessed))
.append($('<td>').text(permissions))
);
}
);
}
}

View File

@ -79,7 +79,7 @@
<td class="short action-links">
<?php echo $this->Html->link('', array('controller' => 'galaxies', 'action' => 'viewGraph', $item['GalaxyCluster']['id']), array('class' => 'fa fa-share-alt', 'title' => 'View graph'));?>
<?php echo $this->Html->link('', array('action' => 'view', $item['GalaxyCluster']['id']), array('class' => 'icon-list-alt', 'title' => 'View'));?>
<span class="icon-trash useCursorPointer" title="<?php echo __('Delete galaxy cluster');?>" role="button" tabindex="0" aria-label="<?php echo __('Delete galaxy cluster');?>" onClick="deleteObject('galaxy_clusters', 'delete', '<?php echo h($item['GalaxyCluster']['id']); ?>', '<?php echo h($item['GalaxyCluster']['id']); ?>');"></span>
<span class="icon-trash useCursorPointer" title="<?php echo __('Delete galaxy cluster');?>" role="button" tabindex="0" aria-label="<?php echo __('Delete galaxy cluster');?>" onClick="deleteObject('galaxy_clusters', 'delete', '<?php echo h($item['GalaxyCluster']['id']); ?>', '<?php echo h($item['GalaxyCluster']['id']); ?>');"></span>
</td>
</tr>
<?php

View File

@ -16,9 +16,9 @@
<dd><?php echo $cluster['Galaxy']['name'] ? h($cluster['Galaxy']['name']) : h($cluster['Galaxy']['type']); ?></dd>
<dt>Description</dt>
<dd><?php echo h($cluster['GalaxyCluster']['description']); ?>&nbsp;</dd>
<dt>UUID</dt>
<dt>UUID</dt>
<dd><?php echo h($cluster['GalaxyCluster']['uuid']); ?>&nbsp;</dd>
<dt>Collection UUID</dt>
<dt>Collection UUID</dt>
<dd><?php echo h($cluster['GalaxyCluster']['collection_uuid']); ?>&nbsp;</dd>
<dt>Source</dt>
<dd><?php echo h($cluster['GalaxyCluster']['source']); ?>&nbsp;</dd>

View File

@ -34,14 +34,14 @@ App::uses('UrlCacheAppHelper', 'UrlCache.View/Helper');
*/
class AppHelper extends UrlCacheAppHelper {
public function afterLayout($layoutFile) {
}
public function afterLayout($layoutFile) {
}
public function url($url = null, $full = false) {
if (is_array($url) && !isset($url['admin'])) {
$url['admin'] = false;
}
return parent::url($url, $full);
public function url($url = null, $full = false) {
if (is_array($url) && !isset($url['admin'])) {
$url['admin'] = false;
}
return parent::url($url, $full);
}
}
}

View File

@ -5,90 +5,90 @@ App::uses('AppHelper', 'View/Helper');
// And now [thread][/thread], [event][/event], [link][/link], [code][/code]
class CommandHelper extends AppHelper {
var $helpers = array('Html');
class CommandHelper extends AppHelper {
var $helpers = array('Html');
private $__replacement;
private $__replacement;
private function __buildReplacements() {
$this->__replacement = array(
'link' => array('type' => 'url', 'url' => '$1', 'text' => '$1'),
'thread' => array('type' => 'url', 'url' => h(Configure::read('MISP.baseurl')). '/threads/view/$1', 'text' => ' Thread $1'),
'event' => array('type' => 'url', 'url' => h(Configure::read('MISP.baseurl')). '/events/view/$1', 'text' => ' Event $1'),
'code' => array('type' => 'replace', 'text' => '<pre>$1</pre>'),
'quote' => array('type' => 'replace', 'text' => '<div class="quote">$1</div>')
);
}
private function __buildReplacements() {
$this->__replacement = array(
'link' => array('type' => 'url', 'url' => '$1', 'text' => '$1'),
'thread' => array('type' => 'url', 'url' => h(Configure::read('MISP.baseurl')). '/threads/view/$1', 'text' => ' Thread $1'),
'event' => array('type' => 'url', 'url' => h(Configure::read('MISP.baseurl')). '/events/view/$1', 'text' => ' Event $1'),
'code' => array('type' => 'replace', 'text' => '<pre>$1</pre>'),
'quote' => array('type' => 'replace', 'text' => '<div class="quote">$1</div>')
);
}
public function convertQuotes($string) {
$this->__buildReplacements();
foreach ($this->__replacement as $trigger => $replacement) {
$result = $this->__handleLinks($string, $trigger);
// Does this return a UI Element?
if (!$result) return 'Malformed syntax.';
}
return $string;
}
public function convertQuotes($string) {
$this->__buildReplacements();
foreach ($this->__replacement as $trigger => $replacement) {
$result = $this->__handleLinks($string, $trigger);
// Does this return a UI Element?
if (!$result) return 'Malformed syntax.';
}
return $string;
}
private function __handleLinks(&$string, $trigger) {
$opening = preg_match('%\[' . $trigger . '\]%isU', $string, $opening_matches, PREG_OFFSET_CAPTURE);
$closing = preg_match('%\[/' . $trigger . '\]%isU', $string, $closing_matches, PREG_OFFSET_CAPTURE);
$opening_len = strlen($trigger) + 2;
$closing_len = $opening_len + 1;
if ((count($opening) !== count($closing))) return false;
$pairs = array();
$rearrangedTags = array();
foreach ($opening_matches as $opening_tag) {
$rearrangedTags[$opening_tag[1]] = 'open';
}
foreach ($closing_matches as $closing_tag) {
$rearrangedTags[$closing_tag[1]] = 'close';
}
foreach ($opening_matches as $opening_tag) {
$counter = 1;
foreach ($rearrangedTags as $pos => $type) {
if ($opening_tag[1] == $pos) continue;
if ($type == 'close') $counter--;
else $counter++;
if ($counter == 0) {
$pairs[] = array($opening_tag[1], $pos);
continue 2;
}
}
}
foreach ($pairs as $pair) {
$temp = substr($string, 0, $pair[0]);
if ($this->__replacement[$trigger]['type'] == 'url') {
$data = substr($string, $pair[0] + $opening_len, $pair[1] - ($pair[0] + $opening_len));
if (empty($data)) {
$replacement = '';
} else {
if (!is_numeric($data) && ($trigger == 'event' || $trigger == 'thread')) {
$replacement = '%MALFORMED URL%';
} else {
if (filter_var(str_replace('$1', $data, $this->__replacement[$trigger]['url']), FILTER_VALIDATE_URL)) {
$replacement = $this->Html->link(
str_replace('$1', $data, $this->__replacement[$trigger]['text']),
str_replace('$1', $data, $this->__replacement[$trigger]['url'])
);
} else {
$replacement = '%MALFORMED URL%';
}
}
}
} else {
$data = substr($string, $pair[0] + $opening_len, $pair[1] - ($pair[0] + $opening_len));
if (empty($data)) {
$replacement = '';
} else {
$replacement = str_replace('$1', $data, $this->__replacement[$trigger]['text']);
}
}
$temp .= $replacement;
$temp .= substr($string, $pair[1] + $closing_len, strlen($string));
$string = $temp;
}
return true;
}
}
private function __handleLinks(&$string, $trigger) {
$opening = preg_match('%\[' . $trigger . '\]%isU', $string, $opening_matches, PREG_OFFSET_CAPTURE);
$closing = preg_match('%\[/' . $trigger . '\]%isU', $string, $closing_matches, PREG_OFFSET_CAPTURE);
$opening_len = strlen($trigger) + 2;
$closing_len = $opening_len + 1;
if ((count($opening) !== count($closing))) return false;
$pairs = array();
$rearrangedTags = array();
foreach ($opening_matches as $opening_tag) {
$rearrangedTags[$opening_tag[1]] = 'open';
}
foreach ($closing_matches as $closing_tag) {
$rearrangedTags[$closing_tag[1]] = 'close';
}
foreach ($opening_matches as $opening_tag) {
$counter = 1;
foreach ($rearrangedTags as $pos => $type) {
if ($opening_tag[1] == $pos) continue;
if ($type == 'close') $counter--;
else $counter++;
if ($counter == 0) {
$pairs[] = array($opening_tag[1], $pos);
continue 2;
}
}
}
foreach ($pairs as $pair) {
$temp = substr($string, 0, $pair[0]);
if ($this->__replacement[$trigger]['type'] == 'url') {
$data = substr($string, $pair[0] + $opening_len, $pair[1] - ($pair[0] + $opening_len));
if (empty($data)) {
$replacement = '';
} else {
if (!is_numeric($data) && ($trigger == 'event' || $trigger == 'thread')) {
$replacement = '%MALFORMED URL%';
} else {
if (filter_var(str_replace('$1', $data, $this->__replacement[$trigger]['url']), FILTER_VALIDATE_URL)) {
$replacement = $this->Html->link(
str_replace('$1', $data, $this->__replacement[$trigger]['text']),
str_replace('$1', $data, $this->__replacement[$trigger]['url'])
);
} else {
$replacement = '%MALFORMED URL%';
}
}
}
} else {
$data = substr($string, $pair[0] + $opening_len, $pair[1] - ($pair[0] + $opening_len));
if (empty($data)) {
$replacement = '';
} else {
$replacement = str_replace('$1', $data, $this->__replacement[$trigger]['text']);
}
}
$temp .= $replacement;
$temp .= substr($string, $pair[1] + $closing_len, strlen($string));
$string = $temp;
}
return true;
}
}

View File

@ -5,39 +5,39 @@ App::uses('AppHelper', 'View/Helper');
// It will then run each of those through the string with preg_replaces, highlighting all the matched terms in red
// Used for things such as searches in the logs to highlight found terms
class HighlightHelper extends AppHelper {
class HighlightHelper extends AppHelper {
/**
* Important: data needs to be sanitized using the h() function before entering this function
* @param unknown_type $keywordArray
*/
public function build_replace_pairs($keywordArray) {
// build the $replacePairs variable used to highlight the keywords
$replacementArray = array();
if (!is_array($keywordArray)) {
$keywordArray = array($keywordArray);
}
foreach ($keywordArray as $k => $keywordArrayElement) {
$keywordArrayElement = trim($keywordArrayElement);
if ("" == $keywordArrayElement) {
unset($keywordArray[$k]);
continue;
} else {
$keywordArray[$k] = $keywordArrayElement;
}
$replacementArray[] = '<span style="color:red">'.$keywordArrayElement.'</span>';
}
if (!empty($replacementArray))
return array_combine($keywordArray, $replacementArray);
}
/**
* Important: data needs to be sanitized using the h() function before entering this function
* @param unknown_type $keywordArray
*/
public function build_replace_pairs($keywordArray) {
// build the $replacePairs variable used to highlight the keywords
$replacementArray = array();
if (!is_array($keywordArray)) {
$keywordArray = array($keywordArray);
}
foreach ($keywordArray as $k => $keywordArrayElement) {
$keywordArrayElement = trim($keywordArrayElement);
if ("" == $keywordArrayElement) {
unset($keywordArray[$k]);
continue;
} else {
$keywordArray[$k] = $keywordArrayElement;
}
$replacementArray[] = '<span style="color:red">'.$keywordArrayElement.'</span>';
}
if (!empty($replacementArray))
return array_combine($keywordArray, $replacementArray);
}
public function highlighter($str, $replacePairs) {
if (is_array($replacePairs)) {
return strtr($str, $replacePairs);
} else {
return $str;
}
public function highlighter($str, $replacePairs) {
if (is_array($replacePairs)) {
return strtr($str, $replacePairs);
} else {
return $str;
}
}
}
}
}
?>

View File

@ -1,84 +1,84 @@
<?php
App::uses('AppHelper', 'View/Helper');
class PivotHelper extends AppHelper {
class PivotHelper extends AppHelper {
private function __doConvert($pivot, $currentEvent, $activeText=false) {
$data = null;
$text = $pivot['id'] . ': ';
$active = '';
$pivot['info'] = h($pivot['info']);
// Truncate string if longer than (11 - length of event id) chars to fit the pivot bubble
if (strlen($pivot['info']) > (11 - strlen((string)$pivot['id'])) && strlen($pivot['info']) > 9) {
$text .= mb_substr($pivot['info'], 0, 6) . '...';
} else {
$text .= $pivot['info'];
}
private function __doConvert($pivot, $currentEvent, $activeText=false) {
$data = null;
$text = $pivot['id'] . ': ';
$active = '';
$pivot['info'] = h($pivot['info']);
// Truncate string if longer than (11 - length of event id) chars to fit the pivot bubble
if (strlen($pivot['info']) > (11 - strlen((string)$pivot['id'])) && strlen($pivot['info']) > 9) {
$text .= mb_substr($pivot['info'], 0, 6) . '...';
} else {
$text .= $pivot['info'];
}
// Colour the text white if it is a highlighted pivot element
$pivotType = 'pivotText';
$pivotSpanType = '';
if ($activeText) {
$pivotType = 'pivotTextBlue';
$pivotSpanType = 'pivotSpanBlue';
}
// Colour the text white if it is a highlighted pivot element
$pivotType = 'pivotText';
$pivotSpanType = '';
if ($activeText) {
$pivotType = 'pivotTextBlue';
$pivotSpanType = 'pivotSpanBlue';
}
$data[] = '<span class ="'.$pivotSpanType.'">';
if ($pivot['deletable']) {
$data[] = '<a class="pivotDelete icon-remove" href="' . h(Configure::read('MISP.baseurl')) . '/events/removePivot/' . $pivot['id'] . '/' . $currentEvent . '"></a>';
}
$data[] = '<a class="' . $pivotType . '" href="' . h(Configure::read('MISP.baseurl')) . '/events/view/' . $pivot['id'] . '/1/' . $currentEvent . '" title="' . h($pivot['info']) . ' (' . $pivot['date'] . ')">' . h($text) . '</a>';
$data[] = '</span>';
if (!empty($pivot['children'])) {
foreach ($pivot['children'] as $k => $v) {
$extra = '';
if ($v['id'] == $currentEvent) {
$active = ' activePivot';
}
if ($k > 0) {
$pixelDifference = $pivot['children'][$k]['height'] - $pivot['children'][$k-1]['height'];
$lineDifference = $pixelDifference / 50;
$extra = ' distance' . $lineDifference;
}
$data[] = '<div class="pivotElement' . $extra . $active . '" style="top:' . $pivot['children'][$k]['height'] . 'px;">';
if ($active != '') $temp = $this->__doConvert($v, $currentEvent, true);
else $temp = $this->__doConvert($v, $currentEvent);
$data = array_merge($data, $temp);
$data[] = '</div>';
$active = '';
}
}
return $data;
}
$data[] = '<span class ="'.$pivotSpanType.'">';
if ($pivot['deletable']) {
$data[] = '<a class="pivotDelete icon-remove" href="' . h(Configure::read('MISP.baseurl')) . '/events/removePivot/' . $pivot['id'] . '/' . $currentEvent . '"></a>';
}
$data[] = '<a class="' . $pivotType . '" href="' . h(Configure::read('MISP.baseurl')) . '/events/view/' . $pivot['id'] . '/1/' . $currentEvent . '" title="' . h($pivot['info']) . ' (' . $pivot['date'] . ')">' . h($text) . '</a>';
$data[] = '</span>';
if (!empty($pivot['children'])) {
foreach ($pivot['children'] as $k => $v) {
$extra = '';
if ($v['id'] == $currentEvent) {
$active = ' activePivot';
}
if ($k > 0) {
$pixelDifference = $pivot['children'][$k]['height'] - $pivot['children'][$k-1]['height'];
$lineDifference = $pixelDifference / 50;
$extra = ' distance' . $lineDifference;
}
$data[] = '<div class="pivotElement' . $extra . $active . '" style="top:' . $pivot['children'][$k]['height'] . 'px;">';
if ($active != '') $temp = $this->__doConvert($v, $currentEvent, true);
else $temp = $this->__doConvert($v, $currentEvent);
$data = array_merge($data, $temp);
$data[] = '</div>';
$active = '';
}
}
return $data;
}
public function convertPivotToHTML($pivot, $currentEvent) {
$lookingAtRoot = false;
$pivotType = '';
if ($pivot['id'] == $currentEvent) {
$lookingAtRoot = true;
$pivotType = ' activePivot';
}
$temp = $this->__doConvert($pivot, $currentEvent, $lookingAtRoot);
$height = $this->__findMaxHeight($pivot);
$height = $height + 50;
$data = array('<div class="pivotElement firstPivot ' . $pivotType . '" style="height:' . $height . 'px;">');
$data = array_merge($data, $temp);
$data = array_merge($data, array('</div>'));
foreach ($data as $k => $v) {
echo ($v);
}
}
public function convertPivotToHTML($pivot, $currentEvent) {
$lookingAtRoot = false;
$pivotType = '';
if ($pivot['id'] == $currentEvent) {
$lookingAtRoot = true;
$pivotType = ' activePivot';
}
$temp = $this->__doConvert($pivot, $currentEvent, $lookingAtRoot);
$height = $this->__findMaxHeight($pivot);
$height = $height + 50;
$data = array('<div class="pivotElement firstPivot ' . $pivotType . '" style="height:' . $height . 'px;">');
$data = array_merge($data, $temp);
$data = array_merge($data, array('</div>'));
foreach ($data as $k => $v) {
echo ($v);
}
}
private function __findMaxHeight($pivot) {
$height = $pivot['height'];
$heightToAdd = 0;
$temp = 0;
foreach ($pivot['children'] as $k => $v) {
$temp = $this->__findMaxHeight($v);
if ($temp > $heightToAdd) $heightToAdd = $temp;
}
return $height + $heightToAdd;
}
}
private function __findMaxHeight($pivot) {
$height = $pivot['height'];
$heightToAdd = 0;
$temp = 0;
foreach ($pivot['children'] as $k => $v) {
$temp = $this->__findMaxHeight($v);
if ($temp > $heightToAdd) $heightToAdd = $temp;
}
return $height + $heightToAdd;
}
}
?>

View File

@ -3,18 +3,18 @@ App::uses('AppHelper', 'View/Helper');
// This helper helps determining the brightness of a colour (initially only used for the tagging) in order to decide
// what text colour to use against the background (black or white)
class TextColourHelper extends AppHelper {
class TextColourHelper extends AppHelper {
public function getTextColour($RGB) {
$r = hexdec(substr($RGB, 1, 2));
$g = hexdec(substr($RGB, 3, 2));
$b = hexdec(substr($RGB, 5, 2));
$average = ((2 * $r) + $b + (3 * $g))/6;
if ($average < 128) {
return 'white';
} else {
return 'black';
}
}
}
public function getTextColour($RGB) {
$r = hexdec(substr($RGB, 1, 2));
$g = hexdec(substr($RGB, 3, 2));
$b = hexdec(substr($RGB, 5, 2));
$average = ((2 * $r) + $b + (3 * $g))/6;
if ($average < 128) {
return 'white';
} else {
return 'black';
}
}
}
?>

View File

@ -1,11 +1,11 @@
<?php
App::uses('AppHelper', 'View/Helper');
class UtilityHelper extends AppHelper {
public function space2nbsp($string) {
$string = str_replace("\t", " ", $string);
$string = str_replace(" ", "&nbsp", $string);
return $string;
}
}
class UtilityHelper extends AppHelper {
public function space2nbsp($string) {
$string = str_replace("\t", " ", $string);
$string = str_replace(" ", "&nbsp", $string);
return $string;
}
}
?>

View File

@ -1,25 +1,25 @@
<?php
App::uses('AppHelper', 'View/Helper');
class XmlOutputHelper extends AppHelper {
public function recursiveEcho($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
if (empty($v)) echo '<' . $k . '/>';
else {
foreach ($v as $element) {
echo '<' . $k . '>';
$this->recursiveEcho($element);
echo '</' . $k . '>';
}
}
} else {
if ($v === false) $v = 0;
if ($v === "" || $v === null) echo '<' . $k . '/>';
else {
echo '<' . $k . '>' . $v . '</' . $k . '>';
}
}
}
}
}
class XmlOutputHelper extends AppHelper {
public function recursiveEcho($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
if (empty($v)) echo '<' . $k . '/>';
else {
foreach ($v as $element) {
echo '<' . $k . '>';
$this->recursiveEcho($element);
echo '</' . $k . '>';
}
}
} else {
if ($v === false) $v = 0;
if ($v === "" || $v === null) echo '<' . $k . '/>';
else {
echo '<' . $k . '>' . $v . '</' . $k . '>';
}
}
}
}
}
?>

View File

@ -50,7 +50,7 @@
?>
</div>
<div id="flashContainer" style="padding-top:<?php echo $topPadding; ?>px; !important;">
<div id="main-view-container" class="container-fluid ">
<div id="main-view-container" class="container-fluid ">
<?php
$flash = $this->Flash->render();
echo $flash;
@ -59,8 +59,8 @@
</div>
<div>
<?php
echo $this->fetch('content');
?>
echo $this->fetch('content');
?>
</div>
<?php
echo $this->element('footer');
@ -111,11 +111,11 @@
<?php
endif;
?>
if ($('.alert').text().indexOf("$flashErrorMessage") >= 0) {
//$('#flashErrorMessage').html()
var flashMessageLink = '<span class="useCursorPointer underline bold" onClick="flashErrorPopover();">here</span>';
$('.alert').html(($('.alert').html().replace("$flashErrorMessage", flashMessageLink)));
}
if ($('.alert').text().indexOf("$flashErrorMessage") >= 0) {
//$('#flashErrorMessage').html()
var flashMessageLink = '<span class="useCursorPointer underline bold" onClick="flashErrorPopover();">here</span>';
$('.alert').html(($('.alert').html().replace("$flashErrorMessage", flashMessageLink)));
}
});
</script>
</body>

View File

@ -72,7 +72,7 @@
<?php endif;?>
<th><?php echo $this->Paginator->sort('tag');?></th>
<th><?php echo $this->Paginator->sort('expanded');?></th>
<th><?php echo $this->Paginator->sort('numerical_value');?></th>
<th><?php echo $this->Paginator->sort('numerical_value');?></th>
<th><?php echo $this->Paginator->sort('events');?></th>
<th><?php echo $this->Paginator->sort('attributes');?></th>
<th><?php echo $this->Paginator->sort('tag');?></th>
@ -87,7 +87,7 @@
<?php endif; ?>
<td id="tag_<?php echo h($k); ?>" class="short"><?php echo h($item['tag']); ?></td>
<td><?php echo h($item['expanded']); ?>&nbsp;</td>
<td class="short"><?php echo isset($item['numerical_value']) ? h($item['numerical_value']) : ''; ?>&nbsp;</td>
<td class="short"><?php echo isset($item['numerical_value']) ? h($item['numerical_value']) : ''; ?>&nbsp;</td>
<td class="short">
<?php
if ($item['existing_tag']) {

View File

@ -81,9 +81,9 @@ $(document).ready(function() {
url += '&recipientEmailList=' + $('#UserRecipientEmailList').val();
url += '&orgNameList=' + $('#UserOrgNameList').val();
$.get(url, function(data) {
$("#confirmation_box").html(data);
openPopup("#confirmation_box");
});
$("#confirmation_box").html(data);
openPopup("#confirmation_box");
});
return submitAllowed;
});

View File

@ -29,13 +29,13 @@
<dd><?php echo h($stats['proposal_count']); ?>&nbsp;</dd>
<dt><?php echo __('Users'); ?></dt>
<dd><?php echo h($stats['user_count']); ?>&nbsp;</dd>
<dt><?php echo __('Users with PGP keys'); ?></dt>
<dd><?php echo h($stats['user_count_pgp']) . ' (' . (round(100*($stats['user_count_pgp'] / $stats['user_count']) ,1)) . '%)'; ?>&nbsp;</dd>
<dt><?php echo __('Users with PGP keys'); ?></dt>
<dd><?php echo h($stats['user_count_pgp']) . ' (' . (round(100*($stats['user_count_pgp'] / $stats['user_count']) ,1)) . '%)'; ?>&nbsp;</dd>
<dt><?php echo __('Organisations'); ?></dt>
<dd><?php echo h($stats['org_count']); ?>&nbsp;</dd>
<dt><?php echo __('Local Organisations'); ?></dt>
<dt><?php echo __('Local Organisations'); ?></dt>
<dd><?php echo h($stats['local_org_count']); ?>&nbsp;</dd>
<dt><?php echo __('Average Users / Org'); ?></dt>
<dt><?php echo __('Average Users / Org'); ?></dt>
<dd><?php echo h($stats['average_user_per_org']); ?>&nbsp;</dd>
<dt><?php echo __('Discussion threads'); ?></dt>
<dd><?php echo h($stats['thread_count']);