Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Gieling <github@dartcafe.de>2020-07-25 09:21:14 +0300
committerGitHub <noreply@github.com>2020-07-25 09:21:14 +0300
commitb04ebb596ab4252637c8061b169075e76a65a809 (patch)
tree0889555bda26802946749bc86b5ce9c7ba79b6fd /lib/Controller
parent973fb3e708a499de17b7ae7b07416204270873ac (diff)
parent3e0c0ec6d616676928aca4eb321014499ca630f9 (diff)
Merge pull request #1026 from nextcloud/sharee-fix
Sharee fix
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/SystemController.php23
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/Controller/SystemController.php b/lib/Controller/SystemController.php
index 44dfbf8a..d4c15963 100644
--- a/lib/Controller/SystemController.php
+++ b/lib/Controller/SystemController.php
@@ -85,7 +85,7 @@ class SystemController extends Controller {
* Validate string as email address
* @NoAdminRequired
* @param string $query
- * @return Boolval
+ * @return Boolean
*/
private function isValidEmail($email) {
return (!preg_match('/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/', $email)) ? false : true;
@@ -94,6 +94,7 @@ class SystemController extends Controller {
/**
* Get a list of NC users, groups and contacts
* @NoAdminRequired
+ * @PublicPage
* @NoCSRFRequired
* @param string $query
* @param bool $getGroups - search in groups
@@ -105,8 +106,8 @@ class SystemController extends Controller {
*/
public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers = true, $getContacts = true, $getMail = false, $skipGroups = array(), $skipUsers = array()) {
$list = array();
- // if (filter_var($query, FILTER_VALIDATE_EMAIL)) {
- if ($this->isValidEmail($query)) {
+
+ if ($getMail && $this->isValidEmail($query)) {
$list[] = [
'id' => '',
'user' => '',
@@ -124,10 +125,8 @@ class SystemController extends Controller {
];
}
-
if ($getGroups) {
- $groups = $this->groupManager->search($query);
- foreach ($groups as $group) {
+ foreach ($this->groupManager->search($query) as $group) {
if (!in_array($group->getGID(), $skipGroups)) {
$list[] = [
'id' => $group->getGID(),
@@ -170,13 +169,9 @@ class SystemController extends Controller {
}
}
- $contactsManager = \OC::$server->getContactsManager();
-
-
- if ($getContacts && $contactsManager->isEnabled()) {
- $contacts = $contactsManager->search($query, array('FN', 'EMAIL', 'ORG', 'CATEGORIES'));
+ if ($getContacts && \OC::$server->getContactsManager()->isEnabled()) {
- foreach ($contacts as $contact) {
+ foreach (\OC::$server->getContactsManager()->search($query, array('FN', 'EMAIL', 'ORG', 'CATEGORIES')) as $contact) {
if (!array_key_exists('isLocalSystemBook', $contact) && array_key_exists('EMAIL', $contact)) {
$emailAdresses = $contact['EMAIL'];
@@ -199,9 +194,9 @@ class SystemController extends Controller {
'type' => 'contact',
'icon' => 'icon-mail',
'avatarURL' => '',
- 'avatar' => isset($contact['PHOTO']) ? $contact['PHOTO'] : '',
+ 'avatar' => '',
'lastLogin' => '',
- 'cloudId' => ''
+ 'cloudId' => '',
];
}