summaryrefslogtreecommitdiffstats
path: root/files
diff options
context:
space:
mode:
authorJakob Sack <kde@jakobsack.de>2011-07-22 23:18:08 +0200
committerJakob Sack <kde@jakobsack.de>2011-07-22 23:18:08 +0200
commit3097e4f48a5490de6e55a21b9ee66b2a7b4ae26d (patch)
tree9cab200168a48b27d4e05fb3bdcc6af083a2ab6d /files
parent41a2da234a1425df0aa09ee339076f52e78ead4c (diff)
parentccc94819e2534431ee618f16f1dc522bf6e79c33 (diff)
downloadnextcloud-server-3097e4f48a5490de6e55a21b9ee66b2a7b4ae26d.tar.gz
nextcloud-server-3097e4f48a5490de6e55a21b9ee66b2a7b4ae26d.zip
Merge branch 'sabredav'
Diffstat (limited to 'files')
-rw-r--r--files/webdav.php97
1 files changed, 50 insertions, 47 deletions
diff --git a/files/webdav.php b/files/webdav.php
index ac7a1a5567f..7dce0b48197 100644
--- a/files/webdav.php
+++ b/files/webdav.php
@@ -1,54 +1,57 @@
<?php
/**
-* ownCloud
-*
-* @author Frank Karlitschek
-* @copyright 2010 Frank Karlitschek karlitschek@kde.org
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
+ * ownCloud
+ *
+ * @author Frank Karlitschek
+ * @author Jakob Sack
+ * @copyright 2010 Frank Karlitschek karlitschek@kde.org
+ * @copyright 2011 Jakob Sack kde@jakobsack.de
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// Do not load FS ...
+$RUNTIME_NOSETUPFS = true;
require_once('../lib/base.php');
-require_once('HTTP/WebDAV/Server/Filesystem.php');
-
-
-ini_set('default_charset', 'UTF-8');
-#ini_set('error_reporting', '');
-@ob_clean();
-
-if(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['REDIRECT_REMOTE_USER'])) {
- header('WWW-Authenticate: Basic realm="ownCloud"');
- header('HTTP/1.0 401 Unauthorized');
- die('401 Unauthorized');
-}
-
-$user=$_SERVER['PHP_AUTH_USER'];
-$passwd=$_SERVER['PHP_AUTH_PW'];
-if(OC_USER::login($user,$passwd)){
- OC_UTIL::setUpFS();
- $server = new HTTP_WebDAV_Server_Filesystem();
- $server->ServeRequest($CONFIG_DATADIRECTORY);
-
-}else{
- header('WWW-Authenticate: Basic realm="ownCloud"');
- header('HTTP/1.0 401 Unauthorized');
- die('401 Unauthorized');
-}
-
-
+require_once('Sabre/autoload.php');
+require_once('Connector/Sabre/auth.php');
+require_once('Connector/Sabre/node.php');
+require_once('Connector/Sabre/file.php');
+require_once('Connector/Sabre/directory.php');
+require_once('Connector/Sabre/locks.php');
+
+// Create ownCloud Dir
+$publicDir = new OC_Connector_Sabre_Directory('');
+$server = new Sabre_DAV_Server($publicDir);
+
+// Path to our script
+$server->setBaseUri($WEBROOT.'/files/webdav.php');
+
+// Auth backend
+$authBackend = new OC_Connector_Sabre_Auth();
+$authPlugin = new Sabre_DAV_Auth_Plugin($authBackend,'ownCloud');
+$server->addPlugin($authPlugin);
+
+// Also make sure there is a 'data' directory, writable by the server. This directory is used to store information about locks
+$lockBackend = new OC_Connector_Sabre_Locks();
+$lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
+$server->addPlugin($lockPlugin);
+
+// And off we go!
+$server->exec();
?>