private function KalturaFrontController() { $this->dispatcher = KalturaDispatcher::getInstance(); $this->params = requestUtils::getRequestParams(); $this->service = isset($this->params["service"]) ? $this->params["service"] : null; $this->action = isset($this->params["action"]) ? $this->params["action"] : null; }
/** * Get license for encrypted content playback * * @action getLicense * @param string $flavorAssetId * @param string $referrer 64base encoded * @return string $response * */ public function getLicenseAction($flavorAssetId, $referrer = null) { KalturaResponseCacher::disableCache(); KalturaLog::debug('get license for flavor asset: ' . $flavorAssetId); try { $requestParams = requestUtils::getRequestParams(); if (!array_key_exists(WidevineLicenseProxyUtils::ASSETID, $requestParams)) { KalturaLog::err('assetid is missing on the request'); return WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::WIDEVINE_ASSET_ID_CANNOT_BE_NULL, 0); } $wvAssetId = $requestParams[WidevineLicenseProxyUtils::ASSETID]; $this->validateLicenseRequest($flavorAssetId, $wvAssetId, $referrer); $privileges = null; $isAdmin = false; if (kCurrentContext::$ks_object) { $privileges = kCurrentContext::$ks_object->getPrivileges(); $isAdmin = kCurrentContext::$ks_object->isAdmin(); } $response = WidevineLicenseProxyUtils::sendLicenseRequest($requestParams, $privileges, $isAdmin); } catch (KalturaWidevineLicenseProxyException $e) { KalturaLog::err($e); $response = WidevineLicenseProxyUtils::createErrorResponse($e->getWvErrorCode(), $wvAssetId); } catch (Exception $e) { KalturaLog::err($e); $response = WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::GENERAL_ERROR, $wvAssetId); } WidevineLicenseProxyUtils::printLicenseResponseStatus($response); return $response; }
private function KalturaFrontController() { $this->dispatcher = KalturaDispatcher::getInstance(); $this->params = requestUtils::getRequestParams(); $this->service = isset($this->params["service"]) ? (string) $this->params["service"] : null; $this->action = isset($this->params["action"]) ? (string) $this->params["action"] : null; kCurrentContext::$serializeCallback = array($this, 'serialize'); }
public function serialize($object) { if (is_object($object) && $object instanceof Exception) { $assetid = 0; $requestParams = requestUtils::getRequestParams(); if (array_key_exists(WidevineLicenseProxyUtils::ASSETID, $requestParams)) { $assetid = $requestParams[WidevineLicenseProxyUtils::ASSETID]; } $object = WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::GENERAL_ERROR, $assetid); } return $object; }
public function __construct() { $this->_cacheKeyPrefix = 'playManifest-'; parent::__construct(); if (!kConf::get('enable_cache')) { return; } $this->_params = requestUtils::getRequestParams(); if (isset($this->_params['nocache'])) { return; } $this->calculateCacheKey(); $this->enableCache(); }
public function __construct($params = null, $cacheDirectory = null, $expiry = 0) { self::$_useCache = kConf::get('enable_cache'); if ($expiry) { $this->_expiry = $expiry; } $this->_cacheDirectory = $cacheDirectory ? $cacheDirectory : rtrim(kConf::get('response_cache_dir'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; $this->_cacheDirectory .= "cache_v3-" . $this->_expiry . DIRECTORY_SEPARATOR; if (!self::$_useCache) { return; } if (!$params) { $params = requestUtils::getRequestParams(); } foreach (kConf::get('v3cache_ignore_params') as $name) { unset($params[$name]); } // check the clientTag parameter for a cache start time (cache_st:<time>) directive if (isset($params['clientTag'])) { $clientTag = $params['clientTag']; $matches = null; if (preg_match("/cache_st:(\\d+)/", $clientTag, $matches)) { if ($matches[1] > time()) { self::$_useCache = false; return; } } } $isAdminLogin = isset($params['service']) && isset($params['action']) && $params['service'] == 'adminuser' && $params['action'] == 'login'; if ($isAdminLogin || isset($params['nocache'])) { self::$_useCache = false; return; } $ks = isset($params['ks']) ? $params['ks'] : ''; foreach ($params as $key => $value) { if (preg_match('/[\\d]+:ks/', $key)) { $ks = $value; unset($params[$key]); } } unset($params['ks']); unset($params['kalsig']); unset($params['clientTag']); $this->_params = $params; $this->setKS($ks); }
} ini_set("memory_limit", "256M"); $start = microtime(true); set_time_limit(0); // check cache before loading anything require_once __DIR__ . "/../lib/KalturaResponseCacher.php"; $expiry = kConf::hasParam("v3cache_getfeed_default_expiry") ? kConf::get("v3cache_getfeed_default_expiry") : 86400; $cache = new KalturaResponseCacher(null, kCacheManager::CACHE_TYPE_API_V3_FEED, $expiry); $cache->checkOrStart(); ob_start(); // Database DbManager::setConfig(kConf::getDB()); DbManager::initialize(); KalturaLog::debug(">------------------------------------- syndicationFeedRenderer -------------------------------------"); KalturaLog::info("syndicationFeedRenderer-start "); KalturaLog::debug("getFeed Params [" . print_r(requestUtils::getRequestParams(), true) . "]"); kCurrentContext::$host = isset($_SERVER["HOSTNAME"]) ? $_SERVER["HOSTNAME"] : null; kCurrentContext::$user_ip = requestUtils::getRemoteAddress(); kCurrentContext::$ps_vesion = "ps3"; $feedId = getRequestParameter('feedId'); $entryId = getRequestParameter('entryId'); $limit = getRequestParameter('limit'); $ks = getRequestParameter('ks'); $feedProcessingKey = "feedProcessing_{$feedId}_{$entryId}_{$limit}"; if (function_exists('apc_fetch')) { if (apc_fetch($feedProcessingKey)) { KExternalErrors::dieError(KExternalErrors::PROCESSING_FEED_REQUEST); } } try { $syndicationFeedRenderer = new KalturaSyndicationFeedRenderer($feedId, $feedProcessingKey, $ks);
public function __construct($params = null, $cacheType = kCacheManager::FS_API_V3, $expiry = 0) { $this->_cacheKeyPrefix = 'cache_v3-'; parent::__construct(); if ($expiry) { $this->_defaultExpiry = $this->_expiry = $expiry; } if (!kConf::get('enable_cache')) { return; } if (!$params) { $params = requestUtils::getRequestParams(); } self::handleSessionStart($params); foreach (kConf::get('v3cache_ignore_params') as $name) { unset($params[$name]); } // check the clientTag parameter for a cache start time (cache_st:<time>) directive if (isset($params['clientTag'])) { $clientTag = $params['clientTag']; $matches = null; if (preg_match("/cache_st:(\\d+)/", $clientTag, $matches)) { if ($matches[1] > time()) { self::disableCache(); return; } } } if (isset($params['nocache'])) { self::disableCache(); return; } $this->_cacheStore = kCacheManager::getCache($cacheType); if (!$this->_cacheStore) { self::disableCache(); return; } $ks = isset($params['ks']) ? $params['ks'] : ''; foreach ($params as $key => $value) { if (!preg_match('/[\\d]+:ks/', $key)) { continue; } // not a ks if (strpos($value, ':result') !== false) { continue; } // the ks is the result of some sub request if ($ks && $ks != $value) { self::disableCache(); // several different ks's in a multirequest - don't use cache return; } $ks = $value; unset($params[$key]); } unset($params['ks']); unset($params['kalsig']); unset($params['clientTag']); unset($params['callback']); $this->_params = $params; $this->setKS($ks); $this->enableCache(); }
/** * @param string $format * @param string $fileName * @return string */ private function getTokenizedManifestUrl($format, $fileName) { $params = requestUtils::getRequestParams(); $params['format'] = $format; $excludeList = array('kt', 'ks', 'referrer', 'extwidget', 'a'); foreach ($excludeList as $excludedParam) { unset($params[$excludedParam]); } if ($this->clipTo) { $params['clipTo'] = $this->clipTo; } // in order to enforce preview access control $params = $this->convertToShortNames($params); $partnerId = $this->entry->getPartnerId(); $url = "/p/{$partnerId}/playManifest/kt/" . self::KALTURA_TOKEN_MARKER; foreach ($params as $key => $value) { $url .= "/{$key}/{$value}"; } $url .= "/{$fileName}"; return self::calculateKalturaToken($url); }