cleaned up code

This commit is contained in:
seek3r 2000-09-06 15:55:58 +00:00
parent 081ad0be4b
commit 1f471d7588
2 changed files with 121 additions and 131 deletions

View File

@ -33,12 +33,13 @@
$lid = $phpgw->db->f("loginid");
if ($n_passwd || $n_passwd_2) {
if ($n_passwd != $n_passwd_2)
if ($n_passwd != $n_passwd_2){
$error .= lang_admin("The two passwords are not the same");
if (! $n_passwd)
}
if (! $n_passwd){
$error .= lang_admin("You must enter a password");
}
}
if ($lid != $n_loginid) {
$phpgw->db->query("select loginid from accounts where loginid='$n_loginid'");
@ -47,20 +48,17 @@
}
}
if (count($new_permissions) == 0)
if (count($new_permissions) == 0){
$error .= "<br>" . lang_admin("You must add at least 1 permission to this account");
}
if (! $error) {
$phpgw->db->lock(array('accounts','preferences','sessions'));
if ($n_passwd) {
$phpgw->db->query("update accounts set passwd='" . md5($n_passwd) . "', "
. "lastpasswd_change='" . time() . "' where loginid='"
. "$lid'");
. "lastpasswd_change='" . time() . "' where loginid='" . "$lid'");
$phpgw->db->query("update sessions set passwd='" . addslashes($n_passwd)
. "' where loginid='$lid'");
}
while ($permission = each($new_permissions)) {
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
$phpgw->accounts->add_app($permission[0]);
@ -68,12 +66,12 @@
}
//$phpgw->permissions->add("hr");
if ($new_permissions["anonymous"] && ! $new_permissions["admin"])
if ($new_permissions["anonymous"] && ! $new_permissions["admin"]){
$phpgw->accounts->add_app("anonymous");
if (! $n_account_status)
}
if (! $n_account_status){
$n_account_status = "L";
}
$cd = 27;
// If they changed there loginid, we need to change the owner in ALL
@ -121,7 +119,6 @@
$phpgw->db->next_record();
$account_status = $phpgw->db->f("status");
?>
<form method="POST" action="<?php echo $phpgw->link("editaccount.php"); ?>">
<input type="hidden" name="con" value="<? echo $con; ?>">
<?php
@ -152,15 +149,15 @@
$phpgw->db->query("select * from groups");
while ($phpgw->db->next_record()) {
echo "<option value=\"" . $phpgw->db->f("group_id") . "\"";
for ($i=0; $i<count($user_groups); $i++) {
if ($user_groups[$i][0] == $phpgw->db->f("group_id"))
if ($user_groups[$i][0] == $phpgw->db->f("group_id")){
echo " selected";
}
echo ">" . $phpgw->db->f("group_name") . "</option>\n";
}
?></select>
echo ">" . $phpgw->db->f("group_name") . "</option>\n";
}
?>
</select>
</tr>
<?php
$i = 0;
@ -174,7 +171,6 @@
for ($i=0;$i<200;) { // The $i<200 is only used for a brake
if (! $perm_display[$i][1]) break;
echo '<tr><td>' . lang_common($perm_display[$i][1]) . '</td>'
. '<td><input type="checkbox" name="new_permissions['
. $perm_display[$i][0] . ']" value="True"';
@ -182,11 +178,8 @@
echo " checked";
}
echo "></td>";
$i++;
if (! $perm_display[$i][1]) break;
echo '<td>' . lang_common($perm_display[$i][1]) . '</td>'
. '<td><input type="checkbox" name="new_permissions['
. $perm_display[$i][0] . ']" value="True"';
@ -194,7 +187,6 @@
echo " checked";
}
echo "></td></tr>";
$i++;
}
@ -211,13 +203,11 @@
echo " checked";
echo "></td></tr>";
*/
?>
<tr>
<td><?php echo lang_admin("Account active"); ?></td>
<td><input type="checkbox" name="n_account_status" value="A" <?php
if ($account_status == "A") { echo " checked"; } ?>></td>
<td><input type="checkbox" name="n_account_status" value="A" <?php if ($account_status == "A") { echo " checked"; } ?>>
</td>
</tr>
<tr>
<td><?php echo lang_admin("New password [ Leave blank for no change ]"); ?></td>
@ -233,5 +223,4 @@
</table>
</center>
</form>
<?php
include($phpgw_info["server"]["api_dir"] . "/footer.inc.php");
<?php include($phpgw_info["server"]["api_dir"] . "/footer.inc.php"); ?>

View File

@ -22,11 +22,12 @@
include($phpgw_info["server"]["include_root"] . "/lang/" . "en" . "_login.inc.php");
include($phpgw_info["server"]["api_dir"] . "/phpgw_template.inc.php");
/*
if ($code != 10 && $phpgw_info["server"]["usecookies"] == False) {
Setcookie("sessionid");
Setcookie("kp3");
}
*/
$deny_login = False;
$tmpl = new Template($phpgw_info["server"]["template_dir"]);