/** * Will forward to the regular swf player according to the widget_id */ public function execute() { $ui_conf_id = $this->getRequestParameter("ui_conf_id"); $uiConf = uiConfPeer::retrieveByPK($ui_conf_id); if (!$uiConf) { die; } $partner_id = $uiConf->getPartnerId(); $subp_id = $uiConf->getSubpId(); $host = myPartnerUtils::getHost($partner_id); $ui_conf_swf_url = $uiConf->getSwfUrl(); if (!$ui_conf_swf_url) { $ui_conf_swf_url = "/swf/simpleeditor.swf"; } if (kString::beginsWith($ui_conf_swf_url, "http")) { $swf_url = $ui_conf_swf_url; // absolute URL } else { $use_cdn = $uiConf->getUseCdn(); $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id); $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url; // relative to the current host } // handle buggy case for backward compatiblity $partner_host = $host; if ($partner_host == "http://www.kaltura.com") { $partner_host = 1; } // otherwise the kse will build a flawed url with [[IMPORT]] $params = "contentUrl=" . urlencode($swf_url) . "&host=" . str_replace("http://", "", str_replace("https://", "", $partner_host)) . "&cdnHost=" . str_replace("http://", "", str_replace("https://", "", myPartnerUtils::getCdnHost($partner_id))) . "&uiConfId=" . $ui_conf_id . "&disableurlhashing=" . kConf::get('disable_url_hashing'); $wrapper_swf = myContentStorage::getFSFlashRootPath() . "/flexwrapper/" . kConf::get('editors_flex_wrapper_version') . "/FlexWrapper.swf"; $this->redirect($host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . "{$wrapper_swf}?{$params}"); }
/** * Will forward to the regular swf player according to the widget_id */ public function execute() { $ui_conf_id = $this->getRequestParameter("ui_conf_id"); $uiConf = uiConfPeer::retrieveByPK($ui_conf_id); if (!$uiConf) { die; } $partner_id = $uiConf->getPartnerId(); $subp_id = $uiConf->getSubpId(); if (!$subp_id) { $subp_id = 0; } $host = myPartnerUtils::getHost($partner_id); $ui_conf_swf_url = $uiConf->getSwfUrl(); if (!$ui_conf_swf_url) { $ui_conf_swf_url = "/swf/ContributionWizard.swf"; } if (kString::beginsWith($ui_conf_swf_url, "http")) { $swf_url = $ui_conf_swf_url; // absolute URL } else { $use_cdn = $uiConf->getUseCdn(); $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id); $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url; // relative to the current host } $params = "contentUrl=" . urlencode($swf_url) . "&host=" . str_replace("http://", "", str_replace("https://", "", $host)) . "&cdnHost=" . str_replace("http://", "", str_replace("https://", "", myPartnerUtils::getCdnHost($partner_id))) . "&uiConfId=" . $ui_conf_id; $wrapper_swf = myContentStorage::getFSFlashRootPath() . "/flexwrapper/" . kConf::get('kcw_flex_wrapper_version') . "/FlexWrapper.swf"; $this->redirect($host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . "{$wrapper_swf}?{$params}"); }
/** * Will forward to the uploader swf according to the ui_conf_id */ public function execute() { $ui_conf_id = $this->getRequestParameter("ui_conf_id"); $uiConf = uiConfPeer::retrieveByPK($ui_conf_id); if (!$uiConf) { KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND, "UI conf not found"); } $partner_id = $uiConf->getPartnerId(); $subp_id = $uiConf->getSubpId(); $host = requestUtils::getRequestHost(); $ui_conf_swf_url = $uiConf->getSwfUrl(); if (!$ui_conf_swf_url) { KExternalErrors::dieError(KExternalErrors::ILLEGAL_UI_CONF, "SWF URL not found in UI conf"); } if (kString::beginsWith($ui_conf_swf_url, "http")) { $swf_url = $ui_conf_swf_url; // absolute URL } else { $use_cdn = $uiConf->getUseCdn(); $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id); $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url; // relative to the current host } $conf_vars = $uiConf->getConfVars(); if ($conf_vars) { $conf_vars = "&" . $conf_vars; } $params = "host=" . $host . "&uiConfId=" . $ui_conf_id . $conf_vars; KExternalErrors::terminateDispatch(); $this->redirect("{$swf_url}?{$params}"); }
/** * Will forward to the uploader swf according to the ui_conf_id */ public function execute() { $ui_conf_id = $this->getRequestParameter("ui_conf_id"); $uiConf = uiConfPeer::retrieveByPK($ui_conf_id); if (!$uiConf) { die; } $partner_id = $uiConf->getPartnerId(); $subp_id = $uiConf->getSubpId(); $host = requestUtils::getRequestHost(); $ui_conf_swf_url = $uiConf->getSwfUrl(); if (!$ui_conf_swf_url) { die; } if (kString::beginsWith($ui_conf_swf_url, "http")) { $swf_url = $ui_conf_swf_url; // absolute URL } else { $use_cdn = $uiConf->getUseCdn(); $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id); $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url; // relative to the current host } $conf_vars = $uiConf->getConfVars(); if ($conf_vars) { $conf_vars = "&" . $conf_vars; } $params = "host=" . $host . "&uiConfId=" . $ui_conf_id . $conf_vars; $this->redirect("{$swf_url}?{$params}"); }
/** * This function returns the file system path for a requested content entity. * this function is here to support PS2 getEntry and 2Tor which uses datapath * @return string the content path */ public function getDataPath($version = NULL) { $url = $this->getDownloadUrl($version); // this is to make sure direct embeds (formerly done by going to /content/entry/data/../file.swf) // will still work $url .= '/direct_serve/1/forceproxy/true'; $host = myPartnerUtils::getCdnHost($this->getPartnerId()); $url = str_replace($host, '', $url); return $url; }
protected static function getAssetUrl(asset $asset) { $cdnHost = myPartnerUtils::getCdnHost($asset->getPartnerId()); $urlManager = kUrlManager::getUrlManagerByCdn($cdnHost, $asset->getEntryId()); $urlManager->setDomain($cdnHost); $url = $urlManager->getAssetUrl($asset); $url = $cdnHost . $url; $url = preg_replace('/^https?:\\/\\//', '', $url); $url = 'http://' . $url . '/ext/' . $asset->getId() . '.' . $asset->getFileExt(); return $url; }
/** * 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; }
private function _buildJarsHostPath() { $baseUrl = myPartnerUtils::getCdnHost($this->uiconfObj->getPartnerId()); $jarPath = $this->_getJarsPathFromSwfUrl(); $scheme = parse_url($jarPath, PHP_URL_SCHEME); if (!is_null($scheme)) { return $jarPath; } else { $jarPath = ltrim($jarPath, '/'); $fullUrl = $baseUrl . '/' . $jarPath; return $fullUrl; } }
private function createArgumentsForXSLT() { $partnerPath = myPartnerUtils::getUrlForPartner($this->entry->getPartnerId(), $this->entry->getSubpId()); $prefix = myPartnerUtils::getCdnHost($this->entry->getPartnerId(), null, 'api') . $partnerPath . "/playManifest" . "/entryId/"; $arguments = array("distributionProfileId" => $this->distributionProfile->id, "playManifestPrefix" => $prefix); if ($this->distributionProfile->ipadnewPpvModule) { $arguments["ipadnewPpvModule"] = $this->distributionProfile->ipadnewPpvModule; } if ($this->distributionProfile->ipadnewFileName) { $arguments["ipadnewTypeName"] = $this->distributionProfile->ipadnewFileName; } if ($this->distributionProfile->ismPpvModule) { $arguments["ismPpvModule"] = $this->distributionProfile->ismPpvModule; } if ($this->distributionProfile->ismFileName) { $arguments["ismTypeName"] = $this->distributionProfile->ismFileName; } if ($this->distributionProfile->iphonenewPpvModule) { $arguments["iphonenewPpvModule"] = $this->distributionProfile->iphonenewPpvModule; } if ($this->distributionProfile->iphonenewFileName) { $arguments["iphonenewTypeName"] = $this->distributionProfile->iphonenewFileName; } if ($this->distributionProfile->mbrPpvModule) { $arguments["mbrPpvModule"] = $this->distributionProfile->mbrPpvModule; } if ($this->distributionProfile->mbrFileName) { $arguments["mbrTypeName"] = $this->distributionProfile->mbrFileName; } if ($this->distributionProfile->dashPpvModule) { $arguments["dashPpvModule"] = $this->distributionProfile->dashPpvModule; } if ($this->distributionProfile->dashFileName) { $arguments["dashTypeName"] = $this->distributionProfile->dashFileName; } if ($this->distributionProfile->widevinePpvModule) { $arguments["widevinePpvModule"] = $this->distributionProfile->widevinePpvModule; } if ($this->distributionProfile->widevineFileName) { $arguments["widevineTypeName"] = $this->distributionProfile->widevineFileName; } if ($this->distributionProfile->widevineMbrPpvModule) { $arguments["widevineMbrPpvModule"] = $this->distributionProfile->widevineMbrPpvModule; } if ($this->distributionProfile->widevineMbrFileName) { $arguments["widevineMbrTypeName"] = $this->distributionProfile->widevineMbrFileName; } return $arguments; }
/** * Returns latest version and URL * * @action clientUpdates * @param string $os * @param string $version * @return KalturaCaptureSpaceUpdateResponse * @throws CaptureSpaceErrors::ALREADY_LATEST_VERSION * @throws CaptureSpaceErrors::NO_UPDATE_IS_AVAILABLE */ function clientUpdatesAction($os, $version) { $hashValue = kCaptureSpaceVersionManager::getUpdateHash($os, $version); if (!$hashValue) { throw new KalturaAPIException(CaptureSpaceErrors::NO_UPDATE_IS_AVAILABLE, $version, $os); } $path = "/api_v3/service/captureSpace_captureSpace/action/serveUpdate/os/{$os}/version/{$version}"; $downloadUrl = myPartnerUtils::getCdnHost(null) . $path; $info = new KalturaCaptureSpaceUpdateResponseInfo(); $info->url = $downloadUrl; $info->hash = new KalturaCaptureSpaceUpdateResponseInfoHash(); $info->hash->algorithm = KalturaCaptureSpaceHashAlgorithm::MD5; $info->hash->value = $hashValue; $response = new KalturaCaptureSpaceUpdateResponse(); $response->info = $info; return $response; }
public function execute() { $this->uiconf_id = $this->getRequestParameter('uiconf_id'); if (!$this->uiconf_id) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id'); } $this->uiConf = uiConfPeer::retrieveByPK($this->uiconf_id); if (!$this->uiConf) { KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND); } $this->partner_id = $this->getRequestParameter('partner_id', $this->uiConf->getPartnerId()); if (!$this->partner_id) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id'); } // Single Player parameters $this->entry_id = $this->getRequestParameter('entry_id'); if ($this->entry_id) { $entry = entryPeer::retrieveByPK($this->entry_id); if ($entry) { $this->entry_name = $entry->getName(); $this->entry_description = $entry->getDescription(); $this->entry_thumbnail_url = $entry->getThumbnailUrl(); $flavor_tag = $this->getRequestParameter('flavor_tag', 'iphone'); $flavor_assets = assetPeer::retrieveReadyFlavorsByEntryIdAndTag($this->entry_id, $flavor_tag); $flavor_asset = reset($flavor_assets); /* @var $flavor_asset flavorAsset */ $this->flavor_asset_id = null; if ($flavor_asset) { $this->flavor_asset_id = $flavor_asset->getId(); } } else { $this->entry_id = null; } } $this->delivery_type = $this->getRequestParameter('delivery'); // Playlist Parameters $this->playlist_id = $this->getRequestParameter('playlist_id'); $this->playlist_name = $this->getRequestParameter('playlist_name'); $this->partner_host = myPartnerUtils::getHost($this->partner_id); $this->partner_cdnHost = myPartnerUtils::getCdnHost($this->partner_id); $this->secure_host = kConf::get('cdn_host_https'); }
/** * 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); $html5_version = kConf::get('html5_version'); $use_cdn = $uiConf->getUseCdn(); $host = $use_cdn ? $partner_cdnHost : $partner_host; $url = $host; $url .= "/html5/html5lib/v{$html5_version}/mwEmbedLoader.php"; $this->redirect($url); }
public function execute() { $this->html5_version = kConf::get('html5_version'); $this->uiconf_id = $this->getRequestParameter('uiconf_id'); if (!$this->uiconf_id) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id'); } $this->uiConf = uiConfPeer::retrieveByPK($this->uiconf_id); if (!$this->uiConf) { KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND); } $this->partner_id = $this->getRequestParameter('partner_id', $this->uiConf->getPartnerId()); if (!$this->partner_id) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id'); } $this->entry_id = $this->getRequestParameter('entry_id'); if (!$this->entry_id) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'entry_id'); } $this->delivery_type = $this->getRequestParameter('delivery'); $this->partner_host = myPartnerUtils::getHost($this->partner_id); $this->partner_cdnHost = myPartnerUtils::getCdnHost($this->partner_id); }
public function execute() { sfView::SUCCESS; /** check parameters and verify user is logged-in **/ $this->partner_id = $this->getP("pid"); $this->subp_id = $this->getP("subpid", (int) $this->partner_id * 100); $this->uid = $this->getP("uid"); $this->ks = $this->getP("kmcks"); if (!$this->ks) { // if kmcks from cookie doesn't exist, try ks from REQUEST $this->ks = $this->getP('ks'); } $this->screen_name = $this->getP("screen_name"); $this->email = $this->getP("email"); /** if no KS found, redirect to login page **/ if (!$this->ks) { $this->redirect("kmc/kmc"); die; } $ksObj = kSessionUtils::crackKs($this->ks); /** END - check parameters and verify user is logged-in **/ /** Get array of allowed partners for the current user **/ $this->allowedPartners = array(); $currentUser = kuserPeer::getKuserByPartnerAndUid($this->partner_id, $ksObj->user, true); if ($currentUser) { $partners = myPartnerUtils::getPartnersArray($currentUser->getAllowedPartnerIds()); foreach ($partners as $partner) { $this->allowedPartners[] = array('id' => $partner->getId(), 'name' => $partner->getName()); } $this->full_name = $currentUser->getFullName(); } /** load partner from DB, and set templatePartnerId **/ $this->partner = $partner = null; $this->templatePartnerId = self::SYSTEM_DEFAULT_PARTNER; $this->ignoreSeoLinks = false; $this->ignoreEntrySeoLinks = false; $this->useEmbedCodeProtocolHttps = false; $this->v2Flavors = false; if ($this->partner_id !== NULL) { $this->partner = $partner = PartnerPeer::retrieveByPK($this->partner_id); kmcUtils::redirectPartnerToCorrectKmc($partner, $this->ks, $this->uid, $this->screen_name, $this->email, self::CURRENT_KMC_VERSION); $this->templatePartnerId = $this->partner ? $this->partner->getTemplatePartnerId() : self::SYSTEM_DEFAULT_PARTNER; $this->ignoreSeoLinks = $this->partner->getIgnoreSeoLinks(); $this->ignoreEntrySeoLinks = PermissionPeer::isValidForPartner(PermissionName::FEATURE_IGNORE_ENTRY_SEO_LINKS, $this->partner_id); $this->useEmbedCodeProtocolHttps = PermissionPeer::isValidForPartner(PermissionName::FEATURE_EMBED_CODE_DEFAULT_PROTOCOL_HTTPS, $this->partner_id); $this->v2Flavors = PermissionPeer::isValidForPartner(PermissionName::FEATURE_V2_FLAVORS, $this->partner_id); } /** END - load partner from DB, and set templatePartnerId **/ /** set default flags **/ $this->payingPartner = 'false'; $this->kdp508_players = array(); $this->first_login = false; /** END - set default flags **/ /** set values for template **/ $this->service_url = myPartnerUtils::getHost($this->partner_id); $this->host = $this->stripProtocol($this->service_url); $this->embed_host = $this->host; if (kConf::hasParam('cdn_api_host') && kConf::hasParam('www_host') && $this->host == kConf::get('cdn_api_host')) { $this->host = kConf::get('www_host'); } $this->cdn_url = myPartnerUtils::getCdnHost($this->partner_id); $this->cdn_host = $this->stripProtocol($this->cdn_url); $this->rtmp_host = myPartnerUtils::getRtmpUrl($this->partner_id); $this->flash_dir = $this->cdn_url . myContentStorage::getFSFlashRootPath(); // Decide if to hide akamai delivery type $this->hideAkamaiHDNetwork = $partner->getDisableAkamaiHDNetwork(); /** set payingPartner flag **/ if ($partner && $partner->getPartnerPackage() != PartnerPackages::PARTNER_PACKAGE_FREE) { $this->payingPartner = 'true'; } /** END - set payingPartner flag **/ /** get partner languae **/ $this->language = null; if ($partner->getKMCLanguage()) { $this->language = $partner->getKMCLanguage(); } /** END - get partner languae **/ /** set first_login flag **/ $this->first_login = $partner->getIsFirstLogin(); if ($this->first_login === true) { $partner->setIsFirstLogin(false); $partner->save(); } /** END - set first_login flag **/ /** get logout url **/ $this->logoutUrl = null; if ($partner->getLogoutUrl()) { $this->logoutUrl = $partner->getLogoutUrl(); } /** END - get logout url**/ /** partner-specific: change KDP version for partners working with auto-moderaion **/ // set content kdp version according to partner id $moderated_partners = array(31079, 28575, 32774); $this->content_kdp_version = 'v2.7.0'; if (in_array($this->partner_id, $moderated_partners)) { $this->content_kdp_version = 'v2.1.2.29057'; } /** END - partner-specific: change KDP version for partners working with auto-moderaion **/ $this->kmc_swf_version = kConf::get('kmc_version'); /** uiconf listing work **/ /** fill $this->confs with all uiconf objects for all modules **/ $kmcGeneralUiConf = kmcUtils::getAllKMCUiconfs('kmc', $this->kmc_swf_version, self::SYSTEM_DEFAULT_PARTNER); $kmcGeneralTemplateUiConf = kmcUtils::getAllKMCUiconfs('kmc', $this->kmc_swf_version, $this->templatePartnerId); /** for each module, create separated lists of its uiconf, for each need **/ /** kmc general uiconfs **/ $this->kmc_general = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_kmcgeneral", false, $kmcGeneralUiConf); $this->kmc_permissions = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_kmcpermissions", false, $kmcGeneralUiConf); /** P&E players: **/ //$this->content_uiconfs_previewembed = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_previewembed", true, $kmcGeneralUiConf); //$this->content_uiconfs_previewembed_list = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_previewembed_list", true, $kmcGeneralUiConf); $this->content_uiconfs_flavorpreview = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_flavorpreview", false, $kmcGeneralUiConf); /* KCW uiconfs */ $this->content_uiconfs_upload_webcam = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_uploadWebCam", false, $kmcGeneralUiConf); $this->content_uiconfs_upload_import = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_uploadImport", false, $kmcGeneralUiConf); $this->content_uiconds_clipapp_kdp = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_kdpClipApp", false, $kmcGeneralUiConf); $this->content_uiconds_clipapp_kclip = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_kClipClipApp", false, $kmcGeneralUiConf); /** content KCW,KSE,KAE **/ //$this->content_uiconfs_upload = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_upload", false, $kmcGeneralUiConf); //$this->simple_editor = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_simpleedit", false, $kmcGeneralUiConf); //$this->advanced_editor = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_advanceedit", false, $kmcGeneralUiConf); /** END - uiconf listing work **/ /** get templateXmlUrl for whitelabeled partners **/ //$this->appstudio_templatesXmlUrl = $this->getAppStudioTemplatePath(); }
public function execute() { $this->entryId = $this->getRequestParameter("entryId", null); $this->flavorId = $this->getRequestParameter("flavorId", null); $this->storageId = $this->getRequestParameter("storageId", null); $this->maxBitrate = $this->getRequestParameter("maxBitrate", null); $flavorIdsStr = $this->getRequestParameter("flavorIds", null); if ($flavorIdsStr) { $this->flavorIds = explode(",", $flavorIdsStr); } $this->entry = entryPeer::retrieveByPKNoFilter($this->entryId); if (!$this->entry) { KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND); } if (!$this->flavorId) { $flavorParamId = $this->getRequestParameter("flavorParamId", null); if ($flavorParamId) { $flavorAsset = flavorAssetPeer::retrieveByEntryIdAndFlavorParams($entry->getId(), $flavorParamId); if (!$flavorAsset) { KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND); } $this->flavorId = $flavorAsset->getId(); } } $this->validateStorageId(); $this->protocol = $this->getRequestParameter("protocol", null); if (!$this->protocol) { $this->protocol = StorageProfile::PLAY_FORMAT_HTTP; } $this->format = $this->getRequestParameter("format"); if (!$this->format) { $this->format = StorageProfile::PLAY_FORMAT_HTTP; } $this->cdnHost = $this->getRequestParameter("cdnHost", null); $partner = $this->entry->getPartner(); if (!$this->cdnHost || $partner->getForceCdnHost()) { $this->cdnHost = myPartnerUtils::getCdnHost($this->entry->getPartnerId(), $this->protocol); } if ($this->maxBitrate && (!is_numeric($this->maxBitrate) || $this->maxBitrate <= 0)) { KExternalErrors::dieError(KExternalErrors::INVALID_MAX_BITRATE); } $ksStr = $this->getRequestParameter("ks"); $base64Referrer = $this->getRequestParameter("referrer"); $referrer = base64_decode($base64Referrer); if (!is_string($referrer)) { $referrer = ""; } // base64_decode can return binary data $securyEntryHelper = new KSecureEntryHelper($this->entry, $ksStr, $referrer); if ($securyEntryHelper->shouldPreview()) { $this->clipTo = $securyEntryHelper->getPreviewLength() * 1000; } else { $securyEntryHelper->validateForPlay($this->entry, $ksStr); } // grab seekFrom parameter and normalize url $this->seekFrom = $this->getRequestParameter("seekFrom", -1); if ($this->seekFrom <= 0) { $this->seekFrom = -1; } if ($this->entry->getStatus() == entryStatus::DELETED) { // because the fiter was turned off - a manual check for deleted entries must be done. die; } $xml = null; switch ($this->format) { case StorageProfile::PLAY_FORMAT_HTTP: $xml = $this->serveHttp(); break; case StorageProfile::PLAY_FORMAT_RTMP: $xml = $this->serveRtmp(); break; case StorageProfile::PLAY_FORMAT_SILVER_LIGHT: $xml = $this->serveSilverLight(); break; case StorageProfile::PLAY_FORMAT_APPLE_HTTP: $xml = $this->serveAppleHttp(); break; case "url": return $this->serveUrl(); break; case "hdnetworksmil": $xml = $this->serveHDNetwork(); break; case "hdnetwork": $duration = $this->entry->getDurationInt(); $mediaUrl = "<media url=\"" . requestUtils::getHost() . str_replace("f4m", "smil", str_replace("hdnetwork", "hdnetworksmil", $_SERVER["REQUEST_URI"])) . "\"/>"; $xml = $this->buildXml(self::PLAY_STREAM_TYPE_RECORDED, array(), 'video/x-flv', $duration, null, $mediaUrl); break; } if ($this->format == StorageProfile::PLAY_FORMAT_APPLE_HTTP) { header("Content-Type: text/plain; charset=UTF-8"); } else { header("Content-Type: text/xml; charset=UTF-8"); header("Content-Disposition: inline; filename=manifest.xml"); } echo $xml; die; }
public function getDownloadUrlWithExpiry($expiry, $useCdn = false) { $ksStr = ""; $partnerId = $this->getPartnerId(); $partner = PartnerPeer::retrieveByPK($partnerId); $secret = $partner->getSecret(); $privilege = ks::PRIVILEGE_DOWNLOAD . ":" . $this->getEntryId(); $result = kSessionUtils::startKSession($partnerId, $secret, null, $ksStr, $expiry, false, "", $privilege); if ($result < 0) { throw new Exception("Failed to generate session for flavor asset [" . $this->getId() . "]"); } $finalPath = myPartnerUtils::getUrlForPartner($this->getPartnerId(), $this->getPartnerId() * 100) . "/download" . "/entry_id/" . $this->getEntryId() . "/flavor/" . $this->getId() . "/ks/" . $ksStr; // Gonen May 12 2010 - removing CDN URLs. see ticket 5135 in internal mantis // in order to avoid conflicts with access_control (geo-location restriction), we always return the requestHost (www_host from kConf) // and not the CDN host relevant for the partner. // Tan-Tan January 27 2011 - in some places we do need the cdn, I added a paramter useCdn to force it. if ($useCdn) { $downloadUrl = myPartnerUtils::getCdnHost($partnerId) . $finalPath; } else { $downloadUrl = requestUtils::getRequestHost() . $finalPath; } return $downloadUrl; }
public function execute() { sfView::SUCCESS; /** check parameters and verify user is logged-in **/ $this->ks = $this->getP("kmcks"); if (!$this->ks) { // if kmcks from cookie doesn't exist, try ks from REQUEST $this->ks = $this->getP('ks'); } /** if no KS found, redirect to login page **/ if (!$this->ks) { $this->redirect("kmc/kmc"); die; } $ksObj = kSessionUtils::crackKs($this->ks); // Set partnerId from KS $this->partner_id = $ksObj->partner_id; // Check if the KMC can be framed $allowFrame = PermissionPeer::isValidForPartner(PermissionName::FEATURE_KMC_ALLOW_FRAME, $this->partner_id); if (!$allowFrame) { header('X-Frame-Options: DENY'); } // Check for forced HTTPS $force_ssl = PermissionPeer::isValidForPartner(PermissionName::FEATURE_KMC_ENFORCE_HTTPS, $this->partner_id); if ($force_ssl && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) { header("Location: " . infraRequestUtils::PROTOCOL_HTTPS . "://" . $_SERVER['SERVER_NAME'] . $_SERVER["REQUEST_URI"]); die; } /** END - check parameters and verify user is logged-in **/ /** Get array of allowed partners for the current user **/ $allowedPartners = array(); $this->full_name = ""; $currentUser = kuserPeer::getKuserByPartnerAndUid($this->partner_id, $ksObj->user, true); if ($currentUser) { $partners = myPartnerUtils::getPartnersArray($currentUser->getAllowedPartnerIds()); foreach ($partners as $partner) { $allowedPartners[] = array('id' => $partner->getId(), 'name' => $partner->getName()); } $this->full_name = $currentUser->getFullName(); } $this->showChangeAccount = count($allowedPartners) > 1 ? true : false; // Load partner $this->partner = $partner = PartnerPeer::retrieveByPK($this->partner_id); if (!$partner) { KExternalErrors::dieError(KExternalErrors::PARTNER_NOT_FOUND); } if (!$partner->validateApiAccessControl()) { KExternalErrors::dieError(KExternalErrors::SERVICE_ACCESS_CONTROL_RESTRICTED); } kmcUtils::redirectPartnerToCorrectKmc($partner, $this->ks, null, null, null, self::CURRENT_KMC_VERSION); $this->templatePartnerId = $this->partner ? $this->partner->getTemplatePartnerId() : self::SYSTEM_DEFAULT_PARTNER; $ignoreEntrySeoLinks = PermissionPeer::isValidForPartner(PermissionName::FEATURE_IGNORE_ENTRY_SEO_LINKS, $this->partner_id); $useEmbedCodeProtocolHttps = PermissionPeer::isValidForPartner(PermissionName::FEATURE_EMBED_CODE_DEFAULT_PROTOCOL_HTTPS, $this->partner_id); $showFlashStudio = PermissionPeer::isValidForPartner(PermissionName::FEATURE_SHOW_FLASH_STUDIO, $this->partner_id); $showHTMLStudio = PermissionPeer::isValidForPartner(PermissionName::FEATURE_SHOW_HTML_STUDIO, $this->partner_id); $deliveryTypes = $partner->getDeliveryTypes(); $embedCodeTypes = $partner->getEmbedCodeTypes(); $defaultDeliveryType = $partner->getDefaultDeliveryType() ? $partner->getDefaultDeliveryType() : 'http'; $defaultEmbedCodeType = $partner->getDefaultEmbedCodeType() ? $partner->getDefaultEmbedCodeType() : 'auto'; $this->previewEmbedV2 = PermissionPeer::isValidForPartner(PermissionName::FEATURE_PREVIEW_AND_EMBED_V2, $this->partner_id); /** set values for template **/ $this->service_url = requestUtils::getRequestHost(); $this->host = $this->stripProtocol($this->service_url); $this->embed_host = $this->stripProtocol(myPartnerUtils::getHost($this->partner_id)); if (kConf::hasParam('cdn_api_host') && kConf::hasParam('www_host') && $this->host == kConf::get('cdn_api_host')) { $this->host = kConf::get('www_host'); } if ($this->embed_host == kConf::get("www_host") && kConf::hasParam('cdn_api_host')) { $this->embed_host = kConf::get('cdn_api_host'); } $this->embed_host_https = kConf::hasParam('cdn_api_host_https') ? kConf::get('cdn_api_host_https') : kConf::get('www_host'); $this->cdn_url = myPartnerUtils::getCdnHost($this->partner_id); $this->cdn_host = $this->stripProtocol($this->cdn_url); $this->rtmp_host = kConf::get("rtmp_url"); $this->flash_dir = $this->cdn_url . myContentStorage::getFSFlashRootPath(); /** set payingPartner flag **/ $this->payingPartner = 'false'; if ($partner && $partner->getPartnerPackage() != PartnerPackages::PARTNER_PACKAGE_FREE) { $this->payingPartner = 'true'; $ignoreSeoLinks = true; } else { $ignoreSeoLinks = $this->partner->getIgnoreSeoLinks(); } /** get partner languae **/ $language = null; if ($partner->getKMCLanguage()) { $language = $partner->getKMCLanguage(); } $first_login = $partner->getIsFirstLogin(); if ($first_login === true) { $partner->setIsFirstLogin(false); $partner->save(); } /** get logout url **/ $logoutUrl = null; if ($partner->getLogoutUrl()) { $logoutUrl = $partner->getLogoutUrl(); } $this->kmc_swf_version = kConf::get('kmc_version'); $akamaiEdgeServerIpURL = null; if (kConf::hasParam('akamai_edge_server_ip_url')) { $akamaiEdgeServerIpURL = kConf::get('akamai_edge_server_ip_url'); } /** uiconf listing work **/ /** fill $confs with all uiconf objects for all modules **/ $kmcGeneralUiConf = kmcUtils::getAllKMCUiconfs('kmc', $this->kmc_swf_version, self::SYSTEM_DEFAULT_PARTNER); $kmcGeneralTemplateUiConf = kmcUtils::getAllKMCUiconfs('kmc', $this->kmc_swf_version, $this->templatePartnerId); /** for each module, create separated lists of its uiconf, for each need **/ /** kmc general uiconfs **/ $this->kmc_general = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_kmcgeneral", false, $kmcGeneralUiConf); $this->kmc_permissions = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_kmcpermissions", false, $kmcGeneralUiConf); /** P&E players: **/ //$this->content_uiconfs_previewembed = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_previewembed", true, $kmcGeneralUiConf); //$this->content_uiconfs_previewembed_list = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_previewembed_list", true, $kmcGeneralUiConf); $this->content_uiconfs_flavorpreview = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_flavorpreview", false, $kmcGeneralUiConf); /* KCW uiconfs */ $this->content_uiconfs_upload_webcam = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_uploadWebCam", false, $kmcGeneralUiConf); $this->content_uiconfs_upload_import = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_uploadImport", false, $kmcGeneralUiConf); $this->content_uiconds_clipapp_kdp = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_kdpClipApp", false, $kmcGeneralUiConf); $this->content_uiconds_clipapp_kclip = kmcUtils::find_confs_by_usage_tag($kmcGeneralTemplateUiConf, "kmc_kClipClipApp", false, $kmcGeneralUiConf); $this->studioUiConf = kmcUtils::getStudioUiconf(kConf::get("studio_version")); $this->content_uiconfs_studio_v2 = isset($this->studioUiConf) ? array_values($this->studioUiConf) : null; $this->content_uiconf_studio_v2 = is_array($this->content_uiconfs_studio_v2) && reset($this->content_uiconfs_studio_v2) ? reset($this->content_uiconfs_studio_v2) : null; $this->liveAUiConf = kmcUtils::getLiveAUiconf(); $this->content_uiconfs_livea = isset($this->liveAUiConf) ? array_values($this->liveAUiConf) : null; $this->content_uiconf_livea = is_array($this->content_uiconfs_livea) && reset($this->content_uiconfs_livea) ? reset($this->content_uiconfs_livea) : null; $kmcVars = array('kmc_version' => $this->kmc_swf_version, 'kmc_general_uiconf' => $this->kmc_general->getId(), 'kmc_permissions_uiconf' => $this->kmc_permissions->getId(), 'allowed_partners' => $allowedPartners, 'kmc_secured' => (bool) kConf::get("kmc_secured_login"), 'enableLanguageMenu' => true, 'service_url' => $this->service_url, 'host' => $this->host, 'cdn_host' => $this->cdn_host, 'rtmp_host' => $this->rtmp_host, 'embed_host' => $this->embed_host, 'embed_host_https' => $this->embed_host_https, 'flash_dir' => $this->flash_dir, 'getuiconfs_url' => '/index.php/kmc/getuiconfs', 'terms_of_use' => kConf::get('terms_of_use_uri'), 'ks' => $this->ks, 'partner_id' => $this->partner_id, 'first_login' => (bool) $first_login, 'whitelabel' => $this->templatePartnerId, 'ignore_seo_links' => (bool) $ignoreSeoLinks, 'ignore_entry_seo' => (bool) $ignoreEntrySeoLinks, 'embed_code_protocol_https' => (bool) $useEmbedCodeProtocolHttps, 'delivery_types' => $deliveryTypes, 'embed_code_types' => $embedCodeTypes, 'default_delivery_type' => $defaultDeliveryType, 'default_embed_code_type' => $defaultEmbedCodeType, 'kcw_webcam_uiconf' => $this->content_uiconfs_upload_webcam->getId(), 'kcw_import_uiconf' => $this->content_uiconfs_upload_import->getId(), 'default_kdp' => array('id' => $this->content_uiconfs_flavorpreview->getId(), 'height' => $this->content_uiconfs_flavorpreview->getHeight(), 'width' => $this->content_uiconfs_flavorpreview->getWidth(), 'swf_version' => $this->content_uiconfs_flavorpreview->getswfUrlVersion()), 'clipapp' => array('version' => kConf::get("clipapp_version"), 'kdp' => $this->content_uiconds_clipapp_kdp->getId(), 'kclip' => $this->content_uiconds_clipapp_kclip->getId()), 'studio' => array('version' => kConf::get("studio_version"), 'uiConfID' => isset($this->content_uiconf_studio_v2) ? $this->content_uiconf_studio_v2->getId() : '', 'config' => isset($this->content_uiconf_studio_v2) ? $this->content_uiconf_studio_v2->getConfig() : '', 'showFlashStudio' => $showFlashStudio, 'showHTMLStudio' => $showHTMLStudio), 'liveanalytics' => array('version' => kConf::get("liveanalytics_version"), 'player_id' => isset($this->content_uiconf_livea) ? $this->content_uiconf_livea->getId() : '', 'map_zoom_levels' => kConf::hasParam("map_zoom_levels") ? kConf::get("map_zoom_levels") : '', 'map_urls' => kConf::hasParam("cdn_static_hosts") ? array_map(function ($s) { return "{$s}/content/static/maps/v1"; }, kConf::get("cdn_static_hosts")) : ''), 'usagedashboard' => array('version' => kConf::get("usagedashboard_version")), 'disable_analytics' => (bool) kConf::get("kmc_disable_analytics"), 'google_analytics_account' => kConf::get("ga_account"), 'language' => $language, 'logoutUrl' => $logoutUrl, 'allowFrame' => (bool) $allowFrame, 'akamaiEdgeServerIpURL' => $akamaiEdgeServerIpURL, 'logoUrl' => kmcUtils::getWhitelabelData($partner, 'logo_url'), 'supportUrl' => kmcUtils::getWhitelabelData($partner, 'support_url')); $this->kmcVars = $kmcVars; }
<?php // TEST PAGE FOR ADDING JW TO KMC $jw_license = ($jw_license)? "licensed": "non-commercial"; $service_url = myPartnerUtils::getHost($partner_id); $host = str_replace ( "http://" , "" , $service_url ); $cdn_url = myPartnerUtils::getCdnHost($partner_id); $cdn_host = str_replace ( "http://" , "" , $cdn_url ); $cache_st = "cache_st/".(time()+ 15 * 60); $flash_dir = $service_url . myContentStorage::getFSFlashRootPath (); //$allow_reports = false; $disableurlhashing = kConf::get('disable_url_hashing'); if ( !$allow_reports ) { $first_login = true; } if ( kConf::get('kmc_display_server_tab') ) { $support_url = '#'; $_SESSION['api_v3_login'] = true; } else { $support_url = '/index.php/kmc/support?type=' . md5($payingPartner) . '&pid=' . $partner_id . '&email=' . $email; // if($visibleCT === 'true') // paying partner, not CE // { // $support_url = 'http://corp.kaltura.com/support/form/project/30/partnerId/'.(($host != 1)? '': $partner_id); // $support_url = 'http://tickets.kaltura.com/'; // }
/** * Will forward to the regular swf player according to the widget_id */ public function execute() { $uv_cookie = @$_COOKIE['uv']; if (strlen($uv_cookie) != 35) { $uv_cookie = "uv_" . md5(uniqid(rand(), true)); } setrawcookie('uv', $uv_cookie, time() + 3600 * 24 * 365, '/'); // check if this is a request for the kdp without a wrapper // in case of an application loading the kdp (e.g. kmc) $nowrapper = $this->getRequestParameter("nowrapper", false); // allow caching if either the cache start time (cache_st) parameter // wasn't specified or if it is past the specified time $cache_st = $this->getRequestParameter("cache_st"); $allowCache = !$cache_st || $cache_st < time(); $referer = @$_SERVER['HTTP_REFERER']; $externalInterfaceDisabled = strstr($referer, "bebo.com") === false && strstr($referer, "myspace.com") === false && strstr($referer, "current.com") === false && strstr($referer, "myyearbook.com") === false && strstr($referer, "facebook.com") === false && strstr($referer, "friendster.com") === false ? "" : "&externalInterfaceDisabled=1"; // if there is no wrapper the loader is responsible for setting extra params to the kdp $noncached_params = ""; if (!$nowrapper) { $noncached_params = $externalInterfaceDisabled . "&referer=" . urlencode($referer); } $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? "https" : "http"; $requestKey = $protocol . $_SERVER["REQUEST_URI"]; // check if we cached the redirect url $cache = new myCache("kwidget", 10 * 60); // 10 minutes $cachedResponse = $cache->get($requestKey); if ($allowCache && $cachedResponse) { header("X-Kaltura:cached-action"); header("Expires: Sun, 19 Nov 2000 08:52:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); header("Location:{$cachedResponse}" . $noncached_params); die; } // check if we cached the patched swf with flashvars $cache_swfdata = new myCache("kwidgetswf", 10 * 60); // 10 minutes $cachedResponse = $cache_swfdata->get($requestKey); if ($allowCache && $cachedResponse) { header("X-Kaltura:cached-action"); requestUtils::sendCdnHeaders("swf", strlen($cachedResponse), 60 * 10); echo $cachedResponse; die; } $widget_id = $this->getRequestParameter("wid"); $show_version = $this->getRequestParameter("v"); $debug_kdp = $this->getRequestParameter("debug_kdp", false); $widget = widgetPeer::retrieveByPK($widget_id); if (!$widget) { die; } // because of the routing rule - the entry_id & kmedia_type WILL exist. be sure to ignore them if smaller than 0 $kshow_id = $widget->getKshowId(); $entry_id = $widget->getEntryId(); $gallery_widget = !$kshow_id && !$entry_id; if (!$entry_id) { $entry_id = -1; } if ($widget->getSecurityType() != widget::WIDGET_SECURITY_TYPE_TIMEHASH) { // try eid - if failed entry_id $eid = $this->getRequestParameter("eid", $this->getRequestParameter("entry_id")); // try kid - if failed kshow_id $kid = $this->getRequestParameter("kid", $this->getRequestParameter("kshow_id")); if ($eid != null) { $entry_id = $eid; } elseif ($kid != null) { $kshow_id = $kid; } } if ($widget->getSecurityType() == widget::WIDGET_SECURITY_TYPE_MATCH_IP) { $allowCache = false; // here we'll attemp to match the ip of the request with that from the customData of the widget $custom_data = $widget->getCustomData(); $valid_country = false; if ($custom_data) { // in this case the custom_data should be of format: // valid_county_1,valid_country_2,...,valid_country_n;falback_entry_id $arr = explode(";", $custom_data); $countries_str = $arr[0]; $fallback_entry_id = isset($arr[1]) ? $arr[1] : null; $fallback_kshow_id = isset($arr[2]) ? $arr[2] : null; $current_country = ""; $valid_country = requestUtils::matchIpCountry($countries_str, $current_country); if (!$valid_country) { KalturaLog::log("kwidgetAction: Attempting to access widget [{$widget_id}] and entry [{$entry_id}] from country [{$current_country}]. Retrning entry_id: [{$fallback_entry_id}] kshow_id [{$fallback_kshow_id}]"); $entry_id = $fallback_entry_id; $kshow_id = $fallback_kshow_id; } } } elseif ($widget->getSecurityType() == widget::WIDGET_SECURITY_TYPE_FORCE_KS) { } $kmedia_type = -1; // support either uiconf_id or ui_conf_id $uiconf_id = $this->getRequestParameter("uiconf_id"); if (!$uiconf_id) { $uiconf_id = $this->getRequestParameter("ui_conf_id"); } if ($uiconf_id) { $widget_type = $uiconf_id; $uiconf_id_str = "&uiconf_id={$uiconf_id}"; } else { $widget_type = $widget->getUiConfId(); $uiconf_id_str = ""; } if (empty($widget_type)) { $widget_type = 3; } $kdata = $widget->getCustomData(); $partner_host = myPartnerUtils::getHost($widget->getPartnerId()); $partner_cdnHost = myPartnerUtils::getCdnHost($widget->getPartnerId()); $host = $partner_host; if ($widget_type == 10) { $swf_url = $host . "/swf/weplay.swf"; } else { $swf_url = $host . "/swf/kplayer.swf"; } $partner_id = $widget->getPartnerId(); $subp_id = $widget->getSubpId(); if (!$subp_id) { $subp_id = 0; } $uiConf = uiConfPeer::retrieveByPK($widget_type); // new ui_confs which are deleted should stop the script // the check for >100000 is for supporting very old mediawiki and such players if (!$uiConf && $widget_type > 100000) { die; } if ($uiConf) { $ui_conf_swf_url = $uiConf->getSwfUrl(); if (kString::beginsWith($ui_conf_swf_url, "http")) { $swf_url = $ui_conf_swf_url; // absolute URL } else { $use_cdn = $uiConf->getUseCdn(); $host = $use_cdn ? $partner_cdnHost : $partner_host; $swf_url = $host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url; } if ($debug_kdp) { $swf_url = str_replace("/kdp/", "/kdp_debug/", $swf_url); } } if ($show_version < 0) { $show_version = null; } $ip = requestUtils::getRemoteAddress(); // to convert back, use long2ip // the widget log should change to reflect the new data, but for now - i used $widget_id instead of the widgget_type // WidgetLog::createWidgetLog( $referer , $ip , $kshow_id , $entry_id , $kmedia_type , $widget_id ); if ($entry_id == -1) { $entry_id = null; } $kdp3 = false; $base_wrapper_swf = myContentStorage::getFSFlashRootPath() . "/kdpwrapper/" . kConf::get('kdp_wrapper_version') . "/kdpwrapper.swf"; $widgetIdStr = "widget_id={$widget_id}"; $partnerIdStr = "partner_id={$partner_id}&subp_id={$subp_id}"; if ($uiConf) { $ks_flashvars = ""; $conf_vars = $uiConf->getConfVars(); if ($conf_vars) { $conf_vars = "&" . $conf_vars; } $wrapper_swf = $base_wrapper_swf; $partner = PartnerPeer::retrieveByPK($partner_id); if ($partner) { $partner_type = $partner->getType(); } if (version_compare($uiConf->getSwfUrlVersion(), "3.0", ">=")) { $kdp3 = true; // further in the code, $wrapper_swf is being used and not $base_wrapper_swf $wrapper_swf = $base_wrapper_swf = myContentStorage::getFSFlashRootPath() . '/kdp3wrapper/' . kConf::get('kdp3_wrapper_version') . '/kdp3wrapper.swf'; $widgetIdStr = "widgetId={$widget_id}"; $uiconf_id_str = "&uiConfId={$uiconf_id}"; $partnerIdStr = "partnerId={$partner_id}&subpId={$subp_id}"; } // if we are loaded without a wrapper (directly in flex) // 1. dont create the ks - keep url the same for caching // 2. dont patch the uiconf - patching is done only to wrapper anyway if ($nowrapper) { $dynamic_date = $widgetIdStr . "&host=" . str_replace("http://", "", str_replace("https://", "", $partner_host)) . "&cdnHost=" . str_replace("http://", "", str_replace("https://", "", $partner_cdnHost)) . $uiconf_id_str . $conf_vars; $url = "{$swf_url}?{$dynamic_date}"; } else { // if kdp version >= 2.5 if (version_compare($uiConf->getSwfUrlVersion(), "2.5", ">=")) { // create an anonymous session $ks = ""; $result = kSessionUtils::createKSessionNoValidations($partner_id, 0, $ks, 86400, false, "", "view:*"); $ks_flashvars = "&{$partnerIdStr}&uid=0&ts=" . microtime(true); if ($widget->getSecurityType() != widget::WIDGET_SECURITY_TYPE_FORCE_KS) { $ks_flashvars = "&ks={$ks}" . $ks_flashvars; } // patch kdpwrapper with getwidget and getuiconf $root = myContentStorage::getFSContentRootPath(); $confFile_mtime = $uiConf->getUpdatedAt(null); $new_swf_path = "widget_{$widget_id}_{$widget_type}_{$confFile_mtime}_" . md5($base_wrapper_swf . $swf_url) . ".swf"; $md5 = md5($new_swf_path); $new_swf_path = "content/cacheswf/" . substr($md5, 0, 2) . "/" . substr($md5, 2, 2) . "/" . $new_swf_path; $cached_swf = "{$root}/{$new_swf_path}"; 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; } $serializer = new KalturaXmlSerializer(false); $serializer->serialize($widget_result); $widget_xml = $serializer->getSerializedData(); $serializer = new KalturaXmlSerializer(false); $serializer->serialize($ui_conf_result); $ui_conf_xml = $serializer->getSerializedData(); $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')); } $dynamic_date = $widgetIdStr . $track_wrapper . "&kdpUrl=" . urlencode($swf_url) . "&host=" . str_replace("http://", "", str_replace("https://", "", $partner_host)) . "&cdnHost=" . str_replace("http://", "", str_replace("https://", "", $partner_cdnHost)) . ($show_version ? "&entryVersion={$show_version}" : "") . ($kshow_id ? "&kshowId={$kshow_id}" : "") . ($entry_id ? "&entryId={$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); 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 ? "&entryId={$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); }
private function getFlavorAssetUrl($kalturaEntry) { $partner = PartnerPeer::retrieveByPK($this->syndicationFeed->partnerId); if (!$partner) { return null; } $flavorAsset = assetPeer::retrieveByEntryIdAndParams($kalturaEntry->id, $this->syndicationFeed->flavorParamId); if (!$flavorAsset) { return null; } $syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); $externalStorageUrl = $this->getExternalStorageUrl($partner, $flavorAsset, $syncKey); if ($externalStorageUrl) { return $externalStorageUrl; } if ($partner->getStorageServePriority() == StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY) { return null; } $this->protocol = StorageProfile::PLAY_FORMAT_HTTP; $this->cdnHost = myPartnerUtils::getCdnHost($this->syndicationFeed->partnerId, $this->protocol); $urlManager = kUrlManager::getUrlManagerByCdn($this->cdnHost, $flavorAsset->getEntryId()); $urlManager->setDomain($this->cdnHost); $url = $urlManager->getAssetUrl($flavorAsset); $url = $this->cdnHost . $url; $url = preg_replace('/^https?:\\/\\//', '', $url); return $this->protocol . '://' . $url; }
public function getDownloadUrlWithExpiry($expiry, $useCdn = false, $forceProxy = false, $preview = null) { $ksStr = ""; $partnerId = $this->getPartnerId(); if ($this->isKsNeededForDownload() || $preview) { $partner = PartnerPeer::retrieveByPK($partnerId); $secret = $partner->getSecret(); $privilege = ks::PRIVILEGE_DOWNLOAD . ":" . $this->getEntryId(); $privilege .= "," . kSessionBase::PRIVILEGE_DISABLE_ENTITLEMENT_FOR_ENTRY . ":" . $this->getEntryId(); $privilege .= "," . kSessionBase::PRIVILEGE_VIEW . ":" . $this->getEntryId(); $privilege .= "," . kSessionBase::PRIVILEGE_DOWNLOAD_ASSET . ":" . $this->getId(); if ($preview) { $privilege .= "," . kSessionBase::PRIVILEGE_PREVIEW . ":" . $preview; } $result = kSessionUtils::startKSession($partnerId, $secret, null, $ksStr, $expiry, false, "", $privilege); if ($result < 0) { throw new Exception("Failed to generate session for asset [" . $this->getId() . "] of type " . $this->getType()); } } $finalPath = $this->getFinalDownloadUrlPathWithoutKs(); if ($ksStr) { $finalPath .= "/ks/" . $ksStr; } if ($forceProxy) { $finalPath .= "/relocate/" . $this->getEntryId() . "." . $this->getFileExt(); } // Gonen May 12 2010 - removing CDN URLs. see ticket 5135 in internal mantis // in order to avoid conflicts with access_control (geo-location restriction), we always return the requestHost (www_host from kConf) // and not the CDN host relevant for the partner. // Tan-Tan January 27 2011 - in some places we do need the cdn, I added a paramter useCdn to force it. if ($useCdn) { // TODO in that case we should use the serve flavor and the url manager in order to support secured and signed urls $downloadUrl = myPartnerUtils::getCdnHost($partnerId) . $finalPath; } else { $downloadUrl = requestUtils::getRequestHost() . $finalPath; } return $downloadUrl; }
public function getDownloadUrlWithExpiry($expiry, $useCdn = false) { $ksStr = ""; $ksNeeded = true; $partnerId = $this->getPartnerId(); if (!PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENTITLEMENT, $partnerId)) { $invalidModerationStatuses = array(entry::ENTRY_MODERATION_STATUS_PENDING_MODERATION, entry::ENTRY_MODERATION_STATUS_REJECTED); $entry = $this->getentry(); if ($entry && !in_array($entry->getModerationStatus(), $invalidModerationStatuses) && ($entry->getStartDate() === null || $entry->getStartDate(null) < time()) && ($entry->getEndDate() === null || $entry->getEndDate(null) > time() + 86400)) { $accessControl = $entry->getaccessControl(); if ($accessControl && !$accessControl->getRulesArray()) { $ksNeeded = false; } } } if ($ksNeeded) { $partner = PartnerPeer::retrieveByPK($partnerId); $secret = $partner->getSecret(); $privilege = ks::PRIVILEGE_DOWNLOAD . ":" . $this->getEntryId(); $privilege .= "," . kSessionBase::PRIVILEGE_DISABLE_ENTITLEMENT_FOR_ENTRY . ":" . $this->getEntryId(); $result = kSessionUtils::startKSession($partnerId, $secret, null, $ksStr, $expiry, false, "", $privilege); if ($result < 0) { throw new Exception("Failed to generate session for asset [" . $this->getId() . "] of type " . $this->getType()); } } $finalPath = $this->getFinalDownloadUrlPathWithoutKs(); if ($ksStr) { $finalPath .= "/ks/" . $ksStr; } // Gonen May 12 2010 - removing CDN URLs. see ticket 5135 in internal mantis // in order to avoid conflicts with access_control (geo-location restriction), we always return the requestHost (www_host from kConf) // and not the CDN host relevant for the partner. // Tan-Tan January 27 2011 - in some places we do need the cdn, I added a paramter useCdn to force it. if ($useCdn) { // TODO in that case we should use the serve flavor and the url manager in order to support secured and signed urls $downloadUrl = myPartnerUtils::getCdnHost($partnerId) . $finalPath; } else { $downloadUrl = requestUtils::getRequestHost() . $finalPath; } return $downloadUrl; }
private function getPlayManifestUrl($entry, $playbackProtocol, $tag, $fileExt) { $partnerPath = myPartnerUtils::getUrlForPartner($entry->getPartnerId(), $entry->getSubpId()); $downloadUrl = myPartnerUtils::getCdnHost($entry->getPartnerId()) . $partnerPath . "/playManifest" . "/entryId/{$entry->getId()}" . "/format/{$playbackProtocol}" . "/tags/{$tag}" . "/protocol/http" . "/f/a.{$fileExt}"; return $downloadUrl; }
public function getAssetUrl(asset $asset) { $cdnHost = myPartnerUtils::getCdnHost($asset->getPartnerId()); $urlManager = kUrlManager::getUrlManagerByCdn($cdnHost, $asset->getEntryId()); $urlManager->setDomain($cdnHost); $url = $urlManager->getAssetUrl($asset); $url = $cdnHost . $url; $url = preg_replace('/^https?:\\/\\//', '', $url); return 'http://' . $url; }
/** * Will forward to the regular swf player according to the widget_id */ public function execute() { $entry_id = $this->getRequestParameter("entry_id"); $entry = null; $widget_id = null; $partner_id = null; if ($entry_id) { $entry = entryPeer::retrieveByPK($entry_id); if (!$entry) { KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND); } $partner_id = $entry->getPartnerId(); $widget_id = '_' . $partner_id; } $widget_id = $this->getRequestParameter("widget_id", $widget_id); $widget = widgetPeer::retrieveByPK($widget_id); if (!$widget) { KExternalErrors::dieError(KExternalErrors::WIDGET_NOT_FOUND); } $subp_id = $widget->getSubpId(); if (!$subp_id) { $subp_id = 0; } if (!$entry_id) { $entry_id = $widget->getEntryId(); if (!$entry_id) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'entry_id'); } $entry = entryPeer::retrieveByPK($entry_id); if (!$entry) { KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND); } } $allowCache = true; $securityType = $widget->getSecurityType(); switch ($securityType) { case widget::WIDGET_SECURITY_TYPE_TIMEHASH: // TODO - I don't know what should be validated here break; case widget::WIDGET_SECURITY_TYPE_MATCH_IP: $allowCache = false; // here we'll attemp to match the ip of the request with that from the customData of the widget $custom_data = $widget->getCustomData(); $valid_country = false; if ($custom_data) { // in this case the custom_data should be of format: // valid_county_1,valid_country_2,...,valid_country_n;falback_entry_id $arr = explode(";", $custom_data); $countries_str = $arr[0]; $fallback_entry_id = isset($arr[1]) ? $arr[1] : null; $fallback_kshow_id = isset($arr[2]) ? $arr[2] : null; $current_country = ""; $valid_country = requestUtils::matchIpCountry($countries_str, $current_country); if (!$valid_country) { KalturaLog::log("Attempting to access widget [{$widget_id}] and entry [{$entry_id}] from country [{$current_country}]. Retrning entry_id: [{$fallback_entry_id}] kshow_id [{$fallback_kshow_id}]"); $entry_id = $fallback_entry_id; } } break; case widget::WIDGET_SECURITY_TYPE_FORCE_KS: $ks_str = $this->getRequestParameter('ks'); try { $ks = kSessionUtils::crackKs($ks_str); } catch (Exception $e) { KExternalErrors::dieError(KExternalErrors::INVALID_KS); } $res = kSessionUtils::validateKSession2(1, $partner_id, 0, $ks_str, $ks); if ($res <= 0) { KExternalErrors::dieError(KExternalErrors::INVALID_KS); } break; default: break; } $requestKey = $_SERVER["REQUEST_URI"]; // check if we cached the redirect url $cache = new myCache("embedIframe", 10 * 60); // 10 minutes $cachedResponse = $cache->get($requestKey); if ($allowCache && $cachedResponse) { header("X-Kaltura: cached-action"); header("Expires: Sun, 19 Nov 2000 08:52:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); header("Pragma: no-cache"); header("Location:{$cachedResponse}"); die; } $uiconf_id = $this->getRequestParameter('uiconf_id'); if (!$uiconf_id) { $uiconf_id = $widget->getUiConfId(); } if (!$uiconf_id) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id'); } $partner_host = myPartnerUtils::getHost($partner_id); $partner_cdnHost = myPartnerUtils::getCdnHost($partner_id); $uiConf = uiConfPeer::retrieveByPK($uiconf_id); if (!$uiConf) { KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND); } $partner_host = myPartnerUtils::getHost($partner_id); $partner_cdnHost = myPartnerUtils::getCdnHost($partner_id); $html5_version = kConf::get('html5_version'); $use_cdn = $uiConf->getUseCdn(); $host = $use_cdn ? $partner_cdnHost : $partner_host; $url = $host; $url .= "/html5/html5lib/v{$html5_version}/mwEmbedFrame.php"; $url .= "/entry_id/{$entry_id}/wid/{$widget_id}/uiconf_id/{$uiconf_id}"; if ($allowCache) { $cache->put($requestKey, $url); } $this->redirect($url); }
public function execute() { sfView::SUCCESS; /** check parameters and verify user is logged-in **/ $this->partner_id = $this->getP("pid"); $this->subp_id = $this->getP("subpid", (int) $this->partner_id * 100); $this->uid = $this->getP("uid"); $this->ks = $this->getP("kmcks"); if (!$this->ks) { // if kmcks from cookie doesn't exist, try ks from REQUEST $this->ks = $this->getP('ks'); } $this->screen_name = $this->getP("screen_name"); $this->email = $this->getP("email"); /** if no KS found, redirect to login page **/ if (!$this->ks) { $this->redirect("kmc/kmc"); die; } /** END - check parameters and verify user is logged-in **/ /** load partner from DB, and set templatePartnerId **/ $this->partner = $partner = null; $this->templatePartnerId = self::SYSTEM_DEFAULT_PARTNER; if ($this->partner_id !== NULL) { $this->partner = $partner = PartnerPeer::retrieveByPK($this->partner_id); kmcUtils::redirectPartnerToCorrectKmc($partner, $this->ks, $this->uid, $this->screen_name, $this->email, self::CURRENT_KMC_VERSION); $this->templatePartnerId = $this->partner ? $this->partner->getTemplatePartnerId() : self::SYSTEM_DEFAULT_PARTNER; } /** END - load partner from DB, and set templatePartnerId **/ /** set default flags **/ $this->allow_reports = false; $this->payingPartner = 'false'; $this->embed_code = ""; $this->enable_live_streaming = 'false'; $this->kmc_enable_custom_data = 'false'; $this->kdp508_players = array(); $this->first_login = false; $this->enable_vast = 'false'; /** END - set default flags **/ /** set values for template **/ $this->service_url = myPartnerUtils::getHost($this->partner_id); $this->host = str_replace("http://", "", $this->service_url); $this->cdn_url = myPartnerUtils::getCdnHost($this->partner_id); $this->cdn_host = str_replace("http://", "", $this->cdn_url); $this->rtmp_host = myPartnerUtils::getRtmpUrl($this->partner_id); $this->flash_dir = $this->cdn_url . myContentStorage::getFSFlashRootPath(); /** set embed_code value **/ if ($this->partner_id !== null) { $widget = widgetPeer::retrieveByPK("_" . $this->partner_id); if ($widget) { $this->embed_code = $widget->getWidgetHtml("kaltura_player"); $ui_conf = $widget->getuiConf(); } } /** END - set embed_code value **/ /** set payingPartner flag **/ if ($partner && $partner->getPartnerPackage() != PartnerPackages::PARTNER_PACKAGE_FREE) { $this->payingPartner = 'true'; } /** END - set payingPartner flag **/ /** set enable_live_streaming flag **/ if (kConf::get('kmc_content_enable_live_streaming') && $partner) { if ($partner->getLiveStreamEnabled()) { $this->enable_live_streaming = 'true'; } } /** END - set enable_live_streaming flag **/ /** set enable_live_streaming flag **/ if ($partner && $partner->getEnableVast()) { $this->enable_vast = 'true'; } /** END - set enable_live_streaming flag **/ /** set kmc_enable_custom_data flag **/ $defaultPlugins = kConf::get('default_plugins'); if (is_array($defaultPlugins) && in_array('MetadataPlugin', $defaultPlugins) && $partner) { if ($partner->getPluginEnabled(MetadataPlugin::PLUGIN_NAME) && $partner->getKmcVersion() == self::CURRENT_KMC_VERSION) { $this->kmc_enable_custom_data = 'true'; } } /** END - set kmc_enable_custom_data flag **/ /** set allow_reports flag **/ // 2009-08-27 is the date we added ON2 to KMC trial account // TODO - should be depracated if (strtotime($partner->getCreatedAt()) >= strtotime('2009-08-27') || $partner->getEnableAnalyticsTab()) { $this->allow_reports = true; } if ($partner->getEnableAnalyticsTab()) { $this->allow_reports = true; } // if the email is empty - it is an indication that the kaltura super user is logged in if (!$this->email) { $this->allow_reports = true; } /** END - set allow_reports flag **/ /** set first_login and jw_license flags **/ if ($partner) { $this->first_login = $partner->getIsFirstLogin(); if ($this->first_login === true) { $partner->setIsFirstLogin(false); $partner->save(); } $this->jw_license = $partner->getLicensedJWPlayer(); } /** END - set first_login and jw_license flags **/ /** partner-specific: change KDP version for partners working with auto-moderaion **/ // set content kdp version according to partner id $moderated_partners = array(31079, 28575, 32774); $this->content_kdp_version = 'v2.7.0'; if (in_array($this->partner_id, $moderated_partners)) { $this->content_kdp_version = 'v2.1.2.29057'; } /** END - partner-specific: change KDP version for partners working with auto-moderaion **/ /** applications versioning **/ $this->kmc_content_version = kConf::get('kmc_content_version'); $this->kmc_account_version = kConf::get('kmc_account_version'); $this->kmc_appstudio_version = kConf::get('kmc_appstudio_version'); $this->kmc_rna_version = kConf::get('kmc_rna_version'); $this->kmc_dashboard_version = kConf::get('kmc_dashboard_version'); /** END - applications versioning **/ /** uiconf listing work **/ /** fill $this->confs with all uiconf objects for all modules **/ $contentSystemUiConfs = kmcUtils::getAllKMCUiconfs('content', $this->kmc_content_version, self::SYSTEM_DEFAULT_PARTNER); $contentTemplateUiConfs = kmcUtils::getAllKMCUiconfs('content', $this->kmc_content_version, $this->templatePartnerId); //$this->confs = kmcUtils::getAllKMCUiconfs('content', $this->kmc_content_version, $this->templatePartnerId); $appstudioSystemUiConfs = kmcUtils::getAllKMCUiconfs('appstudio', $this->kmc_appstudio_version, self::SYSTEM_DEFAULT_PARTNER); $appstudioTemplateUiConfs = kmcUtils::getAllKMCUiconfs('appstudio', $this->kmc_appstudio_version, $this->templatePartnerId); //$this->confs = array_merge($this->confs, kmcUtils::getAllKMCUiconfs('appstudio', $this->kmc_appstudio_version, $this->templatePartnerId)); $reportsSystemUiConfs = kmcUtils::getAllKMCUiconfs('reports', $this->kmc_rna_version, self::SYSTEM_DEFAULT_PARTNER); $reportsTemplateUiConfs = kmcUtils::getAllKMCUiconfs('reports', $this->kmc_rna_version, $this->templatePartnerId); //$this->confs = array_merge($this->confs, kmcUtils::getAllKMCUiconfs('reports', $this->kmc_rna_version, $this->templatePartnerId)); /** for each module, create separated lists of its uiconf, for each need **/ /** content players: **/ $this->content_uiconfs_previewembed = kmcUtils::find_confs_by_usage_tag($contentTemplateUiConfs, "content_previewembed", true, $contentSystemUiConfs); $this->content_uiconfs_previewembed_list = kmcUtils::find_confs_by_usage_tag($contentTemplateUiConfs, "content_previewembed_list", true, $contentSystemUiConfs); $this->content_uiconfs_moderation = kmcUtils::find_confs_by_usage_tag($contentTemplateUiConfs, "content_moderation", false, $contentSystemUiConfs); $this->content_uiconfs_drilldown = kmcUtils::find_confs_by_usage_tag($contentTemplateUiConfs, "content_drilldown", false, $contentSystemUiConfs); $this->content_uiconfs_flavorpreview = kmcUtils::find_confs_by_usage_tag($contentTemplateUiConfs, "content_flavorpreview", false, $contentSystemUiConfs); $this->content_uiconfs_metadataview = kmcUtils::find_confs_by_usage_tag($contentTemplateUiConfs, "content_metadataview", false, $contentSystemUiConfs); /** content KCW,KSE,KAE **/ $this->content_uiconfs_upload = kmcUtils::find_confs_by_usage_tag($contentTemplateUiConfs, "content_upload", false, $contentSystemUiConfs); $this->simple_editor = kmcUtils::find_confs_by_usage_tag($contentTemplateUiConfs, "content_simpleedit", false, $contentSystemUiConfs); $this->advanced_editor = kmcUtils::find_confs_by_usage_tag($contentTemplateUiConfs, "content_advanceedit", false, $contentSystemUiConfs); /** appStudio templates uiconf **/ $this->appstudio_uiconfs_templates = kmcUtils::find_confs_by_usage_tag($appstudioTemplateUiConfs, "appstudio_templates", false, $appstudioSystemUiConfs); /** reports drill-down player **/ $this->reports_uiconfs_drilldown = kmcUtils::find_confs_by_usage_tag($reportsTemplateUiConfs, "reports_drilldown", false, $reportsSystemUiConfs); /** silverlight uiconfs **/ $this->silverLightPlayerUiConfs = array(); $this->silverLightPlaylistUiConfs = array(); if ($partner->getKmcVersion() == self::CURRENT_KMC_VERSION && $partner->getEnableSilverLight()) { $this->silverLightPlayerUiConfs = kmcUtils::getSilverLightPlayerUiConfs('slp'); $this->silverLightPlaylistUiConfs = kmcUtils::getSilverLightPlayerUiConfs('sll'); } /** jw uiconfs **/ $this->jw_uiconfs_array = kmcUtils::getJWPlayerUIConfs(); $this->jw_uiconf_playlist = kmcUtils::getJWPlaylistUIConfs(); /** 508 uicinfs **/ if ($partner->getKmcVersion() == self::CURRENT_KMC_VERSION && $partner->getEnable508Players()) { $this->kdp508_players = kmcUtils::getKdp508PlayerUiconfs(); } /** partner's preview&embed uiconfs **/ $this->content_pne_partners_player = kmcUtils::getPartnersUiconfs($this->partner_id, 'player'); $this->content_pne_partners_playlist = kmcUtils::getPartnersUiconfs($this->partner_id, 'playlist'); /** appstudio: default entry and playlists **/ $this->appStudioExampleEntry = $partner->getAppStudioExampleEntry(); $appStudioExampleEntry = entryPeer::retrieveByPK($this->appStudioExampleEntry); if (!($appStudioExampleEntry && $appStudioExampleEntry->getDisplayInSearch() == mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK && $appStudioExampleEntry->getStatus() == entryStatus::READY && $appStudioExampleEntry->getType() == entryType::MEDIA_CLIP)) { $this->appStudioExampleEntry = "_KMCLOGO1"; } $this->appStudioExamplePlayList0 = $partner->getAppStudioExamplePlayList0(); $appStudioExamplePlayList0 = entryPeer::retrieveByPK($this->appStudioExamplePlayList0); if (!($appStudioExamplePlayList0 && $appStudioExamplePlayList0->getStatus() == entryStatus::READY && $appStudioExamplePlayList0->getType() == entryType::PLAYLIST)) { $this->appStudioExamplePlayList0 = "_KMCSPL1"; } $this->appStudioExamplePlayList1 = $partner->getAppStudioExamplePlayList1(); $appStudioExamplePlayList1 = entryPeer::retrieveByPK($this->appStudioExamplePlayList1); if (!($appStudioExamplePlayList1 && $appStudioExamplePlayList1->getStatus() == entryStatus::READY && $appStudioExamplePlayList1->getType() == entryType::PLAYLIST)) { $this->appStudioExamplePlayList1 = "_KMCSPL2"; } /** END - appstudio: default entry and playlists **/ /** END - uiconf listing work **/ /** get templateXmlUrl for whitelabeled partners **/ $this->appstudio_templatesXmlUrl = $this->getAppStudioTemplatePath(); }
/** * 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(); }
<?php $service_url = requestUtils::getRequestHost(); $protocol = requestUtils::getRequestProtocol(); $host = str_replace("{$protocol}://", "", $service_url); $cdn_host = str_replace("http://", "", myPartnerUtils::getCdnHost($partner_id)); $kmc_content_version = 'v1.1.8'; $kmc_account_version = 'v1.1.6'; $kmc_appstudio_version = 'v1.2.0'; $kmc_rna_version = 'v1.0.3'; $flash_dir = $service_url . myContentStorage::getFSFlashRootPath(); ?> <script> sub_nav_tab = ""; current_module = 'reports'; var flashVars = { 'host' : "<?php echo $host; ?> " , 'cdnhost' : "<?php echo $cdn_host; ?> " , 'uid' : "<?php echo $uid; ?> " , 'partner_id' : "<?php echo $partner_id; ?>
public function getRawDownloadUrl() { $finalPath = "/downloadUrl?url=" . myPartnerUtils::getUrlForPartner($this->getPartnerId(), $this->getSubpId()) . "/raw/entry_id/" . $this->getId(); $downloadUrl = myPartnerUtils::getCdnHost($this->getPartnerId()) . $finalPath; return $downloadUrl; }
private function serveVodEntry() { $this->initFlavorIds(); if ($this->entry->getPartner()->getForceCdnHost()) { $this->cdnHost = myPartnerUtils::getCdnHost($this->entry->getPartnerId(), $this->protocol); } $this->initFlavorAssetArray(); $this->initEntryDuration(); if ($this->duration && $this->duration < 10 && $this->deliveryAttributes->getFormat() == PlaybackProtocol::AKAMAI_HDS) { // videos shorter than 10 seconds cannot be played with HDS, fall back to HTTP $this->deliveryAttributes->setFormat(PlaybackProtocol::HTTP); $flavorAssets = $this->deliveryAttributes->getFlavorAssets(); $flavorAsset = reset($flavorAssets); $this->deliveryAttributes->setFlavorAssets(array($flavorAsset)); } $this->initStorageProfile(); // Fixing ALL kinds of historical bugs. if ($this->deliveryAttributes->getFormat() == self::URL) { if (is_null($this->deliveryAttributes->getResponseFormat())) { $this->deliveryAttributes->setResponseFormat('redirect'); } $this->deliveryAttributes->setFormat(PlaybackProtocol::HTTP); } else { if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::AKAMAI_HD) { // This is a hack to return an f4m that has a URL of a smil return $this->serveHDNetwork(); } else { if ($this->deliveryAttributes->getFormat() == self::HDNETWORKSMIL) { // Translate to playback protocol format $this->deliveryAttributes->setFormat(PlaybackProtocol::AKAMAI_HD); } else { if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::RTMP) { if (strpos($this->deliveryAttributes->getMediaProtocol(), "rtmp") !== 0) { $this->deliveryAttributes->setMediaProtocol("rtmp"); } } else { if ($this->deliveryAttributes->getFormat() == PlaybackProtocol::HTTP) { if (strpos($this->deliveryAttributes->getMediaProtocol(), "http") !== 0) { $this->deliveryAttributes->setMediaProtocol("http"); } } } } } } // <-- $this->deliveryProfile = $this->initDeliveryProfile(); if (!$this->deliveryProfile) { return null; } $this->enforceAudioVideoEntry(); $this->deliveryProfile->setDynamicAttributes($this->deliveryAttributes); return $this->deliveryProfile->serve(); }