private function createNewPartner($parnter_name, $contact, $email, $ID_is_for, $SDK_terms_agreement, $description, $website_url, $password = null, $partner = null) { $secret = md5($this->str_makerand(5, 10, true, false, true)); $admin_secret = md5($this->str_makerand(5, 10, true, false, true)); $newPartner = new Partner(); if ($parnter_name) { $newPartner->setPartnerName($parnter_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_KALTURA_NETWORK); $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(0); } if (substr_count($description, 'Drupal module|')) { $newPartner->setType(102); if ($partner) { $partner->setType(102); } } if ($partner) { if ($partner->getType()) { $newPartner->setType($partner->getType()); } if ($partner->getContentCategories()) { $newPartner->setContentCategories($partner->getContentCategories()); } if ($partner->getPhone()) { $newPartner->setPhone($partner->getPhone()); } if ($partner->getDescribeYourself()) { $newPartner->setDescribeYourself($partner->getDescribeYourself()); } if ($partner->getAdultContent()) { $newPartner->setAdultContent($partner->getAdultContent()); } if ($partner->getDefConversionProfileType()) { $newPartner->setDefConversionProfileType($partner->getDefConversionProfileType()); } // new fields of registration form if ($partner->getFirstName()) { $newPartner->setFirstName($partner->getFirstName()); } if ($partner->getLastName()) { $newPartner->setLastName($partner->getLastName()); } if ($partner->getCountry()) { $newPartner->setCountry($partner->getCountry()); } if ($partner->getState()) { $newPartner->setState($partner->getState()); } if ($partner->getAdditionalParams() && is_array($partner->getAdditionalParams()) && count($partner->getAdditionalParams())) { $newPartner->setAdditionalParams($partner->getAdditionalParams()); } } $newPartner->save(); // if name was left empty - which should not happen - use id as name if (!$parnter_name) { $parnter_name = $newPartner->getId(); } $newPartner->setPartnerName($parnter_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(); $partner_id = $newPartner->getId(); widget::createDefaultWidgetForPartner($partner_id, $this->createNewSubPartner($newPartner)); $fromPartner = PartnerPeer::retrieveByPK(kConf::get("template_partner_id")); if (!$fromPartner) { KalturaLog::log("Template content partner was not found!"); } else { myPartnerUtils::copyTemplateContent($fromPartner, $newPartner, true); } $newPartner->setKmcVersion(kConf::get('new_partner_kmc_version')); $newPartner->save(); return $newPartner; }