David Goodwin 16 years ago
parent e0aa21917a
commit 667b00d13f

@ -25,8 +25,7 @@ class AliasHandler {
$sql = "SELECT * FROM $table_alias WHERE address='$username'"; $sql = "SELECT * FROM $table_alias WHERE address='$username'";
$result = db_query($sql); $result = db_query($sql);
if ($result['rows'] == 1) if($result['rows'] == 1) {
{
$row = db_array ($result['result']); $row = db_array ($result['result']);
// At the moment Postfixadmin stores aliases in it's database in a comma seperated list; this may change one day. // At the moment Postfixadmin stores aliases in it's database in a comma seperated list; this may change one day.
$list = explode(',', $row['goto']); $list = explode(',', $row['goto']);

@ -57,9 +57,9 @@ class UserHandler {
if ($result['rows'] == 1) if ($result['rows'] == 1)
{ {
$row = db_array ($result['result']); $row = db_array ($result['result']);
$password = pacrypt ($password, $row['password']); $crypt_password = pacrypt ($password, $row['password']);
if($row['password'] == $password) { if($row['password'] == $crypt_password) {
return true; return true;
} }
} }

@ -41,14 +41,12 @@ $vacation_domain = $CONF['vacation_domain'];
$vacation_goto = preg_replace('/@/', '#', $USERID_USERNAME) . '@' . $vacation_domain; $vacation_goto = preg_replace('/@/', '#', $USERID_USERNAME) . '@' . $vacation_domain;
$ah = new AliasHandler($USERID_USERNAME); $ah = new AliasHandler($USERID_USERNAME);
$tGotoArray = $ah->get();
$tStoreAndForward = $ah->hasStoreAndForward();
$vacation_domain = $CONF['vacation_domain'];
if ($_SERVER['REQUEST_METHOD'] == "GET") if ($_SERVER['REQUEST_METHOD'] == "GET")
{ {
$vacation_domain = $CONF['vacation_domain'];
$tGotoArray = $ah->get();
$tStoreAndForward = $ah->hasStoreAndForward();
include ("../templates/header.php"); include ("../templates/header.php");
include ("../templates/users_menu.php"); include ("../templates/users_menu.php");
include ("../templates/users_edit-alias.php"); include ("../templates/users_edit-alias.php");
@ -66,8 +64,9 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$pEdit_alias_goto = $PALANG['pEdit_alias_goto']; $pEdit_alias_goto = $PALANG['pEdit_alias_goto'];
if (isset($_POST['fVacation'])) $fVacation = $_POST['fVacation']; if (isset($_POST['fVacation'])) $fVacation = $_POST['fVacation'];
if (isset($_POST['fGoto'])) $fGoto = escape_string (trim($_POST['fGoto'])); if (isset($_POST['fGoto'])) $fGoto = trim($_POST['fGoto']);
if (isset($_POST['fForward_and_store'])) $fForward_and_store = escape_string ($_POST['fForward_and_store']); if (isset($_POST['fForward_and_store'])) $fForward_and_store = $_POST['fForward_and_store'];
$goto = strtolower ($fGoto); $goto = strtolower ($fGoto);
$goto = preg_replace ('/\\\r\\\n/', ',', $goto); $goto = preg_replace ('/\\\r\\\n/', ',', $goto);
$goto = preg_replace ('/\r\n/', ',', $goto); $goto = preg_replace ('/\r\n/', ',', $goto);
@ -77,18 +76,23 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$goto = explode(",",$goto); $goto = explode(",",$goto);
$goto = array_merge(array_unique($goto)); $goto = array_merge(array_unique($goto));
$good_goto = array(); $good_goto = array();
foreach($goto as $address) { if($fForward_and_store == 'NO' && sizeof($goto) == 1 && $goto[0] == '') {
if(!check_email($address)) { $tMessage = $PALANG['pEdit_alias_goto_text_error1'];
$error += 1; $error += 1;
$tMessage = $PALANG['pEdit_alias_goto_text_error1'] . "$address</font>"; }
} if($error === 0) {
else { foreach($goto as $address) {
$good_goto[] = $address; if(!check_email($address)) {
$error += 1;
$tMessage = $PALANG['pEdit_alias_goto_text_error2'] . " $address</font>";
}
else {
$good_goto[] = $address;
}
} }
$goto = $good_goto;
} }
$goto = $good_goto;
if ($error == 0) { if ($error == 0) {
$flags = 'remote_only'; $flags = 'remote_only';
@ -102,7 +106,9 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
} }
$tMessage = $PALANG['pEdit_alias_result_error']; $tMessage = $PALANG['pEdit_alias_result_error'];
} }
else {
$tGotoArray = $goto;
}
include ("../templates/header.php"); include ("../templates/header.php");
include ("../templates/users_menu.php"); include ("../templates/users_menu.php");
include ("../templates/users_edit-alias.php"); include ("../templates/users_edit-alias.php");

Loading…
Cancel
Save