diff options
| author | David Siegfried <david.siegfried@uni-vechta.de> | 2024-09-19 13:00:05 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2024-09-19 13:00:05 +0000 |
| commit | 0bc728b24271d1bbdce2f28e098b206452ab6391 (patch) | |
| tree | 6ae714740950c72a187cb24d7af1bdc1977cd203 /app/controllers/contact.php | |
| parent | cecadc738e05f9212cdfb42cb249a2788a59bf88 (diff) | |
prevent php-warnings in vcard-action, fixes #4609
Closes #4609
Merge request studip/studip!3422
Diffstat (limited to 'app/controllers/contact.php')
| -rw-r--r-- | app/controllers/contact.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/contact.php b/app/controllers/contact.php index 7820ce6..98c3daf 100644 --- a/app/controllers/contact.php +++ b/app/controllers/contact.php @@ -185,8 +185,9 @@ class ContactController extends AuthenticatedController $charset = 'utf-8'; $filename = _('Kontakte'); $this->set_layout(null); + $users = []; if (Request::submitted('user')) { - $user = User::findManyByUsername(Request::getArray('user')); + $users = User::findManyByUsername(Request::getArray('user')); } if ($group) { $group_object = Statusgruppen::find($group); @@ -195,23 +196,23 @@ class ContactController extends AuthenticatedController $this->render_nothing(); return; } - $user = User::findMany($group_object->members->pluck('user_id')); + $users = User::findMany($group_object->members->pluck('user_id')); } - if (!$user) { + if (empty($users)) { $user_object = User::findCurrent(); if (!$user_object) { $this->set_status(404); $this->render_nothing(); return; } - $user = User::findCurrent()->contacts; + $users = User::findCurrent()->contacts; } header("Content-type: text/x-vCard;charset=" . $charset); header("Content-disposition: attachment; " . encode_header_parameter('filename', $filename . '.vcf')); header("Pragma: private"); - $this->vCard = vCard::export($user); + $this->vCard = vCard::export($users); } private function initSidebar($active_id = null) |
