users.php
author rejo
Wed, 26 Mar 2008 09:31:12 +0000
changeset 87 654262e698e2
parent 82 c255196bc447
child 99 a4b469dac161
permissions -rw-r--r--
[feladat @ 187] Bugfix. Corrected field order of insert of new zones.
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
47
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     5
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     7
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    11
 *  (at your option) any later version.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    12
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    16
 *  GNU General Public License for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    17
 *
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    20
 */
ae140472d97c [feladat @ 94]
rejo
parents: 13
diff changeset
    21
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    23
include_once("inc/header.inc.php");
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    24
verify_permission(user_view_others) ? $perm_view_others = "1" : $perm_view_others = "0" ;
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    25
verify_permission(user_edit_own) ? $perm_edit_own = "1" : $perm_edit_own = "0" ;
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    26
verify_permission(user_edit_others) ? $perm_edit_others = "1" : $perm_edit_others = "0" ;
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    27
verify_permission(templ_perm_edit) ? $perm_templ_perm_edit = "1" : $perm_templ_perm_edit = "0" ;
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    28
verify_permission(is_ueberuser) ? $perm_is_godlike = "1" : $perm_is_godlike = "0" ; 
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    29
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    30
if (isset($_POST['commit'])) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    31
	foreach ($_POST['user'] as $user) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    32
		update_user_details($user);
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 9
diff changeset
    33
	}
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    34
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    35
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    36
$users = get_user_detail_list("");
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    37
echo "    <h2>" . _('User admin') . "</h2>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    38
echo "    <form method=\"post\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    39
echo "     <table>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    40
echo "      <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    41
echo "       <th>&nbsp;</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    42
echo "       <th>" . _('Username') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    43
echo "       <th>" . _('Fullname') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    44
echo "       <th>" . _('Description') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    45
echo "       <th>" . _('Emailaddress') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    46
echo "       <th>" . _('Template') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    47
echo "       <th>" . _('Enabled') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    48
echo "      </tr>\n";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    49
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    50
foreach ($users as $user) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    51
	if ($user['active'] == "1" ) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    52
		$active = " checked";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    53
	} else {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    54
		$active = "";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    55
	}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    56
	echo "      <input type=\"hidden\" name=\"user[" . $user['uid'] . "][uid]\" value=\"" . $user['uid'] . "\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    57
	echo "      <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    58
	echo "       <td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    59
	if (($user['uid'] == $_SESSION["userid"] && $perm_edit_own == "1") || ($user['uid'] != $_SESSION["userid"] && $perm_edit_others == "1" )) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    60
		echo "        <a href=\"edit_user.php?id=" . $user['uid'] . "\"><img src=\"images/edit.gif\" alt=\"[ " . _('Edit user') . "\" ]></a>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    61
		echo "        <a href=\"delete_user.php?id=" . $user['uid'] . "\"><img src=\"images/delete.gif\" alt=\"[ " . _('Delete user') . "\" ]></a>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    62
	} else {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    63
		echo "        &nbsp;\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    64
	}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    65
	echo "       </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    66
	echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][username]\" value=\"" . $user['username'] . "\"></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    67
	echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][fullname]\" value=\"" . $user['fullname'] . "\"></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    68
	echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][descr]\" value=\"" . $user['descr'] . "\"></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    69
	echo "       <td><input type=\"text\" name=\"user[" . $user['uid'] . "][email]\" value=\"" . $user['email'] . "\"></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    70
	echo "       <td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    71
	echo "        <select name=\"user[" . $user['uid'] . "][templ_id]\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    72
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    73
	foreach (list_permission_templates() as $template) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    74
		($template['id'] == $user['tpl_id']) ? $select = " SELECTED" : $select = "" ;
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    75
		echo "          <option value=\"" . $template['id'] . "\"" . $select . ">" . $template['name'] . "</option>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    76
	}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    77
	echo "         </select>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    78
	echo "       </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    79
	echo "       <td><input type=\"checkbox\" name=\"user[" . $user['uid'] . "][active]\"" . $active . "></td>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    80
	echo "      </tr>\n";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    81
}
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    83
echo "     </table>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    84
echo "     <input type=\"submit\" class=\"button\" name=\"commit\" value=\"" . _('Commit changes') . "\">\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    85
echo "    </form>\n";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    86
82
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    87
echo "    <p>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    88
if ($perm_templ_perm_edit == "1") {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    89
	echo _('Edit') . " <a href=\"list_perm_templ.php\">" . _('permission templates') . "</a>. \n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    90
}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    91
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    92
if (verify_permission(user_add_new)) {
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    93
	echo _('Add') . " <a href=\"add_user.php\">" . _('user') . "</a>. \n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    94
}
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    95
echo "    </p>\n";
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    96
c255196bc447 [feladat @ 182]
rejo
parents: 79
diff changeset
    97
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    98
include_once("inc/footer.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    99
?>