Ejemplo n.º 1
0
 function assignCompanyInfoAndTheme()
 {
     $this->assign('url', Settings::Get('hosturl', Resources::Get('site.url')));
     $this->assign('company', Settings::Get('company_name', Resources::Get('company.webim')));
     $this->assign('logo', Settings::Get('logo', WEBIM_ROOT . '/themes/default/images/logo.gif'));
     $this->assign('theme', Browser::getCurrentTheme());
 }
 private static function readResources($locale)
 {
     $hash = array();
     Resources::readResourceFile(dirname(__FILE__) . "/../locales/{$locale}/properties.txt", $hash);
     $fileName = $_SERVER['DOCUMENT_ROOT'] . WEBIM_ROOT . '/themes/' . Browser::getCurrentTheme() . '/locales/' . $locale . '/resources.txt';
     if (is_file($fileName)) {
         Resources::readResourceFile($fileName, $hash);
     }
     return $hash;
 }
Ejemplo n.º 3
0
function getInvitationContent($avatar, $message, $isSecure)
{
    $host = ($isSecure ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'];
    $TML = new SmartyClass();
    $TML->assign('message', empty($message) ? Resources::Get('invite.default.message') : $message);
    $TML->assign('operatorimage', empty($avatar) ? null : $host . $avatar);
    $TML->assign('theme', Browser::getCurrentTheme());
    $TML->assign('addressprefix', $host);
    $invitation = $TML->fetch('invite.tpl');
    $invitation = addslashes($invitation);
    $invitation = str_replace("\n", "' + \n'", $invitation);
    $invitation = str_replace("\r", '', $invitation);
    return $invitation;
}
Ejemplo n.º 4
0
function showLeaveMessageSentPage()
{
    $TML = new SmartyClass();
    $TML->assignCompanyInfoAndTheme();
    $TML->assign('theme', Browser::getCurrentTheme());
    $TML->display('leave-message-sent.tpl');
    exit;
}
Ejemplo n.º 5
0
 * http://webim.ru/license.html
 * 
 */
require_once 'classes/functions.php';
require_once 'classes/class.thread.php';
require_once 'classes/class.visitsession.php';
require_once 'classes/class.visitedpage.php';
require_once 'classes/class.invitation.php';
$trackStateStrings = array(INVITATION_UNINITIALIZED => "uninitialized", INVITATION_CAN_BE_SENT => "can-be-sent", INVITATION_SENT => "sent", INVITATION_ACCEPTED => "accepted", INVITATION_REJECTED => "rejected", INVITATION_TIMEOUT => "timeout", INVITATION_MISSED => "missed");
if (!Operator::getInstance()->hasViewTrackerOperators()) {
    die;
}
$event = verify_param("event", "/^(init|poll|accept|reject|timeout|left)\$/");
$visitsessionid = VisitSession::GetInstance()->updateCurrentOrCreateSession();
if ($event == "init") {
    initVisitedPage($visitsessionid, Browser::getCurrentTheme());
    exit;
}
$pageid = verify_param("pageid", "/^[a-z0-9]{32}\$/");
// FIXME: do we really need this udpate?
VisitSession::GetInstance()->UpdateVisitSession($visitsessionid);
VisitedPage::GetInstance()->UpdateVisitedPage($pageid);
$visitedpage = VisitedPage::GetInstance()->GetVisitedPageById($pageid);
$state = Invitation::GetInstance()->GetInvitationState($pageid);
$showInvitation = NULL;
$nextState = $state;
switch ($state) {
    case INVITATION_UNINITIALIZED:
        switch ($event) {
            case "poll":
                if (VisitedPage::GetInstance()->HasPendingInvitation($pageid)) {
Ejemplo n.º 6
0
$token = verify_param("token", "/^\\d{1,8}\$/");
$thread = Thread::getInstance()->GetThreadById($threadid);
$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');
Ejemplo n.º 7
0
       $thread = MapperFactory::getMapper("Thread")->getActiveThreadForVisitor($visitor['id']);
       if(!empty($thread)) {
         $res = true;
       } else {
         $res = false;
       }
       $_COOKIE[WEBIM_COOKIE_VISITOR_IN_CHAT] = $res;
       setcookie(WEBIM_COOKIE_VISITOR_IN_CHAT, $res, time() + 30, '/');
	}
	
	$user_in_chat = false;
	if($_COOKIE[WEBIM_COOKIE_VISITOR_IN_CHAT]) {
	  $user_in_chat = true;
	}
	
	$invite_image = $location . "/themes/" . Browser::getCurrentTheme() . '/images/default-auto-invite-operator.gif';
	if($operators_count == 1) {
	  $operator = Operator::getInstance()->GetOperatorById(array_shift($operators));
	  if(!empty($operator) && !empty($operator['avatar'])) {
	    $invite_image = $operator['avatar'];
	  }
	}
	
	$json = new Json(SERVICES_JSON_LOOSE_TYPE);

	$statistics = getUsersStatsFromCookie();//isset($_COOKIE[WEBIM_COOKIE_AUTOINVITE_STATS]) ? $json->decode($_COOKIE[WEBIM_COOKIE_AUTOINVITE_STATS]) : null;
	$total_time_on_site = isset($_COOKIE[WEBIM_COOKIE_TOTAL_TIME_ON_SITE]) ? intval($_COOKIE[WEBIM_COOKIE_TOTAL_TIME_ON_SITE]) : 0;
	
	$visited_pages = array();
	
	if(isset($statistics['visited_pages']) && is_array($statistics['visited_pages'])) {