diff --git a/application/config/routes.php b/application/config/routes.php index b0e96989c..0807c372e 100644 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -139,8 +139,6 @@ $route['api/frontend/v1/treemenudata/lvverwaltung/stdsem/(:any)/emp/(:any)/stg/( $route['api/frontend/v1/lvplan/calendar-events'] = 'api/frontend/v1/LvPlanCalendarEvents/getCalendarData'; -$route['lvplan/caldav'] = 'LvPlanCalDAV'; -$route['lvplan/caldav/.*'] = 'LvPlanCalDAV'; // load routes from extensions, also look for environment-specific configs $subdirs = ['application/config/extensions', 'application/config/' . ENVIRONMENT . '/extensions']; diff --git a/application/controllers/LvPlanCalDAV.php b/application/controllers/LvPlanCalDAV.php deleted file mode 100644 index e45478f62..000000000 --- a/application/controllers/LvPlanCalDAV.php +++ /dev/null @@ -1,58 +0,0 @@ -load->library('sabredav/SabreDAVAuthLib'); - $this->load->library('sabredav/SabreDAVCalDAVLib'); - } - - // ----------------------------------------------------------------------------------------------------------------- - // Public methods - public function index() - { - - $authBackend = new SabreDAVAuthLib(); - $principalBackend = new SabreDAVACLPrincipalBackend($authBackend); - $calendarBackend = new SabreDAVCalDAVBackend($authBackend); - - $tree = array( - new \Sabre\CalDAV\Principal\Collection($principalBackend), - new \Sabre\CalDAV\CalendarRoot($principalBackend, $calendarBackend) - ); - - $server = new \Sabre\DAV\Server($tree); - - $baseUri = '/' . implode('/', array_filter([ - trim(BASE_LOCATION, '/'), - trim($this->config->item('index_page'), '/'), - 'lvplan', - 'caldav' - ])); - $server->setBaseUri($baseUri); - - $authBackend->setRealm('SabreDAV'); - $authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend); - $server->addPlugin($authPlugin); - - $caldavPlugin = new \Sabre\CalDAV\Plugin(); - $server->addPlugin($caldavPlugin); - - $aclPlugin = new \Sabre\DAVACL\Plugin(); - $server->addPlugin($aclPlugin); - - $browser = new \Sabre\DAV\Browser\Plugin(); - $server->addPlugin($browser); - - $server->exec(); - } -} diff --git a/application/controllers/system/MigrateKalender.php b/application/controllers/system/MigrateKalender.php index 2185da07a..d1d29e2ab 100644 --- a/application/controllers/system/MigrateKalender.php +++ b/application/controllers/system/MigrateKalender.php @@ -625,21 +625,6 @@ class MigrateKalender extends CLI_Controller } } - $rooms = is_array($block->orte_kurzbz) ? $block->orte_kurzbz : explode(',', $block->orte_kurzbz ?? ''); - foreach ($rooms as $room_kurzbz) - { - $room_kurzbz = trim($room_kurzbz); - if (!empty($room_kurzbz)) - { - $this->KalenderOrtModel->insert( - array ( - 'kalender_id' => $kalender_id, - 'ort_kurzbz' => $room_kurzbz - ) - ); - } - } - foreach ($block->svg_kombis as $kombi_str) { $kombi_str = trim($kombi_str, '()'); diff --git a/application/helpers/hlp_common_helper.php b/application/helpers/hlp_common_helper.php index d4bf33baf..b9ce6b200 100644 --- a/application/helpers/hlp_common_helper.php +++ b/application/helpers/hlp_common_helper.php @@ -579,4 +579,4 @@ function generateUUID() $data[8] = chr(ord($data[8]) & 0x3f | 0x80); return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); -} +} \ No newline at end of file diff --git a/application/libraries/KalenderLib.php b/application/libraries/KalenderLib.php index cc439704b..522055347 100644 --- a/application/libraries/KalenderLib.php +++ b/application/libraries/KalenderLib.php @@ -1590,17 +1590,6 @@ class KalenderLib $kalender_entry = getData($entryResult); - - $calendarResources = $this->_ci->BetriebsmittelKalenderModel->loadWhere(['eindeutige_kalender_gruppen_id' => $kalender_entry->eindeutige_kalender_gruppen_id]); - if (isError($calendarResources)) return $calendarResources; - - $calendarResourcesItems = getData($calendarResources); - $calendarResourcesIDs = []; - if (is_array($calendarResourcesItems)) { - $calendarResourcesIDs = array_map(function($resource) { - return $resource->betriebsmittel_id; - }, getData($calendarResources)); - } if (!$this->_checkPermission($kalender_entry->lehreinheit_id)) { diff --git a/application/libraries/collision/checks/LectureCollisionCheck.php b/application/libraries/collision/checks/LectureCollisionCheck.php index 4e5a2dc25..e98677d8d 100644 --- a/application/libraries/collision/checks/LectureCollisionCheck.php +++ b/application/libraries/collision/checks/LectureCollisionCheck.php @@ -308,4 +308,4 @@ class LectureCollisionCheck implements ICollisionCheck }, getData($result)); } -} +} \ No newline at end of file diff --git a/application/libraries/sabredav/SabreDAVAuthLib.php b/application/libraries/sabredav/SabreDAVAuthLib.php deleted file mode 100644 index 65b99e0c7..000000000 --- a/application/libraries/sabredav/SabreDAVAuthLib.php +++ /dev/null @@ -1,38 +0,0 @@ -_ci =& get_instance(); - - $this->_ci->load->library('AuthLib', array(false)); - $this->_ci->load->helper('hlp_authentication'); - } - - public function getCurrentUser() - { - if ($this->currentUser) - return $this->currentUser; - - if (isLogged()) - return getAuthUID(); - - return null; - } - - protected function validateUserPass($username, $password) - { - if (isSuccess($this->_ci->authlib->checkUserAuthByUsernamePassword($username, $password))) - { - $this->currentUser = $username; - return true; - } - - $this->currentUser = null; - return false; - } -} \ No newline at end of file diff --git a/application/libraries/sabredav/SabreDAVCalDAVLib.php b/application/libraries/sabredav/SabreDAVCalDAVLib.php deleted file mode 100644 index 7b78344a4..000000000 --- a/application/libraries/sabredav/SabreDAVCalDAVLib.php +++ /dev/null @@ -1,11 +0,0 @@ -auth = $auth; - - /* - $ma = new mitarbeiter(); - $this->result_ma = $ma->getMitarbeiter(null,null,null); - */ - } - - /** - * Liefert den eingeloggten User - */ - function getUser() - { - return $this->auth->getCurrentUser(); - } - - - /** - * Returns a list of principals based on a prefix. - * - * This prefix will often contain something like 'principals'. You are only - * expected to return principals that are in this base path. - * - * You are expected to return at least a 'uri' for every user, you can - * return any additional properties if you wish so. Common properties are: - * {DAV:}displayname - * {http://sabredav.org/ns}email-address - This is a custom SabreDAV - * field that's actualy injected in a number of other properties. If - * you have an email address, use this property. - * - * @param string $prefixPath - * @return array - */ - public function getPrincipalsByPrefix($prefixPath) - { - //$prefixPath = principals - //error_log('Principal.php/getPrincipalsByPrefix('.$prefixPath.')'); - $principals = array(); - $user = $this->getUser(); - - if($prefixPath=='principals') - { - - $principals[] = array( - 'id' => $user, - 'uri' => 'principals/'.$user, - '{DAV:}displayname' => $user, - '{http://sabredav.org/ns}email-address' => $user.'@example.com', - ); - } - - return $principals; - - } - - /** - * Returns a specific principal, specified by it's path. - * The returned structure should be the exact same as from - * getPrincipalsByPrefix. - * - * @param string $path - * @return array - */ - public function getPrincipalByPath($path) - { - $user = mb_substr($path,11); - - $result = array( - 'id' => $user, - 'uri' => 'principals/'.$user, - '{DAV:}displayname' => $user, - '{http://sabredav.org/ns}email-address' => $user.'@example.com', - ); - - return $result; - } - - /** - * Returns the list of members for a group-principal - * - * @param string $principal - * @return array - */ - public function getGroupMemberSet($principal) - { - $result = array(); - - return $result; - } - - /** - * Returns the list of groups a principal is a member of - * - * @param string $principal - * @return array - */ - public function getGroupMembership($principal) - { - $result = array(); - if(preg_match('/^principals\/[0-9A-Za-z\-]*$/',$principal)) - { - $user = mb_substr($principal,11); - } - return $result; - - } - - /** - * Updates the list of group members for a group principal. - * - * The principals should be passed as a list of uri's. - * - * @param string $principal - * @param array $members - * @return void - */ - public function setGroupMemberSet($principal, array $members) - { - throw new \Sabre\DAV\Exception('Not implemented'); - } - - public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) - { - $propPatch->setRemainingResultCode(403); - } - - public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') - { - return array(); - } - - public function findByUri($uri, $principalPrefix) - { - return null; - } -} diff --git a/application/libraries/sabredav/caldav/SabreDAVCalDAVBackend.php b/application/libraries/sabredav/caldav/SabreDAVCalDAVBackend.php deleted file mode 100644 index a0c3b8c47..000000000 --- a/application/libraries/sabredav/caldav/SabreDAVCalDAVBackend.php +++ /dev/null @@ -1,575 +0,0 @@ -auth = $auth; - - $this->CI =& get_instance(); - } - - /** - * Liefert den eingeloggten User - */ - function getUser() - { - return $this->auth->getCurrentUser(); - } - - /** - * Returns a list of calendars for a principal. - * - * Every project is an array with the following keys: - * * id, a unique id that will be used by other functions to modify the - * calendar. This can be the same as the uri or a database key. - * * uri, which the basename of the uri with which the calendar is - * accessed. - * * principalUri. The owner of the calendar. Almost always the same as - * principalUri passed to this method. - * - * Furthermore it can contain webdav properties in clark notation. A very - * common one is '{DAV:}displayname'. - * - * @param string $principalUri - * @return array - */ - public function getCalendarsForUser($principalUri) - { - $user = mb_substr($principalUri,11); - $calendars = array(); - $calendar = array( - 'id' => $user, - 'uri' => self::CALENDAR_NAME.'-'.$user, - 'principaluri' => 'principals/'.$user, - '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => $this->buildCalendarCtag($user), - '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new \Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet(array('VEVENT')), - '{DAV:}displayname' => self::CALENDAR_NAME, - '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description comes here', - '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'Europe/Vienna', - '{http://apple.com/ns/ical/}calendar-order' => '1', - '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', - '{http://sabredav.org/ns}read-only' => 1 - ); - $calendars[] = $calendar; - - return $calendars; - } - - /** - * Creates a new calendar for a principal. - * - * If the creation was a success, an id must be returned that can be used to reference - * this calendar in other methods, such as updateCalendar - * - * @param string $principalUri - * @param string $calendarUri - * @param array $properties - */ - public function createCalendar($principalUri,$calendarUri, array $properties) - { - return $calendarUri; - } - - /** - * Updates properties for a calendar. - * - * The mutations array uses the propertyName in clark-notation as key, - * and the array value for the property value. In the case a property - * should be deleted, the property value will be null. - * - * This method must be atomic. If one property cannot be changed, the - * entire operation must fail. - * - * If the operation was successful, true can be returned. - * If the operation failed, false can be returned. - * - * Deletion of a non-existant property is always succesful. - * - * Lastly, it is optional to return detailed information about any - * failures. In this case an array should be returned with the following - * structure: - * - * array( - * 403 => array( - * '{DAV:}displayname' => null, - * ), - * 424 => array( - * '{DAV:}owner' => null, - * ) - * ) - * - * In this example it was forbidden to update {DAV:}displayname. - * (403 Forbidden), which in turn also caused {DAV:}owner to fail - * (424 Failed Dependency) because the request needs to be atomic. - * - * @param string $calendarId - * @param array $mutations - * @return bool|array - */ - public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) - { - $propPatch->setRemainingResultCode(200); - } - - /** - * Delete a calendar and all it's objects - * - * @param string $calendarId - * @return void - */ - public function deleteCalendar($calendarId) - { - return null; - } - - - public function getCalendarData($userUID, $objectUri=null) - { - $this->CI->load->model("ressource/Mitarbeiter_model", "MitarbeiterModel"); - $this->CI->load->model("person/Benutzer_model", "BenutzerModel"); - - $user = $this->CI->BenutzerModel->loadWhere(array("uid" => $userUID)); - if(!$user) - die('User invalid'); - - $this->CI->load->library('KalenderLib', ['uid' => $userUID]); - - $isUserEmployeeResult = $this->CI->MitarbeiterModel->isMitarbeiter($userUID); - if (isError($isUserEmployeeResult)) { - return; - } - $isUserEmployee = getData($isUserEmployeeResult); - - $startDate = date('Y-m-d', mktime(0,0,0,date('m'),date('d')-14,date('Y'))); - $endDate = date('Y-m-d', mktime(0,0,0,date('m')+6,date('d'),date('Y'))); - - $data = []; - - if ($isUserEmployee) { - $data = $this->CI->kalenderlib->getPlanForLecturerByLecturer($startDate, $endDate, $userUID); - } else { - $data = $this->CI->kalenderlib->getPlanForStudentByStudent($startDate, $endDate, $userUID); - } - - if(!is_array($data)) - $data = array(); - - foreach($data as $item) - { - $item->calendarDataFragment = $this->buildCalendarDataFragment($item); - } - - if (is_null($objectUri)) - { - return $data; - } - - $normalizedObjectUri = $this->normalizeObjectUri($objectUri); - foreach($data as $row) - { - if(md5($row->eindeutige_kalender_gruppen_id) == $normalizedObjectUri) - { - return $row; - } - } - - return null; - } - - public function makeCal($event) - { - return $this->buildICalLine('BEGIN', 'VCALENDAR') - .$this->buildICalLine('VERSION', '2.0') - .$this->buildICalTextLine('PRODID', 'FH Technikum Wien') - .$this->buildICalLine('BEGIN', 'VTIMEZONE') - .$this->buildICalLine('TZID', 'Europe/Vienna') - .$this->buildICalLine('BEGIN', 'DAYLIGHT') - .$this->buildICalLine('TZOFFSETFROM', '+0100') - .$this->buildICalLine('RRULE', 'FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU') - .$this->buildICalLine('DTSTART', '19810329T020000') - .$this->buildICalLine('TZNAME', 'GMT+02:00') - .$this->buildICalLine('TZOFFSETTO', '+0200') - .$this->buildICalLine('END', 'DAYLIGHT') - .$this->buildICalLine('BEGIN', 'STANDARD') - .$this->buildICalLine('TZOFFSETFROM', '+0200') - .$this->buildICalLine('RRULE', 'FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU') - .$this->buildICalLine('DTSTART', '19961027T030000') - .$this->buildICalLine('TZNAME', 'GMT+01:00') - .$this->buildICalLine('TZOFFSETTO', '+0100') - .$this->buildICalLine('END', 'STANDARD') - .$this->buildICalLine('END', 'VTIMEZONE') - .$event - .$this->buildICalLine('END', 'VCALENDAR'); - } - - protected function buildCalendarDataFragment($item) - { - $summaryIcon = ''; - $summary = $item->type == 'reservierung' ? $item->titel : $item->topic; - - $description = ""; - if ($item->type == 'reservierung') { - $description = $item->beschreibung; - } else { - $description = $item->lehrfach_bez . "\r\n"; - - if (isset($item->lektor) && is_array($item->lektor) && count($item->lektor) > 0) { - $description .= "Lektor*in: " . join(", ", array_map(function($teacher) { return $teacher["kurzbz"]; }, $item->lektor)) . "\r\n"; - } - } - - - $category = self::CAL_CATEGORY_STUNDENPLAN; - if ($item->type === 'lehreinheit') { - if ($item->lehrform === 'EXAM') { - $summaryIcon = self::CAL_CATEGORY_STUNDENPLAN_EXAM_ICON; - $category = self::CAL_CATEGORY_STUNDENPLAN_EXAM; - } else if (!isset($item->ko_ort_kurzbz) || $item->ko_ort_kurzbz === '') { - $summaryIcon = self::CAL_CATEGORY_STUNDENPLAN_REMOTE_ICON; - $category = self::CAL_CATEGORY_STUNDENPLAN_REMOTE; - } - } else if ($item->type === 'reservierung' && (!isset($item->ko_ort_kurzbz) || $item->ko_ort_kurzbz === '')) { - $summaryIcon = self::CAL_CATEGORY_RESERVATION_ICON; - $category = self::CAL_CATEGORY_STUNDENPLAN_REMOTE; - } - - if ($summaryIcon !== '') { - $summary = $summaryIcon . ' ' . $summary; - } - - $parsedStartDate = $this->formatICalLocalDateTime($item->isostart); - $parsedEndDate = $this->formatICalLocalDateTime($item->isoend); - $lastModified = $this->formatICalUtcDateTime(isset($item->updateamum) ? $item->updateamum : null); - $dtStamp = $lastModified ?: $this->formatICalUtcDateTime($item->isostart); - - if($dtStamp === null) - $dtStamp = '19700101T000000Z'; - - $fragment = $this->buildICalLine('BEGIN', 'VEVENT') - .$this->buildICalTextLine('UID', $item->eindeutige_kalender_gruppen_id) - .$this->buildICalLine('SEQUENCE', (int)$item->kalender_id) - .$this->buildICalTextLine('SUMMARY', $summary) - .$this->buildICalTextLine('DESCRIPTION', $description) - .$this->buildICalTextLine('LOCATION', isset($item->ort_kurzbz) ? $item->ort_kurzbz : '') - .$this->buildICalTextLine('CATEGORIES', $category) - .$this->buildICalLine('DTSTART', $parsedStartDate, array('TZID' => 'Europe/Vienna')) - .$this->buildICalLine('DTEND', $parsedEndDate, array('TZID' => 'Europe/Vienna')); - - if($lastModified !== null) - $fragment .= $this->buildICalLine('LAST-MODIFIED', $lastModified); - - return $fragment - .$this->buildICalLine('DTSTAMP', $dtStamp) - .$this->buildICalLine('END', 'VEVENT'); - } - - protected function buildCalendarCtag($userUID) - { - $data = $this->getCalendarData($userUID); - if(!is_array($data)) - $data = array(); - - $fragments = array(); - foreach($data as $row) - { - $lastModified = isset($row->updateamum) ? $this->getLastModifiedTimestamp($row->updateamum) : null; - $calendarData = isset($row->calendarDataFragment) ? $this->makeCal($row->calendarDataFragment) : ''; - $fragments[] = $this->getObjectUri($row).':'.$lastModified.':'.md5($calendarData); - } - - sort($fragments, SORT_STRING); - return self::CALENDAR_NAME.'-'.$userUID.'-'.md5(implode('|', $fragments)); - } - - protected function buildICalTextLine($name, $value, array $parameters = array()) - { - return $this->buildICalLine($name, $this->escapeICalText($value), $parameters); - } - - protected function buildICalLine($name, $value, array $parameters = array()) - { - $line = strtoupper($name); - - foreach($parameters as $parameterName => $parameterValue) - { - $parameterValues = is_array($parameterValue) ? $parameterValue : array($parameterValue); - $escapedValues = array(); - - foreach($parameterValues as $singleParameterValue) - $escapedValues[] = $this->escapeICalParameterValue($singleParameterValue); - - $line .= ';'.strtoupper($parameterName).'='.implode(',', $escapedValues); - } - - return $this->foldICalLine($line.':'.(string)$value); - } - - protected function foldICalLine($line) - { - $line = (string)$line; - $folded = ''; - - while(strlen($line) > 75) - { - $part = mb_strcut($line, 0, 75, 'UTF-8'); - $folded .= $part."\r\n"; - $line = ' '.mb_strcut($line, strlen($part), strlen($line) - strlen($part), 'UTF-8'); - } - - return $folded.$line."\r\n"; - } - - protected function escapeICalText($value) - { - $value = (string)$value; - $value = str_replace('\\', '\\\\', $value); - $value = str_replace(array("\r\n", "\r", "\n"), '\n', $value); - return str_replace(array(';', ','), array('\;', '\,'), $value); - } - - protected function escapeICalParameterValue($value) - { - $value = (string)$value; - $value = str_replace(array('\\', '"', "\r", "\n"), array('\\\\', '\"', '', ''), $value); - - if(preg_match('/[;:,]/', $value)) - return '"'.$value.'"'; - - return $value; - } - - protected function formatICalLocalDateTime($dateTime) - { - $dateTime = $this->createDateTime($dateTime); - if($dateTime === null) - return null; - - $dateTime->setTimezone(new DateTimeZone('Europe/Vienna')); - return $dateTime->format('Ymd\THis'); - } - - protected function formatICalUtcDateTime($dateTime) - { - $dateTime = $this->createDateTime($dateTime); - if($dateTime === null) - return null; - - $dateTime->setTimezone(new DateTimeZone('UTC')); - return $dateTime->format('Ymd\THis\Z'); - } - - protected function createDateTime($dateTime) - { - if($dateTime instanceof DateTime) - return clone $dateTime; - - if($dateTime === null || $dateTime === '') - return null; - - try - { - if(is_numeric($dateTime)) - return new DateTime('@'.(int)$dateTime); - - return new DateTime($dateTime); - } - catch(Exception $e) - { - return null; - } - } - - protected function getObjectUri($row) - { - return md5($row->eindeutige_kalender_gruppen_id).'.ics'; - } - - protected function normalizeObjectUri($objectUri) - { - $normalizedObjectUri = (string)$objectUri; - - if(substr($normalizedObjectUri, -4) === '.ics') - $normalizedObjectUri = substr($normalizedObjectUri, 0, -4); - - if(mb_strpos($normalizedObjectUri, '@') !== false) - $normalizedObjectUri = mb_substr($normalizedObjectUri, mb_strpos($normalizedObjectUri, '@') + 1); - - if($this->hasObjectUriDatePrefix($normalizedObjectUri)) - return mb_substr($normalizedObjectUri, mb_strpos($normalizedObjectUri, '-') + 1); - - return $normalizedObjectUri; - } - - protected function hasObjectUriDatePrefix($objectUri) - { - $hyphenPosition = mb_strpos($objectUri, '-'); - if($hyphenPosition !== 15) - return false; - - return preg_match('/^\d{8}T\d{6}$/', mb_substr($objectUri, 0, 15)) === 1; - } - - protected function buildCalendarObject($row, $calendarId) - { - $calendarData = $this->makeCal($row->calendarDataFragment); - - return array( - "id"=>$row->eindeutige_kalender_gruppen_id, - "calendardata"=>$calendarData, - "uri"=>$this->getObjectUri($row), - "lastmodified"=>$this->getLastModifiedTimestamp($row->updateamum), - "etag"=>'"'.md5($calendarData).'"', - "calendarid"=>$calendarId, - "size"=>strlen($calendarData), - "component"=>'vevent' - ); - } - - protected function getLastModifiedTimestamp($lastModified) - { - if($lastModified === null || $lastModified === '') - return null; - - if(is_numeric($lastModified)) - return (int)$lastModified; - - $timestamp = strtotime($lastModified); - if($timestamp === false) - return null; - - return $timestamp; - } - - /** - * Returns all calendar objects within a calendar. - * - * Every item contains an array with the following keys: - * * id - unique identifier which will be used for subsequent updates - * * calendardata - The iCalendar-compatible calnedar data - * * uri - a unique key which will be used to construct the uri. This can be any arbitrary string. - * * lastmodified - a timestamp of the last modification time - * * etag - An arbitrary string, surrounded by double-quotes. (e.g.: - * ' "abcdef"') - * * calendarid - The calendarid as it was passed to this function. - * - * Note that the etag is optional, but it's highly encouraged to return for - * speed reasons. - * - * The calendardata is also optional. If it's not returned - * 'getCalendarObject' will be called later, which *is* expected to return - * calendardata. - * - * @param string $calendarId - * @return array - */ - public function getCalendarObjects($calendarId) - { - //$user = $this->getUser(); - $user = $calendarId; - $data = $this->getCalendarData($user); - - //error_log("Caldav_Backend.php/getCalendarObjects($calendarId) "); - $return = array(); - - if(!is_array($data)) - return $return; - - foreach($data as $row) - { - $return[] = $this->buildCalendarObject($row, $calendarId); - } - return $return; - } - - /** - * Returns information from a single calendar object, based on it's object - * uri. - * - * The returned array must have the same keys as getCalendarObjects. The - * 'calendardata' object is required here though, while it's not required - * for getCalendarObjects. - * - * @param string $calendarId - * @param string $objectUri - * @return array - */ - public function getCalendarObject($calendarId,$objectUri) - { - $user = $calendarId; - $data = $this->getCalendarData($user,$objectUri); - - if(empty($data)) - { - return null; - } - elseif(is_object($data)) - { - $ret = $this->buildCalendarObject($data, $calendarId); - } - - return isset($ret) ? $ret : null; - } - - /** - * Creates a new calendar object. - * - * @param string $calendarId - * @param string $objectUri - * @param string $calendarData - * @return void - */ - public function createCalendarObject($calendarId,$objectUri,$calendarData) - { - return null; - } - - /** - * Updates an existing calendarobject, based on it's uri. - * - * @param string $calendarId - * @param string $objectUri - * @param string $calendarData - * @return void - */ - public function updateCalendarObject($calendarId,$objectUri,$calendarData) - { - if(is_resource($calendarData)) - $calendarData = stream_get_contents($calendarData); - - return '"'.md5((string)$calendarData).'"'; - } - - /** - * Deletes an existing calendar object. - * - * @param string $calendarId - * @param string $objectUri - * @return void - */ - public function deleteCalendarObject($calendarId,$objectUri) - { - return null; - } -} diff --git a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyACL.php b/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyACL.php deleted file mode 100644 index 5407631d5..000000000 --- a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyACL.php +++ /dev/null @@ -1,36 +0,0 @@ - '{DAV:}read', - 'principal' => $principalUri, - 'protected' => true, - ), - array( - 'privilege' => '{DAV:}read', - 'principal' => $principalUri.'/calendar-proxy-read', - 'protected' => true, - ), - ); - - if($includeFreeBusy) - { - $acl[] = array( - 'privilege' => '{'.\Sabre\CalDAV\Plugin::NS_CALDAV.'}read-free-busy', - 'principal' => '{DAV:}authenticated', - 'protected' => true, - ); - } - - return $acl; - } - - public static function ignoreWrite() - { - return null; - } -} diff --git a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendar.php b/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendar.php deleted file mode 100644 index 37f5ff8ae..000000000 --- a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendar.php +++ /dev/null @@ -1,80 +0,0 @@ -readOnlyCaldavBackend = $caldavBackend; - $this->readOnlyCalendarInfo = $calendarInfo; - } - - public function getChild($name) - { - $obj = $this->readOnlyCaldavBackend->getCalendarObject($this->readOnlyCalendarInfo['id'], $name); - - if(!$obj) - throw new \Sabre\DAV\Exception\NotFound('Calendar object not found'); - - $obj['acl'] = $this->getCalendarObjectAcl(); - - return new SabreDAVReadOnlyCalendarObject($this->readOnlyCaldavBackend, $this->readOnlyCalendarInfo, $obj); - } - - public function getChildren() - { - $objs = $this->readOnlyCaldavBackend->getCalendarObjects($this->readOnlyCalendarInfo['id']); - $children = array(); - - foreach($objs as $obj) - { - $obj['acl'] = $this->getCalendarObjectAcl(); - $children[] = new SabreDAVReadOnlyCalendarObject($this->readOnlyCaldavBackend, $this->readOnlyCalendarInfo, $obj); - } - - return $children; - } - - public function createFile($name, $calendarData = null) - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function createDirectory($name) - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function delete() - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function setName($newName) - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function updateProperties($mutations) - { - return true; - } - - public function propPatch(\Sabre\DAV\PropPatch $propPatch) - { - $propPatch->setRemainingResultCode(200); - } - - public function getACL() - { - return SabreDAVReadOnlyACL::getAcl($this->getOwner(), true); - } - - protected function getCalendarObjectAcl() - { - return SabreDAVReadOnlyACL::getAcl($this->getOwner()); - } -} diff --git a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendarHome.php b/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendarHome.php deleted file mode 100644 index 2c0933b5b..000000000 --- a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendarHome.php +++ /dev/null @@ -1,57 +0,0 @@ -readOnlyCaldavBackend = $caldavBackend; - $this->readOnlyPrincipalInfo = $principalInfo; - } - - public function getChildren() - { - $calendars = $this->readOnlyCaldavBackend->getCalendarsForUser($this->readOnlyPrincipalInfo['uri']); - $objs = array(); - - foreach($calendars as $calendar) - { - $objs[] = new SabreDAVReadOnlyCalendar($this->readOnlyCaldavBackend, $calendar); - } - - return $objs; - } - - public function createExtendedCollection($name, \Sabre\DAV\MkCol $mkCol) - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function createFile($filename, $data = null) - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function createDirectory($filename) - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function delete() - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function setName($name) - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function getACL() - { - return SabreDAVReadOnlyACL::getAcl($this->readOnlyPrincipalInfo['uri']); - } -} diff --git a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendarObject.php b/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendarObject.php deleted file mode 100644 index 4b15c20c3..000000000 --- a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendarObject.php +++ /dev/null @@ -1,84 +0,0 @@ -readOnlyCalendarInfo = $calendarInfo; - } - - public function put($calendarData) - { - return $this->getCurrentETag(); - } - - public function getETag() - { - if($this->isWriteRequest()) - { - $ifMatch = isset($_SERVER['HTTP_IF_MATCH']) ? trim($_SERVER['HTTP_IF_MATCH']) : ''; - if($ifMatch !== '' && $ifMatch !== '*') - { - $requestedEtags = explode(',', $ifMatch); - foreach($requestedEtags as $requestedEtag) - { - $requestedEtag = trim($requestedEtag); - if($requestedEtag !== '') - return $requestedEtag; - } - } - } - - return parent::getETag(); - } - - public function getLastModified() - { - if($this->isWriteRequest()) - { - $ifUnmodifiedSince = isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE']) ? trim($_SERVER['HTTP_IF_UNMODIFIED_SINCE']) : ''; - if($ifUnmodifiedSince !== '') - { - $timestamp = strtotime($ifUnmodifiedSince); - if($timestamp !== false) - return max(0, $timestamp - 1); - } - } - - return parent::getLastModified(); - } - - public function delete() - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function setName($name) - { - return SabreDAVReadOnlyACL::ignoreWrite(); - } - - public function getACL() - { - return SabreDAVReadOnlyACL::getAcl($this->readOnlyCalendarInfo['principaluri']); - } - - protected function isWriteRequest() - { - if(!isset($_SERVER['REQUEST_METHOD'])) - return false; - - return in_array(strtoupper($_SERVER['REQUEST_METHOD']), array('PUT', 'DELETE', 'PROPPATCH', 'MOVE', 'COPY', 'PATCH'), true); - } - - protected function getCurrentETag() - { - if(isset($this->objectData['etag']) && $this->objectData['etag'] !== '') - return $this->objectData['etag']; - - return parent::getETag(); - } -} diff --git a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendarRoot.php b/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendarRoot.php deleted file mode 100644 index 345c30b12..000000000 --- a/application/libraries/sabredav/caldav/read_only_calendar/SabreDAVReadOnlyCalendarRoot.php +++ /dev/null @@ -1,17 +0,0 @@ -readOnlyCaldavBackend = $caldavBackend; - } - - public function getChildForPrincipal(array $principal) - { - return new SabreDAVReadOnlyCalendarHome($this->readOnlyCaldavBackend, $principal); - } -} diff --git a/application/views/Tempus.php b/application/views/Tempus.php index 31abd2d7c..db49c57db 100644 --- a/application/views/Tempus.php +++ b/application/views/Tempus.php @@ -10,7 +10,6 @@ 'filtercomponent' => true, 'navigationcomponent' => true, 'vuedatepicker11' => true, - 'momentjs2' => true, 'tags' => true, 'phrases' => array( 'global', diff --git a/composer.json b/composer.json index bf4093bdd..0feee3c63 100644 --- a/composer.json +++ b/composer.json @@ -443,7 +443,7 @@ } ], "require": { - "php": ">=7.0.0", + "php": ">=5.6.40", "afarkas/html5shiv": "3.7.*", "alvaro-prieto/colresizable": "1.6", @@ -506,8 +506,6 @@ "rmariuzzo/jquery-checkboxes": "1.0.7", - "sabre/dav": "4.0.3", - "sabre/event": "5.0.3", "scottjehl/respond": "1.4.2", "tapmodo/jcrop": "2.0.4", diff --git a/public/js/components/Calendar/Base/Grid/Line/Event.js b/public/js/components/Calendar/Base/Grid/Line/Event.js index d118bf6bd..e15e1a283 100644 --- a/public/js/components/Calendar/Base/Grid/Line/Event.js +++ b/public/js/components/Calendar/Base/Grid/Line/Event.js @@ -196,4 +196,4 @@ export default { ` -} +} \ No newline at end of file diff --git a/public/js/components/Calendar/Tempus.js b/public/js/components/Calendar/Tempus.js index 70c2cd062..64b5ef298 100644 --- a/public/js/components/Calendar/Tempus.js +++ b/public/js/components/Calendar/Tempus.js @@ -1,12 +1,13 @@ import FhcCalendar from "./Base.js"; -import { useEventLoader } from "../../composables/EventLoader.js"; +import { useEventLoader } from '../../composables/EventLoader.js'; + +import ModeWeek from './Mode/Week.js'; +import ModeMonth from './Mode/Month.js'; +import ModeTable from './Mode/Table.js'; +import ApiKalender from '../../api/factory/tempus/kalender.js'; +import draggable from '../../directives/draggable.js'; -import ModeWeek from "./Mode/Week.js"; -import ModeMonth from "./Mode/Month.js"; -import ModeTable from "./Mode/Table.js"; -import ApiKalender from "../../api/factory/tempus/kalender.js"; -import draggable from "../../directives/draggable.js"; export default { name: "CalendarTempus", @@ -79,70 +80,71 @@ export default { "open-reservierung" ], - data() { - return { - modes: { - week: Vue.markRaw(ModeWeek), - month: Vue.markRaw(ModeMonth), - tableList: Vue.markRaw(ModeTable), - }, - modeOptions: { - day: { - emptyMessage: Vue.computed(() => this.$p.t("lehre/noLvFound")), - emptyMessageDetails: Vue.computed(() => this.$p.t("lehre/noLvFound")), - }, - week: { - collapseEmptyDays: false, - }, - }, - currentMode: this.mode, - teachingunits: null, - hoursplan: null, - showRaster: true, - }; - }, - computed: { - backgrounds() { - let now = luxon.DateTime.now().setZone(this.timezone); + data() { + return { + modes: { + week: Vue.markRaw(ModeWeek), + month: Vue.markRaw(ModeMonth), + tableList: Vue.markRaw(ModeTable), + }, + modeOptions: { + day: { + emptyMessage: Vue.computed(() => this.$p.t('lehre/noLvFound')), + emptyMessageDetails: Vue.computed(() => this.$p.t('lehre/noLvFound')) + }, + week: { + collapseEmptyDays: false + } + }, + currentMode: this.mode, + teachingunits: null, + hoursplan: null, + showRaster: true, + }; + }, + computed: { + backgrounds() { + let now = luxon.DateTime.now().setZone(this.timezone); - let past = []; - if (this.mode == "Month") { - past = [ - { - class: "background-past", - end: now.startOf("day"), - }, - ]; - } else { - past = [ - { - class: "background-past", - end: now, - label: now - .startOf("minute") - .toISOTime({ suppressSeconds: true, includeOffset: false }), - }, - ]; - } + let past = []; + if (this.mode == 'Month') + { + past = [{ + class: 'background-past', + end: now.startOf('day') + }]; + } + else + { + past = [{ + class: 'background-past', + end: now, + label: now.startOf('minute').toISOTime({ suppressSeconds: true, includeOffset: false }) + }]; + } - return [...past, ...(this.extraBackgrounds || [])]; - }, - visibleEvents() { - let list = this.events; + return [ + ...past, + ...(this.extraBackgrounds || []) + ]; + }, + visibleEvents() + { + let list = this.events; - if (Array.isArray(this.visibleLecturers)) { - const visibleLectures = new Set(this.visibleLecturers); + if (Array.isArray(this.visibleLecturers)) + { + const visibleLectures = new Set(this.visibleLecturers); - list = list.filter((event) => { - if (!event.lektor?.length) return true; - return event.lektor.some((lektor) => - visibleLectures.has(lektor.mitarbeiter_uid), - ); - }); - } + list = list.filter(event => { + if (!event.lektor?.length) + return true; + return event.lektor.some(lektor => visibleLectures.has(lektor.mitarbeiter_uid)); + }); + } - if (!this.visibleStatus.length || this.visibleStatus.includes("all")) - return list; + if (!this.visibleStatus.length || this.visibleStatus.includes('all')) + return list; return list.filter(event => this.visibleStatus.includes(event.status_kurzbz)); }, @@ -185,40 +187,41 @@ export default { setup(props, context) { const rangeInterval = Vue.ref(null); - const { events, lv, reset } = useEventLoader( - rangeInterval, - props.getPromiseFunc, - ); + const { events, lv, reset } = useEventLoader(rangeInterval, props.getPromiseFunc); - Vue.watch(lv, (newValue) => { - context.emit("update:lv", newValue); - }); + Vue.watch(lv, newValue => { + context.emit('update:lv', newValue); + }); - return { - rangeInterval, - events, - lv, - reset, - }; - }, + return { + rangeInterval, + events, + lv, + reset + }; + }, - created() { - this.$api.call(ApiKalender.getStunden()).then((res) => { - return (this.teachingunits = res.data.map((el) => ({ - id: el.stunde, - start: el.beginn, - end: el.ende, - }))); - }); + created() { + this.$api + .call(ApiKalender.getStunden()) + .then(res => { + return this.teachingunits = res.data.map(el => ({ + id: el.stunde, + start: el.beginn, + end: el.ende + })); + }); - this.$api.call(ApiKalender.getCalendarHours()).then((res) => { - this.hoursplan = { - start: res.data.start, - end: res.data.end, - }; - }); - }, - template: /* html */ ` + this.$api + .call(ApiKalender.getCalendarHours()) + .then(res => { + this.hoursplan = { + start: res.data.start, + end: res.data.end + }; + }); + }, + template: /* html */` - `, -}; + ` +} diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index a6ed88c34..97b0d475c 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -61530,166 +61530,6 @@ I have been informed that I am under no obligation to consent to the transmissio ) ) ), - array( - 'app' => 'core', - 'category' => 'ui', - 'phrase' => 'failed_assigned_resources_fetch_error_message', - 'insertvon' => 'system', - 'phrases' => array( - array( - 'sprache' => 'German', - 'text' => 'Fehler beim Abrufen der zugewiesenen Ressourcen. Bitte versuchen Sie es erneut.', - 'description' => '', - 'insertvon' => 'system' - ), - array( - 'sprache' => 'English', - 'text' => 'Error fetching assigned resources. Please try again.', - 'description' => '', - 'insertvon' => 'system' - ) - ) - ), - array( - 'app' => 'core', - 'category' => 'ui', - 'phrase' => 'failed_schedulable_resources_fetch_error_message', - 'insertvon' => 'system', - 'phrases' => array( - array( - 'sprache' => 'German', - 'text' => 'Fehler beim Abrufen der zuweisbaren Ressourcen. Bitte versuchen Sie es erneut.', - 'description' => '', - 'insertvon' => 'system' - ), - array( - 'sprache' => 'English', - 'text' => 'Error fetching schedulable resources. Please try again.', - 'description' => '', - 'insertvon' => 'system' - ) - ) - ), - array( - 'app' => 'core', - 'category' => 'ui', - 'phrase' => 'failed_assigned_resources_save_error_message', - 'insertvon' => 'system', - 'phrases' => array( - array( - 'sprache' => 'German', - 'text' => 'Fehler beim Speichern der zugewiesenen Ressourcen. Bitte versuchen Sie es erneut.', - 'description' => '', - 'insertvon' => 'system' - ), - array( - 'sprache' => 'English', - 'text' => 'Error saving assigned resources. Please try again.', - 'description' => '', - 'insertvon' => 'system' - ) - ) - ), - array( - 'app' => 'core', - 'category' => 'ui', - 'phrase' => 'resource_assignment_modal_title', - 'insertvon' => 'system', - 'phrases' => array( - array( - 'sprache' => 'German', - 'text' => 'Ressourcen-Zuweisung', - 'description' => '', - 'insertvon' => 'system' - ), - array( - 'sprache' => 'English', - 'text' => 'Resource Assignment', - 'description' => '', - 'insertvon' => 'system' - ) - ) - ), - array( - 'app' => 'core', - 'category' => 'ui', - 'phrase' => 'assigned_resources_subtitle', - 'insertvon' => 'system', - 'phrases' => array( - array( - 'sprache' => 'German', - 'text' => 'Zugewiesene Ressourcen', - 'description' => '', - 'insertvon' => 'system' - ), - array( - 'sprache' => 'English', - 'text' => 'Assigned Resources', - 'description' => '', - 'insertvon' => 'system' - ) - ) - ), - array( - 'app' => 'core', - 'category' => 'ui', - 'phrase' => 'no_assigned_resources', - 'insertvon' => 'system', - 'phrases' => array( - array( - 'sprache' => 'German', - 'text' => 'Keine zugewiesenen Ressourcen', - 'description' => '', - 'insertvon' => 'system' - ), - array( - 'sprache' => 'English', - 'text' => 'No Assigned Resources', - 'description' => '', - 'insertvon' => 'system' - ) - ) - ), - array( - 'app' => 'core', - 'category' => 'ui', - 'phrase' => 'available_resources_label', - 'insertvon' => 'system', - 'phrases' => array( - array( - 'sprache' => 'German', - 'text' => 'Verfügbare Ressourcen', - 'description' => '', - 'insertvon' => 'system' - ), - array( - 'sprache' => 'English', - 'text' => 'Available Resources', - 'description' => '', - 'insertvon' => 'system' - ) - ) - ), - array( - 'app' => 'core', - 'category' => 'ui', - 'phrase' => 'assigned_resources_save_success_message', - 'insertvon' => 'system', - 'phrases' => array( - array( - 'sprache' => 'German', - 'text' => 'Zugewiesene Ressourcen erfolgreich gespeichert', - 'description' => '', - 'insertvon' => 'system' - ), - array( - 'sprache' => 'English', - 'text' => 'Assigned Resources successfully saved', - 'description' => '', - 'insertvon' => 'system' - ) - ) - ), // ### Phrases Dashboard Admin END // ### LvPlanStgOrg START ### array( diff --git a/webdav/Caldav_Backend.php b/webdav/Caldav_Backend.php index 8a008f43b..bcb8edcb7 100644 --- a/webdav/Caldav_Backend.php +++ b/webdav/Caldav_Backend.php @@ -8,8 +8,6 @@ require_once(dirname(__FILE__).'/../include/datum.class.php'); */ class MySabre_CalDAV_Backend extends \Sabre\CalDAV\Backend\AbstractBackend { - protected $auth; - /** * Creates the backend * @@ -56,13 +54,12 @@ class MySabre_CalDAV_Backend extends \Sabre\CalDAV\Backend\AbstractBackend 'uri' => 'LVPlan-'.$user, 'principaluri' => 'principals/'.$user, '{' . \Sabre\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => 'LVPlan-'.$user.'-'.time(), - '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new \Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet(array('VEVENT','VTODO')), + '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new \Sabre\CalDAV\Property\SupportedCalendarComponentSet(array('VEVENT','VTODO')), '{DAV:}displayname' => 'LVPlan', '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description comes here', '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'Europe/Vienna', '{http://apple.com/ns/ical/}calendar-order' => '1', - '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', - '{http://sabredav.org/ns}read-only' => 1 + '{http://apple.com/ns/ical/}calendar-color' => '#FF0000' ); $calendars[] = $calendar; @@ -120,9 +117,9 @@ class MySabre_CalDAV_Backend extends \Sabre\CalDAV\Backend\AbstractBackend * @param array $mutations * @return bool|array */ - public function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch) + public function updateCalendar($calendarId, array $mutations) { - $propPatch->setRemainingResultCode(403); + return false; } /** @@ -216,7 +213,7 @@ class MySabre_CalDAV_Backend extends \Sabre\CalDAV\Backend\AbstractBackend foreach($val as $row) { //einzelnen Eintrag holen - if($row['dtstart']==$dtstart && (($row['unr'][0]==$unr) || $unr=='R'.$row['reservierung_id'])) + if($row['dtstart']==$dtstart && ($row['unr'][0]==$unr) || $unr=='R'.$row['reservierung_id']) { return $row; } @@ -254,48 +251,6 @@ TZOFFSETTO:+0100 END:STANDARD END:VTIMEZONE\n".$event."\nEND:VCALENDAR"; } - - protected function getObjectUri($row) - { - // Reservierungen werden mit einem R markiert und mit der ReservierungID da sonst - // Termine verloren gehen koennen wenn zur selben Zeit eine Reservierung und ein LVPlan Eintrag vorhanden ist - if($row['reservierung']) - $uri = $row['dtstart'].'-R'.$row['reservierung_id']; - else - $uri = $row['dtstart'].'-'.$row['unr'][0]; - - return $uri.'@'.md5($row['UID']); - } - - protected function buildCalendarObject($row, $calendarId) - { - $calendarData = $this->makeCal($row['data']); - - return array("id"=>$row['UID'], - "calendardata"=>$calendarData, - "uri"=>$this->getObjectUri($row), - "lastmodified"=>$this->getLastModifiedTimestamp($row['updateamum']), - "etag"=>'"'.$row['UID'].'"', - "calendarid"=>$calendarId, - "size"=>strlen($calendarData), - "component"=>'vevent'); - } - - protected function getLastModifiedTimestamp($lastModified) - { - if($lastModified === null || $lastModified === '') - return null; - - if(is_numeric($lastModified)) - return (int)$lastModified; - - $timestamp = strtotime($lastModified); - if($timestamp === false) - return null; - - return $timestamp; - } - /** * Returns all calendar objects within a calendar. * @@ -328,7 +283,20 @@ END:VTIMEZONE\n".$event."\nEND:VCALENDAR"; $return = array(); foreach($data as $row) { - $return[] = $this->buildCalendarObject($row, $calendarId); + // Reservierungen werden mit einem R markiert und mit der ReservierungID da sonst + // Termine verloren gehen koennen wenn zur selben Zeit eine Reservierung und ein LVPlan Eintrag vorhanden ist + if($row['reservierung']) + $uri = $row['dtstart'].'-R'.$row['reservierung_id']; + else + $uri = $row['dtstart'].'-'.$row['unr'][0]; + + $return[] = array("id"=>$row['UID'], + "calendardata"=>$this->makeCal($row['data']), + "uri"=>$uri.'@'.md5($row['UID']), + "lastmodified"=>$row['updateamum'], + "etag"=>'"'.$row['UID'].'"', + "calendarid"=>$calendarId); + } return $return; } @@ -351,13 +319,23 @@ END:VTIMEZONE\n".$event."\nEND:VCALENDAR"; //$user = $this->getUser(); $user = $calendarId; $data = $this->getCalendarData($user,$objectUri); - if(empty($data)) + if(count($data)==0) { - return null; + $ret=array("id"=>'', + "calendardata"=>'', + "uri"=>'', + "lastmodified"=>'', + "etag"=>'', + "calendarid"=>$calendarId); } else { - $ret = $this->buildCalendarObject($data, $calendarId); + $ret = array("id"=>$data['UID'], + "calendardata"=>$this->makeCal($data['data']), + "uri"=>'principals/'.$user.'/LVPlan/'.$data['dtstart'].'-'.$data['unr'][0].'@'.md5($data['UID']), + "lastmodified"=>$data['updateamum'], + "etag"=>'"'.$data['UID'].'"', + "calendarid"=>$calendarId); } return $ret; } diff --git a/webdav/MySabre_DAV_Browser_NoProperties.php b/webdav/MySabre_DAV_Browser_NoProperties.php deleted file mode 100644 index 8fe2c0b71..000000000 --- a/webdav/MySabre_DAV_Browser_NoProperties.php +++ /dev/null @@ -1,29 +0,0 @@ -

Properties

.*?#s', - '', - $html, - 1 - ); - - $cleanHtml = preg_replace( - '#

Actions

.*?
#s', - '', - $cleanHtml, - 1 - ); - - return $cleanHtml === null ? $html : $cleanHtml; - } -} diff --git a/webdav/Principal.php b/webdav/Principal.php index 7b802ce80..7e3241dac 100644 --- a/webdav/Principal.php +++ b/webdav/Principal.php @@ -32,7 +32,6 @@ class MySabre_DAVACL_PrincipalBackend implements \Sabre\DAVACL\PrincipalBackend\ protected $groupMembersTableName; protected $result_ma; - protected $auth; /** * Sets up the backend. * @@ -122,6 +121,16 @@ class MySabre_DAVACL_PrincipalBackend implements \Sabre\DAVACL\PrincipalBackend\ }*/ } + else //if($prefixPath=='principals/oesi') + { + $user = mb_substr($path,11); + $principals[] = array( + 'id' => $user.'proxyread', + 'uri' => 'principals/'.$user.'/calendar-proxy-read', + '{DAV:}displayname' => '', + '{http://sabredav.org/ns}email-address' => '', + ); + } return $principals; @@ -217,18 +226,13 @@ class MySabre_DAVACL_PrincipalBackend implements \Sabre\DAVACL\PrincipalBackend\ throw new \Sabre\DAV\Exception('Not implemented'); } - public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) + public function updatePrincipal($path, $mutations) { - $propPatch->setRemainingResultCode(403); + throw new \Sabre\DAV\Exception('Not implemented'); } - public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') + public function searchPrincipals($prefixPath,array $searchProperties) { - return array(); - } - - public function findByUri($uri, $principalPrefix) - { - return null; + throw new \Sabre\DAV\Exception('Not implemented'); } } diff --git a/webdav/auth.class.php b/webdav/auth.class.php index 4c9c398d7..8ae826d33 100644 --- a/webdav/auth.class.php +++ b/webdav/auth.class.php @@ -25,25 +25,12 @@ require_once(dirname(__FILE__).'/../include/functions.inc.php'); class myauth extends \Sabre\DAV\Auth\Backend\AbstractBasic { - protected $currentUser = null; - function validateUserPass($username, $password) { if(checkldapuser($username,$password)) - { - $this->currentUser = $username; return true; - } else - { - $this->currentUser = null; return false; } } - - public function getCurrentUser() - { - return $this->currentUser; - } -} ?> diff --git a/webdav/lvplan.php b/webdav/lvplan.php index 83c8f7e0a..b943e03f5 100644 --- a/webdav/lvplan.php +++ b/webdav/lvplan.php @@ -1,11 +1,10 @@ setBaseUri($path); // Authentication plugin -$authBackend->setRealm('SabreDAV'); -$authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend); +$authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend,'SabreDAV'); $server->addPlugin($authPlugin); // CalDAV plugin @@ -46,8 +44,9 @@ $aclPlugin = new \Sabre\DAVACL\Plugin(); $server->addPlugin($aclPlugin); // Support for html frontend -$browser = new MySabre_DAV_Browser_NoProperties(); +$browser = new \Sabre\DAV\Browser\Plugin(); $server->addPlugin($browser); // And off we go! $server->exec(); +