summaryrefslogtreecommitdiffstats
path: root/core/ajax/share.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/ajax/share.php')
-rw-r--r--core/ajax/share.php29
1 files changed, 27 insertions, 2 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index eff012f19d9..6cf5eb00cb6 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -67,6 +67,8 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
} else {
OC_JSON::success();
}
+ } catch (\OC\HintException $exception) {
+ OC_JSON::error(array('data' => array('message' => $exception->getHint())));
} catch (Exception $exception) {
OC_JSON::error(array('data' => array('message' => $exception->getMessage())));
}
@@ -274,8 +276,15 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$sharedUsers = [];
$sharedGroups = [];
if (isset($_GET['itemShares'])) {
- $sharedUsers = isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) ? $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER] : [];
- $sharedGroups = isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) ? $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP] : [];
+ if (isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) &&
+ is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) {
+ $sharedUsers = $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER];
+ }
+
+ if (isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) &&
+ is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
+ $sharedGroups = isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]);
+ }
}
$count = 0;
@@ -353,8 +362,24 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
)
);
}
+ $contactManager = \OC::$server->getContactsManager();
+ $addressBookContacts = $contactManager->search($_GET['search'], ['CLOUD', 'FN']);
+ foreach ($addressBookContacts as $contact) {
+ if (isset($contact['CLOUD'])) {
+ foreach ($contact['CLOUD'] as $cloudId) {
+ $shareWith[] = array(
+ 'label' => $contact['FN'] . ' (' . $cloudId . ')',
+ 'value' => array(
+ 'shareType' => \OCP\Share::SHARE_TYPE_REMOTE,
+ 'shareWith' => $cloudId
+ )
+ );
+ }
+ }
+ }
}
+
$sorter = new \OC\Share\SearchResultSorter((string)$_GET['search'],
'label',
\OC::$server->getLogger());