diff options
author | mistic100 <mistic@piwigo.org> | 2012-08-03 09:55:51 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2012-08-03 09:55:51 +0000 |
commit | 8bca490ac0be9a115828caa2065758976dcb7948 (patch) | |
tree | 13624f828cb7014da44afe1f4aa4a5a013fbbf3c | |
parent | 1af611b10f294607a9956036976ebc9a657d7aea (diff) |
Merged revision(s) r17345 from trunk:
bug 2715: on picture page, tools buttons + Firefox prefetch increment the hit counter
git-svn-id: http://piwigo.org/svn/branches/2.4@17346 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | picture.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/picture.php b/picture.php index 6048aa2e0..2b75493de 100644 --- a/picture.php +++ b/picture.php @@ -422,7 +422,24 @@ UPDATE '.USER_CACHE_CATEGORIES_TABLE.' } } -//---------- incrementation of the number of hits, we do this only if no action + +//---------- incrementation of the number of hits +// 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;')); +} +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;')); + } + 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']) ) ) { $query = ' @@ -433,6 +450,7 @@ UPDATE ;'; pwg_query($query); } + //---------------------------------------------------------- related categories $query = ' SELECT category_id,uppercats,commentable,global_rank |