You are here

function forward_tracker in Forward 6

Same name and namespace in other branches
  1. 5 forward.module \forward_tracker()
  2. 7.3 forward.module \forward_tracker()
  3. 7 forward.module \forward_tracker()
  4. 7.2 forward.module \forward_tracker()
1 string reference to 'forward_tracker'
forward_menu in ./forward.module
Menu Hooks

File

./forward.module, line 484

Code

function forward_tracker() {
  global $user;
  $form_state['values']['path'] = drupal_get_normal_path($_GET['path']);
  $args = explode('/', $form_state['values']['path']);
  if ($form_state['values']['path'] == variable_get('site_frontpage', 'node')) {
    $form_state['values']['path'] = '<front>';
  }
  if (flood_is_allowed('forward_tracker', variable_get('forward_flood_control_clicks', 20))) {
    if ($args[0] == 'node' && !empty($args[1]) && is_numeric($args[1])) {
      $nid = $args[1];
      db_query("UPDATE {forward_statistics} SET clickthrough_count = clickthrough_count+1 WHERE nid = %d", $nid);
    }
    db_query("INSERT INTO {forward_log} (path, type, timestamp, uid, hostname) VALUES ('%s', '%s', %d, %d, '%s')", $form_state['values']['path'], 'REF', time(), $user->uid, ip_address());
  }
  flood_register_event('forward_tracker');
  if (!_forward_url_is_external($form_state['values']['path'])) {
    drupal_goto(drupal_get_path_alias($form_state['values']['path']));
  }
  else {
    drupal_goto();
  }
}