changes in connected users view

This commit is contained in:
alejandro-campos 2020-12-15 17:40:15 +01:00
parent 463013b06a
commit 7a74ae4d20
1 changed files with 10 additions and 9 deletions

View File

@ -76,20 +76,21 @@ function users_extension_main_god($god=true)
$table->head[0] = __('User');
$table->head[1] = __('IP');
$table->head[2] = __('Date');
$table->head[2] = __('Last login');
$table->head[3] = __('Last contact');
$rowPair = true;
$iterator = 0;
// Get data
foreach ($rows as $row) {
// Get ip_origin of the last login of the user
// Get data of user's last login.
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$ip_origin = db_get_value_sql(
$last_login_data = db_get_row_sql(
sprintf(
"SELECT ip_origen
"SELECT ip_origen, utimestamp
FROM tsesion
WHERE id_usuario = '%s'
AND descripcion = '".io_safe_input('Logged in')."'
@ -100,9 +101,9 @@ function users_extension_main_god($god=true)
break;
case 'oracle':
$ip_origin = db_get_value_sql(
$last_login_data = db_get_row_sql(
sprintf(
"SELECT ip_origen
"SELECT ip_origen, utimestamp
FROM tsesion
WHERE id_usuario = '%s'
AND to_char(descripcion) = '".io_safe_input('Logged in')."'
@ -124,8 +125,9 @@ function users_extension_main_god($god=true)
$data = [];
$data[0] = '<a href="index.php?sec=gusuarios&amp;sec2=godmode/users/configure_user&amp;id='.$row['id_user'].'">'.$row['id_user'].'</a>';
$data[1] = $ip_origin;
$data[2] = date($config['date_format'], $row['last_connect']);
$data[1] = $last_login_data['ip_origin'];
$data[2] = date($config['date_format'], $last_login_data['utimestamp']);
$data[3] = date($config['date_format'], $row['last_connect']);
array_push($table->data, $data);
}
@ -134,7 +136,6 @@ function users_extension_main_god($god=true)
}
extensions_add_godmode_menu_option(__('Users connected'), 'UM', 'gusuarios', 'users/icon.png', 'v1r1');
extensions_add_operation_menu_option(__('Users connected'), 'workspace', 'users/icon.png', 'v1r1', '', 'UM');
extensions_add_godmode_function('users_extension_main_god');