Пример #1
0
 if (isset($_POST["add"])) {
     //If no name has been given to this configuration, then go back to the page without adding
     if ($_POST["name"] != "") {
         if ($newID = $config_ldap->add($_POST)) {
             if (AuthLdap::testLDAPConnection($newID)) {
                 Session::addMessageAfterRedirect(__('Test successful'));
             } else {
                 Session::addMessageAfterRedirect(__('Test failed'), false, ERROR);
             }
             Html::redirect($CFG_GLPI["root_doc"] . "/front/authldap.php?next=extauth_ldap&id=" . $newID);
         }
     }
     Html::back();
 } else {
     if (isset($_POST["delete"])) {
         $config_ldap->delete($_POST);
         $_SESSION['glpi_authconfig'] = 1;
         $config_ldap->redirectToList();
     } else {
         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"])) {