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;
 }
 /**
 	return array('status' => $status, 'message' => $message, 'objects' => $objects);
 		objects - array of
 				'thumb' 
 				'title'  
 				'description' 
 				'id' - unique id to be passed to getMediaInfo 
 */
 public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
 {
     $status = "ok";
     $message = '';
     $objects = array();
     @(list($searchTerm, $requestedPageSize, $numResults, $repeatOldResults) = explode(",", $searchText));
     if ($requestedPageSize > 0) {
         $pageSize = $requestedPageSize;
     }
     $already_returned = ($page - 1) * $pageSize;
     $num_of_entries_to_return = min($pageSize, $numResults - $already_returned);
     $i = 0;
     for ($i = 0; $i < $num_of_entries_to_return; ++$i) {
         $host_num = 1 + $i % 7;
         $host = requestUtils::getHost();
         $url = "{$host}/qa/images.php?id=";
         $id = ($page - 1) * $pageSize + $i;
         if ($repeatOldResults > 0) {
             $id = $id % $repeatOldResults;
         }
         $id = 1 + $id;
         // do we want it to be 0-based or 1-based ??
         $playback = $i % 2 ? "none" : "";
         $object = array("id" => "id-{$id}", "thumb" => $url . $id, "tags" => "tags-{$id}, {$searchTerm}", "title" => "title-{$id}", "description" => "description-{$id}", "flash_playback_type" => $playback);
         $objects[] = $object;
     }
     return array('status' => $status, 'message' => $message, 'objects' => $objects);
 }
function createSelect($id, $name, $default_value, $list_name)
{
    $prefix = "partner_";
    $host = requestUtils::getHost();
    // TODO - all static lists should move out of this function !!
    if (strpos($host, "localhost") != false) {
        $limited = false;
    } else {
        if (strpos($host, "kaldev") !== false) {
            $limited = false;
        } else {
            $limited = true;
        }
    }
    //global $arrays;
    $media_type_list = array("1" => "Video", "2" => "Image", "5" => "Audio");
    $media_source_list = array("20" => "Kaltura", "21" => "MyClips", "23" => "KalturaPartner", "1" => "* File", "2" => "* Webcam", "3" => "Flickr", "4" => "YouTube", "5" => "* URL", "7" => "MySpace", "8" => "PhotoBucket", "9" => "Jamendo", "10" => "CCMixter", "11" => "NYPL", "12" => "Current", "13" => "MediaCommons", "22" => "Archive.org");
    if ($limited) {
        $format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP");
        if (strpos($host, "sandbox") !== false) {
            $service_url_list = array("sandbox.kaltura.com" => "Sandbox", "www.kaltura.com" => "Kaltura");
        } else {
            $service_url_list = array("www.kaltura.com" => "Kaltura", "sandbox.kaltura.com" => "Sandbox");
        }
        $index_path_list = array("index.php" => "index");
    } else {
        $format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP", "4" => "PHP_ARR", "5" => "PHP_OBJ");
        $service_url_list = array("localhost" => "localhost", "kaldev.kaltura.com" => "kaldev", "www.kaltura.com" => "Kaltura", "sandbox.kaltura.com" => "Sandbox");
        $index_path_list = array("index.php" => "index", "kaltura_dev.php" => "debug");
    }
    $clazz_list = array("kshow" => "kshow", "kuser" => "kuser", "entry" => "entry", "PuserKuser" => "PuserKuser");
    $moderation_object_type = array("1" => "kshow", "2" => "entry", "3" => "kuser", "" => "none");
    $notification_status = array("" => "All", "1" => "Pending", "2" => "Sent", "3" => "Error", "4" => "Should Resend");
    $entry_type = array("" => "All", "1" => "Clip", "2" => "Roughcut");
    $entry_media_type = array("" => "All", "1" => "Video", "2" => "Image", "5" => "Audio", "6" => "Roughcut");
    $boolean_type = array("" => "", "true" => "true", "false" => "false");
    $boolean_int_type = array("" => "", "1" => "true", "0" => "false");
    $partner_status_int_type = array("1" => "Normal", "2" => "Content Blocked", "3" => "Fully Blocked", "0" => "Deleted");
    $partner_group_int_type = array("1" => "Publisher", "2" => "VAR", "3" => "Group");
    $arrays = array("format_list" => $format_list, "media_type" => $media_type_list, "media_source" => $media_source_list, "service_urls" => $service_url_list, "service_urls1" => array_merge(array("" => ""), $service_url_list), "index_paths" => $index_path_list, "clazz_list" => $clazz_list, "moderation_object_type" => $moderation_object_type, "boolean_type" => $boolean_type, "boolean_int_type" => $boolean_int_type, "notification_status" => $notification_status, "partner_status_int_type" => $partner_status_int_type, "partner_group_int_type" => $partner_group_int_type, "appear_in_saerch_list" => array("0" => "Not at all", "1" => "Partner only", "2" => "Kaltura network"), "net_storage_priority" => array(StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_ONLY => 'Kaltura DCs only', StorageProfile::STORAGE_SERVE_PRIORITY_KALTURA_FIRST => 'Kaltura first', StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_FIRST => 'External storages first', StorageProfile::STORAGE_SERVE_PRIORITY_EXTERNAL_ONLY => 'External storages only'));
    $list = $arrays[$list_name];
    //echo "createSelect: list_name:[$list_name] count:[" . count ( $list ) . "]<br>";
    $str = "<select id='{$prefix}{$id}' style='font-family:arial; font-size:12px;' name='{$prefix}{$name}' onkeyup='updateSelect( this )' onchange='updateSelect( this )'>";
    $default_value_selected = "";
    foreach ($list as $value => $option) {
        // not always the default value is found
        if ($value == $default_value) {
            $default_value_selected = $default_value;
        }
        $selected = $value == $default_value ? "selected='selected'" : "";
        $str .= "<option value='{$value}' {$selected} >{$option}</option>\n";
    }
    $str .= "</select> <span style='color:blue;' id='{$prefix}{$id}_current_value'>{$default_value_selected}</span>\n";
    return $str;
}
 public static function getGenericMarkup()
 {
     $host = @requestUtils::getHost();
     if (empty($host) || strlen($host) < 8) {
         $host = "http://www.kaltura.com";
     }
     $base = $host . "/index.php";
     $a_start = "<a href='";
     $a_end = "'>";
     $a_close = "</a>";
     if (self::$generic_markup == null) {
         self::$generic_markup = array("link-home" => $a_start . $base . $a_end . "Kaltura" . $a_close, "link-browse-kshow-start" => $a_start . $base . "/browse?kshow_id='", "link-browse-kshow-middle" => "'>", "link-browse-kshow-end" => "</a>", "link-forum" => $a_start . $base . "/forum" . $a_end . "Forum" . $a_close, "link-mykaltura" => $a_start . $base . "/mykaltura/viewprofile?screenname=<kl:screenName>" . $a_end . "<kl:screenName>" . $a_close, "link-contact" => $a_start . $base . "/static/contactus" . $a_end . "Contact Us" . $a_close, "link-block-email-url" => $base . "/mail/blockMail?e=");
     }
     return self::$generic_markup;
 }
