Skip to content

Commit

Permalink
Merge branch 'master' into release-1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoh committed May 19, 2017
2 parents 0a8bc0c + 21894c2 commit 9603c33
Show file tree
Hide file tree
Showing 24 changed files with 26 additions and 48 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
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)
=================================================
* Replace globaladdressbook_readonly option with globaladdressbook_perms
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "http://github.com/JohnDoh/Roundcube-Plugin-Global-Address-Book/",
"license": "GPL-3.0",
"type": "roundcube-plugin",
"version": "1.9",
"version": "1.10",
"authors": [
{
"name": "Philip Weir",
Expand All @@ -25,7 +25,7 @@
},
"extra": {
"roundcube": {
"min-version": "1.0-beta"
"min-version": "1.0"
}
}
}
3 changes: 1 addition & 2 deletions config.inc.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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]';
Expand Down Expand Up @@ -34,5 +35,3 @@ $config['globaladdressbook_autocomplete'] = true;

// check globaladdressbook for known senders when displaying remote inline images
$config['globaladdressbook_check_safe'] = true;

?>
23 changes: 19 additions & 4 deletions globaladdressbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*
* Plugin to add a global address book
*
* @version @package_version@
* @author Philip Weir
*
* Copyright (C) 2009-2014 Philip Weir
Expand Down Expand Up @@ -44,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();
Expand Down Expand Up @@ -121,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();
Expand Down
2 changes: 0 additions & 2 deletions localization/cs_CZ.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Globalní Adresář';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/de_CH.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Allgemeines Adressbuch';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/de_DE.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Allgemeines Adressbuch';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/en_GB.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Global Addresses';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/en_US.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Global Addresses';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/es_AR.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Direcciones globales';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/es_ES.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Direcciones globales';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/fr_FR.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Adresses Globales';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/gl_ES.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Direccións globais';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/hu_HU.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Globális címjegyzék';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/it_IT.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Indirizzi Globali';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/ja_JP.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'グローバル・アドレス';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/nl_NL.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Globale adressen';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/pl_PL.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Globalne adresy';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/pt_BR.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Contatos Globais';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/pt_PT.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Endereços Globais';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/ro_RO.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Agendă globală';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/ru_RU.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'Глобальные адреса';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/tr_TR.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = 'global adresler';

$messages = array();

?>
2 changes: 0 additions & 2 deletions localization/zh_TW.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ $labels = array();
$labels['globaladdressbook'] = '公用通訊錄';

$messages = array();

?>

0 comments on commit 9603c33

Please sign in to comment.