diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-12-03 18:02:22 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-12-03 18:02:22 +0100 |
commit | be30b1a8de2c7858be3f1dfa792504478af70eb4 (patch) | |
tree | eb3f69b006041c1a586479bb59dbf557df48eec0 /apps/files_external/lib/dropbox.php | |
parent | 18663100d9f68400fba1fc344874aacb62bb4659 (diff) | |
parent | 4cb760a92402ab3eb8550fb05b05eae800030680 (diff) | |
download | nextcloud-server-be30b1a8de2c7858be3f1dfa792504478af70eb4.tar.gz nextcloud-server-be30b1a8de2c7858be3f1dfa792504478af70eb4.zip |
merge master into filesystem
Diffstat (limited to 'apps/files_external/lib/dropbox.php')
-rwxr-xr-x | apps/files_external/lib/dropbox.php | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php index 0e82f80668f..9223b4ca87b 100755 --- a/apps/files_external/lib/dropbox.php +++ b/apps/files_external/lib/dropbox.php @@ -34,7 +34,12 @@ class Dropbox extends \OC\Files\Storage\Common { 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'])) { + if (isset($params['configured']) && $params['configured'] == 'true' + && isset($params['app_key']) + && isset($params['app_secret']) + && isset($params['token']) + && isset($params['token_secret']) + ) { $this->id = 'dropbox::'.$params['app_key'] . $params['token']. '/' . $params['root']; $this->root=isset($params['root'])?$params['root']:''; $oauth = new \Dropbox_OAuth_Curl($params['app_key'], $params['app_secret']); @@ -48,7 +53,7 @@ class Dropbox extends \OC\Files\Storage\Common { private function getMetaData($path, $list = false) { $path = $this->root.$path; - if (!$list && isset($this->metaData[$path])) { + if ( ! $list && isset($this->metaData[$path])) { return $this->metaData[$path]; } else { if ($list) { @@ -103,7 +108,8 @@ class Dropbox extends \OC\Files\Storage\Common { } public function opendir($path) { - if ($contents = $this->getMetaData($path, true)) { + $contents = $this->getMetaData($path, true); + if ($contents) { $files = array(); foreach ($contents as $file) { $files[] = basename($file['path']); @@ -115,7 +121,8 @@ class Dropbox extends \OC\Files\Storage\Common { } public function stat($path) { - if ($metaData = $this->getMetaData($path)) { + $metaData = $this->getMetaData($path); + if ($metaData) { $stat['size'] = $metaData['bytes']; $stat['atime'] = time(); $stat['mtime'] = (isset($metaData['modified'])) ? strtotime($metaData['modified']) : time(); @@ -127,11 +134,14 @@ class Dropbox extends \OC\Files\Storage\Common { public function filetype($path) { if ($path == '' || $path == '/') { return 'dir'; - } else if ($metaData = $this->getMetaData($path)) { - if ($metaData['is_dir'] == 'true') { - return 'dir'; - } else { - return 'file'; + } else { + $metaData = $this->getMetaData($path); + if ($metaData) { + if ($metaData['is_dir'] == 'true') { + return 'dir'; + } else { + return 'file'; + } } } return false; @@ -248,8 +258,11 @@ class Dropbox extends \OC\Files\Storage\Common { public function getMimeType($path) { if ($this->filetype($path) == 'dir') { return 'httpd/unix-directory'; - } else if ($metaData = $this->getMetaData($path)) { - return $metaData['mime_type']; + } else { + $metaData = $this->getMetaData($path); + if ($metaData) { + return $metaData['mime_type']; + } } return false; } |