//msg_gettree
 if ($action == msg_gettree) {
     $lst1 = null;
     global $gl_parsetags;
     $gl_parsetags = false;
     $gc = new GroupContainer("id", "name");
     $opt = "";
     $withvirtual = true;
     if (isset($options)) {
         $opt = $options;
         if ($opt == "withfriends") {
             $withvirtual = false;
         }
     }
     if ($opt == "onlyfriends") {
         $lst1 = $fac->getAllFriendGroups($usr->getUid());
     } else {
         if ($parentgroupid == -1) {
             $lst1 = $fac->getRootGroups($usr->getUid(), $withvirtual);
         }
     }
     if ($lst1 != null) {
         for ($i = 0; $i < count($lst1); $i++) {
             $fac->parseChildren($usr->getUid(), $lst1[$i]);
             $lst1[$i]->prepareForTree(-1);
             $gc->addGroup($lst1[$i]);
         }
         if ($opt == "withfriends") {
             $lst2 = $fac->getAllFriendGroups($usr->getUid());
             if ($lst2 != null) {
                 for ($i = 0; $i < count($lst2); $i++) {