示例#1
0
 public function __construct($params)
 {
     // extract context path from host if specified
     // (owncloud install path on host)
     $host = $params['host'];
     $contextPath = '';
     $hostSlashPos = strpos($host, '/');
     if ($hostSlashPos !== false) {
         $contextPath = substr($host, $hostSlashPos);
         $host = substr($host, 0, $hostSlashPos);
     }
     if (substr($contextPath, 1) !== '/') {
         $contextPath .= '/';
     }
     if (isset($params['root'])) {
         $root = $params['root'];
         if (substr($root, 1) !== '/') {
             $root = '/' . $root;
         }
     } else {
         $root = '/';
     }
     $params['host'] = $host;
     $params['root'] = $contextPath . self::OC_URL_SUFFIX . $root;
     parent::__construct($params);
 }
示例#2
0
 public function __construct($options)
 {
     $this->manager = $options['manager'];
     $this->remote = $options['remote'];
     $this->remoteUser = $options['owner'];
     list($protocol, $remote) = explode('://', $this->remote);
     list($host, $root) = explode('/', $remote, 2);
     $secure = $protocol === 'https';
     $root = rtrim($root, '/') . '/public.php/webdav';
     $this->mountPoint = $options['mountpoint'];
     $this->token = $options['token'];
     parent::__construct(array('secure' => $secure, 'host' => $host, 'root' => $root, 'user' => $options['token'], 'password' => $options['password']));
 }
示例#3
0
 public function __construct($options)
 {
     $this->manager = $options['manager'];
     $this->certificateManager = $options['certificateManager'];
     $this->remote = $options['remote'];
     $this->remoteUser = $options['owner'];
     list($protocol, $remote) = explode('://', $this->remote);
     if (strpos($remote, '/')) {
         list($host, $root) = explode('/', $remote, 2);
     } else {
         $host = $remote;
         $root = '';
     }
     $secure = $protocol === 'https';
     $root = rtrim($root, '/') . '/public.php/webdav';
     $this->mountPoint = $options['mountpoint'];
     $this->token = $options['token'];
     parent::__construct(array('secure' => $secure, 'host' => $host, 'root' => $root, 'user' => $options['token'], 'password' => (string) $options['password']));
     $this->getWatcher()->setPolicy(\OC\Files\Cache\Watcher::CHECK_ONCE);
 }
示例#4
0
 public function __construct($options)
 {
     $this->memcacheFactory = \OC::$server->getMemCacheFactory();
     $this->httpClient = \OC::$server->getHTTPClientService();
     $discoveryManager = new DiscoveryManager($this->memcacheFactory, \OC::$server->getHTTPClientService());
     $this->manager = $options['manager'];
     $this->certificateManager = $options['certificateManager'];
     $this->remote = $options['remote'];
     $this->remoteUser = $options['owner'];
     list($protocol, $remote) = explode('://', $this->remote);
     if (strpos($remote, '/')) {
         list($host, $root) = explode('/', $remote, 2);
     } else {
         $host = $remote;
         $root = '';
     }
     $secure = $protocol === 'https';
     $root = rtrim($root, '/') . $discoveryManager->getWebDavEndpoint($this->remote);
     $this->mountPoint = $options['mountpoint'];
     $this->token = $options['token'];
     parent::__construct(array('secure' => $secure, 'host' => $host, 'root' => $root, 'user' => $options['token'], 'password' => (string) $options['password']));
 }
示例#5
0
文件: owncloud.php 项目: evanjt/core
 public function __construct($params)
 {
     // extract context path from host if specified
     // (owncloud install path on host)
     $host = $params['host'];
     // strip protocol
     if (substr($host, 0, 8) == "https://") {
         $host = substr($host, 8);
         $params['secure'] = true;
     } else {
         if (substr($host, 0, 7) == "http://") {
             $host = substr($host, 7);
             $params['secure'] = false;
         }
     }
     $contextPath = '';
     $hostSlashPos = strpos($host, '/');
     if ($hostSlashPos !== false) {
         $contextPath = substr($host, $hostSlashPos);
         $host = substr($host, 0, $hostSlashPos);
     }
     if (substr($contextPath, -1) !== '/') {
         $contextPath .= '/';
     }
     if (isset($params['root'])) {
         $root = $params['root'];
         if (substr($root, 0, 1) !== '/') {
             $root = '/' . $root;
         }
     } else {
         $root = '/';
     }
     $params['host'] = $host;
     $params['root'] = $contextPath . self::OC_URL_SUFFIX . $root;
     parent::__construct($params);
 }