summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax/external.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-05-09 17:06:08 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-06-14 10:13:23 +0200
commitd7de35376d7e068abdfb49e8336feab25e313662 (patch)
treeb4d054593e20eb2f5396e06ef1c472337993a7c4 /apps/files_sharing/ajax/external.php
parent0156ef816650ec73d033ebba2107cf237d6301e3 (diff)
downloadnextcloud-server-d7de35376d7e068abdfb49e8336feab25e313662.tar.gz
nextcloud-server-d7de35376d7e068abdfb49e8336feab25e313662.zip
Add interface for accpeting external shares
Diffstat (limited to 'apps/files_sharing/ajax/external.php')
-rw-r--r--apps/files_sharing/ajax/external.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/files_sharing/ajax/external.php b/apps/files_sharing/ajax/external.php
new file mode 100644
index 00000000000..e7bf903f705
--- /dev/null
+++ b/apps/files_sharing/ajax/external.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+OCP\JSON::callCheck();
+OCP\JSON::checkLoggedIn();
+
+$token = $_POST['token'];
+$remote = $_POST['remote'];
+$owner = $_POST['owner'];
+$name = $_POST['name'];
+$password = $_POST['password'];
+
+$externalManager = new \OCA\Files_Sharing\External\Manager(
+ \OC::$server->getDatabaseConnection(),
+ \OC\Files\Filesystem::getMountManager(),
+ \OC\Files\Filesystem::getLoader(),
+ \OC::$server->getUserSession()
+);
+
+$mount = $externalManager->addShare($remote, $token, $password, $name, $owner);
+$result = $mount->getStorage()->file_exists('');
+
+echo json_encode($result);