/**
  * 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;
 }
 /**
  * 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}");
 }
Ejemplo n.º 3
0
 public function clearMemory()
 {
     accessControlPeer::clearInstancePool();
     BatchJobPeer::clearInstancePool();
     BulkUploadResultPeer::clearInstancePool();
     categoryPeer::clearInstancePool();
     EmailIngestionProfilePeer::clearInstancePool();
     entryPeer::clearInstancePool();
     FileSyncPeer::clearInstancePool();
     flavorAssetPeer::clearInstancePool();
     flavorParamsConversionProfilePeer::clearInstancePool();
     flavorParamsOutputPeer::clearInstancePool();
     flavorParamsPeer::clearInstancePool();
     kshowPeer::clearInstancePool();
     mediaInfoPeer::clearInstancePool();
     moderationFlagPeer::clearInstancePool();
     moderationPeer::clearInstancePool();
     notificationPeer::clearInstancePool();
     roughcutEntryPeer::clearInstancePool();
     SchedulerConfigPeer::clearInstancePool();
     SchedulerPeer::clearInstancePool();
     SchedulerStatusPeer::clearInstancePool();
     SchedulerWorkerPeer::clearInstancePool();
     StorageProfilePeer::clearInstancePool();
     syndicationFeedPeer::clearInstancePool();
     TrackEntryPeer::clearInstancePool();
     uiConfPeer::clearInstancePool();
     UploadTokenPeer::clearInstancePool();
     // TODO clear default filters
     // TODO call all memory cleaner plugins
     if (function_exists('gc_collect_cycles')) {
         // php 5.3 and above
         gc_collect_cycles();
     }
 }
Ejemplo n.º 4
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass(new uiConfPeer(), $partner_id);
     $allow_empty = $this->getP("allow_empty_field", false);
     if ($allow_empty == "false" || $allow_empty === 0) {
         $allow_empty = false;
     }
     $prefix = $this->getObjectPrefix();
     $uiconf_id = $this->getPM("{$prefix}_id");
     $uiconf = uiConfPeer::retrieveByPK($uiconf_id);
     if (!$uiconf) {
         $this->addError(APIErrors::INVALID_UI_CONF_ID, $uiconf_id);
         return;
     }
     if ($uiconf && !$uiconf->isValid()) {
         $this->addError(APIErrors::INTERNAL_SERVERL_ERROR, "uiConf object [{$uiconf->getId()}] is not valid");
         return;
     }
     // get the new properties for the uiconf from the request
     $uiconf_update_data = new uiConf();
     $uiconf_update_data->setPartnerId($partner_id);
     // set this once before filling the object and once after
     $obj_wrapper = objectWrapperBase::getWrapperClass($uiconf_update_data, 0);
     $updateable_fields = $obj_wrapper->getUpdateableFields();
     $fields_modified = baseObjectUtils::fillObjectFromMapOrderedByFields($this->getInputParams(), $uiconf_update_data, "{$prefix}_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
     if (count($fields_modified) > 0) {
         if ($uiconf_update_data) {
             baseObjectUtils::fillObjectFromObject($updateable_fields, $uiconf_update_data, $uiconf, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
         }
         $uiconf->save();
     }
     $wrapper = objectWrapperBase::getWrapperClass($uiconf, objectWrapperBase::DETAIL_LEVEL_REGULAR);
     $this->addMsg("{$prefix}", $wrapper);
     $this->addDebug("modified_fields", $fields_modified);
 }
Ejemplo n.º 5
0
 /**
  * Will return a JS library for integrating the KSR (similar to HTML5 in concept)
  * uiconfId specifies from which uiconf to fetch different settings that should be replaced in the JS
  */
 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);
     }
     $ui_conf_swf_url = $this->uiconfObj->getSwfUrl();
     if (!$ui_conf_swf_url) {
         KExternalErrors::dieError(KExternalErrors::ILLEGAL_UI_CONF, "SWF URL not found in UI conf");
     }
     @libxml_use_internal_errors(true);
     try {
         $this->uiconfXmlObj = new SimpleXMLElement(trim($this->uiconfObj->getConfFile()));
     } catch (Exception $e) {
         KalturaLog::debug("malformed uiconf XML - base64 encoded: [" . base64_encode(trim($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;
 }
Ejemplo n.º 6
0
 /**
  * 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}");
 }
Ejemplo n.º 7
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass(new uiConfPeer(), $partner_id);
     $ui_conf_id = $this->getPM("uiconf_id");
     $detailed = $this->getP("detailed", false);
     $new_name = $this->getP("new_name");
     if (!$new_name || $new_name == '') {
         $new_name = null;
     }
     $ui_conf = null;
     if ($ui_conf_id) {
         $ui_conf = uiConfPeer::retrieveByPK($ui_conf_id);
     }
     if (!$ui_conf) {
         $this->addError(APIErrors::INVALID_UI_CONF_ID, $ui_conf_id);
     } else {
         $ui_conf_verride_params = new uiConf();
         $ui_conf_verride_params->setPartnerId($partner_id);
         $ui_conf_verride_params->setDisplayInSearch(1);
         // the cloned ui_conf should NOT be a template
         $new_ui_conf = $ui_conf->cloneToNew($ui_conf_verride_params, $new_name);
         if (!$new_ui_conf) {
             $this->addError(APIErrors::UI_CONF_CLONE_FAILED, $ui_conf_id);
         } else {
             $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
             $wrapper = objectWrapperBase::getWrapperClass($new_ui_conf, $level);
             // TODO - remove this code when cache works properly when saving objects (in their save method)
             //				$wrapper->removeFromCache( "kshow" , $new_ui_conf->getId() );
             $this->addMsg("uiconf", $wrapper);
         }
     }
 }
Ejemplo n.º 8
0
 /**
  * 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}");
 }
Ejemplo n.º 9
0
 /**
  * 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();
     $host = myPartnerUtils::getHost($partner_id);
     $ui_conf_swf_url = $uiConf->getSwfUrl();
     if (!$ui_conf_swf_url) {
         $ui_conf_swf_url = "/swf/simpleeditor.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
     }
     // handle buggy case for backward compatiblity
     $partner_host = $host;
     if ($partner_host == "http://www.kaltura.com") {
         $partner_host = 1;
     }
     // otherwise the kse will build a flawed url with [[IMPORT]]
     $params = "contentUrl=" . urlencode($swf_url) . "&host=" . str_replace("http://", "", str_replace("https://", "", $partner_host)) . "&cdnHost=" . str_replace("http://", "", str_replace("https://", "", myPartnerUtils::getCdnHost($partner_id))) . "&uiConfId=" . $ui_conf_id . "&disableurlhashing=" . kConf::get('disable_url_hashing');
     $wrapper_swf = myContentStorage::getFSFlashRootPath() . "/flexwrapper/" . kConf::get('editors_flex_wrapper_version') . "/FlexWrapper.swf";
     $this->redirect($host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . "{$wrapper_swf}?{$params}");
 }
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     //myDbHelper::DB_HELPER_CONN_PROPEL2
     $uiConfId = $this->getRequestParameter("id");
     $uiConf = uiConfPeer::retrieveByPK($uiConfId);
     $subTypes = array(uiconf::FILE_SYNC_UICONF_SUB_TYPE_DATA, uiconf::FILE_SYNC_UICONF_SUB_TYPE_FEATURES);
     foreach ($subTypes as $subType) {
         if ($subType == uiconf::FILE_SYNC_UICONF_SUB_TYPE_DATA) {
             echo "Data:" . PHP_EOL;
         } else {
             if ($subType == uiconf::FILE_SYNC_UICONF_SUB_TYPE_FEATURES) {
                 echo "Features:" . PHP_EOL;
             }
         }
         $syncKey = $uiConf->getSyncKey($subType);
         if (kFileSyncUtils::file_exists($syncKey)) {
             echo "File sync already exists." . PHP_EOL;
         } else {
             list($rootPath, $filePath) = $uiConf->generateFilePathArr($subType);
             $fullPath = $rootPath . $filePath;
             if (file_exists($fullPath)) {
                 kFileSyncUtils::createSyncFileForKey($syncKey);
                 echo "Created successfully." . PHP_EOL;
             } else {
                 echo "File not found:" . PHP_EOL;
                 echo $fullPath . PHP_EOL;
                 echo "Not creating file sync." . PHP_EOL;
             }
         }
         echo PHP_EOL;
     }
     die;
 }
Ejemplo n.º 11
0
 public static function setDefaultCriteriaFilter()
 {
     if (self::$s_criteria_filter == null) {
         self::$s_criteria_filter = new criteriaFilter();
     }
     $c = new Criteria();
     $c->add(self::STATUS, uiConf::UI_CONF_STATUS_READY);
     self::$s_criteria_filter->setFilter($c);
 }
 /**
  * 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;
 }
Ejemplo n.º 13
0
 /**
  * 
  * @param int $objectType
  * @param string $objectId
  * @return ISyncableFile
  */
 public static function retrieveObject($objectType, $objectId)
 {
     $object = null;
     switch ($objectType) {
         case FileSyncObjectType::ENTRY:
             entryPeer::setUseCriteriaFilter(false);
             $object = entryPeer::retrieveByPK($objectId);
             entryPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::UICONF:
             uiConfPeer::setUseCriteriaFilter(false);
             $object = uiConfPeer::retrieveByPK($objectId);
             uiConfPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::BATCHJOB:
             BatchJobPeer::setUseCriteriaFilter(false);
             $object = BatchJobPeer::retrieveByPK($objectId);
             BatchJobPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::FLAVOR_ASSET:
             assetPeer::setUseCriteriaFilter(false);
             $object = assetPeer::retrieveById($objectId);
             assetPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::SYNDICATION_FEED:
             syndicationFeedPeer::setUseCriteriaFilter(false);
             $object = syndicationFeedPeer::retrieveByPK($objectId);
             syndicationFeedPeer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::CONVERSION_PROFILE:
             conversionProfile2Peer::setUseCriteriaFilter(false);
             $object = conversionProfile2Peer::retrieveByPK($objectId);
             conversionProfile2Peer::setUseCriteriaFilter(true);
             break;
         case FileSyncObjectType::FILE_ASSET:
             conversionProfile2Peer::setUseCriteriaFilter(false);
             $object = FileAssetPeer::retrieveByPK($objectId);
             conversionProfile2Peer::setUseCriteriaFilter(true);
             break;
     }
     if ($object == null) {
         $object = KalturaPluginManager::loadObject('ISyncableFile', $objectType, array('objectId' => $objectId));
     }
     if ($object == null) {
         $error = __METHOD__ . " Cannot find object type [" . $objectType . "] with object_id [" . $objectId . "]";
         KalturaLog::err($error);
         throw new kFileSyncException($error);
     }
     return $object;
 }
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     $partnerId = $this->getRequestParameter("partnerId", null);
     if ($partnerId !== null) {
         $partnerId = (int) $partnerId;
     }
     $c = new Criteria();
     $c->add(uiConfPeer::PARTNER_ID, $partnerId);
     $c->addDescendingOrderByColumn(uiConfPeer::CREATED_AT);
     $this->uiconfs = uiConfPeer::doSelect($c);
     $partner = PartnerPeer::retrieveByPK($partnerId);
     $this->partner = $partner;
     $this->partnerId = $partnerId;
 }
Ejemplo n.º 15
0
 /**
  * Add new widget, can be attached to entry or kshow
  * SourceWidget is ignored.
  * 
  * @action add
  * @param KalturaWidget $widget
  * @return KalturaWidget
  */
 function addAction(KalturaWidget $widget)
 {
     if ($widget->sourceWidgetId === null && $widget->uiConfId === null) {
         throw new KalturaAPIException(KalturaErrors::SOURCE_WIDGET_OR_UICONF_REQUIRED);
     }
     if ($widget->sourceWidgetId !== null) {
         $sourceWidget = widgetPeer::retrieveByPK($widget->sourceWidgetId);
         if (!$sourceWidget) {
             throw new KalturaAPIException(KalturaErrors::SOURCE_WIDGET_NOT_FOUND, $widget->sourceWidgetId);
         }
         if ($widget->uiConfId === null) {
             $widget->uiConfId = $sourceWidget->getUiConfId();
         }
     }
     if ($widget->uiConfId !== null) {
         $uiConf = uiConfPeer::retrieveByPK($widget->uiConfId);
         if (!$uiConf) {
             throw new KalturaAPIException(KalturaErrors::UICONF_ID_NOT_FOUND, $widget->uiConfId);
         }
     }
     if (!is_null($widget->enforceEntitlement) && $widget->enforceEntitlement == false && kEntitlementUtils::getEntitlementEnforcement()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_DISABLE_ENTITLEMENT_FOR_WIDGET_WHEN_ENTITLEMENT_ENFORCEMENT_ENABLE);
     }
     if ($widget->entryId !== null) {
         $entry = entryPeer::retrieveByPK($widget->entryId);
         if (!$entry) {
             throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $widget->entryId);
         }
     } elseif ($widget->enforceEntitlement != null && $widget->enforceEntitlement == false) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_DISABLE_ENTITLEMENT_WITH_NO_ENTRY_ID);
     }
     $dbWidget = $widget->toWidget();
     $dbWidget->setPartnerId($this->getPartnerId());
     $dbWidget->setSubpId($this->getPartnerId() * 100);
     $widgetId = $dbWidget->calculateId($dbWidget);
     $dbWidget->setId($widgetId);
     if ($entry && $entry->getType() == entryType::PLAYLIST) {
         $dbWidget->setIsPlayList(true);
     }
     $dbWidget->save();
     $savedWidget = widgetPeer::retrieveByPK($widgetId);
     $widget = new KalturaWidget();
     // start from blank
     $widget->fromObject($savedWidget, $this->getResponseProfile());
     return $widget;
 }
