From 1aa6f8de59c77ca42c90e0eeb1bb68893df5867f Mon Sep 17 00:00:00 2001
From: Roland Gruber
";
echo "" . _("Path to external script") . ": " . $this->scriptPath . "
";
echo "" . _("Server of external script") . ": " . $this->scriptServer . "
";
- echo "" . _("List of valid users") . ": " . $this->Admins . "
";
+ echo "" . _("List of valid users") . ": " . $this->Admins . "
";
+ echo "" . _("User modules") . ": " . $this->usermodules . "
";
+ echo "" . _("Group modules") . ": " . $this->groupmodules . "
";
+ echo "" . _("Host modules") . ": " . $this->hostmodules . "
";
echo "" . _("Text for user PDF") . ": " . $this->get_pdftext();
}
@@ -712,13 +719,18 @@ class Config {
function set_UserModules($modules) {
if (! is_array($modules)) return false;
// check module names
- // TODO check against available module names
+ $available = getAvailableUserModules();
+ for ($i = 0; $i < sizeof($modules); $i++) {
+ if (! in_array($modules[$i], $available)) return false;
+ }
+ // TODO: check depends/conflicts
$this->usermodules = implode(",", $modules);
+ return true;
}
// returns an array of all selected group modules
function get_GroupModules() {
- return explode(",", $this->usermodules);
+ return explode(",", $this->groupmodules);
}
// sets the selected group modules
@@ -727,13 +739,18 @@ class Config {
function set_GroupModules($modules) {
if (! is_array($modules)) return false;
// check module names
- // TODO check against available module names
+ $available = getAvailableGroupModules();
+ for ($i = 0; $i < sizeof($modules); $i++) {
+ if (! in_array($modules[$i], $available)) return false;
+ }
+ // TODO: check depends/conflicts
$this->groupmodules = implode(",", $modules);
+ return true;
}
// returns an array of all selected host modules
function get_HostModules() {
- return explode(",", $this->usermodules);
+ return explode(",", $this->hostmodules);
}
// sets the selected host modules
@@ -742,8 +759,13 @@ class Config {
function set_HostModules($modules) {
if (! is_array($modules)) return false;
// check module names
- // TODO check against available module names
+ $available = getAvailableHostModules();
+ for ($i = 0; $i < sizeof($modules); $i++) {
+ if (! in_array($modules[$i], $available)) return false;
+ }
+ // TODO: check depends/conflicts
$this->hostmodules = implode(",", $modules);
+ return true;
}
}
diff --git a/lam/templates/config/conflogin.php b/lam/templates/config/conflogin.php
index 66c7cfd3..b3072655 100644
--- a/lam/templates/config/conflogin.php
+++ b/lam/templates/config/conflogin.php
@@ -57,6 +57,9 @@ unset($_SESSION['conf_scriptserver']);
unset($_SESSION['conf_samba3']);
unset($_SESSION['conf_pwdhash']);
unset($_SESSION['conf_filename']);
+unset($_SESSION['conf_usermodules']);
+unset($_SESSION['conf_groupmodules']);
+unset($_SESSION['conf_hostmodules']);
// remove config wizard settings
unset($_SESSION['confwiz_config']);
diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php
index 68cbbe4d..60ee26e3 100644
--- a/lam/templates/config/confmain.php
+++ b/lam/templates/config/confmain.php
@@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
- Copyright (C) 2003 Roland Gruber
+ Copyright (C) 2003-04 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
@@ -33,9 +33,9 @@ session_save_path("../../sess");
setlanguage();
// check if button was pressed and if we have to save the setting or go back to login
-if ($_POST['back'] || $_POST['submitconf']){
+if ($_POST['back'] || $_POST['submitconf'] || $_POST['editmodules']){
// save settings
- if ($_POST['submitconf']){
+ if ($_POST['submitconf'] || $_POST['editmodules']){
// save HTTP-POST variables in session
$_SESSION['conf_passwd'] = $_POST['passwd'];
$_SESSION['conf_passwd1'] = $_POST['passwd1'];
@@ -63,9 +63,19 @@ if ($_POST['back'] || $_POST['submitconf']){
$_SESSION['conf_scriptpath'] = $_POST['scriptpath'];
$_SESSION['conf_scriptserver'] = $_POST['scriptserver'];
$_SESSION['conf_pdf_usertext'] = $_POST['pdf_usertext'];
+ $_SESSION['conf_usermodules'] = explode(",", $_POST['usermodules']);
+ $_SESSION['conf_groupmodules'] = explode(",", $_POST['groupmodules']);
+ $_SESSION['conf_hostmodules'] = explode(",", $_POST['hostmodules']);
$_SESSION['conf_filename'] = $_POST['filename'];
+ }
+ // go to final page
+ if ($_POST['submitconf']){
metaRefresh("confsave.php");
}
+ // go to modules page
+ elseif ($_POST['editmodules']){
+ metaRefresh("confmodules.php");
+ }
// back to login
else if ($_POST['back']){
metaRefresh("../login.php");
@@ -75,6 +85,7 @@ if ($_POST['back'] || $_POST['submitconf']){
// get password if register_globals is off
if ($_POST['passwd']) $passwd = $_POST['passwd'];
+if ($_GET["modulesback"] == "true") $passwd = $_SESSION['conf_passwd'];
// check if password was entered
// if not: load login page
@@ -84,16 +95,53 @@ if (! $passwd) {
exit;
}
+include_once ('../../lib/config.inc');
+$filename = $_POST['filename'];
+if ($_GET["modulesback"] == "true") $filename = $_SESSION['conf_filename'];
+$conf = new Config($filename);
+
// check if password is valid
// if not: load login page
-include_once ('../../lib/config.inc');
-$conf = new Config($_POST['filename']);
if (!(($conf->get_Passwd()) == $passwd)) {
$message = _("The password is invalid! Please try again.");
require('conflogin.php');
exit;
}
+// check if user comes from modules page
+if ($_GET["modulesback"] == "true") {
+ // load config values from session
+ $conf->set_samba3($_SESSION['conf_samba3']);
+ $conf->set_ServerURL($_SESSION['conf_serverurl']);
+ $conf->set_cacheTimeout($_SESSION['conf_cachetimeout']);
+ $conf->set_Adminstring($_SESSION['conf_admins']);
+ $conf->set_UserSuffix($_SESSION['conf_suffusers']);
+ $conf->set_GroupSuffix($_SESSION['conf_suffgroups']);
+ $conf->set_HostSuffix($_SESSION['conf_suffhosts']);
+ $conf->set_DomainSuffix($_SESSION['conf_suffdomains']);
+ $conf->set_minUID($_SESSION['conf_minUID']);
+ $conf->set_maxUID($_SESSION['conf_maxUID']);
+ $conf->set_minGID($_SESSION['conf_minGID']);
+ $conf->set_maxGID($_SESSION['conf_maxGID']);
+ $conf->set_minMachine($_SESSION['conf_minMach']);
+ $conf->set_maxMachine($_SESSION['conf_maxMach']);
+ $conf->set_userlistAttributes($_SESSION['conf_usrlstattr']);
+ $conf->set_grouplistAttributes($_SESSION['conf_grplstattr']);
+ $conf->set_hostlistAttributes($_SESSION['conf_hstlstattr']);
+ $conf->set_MaxListEntries($_SESSION['conf_maxlistentries']);
+ $conf->set_defaultLanguage($_SESSION['conf_lang']);
+ $conf->set_scriptpath($_SESSION['conf_scriptpath']);
+ $conf->set_scriptserver($_SESSION['conf_scriptserver']);
+ $conf->set_pwdhash($_SESSION['conf_pwdhash']);
+ $conf->set_pdftext($_SESSION['conf_pdf_usertext']);
+ // check if modules were edited
+ if ($_GET["moduleschanged"] == "true") {
+ $conf->set_UserModules($_SESSION['conf_usermodules']);
+ $conf->set_GroupModules($_SESSION['conf_groupmodules']);
+ $conf->set_HostModules($_SESSION['conf_hostmodules']);
+ }
+}
+
echo $_SESSION['header'];
echo ("" . _("Help
echo ("");
echo ("");
+
+echo ("");
+
+echo ("");
+
echo ("");
echo ("