|
|
@ -75,421 +75,26 @@ echo ("<form action=\"confmodules.php\" method=\"post\">\n");
|
|
|
|
echo "<p align=\"center\"><big><b>" . _("Module selection") . "</b></big><br><br></p>";
|
|
|
|
echo "<p align=\"center\"><big><b>" . _("Module selection") . "</b></big><br><br></p>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// user modules
|
|
|
|
$account_list = array(
|
|
|
|
$selected_users_temp = $_SESSION['conf_usermodules'];
|
|
|
|
array('user', _('User modules')),
|
|
|
|
$available_users = array();
|
|
|
|
array('group', _('Group modules')),
|
|
|
|
$available_users = getAvailableModules('user');
|
|
|
|
array('host', _('Host modules'))
|
|
|
|
$selected_users = array();
|
|
|
|
);
|
|
|
|
// only use available modules as selected
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_users_temp); $i++) {
|
|
|
|
|
|
|
|
if (in_array($selected_users_temp[$i], $available_users)) $selected_users[] = $selected_users_temp[$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$no_conflicts_user = true;
|
|
|
|
|
|
|
|
$no_depends_user = true;
|
|
|
|
|
|
|
|
$no_missing_basemodule_user = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// remove modules from selection
|
|
|
|
$allDependenciesOk = true;
|
|
|
|
if ($_POST['user_selected'] && ($_POST['user_remove'])) {
|
|
|
|
|
|
|
|
$new_selected_users = array();
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_users); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($selected_users[$i], $_POST['user_selected'])) $new_selected_users[] = $selected_users[$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$selected_users = $new_selected_users;
|
|
|
|
|
|
|
|
$_SESSION['conf_usermodules'] = $selected_users;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add modules to selection
|
|
|
|
for ($i = 0; $i < sizeof($account_list); $i++) {
|
|
|
|
elseif ($_POST['user_available'] && ($_POST['user_add'])) {
|
|
|
|
$ret = config_showAccountModules($account_list[$i][0], $account_list[$i][1]);
|
|
|
|
$new_selected_users = $selected_users;
|
|
|
|
if (!$ret) {
|
|
|
|
for ($i = 0; $i < sizeof($_POST['user_available']); $i++) {
|
|
|
|
$allDependenciesOk = false;
|
|
|
|
if (! in_array($_POST['user_available'][$i], $selected_users)) $new_selected_users[] = $_POST['user_available'][$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$selected_users = $new_selected_users;
|
|
|
|
|
|
|
|
$_SESSION['conf_usermodules'] = $selected_users;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// group modules
|
|
|
|
|
|
|
|
$selected_groups_temp = $_SESSION['conf_groupmodules'];
|
|
|
|
|
|
|
|
$available_groups = array();
|
|
|
|
|
|
|
|
$available_groups = getAvailableModules('group');
|
|
|
|
|
|
|
|
$selected_groups = array();
|
|
|
|
|
|
|
|
// only use available modules as selected
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_groups_temp); $i++) {
|
|
|
|
|
|
|
|
if (in_array($selected_groups_temp[$i], $available_groups)) $selected_groups[] = $selected_groups_temp[$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$no_conflicts_group = true;
|
|
|
|
|
|
|
|
$no_depends_group = true;
|
|
|
|
|
|
|
|
$no_missing_basemodule_group = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// remove modules from selection
|
|
|
|
|
|
|
|
if ($_POST['group_selected'] && ($_POST['group_remove'])) {
|
|
|
|
|
|
|
|
$new_selected_groups = array();
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_groups); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($selected_groups[$i], $_POST['group_selected'])) $new_selected_groups[] = $selected_groups[$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$selected_groups = $new_selected_groups;
|
|
|
|
|
|
|
|
$_SESSION['conf_groupmodules'] = $selected_groups;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add modules to selection
|
|
|
|
|
|
|
|
elseif ($_POST['group_available'] && ($_POST['group_add'])) {
|
|
|
|
|
|
|
|
$new_selected_groups = $selected_groups;
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($_POST['group_available']); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($_POST['group_available'][$i], $selected_groups)) $new_selected_groups[] = $_POST['group_available'][$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$selected_groups = $new_selected_groups;
|
|
|
|
|
|
|
|
$_SESSION['conf_groupmodules'] = $selected_groups;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// host modules
|
|
|
|
|
|
|
|
$selected_hosts_temp = $_SESSION['conf_hostmodules'];
|
|
|
|
|
|
|
|
$available_hosts = array();
|
|
|
|
|
|
|
|
$available_hosts = getAvailableModules('host');
|
|
|
|
|
|
|
|
$selected_hosts = array();
|
|
|
|
|
|
|
|
// only use available modules as selected
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_hosts_temp); $i++) {
|
|
|
|
|
|
|
|
if (in_array($selected_hosts_temp[$i], $available_hosts)) $selected_hosts[] = $selected_hosts_temp[$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$no_conflicts_host = true;
|
|
|
|
|
|
|
|
$no_depends_host = true;
|
|
|
|
|
|
|
|
$no_missing_basemodule_host = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// remove modules from selection
|
|
|
|
|
|
|
|
if ($_POST['host_selected'] && ($_POST['host_remove'])) {
|
|
|
|
|
|
|
|
$new_selected_hosts = array();
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_hosts); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($selected_hosts[$i], $_POST['host_selected'])) $new_selected_hosts[] = $selected_hosts[$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$selected_hosts = $new_selected_hosts;
|
|
|
|
|
|
|
|
$_SESSION['conf_hostmodules'] = $selected_hosts;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add modules to selection
|
|
|
|
|
|
|
|
elseif ($_POST['host_available'] && ($_POST['host_add'])) {
|
|
|
|
|
|
|
|
$new_selected_hosts = $selected_hosts;
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($_POST['host_available']); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($_POST['host_available'][$i], $selected_hosts)) $new_selected_hosts[] = $_POST['host_available'][$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$selected_hosts = $new_selected_hosts;
|
|
|
|
|
|
|
|
$_SESSION['conf_hostmodules'] = $selected_hosts;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// show user modules
|
|
|
|
|
|
|
|
echo "<fieldset class=\"useredit-bright\"><legend class=\"useredit-bright\"><b>" . _("User modules") . "</b></legend>\n";
|
|
|
|
|
|
|
|
echo "<table border=0 width=\"100%\">\n";
|
|
|
|
|
|
|
|
// select boxes
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"5%\"></td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"40%\">\n";
|
|
|
|
|
|
|
|
echo "<fieldset class=\"useredit-bright\">\n";
|
|
|
|
|
|
|
|
echo "<legend class=\"useredit-bright\">" . _("Selected user modules") . "</legend>\n";
|
|
|
|
|
|
|
|
echo "<select class=\"useredit-bright\" name=\"user_selected[]\" size=5 multiple>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_users); $i++) {
|
|
|
|
|
|
|
|
if (in_array($selected_users[$i], $available_users)) { // selected modules must be available
|
|
|
|
|
|
|
|
if (is_base_module($selected_users[$i], "user")) { // mark base modules
|
|
|
|
|
|
|
|
echo "<option value=\"" . $selected_users[$i] . "\">";
|
|
|
|
|
|
|
|
echo $selected_users[$i] . "(" . getModuleAlias($selected_users[$i], "user") . ")(" . _("base module") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
echo "<option value=\"" . $selected_users[$i] . "\">";
|
|
|
|
|
|
|
|
echo $selected_users[$i] . "(" . getModuleAlias($selected_users[$i], "user") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</select>\n";
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"10%\" align=\"center\">\n";
|
|
|
|
|
|
|
|
echo "<p>";
|
|
|
|
|
|
|
|
echo "<input type=submit value=\"<=\" name=\"user_add\">";
|
|
|
|
|
|
|
|
echo "<br>";
|
|
|
|
|
|
|
|
echo "<input type=submit value=\"=>\" name=\"user_remove\">";
|
|
|
|
|
|
|
|
echo "</p>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"40%\">\n";
|
|
|
|
|
|
|
|
echo "<fieldset class=\"useredit-bright\">\n";
|
|
|
|
|
|
|
|
echo "<legend class=\"useredit-bright\">" . _("Available user modules") . "</legend>\n";
|
|
|
|
|
|
|
|
echo "<select class=\"useredit-bright\" name=\"user_available[]\" size=5 multiple>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($available_users); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($available_users[$i], $selected_users)) { // display non-selected modules
|
|
|
|
|
|
|
|
if (is_base_module($available_users[$i], "user")) { // mark base modules
|
|
|
|
|
|
|
|
echo "<option value=\"" . $available_users[$i] . "\">";
|
|
|
|
|
|
|
|
echo $available_users[$i] . "(" . getModuleAlias($available_users[$i], "user") . ")(" . _("base module") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
echo "<option value=\"" . $available_users[$i] . "\">";
|
|
|
|
|
|
|
|
echo $available_users[$i] . "(" . getModuleAlias($available_users[$i], "user") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</select>\n";
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"5%\"></td>\n";
|
|
|
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check dependencies
|
|
|
|
|
|
|
|
$user_depends = check_module_depends($selected_users, getModulesDependencies('user'));
|
|
|
|
|
|
|
|
if ($user_depends != false) {
|
|
|
|
|
|
|
|
$no_depends_user = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($user_depends); $i++) {
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("Unsolved dependency:") . " </b>" . $user_depends[$i][0] . " (" .
|
|
|
|
|
|
|
|
$user_depends[$i][1] . ")" . "</font><br>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check conflicts
|
|
|
|
|
|
|
|
$user_conflicts = check_module_conflicts($selected_users, getModulesDependencies('user'));
|
|
|
|
|
|
|
|
if ($user_conflicts != false) {
|
|
|
|
|
|
|
|
$no_conflicts_user = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($user_conflicts); $i++) {
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("Conflicting module:") . " </b>" . $user_conflicts[$i][0] . " (" .
|
|
|
|
|
|
|
|
$user_conflicts[$i][1] . ")" . "</font><br>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check for base module
|
|
|
|
|
|
|
|
$found = false;
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_users); $i++) {
|
|
|
|
|
|
|
|
if (is_base_module($selected_users[$i], "user")) {
|
|
|
|
|
|
|
|
$found = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $found) {
|
|
|
|
|
|
|
|
$no_missing_basemodule_user = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("No base module selected!") . "</b></font><br>\n";
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "<p></p>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// show group modules
|
|
|
|
|
|
|
|
echo "<fieldset class=\"groupedit-bright\"><legend class=\"groupedit-bright\"><b>" . _("Group modules") . "</b></legend>\n";
|
|
|
|
|
|
|
|
echo "<table border=0 width=\"100%\">\n";
|
|
|
|
|
|
|
|
// select boxes
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"5%\"></td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"40%\">\n";
|
|
|
|
|
|
|
|
echo "<fieldset class=\"groupedit-bright\">\n";
|
|
|
|
|
|
|
|
echo "<legend class=\"groupedit-bright\">" . _("Selected group modules") . "</legend>\n";
|
|
|
|
|
|
|
|
echo "<select class=\"groupedit-bright\" name=\"group_selected[]\" size=5 multiple>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_groups); $i++) {
|
|
|
|
|
|
|
|
if (in_array($selected_groups[$i], $available_groups)) { // selected modules must be available
|
|
|
|
|
|
|
|
if (is_base_module($selected_groups[$i], "group")) { // mark base modules
|
|
|
|
|
|
|
|
echo "<option value=\"" . $selected_groups[$i] . "\">";
|
|
|
|
|
|
|
|
echo $selected_groups[$i] . "(" . getModuleAlias($selected_groups[$i], "group") . ")(" . _("base module") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
echo "<option value=\"" . $selected_groups[$i] . "\">";
|
|
|
|
|
|
|
|
echo $selected_groups[$i] . "(" . getModuleAlias($selected_groups[$i], "group") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</select>\n";
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"10%\" align=\"center\">\n";
|
|
|
|
|
|
|
|
echo "<p>";
|
|
|
|
|
|
|
|
echo "<input type=submit value=\"<=\" name=\"group_add\">";
|
|
|
|
|
|
|
|
echo "<br>";
|
|
|
|
|
|
|
|
echo "<input type=submit value=\"=>\" name=\"group_remove\">";
|
|
|
|
|
|
|
|
echo "</p>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"40%\">\n";
|
|
|
|
|
|
|
|
echo "<fieldset class=\"groupedit-bright\">\n";
|
|
|
|
|
|
|
|
echo "<legend class=\"groupedit-bright\">" . _("Available group modules") . "</legend>\n";
|
|
|
|
|
|
|
|
echo "<select class=\"groupedit-bright\" name=\"group_available[]\" size=5 multiple>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($available_groups); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($available_groups[$i], $selected_groups)) { // display non-selected modules
|
|
|
|
|
|
|
|
if (is_base_module($available_groups[$i], "group")) { // mark base modules
|
|
|
|
|
|
|
|
echo "<option value=\"" . $available_groups[$i] . "\">";
|
|
|
|
|
|
|
|
echo $available_groups[$i] . "(" . getModuleAlias($available_groups[$i], "group") . ")(" . _("base module") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
echo "<option value=\"" . $available_groups[$i] . "\">";
|
|
|
|
|
|
|
|
echo $available_groups[$i] . "(" . getModuleAlias($available_groups[$i], "group") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</select>\n";
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"5%\"></td>\n";
|
|
|
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check dependencies
|
|
|
|
|
|
|
|
$group_depends = check_module_depends($selected_groups, getModulesDependencies('group'));
|
|
|
|
|
|
|
|
if ($group_depends != false) {
|
|
|
|
|
|
|
|
$no_depends_group = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($group_depends); $i++) {
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("Unsolved dependency:") . " </b>" . $group_depends[$i][0] . " (" .
|
|
|
|
|
|
|
|
$group_depends[$i][1] . ")" . "</font><br>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check conflicts
|
|
|
|
|
|
|
|
$group_conflicts = check_module_conflicts($selected_groups, getModulesDependencies('group'));
|
|
|
|
|
|
|
|
if ($group_conflicts != false) {
|
|
|
|
|
|
|
|
$no_conflicts_group = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($group_conflicts); $i++) {
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("Conflicting module:") . " </b>" . $group_conflicts[$i][0] . " (" .
|
|
|
|
|
|
|
|
$group_conflicts[$i][1] . ")" . "</font><br>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check for base module
|
|
|
|
|
|
|
|
$found = false;
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_groups); $i++) {
|
|
|
|
|
|
|
|
if (is_base_module($selected_groups[$i], "group")) {
|
|
|
|
|
|
|
|
$found = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $found) {
|
|
|
|
|
|
|
|
$no_missing_basemodule_group = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("No base module selected!") . "</b></font><br>\n";
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "<p></p>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// show host modules
|
|
|
|
|
|
|
|
echo "<fieldset class=\"hostedit-bright\"><legend class=\"hostedit-bright\"><b>" . _("Host modules") . "</b></legend>\n";
|
|
|
|
|
|
|
|
echo "<table border=0 width=\"100%\">\n";
|
|
|
|
|
|
|
|
// select boxes
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"5%\"></td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"40%\">\n";
|
|
|
|
|
|
|
|
echo "<fieldset class=\"hostedit-bright\">\n";
|
|
|
|
|
|
|
|
echo "<legend class=\"hostedit-bright\">" . _("Selected host modules") . "</legend>\n";
|
|
|
|
|
|
|
|
echo "<select class=\"hostedit-bright\" name=\"host_selected[]\" size=5 multiple>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_hosts); $i++) {
|
|
|
|
|
|
|
|
if (in_array($selected_hosts[$i], $available_hosts)) { // selected modules must be available
|
|
|
|
|
|
|
|
if (is_base_module($selected_hosts[$i], "host")) { // mark base modules
|
|
|
|
|
|
|
|
echo "<option value=\"" . $selected_hosts[$i] . "\">";
|
|
|
|
|
|
|
|
echo $selected_hosts[$i] . "(" . getModuleAlias($selected_hosts[$i], "host") . ")(" . _("base module") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
echo "<option value=\"" . $selected_hosts[$i] . "\">";
|
|
|
|
|
|
|
|
echo $selected_hosts[$i] . "(" . getModuleAlias($selected_hosts[$i], "host") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</select>\n";
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"10%\" align=\"center\">\n";
|
|
|
|
|
|
|
|
echo "<p>";
|
|
|
|
|
|
|
|
echo "<input type=submit value=\"<=\" name=\"host_add\">";
|
|
|
|
|
|
|
|
echo "<br>";
|
|
|
|
|
|
|
|
echo "<input type=submit value=\"=>\" name=\"host_remove\">";
|
|
|
|
|
|
|
|
echo "</p>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"40%\">\n";
|
|
|
|
|
|
|
|
echo "<fieldset class=\"hostedit-bright\">\n";
|
|
|
|
|
|
|
|
echo "<legend class=\"hostedit-bright\">" . _("Available host modules") . "</legend>\n";
|
|
|
|
|
|
|
|
echo "<select class=\"hostedit-bright\" name=\"host_available[]\" size=5 multiple>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($available_hosts); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($available_hosts[$i], $selected_hosts)) { // display non-selected modules
|
|
|
|
|
|
|
|
if (is_base_module($available_hosts[$i], "host")) { // mark base modules
|
|
|
|
|
|
|
|
echo "<option value=\"" . $available_hosts[$i] . "\">";
|
|
|
|
|
|
|
|
echo $available_hosts[$i] . "(" . getModuleAlias($available_hosts[$i], "host") . ")(" . _("base module") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
echo "<option value=\"" . $available_hosts[$i] . "\">";
|
|
|
|
|
|
|
|
echo $available_hosts[$i] . "(" . getModuleAlias($available_hosts[$i], "host") . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</select>\n";
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"5%\"></td>\n";
|
|
|
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check dependencies
|
|
|
|
|
|
|
|
$host_depends = check_module_depends($selected_hosts, getModulesDependencies('host'));
|
|
|
|
|
|
|
|
if ($host_depends != false) {
|
|
|
|
|
|
|
|
$no_depends_host = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($host_depends); $i++) {
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("Unsolved dependency:") . " </b>" . $host_depends[$i][0] . " (" .
|
|
|
|
|
|
|
|
$host_depends[$i][1] . ")" . "</font><br>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check conflicts
|
|
|
|
|
|
|
|
$host_conflicts = check_module_conflicts($selected_hosts, getModulesDependencies('host'));
|
|
|
|
|
|
|
|
if ($host_conflicts != false) {
|
|
|
|
|
|
|
|
$no_conflicts_host = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($host_conflicts); $i++) {
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("Conflicting module:") . " </b>" . $host_conflicts[$i][0] . " (" .
|
|
|
|
|
|
|
|
$host_conflicts[$i][1] . ")" . "</font><br>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check for base module
|
|
|
|
|
|
|
|
$found = false;
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_hosts); $i++) {
|
|
|
|
|
|
|
|
if (is_base_module($selected_hosts[$i], "host")) {
|
|
|
|
|
|
|
|
$found = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $found) {
|
|
|
|
|
|
|
|
$no_missing_basemodule_host = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("No base module selected!") . "</b></font><br>\n";
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// submit buttons
|
|
|
|
// submit buttons
|
|
|
|
echo "<p>\n";
|
|
|
|
echo "<p>\n";
|
|
|
|
// disable button if there are conflicts/depends
|
|
|
|
// disable button if there are conflicts/depends
|
|
|
|
if ($no_conflicts_user && $no_depends_user && $no_missing_basemodule_user &&
|
|
|
|
if ($allDependenciesOk) {
|
|
|
|
$no_conflicts_group && $no_depends_group && $no_missing_basemodule_group &&
|
|
|
|
|
|
|
|
$no_conflicts_host && $no_depends_host && $no_missing_basemodule_host) {
|
|
|
|
|
|
|
|
echo "<input type=\"submit\" value=\"" . _("Submit") . "\" name=\"submit\">\n";
|
|
|
|
echo "<input type=\"submit\" value=\"" . _("Submit") . "\" name=\"submit\">\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
@ -499,10 +104,162 @@ echo "<p>\n";
|
|
|
|
echo "<input type=\"submit\" value=\"" . _("Abort") . "\" name=\"abort\">\n";
|
|
|
|
echo "<input type=\"submit\" value=\"" . _("Abort") . "\" name=\"abort\">\n";
|
|
|
|
echo "</p>\n";
|
|
|
|
echo "</p>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "<p><br><br>\n";
|
|
|
|
|
|
|
|
echo "(*) <a href=\"../help.php?HelpNumber=237\">" . _("Base module") . "</a>";
|
|
|
|
|
|
|
|
echo "</p>\n";
|
|
|
|
|
|
|
|
|
|
|
|
echo "</form>\n";
|
|
|
|
echo "</form>\n";
|
|
|
|
echo "</body>\n";
|
|
|
|
echo "</body>\n";
|
|
|
|
echo "</html>\n";
|
|
|
|
echo "</html>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Displays the module selection boxes and checks if dependencies are fulfilled.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param string $scope account type
|
|
|
|
|
|
|
|
* @param string $title title for module selection (e.g. "User modules")
|
|
|
|
|
|
|
|
* @return boolean true if all dependencies are ok
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function config_showAccountModules($scope, $title) {
|
|
|
|
|
|
|
|
// account modules
|
|
|
|
|
|
|
|
$selected_temp = $_SESSION['conf_' . $scope . 'modules'];
|
|
|
|
|
|
|
|
$available = array();
|
|
|
|
|
|
|
|
$available = getAvailableModules($scope);
|
|
|
|
|
|
|
|
$selected = array();
|
|
|
|
|
|
|
|
// only use available modules as selected
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected_temp); $i++) {
|
|
|
|
|
|
|
|
if (in_array($selected_temp[$i], $available)) $selected[] = $selected_temp[$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$no_conflicts = true;
|
|
|
|
|
|
|
|
$no_depends = true;
|
|
|
|
|
|
|
|
$no_missing_basemodule = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// remove modules from selection
|
|
|
|
|
|
|
|
if ($_POST[$scope . '_selected'] && ($_POST[$scope . '_remove'])) {
|
|
|
|
|
|
|
|
$new_selected = array();
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($selected[$i], $_POST[$scope . '_selected'])) $new_selected[] = $selected[$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$selected = $new_selected;
|
|
|
|
|
|
|
|
$_SESSION['conf_' . $scope . 'modules'] = $selected;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add modules to selection
|
|
|
|
|
|
|
|
elseif ($_POST[$scope . '_available'] && ($_POST[$scope . '_add'])) {
|
|
|
|
|
|
|
|
$new_selected = $selected;
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($_POST[$scope . '_available']); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($_POST[$scope . '_available'][$i], $selected)) $new_selected[] = $_POST[$scope . '_available'][$i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$selected = $new_selected;
|
|
|
|
|
|
|
|
$_SESSION['conf_' . $scope . 'modules'] = $selected;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// show account modules
|
|
|
|
|
|
|
|
echo "<fieldset class=\"" . $scope . "edit-bright\"><legend class=\"" . $scope . "edit-bright\"><b>" . $title . "</b></legend>\n";
|
|
|
|
|
|
|
|
echo "<table border=0 width=\"100%\">\n";
|
|
|
|
|
|
|
|
// select boxes
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"5%\"></td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"40%\">\n";
|
|
|
|
|
|
|
|
echo "<fieldset class=\"" . $scope . "edit-bright\">\n";
|
|
|
|
|
|
|
|
echo "<legend class=\"" . $scope . "edit-bright\">" . _("Selected modules") . "</legend>\n";
|
|
|
|
|
|
|
|
echo "<select class=\"" . $scope . "edit-bright\" name=\"" . $scope . "_selected[]\" size=5 multiple>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected); $i++) {
|
|
|
|
|
|
|
|
if (in_array($selected[$i], $available)) { // selected modules must be available
|
|
|
|
|
|
|
|
if (is_base_module($selected[$i], $scope)) { // mark base modules
|
|
|
|
|
|
|
|
echo "<option value=\"" . $selected[$i] . "\">";
|
|
|
|
|
|
|
|
echo $selected[$i] . "(" . getModuleAlias($selected[$i], $scope) . ")(*)";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
echo "<option value=\"" . $selected[$i] . "\">";
|
|
|
|
|
|
|
|
echo $selected[$i] . "(" . getModuleAlias($selected[$i], $scope) . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</select>\n";
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"10%\" align=\"center\">\n";
|
|
|
|
|
|
|
|
echo "<p>";
|
|
|
|
|
|
|
|
echo "<input type=submit value=\"<=\" name=\"" . $scope . "_add\">";
|
|
|
|
|
|
|
|
echo "<br>";
|
|
|
|
|
|
|
|
echo "<input type=submit value=\"=>\" name=\"" . $scope . "_remove\">";
|
|
|
|
|
|
|
|
echo "</p>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"40%\">\n";
|
|
|
|
|
|
|
|
echo "<fieldset class=\"" . $scope . "edit-bright\">\n";
|
|
|
|
|
|
|
|
echo "<legend class=\"" . $scope . "edit-bright\">" . _("Available modules") . "</legend>\n";
|
|
|
|
|
|
|
|
echo "<select class=\"" . $scope . "edit-bright\" name=\"" . $scope . "_available[]\" size=5 multiple>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($available); $i++) {
|
|
|
|
|
|
|
|
if (! in_array($available[$i], $selected)) { // display non-selected modules
|
|
|
|
|
|
|
|
if (is_base_module($available[$i], $scope)) { // mark base modules
|
|
|
|
|
|
|
|
echo "<option value=\"" . $available[$i] . "\">";
|
|
|
|
|
|
|
|
echo $available[$i] . "(" . getModuleAlias($available[$i], $scope) . ")(*)";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
echo "<option value=\"" . $available[$i] . "\">";
|
|
|
|
|
|
|
|
echo $available[$i] . "(" . getModuleAlias($available[$i], $scope) . ")";
|
|
|
|
|
|
|
|
echo "</option>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "</select>\n";
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
|
|
|
echo "<td width=\"5%\"></td>\n";
|
|
|
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
|
|
|
echo "</table>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check dependencies
|
|
|
|
|
|
|
|
$depends = check_module_depends($selected, getModulesDependencies($scope));
|
|
|
|
|
|
|
|
if ($depends != false) {
|
|
|
|
|
|
|
|
$no_depends = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($depends); $i++) {
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("Unsolved dependency:") . " </b>" . $depends[$i][0] . " (" .
|
|
|
|
|
|
|
|
$depends[$i][1] . ")" . "</font><br>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check conflicts
|
|
|
|
|
|
|
|
$conflicts = check_module_conflicts($selected, getModulesDependencies($scope));
|
|
|
|
|
|
|
|
if ($conflicts != false) {
|
|
|
|
|
|
|
|
$no_conflicts = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($conflicts); $i++) {
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("Conflicting module:") . " </b>" . $conflicts[$i][0] . " (" .
|
|
|
|
|
|
|
|
$conflicts[$i][1] . ")" . "</font><br>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check for base module
|
|
|
|
|
|
|
|
$baseCount = 0;
|
|
|
|
|
|
|
|
for ($i = 0; $i < sizeof($selected); $i++) {
|
|
|
|
|
|
|
|
if (is_base_module($selected[$i], $scope)) {
|
|
|
|
|
|
|
|
$baseCount++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($baseCount != 1) {
|
|
|
|
|
|
|
|
$no_missing_basemodule = false;
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
echo "<font color=\"red\"><b>" . _("No or more than one base module selected!") . "</b></font><br>\n";
|
|
|
|
|
|
|
|
echo "<p>\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "</fieldset>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "<p></p>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ($no_conflicts & $no_depends & $no_missing_basemodule);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|