Exemplo n.º 1
0
 function CreateOperator($_loginId, $_fullName, $_email, $_permissions, $_webspace, $_passwordMD5, $_administrator, $_groups, $_language)
 {
     $operator = new Operator(getId(USER_ID_LENGTH), $_loginId);
     $operator->Load();
     $operator->Fullname = $_fullName;
     $operator->Email = $_email;
     $operator->PermissionSet = $_permissions;
     $operator->Webspace = $_webspace;
     $operator->Password = $_passwordMD5;
     $operator->Level = $_administrator ? 1 : 0;
     $operator->Groups = $_groups;
     $operator->Language = $_language;
     $operator->Save(true);
     return $operator;
 }
Exemplo n.º 2
0
function processActions()
{
    global $BROWSER, $CONFIG;
    $actionData = "";
    $BROWSER->GetActions();
    if ($BROWSER->Request != null && $BROWSER->Request->Status == REQUEST_STATUS_ACTIVE) {
        $requestUser = new Operator($BROWSER->Request->SenderSessId, $BROWSER->Request->SenderUserId);
        $requestUser->Load();
        if ($requestUser->LastActive < time() - $CONFIG["timeout_clients"] || $requestUser->Status == USER_STATUS_OFFLINE) {
            $BROWSER->Request->Destroy();
            $actionData .= "lz_tracking_close_request();";
        }
        if (isset($_GET[GET_TRACK_REQUEST_DECLINED]) || isset($_GET[GET_TRACK_REQUEST_ACCEPTED])) {
            if (isset($_GET[GET_TRACK_REQUEST_DECLINED])) {
                $BROWSER->Request->Decline();
            }
            if (isset($_GET[GET_TRACK_REQUEST_ACCEPTED])) {
                $BROWSER->Request->Accept();
            }
            $actionData .= "lz_tracking_close_request();";
        }
    } else {
        if ($BROWSER->Request != null && $BROWSER->Request->Status != REQUEST_STATUS_ACTIVE) {
            $actionData .= "lz_tracking_close_request();";
        }
    }
    if ($BROWSER->Request != null && $BROWSER->Request->Status == REQUEST_STATUS_ACTIVE && !isset($_GET[GET_TRACK_REQUEST_ACTIVE])) {
        $height = !@file_exists(FILE_INVITATIONLOGO) ? 220 : 302;
        $actionData .= $BROWSER->Request->GetCommand(getInvitationTemplate($BROWSER->Request->Id, $BROWSER->Request->SenderUserId, $BROWSER->UserId, $BROWSER->Request->SenderFullname, $BROWSER->Request->SenderGroupId), htmlentities($BROWSER->Request->Text, ENT_QUOTES, "UTF-8"), 302, $height);
    } else {
        if ($BROWSER->Request != null && $BROWSER->Request->Status == REQUEST_STATUS_ACCEPTED) {
            // hold
        }
    }
    if ($BROWSER->Guide != null) {
        $actionData .= $BROWSER->Guide->GetCommand();
        $BROWSER->Guide->Destroy();
    }
    if ($BROWSER->Alerts != null) {
        foreach ($BROWSER->Alerts as $alert) {
            $actionData .= $alert->GetCommand();
            $alert->Destroy();
        }
        $actionData = str_replace("<!--server-->", LIVEZILLA_URL, $actionData);
    }
    return $actionData;
}
Exemplo n.º 3
0
 function LoadChat($_config, $_internal)
 {
     $declined = true;
     $this->Chat = null;
     $this->ChatRequestReceiptants = array();
     $chatfiles = getDirectory($this->Folder, false);
     foreach ($chatfiles as $chatfile) {
         if (strpos($chatfile, "." . EX_CHAT_OPEN) !== false) {
             if (strpos($chatfile, "." . EX_CHAT_OPEN) !== false && ($_config["gl_alloc_mode"] == ALLOCATION_MODE_ALL || isnull($this->Chat))) {
                 $partnerid = str_replace("." . EX_CHAT_OPEN, "", $chatfile);
                 $chat = new Chat($this->Folder . $chatfile);
                 $activated = $chat->IsActivated($partnerid);
                 if (!$chat->Declined) {
                     $declined = false;
                     if (!$activated) {
                         $this->ChatRequestReceiptants[] = $partnerid;
                     }
                 }
                 if ($activated || isnull($this->Chat) || CALLER_TYPE != CALLER_TYPE_EXTERNAL && !isnull($this->Chat) && ($partnerid == $_internal->SystemId && !$chat->IsActivated(null))) {
                     if (CALLER_TYPE != CALLER_TYPE_EXTERNAL && $chat->Declined) {
                         continue;
                     }
                     $this->Chat = $chat;
                     if (isnull($_internal)) {
                         $_internal = new Operator($partnerid, null);
                         $_internal->Load();
                         $this->DesiredChatPartnerTyping = $_internal->Typing == $this->SystemId;
                     }
                     $dataSetTime = getDataSetTime($_internal->SessionFile);
                     if ($_internal->Status == CHAT_STATUS_ACTIVE || $dataSetTime < time() - $_config["timeout_clients"]) {
                         $this->Chat->Closed = true;
                     }
                 }
             } else {
                 unlinkDataSet($this->Folder . $chatfile);
             }
         }
     }
     if (!isnull($this->Chat)) {
         $this->Chat->Declined = $declined;
     }
 }