# Profile editor

The profile editor allows the user to set default values for new accounts.
These defaults are saved as files in config/profiles.

## Profilemain.php

This is the start page of the profile editor. The user can select to add/modify/remove selected account profiles.
The list of existing account profiles is returned by getAccountProfiles() in modules.inc. It includes all profile names without file extensions.

## Profilepage.php

This script is used to display the account profile to the user.
The profile options include the LDAP OU suffix and options provided by the account modules.
The values for the OU selection are read with type->getSuffixList().
The account modules provide all other profile options. The profile editor displays a separate fieldset for each module containing its options.
The function print_option() manages the display of the different option types (checkbox, select, ...). The type of each option is saved in $_SESSION['profile_types'].
See the modules specification for a complete list of supported types.
The profiles have unique names under which they are saved. If a profile with the same name already exists it will be overwritten.
When the user selects to save the profile then profilepage.php will check the input for correctness.
First the values are converted to the correct type (checkbox -> Boolean) by checking $_SESSION['profile_types']. Then LAM will replace all "\'" with "'" if magic_quotes_gpc is on. Now the input data is checked for correctness by calling checkProfileOptions().
The account modules return a list of error messages if one or more options are incorrect. If there are errors they will be displayed, otherwise the profile is saved by calling saveAccountProfile().

## Profiledelete.php

When the user selected to delete a profile in profilemain.php he is redirected to this page.
LAM will ask once again if the user is sure to delete the profile. If this is the case the profile will be deleted with delAccountProfile() from profiles.inc.