escape ampersand, html 4.0 compatible page for old browsers, preview of error page

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@531 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2009-06-05 15:49:51 +00:00
parent 165edcf6c3
commit 155f238a1b
8 changed files with 43 additions and 34 deletions

File diff suppressed because one or more lines are too long

View File

@ -15,9 +15,9 @@ var FrameUtils = {
var doc = this.getDocument(frm); var doc = this.getDocument(frm);
doc.open(); doc.open();
doc.write("<html><head>"); doc.write("<html><head>");
doc.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\""+Chat.cssfile+"\" />"); doc.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\""+Chat.cssfile+"\">");
doc.write("</head><body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400' marginwidth='0' marginheight='0' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0'>"); doc.write("</head><body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400'>");
doc.write("<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message' id='content'></td></tr></table><a id='bottom'/>"); doc.write("<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message' id='content'></td></tr></table><a id='bottom'></a>");
doc.write("</body></html>"); doc.write("</body></html>");
doc.close(); doc.close();
frm.onload = function() { frm.onload = function() {

File diff suppressed because one or more lines are too long

View File

@ -160,14 +160,17 @@ function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agen
$output = get_messages($threadid,"html",$isuser,$lastid); $output = get_messages($threadid,"html",$isuser,$lastid);
start_html_output(); start_html_output();
$url = "$webimroot/thread.php?act=refresh&thread=$threadid&token=$token&html=on&user=".($isuser?"true":"false"); $url = "$webimroot/thread.php?act=refresh&amp;thread=$threadid&amp;token=$token&amp;html=on&amp;user=".($isuser?"true":"false");
print("<html><head>\n". print(
"<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"$webimroot/styles/default/chat.css\" />\n". "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">".
"<meta http-equiv=\"Refresh\" content=\"7; URL=$url&sn=11\">\n". "<html>\n<head>\n".
"<link href=\"$webimroot/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n".
"<meta http-equiv=\"Refresh\" content=\"7; URL=$url&amp;sn=11\">\n".
"<meta http-equiv=\"Pragma\" content=\"no-cache\">\n". "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n".
"</head>". "<title>chat</title>\n".
"<body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400' marginwidth='0' marginheight='0' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0' onload=\"if( location.hash != '#aend' ){location.hash='#aend';}\">". "</head>\n".
"<body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400' onload=\"if( location.hash != '#aend' ){location.hash='#aend';}\">".
"<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message'>" ); "<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message'>" );
foreach( $output as $msg ) { foreach( $output as $msg ) {
@ -175,7 +178,7 @@ function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agen
} }
print( print(
"</td></tr></table><a name='aend'>". "</td></tr></table><a name='aend'></a>".
"</body></html>" ); "</body></html>" );
} }
} }
@ -317,11 +320,11 @@ function setup_chatview_for_user($thread,$level) {
$page['ignorectrl'] = 0; $page['ignorectrl'] = 0;
} }
$params = "thread=".$thread['threadid']."&token=".$thread['ltoken']; $params = "thread=".$thread['threadid']."&amp;token=".$thread['ltoken'];
$page['mailLink'] = "$webimroot/client.php?".$params."&level=$level&act=mailthread"; $page['mailLink'] = "$webimroot/client.php?".$params."&amp;level=$level&amp;act=mailthread";
if($settings['enablessl'] == "1" && !is_secure_request()) { if($settings['enablessl'] == "1" && !is_secure_request()) {
$page['sslLink'] = get_app_location(true, true)."/client.php?".$params."&level=$level"; $page['sslLink'] = get_app_location(true, true)."/client.php?".$params."&amp;level=$level";
} }
$page['isOpera95'] = is_agent_opera95(); $page['isOpera95'] = is_agent_opera95();
@ -374,7 +377,7 @@ function setup_chatview_for_operator($thread,$operator) {
} }
if($settings['enablessl'] == "1" && !is_secure_request()) { if($settings['enablessl'] == "1" && !is_secure_request()) {
$page['sslLink'] = get_app_location(true, true)."/operator/agent.php?thread=".$thread['threadid']."&token=".$thread['ltoken']; $page['sslLink'] = get_app_location(true, true)."/operator/agent.php?thread=".$thread['threadid']."&amp;token=".$thread['ltoken'];
} }
$page['isOpera95'] = is_agent_opera95(); $page['isOpera95'] = is_agent_opera95();
$page['neediframesrc'] = needsFramesrc(); $page['neediframesrc'] = needsFramesrc();
@ -386,8 +389,8 @@ function setup_chatview_for_operator($thread,$operator) {
$predefinedres .= "<option>".htmlspecialchars(topage($answer['vcvalue']))."</option>"; $predefinedres .= "<option>".htmlspecialchars(topage($answer['vcvalue']))."</option>";
} }
$page['predefinedAnswers'] = $predefinedres; $page['predefinedAnswers'] = $predefinedres;
$params = "thread=".$thread['threadid']."&token=".$thread['ltoken']; $params = "thread=".$thread['threadid']."&amp;token=".$thread['ltoken'];
$page['redirectLink'] = "$webimroot/operator/agent.php?".$params."&act=redirect"; $page['redirectLink'] = "$webimroot/operator/agent.php?".$params."&amp;act=redirect";
$page['namePostfix'] = ""; $page['namePostfix'] = "";
} }

