Example #1
0
function MailBoxTransport()
{
    $main = new maincf_multi();
    if (!isset($GLOBALS["CLASS_SOCKET"])) {
        $GLOBALS["CLASS_SOCKET"] = new sockets();
        $sock = $GLOBALS["CLASS_SOCKET"];
    } else {
        $sock = $GLOBALS["CLASS_SOCKET"];
    }
    if (!isset($GLOBALS["CLASS_USERS_MENUS"])) {
        $users = new usersMenus();
        $GLOBALS["CLASS_USERS_MENUS"] = $users;
    } else {
        $users = $GLOBALS["CLASS_USERS_MENUS"];
    }
    $default = $main->getMailBoxTransport();
    postconf("zarafa_destination_recipient_limit", 1);
    echo "Starting......: Postfix mailbox_transport {$default}\n";
    postconf("mailbox_transport", $default);
    system("{$GLOBALS["postconf"]} -e \"zarafa_destination_recipient_limit = 1\" >/dev/null 2>&1");
    if (preg_match("#lmtp:(.+?):[0-9]+#", $default)) {
        if (!$users->ZARAFA_INSTALLED) {
            if (!$users->cyrus_imapd_installed) {
                echo "Starting......: Postfix None of Zarafa or cyrus imap installed on this server\n";
                disable_lmtp_sasl();
                return null;
            }
            echo "Starting......: Postfix \"LMTP\" is enabled ({$default})\n";
            $ldap = new clladp();
            $CyrusLMTPListen = trim($sock->GET_INFO("CyrusLMTPListen"));
            $cyruspass = $ldap->CyrusPassword();
            if ($CyrusLMTPListen != null) {
                @file_put_contents("/etc/postfix/lmtpauth", "{$CyrusLMTPListen}\tcyrus:{$cyruspass}");
                shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/lmtpauth");
                postconf("lmtp_sasl_auth_enable", "yes");
                postconf("lmtp_sasl_password_maps", "hash:/etc/postfix/lmtpauth");
                postconf("lmtp_sasl_mechanism_filter", "plain, login");
                postconf("lmtp_sasl_security_options", null);
            }
        }
    } else {
        disable_lmtp_sasl();
    }
}
function MailBoxTransport()
{
    $main = new maincf_multi();
    $sock = new sockets();
    $users = new usersMenus();
    $default = $main->getMailBoxTransport();
    system("{$GLOBALS["postconf"]} -e \"zarafa_destination_recipient_limit = 1\" >/dev/null 2>&1");
    system("{$GLOBALS["postconf"]} -e \"mailbox_transport = {$default}\" >/dev/null 2>&1");
    if (preg_match("#lmtp:(.+?):[0-9]+#", $default)) {
        if (!$users->ZARAFA_INSTALLED) {
            if (!$users->cyrus_imapd_installed) {
                disable_lmtp_sasl();
                return null;
            }
            echo "Starting......: Postfix LMTP is enabled {$default}\n";
            $ldap = new clladp();
            $CyrusLMTPListen = trim($sock->GET_INFO("CyrusLMTPListen"));
            $cyruspass = $ldap->CyrusPassword();
            @file_put_contents("/etc/postfix/lmtpauth", "{$CyrusLMTPListen}\tcyrus:{$cyruspass}");
            shell_exec("{$GLOBALS["postmap"]} hash:/etc/postfix/lmtpauth");
            system("{$GLOBALS["postconf"]} -e \"lmtp_sasl_auth_enable = yes\" >/dev/null 2>&1");
            system("{$GLOBALS["postconf"]} -e \"lmtp_sasl_password_maps = hash:/etc/postfix/lmtpauth\" >/dev/null 2>&1");
            system("{$GLOBALS["postconf"]} -e \"lmtp_sasl_mechanism_filter = plain, login\" >/dev/null 2>&1");
            system("{$GLOBALS["postconf"]} -e \"lmtp_sasl_security_options =\" >/dev/null 2>&1");
        }
    } else {
        disable_lmtp_sasl();
    }
}