Do not support old browsers at all

This commit is contained in:
Dmitriy Simushev 2013-02-19 12:13:01 +00:00
parent d2805afc9f
commit 8fc9b85bfa
3 changed files with 19 additions and 18 deletions

View File

@ -36,6 +36,17 @@ if(Settings::get('enablessl') == "1" && Settings::get('forcessl') == "1") {
}
}
// Do not support old browsers at all
if (get_remote_level($_SERVER['HTTP_USER_AGENT']) == 'old') {
// Create page array
$page = array_merge_recursive(
setup_logo()
);
expand("styles/dialogs", getchatstyle(), "nochat.tpl");
exit;
}
$page = array();
if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
@ -160,15 +171,13 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
}
$threadid = $thread->id;
$token = $thread->lastToken;
$level = get_remote_level($_SERVER['HTTP_USER_AGENT']);
$chatstyle = verifyparam( "style", "/^\w+$/", "");
header("Location: $webimroot/client.php?thread=$threadid&token=$token&level=$level".($chatstyle ? "&style=$chatstyle" : ""));
header("Location: $webimroot/client.php?thread=$threadid&token=$token".($chatstyle ? "&style=$chatstyle" : ""));
exit;
}
$token = verifyparam( "token", "/^\d{1,8}$/");
$threadid = verifyparam( "thread", "/^\d{1,8}$/");
$level = verifyparam( "level", "/^(ajaxed|old)$/");
$thread = Thread::load($threadid, $token);
if (! $thread) {
@ -177,13 +186,13 @@ if (! $thread) {
$page = array_merge_recursive(
$page,
setup_chatview_for_user($thread, $level)
setup_chatview_for_user($thread)
);
$pparam = verifyparam( "act", "/^(mailthread)$/", "default");
if( $pparam == "mailthread" ) {
expand("styles/dialogs", getchatstyle(), "mail.tpl");
} else if( $level == "ajaxed" ) {
} else {
// Load JavaScript plugins and JavaScripts, CSS files required by them
$page['additional_css'] = get_additional_css('client_chat_window');
$page['additional_js'] = get_additional_js('client_chat_window');
@ -192,8 +201,6 @@ if( $pparam == "mailthread" ) {
$page['chatModule'] = json_encode($page['chat']);
// Expand page
expand("styles/dialogs", getchatstyle(), "chat.tpl");
} else if( $level == "old" ) {
expand("styles/dialogs", getchatstyle(), "nochat.tpl");
}
?>

View File

@ -99,7 +99,7 @@ function get_remote_level($useragent)
}
}
}
return "simple";
return "ajaxed";
}
function is_agent_opera95()
@ -354,17 +354,14 @@ function setup_chatview(Thread $thread) {
*
* @global string $webimroot Root URL path for Mibew
* @param Thread $thread thread object
* @param string $level Chat level. Indicates ajax or old chat window should
* be used
* @return array Array of chat view data
*/
function setup_chatview_for_user(Thread $thread, $level) {
function setup_chatview_for_user(Thread $thread) {
global $webimroot;
$data = setup_chatview($thread);
$data['level'] = $level;
// Set user info
$data['chat']['user'] = array(
'name' => htmlspecialchars(topage($thread->userName)),
@ -380,14 +377,13 @@ function setup_chatview_for_user(Thread $thread, $level) {
// Set link to send mail page
$data['chat']['links']['mail'] = "$webimroot/client.php?"
. $params
. "&level=$level&act=mailthread";
. "&act=mailthread";
// Set SSL link
if (Settings::get('enablessl') == "1" && !is_secure_request()) {
$data['chat']['links']['ssl'] = get_app_location(true, true)
. "/client.php?"
. $params
. "&level=$level";
. $params;
}
return $data;
@ -399,8 +395,6 @@ function setup_chatview_for_user(Thread $thread, $level) {
* @global string $webimroot Root URL path for Mibew
* @global string $webim_encoding Current Mibew encoding
* @param Thread $thread thread object
* @param string $level Chat level. Indicates ajax or old chat window should
* be used
* @return array Array of chat view data
*/
function setup_chatview_for_operator(Thread $thread, $operator) {

View File

@ -98,7 +98,7 @@ if (!isset($_GET['token'])) {
}
$token = $thread->lastToken;
header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token&level=$remote_level");
header("Location: $webimroot/operator/agent.php?thread=$threadid&token=$token");
exit;
}