Merge pull request #4927 from 4ekin/fix-postgresql-issues

fix: some PostgreSQL issues
pull/4939/head
Andras Iklody 2019-07-30 09:16:11 +02:00 committed by GitHub
commit de228e083f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 16 additions and 7 deletions

View File

@ -3037,7 +3037,7 @@ class AttributesController extends AppController
if ($id === 'selected') { if ($id === 'selected') {
$idList = json_decode($this->request->data['attribute_ids'], true); $idList = json_decode($this->request->data['attribute_ids'], true);
} }
$local = !empty($this->params['named']['local']); $local = empty($this->params['named']['local']) ? 0 : 1;
if (!$this->request->is('post')) { if (!$this->request->is('post')) {
$this->set('local', $local); $this->set('local', $local);
$this->set('object_id', $id); $this->set('object_id', $id);

View File

@ -76,6 +76,8 @@ class SharingGroupsController extends AppController
} }
} }
$this->SharingGroup->create(); $this->SharingGroup->create();
$sg['active'] = $sg['active'] ? 1: 0;
$sg['roaming'] = $sg['roaming'] ? 1: 0;
$sg['organisation_uuid'] = $this->Auth->user('Organisation')['uuid']; $sg['organisation_uuid'] = $this->Auth->user('Organisation')['uuid'];
$sg['local'] = 1; $sg['local'] = 1;
$sg['org_id'] = $this->Auth->user('org_id'); $sg['org_id'] = $this->Auth->user('org_id');

View File

@ -14,7 +14,11 @@ class QueryTool
{ {
$db = $model->getDataSource(); $db = $model->getDataSource();
$connection = $db->getConnection(); $connection = $db->getConnection();
$query = $connection->prepare('DELETE FROM ' . $table . ' WHERE ' . $field . ' = :value'); if ($db->config['datasource'] == 'Database/Mysql' ) {
$query = $connection->prepare('DELETE FROM ' . $table . ' WHERE ' . $field . ' = :value');
} elseif ($db->config['datasource'] == 'Database/Postgres' ) {
$query = $connection->prepare('DELETE FROM "' . $table . '" WHERE "' . $field . '" = :value');
}
$query->bindValue(':value', $value, $this->__pdoMap[$db->introspectType($value)]); $query->bindValue(':value', $value, $this->__pdoMap[$db->introspectType($value)]);
$query->execute(); $query->execute();
} }

View File

@ -3685,6 +3685,8 @@ class Attribute extends AppModel
} }
$attribute['event_id'] = $eventId; $attribute['event_id'] = $eventId;
$attribute['object_id'] = $objectId ? $objectId : 0; $attribute['object_id'] = $objectId ? $objectId : 0;
$attribute['to_ids'] = $attribute['to_ids'] ? 1 : 0;
$attribute['disable_correlation'] = $attribute['disable_correlation'] ? 1 : 0;
unset($attribute['id']); unset($attribute['id']);
if (isset($attribute['encrypt'])) { if (isset($attribute['encrypt'])) {
$result = $this->handleMaliciousBase64($eventId, $attribute['value'], $attribute['data'], array('md5')); $result = $this->handleMaliciousBase64($eventId, $attribute['value'], $attribute['data'], array('md5'));

View File

@ -190,7 +190,7 @@ class EventTag extends AppModel
'conditions' => array('name' => $allowedTags) 'conditions' => array('name' => $allowedTags)
) )
), ),
'group' => 'tag_id', 'group' => array('tag_id', 'Tag.name', 'Tag.id'),
'fields' => array('Tag.name', 'EventTag.tag_id', 'count(EventTag.tag_id) as score') 'fields' => array('Tag.name', 'EventTag.tag_id', 'count(EventTag.tag_id) as score')
)); ));
} }

View File

