Skip to content

Commit 65453fb

Browse files
committed
pre 2.5.0, Stable Release Candidate
1 parent b025f72 commit 65453fb

File tree

5 files changed

+35
-33
lines changed

5 files changed

+35
-33
lines changed

INSTALL

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
1. To Install, extract this archive and copy the folder
2-
`sql_global_addressbooks` into roundcube/plugins/
2+
`sql_global_addressbooks` into `%roundcube/plugins/`
33

4-
2. Choose one of the SQL Scripts from ./SQL/, dependant on your Mail System
4+
2. Choose one of the SQL Scripts from `./SQL/`, dependant on your Mail System
55
and whether or not you wish to have Alias Support, [%name%+alias.sql]
66
or you would like just to have the primary emails, [%name%.sql]
77
and run it on your MySQL/MariaDB Server as root, for example from PHPMyAdmin
88

9-
3. And then add `sql_global_addressbooks` to your roundcube/config/config.inc.php
10-
$config['plugins'] = array(..., 'sql_global_addressbooks');
9+
3. And then add `sql_global_addressbooks` to your `roundcube/config/config.inc.php`
10+
`$config['plugins'] = array(..., 'sql_global_addressbooks');`
1111

12-
4. Rename roundcube/plugins/sql_global_addressbooks/config.inc.php.dist to
13-
config.inc.php and fill in the configuration file.
12+
4. Rename `%roundcube/plugins/sql_global_addressbooks/config.inc.php.dist` to
13+
`config.inc.php` and fill in the configuration file.

sql_global_addressbooks/config.inc.php.dist

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,27 @@ NULL for disable or a string as the name of the `Domain Book`.
1313
e.g: = 'Domain Address Book'; */
1414
$config['_sql_domainbook_name'] = 'Domain Address Book';
1515

16-
1716
/*
1817
Default for both rules is Everything/Everyone is whitelisted and nothing Blacklisted.
1918
READ Allowed is the list of domains (or *) which can see this Address Book. */
2019
// $config['_sql_db_read_allowed'] = array('*');
2120
/*
2221
READ Hidden is the list of domains which cannot see this Address Book. */
23-
// $config['_sql_db_read_hidden'] = array('');
22+
// $config['_sql_db_read_hidden'] = array();
2423

2524

2625

2726

2827
/*
2928
The `Global Book` is an Address Book which will contain all the members of the Database View
3029
Configure as NULL for disable or a string as the name of the `Global Book`.
31-
e.g: = 'Global Book'; */
32-
// $config['_sql_globalbook_name'] = NULL;
30+
e.g: = 'Global Address Book'; */
31+
// $config['_sql_globalbook_name'] = 'Global Address Book';
3332

3433
/*
3534
Should the Global Address Book be grouped? */
3635
// $config['_sql_globalbook_gp'] = true;
3736

38-
3937
/*
4038
Default for both rule sets is Everything/Everyone is whitelisted and nothing Blacklisted.
4139
READ Allowed is the list of domains (or *) which can see this Address Book. */
@@ -60,7 +58,7 @@ The definition can also support multiple books, the definition goes like:
6058
array(array('Support Book', 'webdevguru.co.uk', 'support.co.uk'), array(...))
6159
Multidimensional Array, of no limit, first sub-element is the Specified Name of the Support Book.
6260
The rest of the elements are the Domains that should be within that Support Book.
63-
e.g: = array( array('Support Book',
61+
e.g: = array( array('Support Contacts',
6462
'webdevguru.co.uk',
6563
'support.site.com') ); */
6664
// $config['_sql_supportbook_list'] = array();

sql_global_addressbooks/sql_global_addressbooks.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,26 @@
44
/**
55
* Specialised Global Addressbook Contacts Class!
66
*
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+
*
711
* @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
817
*/
918
class sql_global_addressbooks extends rcube_plugin {
1019

1120
public $task = 'mail|addressbook';
1221

1322
public function init() {
1423
$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'));
1625
$this->load_config();
26+
1727
$rcmail = rcmail::get_instance();
1828
$config = $rcmail->config;
1929
$domain = $rcmail->user->get_username('domain');
@@ -56,7 +66,7 @@ private function touchbook($id, $name, $groups=false) {
5666
private function wlbl($id, $domain) {
5767
$rc = rcmail::get_instance();
5868
$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());
6070

6171
if (in_array($domain, $fc)) { return false; }
6272
if ($cf === array('*') || in_array($domain, $cf)) { return true; }
@@ -107,11 +117,11 @@ public function address_sources($p) {
107117

108118
public function get_address_book($p) {
109119

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') {
113121
$p['instance'] = new sql_global_backend('global');
114122
$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']);
115125
} elseif ($p['id'] === 'domain') { $p['instance'] = new sql_global_backend('domain'); }
116126

117127
return $p;

sql_global_addressbooks/sql_global_backend.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
<?php
22

33
/**
4-
* Specialised Global Addressbook Contacts Backend Class!
4+
* Specialised Global Addressbook Contacts Class Backend!
55
*
66
* @author Michael Daniel Telatynski <[email protected]>
7+
* @copyright 2015 Web Development Guru
8+
* @license http://bit.ly/16ABH2R
9+
* @license MIT
10+
*
11+
* @version 2.5.0
712
*/
813
class sql_global_backend extends rcube_addressbook {
914

@@ -177,17 +182,6 @@ public function search($fields, $value, $strict=false, $select=true, $nocount=fa
177182
}
178183
}
179184

180-
/*foreach ($required as $col) {
181-
$and_where[] = $db->quote_identifier($col).' <> '.$db->quote('');
182-
}*/
183-
if (!empty($where)) {
184-
// use AND operator for advanced searches
185-
//$where =
186-
}
187-
/*if (!empty($and_where)) {
188-
$where = ($where ? "($where) AND " : '') . join(' AND ', $and_where);
189-
}*/
190-
191185
if (!empty($where)) {
192186
$this->set_search_set(join(is_array($value) ? ' AND ' : ' OR ', $where));
193187
/*if ($select) {

sql_global_addressbooks/tests/sql_global_addressbooks.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
class ExampleAddressbook_Plugin extends PHPUnit_Framework_TestCase
3+
class sql_global_addressbooks_Plugin extends PHPUnit_Framework_TestCase
44
{
55

66
function setUp()
77
{
8-
include_once dirname(__FILE__) . '/../webdevguru_contacts.php';
8+
include_once dirname(__FILE__) . '/../sql_global_backend.php';
99
}
1010

1111
/**
@@ -14,9 +14,9 @@ function setUp()
1414
function test_constructor()
1515
{
1616
$rcube = rcube::get_instance();
17-
$plugin = new example_addressbook($rcube->api);
17+
$plugin = new sql_global_addressbooks($rcube->api);
1818

19-
$this->assertInstanceOf('example_addressbook', $plugin);
19+
$this->assertInstanceOf('sql_global_addressbooks', $plugin);
2020
$this->assertInstanceOf('rcube_plugin', $plugin);
2121
}
2222
}

0 commit comments

Comments
 (0)