From 7adbe4399f0ceb47493bb08be54bd1386c0681a7 Mon Sep 17 00:00:00 2001 From: PhilW Date: Mon, 1 Jun 2015 17:56:57 +0100 Subject: [PATCH 1/5] add default username if config is missing --- globaladdressbook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/globaladdressbook.php b/globaladdressbook.php index c2abb28..7f7bf59 100644 --- a/globaladdressbook.php +++ b/globaladdressbook.php @@ -44,7 +44,7 @@ public function init() $this->load_config(); $this->add_texts('localization/'); - $this->user_name = $rcmail->config->get('globaladdressbook_user'); + $this->user_name = $rcmail->config->get('globaladdressbook_user', '[global_addressbook_user]'); $this->user_name = str_replace('%d', $rcmail->user->get_username('domain'), $this->user_name); $this->user_name = str_replace('%h', $_SESSION['storage_host'], $this->user_name); $this->groups = $rcmail->config->get('globaladdressbook_groups', false); From 3fe735400ac38e9915958635236399a398b9cb9e Mon Sep 17 00:00:00 2001 From: PhilW Date: Sun, 20 Mar 2016 10:17:49 +0000 Subject: [PATCH 2/5] cs fixes --- config.inc.php.dist | 2 -- localization/cs_CZ.inc | 2 -- localization/de_CH.inc | 2 -- localization/de_DE.inc | 2 -- localization/en_GB.inc | 2 -- localization/en_US.inc | 2 -- localization/es_AR.inc | 2 -- localization/es_ES.inc | 2 -- localization/fr_FR.inc | 2 -- localization/gl_ES.inc | 2 -- localization/hu_HU.inc | 2 -- localization/it_IT.inc | 2 -- localization/ja_JP.inc | 2 -- localization/nl_NL.inc | 2 -- localization/pl_PL.inc | 2 -- localization/pt_BR.inc | 2 -- localization/pt_PT.inc | 2 -- localization/ro_RO.inc | 2 -- localization/ru_RU.inc | 2 -- localization/tr_TR.inc | 2 -- localization/zh_TW.inc | 2 -- 21 files changed, 42 deletions(-) diff --git a/config.inc.php.dist b/config.inc.php.dist index a4a4a2b..9269858 100644 --- a/config.inc.php.dist +++ b/config.inc.php.dist @@ -34,5 +34,3 @@ $config['globaladdressbook_autocomplete'] = true; // check globaladdressbook for known senders when displaying remote inline images $config['globaladdressbook_check_safe'] = true; - -?> \ No newline at end of file diff --git a/localization/cs_CZ.inc b/localization/cs_CZ.inc index 1002ab0..cd972df 100644 --- a/localization/cs_CZ.inc +++ b/localization/cs_CZ.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Globalní Adresář'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/de_CH.inc b/localization/de_CH.inc index 6ed2b47..8ce7fb6 100644 --- a/localization/de_CH.inc +++ b/localization/de_CH.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Allgemeines Adressbuch'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/de_DE.inc b/localization/de_DE.inc index 6ed2b47..8ce7fb6 100644 --- a/localization/de_DE.inc +++ b/localization/de_DE.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Allgemeines Adressbuch'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/en_GB.inc b/localization/en_GB.inc index c8bc6d7..20719e3 100644 --- a/localization/en_GB.inc +++ b/localization/en_GB.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Global Addresses'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/en_US.inc b/localization/en_US.inc index c8bc6d7..20719e3 100644 --- a/localization/en_US.inc +++ b/localization/en_US.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Global Addresses'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/es_AR.inc b/localization/es_AR.inc index 0686db7..87da2f0 100644 --- a/localization/es_AR.inc +++ b/localization/es_AR.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Direcciones globales'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/es_ES.inc b/localization/es_ES.inc index 54b0a75..2614e7b 100644 --- a/localization/es_ES.inc +++ b/localization/es_ES.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Direcciones globales'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/fr_FR.inc b/localization/fr_FR.inc index 8b47afd..5cb995c 100644 --- a/localization/fr_FR.inc +++ b/localization/fr_FR.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Adresses Globales'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/gl_ES.inc b/localization/gl_ES.inc index 334338e..c7d93a5 100644 --- a/localization/gl_ES.inc +++ b/localization/gl_ES.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Direccións globais'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/hu_HU.inc b/localization/hu_HU.inc index 1e084d6..986997a 100644 --- a/localization/hu_HU.inc +++ b/localization/hu_HU.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Globális címjegyzék'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/it_IT.inc b/localization/it_IT.inc index 8cfa2e7..9d114ca 100644 --- a/localization/it_IT.inc +++ b/localization/it_IT.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Indirizzi Globali'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/ja_JP.inc b/localization/ja_JP.inc index 18f319f..8d92198 100644 --- a/localization/ja_JP.inc +++ b/localization/ja_JP.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'グローバル・アドレス'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/nl_NL.inc b/localization/nl_NL.inc index 8510a30..74bb05d 100644 --- a/localization/nl_NL.inc +++ b/localization/nl_NL.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Globale adressen'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/pl_PL.inc b/localization/pl_PL.inc index 20a412a..082d193 100644 --- a/localization/pl_PL.inc +++ b/localization/pl_PL.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Globalne adresy'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/pt_BR.inc b/localization/pt_BR.inc index e8d5e1f..1127c60 100644 --- a/localization/pt_BR.inc +++ b/localization/pt_BR.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Contatos Globais'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/pt_PT.inc b/localization/pt_PT.inc index 816635b..1a6652b 100644 --- a/localization/pt_PT.inc +++ b/localization/pt_PT.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Endereços Globais'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/ro_RO.inc b/localization/ro_RO.inc index 37df135..bb18e0a 100644 --- a/localization/ro_RO.inc +++ b/localization/ro_RO.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Agendă globală'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/ru_RU.inc b/localization/ru_RU.inc index 385bc1a..db59571 100644 --- a/localization/ru_RU.inc +++ b/localization/ru_RU.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'Глобальные адреса'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/tr_TR.inc b/localization/tr_TR.inc index fb568d9..ac4e7f0 100644 --- a/localization/tr_TR.inc +++ b/localization/tr_TR.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = 'global adresler'; $messages = array(); - -?> \ No newline at end of file diff --git a/localization/zh_TW.inc b/localization/zh_TW.inc index 4e0f8f6..a44896f 100644 --- a/localization/zh_TW.inc +++ b/localization/zh_TW.inc @@ -5,5 +5,3 @@ $labels = array(); $labels['globaladdressbook'] = '公用通訊錄'; $messages = array(); - -?> \ No newline at end of file From cdc95ca97c657fc24f8187817642de43c63fca56 Mon Sep 17 00:00:00 2001 From: PhilW Date: Wed, 2 Nov 2016 09:59:48 +0000 Subject: [PATCH 3/5] remove @version @package_version@ --- globaladdressbook.php | 1 - 1 file changed, 1 deletion(-) diff --git a/globaladdressbook.php b/globaladdressbook.php index 7f7bf59..12090e5 100644 --- a/globaladdressbook.php +++ b/globaladdressbook.php @@ -5,7 +5,6 @@ * * Plugin to add a global address book * - * @version @package_version@ * @author Philip Weir * * Copyright (C) 2009-2014 Philip Weir From 26cdc89b577a5af92d04f1fb0d2c9e201bfd2def Mon Sep 17 00:00:00 2001 From: PhilW Date: Sat, 6 May 2017 07:15:45 +0100 Subject: [PATCH 4/5] add %i macro to get domain from identity --- CHANGELOG | 2 ++ config.inc.php.dist | 1 + globaladdressbook.php | 22 +++++++++++++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 18353c2..08e6f18 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ Roundcube Webmail GlobalAddressbook =================================== + * Add %i macro to get domain from default identity + Version 1.9 (2014-08-31, rc-1.0) ================================================= * Replace globaladdressbook_readonly option with globaladdressbook_perms diff --git a/config.inc.php.dist b/config.inc.php.dist index 9269858..924df0a 100644 --- a/config.inc.php.dist +++ b/config.inc.php.dist @@ -7,6 +7,7 @@ // the name of the dummy user which holds the global address book, if the user does not exist it will be created // the name can contain the following macros that will be expanded as follows: // %d is replaced with the domain part of the username (if the username is an email address or default mail domain if not) +// %i is replaced with the domain part of the email address from the user's default identity // %h is replaced with the imap host (from the session info) // eg. to create one global address book per domain: global_addressbook@%d $config['globaladdressbook_user'] = '[global_addressbook_user]'; diff --git a/globaladdressbook.php b/globaladdressbook.php index 12090e5..cf67444 100644 --- a/globaladdressbook.php +++ b/globaladdressbook.php @@ -43,9 +43,7 @@ public function init() $this->load_config(); $this->add_texts('localization/'); - $this->user_name = $rcmail->config->get('globaladdressbook_user', '[global_addressbook_user]'); - $this->user_name = str_replace('%d', $rcmail->user->get_username('domain'), $this->user_name); - $this->user_name = str_replace('%h', $_SESSION['storage_host'], $this->user_name); + $this->user_name = globaladdressbook::parse_user($rcmail->config->get('globaladdressbook_user', '[global_addressbook_user]')); $this->groups = $rcmail->config->get('globaladdressbook_groups', false); $this->name = $this->gettext('globaladdressbook'); $this->_set_permissions(); @@ -120,6 +118,24 @@ public function check_known_senders($args) return $args; } + public static function parse_user($name) + { + $user = rcube::get_instance()->user; + + // %h - IMAP host + $h = $_SESSION['storage_host']; + // %d - domain name after the '@' from username + $d = $user->get_username('domain'); + // %i - domain name after the '@' from e-mail address of default identity + if (strpos($name, '%i') !== false) { + $user_ident = $user->list_emails(true); + list($local, $domain) = explode('@', $user_ident['email']); + $i = $domain; + } + + return str_replace(array('%h', '%d', '%i'), array($h, $d, $i), $name); + } + private function _set_permissions() { $rcmail = rcube::get_instance(); From 21894c298e7eef3dada3d5ecbd7dd5848bc0cfac Mon Sep 17 00:00:00 2001 From: PhilW Date: Fri, 19 May 2017 12:03:26 +0100 Subject: [PATCH 5/5] update version number --- CHANGELOG | 2 ++ composer.json | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 08e6f18..34c3a87 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ Roundcube Webmail GlobalAddressbook =================================== +Version 1.10 (2017-05-19, rc-1.0) +================================================= * Add %i macro to get domain from default identity Version 1.9 (2014-08-31, rc-1.0) diff --git a/composer.json b/composer.json index 724b4e8..173fedd 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "homepage": "http://github.com/JohnDoh/Roundcube-Plugin-Global-Address-Book/", "license": "GPL-3.0", "type": "roundcube-plugin", - "version": "1.10-git", + "version": "1.10", "authors": [ { "name": "Philip Weir", @@ -25,7 +25,7 @@ }, "extra": { "roundcube": { - "min-version": "1.0-beta" + "min-version": "1.0" } } } \ No newline at end of file