本文整理汇总了PHP中Browser::GetExtAddr方法的典型用法代码示例。如果您正苦于以下问题:PHP Browser::GetExtAddr方法的具体用法?PHP Browser::GetExtAddr怎么用?PHP Browser::GetExtAddr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser::GetExtAddr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCurrentOrCreateSession
function updateCurrentOrCreateSession()
{
$session = $this->getCurrentSession();
$visitorInfo = GetVisitorFromRequestAndSetCookie();
$fl_login = isset($_SESSION['login']) ? $_SESSION['login'] : '';
if (empty($session)) {
$ip = Browser::GetExtAddr();
$remoteHost = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : null;
$useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
$userid = null;
$sessionId = $this->createVisitSession($ip, $remoteHost, $useragent, $userid, $visitorInfo['id'], $visitorInfo['name'], $fl_login, $visitorInfo['partnerref']);
} else {
$sessionId = is_array($session) ? $session['visitsessionid'] : $session;
$this->UpdateVisitSession($sessionId, array('fl_login' => $fl_login, 'visitorname' => $visitorInfo['name']));
}
VisitedPage::GetInstance()->addOrUpdateFromSession($sessionId);
$_SESSION['WEBIM_VISIT_SESSION_ID'] = $sessionId;
return $sessionId;
}
示例2: createNewThread
function createNewThread()
{
$extAddr = Browser::GetExtAddr();
$remoteHost = !empty($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : $extAddr;
$visitSessionId = VisitSession::GetInstance()->updateCurrentOrCreateSession();
$params = array();
$params['visitsessionid'] = $visitSessionId;
$params['lastpingvisitor'] = null;
// $canChangeName = Visitor::getInstance()->canVisitorChangeName();
// if (!empty($_REQUEST['visitorname']) && $canChangeName) {
// Visitor::getInstance()->setVisitorNameCookie($_REQUEST['visitorname']);
// $params['visitorname'] = $_REQUEST['visitorname'];
// }
$operatorid = verify_param('operatorid', "/^(\\d)\$/");
$departmentkey = verify_param('departmentkey', "/^\\w+\$/");
$autoinviteid = verify_param('autoinviteid', "/^\\d+\$/");
if (!empty($departmentkey)) {
$department = MapperFactory::getMapper('Department')->getByDepartmentKey($departmentkey);
$params['departmentid'] = $department['departmentid'];
}
// else {
// $departments = MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale());
//
// if (count($departments) == 1) {
// $params['departmentid'] = $departments[0]['departmentid'];
// }
// }
//
$startThreadState = null;
if (!empty($operatorid) && ($operator = Operator::GetOperatorById($operatorid))) {
$params['nextoperatorid'] = $operator['operatorid'];
$startThreadState = STATE_LOADING_FOR_EXACT_OPERATOR;
} else {
$startThreadState = STATE_LOADING;
}
$thread = Thread::getInstance()->CreateThread(Resources::getCurrentLocale(), $startThreadState, $params);
VisitSession::GetInstance()->UpdateVisitSession($visitSessionId, array('hasthread' => 1));
set_has_threads(HAS_THREADS_FILE);
// если пользователь не ввел email, то по умолчанию сообщаем email с основной базы
if (empty($_REQUEST['email']) && !empty($_SESSION['uid'])) {
$_REQUEST['email'] = $GLOBALS['DB']->val('SELECT email FROM users WHERE uid = ?', $_SESSION['uid']);
}
Thread::getInstance()->sendFirstMessageWithVisitorInfo($thread, $_REQUEST);
if (!empty($autoinviteid)) {
Thread::getInstance()->sendAutoIniviteTextToOperator($thread, $autoinviteid);
}
$visitor = GetVisitorFromRequestAndSetCookie();
$opener = Thread::getInstance()->getOpenerWithTitle();
VisitSession::GetInstance()->setVisitSessionCurrentPage($visitor['id'], $opener[0], $opener[1]);
if (!empty($_REQUEST['message'])) {
$v = GetVisitorFromRequestAndSetCookie();
$hash = array();
$hash['sendername'] = $v['name'];
$hash['message'] = $_REQUEST['message'];
ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'visitor_message', $hash);
}
if (!empty($email) || !empty($phone)) {
Thread::getInstance()->PostMessage($thread['threadid'], KIND_FOR_AGENT, Resources::get('start.chat.info', array($email, $phone)));
}
// MapperFactory::getMapper("Thread")->incrementVisitorMessageCount($threadid);
return $thread;
}