function GroupBuilder($_reqGroup = "", $_reqOperator = "", $allowCom = true)
 {
     $reqGroup = UserGroup::ReadParams();
     $this->ReqGroup = !empty($reqGroup) ? $reqGroup : $_reqGroup;
     $this->ReqOperator = !empty($_GET[GET_EXTERN_INTERN_USER_ID]) ? Encoding::Base64UrlDecode($_GET[GET_EXTERN_INTERN_USER_ID]) : $_reqOperator;
     $this->GroupValues["groups_online"] = array();
     $this->GroupValues["groups_offline"] = array();
     $this->GroupValues["groups_online_amounts"] = array();
     $this->GroupValues["groups_output"] = array();
     $this->GroupValues["groups_hidden"] = array();
     $this->GroupValues["set_by_get_user"] = null;
     $this->GroupValues["set_by_get_group"] = null;
     $this->GroupValues["set_by_cookie"] = null;
     $this->GroupValues["set_by_standard"] = null;
     $this->GroupValues["set_by_online"] = null;
     $this->GroupValues["req_for_user"] = !empty($this->ReqOperator);
     $this->GroupValues["req_for_group"] = !empty($this->ReqGroup);
     $this->Parameters = Communication::GetTargetParameters($allowCom);
     if ($this->Parameters["include_group"] != null || $this->Parameters["include_user"] != null) {
         foreach (Server::$Groups as $gid => $group) {
             if (!($this->Parameters["include_group"] != null && in_array($gid, $this->Parameters["include_group"]))) {
                 if (!($this->Parameters["include_user"] != null && in_array($gid, Server::$Operators[Operator::GetSystemId($this->Parameters["include_user"])]->GetGroupList(false)))) {
                     $this->GroupValues["groups_hidden"][] = $gid;
                 }
             }
         }
     }
     if ($this->Parameters["exclude"] != null) {
         $this->GroupValues["groups_hidden"] = $this->Parameters["exclude"];
     }
 }
 function ReloadGroups($_overlay = false, $_preSelect = true)
 {
     Server::InitDataBlock(array("INTERNAL", "FILTERS"));
     $grParam = UserGroup::ReadParams();
     $opParam = Operator::ReadParams();
     if (!empty($grParam) && empty($this->Browsers[0]->DesiredChatGroup)) {
         $this->Browsers[0]->DesiredChatGroup = $grParam;
     }
     if (!empty($opParam)) {
         $this->Browsers[0]->DesiredChatPartner = Operator::GetSystemId($opParam);
     }
     $groupbuilder = new GroupBuilder($this->Browsers[0]->DesiredChatGroup, $this->Browsers[0]->DesiredChatPartner);
     $groupbuilder->Generate($this);
     if (!empty($opParam)) {
         $this->Browsers[0]->DesiredChatPartner = Operator::GetSystemId($opParam);
     }
     $groupsAvailable = To::BoolString($groupbuilder->GroupAvailable || isset($_POST[GET_EXTERN_RESET]) && strlen($groupbuilder->ErrorHTML) <= 2);
     $_preSelect = $_preSelect ? Encoding::Base64UrlEncode($this->Browsers[0]->DesiredChatGroup) : "";
     $this->AddFunctionCall("lz_chat_set_groups(" . $groupsAvailable . ",\"" . $groupbuilder->Result . "\" ," . $groupbuilder->ErrorHTML . ",'" . $_preSelect . "');", false);
     if (!$_overlay) {
         $this->AddFunctionCall("lz_chat_release(" . $groupsAvailable . "," . $groupbuilder->ErrorHTML . ");", false);
     }
 }
function reloadGroups($_user, $_overlay = false, $_preSelect = true, $_declined = false)
{
    global $CONFIG, $INTERNAL, $GROUPS;
    initData(array("INTERNAL", "FILTERS"));
    $grParam = UserGroup::ReadParams();
    $opParam = Operator::ReadParams();
    if (!empty($grParam) && empty($_user->Browsers[0]->DesiredChatGroup)) {
        $_user->Browsers[0]->DesiredChatGroup = $grParam;
    }
    if (!empty($opParam)) {
        $_user->Browsers[0]->DesiredChatPartner = Operator::GetSystemId($opParam);
    }
    $groupbuilder = new GroupBuilder($INTERNAL, $GROUPS, $CONFIG, $_user->Browsers[0]->DesiredChatGroup, $_user->Browsers[0]->DesiredChatPartner);
    $groupbuilder->Generate($_user);
    if (!empty($opParam)) {
        $_user->Browsers[0]->DesiredChatPartner = Operator::GetSystemId($opParam);
    }
    $groupsAvailable = parseBool($groupbuilder->GroupAvailable || isset($_POST[GET_EXTERN_RESET]) && strlen($groupbuilder->ErrorHTML) <= 2);
    $_preSelect = $_preSelect ? base64UrlEncode($_user->Browsers[0]->DesiredChatGroup) : "";
    $_user->AddFunctionCall("lz_chat_set_groups(" . $groupsAvailable . ",\"" . $groupbuilder->Result . "\" ," . $groupbuilder->ErrorHTML . ",'" . $_preSelect . "');", false);
    if (!$_overlay) {
        $_user->AddFunctionCall("lz_chat_release(" . $groupsAvailable . "," . $groupbuilder->ErrorHTML . ");", false);
    }
    return $_user;
}