more general list functions in config.inc,
put attribute-description code in lists.inc
This commit is contained in:
parent
ab44ea6afc
commit
fb89aaa120
|
@ -525,33 +525,54 @@ class Config {
|
||||||
/**
|
/**
|
||||||
* Returns the list of attributes to show in user list
|
* Returns the list of attributes to show in user list
|
||||||
*
|
*
|
||||||
|
* @param string $scope account type
|
||||||
* @return string the attribute list
|
* @return string the attribute list
|
||||||
*/
|
*/
|
||||||
function get_userlistAttributes() {
|
function get_listAttributes($scope) {
|
||||||
return $this->userlistAttributes;
|
switch ($scope) {
|
||||||
|
case 'user':
|
||||||
|
return $this->userlistAttributes;
|
||||||
|
break;
|
||||||
|
case 'group':
|
||||||
|
return $this->grouplistAttributes;
|
||||||
|
break;
|
||||||
|
case 'host':
|
||||||
|
return $this->hostlistAttributes;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the list of attributes to show in user list
|
* Sets the list of attributes to show in user list
|
||||||
*
|
*
|
||||||
* @param string $value new attribute string
|
* @param string $value new attribute string
|
||||||
|
* @param string $scope account type
|
||||||
* @return boolean true if $value has correct format
|
* @return boolean true if $value has correct format
|
||||||
*/
|
*/
|
||||||
function set_userlistAttributes($value) {
|
function set_listAttributes($value, $scope) {
|
||||||
if (is_string($value) && eregi("^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$", $value)) {
|
if (is_string($value) && eregi("^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$", $value)) {
|
||||||
$this->userlistAttributes = $value;
|
switch ($scope) {
|
||||||
|
case 'user':
|
||||||
|
$this->userlistAttributes = $value;
|
||||||
|
break;
|
||||||
|
case 'group':
|
||||||
|
$this->grouplistAttributes = $value;
|
||||||
|
break;
|
||||||
|
case 'host':
|
||||||
|
$this->hostlistAttributes = $value;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the list of attributes to show in group list
|
|
||||||
*
|
|
||||||
* @return string the attribute list
|
|
||||||
*/
|
|
||||||
function get_grouplistAttributes() {
|
|
||||||
return $this->grouplistAttributes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -568,30 +589,6 @@ class Config {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the list of attributes to show in host list
|
|
||||||
*
|
|
||||||
* @return string the attribute list
|
|
||||||
*/
|
|
||||||
function get_hostlistAttributes() {
|
|
||||||
return $this->hostlistAttributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the list of attributes to show in host list
|
|
||||||
*
|
|
||||||
* @param string $value new attribute string
|
|
||||||
* @return boolean true if $value has correct format
|
|
||||||
*/
|
|
||||||
function set_hostlistAttributes($value) {
|
|
||||||
if (! $value && ($this->hostsuffix == "")) $this->hostlistAttributes = "";
|
|
||||||
elseif (is_string($value) && eregi("^((#[^:;]+)|([^:;]*:[^:;]+))(;((#[^:;]+)|([^:;]*:[^:;]+)))*$", $value)) {
|
|
||||||
$this->hostlistAttributes = $value;
|
|
||||||
}
|
|
||||||
else return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum number of rows in user/group/host lists
|
* Returns the maximum number of rows in user/group/host lists
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,12 +32,11 @@ $Id$
|
||||||
/**
|
/**
|
||||||
* Builds the regular expressions from the filter values.
|
* Builds the regular expressions from the filter values.
|
||||||
*
|
*
|
||||||
* @param array $post HTTP Post values
|
|
||||||
* @param array $attributes list of displayed attributes
|
* @param array $attributes list of displayed attributes
|
||||||
* @return array filter data array($attribute => array('regex' => $reg, 'original' => $orig))
|
* @return array filter data array($attribute => array('regex' => $reg, 'original' => $orig))
|
||||||
* $reg is the regular expression to use, $orig the user's unmodified input string
|
* $reg is the regular expression to use, $orig the user's unmodified input string
|
||||||
*/
|
*/
|
||||||
function listBuildFilter($post, $attributes) {
|
function listBuildFilter($attributes) {
|
||||||
$filter = array();
|
$filter = array();
|
||||||
for ($i = 0; $i < sizeof($attributes); $i++) {
|
for ($i = 0; $i < sizeof($attributes); $i++) {
|
||||||
if (isset($_POST["filter" . strtolower($attributes[$i])]) && eregi('^([0-9a-z_\\*\\$])+$', $_POST["filter" . strtolower($attributes[$i])])) {
|
if (isset($_POST["filter" . strtolower($attributes[$i])]) && eregi('^([0-9a-z_\\*\\$])+$', $_POST["filter" . strtolower($attributes[$i])])) {
|
||||||
|
@ -287,53 +286,49 @@ function listDoPost($scope) {
|
||||||
/**
|
/**
|
||||||
* Returns the LDAP attribute names and their description for the user list
|
* Returns the LDAP attribute names and their description for the user list
|
||||||
*
|
*
|
||||||
|
* @param string $scope account type
|
||||||
* @return array list of LDAP attributes and descriptions
|
* @return array list of LDAP attributes and descriptions
|
||||||
*/
|
*/
|
||||||
function listGetAttributeUserArray() {
|
function listGetAttributeArray($scope) {
|
||||||
return array (
|
switch ($scope) {
|
||||||
"uid" => _("User ID"),
|
case 'user':
|
||||||
"uidnumber" => _("UID number"),
|
return array (
|
||||||
"gidnumber" => _("GID number"),
|
"uid" => _("User ID"),
|
||||||
"cn" => _("Username"),
|
"uidnumber" => _("UID number"),
|
||||||
"host" => _("Allowed hosts"),
|
"gidnumber" => _("GID number"),
|
||||||
"givenname" => _("First name"),
|
"cn" => _("Username"),
|
||||||
"sn" => _("Last name"),
|
"host" => _("Allowed hosts"),
|
||||||
"homedirectory" => _("Home directory"),
|
"givenname" => _("First name"),
|
||||||
"loginshell" => _("Login shell"),
|
"sn" => _("Last name"),
|
||||||
"mail" => _("E-Mail"),
|
"homedirectory" => _("Home directory"),
|
||||||
"gecos" => _("Description")
|
"loginshell" => _("Login shell"),
|
||||||
);
|
"mail" => _("E-Mail"),
|
||||||
}
|
"gecos" => _("Description")
|
||||||
|
);
|
||||||
/**
|
break;
|
||||||
* Returns the LDAP attribute names and their description for the group list
|
case 'group':
|
||||||
*
|
return array (
|
||||||
* @return array list of LDAP attributes and descriptions
|
"cn" => _("Group name"),
|
||||||
*/
|
"gidnumber" => _("GID number"),
|
||||||
function listGetAttributeGroupArray() {
|
"memberuid" => _("Group members"),
|
||||||
return array (
|
"member" => _("Group member DNs"),
|
||||||
"cn" => _("Group name"),
|
"description" => _("Group description")
|
||||||
"gidnumber" => _("GID number"),
|
);
|
||||||
"memberuid" => _("Group members"),
|
break;
|
||||||
"member" => _("Group member DNs"),
|
case 'host':
|
||||||
"description" => _("Group description")
|
return array (
|
||||||
);
|
"uid" => _("Host username"),
|
||||||
}
|
"cn" => _("Host name"),
|
||||||
|
"rid" => _("RID (Windows UID)"),
|
||||||
/**
|
"description" => _("Host description"),
|
||||||
* Returns the LDAP attribute names and their description for the host list
|
"uidnumber" => _("UID number"),
|
||||||
*
|
"gidnumber" => _("GID number")
|
||||||
* @return array list of LDAP attributes and descriptions
|
);
|
||||||
*/
|
break;
|
||||||
function listGetAttributeHostArray() {
|
default:
|
||||||
return array (
|
return array();
|
||||||
"uid" => _("Host username"),
|
break;
|
||||||
"cn" => _("Host name"),
|
}
|
||||||
"rid" => _("RID (Windows UID)"),
|
|
||||||
"description" => _("Host description"),
|
|
||||||
"uidnumber" => _("UID number"),
|
|
||||||
"gidnumber" => _("GID number")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -391,4 +386,43 @@ function listPrintJavaScript() {
|
||||||
echo "</script>\n";
|
echo "</script>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an hash array containing with all attributes to be shown and their descriptions.
|
||||||
|
* Format: array(attribute => description)
|
||||||
|
*
|
||||||
|
* @param string $scope account type
|
||||||
|
* @return array attribute list
|
||||||
|
*/
|
||||||
|
function listGetAttributeDescriptionList($scope) {
|
||||||
|
$ret = array();
|
||||||
|
$attr_string = $_SESSION["config"]->get_listAttributes($scope);
|
||||||
|
$temp_array = explode(";", $attr_string);
|
||||||
|
$hash_table = listGetAttributeArray($scope);
|
||||||
|
// generate column attributes and descriptions
|
||||||
|
for ($i = 0; $i < sizeof($temp_array); $i++) {
|
||||||
|
// if value is predifined, look up description in hash_table
|
||||||
|
if (substr($temp_array[$i],0,1) == "#") {
|
||||||
|
$attr = strtolower(substr($temp_array[$i],1));
|
||||||
|
if (isset($hash_table[$attr])) {
|
||||||
|
$ret[$attr] = $hash_table[$attr];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ret[$attr] = $attr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if not predefined, the attribute is seperated by a ":" from description
|
||||||
|
else {
|
||||||
|
$attr = explode(":", $temp_array[$i]);
|
||||||
|
if (isset($attr[1])) {
|
||||||
|
$ret[$attr[0]] = $attr[1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ret[$attr[0]] = $attr[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -124,9 +124,9 @@ if (isset($_GET["modulesback"])) {
|
||||||
$conf->set_Suffix('host', $_SESSION['conf_suffhosts']);
|
$conf->set_Suffix('host', $_SESSION['conf_suffhosts']);
|
||||||
$conf->set_Suffix('domain', $_SESSION['conf_suffdomains']);
|
$conf->set_Suffix('domain', $_SESSION['conf_suffdomains']);
|
||||||
$conf->set_Suffix('tree', $_SESSION['conf_sufftree']);
|
$conf->set_Suffix('tree', $_SESSION['conf_sufftree']);
|
||||||
$conf->set_userlistAttributes($_SESSION['conf_usrlstattr']);
|
$conf->set_listAttributes($_SESSION['conf_usrlstattr'], 'user');
|
||||||
$conf->set_grouplistAttributes($_SESSION['conf_grplstattr']);
|
$conf->set_listAttributes($_SESSION['conf_grplstattr'], 'group');
|
||||||
$conf->set_hostlistAttributes($_SESSION['conf_hstlstattr']);
|
$conf->set_listAttributes($_SESSION['conf_hstlstattr'], 'host');
|
||||||
$conf->set_MaxListEntries($_SESSION['conf_maxlistentries']);
|
$conf->set_MaxListEntries($_SESSION['conf_maxlistentries']);
|
||||||
$conf->set_defaultLanguage($_SESSION['conf_lang']);
|
$conf->set_defaultLanguage($_SESSION['conf_lang']);
|
||||||
$conf->set_scriptpath($_SESSION['conf_scriptpath']);
|
$conf->set_scriptpath($_SESSION['conf_scriptpath']);
|
||||||
|
@ -292,19 +292,19 @@ echo ("<table border=0>\n");
|
||||||
// user list attributes
|
// user list attributes
|
||||||
echo ("<tr><td align=\"right\"><b>".
|
echo ("<tr><td align=\"right\"><b>".
|
||||||
_("Attributes in User List") . " *:</b></td>".
|
_("Attributes in User List") . " *:</b></td>".
|
||||||
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"usrlstattr\" value=\"" . $conf->get_userlistAttributes() . "\"></td>");
|
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"usrlstattr\" value=\"" . $conf->get_listAttributes('user') . "\"></td>");
|
||||||
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
|
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
|
||||||
$tabindex++;
|
$tabindex++;
|
||||||
// group list attributes
|
// group list attributes
|
||||||
echo ("<tr><td align=\"right\"><b>".
|
echo ("<tr><td align=\"right\"><b>".
|
||||||
_("Attributes in Group List") . " *:</b></td>".
|
_("Attributes in Group List") . " *:</b></td>".
|
||||||
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"grplstattr\" value=\"" . $conf->get_grouplistAttributes() . "\"></td>");
|
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"grplstattr\" value=\"" . $conf->get_listAttributes('group') . "\"></td>");
|
||||||
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
|
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
|
||||||
$tabindex++;
|
$tabindex++;
|
||||||
// host list attributes
|
// host list attributes
|
||||||
echo ("<tr><td align=\"right\"><b>".
|
echo ("<tr><td align=\"right\"><b>".
|
||||||
_("Attributes in Host List") . " **:</b></td>".
|
_("Attributes in Host List") . " **:</b></td>".
|
||||||
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"hstlstattr\" value=\"" . $conf->get_hostlistAttributes() . "\"></td>");
|
"<td><input tabindex=\"$tabindex\" size=50 type=\"text\" name=\"hstlstattr\" value=\"" . $conf->get_listAttributes('host') . "\"></td>");
|
||||||
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
|
echo ("<td><a href=\"../help.php?HelpNumber=206\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
|
||||||
$tabindex++;
|
$tabindex++;
|
||||||
|
|
||||||
|
|
|
@ -128,17 +128,17 @@ if (!$conf->set_Suffix("tree", $sufftree)) {
|
||||||
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (!$conf->set_userlistAttributes($usrlstattr)) {
|
if (!$conf->set_listAttributes($usrlstattr, 'user')) {
|
||||||
echo ("<font color=\"red\"><b>" . _("User list attributes are invalid!") . "</b></font>");
|
echo ("<font color=\"red\"><b>" . _("User list attributes are invalid!") . "</b></font>");
|
||||||
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (!$conf->set_grouplistAttributes($grplstattr)) {
|
if (!$conf->set_listAttributes($grplstattr, 'group')) {
|
||||||
echo ("<font color=\"red\"><b>" . _("Group list attributes are invalid!") . "</b></font>");
|
echo ("<font color=\"red\"><b>" . _("Group list attributes are invalid!") . "</b></font>");
|
||||||
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (!$conf->set_hostlistAttributes($hstlstattr)) {
|
if (!$conf->set_listAttributes($hstlstattr, 'host')) {
|
||||||
echo ("<font color=\"red\"><b>" . _("Host list attributes are invalid!") . "</b></font>");
|
echo ("<font color=\"red\"><b>" . _("Host list attributes are invalid!") . "</b></font>");
|
||||||
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -67,11 +67,9 @@ echo "</head><body>\n";
|
||||||
listPrintJavaScript();
|
listPrintJavaScript();
|
||||||
|
|
||||||
// generate attribute-description table
|
// generate attribute-description table
|
||||||
$attr_array = array(); // list of LDAP attributes to show
|
$temp_array = listGetAttributeDescriptionList($scope);
|
||||||
$desc_array = array(); // list of descriptions for the attributes
|
$attr_array = array_keys($temp_array); // list of LDAP attributes to show
|
||||||
$attr_string = $_SESSION["config"]->get_grouplistAttributes();
|
$desc_array = array_values($temp_array); // list of descriptions for the attributes
|
||||||
$temp_array = explode(";", $attr_string);
|
|
||||||
$hash_table = listGetAttributeGroupArray();
|
|
||||||
|
|
||||||
// get current page
|
// get current page
|
||||||
if (isset($_GET["page"])) $page = $_GET["page"];
|
if (isset($_GET["page"])) $page = $_GET["page"];
|
||||||
|
@ -83,24 +81,6 @@ if ($_SESSION["config"]->get_MaxListEntries() <= 0)
|
||||||
else
|
else
|
||||||
$max_page_entries = $_SESSION["config"]->get_MaxListEntries();
|
$max_page_entries = $_SESSION["config"]->get_MaxListEntries();
|
||||||
|
|
||||||
// generate column attributes and descriptions
|
|
||||||
for ($i = 0; $i < sizeof($temp_array); $i++) {
|
|
||||||
// if value is predifined, look up description in hash_table
|
|
||||||
if (substr($temp_array[$i],0,1) == "#") {
|
|
||||||
$attr = strtolower(substr($temp_array[$i],1));
|
|
||||||
$attr_array[$i] = $attr;
|
|
||||||
if ($hash_table[$attr]) $desc_array[] = strtoupper($hash_table[$attr]);
|
|
||||||
else $desc_array[] = strtoupper($attr);
|
|
||||||
}
|
|
||||||
// if not predefined, the attribute is seperated by a ":" from description
|
|
||||||
else {
|
|
||||||
$attr = explode(":", $temp_array[$i]);
|
|
||||||
$attr_array[$i] = $attr[0];
|
|
||||||
if ($attr[1]) $desc_array[$i] = strtoupper($attr[1]);
|
|
||||||
else $desc_array[$i] = strtoupper($attr[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// get sorting column
|
// get sorting column
|
||||||
if (isset($_GET["sort"])) $sort = $_GET["sort"];
|
if (isset($_GET["sort"])) $sort = $_GET["sort"];
|
||||||
else $sort = strtolower($attr_array[0]);
|
else $sort = strtolower($attr_array[0]);
|
||||||
|
@ -138,13 +118,12 @@ if ($refresh) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter = listBuildFilter($_POST, $attr_array);
|
$filter = listBuildFilter($attr_array);
|
||||||
$info = listFilterAccounts($info, $filter);
|
$info = listFilterAccounts($info, $filter);
|
||||||
if (sizeof($info) == 0) StatusMessage("WARN", "", _("No groups found!"));
|
if (sizeof($info) == 0) StatusMessage("WARN", "", _("No groups found!"));
|
||||||
// sort rows by sort column ($sort)
|
// sort rows by sort column ($sort)
|
||||||
if ($info) {
|
if ($info) {
|
||||||
$info = listSort($sort, $attr_array, $info);
|
$info = listSort($sort, $attr_array, $info);
|
||||||
$_SESSION[$scope . 'info'] = $info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// build filter URL
|
// build filter URL
|
||||||
|
|
|
@ -67,11 +67,9 @@ echo "</head><body>\n";
|
||||||
listPrintJavaScript();
|
listPrintJavaScript();
|
||||||
|
|
||||||
// generate attribute-description table
|
// generate attribute-description table
|
||||||
$attr_array = array(); // list of LDAP attributes to show
|
$temp_array = listGetAttributeDescriptionList($scope);
|
||||||
$desc_array = array(); // list of descriptions for the attributes
|
$attr_array = array_keys($temp_array); // list of LDAP attributes to show
|
||||||
$attr_string = $_SESSION["config"]->get_hostlistAttributes();
|
$desc_array = array_values($temp_array); // list of descriptions for the attributes
|
||||||
$temp_array = explode(";", $attr_string);
|
|
||||||
$hash_table = listGetAttributeHostArray();
|
|
||||||
|
|
||||||
// get current page
|
// get current page
|
||||||
if (isset($_GET["page"])) $page = $_GET["page"];
|
if (isset($_GET["page"])) $page = $_GET["page"];
|
||||||
|
@ -83,24 +81,6 @@ if ($_SESSION["config"]->get_MaxListEntries() <= 0)
|
||||||
else
|
else
|
||||||
$max_page_entries = $_SESSION["config"]->get_MaxListEntries();
|
$max_page_entries = $_SESSION["config"]->get_MaxListEntries();
|
||||||
|
|
||||||
// generate column attributes and descriptions
|
|
||||||
for ($i = 0; $i < sizeof($temp_array); $i++) {
|
|
||||||
// if value is predifined, look up description in hash_table
|
|
||||||
if (substr($temp_array[$i],0,1) == "#") {
|
|
||||||
$attr = strtolower(substr($temp_array[$i],1));
|
|
||||||
$attr_array[$i] = $attr;
|
|
||||||
if ($hash_table[$attr]) $desc_array[] = strtoupper($hash_table[$attr]);
|
|
||||||
else $desc_array[] = strtoupper($attr);
|
|
||||||
}
|
|
||||||
// if not predefined, the attribute is seperated by a ":" from description
|
|
||||||
else {
|
|
||||||
$attr = explode(":", $temp_array[$i]);
|
|
||||||
$attr_array[$i] = $attr[0];
|
|
||||||
if ($attr[1]) $desc_array[$i] = strtoupper($attr[1]);
|
|
||||||
else $desc_array[$i] = strtoupper($attr[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// get sorting column
|
// get sorting column
|
||||||
if (isset($_GET["sort"])) $sort = $_GET["sort"];
|
if (isset($_GET["sort"])) $sort = $_GET["sort"];
|
||||||
else $sort = strtolower($attr_array[0]);
|
else $sort = strtolower($attr_array[0]);
|
||||||
|
@ -138,13 +118,12 @@ if ($refresh) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter = listBuildFilter($_POST, $attr_array);
|
$filter = listBuildFilter($attr_array);
|
||||||
$info = listFilterAccounts($info, $filter);
|
$info = listFilterAccounts($info, $filter);
|
||||||
if (sizeof($info) == 0) StatusMessage("WARN", "", _("No hosts found!"));
|
if (sizeof($info) == 0) StatusMessage("WARN", "", _("No hosts found!"));
|
||||||
// sort rows by sort column ($sort)
|
// sort rows by sort column ($sort)
|
||||||
if ($info) {
|
if ($info) {
|
||||||
$info = listSort($sort, $attr_array, $info);
|
$info = listSort($sort, $attr_array, $info);
|
||||||
$_SESSION[$scope . 'info'] = $info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// build filter URL
|
// build filter URL
|
||||||
|
|
|
@ -61,7 +61,7 @@ if (isset($_GET['norefresh'])) $refresh = false;
|
||||||
if (isset($_POST['refresh'])) $refresh = true;
|
if (isset($_POST['refresh'])) $refresh = true;
|
||||||
|
|
||||||
// check if primary group should be translated
|
// check if primary group should be translated
|
||||||
if (isset($_POST['trans_primary'])) $trans_primary = "on";
|
if (isset($_POST['trans_primary']) && ($_POST['trans_primary'] == 'on')) $trans_primary = "on";
|
||||||
else $trans_primary = "off";
|
else $trans_primary = "off";
|
||||||
if (isset($_SESSION['trans_primary_hash'])) $trans_primary_hash = $_SESSION['trans_primary_hash'];
|
if (isset($_SESSION['trans_primary_hash'])) $trans_primary_hash = $_SESSION['trans_primary_hash'];
|
||||||
else $trans_primary_hash = array();
|
else $trans_primary_hash = array();
|
||||||
|
@ -107,29 +107,9 @@ if ($_SESSION["config"]->get_MaxListEntries() <= 0) {
|
||||||
else $max_page_entries = $_SESSION["config"]->get_MaxListEntries();
|
else $max_page_entries = $_SESSION["config"]->get_MaxListEntries();
|
||||||
|
|
||||||
// generate attribute-description table
|
// generate attribute-description table
|
||||||
$attr_array = array(); // list of LDAP attributes to show
|
$temp_array = listGetAttributeDescriptionList($scope);
|
||||||
$desc_array = array(); // list of descriptions for the attributes
|
$attr_array = array_keys($temp_array); // list of LDAP attributes to show
|
||||||
$attr_string = $_SESSION["config"]->get_userlistAttributes();
|
$desc_array = array_values($temp_array); // list of descriptions for the attributes
|
||||||
$temp_array = explode(";", $attr_string);
|
|
||||||
$hash_table = listGetAttributeUserArray();
|
|
||||||
|
|
||||||
// generate column attributes and descriptions
|
|
||||||
for ($i = 0; $i < sizeof($temp_array); $i++) {
|
|
||||||
// if value is predifined, look up description in hash_table
|
|
||||||
if (substr($temp_array[$i],0,1) == "#") {
|
|
||||||
$attr = strtolower(substr($temp_array[$i],1));
|
|
||||||
$attr_array[$i] = $attr;
|
|
||||||
if ($hash_table[$attr]) $desc_array[] = strtoupper($hash_table[$attr]);
|
|
||||||
else $desc_array[] = strtoupper($attr);
|
|
||||||
}
|
|
||||||
// if not predefined, the attribute is seperated by a ":" from description
|
|
||||||
else {
|
|
||||||
$attr = explode(":", $temp_array[$i]);
|
|
||||||
$attr_array[$i] = $attr[0];
|
|
||||||
if ($attr[1]) $desc_array[$i] = strtoupper($attr[1]);
|
|
||||||
else $desc_array[$i] = strtoupper($attr[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET["sort"])) $sort = $_GET["sort"];
|
if (isset($_GET["sort"])) $sort = $_GET["sort"];
|
||||||
else $sort = strtolower($attr_array[0]);
|
else $sort = strtolower($attr_array[0]);
|
||||||
|
@ -167,13 +147,12 @@ if ($refresh) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter = listBuildFilter($_POST, $attr_array);
|
$filter = listBuildFilter($attr_array);
|
||||||
$info = listFilterAccounts($info, $filter);
|
$info = listFilterAccounts($info, $filter);
|
||||||
if (sizeof($info) == 0) StatusMessage("WARN", "", _("No users found!"));
|
if (sizeof($info) == 0) StatusMessage("WARN", "", _("No users found!"));
|
||||||
// sort rows by sort column ($sort)
|
// sort rows by sort column ($sort)
|
||||||
if ($info) {
|
if ($info) {
|
||||||
$info = listSort($sort, $attr_array, $info);
|
$info = listSort($sort, $attr_array, $info);
|
||||||
$_SESSION[$scope . 'info'] = $info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// build filter URL
|
// build filter URL
|
||||||
|
@ -219,7 +198,6 @@ if (sizeof($info) != 0) {
|
||||||
// resort if needed
|
// resort if needed
|
||||||
if ($sort == "gidnumber") {
|
if ($sort == "gidnumber") {
|
||||||
$info = listSort($sort, $attr_array, $info);
|
$info = listSort($sort, $attr_array, $info);
|
||||||
$_SESSION[$scope . 'info'] = $info;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// print user list
|
// print user list
|
||||||
|
|
|
@ -47,9 +47,9 @@ $Suff_users = $conf->get_Suffix('user');
|
||||||
$Suff_groups = $conf->get_Suffix('group');
|
$Suff_groups = $conf->get_Suffix('group');
|
||||||
$Suff_hosts = $conf->get_Suffix('host');
|
$Suff_hosts = $conf->get_Suffix('host');
|
||||||
$Suff_domains = $conf->get_Suffix('domain');
|
$Suff_domains = $conf->get_Suffix('domain');
|
||||||
$userlistAttributes = $conf->get_userlistAttributes();
|
$userlistAttributes = $conf->get_listAttributes('user');
|
||||||
$grouplistAttributes = $conf->get_grouplistAttributes();
|
$grouplistAttributes = $conf->get_listAttributes('group');
|
||||||
$hostlistAttributes = $conf->get_hostlistAttributes();
|
$hostlistAttributes = $conf->get_listAttributes('host');
|
||||||
$maxlistentries = $conf->get_maxlistentries();
|
$maxlistentries = $conf->get_maxlistentries();
|
||||||
$defaultlanguage = $conf->get_defaultlanguage();
|
$defaultlanguage = $conf->get_defaultlanguage();
|
||||||
$scriptpath = $conf->get_scriptPath();
|
$scriptpath = $conf->get_scriptPath();
|
||||||
|
@ -66,9 +66,9 @@ $conf->set_Suffix('user', "ou=test,o=test,c=de");
|
||||||
$conf->set_Suffix('group', "ou=testgrp,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('host', "ou=testhst,o=test,c=de");
|
||||||
$conf->set_Suffix('domain', "ou=testdom,o=test,c=de");
|
$conf->set_Suffix('domain', "ou=testdom,o=test,c=de");
|
||||||
$conf->set_userlistAttributes("#uid;#cn");
|
$conf->set_listAttributes("#uid;#cn", 'user');
|
||||||
$conf->set_grouplistAttributes("#gidNumber;#cn;#memberUID");
|
$conf->set_listAttributes("#gidNumber;#cn;#memberUID", 'group');
|
||||||
$conf->set_hostlistAttributes("#cn;#uid;#description");
|
$conf->set_listAttributes("#cn;#uid;#description", 'host');
|
||||||
$conf->set_maxlistentries("54");
|
$conf->set_maxlistentries("54");
|
||||||
$conf->set_defaultlanguage("de_AT:iso639_de:Deutsch (Oesterreich)");
|
$conf->set_defaultlanguage("de_AT:iso639_de:Deutsch (Oesterreich)");
|
||||||
$conf->set_scriptPath("/var/www/lam/lib/script");
|
$conf->set_scriptPath("/var/www/lam/lib/script");
|
||||||
|
@ -87,9 +87,9 @@ if ($conf2->get_Suffix('user') != "ou=test,o=test,c=de") echo ("<br><font color=
|
||||||
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('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('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_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_listAttributes('user') != "#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_listAttributes('group') != "#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>");
|
if ($conf2->get_listAttributes('host') != "#cn;#uid;#description") echo ("<br><font color=\"#FF0000\">Saving hostlistAttributes failed!</font><br>");
|
||||||
if ($conf2->get_maxlistentries() != "54") echo ("<br><font color=\"#FF0000\">Saving maxlistentries failed!</font><br>");
|
if ($conf2->get_maxlistentries() != "54") echo ("<br><font color=\"#FF0000\">Saving maxlistentries failed!</font><br>");
|
||||||
if ($conf2->get_defaultlanguage() != "de_AT:iso639_de:Deutsch (Oesterreich)") echo ("<br><font color=\"#FF0000\">Saving default language failed!</font><br>");
|
if ($conf2->get_defaultlanguage() != "de_AT:iso639_de:Deutsch (Oesterreich)") echo ("<br><font color=\"#FF0000\">Saving default language failed!</font><br>");
|
||||||
if ($conf2->get_scriptPath() != "/var/www/lam/lib/script") echo ("<br><font color=\"#FF0000\">Saving script path failed!</font><br>");
|
if ($conf2->get_scriptPath() != "/var/www/lam/lib/script") echo ("<br><font color=\"#FF0000\">Saving script path failed!</font><br>");
|
||||||
|
@ -107,9 +107,9 @@ $conf2->set_Suffix('user', $Suff_users);
|
||||||
$conf2->set_Suffix('group', $Suff_groups);
|
$conf2->set_Suffix('group', $Suff_groups);
|
||||||
$conf2->set_Suffix('host', $Suff_hosts);
|
$conf2->set_Suffix('host', $Suff_hosts);
|
||||||
$conf2->set_Suffix('domain', $Suff_domains);
|
$conf2->set_Suffix('domain', $Suff_domains);
|
||||||
$conf2->set_userlistAttributes($userlistAttributes);
|
$conf2->set_listAttributes($userlistAttributes, 'user');
|
||||||
$conf2->set_grouplistAttributes($grouplistAttributes);
|
$conf2->set_listAttributes($grouplistAttributes, 'group');
|
||||||
$conf2->set_hostlistAttributes($hostlistAttributes);
|
$conf2->set_listAttributes($hostlistAttributes, 'host');
|
||||||
$conf2->set_maxlistentries($maxlistentries);
|
$conf2->set_maxlistentries($maxlistentries);
|
||||||
$conf2->set_defaultLanguage($defaultlanguage);
|
$conf2->set_defaultLanguage($defaultlanguage);
|
||||||
$conf2->set_scriptPath($scriptpath);
|
$conf2->set_scriptPath($scriptpath);
|
||||||
|
|
Loading…
Reference in New Issue