diff --git a/.gitignore b/.gitignore
index 3dd84d9..d20187c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@
locales/po/*.mo
+.omc/
diff --git a/audit.php b/audit.php
index dffed41..2474af4 100644
--- a/audit.php
+++ b/audit.php
@@ -1,4 +1,6 @@
$content) {
+ $nattribs = [];
+ foreach(($attribs ?? []) as $field => $content) {
$nattribs[$field] = $content;
}
ksort($nattribs);
@@ -107,12 +109,12 @@
}
if ($i % $columns > 0) {
- $output . '
| | ';
+ $output .= ' | | ';
}
}
// Display the Record Data under selected_items if it is not empty
- $recordData = json_decode($data['object_data']);
+ $recordData = json_decode($data['object_data'] ?? '');
if (!empty($recordData)) {
$output .= '';
$output .= '
|
';
@@ -181,7 +183,7 @@ function audit_export_rows() {
foreach($events as $event) {
$post = json_decode($event['post']);
$poster = '';
- foreach($post as $var => $value) {
+ foreach(($post ?? []) as $var => $value) {
if (is_array($value)) {
$poster .= ($poster != '' ? '|':'') . $var . ':' . implode('%', $value);
} else {
@@ -211,40 +213,40 @@ function audit_csv_escape($string) {
function process_request_vars() {
/* ================= input validation and session storage ================= */
$filters = array(
- 'rows' => array(
+ 'rows' => [
'filter' => FILTER_VALIDATE_INT,
'pageset' => true,
'default' => '-1'
- ),
- 'page' => array(
+ ],
+ 'page' => [
'filter' => FILTER_VALIDATE_INT,
'default' => '1'
- ),
- 'filter' => array(
+ ],
+ 'filter' => [
'filter' => FILTER_DEFAULT,
'pageset' => true,
'default' => ''
- ),
+ ],
'sort_column' => array(
'filter' => FILTER_CALLBACK,
'default' => 'event_time',
- 'options' => array('options' => 'sanitize_search_string')
+ 'options' => ['options' => 'sanitize_search_string']
),
'sort_direction' => array(
'filter' => FILTER_CALLBACK,
'default' => 'DESC',
- 'options' => array('options' => 'sanitize_search_string')
+ 'options' => ['options' => 'sanitize_search_string']
),
- 'user_id' => array(
+ 'user_id' => [
'filter' => FILTER_VALIDATE_INT,
'pageset' => true,
'default' => '-1'
- ),
+ ],
'event_page' => array(
'filter' => FILTER_CALLBACK,
'pageset' => true,
'default' => '-1',
- 'options' => array('options' => 'sanitize_search_string')
+ 'options' => ['options' => 'sanitize_search_string']
)
);
diff --git a/audit_functions.php b/audit_functions.php
index 6a93705..ba450e0 100644
--- a/audit_functions.php
+++ b/audit_functions.php
@@ -1,7 +1,14 @@
false));
+ $selected_items = unserialize(stripslashes($post['selected_items']), ['allowed_classes' => false]);
$drop_action = $post['drp_action'];
} else {
- $selected_items = array();
+ $selected_items = [];
$drop_action = false;
}
@@ -209,7 +216,7 @@ function audit_config_insert() {
db_execute_prepared('INSERT INTO audit_log (page, user_id, action, ip_address, user_agent, event_time, post, object_data)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
- array($page, $user_id, $action, $ip_address, $user_agent, $event_time, $post, $object_data));
+ [$page, $user_id, $action, $ip_address, $user_agent, $event_time, $post, $object_data]);
if ($audit_log == '') {
set_config_option('audit_log_external_path', $base . '/log/audit.log');
@@ -226,7 +233,7 @@ function audit_config_insert() {
}
if (read_config_option('audit_log_external') == 'on' && $audit_log != '' && file_exists($audit_log)) {
- $log_data = array(
+ $log_data = [
'page' => $page,
'user_id' => $user_id,
'action' => $action,
@@ -235,7 +242,7 @@ function audit_config_insert() {
'event_time' => $event_time,
'post' => $post,
'object_data' => $object_data
- );
+ ];
$log_msg = json_encode($log_data) . "\n";
$file = fopen($audit_log, 'a');
@@ -263,7 +270,7 @@ function audit_config_insert() {
db_execute_prepared('INSERT INTO audit_log (page, user_id, action, ip_address, user_agent, event_time, post)
VALUES (?, ?, ?, ?, ?, ?, ?)',
- array($page, $user_id, $action, $ip_address, $user_agent, $event_time, $post));
+ [$page, $user_id, $action, $ip_address, $user_agent, $event_time, $post]);
}
}
}
\ No newline at end of file
diff --git a/index.php b/index.php
index 2e22b8c..a25b19c 100644
--- a/index.php
+++ b/index.php
@@ -1,4 +1,6 @@
$_SESSION['audit_message'], 'type' => 'info');
+ $messages['audit_message'] = ['message' => $_SESSION['audit_message'], 'type' => 'info'];
}
$audit_retentions = array(
@@ -269,7 +271,7 @@ function audit_config_arrays() {
$menu[__('Utilities')]['plugins/audit/audit.php'] = __('Audit Log', 'audit');
if (function_exists('auth_augment_roles')) {
- auth_augment_roles(__('System Administration'), array('audit.php'));
+ auth_augment_roles(__('System Administration'), ['audit.php']);
}
audit_check_upgrade();