Ejemplo n.º 16
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass('uiConf', $partner_id);
     $detailed = $this->getP("detailed", false);
     $detailed_fields = $this->getP("detailed_fields");
     $limit = $this->getP("page_size", 10);
     $limit = $this->maxPageSize($limit);
     $page = $this->getP("page", 1);
     $offset = ($page - 1) * $limit;
     $c = new Criteria();
     // filter
     $filter = new uiConfFilter();
     $fields_set = $filter->fillObjectFromRequest($this->getInputParams(), "filter_", null);
     $this->setExtraFilters($filter);
     $filter->attachToCriteria($c);
     $count = uiConfPeer::doCount($c);
     if ($count > 0) {
         $offset = ($page - 1) * $limit;
         $c->setLimit($limit);
         if ($offset > 0) {
             $c->setOffset($offset);
         }
         $list = uiConfPeer::doSelect($c);
         $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     } else {
         // no need to query the data - there is none !
         $list = array();
         $level = objectWrapperBase::DETAIL_LEVEL_REGULAR;
     }
     $this->addMsg("count", $count);
     $this->addMsg("page_size", $limit);
     $this->addMsg("page", $page);
     foreach ($list as $listed_uiConf) {
         if (!$listed_uiConf->isValid()) {
             $this->addError(APIErrors::INTERNAL_SERVERL_ERROR, "uiConf object [{$listed_uiConf->getId()}] is not valid");
             return;
         }
     }
     if ($detailed_fields) {
         $extra_fields = explode(",", $detailed_fields);
         $wrapper = objectWrapperBase::getWrapperClass($list, $level, objectWrapperBase::DETAIL_VELOCITY_DEFAULT, 0, $extra_fields);
     } else {
         $wrapper = objectWrapperBase::getWrapperClass($list, $level);
     }
     $this->addMsg($this->getObjectPrefix(), $wrapper);
 }
