From 580c3f4ffe9608d2beb56d418c68b3b112420e76 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 12:49:51 +0000 Subject: another bulk of composer updates (cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce) --- .../sabre/dav/lib/DAV/Browser/GuessContentType.php | 49 ++- vendor/sabre/dav/lib/DAV/Browser/HtmlOutput.php | 10 +- .../sabre/dav/lib/DAV/Browser/HtmlOutputHelper.php | 46 +-- .../sabre/dav/lib/DAV/Browser/MapGetToPropFind.php | 31 +- vendor/sabre/dav/lib/DAV/Browser/Plugin.php | 348 ++++++++++----------- vendor/sabre/dav/lib/DAV/Browser/PropFindAll.php | 54 ++-- 6 files changed, 268 insertions(+), 270 deletions(-) (limited to 'vendor/sabre/dav/lib/DAV/Browser') diff --git a/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php b/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php index 3ba2aee25..7466babb3 100644 --- a/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php +++ b/vendor/sabre/dav/lib/DAV/Browser/GuessContentType.php @@ -1,14 +1,16 @@ 'image/jpeg', 'gif' => 'image/gif', @@ -44,58 +45,52 @@ class GuessContentType extends DAV\ServerPlugin { // text 'txt' => 'text/plain', - ]; /** - * Initializes the plugin + * Initializes the plugin. * * @param DAV\Server $server - * @return void */ - function initialize(DAV\Server $server) { - + public function initialize(DAV\Server $server) + { // Using a relatively low priority (200) to allow other extensions // to set the content-type first. $server->on('propFind', [$this, 'propFind'], 200); - } /** - * Our PROPFIND handler + * Our PROPFIND handler. * * Here we set a contenttype, if the node didn't already have one. * * @param PropFind $propFind - * @param INode $node - * @return void + * @param INode $node */ - function propFind(PropFind $propFind, INode $node) { - - $propFind->handle('{DAV:}getcontenttype', function() use ($propFind) { + public function propFind(PropFind $propFind, INode $node) + { + $propFind->handle('{DAV:}getcontenttype', function () use ($propFind) { + list(, $fileName) = Uri\split($propFind->getPath()); - list(, $fileName) = URLUtil::splitPath($propFind->getPath()); return $this->getContentType($fileName); - }); - } /** - * Simple method to return the contenttype + * Simple method to return the contenttype. * * @param string $fileName + * * @return string */ - protected function getContentType($fileName) { - + protected function getContentType($fileName) + { // Just grabbing the extension $extension = strtolower(substr($fileName, strrpos($fileName, '.') + 1)); if (isset($this->extensionMap[$extension])) { return $this->extensionMap[$extension]; } - return 'application/octet-stream'; + return 'application/octet-stream'; } - } diff --git a/vendor/sabre/dav/lib/DAV/Browser/HtmlOutput.php b/vendor/sabre/dav/lib/DAV/Browser/HtmlOutput.php index f4be6b348..59b3f5604 100644 --- a/vendor/sabre/dav/lib/DAV/Browser/HtmlOutput.php +++ b/vendor/sabre/dav/lib/DAV/Browser/HtmlOutput.php @@ -1,5 +1,7 @@ baseUri = $baseUri; $this->namespaceMap = $namespaceMap; - } /** @@ -58,24 +59,24 @@ class HtmlOutputHelper { * Absolute urls are left alone. * * @param string $path + * * @return string */ - function fullUrl($path) { - + public function fullUrl($path) + { return Uri\resolve($this->baseUri, $path); - } /** * Escape string for HTML output. * - * @param string $input + * @param scalar $input + * * @return string */ - function h($input) { - - return htmlspecialchars($input, ENT_COMPAT, 'UTF-8'); - + public function h($input) + { + return htmlspecialchars((string) $input, ENT_COMPAT, 'UTF-8'); } /** @@ -86,13 +87,14 @@ class HtmlOutputHelper { * * @param string $url * @param string $label + * * @return string */ - function link($url, $label = null) { - + public function link($url, $label = null) + { $url = $this->h($this->fullUrl($url)); - return '' . ($label ? $this->h($label) : $url) . ''; + return ''.($label ? $this->h($label) : $url).''; } /** @@ -100,18 +102,18 @@ class HtmlOutputHelper { * shortened version with a prefix, if it was a known namespace. * * @param string $element + * * @return string */ - function xmlName($element) { - + public function xmlName($element) + { list($ns, $localName) = XmlService::parseClarkNotation($element); if (isset($this->namespaceMap[$ns])) { - $propName = $this->namespaceMap[$ns] . ':' . $localName; + $propName = $this->namespaceMap[$ns].':'.$localName; } else { $propName = $element; } - return "h($element) . "\">" . $this->h($propName) . ""; + return ''.$this->h($propName).''; } - } diff --git a/vendor/sabre/dav/lib/DAV/Browser/MapGetToPropFind.php b/vendor/sabre/dav/lib/DAV/Browser/MapGetToPropFind.php index 61327c49a..25e061128 100644 --- a/vendor/sabre/dav/lib/DAV/Browser/MapGetToPropFind.php +++ b/vendor/sabre/dav/lib/DAV/Browser/MapGetToPropFind.php @@ -1,5 +1,7 @@ server = $server; $this->server->on('method:GET', [$this, 'httpGet'], 90); } /** - * This method intercepts GET requests to non-files, and changes it into an HTTP PROPFIND request + * This method intercepts GET requests to non-files, and changes it into an HTTP PROPFIND request. * - * @param RequestInterface $request + * @param RequestInterface $request * @param ResponseInterface $response + * * @return bool */ - function httpGet(RequestInterface $request, ResponseInterface $response) { - + public function httpGet(RequestInterface $request, ResponseInterface $response) + { $node = $this->server->tree->getNodeForPath($request->getPath()); - if ($node instanceof DAV\IFile) return; + if ($node instanceof DAV\IFile) { + return; + } $subRequest = clone $request; $subRequest->setMethod('PROPFIND'); $this->server->invokeMethod($subRequest, $response); - return false; + return false; } - } diff --git a/vendor/sabre/dav/lib/DAV/Browser/Plugin.php b/vendor/sabre/dav/lib/DAV/Browser/Plugin.php index 545ad5633..e2fab4b79 100644 --- a/vendor/sabre/dav/lib/DAV/Browser/Plugin.php +++ b/vendor/sabre/dav/lib/DAV/Browser/Plugin.php @@ -1,15 +1,18 @@ enablePost = $enablePost; - } /** - * Initializes the plugin and subscribes to events + * Initializes the plugin and subscribes to events. * * @param DAV\Server $server - * @return void */ - function initialize(DAV\Server $server) { - + public function initialize(DAV\Server $server) + { $this->server = $server; $this->server->on('method:GET', [$this, 'httpGetEarly'], 90); $this->server->on('method:GET', [$this, 'httpGet'], 200); $this->server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel'], 200); - if ($this->enablePost) $this->server->on('method:POST', [$this, 'httpPOST']); + if ($this->enablePost) { + $this->server->on('method:POST', [$this, 'httpPOST']); + } } /** * This method intercepts GET requests that have ?sabreAction=info - * appended to the URL + * appended to the URL. * - * @param RequestInterface $request + * @param RequestInterface $request * @param ResponseInterface $response + * * @return bool */ - function httpGetEarly(RequestInterface $request, ResponseInterface $response) { - + public function httpGetEarly(RequestInterface $request, ResponseInterface $response) + { $params = $request->getQueryParameters(); - if (isset($params['sabreAction']) && $params['sabreAction'] === 'info') { + if (isset($params['sabreAction']) && 'info' === $params['sabreAction']) { return $this->httpGet($request, $response); } - } /** - * This method intercepts GET requests to collections and returns the html + * This method intercepts GET requests to collections and returns the html. * - * @param RequestInterface $request + * @param RequestInterface $request * @param ResponseInterface $response + * * @return bool */ - function httpGet(RequestInterface $request, ResponseInterface $response) { - + public function httpGet(RequestInterface $request, ResponseInterface $response) + { // We're not using straight-up $_GET, because we want everything to be // unit testable. $getVars = $request->getQueryParameters(); @@ -117,13 +121,13 @@ class Plugin extends DAV\ServerPlugin { $sabreAction = isset($getVars['sabreAction']) ? $getVars['sabreAction'] : null; switch ($sabreAction) { - - case 'asset' : + case 'asset': // Asset handling, such as images $this->serveAsset(isset($getVars['assetName']) ? $getVars['assetName'] : null); + return false; - default : - case 'info' : + default: + case 'info': try { $this->server->tree->getNodeForPath($request->getPath()); } catch (DAV\Exception\NotFound $e) { @@ -141,7 +145,7 @@ class Plugin extends DAV\ServerPlugin { return false; - case 'plugins' : + case 'plugins': $response->setStatus(200); $response->setHeader('Content-Type', 'text/html; charset=utf-8'); @@ -150,41 +154,39 @@ class Plugin extends DAV\ServerPlugin { ); return false; - } - } /** * Handles POST requests for tree operations. * - * @param RequestInterface $request + * @param RequestInterface $request * @param ResponseInterface $response + * * @return bool */ - function httpPOST(RequestInterface $request, ResponseInterface $response) { - + public function httpPOST(RequestInterface $request, ResponseInterface $response) + { $contentType = $request->getHeader('Content-Type'); list($contentType) = explode(';', $contentType); - if ($contentType !== 'application/x-www-form-urlencoded' && - $contentType !== 'multipart/form-data') { - return; + if ('application/x-www-form-urlencoded' !== $contentType && + 'multipart/form-data' !== $contentType) { + return; } $postVars = $request->getPostData(); - if (!isset($postVars['sabreAction'])) + if (!isset($postVars['sabreAction'])) { return; + } $uri = $request->getPath(); if ($this->server->emit('onBrowserPostAction', [$uri, $postVars['sabreAction'], $postVars])) { - switch ($postVars['sabreAction']) { - - case 'mkcol' : + case 'mkcol': if (isset($postVars['name']) && trim($postVars['name'])) { // Using basename() because we won't allow slashes - list(, $folderName) = URLUtil::splitPath(trim($postVars['name'])); + list(, $folderName) = Uri\split(trim($postVars['name'])); if (isset($postVars['resourceType'])) { $resourceType = explode(',', $postVars['resourceType']); @@ -196,7 +198,7 @@ class Plugin extends DAV\ServerPlugin { foreach ($postVars as $varName => $varValue) { // Any _POST variable in clark notation is treated // like a property. - if ($varName[0] === '{') { + if ('{' === $varName[0]) { // PHP will convert any dots to underscores. // This leaves us with no way to differentiate // the two. @@ -212,65 +214,67 @@ class Plugin extends DAV\ServerPlugin { $resourceType, $properties ); - $this->server->createCollection($uri . '/' . $folderName, $mkCol); + $this->server->createCollection($uri.'/'.$folderName, $mkCol); } break; // @codeCoverageIgnoreStart - case 'put' : + case 'put': - if ($_FILES) $file = current($_FILES); - else break; + if ($_FILES) { + $file = current($_FILES); + } else { + break; + } - list(, $newName) = URLUtil::splitPath(trim($file['name'])); - if (isset($postVars['name']) && trim($postVars['name'])) + list(, $newName) = Uri\split(trim($file['name'])); + if (isset($postVars['name']) && trim($postVars['name'])) { $newName = trim($postVars['name']); + } // Making sure we only have a 'basename' component - list(, $newName) = URLUtil::splitPath($newName); + list(, $newName) = Uri\split($newName); if (is_uploaded_file($file['tmp_name'])) { - $this->server->createFile($uri . '/' . $newName, fopen($file['tmp_name'], 'r')); + $this->server->createFile($uri.'/'.$newName, fopen($file['tmp_name'], 'r')); } break; // @codeCoverageIgnoreEnd - } - } $response->setHeader('Location', $request->getUrl()); $response->setStatus(302); - return false; + return false; } /** * Escapes a string for html. * * @param string $value + * * @return string */ - function escapeHTML($value) { - + public function escapeHTML($value) + { return htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); - } /** - * Generates the html directory index for a given url + * Generates the html directory index for a given url. * * @param string $path + * * @return string */ - function generateDirectoryIndex($path) { - + public function generateDirectoryIndex($path) + { $html = $this->generateHeader($path ? $path : '/', $path); $node = $this->server->tree->getNodeForPath($path); if ($node instanceof DAV\ICollection) { - $html .= "

Nodes

\n"; - $html .= ""; + $html .= '
'; $subNodes = $this->server->getPropertiesForChildren($path, [ '{DAV:}displayname', @@ -281,10 +285,9 @@ class Plugin extends DAV\ServerPlugin { ]); foreach ($subNodes as $subPath => $subProps) { - $subNode = $this->server->tree->getNodeForPath($subPath); - $fullPath = $this->server->getBaseUri() . URLUtil::encodePath($subPath); - list(, $displayPath) = URLUtil::splitPath($subPath); + $fullPath = $this->server->getBaseUri().HTTP\encodePath($subPath); + list(, $displayPath) = Uri\split($subPath); $subNodes[$subPath]['subNode'] = $subNode; $subNodes[$subPath]['fullPath'] = $fullPath; @@ -295,43 +298,46 @@ class Plugin extends DAV\ServerPlugin { foreach ($subNodes as $subProps) { $type = [ 'string' => 'Unknown', - 'icon' => 'cog', + 'icon' => 'cog', ]; if (isset($subProps['{DAV:}resourcetype'])) { $type = $this->mapResourceType($subProps['{DAV:}resourcetype']->getValue(), $subProps['subNode']); } $html .= ''; - $html .= ''; - $html .= ''; + $html .= ''; + $html .= ''; $html .= ''; $buttonActions = ''; if ($subProps['subNode'] instanceof DAV\IFile) { - $buttonActions = ''; + $buttonActions = ''; } $this->server->emit('browserButtonActions', [$subProps['fullPath'], $subProps['subNode'], &$buttonActions]); - $html .= ''; + $html .= ''; $html .= ''; } $html .= '
' . $this->escapeHTML($subProps['displayPath']) . '' . $this->escapeHTML($type['string']) . ' '.$this->escapeHTML($subProps['displayPath']).''.$this->escapeHTML($type['string']).''; if (isset($subProps['{DAV:}getcontentlength'])) { - $html .= $this->escapeHTML($subProps['{DAV:}getcontentlength'] . ' bytes'); + $html .= $this->escapeHTML($subProps['{DAV:}getcontentlength'].' bytes'); } $html .= ''; if (isset($subProps['{DAV:}getlastmodified'])) { $lastMod = $subProps['{DAV:}getlastmodified']->getTime(); $html .= $this->escapeHTML($lastMod->format('F j, Y, g:i a')); } + $html .= ''; + if (isset($subProps['{DAV:}displayname'])) { + $html .= $this->escapeHTML($subProps['{DAV:}displayname']); + } $html .= '' . $buttonActions . ''.$buttonActions.'
'; - } - $html .= "
"; - $html .= "

Properties

"; - $html .= ""; + $html .= ''; + $html .= '

Properties

'; + $html .= '
'; // Allprops request $propFind = new PropFindAll($path); @@ -343,12 +349,10 @@ class Plugin extends DAV\ServerPlugin { if (!in_array($propName, $this->uninterestingProperties)) { $html .= $this->drawPropertyRow($propName, $propValue); } - } - - $html .= "
"; - $html .= "
"; + $html .= ''; + $html .= ''; /* Start of generating actions */ @@ -358,8 +362,7 @@ class Plugin extends DAV\ServerPlugin { } if ($output) { - - $html .= "

Actions

"; + $html .= '

Actions

'; $html .= "
\n"; $html .= $output; $html .= "
\n"; @@ -371,7 +374,6 @@ class Plugin extends DAV\ServerPlugin { $this->server->httpResponse->setHeader('Content-Security-Policy', "default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';"); return $html; - } /** @@ -379,31 +381,30 @@ class Plugin extends DAV\ServerPlugin { * * @return string */ - function generatePluginListing() { - + public function generatePluginListing() + { $html = $this->generateHeader('Plugins'); - $html .= "

Plugins

"; - $html .= ""; + $html .= '

Plugins

'; + $html .= '
'; foreach ($this->server->getPlugins() as $plugin) { $info = $plugin->getPluginInfo(); - $html .= ''; - $html .= ''; + $html .= ''; + $html .= ''; $html .= ''; } - $html .= "
' . $info['name'] . '' . $info['description'] . '
'.$info['name'].''.$info['description'].''; if (isset($info['link']) && $info['link']) { - $html .= ''; + $html .= ''; } $html .= '
"; - $html .= "
"; + $html .= ''; + $html .= '
'; /* Start of generating actions */ $html .= $this->generateFooter(); return $html; - } /** @@ -414,22 +415,23 @@ class Plugin extends DAV\ServerPlugin { * * @param string $title * @param string $path + * * @return string */ - function generateHeader($title, $path = null) { - + public function generateHeader($title, $path = null) + { $version = ''; if (DAV\Server::$exposeVersion) { $version = DAV\Version::VERSION; } $vars = [ - 'title' => $this->escapeHTML($title), - 'favicon' => $this->escapeHTML($this->getAssetUrl('favicon.ico')), - 'style' => $this->escapeHTML($this->getAssetUrl('sabredav.css')), + 'title' => $this->escapeHTML($title), + 'favicon' => $this->escapeHTML($this->getAssetUrl('favicon.ico')), + 'style' => $this->escapeHTML($this->getAssetUrl('sabredav.css')), 'iconstyle' => $this->escapeHTML($this->getAssetUrl('openiconic/open-iconic.css')), - 'logo' => $this->escapeHTML($this->getAssetUrl('sabredav.png')), - 'baseUrl' => $this->server->getBaseUri(), + 'logo' => $this->escapeHTML($this->getAssetUrl('sabredav.png')), + 'baseUrl' => $this->server->getBaseUri(), ]; $html = <<server->getBaseUri() . URLUtil::encodePath($parentUri); - $html .= '⇤ Go to parent'; + if ($path) { + list($parentUri) = Uri\split($path); + $fullPath = $this->server->getBaseUri().HTTP\encodePath($parentUri); + $html .= '⇤ Go to parent'; } else { $html .= '⇤ Go to parent'; } $html .= ' Plugins'; - $html .= ""; + $html .= ''; return $html; - } /** @@ -476,18 +477,19 @@ HTML; * * @return string */ - function generateFooter() { - + public function generateFooter() + { $version = ''; if (DAV\Server::$exposeVersion) { $version = DAV\Version::VERSION; } + $year = date('Y'); + return <<Generated by SabreDAV $version (c)2007-2016 http://sabre.io/ + HTML; - } /** @@ -498,19 +500,20 @@ HTML; * creating new directories. * * @param DAV\INode $node - * @param mixed $output - * @param string $path - * @return void + * @param mixed $output + * @param string $path */ - function htmlActionsPanel(DAV\INode $node, &$output, $path) { - - if (!$node instanceof DAV\ICollection) + public function htmlActionsPanel(DAV\INode $node, &$output, $path) + { + if (!$node instanceof DAV\ICollection) { return; + } // We also know fairly certain that if an object is a non-extended // SimpleCollection, we won't need to show the panel either. - if (get_class($node) === 'Sabre\\DAV\\SimpleCollection') + if ('Sabre\\DAV\\SimpleCollection' === get_class($node)) { return; + } $output .= << @@ -527,7 +530,6 @@ HTML; HTML; - } /** @@ -535,32 +537,35 @@ HTML; * suiteable for http access. * * @param string $assetName + * * @return string */ - protected function getAssetUrl($assetName) { - - return $this->server->getBaseUri() . '?sabreAction=asset&assetName=' . urlencode($assetName); - + protected function getAssetUrl($assetName) + { + return $this->server->getBaseUri().'?sabreAction=asset&assetName='.urlencode($assetName); } /** * This method returns a local pathname to an asset. * * @param string $assetName + * * @throws DAV\Exception\NotFound + * * @return string */ - protected function getLocalAssetPath($assetName) { - - $assetDir = __DIR__ . '/assets/'; - $path = $assetDir . $assetName; + protected function getLocalAssetPath($assetName) + { + $assetDir = __DIR__.'/assets/'; + $path = $assetDir.$assetName; // Making sure people aren't trying to escape from the base path. $path = str_replace('\\', '/', $path); - if (strpos($path, '/../') !== false || strrchr($path, '/') === '/..') { + if (false !== strpos($path, '/../') || '/..' === strrchr($path, '/')) { throw new DAV\Exception\NotFound('Path does not exist, or escaping from the base path was detected'); } - if (strpos(realpath($path), realpath($assetDir)) === 0 && file_exists($path)) { + $realPath = realpath($path); + if ($realPath && 0 === strpos($realPath, realpath($assetDir)) && file_exists($path)) { return $path; } throw new DAV\Exception\NotFound('Path does not exist, or escaping from the base path was detected'); @@ -570,10 +575,9 @@ HTML; * This method reads an asset from disk and generates a full http response. * * @param string $assetName - * @return void */ - protected function serveAsset($assetName) { - + protected function serveAsset($assetName) + { $assetPath = $this->getLocalAssetPath($assetName); // Rudimentary mime type detection @@ -594,7 +598,6 @@ HTML; $this->server->httpResponse->setHeader('Cache-Control', 'public, max-age=1209600'); $this->server->httpResponse->setStatus(200); $this->server->httpResponse->setBody(fopen($assetPath, 'r')); - } /** @@ -603,10 +606,11 @@ HTML; * * @param array $a * @param array $b + * * @return int */ - protected function compareNodes($a, $b) { - + protected function compareNodes($a, $b) + { $typeA = (isset($a['{DAV:}resourcetype'])) ? (in_array('{DAV:}collection', $a['{DAV:}resourcetype']->getValue())) : false; @@ -619,29 +623,30 @@ HTML; if ($typeA === $typeB) { return strnatcasecmp($a['displayPath'], $b['displayPath']); } - return (($typeA < $typeB) ? 1 : -1); + return ($typeA < $typeB) ? 1 : -1; } /** * Maps a resource type to a human-readable string and icon. * - * @param array $resourceTypes + * @param array $resourceTypes * @param DAV\INode $node + * * @return array */ - private function mapResourceType(array $resourceTypes, $node) { - + private function mapResourceType(array $resourceTypes, $node) + { if (!$resourceTypes) { if ($node instanceof DAV\IFile) { return [ 'string' => 'File', - 'icon' => 'file', + 'icon' => 'file', ]; } else { return [ 'string' => 'Unknown', - 'icon' => 'cog', + 'icon' => 'cog', ]; } } @@ -649,53 +654,53 @@ HTML; $types = [ '{http://calendarserver.org/ns/}calendar-proxy-write' => [ 'string' => 'Proxy-Write', - 'icon' => 'people', + 'icon' => 'people', ], '{http://calendarserver.org/ns/}calendar-proxy-read' => [ 'string' => 'Proxy-Read', - 'icon' => 'people', + 'icon' => 'people', ], '{urn:ietf:params:xml:ns:caldav}schedule-outbox' => [ 'string' => 'Outbox', - 'icon' => 'inbox', + 'icon' => 'inbox', ], '{urn:ietf:params:xml:ns:caldav}schedule-inbox' => [ 'string' => 'Inbox', - 'icon' => 'inbox', + 'icon' => 'inbox', ], '{urn:ietf:params:xml:ns:caldav}calendar' => [ 'string' => 'Calendar', - 'icon' => 'calendar', + 'icon' => 'calendar', ], '{http://calendarserver.org/ns/}shared-owner' => [ 'string' => 'Shared', - 'icon' => 'calendar', + 'icon' => 'calendar', ], '{http://calendarserver.org/ns/}subscribed' => [ 'string' => 'Subscription', - 'icon' => 'calendar', + 'icon' => 'calendar', ], '{urn:ietf:params:xml:ns:carddav}directory' => [ 'string' => 'Directory', - 'icon' => 'globe', + 'icon' => 'globe', ], '{urn:ietf:params:xml:ns:carddav}addressbook' => [ 'string' => 'Address book', - 'icon' => 'book', + 'icon' => 'book', ], '{DAV:}principal' => [ 'string' => 'Principal', - 'icon' => 'person', + 'icon' => 'person', ], '{DAV:}collection' => [ 'string' => 'Collection', - 'icon' => 'folder', + 'icon' => 'folder', ], ]; $info = [ 'string' => [], - 'icon' => 'cog', + 'icon' => 'cog', ]; foreach ($resourceTypes as $k => $resourceType) { if (isset($types[$resourceType])) { @@ -713,42 +718,41 @@ HTML; $info['string'] = implode(', ', $info['string']); return $info; - } /** - * Draws a table row for a property + * Draws a table row for a property. * * @param string $name - * @param mixed $value + * @param mixed $value + * * @return string */ - private function drawPropertyRow($name, $value) { - + private function drawPropertyRow($name, $value) + { $html = new HtmlOutputHelper( $this->server->getBaseUri(), $this->server->xml->namespaceMap ); - return "" . $html->xmlName($name) . "" . $this->drawPropertyValue($html, $value) . ""; - + return ''.$html->xmlName($name).''.$this->drawPropertyValue($html, $value).''; } /** - * Draws a table row for a property + * Draws a table row for a property. * * @param HtmlOutputHelper $html - * @param mixed $value + * @param mixed $value + * * @return string */ - private function drawPropertyValue($html, $value) { - + private function drawPropertyValue($html, $value) + { if (is_scalar($value)) { return $html->h($value); } elseif ($value instanceof HtmlOutput) { return $value->toHtml($html); } elseif ($value instanceof \Sabre\Xml\XmlSerializable) { - // There's no default html output for this property, we're going // to output the actual xml serialization instead. $xml = $this->server->xml->write('{DAV:}root', $value, $this->server->getBaseUri()); @@ -756,12 +760,11 @@ HTML; // element. $xml = explode("\n", $xml); $xml = array_slice($xml, 2, -2); - return "
" . $html->h(implode("\n", $xml)) . "
"; + return '
'.$html->h(implode("\n", $xml)).'
'; } else { - return "unknown"; + return 'unknown'; } - } /** @@ -772,10 +775,9 @@ HTML; * * @return string */ - function getPluginName() { - + public function getPluginName() + { return 'browser'; - } /** @@ -789,14 +791,12 @@ HTML; * * @return array */ - function getPluginInfo() { - + public function getPluginInfo() + { return [ - 'name' => $this->getPluginName(), + 'name' => $this->getPluginName(), 'description' => 'Generates HTML indexes and debug information for your sabre/dav server', - 'link' => 'http://sabre.io/dav/browser-plugin/', + 'link' => 'http://sabre.io/dav/browser-plugin/', ]; - } - } diff --git a/vendor/sabre/dav/lib/DAV/Browser/PropFindAll.php b/vendor/sabre/dav/lib/DAV/Browser/PropFindAll.php index c14b7f2f9..34702bdd8 100644 --- a/vendor/sabre/dav/lib/DAV/Browser/PropFindAll.php +++ b/vendor/sabre/dav/lib/DAV/Browser/PropFindAll.php @@ -1,5 +1,7 @@ result[$propertyName] = [200, $value]; } - } /** - * Sets the value of the property + * Sets the value of the property. * * If status is not supplied, the status will default to 200 for non-null * properties, and 404 for null properties. * * @param string $propertyName - * @param mixed $value - * @param int $status - * @return void + * @param mixed $value + * @param int $status */ - function set($propertyName, $value, $status = null) { - + public function set($propertyName, $value, $status = null) + { if (is_null($status)) { $status = is_null($value) ? 404 : 200; } $this->result[$propertyName] = [$status, $value]; - } /** * Returns the current value for a property. * * @param string $propertyName + * * @return mixed */ - function get($propertyName) { - + public function get($propertyName) + { return isset($this->result[$propertyName]) ? $this->result[$propertyName][1] : null; - } /** @@ -99,12 +96,12 @@ class PropFindAll extends PropFind { * null will be returned. * * @param string $propertyName + * * @return int|null */ - function getStatus($propertyName) { - + public function getStatus($propertyName) + { return isset($this->result[$propertyName]) ? $this->result[$propertyName][0] : 404; - } /** @@ -113,11 +110,11 @@ class PropFindAll extends PropFind { * * @return array */ - function get404Properties() { - + public function get404Properties() + { $result = []; foreach ($this->result as $propertyName => $stuff) { - if ($stuff[0] === 404) { + if (404 === $stuff[0]) { $result[] = $propertyName; } } @@ -125,8 +122,7 @@ class PropFindAll extends PropFind { if (!$result) { $result[] = '{http://sabredav.org/ns}idk'; } - return $result; + return $result; } - } -- cgit v1.2.3