1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
12: class Kronolith_Storage_Kolab extends Kronolith_Storage
13: {
14: protected $_params = array();
15:
16: public function __construct($user, array $params = array())
17: {
18: $this->_user = $user;
19: $this->_params = $params;
20: }
21:
22: 23: 24:
25: public function search($email, $private_only = false)
26: {
27: global $conf;
28:
29: if (class_exists('Horde_Kolab_Session')) {
30: $session = Horde_Kolab_Session::singleton();
31: $server = $session->freebusy_server;
32: } else {
33: $server = sprintf('%s://%s:%d/freebusy/',
34: $conf['storage']['freebusy']['protocol'],
35: Kolab::getServer('imap'),
36: $conf['storage']['freebusy']['port']);
37: }
38:
39: $fb_url = sprintf('%s/%s.xfb', $server, $email);
40:
41: $options['method'] = 'GET';
42: $options['timeout'] = 5;
43: $options['allowRedirects'] = true;
44:
45: if (!empty($GLOBALS['conf']['http']['proxy']['proxy_host'])) {
46: $options = array_merge($options, $GLOBALS['conf']['http']['proxy']);
47: }
48:
49: $http = new HTTP_Request($fb_url, $options);
50: $http->setBasicAuth($GLOBALS['registry']->getAuth(), $GLOBALS['registry']->getAuthCredential('password'));
51: @$http->sendRequest();
52: if ($http->getResponseCode() != 200) {
53: throw new Horde_Exception_NotFound();
54: }
55: $vfb_text = $http->getResponseBody();
56:
57: $iCal = new Horde_Icalendar;
58: $iCal->parsevCalendar($vfb_text);
59:
60: $vfb = $iCal->findComponent('VFREEBUSY');
61: if ($vfb === false) {
62: throw new Horde_Exception_NotFound();
63: }
64:
65: return $vfb;
66: }
67:
68: public function store($email, $vfb, $public = false)
69: {
70:
71:
72: }
73:
74: }
75: