function relayhost()
{
    $sock = new sockets();
    $PostfixRelayHost = trim($sock->GET_INFO("PostfixRelayHost"));
    if ($PostfixRelayHost == null) {
        shell_exec("{$GLOBALS["postconf"]} -e \"relayhost =\" >/dev/null 2>&1");
        return null;
    }
    $tools = new DomainsTools();
    $hash = $tools->transport_maps_explode($PostfixRelayHost);
    if ($hash[2] == null) {
        $hash[2] = 25;
    }
    $PostfixRelayHost_pattern = "[{$hash[1]}]:{$hash[2]}";
    echo "Starting......: Relay host: {$PostfixRelayHost_pattern}\n";
    $ldap = new clladp();
    $sasl_password_string = $ldap->sasl_relayhost($hash[1]);
    if ($sasl_password_string != null) {
        $relayhost_hash = "{$PostfixRelayHost_pattern}\t{$sasl_password_string}\n";
        @file_put_contents("/etc/postfix/sasl_passwd", $relayhost_hash);
        shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/sasl_passwd >/dev/null 2>&1");
        shell_exec("{$GLOBALS["postconf"]} -e \"smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd\" >/dev/null 2>&1");
    }
    shell_exec("{$GLOBALS["postconf"]} -e \"relayhost ={$PostfixRelayHost_pattern}\" >/dev/null 2>&1");
}
Exemplo n.º 2
0
function orangefr_popup()
{
    $sasl = new smtp_sasl_password_maps();
    $domain = new DomainsTools();
    $ISP = $_GET["isp"];
    $ini = new Bs_IniHandler();
    $ldap = new clladp();
    $ini->loadFile("ressources/databases/isp.defaults.settings.conf");
    $default_server = $ini->_params[$ISP]["default_server"];
    $default_port = $ini->_params[$ISP]["default_port"];
    $serverstring = $domain->transport_maps_implode($default_server, $default_port, null, "no");
    $auth = $ldap->sasl_relayhost($default_server);
    if ($auth != null) {
        if (preg_match('#(.+?):(.+)#', $auth, $re)) {
            $username = $re[1];
            $password = $re[2];
        }
    }
    $tpl = new templates();
    $isp_server_address_label = $tpl->_ENGINE_parse_body('{isp_server_address}');
    $isp_server_port_label = $tpl->_ENGINE_parse_body('{isp_server_port}');
    if (strlen($isp_server_address_label) > 25) {
        $isp_server_address_label = texttooltip(substr($isp_server_address_label, 0, 22) . '...', $isp_server_address_label, null, 1);
    }
    if (strlen($isp_server_port_label) > 25) {
        $isp_server_port_label = texttooltip(substr($isp_server_port_label, 0, 22) . '...', $isp_server_port_label, null, 1);
    }
    $page = CurrentPageName();
    $text = "\n\t<div id='anim'></div>\n\t<p class=caption style='font-size:12px'>{please_verify_addressisp}</p>\n\t<strong style='font-size:13px'>{technical_address}:<code>{$serverstring}</code></strong><br>\n\t<form name='FFMISPRELAY'>\n\t<table style='width:100%;background-color:#FFFFFF;border:1px solid #CCCCCC;padding:5px'>\n\t\t<tr>\n\t\t\t<td class=legend nowrap>{$isp_server_address_label}</td>\n\t\t\t<td>" . Field_text('isp_address', $default_server, 'width:220px;') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend nowrap>{$isp_server_port_label}</td>\n\t\t\t<td>" . Field_text('isp_port', $default_port, 'width:30px;') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend nowrap>{username}</td>\n\t\t\t<td>" . Field_text('isp_username', $username, 'width:190px;') . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend nowrap>{password}</td>\n\t\t\t<td>" . Field_password('isp_password', $password, 'width:90px;') . "</td>\n\t\t</tr>\t\n\t\t<tr><td colspan=2>&nbsp;</td></tr>\n\t\t<tr>\n\t\t\t<td colspan=2 style='padding-top:4px;border-top:1px solid #CCCCCC' align='right'>\n\t\t\t" . button("{apply}", "FFMISPRELAY_SAVE()") . "\n\t\t\t\t\n\t\t\t</td\n\t\t</tr>\n\t</table>\t\n\t\n\t";
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1%><img src='img/{$ini->_params[$ISP]["default_icon"]}' style='margin:4px;padding:5px;border:1px solid #7B787E;background-color:white'></td>\n\t\t<td style='vertical-align:top'>{$text}</td>\n\t</tr>\n\t</table>\n\t<script>\t\t\n\tvar x_FFMISPRELAY_SAVE=function(obj){\n    \tvar tempvalue=trim(obj.responseText);\n\t  \tif(tempvalue.length>3){alert(tempvalue);}\n\t\tdocument.getElementById('anim').innerHTML='';\n\t\t}\n\t\n\t\tfunction FFMISPRELAY_SAVE(){\n\t\t\tvar XHR = new XHRConnection(); \n\t\t\tXHR.appendData('isp_address',document.getElementById('isp_address').value);\n\t\t\tXHR.appendData('isp_password',document.getElementById('isp_password').value);\n\t\t\tXHR.appendData('isp_port',document.getElementById('isp_port').value);\n\t\t\tXHR.appendData('isp_username',document.getElementById('isp_username').value);\n\t\t\tdocument.getElementById('anim').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>';\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_FFMISPRELAY_SAVE);\n\t\t}\t\t\n\t\t\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}