本文整理汇总了PHP中clladp::ldap_add方法的典型用法代码示例。如果您正苦于以下问题:PHP clladp::ldap_add方法的具体用法?PHP clladp::ldap_add怎么用?PHP clladp::ldap_add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clladp
的用法示例。
在下文中一共展示了clladp::ldap_add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: NewGroup
function NewGroup()
{
$date = date('ymdhI');
$ldap = new clladp();
$ou = $_GET["NewGroup"];
$dn = "cn=New Group {$date},ou={$ou},dc=organizations,{$ldap->suffix}";
$update_array["cn"][0] = "New Group {$date}";
$update_array["gidNumber"][0] = $ldap->_GenerateGUID();
$update_array["description"][0] = "New posix group";
$update_array["objectClass"][] = 'posixGroup';
$update_array["objectClass"][] = 'ArticaSettings';
$update_array["objectClass"][] = 'top';
if ($ldap->ldap_add($dn, $update_array) == false) {
echo "Error: Adding {$update_array["gidNumber"][0]} gid \n\t\t\tcn=New Group\n" . $ldap->ldap_last_error;
exit;
}
echo "OK";
}
示例4: 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;
}
}
}
示例5: 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");
}
示例6: events
if ($GLOBALS["VERBOSE"]) {
echo "file:{$file} ou:{$ou}\n";
}
if (!is_file($file)) {
events("{$file}, no such file", 100);
die;
}
$tbl = @explode("\n", @file_get_contents($file));
$ldap = new clladp();
$hashdoms = $ldap->hash_get_all_domains();
$dn = "cn=relay_domains,ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "relay_domains";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
events("{$dn}: {$ldap->ldap_last_error}", 100);
die;
}
unset($upd);
}
$dn = "cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "relay_recipient_maps";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
events("{$dn}: {$ldap->ldap_last_error}", 100);
die;
}
unset($upd);
示例7: autofs_connect
function autofs_connect()
{
$auto = new autofs();
$ldap = new clladp();
$sock = new sockets();
$_GET["LOCAL_DIR"] = strtolower($ldap->StripSpecialsChars($_GET["LOCAL_DIR"]));
$upd = array();
$dn = "cn={$_GET["LOCAL_DIR"]},ou=auto.automounts,ou=mounts,{$ldap->suffix}";
if ($_GET["fs"] == null) {
$prefix_pattern = "-fstype=auto,check=none,noatime";
}
if ($_GET["fs"] == "ext2") {
$prefix_pattern = "-fstype=ext2,check=none,noatime";
}
if ($_GET["fs"] == "ext3") {
$prefix_pattern = "-fstype=ext3,check=none,noatime,nodiratime,data=journal,user";
}
if ($_GET["fs"] == "ext4") {
$prefix_pattern = "-fstype=ext4,check=none,noatime,commit=60,nodiratime,data=journal,user";
}
if ($_GET["fs"] == "vfat") {
$prefix_pattern = "-fstype=vfat,uid=1000,gid=1010";
}
if ($_GET["fs"] == "ntfs") {
$prefix_pattern = "-fstype=ntfs-3g,uid=1000,gid=1010";
}
if ($prefix_pattern == null) {
$prefix_pattern = "-fstype=auto,check=none,noatime";
}
$pattern = "{$prefix_pattern} :{$_GET["dev"]}";
if (!$ldap->ExistsDN($dn)) {
$upd["ObjectClass"][] = 'top';
$upd["ObjectClass"][] = 'automount';
$upd["cn"][] = "{$_GET["LOCAL_DIR"]}";
$upd["automountInformation"][] = $pattern;
if (!$ldap->ldap_add($dn, $upd)) {
echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error;
return;
}
$sock->getFrameWork("cmd.php?autofs-reload=yes");
return;
}
$upd["automountInformation"][] = $pattern;
if (!$ldap->Ldap_modify($dn, $upd)) {
echo "function: " . __FUNCTION__ . "\n" . "file: " . __FILE__ . "\nline: " . __LINE__ . "\n" . $ldap->ldap_last_error;
return false;
}
$sock->getFrameWork("cmd.php?autofs-reload=yes");
}
示例8: TESTS
function TESTS(){
$ldap=new clladp();
$upd['cn'][0]='Sender_Dependent_Relay_host_Maps';
$dn="cn=Sender_Dependent_Relay_host_Maps,cn=artica,$ldap->suffix";
$upd['objectClass'][0]='senderDependentRelayhostMaps';
$upd['objectClass'][1]='top';
$ldap->ldap_add($dn,$upd);
}
示例9: SaveSettings
function SaveSettings()
{
$ldap = new clladp();
$ArticaInadynPoolRule = $_GET["ArticaInadynPoolRule"];
$dn = "cn=inadyn,cn=artica,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd["objectClass"][] = 'top';
$upd["objectClass"][] = 'ArticaInadyn';
$upd["cn"] = "inadyn";
$upd["ArticaInadynPoolRule"][] = "{$ArticaInadynPoolRule}";
if (!$ldap->ldap_add($dn, $upd)) {
echo $ldap->ldap_last_error;
exit;
}
unset($upd);
}
$upd["ArticaInadynPoolRule"][0] = $ArticaInadynPoolRule;
if (!$ldap->Ldap_modify($dn, $upd)) {
echo $ldap->ldap_last_error;
exit;
}
$tpl = new templates();
echo $tpl->_ENGINE_parse_body('{success}');
}
示例10: BuildRobots
function BuildRobots()
{
$ldap = new clladp();
$dn = "cn=PostfixRobots,cn=artica,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "PostfixRobots";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo $ldap->ldap_last_error;
}
unset($upd);
}
$dn = "cn=artica,cn=PostfixRobots,cn=artica,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "artica";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo $ldap->ldap_last_error;
}
unset($upd);
}
$dn = "cn=xspam@localhost.localdomain,cn=artica,cn=PostfixRobots,cn=artica,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "xspam@localhost.localdomain";
$upd['objectClass'][0] = 'transportTable';
$upd['objectClass'][1] = 'top';
$upd["transport"][0] = "artica-spam:xspam@localhost.localdomain";
if (!$ldap->ldap_add($dn, $upd)) {
echo $ldap->ldap_last_error;
}
unset($upd);
}
$dn = "cn=relay_domains,cn=artica,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "relay_domains";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo $ldap->ldap_last_error;
}
unset($upd);
}
$dn = "cn=relay_recipient_maps,cn=artica,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "relay_recipient_maps";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo $ldap->ldap_last_error;
}
unset($upd);
}
$dn = "cn=localhost.localdomain,cn=relay_domains,cn=artica,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "localhost.localdomain";
$upd['objectClass'][0] = 'PostFixRelayDomains';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo $ldap->ldap_last_error;
}
unset($upd);
}
$dn = "cn=@localhost.localdomain,cn=relay_recipient_maps,cn=artica,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "@localhost.localdomain";
$upd['objectClass'][0] = 'PostfixRelayRecipientMaps';
$upd['objectClass'][1] = 'top';
if (!$ldap->ldap_add($dn, $upd)) {
echo $ldap->ldap_last_error;
}
unset($upd);
}
$dn = "cn=transport_map,cn=artica,{$ldap->suffix}";
if (!$ldap->ExistsDN($dn)) {
$upd['cn'][0] = "transport_map";
$upd['objectClass'][0] = 'PostFixStructuralClass';
$upd['objectClass'][1] = 'top';
$ldap->ldap_add($dn, $upd);
unset($upd);
}
$dn = "cn=localhost.localdomain,cn=transport_map,cn=artica,{$ldap->suffix}";
$upd['cn'][0] = "localhost.localdomain";
$upd['objectClass'][0] = 'transportTable';
$upd['objectClass'][1] = 'top';
$upd["transport"][] = "artica-spam:xspam@localhost.localdomain";
$ldap->ldap_add($dn, $upd);
unset($upd);
}
示例11: Tree_ou_Add_user
function Tree_ou_Add_user()
{
$user = $_GET["Tree_ou_Add_user"];
$user = replace_accents($user);
$ldap = new clladp();
$ou = $_GET["ou"];
$uid = str_replace(' ', '.', $user);
if (stripos($user, '@') > 0) {
$mail = $user;
$tbl = explode('@', $user);
$domainName = $tbl[1];
$user = $tbl[0];
$uid = str_replace(' ', '.', $user);
if (preg_match('#([a-z0-9]+)([\\.\\-_])([a-z0-9_\\-\\.]+)#', $user, $reg)) {
$firstname = $reg[1];
$lastname = $reg[3];
} elseif (preg_match('#(.+)\\s+(.+)#', $user, $reg)) {
$firstname = $reg[1];
$lastname = $reg[2];
} elseif (preg_match('#(.+)#', $user, $reg)) {
$lastname = $reg[1];
$firstname = $lastname;
}
} else {
if (preg_match('#([a-z0-9_\\-]+)\\s+([a-z0-9_\\-]+)#', $user, $reg)) {
$lastname = $reg[2];
$firstname = $reg[1];
$domainName = 'none';
} else {
$lastname = $user;
$firstname = $user;
$domainName = 'none';
}
}
$dn = "cn={$user},ou=users,ou={$ou},dc=organizations,{$ldap->suffix}";
$update_array["cn"][] = $user;
$update_array["uid"][] = $uid;
$update_array["sn"][] = $lastname;
$update_array["domainName"][] = $domainName;
$update_array["homeDirectory"][] = "/home/{$firstname}.{$lastname}";
$update_array["accountGroup"][] = "0";
$update_array["accountActive"][] = 'TRUE';
$update_array["mailDir"] = 'cyrus';
$update_array["objectClass"][] = "userAccount";
$update_array["objectClass"][] = "top";
$ldap->ldap_add($dn, $update_array);
if ($ldap->ldap_last_error != null) {
echo nl2br($ldap->ldap_last_error);
exit;
}
$update_array = null;
$update_array["givenName"][] = $firstname;
$update_array["mail"][] = $mail;
$update_array["DisplayName"][] = "{$firstname} " . $lastname;
$update_array["MailBoxActive"][] = "FALSE";
$update_array["objectclass"][] = "ArticaSettings";
$ldap->Ldap_add_mod($dn, $update_array);
$pages = new HtmlPages();
echo $pages->PageOu("ou={$ou},dc=organizations,{$ldap->suffix}");
}
示例12: 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");
}
示例13: 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();
}
示例14: 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}');
}
示例15: mailman_add_new_distribution_list
function mailman_add_new_distribution_list()
{
$id = $_GET["id"];
$ldap = new clladp();
$cn = "cn={$id},cn=mailman,cn=artica,{$ldap->suffix}";
$upd["objectclass"][] = 'top';
$upd["objectclass"][] = 'ArticaMailManClass';
$upd["cn"][] = $id;
$upd["MailmanListOperation"][] = "ADD";
$upd["MailManListAdministrator"][] = $_GET["MailManListAdministrator"];
$upd["MailManListAdminPassword"][] = $_GET["MailManListAdminPassword"];
if ($_GET["ou"] != null) {
$upd["MailManOuOwner"][] = $_GET["ou"];
} else {
$upd["MailManOuOwner"][] = "undefined";
}
$ldap->ldap_add($cn, $upd);
}