You are here

function flag_get_token in Flag 7.2

Same name and namespace in other branches
  1. 5 flag.module \flag_get_token()
  2. 6.2 flag.module \flag_get_token()
  3. 6 flag.module \flag_get_token()
  4. 7.3 flag.module \flag_get_token()

Get a private token used to protect links from spoofing - CSRF.

2 calls to flag_get_token()
flag_check_token in ./flag.module
Check to see if a token value matches the specified node.
flag_flag_link in ./flag.module
Implements hook_flag_link().

File

./flag.module, line 2041
The Flag module.

Code

function flag_get_token($content_id) {

  // Anonymous users get a less secure token, since it must be the same for all
  // anonymous users on the entire site to work with page caching.
  return $GLOBALS['user']->uid ? drupal_get_token($content_id) : md5(drupal_get_private_key() . $content_id);
}