get_Passwd()) {
require('conflogin.php');
exit;
}
echo $_SESSION['header'];
echo "
listusers\n";
echo "\n";
echo "\n";
echo ("".
"
");
// check new preferences
if (!$serverurl) {
echo ("" . _("Server Address is empty!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!isset($cachetimeout) || !(is_numeric($cachetimeout)) || !($cachetimeout > -1)) {
echo ("" . _("Cache timeout is empty!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$admins || !eregi("^([a-z0-9]|-)+=([a-z0-9]|-)+(,([a-z0-9]|-)+=([a-z0-9]|-)+)+(;([a-z0-9]|-)+=([a-z0-9]|-)+(,([a-z0-9]|-)+=([a-z0-9]|-)+)+)*$", $admins)) {
echo ("" . _("List of admin users is empty or invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$suffusers || !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffusers)) {
echo ("" . _("UserSuffix is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$suffgroups || !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffgroups)) {
echo ("" . _("UserSuffix is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$suffhosts || !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffhosts)) {
echo ("" . _("HostSuffix is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (($samba3 == "yes") && !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffdomains)) {
echo ("" . _("DomainSuffix is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!isset($minUID) || !is_numeric($minUID)) {
echo ("" . _("MinUID is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$maxUID || !is_numeric($maxUID)) {
echo ("" . _("MaxUID is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!isset($minGID) || !is_numeric($minGID)) {
echo ("" . _("MinGID is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$maxGID || !is_numeric($maxGID)) {
echo ("" . _("MaxGID is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!isset($minMach) || !is_numeric($minMach)) {
echo ("" . _("MinMachine is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$maxMach || !is_numeric($maxMach)) {
echo ("" . _("MaxMachine is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$usrlstattr || !eregi("^((#[a-z]*)|([a-z]*:[a-z*]))(;((#[a-z]*)|([a-z]*:[a-z]*)))*$", $usrlstattr)) {
echo ("" . _("User list attributes are invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$grplstattr || !eregi("^((#[a-z]*)|([a-z]*:[a-z*]))(;((#[a-z]*)|([a-z]*:[a-z]*)))*$", $grplstattr)) {
echo ("" . _("Group list attributes are invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$hstlstattr || !eregi("^((#[a-z]*)|([a-z]*:[a-z*]))(;((#[a-z]*)|([a-z]*:[a-z]*)))*$", $hstlstattr)) {
echo ("" . _("Host list attributes are invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$maxlistentries || !is_numeric($maxlistentries)) {
echo ("" . _("Max list entries is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$lang) {
echo ("" . _("Language is not defined!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if (!$samba3) {
echo ("" . _("Samba version is not defined!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if ($scriptpath && !eregi("^/[a-z0-9_\\-]+(/[a-z0-9_\\.\\-]+)+$", $scriptpath)) {
echo ("" . _("Script path is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
if ($scriptserver && !is_string($scriptserver)) {
echo ("" . _("Script server is invalid!") . "");
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
// set new preferences
$conf->set_ServerURL($serverurl);
$conf->set_cacheTimeout($cachetimeout);
$conf->set_Adminstring($admins);
$conf->set_UserSuffix($suffusers);
$conf->set_GroupSuffix($suffgroups);
$conf->set_HostSuffix($suffhosts);
$conf->set_DomainSuffix($suffdomains);
$conf->set_minUID($minUID);
$conf->set_maxUID($maxUID);
$conf->set_minGID($minGID);
$conf->set_maxGID($maxGID);
$conf->set_minMachine($minMach);
$conf->set_maxMachine($maxMach);
$conf->set_userlistAttributes($usrlstattr);
$conf->set_grouplistAttributes($grplstattr);
$conf->set_hostlistAttributes($hstlstattr);
$conf->set_MaxListEntries($maxlistentries);
$conf->set_defaultLanguage($lang);
$conf->set_samba3($samba3);
$conf->set_scriptpath($scriptpath);
$conf->set_scriptserver($scriptserver);
// check if password was changed
if ($passwd1) {
if ($passwd1 != $passwd2) {
echo ("" . _("Passwords are different!") . "");
exit;
}
// set new password
if ($passwd1 != "") {
$conf->set_Passwd($passwd1);
echo ("" . _("Password changed!") . "
");
}
}
// save settings and display new settings
$conf->save();
echo ("" . _("The following settings were saved to profile:") . " " . $filename . "
");
$conf->printconf();
echo ("
" . _("Back to Login") . "");
echo("");
// remove settings from session
unset($_SESSION['conf_passwd']);
unset($_SESSION['conf_passwd1']);
unset($_SESSION['conf_passwd2']);
unset($_SESSION['conf_serverurl']);
unset($_SESSION['conf_cachetimeout']);
unset($_SESSION['conf_admins']);
unset($_SESSION['conf_suffusers']);
unset($_SESSION['conf_suffgroups']);
unset($_SESSION['conf_suffhosts']);
unset($_SESSION['conf_suffdomains']);
unset($_SESSION['conf_minUID']);
unset($_SESSION['conf_maxUID']);
unset($_SESSION['conf_minGID']);
unset($_SESSION['conf_maxGID']);
unset($_SESSION['conf_minMach']);
unset($_SESSION['conf_maxMach']);
unset($_SESSION['conf_usrlstattr']);
unset($_SESSION['conf_grplstattr']);
unset($_SESSION['conf_hstlstattr']);
unset($_SESSION['conf_maxlistentries']);
unset($_SESSION['conf_lang']);
unset($_SESSION['conf_scriptpath']);
unset($_SESSION['conf_scriptserver']);
unset($_SESSION['conf_samba3']);
unset($_SESSION['conf_filename']);
?>