if (isset($_POST["test_ldap"])) { $config_ldap->getFromDB($_POST["id"]); if (AuthLdap::testLDAPConnection($_POST["id"])) { //TRANS: %s is the description of the test $_SESSION["LDAP_TEST_MESSAGE"] = sprintf(__('Test successful: %s'), sprintf(__('Main server %s'), $config_ldap->fields["name"])); } else { //TRANS: %s is the description of the test $_SESSION["LDAP_TEST_MESSAGE"] = sprintf(__('Test failed: %s'), sprintf(__('Main server %s'), $config_ldap->fields["name"])); } Html::back(); } else { if (isset($_POST["test_ldap_replicate"])) { foreach ($_POST["test_ldap_replicate"] as $replicate_id => $value) { $replicate = new AuthLdapReplicate(); $replicate->getFromDB($replicate_id); if (AuthLdap::testLDAPConnection($_POST["id"], $replicate_id)) { //TRANS: %s is the description of the test $_SESSION["LDAP_TEST_MESSAGE"] = sprintf(__('Test successful: %s'), sprintf(__('Replicate %s'), $ldap->fields["name"])); } else { //TRANS: %s is the description of the test $_SESSION["LDAP_TEST_MESSAGE"] = sprintf(__('Test failed: %s'), sprintf(__('Replicate %s'), $ldap->fields["name"])); } } Html::back(); } else { if (isset($_POST["add_replicate"])) { $replicate = new AuthLdapReplicate(); unset($_POST["next"]); unset($_POST["id"]); $replicate->add($_POST); Html::back();
Html::redirect($_SERVER['PHP_SELF']); } else { if (!isset($_GET['start'])) { $_GET['start'] = 0; } if (isset($_SESSION["ldap_import"])) { unset($_SESSION["ldap_import"]); } if (!isset($_SESSION["ldap_server"])) { if (isset($_POST["ldap_server"])) { $_SESSION["ldap_server"] = $_POST["ldap_server"]; } else { Html::redirect($CFG_GLPI["root_doc"] . "/front/ldap.php"); } } if (!AuthLdap::testLDAPConnection($_SESSION["ldap_server"])) { unset($_SESSION["ldap_server"]); echo "<div class='center b'>" . __('Unable to connect to the LDAP directory') . "<br>"; echo "<a href='" . $_SERVER['PHP_SELF'] . "?next=listservers'>" . __('Back') . "</a></div>"; } else { if (!isset($_SESSION["ldap_group_filter"])) { $_SESSION["ldap_group_filter"] = ''; } if (!isset($_SESSION["ldap_group_filter2"])) { $_SESSION["ldap_group_filter2"] = ''; } if (isset($_GET["order"])) { $_SESSION["ldap_sortorder"] = $_GET["order"]; } if (!isset($_SESSION["ldap_sortorder"])) { $_SESSION["ldap_sortorder"] = "ASC";