예제 #1
0
 /**
  *  Default constructor for CalDAV client.
  *
  * @param string Caldav URI to appropriate calendar.
  * @param string Username for HTTP basic auth.
  * @param string Password for HTTP basic auth.
  * @param boolean Verify SSL cert. // Mod by Rosali (https://gitlab.awesome-it.de/kolab/roundcube-plugins/issues/1)
  */
 public function __construct($uri, $user = null, $pass = null, $authtype = 'detect', $verifySSL = array(true, true))
 {
     $this->user_agent = 'MyRoundcube-SabreDAV/' . Sabre\DAV\Version::VERSION;
     // Include libvcalendar on demand ...
     if (!class_exists("libvcalendar")) {
         require_once INSTALL_PATH . 'plugins/libgpl/libcalendaring/libvcalendar.php';
     }
     $this->libvcal = new libvcalendar();
     $this->rc = rcube::get_instance();
     $tokens = parse_url($uri);
     $this->base_uri = $tokens['scheme'] . "://" . $tokens['host'] . ($tokens['port'] ? ":" . $tokens['port'] : null);
     $this->path = $tokens['path'] . ($tokens['query'] ? "?" . $tokens['query'] : null);
     switch ($authtype) {
         case 'digest':
             $auth = Sabre\DAV\Client::AUTH_DIGEST;
             break;
         case 'basic':
             $auth = Sabre\DAV\Client::AUTH_BASIC;
             break;
         default:
             $auth = Sabre\DAV\Client::AUTH_BASIC | Sabre\DAV\Client::AUTH_DIGEST;
     }
     $settings = array('baseUri' => $this->base_uri, 'authType' => $auth);
     if ($user) {
         $settings['userName'] = $user;
     }
     if ($pass) {
         $settings['password'] = $pass;
     }
     parent::__construct($settings);
     $this->verifyPeer = $verifySSL[0];
     $this->verifyHost = $verifySSL[1];
 }
예제 #2
0
파일: Client.php 프로젝트: jubinpatel/horde
 /**
  * Constructor
  *
  * Settings are provided through the 'settings' argument. The following
  * settings are supported:
  *
  *   * client
  *   * baseUri
  *   * userName (optional)
  *   * password (optional)
  *   * proxy (optional)
  *
  * @param array $settings
  */
 public function __construct(array $settings)
 {
     if (!isset($settings['client'])) {
         throw new InvalidArgumentException('A client must be provided');
     }
     $this->_http = $settings['client'];
     $this->propertyMap['{DAV:}current-user-privilege-set'] = 'Sabre\\DAVACL\\Property\\CurrentUserPrivilegeSet';
     parent::__construct($settings);
 }