From cac08d6f486f35322cfe873caaab7f730ac838b1 Mon Sep 17 00:00:00 2001 From: rvelices Date: Mon, 14 Apr 2014 21:38:41 +0000 Subject: simplified allow_increment_element_hit_count call and also pass the image id in the event ... git-svn-id: http://piwigo.org/svn/trunk@28184 68402e56-0260-453c-a942-63ccdbb3a9ee --- picture.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'picture.php') diff --git a/picture.php b/picture.php index 10c39a789..13599bc43 100644 --- a/picture.php +++ b/picture.php @@ -417,23 +417,24 @@ UPDATE '.CATEGORIES_TABLE.' //---------- incrementation of the number of hits +$inc_hit_count = !isset($_POST['content']); // don't increment counter if in the Mozilla Firefox prefetch if (isset($_SERVER['HTTP_X_MOZ']) and $_SERVER['HTTP_X_MOZ'] == 'prefetch') { - add_event_handler('allow_increment_element_hit_count', create_function('$b', 'return false;')); + $inc_hit_count = false; } else { // don't increment counter if comming from the same picture (actions) if (pwg_get_session_var('referer_image_id',0) == $page['image_id']) { - add_event_handler('allow_increment_element_hit_count', create_function('$b', 'return false;')); + $inc_hit_count = false; } pwg_set_session_var('referer_image_id', $page['image_id']); } // don't increment if adding a comment -if (trigger_event('allow_increment_element_hit_count', !isset($_POST['content']) ) ) +if (trigger_event('allow_increment_element_hit_count', $inc_hit_count, $page['image_id'] ) ) { $query = ' UPDATE -- cgit v1.2.3