Example #5
0
 public function fromObject($batchJob)
 {
     if ($batchJob->getJobType() != BatchJobType::BULKUPLOAD) {
         throw new Exception("Bulk upload object can be initialized from bulk upload job only");
     }
     $this->id = $batchJob->getId();
     $this->uploadedOn = $batchJob->getCreatedAt(null);
     $this->status = $batchJob->getStatus();
     $this->error = $batchJob->getDescription();
     $this->logFileUrl = requestUtils::getHost() . "/index.php/extwidget/bulkuploadfile/id/{$batchJob->getId()}/pid/{$batchJob->getPartnerId()}/type/log";
     $this->csvFileUrl = requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$batchJob->getId()}/pid/{$batchJob->getPartnerId()}/type/csv";
     $jobData = $batchJob->getData();
     if ($jobData instanceof kBulkUploadJobData) {
         $this->uploadedBy = $jobData->getUploadedBy();
         $this->uploadedByUserId = $jobData->getUserId();
         $this->numOfEntries = $jobData->getNumOfEntries();
     }
     //		$results = BulkUploadResultPeer::retrieveByBulkUploadId($this->id);
     //		$this->results = KalturaBulkUploadResultArray::fromBulkUploadResultArray($results);
 }
 /**
  * display login form
  */
 protected function executeLoginScreen()
 {
     /**
      * the google api project that we are granting access to
      */
     $appId = $this->getRequestParameter('ytid');
     /**
      * sub id is needed when we want to authorize different google accounts for several distribution profiles
      * the distribution profile can then look for its specific access token by the 'subid'
      */
     $subId = $this->getRequestParameter('subid');
     $appConfig = $this->getFromGoogleAuthConfig($appId);
     $this->invalidConfig = null;
     $this->loginError = null;
     $this->serviceUrl = requestUtils::getHost();
     $params = array('ytid' => $appId, 'subid' => $subId);
     $this->nextUrl = $this->getController()->genUrl('extservices/googleoauth2?' . http_build_query($params, null, '&')) . '?ks=';
     if ($appConfig === null) {
         $this->invalidConfig = true;
     }
 }
