updated checkProfileOptions

This commit is contained in:
Roland Gruber 2004-03-14 17:35:22 +00:00
parent e2c1420e25
commit 6592b0911c
1 changed files with 13 additions and 9 deletions

View File

@ -151,7 +151,7 @@ function check_module_conflicts($selected, $deps) {
} }
// returns an array with all available user module names // returns an array with all available user module names
// $scope = suer, group, host, .... // $scope = user, group, host, ...
function getAvailableModules($scope) { function getAvailableModules($scope) {
// get module names. // get module names.
$dir = opendir('../../lib/modules'); $dir = opendir('../../lib/modules');
@ -175,15 +175,18 @@ function getProfileOptions($scope) {
return $return; return $return;
} }
function checkProfileOptions($scope, $post) { // checks if the profile options are valid
// type = user, group, host, ... // $scope: user, group, host, ...
if (!isset($_SESSION['profile_account'])) { // $options: an hash array containing all options (name => array(...))
// create new object function checkProfileOptions($scope, $options) {
$_SESSION['profile_account'] = new accountContainer($scope, 'profile_account'); $return = array();
$_SESSION['profile_account']->new_account(); $modules = getAvailableModules($scope);
} for ($i = 0; $i < sizeof($modules); $i++) {
return $_SESSION['profile_account']->process_profile($post); $errors = call_user_func(array($modules[$i], "check_profileOptions"), $scope, $options);
$return = array_merge($return, $errors);
} }
return $return;
}
class accountContainer { class accountContainer {
@ -713,6 +716,7 @@ class accountContainer {
return $return; return $return;
} }
// TODO remove this function?
function proccess_profile($post) { function proccess_profile($post) {
$return = array(); $return = array();
$module = array_keys ($this->module); $module = array_keys ($this->module);