Ejemplo n.º 17
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass('uiConf', $partner_id);
     $prefix = $this->getObjectPrefix();
     $uiconf_id_to_delete = $this->getPM("{$prefix}_id");
     $uiconf_to_delete = uiConfPeer::retrieveByPK($uiconf_id_to_delete);
     if ($uiconf_to_delete && !$uiconf_to_delete->isValid()) {
         $this->addError(APIErrors::INTERNAL_SERVERL_ERROR, "uiConf object [{$uiconf_to_delete->getId()}] is not valid");
         return;
     }
     if (!$uiconf_to_delete) {
         $this->addError(APIErrors::INVALID_UI_CONF_ID, $prefix, $uiconf_id_to_delete);
         return;
     }
     $uiconf_to_delete->setStatus(uiConf::UI_CONF_STATUS_DELETED);
     $uiconf_to_delete->save();
     //		myNotificationMgr::createNotification( notification::NOTIFICATION_TYPE_ENTRY_DELETE , $entry_to_delete );
     $this->addMsg("deleted_" . $prefix, objectWrapperBase::getWrapperClass($uiconf_to_delete, objectWrapperBase::DETAIL_LEVEL_REGULAR));
 }
 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');
 }
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     //myDbHelper::DB_HELPER_CONN_PROPEL2
     $this->saved = false;
     $uiConfId = $this->getRequestParameter("id");
     $this->uiConf = uiConfPeer::retrieveByPK($uiConfId);
     if ($this->uiConf->getObjType() != uiConf::UI_CONF_TYPE_CW) {
         die("Not a CW UIConf!");
     }
     if ($this->uiConf->getCreationMode() != uiConf::UI_CONF_CREATION_MODE_ADVANCED) {
         die("Creation mode must be advanced!");
     }
     if ($this->getRequest()->getMethodName() == "POST") {
         $this->uiConf->setConfFile($this->getRequestParameter("confFile"));
         $this->uiConf->save();
         $this->redirect("system/editUiconf?id=" . $this->uiConf->getId());
     }
 }
