function PostfixAddRoutingRuleTable(){ $page=CurrentPageName(); $main=new main_cf(); $service=$main->HashGetMasterCfServices(); $service["smtp"]="smtp"; $ldap=new clladp(); $ORG=$ldap->hash_get_ou(true); ksort($service); $ORG[null]='{select}'; if(isset($_GET["domainName"])){ $Table=$ldap->hash_load_transport(); $t=new DomainsTools(); $domainName=$_GET["domainName"]; $line=$Table[$domainName]; writelogs("LINE=$line for $domainName",__FUNCTION__,__FILE__); $conf=$t->transport_maps_explode($Table[$domainName]); $relay_address=$conf[1]; $smtp_port=$conf[2]; $MX_lookups=$conf[3]; $relay_service=$conf[0]; $orgfound=$ldap->organization_name_from_transporttable($domainName); } $organization=Field_array_Hash($ORG,'org',$orgfound); if($relay_service==null){$relay_service="smtp";} $html=" <h1>{routing_rule}</H1> "; $form=" <br>" . RoundedLightWhite(" <form name='FFM3'> <input type='hidden' name='PostfixAddRoutingRuleTableSave' value='yes'> <table style='width:100%'> <tr> <td align='right' class=legend>{organization}:</strong></td> <td style='font-size:12px'>$organization</td> </tr> <tr> <td align='right' class=legend>{pattern}:</strong></td> <td style='font-size:12px'>" . Field_text('domain',$domainName,'width:50%',null,null,'{transport_maps_pattern_explain}') . "</td> </tr> <tr> <td align='right' class=legend>{service}:</strong></td> <td style='font-size:12px'>" . Field_array_Hash($service,'service',$relay_service) . "</td> </tr> <td align='right' nowrap class=legend>{address}:</strong></td> <td style='font-size:12px'>" . Field_text('relay_address',$relay_address) . "</td> </tr> </tr> <td align='right' nowrap class=legend>{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}","PostfixAddNewRoutingTable()")."</td> </tr> <tr> <td align='left' colspan=2><hr><p class=caption{MX_lookups}</strong><br>{MX_lookups_text}</p></td> </tr> </table> </FORM> <script> var X_PostfixAddNewRoutingTable= function (obj) { var results=obj.responseText; if (results.length>0){alert(results);} if(document.getElementById('container-tabs')){ $('#container-tabs').tabs( 'load' ,1 ); } YahooWinHide(); } function PostfixAddNewRoutingTable(){ var XHR = new XHRConnection(); XHR.appendData('PostfixAddRoutingRuleTableSave','yes'); XHR.appendData('org',document.getElementById('org').value); XHR.appendData('domain',document.getElementById('domain').value); XHR.appendData('service',document.getElementById('service').value); XHR.appendData('relay_address',document.getElementById('relay_address').value); XHR.appendData('relay_port',document.getElementById('relay_port').value); XHR.appendData('MX_lookups',document.getElementById('MX_lookups').value); XHR.sendAndLoad('$page', 'GET',X_PostfixAddNewRoutingTable); } </script> "); $tpl=new templates(); echo $tpl->_ENGINE_parse_body("$html$form"); }
function BuildLevel2($ou) { $ldap = new clladp(); $privileges = new usersMenus($_GET["PRIVS"]); $HashDomains = $ldap->hash_get_domains_ou($ou); $hash_group = $ldap->hash_groups($ou); $hash_transport = $ldap->hash_load_transport(); $hash_users = $ldap->hash_get_users_Only_ou($ou); writelogs("BuildLevel2 ->{$ou} users number=" . count($hash_users), __FUNCTION__, basename(__FILE__)); if ($privileges->AllowChangeDomains == true) { if (is_array($HashDomains)) { while (list($num, $ligne) = each($HashDomains)) { $items = $items . "{\n"; $items = $items . "\t\t\t'id' : 'domain:{$ou},{$num}',\n"; $items = $items . "\t\t\t'txt' : '{$ligne}',\n"; if (isset($hash_transport[$ligne])) { $items = $items . "\t\t\t'img' : 'alias-18.gif',\n"; } else { $items = $items . "\t\t\t'img' : 'globe.gif',\n"; } $items = $items . "\t\t\t'editable' : false,\n"; $items = $items . "\t\t\t'draggable' : false\n"; $items = $items . "\t\t\t},"; } } } if (is_array($hash_users)) { if (count($hash_users) > 50) { $count = count($hash_users); $items = $items . "{\n"; $items = $items . "\t\t\t'id' : 'users:{$ou}',\n"; $items = $items . "\t\t\t'txt' : '{$count} users',\n"; $items = $items . "\t\t'openlink' : 'ldapTree.php',\n"; $items = $items . "\t\t'draggable' : true,\n"; $items = $items . "\t\t\t'img' : 'family-20.gif'\n"; $items = $items . "\t\t\t},"; } } if (is_array($hash_group)) { while (list($num, $ligne) = each($hash_group)) { $num = str_replace("'", "`", $num); if (strlen($num) > 20) { $num = substr($num, 0, 17) . "..."; } $items = $items . "{\n"; $items = $items . "\t\t\t'id' : 'group:{$ligne["gid"]}',\n"; $items = $items . "\t\t\t'txt' : '{$num}',\n"; $items = $items . "\t\t\t'img' : 'tree-groups',\n"; $items = $items . "\t\t\t'editable' : true,\n"; $items = $items . "\t\t\t'draggable' : false,\n"; $items = $items . "\t\t'onopenpopulate' : myOpenPopulate,\n"; $items = $items . "\t\t'openlink' : 'ldapTree.php',\n"; $items = $items . "\t\t'canhavechildren' : true\n"; $items = $items . "\t\t\t},"; } } if (is_array($hash_users)) { if (count($hash_users) < 50) { while (list($num, $ligne) = each($hash_users)) { $userdatas = $ldap->UserDatas($ligne); $ligne = str_replace("'", "\\'", $ligne); $name = $userdatas["displayName"]; $name = str_replace("'", "`", $name); $items = $items . "{\n"; $items = $items . "\t\t\t'id' : 'user:{$ligne}',\n"; $items = $items . "\t\t\t'txt' : '{$name}',\n"; $items = $items . "\t\t'openlink' : 'ldapTree.php',\n"; $items = $items . "\t\t'draggable' : true,\n"; $items = $items . "\t\t\t'img' : 'outicon_1002.gif'\n"; $items = $items . "\t\t\t},"; } } } if ($items[strlen($items) - 1] == ',') { $items = substr($items, 0, strlen($items) - 1); } return $items; }
function PopUp_DomainTransport() { $ldap = new clladp(); $tpl = new templates(); $domain = $_GET["LoadDomainSettings"]; $ou = $_GET["LoadDomainSettingsOu"]; $hash_transport = $ldap->hash_load_transport(); if (isset($hash_transport[$domain])) { $service = array("smtp" => "smtp", "relay" => "relay", "lmtp" => "lmtp"); $m = new DomainsTools($hash_transport[$domain]); $transport = "\n\t\t\t<fieldset><legend>{$domain} {relay} </legend>\n\t\t\t<span style='font-size:9px;'><i>{relay explain}</i></span>\n\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width=1% valign='top'><img src='img/alias-64.gif'></td>\n\t\t\t\t\t<td valign='top'>\n\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right'><strong>{transport_ip}:</td>" . Field_text('transport_ip', $m->transport_ip) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tR>\n\t\t\t\t\t\t\t<td align='right'><strong>{transport_type}:</td>" . Field_array_Hash($service, 'transport_type', $m->transport_type, null, null, 0, 'width:99%') . "</td>\t\t\t\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right'><strong>{transport_port}:</td>" . Field_text('transport_port', $m->transport_port) . "</td>\n\t\t\t\t\t\t</tr>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right' colspan=2><input type='button' value='{label_edit_transport}' OnClick=\"javascript:SaveTransportDomain('{$domain}','{$ou}');\"></td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\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</table>\n\t\t\t</fieldset>"; } else { $transport = "<fieldset><legend>{$domain} {relay} </legend><img src='img/alias-64.gif' align='left' style='margin:5px'>\n\t\t\t\t<span style='font-size:9px;'><i>{relay explain}<br>{relay explain 2}</i></span>\n\t\t\t\t<br><center>\n\t\t\t\t\t<input type='hidden' id='relay explain 3' value=\"{relay explain 3}\">\n\t\t\t\t\t<input type='button' value='{label_add_transport}' OnClick=\"javascript:AddTransportToDomain('{$domain}','{$ou}','{$ldap->suffix}');\">\n\t\t\t\t</center>\n\t\t\t\t</fieldset>\n\t\t\t\t"; } return $tpl->_ENGINE_parse_body($transport); }
function PostfixAddRoutingRuleTable() { $page = CurrentPageName(); $main = new main_cf(); $users = new usersMenus(); $tpl = new templates(); if (!$users->AsPostfixAdministrator) { echo "<script>alert('" . $tpl->javascript_parse_text("{ERROR_NO_PRIVS}") . "');</script>"; die; } $service = $main->HashGetMasterCfServices(); $service["smtp"] = "smtp"; $ldap = new clladp(); $ORG = $ldap->hash_get_ou(true); ksort($service); $ORG[null] = '{select}'; if (isset($_GET["domainName"])) { $Table = $ldap->hash_load_transport(); $t = new DomainsTools(); $domainName = $_GET["domainName"]; $line = $Table[$domainName]; writelogs("LINE={$line} for {$domainName}", __FUNCTION__, __FILE__); $conf = $t->transport_maps_explode($Table[$domainName]); $relay_address = $conf[1]; $smtp_port = $conf[2]; $MX_lookups = $conf[3]; $relay_service = $conf[0]; $orgfound = $ldap->organization_name_from_transporttable($domainName); } $organization = Field_array_Hash($ORG, 'org', $orgfound, "style:font-size:14px;padding:3px"); if ($relay_service == null) { $relay_service = "smtp"; } $html = "\n\t<div style='font-size:16px'>{routing_rule}::{$domainName}</div>\n\t"; $form = "\n\t\n\t<form name='FFM3'>\n\t<input type='hidden' name='PostfixAddRoutingRuleTableSave' value='yes'>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t<td align='right' class=legend>{organization}:</strong></td>\n\t<td style='font-size:14px'>{$organization}</td>\n\t</tr>\t\n\t<tr>\n\t<td align='right' class=legend>{pattern}:</strong></td>\n\t<td style='font-size:14px'>" . Field_text('domain', $domainName, 'font-size:14px;width:50%', null, null, '{transport_maps_pattern_explain}') . "</td>\n\t</tr>\n\t<tr>\n\t<td align='right' class=legend>{service}:</strong></td>\n\t<td style='font-size:14px'>" . Field_array_Hash($service, 'service', $relay_service, "style:font-size:14px") . "</td>\n\t</tr>\t\n\t<td align='right' nowrap class=legend>{address}:</strong></td>\n\t<td style='font-size:14px'>" . Field_text('relay_address', $relay_address, "font-size:16px;width:120px") . "</td>\t\n\t</tr>\n\t</tr>\n\t<td align='right' nowrap class=legend>{port}:</strong></td>\n\t<td style='font-size:14px'>" . Field_text('relay_port', $smtp_port, "font-size:16px;width:55px") . "</td>\t\n\t</tr>\t\n\t<tr>\n\t<td align='right' nowrap>" . Field_yesno_checkbox_img('MX_lookups', $MX_lookups, '{enable_disable}') . "</td>\n\t<td style='font-size:14px'>{MX_lookups}</td>\t\n\t</tr>\n\t{$sasl}\n\t<tr>\n\t<td align='right' colspan=2>" . button("{apply}", "PostfixAddNewRoutingTable()") . "</td>\n\t</tr>\t\t\n\t<tr>\n\t<td align='left' colspan=2><hr><div class=text-info><strong>{MX_lookups}</strong><br>{MX_lookups_text}</div></td>\n\t</tr>\t\t\t\n\t\t\n\t</table>\n\t</FORM>\n<script>\nvar X_PostfixAddNewRoutingTable= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif (results.length>0){alert(results);}\n\t\tif(document.getElementById('container-tabs')){\n\t\t\t\$('#container-tabs').tabs( 'load' ,1 );\n\t\t}\n\t\tYahooWinHide();\n\t}\t\t\nfunction PostfixAddNewRoutingTable(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('PostfixAddRoutingRuleTableSave','yes');\n\t\tXHR.appendData('org',document.getElementById('org').value);\n\t\tXHR.appendData('domain',document.getElementById('domain').value);\n\t\tXHR.appendData('service',document.getElementById('service').value);\n\t\tXHR.appendData('relay_address',document.getElementById('relay_address').value);\n\t\tXHR.appendData('relay_port',document.getElementById('relay_port').value);\n\t\tXHR.appendData('MX_lookups',document.getElementById('MX_lookups').value);\t\t\t\t\n\t\tXHR.sendAndLoad('{$page}', 'GET',X_PostfixAddNewRoutingTable);\n\t}\t\t\n\t\n</script>\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body("{$html}{$form}"); }