本文整理汇总了PHP中myPartnerUtils::getHost方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::getHost方法的具体用法?PHP myPartnerUtils::getHost怎么用?PHP myPartnerUtils::getHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myPartnerUtils
的用法示例。
在下文中一共展示了myPartnerUtils::getHost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* 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}");
}
示例2: execute
/**
* 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}");
}
示例3: execute
/**
* 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}");
}
示例4: execute
/**
* 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}");
}
示例5: 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
示例6: execute
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');
}
示例7: execute
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);
}
示例8: 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);
$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);
}
示例9: execute
/**
* 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);
//.........这里部分代码省略.........
示例10: execute
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 **/
//.........这里部分代码省略.........
示例11: execute
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;
//.........这里部分代码省略.........
示例12: execute
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();
//.........这里部分代码省略.........
示例13: execute
//.........这里部分代码省略.........
// 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);
}
}
示例14: execute
public function execute()
{
$this->uiconf_id = intval($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 = intval($this->getRequestParameter('partner_id', $this->uiConf->getPartnerId()));
if (!$this->partner_id) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id');
}
// Single Player parameters
$this->entry_id = htmlspecialchars($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();
$this->entry_thumbnail_secure_url = $entry->getThumbnailUrl(null, 'https');
$this->entry_duration = $entry->getDuration();
$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;
}
}
$playlist_name = null;
$playlist_description = null;
$embed_host = kConf::hasParam('cdn_api_host') ? kConf::get('cdn_api_host') : kConf::get('www_host');
$embed_host_https = kConf::hasParam('cdn_api_host_https') ? kConf::get('cdn_api_host_https') : kConf::get('www_host');
// Check if HTTPS enabled and set protocol
$https_enabled = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? true : false;
$protocol = $https_enabled ? 'https' : 'http';
$this->framed = isset($_GET['framed']) ? true : false;
$this->embedType = $this->getRequestParameter('embed') ? $this->getRequestParameter('embed') : 'legacy';
$cacheSt = time() + 60 * 15;
// Basic embed options
$embedParams = array('host' => $embed_host, 'securedHost' => $embed_host_https, 'partnerId' => $this->partner_id, 'protocol' => $protocol, 'embedType' => $this->embedType, 'uiConfId' => $this->uiconf_id, 'width' => $this->uiConf->getWidth(), 'height' => $this->uiConf->getHeight(), 'includeKalturaLinks' => true, 'cacheSt' => $cacheSt);
// Add entry Id and Metadata
if ($this->entry_id) {
$embedParams['entryId'] = $this->entry_id;
$embedParams['includeSeoMetadata'] = true;
$embedParams['entryMeta'] = array('name' => $this->entry_name, 'description' => $this->entry_description, 'thumbnailUrl' => $this->entry_thumbnail_url, 'duration' => $this->entry_duration);
}
// Add flashVars
if (isset($_GET['flashvars'])) {
$flashVars = array();
if (is_array($_GET['flashvars'])) {
foreach ($_GET['flashvars'] as $key => $val) {
if ($this->isJson($val)) {
$val = json_decode($val, true);
}
$flashVars[$key] = $val;
}
}
//Check for playlist name
if (isset($_GET['flashvars']['playlistAPI.kpl0Name'])) {
$playlist_name = htmlspecialchars($_GET['flashvars']['playlistAPI.kpl0Name']);
}
// Get playlist name from playlist id
if (isset($_GET['flashvars']['playlistAPI.kpl0Id'])) {
$playlistId = htmlspecialchars($_GET['flashvars']['playlistAPI.kpl0Id']);
$playlist = entryPeer::retrieveByPK($playlistId);
if ($playlist) {
$playlist_name = $playlist->getName();
$playlist_description = $playlist->getDescription();
}
}
} else {
$this->partner_host = myPartnerUtils::getHost($this->partner_id);
$this->playlist_id = htmlspecialchars($this->getRequestParameter('playlist_id'));
// Get delivery types from player.ini
$map = kConf::getMap('players');
$deliveryTypes = $map['delivery_types'];
$flashVars = array();
if (isset($deliveryTypes[$this->getRequestParameter('delivery')]) && isset($deliveryTypes[$this->getRequestParameter('delivery')]['flashvars'])) {
$flashVars = $deliveryTypes[$this->getRequestParameter('delivery')]['flashvars'];
}
if ($this->playlist_id && $this->playlist_id != 'multitab_playlist') {
// build playlist url
$playlist_url = $this->partner_host . "/index.php/partnerservices2/executeplaylist?";
$playlist_url .= "partner_id=" . $this->partner_id . "&subp_id=" . $this->partner_id . "00&format=8&ks={ks}&playlist_id=" . $this->playlist_id;
$playlist_name = htmlspecialchars($this->getRequestParameter('playlist_name'));
// Add playlist flashVars
$flashVars["playlistAPI.kpl0Name"] = $playlist_name;
$flashVars["playlistAPI.kpl0Url"] = urlencode($playlist_url);
}
}
// Don't include flashvars if empty array
if (count($flashVars)) {
//.........这里部分代码省略.........
示例15: getWidgetHtml
public function getWidgetHtml($player_name = null, $ui_conf_id = null)
{
$partner = PartnerPeer::retrieveByPK($this->getPartnerId());
$templatePartnerId = $partner ? $partner->getTemplatePartnerId() : 0;
// add the version as an additional parameter
$domain = myPartnerUtils::getHost($this->getPartnerId());
// $swf_url = "/index.php/widget/{$this->getKshowId()}/-1/2/{$this->getUiConfId()}/-1";
$security_type = $this->getSecurityType();
$ui_conf = $this->getuiConf();
/*
if ( $ui_conf_id )
{
$ui_conf = uiConfPeer::retrieveByPK($ui_conf_id );
}
else
{
$ui_conf = $this->getuiConf();
}
*/
if (!$ui_conf) {
return "Cannot find ui_conf [" . $this->getUiConfId() . "]";
//throw new APIException( APIErrors::INVALID_UI_CONF_ID_FOR_WIDGET , $this->getUiConfId() , $this->getId() );
//throw new APIException( APIErrors::INVALID_UI_CONF_ID , $this->getUiConfId() ); //
}
$swf_url = "/index.php/kwidget/wid/{$this->getId()}";
if ($ui_conf) {
$swf_url .= "/uiconf_id/" . $this->getUiConfId();
}
$swf_url .= $security_type == self::WIDGET_SECURITY_TYPE_TIMEHASH ? "|timehash|" : "";
$height = $ui_conf->getHeight();
$width = $ui_conf->getWidth();
if ($height <= 0) {
$height = 340;
}
if ($width <= 0) {
$width = 400;
}
$seo_visible = "";
$seo_hidden = "";
if ($templatePartnerId) {
$player_name = 'player_' . (int) microtime(true);
} else {
if (!$partner->getIgnoreSeoLinks()) {
$seo_hidden = '<a href="http://corp.kaltura.com">video platform</a>' . '<a href="http://corp.kaltura.com/video_platform/video_management">video management</a>' . '<a href="http://corp.kaltura.com/solutions/video_solution">video solutions</a>' . '<a href="http://corp.kaltura.com/video_platform/video_publishing">video player</a>';
}
}
if ($player_name == null) {
$player_name = 'kaltura_player_' . (int) microtime(true);
}
$widget = "";
if ($this->getAddEmbedHtml5Support()) {
//following line is html5 support
$widget .= '<script type="text/javascript" src="http://' . kConf::get('www_host') . '/p/' . $this->getPartnerId() . '/sp/' . $this->getPartnerId() . '00/embedIframeJs/uiconf_id/' . $this->getUiConfId() . '/partner_id/' . $this->getPartnerId() . '"></script>';
}
$widget .= '<object name="' . $player_name . '" id="' . $player_name . '" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" height="' . $height . '" width="' . $width . '" data="' . $domain . $swf_url . '">' . '<param name="allowScriptAccess" value="always" />' . '<param name="allowNetworking" value="all" />' . '<param name="allowFullScreen" value="true" />' . '<param name="bgcolor" value="#000000" />' . '<param name="movie" value="' . $domain . $swf_url . '"/>' . '<param name="flashVars" value=""/>' . $seo_hidden . '</object>';
return $widget;
}