edit_user.php
author rejo
Tue, 10 Jul 2007 21:24:06 +0000
changeset 37 b785e54690ce
parent 13 2ff220cfde13
child 43 2d7b36d12274
permissions -rw-r--r--
[feladat @ 84] Bugfix. The function zone_count() now also counts zones an owner has only partial access to, not just those zones the owner has full access to. This fixes just the count, the zones a user has partial access to are not (yet!) shown in the "list zones" page. Bugfix. In the zone listing the "edit" button is now show for users with access level 1. Untill now they were presented an overview of the zones they could change, but there was no link for them to actually edit the zone. Bugfix. Some of the buttons in the "edit zone" interface that are of no use to a user with access level 1 have been hidden. Bugfix. Make sure a user with access level 1 with only partial access to a zone cannot add new records to that zone. Only the zone owner should be able to add new record. Bugfix. If a user with access level 1 edits a record in a zone he has only partial access to, an error was shown because of call to a non- existing function in the PEAR:MDB2. This bug was most likely introduced while migrating from PEAR:DB to PEAR:MDB2. Bugfix. A user with access level 1 was able to delete all records of a zone he has only partial access to. Some additional checks have been added. Bugfix. If a user with accees level 1 has partial access to one or more zones starting with a certain character, but did not own at least one entire zone starting with the same character, the character wasn't clickable in the "list zone" page. Interface. If no record or zone id is given for delete_record.php or delete_domain.php, don't just die but echo a nice message. The i18n files have not yet been updated to reflect this change. Interface. If no master IP is given in delete_supermaster.php, don't just die but echo a nice message. The i18n files have not yet been updated to reflect this change. [All fixes by Peter Beernink.]
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     1
<?php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     2
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     3
require_once("inc/toolkit.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     4
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     5
if($_POST["commit"])
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     6
{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     7
	if($_POST["username"] && $_POST["level"] && $_POST["fullname"])
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     8
	{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     9
		if(!isset($_POST["active"]))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    10
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    11
			$active = 0;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    12
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    13
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    14
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    15
			$active = 1;
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    16
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    17
		if(edit_user($_POST["number"], $_POST["username"], $_POST["fullname"], $_POST["email"], $_POST["level"], $_POST["description"], $active, $_POST["password"]))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    18
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    19
			clean_page($BASE_URL . $BASE_PATH . "users.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    20
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    21
		else
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
		{
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
			error("Error editting user!");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
		}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    25
	}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    26
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    27
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    28
include_once("inc/header.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    30
if (!level(10))
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    31
{
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    32
	error("You do not have the required access level.");
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    33
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
?>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    35
    <h2><? echo _('Edit user'); ?> "<? echo get_fullname_from_userid($_GET["id"]) ?>"</h2>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    36
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
$r = array();
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
$r = get_user_info($_GET["id"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
?>
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    40
    <form method="post">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    41
     <input type="HIDDEN" name="number" value="<? echo $_GET["id"] ?>">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    42
     <table>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    43
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    44
       <td class="n"><? echo _('User name'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    45
       <td class="n"><input type="text" class="input" name="username" value="<? echo $r["username"]?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    46
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    47
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    48
       <td class="n"><? echo _('Full name'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    49
       <td class="n"><input type="text" class="input" name="fullname" value="<? echo $r["fullname"]?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    50
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    51
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    52
       <td class="n"><? echo _('Password'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    53
       <td class="n"><input type="text" class="input" name="password" value=""></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    54
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    55
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    56
       <td class="n"><? echo _('E-mail'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    57
       <td class="n"><input type="text" class="input" name="email" value="<? echo $r["email"]?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    58
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    59
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    60
       <td class="n"><? echo _('User level'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    61
       <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    62
        <select name="level">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    63
	 <option value="1" <? if($r["level"] == 1) { echo "selectED"; } ?>>1 (<? echo _('Normal user'); ?>)</option>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    64
	 <option value="5" <? if($r["level"] == 5) { echo "selectED"; } ?>>5 (<? echo _('Administrator'); ?>)</option>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    65
	 <option value="10" <? if($r["level"] == 10) { echo "selectED"; } ?>>10 (<? echo _('Administrator w/ user admin rights'); ?>)</option>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    66
	</select>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    67
       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    68
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    69
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    70
       <td class="n"><? echo _('Description'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    71
       <td class="n">
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    72
        <textarea rows="6" cols="30" class="inputarea" name="description"><? echo $r["description"]?></textarea>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    73
       </td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    74
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    75
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    76
       <td class="n"><? echo _('Active'); ?>:</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    77
       <td class="n"><input type="checkbox" name="active" value="1" <? if($r["active"]) { ?>CHECKED<? } ?>></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    78
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    79
      <tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    80
       <td class="n">&nbsp;</td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    81
       <td class="n"><input type="submit" class="button" name="commit" value="<? echo _('Commit changes'); ?>"></td>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    82
      </tr>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    83
     </table>
2ff220cfde13 [feladat @ 60]
rejo
parents: 3
diff changeset
    84
    </form>
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    85
<?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    86
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    87
include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    88
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    89
?>