From 09ae698e4382c2f709dd73ec2a876320174060a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jul 2008 09:20:42 +0000 Subject: [PATCH] Better error management --- htdocs/admin/ldap_contacts.php | 27 +++++++++++++++------------ htdocs/admin/ldap_groups.php | 27 ++++++++++++++++----------- htdocs/admin/ldap_members.php | 29 +++++++++++++++++------------ htdocs/admin/ldap_users.php | 27 ++++++++++++++++----------- 4 files changed, 64 insertions(+), 46 deletions(-) diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 66079921d99..52ced4610c9 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -3,7 +3,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Regis Houssin - * Copyright (C) 2006-2007 Laurent Destailleur + * Copyright (C) 2006-2008 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,16 +18,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/admin/ldap_contacts.php \ingroup ldap \brief Page d'administration/configuration du module Ldap - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -255,15 +252,21 @@ print info_admin($langs->trans("LDAPDescValues")); /* * Test de la connexion */ +print '
'; +if (! function_exists("ldap_connect")) +{ + print ''.$langs->trans("LDAPTestSynchroContact").''; +} +else if (empty($conf->global->LDAP_SERVER_HOST)) +{ + print ''.$langs->trans("LDAPTestSynchroContact").''; +} +else print ''.$langs->trans("LDAPTestSynchroContact").''; +print '

'; + + if (function_exists("ldap_connect")) { - if ($conf->global->LDAP_SERVER_HOST) - { - print '
'; - print ''.$langs->trans("LDAPTestSynchroContact").''; - print '

'; - } - if ($_GET["action"] == 'test') { // Creation objet diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index c6d7d3e8047..d3b80da4710 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -18,16 +18,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/admin/ldap_groups.php \ingroup ldap \brief Page d'administration/configuration du module Ldap - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -175,15 +172,23 @@ print info_admin($langs->trans("LDAPDescValues")); /* * Test de la connexion */ +print '
'; +if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') +{ + if (! function_exists("ldap_connect")) + { + print ''.$langs->trans("LDAPTestSynchroGroup").''; + } + else if (empty($conf->global->LDAP_SERVER_HOST)) + { + print ''.$langs->trans("LDAPTestSynchroGroup").''; + } + else print ''.$langs->trans("LDAPTestSynchroGroup").''; + print '

'; +} + if (function_exists("ldap_connect")) { - if ($conf->global->LDAP_SERVER_HOST && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') - { - print '
'; - print ''.$langs->trans("LDAPTestSynchroGroup").''; - print '

'; - } - if ($_GET["action"] == 'testgroup') { // Creation objet diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 43c9f0d12dc..e3462f30a30 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -3,7 +3,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005 Regis Houssin - * Copyright (C) 2006-2007 Laurent Destailleur + * Copyright (C) 2006-2008 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,15 +18,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \file htdocs/admin/ldap_members.php \ingroup ldap adherent \brief Page d'administration/configuration du module Ldap adherent - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -366,16 +364,23 @@ print info_admin($langs->trans("LDAPDescValues")); /* * Test de la connexion */ +if ($conf->global->LDAP_MEMBER_ACTIVE) +{ + print '
'; + if (! function_exists("ldap_connect")) + { + print ''.$langs->trans("LDAPTestSynchroMember").''; + } + else if (empty($conf->global->LDAP_SERVER_HOST)) + { + print ''.$langs->trans("LDAPTestSynchroMember").''; + } + else print ''.$langs->trans("LDAPTestSynchroMember").''; + print '

'; +} + if (function_exists("ldap_connect")) { - if ($conf->global->LDAP_SERVER_HOST && $conf->global->LDAP_MEMBER_ACTIVE) - { - print '
'; - print ''.$langs->trans("LDAPTestSynchroMember").''; -// print ''.$langs->trans("LDAPTestSynchroTypeMember").''; - print '

'; - } - if ($_GET["action"] == 'testmember') { // Creation objet diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 3ddfb74d63b..be8796eb834 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -18,16 +18,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/admin/ldap_users.php \ingroup ldap \brief Page d'administration/configuration du module Ldap - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -267,15 +264,23 @@ print info_admin($langs->trans("LDAPDescValues")); /* * Test de la connexion */ +if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') +{ + print '
'; + if (! function_exists("ldap_connect")) + { + print ''.$langs->trans("LDAPTestSynchroUser").''; + } + else if (empty($conf->global->LDAP_SERVER_HOST)) + { + print ''.$langs->trans("LDAPTestSynchroUser").''; + } + else print ''.$langs->trans("LDAPTestSynchroUser").''; + print '

'; +} + if (function_exists("ldap_connect")) { - if ($conf->global->LDAP_SERVER_HOST && $conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') - { - print '
'; - print ''.$langs->trans("LDAPTestSynchroUser").''; - print '

'; - } - if ($_GET["action"] == 'testuser') { // Creation objet