From 6b37b2b4228d136e68e1a1346617be61bbf5a2d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ja=CC=81n=20Ma=CC=81te=CC=81?= Date: Mon, 24 Mar 2014 01:52:52 +0100 Subject: [PATCH] fixed masking of confidential event components --- inc/DAVResource.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/inc/DAVResource.php b/inc/DAVResource.php index 8ed84357..d5c309d7 100644 --- a/inc/DAVResource.php +++ b/inc/DAVResource.php @@ -186,7 +186,7 @@ class DAVResource * @param object $row The row from the DB. */ function FromRow($row) { - global $c; + global $c, $session; if ( $row == null ) return; @@ -283,17 +283,24 @@ class DAVResource $this->resource->location = null; $this->resource->url = null; } - else if ( isset($c->hide_alarm) && $c->hide_alarm && !$this->HavePrivilegeTo('write') ) { - $vcal1 = new iCalComponent($this->resource->caldav_data); - $comps = $vcal1->GetComponents(); - $vcal2 = new iCalComponent(); - $vcal2->VCalendar(); - foreach( $comps AS $comp ) { - $comp->ClearComponents('VALARM'); - $vcal2->AddComponent($comp); + else { + if ( strtoupper($this->resource->class)=='CONFIDENTIAL' && !$this->HavePrivilegeTo('all') && $session->user_no != $this->resource->user_no ) { + $vcal = new iCalComponent($this->resource->caldav_data); + $confidential = $vcal->CloneConfidential(); + $this->resource->caldav_data = $confidential->Render(); + } + if ( isset($c->hide_alarm) && $c->hide_alarm && !$this->HavePrivilegeTo('write') ) { + $vcal1 = new iCalComponent($this->resource->caldav_data); + $comps = $vcal1->GetComponents(); + $vcal2 = new iCalComponent(); + $vcal2->VCalendar(); + foreach( $comps AS $comp ) { + $comp->ClearComponents('VALARM'); + $vcal2->AddComponent($comp); + } + $this->resource->displayname = $this->resource->summary = $vcal2->GetPValue('SUMMARY'); + $this->resource->caldav_data = $vcal2->Render(); } - $this->resource->displayname = $this->resource->summary = $vcal2->GetPValue('SUMMARY'); - $this->resource->caldav_data = $vcal2->Render(); } } else if ( strtoupper(substr($this->resource->caldav_data,0,11)) == 'BEGIN:VCARD' ) {