芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/cloud.pulsehost.co.uk/vendor/afterlogic/dav/lib/DAV/CalDAV/Plugin.php
VEVENT->ORGANIZER)) { $sOrganizer = $vobj->VEVENT->ORGANIZER->getNormalizedValue(); $iPos = strpos($sOrganizer, 'principals/'); if ($iPos !== false) { $sOrganizer = 'mailto:' . \trim(substr($sOrganizer, $iPos + 11), '/'); $vobj->VEVENT->ORGANIZER->setValue($sOrganizer); $data = $vobj->serialize(); $vobj->destroy(); $modified = true; } } } /** * This method is triggered before a file gets updated with new content. * * This plugin uses this method to ensure that CalDAV objects receive * valid calendar data. * * @param string $path * @param DAV\IFile $node * @param resource $data * @param bool $modified Should be set to true, if this event handler * changed &$data. * @return void */ public function beforeWriteContent($path, \Sabre\DAV\IFile $node, &$data, &$modified) { if (!$node instanceof \Sabre\CalDAV\ICalendarObject) { return; } // We're onyl interested in ICalendarObject nodes that are inside of a // real calendar. This is to avoid triggering validation and scheduling // for non-calendars (such as an inbox). list($parent) = \Sabre\Uri\split($path); $parentNode = $this->server->tree->getNodeForPath($parent); if (!$parentNode instanceof \Sabre\CalDAV\ICalendar) { return; } $this->fixOrganizer($data, $modified); try { $this->validateICalendar( $data, $path, $modified, $this->server->httpRequest, $this->server->httpResponse, false ); } catch (\Exception $oEx) { } } /** * This method is triggered before a new file is created. * * This plugin uses this method to ensure that newly created calendar * objects contain valid calendar data. * * @param string $path * @param resource $data * @param DAV\ICollection $parentNode * @param bool $modified Should be set to true, if this event handler * changed &$data. * @return void */ public function beforeCreateFile($path, &$data, \Sabre\DAV\ICollection $parentNode, &$modified) { if (!$parentNode instanceof \Sabre\CalDAV\ICalendar) { return; } $this->fixOrganizer($data, $modified); try { $this->validateICalendar( $data, $path, $modified, $this->server->httpRequest, $this->server->httpResponse, true ); } catch (\Exception $oEx) { } } /** * Use this method to tell the server this plugin defines additional * HTTP methods. * * This method is passed a uri. It should only return HTTP methods that are * available for the specified uri. * * @param string $uri * * @return array */ public function getHTTPMethods($uri) { $uri = '/'.\ltrim($uri, '/'); // The MKCALENDAR is only available on unmapped uri's, whose // parents extend IExtendedCollection list($parent, $name) = \Sabre\Uri\split($uri); if (isset($parent)) { $node = $this->server->tree->getNodeForPath($parent); if ($node instanceof \Sabre\DAV\IExtendedCollection) { try { $node->getChild($name); } catch (\Sabre\DAV\Exception\NotFound $e) { return ['MKCALENDAR']; } } } return []; } }