@ -74,6 +74,7 @@
<?php <?php
echo $this->Form->input('to_ids', array( echo $this->Form->input('to_ids', array(
'label' => __('for Intrusion Detection System'), 'label' => __('for Intrusion Detection System'),
'type' => 'checkbox'
)); ));
echo $this->Form->input('batch_import', array( echo $this->Form->input('batch_import', array(
'type' => 'checkbox' 'type' => 'checkbox'

View File

@ -191,7 +191,7 @@
<span style=" white-space: nowrap;"><?php echo $post_count?></span>&nbsp; <span style=" white-space: nowrap;"><?php echo $post_count?></span>&nbsp;
</td> </td>
<?php endif;?> <?php endif;?>
<?php if ('true' == $isSiteAdmin): ?> <?php if ($isSiteAdmin): ?>
<td class="short" ondblclick="location.href ='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>'"> <td class="short" ondblclick="location.href ='<?php echo $baseurl."/events/view/".$event['Event']['id'];?>'">
<?php echo h($event['User']['email']); ?>&nbsp; <?php echo h($event['User']['email']); ?>&nbsp;
</td> </td>

View File

@ -85,7 +85,7 @@
?> ?>
<div class="clear"></div> <div class="clear"></div>
<?php <?php
echo $this->Form->input('disabled', array('label' => __('Disable this user account'))); echo $this->Form->input('disabled', array('type' => 'checkbox', 'label' => __('Disable this user account')));
echo $this->Form->input('notify', array( echo $this->Form->input('notify', array(
'label' => __('Send credentials automatically'), 'label' => __('Send credentials automatically'),
'type' => 'checkbox', 'type' => 'checkbox',

View File

@ -66,7 +66,7 @@
<div class="clear"><span role="button" tabindex="0" aria-label="<?php echo __('Fetch the user\'s GnuPG key');?>" onClick="lookupPGPKey('UserEmail');" class="btn btn-inverse" style="margin-bottom:10px;"><?php echo __('Fetch GnuPG key');?></span></div> <div class="clear"><span role="button" tabindex="0" aria-label="<?php echo __('Fetch the user\'s GnuPG key');?>" onClick="lookupPGPKey('UserEmail');" class="btn btn-inverse" style="margin-bottom:10px;"><?php echo __('Fetch GnuPG key');?></span></div>
<?php <?php
if (Configure::read('SMIME.enabled')) echo $this->Form->input('certif_public', array('label' => __('SMIME key'), 'div' => 'clear', 'class' => 'input-xxlarge', 'placeholder' => __('Paste the user\'s SMIME public key in PEM format here.'))); if (Configure::read('SMIME.enabled')) echo $this->Form->input('certif_public', array('label' => __('SMIME key'), 'div' => 'clear', 'class' => 'input-xxlarge', 'placeholder' => __('Paste the user\'s SMIME public key in PEM format here.')));
echo $this->Form->input('termsaccepted', array('label' => __('Terms accepted'))); echo $this->Form->input('termsaccepted', array('type' => 'checkbox', 'label' => __('Terms accepted')));
echo $this->Form->input('change_pw', array('type' => 'checkbox', 'label' => __('Change Password'))); echo $this->Form->input('change_pw', array('type' => 'checkbox', 'label' => __('Change Password')));
echo $this->Form->input('autoalert', array('label' => __('Receive alerts when events are published'), 'type' => 'checkbox')); echo $this->Form->input('autoalert', array('label' => __('Receive alerts when events are published'), 'type' => 'checkbox'));
echo $this->Form->input('contactalert', array('label' => __('Receive alerts from "contact reporter" requests'), 'type' => 'checkbox')); echo $this->Form->input('contactalert', array('label' => __('Receive alerts from "contact reporter" requests'), 'type' => 'checkbox'));
@ -75,7 +75,7 @@
?> ?>
<div class="clear"></div> <div class="clear"></div>
<?php <?php
echo $this->Form->input('disabled', array('label' => __('Disable this user account'))); echo $this->Form->input('disabled', array('type' => 'checkbox', 'label' => __('Disable this user account')));
?> ?>
</fieldset> </fieldset>