added some comments + minor changes
This commit is contained in:
parent
6a47977c54
commit
77b145572d
|
@ -67,7 +67,7 @@ class Config {
|
||||||
$file = fopen($conffile, "r");
|
$file = fopen($conffile, "r");
|
||||||
while (!feof($file)) {
|
while (!feof($file)) {
|
||||||
$line = fgets($file, 1024);
|
$line = fgets($file, 1024);
|
||||||
if (($line == "\n")||($line[0] == "#")) continue;
|
if (($line == "\n")||($line[0] == "#")) continue; // ignore comments
|
||||||
if (substr($line, 0, 5) == "ssl: ") {
|
if (substr($line, 0, 5) == "ssl: ") {
|
||||||
$this->SSL = chop(substr($line, 5, strlen($line)-5));
|
$this->SSL = chop(substr($line, 5, strlen($line)-5));
|
||||||
continue;
|
continue;
|
||||||
|
@ -122,7 +122,7 @@ class Config {
|
||||||
}
|
}
|
||||||
fclose($file);
|
fclose($file);
|
||||||
for ($i = 0; $i < sizeof($file_array); $i++) {
|
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: ") {
|
if (substr($file_array[$i], 0, 5) == "ssl: ") {
|
||||||
$file_array[$i] = "ssl: " . $this->SSL . "\n";
|
$file_array[$i] = "ssl: " . $this->SSL . "\n";
|
||||||
$save_ssl = True;
|
$save_ssl = True;
|
||||||
|
@ -176,7 +176,7 @@ class Config {
|
||||||
"# e.g. ou=People,dc=yourdomain,dc=org\n" . "usersuffix: " . $this->suff_users);
|
"# 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" .
|
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);
|
"# 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);
|
"# e.g. ou=machines,dc=yourdomain,dc=org\n" . "hostsuffix: " . $this->suff_hosts);
|
||||||
$file = fopen($conffile, "w");
|
$file = fopen($conffile, "w");
|
||||||
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
|
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
|
||||||
|
@ -195,6 +195,8 @@ class Config {
|
||||||
echo _("<b>HostSuffix: </b>") . $this->suff_hosts;
|
echo _("<b>HostSuffix: </b>") . $this->suff_hosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// functions to read/write preferences
|
||||||
|
|
||||||
function get_SSL() {
|
function get_SSL() {
|
||||||
return $this->SSL;
|
return $this->SSL;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +229,7 @@ class Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_Admins($value) {
|
function set_Admins($value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) { // check if $value is array of strings
|
||||||
$b = true;
|
$b = true;
|
||||||
for($i = 0; $i < sizeof($value); $i++){
|
for($i = 0; $i < sizeof($value); $i++){
|
||||||
if (is_string($value[$i]) == false) {
|
if (is_string($value[$i]) == false) {
|
||||||
|
@ -237,6 +239,7 @@ class Config {
|
||||||
}
|
}
|
||||||
if ($b) $this->Admins = $value;
|
if ($b) $this->Admins = $value;
|
||||||
}
|
}
|
||||||
|
else echo _("Config->set_Admins failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_Adminstring() {
|
function get_Adminstring() {
|
||||||
|
|
|
@ -25,12 +25,14 @@ $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// check if password was entered
|
// check if password was entered
|
||||||
|
// if not: load login page
|
||||||
if (! $passwd) {
|
if (! $passwd) {
|
||||||
require('conflogin.php');
|
require('conflogin.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if password is valid
|
// check if password is valid
|
||||||
|
// if not: load login page
|
||||||
include_once ('config.php');
|
include_once ('config.php');
|
||||||
$conf = new Config();
|
$conf = new Config();
|
||||||
if (!(($conf->get_Passwd()) == $passwd)) {
|
if (!(($conf->get_Passwd()) == $passwd)) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ $Id$
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
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();
|
$conf = new Config();
|
||||||
|
|
||||||
// check if password is correct
|
// check if password is correct
|
||||||
|
// if not: load login page
|
||||||
if ($passwd != $conf->get_Passwd()) {
|
if ($passwd != $conf->get_Passwd()) {
|
||||||
require('confmain.php');
|
require('conflogin.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,11 +74,12 @@ if ($pass1 != $pass2) {
|
||||||
echo _("<b>" . _("Passwords are different!") . "</b>");
|
echo _("<b>" . _("Passwords are different!") . "</b>");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
// set new password
|
||||||
if ($pass1 != "") {
|
if ($pass1 != "") {
|
||||||
$conf->set_Passwd($pass1);
|
$conf->set_Passwd($pass1);
|
||||||
echo ("<b>" . _("Password changed!") . "</b><br><br>");
|
echo ("<b>" . _("Password changed!") . "</b><br><br>");
|
||||||
}
|
}
|
||||||
// save settings
|
// save settings and display new settings
|
||||||
$conf->save();
|
$conf->save();
|
||||||
echo ("<b>" . _("Saving the following settings:") . "</b><br><br>");
|
echo ("<b>" . _("Saving the following settings:") . "</b><br><br>");
|
||||||
$conf->printconf();
|
$conf->printconf();
|
||||||
|
|
|
@ -25,6 +25,6 @@ usersuffix: ou=People,o=test,c=de
|
||||||
# e.g. ou=Groups,dc=yourdomain,dc=org
|
# e.g. ou=Groups,dc=yourdomain,dc=org
|
||||||
groupsuffix: ou=group,o=test,c=de
|
groupsuffix: ou=group,o=test,c=de
|
||||||
|
|
||||||
# suffix of hosts
|
# suffix of Samba hosts
|
||||||
# e.g. ou=machines,dc=yourdomain,dc=org
|
# e.g. ou=machines,dc=yourdomain,dc=org
|
||||||
hostsuffix: ou=machines,o=test,c=de
|
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");
|
include_once("../config/config.php");
|
||||||
|
|
||||||
class Ldap{
|
class Ldap{
|
||||||
|
@ -99,7 +99,6 @@ class Ldap{
|
||||||
}
|
}
|
||||||
|
|
||||||
// closes connection to server
|
// closes connection to server
|
||||||
// $base is optional and specifies the root from where to search for entries
|
|
||||||
function close() {
|
function close() {
|
||||||
ldap_close($this->server);
|
ldap_close($this->server);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue