本文整理汇总了PHP中clladp::ldap_delete方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::ldap_delete方法的具体用法?PHP clladp::ldap_delete怎么用?PHP clladp::ldap_delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clladp
的用法示例。
在下文中一共展示了clladp::ldap_delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DelDNSEntry
function DelDNSEntry()
{
$ldap = new clladp();
if (!$ldap->ldap_delete($_GET["DelDNSEntry"])) {
echo $ldap->ldap_last_error;
}
}
示例2: Confirm
function Confirm()
{
$ldap = new clladp();
$dn = base64_decode($_GET["dn"]);
if ($dn == null) {
echo "DN IS NULL";
return;
}
if (!$ldap->ldap_delete(base64_decode($_GET["dn"]))) {
echo $ldap->ldap_last_error;
}
}
示例3: changecomputername
function changecomputername()
{
if (substr($_POST["userid"], strlen($_POST["userid"]) - 1, 1) != "\$") {
$_POST["userid"] = $_POST["userid"] . "\$";
}
$comp = new computers($_POST["userid"]);
$MAC = $comp->ComputerMacAddress;
$_POST["NewHostname"] = trim(strtolower($_POST["NewHostname"]));
$_POST["NewHostname"] = str_replace('$', '', $_POST["NewHostname"]);
$actualdn = $comp->dn;
$newrdn = "cn={$_POST["NewHostname"]}\$";
$ldap = new clladp();
if (!preg_match("#^cn=(.+?),[a-zA-Z\\s]+#", $actualdn, $re)) {
echo "Unable to preg_match {$actualdn}\n";
return;
}
$newDN = str_replace($re[1], $_POST["NewHostname"] . '$', $actualdn);
if ($newDN == null) {
echo "Unable to preg_match {$actualdn} -> {$re[1]}\n";
return;
}
if ($ldap->ExistsDN("{$newrdn},ou=Computer,dc=samba,dc=organizations,{$ldap->suffix}")) {
$ldap->ldap_delete("{$newrdn},ou=Computer,dc=samba,dc=organizations,{$ldap->suffix}");
}
$newParent = "ou=Computer,dc=samba,dc=organizations,{$ldap->suffix}";
if (!$ldap->Ldap_rename_dn($newrdn, $actualdn, $newParent)) {
echo "Rename failed {$ldap->ldap_last_error}\nFunction:" . __FUNCTION__ . "\nFile:" . __FILE__ . "\nLine" . __LINE__ . "\n\nActual DN:{$actualdn}\nExpected DN:{$newrdn}";
return;
}
$upd["uid"][0] = $_POST["NewHostname"] . '$';
if (!$ldap->Ldap_modify($newDN, $upd)) {
echo "Update UID {$upd["uid"][0]} failed:\n{$ldap->ldap_last_error}\nFunction:" . __FUNCTION__ . "\nFile:" . __FILE__ . "\nLine" . __LINE__ . "\nExpected DN:{$newDN}\nExpected value:{$_POST["NewHostname"]}";
return;
}
$ocs = new ocs($MAC);
$ocs->ComputerName = $_POST["NewHostname"];
$ocs->ComputerIP = $comp->ComputerIP;
$ocs->EditComputer();
if (IsPhysicalAddress($comp->ComputerMacAddress)) {
include_once dirname(__FILE__) . "/ressources/class.mysql.inc";
$uid = $comp->ComputerIDFromMAC($comp->ComputerMacAddress);
$comp = new computers($uid);
$sql = "UPDATE dhcpd_fixed SET `hostname`='{$comp->ComputerRealName}' WHERE `mac`='{$comp->ComputerMacAddress}'";
$q = new mysql();
$q->QUERY_SQL($sql, "artica_backup");
}
}
示例4: EditRelayDomain
function EditRelayDomain()
{
$relayIP = $_GET["EditRelayDomainIP"];
$relayPort = $_GET["EditRelayDomainPort"];
$domain_name = $_GET["EditRelayDomainName"];
$MX = $_GET["MX"];
$ldap = new clladp();
$ou = $_GET["ou"];
$autoaliases = $_GET["autoaliases"];
$trusted_smtp_domain = $_GET["trusted_smtp_domain"];
$auto = new AutoAliases($ou);
if ($autoaliases == "yes") {
$auto->DomainsArray[$domain_name] = $domain_name;
} else {
unset($auto->DomainsArray[$domain_name]);
}
$auto->Save();
writelogs("saving relay:{$relayIP}:{$relayPort} trusted_smtp_domain={$trusted_smtp_domain}", __FUNCTION__, __FILE__, __LINE__);
$dn = "cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd = array();
$upd['cn'][0] = "transport_map";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
$ldap->ldap_add($dn, $upd);
unset($upd);
}
if ($MX == "no") {
$relayIP = "[{$relayIP}]";
}
$dn = "cn={$domain_name},cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
$ldap->ldap_delete($dn);
}
writelogs("Create {$dn}", __FUNCTION__, __FILE__);
$upd = array();
$upd['cn'][0] = "{$domain_name}";
$upd['objectClass'][0] = 'transportTable';
$upd['objectClass'][1] = 'top';
$upd["transport"][] = "relay:{$relayIP}:{$relayPort}";
if (!$ldap->ldap_add($dn, $upd)) {
echo "Error\n" . "Line: " . __LINE__ . "\n{$ldap->ldap_last_error}";
return;
}
unset($upd);
$dn = "cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd = array();
$upd['cn'][0] = "relay_recipient_maps";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo "Error\n" . "Line: " . __LINE__ . "\n{$ldap->ldap_last_error}";
return;
}
unset($upd);
}
$dn = "cn=@{$domain_name},cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
$ldap->ldap_delete($dn);
}
if ($trusted_smtp_domain == 1) {
$upd = array();
$upd['cn'][0] = "@{$domain_name}";
$upd['objectClass'][0] = 'PostfixRelayRecipientMaps';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo "Error\n" . "Line: " . __LINE__ . "\n{$ldap->ldap_last_error}";
return;
}
}
$sock = new sockets();
$usr = new usersMenus();
$sock->getFrameWork("cmd.php?postfix-transport-maps=yes");
}
示例5: DeleteOU
function DeleteOU()
{
$user = new usersMenus();
if ($user->AsArticaAdministrator == true) {
$ldap = new clladp();
$ldap->ldap_delete("ou={$_GET["DeleteOU"]},dc=organizations,{$ldap->suffix}", true);
}
}
示例6: PostfixDeleteRelayRecipient
function PostfixDeleteRelayRecipient(){
$domain=$_GET["PostfixDeleteRelayRecipient"];
$ldap=new clladp();
$dn="cn=$domain,cn=relay_recipient_maps ,cn=artica,$ldap->suffix";
$ldap->ldap_delete($dn,false);
$sock=new sockets();
$sock->getFrameWork("services.php?postfix-single=yes");
}
示例7: remotedomain_edit
function remotedomain_edit()
{
$relayIP = $_POST["destination"];
$relayPort = $_POST["port"];
$domain_name = $_POST["remotedomain"];
$MX = $_POST["MX"];
$ldap = new clladp();
$ou = $_POST["ou"];
$trusted_smtp_domain = $_POST["trusted_smtp_domain"];
if ($MX == 0) {
$MX = "no";
} else {
$MX = "yes";
}
writelogs("saving relay:{$relayIP}:{$relayPort} trusted_smtp_domain={$trusted_smtp_domain}", __FUNCTION__, __FILE__, __LINE__);
$dn = "cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd = array();
$upd['cn'][0] = "transport_map";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
$ldap->ldap_add($dn, $upd);
unset($upd);
}
if ($MX == "no") {
$relayIP = "[{$relayIP}]";
}
$dn = "cn={$domain_name},cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
$ldap->ldap_delete($dn);
}
writelogs("Create {$dn}", __FUNCTION__, __FILE__);
$upd = array();
$upd['cn'][0] = "{$domain_name}";
$upd['objectClass'][0] = 'transportTable';
$upd['objectClass'][1] = 'top';
$upd["transport"][] = "relay:{$relayIP}:{$relayPort}";
if (!$ldap->ldap_add($dn, $upd)) {
echo "Error\n" . "Line: " . __LINE__ . "\n{$ldap->ldap_last_error}";
return;
}
unset($upd);
$dn = "cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd = array();
$upd['cn'][0] = "relay_recipient_maps";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo "Error\n" . "Line: " . __LINE__ . "\n{$ldap->ldap_last_error}";
return;
}
unset($upd);
}
$dn = "cn=@{$domain_name},cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
$ldap->ldap_delete($dn);
}
if ($trusted_smtp_domain == 1) {
$upd = array();
$upd['cn'][0] = "@{$domain_name}";
$upd['objectClass'][0] = 'PostfixRelayRecipientMaps';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo "Error\n" . "Line: " . __LINE__ . "\n{$ldap->ldap_last_error}";
return;
}
}
ChockServices();
}
示例8: DNS_DEL_ENTRY
function DNS_DEL_ENTRY($value)
{
$hostname = base64_decode($value);
$EXEC_NICE = EXEC_NICE();
if (is_file("/usr/bin/nohup")) {
$nohup = "/usr/bin/nohup ";
}
$reload_datas = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-dns >/dev/null 2>&1 &";
include_once dirname(__FILE__) . "/ressources/class.pdns.inc";
$ldap = new clladp();
$upd = array();
$tbl = explode(".", $hostname);
$dc = "dc=" . @implode(",dc=", $tbl);
if ($ldap->ExistsDN("{$dc},ou=dns,{$ldap->suffix}")) {
if ($ldap->ldap_delete("{$dc},ou=dns,{$ldap->suffix}", true)) {
send_email_events("Success deleting DNS entry {$hostname}", "DN removed was : {$dc},ou=dns,{$ldap->suffix}", "CLOUD");
return true;
}
} else {
events("unable to stat {$dc},ou=dns,{$ldap->suffix}", __FUNCTION__, __FILE__, __LINE__);
}
$suffix = "ou=dns,{$ldap->suffix}";
$pattern = "(&(objectclass=*)(associatedDomain={$hostname}))";
$sr = @ldap_search($ldap->ldap_connection, $suffix, "{$pattern}", array());
if ($sr) {
$hash = ldap_get_entries($ldap->ldap_connection, $sr);
for ($i = 0; $i < $hash["count"]; $i++) {
$dn = $hash[$i]["dn"];
if (strlen($dn) > 0) {
$dns[] = $dn;
events("removing associateddomain={$hostname} in {$dn}", __FUNCTION__, __FILE__, __LINE__);
$upd["associateddomain"] = $hostname;
if (!$ldap->Ldap_del_mod($dn, $upd)) {
$dns[] = $ldap->ldap_last_error;
}
}
}
send_email_events("Success executing remove DNS entry {$hostname}", @implode("\n", $dns), "CLOUD");
return true;
}
events("Failed -> notify", __FUNCTION__, __FILE__, __LINE__);
send_email_events("Failed remove DNS entry {$hostname} does not exists", null, "CLOUD");
shell_exec($reload_datas);
return true;
}
示例9: users_delete
function users_delete()
{
$ldap = new clladp();
$ldap->ldap_delete($_GET["deleteuserdn"], true);
echo users_table($_GET["ou"], $_GET["domain"]);
}
示例10: DeleteMember
function DeleteMember()
{
$usermenu = new usersMenus();
$tpl = new templates();
if ($usermenu->AllowAddUsers == false) {
echo $tpl->_ENGINE_parse_body('{no_privileges}');
exit;
}
$ldap = new clladp();
$Userdatas = $ldap->UserDatas($_GET["DeleteMember"]);
$dn = $Userdatas["dn"];
$ldap->ldap_delete($dn, false);
if ($ldap->ldap_last_error != null) {
echo $ldap->ldap_last_error;
} else {
echo $tpl->_ENGINE_parse_body('{success}');
exit;
}
}
示例11: sasl_delete
function sasl_delete()
{
$ldap = new clladp();
$cn = "cn={$_GET["sasl_delete"]},cn=smtp_sasl_password_maps,cn=artica,{$ldap->suffix}";
$ldap->ldap_delete($cn, true);
}
示例12: DeleteRobot
function DeleteRobot()
{
$ldap = new clladp();
$H = $ldap->UserDatas($_GET["DeleteRobot"]);
$dn = $H["dn"];
$ldap->ldap_delete($dn, true);
}
示例13: CONTACT_DELETE
function CONTACT_DELETE()
{
$employeeNumber = $_GET["delete-contact"];
$ct = new contacts($_SESSION["uid"], $employeeNumber);
if ($_SESSION["uid"] != -100) {
$ldap = new clladp();
$user = new user($_SESSION["uid"]);
$dn = "cn={$ct->sn} {$ct->givenName},ou={$user->uid},ou=People,dc={$user->ou},dc=NAB,{$ldap->suffix}";
if ($dn == $ct->dn) {
$ldap->ldap_delete($ct->dn, true);
$sock = new sockets();
$sock->getfile("OBMContactDelete:{$ct->uidNumber}");
} else {
$tpl = new templates();
echo $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
}
}
}
示例14: smtpd_client_restrictions_save
function smtpd_client_restrictions_save()
{
$ldap = new clladp();
if (!$ldap->ExistsDN("cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
$upd["objectClass"][] = "top";
$upd["objectClass"][] = "top";
$upd["objectClass"][] = "PostFixStructuralClass";
$upd["cn"][0] = "restrictions_classes";
if (!$ldap->ldap_add("cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd)) {
echo "cn=restrictions_classes,cn=artica,{$ldap->suffix}\n{$ldap->ldap_last_error}";
return null;
}
}
if ($ldap->ExistsDN("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
$ldap->ldap_delete("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", false);
$upd1["objectClass"][] = "top";
$upd1["objectClass"][] = "PostFixRestrictionStandardClasses";
$upd1["cn"][0] = "smtpd_client_restrictions";
if (!$ldap->ldap_add("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd1)) {
echo "Modify smtpd_client_restrictions branch\n{$ldap->ldap_last_error}";
return null;
}
}
unset($upd1);
if ($ldap->ExistsDN("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
$ldap->ldap_delete("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", false);
}
if (!$ldap->ExistsDN("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}")) {
$upd1["objectClass"][] = "top";
$upd1["objectClass"][] = "PostFixRestrictionStandardClasses";
$upd1["cn"][0] = "smtpd_helo_restrictions";
if (!$ldap->ldap_add("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd1)) {
echo "Modify smtpd_helo_restrictions branch\n{$ldap->ldap_last_error}";
return null;
}
}
$EnablePostfixAntispamPack = $_GET["EnablePostfixAntispamPack"];
$upd_vals["PostFixRestrictionClassList"][] = "permit_mynetworks=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "permit_sasl_authenticated=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "check_client_access=\"hash:/etc/postfix/postfix_allowed_connections\"";
if ($_GET["reject_unknown_client_hostname"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_client_hostname=\"\"";
}
if ($_GET["reject_invalid_hostname"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_invalid_hostname=\"\"";
}
if ($_GET["reject_unknown_reverse_client_hostname"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_reverse_client_hostname=\"\"";
}
if ($_GET["reject_unknown_sender_domain"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_unknown_sender_domain=\"\"";
}
if ($_GET["reject_non_fqdn_sender"] == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_non_fqdn_sender=\"\"";
}
if ($EnablePostfixAntispamPack == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"zen.spamhaus.org\"";
$upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"sbl.spamhaus.org\"";
$upd_vals["PostFixRestrictionClassList"][] = "reject_rbl_client=\"cbl.abuseat.org\"";
}
$upd_vals["PostFixRestrictionClassList"][] = "permit=\"\"";
$sock = new sockets();
$sock->SET_INFO('EnablePostfixAntispamPack', $EnablePostfixAntispamPack);
$sock->SET_INFO('reject_forged_mails', $_GET["reject_forged_mails"]);
if (!$ldap->Ldap_modify("cn=smtpd_client_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd_vals)) {
echo "Modify smtpd_client_restrictions branch\n{$ldap->ldap_last_error}";
return null;
}
unset($upd_vals);
if ($EnablePostfixAntispamPack == 1) {
$upd_vals["PostFixRestrictionClassList"][] = "permit_mynetworks=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "permit_sasl_authenticated=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "check_client_access=\"hash:/etc/postfix/postfix_allowed_connections\"";
$upd_vals["PostFixRestrictionClassList"][] = "reject_non_fqdn_hostname=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "reject_invalid_hostname=\"\"";
$upd_vals["PostFixRestrictionClassList"][] = "permit=\"\"";
if (!$ldap->Ldap_modify("cn=smtpd_helo_restrictions,cn=restrictions_classes,cn=artica,{$ldap->suffix}", $upd_vals)) {
echo "Modify datas in smtpd_helo_restrictions branch\n{$ldap->ldap_last_error}";
return null;
}
}
$main = new main_cf();
$main->save_conf_to_server(1);
$sock = new sockets();
$tpl = new templates();
$sock->getFrameWork("cmd.php?reconfigure-postfix=yes");
}
示例15: ExportDN
echo "No ldapadd !!\n";
return;
}
if ($newou == null) {
echo "No destination\n";
return;
}
if ($ou == null) {
echo "No org source\n";
return;
}
@mkdir("/usr/share/artica-postfix/ressources/ldap-back/{$ou}", null, true);
$tmpfile = "/usr/share/artica-postfix/ressources/ldap-back/{$ou}/{$ou}.ldif";
$dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
ExportDN($ou, $newou, $dn);
$ldap->ldap_delete($dn, true);
$dn = "cn={$ou},cn=catch-all,cn=artica,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
ExportDN($ou, $newou, $dn);
$ldap->ldap_delete($dn, true);
}
$dn = "cn={$ou},cn=PostfixRobots,cn=artica,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
ExportDN($ou, $newou, $dn);
$ldap->ldap_delete($dn, true);
}
$dn = "dc={$ou},dc=NAB,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
ExportDN($ou, $newou, $dn);
$ldap->ldap_delete($dn, true);
}