Example #7
0
 public function execute()
 {
     // Prevent the page fron being embeded in an iframe
     header('X-Frame-Options: DENY');
     $service_url = requestUtils::getHost();
     $service_url = str_replace("http://", "", $service_url);
     if (kConf::get('kmc_secured_login')) {
         $service_url = 'https://' . $service_url;
         if ((empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') && $_SERVER['SERVER_PORT'] != 443) {
             header('Location:' . $service_url . '/' . $_SERVER['REQUEST_URI']);
             die;
         }
     } else {
         $service_url = 'http://' . $service_url;
         header('Location:' . $service_url . '/' . $_SERVER['REQUEST_URI']);
         die;
     }
     $this->service_url = $service_url;
     $this->kmc_login_version = kConf::get('kmc_login_version');
     $this->setPassHashKey = $this->getRequestParameter("setpasshashkey");
     $this->hashKeyErrorCode = null;
     $this->hashKeyLoginId = null;
     if ($this->setPassHashKey) {
         try {
             if (!UserLoginDataPeer::isHashKeyValid($this->setPassHashKey)) {
                 $this->hashKeyErrorCode = kUserException::NEW_PASSWORD_HASH_KEY_INVALID;
             } else {
                 $userLoginDataId = UserLoginDataPeer::getIdFromHashKey($this->setPassHashKey);
                 $userLoginData = UserLoginDataPeer::retrieveByPK($userLoginDataId);
                 if (!$userLoginData) {
                     $this->hashKeyLoginId = "";
                 }
                 $this->hashKeyLoginId = $userLoginData->getLoginEmail();
             }
         } catch (kCoreException $e) {
             $this->hashKeyErrorCode = $e->getCode();
         }
     }
     sfView::SUCCESS;
 }
 public function executeImpl(kshow $kshow, entry &$entry)
 {
     $genericWidget = "";
     $myspaceWidget = "";
     $kshow_id = $kshow->getId();
     $entry_id = $entry->getId();
     if (!$kshow->getPartnerId() && !$this->forceViewPermissions($kshow, $kshow_id, false, false)) {
         die;
     }
     $this->kshow_category = $kshow->getTypeText();
     $this->kshow_description = $kshow->getDescription();
     $this->kshow_name = $kshow->getName();
     $this->kshow_tags = $kshow->getTags();
     $kdata = @$_REQUEST["kdata"];
     if ($kdata == "null") {
         $kdata = "";
     }
     $this->widget_type = @$_REQUEST["widget_type"];
     list($genericWidget, $myspaceWidget) = myKshowUtils::getEmbedPlayerUrl($kshow_id, $entry_id, false, $kdata);
     if ($entry_id == 1002) {
         $this->share_url = requestUtils::getHost() . "/index.php/corp/kalturaPromo";
     } else {
         if ($kdata) {
             $this->share_url = myKshowUtils::getWidgetCmdUrl($kdata, "share");
         } else {
             $this->share_url = myKshowUtils::getUrl($kshow_id) . "&entry_id={$entry_id}";
         }
     }
     //list($status, $kmediaType, $kmediaData) = myContentRender::createPlayerMedia($entry); // myContentRender class removed, old code
     $status = $entry->getStatus();
     $kmediaType = $entry->getMediaType();
     $kmediaData = "";
     $this->message = $kmediaType == entry::ENTRY_MEDIA_TYPE_TEXT ? $kmediaData : "";
     $this->generic_embed_code = $genericWidget;
     $this->myspace_embed_code = $myspaceWidget;
     $this->thumbnail = $entry ? $entry->getBigThumbnailPath(true) : "";
     $this->kuser = $entry->getKuser();
     $this->entry = $entry;
 }
Example #9
0
 /**
  * Use the thumbnailUrl of the show entry -
  * TODO - cache to prevent the extra hit to DB
  */
 public function getThumbnailUrl($version = NULL)
 {
     $show_entry = $this->getShowEntry();
     if ($show_entry) {
         return $show_entry->getThumbnailUrl();
     } else {
         $path = $this->getThumbnailPath($version);
         $url = requestUtils::getHost() . $path;
         return $url;
     }
 }
 public static function enforceCdnDelivery($partnerId)
 {
     $host = requestUtils::getHost();
     $cdnHost = myPartnerUtils::getCdnHost($partnerId);
     $dc = kDataCenterMgr::getCurrentDc();
     $external_url = $dc["external_url"];
     // allow access only via cdn or via proxy from secondary datacenter
     if ($host != $cdnHost && $host != $external_url) {
         $uri = $_SERVER["REQUEST_URI"];
         if (strpos($uri, "/forceproxy/true") === false) {
             $uri .= "/forceproxy/true/";
         }
         header('Location:' . $cdnHost . $uri);
         header("X-Kaltura:enforce-cdn");
         die;
     }
 }
 private static function getContentPath()
 {
     return requestUtils::getHost();
 }
 public function execute()
 {
     $this->entryId = $this->getRequestParameter("entryId", null);
     $this->flavorId = $this->getRequestParameter("flavorId", null);
     $this->storageId = $this->getRequestParameter("storageId", null);
     $this->maxBitrate = $this->getRequestParameter("maxBitrate", null);
     $flavorIdsStr = $this->getRequestParameter("flavorIds", null);
     if ($flavorIdsStr) {
         $this->flavorIds = explode(",", $flavorIdsStr);
     }
     $this->entry = entryPeer::retrieveByPKNoFilter($this->entryId);
     if (!$this->entry) {
         KExternalErrors::dieError(KExternalErrors::ENTRY_NOT_FOUND);
     }
     if (!$this->flavorId) {
         $flavorParamId = $this->getRequestParameter("flavorParamId", null);
         if ($flavorParamId) {
             $flavorAsset = flavorAssetPeer::retrieveByEntryIdAndFlavorParams($entry->getId(), $flavorParamId);
             if (!$flavorAsset) {
                 KExternalErrors::dieError(KExternalErrors::FLAVOR_NOT_FOUND);
             }
             $this->flavorId = $flavorAsset->getId();
         }
     }
     $this->validateStorageId();
     $this->protocol = $this->getRequestParameter("protocol", null);
     if (!$this->protocol) {
         $this->protocol = StorageProfile::PLAY_FORMAT_HTTP;
     }
     $this->format = $this->getRequestParameter("format");
     if (!$this->format) {
         $this->format = StorageProfile::PLAY_FORMAT_HTTP;
     }
     $this->cdnHost = $this->getRequestParameter("cdnHost", null);
     $partner = $this->entry->getPartner();
     if (!$this->cdnHost || $partner->getForceCdnHost()) {
         $this->cdnHost = myPartnerUtils::getCdnHost($this->entry->getPartnerId(), $this->protocol);
     }
     if ($this->maxBitrate && (!is_numeric($this->maxBitrate) || $this->maxBitrate <= 0)) {
         KExternalErrors::dieError(KExternalErrors::INVALID_MAX_BITRATE);
     }
     $ksStr = $this->getRequestParameter("ks");
     $base64Referrer = $this->getRequestParameter("referrer");
     $referrer = base64_decode($base64Referrer);
     if (!is_string($referrer)) {
         $referrer = "";
     }
     // base64_decode can return binary data
     $securyEntryHelper = new KSecureEntryHelper($this->entry, $ksStr, $referrer);
     if ($securyEntryHelper->shouldPreview()) {
         $this->clipTo = $securyEntryHelper->getPreviewLength() * 1000;
     } else {
         $securyEntryHelper->validateForPlay($this->entry, $ksStr);
     }
     // grab seekFrom parameter and normalize url
     $this->seekFrom = $this->getRequestParameter("seekFrom", -1);
     if ($this->seekFrom <= 0) {
         $this->seekFrom = -1;
     }
     if ($this->entry->getStatus() == entryStatus::DELETED) {
         // because the fiter was turned off - a manual check for deleted entries must be done.
         die;
     }
     $xml = null;
     switch ($this->format) {
         case StorageProfile::PLAY_FORMAT_HTTP:
             $xml = $this->serveHttp();
             break;
         case StorageProfile::PLAY_FORMAT_RTMP:
             $xml = $this->serveRtmp();
             break;
         case StorageProfile::PLAY_FORMAT_SILVER_LIGHT:
             $xml = $this->serveSilverLight();
             break;
         case StorageProfile::PLAY_FORMAT_APPLE_HTTP:
             $xml = $this->serveAppleHttp();
             break;
         case "url":
             return $this->serveUrl();
             break;
         case "hdnetworksmil":
             $xml = $this->serveHDNetwork();
             break;
         case "hdnetwork":
             $duration = $this->entry->getDurationInt();
             $mediaUrl = "<media url=\"" . requestUtils::getHost() . str_replace("f4m", "smil", str_replace("hdnetwork", "hdnetworksmil", $_SERVER["REQUEST_URI"])) . "\"/>";
             $xml = $this->buildXml(self::PLAY_STREAM_TYPE_RECORDED, array(), 'video/x-flv', $duration, null, $mediaUrl);
             break;
     }
     if ($this->format == StorageProfile::PLAY_FORMAT_APPLE_HTTP) {
         header("Content-Type: text/plain; charset=UTF-8");
     } else {
         header("Content-Type: text/xml; charset=UTF-8");
         header("Content-Disposition: inline; filename=manifest.xml");
     }
     echo $xml;
     die;
 }
 /**
  * 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->getRequestParameter("version", null);
     $width = $this->getRequestParameter("width", -1);
     $height = $this->getRequestParameter("height", -1);
     $type = $this->getRequestParameter("type", 1);
     $crop_provider = $this->getRequestParameter("crop_provider", null);
     $quality = $this->getRequestParameter("quality", 0);
     $src_x = $this->getRequestParameter("src_x", 0);
     $src_y = $this->getRequestParameter("src_y", 0);
     $src_w = $this->getRequestParameter("src_w", 0);
     $src_h = $this->getRequestParameter("src_h", 0);
     $vid_sec = $this->getRequestParameter("vid_sec", -1);
     $vid_slice = $this->getRequestParameter("vid_slice", -1);
     $vid_slices = $this->getRequestParameter("vid_slices", -1);
     // 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->getRequestParameter("rel_width", -1);
     $rel_height = $this->getRequestParameter("rel_height", -1);
     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");
     if ($upload_token_id) {
         $upload_token = UploadTokenPeer::retrieveByPK($upload_token_id);
         if ($upload_token) {
             $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);
                 kFile::dumpFile($thumb_full_path);
             }
         }
     }
     $entry = entryPeer::retrieveByPKNoFilter($entry_id);
     // 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;
     }
     if (!$entry) {
         // 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);
         }
     }
     $subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB;
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
         $subType = entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA;
     }
     $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) {
         // if entry type is audio - serve generic thumb:
         if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_AUDIO) {
             if ($entry->getStatus() == entryStatus::DELETED && $entry->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK) {
                 KalturaLog::log("rejected audio entry - not serving thumbnail");
                 KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
             }
             $contentPath = myContentStorage::getFSContentRootPath();
             $msgPath = $contentPath . "content/templates/entry/thumbnail/audio_thumb.jpg";
             $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, $msgPath);
             //kFile::dumpFile($tempThumbPath, null, 0);
         } elseif ($entry->getType() == entryType::LIVE_STREAM) {
             if ($entry->getStatus() == entryStatus::DELETED && $entry->getModerationStatus() == moderation::MODERATION_STATUS_BLOCK) {
                 KalturaLog::log("rejected live stream entry - not serving thumbnail");
                 KExternalErrors::dieError(KExternalErrors::ENTRY_DELETED_MODERATED);
             }
             $contentPath = myContentStorage::getFSContentRootPath();
             $msgPath = $contentPath . "content/templates/entry/thumbnail/live_thumb.jpg";
             $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, $msgPath);
         } elseif ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_SHOW) {
             $contentPath = myContentStorage::getFSContentRootPath();
             $msgPath = $contentPath . "content/templates/entry/thumbnail/auto_edit.jpg";
             $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, $msgPath);
             //kFile::dumpFile($tempThumbPath, null, 0);
         } elseif ($entry->getType() == entryType::MEDIA_CLIP) {
             // commenting out the new behavior, in this case the thumbnail will be created in resizeEntryImage
             //$contentPath = myContentStorage::getFSContentRootPath();
             //$msgPath = $contentPath."content/templates/entry/thumbnail/broken_thumb.jpg";
             //header("Xkaltura-app: entry [$entry_id] in conversion, returning template broken thumb");
             //KalturaLog::log( "Entry in conversion, no thumbnail yet [$entry_id], created dynamic 1x1 jpg");
             //kFile::dumpFile($msgPath, null, 0);
             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);
             } catch (Exception $ex) {
                 if ($ex->getCode() == kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC) {
                     // get original flavor asset
                     $origFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entry_id);
                     if ($origFlavorAsset) {
                         $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);
                         }
                         $remote_url = kDataCenterMgr::getRedirectExternalUrl($remoteFileSync, $_SERVER['REQUEST_URI']);
                         KalturaLog::log(__METHOD__ . ": redirecting to [{$remote_url}]");
                         $this->redirect($remote_url);
                     }
                 }
             }
         } else {
             // file does not exist on any DC - die
             KalturaLog::log("Error - no FileSync for entry [{$entry_id}]");
             KExternalErrors::dieError(KExternalErrors::MISSING_THUMBNAIL_FILESYNC);
         }
     }
     if (!$local && !$tempThumbPath) {
         $remote_url = kDataCenterMgr::getRedirectExternalUrl($file_sync, $_SERVER['REQUEST_URI']);
         KalturaLog::log(__METHOD__ . ": redirecting to [{$remote_url}]");
         $this->redirect($remote_url);
     }
     // 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);
         } catch (Exception $ex) {
             if ($ex->getCode() == kFileSyncException::FILE_DOES_NOT_EXIST_ON_CURRENT_DC) {
                 // get original flavor asset
                 $origFlavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($entry_id);
                 if ($origFlavorAsset) {
                     $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);
                     }
                     $remote_url = kDataCenterMgr::getRedirectExternalUrl($remoteFileSync, $_SERVER['REQUEST_URI']);
                     KalturaLog::log(__METHOD__ . ": redirecting to [{$remote_url}]");
                     $this->redirect($remote_url);
                 }
             }
         }
     }
     $nocache = strpos($tempThumbPath, "_NOCACHE_") !== false;
     // 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)
 }
Example #14
0
 public function fromObject($sourceObject)
 {
     if (!$sourceObject) {
         return;
     }
     parent::fromObject($sourceObject);
     $host = requestUtils::getHost();
     $this->executeUrl = myPlaylistUtils::toPlaylistUrl($sourceObject, $host);
     if ($this->playlistType == KalturaPlaylistType::DYNAMIC) {
         $this->playlistContentXmlToFilters();
     }
 }
 /**
  * @return kManifestRenderer
  */
 private function serveHDNetwork()
 {
     $duration = $this->entry->getDurationInt();
     $mediaUrl = requestUtils::getHost() . str_replace("f4m", "smil", str_replace("hdnetwork", "hdnetworksmil", $_SERVER["REQUEST_URI"]));
     $renderer = new kF4MManifestRenderer();
     $renderer->entryId = $this->entryId;
     $renderer->duration = $duration;
     $renderer->mediaUrl = $mediaUrl;
     return $renderer;
 }
    public static function addEntryToMetadata($content, $entry, $current_kshow_version = null, $version_info = null)
    {
        if (!$entry) {
            return null;
        }
        $media_type = $entry->getMediaType();
        if (!($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO || $media_type == entry::ENTRY_MEDIA_TYPE_IMAGE)) {
            // ignote enatiers that are not images or video
            return null;
        }
        if (isset($version_info)) {
            $content = self::addVersionInfo($content, $version_info);
        }
        $xml_doc = new DOMDocument();
        $xml_doc->loadXML($content);
        //return $xml_doc->saveXML();
        $xpath = new DOMXPath($xml_doc);
        $totalTime = 0;
        $seqDuarations = $xpath->query("//MetaData/SeqDuration");
        $one_and_only_seqDuaration = null;
        if ($seqDuarations) {
            $one_and_only_seqDuaration = $seqDuarations->item(0);
            if ($one_and_only_seqDuaration) {
                $totalTime = $one_and_only_seqDuaration->nodeValue;
            } else {
                $totalTime = 0;
                $one_and_only_seqDuaration = null;
            }
        } else {
            $totalTime = 0;
        }
        $should_save = false;
        $host_name = null;
        // set the updated list in the xml
        $host_elem = kXml::getFirstElement($xml_doc, "Host");
        if ($host_elem == null || empty($host_elem->nodeValue) || strlen($host_elem->nodeValue) < 6) {
            $host_name = requestUtils::getHost();
            $metadata = kXml::getFirstElement($xml_doc, "MetaData");
            kXml::setChildElement($xml_doc, $metadata, "Host", $host_name, false);
            $should_save = true;
        } else {
            $host_name = $host_elem->nodeValue;
        }
        $prev_transition_duration = 0;
        $vidAsset_parentNode = kXml::getFirstElement($xml_doc, "VideoAssets");
        $vidAssets = $xpath->query("//VideoAssets/vidAsset");
        $vidAssets_count = 0;
        foreach ($vidAssets as $vidAsset) {
            if ($vidAssets_count == 0) {
                if ($vidAsset_parentNode == null) {
                    $vidAsset_parentNode = $vidAsset->parentNode;
                }
            }
            $end_transition = kXml::getFirstElement($vidAsset, "EndTransition");
            if ($end_transition) {
                // by the end of the loop we'll have the last transisiotn in hand
                $cross = $end_transition->getAttribute("cross");
                if ($cross == "1") {
                    $prev_transition_duration = $end_transition->getAttribute("length");
                } else {
                    $prev_transition_duration = 0;
                }
            }
            $vidAssets_count++;
        }
        $entry_id = $entry->getId();
        // if the entry has an error - remove the pending
        if ($entry->getStatus() == entryStatus::ERROR_CONVERTING) {
            // return the XML - new if modified and the original if not
            if ($current_kshow_version != null) {
                //				$entry->setUpdateWhenReady ( $current_kshow_version );
                $should_save = self::updatePending($xml_doc, $entry_id, false);
                // increment the count on the show entry
            }
            if ($should_save) {
                return $xml_doc->saveXML();
            }
            // this is if the host has been added
            return $content;
        }
        if ($entry->getStatus() != entryStatus::READY) {
            // return the XML - new if modified and the original if not
            if ($current_kshow_version != null) {
                $entry->setUpdateWhenReady($current_kshow_version);
                $should_save = self::updatePending($xml_doc, $entry_id, true);
                // increment the count on the show entry
                $show_entry = $entry->getKshow()->getShowEntry();
                if ($show_entry) {
                    $show_entry->incInCustomData("pending_entries");
                    $show_entry->incInCustomData("moderated_entries");
                    $show_entry->save();
                }
            }
            if ($should_save) {
                return $xml_doc->saveXML();
            }
            // this is if the host has been added
            return $content;
        }
        if ($vidAssets_count >= self::MAX_ENTRIES_IN_METADATA) {
            KalturaLog::log("Exceeded number of entries in metadata [" . self::MAX_ENTRIES_IN_METADATA . "]. Will not add entry [{$entry_id}] to file.");
            $should_save = false;
            return null;
        }
        // staart at the beginning of the asset
        $startTime = 0;
        if ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO) {
            $isVideo = true;
            $media_type_str = 'VIDEO';
            $real_length = $entry->getLengthInMsecs() / 1000;
            if ($real_length <= 0) {
                $lenTime = 10;
                // hard-coded first 10 seconds
            } else {
                $lenTime = $real_length;
            }
        } else {
            if ($media_type == entry::ENTRY_MEDIA_TYPE_IMAGE) {
                $isVideo = false;
                $media_type_str = 'IMAGE';
                $lenTime = 4;
            } else {
                return $content;
                // leave untouched
            }
        }
        $addLastFadeoutTime = 1;
        $media_name = $entry->getName();
        $media_url = $entry->getDataUrl();
        $relMedia_url = strstr($media_url, "/content");
        if ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO) {
            // for video - change the URL of the asset to use the clipper
            /* http://www6.localhost.com/index.php/keditorservices/flvclipper?entry_id=12353 */
            $clipper_path = $host_name . "/index.php/keditorservices/flvclipper?entry_id={$entry_id}";
            $media_url = $clipper_path;
        }
        $transition_duration = 1;
        $host_id = 1 + $media_url % 7;
        // make sure that the media_url is formated properly otherwize the editor wrongly modifies the URL
        $media_url = str_replace("/localhost/", "/www{$host_id}.localhost.com/", $media_url);
        $transition_type = "dissolve";
        // the dissolve transition is from the cross family. It should not be used with the simple editor
        $fixed_media_name = kString::xmlEncode($media_name);
        $newVidasset = "\n" . '		<vidAsset k_id="' . $entry_id . '" type="' . $media_type_str . '" name="' . $fixed_media_name . '" url="' . $media_url . '">' . "\n" . '			<StreamInfo file_name="' . $relMedia_url . '" start_time="' . $startTime . '" len_time="' . $lenTime . '"
						posX="0" posY="0" start_byte="-1" end_byte="-1" total_bytes="-1" real_seek_time="-1" volume="1"
						pan="0" isSingleFrame="0" real_start_byte="-1" real_end_byte="-1" Clipped_Start="0" Clipped_Len="' . $lenTime . '"/>' . "\n" . '			<EndTransition cross="0" type="' . $transition_type . '" StartTime="' . ($lenTime - $transition_duration) . '" length="' . $transition_duration . '">' . "\n" . '				<arguments>' . "\n" . '					<name>' . $transition_type . '</name>' . "\n" . '					<version>1.00</version>' . "\n" . '					<arguments/>' . "\n" . '				</arguments>' . "\n" . '			</EndTransition>' . "\n" . '		</vidAsset>' . "\n";
        // 	if there is a transition for the previous asset - calculate it's length
        $totalTime = $totalTime + $lenTime - $prev_transition_duration;
        // update the pending element if needed
        $should_save = self::updatePending($xml_doc, $entry_id, true);
        KalturaLog::log("Will append to xml\n{$newVidasset}");
        $temp_xml_doc = new DOMDocument();
        $temp_xml_doc->loadXML($newVidasset);
        //		echo $temp_xml_doc->saveXML( );
        $new_node = $temp_xml_doc->documentElement;
        $new_vid_asset = $xml_doc->importNode($new_node, true);
        if (!$vidAsset_parentNode) {
            KalturaLog::log("No VideoAssets parent node for entry [{$entry_id}] content [{$content}].");
            return null;
        }
        // insert the new video asset as the last one in the "vidAssets" element
        $vidAsset_parentNode->appendChild($new_vid_asset);
        $one_and_only_seqDuaration->nodeValue = $totalTime;
        return $xml_doc->saveXML();
    }
 private function createGenericWidgetHtml2($partner_id, $subp_id, $puser_id)
 {
     $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;
     $host = $this->getP("host", null);
     $WIDGET_HOST = requestUtils::getHost();
     // add the version as an additional parameter
     $domain = $host ? "http://" . $host : $WIDGET_HOST;
     $swf_url = "/index.php/extwidget/kwidget/wid/{$widget_id}/kid/{$kshow_id}";
     $height = 0;
     $width = 0;
     $widget = widgetPeer::retrieveByPK($widget_id);
     if ($widget) {
         $ui_conf = $widget->getUiConf();
         if ($ui_conf) {
             $height = $ui_conf->getHeight();
             $width = $ui_conf->getWidth();
         }
     }
     if (!$height) {
         $height = 300 + 105 + 20;
     }
     if (!$width) {
         $width = 400;
     }
     $params = array();
     if ($kshow_id) {
         $params[] = "kshowId={$kshow_id}";
     }
     if ($entry_id) {
         $params[] = "entryId={$entry_id}";
     }
     $flash_vars = implode("&", $params);
     $widget = '<object id="kaltura_player_' . (int) microtime(true) . '" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" height="' . $height . '" width="' . $width . '" data="' . $domain . $swf_url . '">' . '<param name="allowScriptAccess" value="always" />' . '<param name="allowNetworking" value="all" />' . '<param name="allowFullScreen" value="true" />' . '<param name="bgcolor" value=#000000 />' . '<param name="movie" value="' . $domain . $swf_url . '"/>' . '<param name="flashVars" value="' . $flash_vars . '"/>' . '<param name="wmode" value="opaque"/>' . "<a href='http://www.kaltura.com' style='color:#bcff63; text-decoration:none; '>Kaltura</a>" . '</object>';
     $html = "<div>{$widget}</div><br><div><code>" . htmlentities($widget) . "</code>";
     return $html;
 }
 public function getLastKshowUrl()
 {
     // return the last kshow_id created by this kuser
     $c = new Criteria();
     $c->add(kshowPeer::PRODUCER_ID, $this->getId());
     $c->addDescendingOrderByColumn(kshowPeer::ID);
     $kshow = kshowPeer::doSelectOne($c);
     $host = requestUtils::getHost() . "/";
     if ($kshow) {
         return "<a href='" . $host . "/id/" . $kshow->getId() . "'>" . $kshow->getName() . "</a>";
     } else {
         // This should never happen
         return "<a href='" . $host . "'>Kaltura</a>";
     }
 }
