You are here

function jplayer_protect_authorize in jPlayer 6

Same name and namespace in other branches
  1. 7.2 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 34
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 < time() + variable_get('jplayer_access_time', 30)) {
    $_SESSION['jplayer_protect'][$filepath] = $timestamp;
  }
  drupal_json(time() + variable_get('jplayer_access_time', 30));
}