View File

@ -434,10 +434,10 @@ function get_gifimage_size($filename) {
function add_params($servlet, $params) { function add_params($servlet, $params) {
$infix = '?'; $infix = '?';
if( strstr($servlet,$infix) !== FALSE ) if( strstr($servlet,$infix) !== FALSE )
$infix = '&'; $infix = '&amp;';
foreach($params as $k => $v) { foreach($params as $k => $v) {
$servlet .= $infix.$k."=".$v; $servlet .= $infix.$k."=".$v;
$infix = '&'; $infix = '&amp;';
} }
return $servlet; return $servlet;
} }

View File

@ -30,14 +30,19 @@ function demo_process_thread($act,$outformat,$lastid,$isuser,$canpost,$istyping,
print("<thread lastid=\"$lastid\" typing=\"".($istyping ? 1 : 0)."\" canpost=\"".($canpost ? 1 : 0)."\">"); print("<thread lastid=\"$lastid\" typing=\"".($istyping ? 1 : 0)."\" canpost=\"".($canpost ? 1 : 0)."\">");
} else { } else {
start_html_output(); start_html_output();
$url = "$webimroot/thread.php?act=refresh&thread=0&token=123&html=on&user=".($isuser?"true":"false"); $url = "$webimroot/thread.php?act=refresh&amp;thread=0&amp;token=123&amp;html=on&amp;user=".($isuser?"true":"false");
print("<html><head>\n".
"<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"$webimroot/styles/default/chat.css\" />\n". print(
"<meta http-equiv=\"Refresh\" content=\"7; URL=$url&sn=11\">\n". "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">".
"<html>\n<head>\n".
"<link href=\"$webimroot/styles/default/chat.css\" rel=\"stylesheet\" type=\"text/css\">\n".
"<meta http-equiv=\"Refresh\" content=\"7; URL=$url&amp;sn=11\">\n".
"<meta http-equiv=\"Pragma\" content=\"no-cache\">\n". "<meta http-equiv=\"Pragma\" content=\"no-cache\">\n".
"</head>". "<title>chat</title>\n".
"<body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400' marginwidth='0' marginheight='0' leftmargin='0' rightmargin='0' topmargin='0' bottommargin='0'>". "</head>\n".
"<body bgcolor='#FFFFFF' text='#000000' link='#C28400' vlink='#C28400' alink='#C28400'>".
"<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message'>" ); "<table width='100%' cellspacing='0' cellpadding='0' border='0'><tr><td valign='top' class='message'>" );
} }
if($lastid == 1) { if($lastid == 1) {
demo_print_message( demo_print_message(
@ -70,7 +75,7 @@ function demo_process_thread($act,$outformat,$lastid,$isuser,$canpost,$istyping,
print("</thread>"); print("</thread>");
} else { } else {
print( print(
"</td></tr></table><a name='aend'>". "</td></tr></table><a name='aend'></a>".
"</body></html>" ); "</body></html>" );
} }
} }

View File

@ -38,10 +38,10 @@ if(!in_array($preview, $stylelist)) {
$preview = $stylelist[0]; $preview = $stylelist[0];
} }
$show = verifyparam("show", "/^(chat|chatsimple|nochat|mail|mailsent|survey|leavemessage|leavemessagesent|redirect|redirected|agentchat|agentrochat)$/", ""); $show = verifyparam("show", "/^(chat|chatsimple|nochat|mail|mailsent|survey|leavemessage|leavemessagesent|redirect|redirected|agentchat|agentrochat|error)$/", "");
$showerrors = verifyparam("showerr", "/^on$/", "") == "on"; $showerrors = verifyparam("showerr", "/^on$/", "") == "on";
$errors = array(); $errors = array();
if($showerrors) { if($showerrors || $show == 'error') {
$errors[] = "Test error"; $errors[] = "Test error";
} }
@ -59,7 +59,7 @@ if($show == 'survey') {
expand("../styles", "$preview", "$show.tpl"); expand("../styles", "$preview", "$show.tpl");
exit; exit;
} }
if($show == 'mailsent') { if($show == 'mailsent' || $show == 'error') {
$page['email'] = "admin@yourdomain.com"; $page['email'] = "admin@yourdomain.com";
setup_logo(); setup_logo();
expand("../styles", "$preview", "$show.tpl"); expand("../styles", "$preview", "$show.tpl");
@ -101,6 +101,7 @@ $templateList = array(
array('label' => getlocal("page.preview.redirected"), 'id' => 'redirected', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.redirected"), 'id' => 'redirected', 'h' => 480, 'w' => 640),
array('label' => getlocal("page.preview.agentchat"), 'id' => 'agentchat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.agentchat"), 'id' => 'agentchat', 'h' => 480, 'w' => 640),
array('label' => getlocal("page.preview.agentrochat"), 'id' => 'agentrochat', 'h' => 480, 'w' => 640), array('label' => getlocal("page.preview.agentrochat"), 'id' => 'agentrochat', 'h' => 480, 'w' => 640),
array('label' => getlocal("page.preview.error"), 'id' => 'error', 'h' => 480, 'w' => 640),
); );
$template = verifyparam("template", "/^\w+$/", "chat"); $template = verifyparam("template", "/^\w+$/", "chat");
@ -115,7 +116,7 @@ $page['availableTemplates'] = array(
"survey", "leavemessage", "leavemessagesent", "survey", "leavemessage", "leavemessagesent",
"mail", "mailsent", "mail", "mailsent",
"redirect", "redirected", "redirect", "redirected",
"agentchat", "agentrochat", "agentchat", "agentrochat", "error",
"all"); "all");
$page['showlink'] = "$webimroot/operator/themes.php?preview=$preview&amp;".($showerrors?"showerr=on&amp;":"")."show="; $page['showlink'] = "$webimroot/operator/themes.php?preview=$preview&amp;".($showerrors?"showerr=on&amp;":"")."show=";

View File

@ -19,7 +19,7 @@ $page['menuid'] = "users";
function tpl_header() { global $page, $webimroot; function tpl_header() { global $page, $webimroot;
?> ?>
<script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/common.js?v=160a1"></script> <script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/common.js?v=161"></script>
<script type="text/javascript" language="javascript"><!-- <script type="text/javascript" language="javascript"><!--
var localized = new Array( var localized = new Array(
"<?php echo getlocal("pending.table.speak") ?>", "<?php echo getlocal("pending.table.speak") ?>",
@ -34,7 +34,7 @@ var updaterOptions = {
agentservl:"<?php echo $webimroot ?>/operator/agent.php", agentservl:"<?php echo $webimroot ?>/operator/agent.php",
noclients:"<?php echo getlocal("clients.no_clients") ?>", havemenu: <?php echo $page['havemenu'] ?>, showpopup: <?php echo $page['showpopup'] ?> }; noclients:"<?php echo getlocal("clients.no_clients") ?>", havemenu: <?php echo $page['havemenu'] ?>, showpopup: <?php echo $page['showpopup'] ?> };
//--></script> //--></script>
<script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/users.js?v=160a1"></script> <script type="text/javascript" language="javascript" src="<?php echo $webimroot ?>/js/users.js?v=161"></script>
<?php <?php
} }