Ejemplo n.º 20
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass('uiConf', $partner_id);
     $ui_conf_id = $this->getPM("ui_conf_id");
     $detailed = $this->getP("detailed", false);
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $ui_conf = uiConfPeer::retrieveByPK($ui_conf_id);
     if ($ui_conf && !$ui_conf->isValid()) {
         $this->addError(APIErrors::INTERNAL_SERVERL_ERROR, "uiConf object [{$ui_conf->getId()}] is not valid");
         return;
     }
     if ($ui_conf) {
         $this->addMsg("ui_conf", objectWrapperBase::getWrapperClass($ui_conf, $level));
         self::$escape_text = true;
         /*
         $service_provider_list = myPartnerUtils::getMediaServiceProviders ( $partner_id , $subp_id );
         $this->addMsg( "config_" , $service_provider_list );
         
         $ui =  array ( "__0_moduleData" => 
         			array ( "moduleUrl" => "main" , 
         			"style" => "SearchView"  , "locale" => "SearchView"  ) ,
         		"__1_moduleData" => 
         			array ( "moduleUrl" => "SearchView.swf" , 
         			"style" => "SearchView"  , "locale" => "SearchView"  ) ,
         		"__2_moduleData" => 
         		array ( "moduleUrl" => "SearchView.swf" , 
         		"style" => "SearchView"  , "locale" => "SearchView"  ) , 
         	"__3_moduleData" => 
         		array ( "moduleUrl" => "SearchView.swf" , 
         		"style" => "SearchView"  , "locale" => "SearchView"  ) ,					
         		
         	) ;
         $this->addMsg( "ui" , $ui );
         */
     } else {
         $this->addError(APIErrors::INVALID_UI_CONF_ID, $ui_conf_id);
         return;
     }
 }
