diff options
-rw-r--r-- | apps/files/appinfo/remote.php | 1 | ||||
-rw-r--r-- | core/css/styles.css | 8 | ||||
-rw-r--r-- | files/webdav.php | 30 | ||||
-rw-r--r-- | lib/base.php | 6 | ||||
-rw-r--r-- | lib/private/connector/sabre/filesplugin.php | 73 | ||||
-rw-r--r-- | lib/private/connector/sabre/node.php | 23 | ||||
-rw-r--r-- | settings/css/settings.css | 4 |
7 files changed, 107 insertions, 38 deletions
diff --git a/apps/files/appinfo/remote.php b/apps/files/appinfo/remote.php index 75c80cd49f3..9f290796205 100644 --- a/apps/files/appinfo/remote.php +++ b/apps/files/appinfo/remote.php @@ -48,6 +48,7 @@ $defaults = new OC_Defaults(); $server->addPlugin(new Sabre_DAV_Auth_Plugin($authBackend, $defaults->getName())); $server->addPlugin(new Sabre_DAV_Locks_Plugin($lockBackend)); $server->addPlugin(new Sabre_DAV_Browser_Plugin(false)); // Show something in the Browser, but no upload +$server->addPlugin(new OC_Connector_Sabre_FilesPlugin()); $server->addPlugin(new OC_Connector_Sabre_AbortedUploadDetectionPlugin()); $server->addPlugin(new OC_Connector_Sabre_QuotaPlugin()); $server->addPlugin(new OC_Connector_Sabre_MaintenancePlugin()); diff --git a/core/css/styles.css b/core/css/styles.css index 9a62fe165a6..868829b1c58 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -202,7 +202,7 @@ input[type="submit"].enabled { -moz-box-sizing:border-box; box-sizing:border-box; } #leftcontent, .leftcontent { - position:relative; overflow:auto; width:20em; height:100%; + position:relative; overflow:auto; width:256px; height:100%; background:#f8f8f8; border-right:1px solid #ddd; -moz-box-sizing:border-box; box-sizing:border-box; } @@ -211,7 +211,11 @@ input[type="submit"].enabled { #leftcontent li.active, .leftcontent li.active { font-weight:bold; } #leftcontent li:hover, .leftcontent li:hover { color:#333; background:#ddd; } #leftcontent a { height:100%; display:block; margin:0; padding:0 1em 0 0; float:left; } -#rightcontent, .rightcontent { position:fixed; top:6.4em; left:24.5em; overflow:auto } +#rightcontent, .rightcontent { position:fixed; top:89px; left: 336px; overflow:auto } + +#controls + .leftcontent{ + top: 44px; +} #emptycontent { font-size: 1.5em; diff --git a/files/webdav.php b/files/webdav.php deleted file mode 100644 index 87dd0191969..00000000000 --- a/files/webdav.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -/** - * ownCloud - * - * @author Frank Karlitschek - * @author Jakob Sack - * @copyright 2012 Frank Karlitschek frank@owncloud.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/>. - * - */ - -// only need filesystem apps -$RUNTIME_APPTYPES=array('filesystem', 'authentication'); -require_once '../lib/base.php'; -$baseuri = OC::$WEBROOT. '/files/webdav.php'; -require_once 'apps/files/appinfo/remote.php'; diff --git a/lib/base.php b/lib/base.php index a8ea865e621..240dd1c12b6 100644 --- a/lib/base.php +++ b/lib/base.php @@ -690,7 +690,11 @@ class OC { } // Handle WebDAV if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND') { - header('location: ' . OC_Helper::linkToRemote('webdav')); + // not allowed any more to prevent people + // mounting this root directly. + // Users need to mount remote.php/webdav instead. + header('HTTP/1.1 405 Method Not Allowed'); + header('Status: 405 Method Not Allowed'); return; } diff --git a/lib/private/connector/sabre/filesplugin.php b/lib/private/connector/sabre/filesplugin.php new file mode 100644 index 00000000000..ac781825672 --- /dev/null +++ b/lib/private/connector/sabre/filesplugin.php @@ -0,0 +1,73 @@ +<?php + +/** + * ownCloud + * + * @author Thomas Müller + * @copyright 2013 Thomas Müller <thomas.mueller@tmit.eu> + * + * @license AGPL3 + */ + +class OC_Connector_Sabre_FilesPlugin extends Sabre_DAV_ServerPlugin +{ + + // namespace + const NS_OWNCLOUD = 'http://owncloud.org/ns'; + + /** + * Reference to main server object + * + * @var Sabre_DAV_Server + */ + private $server; + + /** + * This initializes the plugin. + * + * This function is called by Sabre_DAV_Server, after + * addPlugin is called. + * + * This method should set up the required event subscriptions. + * + * @param Sabre_DAV_Server $server + * @return void + */ + public function initialize(Sabre_DAV_Server $server) { + + $server->xmlNamespaces[self::NS_OWNCLOUD] = 'oc'; + $server->protectedProperties[] = '{' . self::NS_OWNCLOUD . '}id'; + + $this->server = $server; + $this->server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties')); + } + + /** + * Adds all ownCloud-specific properties + * + * @param string $path + * @param Sabre_DAV_INode $node + * @param array $requestedProperties + * @param array $returnedProperties + * @return void + */ + public function beforeGetProperties($path, Sabre_DAV_INode $node, array &$requestedProperties, array &$returnedProperties) { + + if ($node instanceof OC_Connector_Sabre_Node) { + + $fileid_propertyname = '{' . self::NS_OWNCLOUD . '}id'; + if (array_search($fileid_propertyname, $requestedProperties)) { + unset($requestedProperties[array_search($fileid_propertyname, $requestedProperties)]); + } + + /** @var $node OC_Connector_Sabre_Node */ + $fileId = $node->getFileId(); + if (!is_null($fileId)) { + $returnedProperties[200][$fileid_propertyname] = $fileId; + } + + } + + } + +} diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php index 3c2ad60f1dd..76fbc251100 100644 --- a/lib/private/connector/sabre/node.php +++ b/lib/private/connector/sabre/node.php @@ -45,6 +45,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * @var string */ protected $path; + /** * node fileinfo cache * @var array @@ -211,6 +212,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * properties should be returned */ public function getProperties($properties) { + if (is_null($this->property_cache)) { $sql = 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ?'; $result = OC_DB::executeAudited( $sql, array( OC_User::getUser(), $this->path ) ); @@ -236,8 +238,11 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr $props = array(); foreach($properties as $property) { - if (isset($this->property_cache[$property])) $props[$property] = $this->property_cache[$property]; + if (isset($this->property_cache[$property])) { + $props[$property] = $this->property_cache[$property]; + } } + return $props; } @@ -260,4 +265,20 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr } return $this->fileView; } + + /** + * @return mixed + */ + public function getFileId() + { + $this->getFileinfoCache(); + + if (isset($this->fileinfo_cache['fileid'])) { + $instanceId = OC_Util::getInstanceId(); + $id = sprintf('%08d', $this->fileinfo_cache['fileid']); + return $instanceId . $id; + } + + return null; + } } diff --git a/settings/css/settings.css b/settings/css/settings.css index b47075241df..6eef96c2dc1 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -58,10 +58,6 @@ tr:hover>td.remove>a, tr:hover>td.password>img,tr:hover>td.displayName>img, tr:h tr:hover>td.remove>a { float:right; } li.selected { background-color:#ddd; } table.grid { width:100%; } -#leftcontent, .leftcontent { - width: 256px; -} -#rightcontent, .rightcontent { top: 80px; left: 336px; } #rightcontent { padding-left: 10px; } div.quota { float: right; |