get_<scope>Suffix() -> get_Suffix(<scope>)

This commit is contained in:
Roland Gruber 2005-03-10 20:20:00 +00:00
parent 6a24c59694
commit 0061cee082
22 changed files with 92 additions and 187 deletions

View File

@ -199,7 +199,7 @@ class cache {
foreach ($scopes as $scope) {
// Get Scope
If ($scope != '*')
$suffix = call_user_func(array($_SESSION['config'], 'get_'.ucfirst($scope).'Suffix'));
$suffix = $_SESSION['config']->get_Suffix($scope);
else $suffix = '';
// Get Data from ldap
$search = $this->attributes[$scope];
@ -239,9 +239,8 @@ class cache {
$allowed_types = array ( 'user', 'group', 'host', '*' );
for ($i=0; $i<count($allowed_types); $i++) {
if ($allowed_types[$i]!='*') {
// *** fixme, where is get_DomainSuffix
If ($scope != '*')
$suffix = call_user_func(array($_SESSION['config'], 'get_'.ucfirst($allowed_types[$i]).'Suffix'));
$suffix = $_SESSION['config']->get_Suffix($allowed_types[$i]);
else $suffix = '';
if (substr($suffix, $dn)) $singlescope = $allowed_types[$i];
}
@ -252,7 +251,7 @@ class cache {
// Get Scope
foreach ($allowed_types as $scope) {
if ($scope!='*') {
$suffix = call_user_func(array($_SESSION['config'], 'get_'.ucfirst($scope).'Suffix'));
$suffix = $_SESSION['config']->get_Suffix($scope);
if (strpos($dn, $suffix)) $singlescope = $scope;
}
}

View File

@ -443,100 +443,6 @@ class Config {
return true;
}
/**
* Returns the LDAP suffix where users are saved
*
* @return string the user suffix
*/
function get_UserSuffix() {
return $this->usersuffix;
}
/**
* Sets the LDAP suffix where users are saved
*
* @param string $value new user suffix
* @return boolean true if $value has correct format
*/
function set_UserSuffix($value) {
if (is_string($value)) {
$this->usersuffix = $value;
}
else return false;
return true;
}
/**
* returns the LDAP suffix where groups are saved
*
* @return string the group suffix
*/
function get_GroupSuffix() {
return $this->groupsuffix;
}
/**
* Sets the LDAP suffix where groups are saved
*
* @param string $value new group suffix
* @return boolean true if $value has correct format
*/
function set_GroupSuffix($value) {
if (is_string($value)) {
$this->groupsuffix = $value;
}
else return false;
return true;
}
/**
* returns the LDAP suffix where hosts are saved
*
* @return string the host suffix
*/
function get_HostSuffix() {
return $this->hostsuffix;
}
/**
* Sets the LDAP suffix where hosts are saved
*
* @param string $value new host suffix
* @return boolean true if $value has correct format
*/
function set_HostSuffix($value) {
if (! $value) $this->hostsuffix = "";
elseif (is_string($value)) {
$this->hostsuffix = $value;
}
else return false;
return true;
}
/**
* Returns the LDAP suffix where domains are saved
*
* @return string the domain suffix
*/
function get_DomainSuffix() {
return $this->domainsuffix;
}
/**
* Sets the LDAP suffix where domains are saved
*
* @param string $value new domain suffix
* @return boolean true if $value has correct format
*/
function set_DomainSuffix($value) {
if (!$value) $this->domainsuffix = "";
elseif (is_string($value)) {
$this->domainsuffix = $value;
}
else return false;
return true;
}
/**
* Returns the LDAP suffix for the given account type
*

View File

@ -720,7 +720,7 @@ class accountContainer {
if (count($table)!=0) $return[] = array ( 0 => array ( 'kind' => 'table', 'value' => $table ) );
// loop through all suffixes
$rootsuffix = call_user_func(array($_SESSION['config'], 'get_' . ucfirst($this->type) . 'Suffix'));
$rootsuffix = $_SESSION['config']->get_Suffix($this->type);
foreach ($_SESSION['ldap']->search_units($rootsuffix) as $suffix) {
if ($this->dn == $suffix) $option_selected = $suffix;
$suffixes[] = $suffix;

View File

@ -729,7 +729,7 @@ class posixGroup extends baseModule {
$DNs = array_keys($result);
for ($i=0; $i<count($DNs); $i++) {
// Get Domain SID from name
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
// Get Domain-SID from group SID
$domainSID = substr($result[$DNs[$i]], 0, strrpos($result[$DNs[$i]], "-"));
for ($i=0; $i<count($sambaDomains); $i++ )

View File

@ -70,7 +70,7 @@ class sambaGroupMapping extends baseModule {
*/
function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts) {
// search existing Samba 3 domains
$domains = search_domains($_SESSION['config']->get_domainSuffix());
$domains = search_domains($_SESSION['config']->get_Suffix('domain'));
$nameToSID = array();
// get domain SIDs
for ($i = 0; $i < sizeof($domains); $i++) {
@ -144,7 +144,7 @@ class sambaGroupMapping extends baseModule {
*/
function display_html_attributes(&$post) {
// Get Domain SID from name
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
// Get Domain-SID from group SID
if ($this->attributes['sambaSID'][0]!='')
$domainSID = substr($this->attributes['sambaSID'][0], 0, strrpos($this->attributes['sambaSID'][0], "-"));
@ -229,7 +229,7 @@ class sambaGroupMapping extends baseModule {
// upload fields
// search existing Samba 3 domains
if ($_SESSION['loggedIn']) {
$domains = search_domains($_SESSION['config']->get_domainSuffix());
$domains = search_domains($_SESSION['config']->get_Suffix('domain'));
$domainNames = array();
for ($i = 0; $i < sizeof($domains); $i++) $domainNames[] = $domains[$i]->name;
$return['upload_columns'] = array(
@ -312,7 +312,7 @@ class sambaGroupMapping extends baseModule {
function get_profileOptions() {
$return = array();
// get list of domains
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
$sambaDomainNames = array();
for ($i = 0; $i < count($sambaDomains); $i++ ) {
// extract names
@ -335,7 +335,7 @@ class sambaGroupMapping extends baseModule {
function load_profile($profile) {
if (isset($profile['sambaGroupMapping_sambaDomainName'][0])) {
// get list of domains
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
for ($i = 0; $i < sizeof($sambaDomains); $i++) {
if ($sambaDomains[$i]->name == $profile['sambaGroupMapping_sambaDomainName'][0]) {
$this->attributes['sambaSID'][0] = $sambaDomains[$i]->SID . "-0";
@ -398,7 +398,7 @@ class sambaGroupMapping extends baseModule {
$this->attributes['sambaGroupType'][0] = $this->sambaGroupTypes[$post['sambaGroupType']];
// Get Domain SID from name
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
for ($i=0; $i<count($sambaDomains); $i++ )
if ($post['sambaDomainName'] == $sambaDomains[$i]->name) {
$SID = $sambaDomains[$i]->SID;
@ -443,7 +443,7 @@ class sambaGroupMapping extends baseModule {
*/
function save_attributes() {
// Get Domain SID from name
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
// Get Domain-SID from group SID
$domainSID = substr($this->attributes['sambaSID'][0], 0, strrpos($this->attributes['sambaSID'][0], "-"));
for ($i=0; $i<count($sambaDomains); $i++ )

View File

@ -443,7 +443,7 @@ class sambaSamAccount extends baseModule {
* it's psssible uidNumber has changed
*/
// Get Domain SID from name
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
for ($i=0; $i<count($sambaDomains); $i++ )
if ($this->attributes['sambaDomainName'][0] == $sambaDomains[$i]->name) {
$SID = $sambaDomains[$i]->SID;
@ -502,7 +502,7 @@ class sambaSamAccount extends baseModule {
// Save attributes
$this->attributes['sambaDomainName'][0] = $post['sambaDomainName'];
// Get Domain SID from name
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
for ($i=0; $i<count($sambaDomains); $i++ )
if ($this->attributes['sambaDomainName'][0] == $sambaDomains[$i]->name) {
$SID = $sambaDomains[$i]->SID;
@ -692,7 +692,7 @@ class sambaSamAccount extends baseModule {
*/
function display_html_attributes(&$post) {
// Get Domain SID from name
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
for ($i=0; $i<count($sambaDomains); $i++ ) {
$sambaDomainNames[] = $sambaDomains[$i]->name;
if ($this->attributes['sambaDomainName'][0] == $sambaDomains[$i]->name)
@ -917,7 +917,7 @@ class sambaSamAccount extends baseModule {
2 => array('kind' => 'help', 'value' => 'workstations')
);
// domains
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
$sambaDomainNames = array();
for ($i = 0; $i < count($sambaDomains); $i++) {
$sambaDomainNames[] = $sambaDomains[$i]->name;
@ -930,7 +930,7 @@ class sambaSamAccount extends baseModule {
}
elseif ($this->get_scope() == 'host') {
// domains
$sambaDomains = search_domains($_SESSION['config']->get_domainSuffix());
$sambaDomains = search_domains($_SESSION['config']->get_Suffix('domain'));
$sambaDomainNames = array();
for ($i = 0; $i < count($sambaDomains); $i++) {
$sambaDomainNames[] = $sambaDomains[$i]->name;
@ -1011,7 +1011,7 @@ class sambaSamAccount extends baseModule {
function build_uploadAccounts($rawAccounts, $ids, &$partialAccounts) {
$triggered_messages = array();
// get list of Samba 3 domains
$domains = search_domains($_SESSION['config']->get_DomainSuffix());
$domains = search_domains($_SESSION['config']->get_Suffix('domain'));
// get list of Unix groups and their sambaSID + gidNumber
$groups = $_SESSION['cache']->get_cache('cn', 'posixGroup', 'group');
$groups_SID = $_SESSION['cache']->get_cache('sambaSID', 'sambaGroupMapping', 'group');

View File

@ -119,10 +119,10 @@ if (isset($_GET["modulesback"])) {
$conf->set_ServerURL($_SESSION['conf_serverurl']);
$conf->set_cacheTimeout($_SESSION['conf_cachetimeout']);
$conf->set_Adminstring($_SESSION['conf_admins']);
$conf->set_UserSuffix($_SESSION['conf_suffusers']);
$conf->set_GroupSuffix($_SESSION['conf_suffgroups']);
$conf->set_HostSuffix($_SESSION['conf_suffhosts']);
$conf->set_DomainSuffix($_SESSION['conf_suffdomains']);
$conf->set_Suffix('user', $_SESSION['conf_suffusers']);
$conf->set_Suffix('group', $_SESSION['conf_suffgroups']);
$conf->set_Suffix('host', $_SESSION['conf_suffhosts']);
$conf->set_Suffix('domain', $_SESSION['conf_suffdomains']);
$conf->set_Suffix('tree', $_SESSION['conf_sufftree']);
$conf->set_userlistAttributes($_SESSION['conf_usrlstattr']);
$conf->set_grouplistAttributes($_SESSION['conf_grplstattr']);
@ -170,25 +170,25 @@ echo ("<tr><td colspan=3>&nbsp</td></tr>");
// user suffix
echo ("<tr><td align=\"right\"><b>".
_("UserSuffix") . ": </b></td>".
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffusers\" value=\"" . $conf->get_UserSuffix() . "\"></td>\n");
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffusers\" value=\"" . $conf->get_Suffix('user') . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
$tabindex++;
// group suffix
echo ("<tr><td align=\"right\"><b>".
_("GroupSuffix") . ": </b></td>".
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffgroups\" value=\"" . $conf->get_GroupSuffix() . "\"></td>\n");
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffgroups\" value=\"" . $conf->get_Suffix('group') . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
$tabindex++;
// host suffix
echo ("<tr><td align=\"right\"><b>".
_("HostSuffix") . ": </b></td>".
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffhosts\" value=\"" . $conf->get_HostSuffix() . "\"></td>\n");
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffhosts\" value=\"" . $conf->get_Suffix('host') . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
$tabindex++;
// domain suffix
echo ("<tr><td align=\"right\"><b>".
_("DomainSuffix") . " **: </b></td>".
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffdomains\" value=\"" . $conf->get_DomainSuffix() . "\"></td>\n");
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"suffdomains\" value=\"" . $conf->get_Suffix('domain') . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=202\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
$tabindex++;
// tree suffix

View File

@ -103,22 +103,22 @@ if (!$conf->set_Adminstring($admins)) {
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}
if (!$conf->set_UserSuffix($suffusers)) {
if (!$conf->set_Suffix('user', $suffusers)) {
echo ("<font color=\"red\"><b>" . _("UserSuffix is invalid!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}
if (!$conf->set_GroupSuffix($suffgroups)) {
if (!$conf->set_Suffix('group', $suffgroups)) {
echo ("<font color=\"red\"><b>" . _("GroupSuffix is invalid!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}
if (!$conf->set_HostSuffix($suffhosts)) {
if (!$conf->set_Suffix('host', $suffhosts)) {
echo ("<font color=\"red\"><b>" . _("HostSuffix is invalid!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}
if (!$conf->set_DomainSuffix($suffdomains)) {
if (!$conf->set_Suffix('domain', $suffdomains)) {
echo ("<font color=\"red\"><b>" . _("DomainSuffix is invalid!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;

View File

@ -45,9 +45,9 @@ setlanguage();
// add/edit domain
if (($_GET['action'] == "edit") || ($_GET['action'] == "new")) {
// get list of domains
$domlist = search_domains($_SESSION['config']->get_domainSuffix());
$domlist = search_domains($_SESSION['config']->get_Suffix('domain'));
// get possible suffixes
$domsuff = $_SESSION['ldap']->search_units($_SESSION['config']->get_domainSuffix());
$domsuff = $_SESSION['ldap']->search_units($_SESSION['config']->get_Suffix('domain'));
if ($_GET['action'] == "edit") {
// remove "\'"
$_GET['DN'] = str_replace("\\", "", $_GET['DN']);
@ -66,7 +66,7 @@ if (($_GET['action'] == "edit") || ($_GET['action'] == "new")) {
}
else {
$domain = new samba3domain();
$domain_suffix = $_SESSION['config']->get_domainSuffix();
$domain_suffix = $_SESSION['config']->get_Suffix('domain');
}
// display page
echo $_SESSION['header'];
@ -233,7 +233,7 @@ elseif ($_POST['sub_save']) {
echo "<body>\n";
// check input
if ($_POST['add']) { // check for existing domains
$suffix = $_SESSION['config']->get_DomainSuffix();
$suffix = $_SESSION['config']->get_Suffix('domain');
$server = $_SESSION['ldap']->server;
$filter = "(|(sambasid=" . $_POST['dom_SID'] . ")(sambadomainname=" . $_POST['dom_name'] . "))";
$sr = @ldap_search($server, $suffix, $filter, array());

View File

@ -106,7 +106,7 @@ else $sort = strtolower($attr_array[0]);
// check search suffix
if (isset($_POST['suffix'])) $suffix = $_POST['suffix']; // new suffix selected via combobox
elseif (isset($_SESSION[$scope . '_suffix'])) $suffix = $_SESSION[$scope . '_suffix']; // old suffix from session
else $suffix = $_SESSION["config"]->get_DomainSuffix(); // default suffix
else $suffix = $_SESSION["config"]->get_Suffix($scope); // default suffix
$refresh = true;
if (isset($_GET['norefresh'])) $refresh = false;
@ -198,7 +198,7 @@ echo ("<br>\n");
if ($refresh) {
// generate list of possible suffixes
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_DomainSuffix());
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix($scope));
}
// print combobox with possible sub-DNs

View File

@ -108,7 +108,7 @@ else $sort = strtolower($attr_array[0]);
// check search suffix
if ($_POST['suffix']) $suffix = $_POST['suffix']; // new suffix selected via combobox
elseif ($_SESSION[$scope . '_suffix']) $suffix = $_SESSION[$scope . '_suffix']; // old suffix from session
else $suffix = $_SESSION["config"]->get_GroupSuffix(); // default suffix
else $suffix = $_SESSION["config"]->get_Suffix($scope); // default suffix
$refresh = true;
if (isset($_GET['norefresh'])) $refresh = false;
@ -246,7 +246,7 @@ echo ("<br>\n");
if ($refresh) {
// generate list of possible suffixes
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_GroupSuffix());
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix($scope));
}
// print combobox with possible sub-DNs

View File

@ -108,7 +108,7 @@ else $sort = strtolower($attr_array[0]);
// check search suffix
if ($_POST['suffix']) $suffix = $_POST['suffix']; // new suffix selected via combobox
elseif ($_SESSION[$scope . '_suffix']) $suffix = $_SESSION[$scope . '_suffix']; // old suffix from session
else $suffix = $_SESSION["config"]->get_HostSuffix(); // default suffix
else $suffix = $_SESSION["config"]->get_Suffix($scope); // default suffix
$refresh = true;
if (isset($_GET['norefresh'])) $refresh = false;
@ -230,7 +230,7 @@ echo ("<br>\n");
if ($refresh) {
// generate list of possible suffixes
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_HostSuffix());
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix($scope));
}
// print combobox with possible sub-DNs

View File

@ -68,7 +68,7 @@ else $trans_primary_hash = array();
// generate hash table for group translation
if ($trans_primary == "on" && ($refresh || (sizeof($trans_primary_hash) == 0))) {
$trans_primary_hash = array();
$grp_suffix = $_SESSION['config']->get_groupSuffix();
$grp_suffix = $_SESSION['config']->get_Suffix('group');
$filter = "objectClass=posixGroup";
$attrs = array("cn", "gidNumber");
$sr = @ldap_search($_SESSION["ldap"]->server(), $grp_suffix, $filter, $attrs);
@ -137,7 +137,7 @@ else $sort = strtolower($attr_array[0]);
// check search suffix
if (isset($_POST['suffix'])) $suffix = $_POST['suffix']; // new suffix selected via combobox
elseif (isset($_SESSION[$scope . '_suffix'])) $suffix = $_SESSION[$scope . '_suffix']; // old suffix from session
else $suffix = $_SESSION["config"]->get_UserSuffix(); // default suffix
else $suffix = $_SESSION["config"]->get_Suffix($scope); // default suffix
// configure search filter for LDAP
@ -277,7 +277,7 @@ if (sizeof($info) != 0) {
if ($refresh) {
// generate list of possible suffixes
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_UserSuffix());
$units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix($scope));
}
// print combobox with possible sub-DNs

View File

@ -76,7 +76,7 @@ else {
function search_username($name) {
$filter = "(uid=$name)";
$attrs = array();
$sr = @ldap_search($_SESSION['ldap']->server, $_SESSION['config']->get_UserSuffix(), $filter, $attrs);
$sr = @ldap_search($_SESSION['ldap']->server, $_SESSION['config']->get_Suffix('user'), $filter, $attrs);
if ($sr) {
$info = ldap_get_entries($_SESSION['ldap']->server, $sr);
// return only first DN entry

View File

@ -41,32 +41,32 @@ $startPage = "";
// check if all suffixes in conf-file exist
$conf = $_SESSION['config'];
$new_suffs = array();
if ($conf->get_UserSuffix() && ($conf->get_UserSuffix() != "")) {
if ($conf->get_Suffix('user') && ($conf->get_Suffix('user') != "")) {
$startPage = "./lists/listusers.php";
$info = @ldap_search($_SESSION['ldap']->server, $conf->get_UserSuffix(), "", array());
$info = @ldap_search($_SESSION['ldap']->server, $conf->get_Suffix('user'), "", array());
$res = @ldap_get_entries($_SESSION['ldap']->server, $info);
if (!$res && !in_array($conf->get_UserSuffix(), $new_suffs)) $new_suffs[] = $conf->get_UserSuffix();
if (!$res && !in_array($conf->get_Suffix('user'), $new_suffs)) $new_suffs[] = $conf->get_Suffix('user');
}
if ($conf->get_GroupSuffix() && ($conf->get_GroupSuffix() != "")) {
if ($conf->get_Suffix('group') && ($conf->get_Suffix('group') != "")) {
if ($startPage == "") {
$startPage = "./lists/listgroups.php";
}
$info = @ldap_search($_SESSION['ldap']->server, $conf->get_GroupSuffix(), "", array());
$info = @ldap_search($_SESSION['ldap']->server, $conf->get_Suffix('group'), "", array());
$res = @ldap_get_entries($_SESSION['ldap']->server, $info);
if (!$res && !in_array($conf->get_GroupSuffix(), $new_suffs)) $new_suffs[] = $conf->get_GroupSuffix();
if (!$res && !in_array($conf->get_Suffix('group'), $new_suffs)) $new_suffs[] = $conf->get_Suffix('group');
}
if ($conf->get_HostSuffix() && ($conf->get_HostSuffix() != "")) {
if ($conf->get_Suffix('host') && ($conf->get_Suffix('host') != "")) {
if ($startPage == "") {
$startPage = "./lists/listhosts.php";
}
$info = @ldap_search($_SESSION['ldap']->server, $conf->get_HostSuffix(), "", array());
$info = @ldap_search($_SESSION['ldap']->server, $conf->get_Suffix('host'), "", array());
$res = @ldap_get_entries($_SESSION['ldap']->server, $info);
if (!$res && !in_array($conf->get_HostSuffix(), $new_suffs)) $new_suffs[] = $conf->get_HostSuffix();
if (!$res && !in_array($conf->get_Suffix('host'), $new_suffs)) $new_suffs[] = $conf->get_Suffix('host');
}
if ($conf->get_DomainSuffix() && ($conf->get_DomainSuffix() != "")) {
$info = @ldap_search($_SESSION['ldap']->server, $conf->get_DomainSuffix(), "", array());
if ($conf->get_Suffix('domain') && ($conf->get_Suffix('domain') != "")) {
$info = @ldap_search($_SESSION['ldap']->server, $conf->get_Suffix('domain'), "", array());
$res = @ldap_get_entries($_SESSION['ldap']->server, $info);
if (!$res && !in_array($conf->get_DomainSuffix(), $new_suffs)) $new_suffs[] = $conf->get_DomainSuffix();
if (!$res && !in_array($conf->get_Suffix('domain'), $new_suffs)) $new_suffs[] = $conf->get_Suffix('domain');
}
// get encoding

View File

@ -41,9 +41,9 @@ echo $_SESSION['header'];
// number of list views (users, groups, ...)
$lists = 0;
if ($_SESSION['config']->get_Usersuffix() != "") $lists++;
if ($_SESSION['config']->get_Groupsuffix() != "") $lists++;
if ($_SESSION['config']->get_Hostsuffix() != "") $lists++;
if ($_SESSION['config']->get_Suffix('user') != "") $lists++;
if ($_SESSION['config']->get_Suffix('group') != "") $lists++;
if ($_SESSION['config']->get_Suffix('host') != "") $lists++;
if ($_SESSION['config']->get_Suffix('tree') != "") $lists++;
?>
@ -77,13 +77,13 @@ if ($_SESSION['config']->get_Suffix('tree') != "") $lists++;
if ($_SESSION['config']->get_Suffix('tree') != "") {
echo '<td width="120" align="center"><a href="./tree/tree_view.php" target="mainpart"><big>' . _("Tree view") . '</big></a></td>' . "\n";
}
if ($_SESSION['config']->get_Usersuffix() != "") {
if ($_SESSION['config']->get_Suffix('user') != "") {
echo '<td width="120" align="center"><a href="./lists/listusers.php" target="mainpart"><big>' . _("Users") . '</big></a></td>' . "\n";
}
if ($_SESSION['config']->get_Groupsuffix() != "") {
if ($_SESSION['config']->get_Suffix('group') != "") {
echo '<td width="120" align="center"><a href="./lists/listgroups.php" target="mainpart"><big>' . _("Groups") . '</big></a></td>' . "\n";
}
if ($_SESSION['config']->get_Hostsuffix() != "") {
if ($_SESSION['config']->get_Suffix('host') != "") {
echo '<td width="120" align="center"><a href="./lists/listhosts.php" target="mainpart"><big>' . _("Hosts") . '</big></a></td>' . "\n";
}
?>

View File

@ -165,7 +165,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
// TODO check against list of possible RDN attributes
else {
$account_dn = $data[$i][$ids['dn_rdn']] . "=" . $accounts[$i][$data[$i][$ids['dn_rdn']]] . ",";
if ($data[$i][$ids['dn_suffix']] == "") $account_dn = $account_dn . call_user_func(array($_SESSION['config'], "get_" . ucfirst($_POST['scope']) . "Suffix"));
if ($data[$i][$ids['dn_suffix']] == "") $account_dn = $account_dn . $_SESSION['config']->get_Suffix($_POST['scope']);
else $account_dn = $account_dn . $data[$i][$ids['dn_suffix']];
$accounts[$i]['dn'] = $account_dn;
}

View File

@ -144,7 +144,7 @@ function showMainPage($scope) {
echo "<ul>\n";
echo "<li><b>" . _("Identifier") . ":</b> " . "dn_suffix</li>\n";
echo "<li><b>" . _("Example value") . ":</b> " . "ou=accounts,dc=yourdomain,dc=org</li>\n";
echo "<li><b>" . _("Default value") . ":</b> " . call_user_func(array($_SESSION['config'], 'get_' . ucfirst($scope) . 'Suffix')) . "</li>\n";
echo "<li><b>" . _("Default value") . ":</b> " . $_SESSION['config']->get_Suffix($scope) . "</li>\n";
echo "<li>\n";
echo "<a href=\"help.php?HelpNumber=361\" target=\"lamhelp\">" . _("Help") . "</a>\n";
echo "</li>\n";
@ -232,10 +232,10 @@ function showMainPage($scope) {
echo "</tr>\n";
echo "<tr>\n";
// DN attributes
$sampleCSV_row[] = "\"" . call_user_func(array($_SESSION['config'], 'get_' . ucfirst($scope) . 'Suffix')) . "\"";
$sampleCSV_row[] = "\"" . $_SESSION['config']->get_Suffix($scope) . "\"";
$sampleCSV_row[] = "\"" . array_shift(getRDNAttributes($scope)) . "\"";
echo "<td>\n";
echo call_user_func(array($_SESSION['config'], 'get_' . ucfirst($scope) . 'Suffix'));
echo $_SESSION['config']->get_Suffix($scope);
echo "</td>\n";
echo "<td>\n";
echo array_shift(getRDNAttributes($scope));

View File

@ -330,9 +330,9 @@ function display_main() {
echo ("<form action=\"ou_edit.php?type=user\" method=\"post\">\n");
// user OUs
if ($_SESSION["config"]->get_UserSuffix() != "") {
if ($_SESSION["config"]->get_Suffix('user') != "") {
// generate lists of possible suffixes
$usr_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_UserSuffix());
$usr_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix('user'));
echo ("<fieldset><legend><b>" . _("Users") . "</b></legend>\n");
echo ("<table border=0>\n");
// new OU
@ -367,9 +367,9 @@ function display_main() {
}
// group OUs
if ($_SESSION["config"]->get_GroupSuffix() != "") {
if ($_SESSION["config"]->get_Suffix('group') != "") {
// generate lists of possible suffixes
$grp_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_GroupSuffix());
$grp_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix('group'));
echo ("<fieldset><legend><b>" . _("Groups") . "</b></legend>\n");
echo ("<table border=0>\n");
// new OU
@ -404,9 +404,9 @@ function display_main() {
}
// host OUs
if ($_SESSION["config"]->get_HostSuffix() != "") {
if ($_SESSION["config"]->get_Suffix('host') != "") {
// generate lists of possible suffixes
$hst_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_HostSuffix());
$hst_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix('host'));
echo ("<fieldset><legend><b>" . _("Samba Hosts") . "</b></legend>\n");
echo ("<table border=0>\n");
// new OU
@ -441,9 +441,9 @@ function display_main() {
}
// domain OUs
if ($_SESSION["config"]->get_DomainSuffix() != "") {
if ($_SESSION["config"]->get_Suffix('domain') != "") {
// generate lists of possible suffixes
$dom_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_DomainSuffix());
$dom_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_Suffix('domain'));
echo ("<fieldset><legend><b>" . _("Domains") . "</b></legend>\n");
echo ("<table border=0>\n");
// new OU

View File

@ -75,7 +75,7 @@ echo ("<form action=\"profilecreate.php?type=$type\" method=\"post\">\n");
// suffix box
// get root suffix
$rootsuffix = call_user_func(array($_SESSION['config'], 'get_' . ucfirst($type) . 'Suffix'));
$rootsuffix = $_SESSION['config']->get_Suffix($type);
// get subsuffixes
$suffixes = array();
foreach ($_SESSION['ldap']->search_units($rootsuffix) as $suffix) {

View File

@ -56,7 +56,7 @@ $tools[] = array(
);
// Samba 3 domains
if ($_SESSION['config']->get_DomainSuffix() && ($_SESSION['config']->get_DomainSuffix() != "")) {
if ($_SESSION['config']->get_Suffix('domain') && ($_SESSION['config']->get_Suffix('domain') != "")) {
$tools[] = array(
"name" => _("Samba 3 domains"),
"description" => _("Manages Samba 3 domain accounts."),

View File

@ -43,10 +43,10 @@ $ServerURL = $conf->get_ServerURL();
$cachetimeout = $conf->get_cacheTimeout();
$Passwd = $conf->get_Passwd();
$Adminstring = $conf->get_Adminstring();
$Suff_users = $conf->get_UserSuffix();
$Suff_groups = $conf->get_GroupSuffix();
$Suff_hosts = $conf->get_HostSuffix();
$Suff_domains = $conf->get_DomainSuffix();
$Suff_users = $conf->get_Suffix('user');
$Suff_groups = $conf->get_Suffix('group');
$Suff_hosts = $conf->get_Suffix('host');
$Suff_domains = $conf->get_Suffix('domain');
$userlistAttributes = $conf->get_userlistAttributes();
$grouplistAttributes = $conf->get_grouplistAttributes();
$hostlistAttributes = $conf->get_hostlistAttributes();
@ -62,10 +62,10 @@ $conf->set_ServerURL("ldap://123.345.678.123:777");
$conf->set_cacheTimeout("33");
$conf->set_Passwd("123456abcde");
$conf->set_Adminstring("uid=test,o=test,dc=org;uid=root,o=test2,c=de");
$conf->set_UserSuffix("ou=test,o=test,c=de");
$conf->set_GroupSuffix("ou=testgrp,o=test,c=de");
$conf->set_HostSuffix("ou=testhst,o=test,c=de");
$conf->set_DomainSuffix("ou=testdom,o=test,c=de");
$conf->set_Suffix('user', "ou=test,o=test,c=de");
$conf->set_Suffix('group', "ou=testgrp,o=test,c=de");
$conf->set_Suffix('host', "ou=testhst,o=test,c=de");
$conf->set_Suffix('domain', "ou=testdom,o=test,c=de");
$conf->set_userlistAttributes("#uid;#cn");
$conf->set_grouplistAttributes("#gidNumber;#cn;#memberUID");
$conf->set_hostlistAttributes("#cn;#uid;#description");
@ -83,10 +83,10 @@ if ($conf2->get_ServerURL() != "ldap://123.345.678.123:777") echo ("<br><font co
if ($conf2->get_cacheTimeout() != "33") echo ("<br><font color=\"#FF0000\">Saving Cache timeout failed!</font><br>");
if ($conf2->get_Passwd() != "123456abcde") echo ("<br><font color=\"#FF0000\">Saving password failed!</font><br>");
if ($conf2->get_Adminstring() != "uid=test,o=test,dc=org;uid=root,o=test2,c=de") echo ("<br><font color=\"#FF0000\">Saving admin string failed!</font><br>");
if ($conf2->get_UserSuffix() != "ou=test,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving user suffix failed!</font><br>");
if ($conf2->get_GroupSuffix() != "ou=testgrp,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving group suffix failed!</font><br>");
if ($conf2->get_HostSuffix() != "ou=testhst,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving host suffix failed!</font><br>");
if ($conf2->get_DomainSuffix() != "ou=testdom,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving domain suffix failed!</font><br>");
if ($conf2->get_Suffix('user') != "ou=test,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving user suffix failed!</font><br>");
if ($conf2->get_Suffix('group') != "ou=testgrp,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving group suffix failed!</font><br>");
if ($conf2->get_Suffix('host') != "ou=testhst,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving host suffix failed!</font><br>");
if ($conf2->get_Suffix('domain') != "ou=testdom,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving domain suffix failed!</font><br>");
if ($conf2->get_userlistAttributes() != "#uid;#cn") echo ("<br><font color=\"#FF0000\">Saving userlistAttributes failed!</font><br>");
if ($conf2->get_grouplistAttributes() != "#gidNumber;#cn;#memberUID") echo ("<br><font color=\"#FF0000\">Saving grouplistAttributes failed!</font><br>");
if ($conf2->get_hostlistAttributes() != "#cn;#uid;#description") echo ("<br><font color=\"#FF0000\">Saving hostlistAttributes failed!</font><br>");
@ -103,10 +103,10 @@ $conf2->set_ServerURL($ServerURL);
$conf2->set_cacheTimeout($cachetimeout);
$conf2->set_Passwd($Passwd);
$conf2->set_Adminstring($Adminstring);
$conf2->set_UserSuffix($Suff_users);
$conf2->set_GroupSuffix($Suff_groups);
$conf2->set_HostSuffix($Suff_hosts);
$conf2->set_DomainSuffix($Suff_domains);
$conf2->set_Suffix('user', $Suff_users);
$conf2->set_Suffix('group', $Suff_groups);
$conf2->set_Suffix('host', $Suff_hosts);
$conf2->set_Suffix('domain', $Suff_domains);
$conf2->set_userlistAttributes($userlistAttributes);
$conf2->set_grouplistAttributes($grouplistAttributes);
$conf2->set_hostlistAttributes($hostlistAttributes);