chg: [l10n] Make export choices l10n

pull/8607/head
Jakub Onderka 2022-09-22 13:15:56 +02:00
parent cd232af4ab
commit bb61b78ebd
1 changed files with 82 additions and 83 deletions

View File

@ -4239,29 +4239,28 @@ class EventsController extends AppController
throw new NotFoundException(__('Event not found or you are not authorised to view it.')); throw new NotFoundException(__('Event not found or you are not authorised to view it.'));
} }
$id = $event['Event']['id']; $id = $event['Event']['id'];
// #TODO i18n
$exports = array( $exports = array(
'xml' => array(
'url' => $this->baseurl . '/events/restSearch/xml/eventid:' . $id . '.xml',
'text' => 'MISP XML (metadata + all attributes)',
'requiresPublished' => false,
'checkbox' => true,
'checkbox_text' => 'Encode Attachments',
'checkbox_set' => $this->baseurl . '/events/restSearch/xml/eventid:' . $id . '/withAttachments:1.xml',
'checkbox_default' => true
),
'json' => array( 'json' => array(
'url' => $this->baseurl . '/events/restSearch/json/eventid:' . $id . '.json', 'url' => $this->baseurl . '/events/restSearch/json/eventid:' . $id . '.json',
'text' => 'MISP JSON (metadata + all attributes)', 'text' => __('MISP JSON (metadata + all attributes)'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => true, 'checkbox' => true,
'checkbox_text' => 'Encode Attachments', 'checkbox_text' => __('Encode Attachments'),
'checkbox_set' => $this->baseurl . '/events/restSearch/json/withAttachments:1/eventid:' . $id . '.json', 'checkbox_set' => $this->baseurl . '/events/restSearch/json/withAttachments:1/eventid:' . $id . '.json',
'checkbox_default' => true 'checkbox_default' => true,
),
'xml' => array(
'url' => $this->baseurl . '/events/restSearch/xml/eventid:' . $id . '.xml',
'text' => __('MISP XML (metadata + all attributes)'),
'requiresPublished' => false,
'checkbox' => true,
'checkbox_text' => __('Encode Attachments'),
'checkbox_set' => $this->baseurl . '/events/restSearch/xml/eventid:' . $id . '/withAttachments:1.xml',
'checkbox_default' => true,
), ),
'openIOC' => array( 'openIOC' => array(
'url' => $this->baseurl . '/events/restSearch/openioc/to_ids:1/published:1/eventid:' . $id . '.json', 'url' => $this->baseurl . '/events/restSearch/openioc/to_ids:1/published:1/eventid:' . $id . '.json',
'text' => 'OpenIOC (all indicators marked to IDS)', 'text' => __('OpenIOC (all indicators marked to IDS)'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => false, 'checkbox' => false,
), ),
@ -4270,73 +4269,73 @@ class EventsController extends AppController
'text' => 'CSV', 'text' => 'CSV',
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => true, 'checkbox' => true,
'checkbox_text' => 'Include non-IDS marked attributes', 'checkbox_text' => __('Include non-IDS marked attributes'),
'checkbox_set' => $this->baseurl . '/events/restSearch/returnFormat:csv/to_ids:1||0/published:1||0/includeContext:0/eventid:' . $id 'checkbox_set' => $this->baseurl . '/events/restSearch/returnFormat:csv/to_ids:1||0/published:1||0/includeContext:0/eventid:' . $id,
), ),
'csv_with_context' => array( 'csv_with_context' => array(
'url' => $this->baseurl . '/events/restSearch/returnFormat:csv/to_ids:1/published:1/includeContext:1/eventid:' . $id, 'url' => $this->baseurl . '/events/restSearch/returnFormat:csv/to_ids:1/published:1/includeContext:1/eventid:' . $id,
'text' => 'CSV with additional context', 'text' => __('CSV with additional context'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => true, 'checkbox' => true,
'checkbox_text' => 'Include non-IDS marked attributes', 'checkbox_text' => __('Include non-IDS marked attributes'),
'checkbox_set' => $this->baseurl . '/events/restSearch/returnFormat:csv/to_ids:1||0/published:1||0/includeContext:1/eventid:' . $id 'checkbox_set' => $this->baseurl . '/events/restSearch/returnFormat:csv/to_ids:1||0/published:1||0/includeContext:1/eventid:' . $id,
), ),
'stix_xml' => array( 'stix_xml' => array(
'url' => $this->baseurl . '/events/restSearch/stix/eventid:' . $id, 'url' => $this->baseurl . '/events/restSearch/stix/eventid:' . $id,
'text' => 'STIX 1 XML (metadata + all attributes)', 'text' => __('STIX 1 XML (metadata + all attributes)'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => true, 'checkbox' => true,
'checkbox_text' => 'Encode Attachments', 'checkbox_text' => __('Encode Attachments'),
'checkbox_set' => $this->baseurl . '/events/restSearch/stix/eventid:' . $id . '/withAttachments:1' 'checkbox_set' => $this->baseurl . '/events/restSearch/stix/eventid:' . $id . '/withAttachments:1',
), ),
'stix_json' => array( 'stix_json' => array(
'url' => $this->baseurl . '/events/restSearch/stix-json/eventid:' . $id, 'url' => $this->baseurl . '/events/restSearch/stix-json/eventid:' . $id,
'text' => 'STIX 1 JSON (metadata + all attributes)', 'text' => __('STIX 1 JSON (metadata + all attributes)'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => true, 'checkbox' => true,
'checkbox_text' => 'Encode Attachments', 'checkbox_text' => __('Encode Attachments'),
'checkbox_set' => $this->baseurl . '/events/restSearch/stix-json/withAttachments:1/eventid:' . $id 'checkbox_set' => $this->baseurl . '/events/restSearch/stix-json/withAttachments:1/eventid:' . $id,
), ),
'stix2_json' => array( 'stix2_json' => array(
'url' => $this->baseurl . '/events/restSearch/stix2/eventid:' . $id, 'url' => $this->baseurl . '/events/restSearch/stix2/eventid:' . $id,
'text' => 'STIX 2', 'text' => 'STIX 2',
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => true, 'checkbox' => true,
'checkbox_text' => 'Encode Attachments', 'checkbox_text' => __('Encode Attachments'),
'checkbox_set' => $this->baseurl . '/events/restSearch/stix2/eventid:' . $id . '/withAttachments:1' 'checkbox_set' => $this->baseurl . '/events/restSearch/stix2/eventid:' . $id . '/withAttachments:1',
), ),
'rpz' => array( 'rpz' => array(
'url' => $this->baseurl . '/attributes/restSearch/returnFormat:rpz/published:1||0/eventid:' . $id, 'url' => $this->baseurl . '/attributes/restSearch/returnFormat:rpz/published:1||0/eventid:' . $id,
'text' => 'RPZ Zone file', 'text' => __('RPZ Zone file'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => false, 'checkbox' => false,
), ),
'suricata' => array( 'suricata' => array(
'url' => $this->baseurl . '/events/restSearch/returnFormat:suricata/published:1||0/eventid:' . $id, 'url' => $this->baseurl . '/events/restSearch/returnFormat:suricata/published:1||0/eventid:' . $id,
'text' => 'Download Suricata rules', 'text' => __('Suricata rules'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => false, 'checkbox' => false,
), ),
'snort' => array( 'snort' => array(
'url' => $this->baseurl . '/events/restSearch/returnFormat:snort/published:1||0/eventid:' . $id, 'url' => $this->baseurl . '/events/restSearch/returnFormat:snort/published:1||0/eventid:' . $id,
'text' => 'Download Snort rules', 'text' => __('Snort rules'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => false, 'checkbox' => false,
), ),
'bro' => array( 'bro' => array(
'url' => $this->baseurl . '/attributes/bro/download/all/false/' . $id, 'url' => $this->baseurl . '/attributes/bro/download/all/false/' . $id,
// 'url' => '/attributes/restSearch/returnFormat:bro/published:1||0/eventid:' . $id, // 'url' => '/attributes/restSearch/returnFormat:bro/published:1||0/eventid:' . $id,
'text' => 'Download Bro rules', 'text' => __('Bro rules'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => false 'checkbox' => false,
), ),
'text' => array( 'text' => array(
'text' => 'Export all attribute values as a text file', 'text' => __('Export all attribute values as a text file'),
'url' => $this->baseurl . '/attributes/restSearch/returnFormat:text/published:1||0/eventid:' . $id, 'url' => $this->baseurl . '/attributes/restSearch/returnFormat:text/published:1||0/eventid:' . $id,
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => true, 'checkbox' => true,
'checkbox_text' => 'Include non-IDS marked attributes', 'checkbox_text' => __('Include non-IDS marked attributes'),
'checkbox_set' => $this->baseurl . '/attributes/restSearch/returnFormat:text/published:1||0/to_ids:1||0/eventid:' . $id 'checkbox_set' => $this->baseurl . '/attributes/restSearch/returnFormat:text/published:1||0/to_ids:1||0/eventid:' . $id,
), ),
); );
if ($event['Event']['published'] == 0) { if ($event['Event']['published'] == 0) {
@ -4347,9 +4346,9 @@ class EventsController extends AppController
} }
$exports['csv'] = array( $exports['csv'] = array(
'url' => $this->baseurl . '/events/restSearch/returnFormat:csv/includeContext:0/eventid:' . $id, 'url' => $this->baseurl . '/events/restSearch/returnFormat:csv/includeContext:0/eventid:' . $id,
'text' => 'CSV (event not published, IDS flag ignored)', 'text' => __('CSV (event not published, IDS flag ignored)'),
'requiresPublished' => false, 'requiresPublished' => false,
'checkbox' => false 'checkbox' => false,
); );
} }
$this->loadModel('Module'); $this->loadModel('Module');
@ -4371,7 +4370,7 @@ class EventsController extends AppController
public function importChoice($id = false, $scope = 'event') public function importChoice($id = false, $scope = 'event')
{ {
if ($scope == 'event') { if ($scope === 'event') {
$event = $this->Event->fetchSimpleEvent($this->Auth->user(), $id); $event = $this->Event->fetchSimpleEvent($this->Auth->user(), $id);
if (empty($event)) { if (empty($event)) {
throw new NotFoundException(__('Event not found or you are not authorised to view it.')); throw new NotFoundException(__('Event not found or you are not authorised to view it.'));
@ -4417,7 +4416,7 @@ class EventsController extends AppController
$imports[$module['name']] = array( $imports[$module['name']] = array(
'url' => $this->baseurl . '/events/importModule/' . $module['name'] . '/' . $id, 'url' => $this->baseurl . '/events/importModule/' . $module['name'] . '/' . $id,
'text' => Inflector::humanize($module['name']), 'text' => Inflector::humanize($module['name']),
'ajax' => false 'ajax' => false,
); );
} }
} }
@ -4427,7 +4426,7 @@ class EventsController extends AppController
'url' => $this->baseurl . '/events/add_misp_export', 'url' => $this->baseurl . '/events/add_misp_export',
'text' => __('MISP standard (recommended exchange format - lossless)'), 'text' => __('MISP standard (recommended exchange format - lossless)'),
'ajax' => false, 'ajax' => false,
'bold' => true 'bold' => true,
), ),
'STIX' => array( 'STIX' => array(
'url' => $this->baseurl . '/events/upload_stix', 'url' => $this->baseurl . '/events/upload_stix',