if (!empty($_POST['mailbox_name'])) { if (in_array($_POST['mailbox_name'], UberspaceMM::getUsernames(true))) { if (UberspaceMM::changeForwards($_POST['mailbox_name'], implode(' ', explode(',', trim($_POST['destinations']))))) { echo '<div class="alert alert-success"><b>Yay!</b> Changed forwarding destinations for user <b>' . $_POST['mailbox_name'] . '</b>.</div>'; } else { echo '<div class="alert alert-danger"><b>Fuack!</b> It was impossible for me to change the destinations for the user <b>' . $_POST['mailbox_name'] . '</b>.</div>'; } } else { echo '<div class="alert alert-danger"><b>Fawk!</b> The user <b>' . $_POST['mailbox_name'] . '</b> does not exist.</div>'; } } else { echo '<div class="alert alert-warning"><b>Ey!</b> Please fill out every field.</div>'; } } else { if ($path_info[1] == 'SetupVirtualMailboxes') { if (UberspaceMM::setupVirtualMailboxes()) { echo '<div class="alert alert-success"><b>Yay!</b> Successfully set up virtual mailboxes.</div>'; } else { echo '<div class="alert alert-danger"><b>Fuack!</b> I encountered an error while trying to set virtual mailboxes up.</div>'; } } else { echo '<div class="alert alert-warning"><b>Oh noes!</b> This page does not exist.</div>'; } } } } } } } } ?>
<style> a { text-decoration: none !important; } </style> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="page-header"> <h1><a href="https://github.com/LucaKling/UberspaceMM"><i class="fa fa-github"></i> UberspaceMM</a>::getUsernames() example</h1> </div> <?php require_once '../UberspaceMM.class.php'; echo '<table class="table table-bordered table-hover">'; echo '<tr><th>Name</th><th>Type</th><th>Forwarding destinations</th></tr>'; foreach (UberspaceMM::getUsernames() as $arrUser) { echo '<tr><td>' . $arrUser['name'] . '</td><td>' . ($arrUser['isMailbox'] ? 'Mailbox' : 'Forwarder') . '</td><td>' . implode(', ', $arrUser['forwards']) . '</td></tr>'; } echo '</table>'; ?> <hr> <p>© 2014 - <a href="https://github.com/LucaKling">Luca Kling</a></p> </div> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script> </body> </html>