From 77b145572dcdfafd65e804ef3192dc70fd701f5c Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 8 Mar 2003 10:10:19 +0000 Subject: [PATCH] added some comments + minor changes --- lam/config/config.php | 11 +++++++---- lam/config/confmain.php | 2 ++ lam/config/confsave.php | 10 ++++++---- lam/lam.conf | 2 +- lam/lib/ldap.php | 3 +-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lam/config/config.php b/lam/config/config.php index 7124935f..2b3fbe5c 100644 --- a/lam/config/config.php +++ b/lam/config/config.php @@ -67,7 +67,7 @@ class Config { $file = fopen($conffile, "r"); while (!feof($file)) { $line = fgets($file, 1024); - if (($line == "\n")||($line[0] == "#")) continue; + if (($line == "\n")||($line[0] == "#")) continue; // ignore comments if (substr($line, 0, 5) == "ssl: ") { $this->SSL = chop(substr($line, 5, strlen($line)-5)); continue; @@ -122,7 +122,7 @@ class Config { } fclose($file); for ($i = 0; $i < sizeof($file_array); $i++) { - if (($file_array[$i] == "\n")||($file_array[$i][0] == "#")) continue; + if (($file_array[$i] == "\n")||($file_array[$i][0] == "#")) continue; // ignore comments if (substr($file_array[$i], 0, 5) == "ssl: ") { $file_array[$i] = "ssl: " . $this->SSL . "\n"; $save_ssl = True; @@ -176,7 +176,7 @@ class Config { "# e.g. ou=People,dc=yourdomain,dc=org\n" . "usersuffix: " . $this->suff_users); if (!$save_suffgrp == True) array_push($file_array, "\n# suffix of groups\n" . "# e.g. ou=Groups,dc=yourdomain,dc=org\n" . "groupsuffix: " . $this->suff_groups); - if (!$save_suffhst == True) array_push($file_array, "\n# suffix of hosts\n" . + if (!$save_suffhst == True) array_push($file_array, "\n# suffix of Samba hosts\n" . "# e.g. ou=machines,dc=yourdomain,dc=org\n" . "hostsuffix: " . $this->suff_hosts); $file = fopen($conffile, "w"); for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]); @@ -194,6 +194,8 @@ class Config { echo _("GroupSuffix: ") . $this->suff_groups . "
"; echo _("HostSuffix: ") . $this->suff_hosts; } + +// functions to read/write preferences function get_SSL() { return $this->SSL; @@ -227,7 +229,7 @@ class Config { } function set_Admins($value) { - if (is_array($value)) { + if (is_array($value)) { // check if $value is array of strings $b = true; for($i = 0; $i < sizeof($value); $i++){ if (is_string($value[$i]) == false) { @@ -237,6 +239,7 @@ class Config { } if ($b) $this->Admins = $value; } + else echo _("Config->set_Admins failed!"); } function get_Adminstring() { diff --git a/lam/config/confmain.php b/lam/config/confmain.php index 73eef583..795c4796 100644 --- a/lam/config/confmain.php +++ b/lam/config/confmain.php @@ -25,12 +25,14 @@ $Id$ */ // check if password was entered +// if not: load login page if (! $passwd) { require('conflogin.php'); exit; } // check if password is valid +// if not: load login page include_once ('config.php'); $conf = new Config(); if (!(($conf->get_Passwd()) == $passwd)) { diff --git a/lam/config/confsave.php b/lam/config/confsave.php index 38f6869e..8ce0f997 100644 --- a/lam/config/confsave.php +++ b/lam/config/confsave.php @@ -20,7 +20,7 @@ $Id$ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + confsave saves the new preferences to lam.conf */ @@ -28,8 +28,9 @@ include_once ('config.php'); $conf = new Config(); // check if password is correct +// if not: load login page if ($passwd != $conf->get_Passwd()) { - require('confmain.php'); + require('conflogin.php'); exit; } @@ -73,13 +74,14 @@ if ($pass1 != $pass2) { echo _("" . _("Passwords are different!") . ""); exit; } +// set new password if ($pass1 != "") { $conf->set_Passwd($pass1); echo ("" . _("Password changed!") . "

"); } -// save settings +// save settings and display new settings $conf->save(); echo ("" . _("Saving the following settings:") . "

"); $conf->printconf(); -?> \ No newline at end of file +?> diff --git a/lam/lam.conf b/lam/lam.conf index 02cf3fd6..24ea4dfe 100644 --- a/lam/lam.conf +++ b/lam/lam.conf @@ -25,6 +25,6 @@ usersuffix: ou=People,o=test,c=de # e.g. ou=Groups,dc=yourdomain,dc=org groupsuffix: ou=group,o=test,c=de -# suffix of hosts +# suffix of Samba hosts # e.g. ou=machines,dc=yourdomain,dc=org hostsuffix: ou=machines,o=test,c=de diff --git a/lam/lib/ldap.php b/lam/lib/ldap.php index 3232e844..55b72454 100644 --- a/lam/lib/ldap.php +++ b/lam/lib/ldap.php @@ -21,7 +21,7 @@ $Id$ */ -// Ldap provides basic functions to connect to the OpenLDAP server and get lists of users and groups. +// ldap.php provides basic functions to connect to the OpenLDAP server and get lists of users and groups. include_once("../config/config.php"); class Ldap{ @@ -99,7 +99,6 @@ class Ldap{ } // closes connection to server - // $base is optional and specifies the root from where to search for entries function close() { ldap_close($this->server); }