function processTyping($_dgroup = "")
{
    global $USER, $GROUPS, $INTERNAL, $LZLANG;
    //$USER->Browsers[0]->InternalUser->LoadProfile();
    $groupname = addslashes($GROUPS[$USER->Browsers[0]->DesiredChatGroup]->GetDescription($USER->Language));
    foreach ($GROUPS as $group) {
        if ($group->IsDynamic && !empty($group->Members[$USER->Browsers[0]->SystemId])) {
            $_dgroup = $group->Descriptions["EN"];
            foreach ($group->Members as $member => $persistent) {
                if ($member != $USER->Browsers[0]->SystemId) {
                    if (!empty($INTERNAL[$member])) {
                        if ($INTERNAL[$member]->Status == USER_STATUS_OFFLINE) {
                            continue;
                        }
                        $name = $INTERNAL[$member]->Fullname;
                    } else {
                        $name = getValueBySystemId($member, "fullname", $LZLANG["client_guest"]);
                        if (empty($name)) {
                            $name = $LZLANG["client_guest"];
                        }
                    }
                    if ($USER->Browsers[0]->DesiredChatPartner != $member && (!$persistent || $member == $USER->Browsers[0]->SystemId)) {
                        $USER->AddFunctionCall("lz_chat_set_room_member('" . base64_encode($member) . "','" . base64_encode($name) . "');", false);
                    }
                }
            }
        }
    }
    foreach ($USER->Browsers[0]->Members as $sysid => $chatm) {
        if ($chatm->Status < 2 && empty($chatm->Declined)) {
            $USER->AddFunctionCall("lz_chat_set_room_member('" . base64_encode($sysid) . "','" . base64_encode($INTERNAL[$sysid]->Fullname) . "');", false);
        }
    }
    $USER->AddFunctionCall("lz_chat_set_host(\"" . base64_encode($USER->Browsers[0]->InternalUser->UserId) . "\",\"" . base64_encode(addslashes($USER->Browsers[0]->InternalUser->Fullname)) . "\",\"" . base64_encode($groupname) . "\",\"" . strtolower($USER->Browsers[0]->InternalUser->Language) . "\"," . parseBool($USER->Browsers[0]->InternalUser->Typing == $USER->Browsers[0]->SystemId) . "," . parseBool(!empty($USER->Browsers[0]->InternalUser->Profile) && $USER->Browsers[0]->InternalUser->Profile->Public) . ",\"" . base64_encode($_dgroup) . "\");", false);
}
function processPostForExternal($rec, $recgroup, $post, $time, $count, $_group = false)
{
    global $INTERNAL, $GROUPS, $STATS;
    if (STATS_ACTIVE) {
        $STATS->ProcessAction(ST_ACTION_INTERNAL_POST);
    }
    if (!empty($INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]) && $_group) {
        $INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]->Load();
        $INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]->Members[$rec] = true;
        $chatId = $INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]->ChatId;
        $receiverlist = $INTERNAL[CALLER_SYSTEM_ID]->ExternalChats[$rec]->Members;
    } else {
        $chatId = getValueBySystemId($rec, "chat_id", "");
        $receiverlist = array($rec => $rec);
    }
    $npost = new Post(getId(32), CALLER_SYSTEM_ID, "", $post, $time, $chatId, $INTERNAL[CALLER_SYSTEM_ID]->Fullname);
    foreach ($receiverlist as $systemid => $member) {
        if ($systemid == CALLER_SYSTEM_ID || !empty($member->Declined)) {
            continue;
        }
        if (!empty($INTERNAL[$systemid]) && !empty($GROUPS[$recgroup]->Members[$systemid])) {
            continue;
        }
        $npost->Receiver = $systemid;
        $npost->Persistent = false;
        $npost->Translation = $_POST[POST_INTERN_PROCESS_POSTS . "_vd" . $count];
        $npost->TranslationISO = $_POST[POST_INTERN_PROCESS_POSTS . "_ve" . $count];
        $npost->ReceiverGroup = $recgroup;
        $npost->ReceiverOriginal = $rec;
        $npost->Save();
        $INTERNAL[CALLER_SYSTEM_ID]->SetRepostTime($npost->ReceiverGroup, $npost->Created);
    }
}
Example #3
0
 $post = new Post($id, $USER->Browsers[0]->SystemId, "", base64UrlDecode($_GET["mp" . $pc]), !empty($_GET["mc" . $pc]) ? $_GET["mc" . $pc] : time(), $USER->Browsers[0]->ChatId, $senderName);
 $post->BrowserId = $BROWSER->BrowserId;
 if (!empty($_GET["mpti" . $pc])) {
     $post->Translation = base64UrlDecode($_GET["mpt" . $pc]);
     $post->TranslationISO = base64UrlDecode($_GET["mpti" . $pc]);
 }
 $saved = false;
 if (!$USER->Browsers[0]->Waiting) {
     foreach ($GROUPS as $groupid => $group) {
         if ($group->IsDynamic && $USER->Browsers[0]->Status == CHAT_STATUS_ACTIVE && !empty($group->Members[$USER->Browsers[0]->SystemId])) {
             foreach ($group->Members as $member => $persistent) {
                 if ($member != $USER->Browsers[0]->SystemId) {
                     if (!empty($INTERNAL[$member])) {
                         processPost($id, $post, $member, $pc, $groupid, $USER->Browsers[0]->ChatId);
                     } else {
                         processPost($id, $post, $member, $pc, $groupid, getValueBySystemId($member, "chat_id", ""));
                     }
                     $saved = true;
                 }
             }
             $pGroup = $group;
         }
     }
     foreach ($USER->Browsers[0]->Members as $systemid => $member) {
         if (!empty($member->Declined)) {
             continue;
         }
         if (!empty($INTERNAL[$systemid]) && !empty($pGroup->Members[$systemid])) {
             continue;
         }
         if (!(!empty($pGroup) && !empty($INTERNAL[$systemid]))) {