本文整理汇总了PHP中clladp::ExistsDN方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::ExistsDN方法的具体用法?PHP clladp::ExistsDN怎么用?PHP clladp::ExistsDN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clladp
的用法示例。
在下文中一共展示了clladp::ExistsDN方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaveCyrusPassword
function SaveCyrusPassword()
{
$ldap = new clladp();
$_POST["SaveCyrusPassword"] = url_decode_special_tool(trim($_POST["SaveCyrusPassword"]));
if ($_POST["SaveCyrusPassword"] == null) {
echo "Error: No password defined\n";
return;
}
if (strpos($_POST["SaveCyrusPassword"], '@') > 0) {
echo "@,: denied character\n";
return;
}
if (strpos($_POST["SaveCyrusPassword"], ':') > 0) {
echo "@,: denied character\n";
return;
}
$attrs["userPassword"][0] = $_POST["SaveCyrusPassword"];
$dn = "cn=cyrus,dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
if (!$ldap->Ldap_modify($dn, $attrs)) {
echo $ldap->ldap_last_error;
return;
}
}
$dn = "cn=cyrus,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
if (!$ldap->Ldap_modify($dn, $attrs)) {
echo $ldap->ldap_last_error;
return;
}
}
$sock = new sockets();
$sock->getFrameWork("cmd.php?cyrus-change-password=" . base64_encode($_POST["SaveCyrusPassword"]));
}
示例2: add_isp_server_name
function add_isp_server_name()
{
$ldap = new clladp();
if (!$ldap->ExistsDN("cn=smtp_sasl_password_maps,cn=artica,{$ldap->suffix}")) {
$upd["cn"][] = "smtp_sasl_password_maps";
$upd["objectClass"][] = "top";
$upd["objectClass"][] = "PostFixStructuralClass";
$ldap->ldap_add("cn=smtp_sasl_password_maps,cn=artica,{$ldap->suffix}", $upd);
unset($upd);
}
$cn = "cn={$_GET["isp_server_name"]},cn=smtp_sasl_password_maps,cn=artica,{$ldap->suffix}";
if ($ldap->ExistsDN($cn)) {
return null;
}
$upd["cn"] = $_GET["isp_server_name"];
$upd["objectClass"][] = "top";
$upd["objectClass"][] = "PostfixSmtpSaslPaswordMaps";
$upd["SmtpSaslPasswordString"] = "{$_GET["username"]}:{$_GET["password"]}";
$ldap->ldap_add($cn, $upd);
}
示例3: DeleteSmtpSaslPasswordMaps
function DeleteSmtpSaslPasswordMaps()
{
$ldap = new clladp();
$server = base64_decode($_GET["DeleteSmtpSaslPasswordMaps"]);
$dn = "cn={$server},cn=smtp_sasl_password_maps,cn=artica,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
if (!$ldap->ldap_delete($dn, true)) {
echo "{$dn}\n{$ldap->ldap_last_error}";
return;
}
}
$sock = new sockets();
$sock->getFrameWork("cmd.php?postfix-relayhost=yes");
}
示例4: 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");
}
}
示例5: Loadtemplate
function Loadtemplate()
{
$ou = $_GET["ou"];
$template_name = $_GET["template"];
writequeries();
$ldap = new clladp();
$dn = "cn=artica_quarantine_settings,ou={$ou},dc=organizations,{$ldap->suffix}";
if (isset($_GET["ArticaMaxDayTemplate"])) {
$template_data = "<SUBJECT>{$_GET["subject"]}</SUBJECT>\n\t\t<FROM>{$_GET["from"]}</FROM>\n\t\t<TEMPLATE>{$_GET["ArticaMaxDayTemplate"]}</TEMPLATE>";
$upd[$template_name][0] = $template_data;
if (!$ldap->Ldap_modify($dn, $upd)) {
echo "<H2>{$ldap->ldap_last_error}</H2>";
exit;
}
}
if (!$ldap->ExistsDN($dn)) {
$upd["cn"][] = "artica_quarantine_settings";
$upd["objectClass"][] = 'top';
$upd["objectClass"][] = 'ArticaQuarantineTemplates';
$upd["{$template_name}"][] = "DEFAULT";
$ldap->ldap_add($dn, $upd);
$template_data = "DEFAULT";
} else {
$hash = $ldap->Ldap_read($dn, '(ObjectClass=ArticaQuarantineTemplates)', array(strtolower($template_name)));
if (!is_array($hash[0][strtolower($template_name)])) {
unset($upd);
$upd[$template_name] = "DEFAULT";
$ldap->Ldap_add_mod($dn, $upd);
$hash = $ldap->Ldap_read($dn, '(ObjectClass=ArticaQuarantineTemplates)', array(strtolower($template_name)));
}
$template_data = $hash[0][strtolower($template_name)][0];
}
if ($template_data == "DEFAULT") {
$template_data = file_get_contents("ressources/databases/{$template_name}.cf");
}
if (preg_match('#<SUBJECT>(.+?)</SUBJECT>\\s+<FROM>(.+?)</FROM>\\s+<TEMPLATE>(.+?)</TEMPLATE>#is', $template_data, $reg)) {
$subject = $reg[1];
$from = $reg[2];
$template_d = $reg[3];
}
$tiny = TinyMce('ArticaMaxDayTemplate', $template_d);
$html = "\n\t<html>\n\t<head>\n\t<link href='css/styles_main.css' rel=\"styleSheet\" type='text/css' />\n\t<link href='css/styles_header.css' rel=\"styleSheet\" type='text/css' />\n\t<link href='css/styles_middle.css' rel=\"styleSheet\" type='text/css' />\n\t<link href='css/styles_forms.css' rel=\"styleSheet\" type='text/css' />\n\t<link href='css/styles_tables.css' rel=\"styleSheet\" type='text/css' />\n\t<script type='text/javascript' language='JavaScript' src='mouse.js'></script>\n\t<script type='text/javascript' language='javascript' src='XHRConnection.js'></script>\n\t<script type='text/javascript' language='javascript' src='default.js'></script>\n\t<script type='text/javascript' language='javascript' src='js/quarantine.ou.js'></script>\t\n\t</head>\n\t<body width=100% style='background-color:white'> \n\t\t<H5>{" . "{$template_name}}</H5>\n\t<form name='FFM1'>\n\t<table style='width:100%;margin:10px'>\n\t<tr>\n\t<td align='right'><strong>{from}:</strong></td>\n\t<td><input type='text' name='from' value='{$from}'></td>\n\t</tr>\n\t<tr>\n\t<td align='right'><strong>{subject}:</strong></td>\n\t<td><input type='text' name='subject' value='{$subject}'></td>\n\t</tr>\t\n\t</table>\n\t<div style='width:450px'>{$tiny}</div>\n\t<p class=caption>{template_token}</p>\n\t<input type='hidden' name='ou' value='{$ou}'>\n\t<input type='hidden' name='template' value='{$template_name}'>\n\t</form>\n\t</body>\n\t</html>";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例6: bogo_add_spam_user
function bogo_add_spam_user()
{
$ou = $_GET["ou"];
$bogospam_user = $_GET["bogospam_user"];
$bogospam_domain = $_GET["bogospam_domain"];
$bogospam_type = $_GET["bogospam_type"];
$userid = $bogospam_user;
$password = "NOPASS";
$group_id = 0;
$email = "{$bogospam_user}@{$bogospam_domain}";
$tpl = new templates();
$userid = str_replace(" ", ".", $userid);
$ldap = new clladp();
$dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd["cn"][0] = $userid;
$upd["ObjectClass"][0] = 'top';
$upd["ObjectClass"][1] = 'userAccount';
$upd["ObjectClass"][2] = 'organizationalPerson';
$upd["ObjectClass"][3] = 'ArticaBogoFilterAdmin';
$upd["uid"][0] = $userid;
$upd["accountActive"][0] = "TRUE";
$upd["mail"][0] = "{$email}";
$upd["accountGroup"][0] = $group_id;
$upd["domainName"][0] = $bogospam_domain;
$upd["homeDirectory"][0] = "/home/{$userid}";
$upd["mailDir"][0] = "/home/{$userid}/mail";
$upd["sn"][0] = $userid;
$upd["displayName"][0] = $userid . " bogofilter robot";
$upd["userPassword"][0] = $password;
$upd["BogoFilterMailType"][0] = "{$bogospam_type}";
if (!$ldap->ldap_add($dn, $upd)) {
echo "ERROR: {$ldap->ldap_last_error}";
exit;
}
}
}
示例7: rename_group
function rename_group()
{
$tpl = new templates();
if ($_SESSION["uid"] != -100) {
if ($_GET["ou"] != $_SESSION["ou"]) {
}
echo $tpl->_ENGINE_parse_body("{ERROR_NO_PRIVS}");
die;
}
$gp = new groups($_GET["group-id"]);
if ($_SESSION["uid"] != -100) {
if ($gp->ou != $_SESSION["ou"]) {
echo $tpl->_ENGINE_parse_body("{ERROR_NO_PRIVS}");
die;
}
}
$ldap = new clladp();
$newname = $_GET["new-name"];
if (trim($newname) == null) {
return null;
}
$actualdn = $gp->dn;
if (preg_match('#cn=(.+?),(.+)#', $actualdn, $re)) {
$branch = $re[2];
}
$newdn = "cn={$newname}";
$newdn2 = "{$newdn},{$branch}";
$ldap = new clladp();
if ($ldap->ExistsDN($newdn2)) {
return null;
}
writelogs("Rename {$actualdn} to {$newdn}", __CLASS__ . '/' . __FUNCTION__, __FILE__);
if (!$ldap->Ldap_rename_dn($newdn, $actualdn, $branch)) {
echo $tpl->_ENGINE_parse_body("{GROUP_RENAME} {failed}\n {$ldap->ldap_last_error}");
}
}
示例8: USER_ADD
function USER_ADD()
{
$userid = $_REQUEST["new_userid"];
$password = $_REQUEST["password"];
$group_id = $_REQUEST["group_id"];
if (isset($_GET["encpass"])) {
$password = url_decode_special_tool($password);
}
$ou = $_REQUEST["ou"];
$tpl = new templates();
if (preg_match("#(.+?)@(.+)#", $_REQUEST["email"], $re)) {
$_REQUEST["user_domain"] = $re[2];
$_REQUEST["email"] = $re[1];
}
$email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"];
$email = strtolower($email);
$user = new usersMenus();
if ($user->EnableVirtualDomainsInMailBoxes == 1) {
writelogs("Adding change {$userid} to \"{$email}\" in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
$userid = $email;
}
if (is_numeric($group_id)) {
$gp = new groups($group_id);
writelogs("privileges: {$group_id} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"", __FUNCTION__, __FILE__, __LINE__);
if ($gp->Privileges_array["AsComplexPassword"] == "yes") {
$ldap = new clladp();
$hash = $ldap->OUDatas($ou);
$privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true);
$policiespwd = unserialize(base64_decode($privs["PasswdPolicy"]));
if (is_array($policiespwd)) {
$priv = new privileges();
if (!$priv->PolicyPassword($password, $policiespwd)) {
return false;
}
}
} else {
writelogs("privileges: {$group_id} -> AsComplexPassword = \"No\" -> continue", __FUNCTION__, __FILE__, __LINE__);
}
}
$users = new user($userid);
if ($users->UserExists) {
echo $tpl->javascript_parse_text('ERROR: {account_already_exists}');
return false;
}
writelogs("Adding {$userid} in group {$group_id}", __FUNCTION__, __FILE__, __LINE__);
$email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"];
if ($ou == null) {
echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_ou}'));
exit;
}
if ($userid == null) {
echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_userid}'));
exit;
}
if ($password == null) {
echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_password}'));
exit;
}
if ($email == null) {
echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_email}'));
exit;
}
$ldap = new clladp();
if (!is_numeric($group_id)) {
writelogs("Groupid is not numeric", __FUNCTION__, __FILE__, __LINE__);
$default_dn_group = "cn=nogroup,ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($default_dn_group)) {
$ldap->AddGroup("nogroup", $ou);
}
$group_id = $ldap->GroupIDFromName($ou, "nogroup");
if (!is_numeric($group_id)) {
$group_id = 0;
}
}
$emT = explode('@', $email);
//Verify domains --------------------------------------------------------------- 2008 10 05,P3
$hash_domains_table = $ldap->hash_get_domains_ou($ou);
if (!isset($hash_domains_table[$_REQUEST["user_domain"]])) {
writelogs("{$userid} have no domains", __FUNCTION__, __FILE__, __LINE__);
writelogs("Create a new local domain by default", __FUNCTION__, __FILE__, __LINE__);
$ldap->AddDomainEntity($ou, $_REQUEST["user_domain"]);
}
//------------------------------------------------------------------------------
$domains = $ldap->domains_get_locals_domains($ou);
$dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
writelogs("{$userid} ({$dn}) already exists", __FUNCTION__, __FILE__, __LINE__);
echo $userid;
exit;
}
$users = new user($userid);
$users->mail = $email;
$users->accountGroup = $group_id;
$users->domainname = $_REQUEST["user_domain"];
if ($password != null) {
$users->password = $password;
}
$users->ou = $ou;
if ($domains[$_REQUEST["user_domain"]] == true) {
$upd = array();
//.........这里部分代码省略.........
示例9: 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;
}
示例10: build_virtual_alias_maps
function build_virtual_alias_maps()
{
$main = new maincf_multi("master", "master");
$ldap = new clladp();
if ($GLOBALS["DEBUG"]) {
echo __FUNCTION__ . " -> virtual_alias_maps=" . count($GLOBALS["virtual_alias_maps"]) . " entries\n";
}
if (is_array($GLOBALS["virtual_alias_maps_emailing"])) {
echo "Starting......: " . date("H:i:s") . " Postfix [" . __LINE__ . "] " . count($GLOBALS["virtual_alias_maps_emailing"]) . " distribution listes\n";
while (list($num, $ligne) = each($GLOBALS["virtual_alias_maps_emailing"])) {
$num = trim($num);
$num = str_replace("\r", "", $num);
$num = str_replace("\n", "", $num);
if ($GLOBALS["VERBOSE"]) {
echo "FINAL -> {$num}/\"{$ligne}\"\n";
}
if ($ligne == null) {
continue;
}
$final[] = $ligne;
}
}
//-----------------------------------------------------------------------------------
if (is_array($GLOBALS["virtual_alias_maps"])) {
echo "Starting......: " . date("H:i:s") . " Cleaning virtual aliase(s)\n";
while (list($num, $ligne) = each($GLOBALS["virtual_alias_maps"])) {
$ligne = trim($ligne);
$ligne = str_replace("\r", "", $ligne);
$ligne = str_replace("\n", "", $ligne);
if ($ligne == null) {
continue;
}
if (preg_match("#x500:#", $ligne)) {
continue;
}
if (preg_match("#x400:#", $ligne)) {
continue;
}
$final[] = $ligne;
}
}
//-----------------------------------------------------------------------------------
$dn = "cn=artica_smtp_sync,cn=artica,{$ldap->suffix}";
$filter = "(&(objectClass=InternalRecipients)(cn=*))";
if ($ldap->ExistsDN($dn)) {
$attrs = array("cn");
$hash = $ldap->Ldap_search($dn, $filter, $attrs);
if ($hash["count"] > 0) {
for ($i = 0; $i < $hash["count"]; $i++) {
$email = $hash[$i]["cn"][0];
$email = trim($email);
$email = str_replace("\r", "", $email);
$email = str_replace("\n", "", $email);
if (trim($email) == null) {
continue;
}
$final[] = "{$email}\t{$email}";
}
}
}
//-----------------------------------------------------------------------------------
if (isset($GLOBALS["LDAPDBS"]["virtual_alias_maps"])) {
if (!is_array($GLOBALS["LDAPDBS"]["virtual_alias_maps"])) {
$virtual_alias_maps_cf = $GLOBALS["LDAPDBS"]["virtual_alias_maps"];
}
}
$sock = new sockets();
$MailingListUseLdap = $sock->GET_INFO("MailingListUseLdap");
if (!is_numeric($MailingListUseLdap)) {
$MailingListUseLdap = 0;
}
if ($MailingListUseLdap == 1) {
$virtual_alias_maps_cf[] = "ldap:/etc/postfix/mailinglist.ldap.cf";
mailling_ldap();
}
$sql = "SELECT * FROM postfix_aliases_domains";
$q = new mysql();
$pre = '${1}';
$li = array();
$results = $q->QUERY_SQL($sql, "artica_backup");
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$ligne["alias"] = trim($ligne["alias"]);
$ligne["alias"] = strtolower($ligne["alias"]);
$aliases = str_replace(".", "\\.", $ligne["alias"]);
$domain = $ligne["domain"];
$li[] = "/^(.*)@{$aliases}\$/\t{$pre}@{$domain}";
$final[] = "{$ligne["alias"]}\tDOMAIN";
}
$main = new maincf_multi("master", "master");
$virtual_mailing_addr = $main->mailling_list_mysql("master");
if (is_array($virtual_mailing_addr)) {
while (list($num, $ligne) = each($virtual_mailing_addr)) {
$final[] = $ligne;
}
}
echo "Starting......: " . date("H:i:s") . " Postfix " . count($final) . " virtual aliase(s)\n";
echo "Starting......: " . date("H:i:s") . " Postfix " . count($li) . " virtual domain(s) aliases\n";
$virtual_alias_maps_cf[] = "hash:/etc/postfix/virtual";
$virtual_alias_maps_cf[] = "pcre:/etc/postfix/virtual.domains";
if ($GLOBALS["DEBUG"]) {
//.........这里部分代码省略.........
示例11: add_auto_mount
function add_auto_mount()
{
$type = $_GET["type"];
$mount_point = $_GET["mount-point"];
$computer = $_GET["computer"];
$src = $_GET["src"];
if ($type == 'smbfs') {
$cmp = new computers($computer);
$ini = new Bs_IniHandler();
$ini->loadString($cmp->ComputerCryptedInfos);
$username = $ini->_params["ACCOUNT"]["USERNAME"];
$password = $ini->_params["ACCOUNT"]["PASSWORD"];
if ($username != null) {
$options = ",username={$username},password={$password}";
}
$pattern = "-fstype=smbfs{$options} ://{$cmp->ComputerIP}/{$src}";
}
if (preg_match("#nfs[0-9]+#", $type)) {
if ($type == 'nfs3') {
$pattern = "-fstype={$type} {$cmp->ComputerIP}:{$src}";
}
if ($type == 'nfs4') {
$pattern = "-fstype={$type} {$cmp->ComputerIP}:/";
}
}
$ldap = new clladp();
$autofs = new autofs();
$dn = "cn={$mount_point},ou=auto.automounts,ou=mounts,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd["ObjectClass"][] = 'top';
$upd["ObjectClass"][] = 'automount';
$upd["cn"][] = $mount_point;
$upd["automountInformation"][] = $pattern;
if (!$ldap->ldap_add($dn, $upd)) {
echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error;
return false;
}
} else {
$upd["automountInformation"][] = $pattern;
if (!$ldap->Ldap_modify($dn, $upd)) {
echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error;
return false;
}
}
$tpl = new templates();
echo $tpl->_ENGINE_parse_body('{success}');
}
示例12: CheckBranch
function CheckBranch()
{
$ldap = new clladp();
if (!$ldap->ExistsDN("dc=organizations,{$ldap->suffix}")) {
writelogs("CheckBranch():: creating the new branch dc=organizations,{$ldap->suffix}", __FUNCTION__, __FILE__, __LINE__);
$upd["objectClass"][] = "top";
$upd["objectClass"][] = "organization";
$upd["objectClass"][] = "dcObject";
$upd["o"][] = "organizations";
$upd["dc"][] = "organizations";
if (!$ldap->ldap_add("dc=organizations,{$ldap->suffix}", $upd)) {
writelogs("Unable to create new entry dc=organizations,{$ldap->suffix}", __FUNCTION__, __FILE__, __LINE__);
writelogs($ldap->ldap_last_error, __FUNCTION__, __FILE__, __LINE__);
return false;
}
return true;
} else {
writelogs("CheckBranch():: The new branch dc=organizations,{$ldap->suffix} exists", __FUNCTION__, __FILE__, __LINE__);
return true;
}
}
示例13: CronAddArticaTasksSave
function CronAddArticaTasksSave()
{
$task_name = $_GET["CronAddArticaTasksSave"];
$ldap = new clladp();
$tpl = new templates();
$dn = "cn={$task_name},cn=system_cron_task,cn=artica,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
echo $tpl->_ENGINE_parse_body('{error_task_already_exists}');
exit;
}
$cron = new cron();
$upd['cn'][0] = "{$task_name}";
$upd['objectClass'][0] = 'ArticaCronDatas';
$upd['objectClass'][1] = 'top';
$upd['CronFileCommand'][0] = $cron->array_artica_task[$task_name]["CronFileCommand"];
$upd['CronFileDescriptions'][0] = $cron->array_artica_task[$task_name]["CronFileDescriptions"];
$upd['CronFileMailto'][0] = $cron->array_artica_task[$task_name]["CronFileMailto"];
$upd["CronFileToDelete"][0] = "no";
$ldap->ldap_add($dn, $upd);
echo $tpl->_ENGINE_parse_body('{success}');
}
示例14: users_database
function users_database()
{
$tpl = new templates();
$page = CurrentPageName();
$ou = $_GET["ou"];
$domain = $_GET["domain"];
$ldap = new clladp();
$trusted_smtp_domain = 0;
$search = $_GET["search"];
$search = "*" . $_GET["search"] . "*";
$search = str_replace("**", "*", $search);
$search = str_replace("*", "%", $search);
$dn = "cn=@{$_GET["domain"]},cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
$trusted_smtp_domain = 1;
}
if ($trusted_smtp_domain == 1) {
$html = "<div class=explain>{DOMAIN_TRUSTED_NO_USERDB_TEXT}</div>";
echo $tpl->_ENGINE_parse_body($html);
return;
}
$sql = "SELECT `email` FROM postfix_relais_domains_users WHERE\n\t`ou`='{$ou}' AND `domain`='{$domain}'\n\tAND `email` LIKE '{$search}' ORDER BY email LIMIT 0,90";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
echo "<H2>{$q->mysql_error}</H2>";
}
$html = "\n<p> </p>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>" . imgtootltip("plus-24.png", "{import}", "ImportUsersRelayDomain()") . "</th>\n\t\t<th>{email}</th>\n\t\t<th>" . imgtootltip("delete-32.png", "{empty_database}", "EmptyUsersRelayDomain()") . "</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
if ($classtr == "oddRow") {
$classtr = null;
} else {
$classtr = "oddRow";
}
$html = $html . "\n\t<tr class={$classtr}>\n\t<td style='font-size:14px;font-weight:bold'><img src=img/fw_bold.gif></td>\n\t<td style='font-size:14px;font-weight:bold'>{$ligne["email"]}</a></td>\n\t<td width=1%>" . imgtootltip("delete-24.png", "{delete}", "POSTFIX_MULTI_INSTANCE_INFOS_DEL('{$ligne["ou"]}','{$ligne["ip_address"]}')") . "</td>\n\t</tR>";
}
$html = $html . "</table>\n";
echo $tpl->_ENGINE_parse_body($html);
return;
}
示例15: post_form
function post_form()
{
$_POST["email"] = strtolower(trim($_POST["email"]));
$_POST["password"] = trim($_POST["password"]);
$tpl = new templates();
$sock = new sockets();
$ldap = new clladp();
$EnableVirtualDomainsInMailBoxes = $sock->GET_INFO("EnableVirtualDomainsInMailBoxes");
if (!ValidateMail($_POST["email"])) {
echo "<H2>" . $tpl->_ENGINE_parse_body("{ERROR_INVALID_EMAIL_ADDR}: ({original_mail}:{$_POST["email"]})") . "</H2>";
exit;
}
$domain = trim(strtolower($_POST["domain"]));
$company = $_POST["company"];
$password = $_POST["password"];
$uid = trim(strtolower($_POST["username"]));
$ou = $_POST["organization"];
if ($ou == null) {
$ou = $_POST["company"];
}
if ($company == null) {
echo $tpl->_ENGINE_parse_body("<H2>{company}:{ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM}</H2>");
exit;
}
if ($password == null) {
echo $tpl->_ENGINE_parse_body("<H2>{password}:{ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM}</H2>");
exit;
}
if ($_POST["domain"] == null) {
echo $tpl->_ENGINE_parse_body("<H2>{domain}:{ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM}</H2>");
exit;
}
if ($uid == null) {
echo $tpl->_ENGINE_parse_body("<H2>{username}:{ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM}</H2>");
exit;
}
if (isset($_POST["subdomain"])) {
$_POST["subdomain"] = trim(strtolower($_POST["subdomain"]));
if ($_POST["subdomain"] == null) {
echo $tpl->_ENGINE_parse_body("<H2>{subdomain}:{ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM}</H2>");
exit;
}
$domain = $_POST["subdomain"] . ".{$domain}";
}
$hashdoms = $ldap->hash_get_all_domains();
if ($hashdoms[$domain] != null) {
echo $tpl->_ENGINE_parse_body("<H2>{error_domain_exists} »<strong>{$domain}</strong></H2");
exit;
}
$ou = $ldap->StripSpecialsChars($ou);
$uid = $ldap->StripSpecialsChars($uid);
if ($ou == "users") {
echo "<H2>Error: Adding\n{$ou} words not permitted\n</H2>";
exit;
}
if ($ou == "groups") {
echo "<H2>Error: Adding\n{$ou} words not permitted\n</H2>";
exit;
}
if ($ou == "computers") {
echo "<H2>Error: Adding\n{$ou} words not permitted\n</H2>";
exit;
}
if ($ou == "pureftpd") {
echo "<H2>Error: Adding\n{$ou} words not permitted\n</H2>";
exit;
}
$ldap = new clladp();
$dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
echo $tpl->_ENGINE_parse_body("<H2>{organization}:{ERROR_OBJECT_ALREADY_EXISTS}</H2>");
exit;
}
if ($EnableVirtualDomainsInMailBoxes == 1) {
$uidtests = "{$uid}@{$domain}";
$u = new user($uidtests);
if (!$u->DoesNotExists) {
echo $tpl->_ENGINE_parse_body("<H2>{member}: «{$uid}» {ERROR_OBJECT_ALREADY_EXISTS}</H2>");
exit;
}
}
$u = new user($uid);
if (!$u->DoesNotExists) {
echo $tpl->_ENGINE_parse_body("<H2>{member}: «{$uid}» {ERROR_OBJECT_ALREADY_EXISTS}</H2>");
exit;
}
$zmd5 = md5("{$_POST["email"]}{$ou}{$company}{$domain}{$uid}");
$password = addslashes($password);
$company = addslashes($company);
$uid = addslashes($uid);
$sql = "INSERT IGNORE INTO register_orgs(`email`,`ou`,`company`,`domain`,`username`,`password`,`zmd5`)\n\tVALUES('{$_POST["email"]}','{$ou}','{$company}','{$domain}','{$uid}','{$password}','{$zmd5}')\n\t";
$q = new mysql();
$q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
echo "<H2>{$q->mysql_error}</H2>";
return;
}
$prefix = "http://";
if ($_SERVER["HTTPS"] == "on") {
$prefix = "https://";
//.........这里部分代码省略.........