From b923ce87e422780c66bc65d048e130e29f72109f Mon Sep 17 00:00:00 2001 From: Andy Wettstein Date: Wed, 3 Dec 2008 13:13:23 +0100 Subject: [PATCH] Make it possible to disable private contacts If you don't want private address books, just set $conf['privatebook'] darcs-hash:20081203121323-18fff-733cd397a8a4ed5f31a7cf2055457f439f62170e.gz --- entry.php | 4 ++-- inc/functions.php | 2 +- inc/template.php | 8 ++++---- templates/entry_edit.tpl | 4 +++- templates/help.tpl | 2 +- templates/import_entry.tpl | 4 ++++ 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/entry.php b/entry.php index a19888e..4405991 100644 --- a/entry.php +++ b/entry.php @@ -133,7 +133,7 @@ function _saveData(){ $now = time(); $newdn = 'uid='.$now; if (empty($_REQUEST['type'])) { $_REQUEST['type']='public'; } - if($_REQUEST['type'] == 'private'){ + if($_REQUEST['type'] == 'private' && $conf['privatebook']){ $newdn .= ', '.$conf['privatebook'].', '.$_SESSION['ldapab']['binddn']; }else{ $newdn .= ', '.$conf['publicbook']; @@ -231,7 +231,7 @@ function _getUploadData(){ unlink($file['tmp_name']); return $data; } else { - $smarty->assign('jpegError',$lang['err_wrongFileType']); + $smarty->assign('jpegError',$lang['err_wrongFileType']); } } else { $smarty->assign('jpegError',$lang['err_fileNotUploaded']); diff --git a/inc/functions.php b/inc/functions.php index eb1619c..a5e0631 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -393,7 +393,7 @@ function ldap_queryabooks($filter,$types){ ldap_free_result($sr); // private addressbook - if(!empty($_SESSION['ldapab']['binddn'])){ + if(!empty($_SESSION['ldapab']['binddn']) && $conf['privatebook']){ $sr = @ldap_list($LDAP_CON,$conf['privatebook']. ','.$_SESSION['ldapab']['binddn'], $filter,$types); diff --git a/inc/template.php b/inc/template.php index 279ca4c..64d3760 100644 --- a/inc/template.php +++ b/inc/template.php @@ -119,7 +119,7 @@ function tpl_markers(){ $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=inetOrgPerson",array("marker")); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION['ldapab']['binddn'])){ + if(!empty($_SESSION['ldapab']['binddn']) && $conf['privatebook']){ $sr = @ldap_list($LDAP_CON, $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], "ObjectClass=inetOrgPerson",array("marker")); @@ -183,7 +183,7 @@ function tpl_categories(){ $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=OXUserObject",array("OXUserCategories")); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION['ldapab']['binddn'])){ + if(!empty($_SESSION['ldapab']['binddn']) && $conf['privatebook']){ $sr = @ldap_list($LDAP_CON, $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], "ObjectClass=OXUserObject",array("OXUserCategories")); @@ -221,7 +221,7 @@ function tpl_timezone(){ $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=OXUserObject",array("OXTimeZone")); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION['ldapab']['binddn'])){ + if(!empty($_SESSION['ldapab']['binddn']) && $conf['privatebook']){ $sr = @ldap_list($LDAP_CON, $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], "ObjectClass=OXUserObject",array("OXTimeZone")); @@ -259,7 +259,7 @@ function tpl_country(){ $sr = ldap_list($LDAP_CON,$conf['publicbook'],"ObjectClass=OXUserObject",array("userCountry")); $result1 = ldap_get_binentries($LDAP_CON, $sr); //check users private addressbook - if(!empty($_SESSION['ldapab']['binddn'])){ + if(!empty($_SESSION['ldapab']['binddn']) && $conf['privatebook']){ $sr = @ldap_list($LDAP_CON, $conf['privatebook'].','.$_SESSION['ldapab']['binddn'], "ObjectClass=OXUserObject",array("userCountry")); diff --git a/templates/entry_edit.tpl b/templates/entry_edit.tpl index 2ea276c..3973801 100644 --- a/templates/entry_edit.tpl +++ b/templates/entry_edit.tpl @@ -310,7 +310,7 @@ - {if $entry.dn == ''} + {if $entry.dn == '' && $conf.privatebook} {$lang.msg_addto}
@@ -322,6 +322,8 @@ + {else} + {/if} diff --git a/templates/help.tpl b/templates/help.tpl index f93203a..f21db2a 100644 --- a/templates/help.tpl +++ b/templates/help.tpl @@ -22,7 +22,7 @@

Private Addressbook

-{if $binddn} +{if $binddn && $conf.privatebook}

To access your personal address data use these settings:

LDAP-Server
diff --git a/templates/import_entry.tpl b/templates/import_entry.tpl index 28ef22e..dd66dfa 100644 --- a/templates/import_entry.tpl +++ b/templates/import_entry.tpl @@ -28,12 +28,16 @@ {/foreach} + {if $conf.privatebook} + {else} + + {/if} -- 2.39.5