Ejemplo n.º 21
0
 /**
  * Add new widget, can be attached to entry or kshow
  * SourceWidget is ignored.
  * 
  * @action add
  * @param KalturaWidget $widget
  * @return KalturaWidget
  */
 function addAction(KalturaWidget $widget)
 {
     if ($widget->sourceWidgetId === null && $widget->uiConfId === null) {
         throw new KalturaAPIException(KalturaErrors::SOURCE_WIDGET_OR_UICONF_REQUIRED);
     }
     if ($widget->sourceWidgetId !== null) {
         $sourceWidget = widgetPeer::retrieveByPK($widget->sourceWidgetId);
         if (!$sourceWidget) {
             throw new KalturaAPIException(KalturaErrors::SOURCE_WIDGET_NOT_FOUND, $widget->sourceWidgetId);
         }
         if ($widget->uiConfId === null) {
             $widget->uiConfId = $sourceWidget->getUiConfId();
         }
     }
     if ($widget->uiConfId !== null) {
         $uiConf = uiConfPeer::retrieveByPK($widget->uiConfId);
         if (!$uiConf) {
             throw new KalturaAPIException(KalturaErrors::UICONF_ID_NOT_FOUND, $widget->uiConfId);
         }
     }
     if ($widget->entryId !== null) {
         $entry = entryPeer::retrieveByPK($widget->entryId);
         if (!$entry) {
             throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $widget->entryId);
         }
     }
     $dbWidget = $widget->toWidget();
     $dbWidget->setPartnerId($this->getPartnerId());
     $dbWidget->setSubpId($this->getPartnerId() * 100);
     $widgetId = $dbWidget->calculateId($dbWidget);
     $dbWidget->setId($widgetId);
     $dbWidget->save();
     $savedWidget = widgetPeer::retrieveByPK($widgetId);
     $widget = new KalturaWidget();
     // start from blank
     $widget->fromWidget($savedWidget);
     return $widget;
 }
Ejemplo n.º 22
0
 /**
  * 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);
 }
Ejemplo n.º 23
0
 public function getRootObjects(IRelatedObject $object)
 {
     /* @var $object FileAsset */
     $rootObjects = array();
     $parentObject = null;
     switch ($object->getObjectType()) {
         case FileAssetObjectType::UI_CONF:
             $parentObject = uiConfPeer::retrieveByPK($object->getObjectId());
             break;
     }
     if ($parentObject) {
         /* @var $parentObject IRelatedObjectPeer */
         $peer = $parentObject->getPeer();
         if ($peer instanceof IRelatedObjectPeer) {
             $parentRoots = $peer->getRootObjects($parentObject);
             if (count($parentRoots)) {
                 $rootObjects = array_merge($rootObjects, $parentRoots);
             }
         }
         $rootObjects[] = $parentObject;
     }
     return $rootObjects;
 }
