%s
', implode(', ', $missingTaxonomies) ); } break; case 'attribute': $id = $attributeId; $searchUrl = '/attributes/search/tags:'; if (!empty($server)) { $searchUrl = sprintf("/servers/previewIndex/%s/searchtag:", h($server['Server']['id'])); } break; } $full = $isAclTagger && $tagAccess && empty($static_tags_only); $fullLocal = $isAclTagger && $localTagAccess && empty($static_tags_only); $host_org_editor = (int)$me['org_id'] === Configure::read('MISP.host_org_id') && $isAclTagger && empty($static_tags_only); $tagData = ""; foreach ($tags as $tag) { if (empty($tag['Tag'])) { $tag['Tag'] = $tag; } if (empty($tag['Tag']['colour'])) { $tag['Tag']['colour'] = '#0088cc'; } $aStyle = 'background-color:' . h($tag['Tag']['colour']) . ';color:' . $this->TextColour->getTextColour($tag['Tag']['colour']) . ';'; $aClass = 'tag nowrap'; $aText = trim($tag['Tag']['name']); $aTextModified = null; if (isset($tag_display_style)) { if (!isset($tag_display_style) || $tag_display_style == 1) { // default behaviour, do nothing for now } else if ($tag_display_style == 2) { $separator_pos = strpos($aText, ':'); if ($separator_pos !== false) { $aTextModified = substr($aText, $separator_pos + 1); $value_pos = strpos($aTextModified, '='); if ($value_pos !== false) { $aTextModified = substr($aTextModified, $value_pos + 1); $aTextModified = trim($aTextModified, '"'); } $aTextModified = h($aTextModified); } } else if ($tag_display_style === 0 || $tag_display_style === '0') { $aTextModified = ' '; } } $aText = h($aText); $span_scope = !empty($hide_global_scope) ? '' : sprintf( '', 'black-white tag', !empty($tag['local']) ? __('Local tag') : __('Global tag'), !empty($tag['local']) ? __('Local tag') : __('Global tag'), !empty($tag['local']) ? 'user' : 'globe-americas' ); if (!empty($tag['Tag']['id'])) { $span_tag = sprintf( '%s', sprintf( '%s%s%s', $baseurl, $searchUrl, h($tag['Tag']['id']) ), $aStyle, $aClass, isset($aTextModified) ? ' title="' . $aText . '"' : '', h($tag['Tag']['id']), isset($aTextModified) ? $aTextModified : $aText ); } else { $span_tag = sprintf( '%s', $aStyle, $aClass, $aText ); } $span_delete = ''; if ($full || ($fullLocal && $tag['Tag']['local'])) { $span_delete = sprintf( 'x', 'black-white tag useCursorPointer noPrint', __('Remove tag'), "button", "0", __('Remove tag %s', h($tag['Tag']['name'])), sprintf( "removeObjectTagPopup(this, '%s', '%s', '%s')", $scope, $id, h($tag['Tag']['id']) ) ); } $tagData .= '' . $span_scope . $span_tag . $span_delete . ' '; } $buttonData = array(); if ($full) { $buttonData[] = sprintf( '', __('Add a tag'), __('Add a tag'), 'addTagButton addButton btn btn-inverse noPrint', $baseurl . '/tags/selectTaxonomy/' . $id . ($scope === 'event' ? '' : ('/' . $scope)), ' ' ); } if ($full || $fullLocal) { $buttonData[] = sprintf( '', __('Add a local tag'), __('Add a local tag'), 'addLocalTagButton addButton btn btn-inverse noPrint', $baseurl . '/tags/selectTaxonomy/local:1/' . $id . ($scope === 'event' ? '' : ('/' . $scope)), ' ' ); } if (!empty($buttonData)) { $tagData .= '' . implode('', $buttonData) . ''; } echo sprintf( '%s', $tagData ); $tagConflictData = ''; if (!empty($tagConflicts['global'])) { $tagConflictData .= '
'; $tagConflictData .= ''; $tagConflictData .= '
'; foreach ($tagConflicts['global'] as $tagConflict) { $tagConflictData .= sprintf( '%s
', h($tagConflict['conflict']) ); foreach ($tagConflict['tags'] as $tag) { $tagConflictData .= sprintf('%s
', h($tag)); } } $tagConflictData .= '
'; } if (!empty($tagConflicts['local'])) { $tagConflictData .= '
'; $tagConflictData .= ''; $tagConflictData .= '
'; foreach ($tagConflicts['local'] as $tagConflict) { $tagConflictData .= sprintf( '%s
', h($tagConflict['conflict']) ); foreach ($tagConflict['tags'] as $tag) { $tagConflictData .= sprintf('%s
', h($tag)); } } $tagConflictData .= '
'; } echo $tagConflictData;