diff options
author | Aleksander Machniak <alec@alec.pl> | 2020-10-04 11:31:47 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2020-10-04 11:31:47 +0300 |
commit | b21d1fe8f2aa10d83294077a42dad316e877e578 (patch) | |
tree | 573a3af460a0c9f6240762ac77e3a31c9380fc34 /program/include/rcmail.php | |
parent | db2aaab652fac844940983b6430c56a80c7216f3 (diff) |
Change "Allow remote resources" to include "from my contacts" and "from trusted senders" (#7614)
Diffstat (limited to 'program/include/rcmail.php')
-rw-r--r-- | program/include/rcmail.php | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 89090dbbf..b9ed3db5f 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1244,11 +1244,22 @@ class rcmail extends rcube return false; } - // TODO: Consider using all writeable addressbooks by default - // TODO: Support TYPE_DEFAULT, TYPE_WRITEABLE, TYPE_READONLY filter + // TODO: Support TYPE_READONLY filter + $sources = []; - if ($default = $this->get_address_book(rcube_addressbook::TYPE_DEFAULT, true)) { - $sources = array($this->get_address_book_id($default)); + if ($type & rcube_addressbook::TYPE_WRITEABLE) { + foreach ($this->get_address_sources(true, true) as $book) { + $sources[] = $book['id']; + } + } + + if ($type & rcube_addressbook::TYPE_DEFAULT) { + if ($default = $this->get_address_book(rcube_addressbook::TYPE_DEFAULT, true)) { + $book_id = $this->get_address_book_id($default); + if (!in_array($book_id, $sources)) { + $sources[] = $book_id; + } + } } if ($type & rcube_addressbook::TYPE_RECIPIENT) { |