Ejemplo n.º 1
0
function setupChatViewForVisitor($thread, $level)
{
    $visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
    $page['agent'] = false;
    $page['visitor'] = true;
    $page['canpost'] = true;
    $nameisset = Resources::Get('chat.default.visitorname') != $visitSession['visitorname'];
    $page['displ1'] = $nameisset ? 'none' : 'inline';
    $page['displ2'] = $nameisset ? 'inline' : 'none';
    $page['level'] = $level;
    $page['ct_chatThreadId'] = $thread['threadid'];
    $page['ct_token'] = $thread['token'];
    $page['ct_visitor_name'] = $visitSession['visitorname'];
    $page['canChangeName'] = Visitor::getInstance()->canVisitorChangeName();
    $page['ct_company_name'] = Settings::Get('company_name');
    $page['ct_company_chatLogoURL'] = Settings::Get('logo');
    $page['webimHost'] = Settings::Get('hosturl');
    $page['send_shortcut'] = 'Enter';
    $params = 'thread=' . $thread['threadid'] . '&token=' . $thread['token'];
    $page['selfLink'] = WEBIM_ROOT . '/client.php?' . $params . '&level=' . $level;
    $page['isOpera95'] = is_agent_opera95();
    $page['displayrate'] = !empty($thread['rate']) ? 'none' : 'inline';
    $page['rateList'] = explode('|', Resources::Get('chat.operator_rates'));
    if (!empty($res)) {
        foreach ($res as $k => $v) {
            $page[$k] = $v;
        }
    }
    $page['viewonly'] = '0';
    return $page;
}
Ejemplo n.º 2
0
function updateContacts($name, $email, $phone, $threadid, $visitsessionid)
{
    $visitSession = MapperFactory::getMapper("VisitSession")->getById($visitsessionid);
    if ($visitSession['visitorname'] != $name) {
        Thread::getInstance()->RenameVisitor(array("threadid" => $threadid), $name);
        Visitor::getInstance()->setVisitorNameCookie($name);
        MapperFactory::getMapper("VisitSession")->save(array('visitsessionid' => $visitsessionid, 'visitorname' => $name));
    }
}
Ejemplo n.º 3
0
$TML->assign('RAND', rand(1000, 9999));
$args = array();
foreach ($_GET as $key => $item) {
    if ($key != 'action') {
        $args[] = "{$key}={$item}";
    }
}
$TML->assign('chaturi', "./?a=5" . join('&', $args));
$TML->assign('MAX_FILES', feedback::MAX_FILES);
$TML->assign('u_token_key', $_SESSION['rand']);
if ($has_errors) {
    echo "Error:{$errors[0]};{$errors['1']}" . ($errors[2] ? ';' . $errors[2] : '');
    exit;
}
$visitSessionId = VisitSession::GetInstance()->updateCurrentOrCreateSession();
$params = array();
$params['visitsessionid'] = $visitSessionId;
$params['lastpingvisitor'] = null;
$params['offline'] = 1;
$threads_count = MapperFactory::getMapper("Thread")->getNonEmptyThreadsCountByVisitorId($visitorid);
$thread = Thread::getInstance()->CreateThread(WEBIM_CURRENT_LOCALE, STATE_CLOSED, $params);
VisitSession::GetInstance()->UpdateVisitSession($visitSessionId, array('hasthread' => 1));
Thread::getInstance()->sendFirstMessageWithVisitorInfo($thread);
Visitor::getInstance()->setVisitorNameCookie($visitor_name);
$feedback = new feedback();
$uid = get_uid(false);
$login = $_SESSION['webim_uname'];
$email = $_SESSION['webim_email'];
$feedback->Add($uid, $login, $email, $department, iconv("UTF-8", "WINDOWS-1251//IGNORE", $message), $attach);
echo "Success: ok";
exit;
Ejemplo n.º 4
0
$visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
if (!$thread || !isset($thread['token']) || $token != $thread['token']) {
    die("wrong thread");
}
$TML = new SmartyClass();
setupChatViewForOperator($thread, $visitSession, $operator, $viewonly, $TML);
Browser::SendHtmlHeaders();
$pparam = verify_param("act", "/^(mailthread_c)\$/", "default");
if ($pparam == "mailthread_c") {
    $TML->assignCompanyInfoAndTheme();
    $TML->assign('threadid', $thread['threadid']);
    $TML->assign('token', $thread['token']);
    $TML->assign('level', $_REQUEST['level']);
    $theme = Browser::getCurrentTheme();
    $TML->assign('theme', $theme);
    $TML->assign('email_from', Visitor::getInstance()->getEmail($threadid));
    $TML->assign('email', '*****@*****.**');
    // отделы службы поддержки free-lance ---
    $aDetps = array();
    foreach ($aDkoOrder as $nOrder) {
        $aDetps[] = array('value' => $nOrder, 'title' => $aDko[$nOrder]['option']);
    }
    $TML->assign('depts', $aDetps);
    //---------------------------------------
    $TML->display('send-history-c.tpl');
} else {
    $snd_uri = '/webim/operator/agent.php?thread=' . $threadid . '&token=' . $token . '&act=mailthread_c';
    $TML->assign('snd_uri', $snd_uri);
    $TML->display('chat_ajaxed.tpl');
}
function preparePredefinedAnswers($locale)
Ejemplo n.º 5
0
            Thread::getInstance()->CommitThread($thread['threadid'], array('shownmessageid' => $postedid));
        }
        if (!$isvisitor && $thread['state'] == STATE_INVITE) {
            Invitation::GetInstance()->UpdateInvitationMessage($thread['threadid'], $postedid);
        }
    }
    Thread::getInstance()->PrintThreadMessages($thread, $token, $lastid, $isvisitor, $outformat, $viewonly);
    exit;
} elseif ($act == "rename") {
    if (!Visitor::getInstance()->canVisitorChangeName()) {
        show_error("server: forbidden to change name");
    }
    if (!empty($_REQUEST['name'])) {
        $newname = smarticonv('UTF-8', WEBIM_ENCODING, $_REQUEST['name']);
        Thread::getInstance()->RenameVisitor($thread, $newname);
        Visitor::getInstance()->setVisitorNameCookie($newname);
    }
    //        $data = strtr(base64_encode($newname), '+/=', '-_, ');
    show_ok_result("rename");
} elseif ($act == "ping") {
    show_ok_result("ping");
} elseif ($act == "close") {
    if ($isvisitor) {
        ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'visitor_close');
        $visitor = GetVisitorFromRequestAndSetCookie();
        $threads = MapperFactory::getMapper("Thread")->getOpenThreadsForVisitor($visitor['id']);
        if (count($threads) < 1) {
            VisitSession::GetInstance()->deleteVisitSessionCurrentPageFile($visitor['id']);
        }
    } elseif ($thread['operatorid'] == $operator['operatorid']) {
        ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'operator_close');