Ejemplo n.º 24
0
 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);
 }
Ejemplo n.º 25
0
 /**
  * Retrieve a list of available UIConfs  with no partner limitation
  * 
  * @action list
  * @param KalturaUiConfFilter $filter
  * @param KalturaFilterPager $pager
  * @return KalturaUiConfAdminListResponse
  */
 function listAction(KalturaUiConfFilter $filter = null, KalturaFilterPager $pager = null)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
     if (!$filter) {
         $filter = new KalturaUiConfFilter();
     }
     $uiConfFilter = new uiConfFilter();
     $filter->toObject($uiConfFilter);
     $c = new Criteria();
     $uiConfFilter->attachToCriteria($c);
     $count = uiConfPeer::doCount($c);
     if ($pager) {
         $pager->attachToCriteria($c);
     }
     $list = uiConfPeer::doSelect($c);
     $newList = KalturaUiConfAdminArray::fromUiConfAdminArray($list);
     $response = new KalturaUiConfAdminListResponse();
     $response->objects = $newList;
     $response->totalCount = $count;
     return $response;
 }
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     // ajax stuff are here because there are too many actions in system module
     $ajax = $this->getRequestParameter("ajax", null);
     if ($ajax !== null) {
         switch ($ajax) {
             case "getPartnerName":
                 $name = "Unknown Partner";
                 $partnerId = $this->getRequestParameter("id");
                 $partner = PartnerPeer::retrieveByPK($partnerId);
                 if ($partner) {
                     $name = $partner->getName();
                 }
                 return $this->renderText(json_encode($name));
             case "validateWidgetIds":
                 $widgetIds = explode(",", $this->getRequestParameter("widgetIds"));
                 $existingIds = array();
                 if (is_array($widgetIds)) {
                     $widgets = widgetPeer::retrieveByPKs($widgetIds);
                     if ($widgets) {
                         foreach ($widgets as $widget) {
                             $id = $widget->getId();
                             if (in_array($id, $widgetIds)) {
                                 $existingIds[] = $id;
                             }
                         }
                     }
                 }
                 return $this->renderText(json_encode($existingIds));
         }
     }
     // end of ajax stuff
     $uiConfId = $this->getRequestParameter("uiConfId");
     $uiConf = uiConfPeer::retrieveByPK($uiConfId);
     if ($this->getRequest()->getMethodName() == "POST") {
         $numOfWidgets = (int) $this->getRequestParameter("numOfWidgets");
         $startIndex = (int) $this->getRequestParameter("startIndex");
         $partnerId = $this->getRequestParameter("partnerId");
         $uiConfId = $this->getRequestParameter("uiConfId");
         $entryId = $this->getRequestParameter("entryId");
         $securityType = $this->getRequestParameter("securityType");
         $securityPolicy = $this->getRequestParameter("securityPolicy");
         $prefix = $this->getRequestParameter("prefix");
         if ($prefix) {
             $prefix = "_";
         } else {
             $prefix = "";
         }
         for ($i = $startIndex; $i < $startIndex + $numOfWidgets; $i++) {
             $widget = new widget();
             if (!$i) {
                 $widget->setId($prefix . $partnerId . "_" . $uiConfId);
             } else {
                 $widget->setId($prefix . $partnerId . "_" . $uiConfId . "_" . $i);
             }
             $widget->setUiConfId($uiConfId);
             $widget->setPartnerId($partnerId);
             $widget->setSubpId($partnerId * 100);
             $widget->setEntryId($entryId);
             $widget->setSecurityType($securityType);
             $widget->setSecurityPolicy($securityPolicy);
             $widget->save();
         }
         $this->redirect("system/editUiconf?id=" . $uiConfId);
     }
     if ($uiConf) {
         $partner = PartnerPeer::retrieveByPK($uiConf->getPartnerId());
     } else {
         $uiConf = new uiConf();
         $partner = new Partner();
     }
     $this->widget = new widget();
     $this->uiConf = $uiConf;
     $this->partner = $partner;
 }
