mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-01 20:04:51 +02:00
fixes #911 new method pwg.history.log (to be used by PhotoSwipe, in SmartPocket or BootstrapDarkroom)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user