private function KalturaFrontController() { $this->dispatcher = KalturaDispatcher::getInstance(); $this->params = requestUtils::getRequestParams(); $this->service = isset($this->params["service"]) ? $this->params["service"] : null; $this->action = isset($this->params["action"]) ? $this->params["action"] : null; }
/** 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); }
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) { $limit = $this->getP("page_size", 20); $limit = min($limit, 100); $page = $this->getP("page", 1); $offset = ($page - 1) * $limit; $c = new Criteria(); $c->addAnd(BatchJobPeer::PARTNER_ID, $partner_id); $c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD); $c->addDescendingOrderByColumn(BatchJobPeer::ID); $count = BatchJobPeer::doCount($c); $c->setLimit($limit); $c->setOffset($offset); $jobs = BatchJobPeer::doSelect($c); $obj = array(); foreach ($jobs as $job) { $jobData = $job->getData(); if (!$jobData instanceof kBulkUploadJobData) { continue; } $bulkResults = BulkUploadResultPeer::retrieveWithEntryByBulkUploadId($job->getId()); $obj[] = array("uploadedBy" => $jobData->getUploadedBy(), "uploadedOn" => $job->getCreatedAt(null), "numOfEntries" => count($bulkResults), "status" => $job->getStatus(), "error" => $job->getStatus() == BatchJob::BATCHJOB_STATUS_FAILED ? $job->getMessage() : '', "logFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/log", "csvFileUrl" => requestUtils::getCdnHost() . "/index.php/extwidget/bulkuploadfile/id/{$job->getId()}/pid/{$job->getPartnerId()}/type/csv"); } $this->addMsg("count", $count); $this->addMsg("page_size", $limit); $this->addMsg("page", $page); $this->addMsg("bulk_uploads", $obj); }
public function __construct() { $this->setIp(requestUtils::getRemoteAddress()); $this->setReferrer(isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : null); $this->setUserAgent(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null); $this->setKs(kCurrentContext::$ks_object ? kCurrentContext::$ks_object : null); }
/** * Will forward to the uploader swf according to the ui_conf_id */ public function execute() { $ui_conf_id = $this->getRequestParameter("ui_conf_id"); $uiConf = uiConfPeer::retrieveByPK($ui_conf_id); if (!$uiConf) { die; } $partner_id = $uiConf->getPartnerId(); $subp_id = $uiConf->getSubpId(); $host = requestUtils::getRequestHost(); $ui_conf_swf_url = $uiConf->getSwfUrl(); if (!$ui_conf_swf_url) { die; } if (kString::beginsWith($ui_conf_swf_url, "http")) { $swf_url = $ui_conf_swf_url; // absolute URL } else { $use_cdn = $uiConf->getUseCdn(); $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id); $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url; // relative to the current host } $conf_vars = $uiConf->getConfVars(); if ($conf_vars) { $conf_vars = "&" . $conf_vars; } $params = "host=" . $host . "&uiConfId=" . $ui_conf_id . $conf_vars; $this->redirect("{$swf_url}?{$params}"); }
/** * Will forward to the uploader swf according to the ui_conf_id */ public function execute() { $ui_conf_id = $this->getRequestParameter("ui_conf_id"); $uiConf = uiConfPeer::retrieveByPK($ui_conf_id); if (!$uiConf) { KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND, "UI conf not found"); } $partner_id = $uiConf->getPartnerId(); $subp_id = $uiConf->getSubpId(); $host = requestUtils::getRequestHost(); $ui_conf_swf_url = $uiConf->getSwfUrl(); if (!$ui_conf_swf_url) { KExternalErrors::dieError(KExternalErrors::ILLEGAL_UI_CONF, "SWF URL not found in UI conf"); } if (kString::beginsWith($ui_conf_swf_url, "http")) { $swf_url = $ui_conf_swf_url; // absolute URL } else { $use_cdn = $uiConf->getUseCdn(); $cdn_host = $use_cdn ? myPartnerUtils::getCdnHost($partner_id) : myPartnerUtils::getHost($partner_id); $swf_url = $cdn_host . myPartnerUtils::getUrlForPartner($partner_id, $subp_id) . $ui_conf_swf_url; // relative to the current host } $conf_vars = $uiConf->getConfVars(); if ($conf_vars) { $conf_vars = "&" . $conf_vars; } $params = "host=" . $host . "&uiConfId=" . $ui_conf_id . $conf_vars; KExternalErrors::terminateDispatch(); $this->redirect("{$swf_url}?{$params}"); }
/** * Get license for encrypted content playback * * @action getLicense * @param string $flavorAssetId * @param string $referrer 64base encoded * @return string $response * */ public function getLicenseAction($flavorAssetId, $referrer = null) { KalturaResponseCacher::disableCache(); KalturaLog::debug('get license for flavor asset: ' . $flavorAssetId); try { $requestParams = requestUtils::getRequestParams(); if (!array_key_exists(WidevineLicenseProxyUtils::ASSETID, $requestParams)) { KalturaLog::err('assetid is missing on the request'); return WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::WIDEVINE_ASSET_ID_CANNOT_BE_NULL, 0); } $wvAssetId = $requestParams[WidevineLicenseProxyUtils::ASSETID]; $this->validateLicenseRequest($flavorAssetId, $wvAssetId, $referrer); $privileges = null; $isAdmin = false; if (kCurrentContext::$ks_object) { $privileges = kCurrentContext::$ks_object->getPrivileges(); $isAdmin = kCurrentContext::$ks_object->isAdmin(); } $response = WidevineLicenseProxyUtils::sendLicenseRequest($requestParams, $privileges, $isAdmin); } catch (KalturaWidevineLicenseProxyException $e) { KalturaLog::err($e); $response = WidevineLicenseProxyUtils::createErrorResponse($e->getWvErrorCode(), $wvAssetId); } catch (Exception $e) { KalturaLog::err($e); $response = WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::GENERAL_ERROR, $wvAssetId); } WidevineLicenseProxyUtils::printLicenseResponseStatus($response); return $response; }
public static function dieError($errorCode, $message = null) { $description = self::$errorDescriptionMap[$errorCode]; $args = func_get_args(); if (count($args) > 1) { array_shift($args); $description = @call_user_func_array('sprintf', array_merge(array($description), $args)); } if ($message) { $description .= ", {$message}"; } KalturaLog::err("exiting on error {$errorCode} - {$description}"); $headers = array(); if (self::$responseCode) { $headers[] = self::$errorCodeMap[self::$responseCode]; } $headers[] = "X-Kaltura-App: exiting on error {$errorCode} - {$description}"; foreach ($headers as $header) { header($header); } header("X-Kaltura:error-{$errorCode}"); $headers[] = "X-Kaltura:cached-error-{$errorCode}"; self::terminateDispatch(); if ($errorCode != self::ACCESS_CONTROL_RESTRICTED && $errorCode != self::IP_COUNTRY_BLOCKED && $_SERVER["REQUEST_METHOD"] == "GET") { requestUtils::sendCachingHeaders(self::CACHE_EXPIRY, true, time()); if (function_exists('apc_store')) { $protocol = infraRequestUtils::getProtocol(); $host = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']; $uri = $_SERVER["REQUEST_URI"]; apc_store("exterror-{$protocol}://{$host}{$uri}", $headers, self::CACHE_EXPIRY); } } die; }
private function KalturaFrontController() { $this->dispatcher = KalturaDispatcher::getInstance(); $this->params = requestUtils::getRequestParams(); $this->service = isset($this->params["service"]) ? (string) $this->params["service"] : null; $this->action = isset($this->params["action"]) ? (string) $this->params["action"] : null; kCurrentContext::$serializeCallback = array($this, 'serialize'); }
/** * Set default values and save the new upload token */ public function saveAsNewUploadToken() { $this->_uploadToken->setStatus(UploadToken::UPLOAD_TOKEN_PENDING); $this->_uploadToken->setUploadedFileSize(null); $this->_uploadToken->setUploadTempPath(null); $this->_uploadToken->setUserIp(requestUtils::getRemoteAddress()); $this->_uploadToken->setDc(kDataCenterMgr::getCurrentDcId()); $this->_uploadToken->save(); }
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; }
/** * Will forward to the regular swf player according to the widget_id */ public function execute() { $uiconf_id = $this->getRequestParameter('uiconf_id'); if (!$uiconf_id) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'uiconf_id'); } $uiConf = uiConfPeer::retrieveByPK($uiconf_id); if (!$uiConf) { KExternalErrors::dieError(KExternalErrors::UI_CONF_NOT_FOUND); } $partner_id = $this->getRequestParameter('partner_id', $uiConf->getPartnerId()); if (!$partner_id) { KExternalErrors::dieError(KExternalErrors::MISSING_PARAMETER, 'partner_id'); } $partner_host = myPartnerUtils::getHost($partner_id); $partner_cdnHost = myPartnerUtils::getCdnHost($partner_id); $use_cdn = $uiConf->getUseCdn(); $host = $use_cdn ? $partner_cdnHost : $partner_host; $ui_conf_html5_url = $uiConf->getHtml5Url(); if (kConf::hasMap("optimized_playback")) { $optimizedPlayback = kConf::getMap("optimized_playback"); if (array_key_exists($partner_id, $optimizedPlayback)) { // force a specific kdp for the partner $params = $optimizedPlayback[$partner_id]; if (array_key_exists('html5_url', $params)) { $ui_conf_html5_url = $params['html5_url']; } } } if (kString::beginsWith($ui_conf_html5_url, "http")) { $url = $ui_conf_html5_url; // absolute URL } else { if ($ui_conf_html5_url) { $url = $host . $ui_conf_html5_url; } else { $html5_version = kConf::get('html5_version'); $url = "{$host}/html5/html5lib/{$html5_version}/mwEmbedLoader.php"; } } // append uiconf_id and partner id for optimizing loading of html5 library. append them only for "standard" urls by looking for the mwEmbedLoader.php suffix if (kString::endsWith($url, "mwEmbedLoader.php")) { $url .= "/p/{$partner_id}/uiconf_id/{$uiconf_id}"; $entry_id = $this->getRequestParameter('entry_id'); if ($entry_id) { $url .= "/entry_id/{$entry_id}"; } } requestUtils::sendCachingHeaders(60); header("Pragma:"); kFile::cacheRedirect($url); header("Location:{$url}"); die; }
/** * Will forward to the regular swf player according to the widget_id */ public function execute() { requestUtils::handleConditionalGet(); $file_sync_id = $this->getRequestParameter("id"); $hash = $this->getRequestParameter("hash"); $file_name = $this->getRequestParameter("fileName"); if ($file_name) { $file_name = base64_decode($file_name); } kDataCenterMgr::serveFileToRemoteDataCenter($file_sync_id, $hash, $file_name); die; }
public function serialize($object) { if (is_object($object) && $object instanceof Exception) { $assetid = 0; $requestParams = requestUtils::getRequestParams(); if (array_key_exists(WidevineLicenseProxyUtils::ASSETID, $requestParams)) { $assetid = $requestParams[WidevineLicenseProxyUtils::ASSETID]; } $object = WidevineLicenseProxyUtils::createErrorResponse(KalturaWidevineErrorCodes::GENERAL_ERROR, $assetid); } return $object; }
public function __construct() { $this->_cacheKeyPrefix = 'playManifest-'; parent::__construct(); if (!kConf::get('enable_cache')) { return; } $this->_params = requestUtils::getRequestParams(); if (isset($this->_params['nocache'])) { return; } $this->calculateCacheKey(); $this->enableCache(); }
/** * @param string $playbackContext */ public function output($playbackContext) { if ($this->tokenizer) { $this->tokenizer->setPlaybackContext($playbackContext); } $this->tokenizeUrls(); $headers = $this->getHeaders(); foreach ($headers as $header) { header($header); } requestUtils::sendCachingHeaders(kApiCache::hasExtraFields() ? 0 : $this->cachingHeadersAge); echo $this->getBody(); die; }
public function checkIsLive($url) { $content = $this->urlExists($url, array('application/dash+xml')); if (!$content) { return false; } $mediaUrls = $this->getDashUrls($content); foreach ($mediaUrls as $mediaUrl) { $mediaUrl = requestUtils::resolve($mediaUrl, $url); if ($this->urlExists($mediaUrl, array('audio/mp4', 'video/mp4'), '0-1') !== false) { return true; } } return false; }
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; }
public function __construct($params = null, $cacheDirectory = null, $expiry = 0) { self::$_useCache = kConf::get('enable_cache'); if ($expiry) { $this->_expiry = $expiry; } $this->_cacheDirectory = $cacheDirectory ? $cacheDirectory : rtrim(kConf::get('response_cache_dir'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; $this->_cacheDirectory .= "cache_v3-" . $this->_expiry . DIRECTORY_SEPARATOR; if (!self::$_useCache) { return; } if (!$params) { $params = requestUtils::getRequestParams(); } foreach (kConf::get('v3cache_ignore_params') as $name) { unset($params[$name]); } // check the clientTag parameter for a cache start time (cache_st:<time>) directive if (isset($params['clientTag'])) { $clientTag = $params['clientTag']; $matches = null; if (preg_match("/cache_st:(\\d+)/", $clientTag, $matches)) { if ($matches[1] > time()) { self::$_useCache = false; return; } } } $isAdminLogin = isset($params['service']) && isset($params['action']) && $params['service'] == 'adminuser' && $params['action'] == 'login'; if ($isAdminLogin || isset($params['nocache'])) { self::$_useCache = false; return; } $ks = isset($params['ks']) ? $params['ks'] : ''; foreach ($params as $key => $value) { if (preg_match('/[\\d]+:ks/', $key)) { $ks = $value; unset($params[$key]); } } unset($params['ks']); unset($params['kalsig']); unset($params['clientTag']); $this->_params = $params; $this->setKS($ks); }
public static function dieError($errorCode, $message = null) { $description = self::$errorDescriptionMap[$errorCode]; $args = func_get_args(); if (count($args) > 1) { array_shift($args); $description = @call_user_func_array('sprintf', array_merge(array($description), $args)); } if ($message) { $description .= ", {$message}"; } KalturaLog::err("exiting on error {$errorCode} - {$description}"); header("X-Kaltura:error-{$errorCode}"); header("X-Kaltura-App: exiting on error {$errorCode} - {$description}"); if ($errorCode != self::ACCESS_CONTROL_RESTRICTED && $errorCode != self::IP_COUNTRY_BLOCKED) { requestUtils::sendCachingHeaders(60); } die; }
/** * Will forward to the regular swf player according to the widget_id */ public function execute() { requestUtils::handleConditionalGet(); $file_sync_id = $this->getRequestParameter("id"); $hash = $this->getRequestParameter("hash"); $file_name = $this->getRequestParameter("fileName"); if ($file_name) { $file_name = base64_decode($file_name); } $file_sync = FileSyncPeer::retrieveByPk($file_sync_id); if (!$file_sync) { $current_dc_id = kDataCenterMgr::getCurrentDcId(); $error = "DC[{$current_dc_id}]: Cannot find FileSync with id [{$file_sync_id}]"; KalturaLog::err($error); KExternalErrors::dieError(KExternalErrors::FILE_NOT_FOUND); } KalturaMonitorClient::initApiMonitor(false, 'extwidget.serveFile', $file_sync->getPartnerId()); kDataCenterMgr::serveFileToRemoteDataCenter($file_sync, $hash, $file_name); die; }
function collectAction(KalturaStatsEvent $event) { $evenLogFullPath = kConf::get("event_log_file_path"); // if no file path - do nothing if (!$evenLogFullPath) { return; } $http_referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""; $users_timestamp = $event->eventTimestamp; $eventLine = $event->clientVer . self::SEPARATOR . $event->eventType . self::SEPARATOR . date("Y-m-d H:i:s", time()) . self::SEPARATOR . $event->sessionId . self::SEPARATOR . $event->partnerId . self::SEPARATOR . $event->entryId . self::SEPARATOR . $event->uniqueViewer . self::SEPARATOR . $event->widgetId . self::SEPARATOR . $event->uiconfId . self::SEPARATOR . $event->userId . self::SEPARATOR . $event->currentPoint . self::SEPARATOR . $event->duration . self::SEPARATOR . requestUtils::getRemoteAddress() . self::SEPARATOR . $event->processDuration . self::SEPARATOR . $event->controlId . self::SEPARATOR . $event->seek . self::SEPARATOR . $event->newPoint . self::SEPARATOR . ($event->referrer ? $event->referrer : "") . self::SEPARATOR . $users_timestamp . self::SEPARATOR . PHP_EOL; try { $res = $this->writeToFile($evenLogFullPath, $eventLine); if (!$res) { KalturaLog::err("Error while trying to write event to log. Event:\n" . $eventLine); } } catch (Exception $ex) { KalturaLog::err("Error while trying to write event to log. Event:\n" . $eventLine); } return true; }
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; } }
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; }
/** * Fetch the manifest and build all flavors array * @param string $url */ private function buildF4mFlavors($url, array &$flavors, array &$bootstrapInfos) { $manifest = KCurlWrapper::getContent($url); if (!$manifest) { return; } $manifest = preg_replace('/xmlns="[^"]+"/', '', $manifest); $xml = new SimpleXMLElement($manifest); $mediaElements = $xml->xpath('/manifest/media'); foreach ($mediaElements as $mediaElement) { /* @var $mediaElement SimpleXMLElement */ $flavor = array('urlPrefix' => ''); $playlistUrl = null; foreach ($mediaElement->attributes() as $attr => $attrValue) { $attrValue = "{$attrValue}"; if ($attr === 'url') { $attrValue = requestUtils::resolve($attrValue, $url); } if ($attr === 'bootstrapInfoId') { $bootstrapInfoElements = $xml->xpath("/manifest/bootstrapInfo[@id='{$attrValue}']"); if (count($bootstrapInfoElements)) { $bootstrapInfoElement = reset($bootstrapInfoElements); /* @var $bootstrapInfoElement SimpleXMLElement */ $playlistUrl = requestUtils::resolve(strval($bootstrapInfoElement['url']), $url); } } $flavor["{$attr}"] = $attrValue; } if ($playlistUrl) { $playlistId = md5($playlistUrl); $bootstrapInfo = array('id' => $playlistId, 'url' => $playlistUrl); $bootstrapInfos[$playlistId] = $bootstrapInfo; $flavor['bootstrapInfoId'] = $playlistId; } $flavors[] = $flavor; } }
public function getBigThumbnailUrl($version = NULL) { $path = $this->getBigThumbnailPath($version); $url = requestUtils::getRequestHost() . $path; return $url; }
<?php include_once "//var/www/gip/app/settings/gipConfiguration.inc.php"; include_once INC_SUPERHEADER; include_once CLASS_PLUGIN_LOADER; $thisPlugInLoader = new plugInLoader(); $arguments = array(); $arguments['db'] = requestUtils::getRequestObject('db'); $arguments['table'] = requestUtils::getRequestObject('table'); $generatedCode = $thisPlugInLoader->loadPlugIn(PLUGIN_PHP_GENIE_WEB_DELETE_GENERATOR_NAME, PLUGIN_PHP_GENIE_WEB_DELETE_GENERATOR_CLASS, $arguments); highlight_string($generatedCode);