From 53fd170bfb6ef49b999b73c16f03b50476c1ebd3 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 23 Apr 2003 19:13:55 +0000 Subject: [PATCH] files were moved --- lam/{ => config}/lam.conf | 0 lam/{config/config.php => lib/config.inc} | 26 +++- lam/lib/{ldap.php => ldap.inc} | 2 +- lam/lib/listgroups.php | 148 ---------------------- lam/lib/listhosts.php | 130 ------------------- lam/{ => templates}/config/conflogin.php | 4 +- lam/{ => templates}/config/confmain.php | 18 +-- lam/{ => templates}/config/confsave.php | 8 +- lam/templates/logout.php | 2 +- lam/templates/main.php | 2 +- lam/templates/main_header.php | 6 +- 11 files changed, 41 insertions(+), 305 deletions(-) rename lam/{ => config}/lam.conf (100%) rename lam/{config/config.php => lib/config.inc} (96%) rename lam/lib/{ldap.php => ldap.inc} (99%) delete mode 100644 lam/lib/listgroups.php delete mode 100644 lam/lib/listhosts.php rename lam/{ => templates}/config/conflogin.php (92%) rename lam/{ => templates}/config/confmain.php (94%) rename lam/{ => templates}/config/confsave.php (95%) diff --git a/lam/lam.conf b/lam/config/lam.conf similarity index 100% rename from lam/lam.conf rename to lam/config/lam.conf diff --git a/lam/config/config.php b/lam/lib/config.inc similarity index 96% rename from lam/config/config.php rename to lam/lib/config.inc index f0c09cd4..a7cdb0fc 100644 --- a/lam/config/config.php +++ b/lam/lib/config.inc @@ -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 "
"; + echo _("Unable to load lam.conf! ") . $conffile ; echo "
"; } } - // 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 = diff --git a/lam/lib/ldap.php b/lam/lib/ldap.inc similarity index 99% rename from lam/lib/ldap.php rename to lam/lib/ldap.inc index 979cbb37..734ca821 100644 --- a/lam/lib/ldap.php +++ b/lam/lib/ldap.inc @@ -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{ diff --git a/lam/lib/listgroups.php b/lam/lib/listgroups.php deleted file mode 100644 index e0ff1e70..00000000 --- a/lam/lib/listgroups.php +++ /dev/null @@ -1,148 +0,0 @@ -listgroups\n"; -echo "\n"; -echo "\n"; -echo "\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 ("

" . _("No Grous found!") . "

"); -} -else echo ("

" . _("LDAP Search failed! Please check your preferences.
No Groups found!") . "


"); - -echo ("
\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 "\n"; -echo ""; -// table header -for ($k = 0; $k < sizeof($desc_array); $k++) { - echo ""; -} -echo "\n"; - -// print group list -for ($i = 0; $i < sizeof($info); $i++) { // ignore last entry in array which is "count" - echo("" . - " " . - " "); - for ($k = 0; $k < sizeof($attr_array); $k++) { - echo (""); - } - echo("\n"); -} -echo ("
" . $desc_array[$k] . "
" . _("Edit") . ""); - // 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] = "" . - $info[$i][strtolower($attr_array[$k])][$d] . ""; - } - else $linklist[$d] = $user; - } - echo implode("; ", $linklist); - } - // print all other attributes - else { - echo implode("; ", $info[$i][strtolower($attr_array[$k])]); - } - } - echo ("
"); -echo ("

 

\n"); -echo (""); -echo ("\n"); -echo ("
" . _("New Group") . ""); -echo ("   " . _("Delete Group(s)") . "
\n"); -echo ("
\n"); -echo "\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; -} - -?> diff --git a/lam/lib/listhosts.php b/lam/lib/listhosts.php deleted file mode 100644 index e7006fc6..00000000 --- a/lam/lib/listhosts.php +++ /dev/null @@ -1,130 +0,0 @@ -listhosts\n"; -echo "\n"; -echo "\n"; -echo "\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 ("

" . _("No Samba Hosts found!") . "

"); -} -else echo ("

" . _("LDAP Search failed! Please check your preferences.
No Samba Hosts found!") . "


"); - -echo ("
\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 "\n"; -echo ""; -// table header -for ($k = 0; $k < sizeof($desc_array); $k++) { - echo ""; -} -echo "\n"; - -// print host list -for ($i = 0; $i < sizeof($info); $i++) { - echo("" . - " " . - " "); - for ($k = 0; $k < sizeof($attr_array); $k++) { - echo (""); - } - echo("\n"); -} -echo ("
" . $desc_array[$k] . "
" . _("Edit") . ""); - // 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 ("
"); -echo ("

 

\n"); -echo (""); -echo ("\n"); -echo ("
" . _("New Host") . ""); -echo ("   " . _("Delete Host(s)") . "
\n"); -echo ("
\n"); -echo "\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; -} - -?> diff --git a/lam/config/conflogin.php b/lam/templates/config/conflogin.php similarity index 92% rename from lam/config/conflogin.php rename to lam/templates/config/conflogin.php index c13cfef0..791dbee5 100644 --- a/lam/config/conflogin.php +++ b/lam/templates/config/conflogin.php @@ -24,7 +24,7 @@ $Id$ */ // start session -session_save_path("../sess"); +session_save_path("../../sess"); session_start(); ?> @@ -37,7 +37,7 @@ session_start(); -




