aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Dav.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module/Dav.php')
-rw-r--r--Zotlabs/Module/Dav.php36
1 files changed, 17 insertions, 19 deletions
diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php
index aaf69844c..4ab101780 100644
--- a/Zotlabs/Module/Dav.php
+++ b/Zotlabs/Module/Dav.php
@@ -1,13 +1,13 @@
<?php
-
-namespace Zotlabs\Module;
/**
- * @file mod/dav.php
+ * @file Zotlabs/Module/Dav.php
* @brief Initialize Hubzilla's cloud (SabreDAV).
*
* Module for accessing the DAV storage area from a DAV client.
*/
+namespace Zotlabs\Module;
+
use \Sabre\DAV as SDAV;
use \Zotlabs\Storage;
@@ -16,16 +16,14 @@ require_once('vendor/autoload.php');
require_once('include/attach.php');
-/**
- * @brief Fires up the SabreDAV server.
- *
- * @param App &$a
- */
-
class Dav extends \Zotlabs\Web\Controller {
+ /**
+ * @brief Fires up the SabreDAV server.
+ *
+ */
function init() {
-
+
// workaround for HTTP-auth in CGI mode
if (x($_SERVER, 'REDIRECT_REMOTE_USER')) {
$userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ;
@@ -47,16 +45,16 @@ class Dav extends \Zotlabs\Web\Controller {
if (! is_dir('store'))
os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
-
+
if (argc() > 1)
profile_load(argv(1),0);
-
+
$auth = new \Zotlabs\Storage\BasicAuth();
$auth->setRealm(ucfirst(\Zotlabs\Lib\System::get_platform_name()) . ' ' . 'WebDAV');
$rootDirectory = new \Zotlabs\Storage\Directory('/', $auth);
-
+
// A SabreDAV server-object
$server = new SDAV\Server($rootDirectory);
@@ -68,21 +66,21 @@ class Dav extends \Zotlabs\Web\Controller {
// prevent overwriting changes each other with a lock backend
$lockBackend = new SDAV\Locks\Backend\File('store/[data]/locks');
$lockPlugin = new SDAV\Locks\Plugin($lockBackend);
-
+
$server->addPlugin($lockPlugin);
-
+
// provide a directory view for the cloud in Hubzilla
$browser = new \Zotlabs\Storage\Browser($auth);
$auth->setBrowserPlugin($browser);
-
+
// Experimental QuotaPlugin
// require_once('Zotlabs/Storage/QuotaPlugin.php');
// $server->addPlugin(new \Zotlabs\Storage\QuotaPlugin($auth));
-
+
// All we need to do now, is to fire up the server
$server->exec();
-
+
killme();
}
-
+
}