示例#1
0
<form class="form-inline" role="form" action="{$uri_base}/SetupVirtualMailboxes/" method="POST">
  <button type="submit" class="btn btn-default">Setup virtual mailboxes</button>
</form>
EOF;
} else {
    echo '<p><a href="' . $uri_base . '/List/"><i class="fa fa-arrow-left"></i> Back to the listing</a></p><hr>';
    if ($path_info[1] == 'AddMailbox') {
        if (!empty($_POST['mailbox_name']) && !empty($_POST['password']) && !empty($_POST['password2'])) {
            if (in_array($_POST['mailbox_name'], UberspaceMM::getUsernames(true))) {
                $errors[] = 'The username <b>' . $_POST['mailbox_name'] . '</b> already exists';
            }
            if ($_POST['password'] != $_POST['password2']) {
                $errors[] = 'The passwords do not match';
            }
            if (empty($errors)) {
                if (UberspaceMM::addNewUser($_POST['mailbox_name'], $_POST['password'])) {
                    echo '<div class="alert alert-success"><b>Yay!</b> Added user <b>' . $_POST['mailbox_name'] . '</b>.</div>';
                } else {
                    echo '<div class="alert alert-danger"><b>Fawk!</b> Could not add the user <b>' . $_POST['mailbox_name'] . '</b>.</div>';
                }
            } else {
                echo '<div class="alert alert-danger"><b>Damn, there were errors!</b><br>';
                echo '- ' . implode('<br>- ', $errors);
                echo '</div>';
            }
        } else {
            echo '<div class="alert alert-warning"><b>Hey, you!</b> Please fill out every field.</div>';
        }
    } else {
        if ($path_info[1] == 'AddForwarder') {
            if (!empty($_POST['mailbox_name']) && !empty($_POST['destinations'])) {