diff --git a/lam/lib/config.inc b/lam/lib/config.inc
index 8dacc091..b731c5c9 100644
--- a/lam/lib/config.inc
+++ b/lam/lib/config.inc
@@ -40,467 +40,491 @@ function setlanguage() {
class Config {
- // server address (e.g. ldap://127.0.0.1:389)
- var $ServerURL;
+ // server address (e.g. ldap://127.0.0.1:389)
+ var $ServerURL;
- // array of strings: users with admin rights
- var $Admins;
+ // array of strings: users with admin rights
+ var $Admins;
- // string: password to edit preferences
- var $Passwd;
+ // string: password to edit preferences
+ var $Passwd;
- // single line with the names of all admin users
- var $Adminstring;
+ // single line with the names of all admin users
+ var $Adminstring;
- // suffix for users
- var $Suff_users;
+ // suffix for users
+ var $Suff_users;
- // suffix for groups
- var $Suff_groups;
+ // suffix for groups
+ var $Suff_groups;
- // suffix for Samba hosts
- var $Suff_hosts;
+ // suffix for Samba hosts
+ var $Suff_hosts;
- // minimum/maximum numbers for UID, GID and UID of Samba Hosts
- var $MinUID;
- var $MaxUID;
- var $MinGID;
- var $MaxGID;
- var $MinMachine;
- var $MaxMachine;
+ // minimum/maximum numbers for UID, GID and UID of Samba Hosts
+ var $MinUID;
+ var $MaxUID;
+ var $MinGID;
+ var $MaxGID;
+ var $MinMachine;
+ var $MaxMachine;
- // attributes that are shown in the user/group/host tables
- var $userlistAttributes;
- var $grouplistAttributes;
- var $hostlistAttributes;
+ // attributes that are shown in the user/group/host tables
+ var $userlistAttributes;
+ var $grouplistAttributes;
+ var $hostlistAttributes;
+ var $maxlistentries;
- // constructor, loads preferences from ../config/lam.conf
- function Config() {
- $this->reload();
- }
+ // constructor, loads preferences from ../config/lam.conf
+ function Config() {
+ $this->reload();
+ }
- // reloads preferences from ../config/lam.conf
- function reload() {
- $conffile = substr(__FILE__, 0, strlen(__FILE__) - 15) . "/config/lam.conf";
- if (is_file($conffile) == True) {
- $file = fopen($conffile, "r");
- while (!feof($file)) {
- $line = fgets($file, 1024);
- if (($line == "\n")||($line[0] == "#")) continue; // ignore comments
- // search keywords
- if (substr($line, 0, 11) == "serverURL: ") {
- $this->ServerURL = chop(substr($line, 11, strlen($line)-11));
- continue;
- }
- if (substr($line, 0, 8) == "passwd: ") {
- $this->Passwd = chop(substr($line, 8, strlen($line)-8));
- continue;
- }
- if (substr($line, 0, 8) == "admins: ") {
- $adminstr = chop(substr($line, 8, strlen($line)-8));
- $this->Adminstring = $adminstr;
- $this->Admins = explode(";", $adminstr);
- continue;
- }
- if (substr($line, 0, 12) == "usersuffix: ") {
- $this->Suff_users = chop(substr($line, 12, strlen($line)-12));
- continue;
- }
- if (substr($line, 0, 13) == "groupsuffix: ") {
- $this->Suff_groups = chop(substr($line, 13, strlen($line)-13));
- continue;
- }
- if (substr($line, 0, 12) == "hostsuffix: ") {
- $this->Suff_hosts = chop(substr($line, 12, strlen($line)-12));
- continue;
- }
- if (substr($line, 0, 8) == "minUID: ") {
- $this->MinUID = chop(substr($line, 8, strlen($line)-8));
- continue;
- }
- if (substr($line, 0, 8) == "maxUID: ") {
- $this->MaxUID = chop(substr($line, 8, strlen($line)-8));
- continue;
- }
- if (substr($line, 0, 8) == "minGID: ") {
- $this->MinGID = chop(substr($line, 8, strlen($line)-8));
- continue;
- }
- if (substr($line, 0, 8) == "maxGID: ") {
- $this->MaxGID = chop(substr($line, 8, strlen($line)-8));
- continue;
- }
- if (substr($line, 0, 12) == "minMachine: ") {
- $this->MinMachine = chop(substr($line, 12, strlen($line)-12));
- continue;
- }
- if (substr($line, 0, 12) == "maxMachine: ") {
- $this->MaxMachine = chop(substr($line, 12, strlen($line)-12));
- continue;
- }
- if (substr($line, 0, 20) == "userlistAttributes: ") {
- $this->userlistAttributes = chop(substr($line, 20, strlen($line)-20));
- continue;
- }
- if (substr($line, 0, 21) == "grouplistAttributes: ") {
- $this->grouplistAttributes = chop(substr($line, 21, strlen($line)-21));
- continue;
- }
- if (substr($line, 0, 20) == "hostlistAttributes: ") {
- $this->hostlistAttributes = chop(substr($line, 20, strlen($line)-20));
- continue;
- }
- }
- fclose($file);
- }
- else {
- echo _("Unable to load lam.conf! ") . $conffile ; echo "
";
- }
+ // reloads preferences from ../config/lam.conf
+ function reload() {
+ $conffile = substr(__FILE__, 0, strlen(__FILE__) - 15) . "/config/lam.conf";
+ if (is_file($conffile) == True) {
+ $file = fopen($conffile, "r");
+ while (!feof($file)) {
+ $line = fgets($file, 1024);
+ if (($line == "\n")||($line[0] == "#")) continue; // ignore comments
+ // search keywords
+ if (substr($line, 0, 11) == "serverURL: ") {
+ $this->ServerURL = chop(substr($line, 11, strlen($line)-11));
+ continue;
}
+ if (substr($line, 0, 8) == "passwd: ") {
+ $this->Passwd = chop(substr($line, 8, strlen($line)-8));
+ continue;
+ }
+ if (substr($line, 0, 8) == "admins: ") {
+ $adminstr = chop(substr($line, 8, strlen($line)-8));
+ $this->Adminstring = $adminstr;
+ $this->Admins = explode(";", $adminstr);
+ continue;
+ }
+ if (substr($line, 0, 12) == "usersuffix: ") {
+ $this->Suff_users = chop(substr($line, 12, strlen($line)-12));
+ continue;
+ }
+ if (substr($line, 0, 13) == "groupsuffix: ") {
+ $this->Suff_groups = chop(substr($line, 13, strlen($line)-13));
+ continue;
+ }
+ if (substr($line, 0, 12) == "hostsuffix: ") {
+ $this->Suff_hosts = chop(substr($line, 12, strlen($line)-12));
+ continue;
+ }
+ if (substr($line, 0, 8) == "minUID: ") {
+ $this->MinUID = chop(substr($line, 8, strlen($line)-8));
+ continue;
+ }
+ if (substr($line, 0, 8) == "maxUID: ") {
+ $this->MaxUID = chop(substr($line, 8, strlen($line)-8));
+ continue;
+ }
+ if (substr($line, 0, 8) == "minGID: ") {
+ $this->MinGID = chop(substr($line, 8, strlen($line)-8));
+ continue;
+ }
+ if (substr($line, 0, 8) == "maxGID: ") {
+ $this->MaxGID = chop(substr($line, 8, strlen($line)-8));
+ continue;
+ }
+ if (substr($line, 0, 12) == "minMachine: ") {
+ $this->MinMachine = chop(substr($line, 12, strlen($line)-12));
+ continue;
+ }
+ if (substr($line, 0, 12) == "maxMachine: ") {
+ $this->MaxMachine = chop(substr($line, 12, strlen($line)-12));
+ continue;
+ }
+ if (substr($line, 0, 20) == "userlistAttributes: ") {
+ $this->userlistAttributes = chop(substr($line, 20, strlen($line)-20));
+ continue;
+ }
+ if (substr($line, 0, 21) == "grouplistAttributes: ") {
+ $this->grouplistAttributes = chop(substr($line, 21, strlen($line)-21));
+ continue;
+ }
+ if (substr($line, 0, 20) == "hostlistAttributes: ") {
+ $this->hostlistAttributes = chop(substr($line, 20, strlen($line)-20));
+ continue;
+ }
+ }
+ fclose($file);
+ }
+ else {
+ echo _("Unable to load lam.conf! ") . $conffile ; echo "
";
+ }
+ }
- // saves preferences to ../config/lam.conf
- function save() {
- // 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 =
- $save_minUID = $save_maxUID = $save_minGID = $save_maxGID = $save_minMach = $save_maxMach =
- $save_usrlstatrr = $save_grplstatrr = $save_hstlstatrr = False;
- $file = fopen($conffile, "r");
- $file_array = array();
- while (!feof($file)) {
- array_push($file_array, fgets($file, 1024));
- }
- fclose($file);
- for ($i = 0; $i < sizeof($file_array); $i++) {
- if (($file_array[$i] == "\n")||($file_array[$i][0] == "#")) continue; // ignore comments
- // search for keywords
- if (substr($file_array[$i], 0, 11) == "serverURL: ") {
- $file_array[$i] = "serverURL: " . $this->ServerURL . "\n";
- $save_serverURL = True;
- continue;
- }
- if (substr($file_array[$i], 0, 8) == "passwd: ") {
- $file_array[$i] = "passwd: " . $this->Passwd . "\n";
- $save_passwd = True;
- continue;
- }
- if (substr($file_array[$i], 0, 8) == "admins: ") {
- $file_array[$i] = "admins: " . implode(";", $this->Admins) . "\n";
- $save_admins = True;
- continue;
- }
- if (substr($file_array[$i], 0, 12) == "usersuffix: ") {
- $file_array[$i] = "usersuffix: " . $this->Suff_users . "\n";
- $save_suffusr = True;
- continue;
- }
- if (substr($file_array[$i], 0, 13) == "groupsuffix: ") {
- $file_array[$i] = "groupsuffix: " . $this->Suff_groups . "\n";
- $save_suffgrp = True;
- continue;
- }
- if (substr($file_array[$i], 0, 12) == "hostsuffix: ") {
- $file_array[$i] = "hostsuffix: " . $this->Suff_hosts . "\n";
- $save_suffhst = True;
- continue;
- }
- if (substr($file_array[$i], 0, 8) == "minUID: ") {
- $file_array[$i] = "minUID: " . $this->MinUID . "\n";
- $save_minUID = True;
- continue;
- }
- if (substr($file_array[$i], 0, 8) == "maxUID: ") {
- $file_array[$i] = "maxUID: " . $this->MaxUID . "\n";
- $save_maxUID = True;
- continue;
- }
- if (substr($file_array[$i], 0, 8) == "minGID: ") {
- $file_array[$i] = "minGID: " . $this->MinGID . "\n";
- $save_minGID = True;
- continue;
- }
- if (substr($file_array[$i], 0, 8) == "maxGID: ") {
- $file_array[$i] = "maxGID: " . $this->MaxGID . "\n";
- $save_maxGID = True;
- continue;
- }
- if (substr($file_array[$i], 0, 12) == "minMachine: ") {
- $file_array[$i] = "minMachine: " . $this->MinMachine . "\n";
- $save_minMach = True;
- continue;
- }
- if (substr($file_array[$i], 0, 12) == "maxMachine: ") {
- $file_array[$i] = "maxMachine: " . $this->MaxMachine . "\n";
- $save_maxMach = True;
- continue;
- }
- if (substr($file_array[$i], 0, 20) == "userlistAttributes: ") {
- $file_array[$i] = "userlistAttributes: " . $this->userlistAttributes . "\n";
- $save_usrlstattr = True;
- continue;
- }
- if (substr($file_array[$i], 0, 21) == "grouplistAttributes: ") {
- $file_array[$i] = "grouplistAttributes: " . $this->grouplistAttributes . "\n";
- $save_grplstattr = True;
- continue;
- }
- if (substr($file_array[$i], 0, 20) == "hostlistAttributes: ") {
- $file_array[$i] = "hostlistAttributes: " . $this->hostlistAttributes . "\n";
- $save_hstlstattr = True;
- continue;
- }
- }
- // check if we have to add new entries (e.g. if user upgraded LAM and has an old lam.conf)
- if (!$save_serverURL == True) array_push($file_array, "\n\n# server address (e.g. ldap://localhost:389 or ldaps://localhost:636)\n" . "serverURL: " . $this->ServerURL);
- if (!$save_passwd == True) array_push($file_array, "\n\n# password to change these preferences via webfrontend\n" . "passwd: " . $this->Passwd);
- if (!$save_admins == True) array_push($file_array, "\n\n# list of users who are allowed to use LDAP Account Manager\n" .
- "# names have to be seperated by semicolons\n" .
- "# e.g. admins: cn=admin,dc=yourdomain,dc=org;cn=root,dc=yourdomain,dc=org\n" . "admins: " . $this->Admins);
- if (!$save_suffusr == True) array_push($file_array, "\n\n# suffix of users\n" .
- "# e.g. ou=People,dc=yourdomain,dc=org\n" . "usersuffix: " . $this->Suff_users);
- if (!$save_suffgrp == True) array_push($file_array, "\n\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\n# suffix of Samba hosts\n" .
- "# e.g. ou=machines,dc=yourdomain,dc=org\n" . "hostsuffix: " . $this->Suff_hosts);
- if (!$save_minUID == True) array_push($file_array, "\n\n# minimum UID number\n" . "minUID: " . $this->MinUID);
- if (!$save_maxUID == True) array_push($file_array, "\n\n# maximum UID number\n" . "maxUID: " . $this->MaxUID);
- if (!$save_minGID == True) array_push($file_array, "\n\n# minimum GID number\n" . "minGID: " . $this->MinGID);
- if (!$save_maxGID == True) array_push($file_array, "\n\n# maximum GID number\n" . "maxGID: " . $this->MaxGID);
- if (!$save_minMach == True) array_push($file_array, "\n\n# minimum UID number for Samba hosts\n" . "minMachine: " . $this->MinMachine);
- if (!$save_maxMach == True) array_push($file_array, "\n\n# maximum UID number for Samba hosts\n" . "maxMachine: " . $this->MaxMachine);
- if (!$save_usrlstattr == True) array_push($file_array, "\n\n# list of attributes to show in user list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
- "\n# or individual ones (e.g. 'uid:User ID' or 'host:Host Name')\n# values have to be seperated by semicolons\n" . "userlistAttributes: " . $this->userlistAttributes);
- if (!$save_grplstattr == True) array_push($file_array, "\n\n# list of attributes to show in group list\n# entries can either be predefined values (e.g. '#cn' or '#gidNumber')" .
- "\n# or individual ones (e.g. 'cn:Group Name')\n# values have to be seperated by semicolons\n" . "grouplistAttributes: " . $this->grouplistAttributes);
- if (!$save_hstlstattr == True) array_push($file_array, "\n\n# list of attributes to show in host list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
- "\n# or individual ones (e.g. 'cn:Host Name')\n# values have to be seperated by semicolons\n" . "hostlistAttributes: " . $this->hostlistAttributes);
- $file = fopen($conffile, "w");
- if ($file) {
- for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
- fclose($file);
- }
- else {
- echo _("
Cannot open config file!");
- exit;
- }
- }
+ // saves preferences to ../config/lam.conf
+ function save() {
+ // 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 =
+ $save_minUID = $save_maxUID = $save_minGID = $save_maxGID = $save_minMach = $save_maxMach =
+ $save_usrlstatrr = $save_grplstatrr = $save_hstlstatrr = False;
+ $file = fopen($conffile, "r");
+ $file_array = array();
+ while (!feof($file)) {
+ array_push($file_array, fgets($file, 1024));
+ }
+ fclose($file);
+ for ($i = 0; $i < sizeof($file_array); $i++) {
+ if (($file_array[$i] == "\n")||($file_array[$i][0] == "#")) continue; // ignore comments
+ // search for keywords
+ if (substr($file_array[$i], 0, 11) == "serverURL: ") {
+ $file_array[$i] = "serverURL: " . $this->ServerURL . "\n";
+ $save_serverURL = True;
+ continue;
}
+ if (substr($file_array[$i], 0, 8) == "passwd: ") {
+ $file_array[$i] = "passwd: " . $this->Passwd . "\n";
+ $save_passwd = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 8) == "admins: ") {
+ $file_array[$i] = "admins: " . implode(";", $this->Admins) . "\n";
+ $save_admins = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 12) == "usersuffix: ") {
+ $file_array[$i] = "usersuffix: " . $this->Suff_users . "\n";
+ $save_suffusr = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 13) == "groupsuffix: ") {
+ $file_array[$i] = "groupsuffix: " . $this->Suff_groups . "\n";
+ $save_suffgrp = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 12) == "hostsuffix: ") {
+ $file_array[$i] = "hostsuffix: " . $this->Suff_hosts . "\n";
+ $save_suffhst = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 8) == "minUID: ") {
+ $file_array[$i] = "minUID: " . $this->MinUID . "\n";
+ $save_minUID = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 8) == "maxUID: ") {
+ $file_array[$i] = "maxUID: " . $this->MaxUID . "\n";
+ $save_maxUID = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 8) == "minGID: ") {
+ $file_array[$i] = "minGID: " . $this->MinGID . "\n";
+ $save_minGID = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 8) == "maxGID: ") {
+ $file_array[$i] = "maxGID: " . $this->MaxGID . "\n";
+ $save_maxGID = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 12) == "minMachine: ") {
+ $file_array[$i] = "minMachine: " . $this->MinMachine . "\n";
+ $save_minMach = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 12) == "maxMachine: ") {
+ $file_array[$i] = "maxMachine: " . $this->MaxMachine . "\n";
+ $save_maxMach = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 20) == "userlistAttributes: ") {
+ $file_array[$i] = "userlistAttributes: " . $this->userlistAttributes . "\n";
+ $save_usrlstattr = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 21) == "grouplistAttributes: ") {
+ $file_array[$i] = "grouplistAttributes: " . $this->grouplistAttributes . "\n";
+ $save_grplstattr = True;
+ continue;
+ }
+ if (substr($file_array[$i], 0, 20) == "hostlistAttributes: ") {
+ $file_array[$i] = "hostlistAttributes: " . $this->hostlistAttributes . "\n";
+ $save_hstlstattr = True;
+ continue;
+ }
+ }
+ // check if we have to add new entries (e.g. if user upgraded LAM and has an old lam.conf)
+ if (!$save_serverURL == True) array_push($file_array, "\n\n# server address (e.g. ldap://localhost:389 or ldaps://localhost:636)\n" . "serverURL: " . $this->ServerURL);
+ if (!$save_passwd == True) array_push($file_array, "\n\n# password to change these preferences via webfrontend\n" . "passwd: " . $this->Passwd);
+ if (!$save_admins == True) array_push($file_array, "\n\n# list of users who are allowed to use LDAP Account Manager\n" .
+ "# names have to be seperated by semicolons\n" .
+ "# e.g. admins: cn=admin,dc=yourdomain,dc=org;cn=root,dc=yourdomain,dc=org\n" . "admins: " . $this->Admins);
+ if (!$save_suffusr == True) array_push($file_array, "\n\n# suffix of users\n" .
+ "# e.g. ou=People,dc=yourdomain,dc=org\n" . "usersuffix: " . $this->Suff_users);
+ if (!$save_suffgrp == True) array_push($file_array, "\n\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\n# suffix of Samba hosts\n" .
+ "# e.g. ou=machines,dc=yourdomain,dc=org\n" . "hostsuffix: " . $this->Suff_hosts);
+ if (!$save_minUID == True) array_push($file_array, "\n\n# minimum UID number\n" . "minUID: " . $this->MinUID);
+ if (!$save_maxUID == True) array_push($file_array, "\n\n# maximum UID number\n" . "maxUID: " . $this->MaxUID);
+ if (!$save_minGID == True) array_push($file_array, "\n\n# minimum GID number\n" . "minGID: " . $this->MinGID);
+ if (!$save_maxGID == True) array_push($file_array, "\n\n# maximum GID number\n" . "maxGID: " . $this->MaxGID);
+ if (!$save_minMach == True) array_push($file_array, "\n\n# minimum UID number for Samba hosts\n" . "minMachine: " . $this->MinMachine);
+ if (!$save_maxMach == True) array_push($file_array, "\n\n# maximum UID number for Samba hosts\n" . "maxMachine: " . $this->MaxMachine);
+ if (!$save_usrlstattr == True) array_push($file_array, "\n\n# list of attributes to show in user list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
+ "\n# or individual ones (e.g. 'uid:User ID' or 'host:Host Name')\n# values have to be seperated by semicolons\n" . "userlistAttributes: " . $this->userlistAttributes);
+ if (!$save_grplstattr == True) array_push($file_array, "\n\n# list of attributes to show in group list\n# entries can either be predefined values (e.g. '#cn' or '#gidNumber')" .
+ "\n# or individual ones (e.g. 'cn:Group Name')\n# values have to be seperated by semicolons\n" . "grouplistAttributes: " . $this->grouplistAttributes);
+ if (!$save_hstlstattr == True) array_push($file_array, "\n\n# list of attributes to show in host list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
+ "\n# or individual ones (e.g. 'cn:Host Name')\n# values have to be seperated by semicolons\n" . "hostlistAttributes: " . $this->hostlistAttributes);
+ $file = fopen($conffile, "w");
+ if ($file) {
+ for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
+ fclose($file);
+ }
+ else {
+ echo _("
Cannot open config file!");
+ exit;
+ }
+ }
+ }
- // prints current preferences
- function printconf() {
- echo _("ServerURL: ") . $this->ServerURL . "
";
- echo _("Admins: ") . $this->Adminstring . "
";
- echo _("UserSuffix: ") . $this->Suff_users . "
";
- echo _("GroupSuffix: ") . $this->Suff_groups . "
";
- echo _("HostSuffix: ") . $this->Suff_hosts . "
";
- echo _("minUID: ") . $this->MinUID . "
";
- echo _("maxUID: ") . $this->MaxUID . "
";
- echo _("minGID: ") . $this->MinGID . "
";
- echo _("maxGID: ") . $this->MaxGID . "
";
- echo _("minMachine: ") . $this->MinMachine . "
";
- echo _("maxMachine: ") . $this->MaxMachine . "
";
- echo _("userlistAttributes: ") . $this->userlistAttributes . "
";
- echo _("grouplistAttributes: ") . $this->grouplistAttributes . "
";
- echo _("hostlistAttributes: ") . $this->hostlistAttributes;
- }
+ // prints current preferences
+ function printconf() {
+ echo _("ServerURL: ") . $this->ServerURL . "
";
+ echo _("Admins: ") . $this->Adminstring . "
";
+ echo _("UserSuffix: ") . $this->Suff_users . "
";
+ echo _("GroupSuffix: ") . $this->Suff_groups . "
";
+ echo _("HostSuffix: ") . $this->Suff_hosts . "
";
+ echo _("minUID: ") . $this->MinUID . "
";
+ echo _("maxUID: ") . $this->MaxUID . "
";
+ echo _("minGID: ") . $this->MinGID . "
";
+ echo _("maxGID: ") . $this->MaxGID . "
";
+ echo _("minMachine: ") . $this->MinMachine . "
";
+ echo _("maxMachine: ") . $this->MaxMachine . "
";
+ echo _("userlistAttributes: ") . $this->userlistAttributes . "
";
+ echo _("grouplistAttributes: ") . $this->grouplistAttributes . "
";
+ echo _("hostlistAttributes: ") . $this->hostlistAttributes;
+ }
-// functions to read/write preferences
+ // functions to read/write preferences
- // returns the server address as string
- function get_ServerURL() {
- return $this->ServerURL;
- }
+ // returns the server address as string
+ function get_ServerURL() {
+ return $this->ServerURL;
+ }
- // sets the server address
- function set_ServerURL($value) {
- if (is_string($value)) $this->ServerURL = $value;
- else echo _("Config->set_ServerURL failed!");
- }
+ // sets the server address
+ function set_ServerURL($value) {
+ if (is_string($value)) $this->ServerURL = $value;
+ else echo _("Config->set_ServerURL failed!");
+ }
- // returns an array of string with all admin names
- function get_Admins() {
- return $this->Admins;
- }
+ // returns an array of string with all admin names
+ function get_Admins() {
+ return $this->Admins;
+ }
- // needs an array of string containing all admin users
- function set_Admins($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) {
- $b = false;
- break;
- }
- }
- if ($b) $this->Admins = $value;
- }
- else echo _("Config->set_Admins failed!");
+ // needs an array of string containing all admin users
+ function set_Admins($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) {
+ $b = false;
+ break;
}
+ }
+ if ($b) $this->Admins = $value;
+ }
+ else echo _("Config->set_Admins failed!");
+ }
- // returns all admin users seperated by semicolons
- function get_Adminstring() {
- return $this->Adminstring;
- }
+ // returns all admin users seperated by semicolons
+ function get_Adminstring() {
+ return $this->Adminstring;
+ }
- // needs a string that contains all admin users seperated by semicolons
- function set_Adminstring($value) {
- if (is_string($value)) {
- $this->Adminstring = $value;
- $this->Admins = explode(";", $value);
- }
- else echo _("Config->set_Adminstring failed!");
- }
+ // needs a string that contains all admin users seperated by semicolons
+ function set_Adminstring($value) {
+ if (is_string($value)) {
+ $this->Adminstring = $value;
+ $this->Admins = explode(";", $value);
+ }
+ else echo _("Config->set_Adminstring failed!");
+ }
- // returns the password to access the preferences wizard
- function get_Passwd() {
- return $this->Passwd;
- }
+ // returns the password to access the preferences wizard
+ function get_Passwd() {
+ return $this->Passwd;
+ }
- // sets the preferences wizard password
- function set_Passwd($value) {
- if (is_string($value)) $this->Passwd = $value;
- else echo _("Config->set_Passwd failed!");
- }
+ // sets the preferences wizard password
+ function set_Passwd($value) {
+ if (is_string($value)) $this->Passwd = $value;
+ else echo _("Config->set_Passwd failed!");
+ }
- // returns the LDAP suffix where users are saved
- function get_UserSuffix() {
- return $this->Suff_users;
- }
+ // returns the LDAP suffix where users are saved
+ function get_UserSuffix() {
+ return $this->Suff_users;
+ }
- // sets the LDAP suffix where users are saved
- function set_UserSuffix($value) {
- if (is_string($value)) $this->Suff_users = $value;
- else echo _("Config->set_UserSuffix failed!");
- }
+ // sets the LDAP suffix where users are saved
+ function set_UserSuffix($value) {
+ if (is_string($value)) $this->Suff_users = $value;
+ else echo _("Config->set_UserSuffix failed!");
+ }
- // returns the LDAP suffix where groups are saved
- function get_GroupSuffix() {
- return $this->Suff_groups;
- }
+ // returns the LDAP suffix where groups are saved
+ function get_GroupSuffix() {
+ return $this->Suff_groups;
+ }
- // sets the LDAP suffix where groups are saved
- function set_GroupSuffix($value) {
- if (is_string($value)) $this->Suff_groups = $value;
- else echo _("Config->set_GroupSuffix failed!");
- }
+ // sets the LDAP suffix where groups are saved
+ function set_GroupSuffix($value) {
+ if (is_string($value)) $this->Suff_groups = $value;
+ else echo _("Config->set_GroupSuffix failed!");
+ }
- // returns the LDAP suffix where hosts are saved
- function get_HostSuffix() {
- return $this->Suff_hosts;
- }
+ // returns the LDAP suffix where hosts are saved
+ function get_HostSuffix() {
+ return $this->Suff_hosts;
+ }
- // sets the LDAP suffix where hosts are saved
- function set_HostSuffix($value) {
- if (is_string($value)) $this->Suff_hosts = $value;
- else echo _("Config->set_HostSuffix failed!");
- }
+ // sets the LDAP suffix where hosts are saved
+ function set_HostSuffix($value) {
+ if (is_string($value)) $this->Suff_hosts = $value;
+ else echo _("Config->set_HostSuffix failed!");
+ }
- // returns the minimum UID to use when creating new users
- function get_minUID() {
- return $this->MinUID;
- }
+ // returns the minimum UID to use when creating new users
+ function get_minUID() {
+ return $this->MinUID;
+ }
- // sets the minimum UID to use when creating new users
- function set_minUID($value) {
- if (is_numeric($value)) $this->MinUID = $value;
- else echo _("Config->set_minUID failed!");
- }
+ // sets the minimum UID to use when creating new users
+ function set_minUID($value) {
+ if (is_numeric($value)) $this->MinUID = $value;
+ else echo _("Config->set_minUID failed!");
+ }
- // returns the maximum UID to use when creating new users
- function get_maxUID() {
- return $this->MaxUID;
- }
+ // returns the maximum UID to use when creating new users
+ function get_maxUID() {
+ return $this->MaxUID;
+ }
- // sets the maximum UID to use when creating new users
- function set_maxUID($value) {
- if (is_numeric($value)) $this->MaxUID = $value;
- else echo _("Config->set_maxUID failed!");
- }
+ // sets the maximum UID to use when creating new users
+ function set_maxUID($value) {
+ if (is_numeric($value)) $this->MaxUID = $value;
+ else echo _("Config->set_maxUID failed!");
+ }
- // returns the minimum GID to use when creating new groups
- function get_minGID() {
- return $this->MinGID;
- }
+ // returns the minimum GID to use when creating new groups
+ function get_minGID() {
+ return $this->MinGID;
+ }
- // sets the minimum GID to use when creating new groups
- function set_minGID($value) {
- if (is_numeric($value)) $this->MinGID = $value;
- else echo _("Config->set_minGID failed!");
- }
+ // sets the minimum GID to use when creating new groups
+ function set_minGID($value) {
+ if (is_numeric($value)) $this->MinGID = $value;
+ else echo _("Config->set_minGID failed!");
+ }
- // returns the maximum GID to use when creating new groups
- function get_maxGID() {
- return $this->MaxGID;
- }
+ // returns the maximum GID to use when creating new groups
+ function get_maxGID() {
+ return $this->MaxGID;
+ }
- // sets the maximum GID to use when creating new groups
- function set_maxGID($value) {
- if (is_numeric($value)) $this->MaxGID = $value;
- else echo _("Config->set_maxGID failed!");
- }
+ // sets the maximum GID to use when creating new groups
+ function set_maxGID($value) {
+ if (is_numeric($value)) $this->MaxGID = $value;
+ else echo _("Config->set_maxGID failed!");
+ }
- // returns the minimum UID to use when creating new Samba hosts
- function get_minMachine() {
- return $this->MinMachine;
- }
+ // returns the minimum UID to use when creating new Samba hosts
+ function get_minMachine() {
+ return $this->MinMachine;
+ }
- // sets the minimum UID to use when creating new Samba hosts
- function set_minMachine($value) {
- if (is_numeric($value)) $this->MinMachine = $value;
- else echo _("Config->set_minMachine failed!");
- }
+ // sets the minimum UID to use when creating new Samba hosts
+ function set_minMachine($value) {
+ if (is_numeric($value)) $this->MinMachine = $value;
+ else echo _("Config->set_minMachine failed!");
+ }
- // returns the maximum UID to use when creating new Samba hosts
- function get_maxMachine() {
- return $this->MaxMachine;
- }
+ // returns the maximum UID to use when creating new Samba hosts
+ function get_maxMachine() {
+ return $this->MaxMachine;
+ }
- // sets the maximum UID to use when creating new Samba hosts
- function set_maxMachine($value) {
- if (is_numeric($value)) $this->MaxMachine = $value;
- else echo _("Config->set_maxMachine failed!");
- }
+ // sets the maximum UID to use when creating new Samba hosts
+ function set_maxMachine($value) {
+ if (is_numeric($value)) $this->MaxMachine = $value;
+ else echo _("Config->set_maxMachine failed!");
+ }
- // returns the list of attributes to show in user list
- function get_userlistAttributes() {
- return $this->userlistAttributes;
- }
+ // returns the list of attributes to show in user list
+ function get_userlistAttributes() {
+ return $this->userlistAttributes;
+ }
- // sets the list of attributes to show in user list
- function set_userlistAttributes($value) {
- if (is_string($value)) $this->userlistAttributes = $value;
- else echo _("Config->set_userlistAttributes failed!");
- }
+ // sets the list of attributes to show in user list
+ function set_userlistAttributes($value) {
+ if (is_string($value)) $this->userlistAttributes = $value;
+ else echo _("Config->set_userlistAttributes failed!");
+ }
- // returns the list of attributes to show in group list
- function get_grouplistAttributes() {
- return $this->grouplistAttributes;
- }
+ // returns the list of attributes to show in group list
+ function get_grouplistAttributes() {
+ return $this->grouplistAttributes;
+ }
- // sets the list of attributes to show in group list
- function set_grouplistAttributes($value) {
- if (is_string($value)) $this->grouplistAttributes = $value;
- else echo _("Config->set_grouplistAttributes failed!");
- }
+ // sets the list of attributes to show in group list
+ function set_grouplistAttributes($value) {
+ if (is_string($value)) $this->grouplistAttributes = $value;
+ else echo _("Config->set_grouplistAttributes failed!");
+ }
- // returns the list of attributes to show in host list
- function get_hostlistAttributes() {
- return $this->hostlistAttributes;
- }
+ // returns the list of attributes to show in host list
+ function get_hostlistAttributes() {
+ return $this->hostlistAttributes;
+ }
+
+ // sets the list of attributes to show in host list
+ function set_hostlistAttributes($value) {
+ if (is_string($value)) $this->hostlistAttributes = $value;
+ else echo _("Config->set_hostlistAttributes failed!");
+ }
+
+ /**
+ *
+ *
+ *
+ * @return maxlistentries
+ */
+ function get_MaxListEntries() {
+ return $this->maxlistentries;
+ }
+
+ /**
+ * @brief sets the maximum of entries to display on one page of the lists
+ *
+ * @param value maximum count of entries on one page
+ *
+ * @return
+ */
+ function set_MaxListEntries ($value) {
+ if (is_numeric($value)) $this->maxlistentries = $value;
+ else echo _("Config->set_MaxListEntries failed!");
+ }
- // sets the list of attributes to show in host list
- function set_hostlistAttributes($value) {
- if (is_string($value)) $this->hostlistAttributes = $value;
- else echo _("Config->set_hostlistAttributes failed!");
- }
}
diff --git a/lam/templates/config/confsave.php b/lam/templates/config/confsave.php
index c18e3f09..dc9b4086 100644
--- a/lam/templates/config/confsave.php
+++ b/lam/templates/config/confsave.php
@@ -49,6 +49,7 @@ if ($_POST['maxMach']) $maxMach = $_POST['maxMach'];
if ($_POST['usrlstattr']) $usrlstattr = $_POST['usrlstattr'];
if ($_POST['grplstattr']) $grplstattr = $_POST['grplstattr'];
if ($_POST['hstlstattr']) $hstlstattr = $_POST['hstlstattr'];
+if ($_POST['maxlistentries']) $maxlistentries = $_POST['maxlistentries'];
// check if password is correct
// if not: load login page
@@ -130,6 +131,11 @@ if (chop($hstlstattr) == "") {
echo ("\n
" . _("Back to preferences...") . "");
exit;
}
+if (chop($maxlistentries) == "") {
+ echo _("" . _("Max list entries is empty!") . "");
+ echo ("\n
" . _("Back to preferences...") . "");
+ exit;
+}
// set new preferences
$conf->set_ServerURL($serverurl);
@@ -146,6 +152,7 @@ $conf->set_maxMachine($maxMach);
$conf->set_userlistAttributes($usrlstattr);
$conf->set_grouplistAttributes($grplstattr);
$conf->set_hostlistAttributes($hstlstattr);
+$conf->set_MaxListEntries($maxlistentries);
// check if password was changed
if ($pass1 != $pass2) {