aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-19 22:29:01 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-19 22:29:01 -0400
commit82d81e8d39ce69211ec6b29fe3f803c57714b8dd (patch)
tree09dbd675480a02fd626f6634e083f3d6a01b4404 /apps/files_external
parentf893d21660695d1d1cd594c102e2bcba6919dee3 (diff)
parent5eca531f99f9615d1a09bbb0b03dda2063901aa7 (diff)
downloadnextcloud-server-82d81e8d39ce69211ec6b29fe3f803c57714b8dd.tar.gz
nextcloud-server-82d81e8d39ce69211ec6b29fe3f803c57714b8dd.zip
Merge branch 'share_api'
Conflicts: apps/contacts/lib/vcard.php apps/files/index.php lib/files.php
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/amazons3.php4
-rwxr-xr-xapps/files_external/lib/dropbox.php4
-rw-r--r--apps/files_external/lib/dropboxtest.php71
-rw-r--r--apps/files_external/lib/google.php4
-rw-r--r--apps/files_external/lib/googletest.php8
-rw-r--r--apps/files_external/lib/streamwrapper.php4
-rw-r--r--apps/files_external/lib/swift.php4
-rw-r--r--apps/files_external/lib/webdav.php4
-rw-r--r--apps/files_external/tests/test.php7
9 files changed, 98 insertions, 12 deletions
diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index 9feb490dac0..3c2e3330175 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -134,12 +134,12 @@ class OC_Filestorage_AmazonS3 extends OC_Filestorage_Common {
return false;
}
- public function is_readable($path) {
+ public function isReadable($path) {
// TODO Check acl and determine who grantee is
return true;
}
- public function is_writable($path) {
+ public function isUpdatable($path) {
// TODO Check acl and determine who grantee is
return true;
}
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php
index a27d9d7c368..b90563a5065 100755
--- a/apps/files_external/lib/dropbox.php
+++ b/apps/files_external/lib/dropbox.php
@@ -125,11 +125,11 @@ class OC_Filestorage_Dropbox extends OC_Filestorage_Common {
return false;
}
- public function is_readable($path) {
+ public function isReadable($path) {
return $this->file_exists($path);
}
- public function is_writable($path) {
+ public function isUpdatable($path) {
return $this->file_exists($path);
}
diff --git a/apps/files_external/lib/dropboxtest.php b/apps/files_external/lib/dropboxtest.php
new file mode 100644
index 00000000000..686549e16b8
--- /dev/null
+++ b/apps/files_external/lib/dropboxtest.php
@@ -0,0 +1,71 @@
+<?php
+
+require_once 'dropbox.php';
+// $oauth = new Dropbox_OAuth_Curl('526ar3qlrtzmv65', '3bbn0wo5lzgpjty');
+$dropbox = new OC_Filestorage_Dropbox(array('app_key' => '526ar3qlrtzmv65', 'app_secret' => '3bbn0wo5lzgpjty', 'token' => 'a3ben02jb1y538a', 'token_secret' => 'x60h3fsky21r1b0'));
+$dropbox->rename('/652072main_2012-2897_full (1).jpg', '/test.jpg');
+// $dropbox->test();
+// print_r($dropbox->mkdir('Again'));
+
+// GET&https%3A%2F%2Fapi.dropbox.com%2F1%2Fmetadata%2Fdropbox%2FownCloud&list%3D0%26
+
+// uzpi8oo2rbax1po
+// th9uoso3xxny3ca
+//Step 3: Acquiring access tokens Array ( [token] => 37my637p88ng967 [token_secret] => t49fmgp3omucnnr )
+//The user is authenticated You should really save the oauth tokens somewhere, so the first steps will no longer be needed Array ( [token] => 37my637p88ng967 [token_secret] => t49fmgp3omucnnr )
+
+// For convenience, definitely not required
+// header('Content-Type: text/plain');
+
+// // We need to start a session
+// session_start();
+
+// There are multiple steps in this workflow, we keep a 'state number' here
+// if (isset($_SESSION['state'])) {
+// $state = 2;
+// } else {
+// $state = 1;
+// }
+//
+// switch($state) {
+//
+// /* In this phase we grab the initial request tokens
+// and redirect the user to the 'authorize' page hosted
+// on dropbox */
+// case 1 :
+// echo "Step 1: Acquire request tokens\n";
+// $tokens = $oauth->getRequestToken();
+// print_r($tokens);
+//
+// // Note that if you want the user to automatically redirect back, you can
+// // add the 'callback' argument to getAuthorizeUrl.
+// echo "Step 2: You must now redirect the user to:\n";
+// echo $oauth->getAuthorizeUrl() . "\n";
+// $_SESSION['state'] = 2;
+// $_SESSION['oauth_tokens'] = $tokens;
+// die();
+//
+// /* In this phase, the user just came back from authorizing
+// and we're going to fetch the real access tokens */
+// case 2 :
+// echo "Step 3: Acquiring access tokens\n";
+// $oauth->setToken($_SESSION['oauth_tokens']);
+// $tokens = $oauth->getAccessToken();
+// print_r($tokens);
+// $_SESSION['state'] = 3;
+// $_SESSION['oauth_tokens'] = $tokens;
+// // There is no break here, intentional
+//
+// /* This part gets called if the authentication process
+// already succeeded. We can use our stored tokens and the api
+// should work. Store these tokens somewhere, like a database */
+// case 3 :
+// echo "The user is authenticated\n";
+// echo "You should really save the oauth tokens somewhere, so the first steps will no longer be needed\n";
+// print_r($_SESSION['oauth_tokens']);
+// $oauth->setToken($_SESSION['oauth_tokens']);
+// break;
+//
+// }
+
+?> \ No newline at end of file
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index 2b387f0c833..73317bbf714 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -284,11 +284,11 @@ class OC_Filestorage_Google extends OC_Filestorage_Common {
return false;
}
- public function is_readable($path) {
+ public function isReadable($path) {
return true;
}
- public function is_writable($path) {
+ public function isUpdatable($path) {
if ($path == '' || $path == '/') {
return true;
} else if ($entry = $this->getResource($path)) {
diff --git a/apps/files_external/lib/googletest.php b/apps/files_external/lib/googletest.php
new file mode 100644
index 00000000000..a80af6a0978
--- /dev/null
+++ b/apps/files_external/lib/googletest.php
@@ -0,0 +1,8 @@
+<?php
+
+require_once 'google.php';
+
+// $drive = new OC_Filestorage_Google(array('token' => '4/7nZMlRLlAEeXdY0AeH-eHNCL0YaK', 'token_secret' => 'NqO5VMGUVkwFtOYqHsex4257'));
+// $drive = new OC_Filestorage_Google(array('token' => '1/4Xo84YtTxL2MkQst-Ti3nqF1Isy70NUHDRk-BwsLMf4', 'token_secret' => 'jYnyJ_4-ITNxlX9f9RDNoRW-'));
+// var_export($drive->getFeed('https://docs.google.com/feeds/metadata/default', 'GET'));
+
diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php
index 7d56445361e..467c5a5b845 100644
--- a/apps/files_external/lib/streamwrapper.php
+++ b/apps/files_external/lib/streamwrapper.php
@@ -32,11 +32,11 @@ abstract class OC_FileStorage_StreamWrapper extends OC_Filestorage_Common{
return filetype($this->constructUrl($path));
}
- public function is_readable($path){
+ public function isReadable($path){
return true;//not properly supported
}
- public function is_writable($path){
+ public function isUpdatable($path){
return true;//not properly supported
}
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php
index 58b95a6ae01..94ccde1ff8f 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -353,11 +353,11 @@ class OC_FileStorage_SWIFT extends OC_Filestorage_Common{
}
}
- public function is_readable($path){
+ public function isReadable($path){
return true;
}
- public function is_writable($path){
+ public function isUpdatable($path){
return true;
}
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 84d64b65193..e3f73c5c0a7 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -104,11 +104,11 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
}
}
- public function is_readable($path){
+ public function isReadable($path){
return true;//not properly supported
}
- public function is_writable($path){
+ public function isUpdatable($path){
return true;//not properly supported
}
diff --git a/apps/files_external/tests/test.php b/apps/files_external/tests/test.php
new file mode 100644
index 00000000000..bd24404f3b9
--- /dev/null
+++ b/apps/files_external/tests/test.php
@@ -0,0 +1,7 @@
+<?php
+require_once 'files_external/lib/config.php';
+echo "<pre>";
+print_r(OC_Mount_Config::getSystemMountPoints());
+echo "</pre>";
+// OC_Mount_Config::addMountPoint('Photos', 'OC_Filestorage_SWIFT', array('host' => 'gapinthecloud.com', 'user' => 'Gap', 'token' => '23423afdasFJEW22', 'secure' => 'true', 'root' => ''), OC_Mount_Config::MOUNT_TYPE_GROUP, 'admin', false);
+?>