1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
<?php
/* $Id: edit_user.php,v 1.36 2004/12/06 05:20:31 cknudsen Exp $ */
include_once 'includes/init.php';
if ( ! $is_admin )
$user = $login;
// cannot edit public user.
if ( $user == '__public__' )
$user = $login;
// don't allow them to create new users if it's not allowed
if ( empty ( $user ) ) {
// asking to create a new user
if ( ! $is_admin ) {
// must be admin...
do_redirect ( empty ( $STARTVIEW ) ? "month.php" : "$STARTVIEW.php" );
exit;
}
if ( ! $admin_can_add_user ) {
// if adding users is not allowed...
do_redirect ( empty ( $STARTVIEW ) ? "month.php" : "$STARTVIEW.php" );
exit;
}
}
$showHeader = empty ( $is_admin );
print_header ( '', '', '', ! $showHeader );
?>
<table style="border-width:0px;">
<tr><td style="vertical-align:top; width:50%;">
<h2><?php
if ( ! empty ( $user ) ) {
user_load_variables ( $user, "u" );
echo translate("Edit User");
} else {
echo translate("Add User");
}
?></h2>
<form action="edit_user_handler.php" method="post">
<input type="hidden" name="formtype" value="edituser" />
<?php
if ( empty ( $user ) ) {
echo "<input type=\"hidden\" name=\"add\" value=\"1\" />\n";
}
?>
<table style="border-width:0px;">
<tr><td>
<label for="username"><?php etranslate("Username")?>:</label></td><td>
<?php
if ( ! empty ( $user ) ) {
if ( $is_admin )
echo $user . "<input name=\"user\" type=\"hidden\" value=\"" .
htmlspecialchars ( $user ) . "\" />\n";
else
echo $user;
} else {
echo "<input type=\"text\" name=\"user\" id=\"username\" size=\"20\" maxlength=\"20\" />\n";
}
?>
</td></tr>
<tr><td>
<label for="ufirstname"><?php etranslate("First Name")?>:</label></td><td>
<input type="text" name="ufirstname" id="ufirstname" size="20" value="<?php echo htmlspecialchars ( $ufirstname );?>" />
</td></tr>
<tr><td>
<label for="ulastname"><?php etranslate("Last Name")?>:</label></td><td>
<input type="text" name="ulastname" id="ulastname" size="20" value="<?php echo htmlspecialchars ( $ulastname );?>" />
</td></tr>
<tr><td>
<label for="uemail"><?php etranslate("E-mail address")?>:</label></td><td>
<input type="text" name="uemail" id="uemail" size="20" value="<?php echo htmlspecialchars ( $uemail );?>" />
</td></tr>
<?php if ( empty ( $user ) && ! $use_http_auth && $user_can_update_password ) { ?>
<tr><td>
<label for="pass1"><?php etranslate("Password")?>:</label></td><td>
<input name="upassword1" id="pass1" size="15" value="" type="password" />
</td></tr>
<tr><td>
<label for="pass2"><?php etranslate("Password")?> (<?php etranslate("again")?>):</label></td><td>
<input name="upassword2" id="pass2" size="15" value="" type="password" />
</td></tr>
<?php }
if ( $is_admin ) { ?>
<tr><td style="font-weight:bold;">
<?php etranslate("Admin")?>:</td><td>
<label><input type="radio" name="uis_admin" value="Y"<?php if ( $uis_admin == "Y" ) echo " checked=\"checked\"";?> /> <?php etranslate("Yes")?></label>
<label><input type="radio" name="uis_admin" value="N"<?php if ( $uis_admin != "Y" ) echo " checked=\"checked\"";?> /> <?php etranslate("No")?></label>
</td></tr>
<?php } //end if ($is_admin ) ?>
<tr><td colspan="2">
<?php if ( $demo_mode == "Y" ) { ?>
<input type="button" value="<?php etranslate("Save")?>" onclick="alert('<?php etranslate("Disabled for demo")?>')" />
<?php if ( $is_admin && ! empty ( $user ) ) { ?>
<input type="submit" name="action" value="<?php etranslate("Delete")?>" onclick="alert('<?php etranslate("Disabled for demo")?>')" />
<?php } //end if ( $demo_mode == "Y" ) ?>
<?php } else { ?>
<input type="submit" value="<?php etranslate("Save")?>" />
<?php if ( $is_admin && ! empty ( $user ) ) {
if ( $admin_can_delete_user ) ?>
<input type="submit" name="action" value="<?php etranslate("Delete")?>" onclick="return confirm('<?php etranslate("Are you sure you want to delete this user?"); ?>')" />
<?php } ?>
<?php } ?>
</td></tr>
</table>
</form>
<?php if ( ! empty ( $user ) && ! $use_http_auth &&
( isset ( $user_can_update_password ) && $user_can_update_password ) ) { ?>
</td><td> </td>
<td style="vertical-align:top;">
<h2><?php etranslate("Change Password")?></h2>
<form action="edit_user_handler.php" method="post">
<input type="hidden" name="formtype" value="setpassword" />
<?php if ( $is_admin ) { ?>
<input type="hidden" name="user" value="<?php echo $user;?>" />
<?php } ?>
<table style="border-width:0px;">
<tr><td>
<label for="newpass1"><?php etranslate("New Password")?>:</label></td><td>
<input name="upassword1" id="newpass1" type="password" size="15" />
</td></tr>
<tr><td>
<label for="newpass2"><?php etranslate("New Password")?> (<?php etranslate("again")?>):</label></td><td>
<input name="upassword2" id="newpass2" type="password" size="15" />
</td></tr>
<tr><td colspan="2">
<?php if ( $demo_mode == "Y" ) { ?>
<input type="button" value="<?php etranslate("Set Password")?>" onclick="alert('<?php etranslate("Disabled for demo")?>')" />
<?php } else { ?>
<input type="submit" value="<?php etranslate("Set Password")?>" />
<?php } ?>
</td></tr>
</table>
</form>
<?php } ?>
</td></tr></table>
<?php print_trailer ( ! empty ( $showHeader ), true, empty ( $showHeader ) ); ?>
</body>
</html>
|