Ejemplo n.º 27
0
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @return     Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = new Criteria(uiConfPeer::DATABASE_NAME);
     $criteria->add(uiConfPeer::ID, $this->id);
     if ($this->alreadyInSave) {
         if ($this->isColumnModified(uiConfPeer::CUSTOM_DATA)) {
             if (!is_null($this->custom_data_md5)) {
                 $criteria->add(uiConfPeer::CUSTOM_DATA, "MD5(cast(" . uiConfPeer::CUSTOM_DATA . " as char character set latin1)) = '{$this->custom_data_md5}'", Criteria::CUSTOM);
             } else {
                 $criteria->add(uiConfPeer::CUSTOM_DATA, NULL, Criteria::ISNULL);
             }
         }
         if (count($this->modifiedColumns) == 2 && $this->isColumnModified(uiConfPeer::UPDATED_AT)) {
             $theModifiedColumn = null;
             foreach ($this->modifiedColumns as $modifiedColumn) {
                 if ($modifiedColumn != uiConfPeer::UPDATED_AT) {
                     $theModifiedColumn = $modifiedColumn;
                 }
             }
             $atomicColumns = uiConfPeer::getAtomicColumns();
             if (in_array($theModifiedColumn, $atomicColumns)) {
                 $criteria->add($theModifiedColumn, $this->getByName($theModifiedColumn, BasePeer::TYPE_COLNAME), Criteria::NOT_EQUAL);
             }
         }
     }
     return $criteria;
 }
Ejemplo n.º 28
0
    public static function getEmbedCode(entry $playlist, $wid, $ui_conf_id, $uid = null, $autoplay = null)
    {
        if ($playlist == null) {
            return "";
        }
        if (!$uid) {
            $uid = "0";
        }
        $partner_id = $playlist->getPartnerId();
        $subp_id = $playlist->getSubpId();
        $partner = PartnerPeer::retrieveByPK($partner_id);
        $host = myPartnerUtils::getHost($partner_id);
        $playlist_flashvars = self::toPlaylistUrl($playlist, $host);
        if ($wid == null) {
            $wid = $partner->getDefaultWidgetId();
        }
        $widget = widgetPeer::retrieveByPK($wid);
        // use the ui_conf from the widget only if it was not explicitly set
        if ($ui_conf_id == null) {
            $ui_conf_id = $widget->getUiConfId();
        }
        $ui_conf = uiConfPeer::retrieveByPK($ui_conf_id);
        if (!$ui_conf) {
            throw new kCoreException("Invalid uiconf id [{$ui_conf_id}] for widget [{$wid}]", APIErrors::INVALID_UI_CONF_ID);
        }
        //		$autoplay_str = $autoplay ? "autoPlay=true" : "autoPlay=false" ;
        $autoplay_str = "";
        $embed = <<<HTML
<object height="{$ui_conf->getHeight()}" width="{$ui_conf->getWidth()}" type="application/x-shockwave-flash" data="{$host}/kwidget/wid/{$wid}/ui_conf_id/{$ui_conf_id}" id="kaltura_playlist" style="visibility: visible;">\t\t
<param name="allowscriptaccess" value="always"/><param name="allownetworking" value="all"/><param name="bgcolor" value="#000000"/><param name="wmode" value="opaque"/><param name="allowfullscreen" value="true"/>
<param name="movie" value="{$host}/kwidget/wid/{$wid}/ui_conf_id/{$ui_conf_id}"/>
<param name="flashvars" value="layoutId=playlistLight&uid={$uid}&partner_id={$partner_id}&subp_id={$subp_id}&{$playlist_flashvars}"/></object>
HTML;
        return array($embed, $ui_conf->getWidth(), $ui_conf->getHeight());
    }
Ejemplo n.º 29
0
 <?php 
