fix packages list format

This commit is contained in:
Paolo Asperti 2016-09-15 10:48:36 +02:00
parent 1e6057929f
commit 1d06549e8f
1 changed files with 4 additions and 2 deletions

View File

@ -37,8 +37,10 @@ function varsForRole($role, $json=true) {
$result = $roles_db->getKey($role);
$return = array('role'=>$role,'delpkg'=>'','addpkg'=>'');
if (is_array($result)) {
if (is_string($result['Addpkg'])) $return['addpkg'] = $result['Addpkg'];
if (is_string($result['Delpkg'])) $return['delpkg'] = $result['Delpkg'];
if (is_string($result['Addpkg']))
$return['addpkg'] = preg_split("/[\s,]+/", $result['Addpkg']);
if (is_string($result['Delpkg']))
$return['delpkg'] = preg_split("/[\s,]+/", $result['Delpkg']);
}
if ($json) {
return json_encode($return);