|
4 | 4 | /** |
5 | 5 | * Specialised Global Addressbook Contacts Class! |
6 | 6 | * |
| 7 | + * Roundcube Plugin to create an Address Book from list of users in the SQL View. |
| 8 | + * Currently Natively Supporting: |
| 9 | + * + iRedMail [Aliases Supported] |
| 10 | + * |
7 | 11 | * @author Michael Daniel Telatynski <[email protected]> |
| 12 | + * @copyright 2015 Web Development Guru |
| 13 | + * @license http://bit.ly/16ABH2R |
| 14 | + * @license MIT |
| 15 | + * |
| 16 | + * @version 2.5.0 |
8 | 17 | */ |
9 | 18 | class sql_global_addressbooks extends rcube_plugin { |
10 | 19 |
|
11 | 20 | public $task = 'mail|addressbook'; |
12 | 21 |
|
13 | 22 | public function init() { |
14 | 23 | $this->add_hook('addressbooks_list', array($this, 'address_sources')); |
15 | | - $this->add_hook('addressbook_get', array($this, 'get_address_book')); |
| 24 | + $this->add_hook('addressbook_get', array($this, 'get_address_book')); |
16 | 25 | $this->load_config(); |
| 26 | + |
17 | 27 | $rcmail = rcmail::get_instance(); |
18 | 28 | $config = $rcmail->config; |
19 | 29 | $domain = $rcmail->user->get_username('domain'); |
@@ -56,7 +66,7 @@ private function touchbook($id, $name, $groups=false) { |
56 | 66 | private function wlbl($id, $domain) { |
57 | 67 | $rc = rcmail::get_instance(); |
58 | 68 | $cf = $rc->config->get('_sql_' . $id . '_read_allowed', array('*')); |
59 | | - $fc = $rc->config->get('_sql_' . $id . '_read_hidden', array()); |
| 69 | + $fc = $rc->config->get('_sql_' . $id . '_read_hidden', array()); |
60 | 70 |
|
61 | 71 | if (in_array($domain, $fc)) { return false; } |
62 | 72 | if ($cf === array('*') || in_array($domain, $cf)) { return true; } |
@@ -107,11 +117,11 @@ public function address_sources($p) { |
107 | 117 |
|
108 | 118 | public function get_address_book($p) { |
109 | 119 |
|
110 | | - if (in_array($p['id'], self::ac(rcmail::get_instance()->config->get('_sql_supportbook', array()), 0))) { |
111 | | - $p['instance'] = new sql_global_backend($p['id']); |
112 | | - } elseif ($p['id'] === 'global') { |
| 120 | + if ($p['id'] === 'global') { |
113 | 121 | $p['instance'] = new sql_global_backend('global'); |
114 | 122 | $p['instance']->groups = rcmail::get_instance()->config->get('_sql_globalbook_gp', true); |
| 123 | + } elseif (in_array($p['id'], self::ac(rcmail::get_instance()->config->get('_sql_supportbook', array()), 0))) { |
| 124 | + $p['instance'] = new sql_global_backend($p['id']); |
115 | 125 | } elseif ($p['id'] === 'domain') { $p['instance'] = new sql_global_backend('domain'); } |
116 | 126 |
|
117 | 127 | return $p; |
|
0 commit comments