ini_set("memory_limit", "256M");
require_once __DIR__ . '/bootstrap.php';
if (!$argc) {
    die('pleas provide partner id as input' . PHP_EOL . 'to run script: ' . basename(__FILE__) . ' X' . PHP_EOL . 'whereas X is partner id' . PHP_EOL);
}
$partnerId = $argv[0];
$dbConf = kConf::getDB();
DbManager::setConfig($dbConf);
DbManager::initialize();
$c = new Criteria();
$c->add(uiConfPeer::SWF_URL, "%kcw%", Criteria::LIKE);
$c->add(uiConfPeer::OBJ_TYPE, uiConf::UI_CONF_TYPE_CW, Criteria::EQUAL);
$c->add(uiConfPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
$kcwUiconfs = uiConfPeer::doSelect($c);
if (!count($kcwUiconfs)) {
    exit;
}
$fileName = "/manual_uiconfs_paths.log";
$flog = fopen($fileName, 'a+');
//Run a loop for each uiConf to get its filesync key, thus acquiring its confile
foreach ($kcwUiconfs as $kcwUiconf) {
    /* @var $kcwUiconf uiConf */
    $kcwUiconfFilesyncKey = $kcwUiconf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA);
    $kcwConfile = kFileSyncUtils::file_get_contents($kcwUiconfFilesyncKey, false, false);
    if (!$kcwConfile) {
        continue;
    }
    $kcwConfileXML = new SimpleXMLElement($kcwConfile);
    $path = '//provider[@id="kaltura" or @name="kaltura"]';
    $nodesToRemove = $kcwConfileXML->xpath($path);
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     //myDbHelper::DB_HELPER_CONN_PROPEL2
     $this->saved = false;
     $uiConfId = $this->getRequestParameter("id");
     if ($uiConfId) {
         $uiConf = uiConfPeer::retrieveByPK($uiConfId);
     } else {
         $uiConf = new uiConf();
     }
     if ($this->getRequest()->getMethodName() == "POST") {
         $uiConf->setPartnerId($this->getRequestParameter("partnerId"));
         $uiConf->setSubpId($uiConf->getPartnerId() * 100);
         $uiConf->setObjType($this->getRequestParameter("type"));
         $uiConf->setName($this->getRequestParameter("name"));
         $uiConf->setWidth($this->getRequestParameter("width"));
         $uiConf->setHeight($this->getRequestParameter("height"));
         $uiConf->setCreationMode($this->getRequestParameter("creationMode"));
         $uiConf->setSwfUrl($this->getRequestParameter("swfUrl"));
         $uiConf->setConfVars($this->getRequestParameter("confVars"));
         $useCdn = $this->getRequestParameter("useCdn");
         $uiConf->setUseCdn($useCdn === "1" ? true : false);
         $uiConf->setDisplayInSearch($this->getRequestParameter("displayInSearch"));
         $uiConf->setConfVars($this->getRequestParameter("confVars"));
         $uiConf->setTags($this->getRequestParameter("tags"));
         /* files: */
         if ($uiConf->getCreationMode() != uiConf::UI_CONF_CREATION_MODE_MANUAL) {
             $confFile = $this->getRequestParameter("uiconf_confFile");
             $confFileFeatures = $this->getRequestParameter("uiconf_confFileFeatures");
             if ($uiConf->getConfFile() != $confFile || $uiConf->getConfFileFeatures() != $confFileFeatures) {
                 $uiConf->setConfFile($confFile);
                 $uiConf->setConfFileFeatures($confFileFeatures);
             }
         }
         $uiConf->save();
         $this->saved = true;
     }
     // so script won't die when uiconf is missing
     if (!$uiConf) {
         $uiConf = new uiConf();
     }
     $partner = PartnerPeer::retrieveByPK($uiConf->getPartnerId());
     $types = $uiConf->getUiConfTypeMap();
     $c = new Criteria();
     $c->add(widgetPeer::UI_CONF_ID, $uiConf->getId());
     $c->setLimit(1000);
     $widgets = widgetPeer::doSelect($c);
     $widgetsPerPartner = array();
     $this->tooMuchWidgets = false;
     if (count($widgets) == 1000) {
         $this->tooMuchWidgets = true;
     } else {
         if ($widgets) {
             foreach ($widgets as $widget) {
                 if (!array_key_exists($widget->getPartnerId(), $widgetsPerPartner)) {
                     $widgetsPerPartner[$widget->getPartnerId()] = 0;
                 }
                 $widgetsPerPartner[$widget->getPartnerId()]++;
             }
         }
     }
     // find the FileSync
     $fileSyncs = array();
     $fileSyncs[] = array("key" => $uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_DATA));
     $fileSyncs[] = array("key" => $uiConf->getSyncKey(uiConf::FILE_SYNC_UICONF_SUB_TYPE_FEATURES));
     foreach ($fileSyncs as &$fileSync) {
         $fileSync["fileSyncs"] = FileSyncPeer::retrieveAllByFileSyncKey($fileSync["key"]);
     }
     $this->fileSyncs = $fileSyncs;
     $this->widgetsPerPartner = $widgetsPerPartner;
     $this->directoryMap = $uiConf->getDirectoryMap();
     $this->swfNames = $uiConf->getSwfNames();
     $this->types = $types;
     $this->uiConf = $uiConf;
     $this->partner = $partner;
 }