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,16 +116,20 @@ class resources_driver_ldap extends resources_driver
|
||||||
{
|
{
|
||||||
$rec['ID'] = rcube_ldap::dn_decode($rec['ID']);
|
$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);
|
$attr = @json_decode($sattr, true);
|
||||||
$attributes += $attr;
|
$attributes += $attr;
|
||||||
}
|
}
|
||||||
|
else if ($sattr && empty($rec['description'])) {
|
||||||
|
$rec['description'] = $sattr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$rec['attributes'] = $attributes;
|
$rec['attributes'] = $attributes;
|
||||||
}
|
|
||||||
|
|
||||||
// force $rec['members'] to be an array
|
// force $rec['members'] to be an array
|
||||||
if (!empty($rec['members']) && !is_array($rec['members'])) {
|
if (!empty($rec['members']) && !is_array($rec['members'])) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue