From 27af2b3c7a638736779451297089395aff682a12 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 5 Mar 2008 08:58:18 +0000 Subject: [PATCH] Updated class_config -get_ldap_link() checks now, if the current ldap link still valid, if not it creates a new one. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9337 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_config.inc | 50 ++++++++++++++++-------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index 274142b83..9ade720a7 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -216,35 +216,37 @@ class config { function get_ldap_link($sizelimit= FALSE) { - /* Build new connection */ - $this->ldap= ldap_init ($this->current['SERVER'], $this->current['BASE'], - $this->current['ADMIN'], $this->current['PASSWORD']); + if(!is_resource($this->ldap->cid)){ - /* Check for connection */ - if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){ - $smarty= get_smarty(); - msg_dialog::display(_("LDAP error"), _("Cannot bind to LDAP. Please contact the system administrator."), FATAL_ERROR_DIALOG); - exit(); - } + /* Build new connection */ + $this->ldap= ldap_init ($this->current['SERVER'], $this->current['BASE'], + $this->current['ADMIN'], $this->current['PASSWORD']); - if (!session::is_set('size_limit')){ - session::set('size_limit',$this->current['SIZELIMIT']); - session::set('size_ignore',$this->current['SIZEIGNORE']); - } + /* Check for connection */ + if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){ + $smarty= get_smarty(); + msg_dialog::display(_("LDAP error"), _("Cannot bind to LDAP. Please contact the system administrator."), FATAL_ERROR_DIALOG); + exit(); + } - if ($sizelimit){ - $this->ldap->set_size_limit(session::get('size_limit')); - } else { - $this->ldap->set_size_limit(0); - } + if (!session::is_set('size_limit')){ + session::set('size_limit',$this->current['SIZELIMIT']); + session::set('size_ignore',$this->current['SIZEIGNORE']); + } - /* Move referrals */ - if (!isset($this->current['REFERRAL'])){ - $this->ldap->referrals= array(); - } else { - $this->ldap->referrals= $this->current['REFERRAL']; - } + if ($sizelimit){ + $this->ldap->set_size_limit(session::get('size_limit')); + } else { + $this->ldap->set_size_limit(0); + } + /* Move referrals */ + if (!isset($this->current['REFERRAL'])){ + $this->ldap->referrals= array(); + } else { + $this->ldap->referrals= $this->current['REFERRAL']; + } + } return ($this->ldap); } -- 2.30.2