summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas B <roundcube@gmail.com>2012-05-08 06:34:29 (GMT)
committerThomas B <roundcube@gmail.com>2012-05-08 06:34:29 (GMT)
commit8a7eb6a6c34d1ef35a2a3b677eda1184478b84f6 (patch)
treedb0e3bb8310c3bd545caf212e0e9db72da6c7786
parent3df2e08844341f7c8e782ea2dfafa9c061e3f4ab (diff)
downloadroundcubemail-plugins-kolab-8a7eb6a6c34d1ef35a2a3b677eda1184478b84f6.tar.gz
Send user authentication if required for free-busy download; uses PEAR HTTP_Request class
-rw-r--r--plugins/calendar/drivers/kolab/kolab_driver.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php
index adca962..0dd4877 100644
--- a/plugins/calendar/drivers/kolab/kolab_driver.php
+++ b/plugins/calendar/drivers/kolab/kolab_driver.php
@@ -901,6 +901,7 @@ class kolab_driver extends calendar_driver
public function get_freebusy_list($email, $start, $end)
{
require_once('Horde/iCalendar.php');
+ require_once('HTTP/Request.php');
if (empty($email)/* || $end < time()*/)
return false;
@@ -913,7 +914,17 @@ class kolab_driver extends calendar_driver
'OOF' => calendar::FREEBUSY_OOF);
// ask kolab server first
- $fbdata = @file_get_contents(rcube_kolab::get_freebusy_url($email));
+ $request = new HTTP_Request($url = rcube_kolab::get_freebusy_url($email));
+ $result = $request->sendRequest(true);
+
+ // authentication required
+ if (!PEAR::isError($result) && $request->getResponseCode() == 401) {
+ $request->setBasicAuth($this->rc->user->get_username(), $this->rc->decrypt($_SESSION['password']));
+ $result = $request->sendRequest(true);
+ }
+
+ if (!PEAR::isError($result) && $request->getResponseCode() == 200)
+ $fbdata = $request->getResponseBody();
// get free-busy url from contacts
if (!$fbdata) {