本文整理汇总了PHP中KExternalErrors类的典型用法代码示例。如果您正苦于以下问题:PHP KExternalErrors类的具体用法?PHP KExternalErrors怎么用?PHP KExternalErrors使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KExternalErrors类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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}");
}
示例2: execute
public function execute()
{
$ksStr = $this->getP("ks");
if ($ksStr) {
$ksObj = null;
try {
$ksObj = ks::fromSecureString($ksStr);
} catch (Exception $e) {
}
if ($ksObj) {
$partner = PartnerPeer::retrieveByPK($ksObj->partner_id);
if (!$partner) {
KExternalErrors::dieError(KExternalErrors::PARTNER_NOT_FOUND);
}
if (!$partner->validateApiAccessControl()) {
KExternalErrors::dieError(KExternalErrors::SERVICE_ACCESS_CONTROL_RESTRICTED);
}
$ksObj->kill();
}
KalturaLog::info("Killing session with ks - [{$ksStr}], decoded - [" . base64_decode($ksStr) . "]");
} else {
KalturaLog::err('logoutAction called with no KS');
}
setcookie('pid', "", 0, "/");
setcookie('subpid', "", 0, "/");
setcookie('kmcks', "", 0, "/");
return sfView::NONE;
//redirection to kmc/kmc is done from java script
}
示例3: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
// make sure output is not parsed as HTML
header("Content-type: application/x-javascript");
$uiconfId = $this->getRequestParameter("uiconfId");
// replace all $_GET with $this->getRequestParameter()
// load uiconf from DB.
$this->uiconfObj = uiConfPeer::retrieveByPK($uiconfId);
if (!$this->uiconfObj) {
KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND);
}
@libxml_use_internal_errors(true);
$this->uiconfXmlObj = new SimpleXMLElement($this->uiconfObj->getConfFile());
if (!$this->uiconfXmlObj instanceof SimpleXMLElement) {
// no xml or invalid XML, so throw exception
throw new Exception('uiconf XML is invalid');
}
// unsupress the xml errors
@libxml_use_internal_errors(false);
$this->_initReplacementTokens();
$this->_prepareLibJs();
$this->_prepareJs();
echo $this->jsResult;
die;
}
示例4: getLocalThumbFilePath
public function getLocalThumbFilePath($version, $width, $height, $type, $bgcolor = "ffffff", $crop_provider = null, $quality = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $vid_sec = -1, $vid_slice = 0, $vid_slices = -1, $density = 0, $stripProfiles = false, $flavorId = null, $fileName = null)
{
if ($this->getStatus() == entryStatus::DELETED || $this->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK) {
KalturaLog::log("rejected live stream entry - not serving thumbnail");
KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
}
$contentPath = myContentStorage::getFSContentRootPath();
$liveEntryExist = false;
$liveThumbEntry = null;
$liveThumbEntryId = null;
$partner = $this->getPartner();
if ($partner) {
$liveThumbEntryId = $partner->getLiveThumbEntryId();
}
if ($liveThumbEntryId) {
$liveThumbEntry = entryPeer::retrieveByPK($liveThumbEntryId);
}
if ($liveThumbEntry && $liveThumbEntry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
$fileSyncVersion = $partner->getLiveThumbEntryVersion();
$liveEntryKey = $liveThumbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $fileSyncVersion);
$contentPath = kFileSyncUtils::getLocalFilePathForKey($liveEntryKey);
if ($contentPath) {
$msgPath = $contentPath;
$liveEntryExist = true;
} else {
KalturaLog::err('no local file sync for audio entry id');
}
}
if (!$liveEntryExist) {
$msgPath = $contentPath . "content/templates/entry/thumbnail/live_thumb.jpg";
}
return myEntryUtils::resizeEntryImage($this, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $msgPath, $density, $stripProfiles);
}
示例5: buildServeFlavors
public function buildServeFlavors()
{
$baseUrl = null;
$flavors = $this->buildRtmpFlavorsArray($baseUrl);
if (!count($flavors)) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
$this->baseUrl = $baseUrl;
return $flavors;
}
示例6: execute
/**
* Serves multiple files for synchronization between datacenters
*/
public function execute()
{
$fileSyncIds = $this->getRequestParameter("ids");
$hash = $this->getRequestParameter("hash");
// validate hash
$currentDc = kDataCenterMgr::getCurrentDc();
$currentDcId = $currentDc["id"];
$expectedHash = md5($currentDc["secret"] . $fileSyncIds);
if ($hash !== $expectedHash) {
$error = "Invalid hash - ids [{$fileSyncIds}] got [{$hash}] expected [{$expectedHash}]";
KalturaLog::err($error);
KExternalErrors::dieError(KExternalErrors::INVALID_TOKEN);
}
// load file syncs
$fileSyncs = FileSyncPeer::retrieveByPks(explode(',', $fileSyncIds));
if ($fileSyncs) {
KalturaMonitorClient::initApiMonitor(false, 'extwidget.serveMultiFile', $fileSyncs[0]->getPartnerId());
}
// resolve file syncs
$filePaths = array();
foreach ($fileSyncs as $fileSync) {
if ($fileSync->getDc() != $currentDcId) {
$error = "FileSync id [" . $fileSync->getId() . "] does not belong to this DC";
KalturaLog::err($error);
KExternalErrors::dieError(KExternalErrors::BAD_QUERY);
}
// resolve if file_sync is link
$fileSyncResolved = kFileSyncUtils::resolve($fileSync);
// check if file sync path leads to a file or a directory
$resolvedPath = $fileSyncResolved->getFullPath();
if (is_dir($resolvedPath)) {
$error = "FileSync id [" . $fileSync->getId() . "] is a directory";
KalturaLog::err($error);
KExternalErrors::dieError(KExternalErrors::BAD_QUERY);
}
if (!file_exists($resolvedPath)) {
$error = "Path [{$resolvedPath}] for fileSync id [" . $fileSync->getId() . "] does not exist";
KalturaLog::err($error);
continue;
}
$filePaths[$fileSync->getId()] = $resolvedPath;
}
$boundary = md5(uniqid('', true));
header('Content-Type: multipart/form-data; boundary=' . $boundary);
foreach ($filePaths as $id => $filePath) {
echo "--{$boundary}\n";
echo "Content-Type: application/octet-stream\n";
echo "Content-Disposition: form-data; name=\"{$id}\"\n\n";
readfile($filePath);
echo "\n";
}
echo "--{$boundary}--\n";
KExternalErrors::dieGracefully();
}
示例7: serve
public function serve()
{
$baseUrl = null;
$flavors = $this->buildRtmpFlavorsArray($baseUrl);
if (!count($flavors)) {
KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
}
$renderer = $this->getRenderer($flavors);
$renderer->baseUrl = $baseUrl;
return $renderer;
}
示例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);
$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
示例9: execute
public function execute()
{
// Prevent the page fron being embeded in an iframe
header('X-Frame-Options: DENY');
// Check if user already logged in and redirect to kmc2
if ($this->getRequest()->getCookie('kmcks')) {
$this->redirect('kmc/kmc2');
}
if (infraRequestUtils::getProtocol() != infraRequestUtils::PROTOCOL_HTTPS && kConf::get('kmc_secured_login')) {
$url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
header('Location:' . $url);
die;
}
$this->www_host = kConf::get('www_host');
$https_enabled = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? true : false;
$this->securedLogin = kConf::get('kmc_secured_login') || $https_enabled ? true : false;
$swfUrl = $this->securedLogin ? 'https://' : 'http://';
$swfUrl .= $this->www_host . myContentStorage::getFSFlashRootPath();
$swfUrl .= '/kmc/login/' . kConf::get('kmc_login_version') . '/login.swf';
$this->swfUrl = $swfUrl;
$this->partner_id = $this->getRequestParameter("partner_id");
$this->logoUrl = null;
if ($this->partner_id) {
$partner = PartnerPeer::retrieveByPK($this->partner_id);
if ($partner) {
$this->logoUrl = kmcUtils::getWhitelabelData($partner, 'logo_url');
}
}
$this->beta = $this->getRequestParameter("beta");
//prevent script injections - allow only base64_encode chars , which is used when creating A new hash key
$passHashparam = $this->getRequestParameter("setpasshashkey");
if ($passHashparam && !preg_match(self::BASE64_ENCODE_CHARS_REGEX, $passHashparam)) {
KExternalErrors::dieError(KExternalErrors::INVALID_HASH);
}
$this->setPassHashKey = $passHashparam;
$this->hashKeyErrorCode = null;
$this->displayErrorFromServer = false;
if ($this->setPassHashKey) {
try {
$loginData = UserLoginDataPeer::isHashKeyValid($this->setPassHashKey);
$partnerId = $loginData->getConfigPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if ($partner && $partner->getPasswordStructureValidations()) {
$this->displayErrorFromServer = true;
}
} catch (kCoreException $e) {
$this->hashKeyErrorCode = $e->getCode();
}
}
sfView::SUCCESS;
}
示例10: tokenizeSingleUrl
/**
* @param string $url
* @param string $urlPrefix
* @return string
*/
public function tokenizeSingleUrl($url, $urlPrefix = null)
{
if (!$this->ksObject || !$this->ksObject->user) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'ks user');
}
$uriRestrict = explode(',', $url);
// cannot contain commas, since it's used as the privileges delimiter
$uriRestrict = $uriRestrict[0];
$privileges = kSessionBase::PRIVILEGE_DISABLE_ENTITLEMENT_FOR_ENTRY . ':' . $this->entryId;
$privileges .= ',' . kSessionBase::PRIVILEGE_VIEW . ':' . $this->entryId;
$privileges .= ',' . kSessionBase::PRIVILEGE_URI_RESTRICTION . ':' . $uriRestrict . '*';
$ks = kSessionBase::generateKsV2($this->key, $this->ksObject->user, kSessionBase::SESSION_TYPE_USER, $this->partnerId, $this->window, $privileges, null, null);
return $url . '?ks=' . $ks;
}
示例11: 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');
}
示例12: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
requestUtils::handleConditionalGet();
$file_sync_id = $this->getRequestParameter("id");
$hash = $this->getRequestParameter("hash");
$file_name = $this->getRequestParameter("fileName");
if ($file_name) {
$file_name = base64_decode($file_name);
}
$file_sync = FileSyncPeer::retrieveByPk($file_sync_id);
if (!$file_sync) {
$current_dc_id = kDataCenterMgr::getCurrentDcId();
$error = "DC[{$current_dc_id}]: Cannot find FileSync with id [{$file_sync_id}]";
KalturaLog::err($error);
KExternalErrors::dieError(KExternalErrors::FILE_NOT_FOUND);
}
KalturaMonitorClient::initApiMonitor(false, 'extwidget.serveFile', $file_sync->getPartnerId());
kDataCenterMgr::serveFileToRemoteDataCenter($file_sync, $hash, $file_name);
die;
}
示例13: execute
public function execute()
{
$entry_id = $this->getRequestParameter("entryId");
// workaround the filter which hides all the deleted entries -
// now that deleted entries are part of xmls (they simply point to the 'deleted' templates), we should allow them here
$entry = entryPeer::retrieveByPKNoFilter($entry_id);
if (!$entry) {
KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
}
if ($entry->getType() != entryType::LIVE_STREAM || $entry->getStatus() == entryStatus::DELETED) {
// because the fiter was turned off - a manual check for deleted entries must be done.
die;
}
$file = $entry->getStreamName();
$streamer = $entry->getStreamUrl();
$this->logMessage("streamclipper: serving entry [{$entry_id}] file[{$file}] streamer[{$streamer}]", "warning");
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<config>\n\t<file>{$file}</file>\n\t<subscribe>true</subscribe>\n\t<streamer>{$streamer}</streamer>\n\t<type>fcsubscribe</type>\n</config>";
header("Content-Type: text/xml; charset=UTF-8");
echo $xml;
die;
}
示例14: execute
public function execute()
{
// can't read using $_REQUEST because the 'myaction' paramter is created in a routing.yml rule
$service_name = $this->getRequestParameter("myaction");
// remove all '_' and set to lowercase
$myaction_name = trim(strtolower(str_replace("_", "", $service_name)));
$clazz_name = $myaction_name . "Action";
// echo "[$myaction_name] [$clazz_name]<br>";
// $clazz = get_class ( $clazz_name );
//$multi_request = $this->getRequestParameter( "multirequest" , null );
$multi_request = $myaction_name == "multirequest";
if ($multi_request) {
$multi_request = new myMultiRequest($_REQUEST, $this);
$response = $multi_request->execute();
} else {
$include_result = @(include_once "{$clazz_name}.class.php");
if ($include_result) {
$myaction = new $clazz_name($this);
$myaction->setInputParams($_REQUEST);
$response = $myaction->execute();
kEventsManager::flushEvents();
} else {
$format = $this->getP("format");
$response = "Error: Invalid service [{$service_name}]";
}
}
$format = $this->getP("format");
if ($format == kalturaWebserviceRenderer::RESPONSE_TYPE_PHP_ARRAY || $format == kalturaWebserviceRenderer::RESPONSE_TYPE_PHP_OBJECT) {
//$this->setHttpHeader ( "Content-Type" , "text/html; charset=utf-8" );
$response = "<pre>" . print_r($response, true) . "</pre>";
}
// uncomment in order to cache api responses
if (kConf::get('enable_cache')) {
$this->cacheResponse($response);
}
$ret = $this->renderText($response);
KExternalErrors::terminateDispatch();
return $ret;
}
示例15: 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);
}