function forward_tracker in Forward 7
Same name and namespace in other branches
- 5 forward.module \forward_tracker()
- 6 forward.module \forward_tracker()
- 7.3 forward.module \forward_tracker()
- 7.2 forward.module \forward_tracker()
Email Tracker
1 string reference to 'forward_tracker'
- forward_menu in ./
forward.module - Menu Hooks
File
- ./
forward.module, line 472
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>';
}
// Flood control - only allow a certain number of tracking events per minute per IP address
if (flood_is_allowed('forward_tracker', variable_get('forward_flood_control_clicks', 3), 60)) {
if ($args[0] == 'node' && !empty($args[1]) && is_numeric($args[1])) {
$nid = $args[1];
db_update('forward_statistics')
->expression('clickthrough_count', 'clickthrough_count + 1')
->condition('nid', $nid)
->execute();
}
$id = db_insert('forward_log')
->fields(array(
'path' => $form_state['values']['path'],
'type' => 'REF',
'timestamp' => REQUEST_TIME,
'uid' => $user->uid,
'hostname' => ip_address(),
))
->execute();
}
flood_register_event('forward_tracker', 60);
if (!url_is_external($form_state['values']['path'])) {
drupal_goto(drupal_get_path_alias($form_state['values']['path']));
}
else {
drupal_goto();
}
}