ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Plugin.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAV\Mount;
4 
5 use Sabre\DAV;
8 
18 class Plugin extends DAV\ServerPlugin {
19 
25  protected $server;
26 
33  function initialize(DAV\Server $server) {
34 
35  $this->server = $server;
36  $this->server->on('method:GET', [$this, 'httpGet'], 90);
37 
38  }
39 
49 
50  $queryParams = $request->getQueryParameters();
51  if (!array_key_exists('mount', $queryParams)) return;
52 
53  $currentUri = $request->getAbsoluteUrl();
54 
55  // Stripping off everything after the ?
56  list($currentUri) = explode('?', $currentUri);
57 
58  $this->davMount($response, $currentUri);
59 
60  // Returning false to break the event chain
61  return false;
62 
63  }
64 
73 
74  $response->setStatus(200);
75  $response->setHeader('Content-Type', 'application/davmount+xml');
76  ob_start();
77  echo '<?xml version="1.0"?>', "\n";
78  echo "<dm:mount xmlns:dm=\"http://purl.org/NET/webdav/mount\">\n";
79  echo " <dm:url>", htmlspecialchars($uri, ENT_NOQUOTES, 'UTF-8'), "</dm:url>\n";
80  echo "</dm:mount>";
81  $response->setBody(ob_get_clean());
82 
83  }
84 
85 
86 }
This interface represents a HTTP response.
The RequestInterface represents a HTTP request.
The baseclass for all server plugins.
setBody($body)
Updates the body resource with a new stream.
foreach($paths as $path) $request
Definition: asyncclient.php:32
httpGet(RequestInterface $request, ResponseInterface $response)
&#39;beforeMethod&#39; event handles.
Definition: Plugin.php:48
initialize(DAV\Server $server)
Initializes the plugin and registers event handles.
Definition: Plugin.php:33
getQueryParameters()
Returns the list of query parameters.
setStatus($status)
Sets the HTTP status code.
Main DAV server class.
Definition: Server.php:23
davMount(ResponseInterface $response, $uri)
Generates the davmount response.
Definition: Plugin.php:72
This plugin provides support for RFC4709: Mounting WebDAV servers.
Definition: Plugin.php:18
$response
getAbsoluteUrl()
Returns the absolute url.
setHeader($name, $value)
Updates a HTTP header.