#!/usr/bin/php $vusers) { if (is_null($vusers)) { $vusers = 'NULL'; } $roundcubemail["$virtualhost"]["users"][$user_id][$kusers] = $vusers; } /* identities */ $dbQuery_identities = "SELECT * FROM `rc_identities` WHERE `user_id` = '$user_id'"; $dbResult_identities = mysqli_query($dbLink, $dbQuery_identities); while ($row_identities = mysqli_fetch_assoc($dbResult_identities)) { $identity_id=$row_identities['identity_id']; unset($row_identities['identity_id']); foreach($row_identities as $kidentities=>$videntities) { if (is_null($videntities)) { $videntities = 'NULL'; } $roundcubemail["$virtualhost"]["users"][$user_id]['identities'][$identity_id][$kidentities] = $videntities; } } /* contacts */ $dbQuery_contacts = "SELECT * FROM `rc_contacts` WHERE `user_id` = '$user_id'"; $dbResult_contacts = mysqli_query($dbLink, $dbQuery_contacts); while ($row_contacts = mysqli_fetch_assoc($dbResult_contacts)) { $contact_id=$row_contacts['contact_id']; unset($row_contacts['contact_id']); foreach($row_contacts as $kcontacts=>$vcontacts) { if (is_null($vcontacts)) { $vcontacts = 'NULL'; } $roundcubemail["$virtualhost"]["users"][$user_id]['contacts'][$contact_id][$kcontacts] = $vcontacts; } } /* contactgroups */ $dbQuery_contactgroups = "SELECT * FROM `rc_contactgroups` WHERE `user_id` = '$user_id'"; $dbResult_contactgroups = mysqli_query($dbLink, $dbQuery_contactgroups); while ($row_contactgroups = mysqli_fetch_assoc($dbResult_contactgroups)) { $contactgroup_id=$row_contactgroups['contactgroup_id']; unset($row_contactgroups['contactgroup_id']); foreach($row_contactgroups as $kcontactgroups=>$vcontactgroups) { if (is_null($vcontactgroups)) { $vcontactgroups = 'NULL'; } $roundcubemail["$virtualhost"]["users"][$user_id]['contactgroups'][$contactgroup_id][$kcontactgroups] = $vcontactgroups; } /* contactgroupmembers */ $dbQuery_contactgroupmembers = "SELECT * FROM `rc_contactgroupmembers` WHERE `contactgroup_id` = '$contactgroup_id'"; $dbResult_contactgroupmembers = mysqli_query($dbLink, $dbQuery_contactgroupmembers); while ($row_contactgroupmembers = mysqli_fetch_assoc($dbResult_contactgroupmembers)) { $roundcubemail["$virtualhost"]["users"][$user_id]['contactgroups'][$contactgroup_id]['contactgroupmembers'][] = $row_contactgroupmembers; } } } file_put_contents("/var/vmail/$virtualhost/roundcubemail", serialize($roundcubemail));