Example #1
0
 function getClient()
 {
     // Get kaltura configuration file
     require_once realpath(dirname(__FILE__)) . '/../config/kConf.php';
     $kConf = new kConf();
     // Load kaltura client
     require_once realpath(dirname(__FILE__)) . '/../../clients/php5/KalturaClient.php';
     try {
         $conf = new KalturaConfiguration($this->partnerId);
         $conf->serviceUrl = 'http://' . $kConf->get('www_host');
         $client = new KalturaClient($conf);
         $client->setKS($this->Ks);
     } catch (Exception $e) {
         $this->error = 'Error setting KS. <a href="' . $_SERVER['SCRIPT_NAME'] . '">Try again</a>';
         die($this->error);
         return false;
     }
     return $client;
 }
 function getClient()
 {
     // Get kaltura configuration file
     require_once realpath(dirname(__FILE__)) . '/../../infra/kConf.php';
     $kConf = new kConf();
     // Load kaltura client
     require_once realpath(dirname(__FILE__)) . '/../../clients/php5/KalturaClient.php';
     try {
         $conf = new KalturaConfiguration(null);
         $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? "https://" : "http://";
         $port = null;
         if (is_null(parse_url($kConf->get('www_host'), PHP_URL_PORT))) {
             $port = isset($_SERVER["SERVER_PORT"]) ? $_SERVER["SERVER_PORT"] : 80;
         }
         $conf->serviceUrl = $protocol . $kConf->get('www_host') . ($port ? ':' . $port : "");
         $client = new KalturaClient($conf);
         $client->setKS($this->Ks);
     } catch (Exception $e) {
         $this->error = 'Error setting KS. <a href="' . $_SERVER['SCRIPT_NAME'] . '">Try again</a>';
         die($this->error);
         return false;
     }
     return $client;
 }
Example #3
0
 function getClient()
 {
     global $mwEmbedRoot, $wgKalturaUiConfCacheTime, $wgKalturaServiceUrl, $wgScriptCacheDirectory;
     $cacheDir = $wgScriptCacheDirectory;
     $cacheFile = $this->getCacheDir() . '/' . $this->getPartnerId() . ".ks.txt";
     $cacheLife = $wgKalturaUiConfCacheTime;
     $conf = new KalturaConfiguration($this->getPartnerId());
     $conf->serviceUrl = $wgKalturaServiceUrl;
     $client = new KalturaClient($conf);
     // Check modify time on cached php file
     $filemtime = @filemtime($cacheFile);
     // returns FALSE if file does not exist
     if (!$filemtime || filesize($cacheFile) === 0 || time() - $filemtime >= $cacheLife) {
         try {
             $session = $client->session->startWidgetSession($this->playerAttributes['wid']);
             $this->ks = $session->ks;
             file_put_contents($cacheFile, $this->ks);
         } catch (Exception $e) {
             $this->fatalIframeError(KALTURA_GENERIC_SERVER_ERROR . "\n" . $e->getMessage());
         }
     } else {
         $this->ks = file_get_contents($cacheFile);
     }
     // Set the kaltura ks and return the client
     $client->setKS($this->ks);
     return $client;
 }
 public function getClient()
 {
     global $wgKalturaServiceTimeout, $wgLogApiRequests;
     $cacheFile = $this->getCacheDir() . '/' . $this->getWidgetId() . '.' . $this->getCacheSt() . ".ks.txt";
     $conf = new KalturaConfiguration(null);
     $conf->serviceUrl = $this->getServiceConfig('ServiceUrl');
     $conf->serviceBase = $this->getServiceConfig('ServiceBase');
     $conf->clientTag = $this->clientTag;
     $conf->curlTimeout = $wgKalturaServiceTimeout;
     $conf->userAgent = $this->getUserAgent();
     $conf->verifySSL = false;
     $conf->requestHeaders = array($this->getRemoteAddrHeader());
     if ($wgLogApiRequests) {
         require_once 'KalturaLogger.php';
         $conf->setLogger(new KalturaLogger());
     }
     $client = new KalturaClient($conf);
     // Set KS
     if (isset($this->urlParameters['flashvars']['ks'])) {
         $this->ks = $this->urlParameters['flashvars']['ks'];
     } else {
         if (isset($this->urlParameters['ks'])) {
             $this->ks = $this->urlParameters['ks'];
         }
     }
     // check for empty ks
     if (!isset($this->ks) || trim($this->ks) == '') {
         if ($this->canUseCacheFile($cacheFile)) {
             $this->ks = file_get_contents($cacheFile);
         } else {
             try {
                 $session = $client->session->startWidgetSession($this->urlParameters['wid']);
                 $this->ks = $session->ks;
                 $this->partnerId = $session->partnerId;
                 $this->putCacheFile($cacheFile, $this->ks);
             } catch (Exception $e) {
                 throw new Exception(KALTURA_GENERIC_SERVER_ERROR . "\n" . $e->getMessage());
             }
         }
     }
     // Set the kaltura ks and return the client
     $client->setKS($this->ks);
     return $client;
 }
Example #5
0
 function getClient()
 {
     try {
         $conf = new KalturaConfiguration($this->partnerId);
         $client = new KalturaClient($conf);
         $client->setKS($this->ks);
     } catch (Exception $e) {
         $this->error = 'Error setting KS. <a href="' . $_SERVER['SCRIPT_NAME'] . '">Try again</a>';
         die($this->error);
         return false;
     }
     return $client;
 }