From 11d726867cece59d6851b3cc1c3b7a0bf832a2e6 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Tue, 21 May 2013 08:32:15 +0000 Subject: [PATCH] Fix bug with cookie update in widget Widget update target site tracking cookie only if it is absent --- src/messenger/webim/widget.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/messenger/webim/widget.php b/src/messenger/webim/widget.php index 83a5a504..2cee0929 100644 --- a/src/messenger/webim/widget.php +++ b/src/messenger/webim/widget.php @@ -35,6 +35,7 @@ if (Settings::get('enabletracking') == '1') { // Session started. Track visitor $invited = invitation_check($_SESSION['visitorid']); $visitorid = track_visitor($_SESSION['visitorid'], $entry, $referer); + $visitor = track_get_visitor_by_id($visitorid); } else { $visitor = track_get_visitor_by_user_id($user_id); if ($visitor !== false) { @@ -47,7 +48,6 @@ if (Settings::get('enabletracking') == '1') { // Start tracking session $visitorid = track_visitor_start($entry, $referer); $visitor = track_get_visitor_by_id($visitorid); - $user_id = $visitor['userid']; } } @@ -55,11 +55,11 @@ if (Settings::get('enabletracking') == '1') { $_SESSION['visitorid'] = $visitorid; } - if ($user_id !== false) { + if ($user_id === false) { // Update local cookie value at target site $response['handlers'][] = 'updateUserId'; $response['dependences']['updateUserId'] = array(); - $response['data']['user']['id'] = $user_id; + $response['data']['user']['id'] = $visitor['userid']; } // Check if visitor just invited to chat