getConfiguredTypes(); $container = new htmlResponsiveRow(); $container->add(new htmlTitle(_("Profile editor")), 12); if (isset($_POST['deleteProfile']) && ($_POST['deleteProfile'] == 'true')) { $type = $typeManager->getConfiguredType($_POST['profileDeleteType']); if ($type->isHidden()) { logNewMessage(LOG_ERR, 'User tried to delete hidden account type profile: ' . $_POST['profileDeleteType']); die(); } // delete profile if (\LAM\PROFILES\delAccountProfile($_POST['profileDeleteName'], $_POST['profileDeleteType'])) { $message = new htmlStatusMessage('INFO', _('Deleted profile.'), $type->getAlias() . ': ' . htmlspecialchars($_POST['profileDeleteName'])); $container->add($message, 12); } else { $message = new htmlStatusMessage('ERROR', _('Unable to delete profile!'), $type->getAlias() . ': ' . htmlspecialchars($_POST['profileDeleteName'])); $container->add($message, 12); } } $configProfiles = getConfigProfiles(); $serverProfiles = array(); foreach ($configProfiles as $profileName) { $serverProfiles[$profileName] = new \LAMConfig($profileName); } // import profiles if (!empty($_POST['import'])) { $cfg = new LAMCfgMain(); // check master password $errMessage = null; if (!$cfg->checkPassword($_POST['passwd_i_' . $_POST['typeId']])) { $errMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!')); } elseif (!empty($_POST['importProfiles'])) { $options = array(); foreach ($_POST['importProfiles'] as $importProfiles) { $parts = explode('##', $importProfiles); $options[] = array('conf' => $parts[0], 'typeId' => $parts[1], 'name' => $parts[2]); } $errMessage = importProfiles($_POST['typeId'], $options, $serverProfiles, $typeManager); } if ($errMessage !== null) { $container->add($errMessage, 12); } } // export profiles if (!empty($_POST['export'])) { $cfg = new LAMCfgMain(); // check master password $errMessage = null; if (!$cfg->checkPassword($_POST['passwd_e_' . $_POST['typeId']])) { $errMessage = new htmlStatusMessage('ERROR', _('Master password is wrong!')); } elseif (!empty($_POST['exportProfiles'])) { $options = array(); foreach ($_POST['exportProfiles'] as $importProfiles) { $parts = explode('##', $importProfiles); $options[] = array('conf' => $parts[0], 'typeId' => $parts[1]); } $typeId = $_POST['typeId']; $name = $_POST['name_' . $typeId]; $errMessage = exportProfiles($typeId, $name, $options, $serverProfiles, $typeManager); } if ($errMessage !== null) { $container->add($errMessage, 12); } } $profileClasses = array(); $profileClassesTemp = array(); foreach ($types as $type) { if ($type->isHidden() || !checkIfWriteAccessIsAllowed($type->getId())) { continue; } $profileList = \LAM\PROFILES\getAccountProfiles($type->getId()); natcasesort($profileList); $profileClassesTemp[$type->getAlias()] = array( 'typeId' => $type->getId(), 'scope' => $type->getScope(), 'title' => $type->getAlias(), 'icon' => $type->getIcon(), 'profiles' => $profileList); } $profileClassesKeys = array_keys($profileClassesTemp); natcasesort($profileClassesKeys); $profileClassesKeys = array_values($profileClassesKeys); foreach ($profileClassesKeys as $profileClassesKey) { $profileClasses[] = $profileClassesTemp[$profileClassesKey]; } // check if user is logged in, if not go to login if (!$_SESSION['ldap'] || !$_SESSION['ldap']->server()) { metaRefresh("../login.php"); exit; } // check if new profile should be created elseif (isset($_POST['createProfileButton'])) { metaRefresh("profilepage.php?type=" . htmlspecialchars($_POST['createProfile'])); exit; } // check if a profile should be edited foreach ($profileClasses as $profileClass) { if (isset($_POST['editProfile_' . $profileClass['typeId']]) || isset($_POST['editProfile_' . $profileClass['typeId'] . '_x'])) { metaRefresh("profilepage.php?type=" . htmlspecialchars($profileClass['typeId']) . "&edit=" . htmlspecialchars($_POST['profile_' . $profileClass['typeId']])); exit; } } include '../../lib/adminHeader.inc'; echo "