remove edit-alias for users

This commit is contained in:
mischa 2022-09-04 17:46:03 +00:00
parent d9a0010d04
commit cd1751bd6a
3 changed files with 0 additions and 126 deletions

View File

@ -1,31 +0,0 @@
<div id="edit_form">
<form name="edit_alias" method="post">
<table>
<tr>
<td colspan="2"><h3><?php echo $LANG['Edit_alias_welcome']; ?></h3></td>
</tr>
<tr>
<td><?php echo $LANG['Edit_alias_address'] . ":"; ?></td>
<td><?php echo $SESSID_USERNAME; ?></td>
</tr>
<tr>
<td><?php echo $LANG['Edit_alias_goto'] . ":"; ?></td>
<td>
<textarea class="flat" rows="4" cols="60" name="goto">
<?php
foreach ($goto as $row) {
echo "$row\n";
}
?>
</textarea>
</td>
</tr>
<tr>
<td colspan="2" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php echo $LANG['Edit_alias_button']; ?>"></td>
</tr>
<tr>
<td colspan="2" class="standout"><?php echo $message ?? '&nbsp;'; ?></td>
</tr>
</table>
</form>
</div>

View File

@ -3,7 +3,6 @@
<?php if ($CONF['vacation'] == "YES") { ?>
<li><a target="_top" href="vacation.php"><?php echo $LANG['UsersMenu_vacation']; ?></a></li>
<?php } ?>
<li><a target="_top" href="edit-alias.php"><?php echo $LANG['UsersMenu_edit_alias']; ?></a></li>
<li><a target="_top" href="password.php"><?php echo $LANG['UsersMenu_password']; ?></a></li>
<li><a target="_top" href="logout.php"><?php echo $LANG['Menu_logout']; ?></a></li>
</ul>

View File

@ -1,94 +0,0 @@
<?php
//
// OpenSMTPD Admin
// by Mischa Peters <mischa at high5 dot nl>
// Copyright (c) 2022 High5!
// License Info: LICENSE.TXT
//
// File: edit-alias.php
//
// Template File: edit-alias.tpl
//
// Template Variables:
//
// message
// goto
//
// Form POST \ GET Variables:
//
// address
// domain
// goto
//
require_once './functions.inc.php';
include './languages/' . check_language() . '.lang';
$SESSID_USERNAME = check_session();
$list_domains = list_domains($SESSID_USERNAME);
$admin = $SESSID_USERNAME ?? ADMIN_EMAIL;
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$address = filter_input(INPUT_GET, 'address', FILTER_VALIDATE_EMAIL);
$domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
if ($domain_exist) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("SELECT goto FROM alias WHERE address=? AND domain=?");
$sth->bindParam(1, $address, PDO::PARAM_STR);
$sth->bindParam(2, $domain, PDO::PARAM_STR);
$sth->execute();
$goto = $sth->fetch(PDO::FETCH_COLUMN);
$goto = explode(',', $goto);
} catch(PDOException $e) {
$message = $LANG['Edit_alias_address_error'];
}
}
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$address = strtolower(filter_input(INPUT_GET, 'address', FILTER_VALIDATE_EMAIL));
$domain = strtolower(filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN));
$goto = strtolower(filter_input(INPUT_POST, 'goto', FILTER_DEFAULT));
$domain_key = array_search($domain, array_column($list_domains, 'domain'));
$domain_exist = in_array($domain, array_column($list_domains, 'domain'));
if (empty($goto)) {
$goto = array();
$message = $LANG['Edit_alias_goto_text_error1'];
} else {
$goto = preg_replace('/\\\r\\\n/', ',', $goto);
$goto = preg_replace('/\r\n/', ',', $goto);
$goto = preg_replace('/[\s]+/i', '', $goto);
$goto = preg_replace('/\,*$/', '', $goto);
$validate_goto = explode(',', $goto);
foreach ($validate_goto as $row) {
if (!filter_var($row, FILTER_VALIDATE_EMAIL)) {
$goto = explode(',', $goto);
$message = $LANG['Edit_alias_goto_text_error2'] . "$row</div>";
}
}
}
if ($domain_exist && empty($message)) {
try {
$dbh = connect_db();
$sth = $dbh->prepare("UPDATE alias SET goto=?,modified=NOW() WHERE address=? AND domain=?");
$sth->bindParam(1, $goto, PDO::PARAM_STR);
$sth->bindParam(2, $address, PDO::PARAM_STR);
$sth->bindParam(3, $domain, PDO::PARAM_STR);
$sth->execute();
logging($admin, $domain, $LANG['Logging_alias_edit'], "$address -> $goto");
header("Location: list-virtual.php?domain=$domain");
} catch(PDOException $e) {
$message = $LANG['Edit_alias_result_error'];
}
}
}
include './templates/header.tpl';
include './templates/admin_menu.tpl';
include './templates/edit-alias.tpl';
include './templates/footer.tpl';
?>