-if (!$bookcat) {
-while ($result->next()) {
-if (!$result->getString('bookmark_category')) {
-$categories['unsorted']['children'][]=$result->getRecord();
-$categories['unsorted']['sum']+=$result->getString('node_user_subchild_count');
-}
-else {
-$categories[$result->getString('bookmark_category')]['children'][]=$result->getRecord();
-$categories[$result->getString('bookmark_category')]['sum']+=$result->getString('node_user_subchild_count');
-}
-}
+if (empty($bookcat) || !$bookcat) {
+ while ($result->next()) {
+ if (!$result->getString('bookmark_category')) {
+ $categories['unsorted']['children'][]=$result->getRecord();
+ $categories['unsorted']['sum']+=$result->getString('node_user_subchild_count');
+ }
+ else {
+ $categories[$result->getString('bookmark_category')]['children'][]=$result->getRecord();
+ $categories[$result->getString('bookmark_category')]['sum']+=$result->getString('node_user_subchild_count');
+ }
+ }