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(); $page = array();
if( !isset($_GET['token']) || !isset($_GET['thread']) ) { if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
@ -160,15 +171,13 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
} }
$threadid = $thread->id; $threadid = $thread->id;
$token = $thread->lastToken; $token = $thread->lastToken;
$level = get_remote_level($_SERVER['HTTP_USER_AGENT']);
$chatstyle = verifyparam( "style", "/^\w+$/", ""); $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; exit;
} }
$token = verifyparam( "token", "/^\d{1,8}$/"); $token = verifyparam( "token", "/^\d{1,8}$/");
$threadid = verifyparam( "thread", "/^\d{1,8}$/"); $threadid = verifyparam( "thread", "/^\d{1,8}$/");
$level = verifyparam( "level", "/^(ajaxed|old)$/");
$thread = Thread::load($threadid, $token); $thread = Thread::load($threadid, $token);
if (! $thread) { if (! $thread) {
@ -177,13 +186,13 @@ if (! $thread) {
$page = array_merge_recursive( $page = array_merge_recursive(
$page, $page,
setup_chatview_for_user($thread, $level) setup_chatview_for_user($thread)
); );
$pparam = verifyparam( "act", "/^(mailthread)$/", "default"); $pparam = verifyparam( "act", "/^(mailthread)$/", "default");
if( $pparam == "mailthread" ) { if( $pparam == "mailthread" ) {
expand("styles/dialogs", getchatstyle(), "mail.tpl"); expand("styles/dialogs", getchatstyle(), "mail.tpl");
} else if( $level == "ajaxed" ) { } else {
// Load JavaScript plugins and JavaScripts, CSS files required by them // Load JavaScript plugins and JavaScripts, CSS files required by them
$page['additional_css'] = get_additional_css('client_chat_window'); $page['additional_css'] = get_additional_css('client_chat_window');
$page['additional_js'] = get_additional_js('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']); $page['chatModule'] = json_encode($page['chat']);
// Expand page // Expand page
expand("styles/dialogs", getchatstyle(), "chat.tpl"); 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() function is_agent_opera95()
@ -354,17 +354,14 @@ function setup_chatview(Thread $thread) {
* *
* @global string $webimroot Root URL path for Mibew * @global string $webimroot Root URL path for Mibew
* @param Thread $thread thread object * @param Thread $thread thread object
* @param string $level Chat level. Indicates ajax or old chat window should
* be used * be used
* @return array Array of chat view data * @return array Array of chat view data
*/ */
function setup_chatview_for_user(Thread $thread, $level) { function setup_chatview_for_user(Thread $thread) {
global $webimroot; global $webimroot;
$data = setup_chatview($thread); $data = setup_chatview($thread);
$data['level'] = $level;
// Set user info // Set user info
$data['chat']['user'] = array( $data['chat']['user'] = array(
'name' => htmlspecialchars(topage($thread->userName)), 'name' => htmlspecialchars(topage($thread->userName)),
@ -380,14 +377,13 @@ function setup_chatview_for_user(Thread $thread, $level) {
// Set link to send mail page // Set link to send mail page
$data['chat']['links']['mail'] = "$webimroot/client.php?" $data['chat']['links']['mail'] = "$webimroot/client.php?"
. $params . $params
. "&level=$level&act=mailthread"; . "&act=mailthread";
// Set SSL link // Set SSL link
if (Settings::get('enablessl') == "1" && !is_secure_request()) { if (Settings::get('enablessl') == "1" && !is_secure_request()) {
$data['chat']['links']['ssl'] = get_app_location(true, true) $data['chat']['links']['ssl'] = get_app_location(true, true)
. "/client.php?" . "/client.php?"
. $params . $params;
. "&level=$level";
} }
return $data; return $data;
@ -399,8 +395,6 @@ function setup_chatview_for_user(Thread $thread, $level) {
* @global string $webimroot Root URL path for Mibew * @global string $webimroot Root URL path for Mibew
* @global string $webim_encoding Current Mibew encoding * @global string $webim_encoding Current Mibew encoding
* @param Thread $thread thread object * @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 * @return array Array of chat view data
*/ */
function setup_chatview_for_operator(Thread $thread, $operator) { function setup_chatview_for_operator(Thread $thread, $operator) {

View File

@ -98,7 +98,7 @@ if (!isset($_GET['token'])) {
} }
$token = $thread->lastToken; $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; exit;
} }