edit-mailbox.php; indentation fix

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@272 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
David Goodwin 17 years ago
parent 3c2bf37f4a
commit 70dea6ca05

@ -49,112 +49,110 @@ if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']);
$pEdit_mailbox_name_text = $PALANG['pEdit_mailbox_name_text']; $pEdit_mailbox_name_text = $PALANG['pEdit_mailbox_name_text'];
$pEdit_mailbox_quota_text = $PALANG['pEdit_mailbox_quota_text']; $pEdit_mailbox_quota_text = $PALANG['pEdit_mailbox_quota_text'];
$result = db_query("SELECT * FROM $table_mailbox WHERE username = '$fUsername' AND domain = '$fDomain'");
if($result['rows'] != 1) {
die("Invalid username chosen; user does not exist in mailbox table");
}
if (!(check_owner ($SESSID_USERNAME, $fDomain) || authentication_has_role('global-admin')) ) if (!(check_owner ($SESSID_USERNAME, $fDomain) || authentication_has_role('global-admin')) )
{ {
$error = 1; $error = 1;
$tName = $fName; $tName = $fName;
$tQuota = $fQuota; $tQuota = $fQuota;
$tActive = $fActive; $tActive = $fActive;
$tMessage = $PALANG['pEdit_mailbox_domain_error'] . "$fDomain</span>"; $tMessage = $PALANG['pEdit_mailbox_domain_error'] . "$fDomain</span>";
} }
$result = db_query("SELECT * FROM $table_mailbox WHERE username = '$fUsername' AND domain = '$fDomain'");
if($result['rows'] != 1) {
die("Invalid username chosen; user does not exist in mailbox table");
}
$user_details = db_array($result['result']); $user_details = db_array($result['result']);
if ($_SERVER['REQUEST_METHOD'] == "GET") if ($_SERVER['REQUEST_METHOD'] == "GET")
{ {
if (check_owner($SESSID_USERNAME, $fDomain) || authentication_has_role('global-admin')) if (check_owner($SESSID_USERNAME, $fDomain) || authentication_has_role('global-admin'))
{ {
$tName = $user_details['name']; $tName = $user_details['name'];
$tQuota = divide_quota($user_details['quota']); $tQuota = divide_quota($user_details['quota']);
$tActive = $user_details['active']; $tActive = $user_details['active'];
if ('pgsql'==$CONF['database_type']) { if ('pgsql'==$CONF['database_type']) {
$tActive = ('t'==$user_details['active']) ? 1 : 0; $tActive = ('t'==$user_details['active']) ? 1 : 0;
} }
$result = db_query ("SELECT * FROM $table_domain WHERE domain='$fDomain'"); $result = db_query ("SELECT * FROM $table_domain WHERE domain='$fDomain'");
if ($result['rows'] == 1) if ($result['rows'] == 1)
{ {
$row = db_array ($result['result']); $row = db_array ($result['result']);
$tMaxquota = $row['maxquota']; $tMaxquota = $row['maxquota'];
} }
} }
} }
if ($_SERVER['REQUEST_METHOD'] == "POST") if ($_SERVER['REQUEST_METHOD'] == "POST")
{ {
if (isset ($_POST['fPassword'])) $fPassword = escape_string ($_POST['fPassword']); if (isset ($_POST['fPassword'])) $fPassword = escape_string ($_POST['fPassword']);
if (isset ($_POST['fPassword2'])) $fPassword2 = escape_string ($_POST['fPassword2']); if (isset ($_POST['fPassword2'])) $fPassword2 = escape_string ($_POST['fPassword2']);
if (isset ($_POST['fName'])) $fName = escape_string ($_POST['fName']); if (isset ($_POST['fName'])) $fName = escape_string ($_POST['fName']);
if (isset ($_POST['fQuota'])) $fQuota = intval ($_POST['fQuota']); if (isset ($_POST['fQuota'])) $fQuota = intval ($_POST['fQuota']);
if (isset ($_POST['fActive'])) $fActive = escape_string ($_POST['fActive']); if (isset ($_POST['fActive'])) $fActive = escape_string ($_POST['fActive']);
if($fPassword != $user_details['password']){
if($fPassword != $user_details['password']){ if($fPassword == $fPassword2) {
if($fPassword == $fPassword2) { if ($fPassword != "") {
if ($fPassword != "") { $formvars['password'] = pacrypt($fPassword);
$formvars['password'] = pacrypt($fPassword); }
} }
} else {
else { flash_error($PALANG['pEdit_mailbox_password_text_error']);
flash_error($PALANG['pEdit_mailbox_password_text_error']); $error = 1;
$error = 1; }
} }
}
if ($CONF['quota'] == "YES")
if ($CONF['quota'] == "YES") {
{ if (!check_quota ($fQuota, $fDomain))
if (!check_quota ($fQuota, $fDomain)) {
{ $error = 1;
$error = 1; $tName = $fName;
$tName = $fName; $tQuota = $fQuota;
$tQuota = $fQuota; $tActive = $fActive;
$tActive = $fActive; $pEdit_mailbox_quota_text = $PALANG['pEdit_mailbox_quota_text_error'];
$pEdit_mailbox_quota_text = $PALANG['pEdit_mailbox_quota_text_error']; }
} }
} if ($error != 1)
if ($error != 1) {
{ if (!empty ($fQuota))
if (!empty ($fQuota)) {
{ $quota = multiply_quota ($fQuota);
$quota = multiply_quota ($fQuota); }
} else
else {
{ $quota = 0;
$quota = 0; }
}
if ($fActive == "on")
if ($fActive == "on") {
{ $sqlActive = db_get_boolean(True);
$sqlActive = db_get_boolean(True); $fActive = 1;
$fActive = 1; }
} else
else {
{ $sqlActive = db_get_boolean(False);
$sqlActive = db_get_boolean(False); $fActive = 0;
$fActive = 0; }
}
$formvars['name'] = $fName;
$formvars['name'] = $fName; $formvars['quota'] =$quota;
$formvars['quota'] =$quota; $formvars['active']=$sqlActive;
$formvars['active']=$sqlActive;
$result = db_update ('mailbox', "username='$fUsername' AND domain='$fDomain'", $formvars, array('modified'));
$result = db_update ('mailbox', "username='$fUsername' AND domain='$fDomain'", $formvars, array('modified')); if ($result != 1) {
$tMessage = $PALANG['pEdit_mailbox_result_error'];
if ($result != 1) { }
$tMessage = $PALANG['pEdit_mailbox_result_error']; else {
} db_log ($SESSID_USERNAME, $fDomain, 'edit_mailbox', $fUsername);
else {
db_log ($SESSID_USERNAME, $fDomain, 'edit_mailbox', $fUsername); // header ("Location: list-virtual.php?domain=$fDomain");
exit;
header ("Location: list-virtual.php?domain=$fDomain"); }
exit; }
}
}
} }
include ("templates/header.php"); include ("templates/header.php");

Loading…
Cancel
Save