本文整理汇总了PHP中requestUtils::getHost方法的典型用法代码示例。如果您正苦于以下问题:PHP requestUtils::getHost方法的具体用法?PHP requestUtils::getHost怎么用?PHP requestUtils::getHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类requestUtils
的用法示例。
在下文中一共展示了requestUtils::getHost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$this->getResponse()->setHttpHeader("Content-Type", "application/x-javascript");
$kshow_id = $this->getRequestParameter('kshow_id', 0);
$uid = kuser::ANONYMOUS_PUSER_ID;
$kshow = kshowPeer::retrieveByPK($kshow_id);
if (!$kshow) {
return sfView::ERROR;
}
// kshow_id might be a string (something like "15483str") but it will be returned using retriveByPK anyways
// lets make sure we pass just the id to the contribution wizard
$kshow_id = $kshow->getId();
$partner_id = $kshow->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partner_id);
$subp_id = $kshow->getSubpId();
$partner_secret = $partner->getSecret();
$partner_name = $partner->getPartnerName();
$kaltura_services = new startsessionAction();
$kaltura_services->setInputParams(array("format" => kalturaWebserviceRenderer::RESPONSE_TYPE_PHP_ARRAY, "partner_id" => $partner_id, "subp_id" => $subp_id, "uid" => $uid, "secret" => $partner_secret));
$result = $kaltura_services->internalExecute();
$this->ks = @$result["result"]["ks"];
$this->widget_host = requestUtils::getHost();
$this->kshow_id = $kshow_id;
$this->uid = $uid;
$this->partner_id = $partner_id;
$this->subp_id = $subp_id;
$this->partner_name = $partner_name;
return sfView::SUCCESS;
}
示例2: array
/**
return array('status' => $status, 'message' => $message, 'objects' => $objects);
objects - array of
'thumb'
'title'
'description'
'id' - unique id to be passed to getMediaInfo
*/
public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
{
$status = "ok";
$message = '';
$objects = array();
@(list($searchTerm, $requestedPageSize, $numResults, $repeatOldResults) = explode(",", $searchText));
if ($requestedPageSize > 0) {
$pageSize = $requestedPageSize;
}
$already_returned = ($page - 1) * $pageSize;
$num_of_entries_to_return = min($pageSize, $numResults - $already_returned);
$i = 0;
for ($i = 0; $i < $num_of_entries_to_return; ++$i) {
$host_num = 1 + $i % 7;
$host = requestUtils::getHost();
$url = "{$host}/qa/images.php?id=";
$id = ($page - 1) * $pageSize + $i;
if ($repeatOldResults > 0) {
$id = $id % $repeatOldResults;
}
$id = 1 + $id;
// do we want it to be 0-based or 1-based ??
$playback = $i % 2 ? "none" : "";
$object = array("id" => "id-{$id}", "thumb" => $url . $id, "tags" => "tags-{$id}, {$searchTerm}", "title" => "title-{$id}", "description" => "description-{$id}", "flash_playback_type" => $playback);
$objects[] = $object;
}
return array('status' => $status, 'message' => $message, 'objects' => $objects);
}
示例3: createSelect
function createSelect($id, $name, $default_value, $list_name)
{
$prefix = "partner_";
$host = requestUtils::getHost();
// TODO - all static lists should move out of this function !!
if (strpos($host, "localhost") != false) {
$limited = false;
} else {
if (strpos($host, "kaldev") !== false) {
$limited = false;
} else {
$limited = true;
}
}
//global $arrays;
$media_type_list = array("1" => "Video", "2" => "Image", "5" => "Audio");
$media_source_list = array("20" => "Kaltura", "21" => "MyClips", "23" => "KalturaPartner", "1" => "* File", "2" => "* Webcam", "3" => "Flickr", "4" => "YouTube", "5" => "* URL", "7" => "MySpace", "8" => "PhotoBucket", "9" => "Jamendo", "10" => "CCMixter", "11" => "NYPL", "12" => "Current", "13" => "MediaCommons", "22" => "Archive.org");
if ($limited) {
$format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP");
if (strpos($host, "sandbox") !== false) {
$service_url_list = array("sandbox.kaltura.com" => "Sandbox", "www.kaltura.com" => "Kaltura");
} else {
$service_url_list = array("www.kaltura.com" => "Kaltura", "sandbox.kaltura.com" => "Sandbox");
}
$index_path_list = array("index.php" => "index");
} else {
$format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP", "4" => "PHP_ARR", "5" => "PHP_OBJ");
$service_url_list = array("localhost" => "localhost", "kaldev.kaltura.com" => "kaldev", "www.kaltura.com" => "Kaltura", "sandbox.kaltura.com" => "Sandbox");
$index_path_list = array("index.php" => "index", "kaltura_dev.php" => "debug");
}
$clazz_list = array("kshow" => "kshow", "kuser" => "kuser", "entry" => "entry", "PuserKuser" => "PuserKuser");
$moderation_object_type = array("1" => "kshow", "2" => "entry", "3" => "kuser", "" => "none");
$notification_status = array("" => "All", "1" => "Pending", "2" => "Sent", "3" => "Error", "4" => "Should Resend");
$entry_type = array("" => "All", "1" => "Clip", "2" => "Roughcut");
$entry_media_type = array("" => "All", "1" => "Video", "2" => "Image", "5" => "Audio", "6" => "Roughcut");
$boolean_type = array("" => "", "true" => "true", "false" => "false");
$boolean_int_type = array("" => "", "1" => "true", "0" => "false");
$partner_status_int_type = array("1" => "Normal", "2" => "Content Blocked", "3" => "Fully Blocked", "0" => "Deleted");
$partner_group_int_type = array("1" => "Publisher", "2" => "VAR", "3" => "Group");
$arrays = array("format_list" => $format_list, "media_type" => $media_type_list, "media_source" => $media_source_list, "service_urls" => $service_url_list, "service_urls1" => array_merge(array("" => ""), $service_url_list), "index_paths" => $index_path_list, "clazz_list" => $clazz_list, "moderation_object_type" => $moderation_object_type, "boolean_type" => $boolean_type, "boolean_int_type" => $boolean_int_type, "notification_status" => $notification_status, "partner_status_int_type" => $partner_status_int_type, "partner_group_int_type" => $partner_group_int_type, "appear_in_saerch_list" => array("0" => "Not at all", "1" => "Partner only", "2" => "Kaltura network"), "net_storage_priority" => array(StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY => 'Kaltura DCs only', StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST => 'Kaltura first', StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_FIRST => 'External storages first', StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY => 'External storages only'));
$list = $arrays[$list_name];
//echo "createSelect: list_name:[$list_name] count:[" . count ( $list ) . "]<br>";
$str = "<select id='{$prefix}{$id}' style='font-family:arial; font-size:12px;' name='{$prefix}{$name}' onkeyup='updateSelect( this )' onchange='updateSelect( this )'>";
$default_value_selected = "";
foreach ($list as $value => $option) {
// not always the default value is found
if ($value == $default_value) {
$default_value_selected = $default_value;
}
$selected = $value == $default_value ? "selected='selected'" : "";
$str .= "<option value='{$value}' {$selected} >{$option}</option>\n";
}
$str .= "</select> <span style='color:blue;' id='{$prefix}{$id}_current_value'>{$default_value_selected}</span>\n";
return $str;
}
示例4: getGenericMarkup
public static function getGenericMarkup()
{
$host = @requestUtils::getHost();
if (empty($host) || strlen($host) < 8) {
$host = "http://www.kaltura.com";
}
$base = $host . "/index.php";
$a_start = "<a href='";
$a_end = "'>";
$a_close = "</a>";
if (self::$generic_markup == null) {
self::$generic_markup = array("link-home" => $a_start . $base . $a_end . "Kaltura" . $a_close, "link-browse-kshow-start" => $a_start . $base . "/browse?kshow_id='", "link-browse-kshow-middle" => "'>", "link-browse-kshow-end" => "</a>", "link-forum" => $a_start . $base . "/forum" . $a_end . "Forum" . $a_close, "link-mykaltura" => $a_start . $base . "/mykaltura/viewprofile?screenname=<kl:screenName>" . $a_end . "<kl:screenName>" . $a_close, "link-contact" => $a_start . $base . "/static/contactus" . $a_end . "Contact Us" . $a_close, "link-block-email-url" => $base . "/mail/blockMail?e=");
}
return self::$generic_markup;
}
示例5: fromObject
public function fromObject($batchJob)
{
if ($batchJob->getJobType() != BatchJobType::BULKUPLOAD) {
throw new Exception("Bulk upload object can be initialized from bulk upload job only");
}
$this->id = $batchJob->getId();
$this->uploadedOn = $batchJob->getCreatedAt(null);
$this->status = $batchJob->getStatus();
$this->error = $batchJob->getDescription();
$this->logFileUrl = requestUtils::getHost() . "/index.php/extwidget/bulkuploadfile/id/{$batchJob->getId()}/pid/{$batchJob->getPartnerId()}/type/log";
$this->csvFileUrl = requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$batchJob->getId()}/pid/{$batchJob->getPartnerId()}/type/csv";
$jobData = $batchJob->getData();
if ($jobData instanceof kBulkUploadJobData) {
$this->uploadedBy = $jobData->getUploadedBy();
$this->uploadedByUserId = $jobData->getUserId();
$this->numOfEntries = $jobData->getNumOfEntries();
}
// $results = BulkUploadResultPeer::retrieveByBulkUploadId($this->id);
// $this->results = KalturaBulkUploadResultArray::fromBulkUploadResultArray($results);
}
示例6: executeLoginScreen
/**
* display login form
*/
protected function executeLoginScreen()
{
/**
* the google api project that we are granting access to
*/
$appId = $this->getRequestParameter('ytid');
/**
* sub id is needed when we want to authorize different google accounts for several distribution profiles
* the distribution profile can then look for its specific access token by the 'subid'
*/
$subId = $this->getRequestParameter('subid');
$appConfig = $this->getFromGoogleAuthConfig($appId);
$this->invalidConfig = null;
$this->loginError = null;
$this->serviceUrl = requestUtils::getHost();
$params = array('ytid' => $appId, 'subid' => $subId);
$this->nextUrl = $this->getController()->genUrl('extservices/googleoauth2?' . http_build_query($params, null, '&')) . '?ks=';
if ($appConfig === null) {
$this->invalidConfig = true;
}
}
示例7: execute
public function execute()
{
// Prevent the page fron being embeded in an iframe
header('X-Frame-Options: DENY');
$service_url = requestUtils::getHost();
$service_url = str_replace("http://", "", $service_url);
if (kConf::get('kmc_secured_login')) {
$service_url = 'https://' . $service_url;
if ((empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') && $_SERVER['SERVER_PORT'] != 443) {
header('Location:' . $service_url . '/' . $_SERVER['REQUEST_URI']);
die;
}
} else {
$service_url = 'http://' . $service_url;
header('Location:' . $service_url . '/' . $_SERVER['REQUEST_URI']);
die;
}
$this->service_url = $service_url;
$this->kmc_login_version = kConf::get('kmc_login_version');
$this->setPassHashKey = $this->getRequestParameter("setpasshashkey");
$this->hashKeyErrorCode = null;
$this->hashKeyLoginId = null;
if ($this->setPassHashKey) {
try {
if (!UserLoginDataPeer::isHashKeyValid($this->setPassHashKey)) {
$this->hashKeyErrorCode = kUserException::NEW_PASSWORD_HASH_KEY_INVALID;
} else {
$userLoginDataId = UserLoginDataPeer::getIdFromHashKey($this->setPassHashKey);
$userLoginData = UserLoginDataPeer::retrieveByPK($userLoginDataId);
if (!$userLoginData) {
$this->hashKeyLoginId = "";
}
$this->hashKeyLoginId = $userLoginData->getLoginEmail();
}
} catch (kCoreException $e) {
$this->hashKeyErrorCode = $e->getCode();
}
}
sfView::SUCCESS;
}
示例8: executeImpl
public function executeImpl(kshow $kshow, entry &$entry)
{
$genericWidget = "";
$myspaceWidget = "";
$kshow_id = $kshow->getId();
$entry_id = $entry->getId();
if (!$kshow->getPartnerId() && !$this->forceViewPermissions($kshow, $kshow_id, false, false)) {
die;
}
$this->kshow_category = $kshow->getTypeText();
$this->kshow_description = $kshow->getDescription();
$this->kshow_name = $kshow->getName();
$this->kshow_tags = $kshow->getTags();
$kdata = @$_REQUEST["kdata"];
if ($kdata == "null") {
$kdata = "";
}
$this->widget_type = @$_REQUEST["widget_type"];
list($genericWidget, $myspaceWidget) = myKshowUtils::getEmbedPlayerUrl($kshow_id, $entry_id, false, $kdata);
if ($entry_id == 1002) {
$this->share_url = requestUtils::getHost() . "/index.php/corp/kalturaPromo";
} else {
if ($kdata) {
$this->share_url = myKshowUtils::getWidgetCmdUrl($kdata, "share");
} else {
$this->share_url = myKshowUtils::getUrl($kshow_id) . "&entry_id={$entry_id}";
}
}
//list($status, $kmediaType, $kmediaData) = myContentRender::createPlayerMedia($entry); // myContentRender class removed, old code
$status = $entry->getStatus();
$kmediaType = $entry->getMediaType();
$kmediaData = "";
$this->message = $kmediaType == entry::ENTRY_MEDIA_TYPE_TEXT ? $kmediaData : "";
$this->generic_embed_code = $genericWidget;
$this->myspace_embed_code = $myspaceWidget;
$this->thumbnail = $entry ? $entry->getBigThumbnailPath(true) : "";
$this->kuser = $entry->getKuser();
$this->entry = $entry;
}
示例9: getThumbnailUrl
/**
* Use the thumbnailUrl of the show entry -
* TODO - cache to prevent the extra hit to DB
*/
public function getThumbnailUrl($version = NULL)
{
$show_entry = $this->getShowEntry();
if ($show_entry) {
return $show_entry->getThumbnailUrl();
} else {
$path = $this->getThumbnailPath($version);
$url = requestUtils::getHost() . $path;
return $url;
}
}
示例10: enforceCdnDelivery
public static function enforceCdnDelivery($partnerId)
{
$host = requestUtils::getHost();
$cdnHost = myPartnerUtils::getCdnHost($partnerId);
$dc = kDataCenterMgr::getCurrentDc();
$external_url = $dc["external_url"];
// allow access only via cdn or via proxy from secondary datacenter
if ($host != $cdnHost && $host != $external_url) {
$uri = $_SERVER["REQUEST_URI"];
if (strpos($uri, "/forceproxy/true") === false) {
$uri .= "/forceproxy/true/";
}
header('Location:' . $cdnHost . $uri);
header("X-Kaltura:enforce-cdn");
die;
}
}
示例11: getContentPath
private static function getContentPath()
{
return requestUtils::getHost();
}
示例12: execute
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;
}
示例13: execute
//.........这里部分代码省略.........
if ($entry->getStatus() == entryStatus::DELETED && $entry->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK) {
KalturaLog::log("rejected live stream entry - not serving thumbnail");
KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
}
$contentPath = myContentStorage::getFSContentRootPath();
$msgPath = $contentPath . "content/templates/entry/thumbnail/live_thumb.jpg";
$tempThumbPath = myEntryUtils::resizeEntryImage($entry, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $msgPath);
} elseif ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_SHOW) {
$contentPath = myContentStorage::getFSContentRootPath();
$msgPath = $contentPath . "content/templates/entry/thumbnail/auto_edit.jpg";
$tempThumbPath = myEntryUtils::resizeEntryImage($entry, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $msgPath);
//kFile::dumpFile($tempThumbPath, null, 0);
} elseif ($entry->getType() == entryType::MEDIA_CLIP) {
// commenting out the new behavior, in this case the thumbnail will be created in resizeEntryImage
//$contentPath = myContentStorage::getFSContentRootPath();
//$msgPath = $contentPath."content/templates/entry/thumbnail/broken_thumb.jpg";
//header("Xkaltura-app: entry [$entry_id] in conversion, returning template broken thumb");
//KalturaLog::log( "Entry in conversion, no thumbnail yet [$entry_id], created dynamic 1x1 jpg");
//kFile::dumpFile($msgPath, null, 0);
try {
$tempThumbPath = myEntryUtils::resizeEntryImage($entry, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices);
} catch (Exception $ex) {
if ($ex->getCode() == kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC) {
// get original flavor asset
$origFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entry_id);
if ($origFlavorAsset) {
$syncKey = $origFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$remoteFileSync = kFileSyncUtils::getOriginFileSyncForKey($syncKey, false);
if (!$remoteFileSync) {
// file does not exist on any DC - die
KalturaLog::log("Error - no FileSync for entry [{$entry_id}]");
KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
}
if ($remoteFileSync->getDc() == kDataCenterMgr::getCurrentDcId()) {
KalturaLog::log("ERROR - Trying to redirect to myself - stop here.");
KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
}
$remote_url = kDataCenterMgr::getRedirectExternalUrl($remoteFileSync, $_SERVER['REQUEST_URI']);
KalturaLog::log(__METHOD__ . ": redirecting to [{$remote_url}]");
$this->redirect($remote_url);
}
}
}
} else {
// file does not exist on any DC - die
KalturaLog::log("Error - no FileSync for entry [{$entry_id}]");
KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
}
}
if (!$local && !$tempThumbPath) {
$remote_url = kDataCenterMgr::getRedirectExternalUrl($file_sync, $_SERVER['REQUEST_URI']);
KalturaLog::log(__METHOD__ . ": redirecting to [{$remote_url}]");
$this->redirect($remote_url);
}
// if we didnt return a template for the player die and dont return the original deleted thumb
if ($entry_status == entryStatus::DELETED) {
KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
}
if (!$tempThumbPath) {
try {
$tempThumbPath = myEntryUtils::resizeEntryImage($entry, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices);
} catch (Exception $ex) {
if ($ex->getCode() == kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC) {
// get original flavor asset
$origFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entry_id);
if ($origFlavorAsset) {
$syncKey = $origFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$remoteFileSync = kFileSyncUtils::getOriginFileSyncForKey($syncKey, false);
if (!$remoteFileSync) {
// file does not exist on any DC - die
KalturaLog::log("Error - no FileSync for entry [{$entry_id}]");
KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
}
if ($remoteFileSync->getDc() == kDataCenterMgr::getCurrentDcId()) {
KalturaLog::log("ERROR - Trying to redirect to myself - stop here.");
KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
}
$remote_url = kDataCenterMgr::getRedirectExternalUrl($remoteFileSync, $_SERVER['REQUEST_URI']);
KalturaLog::log(__METHOD__ . ": redirecting to [{$remote_url}]");
$this->redirect($remote_url);
}
}
}
}
$nocache = strpos($tempThumbPath, "_NOCACHE_") !== false;
// notify external proxy, so it'll cache this url
if (!$nocache && requestUtils::getHost() == kConf::get("apphome_url") && file_exists($tempThumbPath)) {
self::notifyProxy($_SERVER["REQUEST_URI"]);
}
// cache result
if (!$nocache) {
$requestKey = $_SERVER["REQUEST_URI"];
$cache = new myCache("thumb", 86400 * 30);
// 30 days
$cache->put($requestKey, $tempThumbPath);
}
kFile::dumpFile($tempThumbPath, null, $nocache ? 0 : null);
// TODO - can delete from disk assuming we caneasily recreate it and it will anyway be cached in the CDN
// however dumpfile dies at the end so we cant just write it here (maybe register a shutdown callback)
}
示例14: fromObject
public function fromObject($sourceObject)
{
if (!$sourceObject) {
return;
}
parent::fromObject($sourceObject);
$host = requestUtils::getHost();
$this->executeUrl = myPlaylistUtils::toPlaylistUrl($sourceObject, $host);
if ($this->playlistType == KalturaPlaylistType::DYNAMIC) {
$this->playlistContentXmlToFilters();
}
}
示例15: serveHDNetwork
/**
* @return kManifestRenderer
*/
private function serveHDNetwork()
{
$duration = $this->entry->getDurationInt();
$mediaUrl = requestUtils::getHost() . str_replace("f4m", "smil", str_replace("hdnetwork", "hdnetworksmil", $_SERVER["REQUEST_URI"]));
$renderer = new kF4MManifestRenderer();
$renderer->entryId = $this->entryId;
$renderer->duration = $duration;
$renderer->mediaUrl = $mediaUrl;
return $renderer;
}