<commit_before><?php
$edit = $this->request->params['action'] === 'edit' ? true : false;
echo $this->element('genericElements/Form/genericForm', [
    'data' => [
        'title' => $edit ? __('Edit MISP feed') : __('Add MISP Feed'),
        'description' => __('Add a new MISP feed source.'),
        'notice' => !empty(Configure::read('Security.disable_local_feed_access')) ? __('Warning: local feeds are currently disabled by policy, to re-enable the feature, set the Security.disable_local_feed_access flag to false in the server settings. This setting can only be set via the CLI.') : '',
        'fields' => [
            [
                'field' => 'enabled',
                'label' => __('Enabled'),
                'type' => 'checkbox'
            ],
            [
                'field' => 'caching_enabled',
                'label' => __('Caching enabled'),
                'type' => 'checkbox'
            ],
            [
                'field' => 'lookup_visible',
                'label' => __('Lookup visible'),
                'type' => 'checkbox'
            ],
            [
                'field' => 'Feed.settings.disable_correlation',
                'label' => __('Disable correlation'),
                'type' => 'checkbox'
            ],
            [
                'field' => 'name',
                'label' => __('Name'),
                'placeholder' => __('Feed name'),
                'required' => 1,
                'class' => 'form-control span6'
            ],
            [
                'field' => 'provider',
                'label' => __('Provider'),
                'placeholder' => __('Name of the content provider'),
                'required' => 1,
                'class' => 'form-control span6'
            ],
            [
                'field' => 'input_source',
                'label' => __('Input Source'),
                'options' => $dropdownData['inputSources'],
                'type' => 'dropdown',
                'class' => 'form-control span6'
            ],
            [
                'field' => 'url',
                'label' => __('URL'),
                'placeholder' => 'URL of the feed',
                'required' => 1,
                'class' => 'form-control span6'
            ],
            [
                'field' => 'source_format',
                'label' => __('Source Format'),
                'options' => $dropdownData['feedTypes'],
                'type' => 'dropdown',
                'class' => 'form-control span6'
            ],
            [
                'field' => 'headers',
                'label' => __('Any headers to be passed with requests (for example: Authorization)'),
                'class' => 'input-xxlarge',
                'type' => 'headers',
                'placeholder' => __('Line break separated list of headers in the "headername: value" format'),
                'rows' => 4,
            ],
            [
                'field' => 'orgc_id',
                'label' => __('Creator organisation'),
                'options' => $dropdownData['orgs'],
                'value' => $this->request->params['action'] === 'add' ? $me['org_id'] : '',
                'type' => 'dropdown',
                'div' => ['id' => 'OrgcDiv', 'style' => 'display:none', 'class' => 'optionalField'],
                'class' => 'form-control span6'
            ],
            [
                'field' => 'fixed_event',
                'label' => __('Target Event'),
                'options' => ['Fixed Event', 'New Event Each Pull'],
                'type' => 'dropdown',
                'div' => ['id' => 'TargetDiv', 'style' => 'display:none', 'class' => 'optionalField'],
                'class' => 'form-control span6'
            ],
            [
                'field' => 'target_event',
                'label' => __('Target Event ID'),
                'placeholder' => __('Leave blank unless you want to reuse an existing event.'),
                'div' => ['id' => 'TargetEventDiv', 'style' => 'display:none', 'class' => 'optionalField'],
                'class' => 'form-control span6'
            ],
            [
                'field' => 'Feed.settings.csv.value',
                'label' => __('Value field(s) in the CSV'),
                'title' => __('Select one or several fields that should be parsed by the CSV parser and converted into MISP attributes'),
                'placeholder' => __('2,3,4 (column position separated by commas)'),
                'div' => ['id' => 'settingsCsvValueDiv', 'style' => 'display:none', 'class' => 'optionalField'],
                'class' => 'form-control span6'
            ],
            [
                'field' => 'Feed.settings.csv.delimiter',
                'label' => __('Delimiter'),<commit_msg>fix: fixed events and target event id not properly set<commit_after><?php
$edit = $this->request->params['action'] === 'edit' ? true : false;
echo $this->element('genericElements/Form/genericForm', [
    'data' => [
        'title' => $edit ? __('Edit MISP feed') : __('Add MISP Feed'),
        'description' => __('Add a new MISP feed source.'),
        'notice' => !empty(Configure::read('Security.disable_local_feed_access')) ? __('Warning: local feeds are currently disabled by policy, to re-enable the feature, set the Security.disable_local_feed_access flag to false in the server settings. This setting can only be set via the CLI.') : '',
        'fields' => [
            [
                'field' => 'enabled',
                'label' => __('Enabled'),
                'type' => 'checkbox'
            ],
            [
                'field' => 'caching_enabled',
                'label' => __('Caching enabled'),
                'type' => 'checkbox'
            ],
            [
                'field' => 'lookup_visible',
                'label' => __('Lookup visible'),
                'type' => 'checkbox'
            ],
            [
                'field' => 'Feed.settings.disable_correlation',
                'label' => __('Disable correlation'),
                'type' => 'checkbox'
            ],
            [
                'field' => 'name',
                'label' => __('Name'),
                'placeholder' => __('Feed name'),
                'required' => 1,
                'class' => 'form-control span6'
            ],
            [
                'field' => 'provider',
                'label' => __('Provider'),
                'placeholder' => __('Name of the content provider'),
                'required' => 1,
                'class' => 'form-control span6'
            ],
            [
                'field' => 'input_source',
                'label' => __('Input Source'),
                'options' => $dropdownData['inputSources'],
                'type' => 'dropdown',
                'class' => 'form-control span6'
            ],
            [
                'field' => 'url',
                'label' => __('URL'),
                'placeholder' => 'URL of the feed',
                'required' => 1,
                'class' => 'form-control span6'
            ],
            [
                'field' => 'source_format',
                'label' => __('Source Format'),
                'options' => $dropdownData['feedTypes'],
                'type' => 'dropdown',
                'class' => 'form-control span6'
            ],
            [
                'field' => 'headers',
                'label' => __('Any headers to be passed with requests (for example: Authorization)'),
                'class' => 'input-xxlarge',
                'type' => 'headers',
                'placeholder' => __('Line break separated list of headers in the "headername: value" format'),
                'rows' => 4,
            ],
            [
                'field' => 'orgc_id',
                'label' => __('Creator organisation'),
                'options' => $dropdownData['orgs'],
                'value' => $this->request->params['action'] === 'add' ? $me['org_id'] : '',
                'type' => 'dropdown',
                'div' => ['id' => 'OrgcDiv', 'style' => 'display:none', 'class' => 'optionalField'],
                'class' => 'form-control span6'
            ],
            [
                'field' => 'fixed_event',
                'label' => __('Target Event'),
                'options' => [1 =>'Fixed Event', 0 => 'New Event Each Pull'],
                'type' => 'dropdown',
                'div' => ['id' => 'TargetDiv', 'style' => 'display:none', 'class' => 'optionalField'],
                'class' => 'form-control span6'
            ],
            [
                'field' => 'event_id',
                'label' => __('Target Event ID'),
                'placeholder' => __('Leave blank unless you want to reuse an existing event.'),
                'div' => ['id' => 'TargetEventDiv', 'style' => 'display:none', 'class' => 'optionalField'],
                'class' => 'form-control span6'
            ],
            [
                'field' => 'Feed.settings.csv.value',
                'label' => __('Value field(s) in the CSV'),
                'title' => __('Select one or several fields that should be parsed by the CSV parser and converted into MISP attributes'),
                'placeholder' => __('2,3,4 (column position separated by commas)'),
                'div' => ['id' => 'settingsCsvValueDiv', 'style' => 'display:none', 'class' => 'optionalField'],
                'class' => 'form-control span6'
            ],
            [
                'field' => 'Feed.settings.csv.delimiter',
                'label' => __('Delimiter'),
{'fraction_non_alphanumeric': 0.1667361835245047, 'fraction_numerical': 0.003545359749739312, 'mean_word_length': 1.447307986731309, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 187, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3672555', 'n_tokens_mistral': 2591, 'n_tokens_neox': 2427, 'n_words': 616}