Example #1
0
//delete accounts if requested
if ($task == 'save_account') {
    $task = 'account';
    $mbroot = isset($_POST['mbroot']) ? smart_addslashes($_POST['mbroot']) : '';
    if ($_POST['name'] == "" || $_POST['mail_address'] == "" || $_POST['port'] == "" || $_POST['user'] == "" || $_POST['pass'] == "" || $_POST['host'] == "") {
        $feedback = $error_missing_field;
    } else {
        $use_ssl = isset($_REQUEST['use_ssl']) ? '1' : '0';
        $novalidate_cert = isset($_REQUEST['novalidate_cert']) ? '1' : '0';
        $sent = $_POST['type'] == 'pop3' ? '' : smart_addslashes($_POST['sent']);
        $draft = $_POST['type'] == 'pop3' ? '' : smart_addslashes($_POST['draft']);
        $spam = $_POST['type'] == 'pop3' ? '' : smart_addslashes($_POST['spam']);
        $trash = $_POST['type'] == 'pop3' ? '' : smart_addslashes($_POST['trash']);
        $auto_check = isset($_POST['auto_check']) ? '1' : '0';
        if (isset($_POST['account_id'])) {
            if (!$email->update_account($_POST['account_id'], $_POST['type'], smart_addslashes($_POST['host']), $_POST['port'], $use_ssl, $novalidate_cert, $mbroot, smart_addslashes($_POST['user']), $_POST['pass'], smart_addslashes($_POST['name']), smart_addslashes($_POST['mail_address']), smart_addslashes($_POST['signature']), $sent, $spam, $trash, $draft, $auto_check)) {
                $feedback = '<p class="Error">' . $ml_connect_failed . ' \'' . $_POST['host'] . '\' ' . $ml_at_port . ': ' . $_POST['port'] . '</p>';
                $feedback .= '<p class="Error">' . $email->last_error . '</p>';
            } else {
                header('Location: ' . $return_to);
                exit;
            }
        } else {
            if (!($email_id = $email->add_account($GO_SECURITY->user_id, $_POST['type'], smart_addslashes($_POST['host']), $_POST['port'], $use_ssl, $novalidate_cert, $mbroot, smart_addslashes($_POST['user']), $_POST['pass'], smart_addslashes($_POST['name']), smart_addslashes($_POST['mail_address']), smart_addslashes($_POST['signature']), $sent, $spam, $trash, $draft, $auto_check))) {
                $feedback = '<p class="Error">' . $ml_connect_failed . ' \'' . $_POST['host'] . '\' ' . $ml_at_port . ': ' . $_POST['port'] . '</p>' . '<p class="Error">' . $email->last_error . '</p>';
            } else {
                header('Location: ' . $return_to);
                exit;
            }
        }
    }
$return_to = isset($_REQUEST['return_to']) && $_REQUEST['return_to'] != '' ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];
$link_back = isset($_REQUEST['link_back']) && $_REQUEST['link_back'] != '' ? $_REQUEST['link_back'] : $_SERVER['REQUEST_URI'];
//delete accounts if requested
if ($task == 'save_account') {
    $task = 'account';
    $mbroot = isset($_POST['mbroot']) ? $_POST['mbroot'] : '';
    if ($_POST['name'] == "" || $_POST['mail_address'] == "" || $_POST['port'] == "" || $_POST['user'] == "" || $_POST['pass'] == "" || $_POST['host'] == "") {
        $feedback = $error_missing_field;
    } else {
        $sent = $_POST['type'] == 'pop3' ? '' : $_POST['sent'];
        $draft = $_POST['type'] == 'pop3' ? '' : $_POST['draft'];
        $spam = $_POST['type'] == 'pop3' ? '' : $_POST['spam'];
        $trash = $_POST['type'] == 'pop3' ? '' : $_POST['trash'];
        $auto_check = isset($_POST['auto_check']) ? '1' : '0';
        if (isset($_POST['account_id'])) {
            if (!$email->update_account($_POST['account_id'], $_POST['type'], $_POST['host'], $_POST['port'], $mbroot, $_POST['user'], $_POST['pass'], $_POST['name'], $_POST['mail_address'], $_POST['signature'], $sent, $spam, $trash, $draft, $auto_check)) {
                $feedback = '<p class="Error">' . $ml_connect_failed . ' \'' . $_POST['host'] . '\' ' . $ml_at_port . ': ' . $_POST['port'] . '</p>';
                $feedback .= '<p class="Error">' . $email->last_error . '</p>';
            }
        } else {
            if (!($email_id = $email->add_account($GO_SECURITY->user_id, $_POST['type'], $_POST['host'], $_POST['port'], $mbroot, $_POST['user'], $_POST['pass'], $_POST['name'], $_POST['mail_address'], $_POST['signature'], $sent, $spam, $trash, $draft, $auto_check))) {
                $feedback = '<p class="Error">' . $ml_connect_failed . ' \'' . $_POST['host'] . '\' ' . $ml_at_port . ': ' . $_POST['port'] . '</p>';
                $feedback .= '<p class="Error">' . $email->last_error . '</p>';
            }
        }
    }
}
require $GO_THEME->theme_path . "header.inc";
echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '" name="email_client">';
echo '<input type="hidden" name="task" value="" />';
echo '<input type="hidden" name="close" value="false" />';