2007-10-10 19:15:47 +04:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* This file is part of Web Instant Messenger project.
|
|
|
|
*
|
2008-05-06 01:08:57 +04:00
|
|
|
* Copyright (c) 2005-2008 Internet Services Ltd.
|
2007-10-10 19:15:47 +04:00
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* Evgeny Gryaznov - initial API and implementation
|
|
|
|
*/
|
|
|
|
|
2008-06-05 01:36:54 +04:00
|
|
|
require_once('../libs/common.php');
|
|
|
|
require_once('../libs/chat.php');
|
|
|
|
require_once('../libs/operator.php');
|
2007-10-10 19:15:47 +04:00
|
|
|
|
|
|
|
$operator = check_login();
|
|
|
|
|
|
|
|
$threadid = verifyparam( "thread", "/^\d{1,8}$/");
|
|
|
|
|
|
|
|
if( !isset($_GET['token']) ) {
|
|
|
|
|
2008-09-30 02:46:27 +04:00
|
|
|
$remote_level = get_remote_level($_SERVER['HTTP_USER_AGENT']);
|
|
|
|
if( $remote_level != "ajaxed" ) {
|
2007-10-10 19:15:47 +04:00
|
|
|
die("old browser is used, please update it");
|
|
|
|
}
|
|
|
|
|
|
|
|
$thread = thread_by_id($threadid);
|
|
|
|
if( !$thread || !isset($thread['ltoken']) ) {
|
|
|
|
die("wrong thread");
|
|
|
|
}
|
|
|
|
|
2008-09-30 02:46:27 +04:00
|
|
|
take_thread($thread,$operator);
|
2007-10-10 19:15:47 +04:00
|
|
|
|
2008-09-30 02:46:27 +04:00
|
|
|
$token = $thread['ltoken'];
|
|
|
|
header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token&level=$remote_level");
|
|
|
|
exit;
|
2007-10-10 19:15:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
$token = verifyparam( "token", "/^\d{1,8}$/");
|
|
|
|
|
|
|
|
$thread = thread_by_id($threadid);
|
|
|
|
if( !$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] ) {
|
|
|
|
die("wrong thread");
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_chatview_for_operator($thread, $operator);
|
|
|
|
|
|
|
|
start_html_output();
|
|
|
|
|
|
|
|
require('../view/chat_ajaxed.php');
|
|
|
|
|
2007-05-10 21:31:10 +04:00
|
|
|
?>
|