| 1 |
<?php |
| 2 |
/* |
| 3 |
|
| 4 |
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) |
| 5 |
Copyright (C) 2007 - 2024 Roland Gruber |
| 6 |
|
| 7 |
This program is free software; you can redistribute it and/or modify |
| 8 |
it under the terms of the GNU General Public License as published by |
| 9 |
the Free Software Foundation; either version 2 of the License, or |
| 10 |
(at your option) any later version. |
| 11 |
|
| 12 |
This program is distributed in the hope that it will be useful, |
| 13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more detaexils. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with this program; if not, write to the Free Software |
| 19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 |
|
| 21 |
*/ |
| 22 |
|
| 23 |
/** |
| 24 |
* This page will redirect to delete.php if the given user is valid. |
| 25 |
* |
| 26 |
* It is called from the list views via the delete links. |
| 27 |
* |
| 28 |
* @package lists |
| 29 |
* @author Roland Gruber |
| 30 |
*/ |
| 31 |
|
| 32 |
/** security functions */ |
| 33 |
include_once(__DIR__ . "/../../lib/security.inc"); |
| 34 |
/** Needed to find DNs of users */ |
| 35 |
include_once(__DIR__ . "/../../lib/ldap.inc"); |
| 36 |
/** Used to display error messages */ |
| 37 |
include_once(__DIR__ . "/../../lib/status.inc"); |
| 38 |
|
| 39 |
// start session |
| 40 |
startSecureSession(); |
| 41 |
enforceUserIsLoggedIn(); |
| 42 |
|
| 43 |
setlanguage(); |
| 44 |
|
| 45 |
// get account name and type |
| 46 |
$dn = (string) $_GET['DN']; |
| 47 |
$type = (string) $_GET['type']; |
| 48 |
if (!preg_match('/^[a-z0-9_]+$/i', $type)) { |
| 49 |
logNewMessage(LOG_ERR, 'Invalid type: ' . $type); |
| 50 |
die(); |
| 51 |
} |
| 52 |
|
| 53 |
if (!empty($dn) && !empty($type)) { |
| 54 |
if (str_starts_with($dn, "'")) { |
| 55 |
$dn = substr($dn, 1); |
| 56 |
} |
| 57 |
if (str_ends_with($dn, "'")) { |
| 58 |
$dn = substr($dn, 0, -1); |
| 59 |
} |
| 60 |
$_SESSION['delete_dn'] = [$dn]; |
| 61 |
// redirect to delete.php |
| 62 |
metaRefresh("../delete.php?type=" . htmlspecialchars($type)); |
| 63 |
|
| 64 |
} |
| 65 |
else { |
| 66 |
// print error message if arguments are missing |
| 67 |
include __DIR__ . '/../../lib/adminHeader.inc'; |
| 68 |
StatusMessage("ERROR", "No account or type given."); |
| 69 |
include __DIR__ . '/../../lib/adminFooter.inc'; |
| 70 |
} |