files were moved

This commit is contained in:
Roland Gruber 2003-04-23 19:13:55 +00:00
parent 7851076474
commit 53fd170bfb
11 changed files with 41 additions and 305 deletions

View File

@ -62,14 +62,21 @@ class Config {
var $grouplistAttributes;
var $hostlistAttributes;
// constructor, loads preferences from ../lam.conf
// constructor, loads preferences from ../config/lam.conf
function Config() {
$this->reload();
}
// reloads preferences from ../lam.conf
// reloads preferences from ../config/lam.conf
function reload() {
$conffile = "../lam.conf";
// Get path of lam.conf
$path = getcwd();
$path = explode("/", substr($path,1));
for($i = 0; $i <= array_search("lam", $path); $i++) {
$conffile .= "/" . $path[$i];
}
echo ;
$conffile .= "/config/lam.conf";
if (is_file($conffile) == True) {
$file = fopen($conffile, "r");
while (!feof($file)) {
@ -142,13 +149,20 @@ class Config {
fclose($file);
}
else {
echo _("Unable to load lam.conf!"); echo "<br>";
echo _("Unable to load lam.conf! ") . $conffile ; echo "<br>";
}
}
// saves preferences to ../lam.conf
// saves preferences to ../config/lam.conf
function save() {
$conffile = "../lam.conf";
// Get path of lam.conf
$path = getcwd();
$path = explode("/", substr($path,1));
for($i = 0; $i <= array_search("lam", $path); $i++) {
$conffile .= "/" . $path[$i];
}
echo ;
$conffile .= "/config/lam.conf";
if (is_file($conffile) == True) {
// booleans to check if value was already saved
$save_serverURL = $save_passwd = $save_admins = $save_suffusr = $save_suffgrp = $save_suffhst =

View File

@ -22,7 +22,7 @@ $Id$
*/
// ldap.php provides basic functions to connect to the OpenLDAP server and get lists of users and groups.
include_once("../config/config.php");
include_once("config.inc");
class Ldap{

View File

@ -1,148 +0,0 @@
<?php
/*
$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.
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 detaexils.
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
This code displays a list of all groups.
*/
include_once ('../config/config.php');
include_once("ldap.php");
// start session
session_save_path("../sess");
@session_start();
echo "<html><head><title>listgroups</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\">\n";
echo "</head><body>\n";
echo "<script src=\"./functions.js\" type=\"text/javascript\" language=\"javascript\"></script>\n";
// generate attribute-description table
$attr_array; // list of LDAP attributes to show
$desc_array; // list of descriptions for the attributes
$attr_string = $_SESSION["config"]->get_grouplistAttributes();
$temp_array = explode(";", $attr_string);
$hash_table = $_SESSION["ldap"]->attributeGroupArray();
for ($i = 0; $i < sizeof($temp_array); $i++) {
// if value is predifined, look up description in hash_table
if (substr($temp_array[$i],0,1) == "#") {
$attr = substr($temp_array[$i],1);
$attr_array[$i] = $attr;
$desc_array[] = $hash_table[$attr];
}
// if not predefined, the attribute is seperated by a ":" from description
else {
$attr = explode(":", $temp_array[$i]);
$attr_array[$i] = $attr[0];
$desc_array[$i] = $attr[1];
}
}
// Groups have the attribute "posixGroup"
$filter = "(objectClass=posixGroup)";
$attrs = $attr_array;
$sr = @ldap_search($_SESSION["ldap"]->server(),
$_SESSION["config"]->get_GroupSuffix(),
$filter, $attrs);
if ($sr) {
$info = ldap_get_entries($_SESSION["ldap"]->server, $sr);
ldap_free_result($sr);
if ($info["count"] == 0) echo ("<br><br><font color=\"red\"><b>" . _("No Grous found!") . "</b></font><br><br>");
}
else echo ("<br><br><font color=\"red\"><b>" . _("LDAP Search failed! Please check your preferences. <br> No Groups found!") . "</b></font><br><br>");
echo ("<form action=\"../templates/account.php?type=group\" method=\"post\">\n");
// delete first array entry which is "count"
array_shift($info);
// sort rows by sort column ($list)
usort($info, "cmp_array");
// print group table header
echo "<table rules=\"all\" class=\"grouplist\" width=\"100%\">\n";
echo "<tr class=\"grouplist_head\"><th width=22 height=34></th><th></th>";
// table header
for ($k = 0; $k < sizeof($desc_array); $k++) {
echo "<th><a href=\"listgroups.php?list=" . strtolower($attr_array[$k]) . "\">" . $desc_array[$k] . "</a></th>";
}
echo "</tr>\n";
// print group list
for ($i = 0; $i < sizeof($info); $i++) { // ignore last entry in array which is "count"
echo("<tr class=\"grouplist\" onMouseOver=\"group_over(this, '" . $info[$i]["dn"] . "')\"" .
" onMouseOut=\"group_out(this, '" . $info[$i]["dn"] . "')\"" .
" onClick=\"group_click(this, '" . $info[$i]["dn"] . "')\"" .
" onDblClick=parent.frames[2].location.href=\"../templates/account.php?type=group&DN='" . $info[$i]["dn"] . "'\">" .
" <td height=22><input onClick=\"group_click(this, '" . $info[$i]["dn"] . "')\" type=\"checkbox\" name=\"" . $info[$i]["dn"] . "\"></td>" .
" <td align='center'><a href=\"../templates/account.php?type=group&DN='" . $info[$i]["dn"] . "'\">" . _("Edit") . "</a></td>");
for ($k = 0; $k < sizeof($attr_array); $k++) {
echo ("<td>");
// print all attribute entries seperated by "; "
if (sizeof($info[$i][strtolower($attr_array[$k])]) > 0) {
// delete first array entry which is "count"
array_shift($info[$i][strtolower($attr_array[$k])]);
// generate links for group members
if (strtolower($attr_array[$k]) == "memberuid") {
$linklist = array();
for ($d = 0; $d < sizeof($info[$i][strtolower($attr_array[$k])]); $d++) {
$user = $info[$i][strtolower($attr_array[$k])][$d]; // user name
$dn = $_SESSION["ldap"]->search_username($user); // DN entry
// if user was found in LDAP make link, otherwise just print name
if ($dn) {
$linklist[$d] = "<a href=../templates/account.php?type=user&DN=\"" . $dn . "\" >" .
$info[$i][strtolower($attr_array[$k])][$d] . "</a>";
}
else $linklist[$d] = $user;
}
echo implode("; ", $linklist);
}
// print all other attributes
else {
echo implode("; ", $info[$i][strtolower($attr_array[$k])]);
}
}
echo ("</td>");
}
echo("</tr>\n");
}
echo ("</table>");
echo ("<p>&nbsp</p>\n");
echo ("<table align=\"left\" border=\"0\">");
echo ("<tr><td align=\"left\"><a href=\"../templates/account.php?type=group\" target=\"_self\"><big>" . _("New Group") . "</big></a>");
echo ("&nbsp&nbsp&nbsp<a href=\"../templates/account.php?type=delete\" target=\"_self\"><big>" . _("Delete Group(s)") . "</big></a></td></tr>\n");
echo ("</table>\n");
echo ("</form>\n");
echo "</body></html>\n";
// compare function used for usort-method
// rows are sorted with the first attribute entry of the sort column
// if objects have attributes with multiple values the others are ignored
function cmp_array($a, $b) {
// list specifies the sort column
global $list;
global $attr_array;
// sort by first attribute with name $list
if (!$list) $list = strtolower($attr_array[0]);
if ($a[$list][0] == $b[$list][0]) return 0;
else if ($a[$list][0] == max($a[$list][0], $b[$list][0])) return 1;
else return -1;
}
?>

View File

@ -1,130 +0,0 @@
<?php
/*
$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.
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 detaexils.
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
This code displays a list of all Samba hosts.
*/
include_once ('../config/config.php');
include_once("ldap.php");
// start session
session_save_path("../sess");
@session_start();
echo "<html><head><title>listhosts</title>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\">\n";
echo "</head><body>\n";
echo "<script src=\"./functions.js\" type=\"text/javascript\" language=\"javascript\"></script>\n";
// generate attribute-description table
$attr_array; // list of LDAP attributes to show
$desc_array; // list of descriptions for the attributes
$attr_string = $_SESSION["config"]->get_hostlistAttributes();
$temp_array = explode(";", $attr_string);
$hash_table = $_SESSION["ldap"]->attributeHostArray();
for ($i = 0; $i < sizeof($temp_array); $i++) {
// if value is predifined, look up description in hash_table
if (substr($temp_array[$i],0,1) == "#") {
$attr = substr($temp_array[$i],1);
$attr_array[$i] = $attr;
$desc_array[] = $hash_table[$attr];
}
// if not predefined, the attribute is seperated by a ":" from description
else {
$attr = explode(":", $temp_array[$i]);
$attr_array[$i] = $attr[0];
$desc_array[$i] = $attr[1];
}
}
// Samba hosts have the attribute "sambaAccount" and end with "$"
$filter = "(&(objectClass=sambaAccount) (uid=*$))";
$attrs = $attr_array;
$sr = @ldap_search($_SESSION["ldap"]->server(),
$_SESSION["config"]->get_HostSuffix(),
$filter, $attrs);
if ($sr) {
$info = ldap_get_entries($_SESSION["ldap"]->server, $sr);
ldap_free_result($sr);
if ($info["count"] == 0) echo ("<br><br><font color=\"red\"><b>" . _("No Samba Hosts found!") . "</b></font><br><br>");
}
else echo ("<br><br><font color=\"red\"><b>" . _("LDAP Search failed! Please check your preferences. <br> No Samba Hosts found!") . "</b></font><br><br>");
echo ("<form action=\"../templates/account.php?type=host\" method=\"post\">\n");
// delete first array entry which is "count"
array_shift($info);
// sort rows by sort column ($list)
usort($info, "cmp_array");
// print host table header
echo "<table rules=\"all\" class=\"hostlist\" width=\"100%\">\n";
echo "<tr class=\"hostlist_head\"><th width=22 height=34></th><th></th>";
// table header
for ($k = 0; $k < sizeof($desc_array); $k++) {
echo "<th><a href=\"listhosts.php?list=" . strtolower($attr_array[$k]) . "\">" . $desc_array[$k] . "</a></th>";
}
echo "</tr>\n";
// print host list
for ($i = 0; $i < sizeof($info); $i++) {
echo("<tr class=\"hostlist\" onMouseOver=\"host_over(this, '" . $info[$i]["dn"] . "')\"" .
" onMouseOut=\"host_out(this, '" . $info[$i]["dn"] . "')\"" .
" onClick=\"host_click(this, '" . $info[$i]["dn"] . "')\"" .
" onDblClick=parent.frames[2].location.href=\"../templates/account.php?type=host&DN='" . $info[$i]["dn"] . "'\">" .
" <td height=22><input onClick=\"host_click(this, '" . $info[$i]["dn"] . "')\" type=\"checkbox\" name=\"" . $info[$i]["dn"] . "\"></td>" .
" <td align='center'><a href=\"../templates/account.php?type=host&DN='" . $info[$i]["dn"] . "'\">" . _("Edit") . "</a></td>");
for ($k = 0; $k < sizeof($attr_array); $k++) {
echo ("<td>");
// print all attribute entries seperated by "; "
if (sizeof($info[$i][strtolower($attr_array[$k])]) > 0) {
// delete first array entry which is "count"
array_shift($info[$i][strtolower($attr_array[$k])]);
echo implode("; ", $info[$i][strtolower($attr_array[$k])]);
}
echo ("</td>");
}
echo("</tr>\n");
}
echo ("</table>");
echo ("<p>&nbsp</p>\n");
echo ("<table align=\"left\" border=\"0\">");
echo ("<tr><td align=\"left\"><a href=\"../templates/account.php?type=host\" target=\"_self\"><big>" . _("New Host") . "</big></a>");
echo ("&nbsp&nbsp&nbsp<a href=\"../templates/account.php?type=delete\" target=\"_self\"><big>" . _("Delete Host(s)") . "</big></a></td></tr>\n");
echo ("</table>\n");
echo ("</form>\n");
echo "</body></html>\n";
// compare function used for usort-method
// rows are sorted with the first attribute entry of the sort column
// if objects have attributes with multiple values the others are ignored
function cmp_array($a, $b) {
// list specifies the sort column
global $list;
global $attr_array;
// sort by first attribute with name $list
if (!$list) $list = strtolower($attr_array[0]);
if ($a[$list][0] == $b[$list][0]) return 0;
else if ($a[$list][0] == max($a[$list][0], $b[$list][0])) return 1;
else return -1;
}
?>

View File

@ -24,7 +24,7 @@ $Id$
*/
// start session
session_save_path("../sess");
session_save_path("../../sess");
session_start();
?>
@ -37,7 +37,7 @@ session_start();
</title>
</head>
<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>
<form action="confmain.php" method="post">
<p align="center"><input type="password" name="passwd">

View File

@ -25,7 +25,7 @@ $Id$
*/
// start session
session_save_path("../sess");
session_save_path("../../sess");
session_start();
// check if password was entered
@ -37,7 +37,7 @@ if (! $passwd) {
// check if password is valid
// if not: load login page
include_once ('config.php');
include_once ('../../lib/config.inc');
$conf = new Config();
if (!(($conf->get_Passwd()) == $passwd)) {
require('conflogin.php');
@ -49,15 +49,12 @@ echo ("<head>\n");
echo ("<title>" . _("LDAP Account Manager Configuration") . "</title>\n");
echo ("</head>\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\"><img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p><hr><br><br>\n");
echo ("<form action=\"confsave.php\" method=\"post\">\n");
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");
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>&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");
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>&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");
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");
@ -80,18 +77,21 @@ echo ("<td rowspan=3><p>" . _("This is the list of attributes to show in the lis
. "</p></td></tr>");
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>");
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>");
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");
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 ("</table>\n");
echo ("<p>&nbsp</p>\n");
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>");
echo ("<td rowspan=2 width=10></td><td rowspan=2>" . _("Optional") . "</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>");
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 ("<p>&nbsp</p>\n");
echo ("<p>&nbsp</p>\n");
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='../templates/login.php'\"></pre></td></tr>\n");
echo ("<input type=\"button\" name=\"back\" value=\"" . _("Abort") . "\" onClick=\"self.location.href='../login.php'\"></pre></td></tr>\n");
echo ("</table>\n");
echo ("<input type=\"hidden\" name=\"passwd\" value=\"" . $passwd . "\"><br>\n");
echo ("</form>\n");

View File

@ -25,10 +25,10 @@ $Id$
*/
// start session
session_save_path("../sess");
session_save_path("../../sess");
session_start();
include_once ('config.php');
include_once ('../../lib/config.inc');
$conf = new Config();
// check if password is correct
@ -38,7 +38,7 @@ if ($passwd != $conf->get_Passwd()) {
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
if (chop($serverurl) == "") {
@ -137,6 +137,6 @@ if ($pass1 != "") {
$conf->save();
echo ("<b>" . _("The following settings were saved:") . "</b><br><br>");
$conf->printconf();
echo ("<br><br><br><br><br><a href=\"../templates/login.php\" target=\"_top\">" . _("Back to Login") . "</a>");
echo ("<br><br><br><br><br><a href=\"../login.php\" target=\"_top\">" . _("Back to Login") . "</a>");
?>

View File

@ -27,7 +27,7 @@ $Id$
setcookie("Key", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 0, "/");
setcookie("IV", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 0, "/");
include_once("../lib/ldap.php");
include_once("../lib/ldap.inc");
// start session
session_save_path("../sess");

View File

@ -31,7 +31,7 @@ echo ("</head>\n");
echo ("<frameset rows=\"130,100,*\">\n");
echo ("<frame src=\"./main_header.php\" name=\"head\" frameborder=\"0\" scrolling=\"no\">\n");
echo ("<frame src=\"../templates/status.php\" name=\"status\" frameborder=\"0\" scrolling=\"yes\">\n");
echo ("<frame src=\"../lib/listusers.php\" name=\"mainpart\" frameborder=\"0\" scrolling=\"yes\">\n");
echo ("<frame src=\"./lists/listusers.php\" name=\"mainpart\" frameborder=\"0\" scrolling=\"yes\">\n");
echo ("<noframes>\n");
echo ("This page requires a browser that can show frames!\n");
echo ("</noframes>\n");

View File

@ -41,9 +41,9 @@ $Id$
<br>
<table border="0" align="center" width="600">
<tr>
<td width="200"><p align="center"><a href="../lib/listusers.php" target="mainpart"> <? echo _("Users");?> </a></p></td>
<td width="200"><p align="center"><a href="../lib/listgroups.php" target="mainpart"> <? echo _("Groups");?> </a></p></td>
<td width="200"><p align="center"><a href="../lib/listhosts.php" target="mainpart"> <? echo _("Hosts");?> </a></p></td>
<td width="200"><p align="center"><a href="./lists/listusers.php" target="mainpart"> <? echo _("Users");?> </a></p></td>
<td width="200"><p align="center"><a href="./lists/listgroups.php" target="mainpart"> <? echo _("Groups");?> </a></p></td>
<td width="200"><p align="center"><a href="./lists/listhosts.php" target="mainpart"> <? echo _("Hosts");?> </a></p></td>
</tr>
</table>
</body>