LDAPAccountManager/lam/templates/config/confmain.php

311 lines
12 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");
session_start();
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']) $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'];
if ($_POST['scriptpath']) $scriptpath = $_POST['scriptpath'];
else $scriptpath = "";
if ($_POST['scriptserver']) $scriptserver = $_POST['scriptserver'];
else $scriptserver = "";
2003-05-09 16:22:46 +00:00
session_register('passwd', 'passwd1', 'passwd2', 'serverurl', 'admins', 'suffusers',
'suffgroups', 'suffhosts', 'minUID', 'maxUID', 'minGID', 'maxGID', 'minMach',
'maxMach', 'usrlstattr', 'grplstattr', 'hstlstattr', 'maxlistentries', 'language',
'scriptpath', 'scriptserver');
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\">");
}
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) {
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-02-25 21:28:17 +00:00
$conf = new Config();
if (!(($conf->get_Passwd()) == $passwd)) {
require('conflogin.php');
exit;
}
echo ("<html>\n");
echo ("<head>\n");
echo ("<title>" . _("LDAP Account Manager Configuration") . "</title>\n");
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\">".
"<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 ("<table align=\"left\" border=\"0\">");
2003-05-09 16:22:46 +00:00
// serverURL
2003-05-14 21:01:17 +00:00
echo ("<tr><td><p align=\"right\"><b>" . _("Server Address") . ": </b></p></td>".
"<td><p 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
echo ("<tr><td>&nbsp</td></tr>");
2003-05-09 16:22:46 +00:00
// user suffix
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");
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
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");
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
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");
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
echo ("</table>");
echo ("</fieldset>");
2003-05-09 16:22:46 +00:00
echo ("<br>");
echo ("<fieldset><legend><b>" . _("Ranges") . "</b></legend>");
echo ("<table align=\"left\" border=\"0\">");
2003-05-09 16:22:46 +00:00
// minUID
echo ("<tr><td align=\"right\"><b>".
2003-05-14 21:01:17 +00:00
_("Minimum UID number") . ": </b>".
"<input size=6 type=\"text\" name=\"minUID\" value=\"" . $conf->get_minUID() . "\"></td>\n");
2003-05-09 16:22:46 +00:00
// maxUID
2003-05-14 21:01:17 +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-05-14 21:01:17 +00:00
_("Minimum GID number") . ": </b>".
"<input size=6 type=\"text\" name=\"minGID\" value=\"" . $conf->get_minGID() . "\"></td>\n");
2003-05-09 16:22:46 +00:00
// maxGID
2003-05-14 21:01:17 +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-05-14 21:01:17 +00:00
_("Minimum Machine number") . ": </b>".
"<input size=6 type=\"text\" name=\"minMach\" value=\"" . $conf->get_minMachine() . "\"></td>\n");
2003-05-09 16:22:46 +00:00
// maxMach
2003-05-14 21:01:17 +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
echo ("</table>");
echo ("</fieldset>");
2003-05-09 16:22:46 +00:00
echo ("<br>");
echo ("<fieldset><legend><b>" . _("LDAP List settings") . "</b></legend>");
echo ("<table align=\"left\" border=\"0\">");
2003-05-09 16:22:46 +00:00
// user list attributes
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>");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>");
2003-05-09 16:22:46 +00:00
// user list attributes
echo ("<tr><td><p align=\"right\"><b>".
_("Attributes in Group List:") . "</b></p></td>".
2003-05-14 21:01:17 +00:00
"<td><input size=50 type=\"text\" name=\"grplstattr\" value=\"" . $conf->get_grouplistAttributes() . "\"></td>");
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>");
2003-05-09 16:22:46 +00:00
// user list attributes
echo ("<tr><td><p align=\"right\"><b>".
_("Attributes in Host List:") . "</b></p></td>".
2003-05-14 21:01:17 +00:00
"<td><input size=50 type=\"text\" name=\"hstlstattr\" value=\"" . $conf->get_hostlistAttributes() . "\"></td>");
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>");
2003-05-09 16:22:46 +00:00
// two new lines
2003-04-23 19:13:55 +00:00
echo ("<tr><td>&nbsp</td></tr>");
echo ("<tr><td>&nbsp</td></tr>");
2003-05-09 16:22:46 +00:00
// admin list
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");
2003-05-14 21:01:17 +00:00
echo ("<td><a href=\"../help.php?HelpNumber=207\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
2003-05-09 16:22:46 +00:00
// maximum list entries
echo ("<tr><td><p align=\"right\"><b>".
2003-05-14 21:01:17 +00:00
_("Maximum list entries") . ": </b></p></td>".
"<td><select name=\"maxlistentries\"><option selected>".$conf->get_MaxListEntries()."</option>");
if ($conf->get_MaxListEntries() != 10) echo("<option>10</option>");
if ($conf->get_MaxListEntries() != 20) echo("<option>20</option>");
if ($conf->get_MaxListEntries() != 30) echo("<option>30</option>");
if ($conf->get_MaxListEntries() != 50) echo("<option>50</option>");
if ($conf->get_MaxListEntries() != 75) echo("<option>75</option>");
if ($conf->get_MaxListEntries() != 100) echo("<option>100</option>");
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");
echo ("<br>\n");
2003-05-09 16:22:46 +00:00
echo ("<fieldset><legend><b>" . _("Language settings") . "</b></legend>\n");
echo ("<table align=\"left\" border=\"0\">\n");
2003-05-09 16:22:46 +00:00
// language
echo ("<tr>");
echo ("<td><b>" . _("Default Language") . "</b></td>\n<td>");
2003-05-09 16:22:46 +00:00
// 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] == "#" || $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
echo ("<select name=\"language\">");
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
{
echo _("Unable to load available languages. 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");
echo ("<br>\n");
2003-05-09 16:22:46 +00:00
echo ("<fieldset><legend><b>" . _("Script settings") . "</b></legend>\n");
echo ("<table align=\"left\" border=\"0\">\n");
// script settings
echo ("<tr><td><p align=\"right\"><b>".
_("Path to external script") . ": </b></p></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");
echo ("<tr><td><p align=\"right\"><b>".
_("Server of external script") . ": </b></p></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");
echo ("<br>\n");
echo ("<fieldset><legend><b>" . _("Security settings") . "</b></legend>\n");
echo ("<table align=\"left\" 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");
echo ("</fieldset>");
2003-05-09 16:22:46 +00:00
echo ("<br>");
2003-05-09 16:22:46 +00:00
// buttons
echo ("<table align=\"left\" border=\"0\">");
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-05-09 16:22:46 +00:00
// password for configuration
echo ("<input type=\"hidden\" name=\"passwd\" value=\"" . $passwd . "\"><br>\n");
2003-05-09 16:22:46 +00:00
2003-02-25 21:28:17 +00:00
echo ("</form>\n");
echo ("</body>\n");
echo ("</html>\n");
?>