本文整理汇总了PHP中KExternalErrors类的典型用法代码示例。如果您正苦于以下问题:PHP KExternalErrors类的具体用法?PHP KExternalErrors怎么用?PHP KExternalErrors使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KExternalErrors类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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}");
}
开发者ID:DBezemer,项目名称:server,代码行数:34,代码来源:kuploadAction.class.php
示例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
}
开发者ID:DBezemer,项目名称:server,代码行数:29,代码来源:logoutAction.class.php
示例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;
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:28,代码来源:ksrAction.class.php
示例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);
}
开发者ID:DBezemer,项目名称:server,代码行数:33,代码来源:LiveEntry.php
示例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;
}
开发者ID:DBezemer,项目名称:server,代码行数:10,代码来源:DeliveryProfileRtmp.php
示例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();
}
开发者ID:DBezemer,项目名称:server,代码行数:57,代码来源:serveMultiFileAction.class.php
示例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;
}
开发者ID:kubrickfr,项目名称:server,代码行数:11,代码来源:DeliveryProfileRtmp.php
示例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;
}
开发者ID:DBezemer,项目名称:server,代码行数:51,代码来源:kmcAction.class.php
示例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;
}
开发者ID:kubrickfr,项目名称:server,代码行数:19,代码来源:kKsUrlTokenizer.php
示例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');
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:42,代码来源:previewAction.class.php
示例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;
}
开发者ID:DBezemer,项目名称:server,代码行数:23,代码来源:servefileAction.class.php
示例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;
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:21,代码来源:streamclipperAction.class.php
示例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;
}
开发者ID:DBezemer,项目名称:server,代码行数:39,代码来源:defPartnerservices2baseAction.class.php
示例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);
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:26,代码来源:embedIframeJsAction.class.php
示例16: 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);
}
开发者ID:richhl,项目名称:kalturaCE,代码行数:23,代码来源:previewAction.class.php
示例17: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
requestUtils::handleConditionalGet();
ignore_user_abort();
$entry_id = $this->getRequestParameter("entry_id");
$widget_id = $this->getRequestParameter("widget_id", 0);
$upload_token_id = $this->getRequestParameter("upload_token_id");
$version = $this->getIntRequestParameter("version", null, 0, 10000000);
$type = $this->getIntRequestParameter("type", 1, 1, 5);
//Hack: if KMS sends thumbnail request containing "!" char, the type should be treated as 5.
$width = $this->getRequestParameter("width", -1);
$height = $this->getRequestParameter("height", -1);
if (strpos($width, "!") || strpos($height, "!")) {
$type = 5;
}
$width = $this->getFloatRequestParameter("width", -1, -1, 10000);
$height = $this->getFloatRequestParameter("height", -1, -1, 10000);
$crop_provider = $this->getRequestParameter("crop_provider", null);
$quality = $this->getIntRequestParameter("quality", 0, 0, 100);
$src_x = $this->getFloatRequestParameter("src_x", 0, 0, 10000);
$src_y = $this->getFloatRequestParameter("src_y", 0, 0, 10000);
$src_w = $this->getFloatRequestParameter("src_w", 0, 0, 10000);
$src_h = $this->getFloatRequestParameter("src_h", 0, 0, 10000);
$vid_sec = $this->getFloatRequestParameter("vid_sec", -1, -1);
$vid_slice = $this->getRequestParameter("vid_slice", -1);
$vid_slices = $this->getRequestParameter("vid_slices", -1);
$density = $this->getFloatRequestParameter("density", 0, 0);
$stripProfiles = $this->getRequestParameter("strip", null);
$flavor_id = $this->getRequestParameter("flavor_id", null);
$file_name = $this->getRequestParameter("file_name", null);
$file_name = basename($file_name);
// actual width and height of image from which the src_* values were taken.
// these will be used to multiply the src_* parameters to make them relate to the original image size.
$rel_width = $this->getFloatRequestParameter("rel_width", -1, -1, 10000);
$rel_height = $this->getFloatRequestParameter("rel_height", -1, -1, 10000);
if ($width == -1 && $height == -1) {
$width = 120;
$height = 90;
} else {
if ($width == -1) {
// if only either width or height is missing reset them to zero, and convertImage will handle them
$width = 0;
} else {
if ($height == -1) {
$height = 0;
}
}
}
$bgcolor = $this->getRequestParameter("bgcolor", "ffffff");
$partner = null;
// validating the inputs
if (!is_numeric($quality) || $quality < 0 || $quality > 100) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'quality must be between 20 and 100');
}
if (!is_numeric($src_x) || $src_x < 0 || $src_x > 10000) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'src_x must be between 0 and 10000');
}
if (!is_numeric($src_y) || $src_y < 0 || $src_y > 10000) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'src_y must be between 0 and 10000');
}
if (!is_numeric($src_w) || $src_w < 0 || $src_w > 10000) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'src_w must be between 0 and 10000');
}
if (!is_numeric($src_h) || $src_h < 0 || $src_h > 10000) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'src_h must be between 0 and 10000');
}
if (!is_numeric($width) || $width < 0 || $width > 10000) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'width must be between 0 and 10000');
}
if (!is_numeric($height) || $height < 0 || $height > 10000) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'height must be between 0 and 10000');
}
if (!is_numeric($density) || $density < 0) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'density must be positive');
}
if (!is_numeric($vid_sec) || $vid_sec < -1) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'vid_sec must be positive');
}
if (!preg_match('/^[0-9a-fA-F]{1,6}$/', $bgcolor)) {
KExternalErrors::dieError(KExternalErrors::BAD_QUERY, 'bgcolor must be six hexadecimal characters');
}
if ($upload_token_id) {
$upload_token = UploadTokenPeer::retrieveByPK($upload_token_id);
if ($upload_token) {
$partnerId = $upload_token->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if ($density == 0) {
$density = $partner->getDefThumbDensity();
}
if (is_null($stripProfiles)) {
$stripProfiles = $partner->getStripThumbProfile();
}
$thumb_full_path = myContentStorage::getFSCacheRootPath() . myContentStorage::getGeneralEntityPath("uploadtokenthumb", $upload_token->getIntId(), $upload_token->getId(), $upload_token->getId() . ".jpg");
kFile::fullMkdir($thumb_full_path);
if (file_exists($upload_token->getUploadTempPath())) {
$src_full_path = $upload_token->getUploadTempPath();
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:thumbnailAction.class.php
示例18: execute
public function execute()
{
// Disable layout
$this->setLayout(false);
$this->success = false;
$this->type = $this->getRequestParameter('type');
if (!$this->type) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'type');
}
$validTypes = array('name', 'email', 'password');
if (!in_array($this->type, $validTypes)) {
KExternalErrors::dieError(KExternalErrors::INVALID_SETTING_TYPE);
}
$ks = $this->getP("kmcks");
if (!$ks) {
KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'ks');
}
// Get partner & user info from KS
$ksObj = kSessionUtils::crackKs($ks);
$partnerId = $ksObj->partner_id;
$userId = $ksObj->user;
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
KExternalErrors::dieError(KExternalErrors::PARTNER_NOT_FOUND);
}
if (!$partner->validateApiAccessControl()) {
KExternalErrors::dieError(KExternalErrors::SERVICE_ACCESS_CONTROL_RESTRICTED);
}
$this->forceKMCHttps = PermissionPeer::isValidForPartner(PermissionName::FEATURE_KMC_ENFORCE_HTTPS, $partnerId);
if ($this->forceKMCHttps) {
// Prevent the page fron being embeded in an iframe
header('X-Frame-Options: SAMEORIGIN');
}
if ($this->forceKMCHttps && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) {
die;
}
// Load the current user
$dbUser = kuserPeer::getKuserByPartnerAndUid($partnerId, $userId);
if (!$dbUser) {
KExternalErrors::dieError('INVALID_USER_ID', $userId);
}
$this->email = $dbUser->getEmail();
$this->fname = $dbUser->getFirstName();
$this->lname = $dbUser->getLastName();
$this->parent_url = $this->clean($_GET['parent']);
// Set page title
switch ($this->type) {
case 'password':
$this->pageTitle = 'Change Password';
break;
case 'email':
$this->pageTitle = 'Change Email Address';
break;
case 'name':
$this->pageTitle = 'Change Username';
break;
}
// select which action to do
if (isset($_POST['do'])) {
switch ($_POST['do']) {
case "password":
$this->changePassword();
break;
case "email":
$this->changeEmail();
break;
case "name":
$this->changeName();
break;
}
}
sfView::SUCCESS;
}
开发者ID:DBezemer,项目名称:server,代码行数:73,代码来源:updateLoginDataAction.class.php
示例19: enforceDelivery
/**
* Ensure the request for media arrived in a way approved by the partner.
* this may include restricting to a specific cdn, enforcing token usage etc..
* Die in case of a breach.
*
* @param entry $entry
* @param asset $asset
*/
public static function enforceDelivery($entry, $asset = null)
{
// block inactive partner
$partnerId = $entry->getPartnerId();
self::blockInactivePartner($partnerId);
// validate serve access control
$flavorParamsId = $asset ? $asset->getFlavorParamsId() : null;
$secureEntryHelper = new KSecureEntryHelper($entry, null, null, ContextType::SERVE);
$secureEntryHelper->validateForServe($flavorParamsId);
// enforce delivery
$partner = PartnerPeer::retrieveByPK($partnerId);
// Note: Partner was already loaded by blockInactivePartner, no need to check for null
$restricted = DeliveryProfilePeer::isRequestRestricted($partner);
if ($restricted) {
KalturaLog::log("DELIVERY_METHOD_NOT_ALLOWED partner [{$partnerId}]");
KExternalErrors::dieError(KExternalErrors::DELIVERY_METHOD_NOT_ALLOWED);
}
}
开发者ID:dozernz,项目名称:server,代码行数:26,代码来源:myPartnerUtils.class.php
示例20: 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:
|
请发表评论