added default language

This commit is contained in:
Roland Gruber 2003-05-09 16:22:46 +00:00
parent e2fabce4e3
commit f643f10ee0
6 changed files with 319 additions and 81 deletions

View File

@ -61,3 +61,6 @@ hostlistAttributes: #cn;#rid;#description;gidNumber:GID
# maximum number of rows to show in user/group/host lists # maximum number of rows to show in user/group/host lists
maxlistentries: 30 maxlistentries: 30
# default language (a line from language.conf)
defaultLanguage: de_DE:iso639_de:Deutsch (Deutschland)

View File

@ -24,7 +24,7 @@ $Id$
*/ */
// sets language settings for i18n // sets language settings for automatic translation
function setlanguage() { function setlanguage() {
if ($_SESSION['language']) { if ($_SESSION['language']) {
$language = explode(":", $_SESSION['language']); $language = explode(":", $_SESSION['language']);
@ -77,6 +77,9 @@ class Config {
// maximum number of rows shown in user/group/host list // maximum number of rows shown in user/group/host list
var $maxlistentries; var $maxlistentries;
// default language
var $defaultLanguage;
// constructor, loads preferences from ../config/lam.conf // constructor, loads preferences from ../config/lam.conf
function Config() { function Config() {
$this->reload(); $this->reload();
@ -157,6 +160,10 @@ class Config {
$this->maxlistentries = chop(substr($line, 16, strlen($line)-16)); $this->maxlistentries = chop(substr($line, 16, strlen($line)-16));
continue; continue;
} }
if (substr($line, 0, 17) == "defaultLanguage: ") {
$this->defaultLanguage = chop(substr($line, 17, strlen($line)-17));
continue;
}
} }
fclose($file); fclose($file);
} }
@ -179,7 +186,7 @@ class Config {
// booleans to check if value was already saved // booleans to check if value was already saved
$save_serverURL = $save_passwd = $save_admins = $save_suffusr = $save_suffgrp = $save_suffhst = $save_serverURL = $save_passwd = $save_admins = $save_suffusr = $save_suffgrp = $save_suffhst =
$save_minUID = $save_maxUID = $save_minGID = $save_maxGID = $save_minMach = $save_maxMach = $save_minUID = $save_maxUID = $save_minGID = $save_maxGID = $save_minMach = $save_maxMach =
$save_usrlstatrr = $save_grplstatrr = $save_hstlstatrr = $maxlstent = False; $save_usrlstatrr = $save_grplstatrr = $save_hstlstatrr = $save_maxlstent = $save_deflang = False;
$file = fopen($conffile, "r"); $file = fopen($conffile, "r");
$file_array = array(); $file_array = array();
while (!feof($file)) { while (!feof($file)) {
@ -269,6 +276,11 @@ class Config {
$save_maxlstent = True; $save_maxlstent = True;
continue; continue;
} }
if (substr($file_array[$i], 0, 17) == "defaultLanguage: ") {
$file_array[$i] = "defaultLanguage: " . $this->defaultLanguage . "\n";
$save_deflang = True;
continue;
}
} }
// check if we have to add new entries (e.g. if user upgraded LAM and has an old lam.conf) // check if we have to add new entries (e.g. if user upgraded LAM and has an old lam.conf)
if (!$save_serverURL == True) array_push($file_array, "\n\n# server address (e.g. ldap://localhost:389 or ldaps://localhost:636)\n" . "serverURL: " . $this->ServerURL); if (!$save_serverURL == True) array_push($file_array, "\n\n# server address (e.g. ldap://localhost:389 or ldaps://localhost:636)\n" . "serverURL: " . $this->ServerURL);
@ -295,6 +307,7 @@ class Config {
if (!$save_hstlstattr == True) array_push($file_array, "\n\n# list of attributes to show in host list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" . if (!$save_hstlstattr == True) array_push($file_array, "\n\n# list of attributes to show in host list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
"\n# or individual ones (e.g. 'cn:Host Name')\n# values have to be seperated by semicolons\n" . "hostlistAttributes: " . $this->hostlistAttributes); "\n# or individual ones (e.g. 'cn:Host Name')\n# values have to be seperated by semicolons\n" . "hostlistAttributes: " . $this->hostlistAttributes);
if (!$save_maxlstent == True) array_push($file_array, "\n\n# maximum number of rows to show in user/group/host lists\n" . "maxlistentries: " . $this->maxlistentries); if (!$save_maxlstent == True) array_push($file_array, "\n\n# maximum number of rows to show in user/group/host lists\n" . "maxlistentries: " . $this->maxlistentries);
if (!$save_deflang == True) array_push($file_array, "\n\n# default language (a line from language.conf)\n" . "defaultLanguage: " . $this->defaultLanguage);
$file = fopen($conffile, "w"); $file = fopen($conffile, "w");
if ($file) { if ($file) {
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]);
@ -323,7 +336,8 @@ class Config {
echo _("<b>userlistAttributes: </b>") . $this->userlistAttributes . "<br>"; echo _("<b>userlistAttributes: </b>") . $this->userlistAttributes . "<br>";
echo _("<b>grouplistAttributes: </b>") . $this->grouplistAttributes . "<br>"; echo _("<b>grouplistAttributes: </b>") . $this->grouplistAttributes . "<br>";
echo _("<b>hostlistAttributes: </b>") . $this->hostlistAttributes . "<br>"; echo _("<b>hostlistAttributes: </b>") . $this->hostlistAttributes . "<br>";
echo _("<b>maxlistentries: </b>") . $this->maxlistentries; echo _("<b>maxlistentries: </b>") . $this->maxlistentries . "<br>";
echo _("<b>defaultLanguage: </b>") . $this->defaultLanguage;
} }
// functions to read/write preferences // functions to read/write preferences
@ -535,7 +549,18 @@ class Config {
*/ */
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!"); else echo _("Config->set_MaxListEntries failed!" . $value);
}
// returns the default language string
function get_defaultLanguage() {
return $this->defaultLanguage;
}
// sets the default language string
function set_defaultLanguage($value) {
if (is_string($value)) $this->defaultLanguage = $value;
else echo _("Config->set_defaultLanguage failed!");
} }

View File

@ -37,7 +37,10 @@ session_start();
</title> </title>
</head> </head>
<body> <body>
<p align="center"><a href="http://lam.sf.net" target="new_window"><img src="../../graphics/banner.jpg" border=1></a></p><hr><br><br> <p align="center"><a href="http://lam.sf.net" target="new_window">
<img src="../../graphics/banner.jpg" border=1></a>
</p>
<hr><br><br>
<b><p align="center"> <? echo _("Password to enter preferences:"); ?> </b></p> <b><p align="center"> <? echo _("Password to enter preferences:"); ?> </b></p>
<form action="confmain.php" method="post"> <form action="confmain.php" method="post">
<p align="center"><input type="password" name="passwd"> <p align="center"><input type="password" name="passwd">

View File

@ -28,6 +28,43 @@ $Id$
session_save_path("../../sess"); session_save_path("../../sess");
session_start(); session_start();
// check if button was pressed and if we have to save the setting or go back to login
if ($_POST['back'] || $_POST['submitconf']){
// save settings
if ($_POST['submitconf']){
// save HTTP-POST variables in session
// get data if register_globals is off
if ($_POST['passwd']) $passwd = $_POST['passwd'];
if ($_POST['passwd1']) $passwd1 = $_POST['passwd1'];
if ($_POST['passwd2']) $passwd2 = $_POST['passwd2'];
if ($_POST['serverurl']) $serverurl = $_POST['serverurl'];
if ($_POST['admins']) $admins = $_POST['admins'];
if ($_POST['suffusers']) $suffusers = $_POST['suffusers'];
if ($_POST['suffgroups']) $suffgroups = $_POST['suffgroups'];
if ($_POST['suffhosts']) $suffhosts = $_POST['suffhosts'];
if ($_POST['minUID']) $minUID = $_POST['minUID'];
if ($_POST['maxUID']) $maxUID = $_POST['maxUID'];
if ($_POST['minGID']) $minGID = $_POST['minGID'];
if ($_POST['maxGID']) $maxGID = $_POST['maxGID'];
if ($_POST['minMach']) $minMach = $_POST['minMach'];
if ($_POST['maxMach']) $maxMach = $_POST['maxMach'];
if ($_POST['usrlstattr']) $usrlstattr = $_POST['usrlstattr'];
if ($_POST['grplstattr']) $grplstattr = $_POST['grplstattr'];
if ($_POST['hstlstattr']) $hstlstattr = $_POST['hstlstattr'];
if ($_POST['maxlistentries']) $maxlistentries = $_POST['maxlistentries'];
if ($_POST['language']) $language = $_POST['language'];
session_register('passwd', 'passwd1', 'passwd2', 'serverurl', 'admins', 'suffusers',
'suffgroups', 'suffhosts', 'minUID', 'maxUID', 'minGID', 'maxGID', 'minMach',
'maxMach', 'usrlstattr', 'grplstattr', 'hstlstattr', 'maxlistentries', 'language');
echo("<meta http-equiv=\"refresh\" content=\"0; URL=confsave.php\">");
}
// back to login
else if ($_POST['back']){
echo("<meta http-equiv=\"refresh\" content=\"0; URL=../login.php\">");
}
exit;
}
// get password if register_globals is off // get password if register_globals is off
if ($_POST['passwd']) $passwd = $_POST['passwd']; if ($_POST['passwd']) $passwd = $_POST['passwd'];
@ -53,72 +90,214 @@ echo ("<title>" . _("LDAP Account Manager Configuration") . "</title>\n");
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n"; echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
echo ("</head>\n"); echo ("</head>\n");
echo ("<body>\n"); echo ("<body>\n");
echo ("<p align=\"center\"><a href=\"http://lam.sf.net\" target=\"new_window\"><img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p><hr><br><br>\n"); echo ("<p align=\"center\"><a href=\"http://lam.sf.net\" target=\"new_window\">".
echo ("<form action=\"confsave.php\" method=\"post\">\n"); "<img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p><hr><br><br>\n");
// display formular
echo ("<form action=\"confmain.php\" method=\"post\">\n");
echo ("<fieldset><legend><b>" . _("Server settings") . "</b></legend>"); echo ("<fieldset><legend><b>" . _("Server settings") . "</b></legend>");
echo ("<table align=\"center\" border=\"0\">"); echo ("<table align=\"center\" border=\"0\">");
echo ("<tr><td width=\"20%\"><p align=\"right\"><b>" . _("Server Address") . ": </b></p></td> <td width=\"30%\"><p align=\"left\"><input size=50 type=\"text\" name=\"serverurl\" value=\"" . $conf->get_ServerURL() . "\"></td>\n"); // serverURL
echo ("<td width=\"50%\"><p align=\"left\">" . _("Server Address of LDAP server (e.g. ldap://localhost:389 or ldaps://localhost:636)") . "</p></td></tr>\n"); echo ("<tr><td width=\"20%\"><p align=\"right\"><b>" . _("Server Address") . ": </b></p></td>".
"<td width=\"30%\"><p align=\"left\">".
"<input size=50 type=\"text\" name=\"serverurl\" value=\"" . $conf->get_ServerURL() . "\">".
"</td>\n");
echo ("<td width=\"50%\"><p align=\"left\">".
_("Server Address of LDAP server (e.g. ldap://localhost:389 or ldaps://localhost:636)").
"</p></td></tr>\n");
// new line
echo ("<tr><td>&nbsp</td></tr>"); echo ("<tr><td>&nbsp</td></tr>");
echo ("<tr><td><p align=\"right\"><b>" . _("UserSuffix") . ": </b></p></td> <td><input size=50 type=\"text\" name=\"suffusers\" value=\"" . $conf->get_UserSuffix() . "\"></td>\n");
echo ("<td><p align=\"left\">" . _("This is the suffix from where to search for users.<br>(e.g. ou=People,dc=yourcompany,dc=com)") . "</p></td></tr>\n"); // user suffix
echo ("<tr><td><p align=\"right\"><b>" . _("GroupSuffix") . ": </b></p></td> <td><input size=50 type=\"text\" name=\"suffgroups\" value=\"" . $conf->get_GroupSuffix() . "\"></td>\n"); echo ("<tr><td><p align=\"right\"><b>".
echo ("<td><p align=\"left\">" . _("This is the suffix from where to search for groups.<br>(e.g. ou=group,dc=yourcompany,dc=com)") . "</p></td></tr>\n"); _("UserSuffix") . ": </b></p></td>".
echo ("<tr><td><p align=\"right\"><b>" . _("HostSuffix") . ": </b></p></td> <td><input size=50 type=\"text\" name=\"suffhosts\" value=\"" . $conf->get_HostSuffix() . "\"></td>\n"); "<td><input size=50 type=\"text\" name=\"suffusers\" value=\"" . $conf->get_UserSuffix() . "\"></td>\n");
echo ("<td><p align=\"left\">" . _("This is the suffix from where to search for Samba hosts.<br>(e.g. ou=machines,dc=yourcompany,dc=com)") . "</p></td></tr>\n"); echo ("<td><p align=\"left\">".
_("This is the suffix from where to search for users.<br>(e.g. ou=People,dc=yourcompany,dc=com)").
"</p></td></tr>\n");
// group suffix
echo ("<tr><td><p align=\"right\"><b>".
_("GroupSuffix") . ": </b></p></td>".
"<td><input size=50 type=\"text\" name=\"suffgroups\" value=\"" . $conf->get_GroupSuffix() . "\"></td>\n");
echo ("<td><p align=\"left\">".
_("This is the suffix from where to search for groups.<br>(e.g. ou=group,dc=yourcompany,dc=com)").
"</p></td></tr>\n");
// host suffix
echo ("<tr><td><p align=\"right\"><b>".
_("HostSuffix") . ": </b></p></td>".
"<td><input size=50 type=\"text\" name=\"suffhosts\" value=\"" . $conf->get_HostSuffix() . "\"></td>\n");
echo ("<td><p align=\"left\">".
_("This is the suffix from where to search for Samba hosts.<br>(e.g. ou=machines,dc=yourcompany,dc=com)").
"</p></td></tr>\n");
echo ("</table>"); echo ("</table>");
echo ("</fieldset>"); echo ("</fieldset>");
echo ("<br />"); echo ("<br>");
echo ("<fieldset><legend><b>" . _("Ranges") . "</b></legend>"); echo ("<fieldset><legend><b>" . _("Ranges") . "</b></legend>");
echo ("<table align=\"center\" border=\"0\">"); echo ("<table align=\"center\" border=\"0\">");
echo ("<tr><td>&nbsp</td></tr>");
echo ("<tr><td align=\"right\"><b>" . _("Minimum UID number") . ": </b></td> <td align=\"left\"><input size=6 type=\"text\" name=\"minUID\" value=\"" . $conf->get_minUID() . "\">\n"); // minUID
echo ("&nbsp <b>" . _("Maximum UID number") . ": </b><input size=6 type=\"text\" name=\"maxUID\" value=\"" . $conf->get_maxUID() . "\"></td>\n"); echo ("<tr><td align=\"right\"><b>".
echo ("<td><p align=\"left\">" . _("These are the minimum and maximum numbers to use for user IDs") . "</p></td></tr>\n"); _("Minimum UID number") . ": </b></td>".
echo ("<tr><td align=\"right\"><b>" . _("Minimum GID number") . ": </b></td> <td align=\"left\"><input size=6 type=\"text\" name=\"minGID\" value=\"" . $conf->get_minGID() . "\">\n"); "<td align=\"left\"><input size=6 type=\"text\" name=\"minUID\" value=\"" . $conf->get_minUID() . "\">\n");
echo ("&nbsp <b>" . _("Maximum GID number") . ": </b><input size=6 type=\"text\" name=\"maxGID\" value=\"" . $conf->get_maxGID() . "\"></td>\n"); // maxUID
echo ("<td><p align=\"left\">" . _("These are the minimum and maximum numbers to use for group IDs") . "</p></td></tr>\n"); echo ("&nbsp <b>" . _("Maximum UID number") . ": </b>".
echo ("<tr><td align=\"right\"><b>" . _("Minimum Machine number") . ": </b></td> <td align=\"left\"><input size=6 type=\"text\" name=\"minMach\" value=\"" . $conf->get_minMachine() . "\">\n"); "<input size=6 type=\"text\" name=\"maxUID\" value=\"" . $conf->get_maxUID() . "\"></td>\n");
echo ("&nbsp <b>" . _("Maximum Machine number") . ": </b><input size=6 type=\"text\" name=\"maxMach\" value=\"" . $conf->get_maxMachine() . "\"></td>\n"); // UID text
echo ("<td><p align=\"left\">" . _("These are the minimum and maximum numbers to use for Samba hosts. <br> Do not use the same range as for user IDs.") . "</p></td></tr>\n"); echo ("<td><p align=\"left\">".
_("These are the minimum and maximum numbers to use for user IDs").
"</p></td></tr>\n");
// minGID
echo ("<tr><td align=\"right\"><b>".
_("Minimum GID number") . ": </b></td>".
"<td align=\"left\"><input size=6 type=\"text\" name=\"minGID\" value=\"" . $conf->get_minGID() . "\">\n");
// maxGID
echo ("&nbsp <b>" . _("Maximum GID number").": </b>".
"<input size=6 type=\"text\" name=\"maxGID\" value=\"" . $conf->get_maxGID() . "\"></td>\n");
// GID text
echo ("<td><p align=\"left\">".
_("These are the minimum and maximum numbers to use for group IDs").
"</p></td></tr>\n");
// minMach
echo ("<tr><td align=\"right\"><b>".
_("Minimum Machine number") . ": </b></td>".
"<td align=\"left\"><input size=6 type=\"text\" name=\"minMach\" value=\"" . $conf->get_minMachine() . "\">\n");
// maxMach
echo ("&nbsp <b>" . _("Maximum Machine number") . ": </b>".
"<input size=6 type=\"text\" name=\"maxMach\" value=\"" . $conf->get_maxMachine() . "\"></td>\n");
// Machine text
echo ("<td><p align=\"left\">".
_("These are the minimum and maximum numbers to use for Samba hosts. <br> Do not use the same range as for user IDs.") . "</p></td></tr>\n");
echo ("</table>"); echo ("</table>");
echo ("</fieldset>"); echo ("</fieldset>");
echo ("<br />"); echo ("<br>");
echo ("<fieldset><legend><b>" . _("LDAP List settings") . "</b></legend>"); echo ("<fieldset><legend><b>" . _("LDAP List settings") . "</b></legend>");
echo ("<table align=\"center\" border=\"0\">"); echo ("<table align=\"center\" border=\"0\">");
echo ("<tr><td>&nbsp</td></tr>");
echo ("<tr><td><p align=\"right\"><b>" . _("Attributes in User List:") . "</b></p></td><td><input size=50 type=\"text\" name=\"usrlstattr\" value=\"" . $conf->get_userlistAttributes() . "\"></td>"); // user list attributes
echo ("<td rowspan=3><p>" . _("This is the list of attributes to show in the lists. The entries can either be predefined values (e.g. '#cn' or '#gidNumber') or individual ones (e.g. 'cn:Group Name'). The entries are seperated by semicolons.") echo ("<tr><td><p align=\"right\"><b>".
. "</p></td></tr>"); _("Attributes in User List:") . "</b></p></td>".
echo ("<tr><td><p align=\"right\"><b>" . _("Attributes in Group List:") . "</b></p></td><td><input size=50 type=\"text\" name=\"grplstattr\" value=\"" . $conf->get_grouplistAttributes() . "\"></td></tr>"); "<td><input size=50 type=\"text\" name=\"usrlstattr\" value=\"" . $conf->get_userlistAttributes() . "\"></td>");
echo ("<tr><td><p align=\"right\"><b>" . _("Attributes in Host List:") . "</b></p></td><td><input size=50 type=\"text\" name=\"hstlstattr\" value=\"" . $conf->get_hostlistAttributes() . "\"></td></tr>"); // list attributes description
echo ("<td rowspan=3><p>".
_("This is the list of attributes to show in the lists. The entries can either be predefined values".
" (e.g. '#cn' or '#gidNumber') or individual ones (e.g. 'cn:Group Name'). The entries are seperated by semicolons.").
"</p></td></tr>");
// user list attributes
echo ("<tr><td><p align=\"right\"><b>".
_("Attributes in Group List:") . "</b></p></td>".
"<td><input size=50 type=\"text\" name=\"grplstattr\" value=\"" . $conf->get_grouplistAttributes() . "\"></td></tr>");
// user list attributes
echo ("<tr><td><p align=\"right\"><b>".
_("Attributes in Host List:") . "</b></p></td>".
"<td><input size=50 type=\"text\" name=\"hstlstattr\" value=\"" . $conf->get_hostlistAttributes() . "\"></td></tr>");
// two new lines
echo ("<tr><td>&nbsp</td></tr>"); echo ("<tr><td>&nbsp</td></tr>");
echo ("<tr><td>&nbsp</td></tr>"); echo ("<tr><td>&nbsp</td></tr>");
echo ("<tr><td><p align=\"right\"><b>" . _("List of valid users") . ": </b></p></td> <td><input size=50 type=\"text\" name=\"admins\" value=\"" . $conf->get_Adminstring() . "\"></td>\n"); // admin list
echo ("<td><p align=\"left\">" . _("Usernames must be seperated by semicolons<br>(e.g. cn=admin,dc=yourcompany,dc=com;uid=root,ou=people,dc=yourcompany,dc=com)") . "</p></td></tr>\n"); echo ("<tr><td><p align=\"right\"><b>".
echo ("<tr><td><p align=\"right\"><b>" . _("Maximum displayed entries") . ": </b></p></td> <td><input size=50 type=\"text\" name=\"maxlistentries\" value=\"" . $conf->get_MaxListEntries() . "\"></td>\n"); _("List of valid users") . ": </b></p></td>".
echo ("<td><p align=\"left\">" . _("This is the maximum count of entries which are displayed on one page of the user/host/group lists.") . "</p></td></tr>\n"); "<td><input size=50 type=\"text\" name=\"admins\" value=\"" . $conf->get_Adminstring() . "\"></td>\n");
// admin list description
echo ("<td><p align=\"left\">".
_("Usernames must be seperated by semicolons")."<br>".
_("(e.g. cn=admin,dc=yourcompany,dc=com;uid=root,ou=people,dc=yourcompany,dc=com)").
"</p></td></tr>\n");
// maximum list entries
echo ("<tr><td><p align=\"right\"><b>".
_("Maximum displayed entries") . ": </b></p></td>".
"<td><select name=\"maxlistentries\">".
"<option>".$conf->get_MaxListEntries()."</option>".
"<option>10</option>".
"<option>20</option>".
"<option>30</option>".
"<option>50</option>".
"<option>75</option>".
"<option>100</option>".
"</select></td>\n");
// maximum list entries description
echo ("<td><p align=\"left\">".
_("This is the maximum count of entries which are displayed on one page of the user/host/group lists.").
"</p></td></tr>\n");
echo ("</table>"); echo ("</table>");
echo ("</fieldset>"); echo ("</fieldset>");
echo ("<br />"); echo ("<br>");
echo ("<fieldset><legend><b>" . _("Language settings") . "</b></legend>");
echo ("<table align=\"left\" border=\"0\">");
// language
echo ("<tr><td>");
// read available languages
$languagefile = "../../config/language.conf";
if(is_file($languagefile))
{
$file = fopen($languagefile, "r");
$i = 0;
while(!feof($file))
{
$line = fgets($file, 1024);
if($line == "\n" || $line[0] == "#") continue; // ignore comment and empty lines
$languages[$i] = $line;
$i++;
}
fclose($file);
// generate language list
echo ("<select name=\"language\">");
for ($i = 0; $i < sizeof($languages); $i++) {
$entry = explode(":", $languages[$i]);
echo ("<option value=\"" . $languages[$i] . "\">" . $entry[2] . "</option>");
}
echo ("</select>");
}
else
{
echo _("Unable to load available languages. For further instructions please contact the Admin of this site.");
}
echo ("</td></tr>");
echo ("</table>\n");
echo ("</fieldset>");
echo ("<br>");
echo ("<fieldset><legend><b>" . _("Security settings") . "</b></legend>"); echo ("<fieldset><legend><b>" . _("Security settings") . "</b></legend>");
echo ("<table align=\"left\" border=\"0\">"); echo ("<table align=\"left\" border=\"0\">");
echo ("<tr><td bgcolor=\"red\" align=\"right\"><b>" . _("New Password") . ": </b></td> <td bgcolor=\"red\" align=\"left\"><input type=\"password\" name=\"pass1\"></td></tr>"); // new password
echo ("<tr><td bgcolor=\"red\" align=\"right\"><b>" . _("Reenter Password") . ": </b></td> <td bgcolor=\"red\" align=\"left\"><input type=\"password\" name=\"pass2\"></td></tr>\n"); echo ("<tr><td bgcolor=\"red\" align=\"right\"><b>".
_("New Password") . ": </b></td>".
"<td bgcolor=\"red\" align=\"left\"><input type=\"password\" name=\"pass1\"></td></tr>");
// reenter password
echo ("<tr><td bgcolor=\"red\" align=\"right\"><b>".
_("Reenter Password") . ": </b></td>".
"<td bgcolor=\"red\" align=\"left\"><input type=\"password\" name=\"pass2\"></td></tr>\n");
echo ("</table>\n"); echo ("</table>\n");
echo ("</fieldset>"); echo ("</fieldset>");
echo ("<br />"); echo ("<br>");
// buttons
echo ("<table align=\"left\" border=\"0\">"); echo ("<table align=\"left\" border=\"0\">");
echo ("<tr><td align=\"left\"><pre><input type=\"submit\" name=\"submitconf\" value=\"" . _("Submit") . "\"> <input type=\"reset\" name=\"resetconf\" value=\"" . _("Reset") . "\">");
echo ("<input type=\"button\" name=\"back\" value=\"" . _("Abort") . "\" onClick=\"self.location.href='../login.php'\"></pre></td></tr>\n"); echo ("<tr><td align=\"left\"><pre>".
"<input type=\"submit\" name=\"submitconf\" value=\"" . _("Submit") . "\">".
"<input type=\"reset\" name=\"resetconf\" value=\"" . _("Reset") . "\">".
"<input type=\"submit\" name=\"back\" value=\"" . _("Abort") . "\"");
echo ("></pre></td></tr>\n");
echo ("</table>\n"); echo ("</table>\n");
// password for configuration
echo ("<input type=\"hidden\" name=\"passwd\" value=\"" . $passwd . "\"><br>\n"); echo ("<input type=\"hidden\" name=\"passwd\" value=\"" . $passwd . "\"><br>\n");
echo ("</form>\n"); echo ("</form>\n");
echo ("</body>\n"); echo ("</body>\n");
echo ("</html>\n"); echo ("</html>\n");

View File

@ -32,24 +32,25 @@ include_once ('../../lib/config.inc');
$conf = new Config(); $conf = new Config();
// get data if register_globals is off // get data if register_globals is off
if ($_POST['passwd']) $passwd = $_POST['passwd']; if ($_SESSION['passwd']) $passwd = $_SESSION['passwd'];
if ($_POST['passwd1']) $passwd1 = $_POST['passwd1']; if ($_SESSION['passwd1']) $passwd1 = $_SESSION['passwd1'];
if ($_POST['passwd2']) $passwd2 = $_POST['passwd2']; if ($_SESSION['passwd2']) $passwd2 = $_SESSION['passwd2'];
if ($_POST['serverurl']) $serverurl = $_POST['serverurl']; if ($_SESSION['serverurl']) $serverurl = $_SESSION['serverurl'];
if ($_POST['admins']) $admins = $_POST['admins']; if ($_SESSION['admins']) $admins = $_SESSION['admins'];
if ($_POST['suffusers']) $suffusers = $_POST['suffusers']; if ($_SESSION['suffusers']) $suffusers = $_SESSION['suffusers'];
if ($_POST['suffgroups']) $suffgroups = $_POST['suffgroups']; if ($_SESSION['suffgroups']) $suffgroups = $_SESSION['suffgroups'];
if ($_POST['suffhosts']) $suffhosts = $_POST['suffhosts']; if ($_SESSION['suffhosts']) $suffhosts = $_SESSION['suffhosts'];
if ($_POST['minUID']) $minUID = $_POST['minUID']; if ($_SESSION['minUID']) $minUID = $_SESSION['minUID'];
if ($_POST['maxUID']) $maxUID = $_POST['maxUID']; if ($_SESSION['maxUID']) $maxUID = $_SESSION['maxUID'];
if ($_POST['minGID']) $minGID = $_POST['minGID']; if ($_SESSION['minGID']) $minGID = $_SESSION['minGID'];
if ($_POST['maxGID']) $maxGID = $_POST['maxGID']; if ($_SESSION['maxGID']) $maxGID = $_SESSION['maxGID'];
if ($_POST['minMach']) $minMach = $_POST['minMach']; if ($_SESSION['minMach']) $minMach = $_SESSION['minMach'];
if ($_POST['maxMach']) $maxMach = $_POST['maxMach']; if ($_SESSION['maxMach']) $maxMach = $_SESSION['maxMach'];
if ($_POST['usrlstattr']) $usrlstattr = $_POST['usrlstattr']; if ($_SESSION['usrlstattr']) $usrlstattr = $_SESSION['usrlstattr'];
if ($_POST['grplstattr']) $grplstattr = $_POST['grplstattr']; if ($_SESSION['grplstattr']) $grplstattr = $_SESSION['grplstattr'];
if ($_POST['hstlstattr']) $hstlstattr = $_POST['hstlstattr']; if ($_SESSION['hstlstattr']) $hstlstattr = $_SESSION['hstlstattr'];
if ($_POST['maxlistentries']) $maxlistentries = $_POST['maxlistentries']; if ($_SESSION['maxlistentries']) $maxlistentries = $_SESSION['maxlistentries'];
if ($_SESSION['language']) $language = $_SESSION['language'];
// check if password is correct // check if password is correct
// if not: load login page // if not: load login page
@ -58,7 +59,8 @@ if ($passwd != $conf->get_Passwd()) {
exit; exit;
} }
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>"); 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>");
// check new preferences // check new preferences
if (chop($serverurl) == "") { if (chop($serverurl) == "") {
@ -153,6 +155,9 @@ $conf->set_userlistAttributes($usrlstattr);
$conf->set_grouplistAttributes($grplstattr); $conf->set_grouplistAttributes($grplstattr);
$conf->set_hostlistAttributes($hstlstattr); $conf->set_hostlistAttributes($hstlstattr);
$conf->set_MaxListEntries($maxlistentries); $conf->set_MaxListEntries($maxlistentries);
$conf->set_defaultLanguage($language);
// check if password was changed // check if password was changed
if ($pass1 != $pass2) { if ($pass1 != $pass2) {
@ -169,5 +174,24 @@ $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>");
// remove settings from session
unset($_SESSION['passwd']);
unset($_SESSION['passwd1']);
unset($_SESSION['passwd2']);
unset($_SESSION['serverurl']);
unset($_SESSION['admins']);
unset($_SESSION['suffusers']);
unset($_SESSION['suffgroups']);
unset($_SESSION['suffhosts']);
unset($_SESSION['minUID']);
unset($_SESSION['maxUID']);
unset($_SESSION['minGID']);
unset($_SESSION['maxGID']);
unset($_SESSION['minMach']);
unset($_SESSION['maxMach']);
unset($_SESSION['usrlstattr']);
unset($_SESSION['grplstattr']);
unset($_SESSION['hstlstattr']);
unset($_SESSION['maxlistentries']);
unset($_SESSION['language']);
?> ?>

View File

@ -47,6 +47,7 @@ $userlistAttributes = $conf->get_userlistAttributes();
$grouplistAttributes = $conf->get_grouplistAttributes(); $grouplistAttributes = $conf->get_grouplistAttributes();
$hostlistAttributes = $conf->get_hostlistAttributes(); $hostlistAttributes = $conf->get_hostlistAttributes();
$maxlistentries = $conf->get_maxlistentries(); $maxlistentries = $conf->get_maxlistentries();
$defaultlanguage = $conf->get_defaultlanguage();
echo ("done<br>"); echo ("done<br>");
// next we modify them and save lam.conf // next we modify them and save lam.conf
echo ("Changing preferences..."); echo ("Changing preferences...");
@ -67,6 +68,7 @@ $conf->set_userlistAttributes("#uid;#cn");
$conf->set_grouplistAttributes("#gidNumber;#cn;#memberUID"); $conf->set_grouplistAttributes("#gidNumber;#cn;#memberUID");
$conf->set_hostlistAttributes("#cn;#uid;#description"); $conf->set_hostlistAttributes("#cn;#uid;#description");
$conf->set_maxlistentries("54"); $conf->set_maxlistentries("54");
$conf->set_defaultlanguage("de_AT:iso639_de:Deutsch (Oesterreich)");
$conf->save(); $conf->save();
echo ("done<br>"); echo ("done<br>");
// at last all preferences are read from lam.conf and compared // at last all preferences are read from lam.conf and compared
@ -91,6 +93,7 @@ if ($conf->get_userlistAttributes() != "#uid;#cn") echo ("<br><font color=\"#FF0
if ($conf->get_grouplistAttributes() != "#gidNumber;#cn;#memberUID") echo ("<br><font color=\"#FF0000\">Saving grouplistAttributes failed!</font><br>"); if ($conf->get_grouplistAttributes() != "#gidNumber;#cn;#memberUID") echo ("<br><font color=\"#FF0000\">Saving grouplistAttributes failed!</font><br>");
if ($conf->get_hostlistAttributes() != "#cn;#uid;#description") echo ("<br><font color=\"#FF0000\">Saving hostlistAttributes failed!</font><br>"); if ($conf->get_hostlistAttributes() != "#cn;#uid;#description") echo ("<br><font color=\"#FF0000\">Saving hostlistAttributes failed!</font><br>");
if ($conf->get_maxlistentries() != "54") echo ("<br><font color=\"#FF0000\">Saving maxlistentries failed!</font><br>"); if ($conf->get_maxlistentries() != "54") echo ("<br><font color=\"#FF0000\">Saving maxlistentries failed!</font><br>");
if ($conf->get_defaultlanguage() != "de_AT:iso639_de:Deutsch (Oesterreich)") echo ("<br><font color=\"#FF0000\">Saving default language failed!</font><br>");
echo ("done<br>"); echo ("done<br>");
// restore old values // restore old values
echo ("Restoring old preferences..."); echo ("Restoring old preferences...");
@ -111,6 +114,7 @@ $conf->set_userlistAttributes($userlistAttributes);
$conf->set_grouplistAttributes($grouplistAttributes); $conf->set_grouplistAttributes($grouplistAttributes);
$conf->set_hostlistAttributes($hostlistAttributes); $conf->set_hostlistAttributes($hostlistAttributes);
$conf->set_maxlistentries($maxlistentries); $conf->set_maxlistentries($maxlistentries);
$conf->set_defaultLanguage($defaultlanguage);
$conf->save(); $conf->save();
echo ("done<br>"); echo ("done<br>");
// finished // finished