function INDEX() { $ldap = new clladp(); $ou = $_GET["ou"]; $Hash_datas = $ldap->OUDatas($ou); $h_type = array("spam" => "spam", "ham" => "ham"); $domains1 = $ldap->hash_get_domains_ou($ou); $domainsF1 = Field_array_Hash($domains1, 'bogo_spam_domain', null, null, null, 0, 'width:150px'); $type = Field_array_Hash($h_type, 'bogo_type', null, null, null, 0, 'width:100px'); $hash_action = array("delete" => "{bogo_delete}", "quarantine" => "{bogo_quarantine}", "prepend" => "{bogo_prepend}"); $form_email = "\n\t<input type='hidden' id='ou' value='{$ou}'>\n\t<H5>{bogo_robots}</H5>\n\t<table style='width:100%'>\n\t<tr>\n\t<td align='right' nowrap><strong>{add_bogo_spam}:</strong></td>\n\t<td>" . Field_text('bogo_spam') . "</td>\n\t<td>{$domainsF1}</td>\n\t<td>{$type}</td>\n\t<td><input type='button' value='{add} »' OnClick=\"javascript:bogoAddSpamUser();\"></td>\n\t</tr>\n\t</table>\n\t\n\t"; for ($i = 1; $i < 10; $i++) { $h_level[$i . '0'] = $i . '0 %'; } $actions_datas = explode(';', $Hash_datas["BogoFilterAction"]); $action = "\n\t<H5>{spam_action}</H5>\n\t{spam_action_text} " . Field_array_Hash($h_level, 'exceed', $actions_datas[0], null, null, 0, 'width:60px') . " {then} " . Field_array_Hash($hash_action, 'action', $actions_datas[1], null, null, 0, 'width:160px') . "<br><br>\n\t{if_bogo_prepend} " . Field_text('bogo_prepend', $actions_datas[2], 'width:150px') . "\n\t<div style='width:100%;text-align:right'><input type='button' value='{edit} »»' OnClick=\"javascript:BogoFilterAction();\"></div>\n\t\n\t"; $area_robots = "<div id='robots'></div><script>LoadAjax('robots','{$page}?GetRobots={$ou}')</script>"; $area_robots = RoundedLightGrey($area_robots); $action = RoundedLightGrey($action); $form_email = RoundedLightGrey($form_email); $page = CurrentPageName(); $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src='img/bg_bogofilter.jpg'></td>\n\t<td valign='top' width=99%>" . RoundedLightGreen("{bogo_intro}") . "</td>\n\t</tr>\n\t</table>\n\t{$form_email}\n\t<br>\n\t{$action}\n\t<br>\n\t{$area_robots}\n\t"; $cfg["JS"][] = "js/bogofilter.js"; $tpl = new template_users('{APP_BOGOFILTER}', $html, 0, 0, 0, 0, $cfg); echo $tpl->web_page; }
function page_1() { if ($_COOKIE["company"] == null) { $ldap = new clladp(); $orgs = $ldap->hash_get_ou(false); $company = $orgs[0]; } else { $company = $_COOKIE["company"]; } $field_domain = Field_text('smtp_domain', $_COOKIE["smtp_domain"]); if ($_COOKIE["smtp_domain"] == null) { $sock = new sockets(); if ($sock->GET_INFO("MasterSMTPDomainName") == null) { $ldap = new clladp(); $domains = $ldap->hash_get_domains_ou($company); if (is_array($domains)) { $field_domain = Field_array_Hash($domains, 'smtp_domain'); } } else { $field_domain = Field_text('smtp_domain', $sock->GET_INFO("MasterSMTPDomainName")); } } $html = "\n\t<p class=caption>{company_domain}</p>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend nowrap>{company}:</td>\n\t\t<td>" . Field_text('company', $company) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap>{smtp_domain}:</td>\n\t\t<td>{$field_domain}</td>\n\t</tr>\t\n\t</table>\n\t\n\t\n\t\n\t"; echo BuildPage('{company_domain_t}', $html); }
function formulaire() { $users = new usersMenus(); $ldap = new clladp(); $tpl = new templates(); $page = CurrentPageName(); if ($users->AsAnAdministratorGeneric) { $hash = $ldap->hash_get_ou(false); } else { $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1); } if (count($hash) == 1) { $org = $hash[0]; $hash_groups = $ldap->hash_groups($org, 1); $hash_domains = $ldap->hash_get_domains_ou($org); $groups = Field_array_Hash($hash_groups, 'groupid', null, null, null, 0, "font-size:14px;padding:3px"); $domains = Field_array_Hash($hash_domains, 'domain', null, null, null, 0, "font-size:14px;padding:3px"); } $artica = new artica_general(); $EnableVirtualDomainsInMailBoxes = $artica->EnableVirtualDomainsInMailBoxes; while (list($num, $ligne) = each($hash)) { $ous[$ligne] = $ligne; } $ou = Field_array_Hash($ous, 'organization', null, "ChangeFormValues()", null, 0, "font-size:14px;padding:3px"); $form = "\n\t\n\t<input type='hidden' id='EnableVirtualDomainsInMailBoxes' value='{$EnableVirtualDomainsInMailBoxes}'>\n\t<table style='width:100%' class=form>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{organization}:</td>\n\t\t\t<td>{$ou}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{group}:</td>\n\t\t\t<td><span id='select_groups'>{$groups}</span>\n\t\t</tr>\n\t\t<tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{firstname}:</td>\n\t\t\t<td>" . Field_text('firstname', null, 'width:120px;font-size:14px;padding:3px', null, 'ChangeFormValues()') . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{lastname}:</td>\n\t\t\t<td>" . Field_text('lastname', null, 'width:120px;font-size:14px;padding:3px', null, "ChangeFormValues()") . "</td>\n\t\t</tr>\t\t\n\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{email}:</td>\n\t\t\t<td>" . Field_text('email', null, 'width:120px;font-size:14px;padding:3px', null, "ChangeFormValues()") . "@<span id='select_domain'>{$domains}</span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{uid}:</td>\n\t\t\t<td>" . Field_text('login', null, 'width:120px;font-size:14px;padding:3px') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px'>{password}:</td>\n\t\t\t<td>" . Field_password('password', null, "font-size:14px;padding:3px") . "</td>\n\t\t</tr>\t\n\t\t<tr><td colspan=2> </td></tr>\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button("{add}", "SaveAddUser()") . "\n\t\t\t\t\n\t\t\t</td>\n\t\t</tr>\n\t\t\n\t\t</table>\n\t"; $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1%><div id='ffform'><img src='img/identity-add-96.png'></div></td>\n\t\t<td valign='top' width=99%><div>{$form}</div></td>\n\t</tr>\n\t</table>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
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 build_single_instance($ip) { $sql = "SELECT `value`,`ou` FROM postfix_multi WHERE `key`='myhostname' AND `ip_address`='{$ip}'"; $q = new mysql(); $unix = new unix(); $ldap = new clladp(); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); $ou = $ligne["ou"]; $hostname = $ligne["value"]; $main = new maincf_multi($hostname, $ou); echo "Starting......: dkimproxy {$hostname}\n"; $freeport = $main->GET("dkimproxy_listenport"); $array = unserialize(base64_decode($main->GET_BIGDATA("dkimproxy_datas"))); $unix = new unix(); $key = "/etc/dkimproxy/{$hostname}/private.key"; @mkdir("/etc/dkimproxy/{$hostname}", 640, true); if (!is_file($key)) { echo "Starting......: dkimproxy {$hostname} generating public and private key\n"; $openssl = $unix->find_program("openssl"); @mkdir("/etc/dkimproxy/{$hostname}", 640, true); shell_exec("{$openssl} genrsa -out /etc/dkimproxy/{$hostname}/private.key 1024"); shell_exec("{$openssl} rsa -in /etc/dkimproxy/{$hostname}/private.key -pubout -out /etc/dkimproxy/{$hostname}/public.key"); } if ($hostname == "master") { $domains = $ldap->AllDomains(); } else { $domains = $ldap->hash_get_domains_ou($ou); } while (list($dom, $nil) = each($domains)) { $dd[] = $dom; } $conf[] = "# specify what address/port DKIMproxy should listen on"; $conf[] = "listen {$ip}:{$freeport}"; $conf[] = "# specify what address/port DKIMproxy forwards mail to"; $conf[] = "relay {$ip}:33560"; $conf[] = "# specify what domains DKIMproxy can sign for (comma-separated, no spaces)"; $conf[] = "domain " . @implode(",", $dd); $conf[] = "# specify what signatures to add"; $conf[] = "signature dkim(c=relaxed)"; $conf[] = "signature domainkeys(c=nofws)"; $conf[] = "# specify location of the private key"; $conf[] = "keyfile /etc/dkimproxy/{$hostname}/private.key"; $conf[] = "# specify the selector (i.e. the name of the key record put in DNS)"; $conf[] = "selector {$array["selector_name"]}"; $conf[] = "min_servers 5"; $conf[] = "min_spare_servers 2"; $conf[] = ""; echo "Starting......: dkimproxy {$hostname} generating {$hostname}.conf " . count($dd) . " domain(s)\n"; @file_put_contents("/etc/dkimproxy/{$hostname}.conf", @implode("\n", $conf)); }
function INDEX_CREATE() { $ldap = new clladp(); if ($_GET["ou"] == null) { die; } $_GET["ou"] = base64_decode($_GET["ou"]); $hash = $ldap->hash_groups($_GET["ou"], 1); $domains = $ldap->hash_get_domains_ou($_GET["ou"]); if (count($domains) == 0) { $users = new usersMenus(); if ($users->POSTFIX_INSTALLED) { $field_domains = Field_text('user_domain', "{$_GET["ou"]}.com", "width:85px"); } else { if (!preg_match("#(.+?)\\.(.+)#", $_GET["ou"])) { $dom = "{$_GET["ou"]}.com"; } else { $dom = "{$_GET["ou"]}"; } $field_domains = "<code><strong>{$dom}</strong></code>" . Field_hidden('user_domain', "{$dom}", "width:120px"); } } else { $field_domains = Field_array_Hash($domains, 'user_domain', "style:font-size:18px;padding:3px"); } $tpl = new templates(); $hash[null] = "{select}"; $groups = Field_array_Hash($hash, 'group_id', $_GET["gpid"], "style:font-size:18px;padding:3px"); $error_no_password = $tpl->javascript_parse_text("{error_no_password}"); $error_no_userid = $tpl->javascript_parse_text("{error_no_userid}"); $t = time(); $title = "{$_GET["ou"]}:{create_user}"; $step1 = "\n\t<div style='width:98%' class=form>\n\t<table style='width:99%' class='TableRemove' OnMouseOver=\"javascript:HideExplainAll(1)\">\n\t<tr>\n\t<td valign='top' width=1%><img src='img/chiffre1_32.png'></td>\n\t<td valign='top'>\n\t<div style='font-size:18px;font-weight:bold;margin-bottom:5px'>{name_the_new_account_title}:</div>\n\t" . Field_text('new_userid', null, "font-size:18px;padding:3px;font-weight:bold;color:#C80000", null, "UserAutoChange_eMail()", null, false, "UserADDCheck(event)") . "\n\n\t</td>\n\t</tr>\n\t</table></div>"; $step2 = "\n\t<div style='width:98%' class=form>\n\t<table style='width:99%' class='TableRemove' OnMouseOver=\"javascript:HideExplainAll(2)\">\n\t<tr>\n\t<td valign='top' width=1%><img src='img/chiffre2_32.png'></td>\n\t<td valign='top'>\n\t<div style='font-size:18px;font-weight:bold;margin-bottom:5px'>{email}</div><br>\n\t<input type='hidden' name='email' value='' id='email'>\n\t<span id='prefix_email' style='width:90px;border:1px solid #CCCCCC;padding:2px;font-size:18px;font-weight:bold;margin:2px'>\n\t</span>@{$field_domains} \n\t<div style='text-align:right;font-size:14px;'><i><a href='javascript:ChangeAddUsereMail();'>{change}</a></i>\n\t\n\t</td>\n\t</tr>\n\t</table></div>"; $step3 = "\n\t<div style='width:98%' class=form>\n\t<table style='width:99%' class='TableRemove' OnMouseOver=\"javascript:HideExplainAll(4)\">\n\t<tr>\n\t<td valign='top' width=1%><img src='img/chiffre3_32.png'></td>\n\t<td valign='top'>\n\t<div style='font-size:18px;font-weight:bold;margin-bottom:5px'>{password}</div>\n\t" . Field_password("password-{$t}", null, "font-size:18px;padding:3px;width:190px;letter-spacing:3px", null, null, null, false, "UserADDCheck(event)") . "\n\t</td>\n\t</tr>\n\t</table>\n\t</div>\n\t"; $step4 = "\n\t<div style='width:98%' class=form>\n\t<table style='width:99%' class='TableRemove' OnMouseOver=\"javascript:HideExplainAll(3)\">\n\t<tr>\n\t<td valign='top' width=1%><img src='img/chiffre4_32.png'></td>\n\t<td valign='top'>\n\t<div style='font-size:18px;font-weight:bold;margin-bottom:5px'>{group}</div>\n\t<div style='font-size:18px;margin-bottom:5px'>{select_user_group_title}:</div><br>{$groups}\n\t</td>\n\t</tr>\n\t</table></div>\n\t"; if ($_GET["gpid"] > 0) { $step4 = "<input type='hidden' id='group_id' value='{$_GET["gpid"]}'>"; } $html = "\n\t<input type='hidden' id='ou-mem-add-form-user' value='{$_GET["ou"]}'>\n\t<input type='hidden' id='ou' value='{$_GET["ou"]}'>\n\t<div id='adduser_ajax_newfrm' style='margin-top:5px'>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%' class=TableRemove>\n\t<tr>\n\t<td valign='top' style='width:450px;vertical-align:top'>\n\t\t<table style='width:450px'>\n\t\t<tr>\n\t\t\t<td valign='top' width=290px>{$step1}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td valign='top'>{$step2}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td valign='top'><br>{$step3}</td>\n\t\t</tr>\n\t\t\t<td valign='top'><br>{$step4}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'>\n\t\t\t\t<hr>" . button("{add}", "UserADDSubmit()", 26) . "\n\t\t\t</td>\n\t\t</tr>\t\t\t\n\t\t</table>\n\t</td>\n\t<td valign='top' style='width:50%'>\n\t\t\t<center style='margin-bottom:8px'><img src='img/add-woman-256.png'></center>\n\t\t\t<div style='padding-left:10px'>\t\t\n\t\t\t\t<div class=text-info id='text-1' style='font-size:16px'>{name_the_new_account_explain}</div>\n\t\t\t\t<div class=text-info id='text-2' style='font-size:16px'>{user_email_text}</div>\n\t\t\t\t<div class=text-info id='text-3' style='font-size:16px'>{select_user_group_text}</div>\n\t\t\t\t<div class=text-info id='text-4' style='font-size:16px'>{give_password_text}</div>\n\t\t\t</div>\n\t\t\t\n\t</td>\n\t</tr>\t\n\t</table>\n\t</div>\n\t</div>\n\t<input type='hidden' id='flexRTMEM' value='{$_GET["flexRT"]}'>\n\t<script>\n\t\tfunction VerifyFormAddUserCheck(){\n\t\t\tvar pass;\n\t\t\tvar uid;\n\t\t\tpass=document.getElementById('password-{$t}').value;\n\t\t\tuid=document.getElementById('new_userid').value;\n\t\t\tif(uid.length<1){alert('{$error_no_userid}');return false;}\n\t\t\tif(pass.length<1){alert('{$error_no_password}');return false;}\n\t\t\treturn true;\n\t\t\t}\n\t\t\n\t\tfunction UserADDSubmit(){\n\t\t\tif(!VerifyFormAddUserCheck()){return;}\n\t\t\tUserADD{$t}();\n\t\t}\n\t\n\t\n\t\tfunction UserADDCheck(e){\n\t\t\tif(checkEnter(e)){UserADDSubmit();}\n\t\t}\n\t\t\n\t\tfunction HideExplainAll(id){\n\t\t\tdocument.getElementById('text-1').style.display='none';\n\t\t\tdocument.getElementById('text-2').style.display='none';\n\t\t\tdocument.getElementById('text-3').style.display='none';\n\t\t\tdocument.getElementById('text-4').style.display='none'; \n\t\t\tif(document.getElementById('text-'+id)){\n\t\t\t\tdocument.getElementById('text-'+id).style.display='block';\n\t\t\t\t} \n\t\t\t\n\t\t}\n\t\t\nfunction UserADD{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tvar ou=document.getElementById('ou').value;\n\t\tif(ou.length==0){if(document.getElementById('ou-mem-add-form-user')){ou=document.getElementById('ou-mem-add-form-user').value;}}\n\t\tif(ou.length==0){Alert('Unable to stat Organization name (ou field is empty)');return;}\n\t\t\n\t\tXHR.appendData('ou',ou);\n\t\tXHR.appendData('new_userid',document.getElementById('new_userid').value);\n\t\tXHR.appendData('password',document.getElementById('password-{$t}').value);\n\t\tXHR.appendData('group_id',document.getElementById('group_id').value);\n\t\tXHR.appendData('email',document.getElementById('email').value);\n\t\tXHR.appendData('user_domain',document.getElementById('user_domain').value);\n\t\t\n\t\tif(document.getElementById('adduser_ajax_newfrm')){AnimateDiv('adduser_ajax_newfrm');}\n\t\tif(document.getElementById('bglego')){document.getElementById('bglego').src='img/wait_verybig.gif';}\n\t\tif(document.getElementById('member_add_to_wait')){AnimateDiv('member_add_to_wait');}\n\t\tXHR.sendAndLoad('domains.edit.user.php', 'POST',X_UserADD);\t\n\t}\t\t\n\t\n\t\n\t\t\n\t\tHideExplainAll();\n</script>\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function PatchDomains($ou) { $ldap = new clladp(); if ($ldap->ldapFailed) { return null; } if (strtolower($ou) == "default") { return null; } $tbl = explode("\n", @file_get_contents("/etc/opt/kaspersky/kav4lms/groups.d/{$ou}.conf")); while (list($num, $val) = each($tbl)) { if (preg_match("#Recipients=#", $val)) { unset($tbl[$num]); } if (preg_match("#Senders=#", $val)) { unset($tbl[$num]); } } $domains = $ldap->hash_get_domains_ou($ou); if (!is_array($domains)) { @unlink("/etc/opt/kaspersky/kav4lms/groups.d/{$ou}.conf"); } if (is_array($domains)) { while (list($num, $val) = each($domains)) { $num = str_replace('.', '\\.', $num); $arr[] = "Recipients=re:.*{$num}"; } } if (!is_array($arr)) { @unlink("/etc/opt/kaspersky/kav4lms/groups.d/{$ou}.conf"); return; } $arr[] = "Senders="; reset($tbl); while (list($num, $val) = each($tbl)) { if (preg_match("#\\.definition\\]#", $val)) { $tbl[$num] = $tbl[$num] . "\n" . implode("\n", $arr); } } @file_put_contents("/etc/opt/kaspersky/kav4lms/groups.d/{$ou}.conf", implode("\n", $tbl)); }
function INDEX_CREATE() { $ldap = new clladp(); if ($_GET["ou"] == null) { die; } $_GET["ou"] = base64_decode($_GET["ou"]); $hash = $ldap->hash_groups($_GET["ou"], 1); $domains = $ldap->hash_get_domains_ou($_GET["ou"]); if (count($domains) == 0) { $users = new usersMenus(); if ($users->POSTFIX_INSTALLED) { $field_domains = Field_text('user_domain', "{$_GET["ou"]}.com", "width:85px"); } else { if (!preg_match("#(.+?)\\.(.+)#", $_GET["ou"])) { $dom = "{$_GET["ou"]}.com"; } else { $dom = "{$_GET["ou"]}"; } $field_domains = "<code><strong>{$dom}</strong></code>" . Field_hidden('user_domain', "{$dom}", "width:120px"); } } else { $field_domains = Field_array_Hash($domains, 'user_domain'); } $hash[null] = "{select}"; $groups = Field_array_Hash($hash, 'group_id', $_GET["gpid"]); $title = "{$_GET["ou"]}:{create_user}"; $step1 = "<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src='img/chiffre1.png'></td>\n\t<td valign='top'>\n\t<H3>{name_the_new_account_title}</H3><br>\n\t<strong>{name_the_new_account_field}:</strong>\n\t<br>" . Field_text('new_userid', null, null, null, "UserAutoChange_eMail()") . "\n\t<div class=caption>{name_the_new_account_explain}</div>\n\t</td>\n\t</tr>\n\t</table>"; $step2 = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src='img/chiffre2.png'></td>\n\t<td valign='top'>\n\t<H3>{email}</H3><br>\n\t<strong>{email}:</strong>\n\t<br><input type='hidden' name='email' value='' id='email'>\n\t<span id='prefix_email' style='width:90px;border:1px solid #CCCCCC;padding:2px;font-size:11px;font-weight:bold;margin:2px'></span>@{$field_domains} <a href='javascript:ChangeAddUsereMail();'>[{change}]</a>\n\t<div class=caption>{user_email_text}</div>\n\t</td>\n\t</tr>\n\t</table>"; $step3 = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src='img/chiffre3.png'></td>\n\t<td valign='top'>\n\t<H3>{password}</H3><br>\n\t<strong>{give_password}:</strong>\n\t<br>" . Field_password('password') . "\n\t<div class=caption>{give_password_text}</div>\n\t</td>\n\t</tr>\n\t</table>\n\t"; $step4 = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src='img/chiffre4.png'></td>\n\t<td valign='top'>\n\t<H3>{group}</H3><br>\n\t<strong>{select_user_group_title}:</strong>{$groups}\n\t<div class=caption>{select_user_group_text}</div>\n\t</td>\n\t</tr>\n\t</table>\n\t"; if ($_GET["gpid"] > 0) { $step4 = "<input type='hidden' id='group_id' value='{$_GET["gpid"]}'>"; } $html = "\n\t<input type='hidden' id='ou-mem-add-form-user' value='{$_GET["ou"]}'>\n\t<input type='hidden' id='ou' value='{$_GET["ou"]}'>\n\t<div style='float:right'><img src='img/64_bg_lego.png'></div><H1>{$title}</H1>\n\t<p class=caption>{create_user_text}</p>\n\t<div id='adduser_ajax_newfrm'>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>{$step1}</td>\n\t<td valign='top'>{$step2}</td>\n\t</tr>\n\t<tr>\n\t<td valign='top'><br>{$step3}\n\t</td>\n\t<td valign='top'><br>{$step4}</td>\n\t</tr>\n\t<tr>\n\t<td colspan=2>\n\t<hr>\n\t<div style='padding:10px;text-align:right'>\n\t\t" . button("{add}", "UserADD()") . "\n\t\n\t</td>\n\t</tr>\t\t\n\t\n\t</table>\n\t</div>\n\t"; $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 BACKUP_EMAIL_BEHAVIOR_DASHBOARD() { $tpl = new templates(); $ou = $_SESSION["ou"]; @mkdir("/usr/share/artica-postfix/ressources/web/cache_{$ou}", 0755, true); $filebackup = "/usr/share/artica-postfix/ressources/web/cache_{$ou}/BACKUP_EMAIL_BEHAVIOR_DASHBOARD"; if (file_time_min_Web($filebackup) > 30) { $q = new postgres_sql(); $ldap = new clladp(); $domains = $ldap->hash_get_domains_ou($ou); while (list($domain, $MAIN) = each($domains)) { $domain = trim(strtolower($domain)); if ($domain == null) { continue; } $FDOMS[] = "domainto='{$domain}'"; $FDOMS2[] = "domainfrom='{$domain}'"; } $imploded1 = @implode(" OR ", $FDOMS); $imploded2 = @implode(" OR ", $FDOMS2); $sql = "select count(*) as tcount, SUM(size) as size FROM backupmsg WHERE ({$imploded1}) OR ({$imploded2})"; $ligne = pg_fetch_array($q->QUERY_SQL($sql)); @unlink($filebackup); @file_put_contents($filebackup, serialize($ligne)); } $ligne = unserialize(@file_get_contents($filebackup)); $tcount = $ligne["tcount"]; $size = $ligne["size"]; if ($tcount == 0) { echo $tpl->_ENGINE_parse_body("0 {message}"); return; } $size = FormatBytes($size / 1024); $tcount = FormatNumber($tcount); echo $tpl->_ENGINE_parse_body("<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:GotoBackupMails()\"\n\t\tstyle='text-decoration:underline'>{$tcount} {messages}</a> ({$size})"); }
function import() { $ou = $_GET["ou"]; if (is_base64_encoded($ou)) { $ou = base64_decode($ou); } $page = CurrentPageName(); $tpl = new templates(); $ldap = new clladp(); $domains = $ldap->hash_get_domains_ou($ou); $about_this_section = $tpl->_ENGINE_parse_body("{about_this_section}"); $t = $_GET["t"]; $html = "\n\t\n\t<div id='import-task-{$t}'></div>\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'>{domain}:</td>\n\t\t<td>" . Field_array_Hash($domains, "domain", null, null, null, 0, "font-size:16px;padding:3px") . " <a href=\"javascript:blur();\" OnClick=\"javascript:YahooWinBrowse('500','{$page}?about=yes','{$about_this_section}');\" style='font-size:14px;text-decoration:underline'>{$about_this_section}</a></td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:16px'>{file_path}:</td>\n\t\t<td width=99%>" . Field_text("IMPORTATION_FILE_PATH", "", 'width:85%;font-size:16px;padding:3px') . " </td>\n\t\t<td width=1%>" . button("{browse}", "Loadjs('tree.php?select-file=txt&target-form=IMPORTATION_FILE_PATH')", "16px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button("{import_datas}", "MigrationImportDatas()", "18px") . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t<center>\n\t<div id='taskslistMigr' style='height:200px;overflow:auto;margin-top:8px;width:95%' class=form></div>\n\t</center>\n\t\n\t\n\t<script>\n\tvar x_MigrationImportDatas=function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\n\t\tdocument.getElementById('import-task-{$t}').innerHTML='';\n\t\t\$('#flexRT{$t}').flexReload();\n\t\tLoadAjax('taskslistMigr','{$page}?tasks-list=yes&ou={$_GET["ou"]}');\n\t\t\n\t}\t\n\t\n\tfunction MigrationImportDatas(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('IMPORTATION_FILE_PATH',document.getElementById('IMPORTATION_FILE_PATH').value);\n\t\tXHR.appendData('domain',document.getElementById('domain').value);\n\t\tXHR.appendData('ou','{$_GET["ou"]}');\t\t\n\t\tAnimateDiv('import-task-{$t}');\t\n\t\tXHR.sendAndLoad('{$page}', 'GET', x_MigrationImportDatas);\t\t\t \n\t}\n\t\n\tfunction LauchTasks(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('RELAUNCH_TASKS','yes');\n\t\tAnimateDiv('import-task-{$t}');\t\n\t\tXHR.sendAndLoad('{$page}', 'GET', x_MigrationImportDatas);\t\t\t \n\t}\t\n\t\n\tfunction TaskListsRefresh(){\n\t\tLoadAjax('taskslistMigr','{$page}?tasks-list=yes&ou={$_GET["ou"]}');\n\t}\n\t\n\tfunction TaskMigrDelete(ID){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('DELETE_TASK',ID);\n\t\tXHR.appendData('ou','{$_GET["ou"]}');\t\t\n\t\tAnimateDiv('import-task-{$t}');\t\n\t\tXHR.sendAndLoad('{$page}', 'GET', x_MigrationImportDatas);\t\n\t}\n\t\t\n\tfunction ReloadMembers(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('RELOAD_MEMBERS','yes');\n\t\tdocument.getElementById('users-popup-list').innerHTML='<center><img src=img/wait_verybig.gif></center>';\t\n\t\tXHR.sendAndLoad('{$page}', 'GET', x_MigrationImportDatas);\t\t\t\n\t}\t\n\t\n\tfunction RestartMembers(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('RESTART_MEMBERS','yes');\n\t\tXHR.appendData('ou','{$_GET["ou"]}');\t\n\t\tdocument.getElementById('users-popup-list').innerHTML='<center><img src=img/wait_verybig.gif></center>';\t\n\t\tXHR.sendAndLoad('{$page}', 'GET', x_MigrationImportDatas);\t\t\t\n\t}\t\t\n\t\n\t\n\n\t\n\tTaskListsRefresh();\n</script>\n\t\n\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function GRAB_DATAS($ligne, $md5) { $GLOBALS["zMD5"] = $md5; $params = unserialize($ligne["params"]); $influx = new influx(); $mintime = strtotime("2008-01-01 00:00:00"); $params["TO"] = intval($params["TO"]); $params["FROM"] = abs(intval($params["FROM"])); if ($params["FROM"] < $mintime) { $params["FROM"] = strtotime(date("Y-m-d 00:00:00")); } $params["TO"] = intval($params["TO"]); if ($params["TO"] < $mintime) { $params["TO"] = time(); } $influx = new influx(); $ou = $ligne["ou"]; $uid = $ligne["uid"]; $to = $params["TO"]; $from = $params["FROM"]; $interval = $params["INTERVAL"]; $user = $params["USER"]; $md5_table = "{$md5}report"; $search = $params["searchuser"]; echo "SMTP Flow: FROM {$from} to {$to} {$interval} organization:{$ou} user:{$user} {$search}\n"; $table = "smtpstats"; //zdate,mailfrom,domainfrom,mailto,domainto,subject,size,spamscore,spamreport,disclaimer,backuped,infected,filtered,whitelisted,compressed,stripped $sqlSource = null; $TimeGroup = "date_trunc('hour', zdate) as zdate"; $TimeGroupBy = "date_trunc('hour', zdate)"; $distance = $influx->DistanceHour($from, $to); echo "Distance: {$distance} hours\n"; $FilterDate = "(zdate >='" . date("Y-m-d H:i:s", $from) . "' and zdate <= '" . date("Y-m-d H:i:s", $to) . "')"; if ($search == "*") { $search = null; } if ($search != null) { $search = str_replace("*", ".*", $search); $SSEARCH = "WHERE ( (mailfrom ~* '{$search}') OR (mailto ~* '{$search}')"; } if ($ou != null) { $ldap = new clladp(); $domains = $ldap->hash_get_domains_ou($ou); while (list($domain, $MAIN) = each($domains)) { $domain = trim(strtolower($domain)); if ($domain == null) { continue; } echo "Domain: {$domain}\n"; $FDOMS[] = "domainfrom ='{$domain}'"; $FDOMS2[] = "domainto ='{$domain}'"; } $imploded1 = @implode(" OR ", $FDOMS); $imploded2 = @implode(" OR ", $FDOMS2); $sqlSource = "(select count(*) as hits,sum(size) as size,mailfrom,domainfrom,mailto,domainto,{$TimeGroup} FROM smtpstats WHERE {$FilterDate} AND (({$imploded1}) OR ({$imploded2})) GROUP BY mailfrom,domainfrom,mailto,domainto,{$TimeGroupBy} ORDER BY {$TimeGroupBy} ) as t"; $sqlSource = "select * FROM {$sqlSource} {$SSEARCH}"; } if ($sqlSource == null) { $sqlSource = "(select count(*) as hits,sum(size) as size,mailfrom,domainfrom,mailto,domainto,{$TimeGroup} FROM smtpstats WHERE {$FilterDate} GROUP BY mailfrom,domainfrom,mailto,domainto,{$TimeGroupBy} ORDER BY {$TimeGroupBy} ) as t"; $sqlSource = "select * FROM {$sqlSource} {$SSEARCH}"; } $sql = "CREATE TABLE IF NOT EXISTS \"{$md5}report\"\n\t(zdate timestamp,\n\tmailfrom VARCHAR(128),\n\tmailto VARCHAR(128),\n\tdomainfrom VARCHAR(128),\n\tdomainto VARCHAR(128),\t\n\tsize BIGINT,\n\thits BIGINT)"; echo "TEMP:\n{$sql}\n"; $q = new postgres_sql(); $q->QUERY_SQL($sql); if (!$q->ok) { echo "***************\n{$q->mysql_error}\n***************\n"; return false; } $q->QUERY_SQL("TRUNCATE TABLE \"{$md5}report\""); $q->QUERY_SQL("create index zdate{$md5}report on \"{$md5}report\"(zdate);"); $q->QUERY_SQL("create index mailfrom{$md5}report on \"{$md5}report\"(mailfrom,mailto,reason);"); $sql = "INSERT INTO \"{$md5}report\" (hits,size,mailfrom,domainfrom,mailto,domainto,zdate) {$sqlSource}"; echo "{$sql}\n"; build_progress("{step} {waiting_data}: BigData engine, {please_wait}", 6); $postgres = new postgres_sql(); $results = $postgres->QUERY_SQL($sql); if (!$postgres->ok) { echo "ERROR.....\n"; echo "***************\n{$postgres->mysql_error}\n***************\n"; $q->QUERY_SQL("DROP TABLE \"{$md5}report\""); return false; } $sql = "SELECT COUNT(*) AS tcount FROM \"{$md5}report\""; $ligne = pg_fetch_assoc($postgres->QUERY_SQL($sql)); $total = intval($ligne["tcount"]); echo "Members {$total} items inserted to PostGreSQL\n"; if ($total == 0) { $q->QUERY_SQL("DROP TABLE \"{$md5}report\""); return false; } return true; }
function List_entities($echo = 0) { $ldap = new clladp(); $hash = $ldap->hash_get_ou(); if (!is_array($hash)) { return null; } $html = "<center'>\n\t<fieldset><legend>{entities}</legend><table>\n\t<tr class=rowT>\n\t<td> </td>\n\t<td>{entities}</td>\t\n\t<td>{nb_domains}</td>\t\n\t<td> </td>\n\t</tr>\n\t\n\t"; while (list($num, $val) = each($hash)) { if ($class == 'rowB') { $class = 'rowB'; } else { $class = 'rowB'; } $count_domains = 0; $count_domains = count($ldap->hash_get_domains_ou($val)); $html = $html . "<tr class='{$class}'>\n\t\t\t<td width=1%><img src='img/ou.png'></td>\n\t\t\t<td ><a href=\"javascript:ListDomainByEntity('{$val}');\" style='font-size:13px;letter-spacing:3px'>{$val}</td>\n\t\t\t<td ><span style='font-size:13px;letter-spacing:3px'>{$count_domains}</td>\t\t\t\n\t\t\t<td><input type='button' OnClick=\"javascript:AddDomainByEntity('{$val}');\" value='{js_add_domain} »'></td>\n\t\t</tr>"; } $html = $html . "</table></fieldset>"; if ($echo == 1) { $tpl = new templates(); $html = $tpl->_parse_body($html); echo $html; exit; } return $html; }
function formulaire() { $users = new usersMenus(); $ldap = new clladp(); $tpl = new templates(); $page = CurrentPageName(); $TT = time(); $add_new_organisation_text = $tpl->javascript_parse_text("{add_new_organisation_text}"); $lang = null; $t = $_GET["t"]; if ($users->AsAnAdministratorGeneric) { $hash = $ldap->hash_get_ou(false); } else { if ($_GET["ou"] == null) { $hash = $ldap->Hash_Get_ou_from_users($_SESSION["uid"], 1); if (count($hash) == 0) { if (isset($_SESSION["ou"])) { $hash[0] = $_SESSION["ou"]; } } } else { $hash[0] = $_GET["ou"]; if (count($hash) == 0) { if (isset($_SESSION["ou"])) { $hash[0] = $_SESSION["ou"]; } } } } if (count($hash) == 0) { echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{error_no_ou_created}<center style='margin-top:30px'>" . button("{create_a_new_organization}", "Loadjs('organization.js.php?add-ou=yes');", 22) . "</center>")); return; } if (count($hash) == 1) { $org = $hash[0]; $hash_groups = $ldap->hash_groups($org, 1); $hash_domains = $ldap->hash_get_domains_ou($org); $groups = Field_array_Hash($hash_groups, "groupid-{$t}", null, null, null, 0, "font-size:28px;padding:3px"); $domains = Field_array_Hash($hash_domains, "domain-{$t}", null, null, null, 0, "font-size:28px;padding:3px"); } $artica = new artica_general(); $EnableVirtualDomainsInMailBoxes = $artica->EnableVirtualDomainsInMailBoxes; if ($users->ZARAFA_INSTALLED) { $sock = new sockets(); $languages = unserialize(base64_decode($sock->getFrameWork("zarafa.php?locales=yes"))); while (list($index, $data) = each($languages)) { if (preg_match("#cannot set#i", $data)) { continue; } $langbox[$data] = $data; } $ZARAFA_LANG = $sock->GET_INFO("ZARAFA_LANG"); $mailbox_language = Field_array_Hash($langbox, "ZARAFA_LANG-ZARAFA_LANG", $ZARAFA_LANG, "style:font-size:28px;padding:3px"); $lang = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:28px'>{language}:</td>\n\t\t\t\t<td><span id='MAILBOX_ZARAFA_LANG_LIST'>{$mailbox_language}</span>\n\t\t\t\t<div style='float:right;margin-top:5px'>" . button("{build_languages}", "BuildLocalesCreateUser()") . "</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t"; } while (list($num, $ligne) = each($hash)) { $ous[$ligne] = $ligne; } $ouenc = urlencode($_GET["ou"]); $ADMIN = false; if ($users->AsSquidAdministrator) { $ADMIN = true; } if ($users->AsDebianSystem) { $ADMIN = true; } if ($users->AsSystemAdministrator) { $ADMIN = true; } if ($ADMIN) { $add_ou = "<div style='float:right'>" . imgtootltip("32-plus.png", "{create_a_new_organization}", "TreeAddNewOrganisation{$TT}()") . "</div>"; $add_group = "<div style='float:right'>" . imgtootltip("32-plus.png", "{new_group}", "CreateGroup{$TT}()") . "</div>"; } $ou = Field_array_Hash($ous, "organization-{$t}", $_GET["ou"], "ChangeFormValues()", null, 0, "font-size:28px;padding:3px"); $form = "\n\t\n\t<input type='hidden' id='EnableVirtualDomainsInMailBoxes-{$t}' value='{$EnableVirtualDomainsInMailBoxes}'>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{organization}:</td>\n\t\t\t<td>{$add_ou}<span id='ou-{$TT}'></span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{group}:</td>\n\t\t\t<td>{$add_group}<span id='select_groups-{$t}'>{$groups}</span>\n\t\t</tr>\n\t\t<tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{firstname}:</td>\n\t\t\t<td>" . Field_text("firstname-{$t}", null, 'width:531px;font-size:28px;padding:3px', null, 'ChangeFormValues()') . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{lastname}:</td>\n\t\t\t<td>" . Field_text("lastname-{$t}", null, 'width:531px;font-size:28px;padding:3px', null, "ChangeFormValues()") . "</td>\n\t\t</tr>\t\t\n\t\t\t{$lang}\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{email}:</td>\n\t\t\t<td style='font-size:28px'>" . Field_text("email-{$t}", null, 'width:220px;font-size:28px;padding:3px', null, "ChangeFormValues()") . " @ <span id='select_domain-{$t}'>{$domains}</span></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px' nowrap>{uid}:</td>\n\t\t\t<td>" . Field_text("login-{$t}", null, 'width:320px;font-size:28px;padding:3px') . "</td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:28px'>{password}:</td>\n\t\t\t<td>" . Field_password("password-{$t}", null, "font-size:28px;padding:3px", null, null, null, false, "SaveAddUserCheck(event)") . "</td>\n\t\t</tr>\t\n\t\t<tr><td colspan=2> </td></tr>\n\t\t<tr>\n\t\t\t<td colspan=2 align='right' style='padding:10px'><hr>" . button("{add}", "SaveAddUser()", 34) . "\n\t\t\t\t\n\t\t\t</td>\n\t\t</tr>\n\t\t\n\t\t</table>\n\t</div>\n\t"; $html = "<div id='ffform-{$t}'>\n\t<div>{$form}</div>\n\t<script>\n\tvar xTreeAddNewOrganisation{$TT}= function (obj) {\n\t\tvar response=obj.responseText;\n\t\tif(response){alert(response);}\n\t\tOpenOU{$TT}();\n\t\tChangeFormValues();\n\t\t\$('#table-{$t}').flexReload();\n\t}\t\n\t\n\tfunction TreeAddNewOrganisation{$TT}(){\n\t\tvar org=prompt('{$add_new_organisation_text}','');\n\t\tif(!org){return;}\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('TreeAddNewOrganisation',org);\n\t\tXHR.sendAndLoad('domains.php', 'GET',xTreeAddNewOrganisation{$TT});\n\t}\n\t\n\tfunction OpenOU{$TT}(){\n\t\tLoadAjaxSilent('ou-{$TT}','{$page}?ou-field=yes&t={$t}&ou={$ouenc}');\n\t}\n\t\n\tfunction CreateGroup{$TT}(){\n\t\tvar ou=document.getElementById('organization-{$t}').value;\n\t\tLoadjs('domains.edit.group.php?popup-add-group=yes&ou='+ou+'&t={$t}&tt={$_GET["tt"]}&CallBackFunction=ChangeFormValues');\n\t}\n\tOpenOU{$TT}();\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function build_members_xml($ou, $count) { if ($count < 10) { $numero = "0" . "{$count}"; } else { $numero = $count; } $conf[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; $conf[] = "#include <base/group-member.xml.macro>"; $conf[] = "BEGIN_GROUP_MEMBER_LIST(0x000000{$numero})"; $ldap = new clladp(); if ($ldap->ldapFailed) { return null; } $domains = $ldap->hash_get_domains_ou($ou); if (is_array($domains)) { while (list($num, $val) = each($domains)) { $num = "*@{$num}"; $conf[] = "EMAIL_ENTRY(\"{$num}\")"; } } $conf[] = "END_GROUP_MEMBER_LIST"; $conf[] = ""; echo "ou=\"{$ou}\" ({$count})" . count($domains) . " domains in 000000{$numero}-members.xml - {$count}/{$numero}\n"; @file_put_contents("/usr/local/ap-mailfilter3/conf/def/group/000000{$numero}-members.xml", @implode("\n", $conf)); }
function USER_ADD() { $userid = $_GET["new_userid"]; $password = $_GET["password"]; $group_id = $_GET["group_id"]; $tpl = new templates(); $email = $_GET["email"] . "@" . $_GET["user_domain"]; $user = new usersMenus(); if ($user->EnableVirtualDomainsInMailBoxes == 1) { writelogs("Adding change {$userid} to \"{$email}\" in group {$group_id}", __FUNCTION__, __FILE__, __LINE__); $userid = $email; } $users = new user($userid); if ($users->UserExists) { echo $tpl->javascript_parse_text('ERROR: {account_already_exists}'); return false; } writelogs("Adding {$userid} in group {$group_id}", __FUNCTION__, __FILE__, __LINE__); $email = $_GET["email"] . "@" . $_GET["user_domain"]; $ou = $_GET["ou"]; if ($ou == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_ou}')); exit; } if ($userid == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_userid}')); exit; } if ($password == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_password}')); exit; } if ($email == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_email}')); exit; } $ldap = new clladp(); if ($group_id == null) { $default_dn_group = "cn=nogroup,ou={$ou},dc=organizations,{$ldap->suffix}"; if (!$ldap->ExistsDN($default_dn_group)) { $ldap->AddGroup("nogroup", $ou); } $group_id = $ldap->GroupIDFromName($ou, "nogroup"); if ($group_id == null) { $group_id = 0; } } $emT = explode('@', $email); //Verify domains --------------------------------------------------------------- 2008 10 05,P3 $hash_domains_table = $ldap->hash_get_domains_ou($ou); if ($hash_domains_table[$_GET["user_domain"]] == null) { writelogs("{$userid} have no domains", __FUNCTION__, __FILE__, __LINE__); writelogs("Create a new local domain by default", __FUNCTION__, __FILE__, __LINE__); $ldap->AddDomainEntity($ou, $_GET["user_domain"]); } //------------------------------------------------------------------------------ $domains = $ldap->domains_get_locals_domains($ou); $dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}"; if ($ldap->ExistsDN($dn)) { writelogs("{$userid} ({$dn}) already exists", __FUNCTION__, __FILE__, __LINE__); echo $userid; exit; } $users = new user($userid); $users->mail = $email; $users->accountGroup = $group_id; $users->domainname = $_GET["user_domain"]; if ($password != null) { $users->password = $password; } $users->ou = $ou; if ($domains[$_GET["user_domain"]] == true) { writelogs("is a local domain {$_GET["user_domain"]}={$domains[$_GET["user_domain"]]}", __FUNCTION__, __FILE__, __LINE__); $upd["ObjectClass"][] = 'ArticaSettings'; $users->MailboxActive = "TRUE"; } if (!$users->add_user()) { echo "ERROR:" . $users->ldap_error; exit; } if ($group_id > 0) { $ldap->AddUserToGroup($group_id, $users->uid); } echo $users->uid; }
function BuildQuery() { $users = new usersMenus(); $ldap = new clladp(); $tpl = new templates(); $recipient = $_GET["recipient"]; if ($_GET["query"] == '*') { $_GET["query"] = null; } writelogs("recipient={$_GET["recipient"]}", __FUNCTION__, __FILE__); if ($recipient == null) { $recipient = '*'; } if (!$users->AsArticaAdministrator) { writelogs("AsArticaAdministrator=FALSE", __FUNCTION__, __FILE__); if (strpos(" {$recipient}", '*') == 0) { $uid = $ldap->uid_from_email($_GET["recipient"]); if ($uid == null) { return array(false, $tpl->_ENGINE_parse_body('{error_no_user_exists}')); } else { $filter1 = "mailto='{$recipient}'"; } } else { if (!preg_match('#(.+?)@(.+)#', $recipient, $re)) { return array(false, $tpl->_ENGINE_parse_body('{error_bad_recipient_pattern}')); } $domains = $ldap->hash_get_domains_ou($_GET["ou"]); if ($domains[trim($re[2])] == null) { return array(false, $tpl->_ENGINE_parse_body('{error_match_recipient_domain}')); } $re[1] = str_replace('*', '%', $re[1]); $filter1 = "mailto LIKE '{$re[1]}@{$re[2]}'"; } } if ($users->AsPostfixAdministrator) { writelogs("AsArticaAdministrator=TRUE", __FUNCTION__, __FILE__); writelogs("recipient={$_GET["recipient"]}", __FUNCTION__, __FILE__); if (strpos(" {$recipient}", '*') > 0) { $_GET["recipient"] = str_replace('*', '%', $_GET["recipient"]); $filter1 = "mailto LIKE '{$_GET["recipient"]}'"; writelogs("filter={$filter1}", __FUNCTION__, __FILE__); } else { $filter1 = "mailto='{$_GET["recipient"]}'"; } } if ($_GET["limit"] == null) { $limit = 0; } if ($_GET["query"] != null) { $field2 = ",MessageBody,MATCH (MessageBody) AGAINST ('{$_GET["query"]}') AS pertinence"; $ORDER2 = ",pertinence DESC "; } if ($filter1 == "mailto LIKE ''") { $domains = $ldap->hash_get_domains_ou($_GET["ou"]); while (list($num, $ligne) = each($domains)) { $dd[] = "(mailto LIKE '%{$num}')"; } $filter1 = "(" . implode("OR ", $dd) . ")"; } $limit = $_GET["next"] * 100; $sql = "SELECT \n\t\t MessageID,\n\t\t MessageBody,\n\t\t zDate,\n\t\t mailfrom,\n\t\t subject,\n\t\t mailto\n\t\t {$field2}\n\t\t\tFROM `quarantine` WHERE 1\n\t\t\tAND {$filter1}\n\t\t\tORDER BY zDate DESC {$ORDER2} LIMIT {$limit},100"; writelogs($sql, __FUNCTION__, __FILE__); return array(true, $sql); }
function filter2_section() { $sock = new sockets(); $users = new usersMenus(); $SpamAssMilterEnabled = intval($sock->GET_INFO("SpamAssMilterEnabled")); $SpamassassinDelegation = intval($sock->GET_INFO("SpamassassinDelegation")); $MimeDefangEnabled = intval($sock->GET_INFO('MimeDefangEnabled')); $MimeDefangAutoWhiteList = intval($sock->GET_INFO("MimeDefangAutoWhiteList")); $MimeDefangFilterExtensions = intval($sock->GET_INFO("MimeDefangFilterExtensions")); if ($MimeDefangEnabled == 1) { $SpamAssMilterEnabled = 1; } $TTDOMS = array(); $OK_SPAMASS = false; if ($SpamAssMilterEnabled == 1) { if ($SpamassassinDelegation == 1) { $OK_SPAMASS = true; } } if (!$users->MIMEDEFANG_INSTALLED) { $MimeDefangEnabled = 0; } if ($MimeDefangEnabled == 0) { $MimeDefangClamav = 0; $MimeDefangSpamAssassin = 0; $MimeDefangAutoWhiteList = 0; $MimeDefangFilterExtensions = 0; } $AutoWhite_icon = "arrow-right-24.png"; $AutoWhite_color = "#000000"; $AutoWhite_js = "GotoAutoWhite()"; $AutoWhite_text = null; $ExtCheck_icon = "arrow-right-24.png"; $ExtCheck_color = "#000000"; $ExtCheck_js = "GotoMimeDefangExtensions()"; $ExtCheck_text = null; if ($MimeDefangAutoWhiteList == 0) { $AutoWhite_icon = "arrow-right-24-grey.png"; $AutoWhite_color = "#898989"; $AutoWhite_js = "blur()"; $AutoWhite_text = " <span style='font-size:14px'>({disabled})</span>"; } if ($MimeDefangFilterExtensions == 0) { $ExtCheck_icon = "arrow-right-24-grey.png"; $ExtCheck_color = "#898989"; $ExtCheck_js = "blur()"; $ExtCheck_text = " <span style='font-size:14px'>({disabled})</span>"; } if (!$users->MIMEDEFANG_INSTALLED) { $mimedefang_icon = "arrow-right-24-grey.png"; $mimedefang_color = "#898989"; $mimedefang_js = "GotoMessagingSecurityUpdate()"; $mimedefang_text = " <span style='font-size:14px'>({not_installed})</span>"; $AutoWhite_text = " <span style='font-size:14px'>({not_installed})</span>"; $ExtCheck_text = " <span style='font-size:14px'>({not_installed})</span>"; } $ldap = new clladp(); $domains = $ldap->hash_get_domains_ou($_SESSION["ou"]); $ouencoded = urlencode($_SESSION["ou"]); $TTDOMS[] = "<table style='width:100%'>\n\t<tr>\n\t<td valign='middle' style='width:25px'><img src='img/arrow-right-24.png'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:black'>" . texttooltip("{safety_standards}", "position:right:{safety_standards}", "GoToRFCDomain('{$ouencoded}')") . "</td>\n\t</tr></table>"; $TTDOMS[] = "\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td valign='middle' style='width:25px'><img src='img/{$AutoWhite_icon}'></td>\n\t\t\t<td valign='middle' style='font-size:18px;width:99%;color:{$AutoWhite_color}'>" . texttooltip("{smtp_AutoWhiteList}{$AutoWhite_text}", "position:right:{smtp_AutoWhiteList}", $AutoWhite_js) . "</td>\n\t\t</tr>\n\t</table>"; $TTDOMS[] = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='middle' style='width:25px'><img src='img/{$ExtCheck_icon}'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$ExtCheck_color}'>" . texttooltip("{title_mime}{$ExtCheck_text}", "position:right:{mimedefang_attachments_text}", $ExtCheck_js) . "</td>\n\t\t</tr>\n\t</table>"; while (list($num, $ligne) = each($domains)) { $icon = "arrow-right-24.png"; $Color = "#000000"; $js = "GoToAntiSpamsDomain('{$num}')"; $text = null; if (!$OK_SPAMASS) { $icon = "arrow-right-24-grey.png"; $js = "blur()"; $text = " <span style='font-size:14px'>({disabled})</span>"; $Color = "#898989"; } $TTDOMS[] = "<table style='width:100%'>\n\t\t<tr>\n\t<td valign='middle' style='width:25px'>\n\t\t<img src='img/{$icon}'>\n\t</td>\n\t\t<td valign='middle' style='font-size:18px;width:99%;color:{$Color}'>" . texttooltip("Anti-Spam: {$num}{$text}", "{$num}", "{$js}") . "</td>\n\t</tr>\n\t</table>"; } if (count($TTDOMS) > 0) { $final = CompileTr2($TTDOMS); } $tpl = new templates(); echo $tpl->_ENGINE_parse_body($final); }
function ShoweventsORG() { $ldap = new clladp(); $pattern = $_GET["SendQuery"]; $pattern = str_replace('*', '%', $pattern); if (strpos(" {$pattern}", '%') == 0) { $pattern = $pattern . "%"; } if ($_SESSION["RTTM"]["M"][md5($pattern)] != null) { echo $_SESSION["RTTM"]["M"][md5($pattern)]; return; } $hash = $ldap->hash_get_domains_ou($_SESSION["ou"]); if (!is_array($hash)) { return null; } while (list($num, $ligne) = each($hash)) { $sender_domain[] = "(sender_domain='{$num}')"; $sender_domain[] = "(delivery_domain='{$num}')"; } $or = implode(" OR ", $sender_domain); $first = "((delivery_user LIKE '{$pattern}') OR (sender_user LIKE '{$pattern}'))"; $sql = "SELECT * FROM smtp_logs WHERE {$first} AND ({$or}) ORDER BY time_stamp DESC limit 0,100"; $q = new mysql(); $results = $q->QUERY_SQL($sql, 'artica_events'); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $count = $count + 1; $tr = $tr . format_line($ligne); } $tpl = new templates(); $html = $tpl->_parse_body("<table style='width:99%'>{$tr}</table>"); $_SESSION["RTTM"]["M"][md5($pattern)] = $html; echo $html; }
function items() { //1.4.010916 $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new postgres_sql(); $users = new usersMenus(); $search = '%'; $table = "quarmsg"; $page = 1; $FORCE_FILTER = ""; if (!$users->AsPostfixAdministrator) { if ($users->AsMessagingOrg) { $ldap = new clladp(); $domains = $ldap->hash_get_domains_ou($_SESSION["ou"]); while (list($domain, $MAIN) = each($domains)) { $domain = trim(strtolower($domain)); if ($domain == null) { continue; } $FDOMS[] = "domainto='{$domain}'"; $FDOMS2[] = "domainfrom='{$domain}'"; } $imploded1 = @implode(" OR ", $FDOMS); $imploded2 = @implode(" OR ", $FDOMS2); $table = "(select * FROM quarmsg WHERE ({$imploded1}) OR ({$imploded2})) as t"; } } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexPostGresquery(); $sql = "SELECT COUNT(*) as tcount FROM {$table} WHERE {$searchstring}"; $ligne = pg_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["tcount"]; if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$rp} OFFSET {$pageStart}"; $sql = "SELECT * FROM {$table} WHERE {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error); } if (pg_num_rows($results) == 0) { json_error_show("no rule"); } while ($ligne = pg_fetch_assoc($results)) { $id = $ligne["id"]; $color = "#000000"; $ligne["size"] = FormatBytes($ligne["size"] / 1024); $delete = imgsimple("delete-24.png", "", "Loadjs('{$MyPage}?delete-message-js={$id}')"); $urljs = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$MyPage}?zoom-js=yes&id={$id}');\"\n\tstyle='font-size:16px;color:{$color};text-decoration:underline'>"; $data['rows'][] = array('id' => "C{$zmd5}", 'cell' => array("<span style='font-size:16px;color:{$color}'>{$urljs}{$ligne["zdate"]}</a></span>", "<span style='font-size:16px;color:{$color}'>{$urljs}{$ligne["mailfrom"]}</a></span>", "<span style='font-size:16px;color:{$color}'>{$urljs}{$ligne["mailto"]}</a></span>", "<span style='font-size:16px;color:{$color}'>{$urljs}{$ligne["subject"]}</a></span>", "<span style='font-size:16px;color:{$color}'>{$urljs}{$ligne["size"]}</a></span>", "<center style='font-size:16px;color:{$color}'>{$delete}</a></center>")); } echo json_encode($data); }
function popup_add() { $sock = new sockets(); $users = new usersMenus(); $ApacheGroupWarePort = $sock->GET_INFO("ApacheGroupWarePort"); $ApacheGroupWarePortSSL = $sock->GET_INFO("ApacheGroupWarePortSSL"); if (!is_numeric($ApacheGroupWarePortSSL)) { $ApacheGroupWarePortSSL = 443; } $list = listOfAvailableServices(); $ldap = new clladp(); $sock = new sockets(); $domns = $ldap->hash_get_domains_ou($_GET["ou"]); if (count($domns) == 0) { $fqdns = explode(".", $users->fqdn); unset($fqdns[0]); $fqdn = @implode(".", $fqdns); $domns[$fqdn] = $fqdn; } $domns[null] = "{select}"; $domains = Field_array_Hash($domns, "domain", null); $page = CurrentPageName(); $wwwmysqluser_disabled = false; $wwwmysqlpassword_disabled = false; $ip = new networking(); $ips = $ip->ALL_IPS_GET_ARRAY(); $ips[null] = "{select}"; $eth = Field_array_Hash($ips, 'IP'); $title = "{ADD_WEB_SERVICE}"; $button = "{add}"; $img = "www-add-128.png"; $server_row = "<tr>\n\t\t\t\t\t<td class=legend>{www_server_name}:</td>\n\t\t\t\t\t<td>" . Field_text("servername", null, "width:90px;padding:3px;font-size:13px") . " {$domains}</td>\n\t\t\t\t</tr>"; $address_row = "<tr>\n\t\t\t\t\t<td class=legend>{address}:</td>\n\t\t\t\t\t<td>{$eth}</td>\n\t\t\t\t</tr>"; $h = new vhosts(); if ($_GET["host"] != null) { $title = $_GET["host"]; $button = "{apply}"; $LoadVhosts = $h->LoadHost($_GET["ou"], $_GET["host"]); $serv = $LoadVhosts["wwwservertype"]; if ($h->noneeduser["{$serv}"]) { $wwwmysqluser_disabled = true; $wwwmysqlpassword_disabled = true; } if ($h->noneeduser_mysql["{$serv}"]) { } $img = $h->IMG_ARRAY_128[$LoadVhosts["wwwservertype"]]; $list = "<input type='hidden' id='ServerWWWType' name='ServerWWWType' value='{$LoadVhosts["wwwservertype"]}'><i style='font-size:14px'>{$LoadVhosts["wwwservertype"]}</i>"; $server_row = "<tr>\n\t\t\t\t\t<td class=legend>{www_server_name}:</td>\n\t\t\t\t\t<td><strong style='font-size:16px'>{$_GET["host"]}</strong></td>\n\t\t\t\t</tr>"; $address_row = null; $delete = "<tr>\n\t \t\t\t\t\n\t\t\t\t\t<td colspan=2 align='right'>" . button("{delete}", "DelWebService();") . "\n\t\t\t\t</tr>"; } $users_row = "<tr>\n\t\t\t\t\t<td class=legend>{WWWAppliUser}:</td>\n\t\t\t\t\t<td>" . Field_text("WWWAppliUser", $LoadVhosts["wwwappliuser"], 'width:120px;padding:3px;font-size:13px') . "</td>\n\t\t\t\t</tr>"; if ($_GET["host"] != null) { if ($h->noneeduser[$LoadVhosts["wwwservertype"]]) { $users_row = null; } } if ($LoadVhosts["wwwsslmode"] == "TRUE") { $LoadVhosts["wwwsslmode"] = 1; } else { $LoadVhosts["wwwsslmode"] = 0; } $EnablePostfixMultiInstance = $sock->GET_INFO("EnablePostfixMultiInstance"); if ($EnablePostfixMultiInstance == 1) { $q = new mysql(); $sql = "SELECT ipaddr FROM nics_virtuals WHERE org='{$_GET["ou"]}'"; $results = $q->QUERY_SQL($sql, "artica_backup"); $ipssmtp[null] = "{select}"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ipssmtp[trim($ligne["ipaddr"])] = trim($ligne["ipaddr"]); } $ipssmtp["127.0.0.1"] = "127.0.0.1"; $WWWMultiSMTPSender = "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMultiSMTPSender}:</td>\n\t\t\t\t\t<td>" . Field_array_Hash($ipssmtp, "WWWMultiSMTPSender", $LoadVhosts["WWWMultiSMTPSender"], "style:;padding:3px;font-size:13px") . "</td>\n\t\t\t\t</tr>\t"; } if ($h->WWWEnableAddressBook_ENABLED[$LoadVhosts["wwwservertype"]]) { if ($LoadVhosts["WWWEnableAddressBook"] == null) { $LoadVhosts["WWWEnableAddressBook"] = 0; } $WWWEnableAddressBook = "\n\t\t<tr>\n\t\t\t<td class=legend >{roundcube_ldap_directory}:</td>\n\t\t\t<td style='width:170px'>" . Field_checkbox("WWWEnableAddressBook", 1, $LoadVhosts["WWWEnableAddressBook"]) . "</td>\n\t\t</tr>"; } if ($LoadVhosts["wwwservertype"] == "ROUNDCUBE") { if ($_GET["host"] != null) { $hostEncrypt = base64_encode($_GET["host"]); $roundcube_globaladdressBook = "<br><hr>" . Paragraphe("addressbook-64.png", "{global_addressbook}", "{global_addressbook_explain}", "javascript:Loadjs('roundcube.globaladdressbook.php?www={$hostEncrypt}')"); } } if ($LoadVhosts["wwwservertype"] == "SUGAR") { if ($_GET["host"] != null) { $port = $ApacheGroupWarePort; if ($LoadVhosts["wwwsslmode"] == 1) { $port = $ApacheGroupWarePortSSL; } $sugar_warn = "<strong style='color:red'>{SUGAR_WARNING_FINISH_INSTALL}:<br>\n\t\t\t\t<a style='font-size:12px;font-weight:bold;text-decoration:underline' href='http://{$_GET["host"]}:{$ApacheGroupWarePort}/install.php?goto=SilentInstall&cli=true'>http://{$_GET["host"]}:{$ApacheGroupWarePort}/install.php?goto=SilentInstall&cli=true<a>\n\n\t\t\t\t"; } } $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'><img src='img/{$img}'>{$roundcube_globaladdressBook}\n\t\t<td valign='top'>\n\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{service_type}:</td>\n\t\t\t\t\t<td>{$list}</td>\n\t\t\t\t</tr>\n\t\t\t\t{$server_row}\n\t\t\t\t{$address_row}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{https_mode} ({port}:443):</td>\n\t\t\t\t\t<td>" . Field_checkbox("WWWSSLMode", 1, $LoadVhosts["wwwsslmode"]) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$WWWMultiSMTPSender}\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMysqlUser}:</td>\n\t\t\t\t\t<td>" . Field_text("WWWMysqlUser", $LoadVhosts["wwwmysqluser"], 'width:120px;padding:3px;font-size:13px', null, null, null, false, null, $wwwmysqluser_disabled) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMysqlPassword}:</td>\n\t\t\t\t\t<td>" . Field_password("WWWMysqlPassword", $LoadVhosts["wwwmysqlpassword"], 'width:120px;padding:3px;font-size:13px', null, null, null, false, null, $wwwmysqlpassword_disabled) . "</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t{$users_row}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWAppliPassword}:</td>\n\t\t\t\t\t<td>" . Field_password("WWWAppliPassword", $LoadVhosts["wwwapplipassword"], 'width:120px;padding:3px;font-size:13px', null, null, null, false, null, $wwwapplipassword_disabled) . "</td>\n\t\t\t\t</tr>\t\t\n\t\t\t\t{$WWWEnableAddressBook}\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 align='right'><hr>\n\t\t\t\t\t" . button("{$button}", "AddWebService();") . "\n\t\t\t\t</tr>\n\t\t\t\t{$delete}\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 valign='top'>\n\t\t\t\t\t\t{$sugar_warn}\n\t\t\t\t\t\t<div id='wwwInfos'></div>\t\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t\t\n\t\t\t</table>\n\t\t\t\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t\n\t"; if ($h->noneeduser["{$serv}"]) { $script_1 = "\n\t\tif(document.getElementById('WWWAppliUser')){document.getElementById('WWWAppliUser').disabled=true;}\n\t\tif(document.getElementById('WWWAppliPassword')){document.getElementById('WWWAppliPassword').disabled=true;}\n\t\t"; } else { $script_1 = "\n\t\tif(document.getElementById('WWWAppliUser')){document.getElementById('WWWAppliUser').disabled=false;}\n\t\tif(document.getElementById('WWWAppliPassword')){document.getElementById('WWWAppliPassword').disabled=false;}\n\t\t"; } if ($h->noneeduser_mysql["{$serv}"]) { $script_2 = "\n\t\tif(document.getElementById('WWWMysqlUser')){document.getElementById('WWWMysqlUser').disabled=true;}\n\t\tif(document.getElementById('WWWMysqlPassword')){document.getElementById('WWWMysqlPassword').disabled=true;}\n\t\t"; } else { $script_2 = "\n\t\tif(document.getElementById('WWWMysqlUser')){document.getElementById('WWWMysqlUser').disabled=false;}\n\t\tif(document.getElementById('WWWMysqlPassword')){document.getElementById('WWWMysqlPassword').disabled=false;}\n\t\t"; } $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html, 'domains.manage.org.index.php') . "\n\t<script>\n\t\tfunction wwwEnableDisable(){\n\t\t\t{$script_1}\n\t\t\t{$script_2}\n\t\t}\n\t\tsetTimeout('wwwEnableDisable()',1000);\n\t</script>"; }
function Main_page_user($userid) { $ldap = new clladp(); $userarr = $ldap->UserDatas($userid); $hash = $ldap->ReadDNInfos($userarr["dn"]); $hash["ou"] = $userarr["ou"]; $eMailT = explode('@', $array['mail']); $domain = $eMailT[1]; $email = $eMailT[0]; $usermenus = new usersMenus(); $page = CurrentPageName(); if ($nobox == 0) { $leftimg = "<img src='img/folder-user.gif'>"; } //MailboxActive $domains = $ldap->hash_get_domains_ou($hash["ou"]); if (is_array($domains)) { while (list($num, $ligne) = each($domains)) { $fDomains[$ligne] = $ligne; } $domainName = "<tr>\n\t\t\t\t\t<td align='right'><strong>{domainName}:</strong>\n\t\t\t\t\t<td>" . Field_array_Hash($fDomains, 'domainName', $hash["domainName"], null, null, 0, 'width:120px') . "</td>\n\t\t\t\t\t</tr>"; } if ($usermenus->cyrus_imapd_installed == true) { $button_mailboxes = "<input type='button' value='{mailbox settings} »' OnClick=\"javascript:TreeUserMailBoxForm('{$userid}');\" style='margin-right:20px'>"; } if ($hash["displayname"] == null) { $hash["displayname"] = "unknown"; } $html = "\n\t<fieldset>\n\t\n\t\t<legend>{$hash["displayname"]}</legend>\n\t\t<table>\n\t\t\t<tr>\n\t\t\t<td valign='top'>\n\t\t\t\t\n\t\t\t\t<form name='userLdapform'>\n\t\t\t\t<input type='hidden' name='SaveLdapUser' value='yes'>\n\t\t\t\t<input type='hidden' name='dn' value='{$hash["dn"]}'>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><strong>{ou}:</strong>\n\t\t\t\t\t<td>{$hash["ou"]}</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><strong>{firstname}:</strong>\n\t\t\t\t\t<td>" . Field_text('givenname', $hash["givenname"]) . "</td>\n\t\t\t\t\t</tr>\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><strong>{lastname}:</strong>\n\t\t\t\t\t<td>" . Field_text('sn', $hash["sn"], 'width:98%', null, 'user_autofill();') . "</td>\n\t\t\t\t\t</tr>\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><strong>{DisplayName}:</strong>\n\t\t\t\t\t<td>" . Field_text('displayname', $hash["displayname"]) . "</td>\n\t\t\t\t\t</tr>\t\n\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><strong>{email}:</strong>\n\t\t\t\t\t<td>" . Field_text('mail', $hash["mail"]) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><strong>{sender_canonical}:</strong>\n\t\t\t\t\t<td>" . Field_text('SenderCanonical', $hash["sendercanonical"]) . "</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t{$domainName}\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><strong>{userid}:</strong>\n\t\t\t\t\t<td>" . Field_text('uid', $hash["uid"]) . "</td>\n\t\t\t\t\t</tr>\t\n\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><strong>{password}:</strong>\n\t\t\t\t\t<td>" . Field_password("userpassword", $hash["userpassword"]) . "</td>\n\t\t\t\t\t</tr>\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><strong>{MailboxActive}:</strong>\n\t\t\t\t\t<td>" . Field_TRUEFALSE_checkbox_img('MailboxActive', $hash["mailboxactive"]) . "</td>\n\t\t\t\t\t</tr>\t\t\t\t\t\t\t\n\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\n\t\t\t\t\t<td align='right' colspan=2 ><input type='button' value='{submit} »' OnClick=\"javascript:ParseForm('userLdapform','{$page}',true);\"></td>\n\t\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t</table>\n\t\t\t\t</form>\t\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t</fieldset>"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }
function USER_ADD() { $userid = $_REQUEST["new_userid"]; $password = $_REQUEST["password"]; $group_id = $_REQUEST["group_id"]; if (isset($_GET["encpass"])) { $password = url_decode_special_tool($password); } $ou = $_REQUEST["ou"]; $tpl = new templates(); if (preg_match("#(.+?)@(.+)#", $_REQUEST["email"], $re)) { $_REQUEST["user_domain"] = $re[2]; $_REQUEST["email"] = $re[1]; } $email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"]; $email = strtolower($email); $user = new usersMenus(); if ($user->EnableVirtualDomainsInMailBoxes == 1) { writelogs("Adding change {$userid} to \"{$email}\" in group {$group_id}", __FUNCTION__, __FILE__, __LINE__); $userid = $email; } if (is_numeric($group_id)) { $gp = new groups($group_id); writelogs("privileges: {$group_id} -> AsComplexPassword = \"{$gp->Privileges_array["AsComplexPassword"]}\"", __FUNCTION__, __FILE__, __LINE__); if ($gp->Privileges_array["AsComplexPassword"] == "yes") { $ldap = new clladp(); $hash = $ldap->OUDatas($ou); $privs = $ldap->_ParsePrivieleges($hash["ArticaGroupPrivileges"], array(), true); $policiespwd = unserialize(base64_decode($privs["PasswdPolicy"])); if (is_array($policiespwd)) { $priv = new privileges(); if (!$priv->PolicyPassword($password, $policiespwd)) { return false; } } } else { writelogs("privileges: {$group_id} -> AsComplexPassword = \"No\" -> continue", __FUNCTION__, __FILE__, __LINE__); } } $users = new user($userid); if ($users->UserExists) { echo $tpl->javascript_parse_text('ERROR: {account_already_exists}'); return false; } writelogs("Adding {$userid} in group {$group_id}", __FUNCTION__, __FILE__, __LINE__); $email = $_REQUEST["email"] . "@" . $_REQUEST["user_domain"]; if ($ou == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_ou}')); exit; } if ($userid == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_userid}')); exit; } if ($password == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_password}')); exit; } if ($email == null) { echo html_entity_decode($tpl->javascript_parse_text('ERROR:{error_no_email}')); exit; } $ldap = new clladp(); if (!is_numeric($group_id)) { writelogs("Groupid is not numeric", __FUNCTION__, __FILE__, __LINE__); $default_dn_group = "cn=nogroup,ou={$ou},dc=organizations,{$ldap->suffix}"; if (!$ldap->ExistsDN($default_dn_group)) { $ldap->AddGroup("nogroup", $ou); } $group_id = $ldap->GroupIDFromName($ou, "nogroup"); if (!is_numeric($group_id)) { $group_id = 0; } } $emT = explode('@', $email); //Verify domains --------------------------------------------------------------- 2008 10 05,P3 $hash_domains_table = $ldap->hash_get_domains_ou($ou); if (!isset($hash_domains_table[$_REQUEST["user_domain"]])) { writelogs("{$userid} have no domains", __FUNCTION__, __FILE__, __LINE__); writelogs("Create a new local domain by default", __FUNCTION__, __FILE__, __LINE__); $ldap->AddDomainEntity($ou, $_REQUEST["user_domain"]); } //------------------------------------------------------------------------------ $domains = $ldap->domains_get_locals_domains($ou); $dn = "cn={$userid},ou={$ou},dc=organizations,{$ldap->suffix}"; if ($ldap->ExistsDN($dn)) { writelogs("{$userid} ({$dn}) already exists", __FUNCTION__, __FILE__, __LINE__); echo $userid; exit; } $users = new user($userid); $users->mail = $email; $users->accountGroup = $group_id; $users->domainname = $_REQUEST["user_domain"]; if ($password != null) { $users->password = $password; } $users->ou = $ou; if ($domains[$_REQUEST["user_domain"]] == true) { $upd = array(); writelogs("is a local domain {$_REQUEST["user_domain"]}={$domains[$_REQUEST["user_domain"]]}", __FUNCTION__, __FILE__, __LINE__); $upd["ObjectClass"][] = 'ArticaSettings'; $users->MailboxActive = "TRUE"; } if (!$users->add_user()) { echo "ERROR: add_user(): " . $users->ldap_error . "\n" . basename(__FILE__) . "\nLine:" . __LINE__; exit; } writelogs("Success adding user, now, add user {$users->uid} to group {$group_id} ", __FUNCTION__, __FILE__, __LINE__); if ($group_id > 0) { $ldap->AddUserToGroup($group_id, $users->uid); } echo $users->uid; }
function graph3_ou() { include_once dirname(__FILE__) . "/ressources/class.postgres.inc"; $page = CurrentPageName(); $ldap = new clladp(); $domains = $ldap->hash_get_domains_ou($_SESSION["ou"]); $StartTime = date("Y-m-d H:i:s", strtotime("-24 hours")); while (list($domain, $MAIN) = each($domains)) { $domain = trim(strtolower($domain)); if ($domain == null) { continue; } //$FDOMS[]="domainto = '$domain'"; $FDOMS2[] = "mailto LIKE '%{$domain}'"; } //$imploded1=@implode(" OR ", $FDOMS); $imploded2 = @implode(" OR ", $FDOMS2); $sql = "select date_trunc('hour', zdate) as zdate,COUNT(*) as tcount FROM smtprefused WHERE\n\tzdate >'{$StartTime}' AND ({$imploded2}) GROUP BY date_trunc('hour', zdate) ORDER BY zdate"; $q = new postgres_sql(); $results = $q->QUERY_SQL($sql); if (!$q->ok) { die; } while ($ligne = pg_fetch_assoc($results)) { $x[] = $ligne["zdate"]; $y[] = $ligne["tcount"]; } $tpl = new templates(); $title = "{rejected} {from} {$StartTime}"; $timetext = "{hours}"; $highcharts = new highcharts(); $highcharts->container = "graph3-dashboard"; $highcharts->xAxis = $x; $highcharts->Title = $title; $highcharts->TitleFontSize = "22px"; $highcharts->AxisFontsize = "12px"; $highcharts->yAxisTtitle = "{messages}"; $highcharts->xAxis_labels = false; $highcharts->LegendPrefix = $tpl->javascript_parse_text('{date}: '); $highcharts->LegendSuffix = "Mails"; $highcharts->xAxisTtitle = $timetext; $highcharts->datas = array("{messages}" => $y); echo $highcharts->BuildChart(); //echo "\nLoadjs('$page?graph3=yes');\n"; }
function USER_ALIASES_FORM_ADD() { $t = $_GET["t"]; $userid = $_GET["USER_ALIASES_FORM_ADD"]; $ldap = new clladp(); $user = new user($userid); $domains = $ldap->hash_get_domains_ou($user->ou); $user_domains = Field_array_Hash($domains, 'user_domain', null, null, null, 0, 'font-size:18px;padding:3px'); $form_catech_all = $form_add = "\n\t\t\t\t<div id='{$t}-div'></div>\n\t\t\t\t<div style='width:98%' class=form>\n \t\t\t<table style='width:99%;'>\n \t\t\t\t<tr>\n \t\t\t\t\t<td nowrap colspan=2><strong style='font-size:18px;'>{add_new_alias}:«{in_the_same_organization}»</strong></td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td valign='top'>\n\t \t\t\t\t\t<table>\n\t \t\t\t\t\t\t<tr>\n\t \t\t\t\t\t\t\t<td>" . Field_text('aliases', null, 'width:150px;font-size:18px;padding:3px', null, null, null, false, "AddNewAliasesCheckEnter{$t}(event)") . "</td>\n\t \t\t\t\t\t\t\t<td width=1%><strong style='font-size:18px;'>@</strong></td>\n\t \t\t\t\t\t\t\t<td width=99% align='left'>{$user_domains}</td>\n\t \t\t\t\t\t\t</tr>\n\t \t\t\t\t\t</table>\n \t\t\t\t\t</td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t\t<td nowrap colspan=2> </td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t<td nowrap colspan=2><strong style='font-size:18px;'>\n \t\t\t\t\t{add_new_alias}:«{out_of_organization}»</strong></td>\n \t\t\t</tr>\n \t\t\t<tr>\n \t\t\t\t<td valign='top'>\n\t \t\t\t\t\t<table>\n\t \t\t\t\t\t\t<tr>\n\t \t\t\t\t\t\t\t<td>" . Field_text('fullaliase', null, 'width:350px;font-size:22px;padding:3px', null, null, null, false, "AddNewAliasesCheckEnter{$t}(event)") . "</td>\n\t \t\t\t\t\t\t</tr>\n\t \t\t\t\t\t</table>\n \t\t\t\t</td>\n \t\t\t</tr> \t\t\t\t\n \t\t\t\t<tr>\n \t\t\t\t\t<td colspan=2 align='right'><hr>\n \t\t\t\t\t" . button("{add}", "AddNewAliases{$t}('{$userid}');", "26px") . "\n \t\t\t\t\t\t\n \t\t\t\t\t\t\n \t\t\t\t\t</td>\n \t\t\t</tr>\n \t\t\t\t \t\t\t\n \t\t\t</table>"; $html = "\n<div class=explain style='font-size:16px'>{aliases_text}: «<b>{$user->mail}»</b></div>\n{$form_add}\n\n\n\n<script>\n\tfunction AddNewAliasesCheckEnter{$t}(e){\n\t\tif(!checkEnter(e)){return;}\n\t\tAddNewAliases{$t}();\n\t}\n\t\n\tvar x_AddNewAliasesUser{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tdocument.getElementById('{$t}-div').innerHTML='';\n\t\tif(results.length>0){alert(results);return;}\n\t\tYahooWin5Hide();\n\t\t\$('#flexRT{$t}').flexReload();\n\t}\t\t\n\t\n\t\t\n\tfunction AddNewAliases{$t}(){\n\t\tvar uid='{$_GET["USER_ALIASES_FORM_ADD"]}';\n\t\tm_userid=uid;\n\t\tAnimateDiv('{$t}-div');\n\t\tvar aliase=document.getElementById('aliases').value;\n\t\tvar aliase_domain=document.getElementById('user_domain').value;\n\t\tvar fullaliase=document.getElementById('fullaliase').value;\n\t\taliase=aliase+'@'+aliase_domain;\n\t\tif(fullaliase.length>0){aliase=fullaliase;}\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('AddAliases',uid);\n\t\tXHR.appendData('aliase',aliase);\n\t\tXHR.sendAndLoad('domains.edit.user.php', 'GET',x_AddNewAliasesUser{$t});\n\t\t}\t\n\t\n\t\n</script>\n"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function items() { //1.4.010916 $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $search = '%'; $table = "mimedefang_disclaimer"; $database = "artica_backup"; $page = 1; $FORCE_FILTER = ""; if (!$users->AsPostfixAdministrator) { if ($users->AsMessagingOrg) { $ldap = new clladp(); $domains = $ldap->hash_get_domains_ou($_SESSION["ou"]); while (list($domain, $MAIN) = each($domains)) { $domain = trim(strtolower($domain)); if ($domain == null) { continue; } $FDOMS[] = "mailto LIKE '%{$domain}'"; $FDOMS2[] = "mailfrom LIKE '%{$domain}'"; } $imploded1 = @implode(" OR ", $FDOMS); $imploded2 = @implode(" OR ", $FDOMS2); $table = "(select * FROM mimedefang_disclaimer WHERE ({$imploded1}) OR ({$imploded2})) as t"; } } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, $database); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error); } if (mysql_num_rows($results) == 0) { json_error_show("no rule"); } while ($ligne = mysql_fetch_assoc($results)) { $zmd5 = $ligne["zmd5"]; $color = "black"; $delete = imgsimple("delete-24.png", "", "DeleteDisclaimer{$t}('{$zmd5}')"); $urljs = "<a href=\"javascript:blur();\" OnClick=\"javascript:GItem{$t}('{$zmd5}','{$ligne["mailfrom"]} » {$ligne["mailto"]}');\"\n\tstyle='font-size:22px;color:{$color};text-decoration:underline'>"; $data['rows'][] = array('id' => "{$zmd5}", 'cell' => array("<span style='font-size:22px;color:{$color}'>{$urljs}{$ligne["mailfrom"]}</a></span>", "<span style='font-size:22px;color:{$color}'>{$urljs}{$ligne["mailto"]}</a></span>", "<center style='font-size:16px;color:{$color}'>{$delete}</a></center>")); } echo json_encode($data); }
function popup_add() { $list = listOfAvailableServices(); $ldap = new clladp(); $sock = new sockets(); $domns = $ldap->hash_get_domains_ou($_GET["ou"]); $domns[null] = "{select}"; $domains = Field_array_Hash($domns, "domain", null); $wwwmysqluser_disabled = false; $wwwmysqlpassword_disabled = false; $ip = new networking(); $ips = $ip->ALL_IPS_GET_ARRAY(); $ips[null] = "{select}"; $eth = Field_array_Hash($ips, 'IP'); $title = "{ADD_WEB_SERVICE}"; $button = "{add}"; $img = "www-add-128.png"; $server_row = "<tr>\n\t\t\t\t\t<td class=legend>{www_server_name}:</td>\n\t\t\t\t\t<td>" . Field_text("servername", null, "width:90px") . " {$domains}</td>\n\t\t\t\t</tr>"; $address_row = "<tr>\n\t\t\t\t\t<td class=legend>{address}:</td>\n\t\t\t\t\t<td>{$eth}</td>\n\t\t\t\t</tr>"; $h = new vhosts(); if ($_GET["host"] != null) { $title = $_GET["host"]; $button = "{edit}"; $LoadVhosts = $h->LoadHost($_GET["ou"], $_GET["host"]); $serv = $LoadVhosts["wwwservertype"]; if ($h->noneeduser["{$serv}"]) { $wwwmysqluser_disabled = true; $wwwmysqlpassword_disabled = true; } if ($h->noneeduser_mysql["{$serv}"]) { } $img = $h->IMG_ARRAY_128[$LoadVhosts["wwwservertype"]]; $list = "<input type='hidden' id='ServerWWWType' name='ServerWWWType' value='{$LoadVhosts["wwwservertype"]}'>{$LoadVhosts["wwwservertype"]}"; $server_row = "<tr>\n\t\t\t\t\t<td class=legend>{www_server_name}:</td>\n\t\t\t\t\t<td><strong>{$_GET["host"]}</strong></td>\n\t\t\t\t</tr>"; $address_row = null; $delete = "<tr>\n\t \t\t\t\t\n\t\t\t\t\t<td colspan=2 align='right'>" . button("{delete}", "DelWebService();") . "\n\t\t\t\t</tr>"; } $users_row = "<tr>\n\t\t\t\t\t<td class=legend>{WWWAppliUser}:</td>\n\t\t\t\t\t<td>" . Field_text("WWWAppliUser", $LoadVhosts["wwwappliuser"], 'width:120px') . "</td>\n\t\t\t\t</tr>"; if ($_GET["host"] != null) { if ($h->noneeduser[$LoadVhosts["wwwservertype"]]) { $users_row = null; } } if ($LoadVhosts["wwwsslmode"] == "TRUE") { $LoadVhosts["wwwsslmode"] = 1; } else { $LoadVhosts["wwwsslmode"] = 0; } $EnablePostfixMultiInstance = $sock->GET_INFO("EnablePostfixMultiInstance"); if ($EnablePostfixMultiInstance == 1) { $q = new mysql(); $sql = "SELECT ipaddr FROM nics_virtuals WHERE org='{$_GET["ou"]}'"; $results = $q->QUERY_SQL($sql, "artica_backup"); $ipssmtp[null] = "{select}"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $ipssmtp[trim($ligne["ipaddr"])] = trim($ligne["ipaddr"]); } $ipssmtp["127.0.0.1"] = "127.0.0.1"; $WWWMultiSMTPSender = "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMultiSMTPSender}:</td>\n\t\t\t\t\t<td>" . Field_array_Hash($ipssmtp, "WWWMultiSMTPSender", $LoadVhosts["WWWMultiSMTPSender"]) . "</td>\n\t\t\t\t</tr>\t"; } if ($h->WWWEnableAddressBook_ENABLED[$LoadVhosts["wwwservertype"]]) { if ($LoadVhosts["WWWEnableAddressBook"] == null) { $LoadVhosts["WWWEnableAddressBook"] = 1; } $WWWEnableAddressBook = "\n\t\t<tr>\n\t\t\t<td class=legend >{roundcube_ldap_directory}:</td>\n\t\t\t<td style='width:170px'>" . Field_checkbox("WWWEnableAddressBook", 1, $LoadVhosts["WWWEnableAddressBook"]) . "</td>\n\t\t</tr>"; } $html = "<H1>{$title}</H1>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'><img src='img/{$img}'>\n\t\t<td valign='top'>\n\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{service_type}:</td>\n\t\t\t\t\t<td>{$list}</td>\n\t\t\t\t</tr>\n\t\t\t\t{$server_row}\n\t\t\t\t{$address_row}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{https_mode} ({port}:443):</td>\n\t\t\t\t\t<td>" . Field_checkbox("WWWSSLMode", 1, $LoadVhosts["wwwsslmode"]) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t{$WWWMultiSMTPSender}\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMysqlUser}:</td>\n\t\t\t\t\t<td>" . Field_text("WWWMysqlUser", $LoadVhosts["wwwmysqluser"], 'width:120px', null, null, null, false, null, $wwwmysqluser_disabled) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWMysqlPassword}:</td>\n\t\t\t\t\t<td>" . Field_password("WWWMysqlPassword", $LoadVhosts["wwwmysqlpassword"], null, null, null, null, false, null, $wwwmysqlpassword_disabled) . "</td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t{$users_row}\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=legend>{WWWAppliPassword}:</td>\n\t\t\t\t\t<td>" . Field_password("WWWAppliPassword", $LoadVhosts["wwwapplipassword"], null, null, null, null, false, null, $wwwapplipassword_disabled) . "</td>\n\t\t\t\t</tr>\t\t\n\t\t\t\t{$WWWEnableAddressBook}\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 align='right'><hr>\n\t\t\t\t\t" . button("{$button}", "AddWebService();") . "\n\t\t\t\t</tr>\n\t\t\t\t{$delete}\t\t\t\t\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 valign='top'>\n\t\t\t\t\t\t<div id='wwwInfos'></div>\t\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t\t\n\t\t\t</table>\n\t\t\t\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t\n\t"; if ($h->noneeduser["{$serv}"]) { $script_1 = "\n\t\tif(document.getElementById('WWWAppliUser')){document.getElementById('WWWAppliUser').disabled=true;}\n\t\tif(document.getElementById('WWWAppliPassword')){document.getElementById('WWWAppliPassword').disabled=true;}\n\t\t"; } else { $script_1 = "\n\t\tif(document.getElementById('WWWAppliUser')){document.getElementById('WWWAppliUser').disabled=false;}\n\t\tif(document.getElementById('WWWAppliPassword')){document.getElementById('WWWAppliPassword').disabled=false;}\n\t\t"; } if ($h->noneeduser_mysql["{$serv}"]) { $script_2 = "\n\t\tif(document.getElementById('WWWMysqlUser')){document.getElementById('WWWMysqlUser').disabled=true;}\n\t\tif(document.getElementById('WWWMysqlPassword')){document.getElementById('WWWMysqlPassword').disabled=true;}\n\t\t"; } else { $script_2 = "\n\t\tif(document.getElementById('WWWMysqlUser')){document.getElementById('WWWMysqlUser').disabled=false;}\n\t\tif(document.getElementById('WWWMysqlPassword')){document.getElementById('WWWMysqlPassword').disabled=false;}\n\t\t"; } $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html, 'domains.manage.org.index.php') . "\n\t<script>\n\t\tfunction wwwEnableDisable(){\n\t\t\t{$script_1}\n\t\t\t{$script_2}\n\t\t}\n\t\tsetTimeout('wwwEnableDisable()',1000);\n\t</script>"; }
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 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 FILL_MEM_LOCAL_DOMAINS($ou) { $ldap = new clladp(); $domains = $ldap->hash_get_domains_ou($ou); while (list($num, $ligne) = each($domains)) { if (trim($ligne) == null) { continue; } $GLOBALS["MEM_DOMAINS"][$ou][] = $ligne; } }