Fix broken resource details when kolabDescAttribute contains non-JSON-formatted value (Bifrost#T209152)
We'll display such string as a resource description (if not specified otherwise).
This commit is contained in:
parent
7d6e1fd787
commit
f847df8e50
1 changed files with 9 additions and 5 deletions
|
@ -116,17 +116,21 @@ class resources_driver_ldap extends resources_driver
|
|||
{
|
||||
$rec['ID'] = rcube_ldap::dn_decode($rec['ID']);
|
||||
|
||||
if (is_array($rec['attributes']) && $rec['attributes'][0]) {
|
||||
$attributes = array();
|
||||
$attributes = array();
|
||||
|
||||
foreach ($rec['attributes'] as $sattr) {
|
||||
foreach ((array) $rec['attributes'] as $sattr) {
|
||||
$sattr = trim($sattr);
|
||||
if ($sattr && $sattr[0] === '{') {
|
||||
$attr = @json_decode($sattr, true);
|
||||
$attributes += $attr;
|
||||
}
|
||||
|
||||
$rec['attributes'] = $attributes;
|
||||
else if ($sattr && empty($rec['description'])) {
|
||||
$rec['description'] = $sattr;
|
||||
}
|
||||
}
|
||||
|
||||
$rec['attributes'] = $attributes;
|
||||
|
||||
// force $rec['members'] to be an array
|
||||
if (!empty($rec['members']) && !is_array($rec['members'])) {
|
||||
$rec['members'] = array($rec['members']);
|
||||
|
|
Loading…
Add table
Reference in a new issue