function popup() { $ou = $_GET["ou"]; $t = $_GET["t"]; $ldap = new clladp(); $tpl = new templates(); $page = CurrentPageName(); if (!is_numeric($t)) { $t = time(); } $EnCryptedFunction = $_GET["EnCryptedFunction"]; if (strlen($EnCryptedFunction) > 3) { $EnCryptedFunction = base64_decode($EnCryptedFunction) . "\n"; } else { $EnCryptedFunction = null; } if ($ou == null) { if (isAdmin()) { $OUS = $ldap->hash_get_ou(true); $FieldOu = Field_array_Hash($OUS, "ou-{$t}", null, null, null, 0, "font-size:18px"); } else { $FieldOu = Field_hidden("ou-{$t}", $_SESSION["ou"]) . "<span style='font-size:18px'>{$_SESSION["ou"]}</span>"; } } else { $FieldOu = Field_hidden("ou-{$t}", $ou) . "<span style='font-size:18px'>{$_SESSION["ou"]}</span>"; } $html = "\n\t\t\t\n\t<div id='animate-{$t}'></div>\t\t\n\t<table style='width:98%' class=form>\n\t\t<tr>\n\t\t <td class=legend style='font-size:18px'>{domain}:</td>\n\t\t <td>" . Field_text("domain-{$t}", null, "font-size:18px;font-weigth:bold", null, null, null, false, "AddDomainCk{$t}(event)") . "</td>\n\t\t</tr>\n\t\t<td class=legend style='font-size:18px'>{organization}:</td> \t\t\n\t\t <td>{$FieldOu}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'>" . button("{add}", "AddDomain{$t}()", "20px") . "</td>\n\t\t</tr>\n\t</table>\n\t\t\t\t\t\n<script>\nvar x_AddDomain{$t}=function(obj){\n\tdocument.getElementById('animate-{$t}').innerHTML='';\n\tvar text;\n\ttext=obj.responseText;\n\tif(text.length>3){alert(text);return;}\n\t\$('#flexRT{$t}').flexReload();\n\tYahooUserHide();\n\t{$EnCryptedFunction}\n\t\n\t\n}\n\nfunction AddDomainCk{$t}(e){\n\tif(checkEnter(e)){ AddDomain{$t}();}\n}\n\nfunction AddDomain{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('perform','yes');\n\tvar ou=document.getElementById('ou-{$t}').value;\n\tif(ou.length<3){alert('Organization:`'+ou+'` not supported');return;}\n\tXHR.appendData('ou',document.getElementById('ou-{$t}').value);\n\tXHR.appendData('domain',document.getElementById('domain-{$t}').value);\n\tAnimateDiv('animate-{$t}');\n\tXHR.sendAndLoad('{$page}', 'POST',x_AddDomain{$t}); \n}\n</script>\t\t\t\t\t\n"; echo $tpl->_ENGINE_parse_body($html); }
function popup() { $tpl = new templates(); $t = $_GET["t"]; $page = CurrentPageName(); $ldap = new clladp(); if (!isset($_GET["ou"])) { $_GET["ou"] = null; } if ($_GET["ou"] == null) { $title = "OpenLDAP"; $ous = $ldap->hash_get_ou(true); } else { $title = $_GET["ou"]; $ous[$title] = true; } $style = " OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\""; $organization = $tpl->_ENGINE_parse_body("{organization}"); $f[] = "<ul id='root-{$t}' class='jqueryFileTree'>"; $f[] = "<li class=root>Root: {$title}"; $f[] = "<ul id='mytree-{$t}' class='jqueryFileTree'>"; while (list($ou, $ligne) = each($ous)) { $CLASS = "directory"; $id = md5($ou); $js = texttooltip("{$organization} {$ou}", $ou, "TreeOuExpand{$t}('{$id}','{$ou}');"); $f[] = "<li class={$CLASS} collapsed id='{$id}' {$style}>{$js}</li>"; } $f[] = "</ul>"; $f[] = "</li>"; $f[] = "</ul>"; $f[] = "<script>\nvar mem_id{$t}='';\nvar mem_path{$t}='';\n\nvar xTreeOuExpand{$t}= function (obj) {\n\tvar results=obj.responseText;\n\t\$('#'+mem_id{$t}).removeClass('collapsed');\n\tif(\$('#'+mem_id{$t}).hasClass('directorys')){\$('#'+mem_id{$t}).addClass('expandeds');}\n\tif(\$('#'+mem_id{$t}).hasClass('directory')){\$('#'+mem_id{$t}).addClass('expanded');}\n\t\$('#'+mem_id{$t}).append(results);\n}\n\n\tfunction TreeOuExpand{$t}(id,ou){\n\t\tmem_id{$t}=id;\n\t\tmem_path{$t}=ou;\n\t\tvar expanded=false;\n\t\tif(\$('#'+mem_id{$t}).hasClass('expanded')){expanded=true;}\n\t\tif(!expanded){if(\$('#'+mem_id{$t}).hasClass('expandeds')){expanded=true;}}\n\t\t\t\n\t\tif(!expanded){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('browse-ou',ou);\n\t\t\tXHR.appendData('function','{$_GET["function"]}');\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',xTreeOuExpand{$t});\n\t\t}else{\n\t\t\t\$('#'+mem_id{$t}).children('ul').empty();\n\t\t\tif(\$('#'+mem_id{$t}).hasClass('expanded')){\$('#'+mem_id{$t}).removeClass('expanded');}\n\t\t\tif(\$('#'+mem_id{$t}).hasClass('expandeds')){\$('#'+mem_id{$t}).removeClass('expandeds');}\n\t\t\t\$('#'+mem_id{$t}).addClass('collapsed');\n\t\n\t\t}\n\t}\n\t\n\t\t\n</script>"; echo @implode("\n", $f); }
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 page() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $ldap = new clladp(); $t = time(); $ImportAdSettings = unserialize($sock->GET_INFO("ZarafaImportADSettings")); $OUS = $ldap->hash_get_ou(true); $html = "\n\t<div style='font-size:30px;margin-bottom:20px'>{active_directory_importation}</div>\n\t<div style='font-size:22px' class=explain>{active_directory_importation_contacts_explain}</div>\n\t\n\t\n\t\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{organization}:</td>\n\t\t<td>" . Field_array_Hash($OUS, "ADOU", $ImportAdSettings["ADOU"], "style:font-size:22px;") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{activedirectory_server}:</td>\n\t\t<td>" . Field_text("ADSERVERNAME", $ImportAdSettings["ADSERVERNAME"], "font-size:22px;padding:3px;width:250px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{suffix}:</td>\n\t\t<td>" . Field_text("LDAP_SUFFIX", $ImportAdSettings["LDAP_SUFFIX"], "font-size:22px;padding:3px;width:580px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{username}:</td>\n\t\t<td>" . Field_text("WINDOWS_SERVER_ADMIN", $ImportAdSettings["WINDOWS_SERVER_ADMIN"], "font-size:22px;padding:3px;width:390px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{password}:</td>\n\t\t<td>" . Field_password("WINDOWS_SERVER_PASS", $ImportAdSettings["WINDOWS_SERVER_PASS"], "font-size:22px;padding:3px;width:390px") . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t\n\t<tr style='height:70px'>\n\t\t<td colspan=3 align='right'>" . button("{import_contacts}", "Save{$t}()", 30) . "</td>\n\t</tR>\n\t\n\t</table>\n\t</div>\n\t<script>\n\t\t\n\t\t\n\nvar xSave{$t}=function(obj){\n\tvar tempvalue=obj.responseText;\n if(tempvalue.length>5){alert(tempvalue);}\n Loadjs('zarafa.import-ad-contacts.progress.php');\n}\t\n\t\t\nfunction Save{$t}(){\n\tvar pp=encodeURIComponent(document.getElementById('WINDOWS_SERVER_PASS').value);\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ADOU',document.getElementById('ADOU').value);\n\tXHR.appendData('ADSERVERNAME',document.getElementById('ADSERVERNAME').value);\n\tXHR.appendData('WINDOWS_SERVER_ADMIN',document.getElementById('WINDOWS_SERVER_ADMIN').value);\n\tXHR.appendData('LDAP_SUFFIX',encodeURIComponent(document.getElementById('LDAP_SUFFIX').value));\n\t\n\tXHR.appendData('WINDOWS_SERVER_PASS',pp);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function all() { $ldap = new clladp(); $ous = $ldap->hash_get_ou(); if (!is_array($ous)) { write_syslog("No organizations found, abort exporting OBM v2 users", __FILE__); die; } while (list($num, $organization) = each($ous)) { SyncOrg($organization); } $obm2 = new OBM2(); $obm2->CleanOBMGhostAccount(); }
function popup() { $page = CurrentPageName(); $tpl = new templates(); $ldap = new clladp(); $u = new user($_GET["userid"]); $oldorg = $u->ou; $ous = $ldap->hash_get_ou(true); unset($ous[$u->ou]); $ous[null] = "{select}"; $success = $tpl->javascript_parse_text("{success}"); $field = Field_array_Hash($ous, "nextou", null, "style:font-size:16px;padding:3px"); $html = "\n\t<div class=explain id='useranimateddiv'>{change_user_organization_text}</div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend>{organization}:</td>\n\t\t<td>{$field}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align=right><hr>" . button("{move}", "MoveUserToOu()") . "</td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\tfunction MoveUserToOu(){\n\t\tvar XHR = new XHRConnection();\n\t\tAnimateDiv('useranimateddiv');\n\t XHR.appendData('nextou',document.getElementById('nextou').value);\n\t XHR.appendData('ou','{$u->ou}');\n\t XHR.appendData('userid','{$_GET["userid"]}');\n\t XHR.sendAndLoad('{$page}', 'POST',x_MoveUserToOu); \n\t\n\t}\n\n\t\n\tvar x_MoveUserToOu= function (obj) {\n\t\tvar ou=document.getElementById('nextou').value;\n\t\tvar results=trim(obj.responseText);\n\t\tif(results.length>2){alert('<'+results+'>');user_changeorg_load();return;}\n\t\tYahooUserHide();\n\t\tYahooWin4Hide();\n\t\tif(document.getElementById('org_main')){RefreshTab('org_main');}\n\t\talert('{$success} {$_GET["userid"]} -> '+ou);\n\t}\n</script>\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function add_domain() { $users = new usersMenus(); $page = CurrentPageName(); $tpl = new templates(); $t = time(); if ($users->AsSystemAdministrator) { $ldap = new clladp(); $ous = $ldap->hash_get_ou(true); $orgs = Field_array_Hash($ous, "ou-{$t}", null, "style:font-size:18px"); } else { $orgs = "<span style='font-size:18px'>{$_SESSION["ou"]}</span>\n\t\t<input type='hidden' id='ou-{$t}' value='{$_SESSION["ou"]}'>"; } $html = "<div style='font-size:26px;margin-bottom:20px'>{new_internet_domain}</div>\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{domain}:</div>\n\t\t<td>" . Field_text("domain-{$t}", null, "font-size:18px", null, null, null, false, "SaveCheck{$t}(event)") . "</div>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{organization}:</div>\n\t\t<td>{$orgs}</div>\n\t</tr>\t\t\t\t\t\t\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{add}", "Save{$t}()", 26) . "</td>\n\t</tr>\n\t</table>\t\n<script>\n\tvar xSave{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\tWinORGHide();\n\t\t\$('#flexRT{$_GET["t"]}').flexReload();\n\t\tUnlockPage();\n\t\tif(document.getElementById('main_config_dhcpd')){RefreshTab('main_config_dhcpd');}\n\t}\n\t\nfunction SaveCheck{$t}(e){\n\tif(!checkEnter(e)){return;}\n\tSave{$t}();\n\n}\nfunction Save{$t}(){\n\t\tLockPage();\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('AddNewInternetDomain',document.getElementById('ou-{$t}').value);\n\t\tXHR.appendData('AddNewInternetDomainDomainName',document.getElementById('domain-{$t}').value);\n\t\tXHR.sendAndLoad('domains.edit.domains.php', 'GET',xSave{$t});\n\t\t}\n\n</script>\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function page() { $page = CurrentPageName(); $tpl = new templates(); $rebuild_groupware_warning = $tpl->javascript_parse_text("{rebuild_groupware_warning}"); $t = time(); $h = new vhosts(); $hash = $h->listOfAvailableServices(true); $sql = "SELECT groupware FROM freeweb WHERE servername='{$_GET["servername"]}'"; $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $sock = new sockets(); $ldap = new clladp(); $users = new usersMenus(); if ($users->AsSystemAdministrator) { $ous = $ldap->hash_get_ou(true); $OUFIELD = Field_array_Hash($ous, "NAB-OU-{$t}", $free->Params["ROUNDCUBE"]["NAB-OU"], "style:font-size:14px"); } else { $OUFIELD = "<span style='font-size:14px;font-weight:bold'>{$_SESSION["ou"]}<input type='hidden' id='NAB-OU-{$t}' value='{$_SESSION["ou"]}'></span>"; } $EnableVirtualDomainsInMailBoxes = $sock->GET_INFO("EnableVirtualDomainsInMailBoxes"); if (!is_numeric($EnableVirtualDomainsInMailBoxes)) { $EnableVirtualDomainsInMailBoxes = 0; } $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); if ($ligne["groupware"] != null) { $groupware_text = "\n\t\t<table style='width:99%' class=form>\n\t\t<tr>\n\t\t\t<td width=1% valign='top'><img src='img/{$h->IMG_ARRAY_64[$ligne["groupware"]]}'></td>\n\t\t\t<td valign='top' width=99%>\n\t\t\t\t<div style='font-size:16px'>{current}: <strong>« {$hash[$ligne["groupware"]]} »</strong><hr>\n\t\t\t\t\t<i style='font-size:13px'>{{$h->TEXT_ARRAY[$ligne["groupware"]]["TEXT"]}}</i>\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>"; } $free = new freeweb($_GET["servername"]); $js = "YahooWin4('650','mysql.browse.php?database={$free->mysql_database}&instance-id={$free->mysql_instance_id}','»{$free->mysql_database}');"; // javascript:LoadMysqlTables('rdcbe05261831'); $SMTP_SERVER = $free->Params["ROUNDCUBE"]["SMTP_SERVER"]; if ($SMTP_SERVER == null) { $SMTP_SERVER = "127.0.0.1"; } if (!isset($free->Params["ROUNDCUBE"]["SIEVE_SERVER"])) { $free->Params["ROUNDCUBE"]["SIEVE_SERVER"] = "127.0.0.1:2000"; } $html = "<div style='width:100%' id='roundcubediv'>{$groupware_text}\n\n<table style='width:99%' class=form>\n<tbody>\n<tr>\n\t<td class=legend style='font-size:14px'>MySQL {database}:</td>\n\t<td style='font-size:14px'>Instance {$free->mysql_instance_id} / <a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='text-decoration:underline'>{$free->mysql_database}</a>\n\t <a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$page}?replic-js=yes&servername={$_GET["servername"]}')\" style='text-decoration:underline'>{replication}</a>\n\t\n\t</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px'>{smtp_server}:</td>\n\t<td style='font-size:14px'>" . Field_text("RDCUBE_SMTP_SERVER-{$t}", $SMTP_SERVER, "font-size:14px;width:220px") . "</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px'>{imap_server}:</td>\n\t<td style='font-size:14px'>" . Field_text("RDCUBE_IMAP_SERVER-{$t}", $free->Params["ROUNDCUBE"]["IMAP_SERVER"], "font-size:14px;width:220px") . "</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px'>Sieve:</td>\n\t<td style='font-size:14px'>" . Field_text("RDCUBE_SIEVE_SERVER-{$t}", $free->Params["ROUNDCUBE"]["SIEVE_SERVER"], "font-size:14px;width:220px") . "</td>\n</tr>\t\t\t\n<tr>\n\t<td class=legend style='font-size:14px'>{login_domain}:</td>\n\t<td style='font-size:14px'>" . Field_text("username_domain-{$t}", $free->Params["ROUNDCUBE"]["username_domain"], "font-size:14px;width:220px") . "</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px'>{default_domain}:</td>\n\t<td style='font-size:14px'>" . Field_text("mail_domain-{$t}", $free->Params["ROUNDCUBE"]["mail_domain"], "font-size:14px;width:220px") . "</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px'>{product_name}:</td>\n\t<td style='font-size:14px'>" . Field_text("product_name-{$t}", $free->Params["ROUNDCUBE"]["product_name"], "font-size:14px;width:220px") . "</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px'>{global_addressbook}:</td>\n\t<td style='font-size:14px'>" . Field_checkbox("ENABLE_NAB-{$t}", 1, $free->Params["ROUNDCUBE"]["ENABLE_NAB"], "ENABLE_NAB_CHECK{$t}()") . "</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px'>{organization}:</td>\n\t<td style='font-size:14px'>{$OUFIELD}</td>\n</tr>\n<tr>\n\t<td class=legend style='font-size:14px'>{writeable}:</td>\n\t<td style='font-size:14px'>" . Field_checkbox("WRITE_NAB-{$t}", 1, $free->Params["ROUNDCUBE"]["WRITE_NAB"]) . "</td>\n</tr>\n\n\n<tr>\n<td colspan=2><div style='text-align:right'><hr>" . button("{apply}", "SaveRDCUBESETTS()", 16) . "</div></td>\n</tr>\n\n</table>\n<table class='table-{$t}' style='display: none' id='table-{$t}' style='width:100%;margin:-10px'></table>\n</div>\n\n\n\n\n</div>\n\t<script>\nFreeWebIDMEM='';\n\$(document).ready(function(){\n\$('#table-{$t}').flexigrid({\n\turl: '{$page}?plugin-list=yes&servername={$_GET["servername"]}&force-groupware={$_GET["force-groupware"]}&ForceInstanceZarafaID={$_GET["ForceInstanceZarafaID"]}&t={$t}&tabzarafa={$_GET["tabzarafa"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: ' ', name : 'icon', width : 31, sortable : false, align: 'center'},\n\t\t{display: 'Plugins', name : 'Plugins', width :652, sortable : true, align: 'left'},\n\t\t{display: ' ', name : 'none1', width : 31, sortable : false, align: 'left'},\n\t],\n\t{$buttons}\n\n\tsearchitems : [\n\t\t{display: 'Plugins', name : 'Plugins'},\n\t\t],\n\tsortname: 'servername',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: 'Plugins',\n\tuseRp: false,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: 874,\n\theight: 200,\n\tsingleSelect: true\n\t\n\t}); \n});\t\n\t\n\t\n\t\n\t\tvar x_SaveRDCUBESETTS=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>3){alert(results);}\n\n\t\t\tif(document.getElementById('main_config_freewebedit')){\n\t\t\t\tRefreshTab('main_config_freewebedit');\n\t\t\t}\n\t\t\t\n\t\t}\t\n\t\t\n\t\tvar x_SaveRDCUBESETTSILENT=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>3){alert(results);}\n\n\t\t\t\n\t\t\t\n\t\t}\t\t\t\n\n\t\t\n\t\tfunction PluginEnable(plug){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('servername','{$_GET["servername"]}');\n\t\t\tXHR.appendData('PLUGS',plug);\n\t\t\tif(document.getElementById('plugin_'+plug).checked){XHR.appendData('plugin_'+plug,1);}else{XHR.appendData('plugin_'+plug,0);}\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveRDCUBESETTSILENT);\n\t\t}\n\t\n\t\n\t\tfunction SaveRDCUBESETTS(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('servername','{$_GET["servername"]}');\n\t\t\tXHR.appendData('SMTP_SERVER',document.getElementById('RDCUBE_SMTP_SERVER-{$t}').value);\n\t\t\tXHR.appendData('IMAP_SERVER',document.getElementById('RDCUBE_IMAP_SERVER-{$t}').value);\n\t\t\tXHR.appendData('SIEVE_SERVER',document.getElementById('RDCUBE_SIEVE_SERVER-{$t}').value);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tXHR.appendData('username_domain',document.getElementById('username_domain-{$t}').value);\n\t\t\tXHR.appendData('mail_domain',document.getElementById('mail_domain-{$t}').value);\n\t\t\tXHR.appendData('product_name',document.getElementById('product_name-{$t}').value);\n\t\t\tif(document.getElementById('ENABLE_NAB-{$t}').checked){XHR.appendData('ENABLE_NAB',1);}else{XHR.appendData('ENABLE_NAB',0);}\n\t\t\tif(document.getElementById('WRITE_NAB-{$t}').checked){XHR.appendData('WRITE_NAB',1);}else{XHR.appendData('WRITE_NAB',0);}\n\t\t\tXHR.appendData('NAB-OU',document.getElementById('NAB-OU-{$t}').value);\n\t\t\t\n\t\t\t\n\t\t\tAnimateDiv('roundcubediv');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveRDCUBESETTS);\n\t\t}\n\t\n\t\tfunction EnableVirtualDomainsInMailBoxesCheck(){\n\t\t\tvar EnableVirtualDomainsInMailBoxes={$EnableVirtualDomainsInMailBoxes};\n\t\t\tdocument.getElementById('username_domain-{$t}').disabled=true;\n\t\t\tif(EnableVirtualDomainsInMailBoxes==1){\n\t\t\t\tdocument.getElementById('username_domain-{$t}').disabled=false;\n\t\t\t\tdocument.getElementById('username_domain-{$t}').value='';\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction ENABLE_NAB_CHECK{$t}(){\n\t\t\tdocument.getElementById('NAB-OU-{$t}').disabled=true;\n\t\t\tdocument.getElementById('WRITE_NAB-{$t}').disabled=true;\n\t\t\tif(document.getElementById('ENABLE_NAB-{$t}').checked){\n\t\t\t\tdocument.getElementById('NAB-OU-{$t}').disabled=false;\n\t\t\t\tdocument.getElementById('WRITE_NAB-{$t}').disabled=false;\n\n\t\t\t}\n\t\t}\n\t\t\n\t\tEnableVirtualDomainsInMailBoxesCheck();\n\t\tENABLE_NAB_CHECK{$t}();\n\t</script>\n\t\n\t"; $tpl = new templates(); $datas = $tpl->_ENGINE_parse_body($html); echo $datas; }
function virtip_popup() { $boot = new boostrap_form(); $sock = new sockets(); $users = new usersMenus(); $ldap = new clladp(); $ID = $_GET["ID"]; $title_button = "{add}"; $nics = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes"))); if ($_GET["ID"] > 0) { $sql = "SELECT * FROM nics_virtuals WHERE ID='{$ID}'"; $q = new mysql(); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $title_button = "{apply}"; } $ous = $ldap->hash_get_ou(true); $ous["openvpn_service"] = "{APP_OPENVPN}"; while (list($num, $val) = each($nics)) { $nics_array[$val] = $val; } $nics_array[null] = "{select}"; $ous[null] = "{select}"; $boot->set_list("nic", "{nic}", $nics_array, $ligne["nic"]); $boot->set_list("org", "{organization}", $ous, $ligne["org"]); $boot->set_field("ipaddr", "{tcp_address}", $ligne["ipaddr"], array("IPV4" => true)); $boot->set_field("netmask", "{netmask}", $ligne["netmask"], array("IPV4" => true)); $boot->set_field("cdir", "CDIR", $ligne["cdir"], array("CDIR" => "ipaddr,netmask")); $boot->set_field("gateway", "{gateway}", $ligne["gateway"], array("IPV4" => true)); $boot->set_field("metric", "{metric}", $ligne["metric"]); $boot->set_hidden("ID", $_GET["ID"]); $boot->set_checkbox("ForceGateway", "{ForceGateway}", $ligne["ForceGateway"]); if (!$users->AsSystemAdministrator) { $boot->set_form_locked(); } if ($ID == 0) { $boot->set_CloseYahoo("YahooWin2"); } $boot->set_RefreshSearchs(); echo $boot->Compile(); }
function main_settings() { $page = CurrentPageName(); $tpl = new templates(); $hostname = $_GET["hostname"]; $smb = new samba_aliases($hostname); $must_choose_ipaddr = $tpl->javascript_parse_text("{must_choose_ipaddr}"); $q = new mysql(); $button = "{apply}"; $lock = 1; if ($hostname == null) { $button = "{add}"; $lock = 0; } $ldap = new clladp(); $ous = $ldap->hash_get_ou(true); $ous[null] = "{none}"; $oufield = Field_array_Hash($ous, "smbou", $smb->ou, "style:font-size:13px;padding:3px"); $addIpaddr = imgtootltip("plus-24.png", "{add}", "Loadjs('system.nic.config.php?js-virtual-add=yes&function-after=IpAddrSMbField');"); $html = "\n\t<div id='smbvritid'>\n\t<table style='width:100%' class=form>\n\t<tr>\n\t\t<td class=legend>{netbiosname}:</td>\n\t\t<td valign='top'>" . Field_text("hostname", $hostname, 'width:190px;font-size:16px;padding:3px;font-weight:bold;font-family:monospace', null, null, null, false, null, $workgroup_disabled) . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{listen_ip}:</td>\n\t\t<td valign='top'><span id='ipaddr-field'>{$ipaddrfield}</span> <siv style='float:right'>{$addIpaddr}</div></td>\n\t\t<td>" . help_icon("{samba_aliases_virtual_ip}") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap valign='top' class=legend class=legend>{workgroup}:</td>\n\t\t<td valign='top'>" . Field_text("workgroup", $smb->workgroup, 'width:190px;font-size:13px;padding:3px', null, null, null, false, null, $workgroup_disabled) . "</td>\n\t\t<td valign='top'>" . help_icon("{workgroup_text}") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' nowrap valign='top' class=legend class=legend>{organization}:</td>\n\t\t<td valign='top'>{$oufield}</td>\n\t\t<td valign='top'>" . help_icon("{virtual_smb_ou_explain}") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td align='right' nowrap valign='top' class=legend class=legend>{root_directory}:</td>\n\t\t<td valign='top'>" . Field_text("RootDir", $smb->RootDir, 'width:190px;font-size:13px;padding:3px', null, null, null, false, null, $workgroup_disabled) . " <input type='button' value='{browse}...' OnClick=\"javascript:Loadjs('SambaBrowse.php?field=RootDir&no-shares=yes');\"></td>\n\t\t<td valign='top'>" . help_icon("{smb_RootDir_text}") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button($button, "SaveSMBVirt()") . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t<script>\n\t\tvar x_SaveSMBVirt=function (obj) {\n\t\t var hostname='{$hostname}';\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);}\t\t\t\n\t\t\tif(document.getElementById('browse-samba-list')){BrowseSambaSearch();}\n\t\t\tif(hostname.length==0){YahooWin3Hide();return;}\n\t\t\tRefreshTab('main_config_virtsamba');\n\t\t}\n\t\n\t\n\t\tfunction SaveSMBVirt(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tvar ipaddr=document.getElementById('smbipaddr').value;\n\t\t\tXHR.appendData('ipaddr',ipaddr);\n\t\t\tXHR.appendData('hostname',document.getElementById('hostname').value);\n\t\t\tXHR.appendData('workgroup',document.getElementById('workgroup').value);\n\t\t\tXHR.appendData('ou',document.getElementById('smbou').value);\n\t\t\tXHR.appendData('RootDir',document.getElementById('RootDir').value);\n \t\tAnimateDiv('smbvritid');\n \t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveSMBVirt);\n\t\t\t\t\n\t\t\n\t\t}\n\t\t\n\t\tfunction lockSmbAlias(){\n\t\t\tvar lock={$lock};\n\t\t\tif(lock==1){document.getElementById('hostname').disabled=true;}\n\t\t\t\n\t\t}\n\t\t\n\t\tfunction IpAddrSMbField(){\n\t\t\tLoadAjax('ipaddr-field','{$page}?hostname={$hostname}&ipaddr-field=yes');\n\t\t}\n\t\t\n\t\tlockSmbAlias();\n\t\tIpAddrSMbField();\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function GROUPS_LIST($OU) { writelogs("startup ou={$OU}", __FUNCTION__, __FILE__); $page = CurrentPageName(); $ou = $OU; if (is_base64_encoded($ou)) { $ou = base64_decode($ou); } writelogs("Encoded ou ? =\"{$ou}\" {$_SESSION["uid"]}", __FUNCTION__, __FILE__); $ldap = new clladp(); $users = new usersMenus(); if ($users->AsArticaAdministrator) { writelogs("AsArticaAdministrator privileges", __FUNCTION__, __FILE__); $org = $ldap->hash_get_ou(true); while (list($ou1, $ou2) = each($org)) { $orgs_encoded[base64_encode($ou1)] = $ou2; } //$orgs=Field_array_Hash($orgs_encoded,'SelectOuList',base64_encode($ou),"LoadGroupList()",null,0,'width:250px'); $hash = $ldap->hash_groups($ou, 1); writelogs("AsArticaAdministrator:: Load " . count($hash) . " groups from ou {$ou}", __FUNCTION__, __FILE__); } else { $ou = ORGANISTATION_FROM_USER(); //$orgs="<strong>$ou</strong><input type='hidden' name=SelectOuList id='SelectOuList' value='$ou'>"; if (!$users->AsOrgAdmin) { $hash = $ldap->UserGetGroups($_SESSION["uid"], 1); } if ($users->AsOrgAdmin) { $hash = $ldap->hash_groups($ou, 1); } } if (is_array($hash)) { while (list($num, $line) = each($hash)) { if (strtolower($line) == 'default_group') { unset($hash["{$num}"]); } $tr[] = $num; } } $orgs = Field_hidden("SelectOuList", base64_encode($ou)); writelogs("Load " . count($hash) . " groups from ou {$ou}", __FUNCTION__, __FILE__); $hash[null] = "{select_group}"; reset($hash); $field = Field_array_Hash($hash, 'SelectGroupList', null, "LoadGroupSettings()", null, 0, 'width:250px'); $html = "\n\t{$orgs}\n\t<table style='width:300px'>\n\t<td width=80%>{$field}</td>\n\t<td width=1%>" . imgtootltip('20-refresh.png', '{refresh}', "RefreshGroupList()") . "</td>\n\t<td width=1%>" . button("{add}", "Loadjs('{$page}?popup-add-group=yes&ou={$ou}')") . "</td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\tfunction RefreshGroupList(){\n\t\t\tLoadAjax('grouplist','{$page}?LoadGroupList={$ou}')\n\t\t\n\t\t}\n\t\n\tLoadGroupSettings('{$tr[0]}');\t\n\t</script>\n\t\n\t\n\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }
function export_all_groups() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $oldpid = @file_get_contents($pidfile); if ($unix->process_exists($oldpid)) { events("{$oldpid} already running", __FUNCTION__, __FILE__, __LINE__); die; } @file_put_contents($pidfile, getmypid()); $ldap = new clladp(); $ous = $ldap->hash_get_ou(true); while (list($ou, $ou2) = each($ous)) { if (trim($ou) == null) { continue; } $hash = $ldap->hash_groups($ou); if (!is_array($hash)) { return; } while (list($gid, $groupname) = each($hash)) { $array_final[$gid] = array("ou" => $ou, "name" => $groupname); } } if (!is_array($array_final)) { return null; } echo "exporting " . count($array_final) . " groups in \"/etc/artica-postfix/metagroups.cache\"\n"; $datas = base64_encode(serialize($array_final)); @file_put_contents("/etc/artica-postfix/metagroups.cache", $datas); $http = new httpget(); $sock = new sockets(); $meta = new artica_meta(); $http->uploads["ALL_GROUPS"] = "/etc/artica-postfix/metagroups.cache"; $body = $http->send("{$meta->ArticaMetaHostname}/lic.users.import.php", "post", array("DATAS" => base64_encode(serialize($meta->GLOBAL_ARRAY)))); events(count($array_final) . " groups exported to global Management console", __FUNCTION__, __FILE__, __LINE__); send_email_events(count($array_final) . " groups exported to global Management console", $body, "CLOUD"); echo $body; }
function PostfixAddRelayTable(){ $ldap=new clladp(); $page=CurrentPageName(); $org=$ldap->hash_get_ou(true); $org[null]='{select}'; $listOrg=Field_array_Hash($org,'org',$org); $tls_table=$ldap->hash_Smtp_Tls_Policy_Maps(); $smtp_server_line=$Table[$domainName]; $smtp_server_line=str_replace('smtp:','',$smtp_server_line); $tls_value=$tls_table[$smtp_server_line]; writelogs("server \"{$Table[$domainName]}\"=>$smtp_server_line=>".$tls_table[$smtp_server_line] ."($tls_value)",__FUNCTION__,__FILE__); $main=new main_cf(); if($main->main_array["smtp_sasl_auth_enable"]=="yes"){ $field=Field_array_Hash($main->array_field_relay_tls,'smtp_tls_policy_maps',$tls_value); $sasl=" </tr> <td align='right' nowrap valign='top' class=legend>{tls_level}:</strong></td> <td style='font-size:12px'>$field<div class='caption'>{use_tls_relay_explain}</div></td> </tr>"; } if($smtp_port==null){$smtp_port=25;} $html=" <h1>{add_routing_relay_domain_rule}</H1> <br>" . RoundedLightWhite(" <form name='FFM3'> <input type='hidden' name='PostfixAddRoutingTableSave' value='yes'> <table style='width:100%'> <tr> <td align='right' class=legend>{organization}:</strong></td> <td style='font-size:12px'>$listOrg</td> </tr> <tr> <td align='right' class=legend>{domainName}:</strong></td> <td style='font-size:12px'>" . Field_text('domain',$domainName) . "</td> </tr> <td align='right' nowrap class=legend>{relay_address}:</strong></td> <td style='font-size:12px'>" . Field_text('relay_address',$relay_address) . "</td> </tr> <td align='right' nowrap class=legend>{smtp_port}:</strong></td> <td style='font-size:12px'>" . Field_text('relay_port',$smtp_port) . "</td> </tr> <tr> <td align='right' nowrap>" . Field_yesno_checkbox_img('MX_lookups',$MX_lookups,'{enable_disable}')."</td> <td style='font-size:12px'>{MX_lookups}</td> </tr> $sasl <tr> <td align='right' colspan=2>". button("{apply}","PostfixAddNewRelayTable()")."</td> </tr> <tr> <td align='left' colspan=2><hr><p class=caption>{MX_lookups}</strong><br>{MX_lookups_text}</p></td> </tr> </table> </FORM> //PostfixAddRoutingRuleTableSave <script> var X_PostfixAddNewRelayTable= function (obj) { var results=obj.responseText; if (results.length>0){alert(results);} $('#container-tabs').tabs( 'load' ,3 ); YahooWinHide(); } function PostfixAddNewRelayTable(){ var XHR = new XHRConnection(); XHR.appendData('PostfixAddRoutingTableSave','yes'); XHR.appendData('org',document.getElementById('org').value); XHR.appendData('domain',document.getElementById('domain').value); XHR.appendData('relay_address',document.getElementById('relay_address').value); XHR.appendData('MX_lookups',document.getElementById('MX_lookups').value); XHR.appendData('relay_port',document.getElementById('relay_port').value); if(document.getElementById('smtp_tls_policy_maps')){ XHR.appendData('relay_port',document.getElementById('smtp_tls_policy_maps').value); } XHR.sendAndLoad('$page', 'GET',X_PostfixAddNewRelayTable); } </script> "); $tpl=new templates(); echo $tpl->_ENGINE_parse_body($html); }
function lvm_lvcreate() { $group = $_GET["lvcreate"]; $ldap = new clladp(); $ous = $ldap->hash_get_ou(true); $ous[null] = "{select}"; $field = Field_array_Hash($ous, "affectToThisOu", $ou); $html = "<h1>{ADD_VG}</H1>\n\t<p class=caption>{ADD_VG_TEXT}</p>\n\t<input type='hidden' id='LV_GROUP' value='{$group}'>\n\t" . RoundedLightWhite("\n\t<div id='lvmcreate'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend nowrap>{LVMS_NAME}:</td>\n\t\t<td>" . Field_text('LVMS_NAME', null, 'width:90px') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap>{LVMS_SIZE}:</td>\n\t\t<td>" . Field_text('LVMS_SIZE', null, 'width:30px') . "<strong style='font-size:12px'> G</strong></td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 style='font-size:11px'><br>{AFFECT_VG_EXPLAIN}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{organization}:</td>\n\t\t<td>{$field}</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td colspan='2' align='right'><hr>" . button("{add}", "lvcreateSubmit();") . "</td>\n\t</tr>\n\t</table>\n\t\n\t</div>"); $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function wizard3() { if (!isset($_SESSION["WIZINSTANCE"]["WIZIPADDR"])) { wizard2(); exit; } $page = CurrentPageName(); $tpl = new templates(); $ldap = new clladp(); $ous = $ldap->hash_get_ou(true); $ous[null] = "{none}"; $html = "<strong style='font-size:16px'>{Interface}:{$_SESSION["WIZINSTANCE"]["WIZINTERFACE"]} | {$_SESSION["WIZINSTANCE"]["WIZIPADDR"]}/{$_SESSION["WIZINSTANCE"]["WIZIPMASK"]}</strong>\n\t<div class=explain style='font-size:14px'>{welcome_new_instance_wizard_organdname}</div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{organization}:</td>\n\t\t<td>" . Field_array_Hash($ous, "WIZOU", $_SESSION["WIZINSTANCE"]["WIZOU"], "style:font-size:16px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{hostname}:</td>\n\t\t<td>" . field_text("WIZHOST", $_SESSION["WIZINSTANCE"]["WIZHOST"], "font-size:16px;width:240px;font-weight:bolder") . "</td>\n\t</tr>\t\n\t<tr>\n\t<tr>\n\t\t<td colspan=2><hr></td>\n\t</tr>\n\t<tr>\n\t\n\t\t<td align='left'>" . button("{previous}", "LoadAjax('new_instance_wizard','{$page}?wiz2=yes');", 16) . "</td>\n\t\t<td colspan=2 align='right'>" . button("{next}", "WIZ_WIZHOST()", 16) . "</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t<script>\n\tvar XWIZ_WIZ_WIZHOST= function (obj) {\n\t var results=obj.responseText;\n\t if(results.length>3){alert(results);return;}\n\t \tWIZMULTI4();\n\t}\t\n\t\n\tfunction WIZ_WIZHOST(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('WIZOU',document.getElementById('WIZOU').value);\n\t\tXHR.appendData('WIZHOST',document.getElementById('WIZHOST').value);\n\t\tAnimateDiv('new_instance_wizard');\n\t\tXHR.sendAndLoad('{$page}', 'POST',XWIZ_WIZ_WIZHOST);\t\n\t}\n\t\n\t</script>\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function time_global(){ $ldap=new clladp(); $ous=$ldap->hash_get_ou(true); $ous[null]="{select}"; $ous_field=Field_array_Hash($ous,'ou',null,"ConnectionTimeSelectOU()"); $squid=new squidbee(); $html=" <H1>{connection_time}</h1> <table style='width:99%' class=form'> <tr> <td class=legend nowrap>{ou}</td> <td>$ous_field</td> </tr> <tr> <td class=legend nowrap>group</td> <td><div id='group_field'></div></td> </table> <div id='ConnectionTimeRule' style='width:100%'></div> "; if($squid->LDAP_AUTH<>1){ $html=" <table style='width:99%' class=form> <tbody> <tr> <td width=1% valign='top'><img src='img/error-64.png'></td> <td width=99% valign='top'> <div style='font-size:18px'>{connection_time}</div> <p style='font-size:14px'>{error_no_auth_squid}</p> </td> </tr> </tbody> </table> "; } $tpl=new templates(); return $tpl->_ENGINE_parse_body($html,'squid.index.php'); }
function time_global() { $ldap = new clladp(); $ous = $ldap->hash_get_ou(true); $ous[null] = "{select}"; $ous_field = Field_array_Hash($ous, 'ou', null, "ConnectionTimeSelectOU()"); $squid = new squidbee(); $html = "\n\t<H1>{connection_time}</h1>\n\t<table style='width:100%' class=table_form'>\n\t<tr>\n\t\t<td class=legend nowrap>{ou}</td>\n\t\t<td>{$ous_field}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap>group</td>\n\t\t<td><div id='group_field'></div></td>\n\t</table>\n\t<div id='ConnectionTimeRule' style='width:100%'></div>\n\t"; if ($squid->LDAP_AUTH != 1) { $html = "<H1>{error} {connection_time}</h1>\n\t\t<p class=caption style='font-size:14px'>{error_no_auth_squid}</p>\n\t\t"; } $tpl = new templates(); return $tpl->_ENGINE_parse_body($html, 'squid.index.php'); }
function popup_group() { $ldap = new clladp(); $orgs = $ldap->hash_get_ou(true); $orgs[null] = "{select}"; $organizations = Field_array_Hash($orgs, 'ou', null, "DansGuardianAuthChooseOrg()", null, 0, "font-size:15px;padding:4px"); $dansg = new dansguardian_rules(); $rules = $dansg->hash_RulesList(); $rules[null] = "{select}"; $rules_list = Field_array_Hash($rules, 'RuleID', null, null, null, 0, "font-size:15px;padding:4px"); $html = "\n\t<table style='width:99%'>\n\t<tr>\n\t\t<td class=legend style='font-size:15px'>{organization}:</td>\n\t\t<td>{$organizations}</td>\n\t</tr>\n\t<tr><td class=legend style='font-size:15px'>{groups}:</td>\n\t<td><span id='dans-groups'></span>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:15px'>{rule}:</td>\n\t\t<td>{$rules_list}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{add}", "DansGuardianAuthAdd()") . "</td>\n\t</tr>\n\t</table>\n\t\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function start() { $sock = new sockets(); $ZarafaAdbksWhiteTask = $sock->GET_INFO("ZarafaAdbksWhiteTask"); $ZarafaWhiteSentItems = $sock->GET_INFO("ZarafaWhiteSentItems"); $ZarafaJunkItems = $sock->GET_INFO("ZarafaJunkItems"); if (!is_numeric($ZarafaAdbksWhiteTask)) { $ZarafaAdbksWhiteTask = 0; } if (!is_numeric($ZarafaWhiteSentItems)) { $ZarafaWhiteSentItems = 1; } if (!is_numeric($ZarafaJunkItems)) { $ZarafaJunkItems = 0; } if ($ZarafaAdbksWhiteTask == 0) { return; } $q = new mysql(); $q->BuildTables(); $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time"; if ($unix->process_exists($unix->get_pid_from_file($pidfile))) { system_admin_events("Already exists in memory, aborting task", __FUNCTION__, __FILE__, __LINE__, "zarafa"); return; } @file_put_contents($pidfile, getmypid()); $ZarafaServerListenIP = $sock->GET_INFO("ZarafaServerListenIP"); if ($ZarafaServerListenIP == null) { $ZarafaServerListenIP = "127.0.0.1"; } if ($ZarafaServerListenIP == "0.0.0.0") { $ZarafaServerListenIP = "127.0.0.1"; } $TimeFile = $unix->file_time_min($pidtime); if ($TimeFile < 240) { return; } @unlink($pidtime); @file_put_contents($pidtime, time()); $ldap = new clladp(); $ous = $ldap->hash_get_ou(true); $countDeOu = count($ous); system_admin_events("Parsing {$countDeOu} organization(s)", __FUNCTION__, __FILE__, __LINE__, "zarafa"); $GLOBALS["ITEMSC"] = 0; while (list($ou, $none) = each($ous)) { $users = $ldap->hash_users_ou($ou); $CountDeUsers = count($users); system_admin_events("{$ou} {$CountDeUsers} users", __FUNCTION__, __FILE__, __LINE__, "zarafa"); if (!is_array($users)) { continue; } if (count($users) == 0) { continue; } while (list($uid, $none2) = each($users)) { if (trim($uid) == null) { continue; } import_contacts($uid, $ZarafaServerListenIP); if ($ZarafaWhiteSentItems == 1) { import_sentitems($uid); } if ($ZarafaJunkItems == 1) { inject_blacklists($uid); } } } system_admin_events("Adding {$GLOBALS["ITEMSC"]} contacts in white list", __FUNCTION__, __FILE__, __LINE__, "zarafa"); $EnableAmavisDaemon = $sock->GET_INFO("EnableAmavisDaemon"); if (!is_numeric($EnableAmavisDaemon)) { $EnableAmavisDaemon = 0; } $php5 = $unix->LOCATE_PHP5_BIN(); $users = new usersMenus(); if ($users->AMAVIS_INSTALLED) { if ($EnableAmavisDaemon == 1) { shell_exec("{$php5} " . dirname(__FILE__) . "/exec.amavis.php >/dev/null 2>&1"); shell_exec("/etc/init.d/amavis reload"); } } if ($users->MILTERGREYLIST_INSTALLED) { shell_exec("{$php5} " . dirname(__FILE__) . "/exec.milter-greylist.php >/dev/null 2>&1"); } }
function OU_FIELD() { $users = new usersMenus(); $ldap = new clladp(); $tpl = new templates(); $page = CurrentPageName(); $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) == 1) { $org = $hash[0]; } while (list($num, $ligne) = each($hash)) { $ous[$ligne] = $ligne; } echo Field_array_Hash($ous, "organization-{$t}", $_GET["ou"], "ChangeFormValues()", null, 0, "font-size:28px;padding:3px") . "\n\t<script>ChangeFormValues();</script>\t\t\n\t"; }
function change_field() { $type = $_GET["type"]; $t = $_GET["t"]; $tpl = new templates(); $q = new mysql(); $sql = "SELECT uid FROM postfix_transport_mailbox WHERE `ID`='{$_POST["key"]}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if ($type == 0) { echo Field_text("uid-{$t}", $ligne["uid"], "font-size:16px;width:180px"); return; } $ldap = new clladp(); $users = new usersMenus(); if ($users->AsSystemAdministrator) { $ous = $ldap->hash_get_ou(true); $ous[null] = "{select}"; echo $tpl->_ENGINE_parse_body(Field_array_Hash($ous, "uid-{$t}", $ligne["uid"], "blur()", null, 0, "font-size:16px")); return; } echo Field_hidden("uid-{$t}", $_SESSION["ou"]) . "<span style='font-size:16px'>{$_SESSION["ou"]}</span>"; }
function virtual_add_form(){ $ldap=new clladp(); $sock=new sockets(); $page=CurrentPageName(); $users=new usersMenus(); $tpl=new templates(); $t=$_GET["t"]; if(!is_numeric($t)){$t=0;} $nics=unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes"))); $EnablePostfixMultiInstance=$sock->GET_INFO("EnablePostfixMultiInstance"); $NoGatewayForVirtualNetWork=$sock->GET_INFO("NoGatewayForVirtualNetWork"); $DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement"); if(!is_numeric($NoGatewayForVirtualNetWork)){$NoGatewayForVirtualNetWork=0;} if(!is_numeric($DisableNetworksManagement)){$DisableNetworksManagement=0;} $FailOver=0; $NoGatewayForVirtualNetWorkExplain=$tpl->javascript_parse_text("{NoGatewayForVirtualNetWorkExplain}"); if($users->LinuxDistriCode=="DEBIAN"){ if(preg_match("#Debian\s+([0-9]+)\.#",$users->LinuxDistriFullName,$re)){ $DEBIAN_MAJOR=$re[1]; if($DEBIAN_MAJOR==6){$FailOver=1;} } } $title_button="{add}"; if(!is_numeric($_GET["ID"])){$_GET["ID"]=0;} if($_GET["ID"]>0){ $sql="SELECT * FROM nics_virtuals WHERE ID='{$_GET["ID"]}'"; $q=new mysql(); $ligne=@mysql_fetch_array($q->QUERY_SQL($sql,"artica_backup")); $title_button="{apply}"; } if(isset($_GET["default-datas"])){ $default_array=unserialize(base64_decode($_GET["default-datas"])); if(is_array($default_array)){ $ligne["nic"]=$default_array["NIC"]; if(preg_match("#(.+?)\.([0-9]+)$#",$default_array["IP"],$re)){ if($re[2]>254){$re[2]=1;} $re[2]=$re[2]+1; $ligne["ipaddr"]="{$re[1]}.{$re[2]}"; $ligne["gateway"]=$default_array["GW"]; $ligne["netmask"]=$default_array["NETMASK"]; } } } if($ligne["metric"]==0){$ligne["metric"]=100+$_GET["ID"];} $styleOfFields="font-size:16px;padding:3px"; $ous=$ldap->hash_get_ou(true); $ous["openvpn_service"]="{APP_OPENVPN}"; if($users->crossroads_installed){ if($EnablePostfixMultiInstance==1){ $ous["crossroads"]="{load_balancer}"; } } $AsDebianSystem=1; while (list ($num, $val) = each ($nics) ){$nics_array[$val]=$val;} if(!$users->AsDebianSystem){$AsDebianSystem=0;} $nics_array[null]="{select}"; $ous[null]="{select}"; $nic_field=Field_array_Hash($nics_array,"nic",$ligne["nic"],null,null,0,"font-size:16px;padding:3px"); $ou_fields=Field_array_Hash($ous,"org",$ligne["org"],null,null,0,"font-size:16px;padding:3px"); $html=" <div id='virtip'> ". Field_hidden("ID","{$_GET["ID"]}")." <table style='width:99%' class=form> <tr> <td class=legend style='font-size:16px'>{nic}:</td> <td>$nic_field</td> </tr> <tr> <td class=legend style='font-size:16px'>{organization}:</td> <td>$ou_fields</td> </tr> <tr> <td class=legend style='font-size:16px'>{tcp_address}:</td> <td>" . field_ipv4("ipaddr",$ligne["ipaddr"],$styleOfFields,false,"CalcCdirVirt(0)")."</td> </tr> <tr> <td class=legend style='font-size:16px'>{netmask}:</td> <td>" . field_ipv4("netmask",$ligne["netmask"],$styleOfFields,false,"CalcCdirVirt(0)")."</td> </tr> <tr> <td class=legend style='font-size:16px'>CDIR:</td> <td style='padding:-1px;margin:-1px'> <table style='width:99%;padding:-1px;margin:-1px'> <tr> <td width=1%> " . Field_text("cdir",$ligne["cdir"],"$styleOfFields;width:190px",null,null,null,false,null,$DISABLED)."</td> <td align='left'> ".imgtootltip("img_calc_icon.gif","cdir","CalcCdirVirt(1)") ."</td> </tr> </table></td> </tr> <tr> <td class=legend style='font-size:16px'>{gateway}:</td> <td>" . field_ipv4("gateway_virtual",$ligne["gateway"],$styleOfFields,false)."</td> </tr> <tr> <td class=legend style='font-size:16px'>{metric}:</td> <td>" . field_text("metric_virtual",$ligne["metric"],"$styleOfFields;width:90px",false)."</td> </tr> <tr> <td class=legend style='font-size:16px'>failover:</td> <td>" . Field_checkbox("failover",1,$ligne["failover"],"FaileOverCheck()")."</td> </tr> <tr> <td class=legend style='font-size:16px'>{ForceGateway}:</td> <td>" . Field_checkbox("ForceGateway",1,$ligne["ForceGateway"])."</td> </tr> </table> </div> <div id='infosVirtual' style='font-size:13px'></div> <div style='text-align:right'><hr>". button($title_button,"VirtualIPAddSave()",18)."</div> <script> var Netid={$_GET["ID"]}; var FailOver=$FailOver; var cdir=document.getElementById('cdir').value; var netmask=document.getElementById('netmask').value; if(netmask.length>0){ if(cdir.length==0){ CalcCdirVirt(0); } } if(Netid>0){ document.getElementById('ipaddr').disabled=true; } function CheckGateway(){ var NoGatewayForVirtualNetWork=$NoGatewayForVirtualNetWork; var AsDebianSystem=$AsDebianSystem; if(AsDebianSystem==0){ document.getElementById('ForceGateway').disabled=true; document.getElementById('ForceGateway').checked=false; } document.getElementById('gateway_virtual').disabled=false; if(NoGatewayForVirtualNetWork==1){ document.getElementById('gateway_virtual').disabled=true; document.getElementById('gateway_virtual').value=''; document.getElementById('ForceGateway').disabled=true; document.getElementById('ForceGateway').checked=false; document.getElementById('infosVirtual').innerHTML='$NoGatewayForVirtualNetWorkExplain'; } document.getElementById('failover').disabled=true; if(FailOver==1){document.getElementById('failover').disabled=false;} } function VirtualIPAddSave(){ var DisableNetworksManagement=$DisableNetworksManagement; var NoGatewayForVirtualNetWork=$NoGatewayForVirtualNetWork; if(DisableNetworksManagement==1){alert('$ERROR_NO_PRIVS');return;} var XHR = new XHRConnection(); XHR.appendData('virt-ipaddr',document.getElementById('ipaddr').value); XHR.appendData('netmask',document.getElementById('netmask').value); XHR.appendData('cdir',document.getElementById('cdir').value); XHR.appendData('metric',document.getElementById('metric_virtual').value); if(NoGatewayForVirtualNetWork==0){XHR.appendData('gateway',document.getElementById('gateway_virtual').value);} if(NoGatewayForVirtualNetWork==1){XHR.appendData('gateway','');} XHR.appendData('nic',document.getElementById('nic').value); XHR.appendData('org',document.getElementById('org').value); XHR.appendData('ID',document.getElementById('ID').value); if(document.getElementById('ForceGateway').checked){XHR.appendData('ForceGateway',1);}else{XHR.appendData('ForceGateway',0);} if(document.getElementById('failover')){ if(document.getElementById('failover').checked){XHR.appendData('failover',1);}else{XHR.appendData('failover',0);} } MemFlexGrid=$t; AnimateDiv('virtip'); XHR.sendAndLoad('$page', 'GET',X_VirtualIPAddSave); } function FaileOverCheck(){ document.getElementById('netmask').disabled=false; document.getElementById('gateway_virtual').disabled=false; if(document.getElementById('failover').checked){ document.getElementById('netmask').disabled=true; document.getElementById('gateway_virtual').disabled=true; } //post-up /sbin/ifconfig eth0:1 IP.DE.FAIL.OVER1 netmask 255.255.255.255 broadcast IP.DE.FAIL.OVER1 } CheckGateway(); FaileOverCheck(); </script> "; echo $tpl->_ENGINE_parse_body($html); }
function ORGANISATIONS_LIST() { $tpl = new templates(); $ldap = new clladp(); if ($ldap->IsKerbAuth()) { return ORGANISATIONS_LIST_ACTIVE_DIRECTORY(); } include_once dirname(__FILE__) . "/ressources/class.external.ad.inc"; $Mypage = CurrentPageName(); $users = new usersMenus(); $sock = new sockets(); $ou_nozarafa_explain = $tpl->_ENGINE_parse_body("{ou_nozarafa_explain}"); $t = $_GET["t"]; $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory"); if (!is_numeric($EnableManageUsersTroughActiveDirectory)) { $EnableManageUsersTroughActiveDirectory = 0; } $AllowInternetUsersCreateOrg = $sock->GET_INFO("AllowInternetUsersCreateOrg"); if ($EnableManageUsersTroughActiveDirectory == 1) { $ldap = new ldapAD(); $hash = $ldap->hash_get_ou(true); } else { $ldap = new clladp(); $hash = $ldap->hash_get_ou(true); } if (!is_array($hash)) { json_error_show("No data..."); } ksort($hash); if ($EnableManageUsersTroughActiveDirectory == 0) { if (!$ldap->BuildOrganizationBranch()) { json_error_show("{GENERIC_LDAP_ERROR}<br>{$ldap->ldap_last_error}"); } } if ($_POST["query"] != null) { $search = $_POST["query"]; $search = str_replace(".", "\\.", $search); $search = str_replace("*", ".*?", $search); } if (isset($_GET["ajaxmenu"])) { $ajax = true; } $pic = "32-environement.png"; $style = "style='font-size:16px;'"; $c = 0; $ldap2 = new clladp(); if (count($hash) == 0) { json_error_show("no data"); } while (list($num, $ligne) = each($hash)) { $ou = $ligne; $ou_encoded = base64_encode($ou); if (!preg_match("#{$search}#i", $ligne)) { writelogs("'{$ligne}' NO MATCH {$search}", __FUNCTION__, __FILE__, __LINE__); continue; } $md = md5(serialize($hash) . time()); $md5S = $md; $uri = "javascript:Loadjs('domains.manage.org.index.php?js=yes&ou={$ligne}');"; if ($ajax) { $uri = "javascript:Loadjs('{$Mypage}?LoadOrgPopup={$ligne}');"; } $IsOUUnderActiveDirectory = $ldap2->IsOUUnderActiveDirectory($ou); $GroupsNB = 0; if ($EnableManageUsersTroughActiveDirectory == 0) { $img = $ldap->get_organization_picture($ligne, 32); writelogs("ldap->CountDeUSerOu({$ligne})", __FUNCTION__, __FILE__, __LINE__); $usersNB = $ldap->CountDeUSerOu($ligne); $usersNB = "{$usersNB}"; } else { $img = $pic; if ($IsOUUnderActiveDirectory) { $ad = new external_ad_search(); writelogs("ldap->CountDeUSerOu({$ligne})", __FUNCTION__, __FILE__, __LINE__); $usersNB = $ad->CountDeUSerOu($ligne); } else { writelogs("ldap->CountDeUSerOu({$ligne})", __FUNCTION__, __FILE__, __LINE__); $usersNB = $ldap->CountDeUSerOu($ligne); $usersNB = "{$usersNB}"; } } $delete = imgtootltip("delete-32-grey.png", "<b>{delete_ou} {$ligne}</b><br><i>{delete_ou_text}</i>"); if ($users->AsArticaAdministrator) { $delete = Paragraphe('64-cancel.png', "{delete_ou} {$ligne}", '{delete_ou_text}', "javascript:Loadjs('domains.delete.org.php?ou={$ligne}');", null, 210, 100, 0, true); $delete = imgsimple("delete-32.png", "<b>{delete_ou} {$ligne}</b><br><i>{delete_ou_text}</i>", "javascript:Loadjs('domains.delete.org.php?ou={$ligne}&t={$t}&id-table={$md5S}');"); } $DomainsNB = $ldap->CountDeDomainsOU($ligne); if ($GroupsNB == 0) { if ($IsOUUnderActiveDirectory) { $ad = new external_ad_search(); writelogs("->CountDeGroups({$ou})", __FUNCTION__, __FILE__, __LINE__); $GroupsNB = $ad->CountDeGroups($ou); } else { writelogs("->CountDeGroups({$ou})", __FUNCTION__, __FILE__, __LINE__); $GroupsNB = $ldap->CountDeGroups($ou); } } Paragraphe('folder-useradd-64.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true); Paragraphe('64-folder-group-add.png', '{create_user}', '{create_user_text}', "javascript:Loadjs('domains.add.user.php?ou={$ou}')", null, 210, null, 0, true); Paragraphe("64-folder-group-add.png", "{$ou}:{add_group}", "{add_a_new_group_in_this_org}:<b>{$ou}</b>", "javascript:Loadjs('domains.edit.group.php?popup-add-group=yes&ou={$ou}&t={$t}')"); $select = imgsimple("domain-32.png", "{manage_organisations_text}", $uri); $adduser = imgsimple("folder-useradd-32.png", "{$ou}<hr><b>{create_user}</b><br><i>{create_user_text}</i>", "Loadjs('domains.add.user.php?ou={$ou_encoded}&encoded=yes');"); $addgroup = imgsimple("32-folder-group-add.png", "{$ou}<hr><b>{add_group}</b><br><i>{add_a_new_group_in_this_org}</i>", "Loadjs('domains.edit.group.php?popup-add-group=yes&ou={$ou}&t={$t}');"); $SearchUser = imgsimple("loupe-32.png", "{$ou}<hr><b>{search}</b>:<i>{members}</i>", "Loadjs('domains.find.user.php?ou={$ou_encoded}&encoded=yes');"); $SearchGroup = imgsimple("loupe-32.png", "{$ou}<hr><b>{search}</b>:<i>{groups}</i>", "Loadjs('domains.find.groups.php?ou={$ou_encoded}&encoded=yes&t={$t}');"); $searchDomain = imgsimple("loupe-32.png", "{$ou}<hr><b>{localdomains}</b>:<i>{localdomains_text}</i>", "Loadjs('domains.edit.domains.php?js=yes&ou={$ou}&master-t={$t}');"); $NOZARAFA = 0; $OuZarafaText = null; if ($IsOUUnderActiveDirectory) { $delete = imgtootltip("delete-24-grey.png", "", ""); $adduser = imgsimple("folder-useradd-32-grey.png"); $addgroup = imgsimple("32-folder-group-add-grey.png"); } if ($_GET["zarafaF"] == 1) { $info = $ldap->OUDatas($ou); if (!$info["objectClass"]["zarafa-company"]) { $NOZARAFA = 1; $OuZarafaText = "<br><a href=\"javascript:blur()\" style='color:#B20808;text-decoration:underline;font-style:italic' \n\t\t\t\tOnClick=\"javascript:Loadjs('domains.edit.zarafa.php?ou={$ou_encoded}&t={$t}')\">{$ou_nozarafa_explain}</a>"; } } $array = array(); $array[] = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"{$uri}\" style='font-size:26px;font-weight:bolder;text-transform:capitalize;\n\t\ttext-decoration:underline'>{$ligne}</strong></a>{$OuZarafaText}"; if ($_GET["zarafaF"] == 1) { $zarafaEnabled = "zarafa-logo-32.png"; if ($NOZARAFA == 1) { $zarafaEnabled = "zarafa-logo-32-grey.png"; } $array[] = "<center>" . imgsimple($zarafaEnabled, "<strong style=font-size:26px>{$ou}:{APP_ZARAFA}</strong>\n\t\t\t\t\t<br>{ZARAFA_OU_ICON_TEXT}", "Loadjs('domains.edit.zarafa.php?ou={$ou_encoded}&t={$t}')") . "</center>"; } else { $array[] = " "; } $array[] = "<strong style='font-size:26px'>{$usersNB}</strong>"; $array[] = "<center style='font-size:16px'>{$SearchUser}</center>"; $array[] = "<strong style='font-size:26px'>{$GroupsNB}</strong>"; $array[] = "<center style='font-size:16px'>{$SearchGroup}</center>"; $array[] = "<strong style='font-size:26px'>{$DomainsNB}</strong>"; $array[] = "<center style='font-size:16px'>{$searchDomain}</center>"; $array[] = "<center style='font-size:16px'>{$adduser}</center>"; $array[] = "<center style='font-size:16px'>{$addgroup}</center>"; $array[] = "<center style='font-size:16px'>{$delete}</center>"; $c++; $data['rows'][] = array('id' => $md5S, 'cell' => $array); } $total = $c; $data['page'] = 1; $data['total'] = $total; echo json_encode($data); }
function ORGANISATIONS_LIST(){ $ldap=new clladp(); $page=CurrentPageName(); $hash=$ldap->hash_get_ou(true); $users=new usersMenus(); $sock=new sockets(); $AllowInternetUsersCreateOrg=$sock->GET_INFO("AllowInternetUsersCreateOrg"); if(!is_array($hash)){return null;} ksort($hash); if(!$ldap->BuildOrganizationBranch()){ $error="<div style='float:left'>".Paragraphe("danger64.png","{GENERIC_LDAP_ERROR}",$ldap->ldap_last_error)."</div>"; } $page=CurrentPageName(); if(isset($_GET["ajaxmenu"])){$header=" <input type='hidden' name='add_new_organisation_text' id='add_new_organisation_text' value='{add_new_organisation_text}'> <input type='hidden' name='ajaxmenu' id='ajaxmenu' value='yes'>"; } $html=" $header <div style='width:700px;height:550px'>$error"; if(isset($_GET["ajaxmenu"])){$ajax=true;} $html=$html."<div style='float:left'>".butadm()."</div>"; while (list ($num, $ligne) = each ($hash) ){ $md=md5($ligne); $uri="javascript:Loadjs('domains.manage.org.index.php?js=yes&ou=$ligne');"; if($ajax){ $uri="javascript:Loadjs('$page?LoadOrgPopup=$ligne');"; } $img=$ldap->get_organization_picture($ligne,64); $html=$html . "<div style='float:left'>" . Paragraphe($img,"{manage} $ligne"," <strong>$ligne:<br></strong>{manage_organisations_text}",$uri,null,220,100) . "</div> "; } if($AllowInternetUsersCreateOrg==1){ $sql="SELECT * FROM register_orgs WHERE sended=0 ORDER BY ou"; $q=new mysql(); $results=$q->QUERY_SQL($sql,"artica_backup"); if(!$q->ok){echo "<H2>$q->mysql_error</H2>";} while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){ $uri="javascript:Loadjs('domains.organizations.parameters.php?ou-sql-js={$ligne["zmd5"]}')"; $name=$ligne["ou"]; $time=$ligne["register_date"]; $html=$html . "<div style='float:left'>" . Paragraphe("img/org-warning-64.png","$name"," <strong>$time:<br></strong>{waiting}",$uri,null,220,100) . "</div> "; } } if($users->POSTFIX_INSTALLED){ $sendmail="<div style='float:left'>".Buildicon64('DEF_ICO_SENDTOALL',220,100)."</div>"; } if(isset($_GET["ajaxmenu"])){ $html=$html." <div style='float:left'>" .butadm()."</div>"; } if($users->AsArticaAdministrator){ $parameters="<div style='float:left'>".Paragraphe("parameters2-64.png","{organizations_parameters}"," {organizations_parameters_text}","javascript:Loadjs('domains.organizations.parameters.php')",null,220,100)."</div>"; } $ldap->ldap_close(); return "$parameters".$html."$sendmail</div>"; }
<?php include_once dirname(__FILE__) . '/ressources/class.templates.inc'; include_once dirname(__FILE__) . '/ressources/class.ldap.inc'; if (posix_getuid() != 0) { die("Cannot be used in web server mode\n\n"); } include_once dirname(__FILE__) . '/framework/class.unix.inc'; include_once dirname(__FILE__) . '/framework/frame.class.inc'; if (!Build_pid_func(__FILE__, "MAIN")) { writelogs(basename(__FILE__) . ":Already executed.. aborting the process", basename(__FILE__), __FILE__, __LINE__); die; } $ldap = new clladp(); $hash = $ldap->hash_get_ou(true); CleanTable(); while (list($num, $ligne) = each($hash)) { GeneratStats($num); } function CleanTable() { $q = new mysql(); $sql = "UPDATE smtp_logs SET bounce_error = 'Sended' WHERE bounce_error LIKE '250%'"; $q->QUERY_SQL($sql, "artica_events"); $sql = "UPDATE smtp_logs SET bounce_error = 'Sended' WHERE bounce_error LIKE 'delivered via%'"; $q->QUERY_SQL($sql, "artica_events"); $sql = "UPDATE smtp_logs SET bounce_error = 'Error' WHERE bounce_error LIKE '4.5.0 Error%'"; $q->QUERY_SQL($sql, "artica_events"); $sql = "UPDATE smtp_logs SET bounce_error = 'hostname not found' WHERE bounce_error LIKE '%cannot find your hostname%'"; $q->QUERY_SQL($sql, "artica_events"); $sql = "UPDATE smtp_logs SET bounce_error = 'DNS Error' WHERE bounce_error LIKE '%Name service error%'";
function instances_duplicate_form(){ $tpl=new templates(); $q=new mysql(); $page=CurrentPageName(); $ldap=new clladp(); $ous=$ldap->hash_get_ou(true); $ous[null]="{select}"; //try to find default values. writelogs("Build from -> {$_GET["instance-duplicate-form"]}",__FUNCTION__,__FILE__,__LINE__); $main=new maincf_multi($_GET["instance-duplicate-form"]); $tr=explode(".",$_GET["instance-duplicate-form"]); writelogs("Build from -> hostname {$tr[0]}",__FUNCTION__,__FILE__,__LINE__); $tr[0]=$tr[0]."-new"; $defhostname=@implode(".",$tr); writelogs("Build from -> Default hostname $defhostname",__FUNCTION__,__FILE__,__LINE__); $ipaddr=$main->ip_addr; writelogs("Build from -> source iP addr: $main->ip_addr",__FUNCTION__,__FILE__,__LINE__); $instance_ip_tbl=explode(".",$main->ip_addr); unset($instance_ip_tbl[count($instance_ip_tbl)-1]); $net=@implode(".",$instance_ip_tbl); writelogs("Build from -> Net: $net",__FUNCTION__,__FILE__,__LINE__); $sql="SELECT ipaddr FROM nics_virtuals WHERE ipaddr LIKE '$net.%' ORDER BY ID DESC LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql,"artica_backup")); $last_ip=$ligne["ipaddr"]; $instance_ip_tbl=explode(".",$last_ip); $last_number=$instance_ip_tbl[count($instance_ip_tbl)-1]; writelogs("Build from -> Ladt ip: {$ligne["ipaddr"]}, last number: $last_number",__FUNCTION__,__FILE__,__LINE__); unset($instance_ip_tbl[count($instance_ip_tbl)-1]); if($last_number<255){$last_number=$last_number+1;}else{$last_number="?";} $default_ip_addr=@implode(".",$instance_ip_tbl).".$last_number"; $html=" <div class=explain>{create_new_instance_based_on_this_instance_explain}</div> <table style='width:100%' class=form> <tr> <td class=legend>{ipaddr}:</td> <td>". Field_text("new-ip-addr",$default_ip_addr,"font-size:14px;padding:3px;width:120px")."</td> </tr> <tr> <td class=legend>{instance_server_name}:</td> <td>". Field_text("new-hostname",$defhostname,"font-size:14px;padding:3px;width:170px")."</td> </tr> <tr> <td class=legend>{organization}:</td> <td>". Field_array_Hash($ous,"ou-to-add",$main->ou,"style:font-size:14px;padding:3px")."</td> </tr> <tr> <td colspan=2 align=right><hr>". button("{add}","AddNewInstance()")."</td> </tr> </table> <script> var X_AddNewInstance= function (obj) { var results=obj.responseText; if(results.length>1){alert(results);PostfixInstancesSearch();return;} YahooWinHide(); PostfixInstancesSearch(); } function AddNewInstance(){ var XHR = new XHRConnection(); XHR.appendData('add-new-instance','yes'); XHR.appendData('ou',document.getElementById('ou-to-add').value); XHR.appendData('ip',document.getElementById('new-ip-addr').value); XHR.appendData('hostname',document.getElementById('new-hostname').value); XHR.appendData('src','{$_GET["instance-duplicate-form"]}'); document.getElementById('instances-list-table').innerHTML='<center><img src=img/wait_verybig.gif></center>'; XHR.sendAndLoad('$page', 'GET',X_AddNewInstance); } </script>"; echo $tpl->_ENGINE_parse_body($html); }
function AddNewInternetDomainForm_popup() { $page = CurrentPageName(); $tpl = new templates(); $t = $_GET["t"]; $tt = time(); $ldap = new clladp(); $ous = $ldap->hash_get_ou(true); $t = time(); $html = "\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:16px'>{organization}:</td>\n\t\t\t<td>" . Field_array_Hash($ous, "ou-{$t}", null, "style:font-size:16px;font-weight:bold") . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>{domain}:</td>\n\t\t\t<td>" . Field_text("domain-{$t}", null, "font-size:16px") . "</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td colspan=2 align=right><hr>" . button("{add}", "Save{$tt}();", 22) . "</td>\n\t\t</tr>\n\t\t</table>\n\t\t\t\t\t\n<script>\n\tvar xSave{$tt}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);}\n\t\t\$('#flexRT{$t}').flexReload();\n\t\tUnlockPage();\n\t\tif(document.getElementById('main_config_dhcpd')){RefreshTab('main_config_dhcpd');}\n\t}\nfunction Save{$t}(){\n\t\tLockPage();\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('AddNewInternetDomain',document.getElementById('ou-{$t}').value);\n\t\tXHR.appendData('AddNewInternetDomainDomainName',document.getElementById('domain-{$t}').value);\n\t\tXHR.sendAndLoad('{$page}', 'GET',xSave{$tt});\n\t\t}\n\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
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 vlan_add_form() { $ldap = new clladp(); $sock = new sockets(); $page = CurrentPageName(); $nics = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes"))); $title_button = "{add}"; $t = $_GET["t"]; if ($_GET["ID"] > 0) { $sql = "SELECT * FROM nics_vlan WHERE ID='{$_GET["ID"]}'"; $q = new mysql(); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $title_button = "{apply}"; } if (isset($_GET["default-datas"])) { $default_array = unserialize(base64_decode($_GET["default-datas"])); if (is_array($default_array)) { $ligne["nic"] = $default_array["NIC"]; if (preg_match("#(.+?)\\.([0-9]+)\$#", $default_array["IP"], $re)) { if ($re[2] > 254) { $re[2] = 1; } $re[2] = $re[2] + 1; $ligne["ipaddr"] = "{$re[1]}.{$re[2]}"; $ligne["gateway"] = $default_array["GW"]; $ligne["netmask"] = $default_array["NETMASK"]; } } } $styleOfFields = "font-size:16px;padding:3px"; $ous = $ldap->hash_get_ou(true); $ous["openvpn_service"] = "{APP_OPENVPN}"; while (list($num, $val) = each($nics)) { $nics_array[$val] = $val; } $nics_array[null] = "{select}"; $ous[null] = "{select}"; $nic_field = Field_array_Hash($nics_array, "nic", $ligne["nic"], null, null, 0, "font-size:16px;padding:3px"); $ou_fields = Field_array_Hash($ous, "org", $ligne["org"], null, null, 0, "font-size:16px;padding:3px"); if (!is_numeric($ligne["metric"])) { $ligne["metric"] = 0; } if ($ligne["metric"] == 0) { $ligne["metric"] = lastmetric(); } $html = "\n\t<div id='virtip-vlan-{$t}'></div>\n\t" . Field_hidden("ID", "{$_GET["ID"]}") . "\n\t<table style='width:99%' class=form> \n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{nic}</td>\n\t\t<td>{$nic_field}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{organization}</td>\n\t\t<td>{$ou_fields}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>Vlan ID</td>\n\t\t<td>" . Field_text("vlanid-{$t}", $ligne["vlanid"], "font-size:16px;width:60px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>{tcp_address}:</td>\n\t\t\t<td>" . field_ipv4("ipaddr", $ligne["ipaddr"], "font-size:16px", null, "CalcCdirVirt(0)", null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>{netmask}:</td>\n\t\t\t<td>" . field_ipv4("netmask", $ligne["netmask"], "font-size:16px", null, "CalcCdirVirt(0)", null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>CDIR:</td>\n\t\t\t<td style='padding:-1px;margin:-1px'>\n\t\t\t<table style='width:99%;padding:-1px;margin:-1px'>\n\t\t\t<tr>\n\t\t\t<td width=1%>\n\t\t\t" . Field_text("cdir", $ligne["cdir"], "font-size:16px;width:210px", null, null, null, false, null, $DISABLED) . "</td>\n\t\t\t<td align='left'> " . imgtootltip("img_calc_icon.gif", "cdir", "CalcCdirVirt(1)") . "</td>\n\t\t\t</tr>\n\t\t\t</table></td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>{gateway}:</td>\n\t\t\t<td>" . field_ipv4("gateway", $ligne["gateway"], "font-size:16px", null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{metric}</td>\n\t\t<td>" . Field_text("metric-{$t}", $ligne["metric"], "font-size:16px;width:60px") . "</td>\n\t</tr>\t\t\t\t\t\n\t</table>\n\n\t<div style='text-align:right'><hr>" . button($title_button, "VLANSave{$t}()", "18px") . "</div>\n\t<script>\n\t\n\t\tfunction VLANSave{$t}(){\t\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('vlan-ipaddr',document.getElementById('ipaddr').value);\n\t\t\tXHR.appendData('netmask',document.getElementById('netmask').value);\n\t\t\tXHR.appendData('cdir',document.getElementById('cdir').value);\n\t\t\tXHR.appendData('gateway',document.getElementById('gateway').value);\n\t\t\tXHR.appendData('nic',document.getElementById('nic').value);\n\t\t\tXHR.appendData('org',document.getElementById('org').value);\n\t\t\tXHR.appendData('ID',document.getElementById('ID').value);\n\t\t\tXHR.appendData('vlanid',document.getElementById('vlanid-{$t}').value);\n\t\t\tXHR.appendData('metric',document.getElementById('metric-{$t}').value);\n\t\t\tAnimateDiv('virtip-vlan-{$t}');\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',XVLANSave{$t});\n\t\t}\t\n\n\t\t\n\t\t\n\t\tfunction CheckCDR{$t}(){\n\t\t\tvar cdir=document.getElementById('cdir').value;\n\t\t\tvar netmask=document.getElementById('netmask').value;\n\t\t\tif(netmask.length>0){if(cdir.length==0){CalcCdirVirt(0);}}\n\t\t}\n\t\t\t\n\t\tvar XVLANSave{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tdocument.getElementById('virtip-vlan-{$t}').innerHTML='';\n\t\t\tif(results.length>0){alert(results);}\n\t\t\tYahooWin2Hide();\n\t\t\tif(document.getElementById('main_openvpn_config')){RefreshTab('main_openvpn_config');}\n\t\t\tVLANRefresh();\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\n\tCheckCDR{$t}();\n\t</script>\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }