public function getObject() { if ($this->m_object) { return $this->m_object; } $object_id = $this->object_id; if ($object_id == null) { return null; } switch ($this->getObjectType()) { case self::MODERATION_OBJECT_TYPE_KSHOW: $this->m_object = kshowPeer::retrieveByPK($object_id); break; case self::MODERATION_OBJECT_TYPE_ENTRY: // be able to fetch entries that are deleted entryPeer::allowDeletedInCriteriaFilter(); $this->m_object = entryPeer::retrieveByPK($object_id); entryPeer::blockDeletedInCriteriaFilter(); break; case self::MODERATION_OBJECT_TYPE_USER: // $object_id is the puser_id $puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($this->getPartnerId(), NULL, $object_id, true); if ($puser_kuser && $puser_kuser->getKuser()) { $this->m_object = $puser_kuser->getKuser(); } // $this->m_object = kuserPeer::retrieveByPK( $object_id ); break; } return $this->m_object; }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $kshow_id = $this->getP("kshow_id", kshow::KSHOW_ID_USE_DEFAULT); $entry = 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::KSHOW_ID_CREATE_NEW) { // if the partner allows - create a new kshow $kshow = myPartnerUtils::getDefaultKshow($partner_id, $subp_id, $puser_kuser, null, true); if ($kshow) { $kshow_id = $kshow->getId(); $entry = $kshow->getShowEntry(); // use the newly created kshow's roughcut } } else { $kshow = kshowPeer::retrieveByPK($kshow_id); } if (!$kshow) { // the partner is attempting to add an entry to some invalid or non-existing kwho $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id); return; } if (!$entry) { $entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $kshow->getProducerId(), "&auto_edit.jpg", ""); } $obj_wrapper = objectWrapperBase::getWrapperClass($entry, 0); $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $entry, $this->getObjectPrefix() . "_", array("name", "tags", "groupId", "partnerData", "permissions", "screenName", "description", "indexedCustomData1")); $entry->save(); $this->addMsg($this->getObjectPrefix(), objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_REGULAR)); $this->addDebug("added_fields", $fields_modified); }
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 = kshowPeer::retrieveByPK($kshow_id); } elseif ($kshow_indexedCustomData3) { $kshow = kshowPeer::retrieveByIndexedCustomData3($kshow_indexedCustomData3); } if (!$kshow) { $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id); } else { $newKshow = myKshowUtils::shalowCloneById($kshow_id, $puser_kuser->getKuserId()); if (!$newKshow) { $this->addError(APIErrors::KSHOW_CLONE_FAILED, $kshow_id); } else { $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR; $wrapper = objectWrapperBase::getWrapperClass($newKshow, $level); // TODO - remove this code when cache works properly when saving objects (in their save method) $wrapper->removeFromCache("kshow", $newKshow->getId()); $this->addMsg("kshow", $wrapper); } } }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $this->response_type = kalturaWebserviceRenderer::RESPONSE_TYPE_HTML; // $widget_id = $this->getP("widget_id"); $kshow_id = $this->getP("kshow_id"); $entry_id = $this->getP("entry_id"); $widget_type = $this->getP("widget_type", 1); // TODO -decide on a good default; if ($widget_id) { $this->addMsg("<b>", $this->createGenericWidgetHtml2($partner_id, $subp_id, $puser_id)); return; } if (in_array($partner_id, array(321, 449))) { $widget_type = 60; } list($kshow, $entry, $error, $error_obj) = myKshowUtils::getKshowAndEntry($kshow_id, $entry_id); if ($error_obj) { $this->addError($error_obj); return; } $kshow = kshowPeer::retrieveByPK($kshow_id); if (!$kshow) { $this->addMsg("<b>", "Error: no such {$kshow_id}"); return; } $this->addMsg("<b>", $this->createGenericWidgetHtml($partner_id, $subp_id, $kshow_id, $puser_id, $widget_type)); }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { if (!$puser_kuser) { $this->addError(APIErrors::INVALID_USER_ID, $puser_id); return; } $kshow_id = $this->getPM("kshow_id"); $kshow = kshowPeer::retrieveByPK($kshow_id); // even in case of an error - return the kshow object if (!$kshow) { $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id); return; } else { $desired_version = $this->getPM("kshow_version"); $result = $kshow->rollbackVersion($desired_version); if (!$result) { $this->addError(APIErrors::ERROR_KSHOW_ROLLBACK, $kshow_id, $desired_version); return; } } // after calling this method - most probably the state of the kshow has changed in the cache $wrapper = objectWrapperBase::getWrapperClass($kshow, objectWrapperBase::DETAIL_LEVEL_REGULAR); $wrapper->removeFromCache("kshow", $kshow_id); $this->addMsg("kshow", $wrapper); }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $obj_type = $this->getPM("obj_type"); $obj_id = $this->getPM("obj_id"); $command = $this->getPM("command"); $value = $this->getP("value"); $extra_info = $this->getP("extra_info"); if ($obj_type == "entry") { $entry = entryPeer::retrieveByPK($obj_id); if ($command == "view") { PartnerActivity::incrementActivity($partner_id, PartnerActivity::PARTNER_ACTIVITY_KDP, PartnerActivity::PARTNER_SUB_ACTIVITY_KDP_VIEWS); myStatisticsMgr::incEntryViews($entry); } elseif ($command == "play") { PartnerActivity::incrementActivity($partner_id, PartnerActivity::PARTNER_ACTIVITY_KDP, PartnerActivity::PARTNER_SUB_ACTIVITY_KDP_PLAYS); myStatisticsMgr::incEntryPlays($entry); } } elseif ($obj_type == "kshow") { $kshow = kshowPeer::retrieveByPK($obj_id); if ($command == "view") { PartnerActivity::incrementActivity($partner_id, PartnerActivity::PARTNER_ACTIVITY_KDP, PartnerActivity::PARTNER_SUB_ACTIVITY_KDP_VIEWS); myStatisticsMgr::incKshowViews($kshow); } elseif ($command == "play") { PartnerActivity::incrementActivity($partner_id, PartnerActivity::PARTNER_ACTIVITY_KDP, PartnerActivity::PARTNER_SUB_ACTIVITY_KDP_PLAYS); myStatisticsMgr::incKshowPlays($kshow); } } $this->addMsg("collectedStats", "{$obj_type}, {$obj_id}, {$command}, {$value}, {$extra_info}"); }
/** * If */ public static function createWidgetFromWidget($parent_widget_obj_or_id, $kshow_id, $entry_id = null, $ui_conf_id = null, $custom_data = null, $partner_data = null, $security_type = null) { if ($parent_widget_obj_or_id == null) { throw new Exception("Cannot createWidget from empty object"); } if ($parent_widget_obj_or_id instanceof widget) { $source_widget = $parent_widget_obj_or_id; } else { // assume its an id $source_widget = widgetPeer::retrieveByPK($parent_widget_obj_or_id); if (!$source_widget) { throw new Exception("Cannot createWidget from a none-existing widget [{$parent_widget_obj_or_id}]"); } } $kshow = null; $widget_kshow_id = $source_widget->getKshowId(); if (!$widget_kshow_id) { // fetch the kshow/entry according to the kshow_id/entry_id rules list($kshow, $entry, $error, $error_obj) = myKshowUtils::getKshowAndEntry($kshow_id, $entry_id); $widget_kshow_id = $kshow_id; if ($source_widget->getEntryId()) { $entry_id = $source_widget->getEntryId(); } } if (!$kshow) { $kshow = kshowPeer::retrieveByPK($widget_kshow_id); if (!$kshow) { return null; } } return self::createWidget($kshow, $entry_id, $source_widget, $ui_conf_id, $custom_data, $partner_data, $security_type); }
public function execute() { $this->getResponse()->setHttpHeader("Content-Type", "application/x-javascript"); $kshow_id = $this->getRequestParameter('kshow_id', 0); $uid = kuser::ANONYMOUS_PUSER_ID; $kshow = kshowPeer::retrieveByPK($kshow_id); if (!$kshow) { return sfView::ERROR; } // kshow_id might be a string (something like "15483str") but it will be returned using retriveByPK anyways // lets make sure we pass just the id to the contribution wizard $kshow_id = $kshow->getId(); $partner_id = $kshow->getPartnerId(); $partner = PartnerPeer::retrieveByPK($partner_id); $subp_id = $kshow->getSubpId(); $partner_secret = $partner->getSecret(); $partner_name = $partner->getPartnerName(); $kaltura_services = new startsessionAction(); $kaltura_services->setInputParams(array("format" => kalturaWebserviceRenderer::RESPONSE_TYPE_PHP_ARRAY, "partner_id" => $partner_id, "subp_id" => $subp_id, "uid" => $uid, "secret" => $partner_secret)); $result = $kaltura_services->internalExecute(); $this->ks = @$result["result"]["ks"]; $this->widget_host = requestUtils::getHost(); $this->kshow_id = $kshow_id; $this->uid = $uid; $this->partner_id = $partner_id; $this->subp_id = $subp_id; $this->partner_name = $partner_name; return sfView::SUCCESS; }
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); } }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $kshow_id = $this->getP("kshow_id"); $detailed = $this->getP("detailed", false); $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR; $widget_size = $this->getP("size"); $kshow_from_db = null; if ($kshow_id) { $kshow_from_db = kshowPeer::retrieveByPK($kshow_id); } if ($kshow_from_db) { $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, $level)); $this->addMsg("already_exists_objects", 1); $this->addDebug("already_exists_objects", 1); } else { // no kshow to be found - creae a new one parent::executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser); } // create widget code for the new kshow $kshow = $this->getMsg("kshow"); $kshow_id = $kshow->id; list($genericWidget, $myspaceWidget) = myKshowUtils::getEmbedPlayerUrl($kshow_id, null, false, ""); $code = array("generic_code" => $genericWidget, "myspace_code" => $myspaceWidget); $this->addMsg("widget_code", $code); }
public function execute() { $this->forceSystemAuthentication(); $kshow_id = @$_REQUEST["kshow_id"]; $this->kshow_id = $kshow_id; $this->kshow = NULL; $entry_id = @$_REQUEST["entry_id"]; $this->entry_id = $entry_id; $this->entry = NULL; $this->message = ""; if (!empty($kshow_id)) { $this->kshow = kshowPeer::retrieveByPK($kshow_id); if (!$this->kshow) { $this->message = "Cannot find kshow [{$kshow_id}]"; } else { $this->entry = $this->kshow->getShowEntry(); } } elseif (!empty($kshow_id)) { $this->entry = entryPeer::retrieveByPK($entry_id); if (!$this->entry) { $this->message = "Cannot find entry [{$entry_id}]"; } else { $this->kshow = $this->{$this}->entry->getKshow(); } } if ($this->kshow) { $this->metadata = $this->kshow->getMetadata(); } else { $this->metadata = ""; } $pending_str = $this->getP("pending"); $remove_pending = $this->getP("remove_pending"); if ($this->metadata && ($remove_pending || $pending_str)) { if ($remove_pending) { $pending_str = ""; } $xml_doc = new DOMDocument(); $xml_doc->loadXML($this->metadata); $metadata = kXml::getFirstElement($xml_doc, "MetaData"); $should_save = kXml::setChildElement($xml_doc, $metadata, "Pending", $pending_str, true); if ($remove_pending) { $should_save = kXml::setChildElement($xml_doc, $metadata, "LastPendingTimeStamp", "", true); } if ($should_save) { $fixed_content = $xml_doc->saveXML(); $content_dir = myContentStorage::getFSContentRootPath(); $file_name = realpath($content_dir . $this->entry->getDataPath()); $res = file_put_contents($file_name, $fixed_content); // sync - NOTOK $this->metadata = $fixed_content; } } $this->pending = $pending_str; $this->kshow_id = $kshow_id; $this->entry_id = $entry_id; }
public static function getKshowEntryId($kshow_id, $entry_id) { if ($entry_id == -1) { $kshow = kshowPeer::retrieveByPK($kshow_id); if ($kshow) { $entry_id = $kshow->getShowEntryId(); } } return $entry_id; }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $kshow_id_to_delete = $this->getPM("kshow_id"); $kshow_to_delete = kshowPeer::retrieveByPK($kshow_id_to_delete); if (!$kshow_to_delete) { $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id_to_delete); return; } $kshow_to_delete->delete(); myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_DELETE, $kshow_to_delete); $this->addMsg("deleted_kshow", objectWrapperBase::getWrapperClass($kshow_to_delete, objectWrapperBase::DETAIL_LEVEL_REGULAR)); }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { // get the new properties for the kuser from the request $dvd_entry = new entry(); $this->getTypeAndMediaType($dvd_entry); // important to set type before the auto-fill so the setDataContent will work properly $dvd_entry->setLengthInMsecs(0); $obj_wrapper = objectWrapperBase::getWrapperClass($dvd_entry, 0); $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $dvd_entry, $this->getObjectPrefix() . "_", $obj_wrapper->getUpdateableFields()); // check that mandatory fields were set // TODO $new_widget = null; if (count($fields_modified) > 0) { $kshow_id = $this->getP("kshow_id", kshow::KSHOW_ID_USE_DEFAULT); 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::KSHOW_ID_CREATE_NEW) { // if the partner allows - create a new kshow $kshow = myPartnerUtils::getDefaultKshow($partner_id, $subp_id, $puser_kuser, null, true); if ($kshow) { $kshow_id = $kshow->getId(); } } else { $kshow = kshowPeer::retrieveByPK($kshow_id); } if (!$kshow) { // the partner is attempting to add an entry to some invalid or non-existing kwho $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id); return; } // force the type and media type // TODO - set the kshow to some default kshow of the partner - maybe extract it from the custom_data of this specific partner $dvd_entry->setKshowId($kshow_id); $dvd_entry->setStatus(entryStatus::READY); $dvd_entry->setPartnerId($partner_id); $dvd_entry->setSubpId($subp_id); $dvd_entry->setKuserId($puser_kuser->getKuserId()); $dvd_entry->setCreatorKuserId($puser_kuser->getKuserId()); $dvd_entry->save(); $this->addMsg($this->getObjectPrefix(), objectWrapperBase::getWrapperClass($dvd_entry, objectWrapperBase::DETAIL_LEVEL_DETAILED)); $this->addDebug("added_fields", $fields_modified); } else { $this->addError(APIErrors::NO_FIELDS_SET_FOR_GENERIC_ENTRY, $this->getObjectPrefix()); } }
/** * Will forward to the the thumbnail of the kshows using the widget id */ public function execute() { $widget_id = $this->getRequestParameter("wid"); $widget = widgetPeer::retrieveByPK($widget_id); if (!$widget) { die; } // because of the routing rule - the entry_id & kmedia_type WILL exist. be sure to ignore them if smaller than 0 $kshow_id = $widget->getKshowId(); if ($kshow_id) { $kshow = kshowPeer::retrieveByPK($kshow_id); if ($kshow->getShowEntry()) { $this->redirect($kshow->getShowEntry()->getBigThumbnailUrl()); } } }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $kshow_id = $this->getPM("kshow_id"); $rank = $this->getPM("rank"); $kshow = kshowPeer::retrieveByPK($kshow_id); if (!$kshow) { $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id); return; } if ($rank > entry::MAX_NORMALIZED_RANK || $rank < 0 || !is_numeric($rank)) { $this->addError(APIErrors::INVALID_RANK, $rank); return; } $kuser_id = $puser_kuser->getKuserId(); $entry_id = $kshow->getShowEntryId(); $partner = PartnerPeer::retrieveByPK($partner_id); if (!$partner->getAllowAnonymousRanking()) { // prevent duplicate votes $c = new Criteria(); $c->add(kvotePeer::KUSER_ID, $kuser_id); $c->add(kvotePeer::ENTRY_ID, $entry_id); $c->add(kvotePeer::KSHOW_ID, $kshow_id); $kvote = kvotePeer::doSelectOne($c); if ($kvote != NULL) { $this->addError(APIErrors::USER_ALREADY_RANKED_KSHOW, $puser_id, $kshow_id); return; } } $kvote = new kvote(); $kvote->setKshowId($kshow_id); $kvote->setEntryId($entry_id); $kvote->setKuserId($kuser_id); $kvote->setRank($rank); $kvote->save(); $statistics_results = $kvote->getStatisticsResults(); $updated_kshow = @$statistics_results["kshow"]; if ($updated_kshow) { myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_RANK, $updated_kshow); $data = array("kshow_id" => $kshow_id, "uid" => $puser_id, "rank" => $updated_kshow->getRank(), "votes" => $updated_kshow->getVotes()); //$this->addMsg ( "kshow" , objectWrapperBase::getWrapperClass( $updated_kshow , objectWrapperBase::DETAIL_LEVEL_DETAILED) ); $this->addMsg("rank", $data); } }
public function createMetadata($kshow_id) { // echo ( "createMetadata for [$kshow_id]\n" ); $kshow = kshowPeer::retrieveByPK($kshow_id); $show_entry_id = $kshow->getShowEntryId(); $intro_id = $kshow->getIntroId(); // fetch all entries for a kshow without the kshow entry or the intro // the order is ascending by creation date of the entry // if ordering by ascending ID - the intro will always be first $c = new Criteria(); $c->add(entryPeer::KSHOW_ID, $kshow_id); $c->add(entryPeer::ID, array($show_entry_id, $intro_id), Criteria::NOT_IN); // $c->addDescendingOrderByColumn('(' . entryPeer::ID . '=' . $intro_id . ')'); $c->addAscendingOrderByColumn(entryPeer::ID); // $c->add ( entryPeer::STATUS , entryStatus::READY ); // $c->addAscendingOrderByColumn( entryPeer::CREATED_AT ); $entry_list = entryPeer::doSelect($c); // echo ( "kshow [$kshow_id] has " . count ( $entry_list ) . " entries\n" ); return $this->createMetadataForList($entry_list); }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { // get the new properties for the kuser from the request $widget = new widget(); $obj_wrapper = objectWrapperBase::getWrapperClass($widget, 0); $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $widget, "widget_", $obj_wrapper->getUpdateableFields()); // check that mandatory fields were set // TODO $new_widget = null; if (count($fields_modified) > 0) { // see if to create a widget from a widget or from a kshow if ($widget->getSourceWidgetId()) { $widget_from_db = widgetPeer::retrieveByPK($widget->getSourceWidgetId()); $new_widget = widget::createWidgetFromWidget($widget_from_db, $widget->getKshowId(), $widget->getEntryId(), $widget->getUiConfId(), $widget->getCustomData(), $widget->getPartnerData(), $widget->getSecurityType()); if (!$new_widget) { $this->addError(APIErrors::INVALID_KSHOW_AND_ENTRY_PAIR, $widget->getKshowId(), $widget->getEntryId()); return; } } else { $kshow_id = $widget->getKshowId(); if ($kshow_id) { $kshow = kshowPeer::retrieveByPK($kshow_id); if (!$kshow) { $this->addError(APIErrors::KSHOW_DOES_NOT_EXISTS); // This field in unique. Please change "); return; } } else { $kshow = new kshow(); $kshow->setId(0); $kshow->setPartnerId($partner_id); $kshow->setSubpId($subp_id); } $new_widget = widget::createWidget($kshow, $widget->getEntryId(), null, $widget->getUiConfId(), $widget->getCustomData(), $widget->getPartnerData(), $widget->getSecurityType()); } $this->addMsg("widget", objectWrapperBase::getWrapperClass($new_widget, objectWrapperBase::DETAIL_LEVEL_DETAILED)); $this->addDebug("added_fields", $fields_modified); } else { $this->addError(APIErrors::NO_FIELDS_SET_FOR_WIDGET); } }
public function execute() { $hdr = "text/xml; charset=utf-8"; $this->response->setHttpHeader("Content-Type", $hdr); $movie = $this->getP("movie"); if ($movie) { //@list ( $obj_type , $id ) = explode ( "_" , $movie ); // Gonen 28/03/2010: changed code to support both Andromeda style entry ID (0_XXX....) and old style entry ID (chars only) $obj_type = @substr($movie, 0, strpos($movie, '_')); $id = @str_replace($obj_type . '_', '', $movie); if ($obj_type == "entry") { return $this->renderText(self::renderEntry($id)); } else { $kshow = kshowPeer::retrieveByPK($id); if ($kshow) { return $this->renderText(self::renderEntry($kshow->getShowEntryId())); } } } return $this->renderText("OK"); }
public static function getExtData($kshow_id, $partner_id) { $kshow = kshowPeer::retrieveByPK($kshow_id); $show_entry_id = $kshow->getShowEntryId(); $show_entry = entryPeer::retrieveByPK($show_entry_id); $show_entry_data_key = $show_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA); if ($show_entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_SHOW) { return array(null, null); } $content = kFileSyncUtils::file_get_contents($show_entry_data_key); if ($content == "") { return array(null, null); } $xml_doc = new DOMDocument(); $xml_doc->loadXML($content); $xpath = new DOMXPath($xml_doc); $extDataNodelist = $xpath->query("//ExtData[@partner_id='{$partner_id}']"); $node = null; if ($extDataNodelist && $extDataNodelist->length) { $node = $extDataNodelist->item(0); } return array($xml_doc, $node); }
protected function getKshow($partner_id, $subp_id, $puser_kuser, $kshow_id, $entry) { 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::KSHOW_ID_CREATE_NEW) { // if the partner allows - create a new kshow $kshow = myPartnerUtils::getDefaultKshow($partner_id, $subp_id, $puser_kuser, null, true); if ($kshow) { $kshow_id = $kshow->getId(); } } else { $kshow = kshowPeer::retrieveByPK($kshow_id); } if (!$kshow) { // the partner is attempting to add an entry to some invalid or non-existing kwho $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id); return; } return $kshow; }
/** * 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(); $valid_image_types = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP); $image_type = exif_imagetype($src_full_path); if (!in_array($image_type, $valid_image_types)) { // capture full frame myFileConverter::captureFrame($src_full_path, $thumb_full_path, 1, "image2", -1, -1, 3); if (!file_exists($thumb_full_path)) { myFileConverter::captureFrame($src_full_path, $thumb_full_path, 1, "image2", -1, -1, 0); } $src_full_path = $thumb_full_path; } // and resize it myFileConverter::convertImage($src_full_path, $thumb_full_path, $width, $height, $type, $bgcolor, true, $quality, $src_x, $src_y, $src_w, $src_h, $density, $stripProfiles); kFile::dumpFile($thumb_full_path); } else { KalturaLog::debug("token_id [{$upload_token_id}] not found in DC [" . kDataCenterMgr::getCurrentDcId() . "]. dump url to romote DC"); $remoteUrl = kDataCenterMgr::getRemoteDcExternalUrlByDcId(1 - kDataCenterMgr::getCurrentDcId()) . $_SERVER['REQUEST_URI']; kFile::dumpUrl($remoteUrl); } } } if ($entry_id) { $entry = entryPeer::retrieveByPKNoFilter($entry_id); if (!$entry) { // problem could be due to replication lag kFile::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrlByDcId(1 - kDataCenterMgr::getCurrentDcId())); } } else { // get the widget $widget = widgetPeer::retrieveByPK($widget_id); if (!$widget) { KExternalErrors::dieError(KExternalErrors::ENTRY_AND_WIDGET_NOT_FOUND); } // get the kshow $kshow_id = $widget->getKshowId(); $kshow = kshowPeer::retrieveByPK($kshow_id); if ($kshow) { $entry_id = $kshow->getShowEntryId(); } else { $entry_id = $widget->getEntryId(); } $entry = entryPeer::retrieveByPKNoFilter($entry_id); if (!$entry) { KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND); } } $partner = $entry->getPartner(); if ($density == 0) { $density = $partner->getDefThumbDensity(); } $thumbParams = new kThumbnailParameters(); $thumbParams->setSupportAnimatedThumbnail($partner->getSupportAnimatedThumbnails()); if (is_null($stripProfiles)) { $stripProfiles = $partner->getStripThumbProfile(); } //checks whether the thumbnail display should be restricted by KS $base64Referrer = $this->getRequestParameter("referrer"); $referrer = base64_decode($base64Referrer); if (!is_string($referrer)) { $referrer = ""; } // base64_decode can return binary data if (!$referrer) { $referrer = kApiCache::getHttpReferrer(); } $ksStr = $this->getRequestParameter("ks"); $securyEntryHelper = new KSecureEntryHelper($entry, $ksStr, $referrer, accessControlContextType::THUMBNAIL); $securyEntryHelper->validateForPlay(); // multiply the passed $src_* values so that they will relate to the original image size, according to $src_display_* if ($rel_width != -1) { $widthRatio = $entry->getWidth() / $rel_width; $src_x = $src_x * $widthRatio; $src_w = $src_w * $widthRatio; } if ($rel_height != -1) { $heightRatio = $entry->getHeight() / $rel_height; $src_y = $src_y * $heightRatio; $src_h = $src_h * $heightRatio; } $subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB; if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) { $subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA; } KalturaLog::debug("get thumbnail filesyncs"); $dataKey = $entry->getSyncKey($subType); list($file_sync, $local) = kFileSyncUtils::getReadyFileSyncForKey($dataKey, true, false); $tempThumbPath = null; $entry_status = $entry->getStatus(); // both 640x480 and 0x0 requests are probably coming from the kdp // 640x480 - old kdp version requesting thumbnail // 0x0 - new kdp version requesting the thumbnail of an unready entry // we need to distinguish between calls from the kdp and calls from a browser: <img src=...> // that can't handle swf input if (($width == 640 && $height == 480 || $width == 0 && $height == 0) && ($entry_status == entryStatus::PRECONVERT || $entry_status == entryStatus::IMPORT || $entry_status == entryStatus::ERROR_CONVERTING || $entry_status == entryStatus::DELETED)) { $contentPath = myContentStorage::getFSContentRootPath(); $msgPath = $contentPath . "content/templates/entry/bigthumbnail/"; if ($entry_status == entryStatus::DELETED) { $msgPath .= $entry->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK ? "entry_blocked.swf" : "entry_deleted.swf"; } else { $msgPath .= $entry_status == entryStatus::ERROR_CONVERTING ? "entry_error.swf" : "entry_converting.swf"; } kFile::dumpFile($msgPath, null, 0); } if (!$file_sync) { $tempThumbPath = $entry->getLocalThumbFilePath($entry, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, $density, $stripProfiles, $flavor_id, $file_name); if (!$tempThumbPath) { KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC); } } if (!$local && !$tempThumbPath && $file_sync) { if (!in_array($file_sync->getDc(), kDataCenterMgr::getDcIds())) { $remoteUrl = $file_sync->getExternalUrl($entry->getId()); header("Location: {$remoteUrl}"); die; } $remoteUrl = kDataCenterMgr::getRedirectExternalUrl($file_sync, $_SERVER['REQUEST_URI']); kFile::dumpUrl($remoteUrl); } // if we didnt return a template for the player die and dont return the original deleted thumb if ($entry_status == entryStatus::DELETED) { KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED); } if (!$tempThumbPath) { try { $tempThumbPath = myEntryUtils::resizeEntryImage($entry, $version, $width, $height, $type, $bgcolor, $crop_provider, $quality, $src_x, $src_y, $src_w, $src_h, $vid_sec, $vid_slice, $vid_slices, null, $density, $stripProfiles, $thumbParams); } catch (Exception $ex) { if ($ex->getCode() != kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC) { KalturaLog::log("Error - resize image failed"); KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC); } // get original flavor asset $origFlavorAsset = assetPeer::retrieveOriginalByEntryId($entry_id); if (!$origFlavorAsset) { KalturaLog::log("Error - no original flavor for entry [{$entry_id}]"); KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND); } $syncKey = $origFlavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET); $remoteFileSync = kFileSyncUtils::getOriginFileSyncForKey($syncKey, false); if (!$remoteFileSync) { // file does not exist on any DC - die KalturaLog::log("Error - no FileSync for entry [{$entry_id}]"); KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC); } if ($remoteFileSync->getDc() == kDataCenterMgr::getCurrentDcId()) { KalturaLog::log("ERROR - Trying to redirect to myself - stop here."); KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC); } if (!in_array($remoteFileSync->getDc(), kDataCenterMgr::getDcIds())) { KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC); } $remoteUrl = kDataCenterMgr::getRedirectExternalUrl($remoteFileSync); kFile::dumpUrl($remoteUrl); } } $nocache = strpos($tempThumbPath, "_NOCACHE_") !== false; if ($securyEntryHelper->shouldDisableCache() || kApiCache::hasExtraFields() || !$securyEntryHelper->isKsWidget() && $securyEntryHelper->hasRules()) { $nocache = true; } // notify external proxy, so it'll cache this url if (!$nocache && requestUtils::getHost() == kConf::get("apphome_url") && file_exists($tempThumbPath)) { self::notifyProxy($_SERVER["REQUEST_URI"]); } // cache result if (!$nocache) { $requestKey = $_SERVER["REQUEST_URI"]; $cache = new myCache("thumb", 86400 * 30); // 30 days $cache->put($requestKey, $tempThumbPath); } kFile::dumpFile($tempThumbPath, null, $nocache ? 0 : null); // TODO - can delete from disk assuming we caneasily recreate it and it will anyway be cached in the CDN // however dumpfile dies at the end so we cant just write it here (maybe register a shutdown callback) }
public function execute() { requestUtils::handleConditionalGet(); // set the memory size to be able to serve big files in a single chunk ini_set("memory_limit", "64M"); // set the execution time to be able to serve big files in a single chunk ini_set("max_execution_time", 240); $meta = $this->getRequestParameter("meta", false); $file_info = $this->getRequestParameter("file_info"); $this->entry_id = 0; $this->kshow_id = 0; $version = $this->getRequestParameter("version", null); // returned the version feature to allow rollback $addPadding = false; if (!empty($file_info)) { $file_info_arr = explode("-", $file_info); // the format of file_info is assumed <kshow_id>-<video|audio|voice>-<1|2|3> // OR // e<entry_id>-<video|audio|voice>-<1|2|3> if (count($file_info_arr) == 0) { $this->error = "Invalid request format [{$file_info}]"; return sfView::ERROR; } if ($file_info_arr[0][0] == 'e') { $this->entry_id = substr($file_info_arr[0], 1); } else { $this->kshow_id = $file_info_arr[0]; } if (count($file_info_arr) == 1) { // on this case we assume that the single info parameter is an entry id // we redirect to it ! $entry = entryPeer::retrieveByPK($this->entry_id); if (!$entry) { // very bad - no such entry !! echo "no entry " . $this->entry_id; die; } $dataKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA); // replaced__getDataPath $path = kFileSyncUtils::getReadyLocalFilePathForKey($dataKey); $host = requestUtils::getHost(); $this->redirect($host . $path); } $this->timeline = $file_info_arr[1]; if (count($file_info_arr) > 2) { // this migth include a .flv suffix $last_token = $file_info_arr[2]; $last_token_srr = explode(".", $last_token); $this->streamNum = $last_token_srr[0]; if (count($file_info_arr) > 3) { $version = $file_info_arr[3]; } if (count($file_info_arr) > 4 && $file_info_arr[4] == "padding") { $addPadding = true; } } else { $this->streamNum = 3; } } else { $this->kshow_id = @$_GET["kshow_id"]; $this->entry_id = @$_GET["entry_id"]; $this->timeline = @$_GET["timeline"]; $this->streamNum = $this->getRequestParameter('num', 3); } $entry = null; if ($this->entry_id) { $entry = entryPeer::retrieveByPK($this->entry_id); if (!$entry) { $this->error = "No such entry " . $this->entry_id; return sfView::ERROR; } $this->kshow_id = $entry->getKshowId(); } $kshow = kshowPeer::retrieveByPK($this->kshow_id); if (!$kshow) { $this->error = "No such kshow " . $this->kshow_id; return sfView::ERROR; } if (!$entry) { // if we received only the kshow (old widgets) retrieve the entry $entry = entryPeer::retrieveByPK($kshow->getShowEntryId()); } if (!$entry) { $this->error = "No such entry for kshow " . $this->kshow_id; return sfView::ERROR; } // update the widget log only for video && stream 1 if ($this->timeline == "video" && $this->streamNum == 1) { $referer = @$_SERVER['HTTP_REFERER']; //since we're using a cdn this is useless //$kshow->incPlays(); //WidgetLog::incPlaysIfExists( $this->kshow_id , $this->entry_id ); } $dataKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $version); // replaced__getDataPath $path = kFileSyncUtils::getReadyLocalFilePathForKey($dataKey); $this->flv_streamer = new myFlvStreamer($path, $this->timeline, $this->streamNum, $addPadding); $this->total_length = $this->flv_streamer->getTotalLength(true); // $total_length; //$this->getController()->setRenderMode ( sfView::RENDER_CLIENT ); myStatisticsMgr::saveAllModified(); //if ( $meta ) return "Meta"; return sfView::SUCCESS; }
public function execute() { $this->forceSystemAuthentication(); $source_kshow_id = $this->getP("source_kshow_id"); $target_kshow_id = $this->getP("target_kshow_id"); $kuser_names = $this->getP("kuser_names"); $reset = $this->getP("reset"); if ($reset) { $source_kshow_id = null; $target_kshow_id = null; $kuser_names = null; } $mode = 0; // view if ($source_kshow_id && $target_kshow_id && $kuser_names) { $mode = 1; // review $list_of_kuser_names = explode(",", $kuser_names); foreach ($list_of_kuser_names as &$name) { $name = trim($name); } $source_kshow = kshowPeer::retrieveByPK($source_kshow_id); $target_kshow = kshowPeer::retrieveByPK($target_kshow_id); $target_partner_id = $target_kshow->getPartnerId(); $target_subp_id = $target_kshow->getSubpId(); $c = new Criteria(); // select only the kusers of the correct partner_id $c->add(kuserPeer::SCREEN_NAME, $list_of_kuser_names, Criteria::IN); $c->setLimit(10); //$c->add ( kuserPeer::PARTNER_ID , $target_partner_id ); $list_of_kusers = kuserPeer::doSelect($c); $producer = kuserPeer::retrieveByPK($target_kshow->getProducerId()); $list_of_kusers[] = $producer; $c->add(kuserPeer::PARTNER_ID, $target_partner_id); $list_of_valid_kusers = kuserPeer::doSelect($c); $list_of_valid_kusers[] = $producer; $c = new Criteria(); $c->add(entryPeer::KSHOW_ID, $source_kshow_id); $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP); $c->add(entryPeer::STATUS, entryStatus::READY); $entries = entryPeer::doSelectJoinAll($c); $entry_kusers = array(); // assign each entry to a kuser foreach ($entries as $entry) { $place_in_array = count($entry_kusers) % count($list_of_valid_kusers); $kuser = $list_of_valid_kusers[$place_in_array]; $entry_kusers[$entry->getId()] = $kuser->getId(); } $clone = $this->getP("clone"); if ($clone == 'true') { $mode = 2; // clone $entry_id_map = array(); // will be used to map the source->target entries $entry_cache = array(); // will be used to cache all relevat entries $new_entry_list = array(); $failed_entry_list = array(); foreach ($entries as $entry) { try { $kuser_id = $entry_kusers[$entry->getId()]; $override_fields = $entry->copy(); $override_fields->setPartnerId($target_kshow->getPartnerId()); $override_fields->setSubpId($target_kshow->getSubpId()); $override_fields->setKuserId($kuser_id); $override_fields->setCreatorKuserId($kuser_id); $new_entry = myEntryUtils::deepClone($entry, $target_kshow_id, $override_fields, false); $new_entry_list[] = $new_entry; // will help fix the metadata entries $entry_id_map[$entry->getId()] = $new_entry->getId(); $entry_cache[$entry->getId()] = $entry; $entry_cache[$new_entry->getId()] = $new_entry; } catch (Exception $ex) { $failed_entry_list[] = $entry; } // echo "entry [{$entry->getId()}] copied<br>"; flush(); } // now clone the show_entry $new_show_entry = $target_kshow->getShowEntry(); myEntryUtils::deepCloneShowEntry($source_kshow->getShowEntry(), $new_show_entry, $entry_id_map, $entry_cache); $new_entry_list[] = $new_show_entry; $entries = $new_entry_list; $entry_kusers = null; } // echo "ended!<bR>"; flush(); } $this->source_kshow_id = @$source_kshow_id; $this->target_kshow_id = @$target_kshow_id; $this->partner_id = @$target_partner_id; $this->source_kshow = @$source_kshow; $this->target_kshow = @$target_kshow; $this->kuser_names = @$kuser_names; $this->list_of_kusers = @$list_of_kusers; $this->entries = @$entries; $this->mode = $mode; $this->entry_kusers = @$entry_kusers; // echo "going to template!<bR>"; flush(); }
public function execute() { $kshow_id = $this->getRequestParameter("kshow_id", "0"); $entry_id = $this->getRequestParameter("entry_id", "0"); $cmd = $this->getRequestParameter("cmd", ""); $links_str = $this->getRequestParameter("kdata", ""); if ($links_str) { $links_arr = @unserialize(base64_decode(str_replace(array("|02", "|01"), array("/", "|"), $links_str))); //if $cmd is one of the following - // add , edit , kshow $link_to_follow = @$links_arr[$cmd]; if ($link_to_follow) { // if the link is relative we concatenate it to the "base" link if (strstr($link_to_follow, "http") !== 0) { $link_to_follow = @$links_arr['base'] . $link_to_follow; } header("status:302"); header("location: {$link_to_follow}"); die; } } if ($entry_id == -1) { $kshow = kshowPeer::retrieveByPK($kshow_id); if (!$kshow) { $this->redirect('corp/userzone'); } else { $entry_id = $kshow->getShowEntryId(); } } if ($entry_id == 1002) { $this->redirect('corp/userzone'); } if ($entry_id) { $entry = entryPeer::retrieveByPK($entry_id); if ($entry) { if (!$kshow_id || $kshow_id == -1) { $kshow_id = $entry->getKshowId(); } if (!@$kshow) { $kshow = kshowPeer::retrieveByPK($kshow_id); if (!$kshow) { $this->redirect('corp/userzone'); } if (!$kshow->getPartnerId() && !$this->forceViewPermissions($kshow, $kshow_id, false, false)) { $this->redirect('corp/userzone'); } } if ($cmd == "contribute" || $cmd == "contriubte" || $cmd == "add") { if (!$kshow->getPartnerId() && !$this->forceContribPermissions($kshow, $kshow_id, false, false)) { $this->redirect('corp/userzone'); } //$this->getContext()->getResponse()->setCookie( 'browseCmd', 'contribute', time() + 31536000 , '/' ); //$this->redirect( "/browse/browse2?kshow_id=$kshow_id&entry_id=$entry_id&browseCmd=contribute" ); $this->redirect("/corp/contribute?kshow_id={$kshow_id}&entry_id={$entry_id}&__temp=1"); } else { if ($cmd == "edit") { if ($entry->getType() != entryType::MIX) { $kshow = kshowPeer::retrieveByPK($kshow_id); if (!$kshow) { $this->redirect('corp/userzone'); } else { $entry_id = $kshow->getShowEntryId(); } } $this->redirect("/edit/defEdit?kshow_id={$kshow_id}&entry_id={$entry_id}"); } } } } }
public function getkshow(PropelPDO $con = null) { return kshowPeer::retrieveByPK($this->kshow_id, $con); }
/** * const COMMENT_TYPE_KSHOW = 1; const COMMENT_TYPE_DISCUSSION = 2; const COMMENT_TYPE_USER = 3; const COMMENT_TYPE_SHOUTOUT = 4; * */ public static function addComment(comment $comment) { $obj = NULL; $type = $comment->getCommentType(); $id = $comment->getSubjectId(); if ($type == comment::COMMENT_TYPE_KSHOW || $type == comment::COMMENT_TYPE_SHOUTOUT || $type == comment::COMMENT_TYPE_DISCUSSION) { $obj = kshowPeer::retrieveByPK($id); if ($obj) { $v = $obj->getComments(); self::inc($v); $obj->setComments($v); } } elseif ($type == comment::COMMENT_TYPE_USER) { /* $obj = kuserPeer::retrieveByPK( $id ); $v = $obj->getComments () ; self::inc ( $v ); $obj->setComments ( $v ); */ } // TODO - what about the other types ? if ($obj != NULL) { self::add($obj); } }
public static function createRoughcutThumbnailFromEntry($source_entry, $should_force = false) { $kshow = kshowPeer::retrieveByPK($source_entry->getKshowId()); if (!$kshow) { KalturaLog::log("Error: entry [" . $source_entry->getId() . "] does not have a kshow"); return false; } if ($kshow) { $roughcut = $kshow->getShowEntry(); if (!$roughcut) { KalturaLog::log("Error: entry [" . $source_entry->getId() . "] from kshow " . $kshow->getId() . "] does not have a roughcut "); return false; } return self::createRoughcutThumbnail($roughcut, $source_entry, $should_force); } else { return false; } }
protected function forceProducerOnly($partner_id, $puser_id, $kshow_id) { $kshow = kshowPeer::retrieveByPK($kshow_id); if (!$kshow) { $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id); throw new Exception(); } if ($kshow->getProducerId() != $kshow_id) { $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id); throw new Exception(); } }
public static function createMakeoverRoughcut($kshow_id) { $c = new Criteria(); $c->add(entryPeer::KSHOW_ID, $kshow_id); $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP); $c->add(entryPeer::STATUS, entryStatus::READY); $entries = entryPeer::doSelect($c); $kshow = kshowPeer::retrieveByPK($kshow_id); self::createKEditorMetadata($kshow, $kshow->getShowEntry(), $entries); }