本文整理汇总了PHP中myPartnerUtils类的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils类的具体用法?PHP myPartnerUtils怎么用?PHP myPartnerUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了myPartnerUtils类的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: initService
public function initService($serviceId, $serviceName, $actionName)
{
parent::initService($serviceId, $serviceName, $actionName);
myPartnerUtils::addPartnerToCriteria(new UserRolePeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
myPartnerUtils::addPartnerToCriteria(new PermissionPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
myPartnerUtils::addPartnerToCriteria(new PermissionItemPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup());
}
示例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) {
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}");
}
示例4: execute
public function execute()
{
$this->forceSystemAuthentication();
$partner_id = $this->getRequestParameter('partner_id', -1);
if ($partner_id >= 0) {
myPartnerUtils::applyPartnerFilters($partner_id);
}
$this->partner_id = $partner_id;
$order = $this->getRequestParameter('sort', kuser::KUSER_SORT_MOST_VIEWED);
$page = $this->getRequestParameter('page', 1);
$pager = kuserPeer::getAllUsersOrderedPager($order, 10, $page);
$kuser_list = $pager->getResults();
dashboardUtils::updateKusersRoughcutCount($kuser_list);
$kusersData = array();
foreach ($kuser_list as $kuser) {
$kusersData[] = $this->createkuserData($kuser, $order);
}
// following variables will be used by the view
$this->firstTime = $this->getRequestParameter('first', 1) == 1;
$this->order = $order;
$this->page = $page;
$this->lastPage = $pager->getLastPage();
$this->numResults = $pager->getNbResults();
$this->kusersData = $kusersData;
// allow the action buttons to show only for entires the user on their own pages
$this->allowactions = true;
}
示例5: getFlavorAssetUrl
/**
* @param flavorAsset $flavorAsset
* @return string
*/
public function getFlavorAssetUrl(flavorAsset $flavorAsset)
{
$entry = $flavorAsset->getentry();
$partnerId = $entry->getPartnerId();
$subpId = $entry->getSubpId();
$flavorAssetId = $flavorAsset->getId();
$partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subpId);
$this->setFileExtension($flavorAsset->getFileExt());
$url = "/s{$partnerPath}/serveFlavor/flavorId/{$flavorAssetId}";
if ($this->clipTo) {
$url .= "/clipTo/{$this->clipTo}";
}
if ($this->extention) {
$url .= "/name/{$flavorAssetId}.{$this->extention}";
}
$url = str_replace('\\', '/', $url);
if ($this->protocol != StorageProfile::PLAY_FORMAT_RTMP) {
$url .= '?novar=0';
$url .= '&e=' . (time() + 120);
$secret = $this->getMediaVault();
$fullUrl = $this->protocol . '://' . $this->domain . $url;
$url .= '&h=' . md5($secret . $fullUrl);
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$seekFromBytes = $this->getSeekFromBytes(kFileSyncUtils::getLocalFilePathForKey($syncKey));
if ($seekFromBytes) {
$url .= '&fs=' . $seekFromBytes;
}
} else {
$url .= '/forceproxy/true';
}
return $url;
}
示例6: 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}");
}
示例7: purgeAssetFromEdgeCast
private static function purgeAssetFromEdgeCast(asset $asset)
{
// get partner
$partnerId = $asset->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partnerId);
if (!$partner) {
KalturaLog::err('Cannot find partner with id [' . $partnerId . ']');
return false;
}
$mediaType = $asset instanceof thumbAsset ? self::EDGE_SERVICE_HTTP_SMALL_OBJECT_MEDIA_TYPE : self::EDGE_SERVICE_HTTP_LARGE_OBJECT_MEDIA_TYPE;
$mediaTypePathList = array();
try {
$mediaTypePathList[] = array('MediaType' => $mediaType, 'MediaPath' => $asset->getDownloadUrl());
// asset download url
} catch (Exception $e) {
KalturaLog::err('Cannot get asset URL for asset id [' . $asset->getId() . '] - ' . $e->getMessage());
}
if ($asset instanceof flavorAsset) {
// get a list of all URLs leading to the asset for purging
$subPartnerId = $asset->getentry()->getSubpId();
$partnerPath = myPartnerUtils::getUrlForPartner($partnerId, $subPartnerId);
$assetId = $asset->getId();
$serveFlavorUrl = "{$partnerPath}/serveFlavor/entryId/" . $asset->getEntryId() . "/flavorId/{$assetId}" . '*';
// * wildcard should delete all serveFlavor urls
$hosts = array($partner->getCdnHost(), $partner->getRtmpUrl(), $partner->getIisHost());
foreach ($hosts as $host) {
if (!empty($host)) {
$mediaTypePathList[] = array('MediaType' => $mediaType, 'MediaPath' => $host . $serveFlavorUrl);
}
}
}
return self::purgeFromEdgeCast($mediaTypePathList, $partner);
}
示例8: copyEventNotificationTemplates
/**
* @param Partner $fromPartner
* @param Partner $toPartner
*/
protected function copyEventNotificationTemplates(Partner $fromPartner, Partner $toPartner, $permissionRequiredOnly = false)
{
$fromPartnerId = $fromPartner->getId();
$toPartnerId = $toPartner->getId();
KalturaLog::debug("Copy event-notification templates from [{$fromPartnerId}] to [{$toPartnerId}]");
$c = new Criteria();
$c->add(EventNotificationTemplatePeer::PARTNER_ID, $fromPartnerId);
$systemNameCriteria = new Criteria();
$systemNameCriteria->add(EventNotificationTemplatePeer::PARTNER_ID, $toPartnerId);
$systemNameCriteria->add(EventNotificationTemplatePeer::STATUS, EventNotificationTemplateStatus::ACTIVE);
$eventNotificationTemplates = EventNotificationTemplatePeer::doSelect($c);
foreach ($eventNotificationTemplates as $eventNotificationTemplate) {
/* @var $eventNotificationTemplate EventNotificationTemplate */
if ($permissionRequiredOnly && !count($eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
continue;
}
if (!myPartnerUtils::isPartnerPermittedForCopy($toPartner, $eventNotificationTemplate->getRequiredCopyTemplatePermissions())) {
continue;
}
if ($eventNotificationTemplate->getSystemName()) {
$c = clone $systemNameCriteria;
$c->add(EventNotificationTemplatePeer::SYSTEM_NAME, $eventNotificationTemplate->getSystemName());
if (EventNotificationTemplatePeer::doCount($c)) {
continue;
}
}
$newEventNotificationTemplate = $eventNotificationTemplate->copy();
$newEventNotificationTemplate->setPartnerId($toPartnerId);
$newEventNotificationTemplate->save();
}
}
示例9: getClientNotificationAction
/**
* Return the notifications for a specific entry id and type
*
* @action getClientNotification
* @param string $entryId
* @param KalturaNotificationType $type
* @return KalturaClientNotification
*/
function getClientNotificationAction($entryId, $type)
{
// in case of a multirequest, a mediaService.addFromUploadedFile may fail and therefore the resulting entry id will be empty
// in such a case return immidiately without looking for the notification
if ($entryId == '') {
throw new KalturaAPIException(KalturaErrors::NOTIFICATION_FOR_ENTRY_NOT_FOUND, $entryId);
}
$notifications = BatchJobPeer::retrieveByEntryIdAndType($entryId, BatchJobType::NOTIFICATION, $type);
// FIXME: throw error if not found
if (count($notifications) == 0) {
throw new KalturaAPIException(KalturaErrors::NOTIFICATION_FOR_ENTRY_NOT_FOUND, $entryId);
}
$notification = $notifications[0];
$partnerId = $this->getPartnerId();
$nofication_config_str = null;
list($nofity, $nofication_config_str) = myPartnerUtils::shouldNotify($partnerId);
if (!$nofity) {
return new KalturaClientNotification();
}
$nofication_config = myNotificationsConfig::getInstance($nofication_config_str);
$nofity_send_type = $nofication_config->shouldNotify($type);
if ($nofity_send_type != myNotificationMgr::NOTIFICATION_MGR_SEND_SYNCH && $nofity_send_type != myNotificationMgr::NOTIFICATION_MGR_SEND_BOTH) {
return new KalturaClientNotification();
}
$partner = PartnerPeer::retrieveByPK($partnerId);
list($url, $signatureKey) = myNotificationMgr::getPartnerNotificationInfo($partner);
list($params, $rawSignature) = myNotificationMgr::prepareNotificationData($url, $signatureKey, $notification, null);
$serializedParams = http_build_query($params, "", "&");
$result = new KalturaClientNotification();
$result->url = $url;
$result->data = $serializedParams;
return $result;
}
示例10: impersonateAction
/**
* Start an impersonated session with Kaltura's server.
* The result KS is the session key that you should pass to all services that requires a ticket.
*
* @action impersonate
* @param string $secret Remember to provide the correct secret according to the sessionType you want
* @param int $impersonatedPartnerId
* @param string $userId
* @param KalturaSessionType $type Regular session or Admin session
* @param int $partnerId
* @param int $expiry KS expiry time in seconds
* @param string $privileges
* @return string
*
* @throws APIErrors::START_SESSION_ERROR
*/
function impersonateAction($secret, $impersonatedPartnerId, $userId = "", $type = 0, $partnerId = null, $expiry = 86400, $privileges = null)
{
KalturaResponseCacher::disableCache();
// verify that partnerId exists and is in correspondence with given secret
$result = myPartnerUtils::isValidSecret($partnerId, $secret, "", $expiry, $type);
if ($result !== true) {
throw new KalturaAPIException(APIErrors::START_SESSION_ERROR, $partnerId);
}
// verify partner is allowed to start session for another partner
if (!myPartnerUtils::allowPartnerAccessPartner($partnerId, $this->partnerGroup(), $impersonatedPartnerId)) {
throw new KalturaAPIException(APIErrors::START_SESSION_ERROR, $partnerId);
}
// get impersonated partner
$impersonatedPartner = PartnerPeer::retrieveByPK($impersonatedPartnerId);
if (!$impersonatedPartner) {
// impersonated partner could not be fetched from the DB
throw new KalturaAPIException(APIErrors::START_SESSION_ERROR, $partnerId);
}
// set the correct secret according to required session type
if ($type == KalturaSessionType::ADMIN) {
$impersonatedSecret = $impersonatedPartner->getAdminSecret();
} else {
$impersonatedSecret = $impersonatedPartner->getSecret();
}
// make sure the secret fits the one in the partner's table
$ks = "";
$result = kSessionUtils::startKSession($impersonatedPartner->getId(), $impersonatedSecret, $userId, $ks, $expiry, $type, "", $privileges, $partnerId);
if ($result >= 0) {
return $ks;
} else {
throw new KalturaAPIException(APIErrors::START_SESSION_ERROR, $partnerId);
}
}
示例11: myBatchPartnerUsage
public function myBatchPartnerUsage($partnerId = null)
{
self::initDb();
$partners_exists = true;
$start_pos = 0;
$bulk_size = 500;
while ($partners_exists) {
$c = new Criteria();
if (!is_null($partnerId)) {
$c->addAnd(PartnerPeer::ID, $partnerId);
}
$c->addAnd(PartnerPeer::PARTNER_PACKAGE, 1);
// get only free partners
$c->addAnd(PartnerPeer::MONITOR_USAGE, 1);
$c->addAnd(PartnerPeer::STATUS, Partner::PARTNER_STATUS_DELETED, CRITERIA::NOT_EQUAL);
$c->setOffset($start_pos);
$c->setLimit($bulk_size);
$partners = PartnerPeer::doSelect($c);
if (!$partners) {
KalturaLog::debug("No more partners. offset: {$start_pos} , limit: {$bulk_size} .");
$partners_exists = false;
} else {
KalturaLog::debug("Looping " . ($start_pos + $bulk_size - 1) . " partners, offset: {$start_pos} .");
foreach ($partners as $partner) {
myPartnerUtils::doPartnerUsage($partner, true);
}
}
unset($partners);
PartnerPeer::clearInstancePool();
$start_pos += $bulk_size;
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:32,代码来源:myBatchPartnerUsage.class.php
示例12: createKSessionNoValidations
public static function createKSessionNoValidations($partner_id, $puser_id, &$ks_str, $desired_expiry_in_seconds = 86400, $admin = false, $partner_key = "", $privileges = "")
{
$ks_max_expiry_in_seconds = myPartnerUtils::getExpiry($partner_id);
if ($ks_max_expiry_in_seconds && $ks_max_expiry_in_seconds < $desired_expiry_in_seconds) {
$desired_expiry_in_seconds = $ks_max_expiry_in_seconds;
}
$ks = new ks();
$ks->valid_until = kApiCache::getTime() + $desired_expiry_in_seconds;
// store in milliseconds to make comparison easier at validation time
// $ks->type = $admin ? ks::TYPE_KAS : ks::TYPE_KS;
if ($admin == false) {
$ks->type = ks::TYPE_KS;
} else {
$ks->type = $admin;
}
// if the admin > 1 - use it rather than automatially setting it to be 2
$ks->partner_id = $partner_id;
$ks->partner_pattern = $partner_id;
$ks->error = 0;
$ks->rand = microtime(true);
$ks->user = $puser_id;
$ks->privileges = $privileges;
$ks_str = $ks->toSecureString();
return 0;
}
示例13: execute
public function execute()
{
$this->forceSystemAuthentication();
$partner_id = $this->getRequestParameter('partner_id', -1);
if ($partner_id >= 0) {
myPartnerUtils::applyPartnerFilters($partner_id);
}
$this->partner_id = $partner_id;
$order = $this->getRequestParameter('sort', kshow::KSHOW_SORT_MOST_VIEWED);
$page = $this->getRequestParameter('page', 1);
//$this->producer_id = $this->getRequestParameter('producer_id', 0 );
//$this->kaltura_part_of_flag = $this->getRequestParameter('partof', 0 );
$pager = kshowPeer::getOrderedPager($order, 10, $page);
$kshow_list = $pager->getResults();
dashboardUtils::updateKshowsRoughcutCount($kshow_list);
$kshowsData = array();
foreach ($kshow_list as $kshow) {
$kshowsData[] = $this->createKShowData($kshow, $order);
}
// following variables will be used by the view
$this->firstTime = $this->getRequestParameter('first', 1) == 1;
$this->order = $order;
$this->page = $page;
$this->lastPage = $pager->getLastPage();
$this->numResults = $pager->getNbResults();
$this->kshowsData = $kshowsData;
// allow the action buttons to show only for shows the user produced, and only for authenticated users, on their own pages
$this->allowactions = true;
// !$this->kaltura_part_of_flag && $this->getUser()->isAuthenticated() && $this->getUser()->getAttribute('id') == $this->producer_id;
}
示例14: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$kshow_id = $this->getPM("kshow_id");
$detailed = $this->getP("detailed", false);
$kshow_indexedCustomData3 = $this->getP("indexedCustomData3");
$kshow = null;
if ($kshow_id == kshow::KSHOW_ID_USE_DEFAULT) {
// see if the partner has some default kshow to add to
$kshow = myPartnerUtils::getDefaultKshow($partner_id, $subp_id, $puser_kuser);
if ($kshow) {
$kshow_id = $kshow->getId();
}
} elseif ($kshow_id) {
$kshow = kshowPeer::retrieveByPK($kshow_id);
} elseif ($kshow_indexedCustomData3) {
$kshow = kshowPeer::retrieveByIndexedCustomData3($kshow_indexedCustomData3);
}
if (!$kshow) {
$this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id);
} else {
$level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
$wrapper = objectWrapperBase::getWrapperClass($kshow, $level);
// TODO - remove this code when cache works properly when saving objects (in their save method)
$wrapper->removeFromCache("kshow", $kshow_id);
$this->addMsg("kshow", $wrapper);
}
}
示例15: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$allow_empty = $this->getP("allow_empty_field", false);
if ($allow_empty == "false" || $allow_empty === 0) {
$allow_empty = false;
}
$partner = new Partner();
$obj_wrapper = objectWrapperBase::getWrapperClass($partner, 0);
$updateable_fields = $obj_wrapper->getUpdateableFields();
// TODO - use fillObjectFromMapOrderedByFields instead
$fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $partner, "partner_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
// check that mandatory fields were set
// TODO
if (count($fields_modified) > 0) {
$target_partner = PartnerPeer::retrieveByPK($partner_id);
if ($partner && $target_partner) {
if (@$fields_modified["adminEmail"] && $target_partner->getAdminEmail() != $fields_modified["adminEmail"]) {
myPartnerUtils::emailChangedEmail($partner_id, $target_partner->getAdminEmail(), $fields_modified["adminEmail"], $target_partner->getName(), PartnerPeer::KALTURAS_PARTNER_EMAIL_CHANGE);
}
$partner->setType($target_partner->getType());
baseObjectUtils::fillObjectFromObject($updateable_fields, $partner, $target_partner, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
$target_partner->save();
$this->addMsg("partner", objectWrapperBase::getWrapperClass($target_partner, objectWrapperBase::DETAIL_LEVEL_DETAILED));
$this->addDebug("added_fields", $fields_modified);
} else {
$this->addError(APIErrors::UNKNOWN_PARTNER_ID);
}
} else {
$this->addError(APIErrors::NO_FIELDS_SET_FOR_PARTNER);
}
}