use actions

This commit is contained in:
Synox 2018-02-23 21:55:08 +01:00
parent 92ee25dbf6
commit e66fd86dc7
2 changed files with 4 additions and 4 deletions

View File

@ -88,7 +88,7 @@ $purifier = new HTMLPurifier($purifier_config);
mailbox:
</small>
<form id="header-form" data-turbolinks-permanent action="?" method="post">
<form id="header-form" data-turbolinks-permanent action="?action=redirect" method="post">
<div class="form-group row">
<div class="col-lg-5 col-md-4 col-sm-6 col-xs-12">
@ -177,7 +177,7 @@ $purifier = new HTMLPurifier($purifier_config);
<div class="col-sm-4 text-right">
<a class="btn btn-sm btn-outline-primary " download="true"
role="button"
href="?download_email_id=<?php echo $safe_email_id; ?>&amp;address=<?php echo $user->address ?>">Download
href="?action=download_email&download_email_id=<?php echo $safe_email_id; ?>&amp;address=<?php echo $user->address ?>">Download
</a>
<a class="btn btn-sm btn-outline-danger"

View File

@ -29,10 +29,10 @@ class Router {
function route(): Page {
// TODO: use $this->action
if (isset($this->post_vars['username']) && isset($this->post_vars['domain'])) {
if ($this->action === "redirect" && isset($this->post_vars['username']) && isset($this->post_vars['domain'])) {
return new RedirectToAddressPage($this->post_vars['username'], $this->post_vars['domain']);
} elseif (isset($this->get_vars['download_email_id']) && isset($this->get_vars['address'])) {
} elseif ($this->action === "download_email" && isset($this->get_vars['download_email_id']) && isset($this->get_vars['address'])) {
return new DownloadEmailPage($this->get_vars['download_email_id'], $this->get_vars['address'], $this->config['domains']);
} elseif (isset($this->get_vars['delete_email_id']) && isset($this->get_vars['address'])) {