added some comments + minor changes
This commit is contained in:
parent
6a47977c54
commit
77b145572d
|
@ -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 _("<b>GroupSuffix: </b>") . $this->suff_groups . "</br>";
|
||||
echo _("<b>HostSuffix: </b>") . $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() {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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 _("<b>" . _("Passwords are different!") . "</b>");
|
||||
exit;
|
||||
}
|
||||
// set new password
|
||||
if ($pass1 != "") {
|
||||
$conf->set_Passwd($pass1);
|
||||
echo ("<b>" . _("Password changed!") . "</b><br><br>");
|
||||
}
|
||||
// save settings
|
||||
// save settings and display new settings
|
||||
$conf->save();
|
||||
echo ("<b>" . _("Saving the following settings:") . "</b><br><br>");
|
||||
$conf->printconf();
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue