本文整理汇总了PHP中kConf::hasMap方法的典型用法代码示例。如果您正苦于以下问题:PHP kConf::hasMap方法的具体用法?PHP kConf::hasMap怎么用?PHP kConf::hasMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kConf
的用法示例。
在下文中一共展示了kConf::hasMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
// check that rabbit_mq.ini file exists
if (kConf::hasMap('rabbit_mq')) {
// check configuration is correctly set
$rabbitConfig = kConf::getMap('rabbit_mq');
if (isset($rabbitConfig['username'])) {
$this->username = $rabbitConfig['username'];
}
if (isset($rabbitConfig['password'])) {
$this->password = $rabbitConfig['password'];
}
if (isset($rabbitConfig['server'])) {
$this->MQserver = $rabbitConfig['server'];
}
if (isset($rabbitConfig['port'])) {
$this->port = $rabbitConfig['port'];
}
if (isset($rabbitConfig['curl_port'])) {
$this->curlPort = $rabbitConfig['curl_port'];
}
if (isset($rabbitConfig['timeout'])) {
$this->timeout = $rabbitConfig['timeout'];
}
} else {
KalturaLog::err("RabbitMQ configuration file (rabbit_mq.ini) wasn't found!");
}
}
示例2: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
$uiconf_id = $this->getRequestParameter('uiconf_id');
if (!$uiconf_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
}
$uiConf = uiConfPeer::retrieveByPK($uiconf_id);
if (!$uiConf) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$partner_id = $this->getRequestParameter('partner_id', $uiConf->getPartnerId());
if (!$partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
$partner_host = myPartnerUtils::getHost($partner_id);
$partner_cdnHost = myPartnerUtils::getCdnHost($partner_id);
$use_cdn = $uiConf->getUseCdn();
$host = $use_cdn ? $partner_cdnHost : $partner_host;
$ui_conf_html5_url = $uiConf->getHtml5Url();
if (kConf::hasMap("optimized_playback")) {
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partner_id, $optimizedPlayback)) {
// force a specific kdp for the partner
$params = $optimizedPlayback[$partner_id];
if (array_key_exists('html5_url', $params)) {
$ui_conf_html5_url = $params['html5_url'];
}
}
}
if (kString::beginsWith($ui_conf_html5_url, "http")) {
$url = $ui_conf_html5_url;
// absolute URL
} else {
if ($ui_conf_html5_url) {
$url = $host . $ui_conf_html5_url;
} else {
$html5_version = kConf::get('html5_version');
$url = "{$host}/html5/html5lib/{$html5_version}/mwEmbedLoader.php";
}
}
// append uiconf_id and partner id for optimizing loading of html5 library. append them only for "standard" urls by looking for the mwEmbedLoader.php suffix
if (kString::endsWith($url, "mwEmbedLoader.php")) {
$url .= "/p/{$partner_id}/uiconf_id/{$uiconf_id}";
$entry_id = $this->getRequestParameter('entry_id');
if ($entry_id) {
$url .= "/entry_id/{$entry_id}";
}
}
requestUtils::sendCachingHeaders(60);
header("Pragma:");
kFile::cacheRedirect($url);
header("Location:{$url}");
die;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:57,代码来源:embedIframeJsAction.class.php
示例3: getPlaybackHost
public function getPlaybackHost($protocol = 'http', $format = null, $deliveryType = null)
{
$mediaServerGlobalConfig = array();
if (kConf::hasMap('media_servers')) {
$mediaServerGlobalConfig = array_merge($mediaServerGlobalConfig, kConf::getMap('media_servers'));
}
if ($this->partner_media_server_config) {
$mediaServerGlobalConfig = array_merge($mediaServerGlobalConfig, $this->partner_media_server_config);
}
$domain = $this->getDomainByProtocolAndFormat($mediaServerGlobalConfig, $protocol, $format);
$port = $this->getPortByProtocolAndFormat($mediaServerGlobalConfig, $protocol, $format);
$appPrefix = $this->getApplicationPrefix($mediaServerGlobalConfig);
return "{$domain}:{$port}/{$appPrefix}";
}
示例4: setCacheExpiry
function setCacheExpiry($entriesCount, $feedId)
{
$expiryArr = kConf::hasMap("v3cache_getfeed_expiry") ? kConf::getMap("v3cache_getfeed_expiry") : array();
foreach ($expiryArr as $item) {
if ($item["key"] == "partnerId" && $item["value"] == kCurrentContext::$partner_id || $item["key"] == "feedId" && $item["value"] == $feedId) {
KalturaResponseCacher::setExpiry($item["expiry"]);
return;
}
}
$expiry = kConf::get("v3cache_getfeed_default_cache_time_frame", 'local', 86400);
if (kConf::hasParam("v3cache_getfeed_short_limits_array")) {
$shortLimits = kConf::get("v3cache_getfeed_short_limits_array");
} else {
$shortLimits = array(50 => 900, 100 => 1800, 200 => 3600, 400 => 7200);
}
foreach ($shortLimits as $numOfEntries => $cacheTimeFrame) {
if ($entriesCount <= $numOfEntries) {
$expiry = min($expiry, $cacheTimeFrame);
}
}
KalturaResponseCacher::setExpiry($expiry);
}
示例5:
$wgKalturaRemoteAddressSalt = $kConf->get('remote_addr_header_salt');
}
// Disable Apple HLS if defined in kConf
if ($kConf->hasParam('use_apple_adaptive')) {
$wgKalturaUseAppleAdaptive = $kConf->get('use_apple_adaptive');
}
// Get Kaltura Supported API Features
if ($kConf->hasParam('features')) {
$wgKalturaApiFeatures = $kConf->get('features');
}
// Allow Iframe to connect remote service
$wgKalturaAllowIframeRemoteService = true;
// Set debug for true (testing only)
$wgEnableScriptDebug = false;
// Get PlayReady License URL
if ($kConf->hasMap('playReady')) {
$playReadyMap = $kConf->getMap('playReady');
if ($playReadyMap) {
$wgKalturaLicenseServerUrl = $playReadyMap['license_server_url'];
}
}
// Get PlayReady License URL
if ($kConf->hasMap('drm')) {
$drmMap = $kConf->getMap('drm');
if ($drmMap) {
$wgKalturaUdrmLicenseServerUrl = $drmMap['license_server_url'];
}
}
if ($kConf->hasParam('overrideDomain')) {
$wgEnableKalturaOverrideDomain = $kConf->get('overrideDomain');
}
示例6: addInternalCacheParams
protected function addInternalCacheParams()
{
$this->_params['___cache___protocol'] = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "https" : "http";
$this->_params['___cache___host'] = @$_SERVER['HTTP_HOST'];
$this->_params['___cache___version'] = self::CACHE_VERSION;
$this->_params['___internal'] = intval(kIpAddressUtils::isInternalIp());
if (kConf::hasMap("optimized_playback")) {
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($this->_ksPartnerId, $optimizedPlayback)) {
$params = $optimizedPlayback[$this->_ksPartnerId];
if (array_key_exists('cache_kdp_access_control', $params) && $params['cache_kdp_access_control']) {
$clientTag = 'none';
if (strpos(strtolower($this->clientTag), "kdp") !== false || strpos(strtolower($this->clientTag), "html") !== false) {
$clientTag = 'player';
}
$this->_params['___cache___clientTag'] = $clientTag;
}
}
}
if ($this->clientTag) {
$matches = null;
if (preg_match("/cache_st:(\\d+)/", $this->clientTag, $matches)) {
if ($matches[1] > time()) {
$this->_params['___cache___start'] = $matches[1];
}
}
}
}
示例7: getContextData
/**
* This action delivers entry-related data, based on the user's context: access control, restriction, playback format and storage information.
* @action getContextData
* @param string $entryId
* @param KalturaEntryContextDataParams $contextDataParams
* @return KalturaEntryContextDataResult
*/
public function getContextData($entryId, KalturaEntryContextDataParams $contextDataParams)
{
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$ks = $this->getKs();
$isAdmin = false;
if ($ks) {
$isAdmin = $ks->isAdmin();
}
$accessControl = $dbEntry->getAccessControl();
/* @var $accessControl accessControl */
$result = new KalturaEntryContextDataResult();
$result->isAdmin = $isAdmin;
$result->isScheduledNow = $dbEntry->isScheduledNow($contextDataParams->time);
if ($dbEntry->getStartDate() && abs($dbEntry->getStartDate(null) - time()) <= 86400 || $dbEntry->getEndDate() && abs($dbEntry->getEndDate(null) - time()) <= 86400) {
KalturaResponseCacher::setConditionalCacheExpiry(600);
}
if ($accessControl && $accessControl->hasRules()) {
$disableCache = true;
if (kConf::hasMap("optimized_playback")) {
$partnerId = $accessControl->getPartnerId();
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partnerId, $optimizedPlayback)) {
$params = $optimizedPlayback[$partnerId];
if (array_key_exists('cache_kdp_acccess_control', $params) && $params['cache_kdp_acccess_control']) {
$disableCache = false;
}
}
}
$accessControlScope = $accessControl->getScope();
$contextDataParams->toObject($accessControlScope);
$accessControlScope->setEntryId($entryId);
$result->isAdmin = $accessControlScope->getKs() && $accessControlScope->getKs()->isAdmin();
$dbResult = new kEntryContextDataResult();
if ($accessControl->applyContext($dbResult) && $disableCache) {
KalturaResponseCacher::disableCache();
}
$result->fromObject($dbResult);
}
$partner = PartnerPeer::retrieveByPK($dbEntry->getPartnerId());
if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_REMOTE_STORAGE_DELIVERY_PRIORITY, $dbEntry->getPartnerId()) && $partner->getStorageServePriority() != StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY) {
if (is_null($contextDataParams->flavorAssetId)) {
if ($contextDataParams->flavorTags) {
$assets = assetPeer::retrieveReadyByEntryIdAndTag($entryId, $contextDataParams->flavorTags);
$asset = reset($assets);
} else {
$asset = assetPeer::retrieveBestPlayByEntryId($entryId);
}
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::NO_FLAVORS_FOUND, $entryId);
}
} else {
$asset = assetPeer::retrieveByPK($contextDataParams->flavorAssetId);
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $contextDataParams->flavorAssetId);
}
}
if (!$asset) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $entryId);
}
$assetSyncKey = $asset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
$fileSyncs = kFileSyncUtils::getAllReadyExternalFileSyncsForKey($assetSyncKey);
$storageProfilesXML = new SimpleXMLElement("<StorageProfiles/>");
foreach ($fileSyncs as $fileSync) {
$storageProfileId = $fileSync->getDc();
$storageProfile = StorageProfilePeer::retrieveByPK($storageProfileId);
if (!$storageProfile->getDeliveryRmpBaseUrl() && (!$contextDataParams->streamerType || $contextDataParams->streamerType == StorageProfile::PLAY_FORMAT_AUTO)) {
$contextDataParams->streamerType = StorageProfile::PLAY_FORMAT_HTTP;
$contextDataParams->mediaProtocol = StorageProfile::PLAY_FORMAT_HTTP;
}
$storageProfileXML = $storageProfilesXML->addChild("StorageProfile");
$storageProfileXML->addAttribute("storageProfileId", $storageProfileId);
$storageProfileXML->addChild("Name", $storageProfile->getName());
$storageProfileXML->addChild("SystemName", $storageProfile->getSystemName());
}
$result->storageProfilesXML = $storageProfilesXML->saveXML();
}
if ($contextDataParams->streamerType && $contextDataParams->streamerType != StorageProfile::PLAY_FORMAT_AUTO) {
$result->streamerType = $contextDataParams->streamerType;
$result->mediaProtocol = $contextDataParams->mediaProtocol ? $contextDataParams->mediaProtocol : $contextDataParams->streamerType;
} else {
$result->streamerType = $this->getPartner()->getStreamerType();
if (!$result->streamerType) {
$result->streamerType = StorageProfile::PLAY_FORMAT_HTTP;
}
$result->mediaProtocol = $this->getPartner()->getMediaProtocol();
if (!$result->mediaProtocol) {
$result->mediaProtocol = StorageProfile::PLAY_FORMAT_HTTP;
}
}
return $result;
//.........这里部分代码省略.........
示例8: enforceEncryption
protected function enforceEncryption()
{
$playbackParams = array();
if (kConf::hasMap("optimized_playback")) {
$partnerId = $this->entry->getPartnerId();
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partnerId, $optimizedPlayback)) {
$playbackParams = $optimizedPlayback[$partnerId];
}
}
// TODO add protocol limitation action to access control
if (array_key_exists('enforce_encryption', $playbackParams) && $playbackParams['enforce_encryption']) {
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
KExternalErrors::dieError(KExternalErrors::ACCESS_CONTROL_RESTRICTED, 'unencrypted manifest request - forbidden');
}
$allowedProtocols = array('https', 'rtmpe', 'rtmpte');
if (!in_array(strtolower($this->deliveryAttributes->getMediaProtocol()), $allowedProtocols)) {
KExternalErrors::dieError(KExternalErrors::ACCESS_CONTROL_RESTRICTED, 'unencrypted playback protocol - forbidden');
}
}
}
示例9: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
$uiconf_id = $this->getRequestParameter('uiconf_id');
if (!$uiconf_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id');
}
$uiConf = uiConfPeer::retrieveByPK($uiconf_id);
if (!$uiConf) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
$partner_id = $this->getRequestParameter('partner_id', $uiConf->getPartnerId());
if (!$partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
$widget_id = $this->getRequestParameter("widget_id", '_' . $partner_id);
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "https" : "http";
$host = myPartnerUtils::getCdnHost($partner_id, $protocol, 'api');
$ui_conf_html5_url = $uiConf->getHtml5Url();
if (kConf::hasMap("optimized_playback")) {
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partner_id, $optimizedPlayback)) {
// force a specific kdp for the partner
$params = $optimizedPlayback[$partner_id];
if (array_key_exists('html5_url', $params)) {
$ui_conf_html5_url = $params['html5_url'];
}
}
}
$autoEmbed = $this->getRequestParameter('autoembed');
$iframeEmbed = $this->getRequestParameter('iframeembed');
$scriptName = $iframeEmbed ? 'mwEmbedFrame.php' : 'mwEmbedLoader.php';
if ($ui_conf_html5_url && $iframeEmbed) {
$ui_conf_html5_url = str_replace('mwEmbedLoader.php', 'mwEmbedFrame.php', $ui_conf_html5_url);
}
$relativeUrl = true;
// true if ui_conf html5_url is relative (doesnt start with an http prefix)
if (kString::beginsWith($ui_conf_html5_url, "http")) {
$relativeUrl = false;
$url = $ui_conf_html5_url;
// absolute URL
} else {
if (!$iframeEmbed) {
$host = "{$protocol}://" . kConf::get('html5lib_host') . "/";
}
if ($ui_conf_html5_url) {
$url = $host . $ui_conf_html5_url;
} else {
$html5_version = kConf::get('html5_version');
$url = "{$host}/html5/html5lib/{$html5_version}/" . $scriptName;
}
}
// append uiconf_id and partner id for optimizing loading of html5 library. append them only for "standard" urls by looking for the mwEmbedLoader.php/mwEmbedFrame.php suffix
if (kString::endsWith($url, $scriptName)) {
$url .= "/p/{$partner_id}/uiconf_id/{$uiconf_id}";
if (!$autoEmbed) {
$entry_id = $this->getRequestParameter('entry_id');
if ($entry_id) {
$url .= "/entry_id/{$entry_id}";
}
}
}
header("pragma:");
if ($iframeEmbed) {
$url .= (strpos($url, "?") === false ? "?" : "&") . 'wid=' . $widget_id . '&' . $_SERVER["QUERY_STRING"];
} else {
$params = "protocol={$protocol}&" . $_SERVER["QUERY_STRING"];
$url .= (strpos($url, "?") === false ? "?" : "&") . $params;
if ($relativeUrl) {
header('Content-Type: application/javascript');
kFileUtils::dumpUrl($url, true, false, array("X-Forwarded-For" => requestUtils::getRemoteAddress()));
}
}
requestUtils::sendCachingHeaders(60, true, time());
kFile::cacheRedirect($url);
header("Location:{$url}");
KExternalErrors::dieGracefully();
}
示例10: getWhitelabelData
public static function getWhitelabelData(Partner $partner, $param = null)
{
// no param, return null
if (!$param) {
return null;
}
if (kConf::hasMap("whitelabel")) {
$whitelabel = kConf::getMap("whitelabel");
$params = array();
// Search for partner Id
if (array_key_exists($partner->getId(), $whitelabel)) {
$params = $whitelabel[$partner->getId()];
} else {
if (array_key_exists($partner->getPartnerParentId(), $whitelabel)) {
$params = $whitelabel[$partner->getPartnerParentId()];
}
}
// If we have params, find out param
if (is_array($params) && array_key_exists($param, $params)) {
return $params[$param];
}
return null;
}
return null;
}
示例11: execute
//.........这里部分代码省略.........
if (!file_exists($cached_swf) || filemtime($cached_swf) < $confFile_mtime) {
kFile::fullMkdir($cached_swf);
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "api_v3" . DIRECTORY_SEPARATOR . "bootstrap.php";
$dispatcher = KalturaDispatcher::getInstance();
try {
$widget_result = $dispatcher->dispatch("widget", "get", array("ks" => $ks, "id" => $widget_id));
$ui_conf_result = $dispatcher->dispatch("uiConf", "get", array("ks" => $ks, "id" => $widget_type));
} catch (Exception $ex) {
die;
}
if (!$ui_conf_result->confFile) {
die;
}
ob_start();
$serializer = new KalturaXmlSerializer(false);
$serializer->serialize($widget_result);
$widget_xml = ob_get_contents();
ob_end_clean();
ob_start();
$serializer = new KalturaXmlSerializer(false);
$serializer->serialize($ui_conf_result);
$ui_conf_xml = ob_get_contents();
ob_end_clean();
$patcher = new kPatchSwf($root . $base_wrapper_swf);
$result = "<xml><result>{$widget_xml}</result><result>{$ui_conf_xml}</result></xml>";
$patcher->patch($result, $cached_swf);
}
if (file_exists($cached_swf)) {
$wrapper_swf = $new_swf_path;
}
}
$kdp_version_2 = strpos($swf_url, "kdp/v2.") > 0;
if ($partner_host == "http://www.kaltura.com" && !$kdp_version_2 && !$kdp3) {
$partner_host = 1;
// otherwise the kdp will try going to cdnwww.kaltura.com
}
$track_wrapper = '';
if (kConf::get('track_kdpwrapper') && kConf::get('kdpwrapper_track_url')) {
$track_wrapper = "&wrapper_tracker_url=" . urlencode(kConf::get('kdpwrapper_track_url') . "?activation_key=" . kConf::get('kaltura_activation_key') . "&package_version=" . kConf::get('kaltura_version'));
}
if (kConf::hasMap("optimized_playback")) {
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partner_id, $optimizedPlayback)) {
// force a specific kdp for the partner
$params = $optimizedPlayback[$partner_id];
if (array_key_exists('kdp_version', $params)) {
$swf_url = $partner_cdnHost . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . "/flash/kdp3/" . $params['kdp_version'] . "/kdp3.swf";
}
if (array_key_exists('conf_vars', $params)) {
$conf_vars .= "&" . $params['conf_vars'];
}
// cache immidiately
$cache_st = 0;
$allowCache = true;
}
}
$stats_host = $protocol == "https" ? kConf::get("stats_host_https") : kConf::get("stats_host");
$wrapper_stats = kConf::get('kdp3_wrapper_stats_url') ? "&wrapper_stats_url={$protocol}://{$stats_host}" . urlencode(str_replace("{partnerId}", $partner_id, kConf::get('kdp3_wrapper_stats_url'))) : "";
$dynamic_date = $widgetIdStr . $track_wrapper . $wrapper_stats . "&kdpUrl=" . urlencode($swf_url) . "&host=" . str_replace("http://", "", str_replace("https://", "", $partner_host)) . "&cdnHost=" . str_replace("http://", "", str_replace("https://", "", $partner_cdnHost)) . ($protocol == "https" ? "&statistics.statsDomain={$stats_host}" : "") . ($show_version ? "&entryVersion={$show_version}" : "") . ($kshow_id ? "&kshowId={$kshow_id}" : "") . ($entry_id ? "&{$entryVarName}={$entry_id}" : "") . $uiconf_id_str . $ks_flashvars . ($cache_st ? "&clientTag=cache_st:{$cache_st}" : "") . $conf_vars;
// for now changed back to $host since kdp version prior to 1.0.15 didnt support loading by external domain kdpwrapper
$url = $host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . "/{$wrapper_swf}?{$dynamic_date}";
// patch wrapper with flashvars and dump to browser
if (version_compare($uiConf->getSwfUrlVersion(), "2.6.6", ">=")) {
$patcher = new kPatchSwf($root . $wrapper_swf, "KALTURA_FLASHVARS_DATA");
ob_start();
$patcher->patch($dynamic_date . "&referer=" . urlencode($referer));
$wrapper_data = ob_get_contents();
ob_end_clean();
requestUtils::sendCdnHeaders("swf", strlen($wrapper_data), $allowCache ? 60 * 10 : 0, null, false, time());
echo $wrapper_data;
if ($allowCache) {
$cache_swfdata->put($requestKey, $wrapper_data);
}
die;
}
}
} else {
$dynamic_date = "kshowId={$kshow_id}" . "&host=" . requestUtils::getRequestHostId() . ($show_version ? "&entryVersion={$show_version}" : "") . ($entry_id ? "&{$entryVarName}={$entry_id}" : "") . ($entry_id ? "&KmediaType={$kmedia_type}" : "");
$dynamic_date .= "&isWidget={$widget_type}&referer=" . urlencode($referer);
$dynamic_date .= "&kdata={$kdata}";
$url = "{$swf_url}?{$dynamic_date}";
}
// if referer has a query string an IE bug will prevent out flashvars to propagate
// when nowrapper is true we cant use /swfparams either as there isnt a kdpwrapper
if (!$nowrapper && $uiConf && version_compare($uiConf->getSwfUrlVersion(), "2.6.6", ">=")) {
// apart from the /swfparam/ format, add .swf suffix to the end of the stream in case
// a corporate firewall looks at the file suffix
$pos = strpos($url, "?");
$url = substr($url, 0, $pos) . "/swfparams/" . urlencode(substr($url, $pos + 1)) . ".swf";
}
if ($allowCache) {
$cache->put($requestKey, $url);
}
if (strpos($url, "/swfparams/") > 0) {
$url = substr($url, 0, -4) . urlencode($noncached_params) . ".swf";
} else {
$url .= $noncached_params;
}
$this->redirect($url);
}
示例12: applyAccessControlOnContextData
private function applyAccessControlOnContextData(accessControlScope $accessControlScope)
{
if ($this->isAdmin) {
return;
}
$accessControl = $this->entry->getAccessControl();
/* @var $accessControl accessControl */
if ($accessControl && $accessControl->hasRules()) {
$this->isSecured = true;
if (kConf::hasMap("optimized_playback")) {
$partnerId = $accessControl->getPartnerId();
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partnerId, $optimizedPlayback)) {
$params = $optimizedPlayback[$partnerId];
if (array_key_exists('cache_kdp_access_control', $params) && $params['cache_kdp_access_control'] && (strpos(strtolower(kCurrentContext::$client_lang), "kdp") !== false || strpos(strtolower(kCurrentContext::$client_lang), "html") !== false)) {
return;
}
}
}
$accessControlScope->setEntryId($this->entry->getId());
$this->isAdmin = $accessControlScope->getKs() && $accessControlScope->getKs()->isAdmin();
$this->disableCache = $accessControl->applyContext($this->contextDataResult);
}
}
示例13: getWebService
/**
* @param string $service
* @return KalturaMediaServerClient
*/
public function getWebService($service)
{
if (!isset(self::$webServices[$service])) {
return null;
}
$serviceClass = self::$webServices[$service];
$domain = $this->getHostname();
$port = MediaServer::DEFAULT_WEB_SERVICES_PORT;
$protocol = 'http';
if (kConf::hasMap('media_servers')) {
$mediaServers = kConf::getMap('media_servers');
if (isset($mediaServers['service-port'])) {
$port = $mediaServers['service-port'];
}
if (isset($mediaServers['protocol'])) {
$protocol = $mediaServers['protocol'];
}
if (isset($mediaServers['internal_domain'])) {
$domain = $mediaServers['internal_domain'];
} elseif (isset($mediaServers['internal_search_regex_pattern']) && isset($mediaServers['internal_replacement'])) {
$domain = preg_replace($mediaServers['internal_search_regex_pattern'], $mediaServers['internal_replacement'], $domain);
}
if (isset($mediaServers[$this->getHostname()])) {
$mediaServer = $mediaServers[$this->getHostname()];
if (isset($mediaServer['service-port'])) {
$port = $mediaServer['service-port'];
}
if (isset($mediaServer['protocol'])) {
$protocol = $mediaServer['protocol'];
}
if (isset($mediaServer['internal_domain'])) {
$domain = $mediaServer['internal_domain'];
}
}
}
$url = "{$protocol}://{$domain}:{$port}/{$service}?wsdl";
KalturaLog::debug("Service URL: {$url}");
return new $serviceClass($url);
}
示例14: initCacheModes
private function initCacheModes()
{
if (!is_null($this->_cacheModes)) {
return;
}
$this->_cacheModes = array();
if ($this->_cacheStatus == self::CACHE_STATUS_DISABLED) {
return;
}
$ks = null;
try {
$ks = kSessionUtils::crackKs($this->_ks);
} catch (Exception $e) {
KalturaLog::err($e->getMessage());
self::disableCache();
return;
}
if ($ks && ($ks->valid_until <= time() || $ks->isSetLimitAction())) {
self::disableCache();
return;
}
$isAnonymous = !$ks || !$ks->isAdmin() && ($ks->user === "0" || $ks->user === null);
// force caching of actions listed in kConf even if admin ks is used
if (!$isAnonymous && kConf::hasMap('v3cache_ignore_admin_ks')) {
$v3cacheIgnoreAdminKS = kConf::getMap('v3cache_ignore_admin_ks');
if (isset($v3cacheIgnoreAdminKS[$ks->partner_id])) {
$actions = explode(',', $v3cacheIgnoreAdminKS[$ks->partner_id]);
foreach ($actions as $action) {
list($serviceId, $actionId) = explode('.', $action);
if ($this->_params['service'] == $serviceId && $this->_params['action'] == $actionId) {
$isAnonymous = true;
break;
}
}
}
}
if (!$isAnonymous && $this->_cacheStatus == self::CACHE_STATUS_ANONYMOUS_ONLY) {
self::disableCache();
return;
}
if ($isAnonymous) {
$this->_cacheModes[] = self::CACHE_MODE_ANONYMOUS;
}
if ($this->_cacheStatus != self::CACHE_STATUS_ANONYMOUS_ONLY) {
$this->_cacheModes[] = self::CACHE_MODE_CONDITIONAL;
}
}
示例15: execute
public function execute()
{
$this->seekFrom = $this->getRequestParameter("seekFrom", -1);
if ($this->seekFrom <= 0) {
$this->seekFrom = -1;
}
$this->clipTo = $this->getRequestParameter("clipTo", 0);
$this->deliveryCode = $this->getRequestParameter("deliveryCode", null);
$playbackContext = $this->getRequestParameter("playbackContext", null);
$this->protocol = $this->getRequestParameter("protocol", null);
if (!$this->protocol || $this->protocol === "null") {
$this->protocol = StorageProfile::PLAY_FORMAT_HTTP;
}
$this->format = $this->getRequestParameter("format");
if (!$this->format) {
$this->format = StorageProfile::PLAY_FORMAT_HTTP;
}
$this->tags = $this->getRequestParameter("tags", null);
if (!$this->tags) {
switch ($this->format) {
case StorageProfile::PLAY_FORMAT_SILVER_LIGHT:
$this->tags = array(array(assetParams::TAG_SLWEB));
break;
case StorageProfile::PLAY_FORMAT_APPLE_HTTP:
case StorageProfile::PLAY_FORMAT_HDS:
$this->tags = array(array(assetParams::TAG_APPLEMBR), array('ipadnew', 'iphonenew'), array('ipad', 'iphone'));
break;
default:
$this->tags = array(array(assetParams::TAG_MBR), array(assetParams::TAG_WEB));
}
} else {
$this->tags = array(array($this->tags));
}
$this->cdnHost = $this->getRequestParameter("cdnHost", null);
$this->preferredBitrate = $this->getRequestParameter("preferredBitrate", null);
$this->maxBitrate = $this->getRequestParameter("maxBitrate", null);
if ($this->maxBitrate && (!is_numeric($this->maxBitrate) || $this->maxBitrate <= 0)) {
KExternalErrors::dieError(KExternalErrors::INVALID_MAX_BITRATE);
}
$this->initEntry();
$this->initFlavorIds();
$this->storageId = $this->getRequestParameter("storageId", null);
$this->validateStorageId();
$partner = $this->entry->getPartner();
if (!$this->cdnHost || $partner->getForceCdnHost()) {
$this->cdnHost = myPartnerUtils::getCdnHost($this->entry->getPartnerId(), $this->protocol);
}
$playbackParams = array();
if (kConf::hasMap("optimized_playback")) {
$partnerId = $this->entry->getPartnerId();
$optimizedPlayback = kConf::getMap("optimized_playback");
if (array_key_exists($partnerId, $optimizedPlayback)) {
$playbackParams = $optimizedPlayback[$partnerId];
}
}
if (array_key_exists('enforce_encryption', $playbackParams) && $playbackParams['enforce_encryption']) {
if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
KExternalErrors::dieError(KExternalErrors::ACCESS_CONTROL_RESTRICTED, 'unencrypted manifest request - forbidden');
}
if (strtolower($this->protocol) != 'https') {
KExternalErrors::dieError(KExternalErrors::ACCESS_CONTROL_RESTRICTED, 'unencrypted playback protocol - forbidden');
}
}
$renderer = null;
switch ($this->format) {
case StorageProfile::PLAY_FORMAT_HTTP:
$renderer = $this->serveHttp();
break;
case StorageProfile::PLAY_FORMAT_RTMP:
$renderer = $this->serveRtmp();
break;
case StorageProfile::PLAY_FORMAT_SILVER_LIGHT:
$renderer = $this->serveSilverLight();
break;
case StorageProfile::PLAY_FORMAT_APPLE_HTTP:
$renderer = $this->serveAppleHttp();
break;
case StorageProfile::PLAY_FORMAT_HDS:
$renderer = $this->serveHds();
break;
case "url":
$this->format = "http";
// build url for an http delivery
$renderer = $this->serveUrl();
break;
case "rtsp":
$renderer = $this->serveRtsp();
break;
case "hdnetworksmil":
$renderer = $this->serveHDNetworkSmil();
break;
case "hdnetwork":
$renderer = $this->serveHDNetwork();
break;
case "hdnetworkmanifest":
$renderer = $this->serveHDNetworkManifest();
break;
}
if (!$renderer) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'This format is unsupported');
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:playManifestAction.class.php