creating user agent column for activities

This commit is contained in:
Matthieu Leproux
2022-06-21 13:56:34 +02:00
parent 0e0ab49fac
commit 3d69c6b093
4 changed files with 37 additions and 5 deletions
+4 -3
View File
@@ -556,9 +556,10 @@ function pwg_activity($object, $object_id, $action, $details=array())
}
}
if ('user' == $object and 'login' == $action)
$user_agent = null;
if ('user' == $object and 'login' == $action and isset($_SERVER['HTTP_USER_AGENT']))
{
$details['agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown';
$user_agent = $_SERVER['HTTP_USER_AGENT'];
}
if ('photo' == $object and 'add' == $action and !isset($details['sync']))
@@ -568,7 +569,6 @@ function pwg_activity($object, $object_id, $action, $details=array())
{
$details['added_with'] = 'browser';
}
$details['agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'unknown';
}
if (in_array($object, array('album', 'photo')) and 'delete' == $action and isset($_GET['page']) and 'site_update' == $_GET['page'])
@@ -603,6 +603,7 @@ function pwg_activity($object, $object_id, $action, $details=array())
'session_idx' => session_id(),
'ip_address' => $ip_address,
'details' => $details_insert,
'user_agent' => $user_agent,
);
}
+9 -2
View File
@@ -445,7 +445,8 @@ SELECT
session_idx,
ip_address,
occured_on,
details
details,
user_agent
FROM '.ACTIVITY_TABLE.'
WHERE performed_by = '.$param['uid'].'
ORDER BY activity_id DESC LIMIT '.$page_size.' OFFSET '.$page_offset.';
@@ -463,7 +464,8 @@ SELECT
session_idx,
ip_address,
occured_on,
details
details,
user_agent
FROM '.ACTIVITY_TABLE.'
ORDER BY activity_id DESC LIMIT '.$page_size.' OFFSET '.$page_offset.';
;';
@@ -477,6 +479,11 @@ SELECT
$row['details'] = str_replace('`rank`', 'rank', $row['details']);
$details = @unserialize($row['details']);
if (isset($row['user_agent']))
{
$details['agent'] = $row['user_agent'];
}
if (isset($details['method']))
{
$detailsType = 'method';