From 6153e205162478cda6687f2d326c1821ac3e6dd9 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 08 May 2008 04:17:35 -0400
Subject: [PATCH] - Option 'use_SQL_address_book' replaced by 'address_book_type'

---
 CHANGELOG                          |    1 +
 program/steps/addressbook/func.inc |   11 ++++-------
 config/main.inc.php.dist           |    7 ++++---
 program/steps/mail/addcontact.inc  |    2 +-
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index e67b925..ecdd692 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,7 @@
 ----------
 - Don't attempt to delete cache entries if enable_caching is FALSE (#1485051)
 - Optimized messages sorting on servers without sort capability (#1485049)
+- Option 'use_SQL_address_book' replaced by 'address_book_type'
 
 2008/05/07 (davidke/richs)
 ----------
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index d7ac4d9..ac34d6d 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -213,11 +213,12 @@
 // session domain: .example.org
 $rcmail_config['session_domain'] = '';
 
-// This indicates whether or not to use the SQL address book.
-// If set to false then it will look at using the first writable LDAP
+// This indicates which type of address book to use. Possible choises:
+// 'sql' (default) and 'ldap'.
+// If set to 'ldap' then it will look at using the first writable LDAP
 // address book as the primary address book and it will not display the
 // SQL address book in the 'Address Book' view.
-$rcmail_config['use_SQL_address_book'] = true;
+$rcmail_config['address_book_type'] = 'sql';
 
 // In order to enable public ldap search, configure an array like the Verisign
 // example further below. if you would like to test, simply uncomment the example.
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index a08b551..8938cfa 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -22,16 +22,13 @@
 // instantiate a contacts object according to the given source
 if (($source = get_input_value('_source', RCUBE_INPUT_GPC)) && isset($CONFIG['ldap_public'][$source]))
   $CONTACTS = new rcube_ldap($CONFIG['ldap_public'][$source]);
-else {
-    if (!$CONFIG["use_SQL_address_book"]) {
+else if ($CONFIG['address_book_type'] == 'ldap') {
     // Get the first LDAP address book.
     $source = key((array)$CONFIG['ldap_public']);
     $prop = current((array)$CONFIG['ldap_public']);
     $CONTACTS = new rcube_ldap($prop);
-  } // end if
-  else {
+} else {
     $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']);
-  } // end else
 } // end else
 
 $CONTACTS->set_pagesize($CONFIG['pagesize']);
@@ -52,7 +49,7 @@
 
 // add list of address sources to client env
 $js_list = array();
-if ($CONFIG["use_SQL_address_book"]) {
+if ($CONFIG['address_book_type'] != 'ldap') {
   // We are using the DB address book, add it.
   $js_list = array("0" => array('id' => 0, 'readonly' => false));
 } // end if
@@ -79,7 +76,7 @@
     
   // allow the following attributes to be added to the <ul> tag
   $out = '<ul' . create_attrib_string($attrib, array('style', 'class', 'id')) . ">\n";
-  if ($CONFIG["use_SQL_address_book"]) {
+  if ($CONFIG['address_book_type'] != 'ldap') {
     $out .= sprintf($line_templ,
       'rcmli'.$local_id,
       !$current ? 'selected' : '',
diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index 6f4187b..6568268 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -24,7 +24,7 @@
 if (!empty($_POST['_address']))
 {
   $CONTACTS = array();
-  if (!$CONFIG["use_SQL_address_book"]) {
+  if ($CONFIG['address_book_type'] == 'ldap') {
     // Use the first writable LDAP address book.
     foreach ($CONFIG["ldap_public"] as $id => $prop) {
       if ($prop["writable"]) {

--
Gitblit v1.9.1