本文整理汇总了PHP中myPartnerUtils::applyPartnerFilters方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::applyPartnerFilters方法的具体用法?PHP myPartnerUtils::applyPartnerFilters怎么用?PHP myPartnerUtils::applyPartnerFilters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myPartnerUtils
的用法示例。
在下文中一共展示了myPartnerUtils::applyPartnerFilters方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: execute
/**
* Gives a system applicative snapsot
*/
public function execute()
{
myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL3;
$this->forceSystemAuthentication();
$partner_id = $this->getRequestParameter('partner_id', -1);
if ($partner_id >= 0) {
myPartnerUtils::applyPartnerFilters($partner_id);
}
$this->partner_id = $partner_id;
$limit = $this->getRequestParameter('limit', '30');
if ($limit > 300) {
$limit = 300;
}
$bands_only = $this->getRequestParameter("bands", false) != null;
$modified_only = $this->getRequestParameter("modified", false) != null;
$this->bands_only = $bands_only;
$this->modified_only = $modified_only;
$this->kshows_with_new_entries = $modified_only ? dashboardUtils::getUpdatedKshows() : null;
$yesterday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
$lastweek = mktime(0, 0, 0, date("m"), date("d") - 7, date("Y"));
$query_esterday = date('Y-m-d', $yesterday);
$query_lastweek = date('Y-m-d', $lastweek);
$modified_band_ids = $modified_only ? array_keys($this->kshows_with_new_entries) : null;
if ($modified_only) {
// TODO - this chunk was copied from the code bellow with minor changes - generalize !
$c = new Criteria();
// $c->add ( kshowPeer::ID , $modified_band_ids , Criteria::IN ); // search only the given IDs
$this->bandsOnly($bands_only, $modified_band_ids, $c, kshowPeer::PARTNER_ID);
$this->kshow_count = kshowPeer::doCount($c);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
$c->add($criterion);
$this->kshow_count1 = kshowPeer::doCount($c);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
$c->add($criterion);
$this->kshow_count7 = kshowPeer::doCount($c);
$c->setLimit($limit);
//$c->hints = array(kshowPeer::TABLE_NAME => "created_at_index");
$c->addDescendingOrderByColumn(kshowPeer::CREATED_AT);
$c->remove(kshowPeer::CREATED_AT);
$c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::LEFT_JOIN);
$this->kshows = kshowPeer::doSelectJoinkuser($c);
$this->bands_only = $bands_only;
$this->entry_count = 0;
$this->entry_count1 = 0;
$this->entry_count7 = 0;
$this->entries = array();
$this->kuser_count = 0;
$this->kuser_count1 = 0;
$this->kuser_count7 = 0;
$this->kusers = array();
dashboardUtils::updateKshowsRoughcutCount($this->kshows);
return sfView::SUCCESS;
}
$c = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $c, kshowPeer::PARTNER_ID);
$this->kshow_count = kshowPeer::doCount($c);
$d = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $d, kshowPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
$d->add($criterion);
$this->kshow_count1 = kshowPeer::doCount($d);
$e = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $e, kshowPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(kshowPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
$e->add($criterion);
$this->kshow_count7 = kshowPeer::doCount($e);
//$this->kshow_count = kshowPeer::doCount( $c );
$c->setLimit($limit);
//$c->hints = array(kshowPeer::TABLE_NAME => "created_at_index");
$c->addDescendingOrderByColumn(kshowPeer::CREATED_AT);
$c->addJoin(kshowPeer::PRODUCER_ID, kuserPeer::ID, Criteria::LEFT_JOIN);
$this->kshows = kshowPeer::doSelectJoinkuser($c);
$c = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $c, entryPeer::PARTNER_ID);
$this->entry_count = entryPeer::doCount($c);
$d = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $d, entryPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(entryPeer::CREATED_AT, $query_esterday, Criteria::GREATER_EQUAL);
$d->add($criterion);
$this->entry_count1 = entryPeer::doCount($d);
$e = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $e, entryPeer::PARTNER_ID);
$criterion = $c->getNewCriterion(entryPeer::CREATED_AT, $query_lastweek, Criteria::GREATER_EQUAL);
$e->add($criterion);
$this->entry_count7 = entryPeer::doCount($e);
$c->setLimit($limit);
//$c->hints = array(entryPeer::TABLE_NAME => "created_at_index");
$c->addDescendingOrderByColumn(entryPeer::CREATED_AT);
$c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
// we don't want entries that
// $c->addJoin(entryPeer::KUSER_ID, kuserPeer::ID, Criteria::INNER_JOIN);
// $c->addJoin(entryPeer::KSHOW_ID, kshowPeer::ID, Criteria::INNER_JOIN);
$this->entries = entryPeer::doSelectJoinAll($c);
$c = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $c, kuserPeer::PARTNER_ID);
$d = new Criteria();
$this->bandsOnly($bands_only, $modified_band_ids, $d, kuserPeer::PARTNER_ID);
//.........这里部分代码省略.........
示例4: initService
public function initService($serviceId, $serviceName, $actionName)
{
// init service and action name
$this->serviceId = $serviceId;
$this->serviceName = $serviceName;
$this->actionName = $actionName;
// impersonated partner = partner parameter from the request
$this->impersonatedPartnerId = kCurrentContext::$partner_id;
$this->ks = kCurrentContext::$ks_object ? kCurrentContext::$ks_object : null;
// operating partner = partner from the request or the ks partner
$partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
// if there is no session, assume it's partner 0 using actions that doesn't require ks
if (is_null($partnerId)) {
$partnerId = 0;
}
$this->partner = PartnerPeer::retrieveByPK($partnerId);
if (!$this->partner) {
$this->partner = null;
}
// check if current aciton is allowed and if private partner data access is allowed
$allowPrivatePartnerData = false;
$actionPermitted = $this->isPermitted($allowPrivatePartnerData);
// action not permitted at all, not even kaltura network
if (!$actionPermitted) {
$e = new KalturaAPIException(APIErrors::SERVICE_FORBIDDEN, $this->serviceId . '->' . $this->actionName);
//TODO: should sometimes thorow MISSING_KS instead
header("X-Kaltura:error-" . $e->getCode());
header("X-Kaltura-App: exiting on error " . $e->getCode() . " - " . $e->getMessage());
throw $e;
}
// init partner filter parameters
$this->private_partner_data = $allowPrivatePartnerData;
$this->partnerGroup = kPermissionManager::getPartnerGroup($this->serviceId, $this->actionName);
if ($this->globalPartnerAllowed($this->actionName)) {
$this->partnerGroup = PartnerPeer::GLOBAL_PARTNER . ',' . trim($this->partnerGroup, ',');
}
// apply partner filters according to current context and permissions
myPartnerUtils::resetAllFilters();
myPartnerUtils::applyPartnerFilters($partnerId, $this->private_partner_data, $this->partnerGroup, $this->kalturaNetworkAllowed($this->actionName));
}
示例5: execute
public function execute($add_extra_debug_data = true)
{
date_default_timezone_set(kConf::get("date_default_timezone"));
// TODO - remove for production - use some configuration to determine
kConfigTable::$should_use_cache = false;
$start_impl = $end_impl = 0;
$nocache = false;
if ($this->getP("nocache")) {
$nocache = true;
$this->logMessage("Not using cache!");
objectWrapperBase::useCache(false);
}
$add_benchmarks = $this->getP("add_benchmarks", false);
// while testing our system - will match each service agains its description
// $this->matchInDescription();
$this->msg = array();
$this->error = array();
$this->debug = array();
$start_time = microtime(true);
$start = microtime(true);
$this->benchmarkStart("beforeImpl");
$this->response_type = $this->getP("format", self::DEFAULT_FORMAT);
//
/*
$should_debug = $this->getP ( "should_debug" , true );
if ( $should_debug == "false" ) $this->should_debug = false;
*/
if ($this->should_debug && $add_extra_debug_data) {
$this->benchmarkStart("signature");
$sig_type = $this->getP("sigtype", self::SIG_TYPE_POST);
$signature_params = self::getParamsFromSigType($sig_type);
$signatura_valid = self::validateSignature($signature_params);
$this->benchmarkEnd("signature");
$this->addDebug("sigtype", $sig_type);
$this->addDebug("validateSignature", $signatura_valid);
$this->addDebug("signature", self::signature($signature_params));
// $this->addDebug( "rawsignature" , self::signature( $signature_params , false ) );
}
$partner_id = $this->getP("partner_id");
if (!$partner_id) {
$partner_id = $this->getP("partnerId");
}
$subp_id = $this->getP("subp_id");
if (!$subp_id) {
$subp_id = $this->getP("subpId");
}
$puser_id = $this->getP("uid");
$ks_str = $this->getP("ks");
if ($ks_str == "{ks}") {
$ks_str = "";
}
// if the client DIDN'T replace the dynamic ks - ignore it
// the $execution_cache_key can be used by services to cache the results depending on the inpu parameters
// if the $execution_cache_key is not null, the rendere will search for the result of the rendering depending on the $execution_cache_key
// if it doesn't find it - it will create it (per format) and store it for next time
$execution_cache_key = null;
// moved the renderer here to see if has the $execution_cache_key and if so - skip the implementation
$renderer = new kalturaWebserviceRenderer($this->response_context);
$private_partner_data = false;
try {
try {
$arr = list($partner_id, $subp_id, $uid, $private_partner_data) = $this->validateTicketSetPartner($partner_id, $subp_id, $puser_id, $ks_str);
} catch (Exception $ex) {
KalturaLog::log('validateTicketSetPartner failed - not caching response');
defPartnerservices2baseAction::disableCache();
throw $ex;
}
// if PS2 permission validation is enabled for the current partner, only the actions defined in kConf's parameter "ps2_actions_not_blocked_by_permissions" will be allowed
$currentPartner = $this->getPartner();
if ($currentPartner && $currentPartner->getEnabledService(PermissionName::FEATURE_PS2_PERMISSIONS_VALIDATION)) {
if (!in_array(strtolower(get_class($this)), kConf::get('ps2_actions_not_blocked_by_permissions'))) {
KalturaLog::log('PS2 action ' . get_class($this) . ' is being blocked for partner ' . $currentPartner->getId() . ' defined with FEATURE_PS2_PERMISSIONS_VALIDATION enabled');
$this->addException(APIErrors::SERVICE_FORBIDDEN, get_class($this));
}
}
$this->private_partner_data = $private_partner_data;
//print_r ( $arr );
// TODO - validate the matchIp is ok with the user's IP
$this->validateIp();
// most services should not attempt to cache the results - for them this will return null
$execution_cache_key = $this->getExecutionCacheKeyWrapper($partner_id, $subp_id, $puser_id);
// if the key is not null - it will be used in the renderer for using the cotent from the cache
if ($nocache) {
$renderer->deleteCacheKey($execution_cache_key, $this->response_type);
} else {
$renderer->setCacheKey($execution_cache_key);
}
if (!$renderer->hasContentForCacheKey($this->response_type)) {
$this->benchmarkStart("applyPartnerFilters");
//init entitlement before set the default criteire by myPartnerUtils::applyPartnerFilters
kEntitlementUtils::initEntitlementEnforcement();
// apply filters for Criteria so there will be no chance of exposure of date from other partners !
// TODO - add the parameter for allowing kaltura network
myPartnerUtils::applyPartnerFilters($partner_id, $private_partner_data, $this->partnerGroup2(), $this->kalturaNetwork2());
$this->benchmarkEnd("applyPartnerFilters");
$this->benchmarkStart("puserKuser");
list($partner_id, $subp_id, $puser_id, $partner_prefix) = $this->preparePartnerPuserDetails($partner_id, $subp_id, $puser_id);
$puser_kuser = $this->getPuserKuser($partner_id, $subp_id, $puser_id);
$this->benchmarkEnd("puserKuser");
$this->benchmarkEnd("beforeImpl");
//.........这里部分代码省略.........
示例6: setPartnerFilters
/**
* apply partner filters according to current context and permissions
*
* @param int $partnerId
*/
protected function setPartnerFilters($partnerId)
{
myPartnerUtils::resetAllFilters();
myPartnerUtils::applyPartnerFilters($partnerId, $this->private_partner_data, $this->partnerGroup(), $this->kalturaNetworkAllowed($this->actionName));
}
示例7: createNewPartner
/**
* Function creates new partner, saves all the required data to it, and copies objects & filesyncs of template content to its ID.
* @param string $partner_name
* @param string $contact
* @param string $email
* @param CommercialUseType $ID_is_for
* @param string $SDK_terms_agreement
* @param string $description
* @param string $website_url
* @param string $password
* @param Partner $partner
* @param int $templatePartnerId
* @return Partner
*/
private function createNewPartner($partner_name, $contact, $email, $ID_is_for, $SDK_terms_agreement, $description, $website_url, $password = null, $newPartner = null, $templatePartnerId = null)
{
$secret = md5($this->str_makerand(5, 10, true, false, true));
$admin_secret = md5($this->str_makerand(5, 10, true, false, true));
if (!$newPartner) {
$newPartner = new Partner();
}
if ($partner_name) {
$newPartner->setPartnerName($partner_name);
}
$newPartner->setAdminSecret($admin_secret);
$newPartner->setSecret($secret);
$newPartner->setAdminName($contact);
$newPartner->setAdminEmail($email);
$newPartner->setUrl1($website_url);
if ($ID_is_for === "commercial_use" || $ID_is_for === CommercialUseType::COMMERCIAL_USE) {
$newPartner->setCommercialUse(true);
} else {
//($ID_is_for == "non-commercial_use") || $ID_is_for === CommercialUseType::NON_COMMERCIAL_USE)
$newPartner->setCommercialUse(false);
}
$newPartner->setDescription($description);
$newPartner->setKsMaxExpiryInSeconds(86400);
$newPartner->setModerateContent(false);
$newPartner->setNotify(false);
$newPartner->setAppearInSearch(mySearchUtils::DISPLAY_IN_SEARCH_PARTNER_ONLY);
$newPartner->setIsFirstLogin(true);
/* fix drupal5 module partner type */
//var_dump($description);
if ($this->partnerParentId) {
// this is a child partner of some VAR/partner GROUP
$newPartner->setPartnerParentId($this->partnerParentId);
$newPartner->setMonitorUsage(PartnerFreeTrialType::NO_LIMIT);
$parentPartner = PartnerPeer::retrieveByPK($this->partnerParentId);
$newPartner->setPartnerPackage($parentPartner->getPartnerPackage());
}
if (substr_count($description, 'Drupal module|')) {
$newPartner->setType(102);
}
$newPartner->save();
// if name was left empty - which should not happen - use id as name
if (!$partner_name) {
$partner_name = $newPartner->getId();
}
$newPartner->setPartnerName($partner_name);
$newPartner->setPrefix($newPartner->getId());
$newPartner->setPartnerAlias(md5($newPartner->getId() . 'kaltura partner'));
// set default conversion profile for trial accounts
if ($newPartner->getType() == Partner::PARTNER_TYPE_KMC) {
$newPartner->setDefConversionProfileType(ConversionProfile::DEFAULT_TRIAL_COVERSION_PROFILE_TYPE);
}
$newPartner->save();
// remove the default criteria from all peers and recreate it with the right partner id
myPartnerUtils::resetAllFilters();
myPartnerUtils::applyPartnerFilters($newPartner->getId(), true);
$partner_id = $newPartner->getId();
widget::createDefaultWidgetForPartner($partner_id, $this->createNewSubPartner($newPartner));
$fromPartner = PartnerPeer::retrieveByPK($templatePartnerId ? $templatePartnerId : kConf::get("template_partner_id"));
if (!$fromPartner) {
KalturaLog::log("Template content partner was not found!");
} else {
$newPartner->setI18nTemplatePartnerId($templatePartnerId);
myPartnerUtils::copyTemplateContent($fromPartner, $newPartner, true);
}
if ($newPartner->getType() == Partner::PARTNER_TYPE_WORDPRESS) {
kPermissionManager::setPs2Permission($newPartner);
}
$newPartner->setKmcVersion(kConf::get('new_partner_kmc_version'));
$newPartner->save();
return $newPartner;
}