+




diff --git a/lam/config/confmain.php b/lam/templates/config/confmain.php similarity index 94% rename from lam/config/confmain.php rename to lam/templates/config/confmain.php index aeb409fd..c1df71e4 100644 --- a/lam/config/confmain.php +++ b/lam/templates/config/confmain.php @@ -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 ("\n"); echo ("" . _("LDAP Account Manager Configuration") . "\n"); echo ("\n"); echo ("\n"); -echo ("

\"LDAP




\n"); +echo ("

\"LDAP




\n"); echo ("\n"); echo (""); echo ("\n"); echo ("\n"); echo (""); -echo ("\n"); -echo ("\n"); -echo (""); echo ("\n"); echo ("\n"); echo ("\n"); @@ -80,18 +77,21 @@ echo (""); echo (""); echo (""); +echo (""); +echo (""); +echo ("\n"); +echo ("\n"); echo ("

" . _("Server Address") . ":

get_ServerURL() . "\">

" . _("Server Address of LDAP server (e.g. ldap://localhost:389 or ldaps://localhost:636)") . "

 

" . _("List of valid users") . ":

get_Adminstring() . "\">

" . _("Usernames must be seperated by semicolons
(e.g. cn=admin,dc=yourcompany,dc=com;uid=root,ou=people,dc=yourcompany,dc=com)") . "

 

" . _("UserSuffix") . ":

get_UserSuffix() . "\">

" . _("This is the suffix from where to search for users.
(e.g. ou=People,dc=yourcompany,dc=com)") . "

" . _("GroupSuffix") . ":

get_GroupSuffix() . "\">

" . _("This is the list of attributes to show in the lis . "

" . _("Attributes in Group List:") . "

get_grouplistAttributes() . "\">

" . _("Attributes in Host List:") . "

get_hostlistAttributes() . "\">
 
 

" . _("List of valid users") . ":

get_Adminstring() . "\">

" . _("Usernames must be seperated by semicolons
(e.g. cn=admin,dc=yourcompany,dc=com;uid=root,ou=people,dc=yourcompany,dc=com)") . "

\n"); echo ("

 

\n"); echo (""); -echo (""); -echo ("\n"); +echo (""); echo ("\n"); echo ("
" . _("New Password") . ": " . _("Optional") . "
" . _("New Password") . ":
" . _("Reenter Password") . ":
\n"); echo ("

 

\n"); echo ("

 

\n"); echo (""); echo ("\n"); +echo ("\n"); echo ("
     ");
-echo ("
\n"); echo ("
\n"); echo ("
\n"); diff --git a/lam/config/confsave.php b/lam/templates/config/confsave.php similarity index 95% rename from lam/config/confsave.php rename to lam/templates/config/confsave.php index 3b24bada..d61ab1db 100644 --- a/lam/config/confsave.php +++ b/lam/templates/config/confsave.php @@ -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 ("




"); +echo ("




"); // check new preferences if (chop($serverurl) == "") { @@ -137,6 +137,6 @@ if ($pass1 != "") { $conf->save(); echo ("" . _("The following settings were saved:") . "

"); $conf->printconf(); -echo ("




" . _("Back to Login") . ""); +echo ("




" . _("Back to Login") . ""); ?> diff --git a/lam/templates/logout.php b/lam/templates/logout.php index d883efa5..42ebeeb0 100644 --- a/lam/templates/logout.php +++ b/lam/templates/logout.php @@ -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"); diff --git a/lam/templates/main.php b/lam/templates/main.php index 80ae23da..05687638 100644 --- a/lam/templates/main.php +++ b/lam/templates/main.php @@ -31,7 +31,7 @@ echo ("\n"); echo ("\n"); echo ("\n"); echo ("\n"); -echo ("\n"); +echo ("\n"); echo ("\n"); echo ("This page requires a browser that can show frames!\n"); echo ("\n"); diff --git a/lam/templates/main_header.php b/lam/templates/main_header.php index 1d85a341..6242b09c 100644 --- a/lam/templates/main_header.php +++ b/lam/templates/main_header.php @@ -41,9 +41,9 @@ $Id$
- - - + + +