diff --git a/include/config_default.inc.php b/include/config_default.inc.php index cba091535..3818cfd57 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -750,6 +750,12 @@ $conf['dashboard_check_for_updates'] = true; // Number Weeks displayed on activity chart on the dashboard $conf['dashboard_activity_nb_weeks'] = 4; +// On the Admin>Users>Activity page, should we display the connection/disconnections? +// 'all' = do not filter, display all +// 'admins_only' = only display connections of admin users +// 'none' = don't even display connections of admin users +$conf['activity_display_connections'] = 'admins_only'; + // On album mover page, number of seconds before auto openning album when // dragging an album. In milliseconds. 3 seconds by default. $conf['album_move_delay_before_auto_opening'] = 3*1000; diff --git a/include/ws_functions/pwg.php b/include/ws_functions/pwg.php index 75ef063a3..f985a0a20 100644 --- a/include/ws_functions/pwg.php +++ b/include/ws_functions/pwg.php @@ -434,8 +434,7 @@ function ws_getActivityList($param, &$service) $user_ids = array(); - if (isset($param['uid'])) { - $query = ' + $query = ' SELECT activity_id, performed_by, @@ -447,29 +446,29 @@ SELECT occured_on, details, user_agent - FROM '.ACTIVITY_TABLE.' - WHERE performed_by = '.$param['uid'].' - ORDER BY activity_id DESC LIMIT '.$page_size.' OFFSET '.$page_offset.'; -;'; - } - else + FROM '.ACTIVITY_TABLE; + + if (isset($param['uid'])) { - $query = ' -SELECT - activity_id, - performed_by, - object, - object_id, - action, - session_idx, - ip_address, - occured_on, - details, - user_agent - FROM '.ACTIVITY_TABLE.' - ORDER BY activity_id DESC LIMIT '.$page_size.' OFFSET '.$page_offset.'; -;'; + $query.= ' + WHERE performed_by = '.$param['uid']; } + elseif ('none' == $conf['activity_display_connections']) + { + $query.= ' + WHERE action NOT IN (\'login\', \'logout\')'; + } + elseif ('admins_only' == $conf['activity_display_connections']) + { + include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); + $query.= ' + WHERE NOT (action IN (\'login\', \'logout\') AND object_id NOT IN ('.implode(',', get_admins()).'))'; + } + + $query.= ' + ORDER BY activity_id DESC + LIMIT '.$page_size.' OFFSET '.$page_offset.' +;'; $line_id = 0; $result = pwg_query($query);