summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/helper.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-11-24 15:31:52 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-12-04 13:18:13 +0100
commit698ecbf308d1eae950138bff9edbb0d542c391d0 (patch)
tree3f6ab525053f56c01f2fcef4792a9756f882ab7d /apps/files_sharing/lib/helper.php
parentf0e6876f2ec8ec4576ca0ce8bbfee5bd8082dc1f (diff)
downloadnextcloud-server-698ecbf308d1eae950138bff9edbb0d542c391d0.tar.gz
nextcloud-server-698ecbf308d1eae950138bff9edbb0d542c391d0.zip
OCS API for server-to-server sharing
Diffstat (limited to 'apps/files_sharing/lib/helper.php')
-rw-r--r--apps/files_sharing/lib/helper.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/helper.php b/apps/files_sharing/lib/helper.php
index f7204a8db8f..c83debe952f 100644
--- a/apps/files_sharing/lib/helper.php
+++ b/apps/files_sharing/lib/helper.php
@@ -21,6 +21,30 @@ class Helper {
}
/**
+ * add server-to-server share to database
+ *
+ * @param string $remote
+ * @param string $token
+ * @param string $name
+ * @param string $mountPoint
+ * @param string $owner
+ * @param string $user
+ * @param string $password
+ * @param int $remoteId
+ * @param bool $accepted
+ */
+ public static function addServer2ServerShare($remote, $token, $name, $mountPoint, $owner, $user, $password='', $remoteId=-1, $accepted = false) {
+ $accepted = $accepted ? 1 : 0;
+ $query = \OCP\DB::prepare('
+ INSERT INTO `*PREFIX*share_external`
+ (`remote`, `share_token`, `password`, `name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`, `accepted`, `remote_id`)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ ');
+ $hash = md5($mountPoint);
+ $query->execute(array($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId));
+ }
+
+ /**
* Sets up the filesystem and user for public sharing
* @param string $token string share token
* @param string $relativePath optional path relative to the share