2007-05-10 21:31:10 +04:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* This file is part of Web Instant Messenger project.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2005-2007 Internet Services Ltd.
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
require('../libs/common.php');
|
|
|
|
require('../libs/chat.php');
|
|
|
|
require('../libs/operator.php');
|
|
|
|
|
|
|
|
$operator = check_login();
|
|
|
|
|
|
|
|
$threadid = verifyparam( "thread", "/^\d{1,8}$/");
|
|
|
|
|
|
|
|
if( !isset($_GET['token']) ) {
|
|
|
|
|
|
|
|
if( get_remote_level($_SERVER['HTTP_USER_AGENT']) != "ajaxed" ) {
|
|
|
|
die("old browser is used, please update it");
|
|
|
|
}
|
|
|
|
|
|
|
|
$thread = thread_by_id($threadid);
|
|
|
|
if( !$thread || !isset($thread['ltoken']) ) {
|
|
|
|
die("wrong thread");
|
|
|
|
}
|
|
|
|
|
2007-08-22 01:59:44 +04:00
|
|
|
|
2007-07-09 01:56:16 +04:00
|
|
|
take_thread($thread,$operator);
|
2007-05-10 21:31:10 +04:00
|
|
|
|
|
|
|
$token = $thread['ltoken'];
|
|
|
|
header("Location: ".$_SERVER['PHP_SELF']."?thread=$threadid&token=$token");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$token = verifyparam( "token", "/^\d{1,8}$/");
|
|
|
|
|
|
|
|
$thread = thread_by_id($threadid);
|
|
|
|
if( !$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] ) {
|
|
|
|
die("wrong thread");
|
|
|
|
}
|
|
|
|
|
2007-08-22 01:59:44 +04:00
|
|
|
setup_chatview_for_operator($thread, $operator);
|
2007-05-10 21:31:10 +04:00
|
|
|
|
|
|
|
start_html_output();
|
2007-07-09 01:56:16 +04:00
|
|
|
|
|
|
|
|
|
|
|
require('../view/chat_ajaxed.php');
|
2007-05-10 21:31:10 +04:00
|
|
|
|
|
|
|
?>
|