fixes #1920 new output parameter save_visits for pwg.session.getStatus

This commit is contained in:
plegall
2023-08-03 11:19:44 +02:00
parent 7d73935323
commit d92986a13d
2 changed files with 31 additions and 13 deletions
+30 -13
View File
@@ -385,6 +385,35 @@ SELECT id, name
return $languages;
}
/**
* Does the current user must log visits in history table
*
* @since 14
*
* @param int $image_id
* @param string $image_type
*
* @return bool
*/
function do_log($image_id = null, $image_type = null)
{
global $conf;
$do_log = $conf['log'];
if (is_admin())
{
$do_log = $conf['history_admin'];
}
if (is_a_guest())
{
$do_log = $conf['history_guest'];
}
$do_log = trigger_change('pwg_log_allowed', $do_log, $image_id, $image_type);
return $do_log;
}
/**
* log the visit into history table
*
@@ -414,19 +443,7 @@ UPDATE '.USER_INFOS_TABLE.'
pwg_query($query);
}
$do_log = $conf['log'];
if (is_admin())
{
$do_log = $conf['history_admin'];
}
if (is_a_guest())
{
$do_log = $conf['history_guest'];
}
$do_log = trigger_change('pwg_log_allowed', $do_log, $image_id, $image_type);
if (!$do_log)
if (!do_log($image_id, $image_type))
{
return false;
}
+1
View File
@@ -389,6 +389,7 @@ function ws_session_getStatus($params, &$service)
list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
$res['current_datetime'] = $dbnow;
$res['version'] = PHPWG_VERSION;
$res['save_visits'] = do_log();
// Piwigo Remote Sync does not support receiving the available sizes
$piwigo_remote_sync_agent = 'Apache-HttpClient/';