You are here

function jplayer_protect_authorize in jPlayer 7.2

Same name and namespace in other branches
  1. 6 jplayer_protect/jplayer_protect.module \jplayer_protect_authorize()

Menu callback to authorize access to a file.

1 string reference to 'jplayer_protect_authorize'
jplayer_protect_menu in jplayer_protect/jplayer_protect.module
@file Provides basic content protection for media files accessed with jPlayer.

File

jplayer_protect/jplayer_protect.module, line 35
Provides basic content protection for media files accessed with jPlayer.

Code

function jplayer_protect_authorize($filepath, $timestamp) {
  $filepath = base64_decode($filepath);
  $timestamp = (int) base64_decode($timestamp);
  if (!isset($_SESSION['jplayer_protect'])) {
    $_SESSION['jplayer_protect'] = array();
  }
  if ($timestamp < REQUEST_TIME + variable_get('jplayer_access_time', 30)) {
    $_SESSION['jplayer_protect'][$filepath] = $timestamp;
  }
  return drupal_json_encode(REQUEST_TIME + variable_get('jplayer_access_time', 30));
}