Example #19
0
 public function doFromObject($batchJobObject, KalturaDetachedResponseProfile $responseProfile = null)
 {
     /* @var $batchJobObject BatchJobLog */
     if (is_null($batchJobObject)) {
         return null;
     }
     if ($batchJobObject->getJobType() != BatchJobType::BULKUPLOAD) {
         throw new Exception("Bulk upload object can be initialized from bulk upload job only");
     }
     parent::doFromObject($batchJobObject, $responseProfile);
     $this->uploadedOn = $batchJobObject->getCreatedAt(null);
     $this->logFileUrl = requestUtils::getHost() . "/api_v3/service/bulkUpload/action/serveLog/id/{$batchJobObject->getJobId()}/ks/" . kCurrentContext::$ks;
     //		$this->logFileUrl = requestUtils::getHost() . "/index.php/extwidget/bulkuploadfile/id/{$batchJob->getId()}/pid/{$batchJob->getPartnerId()}/type/log";
     $this->bulkFileUrl = requestUtils::getHost() . "/api_v3/service/bulkUpload/action/serve/id/{$batchJobObject->getJobId()}/ks/" . kCurrentContext::$ks;
     //		$this->bulkFileUrl = requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$batchJob->getId()}/pid/{$batchJob->getPartnerId()}/type/$type";
     $this->csvFileUrl = $this->bulkFileUrl;
     if (method_exists(get_class($batchJobObject), "getParam1")) {
         $this->bulkUploadObjectType = $batchJobObject->getParam1();
     }
     //if (isset ())
     $jobData = $batchJobObject->getData();
     if ($jobData && $jobData instanceof kBulkUploadJobData) {
         $this->uploadedBy = $jobData->getUploadedBy();
         $this->uploadedByUserId = $jobData->getUserId();
         $this->numOfEntries = $jobData->getNumOfEntries();
         $this->numOfObjects = $jobData->getNumOfObjects();
         $this->fileName = $jobData->getFileName();
         $this->bulkUploadObjectType = BulkUploadObjectType::ENTRY;
         if ($jobData->getBulkUploadObjectType()) {
             $this->bulkUploadObjectType = $jobData->getBulkUploadObjectType();
         }
         if (!$jobData->getFilePath()) {
             $this->csvFileUrl = null;
             $this->bulkFileUrl = null;
         }
     }
 }
