| 1 | <?php |
| 2 | /* |
| 3 | |
| 4 | This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) |
| 5 | Copyright (C) 2003 - 2021 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 details. |
| 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 | /** |
| 25 | * This file shows the list views. |
| 26 | * |
| 27 | * @package lists |
| 28 | * @author Roland Gruber |
| 29 | */ |
| 30 | |
| 31 | /** security functions */ |
| 32 | include_once(__DIR__ . "/../../lib/security.inc"); |
| 33 | /** Used to get type information. */ |
| 34 | include_once(__DIR__ . "/../../lib/types.inc"); |
| 35 | /** Access to configuration options */ |
| 36 | include_once(__DIR__ . "/../../lib/config.inc"); |
| 37 | |
| 38 | // start session |
| 39 | startSecureSession(); |
| 40 | enforceUserIsLoggedIn(); |
| 41 | |
| 42 | setlanguage(); |
| 43 | |
| 44 | $typeManager = new LAM\TYPES\TypeManager(); |
| 45 | $type = $typeManager->getConfiguredType($_GET['type']); |
| 46 | |
| 47 | // check if list is hidden |
| 48 | if (($type === null) || $type->isHidden()) { |
| 49 | logNewMessage(LOG_ERR, 'User tried to access hidden account list: ' . $_GET['type']); |
| 50 | die(); |
| 51 | } |
| 52 | |
| 53 | // create list object if needed |
| 54 | $listClass = $type->getBaseType()->getListClassName(); |
| 55 | if (!isset($_SESSION['list_' . $type->getId()])) { |
| 56 | $list = new $listClass($type); |
| 57 | $_SESSION['list_' . $type->getId()] = $list; |
| 58 | } |
| 59 | |
| 60 | // show page |
| 61 | $_SESSION['list_' . $type->getId()]->showPage(); |