Skip to content

Commit

Permalink
Merge branch 'master' into release-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoh committed Jan 31, 2021
2 parents 5b16727 + b57f4a0 commit ac3c072
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Roundcube Webmail GlobalAddressbook
===================================

* Restore support for localized address book names (#54)

Version 2.0 (2021-01-03, rc-1.3)
=================================================
* Complete rewrite of config options
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ Config
The default config file is plugins/globaladdressbook/config.inc.php.dist
Rename this to plugins/globaladdressbook/config.inc.php

**'name'**

This is the name of the address book that is displayed to users inside
Roundcube. The value can be a string or an array of localized names. If an
array is used the keys should be Roundcube localization identifiers and there
must be a key called 'en_us'. All array keys must be lower case. For example:
```php
'name' => [
'en_us' => 'Global Addresses',
'ja_jp' => 'グローバル・アドレス',
'pt_pt' => 'Endereços Globais',
],
```

**'user'**

This is the name of the dummy user which holds the global address book.
Expand Down
10 changes: 8 additions & 2 deletions globaladdressbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,19 @@ private function _load_config()
}
}

private function _get_config($name, $abook_id, $return = null)
private function _get_config($name, $abook_id, $default = null)
{
if (array_key_exists($name, $this->config[$abook_id])) {
$return = $this->config[$abook_id][$name];

if ($name == 'name' && is_array($return)) {
// special handling for localized address book name
$return = $this->rcube->gettext(['name' => 'globaladdressbook.name'] + $return);
$return = $return == '[globaladdressbook.name]' ? $default : $return;
}
}

return $return;
return !empty($return) ? $return : $default;
}

private function _get_user($username, $host)
Expand Down

0 comments on commit ac3c072

Please sign in to comment.