From 8818e82e6f358fd18e3efd6b0fb2c34954bf01b0 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 5 Mar 2008 08:57:19 +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/branches/2.5@9336 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_config.inc | 55 +++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/include/class_config.inc b/include/class_config.inc index 848bc57a2..209d1f83a 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -181,37 +181,40 @@ 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']); - /* Check for connection */ - if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){ - $smarty= get_smarty(); - print_red (_("Can't bind to LDAP. Please contact the system administrator.")); - $smarty->display (get_template_path('headers.tpl')); - echo ''.$_SESSION['errors'].''; - exit(); - } + if(!is_resource($this->ldap->cid)){ - if (!isset($_SESSION['size_limit'])){ - $_SESSION['size_limit']= $this->current['SIZELIMIT']; - $_SESSION['size_ignore']= $this->current['SIZEIGNORE']; - } + /* Build new connection */ + $this->ldap= ldap_init ($this->current['SERVER'], $this->current['BASE'], + $this->current['ADMIN'], $this->current['PASSWORD']); - if ($sizelimit){ - $this->ldap->set_size_limit($_SESSION['size_limit']); - } else { - $this->ldap->set_size_limit(0); - } + /* Check for connection */ + if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){ + $smarty= get_smarty(); + print_red (_("Can't bind to LDAP. Please contact the system administrator.")); + $smarty->display (get_template_path('headers.tpl')); + echo ''.$_SESSION['errors'].''; + exit(); + } - /* Move referrals */ - if (!isset($this->current['REFERRAL'])){ - $this->ldap->referrals= array(); - } else { - $this->ldap->referrals= $this->current['REFERRAL']; - } + if (!isset($_SESSION['size_limit'])){ + $_SESSION['size_limit']= $this->current['SIZELIMIT']; + $_SESSION['size_ignore']= $this->current['SIZEIGNORE']; + } + + if ($sizelimit){ + $this->ldap->set_size_limit($_SESSION['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