diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql
new file mode 100644
index 0000000000..e6dc902733
--- /dev/null
+++ b/pandora_console/extras/mr/62.sql
@@ -0,0 +1,14 @@
+START TRANSACTION;
+
+CREATE TABLE IF NOT EXISTS `tsesion_filter` (
+ `id_filter` INT NOT NULL AUTO_INCREMENT,
+ `id_name` TEXT NULL,
+ `text` TEXT NULL,
+ `period` TEXT NULL,
+ `ip` TEXT NULL,
+ `type` TEXT NULL,
+ `user` TEXT NULL,
+ PRIMARY KEY (`id_filter`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+COMMIT;
diff --git a/pandora_console/include/ajax/audit_log.php b/pandora_console/include/ajax/audit_log.php
new file mode 100644
index 0000000000..3bf5e09d24
--- /dev/null
+++ b/pandora_console/include/ajax/audit_log.php
@@ -0,0 +1,457 @@
+ $values['id_name']]
+ );
+
+ if ($exists) {
+ echo 'duplicate';
+ } else {
+ $result = db_process_sql_insert('tsesion_filter', $values);
+
+ if ($result === false) {
+ echo 'error';
+ } else {
+ echo $result;
+ }
+ }
+}
+
+
+if ($recover_aduit_log_select) {
+ echo json_encode(audit_get_audit_filter_select());
+}
+
+if ($update_log_filter) {
+ $values = [];
+ $id = get_parameter('id');
+ $values['text'] = get_parameter('text', '');
+ $values['period'] = get_parameter('period', '');
+ $values['ip'] = get_parameter('ip', '');
+ $values['type'] = get_parameter('type', -1);
+ $values['user'] = get_parameter('user', -1);
+
+ $result = db_process_sql_update(
+ 'tsesion_filter',
+ $values,
+ ['id_filter' => $id]
+ );
+
+ if ($result === false) {
+ echo 'error';
+ } else {
+ echo 'ok';
+ }
+}
+
+
+if ($get_filter_values) {
+ $id_filter = get_parameter('id');
+
+ $event_filter = audit_get_audit_log_filter($id_filter);
+ echo json_encode($event_filter);
+}
+
+
+if ($load_filter_modal) {
+ $filters = audit_get_audit_filter_select();
+ $user_groups_array = users_get_groups_for_select(
+ $config['id_user'],
+ $access,
+ true,
+ true,
+ false
+ );
+
+ echo '
';
+
+ $table = new StdClass;
+ $table->id = 'load_filter_form';
+ $table->width = '100%';
+ $table->cellspacing = 4;
+ $table->cellpadding = 4;
+ $table->class = 'databox';
+ if (is_metaconsole()) {
+ $table->cellspacing = 0;
+ $table->cellpadding = 0;
+ $table->class = 'databox filters';
+ }
+
+ $table->styleTable = 'font-weight: bold; color: #555; text-align:left;';
+ $filter_id_width = '200px';
+ if (is_metaconsole()) {
+ $filter_id_width = '150px';
+ }
+
+ $data = [];
+ $table->rowid[3] = 'update_filter_row1';
+ $data[0] = __('Load filter').$jump;
+ $data[0] .= html_print_select(
+ $filters,
+ 'filter_id',
+ '',
+ '',
+ __('None'),
+ 0,
+ true,
+ false,
+ true,
+ '',
+ false,
+ 'margin-left:5px; width:'.$filter_id_width.';'
+ );
+ $data[1] = html_print_submit_button(
+ __('Load filter'),
+ 'load_filter',
+ false,
+ 'class="sub upd" onclick="load_filter_values()"',
+ true
+ );
+ $data[1] .= html_print_input_hidden('load_filter', 1, true);
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ html_print_table($table);
+ echo '
';
+ ?>
+
+ ';
+
+ if (check_acl($config['id_user'], 0, 'EW') === 1 || check_acl($config['id_user'], 0, 'EM') === 1) {
+ echo '';
+ $table = new StdClass;
+ $table->id = 'save_filter_form';
+ $table->width = '100%';
+ $table->cellspacing = 4;
+ $table->cellpadding = 4;
+ $table->class = 'databox';
+ if (is_metaconsole()) {
+ $table->class = 'databox filters';
+ $table->cellspacing = 0;
+ $table->cellpadding = 0;
+ }
+
+ $table->styleTable = 'font-weight: bold; text-align:left;';
+ if (!is_metaconsole()) {
+ $table->style[0] = 'width: 50%; width:50%;';
+ }
+
+ $data = [];
+ $table->rowid[0] = 'update_save_selector';
+ $data[0] = html_print_radio_button(
+ 'filter_mode',
+ 'new',
+ __('New filter'),
+ true,
+ true
+ );
+
+ $data[1] = html_print_radio_button(
+ 'filter_mode',
+ 'update',
+ __('Update filter'),
+ false,
+ true
+ );
+
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ $data = [];
+ $table->rowid[1] = 'save_filter_row1';
+ $data[0] = __('Filter name').$jump;
+ $data[0] .= html_print_input_text('id_name', '', '', 15, 255, true);
+
+ $data[1] = html_print_submit_button(
+ __('Save filter'),
+ 'save_filter',
+ false,
+ 'class="sub wand" onclick="save_new_filter();"',
+ true
+ );
+
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ $data = [];
+ $table->rowid[2] = 'save_filter_row2';
+
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ $data = [];
+ $table->rowid[3] = 'update_filter_row1';
+ $data[0] = __('Overwrite filter').$jump;
+
+ $_filters_update = audit_get_audit_filter_select();
+
+ $data[0] .= html_print_select(
+ $_filters_update,
+ 'overwrite_filter',
+ '',
+ '',
+ '',
+ 0,
+ true
+ );
+ $data[1] = html_print_submit_button(
+ __('Update filter'),
+ 'update_filter',
+ false,
+ 'class="sub upd" onclick="save_update_filter();"',
+ true
+ );
+
+ $table->data[] = $data;
+ $table->rowclass[] = '';
+
+ html_print_table($table);
+ } else {
+ include 'general/noaccess.php';
+ }
+
+ echo '';
+ ?>
+
+ 'load-filter',
+ 'class' => 'float-left margin-right-2 margin-left-2 sub config',
+ 'text' => __('Load filter'),
+ 'onclick' => '',
+ ];
+
+ $buttons[] = [
+ 'id' => 'save-filter',
+ 'class' => 'float-left margin-right-2 sub wand',
+ 'text' => __('Save filter'),
+ 'onclick' => '',
+ ];
+
+ // Modal for save/load filters.
+ echo '';
+ echo '';
+
// Load datatables user interface.
ui_print_datatable(
[
@@ -174,9 +194,10 @@ class AuditLog extends HTML
],
'search_button_class' => 'sub filter float-right',
'form' => [
- 'inputs' => [
+ 'extra_buttons' => $buttons,
+ 'inputs' => [
[
- 'label' => __('Search'),
+ 'label' => __('Free search').ui_print_help_tip(__('Search filter by User, Action, Date, Source IP or Comments fields content'), true),
'type' => 'text',
'class' => 'w200px',
'id' => 'filter_text',
@@ -211,7 +232,9 @@ class AuditLog extends HTML
'type' => 'select_from_sql',
'nothing' => __('All'),
'nothing_value' => '-1',
- 'sql' => 'SELECT id_user, id_user AS text FROM tusuario',
+ 'sql' => 'SELECT id_user, id_user AS text FROM tusuario UNION SELECT "SYSTEM"
+ AS id_user, "SYSTEM" AS text UNION SELECT "N/A"
+ AS id_user, "N/A" AS text',
'class' => 'mw250px',
'id' => 'filter_user',
'name' => 'filter_user',
@@ -269,7 +292,10 @@ class AuditLog extends HTML
if (empty($this->filterText) === false) {
$filter .= sprintf(
- " AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')",
+ " AND (accion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR id_usuario LIKE '%%%s%%' OR fecha LIKE '%%%s%%' OR ip_origen LIKE '%%%s%%')",
+ $this->filterText,
+ $this->filterText,
+ $this->filterText,
$this->filterText,
$this->filterText
);
@@ -366,38 +392,147 @@ class AuditLog extends HTML
// Javascript content.
?>
-
+