本文整理汇总了PHP中AuthLdap::testLDAPConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthLdap::testLDAPConnection方法的具体用法?PHP AuthLdap::testLDAPConnection怎么用?PHP AuthLdap::testLDAPConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthLdap
的用法示例。
在下文中一共展示了AuthLdap::testLDAPConnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
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();
示例2: unset
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";