if (isset($_GET['search'])) { $shareWithinGroupOnly = OC\Share\Share::shareWithGroupMembersOnly(); $shareWith = array(); $groups = OC_Group::getGroups((string) $_GET['search']); if ($shareWithinGroupOnly) { $usergroups = OC_Group::getUserGroups(OC_User::getUser()); $groups = array_intersect($groups, $usergroups); } $count = 0; $users = array(); $limit = 0; $offset = 0; while ($count < 15 && count($users) == $limit) { $limit = 15 - $count; if ($shareWithinGroupOnly) { $users = OC_Group::DisplayNamesInGroups($usergroups, (string) $_GET['search'], $limit, $offset); } else { $users = OC_User::getDisplayNames((string) $_GET['search'], $limit, $offset); } $offset += $limit; foreach ($users as $uid => $displayName) { if ((!isset($_GET['itemShares']) || !is_array((string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) || !in_array($uid, (string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) && $uid != OC_User::getUser()) { $shareWith[] = array('label' => $displayName, 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER, 'shareWith' => $uid)); $count++; } } } $count = 0; // enable l10n support $l = \OC::$server->getL10N('core'); foreach ($groups as $group) {
// } // } // } if ($sharePolicy == 'groups_only') { $groups = OC_Group::getUserGroups(OC_User::getUser()); } else { $groups = OC_Group::getGroups(); } $count = 0; $users = array(); $limit = 0; $offset = 0; while ($count < 15 && count($users) == $limit) { $limit = 15 - $count; if ($sharePolicy == 'groups_only') { $users = OC_Group::DisplayNamesInGroups($groups, $_GET['search'], $limit, $offset); } else { $users = OC_User::getDisplayNames($_GET['search'], $limit, $offset); } $offset += $limit; foreach ($users as $uid => $displayName) { if ((!isset($_GET['itemShares']) || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) || !in_array($uid, $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) && $uid != OC_User::getUser()) { $shareWith[] = array('label' => $displayName, 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER, 'shareWith' => $uid)); $count++; } } } $count = 0; foreach ($groups as $group) { if ($count < 15) { if (stripos($group, $_GET['search']) !== false && (!isset($_GET['itemShares']) || !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]))) {