diff --git a/core/user_logs/app_config.php b/core/user_logs/app_config.php index 518ddb57e8..2be6cd2353 100644 --- a/core/user_logs/app_config.php +++ b/core/user_logs/app_config.php @@ -19,7 +19,6 @@ $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'user_log_delete'; - //$apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $y++; //User Logs @@ -80,6 +79,11 @@ $apps[$x]['db'][$y]['fields'][$z]['search_by'] = 'true'; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the user agent.'; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'session_id'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['search_by'] = 'true'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ''; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "insert_date"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz'; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date'; diff --git a/core/user_logs/resources/classes/user_logs.php b/core/user_logs/resources/classes/user_logs.php index 7c69ab5a39..4a4d32dfc5 100644 --- a/core/user_logs/resources/classes/user_logs.php +++ b/core/user_logs/resources/classes/user_logs.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2019-2021 + Portions created by the Initial Developer are Copyright (C) 2019-2024 the Initial Developer. All Rights Reserved. Contributor(s): @@ -63,8 +63,9 @@ if (!class_exists('user_logs')) { * add user_logs */ public static function add($result) { - $array = []; + //prepare the array + $array = []; $array['user_logs'][0]["timestamp"] = 'now()'; $array['user_logs'][0]["domain_uuid"] = $result['domain_uuid']; $array['user_logs'][0]["user_uuid"] = $result['user_uuid']; @@ -72,6 +73,7 @@ if (!class_exists('user_logs')) { $array['user_logs'][0]["type"] = 'login'; $array['user_logs'][0]["remote_address"] = $_SERVER['REMOTE_ADDR']; $array['user_logs'][0]["user_agent"] = $_SERVER['HTTP_USER_AGENT']; + $array['user_logs'][0]["session_id"] = session_id(); $array['user_logs'][0]["type"] = 'login'; if ($result["authorized"] == "true") { $array['user_logs'][0]["result"] = 'success'; diff --git a/core/user_logs/user_logs.php b/core/user_logs/user_logs.php index cccaf5645f..8a4d16a00b 100644 --- a/core/user_logs/user_logs.php +++ b/core/user_logs/user_logs.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2018 - 2023 + Portions created by the Initial Developer are Copyright (C) 2018 - 2024 the Initial Developer. All Rights Reserved. */ @@ -81,6 +81,9 @@ exit; } +//get the session path + $session_path = session_save_path(); + //get order and order by $order_by = $_GET["order_by"] ?? null; $order = $_GET["order"] ?? null; @@ -153,7 +156,8 @@ $sql .= "type, "; $sql .= "result, "; $sql .= "remote_address, "; - $sql .= "user_agent "; + $sql .= "user_agent, "; + $sql .= "session_id "; $sql .= "from v_user_logs as u, v_domains as d "; if (permission_exists('user_log_all') && $show == 'all') { $sql .= "where true "; @@ -236,6 +240,7 @@ } echo "".$text['label-date']."\n"; echo "".$text['label-time']."\n"; + echo "".$text['label-status']."\n"; echo th_order_by('username', $text['label-username'], $order_by, $order); echo th_order_by('type', $text['label-type'], $order_by, $order); echo th_order_by('result', $text['label-result'], $order_by, $order); @@ -246,6 +251,10 @@ if (!empty($user_logs) && is_array($user_logs) && @sizeof($user_logs) != 0) { $x = 0; foreach ($user_logs as $row) { + //check the session status + $session_file = 'sess_'.$row['session_id']; + $session_status = (!empty($row['session_id']) && file_exists($session_path.'/'.$session_file)) ? 'active' : 'inactive'; + echo "\n"; if (permission_exists('user_log_delete')) { echo " \n"; @@ -258,6 +267,7 @@ } echo " ".escape($row['date_formatted'])."\n"; echo " ".escape($row['time_formatted'])."\n"; + echo "
\n"; echo " ".escape($row['username'])."\n"; echo " ".escape($row['type'])."\n"; echo " ".escape($row['result'])."\n"; diff --git a/themes/default/css.php b/themes/default/css.php index 12dabd518c..12aa954af9 100644 --- a/themes/default/css.php +++ b/themes/default/css.php @@ -3230,6 +3230,22 @@ else { //default: white white-space: nowrap; } + .list-status-active { + width: 10px; + height: 10px; + background-color: green; + border-radius: 50%; + display: inline-block; + } + + .list-status-inactive { + width: 10px; + height: 10px; + background-color: #ccc; + border-radius: 50%; + display: inline-block; + } + /* EDIT ********************************************************************************/ td.edit_delete_checkbox_all {