diff options
author | redmatrix <git@macgirvin.com> | 2016-05-10 17:26:44 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-05-10 17:26:44 -0700 |
commit | 0b02a6d123b2014705998c94ddf3d460948d3eac (patch) | |
tree | 78ff2cab9944a4f5ab3f80ec93cbe1120de90bb2 /Zotlabs | |
parent | 40b5b6e9d2da7ab65c8b4d38cdceac83a4d78deb (diff) | |
download | volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.gz volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.tar.bz2 volse-hubzilla-0b02a6d123b2014705998c94ddf3d460948d3eac.zip |
initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import)
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Dav.php | 16 | ||||
-rw-r--r-- | Zotlabs/Storage/Browser.php | 10 |
2 files changed, 20 insertions, 6 deletions
diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php index 9af059974..cc6ea4905 100644 --- a/Zotlabs/Module/Dav.php +++ b/Zotlabs/Module/Dav.php @@ -60,8 +60,16 @@ class Dav extends \Zotlabs\Web\Controller { if ($which) profile_load($a, $which, $profile); + + $auth = new \Zotlabs\Storage\BasicAuth(); - + + $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function($userName,$password) { + if(account_verify_password($userName,$password)) + return true; + return false; + }); + $ob_hash = get_observer_hash(); if ($ob_hash) { @@ -92,6 +100,12 @@ class Dav extends \Zotlabs\Web\Controller { // A SabreDAV server-object $server = new SDAV\Server($rootDirectory); + + + $authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend); + $server->addPlugin($authPlugin); + + // prevent overwriting changes each other with a lock backend $lockBackend = new SDAV\Locks\Backend\File('store/[data]/locks'); $lockPlugin = new SDAV\Locks\Plugin($lockBackend); diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php index 294baaa28..ca262b739 100644 --- a/Zotlabs/Storage/Browser.php +++ b/Zotlabs/Storage/Browser.php @@ -101,8 +101,8 @@ class Browser extends DAV\Browser\Plugin { $parentpath = array(); // only show parent if not leaving /cloud/; TODO how to improve this? if ($path && $path != "cloud") { - list($parentUri) = DAV\URLUtil::splitPath($path); - $fullPath = DAV\URLUtil::encodePath($this->server->getBaseUri() . $parentUri); + list($parentUri) = \Sabre\HTTP\URLUtil::splitPath($path); + $fullPath = \Sabre\HTTP\URLUtil::encodePath($this->server->getBaseUri() . $parentUri); $parentpath['icon'] = $this->enableAssets ? '<a href="' . $fullPath . '"><img src="' . $this->getAssetUrl('icons/parent' . $this->iconExtension) . '" width="24" alt="' . t('parent') . '"></a>' : ''; $parentpath['path'] = $fullPath; @@ -116,7 +116,7 @@ class Browser extends DAV\Browser\Plugin { // This is the current directory, we can skip it if (rtrim($file['href'],'/') == $path) continue; - list(, $name) = DAV\URLUtil::splitPath($file['href']); + list(, $name) = \Sabre\HTTP\URLUtil::splitPath($file['href']); if (isset($file[200]['{DAV:}resourcetype'])) { $type = $file[200]['{DAV:}resourcetype']->getValue(); @@ -166,7 +166,7 @@ class Browser extends DAV\Browser\Plugin { $size = isset($file[200]['{DAV:}getcontentlength']) ? (int)$file[200]['{DAV:}getcontentlength'] : ''; $lastmodified = ((isset($file[200]['{DAV:}getlastmodified'])) ? $file[200]['{DAV:}getlastmodified']->getTime()->format('Y-m-d H:i:s') : ''); - $fullPath = DAV\URLUtil::encodePath('/' . trim($this->server->getBaseUri() . ($path ? $path . '/' : '') . $name, '/')); + $fullPath = \Sabre\HTTP\URLUtil::encodePath('/' . trim($this->server->getBaseUri() . ($path ? $path . '/' : '') . $name, '/')); $displayName = isset($file[200]['{DAV:}displayname']) ? $file[200]['{DAV:}displayname'] : $name; @@ -219,7 +219,7 @@ class Browser extends DAV\Browser\Plugin { $output = ''; if ($this->enablePost) { - $this->server->broadcastEvent('onHTMLActionsPanel', array($parent, &$output)); + $this->server->emit('onHTMLActionsPanel', array($parent, &$output)); } $html .= replace_macros(get_markup_template('cloud.tpl'), array( |