Allow superuser to edit other peoples accounts

Show pending email if there is one
This commit is contained in:
james 2011-02-23 17:09:39 +00:00
parent 6b37f4b721
commit fa3a661b62

View File

@ -37,8 +37,14 @@ if(!isset($_SESSION['accounts_id'])) {
/* Superuser may edit this for any account, if the user is not a superuser, force
* the accounts_id to be whatever is in the session */
if($_SESSION['superuser']) {
if($_GET['accounts_id']) {
$accounts_id = intval($_GET['accounts_id']);
if($accounts_id == 0) $accounts_id = $_SESSION['accounts_id'];
} else if($_GET['users_id']) {
$u=user_load(intval($_GET['users_id']));
$accounts_id=$u['accounts_id'];
}
else
$accounts_id = $_SESSION['accounts_id'];
} else {
$accounts_id = $_SESSION['accounts_id'];
}
@ -83,8 +89,7 @@ case 'save':
}
if($save) {
// action_create_set_email($accounts_id, $email);
mysql_query("UPDATE accounts SET email='".mysql_real_escape_string($email)."' WHERE id={$accounts_id}");
account_set_email($accounts_id,$email);
happy_("An email has been sent to %1 to confirm the new email address", array($email));
}
}
@ -155,9 +160,7 @@ case 'save':
$a = account_load($accounts_id);
$d = '';
$email = $a['email'];
$username_link = ($a['link_username_to_email'] == 'yes') ? 'checked="checked"' : '';
$username = $a['username'];
if($_SESSION['password_expired'] == true) {
echo error(i18n('Your password has expired. You must choose a new password now.'));
@ -174,19 +177,32 @@ case 'save':
<table width="90%">
<tr>
<td style="text-align: left" colspan="2"><b>Email</b><hr /></td>
</tr><tr>
</tr>
<tr>
<td><label for="email"><?=i18n('Email')?>:</label></td>
<td><input id="email" <?=$d?> name="email" type="text" size="30" value="<?=$email?>"></td>
</tr><tr>
<td></td><td>
<td><input id="email" <?=$d?> name="email" type="text" size="30" value="<?=$a['email']?>"></td>
</tr>
<? if($a['pendingemail']) {
?>
<tr>
<td><label for="email"><?=i18n('Pending Email')?>:</label></td>
<td><?=$a['pendingemail']?> is currently pending confirmation</td>
</tr>
<?
}
?>
<tr>
<td></td>
<td>
<div style="font-size: 0.75em;"><?=i18n('Changing the email address will cause a confirmation email to be sent to the new email address before the change will take effect.')?></div>
<br />
</td>
</tr><tr>
</tr>
<tr>
<td style="text-align: left" colspan="2"><b>Username</b><hr /></td>
</tr><tr>
<td><?=i18n('Username')?>:</td>
<td> <input <?=$ud?> <?=$d?> id="username" name=username type="text" size="20" value="<?=$username?>"><br />
<td> <input <?=$ud?> <?=$d?> id="username" name=username type="text" size="20" value="<?=$a['username']?>"><br />
<input id="username_link" <?=$username_link?> <?=$d?> type="checkbox" name="username_link" value="yes" />
<?=i18n('Use the email address as the login username')?><br />