LDAPAccountManager/lam/templates/config/confmain.php

354 lines
14 KiB
PHP
Raw Normal View History

<?php
2003-02-25 21:28:17 +00:00
/*
$Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2003 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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
2003-05-09 16:22:46 +00:00
2003-02-25 21:28:17 +00:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2003-05-09 16:22:46 +00:00
2003-02-25 21:28:17 +00:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2003-05-09 16:22:46 +00:00
2003-02-25 21:28:17 +00:00
*/
include_once ("../../lib/config.inc");
2003-03-23 18:38:47 +00:00
// start session
2003-04-23 19:13:55 +00:00
session_save_path("../../sess");
2003-06-24 15:50:38 +00:00
@session_start();
2003-07-06 17:54:11 +00:00
setlanguage();
2003-05-09 16:22:46 +00:00
// 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']) $_SESSION['passwd'] = $_POST['passwd'];
if ($_POST['passwd1']) $_SESSION['passwd1'] = $_POST['passwd1'];
if ($_POST['passwd2']) $_SESSION['passwd2'] = $_POST['passwd2'];
if ($_POST['serverurl']) $_SESSION['serverurl'] = $_POST['serverurl'];
if ($_POST['admins']) $_SESSION['admins'] = $_POST['admins'];
if ($_POST['suffusers']) $_SESSION['suffusers'] = $_POST['suffusers'];
if ($_POST['suffgroups']) $_SESSION['suffgroups'] = $_POST['suffgroups'];
if ($_POST['suffhosts']) $_SESSION['suffhosts'] = $_POST['suffhosts'];
if ($_POST['suffdomains']) $_SESSION['suffdomains'] = $_POST['suffdomains'];
2003-08-03 11:46:35 +00:00
// if ($_POST['suffmap']) $suffmap = $_POST['suffmap'];
if ($_POST['minUID']) $_SESSION['minUID'] = $_POST['minUID'];
if ($_POST['maxUID']) $_SESSION['maxUID'] = $_POST['maxUID'];
if ($_POST['minGID']) $_SESSION['minGID'] = $_POST['minGID'];
if ($_POST['maxGID']) $_SESSION['maxGID'] = $_POST['maxGID'];
if ($_POST['minMach']) $_SESSION['minMach'] = $_POST['minMach'];
if ($_POST['maxMach']) $_SESSION['maxMach'] = $_POST['maxMach'];
if ($_POST['usrlstattr']) $_SESSION['usrlstattr'] = $_POST['usrlstattr'];
if ($_POST['grplstattr']) $_SESSION['grplstattr'] = $_POST['grplstattr'];
if ($_POST['hstlstattr']) $_SESSION['hstlstattr'] = $_POST['hstlstattr'];
if ($_POST['maxlistentries']) $_SESSION['maxlistentries'] = $_POST['maxlistentries'];
if ($_POST['lang']) $_SESSION['lang'] = $_POST['lang'];
if ($_POST['samba3']) $_SESSION['samba3'] = $_POST['samba3'];
if ($_POST['scriptpath']) $_SESSION['scriptpath'] = $_POST['scriptpath'];
else $_SESSION['scriptpath'] = "";
if ($_POST['scriptserver']) $_SESSION['scriptserver'] = $_POST['scriptserver'];
else $_SESSION['scriptserver'] = "";
if ($_POST['filename']) $_SESSION['filename'] = $_POST['filename'];
2003-05-09 16:22:46 +00:00
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\">");
}
2003-05-09 16:22:46 +00:00
exit;
}
2003-05-02 16:52:19 +00:00
// get password if register_globals is off
if ($_POST['passwd']) $passwd = $_POST['passwd'];
2003-02-25 21:28:17 +00:00
// check if password was entered
2003-03-08 10:10:19 +00:00
// if not: load login page
2003-02-25 21:28:17 +00:00
if (! $passwd) {
2003-06-21 10:25:29 +00:00
$message = _("No password was entered!");
2003-02-25 21:28:17 +00:00
require('conflogin.php');
exit;
}
// check if password is valid
2003-03-08 10:10:19 +00:00
// if not: load login page
2003-04-23 19:13:55 +00:00
include_once ('../../lib/config.inc');
2003-07-06 10:24:41 +00:00
$conf = new Config($_POST['filename']);
2003-02-25 21:28:17 +00:00
if (!(($conf->get_Passwd()) == $passwd)) {
2003-06-21 10:25:29 +00:00
$message = _("The password is invalid! Please try again.");
2003-02-25 21:28:17 +00:00
require('conflogin.php');
exit;
}
2003-07-29 11:52:26 +00:00
echo $_SESSION['header'];
2003-05-28 21:44:41 +00:00
2003-02-25 21:28:17 +00:00
echo ("<html>\n");
echo ("<head>\n");
echo ("<title>" . _("LDAP Account Manager Configuration") . "</title>\n");
2003-06-24 15:50:38 +00:00
echo ("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n");
2003-02-25 21:28:17 +00:00
echo ("</head>\n");
echo ("<body>\n");
2003-05-09 16:22:46 +00:00
echo ("<p align=\"center\"><a href=\"http://lam.sf.net\" target=\"new_window\">".
2003-06-09 10:59:30 +00:00
"<img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p>\n<hr>\n<p></p>\n");
2003-05-09 16:22:46 +00:00
// display formular
echo ("<form action=\"confmain.php\" method=\"post\">\n");
echo ("<fieldset><legend><b>" . _("Server settings") . "</b></legend>");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>");
2003-05-09 16:22:46 +00:00
// serverURL
2003-08-02 09:05:47 +00:00
echo ("<tr><td align=\"right\"><b>" . _("Server address") . " *: </b></td>".
2003-05-28 21:44:41 +00:00
"<td align=\"left\">".
2003-05-09 16:22:46 +00:00
"<input size=50 type=\"text\" name=\"serverurl\" value=\"" . $conf->get_ServerURL() . "\">".
"</td>\n");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=201\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// new line
2003-05-31 23:16:04 +00:00
echo ("<tr><td colspan=3>&nbsp</td></tr>");
2003-05-09 16:22:46 +00:00
// user suffix
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("UserSuffix") . " *: </b></td>".
2003-05-09 16:22:46 +00:00
"<td><input size=50 type=\"text\" name=\"suffusers\" value=\"" . $conf->get_UserSuffix() . "\"></td>\n");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// group suffix
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("GroupSuffix") . " *: </b></td>".
2003-05-09 16:22:46 +00:00
"<td><input size=50 type=\"text\" name=\"suffgroups\" value=\"" . $conf->get_GroupSuffix() . "\"></td>\n");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// host suffix
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("HostSuffix") . " *: </b></td>".
2003-05-09 16:22:46 +00:00
"<td><input size=50 type=\"text\" name=\"suffhosts\" value=\"" . $conf->get_HostSuffix() . "\"></td>\n");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-07-25 15:41:51 +00:00
// domain suffix
echo ("<tr><td align=\"right\"><b>".
_("DomainSuffix") . " **: </b></td>".
"<td><input size=50 type=\"text\" name=\"suffdomains\" value=\"" . $conf->get_DomainSuffix() . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=215\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
// mapping suffix
2003-08-03 11:46:35 +00:00
/*echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("MappingSuffix") . ": </b></td>".
"<td><input size=50 type=\"text\" name=\"suffmap\" value=\"" . $conf->get_MapSuffix() . "\"></td>\n");
2003-08-03 11:46:35 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=216\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");*/
2003-05-09 16:22:46 +00:00
2003-06-19 19:01:00 +00:00
echo ("</table>");
echo ("</fieldset>");
echo ("<p></p>");
echo ("<fieldset><legend><b>" . _("Samba settings") . "</b></legend>");
echo ("<table border=0>");
2003-05-28 15:37:48 +00:00
// Samba version
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
_("Samba 3.x schema") . ": </b></td><td><select name=\"samba3\">\n");
if ($conf->get_samba3() == "yes") echo ("<option>yes</option><option>no</option></select></td>");
else echo ("<option>no</option><option>yes</option></select></td>");
2003-05-28 15:37:48 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=213\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
echo ("</table>");
echo ("</fieldset>");
2003-06-09 10:59:30 +00:00
echo ("<p></p>");
echo ("<fieldset><legend><b>" . _("Ranges") . "</b></legend>");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>");
2003-05-09 16:22:46 +00:00
// minUID
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("Minimum UID number") . " *: </b>".
2003-05-14 21:01:17 +00:00
"<input size=6 type=\"text\" name=\"minUID\" value=\"" . $conf->get_minUID() . "\"></td>\n");
2003-05-09 16:22:46 +00:00
// maxUID
2003-07-25 15:41:51 +00:00
echo ("<td align=\"right\"><b>" . _("Maximum UID number") . " *: </b>".
2003-05-09 16:22:46 +00:00
"<input size=6 type=\"text\" name=\"maxUID\" value=\"" . $conf->get_maxUID() . "\"></td>\n");
// UID text
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=203\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// minGID
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("Minimum GID number") . " *: </b>".
2003-05-14 21:01:17 +00:00
"<input size=6 type=\"text\" name=\"minGID\" value=\"" . $conf->get_minGID() . "\"></td>\n");
2003-05-09 16:22:46 +00:00
// maxGID
2003-07-25 15:41:51 +00:00
echo ("<td align=\"right\"><b>" . _("Maximum GID number")." *: </b>".
2003-05-09 16:22:46 +00:00
"<input size=6 type=\"text\" name=\"maxGID\" value=\"" . $conf->get_maxGID() . "\"></td>\n");
// GID text
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=204\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// minMach
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("Minimum Machine number") . " *: </b>".
2003-05-14 21:01:17 +00:00
"<input size=6 type=\"text\" name=\"minMach\" value=\"" . $conf->get_minMachine() . "\"></td>\n");
2003-05-09 16:22:46 +00:00
// maxMach
2003-07-25 15:41:51 +00:00
echo ("<td align=\"right\"><b>" . _("Maximum Machine number") . " *: </b>".
2003-05-09 16:22:46 +00:00
"<input size=6 type=\"text\" name=\"maxMach\" value=\"" . $conf->get_maxMachine() . "\"></td>\n");
// Machine text
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=205\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
2003-06-08 18:30:14 +00:00
echo ("</table>\n");
echo ("</fieldset>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>\n");
2003-06-08 18:30:14 +00:00
echo ("<fieldset><legend><b>" . _("LDAP List settings") . "</b></legend>\n");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-09 16:22:46 +00:00
// user list attributes
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("Attributes in User List") . " *:</b></td>".
2003-05-09 16:22:46 +00:00
"<td><input size=50 type=\"text\" name=\"usrlstattr\" value=\"" . $conf->get_userlistAttributes() . "\"></td>");
2003-06-08 18:30:14 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// user list attributes
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("Attributes in Group List") . " *:</b></td>".
2003-05-14 21:01:17 +00:00
"<td><input size=50 type=\"text\" name=\"grplstattr\" value=\"" . $conf->get_grouplistAttributes() . "\"></td>");
2003-06-08 18:30:14 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// user list attributes
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("Attributes in Host List") . " *:</b></td>".
2003-05-14 21:01:17 +00:00
"<td><input size=50 type=\"text\" name=\"hstlstattr\" value=\"" . $conf->get_hostlistAttributes() . "\"></td>");
2003-06-08 18:30:14 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-15 18:21:44 +00:00
2003-06-08 18:30:14 +00:00
echo ("<tr><td colspan=3>&nbsp</td></tr>\n");
2003-05-15 18:21:44 +00:00
2003-05-09 16:22:46 +00:00
// maximum list entries
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("Maximum list entries") . " *: </b></td>".
2003-06-08 18:30:14 +00:00
"<td><select name=\"maxlistentries\">\n<option selected>".$conf->get_MaxListEntries()."</option>\n");
if ($conf->get_MaxListEntries() != 10) echo("<option>10</option>\n");
if ($conf->get_MaxListEntries() != 20) echo("<option>20</option>\n");
if ($conf->get_MaxListEntries() != 30) echo("<option>30</option>\n");
if ($conf->get_MaxListEntries() != 50) echo("<option>50</option>\n");
if ($conf->get_MaxListEntries() != 75) echo("<option>75</option>\n");
if ($conf->get_MaxListEntries() != 100) echo("<option>100</option>\n");
echo ("</select></td>\n");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=208\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
echo ("</table>\n");
echo ("</fieldset>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>\n");
2003-05-09 16:22:46 +00:00
echo ("<fieldset><legend><b>" . _("Language settings") . "</b></legend>\n");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-09 16:22:46 +00:00
// language
echo ("<tr>");
2003-08-01 07:44:56 +00:00
echo ("<td><b>" . _("Default language") . ":</b></td><td>\n");
2003-05-09 16:22:46 +00:00
// read available languages
$languagefile = "../../config/language";
2003-05-09 16:22:46 +00:00
if(is_file($languagefile))
{
$file = fopen($languagefile, "r");
$i = 0;
while(!feof($file))
{
$line = fgets($file, 1024);
if($line == "\n" || $line[0] == "#" || $line == "") continue; // ignore comment and empty lines
$languages[$i] = chop($line);
2003-05-09 16:22:46 +00:00
$i++;
}
fclose($file);
// generate language list
2003-07-15 17:30:12 +00:00
echo ("<select name=\"lang\">");
2003-05-09 16:22:46 +00:00
for ($i = 0; $i < sizeof($languages); $i++) {
$entry = explode(":", $languages[$i]);
if ($_SESSION['config']->get_defaultLanguage() != $languages[$i]) echo("<option value=\"" . $languages[$i] . "\">" . $entry[2] . "</option>\n");
else echo("<option selected value=\"" . $languages[$i] . "\">" . $entry[2] . "</option>\n");
2003-05-09 16:22:46 +00:00
}
echo ("</select>\n");
2003-05-09 16:22:46 +00:00
}
else
{
2003-07-30 14:34:33 +00:00
echo _("Unable to load available languages. Setting English as default language. For further instructions please contact the Admin of this site.\n");
2003-05-09 16:22:46 +00:00
}
2003-05-14 21:01:17 +00:00
echo ("</td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=209\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
echo ("</table>\n");
echo ("</fieldset>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>\n");
2003-05-09 16:22:46 +00:00
echo ("<fieldset><legend><b>" . _("Script settings") . "</b></legend>\n");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
// script settings
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
_("Path to external script") . ": </b></td>".
"<td><input size=50 type=\"text\" name=\"scriptpath\" value=\"" . $conf->get_scriptPath() . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=210\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
_("Server of external script") . ": </b></td>".
"<td><input size=50 type=\"text\" name=\"scriptserver\" value=\"" . $conf->get_scriptServer() . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=211\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
echo ("</table>\n");
echo ("</fieldset>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>\n");
2003-06-24 15:50:38 +00:00
// security setings
echo ("<fieldset><legend><b>" . _("Security settings") . "</b></legend>\n");
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-15 18:21:44 +00:00
// admin list
2003-05-28 21:44:41 +00:00
echo ("<tr><td align=\"right\"><b>".
2003-07-25 15:41:51 +00:00
_("List of valid users") . " *: </b></td>".
2003-05-15 18:21:44 +00:00
"<td colspan=2><input size=50 type=\"text\" name=\"admins\" value=\"" . $conf->get_Adminstring() . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=207\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
echo ("</table>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>\n");
2003-05-15 18:21:44 +00:00
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-09 16:22:46 +00:00
// new password
echo ("<tr><td bgcolor=\"red\" align=\"right\"><b>".
_("New Password") . ": </b></td>".
"<td bgcolor=\"red\" align=\"left\"><input type=\"password\" name=\"pass1\"></td>\n");
echo ("<td rowspan=2><a href=\"../help.php?HelpNumber=212\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// 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");
2003-06-08 18:30:14 +00:00
echo ("</fieldset>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>\n");
2003-05-09 16:22:46 +00:00
2003-05-09 16:22:46 +00:00
// buttons
2003-06-09 10:59:30 +00:00
echo ("<table border=0>\n");
2003-05-09 16:22:46 +00:00
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") . "\"\n");
2003-05-09 16:22:46 +00:00
echo ("></pre></td></tr>\n");
echo ("</table>\n");
2003-06-09 10:59:30 +00:00
echo ("<p></p>");
2003-07-25 15:41:51 +00:00
echo ("<p>* = ". _("required") . "</p>");
echo ("<p>** = ". _("required for Samba 3 schema") . "</p>");
2003-05-09 16:22:46 +00:00
// password for configuration
2003-06-09 10:59:30 +00:00
echo ("<p><input type=\"hidden\" name=\"passwd\" value=\"" . $passwd . "\"></p>\n");
2003-05-09 16:22:46 +00:00
2003-07-06 10:24:41 +00:00
// config file
echo ("<p><input type=\"hidden\" name=\"filename\" value=\"" . $_POST['filename'] . "\"></p>\n");
2003-02-25 21:28:17 +00:00
echo ("</form>\n");
echo ("</body>\n");
echo ("</html>\n");
?>