Merge branch 'active_development' of https://github.com/HB9HIL/Cloudlog into active_development

This commit is contained in:
Andreas
2024-01-08 12:31:05 +01:00
2 changed files with 9 additions and 3 deletions

View File

@@ -437,7 +437,6 @@ class User_Model extends CI_Model {
// Checks a user's level of access against the given $level
function authorize($level) {
$u = $this->get_by_id($this->session->userdata('user_id'));
$this->set_last_seen($u->row()->user_id);
$l = $this->config->item('auth_mode');
// Check to see if the minimum level of access is higher than
// the user's own level. If it is, use that.
@@ -445,6 +444,7 @@ class User_Model extends CI_Model {
$level = $this->config->item('auth_mode');
}
if(($this->validate_session()) && ($u->row()->user_type >= $level) || $this->config->item('use_auth') == FALSE || $level == 0) {
$this->set_last_seen($u->row()->user_id);
return 1;
} else {
return 0;

View File

@@ -44,7 +44,7 @@
<th scope="col"><?php echo lang('gen_hamradio_callsign'); ?></th>
<th scope="col"><?php echo lang('admin_email'); ?></th>
<th scope="col"><?php echo lang('admin_type'); ?></th>
<th scope="col"><?php echo lang('admin_last_seen'); ?></th>
<th scope="col"><?php echo lang('admin_last_seen'); echo " <a href=" . site_url('user') . " data-bs-toggle=\"tooltip\" title=\"Refresh\" class=\"btn btn-link btn-sm ms-0.5\"><i class=\"fas fa-sync\"></i></a>"; ?></th>
<th></th>
<th style="text-align: center; vertical-align: middle;" scope="col"><?php echo lang('admin_edit'); ?></th>
<th style="text-align: center; vertical-align: middle;" scope="col"><?php echo lang('admin_password_reset'); ?></th>
@@ -65,7 +65,13 @@
echo $l[$row->user_type]; ?></td>
<td style="text-align: left; vertical-align: middle;"><?php
if ($row->last_seen != null) { // if the user never logged in before the value is null. We can show "never" then.
echo $row->last_seen;
$lastSeenTimestamp = strtotime($row->last_seen);
$currentTimestamp = time();
if (($currentTimestamp - $lastSeenTimestamp) < 120) {
echo "<a><i style=\"color: green;\" class=\"fas fa-circle\"></i> " . $row->last_seen . "</a>";
} else {
echo "<a><i style=\"color: red;\" class=\"fas fa-circle\"></i> " . $row->last_seen . "</a>";
}
} else {
echo lang('general_word_never');
}?>