Changeset 17345


Ignore:
Timestamp:
Aug 3, 2012, 11:53:43 AM (12 years ago)
Author:
mistic100
Message:

bug 2715: on picture page, tools buttons + Firefox prefetch increment the hit counter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r15578 r17345  
    423423}
    424424
    425 //---------- incrementation of the number of hits, we do this only if no action
     425
     426//---------- incrementation of the number of hits
     427// don't increment counter if in the Mozilla Firefox prefetch
     428if (isset($_SERVER['HTTP_X_MOZ']) and $_SERVER['HTTP_X_MOZ'] == 'prefetch')
     429{
     430  add_event_handler('allow_increment_element_hit_count', create_function('$b', 'return false;'));
     431}
     432else
     433{
     434  // don't increment counter if comming from the same picture (actions)
     435  if (pwg_get_session_var('referer_image_id',0) == $page['image_id'])
     436  {
     437    add_event_handler('allow_increment_element_hit_count', create_function('$b', 'return false;'));
     438  }
     439  pwg_set_session_var('referer_image_id', $page['image_id']);
     440}
     441
     442// don't increment if adding a comment
    426443if (trigger_event('allow_increment_element_hit_count', !isset($_POST['content']) ) )
    427444{
     
    434451  pwg_query($query);
    435452}
     453
    436454//---------------------------------------------------------- related categories
    437455$query = '
Note: See TracChangeset for help on using the changeset viewer.