From dfd174881021590d5be27924b94777415156b010 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 24 Feb 2018 14:18:15 +0100 Subject: [PATCH] check for unique label --- lam/templates/config/conftypes.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lam/templates/config/conftypes.php b/lam/templates/config/conftypes.php index 0830f75e..958965b0 100644 --- a/lam/templates/config/conftypes.php +++ b/lam/templates/config/conftypes.php @@ -13,7 +13,7 @@ use \htmlResponsiveRow; use \htmlResponsiveInputField; /* This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2004 - 2017 Roland Gruber + Copyright (C) 2004 - 2018 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -391,6 +391,14 @@ function checkInput() { // save input $conf->set_typeSettings($typeSettings); $conf->set_ActiveTypes($accountTypes); + // check for duplicate type aliases + $aliasNames = array(); + foreach ($typeManager->getConfiguredTypes() as $type) { + if (in_array($type->getAlias(), $aliasNames)) { + $errors[] = array('ERROR', _('Please set a unique label for the account types.'), htmlspecialchars($type->getAlias())); + } + $aliasNames[] = $type->getAlias(); + } return $errors; }