Example #20
0
<?php

$service_url = requestUtils::getHost();
$host = str_replace("http://", "", $service_url);
if ($host == "www.kaltura.com") {
    $host = "1";
}
$www_host = kConf::get('www_host');
if (kConf::get('kmc_secured_login')) {
    $flash_dir = 'https://';
} else {
    $flash_dir = 'http://';
}
$flash_dir .= $www_host . '/' . myContentStorage::getFSFlashRootPath();
$beta_str = $beta ? "/beta/{$beta}" : "";
?>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
var _partner_id, _subp_id, _uid;

function empty(val) {
	if(val === null)
		return true;
	return false;
}
function loginF(remMe, partner_id, subp_id, uid, ks , screen_name, email) {
	var has_cookie = false;
	if (partner_id == null) {
		partner_id = getCookie ( "pid" );
		subp_id = getCookie ( "subpid" );
Example #21
0
 public function doFromObject($sourceObject, KalturaDetachedResponseProfile $responseProfile = null)
 {
     if (!$sourceObject) {
         return;
     }
     parent::doFromObject($sourceObject, $responseProfile);
     if ($this->shouldGet('executeUrl', $responseProfile)) {
         $this->executeUrl = myPlaylistUtils::toPlaylistUrl($sourceObject, requestUtils::getHost());
     }
     if ($this->shouldGet('filters', $responseProfile) && $this->playlistType == KalturaPlaylistType::DYNAMIC) {
         $this->playlistContentXmlToFilters();
     }
 }
 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;
 }
 private function getFacebookDistributionAccessURL($providerId, $ks)
 {
     $host = requestUtils::getHost();
     return $host . self::FACEBOOK_DISTRIBUTION_ACCESS_URL . "&id=" . $providerId . "&ks=" . $ks;
 }
function createSelect($id, $name, $default_value, $list_name, $pid_str = null)
{
    $host = requestUtils::getHost();
    $limited = getLimited();
    //global $arrays;
    $download_file_formats = array("avi" => "avi", "mp4" => "mp4", "mov" => "mov", "flv" => "flv", "mp3" => "mp3", "3gp" => "3gp", "original" => "original");
    $media_type_list = array("1" => "Video", "2" => "Image", "5" => "Audio", "11" => "Document", "12" => "Swf", "-1" => "Automatic");
    $media_source_list = array("20" => "Kaltura", "21" => "MyClips", "23" => "KalturaPartner", "26" => "KalturaKshow", "27" => "KalturaPartnerKshow", "1" => "* File", "2" => "* Webcam", "3" => "Flickr", "4" => "YouTube", "5" => "* URL", "7" => "MySpace", "8" => "PhotoBucket", "9" => "Jamendo", "10" => "CCMixter", "11" => "NYPL", "13" => "MediaCommons", "22" => "Archive.org", "24" => "MetaCafe");
    if (!$limited) {
        $media_source_list = array("25" => "KalturaQa") + $media_source_list;
    }
    $protocol = requestUtils::getRequestProtocol();
    $current_server = str_replace("{$protocol}://", "", requestUtils::getRequestHost());
    $service_url_list[$current_server] = $current_server;
    if ($limited) {
        $format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP");
        if (strpos($host, "sandbox") !== false) {
            $service_url_list["sandbox.kaltura.com"] = "Sandbox";
            $service_url_list["www.kaltura.com"] = "Kaltura";
        } else {
            $service_url_list["www.kaltura.com"] = "Kaltura";
            $service_url_list["sandbox.kaltura.com"] = "Sandbox";
        }
        $index_path_list = array("index.php" => "index");
    } else {
        $format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP", "4" => "PHP_ARR", "5" => "PHP_OBJ", "8" => "mRSS");
        $service_url_list = array_merge($service_url_list, array("localhost" => "localhost", "qac.kaltura.dev" => "qac", "kelev.kaltura.com:9007" => "qac-external", "kaldev.kaltura.com" => "kaldev", "www.kaltura.com" => "Kaltura", "sandbox.kaltura.com" => "Sandbox"));
        $index_path_list = array("index.php" => "index", "kaltura_dev.php" => "debug");
        $service_url_list["debian.kaltura.dev/kalturaCE"] = "debian";
    }
    $clazz_list = array("kshow" => "kshow", "kuser" => "kuser", "entry" => "entry", "PuserKuser" => "PuserKuser");
    $moderation_object_type = array("1" => "kshow", "2" => "entry", "3" => "kuser", "" => "none");
    $moderation_status = array("1" => "pending", "2" => "allow", "3" => "block", "4" => "delete", "5" => "review");
    $notification_status = array("" => "All", "1" => "Pending", "2" => "Sent", "3" => "Error", "4" => "Should Resend");
    $entry_status = array("" => "All", "-1" => "ERROR_CONVERTING", "0" => "IMPORT", "1" => "PRECONVERT", "2" => "READY", "3" => "DELETED", "4" => "PENDING", "5" => "MODERATE", "6" => "BLOCKED");
    $entry_type = array("" => "All", "1" => "Clip", "2" => "Roughcut", "10" => "Document", "-1" => "Automatic");
    $entry_media_type = array("1" => "Video", "2" => "Image", "5" => "Audio", "6" => "Roughcut", "10" => "XML", "11" => "Document", "-1" => "Automatic");
    $entry_media_type_filter = array("" => "All", "1" => "Video", "2" => "Image", "5" => "Audio", "6" => "Roughcut", "10" => "XML", "11" => "Document", "-1" => "Automatic");
    $widget_security_type = array("1" => "none", "2" => "timehash");
    $entries_list_type = array("15" => "All", "1" => "Kshow", "2" => "Kuser", "4" => "Roughcut", "8" => "Episode");
    $boolean_type = array("true" => "true", "false" => "false");
    $boolean_int_type = array("" => "", "1" => "true", "0" => "false");
    $display_in_search_filter = array("" => "All", "0" => "Not displayed", "1" => "In Partner", "2" => "Kaltura Network");
    $usage_graph_resolutions = array("days" => "days", "months" => "months");
    $months_list = array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10", "11" => "11", "12" => "12");
    $obj_type_list = array("kshow" => "kshow", "entry" => "entry");
    // TODO - fix list for moderation_status
    $entry_moderation_status = array("1" => "PENDING", "2" => "ALLOW", "3" => "BLOCK");
    $entry_moderation_status_filter = array("" => "All", "1" => "PENDING", "2" => "ALLOW", "3" => "BLOCK");
    $arrays = array("format_list" => $format_list, "media_type" => $media_type_list, "media_source" => $media_source_list, "download_file_formats" => $download_file_formats, "service_urls" => $service_url_list, "service_urls1" => array_merge(array("" => ""), $service_url_list), "index_paths" => $index_path_list, "clazz_list" => $clazz_list, "moderation_object_type" => $moderation_object_type, "moderation_status" => $moderation_status, "boolean_type" => $boolean_type, "boolean_int_type" => $boolean_int_type, "notification_status" => $notification_status, "notification_type" => array_merge(array("" => "All"), kNotificationJobData::getNotificationTypeMap()), "entry_media_type" => $entry_media_type, "entry_media_type_filter" => $entry_media_type_filter, "entry_type" => $entry_type, "entry_status" => $entry_status, "widget_security_type" => $widget_security_type, "entries_list_type" => $entries_list_type, "entry_moderation_status_filter" => $entry_moderation_status_filter, "entry_moderation_status" => $entry_moderation_status, "entries_filter_order_by" => array("" => "None", "+id" => "id asc", "-id" => "id desc", "+created_at" => "created_at asc", "-created_at" => "created_at desc", "+media_date" => "media_date asc", "-media_date" => "media_date desc", "+name" => "name asc", "-name" => "name desc", "+views" => "views asc", "-views" => "views desc", "+type" => "type asc", "-type" => "type desc", "+media_type" => "media_type asc", "-media_type" => "media_type desc", "+plays" => "plays asc", "-plays" => "plays desc", "+views" => "views asc", "-views" => "views desc", "+rank" => "rank asc", "-rank" => "rank desc", "+moderation_count" => "moderation_count asc", "-moderation_count" => "moderation_count desc", "+moderation_status" => "moderation_status asc", "-moderation_status" => "moderation_status desc"), "obj_type_list" => $obj_type_list, "command_list" => array("view" => "view", "play" => "play", "viewEnd" => "viewEnd"), "display_in_search_filter" => $display_in_search_filter, "playlist_media_type" => array("10" => "Dynamic", "3" => "Static", "101" => "External"), "playlist_media_type_filter" => array("" => "All", "10" => "Dynamic", "3" => "Static", "101" => "External"), "conversion_profile_type" => array("low" => "low", "med" => "med", "high" => "high", "hd" => "HD"), "conversion_profile_aspect_ratio" => array("1" => "keep aspect ratio", "2" => "keep original size", "3" => "4:3", "4" => "16:9"), "uiconf_obj_type" => array("1" => "kdp", "2" => "kcw", "3" => "kse", "4" => "kae", "6" => "app-studio"), "uiconf_obj_type_filter" => array("" => "ALL", "1" => "kdp", "2" => "kcw", "3" => "kse", "4" => "kae", "6" => "app-studio"), "uiconf_filter_order_by" => array("" => "None", "+id" => "id asc", "-id" => "id desc", "+created_at" => "created_at asc", "-created_at" => "created_at desc", "+updated_at" => "updated_at asc", "-updated_at" => "updated_at desc"), "conversion_quality" => array("" => "DEFAULT", "low" => "low", "med" => "medium", "high" => "high", "hd" => "hd"), "download_job_type_filter" => array("" => "ALL", "3" => "flatten", "6" => "download"), "download_filter_order_by" => array("" => "None", "+id" => "id asc", "-id" => "id desc", "+created_at" => "created_at asc", "-created_at" => "created_at desc"), "uiconf_creation_mode" => array("1" => "Manual", "2" => "Wizard", "3" => "Advance"), "months_list" => $months_list, "usage_graph_resolutions" => $usage_graph_resolutions);
    $list = $arrays[$list_name];
    if (!$list) {
        die("<div>cannot find list of name: [{$list_name}]</div>");
    }
    //echo "createSelect: list_name:[$list_name] count:[" . count ( $list ) . "]<br>";
    $str = "<select id='{$id}' style='font-family:arial; font-size:12px;' name='{$name}' onkeyup='updateSelect( this )' onchange='updateSelect( this )' {$pid_str}>";
    $default_value_selected = "";
    foreach ($list as $value => $option) {
        // not always the default value is found
        if ($value == $default_value) {
            $default_value_selected = $default_value;
        }
        if ($default_value === "") {
            $selected = $value === "" ? "selected='selected'" : "";
        } else {
            $selected = $value == $default_value ? "selected='selected'" : "";
        }
        $str .= "<option value='{$value}' {$selected} >{$option}</option>\n";
    }
    $str .= "</select> <span style='color:blue;' id='{$id}_current_value'>{$default_value_selected}</span>\n";
    return $str;
}
Example #25
0
<?php

$host = requestUtils::getHost();
$recorderUrl = "";
if (!kString::beginsWith($host, "http://www.kaltura.com")) {
    $rtmp_host = str_replace("http:", "rtmp:", $host);
    $recorderUrl = "Red5ServerURL={$rtmp_host}/oflaDemo&";
}
echo 'wizardInitVars.recorderUrl = "' . $recorderUrl . '";';
?>

if (typeof(prodWizLogic) == 'undefined') // load the contribute.js only once
{
	activeWizard.waitForScript = true;
	createDynamicScript('/js/contribute.js');
}
else
	prodWizLogic.preInit();

</script>

<div class="cont2 step1" id="_prodWizPageType" autoFocus="true">
	<div class="top2_hint">
		<div class="top2 step1">
			<h1>Choose the type of Kaltura to create</h1>
		</div>
	</div>
	<div class="container">
		<div class="radioGroup clearfix">			
			<?php 
$types = kshow::getTypes();
 /**
  * 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)
 }
 private function serveHDNetwork()
 {
     kApiCache::setConditionalCacheExpiry(600);
     // the result contains a KS so we shouldn't cache it for a long time
     $mediaUrl = requestUtils::getHost() . str_replace("f4m", "smil", str_replace("hdnetwork", "hdnetworksmil", $_SERVER["REQUEST_URI"]));
     $renderer = new kF4MManifestRenderer(array(), $this->entryId);
     $renderer->mediaUrl = $mediaUrl;
     return $renderer;
 }
Example #28
0
}
$ok = image_tag('/sf/sf_default/images/icons/ok48.png');
$notok = image_tag('/sf/sf_default/images/icons/cancel48.png');
?>

<a href="/index.php/system/login?exit=true">logout</a><br>

<h1>System Test Results</h1>
<TABLE align="center">

<?php 
echo '<TR><TD>';
echo "logger class: " . get_class(sfLogger::getInstance());
echo '</TD></TR>';
echo '<TR><TD>';
echo "Host: " . requestUtils::getHost();
echo '</TD></TR>';
echo '<TR><TD>';
echo " webRoot: " . requestUtils::getWebRootUrl();
echo '</TD></TR>';
echo "<TR><TD>Is the server running the 'curl_init' extension? " . (function_exists("curl_init") ? $ok : $notok) . "</TD></TR>";
/*
echo '<TR><TD>The name of the user running httpd: '. exec('whoami')."</TD></TR>";

echo '<TR><TD>Path: '. exec('echo $PATH')."</TD></TR>";

echo '<TR><TD>Is FFMPEG in the path: '. (exec('ffmpeg') != null ? $ok : $notok)."</TD></TR>";
*/
echo '<TR><TD>';
//emailContactImporterDiagnose ();
echo '</TD></TR>';
Example #29
0
 private static function createFileName($partner_id)
 {
     $args = func_get_args();
     $file_name = "";
     foreach ($args as $arg) {
         //			if ( $file_name ) $file_name .= "_";
         if ($arg instanceof reportsInputFilter) {
             $file_name .= $arg->toShortString();
         } else {
             $file_name .= "{$arg}";
         }
     }
     $time_suffix = date("Y-m-D-H", (int) (time() / 43200) * 43200);
     // calculate for intervlas of half days (86400/2)
     $folderPath = "/content/reports/{$partner_id}";
     $fullPath = myContentStorage::getFSContentRootPath() . $folderPath;
     if (!file_exists($fullPath)) {
         kFile::fullMkfileDir($fullPath, 0777, true);
     }
     $fileName = "{$file_name}_{$time_suffix}";
     $url = requestUtils::getHost() . "{$folderPath}/{$fileName}";
     $file_path = "{$fullPath}/{$fileName}";
     //		$path = "/content/reports/$partner_id/{$file_name}_{$time_suffix}";
     //		$file_path = myContentStorage::getFSContentRootPath() .  $path;
     //		$url = requestUtils::getHost() . $path;
     return array($file_path, $url);
 }