Fix default selection on the account edit page

We used a mixture of account type IDs and account type descriptions on
the account edit page. This resulted in the account type field always
defaulting to "Normal user" after an invalid form had been submitted.

Consistently use account type IDs to avoid this.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2012-11-18 10:21:51 +01:00
parent ecf2caf7fb
commit 21e6c3f65f
2 changed files with 4 additions and 4 deletions

View file

@ -50,7 +50,7 @@ if (isset($_COOKIE["AURSID"])) {
/* Verify user has permission to edit the account */ /* Verify user has permission to edit the account */
if (can_edit_account($atype, $row, uid_from_sid($_COOKIE["AURSID"]))) { if (can_edit_account($atype, $row, uid_from_sid($_COOKIE["AURSID"]))) {
display_account_form($atype, "UpdateAccount", $row["Username"], display_account_form($atype, "UpdateAccount", $row["Username"],
$row["AccountType"], $row["Suspended"], $row["Email"], $row["AccountTypeID"], $row["Suspended"], $row["Email"],
"", "", $row["RealName"], $row["LangPreference"], "", "", $row["RealName"], $row["LangPreference"],
$row["IRCNick"], $row["PGPKey"], $row["ID"]); $row["IRCNick"], $row["PGPKey"], $row["ID"]);
} else { } else {

View file

@ -22,12 +22,12 @@
<p> <p>
<label for="id_type"><?= __("Account Type") ?>:</label> <label for="id_type"><?= __("Account Type") ?>:</label>
<select name="T" id="id_type"> <select name="T" id="id_type">
<?php if ($T == "User"): ?> <?php if ($T == 1): ?>
<option value="1" selected="selected"><?= __("Normal user") ?></option> <option value="1" selected="selected"><?= __("Normal user") ?></option>
<?php else: ?> <?php else: ?>
<option value="1"><?= __("Normal user") ?></option> <option value="1"><?= __("Normal user") ?></option>
<?php endif; ?> <?php endif; ?>
<?php if ($T == "Trusted User"): ?> <?php if ($T == 2): ?>
<option value="2" selected="selected"><?= __("Trusted user") ?></option> <option value="2" selected="selected"><?= __("Trusted user") ?></option>
<?php else: ?> <?php else: ?>
<option value="2"><?= __("Trusted user") ?></option> <option value="2"><?= __("Trusted user") ?></option>
@ -37,7 +37,7 @@
if ($UTYPE == "Developer"): if ($UTYPE == "Developer"):
?> ?>
<option value="3" <option value="3"
<?php $T == "Developer" ? print " selected=\"selected\">" : print ">"; <?php $T == 3 ? print " selected=\"selected\">" : print ">";
print __("Developer")."\n"; ?> print __("Developer")."\n"; ?>
</option> </option>
<?php endif; ?> <?php endif; ?>