changed echo commands to StatusMessage

fixed script settings
This commit is contained in:
Roland Gruber 2003-05-14 13:45:52 +00:00
parent 7d77732f37
commit b643b14a8f
3 changed files with 86 additions and 73 deletions

View File

@ -24,6 +24,8 @@ $Id$
*/ */
include_once("status.inc");
// sets language settings for automatic translation // sets language settings for automatic translation
function setlanguage() { function setlanguage() {
if ($_SESSION['language']) { if ($_SESSION['language']) {
@ -181,7 +183,7 @@ class Config {
fclose($file); fclose($file);
} }
else { else {
echo _("Unable to load lam.conf! ") . $conffile ; echo "<br>"; StatusMessage("ERROR", "", _("Unable to load lam.conf! ") . $conffile);
} }
} }
@ -193,7 +195,6 @@ class Config {
for($i = 0; $i <= array_search("lam", $path); $i++) { for($i = 0; $i <= array_search("lam", $path); $i++) {
$conffile .= "/" . $path[$i]; $conffile .= "/" . $path[$i];
} }
echo ;
$conffile .= "/config/lam.conf"; $conffile .= "/config/lam.conf";
if (is_file($conffile) == True) { if (is_file($conffile) == True) {
// booleans to check if value was already saved // booleans to check if value was already saved
@ -339,10 +340,10 @@ class Config {
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]); for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
fclose($file); fclose($file);
} }
else { else {
echo _("<br><font color=\"red\">Cannot open config file!</font>"); StatusMessage("ERROR", "", _("Cannot open config file!"));
exit; exit;
} }
} }
} }
@ -378,7 +379,7 @@ class Config {
// sets the server address // sets the server address
function set_ServerURL($value) { function set_ServerURL($value) {
if (is_string($value)) $this->ServerURL = $value; if (is_string($value)) $this->ServerURL = $value;
else echo _("Config->set_ServerURL failed!") . " " . $value . " " . $value; else StatusMessage("WARN", "", _("Config->set_ServerURL failed!") . " " . $value . " " . $value);
} }
// returns an array of string with all admin names // returns an array of string with all admin names
@ -398,7 +399,7 @@ class Config {
} }
if ($b) $this->Admins = $value; if ($b) $this->Admins = $value;
} }
else echo _("Config->set_Admins failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_Admins failed!") . " " . $value);
} }
// returns all admin users seperated by semicolons // returns all admin users seperated by semicolons
@ -408,11 +409,11 @@ class Config {
// needs a string that contains all admin users seperated by semicolons // needs a string that contains all admin users seperated by semicolons
function set_Adminstring($value) { function set_Adminstring($value) {
if (is_string($value)) { if (is_string($value) && eregi("^[a-z]*=[a-z]*(,[a-z]*=[a-z]*)*(;[a-z]*=[a-z]*(,[a-z]*=[a-z]*)*)*$", $value)) {
$this->Adminstring = $value; $this->Adminstring = $value;
$this->Admins = explode(";", $value); $this->Admins = explode(";", $value);
} }
else echo _("Config->set_Adminstring failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_Adminstring failed!") . " " . $value);
} }
// returns the password to access the preferences wizard // returns the password to access the preferences wizard
@ -423,7 +424,7 @@ class Config {
// sets the preferences wizard password // sets the preferences wizard password
function set_Passwd($value) { function set_Passwd($value) {
if (is_string($value)) $this->Passwd = $value; if (is_string($value)) $this->Passwd = $value;
else echo _("Config->set_Passwd failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_Passwd failed!") . " " . $value);
} }
// returns the LDAP suffix where users are saved // returns the LDAP suffix where users are saved
@ -433,8 +434,10 @@ class Config {
// sets the LDAP suffix where users are saved // sets the LDAP suffix where users are saved
function set_UserSuffix($value) { function set_UserSuffix($value) {
if (is_string($value)) $this->Suff_users = $value; if (is_string($value) && (eregi("^(([a-z]|[0-9])*=([a-z]|[0-9])*)(,([a-z]|[0-9])*=([a-z]|[0-9])*)*$", $value))) {
else echo _("Config->set_UserSuffix failed!") . " " . $value; $this->Suff_users = $value;
}
else StatusMessage("WARN", "", _("Config->set_UserSuffix failed!") . " " . $value);
} }
// returns the LDAP suffix where groups are saved // returns the LDAP suffix where groups are saved
@ -444,8 +447,10 @@ class Config {
// sets the LDAP suffix where groups are saved // sets the LDAP suffix where groups are saved
function set_GroupSuffix($value) { function set_GroupSuffix($value) {
if (is_string($value)) $this->Suff_groups = $value; if (is_string($value) && (eregi("^(([a-z]|[0-9])*=([a-z]|[0-9])*)(,([a-z]|[0-9])*=([a-z]|[0-9])*)*$", $value))) {
else echo _("Config->set_GroupSuffix failed!") . " " . $value; $this->Suff_groups = $value;
}
else StatusMessage("WARN", "", _("Config->set_GroupSuffix failed!") . " " . $value);
} }
// returns the LDAP suffix where hosts are saved // returns the LDAP suffix where hosts are saved
@ -455,8 +460,10 @@ class Config {
// sets the LDAP suffix where hosts are saved // sets the LDAP suffix where hosts are saved
function set_HostSuffix($value) { function set_HostSuffix($value) {
if (is_string($value)) $this->Suff_hosts = $value; if (is_string($value) && (eregi("^(([a-z]|[0-9])*=([a-z]|[0-9])*)(,([a-z]|[0-9])*=([a-z]|[0-9])*)*$", $value))) {
else echo _("Config->set_HostSuffix failed!") . " " . $value; $this->Suff_hosts = $value;
}
else StatusMessage("WARN", "", _("Config->set_HostSuffix failed!") . " " . $value);
} }
// returns the minimum UID to use when creating new users // returns the minimum UID to use when creating new users
@ -467,7 +474,7 @@ class Config {
// sets the minimum UID to use when creating new users // sets the minimum UID to use when creating new users
function set_minUID($value) { function set_minUID($value) {
if (is_numeric($value)) $this->MinUID = $value; if (is_numeric($value)) $this->MinUID = $value;
else echo _("Config->set_minUID failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_minUID failed!") . " " . $value);
} }
// returns the maximum UID to use when creating new users // returns the maximum UID to use when creating new users
@ -478,7 +485,7 @@ class Config {
// sets the maximum UID to use when creating new users // sets the maximum UID to use when creating new users
function set_maxUID($value) { function set_maxUID($value) {
if (is_numeric($value)) $this->MaxUID = $value; if (is_numeric($value)) $this->MaxUID = $value;
else echo _("Config->set_maxUID failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_maxUID failed!") . " " . $value);
} }
// returns the minimum GID to use when creating new groups // returns the minimum GID to use when creating new groups
@ -489,7 +496,7 @@ class Config {
// sets the minimum GID to use when creating new groups // sets the minimum GID to use when creating new groups
function set_minGID($value) { function set_minGID($value) {
if (is_numeric($value)) $this->MinGID = $value; if (is_numeric($value)) $this->MinGID = $value;
else echo _("Config->set_minGID failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_minGID failed!") . " " . $value);
} }
// returns the maximum GID to use when creating new groups // returns the maximum GID to use when creating new groups
@ -500,7 +507,7 @@ class Config {
// sets the maximum GID to use when creating new groups // sets the maximum GID to use when creating new groups
function set_maxGID($value) { function set_maxGID($value) {
if (is_numeric($value)) $this->MaxGID = $value; if (is_numeric($value)) $this->MaxGID = $value;
else echo _("Config->set_maxGID failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_maxGID failed!") . " " . $value);
} }
// returns the minimum UID to use when creating new Samba hosts // returns the minimum UID to use when creating new Samba hosts
@ -511,7 +518,7 @@ class Config {
// sets the minimum UID to use when creating new Samba hosts // sets the minimum UID to use when creating new Samba hosts
function set_minMachine($value) { function set_minMachine($value) {
if (is_numeric($value)) $this->MinMachine = $value; if (is_numeric($value)) $this->MinMachine = $value;
else echo _("Config->set_minMachine failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_minMachine failed!") . " " . $value);
} }
// returns the maximum UID to use when creating new Samba hosts // returns the maximum UID to use when creating new Samba hosts
@ -522,7 +529,7 @@ class Config {
// sets the maximum UID to use when creating new Samba hosts // sets the maximum UID to use when creating new Samba hosts
function set_maxMachine($value) { function set_maxMachine($value) {
if (is_numeric($value)) $this->MaxMachine = $value; if (is_numeric($value)) $this->MaxMachine = $value;
else echo _("Config->set_maxMachine failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_maxMachine failed!") . " " . $value);
} }
// returns the list of attributes to show in user list // returns the list of attributes to show in user list
@ -532,8 +539,10 @@ class Config {
// sets the list of attributes to show in user list // sets the list of attributes to show in user list
function set_userlistAttributes($value) { function set_userlistAttributes($value) {
if (is_string($value)) $this->userlistAttributes = $value; if (is_string($value) && eregi("^((#[a-z]*)|([a-z]*:[a-z*]))(;((#[a-z]*)|([a-z]*:[a-z]*)))*$", $value)) {
else echo _("Config->set_userlistAttributes failed!") . " " . $value; $this->userlistAttributes = $value;
}
else StatusMessage("WARN", "", _("Config->set_userlistAttributes failed!") . " " . $value);
} }
// returns the list of attributes to show in group list // returns the list of attributes to show in group list
@ -543,8 +552,10 @@ class Config {
// sets the list of attributes to show in group list // sets the list of attributes to show in group list
function set_grouplistAttributes($value) { function set_grouplistAttributes($value) {
if (is_string($value)) $this->grouplistAttributes = $value; if (is_string($value) && eregi("^((#[a-z]*)|([a-z]*:[a-z*]))(;((#[a-z]*)|([a-z]*:[a-z]*)))*$", $value)) {
else echo _("Config->set_grouplistAttributes failed!") . " " . $value; $this->grouplistAttributes = $value;
}
else StatusMessage("WARN", "", _("Config->set_grouplistAttributes failed!") . " " . $value);
} }
// returns the list of attributes to show in host list // returns the list of attributes to show in host list
@ -554,30 +565,21 @@ class Config {
// sets the list of attributes to show in host list // sets the list of attributes to show in host list
function set_hostlistAttributes($value) { function set_hostlistAttributes($value) {
if (is_string($value)) $this->hostlistAttributes = $value; if (is_string($value) && eregi("^((#[a-z]*)|([a-z]*:[a-z*]))(;((#[a-z]*)|([a-z]*:[a-z]*)))*$", $value)) {
else echo _("Config->set_hostlistAttributes failed!") . " " . $value; $this->hostlistAttributes = $value;
}
else StatusMessage("WARN", "", _("Config->set_hostlistAttributes failed!") . " " . $value);
} }
/** // returns the maximum number of rows in user/group/host lists
*
*
*
* @return maxlistentries
*/
function get_MaxListEntries() { function get_MaxListEntries() {
return $this->maxlistentries; return $this->maxlistentries;
} }
/** // sets the maximum number of rows in user/group/host lists
* @brief sets the maximum of entries to display on one page of the lists
*
* @param value maximum count of entries on one page
*
* @return
*/
function set_MaxListEntries ($value) { function set_MaxListEntries ($value) {
if (is_numeric($value)) $this->maxlistentries = $value; if (is_numeric($value)) $this->maxlistentries = $value;
else echo _("Config->set_MaxListEntries failed!" . $value); else StatusMessage("WARN", "", _("Config->set_MaxListEntries failed!") . $value);
} }
// returns the default language string // returns the default language string
@ -588,7 +590,7 @@ class Config {
// sets the default language string // sets the default language string
function set_defaultLanguage($value) { function set_defaultLanguage($value) {
if (is_string($value)) $this->defaultLanguage = $value; if (is_string($value)) $this->defaultLanguage = $value;
else echo _("Config->set_defaultLanguage failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_defaultLanguage failed!") . " " . $value);
} }
// returns the path to the external script // returns the path to the external script
@ -600,7 +602,7 @@ class Config {
function set_scriptPath($value) { function set_scriptPath($value) {
if (!$value) $value = ""; // optional parameter if (!$value) $value = ""; // optional parameter
if (is_string($value) && eregi("^()|(/([a-z]|[0-9]|-|_|/)*)$", $value)) $this->scriptPath = $value; if (is_string($value) && eregi("^()|(/([a-z]|[0-9]|-|_|/)*)$", $value)) $this->scriptPath = $value;
else echo _("Config->set_scriptPath failed!") . " " . $value; else StatusMessage("WARN", "", _("Config->set_scriptPath failed!") . " " . $value);
} }
// returns the server of the external script // returns the server of the external script
@ -611,8 +613,10 @@ class Config {
// sets the server of the external script // sets the server of the external script
function set_scriptServer($value) { function set_scriptServer($value) {
if (!$value) $value = ""; // optional parameter if (!$value) $value = ""; // optional parameter
if (is_string($value)) $this->scriptServer = $value; if (is_string($value) && (eregi("^([0-9]{3}.[0-9]{3}.[0-9]{3}.[0-9]{3})$", $value) || $value == "")) {
else echo _("Config->set_scriptServer failed!") . " " . $value; $this->scriptServer = $value;
}
else StatusMessage("WARN", "", _("Config->set_scriptServer failed!") . " " . $value);
} }

View File

@ -56,7 +56,9 @@ if ($_POST['back'] || $_POST['submitconf']){
if ($_POST['maxlistentries']) $maxlistentries = $_POST['maxlistentries']; if ($_POST['maxlistentries']) $maxlistentries = $_POST['maxlistentries'];
if ($_POST['language']) $language = $_POST['language']; if ($_POST['language']) $language = $_POST['language'];
if ($_POST['scriptpath']) $scriptpath = $_POST['scriptpath']; if ($_POST['scriptpath']) $scriptpath = $_POST['scriptpath'];
else $scriptpath = "";
if ($_POST['scriptserver']) $scriptserver = $_POST['scriptserver']; if ($_POST['scriptserver']) $scriptserver = $_POST['scriptserver'];
else $scriptserver = "";
session_register('passwd', 'passwd1', 'passwd2', 'serverurl', 'admins', 'suffusers', session_register('passwd', 'passwd1', 'passwd2', 'serverurl', 'admins', 'suffusers',
'suffgroups', 'suffhosts', 'minUID', 'maxUID', 'minGID', 'maxGID', 'minMach', 'suffgroups', 'suffhosts', 'minUID', 'maxUID', 'minGID', 'maxGID', 'minMach',
'maxMach', 'usrlstattr', 'grplstattr', 'hstlstattr', 'maxlistentries', 'language', 'maxMach', 'usrlstattr', 'grplstattr', 'hstlstattr', 'maxlistentries', 'language',

View File

@ -61,6 +61,10 @@ if ($passwd != $conf->get_Passwd()) {
exit; exit;
} }
echo "<html><head><title>listusers</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo "</head><body>\n";
echo ("<p align=\"center\"><a href=\"http://lam.sf.net\" target=\"new_window\">". echo ("<p align=\"center\"><a href=\"http://lam.sf.net\" target=\"new_window\">".
"<img src=\"../../graphics/banner.jpg\" border=1></a></p><hr><br><br>"); "<img src=\"../../graphics/banner.jpg\" border=1></a></p><hr><br><br>");
@ -187,6 +191,9 @@ $conf->save();
echo ("<b>" . _("The following settings were saved:") . "</b><br><br>"); echo ("<b>" . _("The following settings were saved:") . "</b><br><br>");
$conf->printconf(); $conf->printconf();
echo ("<br><br><br><br><br><a href=\"../login.php\" target=\"_top\">" . _("Back to Login") . "</a>"); echo ("<br><br><br><br><br><a href=\"../login.php\" target=\"_top\">" . _("Back to Login") . "</a>");
echo("</body></html>");
// remove settings from session // remove settings from session
unset($_SESSION['passwd']); unset($_SESSION['passwd']);
unset($_SESSION['passwd1']); unset($_SESSION['passwd1']);