function browse_domains_list() { $page = CurrentPageName(); $tpl = new templates(); $ldap = new clladp(); $users = new usersMenus(); $search = $_GET["search"]; $search = "*{$search}*"; $search = str_replace("***", "*", $search); $search = str_replace("**", "*", $search); $search_sql = str_replace("*", "%", $search); $search_sql = str_replace("%%", "%", $search_sql); $search_regex = str_replace(".", "\\.", $search); $search_regex = str_replace("*", ".*?", $search); if ($users->AsSystemAdministrator) { $q = new mysql(); $sql = "SELECT domain FROM officials_domains WHERE domain LIKE '{$search_sql}' ORDER BY domain"; writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $domains[$ligne["domain"]] = $ligne["domain"]; } $hash = $ldap->hash_get_all_domains(); while (list($num, $ligne) = each($hash)) { if (preg_match("#{$search_regex}#", $ligne)) { $domains[$ligne] = $ligne; } } } else { $hash = $ldap->hash_get_domains_ou($_SESSION["ou"]); while (list($num, $ligne) = each($hash)) { if (preg_match("#{$search_regex}#", $ligne)) { $domains[$ligne] = $ligne; } } } ksort($domains); $html = "\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%>{$add}</th>\n\t\t<th colspan=2>{domains} | {$search_regex} | {$search_sql}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; while (list($num, $ligne) = each($domains)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $select = imgtootltip("plus-24.png", "{select}", "SelectBrowseDomains('{$ligne}')"); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src='img/domain-32.png'></td>\n\t\t\t<td style='font-size:14px;font-weight:bold'>{$ligne}</td>\n\t\t\t<td width=1%>{$select}</td>\n\t\t</tr>\n\t\t"; } $html = $html . "</table>\n\t<script>\n\t\t\n\t\tfunction SelectBrowseDomains(domain){\n\t\t\tdocument.getElementById('{$_GET["field"]}').value=domain\n\t\t\tYahooSetupControlHide();\n\t\t}\n\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function perform() { $domain = $_POST["domain"]; $ou = $_POST["ou"]; $tpl = new templates(); $ldap = new clladp(); $hashdoms = $ldap->hash_get_all_domains(); writelogs("hashdoms[{$domain}]={$hashdoms[$domain]}", __FUNCTION__, __FILE__); if ($hashdoms[$domain] != null) { echo $tpl->_ENGINE_parse_body('{error_domain_exists} ->`' . $domain . "`"); return; } if (!$ldap->AddDomainEntity($ou, $domain)) { echo $ldap->ldap_last_error; return; } }
function dhcp_form() { $ldap = new clladp(); $domains = $ldap->hash_get_all_domains(); $dhcp = new dhcpd_sub($_GET["nic"]); $page = CurrentPageName(); $users = new usersMenus(); $t = time(); if (count($domains) == 0) { $dom = Field_text("ddns_domainname-{$t}", $dhcp->ddns_domainname, "font-size:22px;"); } else { $domains[null] = "{select}"; $dom = Field_array_Hash($domains, "ddns_domainname-{$t}", $dhcp->ddns_domainname, null, null, null, ";font-size:22px;padding:3px"); } $EnableDHCPUseHostnameOnFixed = Field_checkbox_design("EnableDHCPUseHostnameOnFixed-{$t}", 1, $dhcp->EnableDHCPUseHostnameOnFixed); $authoritative = Field_checkbox_design("authoritative-{$t}", 1, $dhcp->authoritative); $ping_check = Field_checkbox_design("ping_check-{$t}", 1, $dhcp->ping_check); $get_lease_hostnames = Field_checkbox_design("get_lease_hostnames-{$t}", 1, $dhcp->get_lease_hostnames); $nicz = new system_nic($_GET["nic"]); $ipaddrEX = explode(".", $nicz->IPADDR); unset($ipaddrEX[3]); if ($dhcp->subnet == null) { $dhcp->subnet = @implode(".", $ipaddrEX) . ".0"; } if ($dhcp->netmask == null) { $dhcp->netmask = $nicz->NETMASK; } if ($dhcp->gateway == null) { $dhcp->gateway = $nicz->GATEWAY; } if ($dhcp->range1 == null) { $dhcp->range1 = @implode(".", $ipaddrEX) . ".50"; } if ($dhcp->range2 == null) { $dhcp->range2 = @implode(".", $ipaddrEX) . ".254"; } if ($dhcp->broadcast == null) { $dhcp->broadcast = @implode(".", $ipaddrEX) . ".255"; } $html = "<div id='dhscpsettings' class=form>\n\t<div class='BodyContent'>\n\t<table style='width:98%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{enabled}:</td>\n\t\t<td>" . Field_checkbox_design("EnableDHCPServer-{$t}", 1, $dhcp->EnableDHCPServer) . "</td>\n\t\t<td> </td>\n\t\t<td> </td>\n\t</tr>\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{EnableDHCPUseHostnameOnFixed}:</td>\n\t\t<td>{$EnableDHCPUseHostnameOnFixed}</td>\n\t\t<td> </td>\n\t\t<td>" . help_icon('{EnableDHCPUseHostnameOnFixed_explain}') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{authoritative}:</td>\n\t\t<td>{$authoritative}</td>\n\t\t<td> </td>\n\t\t<td>" . help_icon('{authoritativeDHCP_explain}') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{DHCPPing_check}:</td>\n\t\t<td>{$ping_check}</td>\n\t\t<td> </td>\n\t\t<td>" . help_icon('{ping_check_explain}') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{get_lease_hostnames}:</td>\n\t\t<td>{$get_lease_hostnames}</td>\n\t\t<td> </td>\n\t\t<td>" . help_icon('{get_lease_hostnames_text}') . "</td>\n\t</tr>\n<tr>\n\t<td colspan=4>\n\t\t\t\t<div style='margin:10px;border:1px solid #CCCCCC;padding:10px'>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px;font-weight:bold;width:607px'>{ipfrom}:</td>\n\t\t\t\t\t<td>" . field_ipv4("range1-{$t}", $dhcp->range1, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px;font-weight:bold'>{ipto}:</td>\n\t\t\t\t\t<td>" . field_ipv4("range2-{$t}", $dhcp->range2, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t</div>\t\t\t\t\t\n\t\t</td>\n</tr>\t\t\t\t\t\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{ddns_domainname}:</td>\n\t\t<td>{$dom}</td>\n\t\t<td> </td>\n\t\t<td width=1% nowrap>" . imgtootltip("plus-16.png", null, "Loadjs('domains.edit.domains.php?js-all-localdomains=yes')") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{max_lease_time}:</td>\n\t\t<td style='font-size:16px'>" . Field_text("max_lease_time-{$t}", $dhcp->max_lease_time, 'width:90px;font-size:22px;padding:3px') . " {seconds}</td>\n\t\t<td> </td>\n\t\t<td >" . help_icon('{max_lease_time_text}') . "</td>\n\t</tr>\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{wpad_label}:</td>\n\t\t<td>" . Field_text("local_pac_server-{$t}", $dhcp->local_pac_server, 'width:300px;font-size:22px;padding:3px', false) . "</td>\n\t\t<td> </td>\n\t\t<td>" . help_icon('{wpad_label_text}') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{subnet}:</td>\n\t\t<td>" . field_ipv4("subnet-{$t}", $dhcp->subnet, "font-size:22px;padding:3px;font-weight:bold", false) . "</td>\n\t\t<td> </td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{netmask}:</td>\n\t\t<td>" . field_ipv4("netmask-{$t}", $dhcp->netmask, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t<td> </td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{gateway}:</td>\n\t\t<td>" . field_ipv4("gateway-{$t}", $dhcp->gateway, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t<td> </td>\n\t</tr>\n\t\t\t\t\n\t\t\t\t\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{DNSServer} 1:</td>\n\t\t<td>" . field_ipv4("DNS_1-{$t}", $dhcp->DNS_1, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t<td> </td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{DNSServer} 2:</td>\n\t\t<td>" . field_ipv4("DNS_2-{$t}", $dhcp->DNS_2, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t<td> </td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{wins_server}:</td>\n\t\t<td>" . field_ipv4("WINS-{$t}", $dhcp->WINS, 'font-size:22px;padding:3px') . " </td>\n\t\t<td> </td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{ntp_server} <span style='font-size:10px'>({optional})</span>:</td>\n\t\t<td>" . Field_text("ntp_server-{$t}", $dhcp->ntp_server, 'width:228px;font-size:22px;padding:3px') . " </td>\n\t\t<td> </td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{broadcast}:</td>\n\t\t<td>" . field_ipv4("broadcast-{$t}", $dhcp->broadcast, 'font-size:22px;padding:3px') . " </td>\n\t\t<td> </td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=4 align='right'><hr>" . button("{apply}", "SaveDHCPSettings{$t}()", 40) . "</td>\n\t</tr>\n</table>\n</div>\n</div>\n<br>\n<script>\nvar x_SaveDHCPSettings{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\tLoadjs('dhcpd.progress.php');\n\t}\t\t\n\t\t\n\tfunction SaveDHCPSettings{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('nic','{$_GET["nic"]}');\n\t\tXHR.appendData('range1',document.getElementById('range1-{$t}').value);\n\t\tXHR.appendData('range2',document.getElementById('range2-{$t}').value);\n\t\tXHR.appendData('gateway',document.getElementById('gateway-{$t}').value);\n\t\tXHR.appendData('netmask',document.getElementById('netmask').value);\n\t\tXHR.appendData('DNS_1',document.getElementById('DNS_1-{$t}').value);\n\t\tXHR.appendData('DNS_2',document.getElementById('DNS_2-{$t}').value);\n\t\tXHR.appendData('max_lease_time',document.getElementById('max_lease_time-{$t}').value);\n\t\tXHR.appendData('ntp_server',document.getElementById('ntp_server-{$t}').value);\n\t\tXHR.appendData('subnet',document.getElementById('subnet-{$t}').value);\n\t\tXHR.appendData('broadcast',document.getElementById('broadcast-{$t}').value);\n\t\tXHR.appendData('WINS',document.getElementById('WINS-{$t}').value);\n\t\tXHR.appendData('local_pac_server',document.getElementById('local_pac_server-{$t}').value);\n\t\t\n\t\tif(document.getElementById('EnableDHCPServer-{$t}').checked){\n\t\tXHR.appendData('EnableDHCPServer',1);}else{XHR.appendData('EnableDHCPServer',0);}\n\t\t\n\t\tif(document.getElementById('EnableDHCPUseHostnameOnFixed-{$t}').checked){XHR.appendData('EnableDHCPUseHostnameOnFixed',1);}else{XHR.appendData('EnableDHCPUseHostnameOnFixed',0);}\n\t\tif(document.getElementById('ping_check-{$t}').checked){XHR.appendData('ping_check',1);}else{XHR.appendData('ping_check',0);}\n\t\tif(document.getElementById('authoritative-{$t}').checked){XHR.appendData('authoritative',1);}else{XHR.appendData('authoritative',0);}\n\t\tXHR.appendData('ddns_domainname',document.getElementById('ddns_domainname-{$t}').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveDHCPSettings{$t});\t\n\n\t}\n</script>\n"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function query() { $ou = null; $ldap = new clladp(); $users = new usersMenus(); if (!$users->AsArticaAdministrator) { $ou = $_SESSION["ou"]; } if ($ou == null) { $domains = $ldap->hash_get_all_domains(); } else { $domains = $ldap->hash_get_domains_ou($ou); } $data = array(); $data['page'] = 1; $data['total'] = $total; $data['rows'] = array(); $c = 0; while (list($num, $ligne) = each($domains)) { if ($num == null) { continue; } if ($_POST["query"] != null) { $qq = $_POST["query"]; $qq = str_replace(".", "\\.", $qq); $qq = str_replace("*", ".*?", $qq); if (!preg_match("#{$qq}#", $num)) { continue; } } $c++; $href = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$_GET["callback"]}('{$num}');WinORGHide();\" style='text-decoration:underline'>"; $data['rows'][] = array('id' => $num, 'cell' => array("<img src='img/domain-32.png'>", "<strong style='font-size:16px;style='color:black'>{$href}{$num}</a></strong>")); } $data['total'] = $c; echo json_encode($data); }
function QueryDNSForm() { $sock = new sockets(); $main = new main_cf(0); $page = CurrentPageName(); $ldap = new clladp(); $tpl = new templates(); $domains = $ldap->hash_get_all_domains(); $myhostname = $sock->GET_INFO("myhostname"); $warn_disable_dns_lookups = $tpl->javascript_parse_text("{warn_disable_dns_lookups}"); $main = new maincf_multi("master", "master"); $domains["\$mydomain"] = "\$mydomain"; //$myorigin=Field_array_Hash($domains,"myorigin",$main->main_array["myorigin"]); $myorigin = "<strong>\$mydomain</strong><input type='hidden' name='myorigin' value='\$mydomain' id='myorigin'>"; $styleadd = "style='font-size:26px;padding:4px'"; $html = "<div id='QueryDNSFormSaveid'>\n<span style='font-size:32px;'>{DNS_SETTINGS} & {hostname}</span>\n<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t<td align='right' valign='top' nowrap class=legend {$styleadd}>{myhostname} :</strong></td>\n\t<td align='left' width=1% {$styleadd}>" . Field_text('myhostname', $myhostname, 'width:500px;font-size:26px;padding:3px') . "</td>\n\t<td valign='top' width=1% {$styleadd}>" . help_icon('{myhostname_text}') . "</td>\n\t<tr>\n\t<tr>\n\t<td align='right' valign='top' nowrap class=legend {$styleadd}>{myorigin} :</strong></td>\n\t<td align='left' width=1% {$styleadd}> {$myorigin}</td>\n\t<td valign='top' width=1% {$styleadd}>" . help_icon('{myorigin_text}') . "</td>\n\t<tr>\t\n\t<td align='right' valign='top' nowrap class=legend {$styleadd}>{ignore_mx_lookup_error} :</strong></td>\n\t<td align='left' width=1% {$styleadd}>" . Field_checkbox_design('ignore_mx_lookup_error', '1', $main->GET("ignore_mx_lookup_error")) . "</td>\n\t<td valign='top' width=1% {$styleadd}>" . help_icon('{ignore_mx_lookup_error_text}') . "</td>\n\t</tr>\n\t<tr>\n\t\t<tr>\n\t<td align='right' valign='top' nowrap class=legend {$styleadd}>{disable_dns_lookups} :</strong></td>\n\t<td align='left' width=1% {$styleadd}>" . Field_checkbox_design('disable_dns_lookups', '1', $main->GET("disable_dns_lookups")) . "</td>\n\t<td valign='top' width=1% {$styleadd}>" . help_icon('{disable_dns_lookups_text}') . "</td>\n\t</tr>\n\t<tr><td colspan=3 align='right'><hr>" . button("{apply}", "QueryDNSFormSave()", 40) . "</td></tr>\n\t</table>\n\t</div>\n\t\n\t\n\t<script>\n\t\n\tvar x_QueryDNSFormSave= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert('\"'+results+'\"'+results.length);}\n\t\tRefreshTab('main_config_postfix_net');\n\t\t}\n\t\t\n\t\n\t\tfunction QueryDNSFormSave(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('myhostname',document.getElementById('myhostname').value);\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('ignore_mx_lookup_error').checked){XHR.appendData('ignore_mx_lookup_error','1');}else{\n\t\t\t\tXHR.appendData('ignore_mx_lookup_error','0');\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('disable_dns_lookups').checked){\n\t\t\t\tif(!confirm('{$warn_disable_dns_lookups}')){return;}\n\t\t\t\tXHR.appendData('disable_dns_lookups','1');}else{\n\t\t\t\tXHR.appendData('disable_dns_lookups','0');\n\t\t\t}\t\t\t\n\t\t\tAnimateDiv('QueryDNSFormSaveid');\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_QueryDNSFormSave);\t\n\t\t\t\n\t\t}\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function ParseMimeDefangFilter() { $q = new mysql(); $sock = new sockets(); if (!$q->TestingConnection()) { echo "Starting mimedefang: testing connection to MySQL failed, aborting configuration task...\n"; return; } $ldap = new clladp(); $tr = array(); $localdomains = $ldap->hash_get_all_domains(); $disclaimers_rules = disclaimers_rules(); $autocompress_rules = autocompress_rules(); $filehosting_rules = filehosting_rules(); if ($autocompress_rules != null) { $EnableAutocompress = 1; } else { $EnableAutocompress = 0; } if ($filehosting_rules != null) { $EnableFileHosting = 1; } else { $EnableFileHosting = 0; } $Param = unserialize(base64_decode($sock->GET_INFO("MimeDefangServiceOptions"))); if (!is_numeric($Param["DEBUG"])) { $Param["DEBUG"] = 0; } $MySQL_server = $q->mysql_server; $MySQL_user = $q->mysql_admin; $MySQL_password = $q->mysql_password; $MySQL_port = intval($q->mysql_port); $main = new main_cf(); @file_put_contents("/etc/artica-postfix/settings/Daemons/MimeDefangPostFixNetwork", @implode("\n", $main->array_mynetworks)); if ($MySQL_server == null) { $MySQL_server = "127.0.0.1"; } if ($MySQL_server == "localhost") { $MySQL_server = "127.0.0.1"; } if ($MySQL_server == "127.0.0.1") { $MySQL_server = null; } if ($MySQL_server == null) { $DSN = "DBI:mysql:database=artica_backup;mysql_socket=/var/run/mysqld/mysqld.sock"; } else { $DSN = "DBI:mysql:database=artica_backup;host={$MySQL_server};port={$MySQL_port}"; } $sock->SET_INFO("MySQLPerlDSN", $DSN); $sock->SET_INFO("MySQLPerlUsername", $MySQL_user); $sock->SET_INFO("MySQLPerlPassword", $MySQL_password); $TMPDIR = "/var/spool/MIMEDefang"; if (!is_dir($TMPDIR)) { @mkdir($TMPDIR, 0755, true); } if (!is_dir("{$TMPDIR}/BACKUP")) { @mkdir("{$TMPDIR}/BACKUP", 0755, true); } @chown($TMPDIR, "postfix"); @chgrp($TMPDIR, "postfix"); @chown("{$TMPDIR}/BACKUP", "postfix"); @chgrp("{$TMPDIR}/BACKUP", "postfix"); $QuarantineDir = "/var/spool/MD-Quarantine"; if (!is_dir($QuarantineDir)) { @mkdir($QuarantineDir, 0755, true); } @chown($QuarantineDir, "postfix"); @chgrp($QuarantineDir, "postfix"); $TMPDIR_CAPTURED = "/var/spool/MIMEDefang_replaced"; if (!is_dir($TMPDIR_CAPTURED)) { @mkdir($TMPDIR_CAPTURED, 0755, true); } @chown($TMPDIR_CAPTURED, "postfix"); @chgrp($TMPDIR_CAPTURED, "postfix"); @copy("/usr/share/artica-postfix/bin/install/mimedefang/mimedefang-filter.pl", "/etc/mail/mimedefang-filter"); while (list($dim, $line) = each($localdomains)) { $tr[] = "'{$dim}'=>1"; } if (count($tr) > 0) { $hashlocaldomains = @implode(",", $tr); } $MimeDefangFileHostingSubjectPrepend = $sock->GET_INFO("MimeDefangFileHostingSubjectPrepend"); $MimeDefangFileHostingSubjectPrepend = str_replace('"', '\\"', $MimeDefangFileHostingSubjectPrepend); $MimeDefangFileHostingLink = $sock->GET_INFO("MimeDefangFileHostingLink"); $MimeDefangFileHostingText = $sock->GET_INFO("MimeDefangFileHostingText"); $MimeDefangFileHostingExternMySQL = $sock->GET_INFO("MimeDefangFileHostingExternMySQL"); $MimeDefangFileHostingMySQLsrv = $sock->GET_INFO("MimeDefangFileHostingMySQLsrv"); $MimeDefangFileHostingMySQLusr = $sock->GET_INFO("MimeDefangFileHostingMySQLusr"); $MimeDefangFileHostingMySQLPass = $sock->GET_INFO("MimeDefangFileHostingMySQLPass"); $MimeDefangFileMaxDaysStore = $sock->GET_INFO("MimeDefangFileMaxDaysStore"); if (!is_numeric($MimeDefangFileMaxDaysStore)) { $MimeDefangFileMaxDaysStore = 5; } $MimeDefangFileHostingText = stripslashes($MimeDefangFileHostingText); if ($MimeDefangFileHostingText == null) { $MimeDefangFileHostingText = "The %s file exceed the company's messaging rules.\nIt has been moved to our Web server.\nYou can download it by clicking on the link bellow."; } $MimeDefangFileHostingText = str_replace('"', '\\"', $MimeDefangFileHostingText); $MimeDefangFileHostingText = str_replace("\n", "\\n", $MimeDefangFileHostingText); $tb = explode("\n", @file_get_contents("/etc/mail/mimedefang-filter")); while (list($index, $line) = each($tb)) { if (preg_match('#my\\s+\\$dsn#', $line)) { $tb[$index] = "\tmy \$dsn = 'DBI:mysql:artica_backup:{$q->mysql_server}';"; continue; } if (preg_match("#my\\s+\\\$db_user_name#", $line)) { $tb[$index] = "\tmy \$db_user_name = '{$q->mysql_admin}';"; continue; } if (preg_match("#my\\s+\\\$MimeDefangFileHostingSubjectPrepend#", $line)) { $tb[$index] = "\tmy \$MimeDefangFileHostingSubjectPrepend = \"{$MimeDefangFileHostingSubjectPrepend}\";"; continue; } if (preg_match("#my\\s+\\\$MimeDefangFileHostingLink#", $line)) { $tb[$index] = "\tmy \$MimeDefangFileHostingLink = \"{$MimeDefangFileHostingLink}\";"; continue; } if (preg_match("#my\\s+\\\$MimeDefangFileMaxDaysStore#", $line)) { $tb[$index] = "\tmy \$MimeDefangFileMaxDaysStore = \"{$MimeDefangFileMaxDaysStore}\";"; continue; } if (preg_match("#my\\s+\\\$MimeDefangFileHostingText#", $line)) { $tb[$index] = "\tmy \$MimeDefangFileHostingText = \"{$MimeDefangFileHostingText}\";"; continue; } if (preg_match("#my\\s+\\\$DebugMimeFilter#", $line)) { $tb[$index] = "\tmy \$DebugMimeFilter = {$Param["DEBUG"]};"; continue; } if (preg_match("#my\\s+\\\$db_password#", $line)) { $tb[$index] = "\tmy \$db_password = '******';"; continue; } if (preg_match("#my\\s+\\\$EnableCompression#", $line)) { $tb[$index] = "\tmy \$EnableCompression = {$EnableAutocompress};"; continue; } if (preg_match("#my\\s+\\\$EnableFileHosting#", $line)) { $tb[$index] = "\tmy \$EnableFileHosting = {$EnableFileHosting};"; continue; } if (preg_match("#my\\s+%hashLocalDomains#", $line)) { $tb[$index] = "\tmy %hashLocalDomains = ({$hashlocaldomains});"; continue; } if (preg_match("#my\\s+%hashCompressesRules#", $line)) { $tb[$index] = "\tmy %hashCompressesRules = ({$autocompress_rules});"; continue; } if (preg_match("#my\\s+%hashFileHostingRules#", $line)) { $tb[$index] = "\tmy %hashFileHostingRules = ({$filehosting_rules});"; continue; } if (preg_match("#my\\s+%hashDisclaimers#", $line)) { $tb[$index] = "\tmy %hashDisclaimers = ({$disclaimers_rules});"; continue; } } echo "Starting mimedefang: saving /etc/mail/mimedefang-filter done\n"; @file_put_contents("/etc/mail/mimedefang-filter", @implode("\n", $tb)); }
function export_all_domains() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $oldpid = @file_get_contents($pidfile); if ($unix->process_exists($oldpid)) { die; } @file_put_contents($pidfile, getmypid()); $ldap = new clladp(); $array_final = array(); $array = $ldap->hash_get_all_domains(); if (!is_array($array)) { return; } while (list($index, $none) = each($array)) { $ou = $ldap->ou_by_smtp_domain($index); $array_final[trim(strtolower($index))]["ou"] = $ou; $array_final[trim(strtolower($index))]["TYPE"] = "LOCAL"; $ous[] = $ou; } if (!is_array($ous)) { return null; } while (list($index, $ou) = each($ous)) { $hash = $ldap->Hash_relay_domains($ou); if (is_array($hash)) { while (list($domain, $transport) = each($hash)) { $array_final[trim(strtolower($domain))]["TYPE"] = $transport; } } } if (!is_array($array_final)) { return null; } echo "exporting " . count($array_final) . " domains in \"/etc/artica-postfix/metadomains.cache\"\n"; $datas = base64_encode(serialize($array_final)); @file_put_contents("/etc/artica-postfix/metadomains.cache", $datas); $http = new httpget(); $sock = new sockets(); $meta = new artica_meta(); $http->uploads["ALL_DOMAINS"] = "/etc/artica-postfix/metadomains.cache"; $body = $http->send("{$meta->ArticaMetaHostname}/lic.users.import.php", "post", array("DATAS" => base64_encode(serialize($meta->GLOBAL_ARRAY)))); events(count($array_final) . " domains exported to global Management console", __FUNCTION__, __FILE__, __LINE__); send_email_events(count($array_final) . " domains exported to global Management console", $body, "CLOUD"); echo $body; }
function SaveWhiteList() { $tpl = new templates(); $to = $_GET["recipient"]; $wbl = $_GET["wbl"]; $RcptDomain = $_GET["RcptDomain"]; $from = $_GET["whitelist"]; if ($to == null) { $to = "*@{$RcptDomain}"; } if ($from == null) { echo $tpl->_ENGINE_parse_body('{from}: {error_miss_datas}'); return false; } if (substr($to, 0, 1) == '@') { $domain = substr($to, 1, strlen($to)); } else { if (strpos($to, '@') > 0) { $tbl = explode('@', $to); $domain = $tbl[1]; } else { $domain = $to; $to = "@{$to}"; } } $tbl[0] = str_replace("*", "", $tbl[0]); $ldap = new clladp(); $domains = $ldap->hash_get_all_domains(); if ($domains[$domain] == null) { echo $tpl->javascript_parse_text('{recipient}: {error_unknown_domain} ' . $domain); return false; } if ($tbl[0] == null) { $ldap->WhiteListsAddDomain($domain, $from, $wbl); return true; } else { $uid = $ldap->uid_from_email($to); if ($uid == null) { echo $tpl->javascript_parse_text('{recipient}: {error_no_user_exists} ' . $to); return false; } $ldap->WhiteListsAddUser($uid, $from, $wbl); } }
function popup_adddns() { $ldap = new clladp(); $domains = $ldap->hash_get_all_domains(); $DnsZoneName = Field_array_Hash($domains, "DnsZoneName", $computer->DnsZoneName, null, null, 0, null, $disabled); $dnstypeTable = array("" => "{select}", "MX" => "{mail_exchanger}", "A" => "{dnstypea}"); $DnsType = Field_array_Hash($dnstypeTable, "DnsType", $computer->DnsType, null, null, 0, null, $disabled); $html = "\t\t\n<H1>{ADD_DNS_ENTRY}</H1>\t\n<p class=caption>{ADD_DNS_ENTRY_TEXT}</p>\n<div id='SaveDNSEntry'>\n" . RoundedLightWhite("\n<table style='width:100%'>\n<tr>\n\t<td class=legend>{computer_name}:</strong></td>\n\t<td align=left>" . Field_text("computername", null, "width:120px") . "</strong></td>\n</tr>\n<tr>\n\t<td class=legend>{DnsZoneName}:</strong></td>\n\t<td align=left>{$DnsZoneName}</strong></td>\n</tr>\n<tr>\t\n\t<td class=legend>{computer_ip}:</strong></td>\n\t<td align=left>" . Field_text('ComputerIP', $computer->ComputerIP, 'width:120px') . "</strong></td>\n<tr>\n<tr>\t\n\t<td colspan=2 align='right'><hr><input type='button' OnClick=\"javascript:SaveDNSEntry();\" value='{add} »'></td>\n<tr>\n</table>") . "</div>"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html, "domains.edit.user.php"); }
function LicenseDomain_Add() { $kav4mailservers = new kav4mailservers(); if ($kav4mailservers->error == true) { return "{error_no_socks}"; } if (!is_array($kav4mailservers->LicenseDomains)) { $kav4mailservers->LicenseDomains[] = null; } while (list($num, $ligne) = each($kav4mailservers->LicenseDomains)) { $licenceDomains[$ligne] = $ligne; } $ldap = new clladp(); $hash_domains = $ldap->hash_get_all_domains(); if (!is_array($hash_domains)) { $body = "{ERROR_NO_DOMAINS_CREATED_FIRST}"; } else { while (list($num, $ligne) = each($hash_domains)) { if ($licenceDomains[$ligne] == null) { if ($ligne != null) { $hash[$ligne] = $ligne; } } } $hash[""] = "{input_select_list}"; $body = Field_array_Hash($hash, 'LicenseDomain', null); } $html = "<fieldset style='width:80%'><legend>{kav_add_protection_domain}</legend>\n\t<table>\n\t<tr class=rowA>\n\t\t<td align='right'>{kav_legend_protection_domain}:</td>\n\t\t<td>{$body}</td>\n\t</tr>\n\t<tr class=rowB>\n\t\t<td align='right' colspan=2><input type='button' OnClick=\"javascript:LicenseDomain_edit();\" value='{submit} »'></td>\n\t</tr>\t\n\t</table>\n\t</fieldset>"; $tpl = new templates(); echo DIV_SHADOW($tpl->_parse_body($html), 'windows'); }
function dhcp_form(){ $ldap=new clladp(); $domains=$ldap->hash_get_all_domains(); $dhcp=new dhcpd(); $page=CurrentPageName(); $users=new usersMenus(); $sock=new sockets(); $EnableDHCPServer=$sock->GET_INFO('EnableDHCPServer'); $EnableDHCPUseHostnameOnFixed=$sock->GET_INFO('EnableDHCPUseHostnameOnFixed'); if(count($domains)==0){$dom=Field_text('ddns_domainname',$dhcp->ddns_domainname,"font-size:13px;");} else{ $domains[null]="{select}"; $dom=Field_array_Hash($domains,'ddns_domainname',$dhcp->ddns_domainname,null,null,null,";font-size:13px;padding:3px");} $nic=$dhcp->array_tcp; if($dhcp->listen_nic==null){$dhcp->listen_nic="eth0"; } while (list ($num, $val) = each ($nic) ){ if($num==null){continue;} if($num=="lo"){continue;} $nics[$num]=$num; } if($dhcp->listen_nic<>null){ $nics[$dhcp->listen_nic]=$dhcp->listen_nic; } $nics[null]='{select}'; if(($users->BIND9_INSTALLED) OR ($users->POWER_DNS_INSTALLED) ){ $EnableArticaAsDNSFirst=Field_checkbox("EnableArticaAsDNSFirst",1,$dhcp->EnableArticaAsDNSFirst); }else{ $EnableArticaAsDNSFirst=Field_numeric_checkbox_img_disabled('EnableArticaAsDNSFirst',0,'{enable_disable}'); } $EnableDHCPUseHostnameOnFixed=Field_checkbox("EnableDHCPUseHostnameOnFixed",1,$EnableDHCPUseHostnameOnFixed); $html=" <div id='dhscpsettings' class=form> <input type='hidden' id='EnableDHCPServer' value='$EnableDHCPServer' name='EnableDHCPServer'> <table style='width:98%'> <tr> <td class=legend style='font-size:13px'>{EnableArticaAsDNSFirst}:</td> <td>$EnableArticaAsDNSFirst</td> <td> </td> <td>". help_icon('{EnableArticaAsDNSFirst_explain}')."</td> </tr> <tr> <td class=legend style='font-size:13px'>{EnableDHCPUseHostnameOnFixed}:</td> <td>$EnableDHCPUseHostnameOnFixed</td> <td> </td> <td>". help_icon('{EnableDHCPUseHostnameOnFixed_explain}')."</td> </tr> <tr> <td class=legend style='font-size:13px'>{nic}:</td> <td>".Field_array_Hash($nics,'dhcp_listen_nic',$dhcp->listen_nic,null,null,null,";font-size:13px;padding:3px")."</td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{ddns_domainname}:</td> <td>$dom</td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{max_lease_time}:</td> <td style='font-size:13px'>".Field_text('max_lease_time',$dhcp->max_lease_time,'width:60px;font-size:13px;padding:3px')." seconds</td> <td> </td> <td >".help_icon('{max_lease_time_text}')."</td> </tr> <tr> <td class=legend style='font-size:13px'>{subnet}:</td> <td>".field_ipv4('subnet',$dhcp->subnet,null,true)."</td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{netmask}:</td> <td>".field_ipv4('netmask',$dhcp->netmask,'font-size:13px;padding:3px')." </td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{gateway}:</td> <td>".field_ipv4('gateway',$dhcp->gateway,'font-size:13px;padding:3px')." </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{only_use_this} ({gateway})</td> <td>".Field_checkbox("OnlySetGateway", 1,$dhcp->OnlySetGateway,"OnlySetGatewayCheck()")."</td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{DNSServer} 1:</td> <td>".field_ipv4('DNS_1',$dhcp->DNS_1,'font-size:13px;padding:3px')." </td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{DNSServer} 2:</td> <td>".field_ipv4('DNS_2',$dhcp->DNS_2,'font-size:13px;padding:3px')." </td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{wins_server}:</td> <td>".field_ipv4('WINSDHCPSERV',$dhcp->WINS,'font-size:13px;padding:3px')." </td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{ntp_server} <span style='font-size:10px'>({optional})</span>:</td> <td>".Field_text('ntp_server',$dhcp->ntp_server,'width:228px;font-size:13px;padding:3px')." </td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{range} {from}:</td> <td>".field_ipv4('range1',$dhcp->range1,'font-size:13px;padding:3px')." </td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{range} {to}:</td> <td>".field_ipv4('range2',$dhcp->range2,'font-size:13px;padding:3px')." </td> <td> </td> <td> </td> </tr> <tr> <td class=legend style='font-size:13px'>{broadcast}:</td> <td>".field_ipv4('broadcast_dhcp_main',$dhcp->broadcast,'font-size:13px;padding:3px')." </td> <td> </td> <td> </td> </tr> <tr> <td colspan=4 align='right'><hr> ". button("{edit}","SaveDHCPSettings()")." </td> </tr> </table> </div><br> <script> function OnlySetGatewayCheck(){ if(document.getElementById('OnlySetGateway').checked){ document.getElementById('EnableArticaAsDNSFirst').disabled=true; }else{ document.getElementById('EnableArticaAsDNSFirst').disabled=false; } } OnlySetGatewayCheck(); </script> "; $tpl=new templates(); return $tpl->_ENGINE_parse_body($html); }
function ldap_domains() { $ldap = new clladp(); $sock = new sockets(); $build_hosts_array = unserialize(@file_get_contents("/etc/dnsmasq.hash.domains")); $domains = $ldap->hash_get_all_domains(); while (list($num, $ligne) = each($domains)) { $build_hosts_array[trim(strtolower($num))] = true; } @file_put_contents("/etc/dnsmasq.hash.domains", serialize($build_hosts_array)); if (isset($GLOBALS["BLACKLIST_DOMAINS"])) { return $GLOBALS["BLACKLIST_DOMAINS"]; } $q = new mysql_squid_builder(); $sql = "SELECT * FROM dnsmasq_blacklist"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} {$q->mysql_error}\n"; } $GLOBALS["BLACKLIST_DOMAINS"] = unserialize(@file_get_contents("/etc/dnsmasq.hash.domains-blacklist")); } while ($ligne = mysql_fetch_assoc($results)) { $domain = $ligne["hostname"]; $domain = trim(strtolower($domain)); if ($domain == null) { continue; } $t[$domain] = true; if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} blacklisted domain: {$domain}\n"; } $GLOBALS["BLACKLIST_DOMAINS"][$domain] = true; } $ARTICA_ARRAY = unserialize(base64_decode($sock->GET_INFO("DNSMasqArticaParams"))); if (isset($ARTICA_ARRAY["LOCALNET"])) { if (count($ARTICA_ARRAY["LOCALNET"]) > 0) { while (list($domain, $enabled) = each($ARTICA_ARRAY["LOCALNET"])) { $domain = trim(strtolower($domain)); if ($domain == null) { continue; } if ($enabled == 1) { continue; } $t[$domain] = true; $GLOBALS["BLACKLIST_DOMAINS"][$domain] = true; } } } @file_put_contents("/etc/dnsmasq.hash.domains-blacklist", serialize($t)); }
function build_main() { $conf_upd = new multi_config("kaspersky.updater"); $conf_scan = new multi_config("kaspersky.server"); $MilterTimeout = $conf_scan->GET("MilterTimeout"); if ($MilterTimeout == null) { $MilterTimeout = 600; } $MaxScanRequests = $conf_scan->GET("MaxScanRequests"); if ($MaxScanRequests == null) { $MaxScanRequests = 0; } $MaxScanTime = $conf_scan->GET("MaxScanTime"); if ($MaxScanTime == null) { $MaxScanTime = 10; } $ScanPacked = $conf_scan->GET("ScanPacked"); if ($ScanPacked == null) { $ScanPacked = "yes"; } $ScanArchives = $conf_scan->GET("ScanArchives"); if ($ScanArchives == null) { $ScanArchives = "yes"; } $ScanCodeanalyzer = $conf_scan->GET("ScanCodeanalyzer"); if ($ScanCodeanalyzer == null) { $ScanCodeanalyzer = "yes"; } $UseAVBasesSet = $conf_scan->GET("UseAVBasesSet"); if ($UseAVBasesSet == null) { $UseAVBasesSet = "extended"; } $ldap = new clladp(); $hash = $ldap->hash_get_all_domains(); while (list($num, $val) = each($hash)) { $doms[] = $num; } if (is_array($doms)) { $domains = implode(",", $doms); } $conf[] = "[kav4lms:server.settings]"; $conf[] = "RunAsUser=postfix"; $conf[] = "RunAsGroup=postfix"; $conf[] = "ServiceSocket=local:/var/run/kav4lms/kavmd.sock"; $conf[] = "ServiceSocketPerms=0600"; $conf[] = "AdminSocket=local:/var/run/kav4lms/kavmdctl.sock"; $conf[] = "AdminSocketPerms=0600"; $conf[] = "MaxWatchdogRetries=10"; $conf[] = "MaxClientRequests=20"; $conf[] = "MaxScanRequests={$MaxScanRequests}"; $conf[] = "LicensedUsersDomains={$domains}"; $conf[] = ""; $conf[] = "[kav4lms:server.log]"; $conf[] = ""; $conf[] = "Options=all"; $conf[] = "Destination=syslog:kavmd@mail"; $conf[] = "Append=yes"; $conf[] = "RotateRounds=10"; $conf[] = "RotateSize=1M"; $conf[] = ""; $conf[] = "[kav4lms:server.statistics]"; $conf[] = "Options=all"; $conf[] = "Format=txt"; $conf[] = "Destination=file:/var/opt/kaspersky/kav4lms/stats/statistics.xml"; $conf[] = "RawDestination=file:/var/opt/kaspersky/kav4lms/stats/statistics.raw"; $conf[] = ""; $conf[] = "[kav4lms:server.notifications]"; $conf[] = "ProductAdmins=postmaster"; $conf[] = "ProductNotify=all"; $conf[] = "Subject=Anti-virus notification message"; $conf[] = "Charset=us-ascii"; $conf[] = "TransferEncoding=7bit"; $conf[] = "NotifierRelay=smtp:127.0.0.1:25"; $conf[] = "NotifierQueue=/var/opt/kaspersky/kav4lms/nqueue/"; $conf[] = "NotifierTimeout=5"; $conf[] = "NotifierPersistence=no"; $conf[] = "Templates=/etc/opt/kaspersky/kav4lms/templates-admin/en"; $conf[] = ""; $conf[] = "[kav4lms:server.snmp]"; $conf[] = "SNMPServices=none"; $conf[] = "SNMPTraps=none"; $conf[] = "AlertThreshold=10"; $conf[] = "Socket=inet:705@127.0.0.1"; $conf[] = "PingInterval=30"; $conf[] = "Timeout=5"; $conf[] = "Retries=10"; $conf[] = ""; $conf[] = "[kav4lms:filter]"; $conf[] = ""; $conf[] = "[kav4lms:filter.settings]"; $conf[] = "RunAsUser=postfix"; $conf[] = "RunAsGroup=postfix"; $conf[] = "FilterSocket=inet:1052@127.0.0.1"; $conf[] = "FilterSocketPerms=0600"; $conf[] = "ServiceSocket=local:/var/run/kav4lms/kavmd.sock"; $conf[] = "ForwardSocket=inet:10026@127.0.0.1"; $conf[] = "FilterTimeout=600"; $conf[] = "FilterThreads=10"; $conf[] = "MaxMilterThreads=0"; $conf[] = "AdminSocket=local:/var/run/kav4lms/filterctl.sock"; $conf[] = "AdminSocketPerms=0600"; $conf[] = ""; $conf[] = "[kav4lms:filter.log]"; $conf[] = "Options=all"; $conf[] = "Destination=syslog:kav4lms-filters@mail"; $conf[] = "Append=yes"; $conf[] = "RotateRounds=10"; $conf[] = "RotateSize=1M"; $conf[] = ""; $conf[] = "[kav4lms:groups]"; $conf[] = "_includes = kav4lms/groups.d/"; $conf[] = "[path]"; $conf[] = "BasesPath=/var/opt/kaspersky/kav4lms/bases/"; $conf[] = "LicensePath=/var/opt/kaspersky/kav4lms/licenses/"; $conf[] = "TempPath=/var/tmp/"; $conf[] = "PidPath=/var/run/kav4lms/"; $conf[] = "iCheckerDBFile=/var/opt/kaspersky/kav4lms/iChecker.db"; $conf[] = ""; $conf[] = "[locale]"; $conf[] = "DateFormat=%Y-%m-%d"; $conf[] = "TimeFormat=%H:%M:%S"; $conf[] = "Strings=locale.d/strings.en"; $conf[] = ""; $conf[] = "[options]"; $conf[] = "User=postfix"; $conf[] = "Group=postfix"; $conf[] = ""; $conf[] = "[updater]"; $conf[] = "[updater.path]"; $conf[] = "BackUpPath=/var/opt/kaspersky/kav4lms/bases.backup/"; $conf[] = ""; $conf[] = "[updater.options]"; $conf[] = "UpdateComponentsList=AVS, AVS_OLD, CORE, Updater, BLST"; $conf[] = "RetranslateComponentsList="; $conf[] = "KeepSilent=no"; $UseUpdateServerUrl = $conf_upd->GET("UseUpdateServerUrl"); $UseUpdateServerUrlOnly = $conf_upd->GET("UseUpdateServerUrlOnly"); $UpdateServerUrl = $conf_upd->GET("UpdateServerUrl"); $RegionSettings = $conf_upd->GET("RegionSettings"); $UseProxy = $conf_upd->GET("UseProxy"); if ($UseProxy == null) { $UseProxy = "no"; } if ($UseUpdateServerUrlOnly == null) { $UseUpdateServerUrlOnly = "no"; } if ($RegionSettings == null) { $RegionSettings = "eu"; } if ($UseUpdateServerUrl == null) { $UseUpdateServerUrl = "no"; } $conf[] = "UseUpdateServerUrl={$UseUpdateServerUrl}"; $conf[] = "UseUpdateServerUrlOnly={$UseUpdateServerUrlOnly}"; $conf[] = "UpdateServerUrl={$UpdateServerUrl}"; $conf[] = "RegionSettings={$RegionSettings}"; $conf[] = "ConnectTimeout=30"; $conf[] = "ProxyAddress={$conf_upd->GET("ProxyAddress")}"; $conf[] = "PassiveFtp=yes"; $conf[] = "UseProxy={$UseProxy}"; $conf[] = "Index=u0607g.xml"; $conf[] = "IndexRelativeServerPath=index/6"; $conf[] = ""; $conf[] = "[updater.report]"; $conf[] = "Append=no"; $conf[] = "ReportFileName=/var/log/kaspersky/kav4lms/keepup2date.log"; $conf[] = "ReportLevel=3"; $conf[] = ""; $conf[] = "[updater.actions]"; $conf[] = "OnAny=/opt/kaspersky/kav4lms/bin/kav4lms-cmd -m update -e %EVENT_NAME% -w '%AVS_UPDATE_DATE%' >/dev/null"; $conf[] = "OnStarted="; $conf[] = "OnUpdated=/opt/kaspersky/kav4lms/bin/kav4lms-cmd -x bases"; $conf[] = "OnRetranslated="; $conf[] = "OnNotUpdated="; $conf[] = "OnFailed="; $conf[] = "OnRolledback=/opt/kaspersky/kav4lms/bin/kav4lms-cmd -x bases"; $conf[] = "OnBasesCheck=/opt/kaspersky/kav4lms/lib/bin/avbasestest %TEMP_BASES_PATH% %BASES_PATH%"; $conf[] = "[scanner.display]"; $conf[] = "ShowContainerResultOnly=false"; $conf[] = "ShowProgress=true"; $conf[] = "ShowOk=true"; $conf[] = "ShowObjectResultOnly=false"; $conf[] = ""; $conf[] = "[scanner.options]"; $conf[] = "SelfExtArchives=yes"; $conf[] = "ExcludeDirs=/dev:/udev:/proc:/sys"; $conf[] = "MailBases=yes"; $conf[] = "Archives={$ScanArchives}"; $conf[] = "Packed={$ScanPacked}"; $conf[] = "#ExcludeMask="; $conf[] = "UseAVbasesSet={$UseAVBasesSet}"; $conf[] = "#MaxLoadAvg="; $conf[] = "LocalFS=false"; $conf[] = "Cure=yes"; $conf[] = "MailPlain=yes"; $conf[] = "Heuristic=yes"; $conf[] = "Recursion=true"; $conf[] = "Ichecker=yes"; $conf[] = "FollowSymlinks=true"; $conf[] = ""; $conf[] = ""; $conf[] = "[scanner.report]"; $conf[] = "Append=true"; $conf[] = "ShowContainerResultOnly=false"; $conf[] = "ShowOk=true"; $conf[] = "ReportLevel=4"; $conf[] = "ShowObjectResultOnly=false"; $conf[] = "ReportFileName=/var/log/kaspersky/kav4lms/kavscanner.log"; $conf[] = ""; $conf[] = ""; $conf[] = "[scanner.container]"; $conf[] = "#OnProtected="; $conf[] = "#OnWarning="; $conf[] = "#OnSuspicion="; $conf[] = "#OnCorrupted="; $conf[] = "#OnInfected="; $conf[] = "#OnError="; $conf[] = "#OnCured="; $conf[] = ""; $conf[] = ""; $conf[] = "[scanner.path]"; $conf[] = "#BackupPath="; $conf[] = ""; $conf[] = "[scanner.object]"; $conf[] = "#OnProtected="; $conf[] = "#OnWarning="; $conf[] = "#OnSuspicion="; $conf[] = "#OnCorrupted="; $conf[] = "#OnInfected="; $conf[] = "#OnError="; $conf[] = "#OnCured="; $conf[] = ""; @file_put_contents("/etc/opt/kaspersky/kav4lms.conf", implode("\n", $conf)); }
function smtpd_recipient_restrictions_reject_forged_mails() { $ldap = new clladp(); $unix = new unix(); $postmap = $unix->find_program("postmap"); $hash = $ldap->hash_get_all_domains(); if (!is_array($hash)) { return false; } while (list($domain, $ligne) = each($hash)) { $f[] = "{$domain}\t 554 {$domain} FORGED MAIL"; } if (!is_array($f)) { return false; } @file_put_contents("/etc/postfix/disallow_my_domain", @implode("\n", $f)); echo "Starting......: compiling domains against forged messages\n"; shell_exec("{$postmap} hash:/etc/postfix/disallow_my_domain"); return true; }
function build() { $sock = new sockets(); $EnableDKFilter = $sock->GET_INFO("EnableDkimMilter"); $DisconnectDKFilter = $sock->GET_INFO("DisconnectDKFilter"); if (!is_numeric($DisconnectDKFilter)) { $DisconnectDKFilter = 0; } if ($DisconnectDKFilter == 1) { return; } $conf = unserialize(base64_decode($sock->GET_INFO("DkimMilterConfig"))); if ($EnableDKFilter == null) { $EnableDKFilter = 0; } if ($conf["On-BadSignature"] == null) { $conf["On-BadSignature"] = "accept"; } if ($conf["On-NoSignature"] == null) { $conf["On-NoSignature"] = "accept"; } if ($conf["On-DNSError"] == null) { $conf["On-DNSError"] = "tempfail"; } if ($conf["On-InternalError"] == null) { $conf["On-InternalError"] = "accept"; } if ($conf["On-Security"] == null) { $conf["On-Security"] = "tempfail"; } if ($conf["On-Default"] == null) { $conf["On-Default"] = "accept"; } if ($conf["ADSPDiscard"] == null) { $conf["ADSPDiscard"] = "1"; } if ($conf["ADSPNoSuchDomain"] == null) { $conf["ADSPNoSuchDomain"] = "1"; } if (trim($conf["SignOutgoing"]) == null) { $conf["SignOutgoing"] = "1"; } if (!is_numeric($conf["X-Header"])) { $conf["X-Header"] = 1; } while (list($key, $value) = each($conf)) { if ($value == "1") { $conf[$key] = "yes"; } if ($value == "0") { $conf[$key] = "no"; } } if ($conf["SignOutgoing"] == "yes") { $mode = "s"; echo "Starting......: " . date("H:i:s") . " milter-dkim sign outgoing mails\n"; } if ($conf["VerifyIncoming"] == "yes") { $mode = $mode . "v"; echo "Starting......: " . date("H:i:s") . " milter-dkim verify incoming mails\n"; } $ldap = new clladp(); $domains = $ldap->hash_get_all_domains(); while (list($key, $value) = each($domains)) { $dd[] = $key; } echo "Starting......: " . date("H:i:s") . " milter-dkim " . count($dd) . " local domains\n"; $Domain = @implode(",", $dd); $f[] = "ADSPDiscard\t\t\t{$conf["ADSPDiscard"]}"; $f[] = "ADSPNoSuchDomain\t\t{$conf["ADSPNoSuchDomain"]}"; $f[] = "AllowSHA1Only\t\t\tno"; $f[] = "AlwaysAddARHeader\t\tno"; $f[] = "AutoRestart\t\t\tyes"; $f[] = "AutoRestartCount\t\t2"; $f[] = "AutoRestartRate\t\t10/1h"; $f[] = "Background\t\t\tYes"; $f[] = "BaseDirectory\t\t\t/var/run/dkim-filter"; $f[] = "BodyLengths\t\t\tNo"; $f[] = "Canonicalization\t\tsimple/simple"; $f[] = "ClockDrift\t\t\t300 "; $f[] = "Diagnostics\t\t\tyes"; $f[] = "DNSTimeout\t\t\t10"; $f[] = "Domain\t\t\t\t{$Domain}"; $f[] = "EnableCoredumps\t\tno"; $f[] = "ExternalIgnoreList\t/etc/mail/dkim/trusted-hosts"; $f[] = "FixCRLF \t\t\t\tno"; $f[] = "InternalHosts\t\t\t/etc/mail/dkim/internal-hosts"; $f[] = "KeepTemporaryFiles\tno"; $f[] = "KeyList \t\t\t\t/etc/mail/dkim/keylist"; $f[] = "LogWhy\t\t\t\tyes"; $f[] = "MilterDebug\t\t\t0"; $f[] = "Mode\t\t\t\t\t{$mode}"; $f[] = "On-Default \t{$conf["On-Default"]}"; $f[] = "On-BadSignature \t{$conf["On-BadSignature"]}"; $f[] = "On-DNSError \t{$conf["On-DNSError"]}"; $f[] = "On-InternalError \t{$conf["On-InternalError"]}"; $f[] = "On-NoSignature \t{$conf["On-NoSignature"]}"; $f[] = "On-Security \t{$conf["On-Security"]}"; $f[] = "PeerList\t\t\t\t/etc/mail/dkim/trusted-hosts"; $f[] = "PidFile\t\t\t\t/var/run/dkim-milter/dkim-milter.pid"; $f[] = "Quarantine\t\t\tNo"; $f[] = "#QueryCache\t\t\tyes"; $f[] = "RemoveARAll\t\t\tNo"; $f[] = "RemoveOldSignatures\tNo"; $f[] = "ReportAddress\t\t\tpostmaster@example.com"; $f[] = "RequiredHeaders\t\tNo"; $f[] = "Selector\t\t\t\tdefault"; $f[] = "SendADSPReports\t\tNo"; $f[] = "SendReports\t\t\tNo"; $f[] = "SignatureAlgorithm\trsa-sha256"; $f[] = "SignatureTTL\t\t\t0"; $f[] = "Socket\t\t\t\tlocal:/var/run/dkim-milter/dkim-milter.sock"; $f[] = "StrictTestMode\t\tno"; $f[] = "Syslog\t\t\t\tyes"; $f[] = "SyslogFacility\t\tmail"; $f[] = "SyslogSuccess\t\t\tyes"; $f[] = "TemporaryDirectory\t/var/tmp"; $f[] = "UMask\t\t\t\t\t022"; $f[] = "UserID\t\t\t\tpostfix"; $f[] = "X-Header\t\t\t\t{$conf["X-Header"]}"; $f[] = ""; /* * KeyList (string) Gives the location of a file listing rules for signing with mul‐tiple keys. If present, overrides any KeyFile setting in the conifguration file. The file named here should contain a set of lines of the form sender‐pattern:signing‐domain:keypath where sender‐pattern is a pattern to match against message senders (with the special character "*" interpreted as "zero or more characters"), signing‐domain is the domain to announce as the signing domain when generating signatures, and keypath is the path to the PEM‐formatted private key to be used for signing messages which match the sender‐pattern. The selector used in the signature will be the filename portion of keypath. If the file referenced by keypath cannot be opened, the filter will try again by appending ".pem" and then ".private" before giving up */ //http://www.howtoforge.com/set-up-dkim-for-multiple-domains-on-postfix-with-dkim-milter-2.8.x-centos-5.3 @mkdir("/etc/dkim-milter", null, true); @file_put_contents("/etc/dkim-milter/dkim-milter.conf", @implode("\n", $f)); keyTable(); WhitelistDomains(); WhitelistHosts(); MyNetworks(); echo "Starting......: " . date("H:i:s") . " milter-dkim Apply permissions...\n"; shell_exec("/bin/chmod 755 /etc/mail/dkim >/dev/null 2>&1"); shell_exec("/bin/chmod 0770 /etc/mail/dkim/keys >/dev/null 2>&1"); shell_exec("/bin/chmod 0770 /etc/mail/dkim/keys/* >/dev/null 2>&1"); shell_exec("/bin/chmod 0770 /etc/mail/dkim/keys/*/* >/dev/null 2>&1"); shell_exec("/bin/chown -R postfix:postfix /etc/mail/dkim >/dev/null 2>&1"); echo "Starting......: " . date("H:i:s") . " milter-dkim Apply permissions done...\n"; if ($GLOBALS["RELOAD"]) { $unix = new unix(); $pid = $unix->get_pid_from_file("/var/run/dkim-milter/dkim-milter.pid"); echo "Starting......: " . date("H:i:s") . " milter-dkim reloading current PID={$pid}\n"; if ($unix->process_exists($pid)) { $kill = $unix->find_program("kill"); echo "Starting......: " . date("H:i:s") . " milter-dkim reloading PID {$pid}\n"; unix_system_HUP($pid); } } }
if ($GLOBALS["VERBOSE"]) { echo "O:{$argv[0]} 1:{$argv[1]} 2:{$argv[2]}\n"; } $file = base64_decode($argv[1]); $GLOBALS["OU"] = base64_decode($argv[2]); $ou = $GLOBALS["OU"]; 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';
function AddNewRelayDomain() { $ou = $_GET["ou"]; $tpl = new templates(); $relayIP = $_GET["AddNewRelayDomainIP"]; if ($relayIP == "127.0.0.1") { echo $tpl->javascript_parse_text("{NO_RELAY_TO_THIS_SERVER_EXPLAIN}"); return; } $tc = new networking(); $IPSAR = $tc->ALL_IPS_GET_ARRAY(); if (!preg_match("#[0-9]\\.[0-9]+\\.[0-9]+\\.[0-9]+#", $relayIP)) { $ip = gethostbyname($relayIP); while (list($ip1, $ip2) = each($IPSAR)) { if ($relayIP == $ip1) { echo $tpl->javascript_parse_text("{NO_RELAY_TO_THIS_SERVER_EXPLAIN}"); return; } } } else { while (list($ip1, $ip2) = each($IPSAR)) { if ($relayIP == $ip1) { echo $tpl->javascript_parse_text("{NO_RELAY_TO_THIS_SERVER_EXPLAIN}"); return; } } } $relayPort = $_GET["AddNewRelayDomainPort"]; $mx = $_GET["MX"]; $domain_name = trim(strtolower($_GET["AddNewRelayDomainName"])); $ldap = new clladp(); if (!$ldap->UseLdap) { $sqlite = new lib_sqlite(); $sqlite->AddRelayDomain($ou, $domain_name, $relayIP, $relayPort, $mx); return; } $tpl = new templates(); $trusted_smtp_domain = $_GET["trusted_smtp_domain"]; $dn = "cn=relay_domains,ou={$ou},dc=organizations,{$ldap->suffix}"; $upd = array(); if (!$ldap->ExistsDN($dn)) { $upd['cn'][0] = "relay_domains"; $upd['objectClass'][0] = 'PostFixStructuralClass'; $upd['objectClass'][1] = 'top'; $ldap->ldap_add($dn, $upd); unset($upd); } $hashdoms = $ldap->hash_get_all_domains(); if ($hashdoms[$domain_name] != null) { echo $tpl->_ENGINE_parse_body('{error_domain_exists}'); exit; } $dn = "cn={$domain_name},cn=relay_domains,ou={$ou},dc=organizations,{$ldap->suffix}"; $upd['cn'][0] = "{$domain_name}"; $upd['objectClass'][0] = 'PostFixRelayDomains'; $upd['objectClass'][1] = 'top'; $ldap->ldap_add($dn, $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'; $ldap->ldap_add($dn, $upd); unset($upd); } if ($trusted_smtp_domain == 0) { $dn = "cn=@{$domain_name},cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}"; $upd['cn'][0] = "@{$domain_name}"; $upd['objectClass'][0] = 'PostfixRelayRecipientMaps'; $upd['objectClass'][1] = 'top'; $ldap->ldap_add($dn, $upd); } $dn = "cn=transport_map,ou={$ou},dc=organizations,{$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); } if ($relayIP != null) { if ($mx == "no") { $relayIP = "[{$relayIP}]"; } $dn = "cn={$domain_name},cn=transport_map,ou={$ou},dc=organizations,{$ldap->suffix}"; $upd['cn'][0] = "{$domain_name}"; $upd['objectClass'][0] = 'transportTable'; $upd['objectClass'][1] = 'top'; $upd["transport"][] = "relay:{$relayIP}:{$relayPort}"; $ldap->ldap_add($dn, $upd); } }
function blacklist(){ $ldap=new clladp(); $domain=$ldap->hash_get_all_domains(); if(!is_array($domain)){return null;} while (list ($num, $line) = each ($domain)){ $html=$html . blacklistdom($num); } $page=main_tabs () . "<br>" . RoundedLightGreen(" <table style='width:99%'> <tr> <td><strong>{from}:</td> <td>" . Field_text('wlfrom',$_GET["whitelist"],'width:120px', null,null,null,false,"AddblwformCheck(1,event)") ."</td> <td><strong>{recipient}:</td> <td>" . Field_text('wlto',$_GET["recipient"],'width:120px', null,null,null,false,"AddblwformCheck(1,event)") ."</td> <td align='right'><input type='button' OnClick=\"javascript:Addblwform(1);\" value='{add} »'></td> </tr> </table>")." <br> $html"; $tpl=new templates(); return $tpl->_ENGINE_parse_body($page); }
function popup_add() { $ldap = new clladp(); $page = CurrentPageName(); $users = new usersMenus(); $t = $_GET["t"]; $listname = $_GET["listname"]; $listnameExists = 0; $btname = "{add}"; $explain = "<div class=text-info style='font-size:14px'>{add_mailman_text}</div>"; if ($_GET["ou"] != null) { $domains = $ldap->hash_get_domains_ou($_GET["ou"]); } else { $domains = $ldap->hash_get_all_domains(); } if ($listname != null) { $mailman = new mailmancontrol($listname); $tr = explode(".", $mailman->emailhost); $emailhost = $tr[0]; unset($tr[0]); $domain = @implode(".", $tr); $explain = "<div style='font-size:14px;width:95%' class=form>http://{$mailman->urlhost} | smtp://{$mailman->emailhost}</div>"; $btname = "{apply}"; $urlhost = str_replace(".{$domain}", "", $mailman->urlhost); $adminmail = $mailman->adminmail; $mangle = $mailman->mangle; $listnameExists = 1; } $domain = Field_array_Hash($domains, "domain-{$t}", null, "FillSuffix{$t}()", null, 0, "font-size:16px"); $html = "\n\n\t{$explain}\n\t<div id='animate-{$t}'></div>\n\t<table class=form style='width:99%'>\n\t<tr>\n\t\t<td valign='top' class=legend style='font-size:16px'>{listname}:</td>\n\t\t<td valign='top' width=1%>" . Field_text('listname_add', $listname, 'width:200px;font-size:16px', null, null, null, false, "FillSuffix{$t}()", false, null) . "</td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' class=legend style='font-size:16px'>{domain}:</td>\n\t\t<td valign='top' width=1%>{$domain}</td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' class=legend style='font-size:16px'>{exclusive}:</td>\n\t\t<td valign='top' width=1%>" . Field_checkbox("mangle-{$t}", 1, $mangle, "MangleCheck{$t}()") . "</td>\n\t\t<td></td>\n\t\t<td></td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td valign='top' class=legend style='font-size:16px'>{emailhost}:</td>\n\t\t<td valign='top' width=1%>" . Field_text("emailhost-{$t}", $emailhost, 'width:200px;font-size:16px', null, null, null, false, "FillSuffix{$t}()") . "</td>\n\t\t<td><span id='suffixDom2-{$t}' style='font-size:16px'></span></td>\n\t\t<td></td>\n\t</tr>\n\t\t\n\t<tr>\n\t\t<td valign='top' class=legend style='font-size:16px'>{urlhost}:</td>\n\t\t<td valign='top' width=1%>" . Field_text("urlhost-{$t}", $urlhost, 'width:200px;font-size:16px', null, null, null, false, "FillSuffix{$t}()") . "</td>\n\t\t<td><span id='suffixDom-{$t}' style='font-size:16px'></span></td>\n\t\t<td></td>\n\t</tr>\t\n\t<tr>\n\t\t<td valign='top' class=legend style='font-size:16px'>{admin_email}:</td>\n\t\t<td valign='top' width=1%>" . Field_text("adminmail-{$t}", $adminmail, 'width:200px;font-size:16px', null, null, null, false, "FillSuffix{$t}()") . "</td>\n\t\t<td> </td>\n\t\t<td width=1%>" . help_icon("{MailManListAdministrator_text}") . "</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td colspan=4 align='right'><hr>" . button("{$btname}", "SaveList{$t}();", "18px") . "</td>\n\t</tr>\t\n\t</table>\n\t<div id='showlists{$t}' style='font-size:14px;font-weight:bold'></div>\n\t<script>\n\tvar x_SaveList{$t}= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tdocument.getElementById('animate-{$t}').innerHTML='';\n\t\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t\t\$('#flexRT{$t}').flexReload();\n\t\tYahooWin2Hide();\n\t} \n\t\n\tfunction MangleCheck{$t}(){\n\t\tif(document.getElementById('mangle-{$t}').checked){\n\t\t\tdocument.getElementById('emailhost-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('emailhost-{$t}').disabled=false;\n\t\t}\n\t\t\n\t\tFillSuffix{$t}()\n\t}\n\n function FillSuffix{$t}(){\n \t\tvar listnameExists={$listnameExists};\n \t\tvar smtpdomain='';\n \t\tvar smtpdomain_point='.';\n \t\tvar textemails='';\n \t\tsmtpdomain=document.getElementById('domain-{$t}').value;\n \t\tvar listname=document.getElementById('listname_add').value;\n \t\tif(document.getElementById('mangle-{$t}').checked){smtpdomain_point='';}else{\n \t\t\tsmtpdomain=document.getElementById('emailhost-{$t}').value+'.'+document.getElementById('domain-{$t}').value;\n \t\t}\n \t\t\n \t\tif(listnameExists==1){document.getElementById('listname_add').disabled=true;}\n\t\tdocument.getElementById('suffixDom-{$t}').innerHTML='.'+document.getElementById('domain-{$t}').value;\n\t\tdocument.getElementById('suffixDom2-{$t}').innerHTML=smtpdomain_point+document.getElementById('domain-{$t}').value;\n\t\tif(listname.length>0){\n\t\t\ttextemails=textemails+listname+'@'+smtpdomain+'<br>';\n\t\t\ttextemails=textemails+listname+'-admin@'+smtpdomain+'<br>';\n\t\t\ttextemails=textemails+listname+'-bounces@'+smtpdomain+'<br>';\n\t\t\ttextemails=textemails+listname+'-confirm@'+smtpdomain+'<br>';\n\t\t\ttextemails=textemails+listname+'-join@'+smtpdomain+'<br>';\n\t\t\ttextemails=textemails+listname+'-leave@'+smtpdomain+'<br>';\n\t\t\ttextemails=textemails+listname+'-owner@'+smtpdomain+'<br>';\n\t\t\ttextemails=textemails+listname+'-request@'+smtpdomain+'<br>';\n\t\t\ttextemails=textemails+listname+'-subscribe@'+smtpdomain+'<br>';\n\t\t\ttextemails=textemails+listname+'-unsubscribe@'+smtpdomain+'<br>';\n\t\t\tdocument.getElementById('showlists{$t}').innerHTML=textemails;\n\t\t}\n\n\t}\n \n function SaveList{$t}(){\n \t var XHR = new XHRConnection();\n \t XHR.appendData('listname_add',document.getElementById('listname_add').value);\n \t XHR.appendData('domain',document.getElementById('domain-{$t}').value);\n \t XHR.appendData('urlhost',document.getElementById('urlhost-{$t}').value);\n \t XHR.appendData('emailhost',document.getElementById('emailhost-{$t}').value);\n \t XHR.appendData('adminmail',document.getElementById('adminmail-{$t}').value);\n \t if(document.getElementById('mangle-{$t}').checked){XHR.appendData('mangle',1);}else{XHR.appendData('mangle',0);}\n \t AnimateDiv('animate-{$t}');\n \t XHR.sendAndLoad('{$page}', 'POST',x_SaveList{$t}); \n }\n \n \n MangleCheck{$t}();\n FillSuffix{$t}();\n </script>\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html, 'mailman.lists.php'); }
function autoaccount_form() { $page = CurrentPageName(); $ldap = new clladp(); $domains = $ldap->hash_get_all_domains(); $field_domains = Field_array_Hash($domains, "domain"); $html = "<h1>{register}</h1>\n\t<div id='fromadd'>\n\t<form name='FFMCOMPRESSS'>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'><img src='img/bg_lego.png'></td>\n\t<td valign='top'>\n\t\t<H3>{create_your_user_account}</H3>\n\t<table class=table_form style='width:100%'>\n\t<tr>\n\t\t<td class=legend>{firstname}:</td>\n\t\t<td>" . Field_text('first_name', null, 'width:160px') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{lastname}:</td>\n\t\t<td>" . Field_text('last_name', null, 'width:160px') . "</td>\n\t</tr>\t\n\t\t<td class=legend>{login}:</td>\n\t\t<td>" . Field_text('login', null, 'width:100px') . "@{$field_domains}</td>\n\t</tr>\n\t</tr>\t\n\t\t<td class=legend>{password}:</td>\n\t\t<td>" . Field_password('password', null, 'width:100px') . "</td>\n\t</tr>\t\n\t<tr><td colspan=2><hr></td></tr>\n\t<tr><td colspan=2 align='right'>\n\t\t<input type='button' OnClick=\"javascript:ParseForm('FFMCOMPRESSS','{$page}',true,false,false,'fromadd','{$page}?submitedform=yes');\"\n\t\t value='{add} »'>\n\t</td>\n\t</tR>\n\t</table>\n\t</form>\n\t</div>\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function CheckDisclaimerGlobal($sender, $recipient, $temp_file) { if (!is_file("/usr/local/bin/altermime")) { if ($GLOBALS["VERBOSE"]) { events("AlterMime is not installed", __FUNCTION__, __LINE__); } return true; } $sock = new sockets(); $EnableAlterMime = $sock->GET_INFO("EnableAlterMime"); if ($EnableAlterMime == 0) { events("AlterMime is disabled", __FUNCTION__, __LINE__); return true; } $DisclaimerOrgOverwrite = $sock->GET_INFO("DisclaimerOrgOverwrite"); if ($DisclaimerOrgOverwrite == 1) { if (CheckDisclaimerOrg_Recipient($sender, $recipient, $temp_file)) { return true; } if (CheckDisclaimerOrg_Sender($sender, $recipient, $temp_file)) { return true; } } if (!preg_match("#(.+?)@(.+)#", $recipient, $re)) { events("Unable to preg_match recipient domain", __FUNCTION__, __LINE__); return false; } $recipient_domain = trim($re[2]); $generic_disclaimer = $sock->GET_INFO("AlterMimeHTMLDisclaimer"); $DisclaimerOutbound = $sock->GET_INFO("DisclaimerOutbound"); $DisclaimerInbound = $sock->GET_INFO("DisclaimerInbound"); $DisclaimerOrgOverwrite = $sock->GET_INFO("DisclaimerInbound"); if ($DisclaimerOutbound == null) { $DisclaimerOutbound = 1; } if ($DisclaimerInbound == null) { $DisclaimerInbound = 0; } $ldap = new clladp(); $domains = $ldap->hash_get_all_domains(); if ($domains[$recipient_domain] != null) { if ($DisclaimerInbound == 0) { return false; events("{$recipient_domain} is a local domain, skip disclaimer (Inbound is disabled)", __FUNCTION__, __LINE__); } if ($DisclaimerOutbound == 0) { return false; events("{$recipient_domain} is a foregin domain, skip disclaimer (Outbound is disabled)", __FUNCTION__, __LINE__); } } else { if ($DisclaimerInbound == 0) { return false; events("{$recipient_domain} is a local domain, skip disclaimer (Inbound is disabled)", __FUNCTION__, __LINE__); } } WriteDisclaimer($generic_disclaimer, $temp_file); return true; }
function COMPILE() { $sock = new sockets(); $sock->SET_INFO("KasxFilterEnabled", 1); $sock->SET_INFO("kavmilterEnable", 1); $domain = trim(strtolower($_SESSION["WIZARD"]["ORGANIZATION"])); $ou = $_SESSION["WIZARD"]["ORGANIZATION"]; $ou = str_replace(" ", "_", $ou); $ldap = new clladp(); $ldap->AddOrganization($_SESSION["WIZARD"]["ORGANIZATION"]); $hashdoms = $ldap->hash_get_all_domains(); if ($hashdoms[$domain] == null) { $ldap->AddRelayDomain($ou, $domain, $_SESSION["WIZARD"]["MAILBOX_IP"], 25); } $kas = new kas_mysql($ou); $kas->SET_VALUE("OPT_FILTRATION_ON", 1); $main = new main_cf(); $main->add_my_networks($_SESSION["WIZARD"]["SMTP_NET"]); $main->save_conf_to_server(); $sock->getFrameWork("cmd.php?kas-reconfigure=yes"); $sock->getFrameWork("cmd.php?kavmilter-configure"); $tpl = new templates(); $html = "\n\t\t\n\t\t<H3>{success}</H3><center>" . button("{close}", "CloseTimeOut()") . "</center>"; echo $tpl->_ENGINE_parse_body("{success}"); }
function AJAX_COMPUTER_DNS_FORM($uid) { $computer = new computers($uid); if ($computer->dhcpfixed == 1) { $computer->VolatileIPAddress = 0; } if ($computer->VolatileIPAddress == 1) { $disabled = true; } $users = new usersMenus(); if ($computer->DnsZoneName == null) { if (isset($_GET["zone-name"])) { $computer->DnsZoneName = $_GET["zone-name"]; } } if ($computer->DnsZoneName == "localhost") { if (isset($_GET["zone-name"])) { $computer->DnsZoneName = $_GET["zone-name"]; } } $ldap = new clladp(); $domains = $ldap->hash_get_all_domains(); $DnsZoneName = Field_array_Hash($domains, "DnsZoneName", $computer->DnsZoneName, "style:font-size:22px", null, 0, null, $disabled); $dnstypeTable = array("" => "{select}", "MX" => "{mail_exchanger}", "A" => "{dnstypea}"); $DnsType = Field_array_Hash($dnstypeTable, "DnsType", $computer->DnsType, "style:font-size:22px", null, 0, null, $disabled); $html = "\t\t\t\n\n<tr>\n\t\t\t\t\t<td class=legend style='font-size:26px'>{DnsZoneName}:</strong></td>\n\t\t\t\t\t<td align=left colspan=2>{$DnsZoneName}</strong></td>\n\t\t\t\t</tr>\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:26px'>{DnsType}:</strong></td>\n\t\t\t\t\t<td align=left colspan=2>{$DnsType}</strong></td>\n\t\t\t\t</tr>\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:26px'>{DnsMXLength}:</strong></td>\n\t\t\t\t\t<td align=left colspan=2>" . Field_text('DnsMXLength', $computer->DnsMXLength, 'font-size:22px;width:110px', null, null, null, false, null, $disabled) . "</strong></td>\n\t\t\t\t</tr>\n\t\t\t</tbody>\n</table>\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }
function PopulateMyDomains(){ unset($GLOBALS["LOCAL_DOMAINS"]); $ldap=new clladp(); $doms=$ldap->hash_get_all_domains(); while (list ($num, $ligne) = each ($doms) ){ events("Internal domain: $num",__FUNCTION__,__LINE__); $GLOBALS["LOCAL_DOMAINS"][trim(strtolower($num))]=true; } @file_put_contents("/tmp/".basename(__FILE__).".domains",serialize($GLOBALS["LOCAL_DOMAINS"])); }
function dhcp_form() { $ldap = new clladp(); writelogs("Get all domains...", __FUNCTION__, __FILE__, __LINE__); $domains = $ldap->hash_get_all_domains(); writelogs(" -> dhcpd();", __FUNCTION__, __FILE__, __LINE__); $dhcp = new dhcpd(0, 1); writelogs(" -> dhcpd(); FINISH", __FUNCTION__, __FILE__, __LINE__); $page = CurrentPageName(); $users = new usersMenus(); $sock = new sockets(); $EnableDHCPServer = $sock->GET_INFO('EnableDHCPServer'); $EnableDHCPUseHostnameOnFixed = $sock->GET_INFO('EnableDHCPUseHostnameOnFixed'); $IncludeDHCPLdapDatabase = $sock->GET_INFO('IncludeDHCPLdapDatabase'); if (!is_numeric($IncludeDHCPLdapDatabase)) { $IncludeDHCPLdapDatabase = 1; } if (count($domains) == 0) { $dom = Field_text('ddns_domainname', $dhcp->ddns_domainname, "font-size:22px;"); } else { $domains[null] = "{select}"; $dom = Field_array_Hash($domains, 'ddns_domainname', $dhcp->ddns_domainname, null, null, null, ";font-size:22px;padding:3px"); } $nic = $dhcp->array_tcp; if ($dhcp->listen_nic == null) { $dhcp->listen_nic = "eth0"; } while (list($num, $val) = each($nic)) { if ($num == null) { continue; } if ($num == "lo") { continue; } $nics[$num] = $num; } if ($dhcp->listen_nic != null) { $nics[$dhcp->listen_nic] = $dhcp->listen_nic; } $nics[null] = '{select}'; $dnsmasq_installed = 0; $EnableArticaAsDNSFirst_enabled = 0; if ($users->dnsmasq_installed) { $dnsmasq_installed = 1; } if ($users->BIND9_INSTALLED or $users->POWER_DNS_INSTALLED or $users->dnsmasq_installed) { $EnableArticaAsDNSFirst_enabled = 1; } $nicz = new system_nic($dhcp->listen_nic); $ipaddrEX = explode(".", $nicz->IPADDR); unset($ipaddrEX[3]); if ($dhcp->subnet == null) { $dhcp->subnet = @implode(".", $ipaddrEX) . ".0"; } if ($dhcp->netmask == null) { $dhcp->netmask = $nicz->NETMASK; } if ($dhcp->gateway == null) { $dhcp->gateway = $nicz->GATEWAY; } if ($dhcp->range1 == null) { $dhcp->range1 = @implode(".", $ipaddrEX) . ".50"; } if ($dhcp->range2 == null) { $dhcp->range2 = @implode(".", $ipaddrEX) . ".254"; } if ($dhcp->broadcast == null) { $dhcp->broadcast = @implode(".", $ipaddrEX) . ".255"; } $EnableArticaAsDNSFirst = Field_checkbox_design("EnableArticaAsDNSFirst", 1, $dhcp->EnableArticaAsDNSFirst); $EnableDHCPUseHostnameOnFixed = Field_checkbox_design("EnableDHCPUseHostnameOnFixed", 1, $EnableDHCPUseHostnameOnFixed); $IncludeDHCPLdapDatabase = Field_checkbox_design("IncludeDHCPLdapDatabase", 1, $IncludeDHCPLdapDatabase, "OnlySetGatewayFCheck()"); $authoritative = Field_checkbox_design("DHCPauthoritative", 1, $dhcp->authoritative); $ping_check = Field_checkbox_design("DHCPPing_check", 1, $dhcp->ping_check); $get_lease_hostnames = Field_checkbox_design("get_lease_hostnames", 1, $dhcp->get_lease_hostnames); $html = "\n\n\t\t\t<div id='dhscpsettings' class=form>\n\t\t\t\t<div class='BodyContent'>\n\t\t\t\t<input type='hidden' id='EnableDHCPServer' value='{$EnableDHCPServer}' name='EnableDHCPServer'>\n\t\t\t\t<table style='width:98%'>\n\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{deny_unkown_clients}:</td>\n\t\t<td>" . Field_checkbox_design("deny_unkown_clients", 1, $dhcp->deny_unkown_clients) . "</td>\n\t\t<td> </td>\n\t\t<td>" . help_icon('{deny_unkown_clients_explain}') . "</td>\n\t</tr>\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{IncludeDHCPLdapDatabase}:</td>\n\t\t\t\t\t<td>{$IncludeDHCPLdapDatabase}</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td>" . help_icon('{IncludeDHCPLdapDatabase_explain}') . "</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{EnableDHCPUseHostnameOnFixed}:</td>\n\t\t\t\t\t<td>{$EnableDHCPUseHostnameOnFixed}</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td>" . help_icon('{EnableDHCPUseHostnameOnFixed_explain}') . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{authoritative}:</td>\n\t\t\t\t\t<td>{$authoritative}</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td>" . help_icon('{authoritativeDHCP_explain}') . "</td>\n\t\t\t\t</tr>\t\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{DHCPPing_check}:</td>\n\t\t\t\t\t<td>{$ping_check}</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td>" . help_icon('{DHCPPing_check_explain}') . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{get_lease_hostnames}:</td>\n\t\t\t\t\t<td>{$get_lease_hostnames}</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td>" . help_icon('{get_lease_hostnames_text}') . "</td>\n\t\t\t\t</tr>\t\n<tr>\n\t<td colspan=4>\n\t\t\t\t<div style='margin:10px;border:1px solid #CCCCCC;pading:10px'>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px' colspan=3>{do_no_verify_range}</span>:</td>\n\t\t\t\t\t<td>" . Field_checkbox_design('do_no_verify_range', 1, $dhcp->do_no_verify_range) . " </td>\n\t\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px;font-weight:bold;width:622px'>{range} {from}:</td>\n\t\t\t\t\t<td>" . field_ipv4('range1', $dhcp->range1, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px;font-weight:bold'>{range} {to}:</td>\n\t\t\t\t\t<td>" . field_ipv4('range2', $dhcp->range2, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t</div>\t\t\t\t\t\n\t\t</td>\n</tr>\t\t\t\n\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{ddns_domainname}:</td>\n\t\t\t\t\t<td>{$dom}</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td width=1% nowrap>" . imgtootltip("plus-16.png", null, "Loadjs('domains.edit.domains.php?js-all-localdomains=yes')") . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{max_lease_time}:</td>\n\t\t\t\t\t<td style='font-size:16px'>" . Field_text('max_lease_time', $dhcp->max_lease_time, 'width:90px;font-size:22px;padding:3px') . " {seconds}</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td >" . help_icon('{max_lease_time_text}') . "</td>\n\t\t\t\t</tr>\t\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{wpad_label}:</td>\n\t\t\t\t\t<td>" . Field_text('local-pac-server', $dhcp->local_pac_server, 'width:300px;font-size:22px;padding:3px', false) . "</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td>" . help_icon('{wpad_label_text}') . "</td>\n\t\t\t\t</tr>\t\t\t\n\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{subnet}:</td>\n\t\t\t\t\t<td>" . field_ipv4('subnet', $dhcp->subnet, "font-size:22px;padding:3px;font-weight:bold", false) . "</td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{netmask}:</td>\n\t\t\t\t\t<td>" . field_ipv4('netmask', $dhcp->netmask, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{gateway}:</td>\n\t\t\t\t\t<td>" . field_ipv4('gateway', $dhcp->gateway, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{broadcast}:</td>\n\t\t\t\t\t<td>" . field_ipv4('broadcast_dhcp_main', $dhcp->broadcast, 'font-size:22px;padding:3px') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{DNSServer} 1:</td>\n\t\t\t\t\t<td>" . field_ipv4('DNS_1', $dhcp->DNS_1, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{DNSServer} 2:</td>\n\t\t\t\t\t<td>" . field_ipv4('DNS_2', $dhcp->DNS_2, 'font-size:22px;padding:3px;font-weight:bold') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{wins_server}:</td>\n\t\t\t\t\t<td>" . field_ipv4('WINSDHCPSERV', $dhcp->WINS, 'font-size:22px;padding:3px') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend style='font-size:22px'>{ntp_server} <span style='font-size:10px'>({optional})</span>:</td>\n\t\t\t\t\t<td>" . Field_text('ntp_server', $dhcp->ntp_server, 'width:228px;font-size:22px;padding:3px') . " </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td> </td>\n\t\t\t\t</tr>\n\t\t\n\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=4 align='right'><hr>\n\t\t\t\t\t" . button("{apply}", "SaveDHCPSettings()", 40) . "\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\t\t\n\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<br>\n\t\t\n\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }
function shared_edit() { $ID = $_GET["shared-edit"]; $t = time(); $tpl = new templates(); $page = CurrentPageName(); $q = new mysql(); $tt = $_GET["tt"]; if (!is_numeric($ID)) { $ID = 0; } $sql = "SELECT sharednet_name FROM dhcpd_sharednets GROUP BY sharednet_name ORDER BY sharednet_name"; $results = $q->QUERY_SQL($sql, "artica_backup"); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $dhcpd_sharednets[$ligne["sharednet_name"]] = $ligne["sharednet_name"]; } $groupname_field = Field_array_Hash($dhcpd_sharednets, "sharednet_name", $ligne["sharednet_name"], "style:font-size:16px;padding:3px"); $sql = "SELECT * FROM dhcpd_sharednets WHERE ID={$ID}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $ldap = new clladp(); $domains = $ldap->hash_get_all_domains(); if (count($domains) == 0) { $dom = Field_text('domain-name', $ligne["domain-name"], "font-size:16px;"); } else { $domains[null] = "{select}"; $dom = Field_array_Hash($domains, 'domain-name', $ligne["domain-name"], null, null, null, "font-size:16px;padding:3px"); } $button = "{apply}"; if ($ID == 0) { $button = "{add}"; } $html = "\n\t<div style='width:98%' class=form>\n\t<table style='width:99%'>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{groupname}:</td>\n\t\t<td>{$groupname_field}</td>\n\t\t<td width=1%> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{groupname} ({add}):</td>\n\t\t<td>" . Field_text("groupnameAdd", null, "font-size:16px") . "</td>\n\t\t<td>" . help_icon("{dhcp-groupnameAdd-explain}") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{scope}:</td>\n\t\t<td>" . Field_text("scope", $ligne["scopename"], "font-size:16px") . "</td>\n\t\t<td>" . help_icon("{dhcp-scope-explain}") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{ddns_domainname}:</td>\n\t\t<td>{$dom}</td>\n\t\t<td>" . help_icon("{dhcp-domain-name-explain}") . "</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{subnet}:</td>\n\t\t<td>" . field_ipv4("subnet_{$t}", $ligne["subnet"], "font-size:16px;padding:3px", true) . "</td>\n\t\t<td width=1%> </td>\n\t</tr>\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{netmask}:</td>\n\t\t<td>" . field_ipv4("netmask_{$t}", $ligne["netmask"], "font-size:16px;padding:3px") . "</td>\n\t\t<td width=1%> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{gateway}:</td>\n\t\t<td>" . field_ipv4("routers_{$t}", $ligne["routers"], 'font-size:16px;padding:3px') . " </td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\t\n\t\t<td class=legend style='font-size:16px'>{range} {from}:</td>\n\t\t<td>" . field_ipv4('range1_' . $t, $ligne["range1"], 'font-size:16px;padding:3px') . " </td>\n\t</tr>\n\t<tr>\t\n\t\t<td class=legend style='font-size:16px'>{range} {to}:</td>\n\t\t<td>" . field_ipv4('range2_' . $t, $ligne["range2"], 'font-size:16px;padding:3px') . " </td>\n\t</tr>\n\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{subnet-mask}:</td>\n\t\t<td>" . field_ipv4('subnet-mask_' . $t, $ligne["subnet-mask"], 'font-size:16px;padding:3px') . "</td>\n\t\t<td>" . help_icon("{dhcp-subnet-masq_text}") . "</td>\n\t</tr>\t\n\t\n\t\n\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{DNSServer} 1:</td>\n\t\t<td>" . field_ipv4('domain-name-servers1', $ligne["domain-name-servers1"], 'font-size:16px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{DNSServer} 2:</td>\n\t\t<td>" . field_ipv4('domain-name-servers2', $ligne["domain-name-servers2"], 'font-size:16px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{wins_server}:</td>\n\t\t<td>" . field_ipv4('wins-server-group', $ligne["wins-server"], 'font-size:16px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{hostname}:</td>\n\t\t<td>" . Field_text('server-name', $ligne["server-name"], 'width:210px;font-size:16px;padding:3px') . " </td>\n\t\t<td>" . help_icon("{dhcp-server-name_text}") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{next-server}:</td>\n\t\t<td>" . Field_text('next-server', $ligne["next-server"], 'width:210px;font-size:16px;padding:3px') . " </td>\n\t\t<td>" . help_icon("{dhcp-next-server-explain}") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{pxe_file}:</td>\n\t\t<td>" . Field_text('pxe_filename', $ligne["pxe_filename"], 'width:110px;font-size:16px;padding:3px') . " </td>\n\t\t<td>" . help_icon("{filename_pxe_explain}") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{pxe_root-path}:</td>\n\t\t<td>" . Field_text('pxe_root-path', $ligne["pxe_root-path"], 'width:210px;font-size:16px;padding:3px') . " </td>\n\t\t<td>" . help_icon("{pxe_root-path_explain}") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{tftp-server-name}:</td>\n\t\t<td>" . Field_text('tftp-server-name', $ligne["tftp-server-name"], 'width:210px;font-size:16px;padding:3px') . " </td>\n\t\t<td>" . help_icon("{tftp-server-name_explain}") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{option-176}:</td>\n\t\t<td><textarea style='font-size:16px;height:50px;width:100%;overflow:auto' id='option-176'>{$ligne["option-176"]}</textarea> </td>\n\t\t<td>" . help_icon("{option-176-explain}") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button($button, "SharedDHCPNetSave{$t}()", 22) . "</td>\n\t</tr>\n\t\n\t\n\t</table>\n\t</div>\n\t<script>\n\t\nvar x_SharedDHCPNetSave{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tvar ID='{$ID}'\n\tif(tempvalue.length>3){alert(tempvalue);return;}\n\t\$('#table-items-{$tt}').flexReload();\n\tif(ID==0){YahooWin5Hide();}\n\t}\t\t\n\t\n\tfunction SharedDHCPNetSave{$t}(){\n\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('domain-name',document.getElementById('domain-name').value);\n\t\tXHR.appendData('sharednet_name',document.getElementById('sharednet_name').value);\n\t\tXHR.appendData('groupnameAdd',document.getElementById('groupnameAdd').value);\n\t\tXHR.appendData('scope',document.getElementById('scope').value);\n\t\tXHR.appendData('subnet',document.getElementById('subnet_{$t}').value);\n\t\tXHR.appendData('netmask',document.getElementById('netmask_{$t}').value);\n\t\tXHR.appendData('routers',document.getElementById('routers_{$t}').value);\n\t\tXHR.appendData('range1',document.getElementById('range1_{$t}').value);\n\t\tXHR.appendData('range2',document.getElementById('range2_{$t}').value);\n\t\tXHR.appendData('subnet-mask',document.getElementById('subnet-mask_{$t}').value);\n\t\tXHR.appendData('domain-name-servers1',document.getElementById('domain-name-servers1').value);\n\t\tXHR.appendData('domain-name-servers2',document.getElementById('domain-name-servers2').value);\n\t\tXHR.appendData('tftp-server-name',document.getElementById('tftp-server-name').value);\n\t\tXHR.appendData('server-name',document.getElementById('server-name').value);\n\t\tXHR.appendData('next-server',document.getElementById('next-server').value);\n\t\tXHR.appendData('pxe_filename',document.getElementById('pxe_filename').value);\n\t\tXHR.appendData('pxe_root-path',document.getElementById('pxe_root-path').value);\n\t\tXHR.appendData('option-176',document.getElementById('option-176').value);\n\t\tXHR.appendData('wins-server',document.getElementById('wins-server-group').value);\n\t\tXHR.appendData('ID',{$ID});\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_SharedDHCPNetSave{$t});\t\n\t}\n</script>\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
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://"; } $link = $prefix . $_SERVER["HTTP_HOST"] . '/' . CurrentPageName() . "?confirm={$zmd5}"; $subject = $tpl->javascript_parse_text("{organization}: {$ou} {register_form}"); $message = "{sendmail_request_form}\n----------------------\n{$link}\n----------------------\n"; $RobotInternetUsers = $sock->GET_INFO("RobotInternetUsers"); if ($RobotInternetUsers == null) { $RobotInternetUsers = "postmaster@{$user->fqdn}"; } $email = $_POST["email"]; mail($email, "{$subject}", $message, "From:" . $RobotInternetUsers); echo "<H2>" . $tpl->_ENGINE_parse_body("{thanks_registration_mail} <strong>{$email}</strong>"); }
function browse_domains_list() { $page = CurrentPageName(); $tpl = new templates(); $ldap = new clladp(); $users = new usersMenus(); $search = $_GET["search"]; $t = $_GET["t"]; $search = "*{$search}*"; $search = str_replace("***", "*", $search); $search = str_replace("**", "*", $search); $search_sql = str_replace("*", "%", $search); $search_sql = str_replace("%%", "%", $search_sql); $search_regex = str_replace(".", "\\.", $search); $search_regex = str_replace("*", ".*?", $search); if ($users->AsSystemAdministrator) { $q = new mysql(); $sql = "SELECT domain FROM officials_domains WHERE domain LIKE '{$search_sql}' ORDER BY domain"; writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $domains[$ligne["domain"]] = $ligne["domain"]; } $hash = $ldap->hash_get_all_domains(); while (list($num, $ligne) = each($hash)) { if (preg_match("#{$search_regex}#", $ligne)) { $domains[$ligne] = $ligne; } } } else { $hash = $ldap->hash_get_domains_ou($_SESSION["ou"]); while (list($num, $ligne) = each($hash)) { if (preg_match("#{$search_regex}#", $ligne)) { $domains[$ligne] = $ligne; } } } ksort($domains); if (count($domains) < $_POST["rp"]) { $_POST["rp"] = $domains; } $data = array(); $data['page'] = 1; $data['total'] = $_POST["rp"]; $data['rows'] = array(); if (count($domains) == 0) { json_error_show("no data"); } while (list($num, $ligne) = each($domains)) { $val = 0; $color = "black"; $delete = imgsimple("delete-48.png", null, "Delete{$_GET["t"]}({$ligne["ID"]})"); $select = imgtootltip("arrow-blue-left-32.png", "{select}", "SelectBrowseDomains{$t}('{$ligne}')"); $data['rows'][] = array('id' => "{$ligne["ID"]}", 'cell' => array("<div style='font-size:22px;font-weight:bold;color:{$color};margin-top:10px'><img src='img/domain-32.png'></span>", "<div style='font-size:22px;font-weight:bold;color:{$color};margin-top:10px'>{$ligne}</a>", "<div>{$select}</div>")); } echo json_encode($data); }
function QueryDNSForm(){ $sock=new sockets(); $main=new main_cf(0); $page=CurrentPageName(); $ldap=new clladp(); $domains=$ldap->hash_get_all_domains(); $myhostname=$sock->GET_INFO("myhostname"); $domains["\$mydomain"]="\$mydomain"; $myorigin=Field_array_Hash($domains,"myorigin",$main->main_array["myorigin"]); if(strlen($myhostname)>2){$main->main_array["myhostname"]=$myhostname;} $myorigin="<strong>\$mydomain</strong><input type='hidden' name='myorigin' value='\$mydomain' id='myorigin'>"; $styleadd="style='font-size:13px;padding:4px'"; $html="<div id='QueryDNSFormSaveid'> <span style='font-size:12px;font-weight:bold'>{DNS_SETTINGS} & {hostname}</span> <table style='width:90%' align='center'> <tr> <td align='right' valign='top' nowrap class=legend>{myhostname} :</strong></td> <td align='left' width=1% $styleadd>" . Field_text('myhostname',$main->main_array["myhostname"],'width:220px;font-size:14px;padding:3px') ."</td> <td valign='top' width=1% $styleadd>".help_icon('{myhostname_text}')."</td> <tr> <tr> <td align='right' valign='top' nowrap class=legend $styleadd>{myorigin} :</strong></td> <td align='left' width=1% $styleadd> $myorigin</td> <td valign='top' width=1% $styleadd>".help_icon('{myorigin_text}')."</td> <tr> <td align='right' valign='top' nowrap class=legend $styleadd>{ignore_mx_lookup_error} :</strong></td> <td align='left' width=1% $styleadd>" . Field_checkbox('ignore_mx_lookup_error','yes',$main->main_array["ignore_mx_lookup_error"]) ."</td> <td valign='top' width=1% $styleadd>".help_icon('{ignore_mx_lookup_error_text}')."</td> </tr> <tr> <tr> <td align='right' valign='top' nowrap class=legend $styleadd>{disable_dns_lookups} :</strong></td> <td align='left' width=1% $styleadd>" . Field_checkbox('disable_dns_lookups','yes',$main->main_array["disable_dns_lookups"]) ."</td> <td valign='top' width=1% $styleadd>".help_icon('{disable_dns_lookups_text}')."</td> </tr> <tr><td colspan=3 align='right'><hr>". button("{edit}","QueryDNSFormSave()")."</td></tr> </table> </div> <script> var x_QueryDNSFormSave= function (obj) { var results=obj.responseText; if(results.length>3){alert('\"'+results+'\"'+results.length);} RefreshTab('main_config_postfix_net'); } function QueryDNSFormSave(){ var XHR = new XHRConnection(); XHR.appendData('myhostname',document.getElementById('myhostname').value); if(document.getElementById('ignore_mx_lookup_error').checked){XHR.appendData('ignore_mx_lookup_error','yes');}else{ XHR.appendData('ignore_mx_lookup_error','no'); } if(document.getElementById('disable_dns_lookups').checked){XHR.appendData('disable_dns_lookups','yes');}else{ XHR.appendData('disable_dns_lookups','no'); } document.getElementById('QueryDNSFormSaveid').innerHTML='<center><img src=img/wait_verybig.gif></center>'; XHR.sendAndLoad('$page', 'GET',x_QueryDNSFormSave); } </script> "; $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function internal_domains() { $ldap = new clladp(); $hash = $ldap->hash_get_all_domains(); $clue = new cluebringer(); while (list($domain, $val) = each($hash)) { $clue->local_domain_add($domain); } echo "Starting......: cluebringer " . count($hash) . " domains updated\n"; }