mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 01:03:31 +02:00
This commit is contained in:
@@ -115,4 +115,24 @@ function encode_slideshow_params($decode_params=array())
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase the number of visits for a given photo.
|
||||
*
|
||||
* Code moved from picture.php to be used by both the API and picture.php
|
||||
*
|
||||
* @since 14
|
||||
* @param int $image_id
|
||||
*/
|
||||
function increase_image_visit_counter($image_id)
|
||||
{
|
||||
// avoiding auto update of "lastmodified" field
|
||||
$query = '
|
||||
UPDATE
|
||||
'.IMAGES_TABLE.'
|
||||
SET hit = hit+1, lastmodified = lastmodified
|
||||
WHERE id = '.$image_id.'
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -614,6 +614,14 @@ function ws_history_log($params, &$service)
|
||||
$page['tag_ids'] = explode(',', $params['tags_string']);
|
||||
}
|
||||
|
||||
// when visiting a photo (which is currently, in version 14, the only event registered
|
||||
// by pwg.history.log) we should also increment images.hit
|
||||
if (!empty($params['image_id']))
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
|
||||
increase_image_visit_counter($params['image_id']);
|
||||
}
|
||||
|
||||
pwg_log($params['image_id'], 'picture');
|
||||
}
|
||||
|
||||
|
||||
+1
-8
@@ -430,14 +430,7 @@ else
|
||||
// don't increment if adding a comment
|
||||
if (trigger_change('allow_increment_element_hit_count', $inc_hit_count, $page['image_id'] ) )
|
||||
{
|
||||
// avoiding auto update of "lastmodified" field
|
||||
$query = '
|
||||
UPDATE
|
||||
'.IMAGES_TABLE.'
|
||||
SET hit = hit+1, lastmodified = lastmodified
|
||||
WHERE id = '.$page['image_id'].'
|
||||
;';
|
||||
pwg_query($query);
|
||||
increase_image_visit_counter($page['image_id']);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------- related categories
|
||||
|
||||
Reference in New Issue
Block a user