Exemple #1
0
 private function init()
 {
     if ($this->ready) {
         return;
     }
     $this->ready = true;
     $settings = array('baseUri' => $this->createBaseUri(), 'userName' => $this->user, 'password' => $this->password);
     $this->client = new Client($settings);
     $this->client->setThrowExceptions(true);
     if ($this->secure === true && $this->certPath) {
         $this->client->addCurlSetting(CURLOPT_CAINFO, $this->certPath);
     }
 }
Exemple #2
0
 private function init()
 {
     if ($this->ready) {
         return;
     }
     $this->ready = true;
     $settings = array('baseUri' => $this->createBaseUri(), 'userName' => $this->user, 'password' => $this->password);
     $proxy = \OC::$server->getConfig()->getSystemValue('proxy', '');
     if ($proxy !== '') {
         $settings['proxy'] = $proxy;
     }
     $this->client = new Client($settings);
     $this->client->setThrowExceptions(true);
     if ($this->secure === true && $this->certPath) {
         $this->client->addCurlSetting(CURLOPT_CAINFO, $this->certPath);
     }
 }
Exemple #3
0
 /**
  * Returns a configured, cached DAV client.
  *
  * @param string $uri  The base URI for any requests.
  *
  * @return \Sabre\DAV\Client  A DAV client.
  * @throws \Sabre\DAV\Exception
  * @throws \Sabre\HTTP\ClientException
  */
 protected function _getClient($uri)
 {
     global $conf;
     $options = array('baseUri' => $uri);
     if (!empty($this->_params['user'])) {
         $options['userName'] = $this->_params['user'];
         $options['password'] = $this->_params['password'];
     }
     $this->_client = new Client($options);
     $this->_client->addCurlSetting(CURLOPT_TIMEOUT, isset($this->_params['timeout']) ? $this->_params['timeout'] : 5);
     if (!empty($conf['http']['proxy']['proxy_host'])) {
         $this->_client->addCurlSetting(CURLOPT_PROXY, $conf['http']['proxy']['proxy_host']);
         $this->_client->addCurlSetting(CURLOPT_PROXYPORT, $conf['http']['proxy']['proxy_port']);
         if (!empty($conf['http']['proxy']['proxy_user']) && !empty($conf['http']['proxy']['proxy_pass'])) {
             $this->_client->addCurlSetting(CURLOPT_PROXYUSERPWD, $conf['http']['proxy']['proxy_user'] . ':' . $conf['http']['proxy']['proxy_pass']);
         }
     }
     return $this->_client;
 }