fixes #911 new method pwg.history.log (to be used by PhotoSwipe, in SmartPocket or BootstrapDarkroom)

This commit is contained in:
plegall
2022-08-26 16:58:11 +02:00
parent 1b66ca73f9
commit 002abf87df
2 changed files with 40 additions and 0 deletions
+27
View File
@@ -585,6 +585,33 @@ SELECT
);
}
/**
* API method
* Log a new line in visit history
* @since 13
*/
function ws_history_log($params, &$service)
{
global $logger, $page;
if (!empty($params['section']) and in_array($params['section'], get_enums(HISTORY_TABLE, 'section')))
{
$page['section'] = $params['section'];
}
if (!empty($params['cat_id']))
{
$page['category'] = array('id' => $params['cat_id']);
}
if (!empty($params['tags_string']) and preg_match('/^\d+(,\d+)*$/', $params['tags_string']))
{
$page['tag_ids'] = explode(',', $params['tags_string']);
}
pwg_log($params['image_id'], 'picture');
}
/**
* API method
* Returns lines of an history search
+13
View File
@@ -1293,6 +1293,19 @@ enabled_high, registration_date, registration_date_string, registration_date_sin
$ws_functions_root . 'pwg.users.php'
);
$service->addMethod(
'pwg.history.log',
'ws_history_log',
array(
'image_id' => array('type'=>WS_TYPE_ID),
'cat_id' => array('type'=>WS_TYPE_ID, 'default'=>null),
'section' => array('default'=>null),
'tags_string' => array('default'=>null),
),
'Log visit in history',
$ws_functions_root . 'pwg.php'
);
$service->addMethod(
'pwg.history.search',
'ws_history_search',