Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-10-06 15:44:53 +0400
committerRobin Appelman <icewind@owncloud.com>2012-10-06 15:44:53 +0400
commita203a4a1c772bc05750f0bbe2db701c21cae6855 (patch)
tree336b4cb2a0c5891d8f3c0925254799580b6fa2ce /apps
parent54695b11eb3e8c3b0d0a03df1b8c9434c5ce4746 (diff)
add support to mount a specific folder from dropbox
Diffstat (limited to 'apps')
-rwxr-xr-xapps/files_external/lib/dropbox.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php
index bb86894e55e..c8220832702 100755
--- a/apps/files_external/lib/dropbox.php
+++ b/apps/files_external/lib/dropbox.php
@@ -25,21 +25,25 @@ require_once 'Dropbox/autoload.php';
class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
private $dropbox;
+ private $root;
private $metaData = array();
private static $tempFiles = array();
public function __construct($params) {
if (isset($params['configured']) && $params['configured'] == 'true' && isset($params['app_key']) && isset($params['app_secret']) && isset($params['token']) && isset($params['token_secret'])) {
+ $this->root=isset($params['root'])?$params['root']:'';
$oauth = new Dropbox_OAuth_Curl($params['app_key'], $params['app_secret']);
$oauth->setToken($params['token'], $params['token_secret']);
$this->dropbox = new Dropbox_API($oauth, 'dropbox');
+ $this->mkdir('');
} else {
throw new Exception('Creating OC_Filestorage_Dropbox storage failed');
}
}
private function getMetaData($path, $list = false) {
+ $path = $this->root.$path;
if (!$list && isset($this->metaData[$path])) {
return $this->metaData[$path];
} else {
@@ -76,6 +80,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
}
public function mkdir($path) {
+ $path = $this->root.$path;
try {
$this->dropbox->createFolder($path);
return true;
@@ -144,6 +149,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
}
public function unlink($path) {
+ $path = $this->root.$path;
try {
$this->dropbox->delete($path);
return true;
@@ -154,6 +160,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
}
public function rename($path1, $path2) {
+ $path1 = $this->root.$path1;
+ $path2 = $this->root.$path2;
try {
$this->dropbox->move($path1, $path2);
return true;
@@ -164,6 +172,8 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
}
public function copy($path1, $path2) {
+ $path1 = $this->root.$path1;
+ $path2 = $this->root.$path2;
try {
$this->dropbox->copy($path1, $path2);
return true;
@@ -174,6 +184,7 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
}
public function fopen($path, $mode) {
+ $path = $this->root.$path;
switch ($mode) {
case 'r':
case 'rb':