コード例 #1
0
	$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'])) {
		foreach ($statistics['visited_pages'] as $p) {
			if(isset($p['url'], $p['time'], $p['referrer'])) {
				$p = array_map("htmlspecialchars", $p);
				$visited_pages[] = $p;
			}
		}
	}
	
	if(count($visited_pages) > 0 && $total_time_on_site > 0) {
		$_SESSION['user_stats'] = array();
コード例 #2
0
ファイル: class.thread.php プロジェクト: Nikitian/fl-ru-damp
 public function sendFirstMessageWithVisitorInfo($thread, $params = array())
 {
     $visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
     $firstPage = null;
     $visted_pages = "";
     if (!session_id()) {
         session_start();
     }
     if (isset($_SESSION['user_stats'])) {
         $stats = $_SESSION['user_stats'];
     } else {
         $stats = getUsersStatsFromCookie();
     }
     if (isset($stats['visited_pages']) && is_array($stats['visited_pages'])) {
         if (count($stats['visited_pages']) > 0) {
             $firstPage = $stats['visited_pages'][0];
         }
         $visted_pages = "\n" . Resources::Get("chat.visited_pages");
         foreach ($stats['visited_pages'] as $vp) {
             $title = isset($_SESSION['titles'], $_SESSION['titles'][$vp['url']]) ? $_SESSION['titles'][$vp['url']] : "";
             if (WEBIM_ENCODING != 'UTF-8') {
                 $title = smarticonv('utf-8', WEBIM_ENCODING, $title);
             }
             if (empty($title)) {
                 $title = Resources::Get("chat.visited_page.no_title");
             }
             $visted_pages .= "\n" . Resources::Get("chat.visited_page", array($title, HTTP_PREFIX . $_SERVER['HTTP_HOST'] . $vp['url'], $vp['time']));
         }
     }
     $openerText = self::formatOpenerWithTitle();
     $message = Resources::Get(empty($openerText) ? 'chat.came.from.unknown' : 'chat.came.from', $openerText);
     $simple = "\n%PARAM%: %VALUE%";
     $link = "\n%PARAM%: %VALUE% %URL%";
     if (!empty($thread['departmentid'])) {
         $departmentid = $thread['departmentid'];
         $dep = MapperFactory::getMapper("DepartmentLocale")->getDepartmentLocale($departmentid, Resources::getCurrentLocale());
         $message .= str_replace(array('%PARAM%', '%VALUE%'), array(Resources::Get('pending.table.head.department'), $dep['departmentname']), $simple);
     }
     if ($firstPage !== null) {
         if (!empty($firstPage['referrer'])) {
             $message .= str_replace(array('%PARAM%', '%VALUE%'), array(Resources::Get('chat.window.referrer'), parseReferrer($firstPage['referrer'], 'chat.window.referrer')), $simple);
         }
         if (!empty($firstPage['url'])) {
             $message .= str_replace(array('%PARAM%', '%VALUE%'), array(Resources::Get('chat.window.landingpage'), $firstPage['url']), $simple);
         }
     }
     $visitor_geodata = GeoIPLookup::getGeoDataByIP($visitSession['ip']);
     if (!empty($visitor_geodata)) {
         $message .= str_replace(array('%PARAM%', '%URL%', '%VALUE%'), array(Resources::Get('chat.window.geolocation'), "http://maps.google.com/maps?q=" . $visitor_geodata['lat'] . "," . $visitor_geodata['lng'], $visitor_geodata['city'] . ' ' . $visitor_geodata['country']), $link);
     }
     $message .= str_replace(array('%PARAM%', '%VALUE%'), array(Resources::Get('chat.window.browser'), get_user_agent($visitSession['useragent'])), $simple);
     $message .= str_replace(array('%PARAM%', '%VALUE%'), array(Resources::Get('chat.window.ip'), WEBIM_WHOIS_LINK . urlencode($visitSession['ip'])), $simple);
     if (!empty($visitSession['remotehost'])) {
         $message .= str_replace(array('%PARAM%', '%VALUE%'), array(Resources::Get('chat.window.remotehost'), $visitSession['remotehost']), $simple);
     }
     if (!empty($params['email'])) {
         $message .= str_replace(array('%PARAM%', '%VALUE%'), array(Resources::Get('chat.window.email'), $params['email']), $simple);
     }
     $message .= str_replace(array('%PARAM%', '%VALUE%'), array(Resources::Get('chat.window.fl_login'), $visitSession['fl_login']), $simple);
     $chats = Thread::getInstance()->CountNonEmptyThreads($visitSession['visitorid']);
     if ($chats > 0) {
         $message .= str_replace(array('%PARAM%', '%URL%', '%VALUE%'), array(Resources::Get('chat.window.chats'), HTTP_PREFIX . $_SERVER['HTTP_HOST'] . WEBIM_ROOT . '/operator/history.php?q=' . $visitSession['visitorid'], $chats), $link);
     }
     $message .= $visted_pages;
     Thread::getInstance()->PostMessage($thread['threadid'], KIND_FOR_AGENT, $message);
 }
コード例 #3
0
ファイル: ainvite.php プロジェクト: Nikitian/fl-ru-damp
    $_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'])) {
    foreach ($statistics['visited_pages'] as $p) {
        if (isset($p['url'], $p['time'], $p['referrer'])) {
            $p = array_map("htmlspecialchars", $p);
            $visited_pages[] = $p;
        }
    }
}
if (count($visited_pages) > 0 && $total_time_on_site > 0) {
    $_SESSION['user_stats'] = array();
    $_SESSION['user_stats']['visited_pages'] = $visited_pages;
    $_SESSION['user_stats']['total_time_on_site'] = htmlspecialchars($total_time_on_site);