You are here

function fivestar_get_token in Fivestar 6

Same name and namespace in other branches
  1. 5 fivestar.module \fivestar_get_token()
  2. 6.2 fivestar.module \fivestar_get_token()

Get a private token used to protect links from CSRF attacks.

2 calls to fivestar_get_token()
fivestar_check_token in ./fivestar.module
Check to see if a token value matches the specified node.
fivestar_expand in ./fivestar.module
Process callback for fivestar_element -- see fivestar_element()

File

./fivestar.module, line 1011
A simple n-star voting widget, usable in other forms.

Code

function fivestar_get_token($value) {
  global $user;

  // Anonymous users don't get a session ID, which breaks page caching.
  $session_id = $user->uid ? session_id() : '';
  $private_key = drupal_get_private_key();
  return md5($session_id . $value . $private_key);
}