1
+ − 1
<?php
47
+ − 2
+ − 3
/* PowerAdmin, a friendly web-based admin tool for PowerDNS.
+ − 4
* See <https://rejo.zenger.nl/poweradmin> for more details.
+ − 5
*
+ − 6
* Copyright 2007, 2008 Rejo Zenger <rejo@zenger.nl>
+ − 7
*
+ − 8
* This program is free software: you can redistribute it and/or modify
+ − 9
* it under the terms of the GNU General Public License as published by
+ − 10
* the Free Software Foundation, either version 3 of the License, or
+ − 11
* (at your option) any later version.
+ − 12
*
+ − 13
* This program is distributed in the hope that it will be useful,
+ − 14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
+ − 15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ − 16
* GNU General Public License for more details.
+ − 17
*
+ − 18
* You should have received a copy of the GNU General Public License
+ − 19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
+ − 20
*/
+ − 21
1
+ − 22
require_once ( "inc/toolkit.inc.php" );
82
+ − 23
include_once ( "inc/header.inc.php" );
1
+ − 24
82
+ − 25
verify_permission ( user_edit_own ) ? $perm_edit_own = "1" : $perm_edit_own = "0" ;
+ − 26
verify_permission ( user_edit_others ) ? $perm_edit_others = "1" : $perm_edit_others = "0" ;
+ − 27
+ − 28
if ( ! ( isset ( $_GET [ 'id' ]) && v_num ( $_GET [ 'id' ]))) {
+ − 29
error ( ERR_INV_INPUT );
+ − 30
include_once ( "inc/footer.inc.php" );
+ − 31
exit ;
+ − 32
} else {
+ − 33
$uid = $_GET [ 'id' ];
+ − 34
}
+ − 35
+ − 36
if ( $_POST [ 'commit' ]) {
+ − 37
if ( delete_user ( $uid , $_POST [ 'zone' ])) {
+ − 38
success ( SUC_USER_DEL );
+ − 39
}
+ − 40
} else {
+ − 41
+ − 42
if (( $uid != $_SESSION [ 'userid' ] && ! verify_permission ( user_edit_others )) || ( $uid == $_SESSION [ 'userid' ] && ! verify_permission ( user_edit_own ))) {
+ − 43
error ( ERR_PERM_DEL_USER );
+ − 44
include_once ( "inc/footer.inc.php" );
+ − 45
exit ;
+ − 46
} else {
+ − 47
$fullname = get_fullname_from_userid ( $uid );
+ − 48
$zones = get_zones ( "own" , $uid );
+ − 49
+ − 50
echo " <h2>" . _ ( 'Delete user' ) . " \" " . $fullname . " \" </h2> \n " ;
+ − 51
echo " <form method= \" post \" > \n " ;
+ − 52
echo " <table> \n " ;
+ − 53
+ − 54
if ( count ( $zones ) > 0 ) {
1
+ − 55
82
+ − 56
$users = show_users ();
+ − 57
+ − 58
echo " <tr> \n " ;
+ − 59
echo " <td colspan= \" 5 \" > \n " ;
+ − 60
+ − 61
echo " " . _ ( 'You are about to delete a user. This user is owner for a number of zones. Please decide what to do with these zones.' ) . " \n " ;
+ − 62
echo " </td> \n " ;
+ − 63
echo " </tr> \n " ;
+ − 64
+ − 65
echo " <tr> \n " ;
+ − 66
echo " <th>" . _ ( 'Zone' ) . "</th> \n " ;
+ − 67
echo " <th>" . _ ( 'Delete' ) . "</th> \n " ;
+ − 68
echo " <th>" . _ ( 'Leave' ) . "</th> \n " ;
+ − 69
echo " <th>" . _ ( 'Add new owner' ) . "</th> \n " ;
+ − 70
echo " <th>" . _ ( 'Owner to be added' ) . "</th> \n " ;
+ − 71
echo " </tr> \n " ;
+ − 72
+ − 73
foreach ( $zones as $zone ) {
+ − 74
echo " <input type= \" hidden \" name= \" zone[" . $zone [ 'id' ] . "][zid] \" value= \" " . $zone [ 'id' ] . " \" > \n " ;
+ − 75
echo " <tr> \n " ;
+ − 76
echo " <td>" . $zone [ 'name' ] . "</td> \n " ;
+ − 77
echo " <td><input type= \" radio \" name= \" zone[" . $zone [ 'id' ] . "][target] \" value= \" delete \" ></td> \n " ;
+ − 78
echo " <td><input type= \" radio \" name= \" zone[" . $zone [ 'id' ] . "][target] \" value= \" leave \" CHECKED></td> \n " ;
+ − 79
echo " <td><input type= \" radio \" name= \" zone[" . $zone [ 'id' ] . "][target] \" value= \" new_owner \" ></td> \n " ;
+ − 80
echo " <td> \n " ;
+ − 81
echo " <select name= \" zone[" . $zone [ 'id' ] . "][newowner] \" > \n " ;
+ − 82
+ − 83
foreach ( $users as $user ) {
+ − 84
echo " <option value= \" " . $user [ "id" ] . " \" >" . $user [ "fullname" ] . "</option> \n " ;
+ − 85
}
+ − 86
+ − 87
echo " </select> \n " ;
+ − 88
echo " </td> \n " ;
+ − 89
echo " </tr> \n " ;
+ − 90
1
+ − 91
}
+ − 92
}
82
+ − 93
echo " <tr> \n " ;
+ − 94
echo " <td colspan= \" 5 \" > \n " ;
+ − 95
+ − 96
echo " " . _ ( 'Really delete this user?' ) . " \n " ;
+ − 97
echo " </td> \n " ;
+ − 98
echo " </tr> \n " ;
1
+ − 99
82
+ − 100
echo " </table> \n " ;
+ − 101
echo " <input type= \" submit \" class= \" button \" name= \" commit \" value= \" " . _ ( 'Comit changes' ) . " \" > \n " ;
+ − 102
echo " </form> \n " ;
+ − 103
}
1
+ − 104
}
82
+ − 105
include_once ( "inc/footer.inc.php" );
+ − 106
?>