Navigation Menu

Skip to content

Commit

Permalink
bug 2715: on picture page, tools buttons + Firefox prefetch increment…
Browse files Browse the repository at this point in the history
… the hit counter

git-svn-id: http://piwigo.org/svn/trunk@17345 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
mistic100 committed Aug 3, 2012
1 parent 00ca4f9 commit 77e753e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion picture.php
Expand Up @@ -422,7 +422,24 @@ function default_picture_content($content, $element_info)
}
}

//---------- 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 = '
Expand All @@ -433,6 +450,7 @@ function default_picture_content($content, $element_info)
;';
pwg_query($query);
}

//---------------------------------------------------------- related categories
$query = '
SELECT category_id,uppercats,commentable,global_rank
Expand Down

0 comments on commit 77e753e

Please sign in to comment.