From 19a55765399baa957e0f86369060b7195b69784e Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Fri, 24 Jul 2009 08:06:24 +0000 Subject: [PATCH] mod_security compatibility mode git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@595 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/libs/operator.php | 5 +++-- src/messenger/webim/locales/en/properties | 1 + src/messenger/webim/operator/getcode.php | 4 +++- src/messenger/webim/view/gen_button.php | 15 +++++++++++---- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php index 65596992..0c3f6167 100644 --- a/src/messenger/webim/libs/operator.php +++ b/src/messenger/webim/libs/operator.php @@ -131,7 +131,7 @@ function append_query($link,$pv) { return "$link$infix$pv"; } -function generate_button($title,$locale,$style,$group,$inner,$showhost,$forcesecure) { +function generate_button($title,$locale,$style,$group,$inner,$showhost,$forcesecure,$modsecurity) { $link = get_app_location($showhost,$forcesecure)."/client.php"; if($locale) $link = append_query($link, "locale=$locale"); @@ -140,7 +140,8 @@ function generate_button($title,$locale,$style,$group,$inner,$showhost,$forcesec if($group) $link = append_query($link, "group=$group"); - $jslink = append_query("'".$link,"url='+escape(document.location.href)+'&referrer='+escape(document.referrer)"); + $modsecfix = $modsecurity ? ".replace('http://','').replace('https://','')" : ""; + $jslink = append_query("'".$link,"url='+escape(document.location.href$modsecfix)+'&referrer='+escape(document.referrer$modsecfix)"); $temp = get_popup($link, "$jslink", $inner, $title, "webim", "toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=640,height=480,resizable=1" ); return "".$temp.""; diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index b5a46705..d1d6cb9c 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -239,6 +239,7 @@ page.gen_button.code=HTML code page.gen_button.default_group=-all operators- page.gen_button.include_site_name=Include host name into the code page.gen_button.intro=You can generate HTML code to place at your site here. +page.gen_button.modsecurity=Compatibility with mod_security (modsecurity.org), turn on only if you have problems with it page.gen_button.sample=Example page.gen_button.secure_links=Use secure links (https) page.gen_button.title=Button HTML code generation diff --git a/src/messenger/webim/operator/getcode.php b/src/messenger/webim/operator/getcode.php index c46a8c8b..d04a2c93 100644 --- a/src/messenger/webim/operator/getcode.php +++ b/src/messenger/webim/operator/getcode.php @@ -71,6 +71,7 @@ if($settings['enablegroups'] == '1') { $showhost = verifyparam("hostname","/^on$/", "") == "on"; $forcesecure = verifyparam("secure","/^on$/", "") == "on"; +$modsecurity = verifyparam("modsecurity","/^on$/", "") == "on"; $lang = verifyparam("lang", "/^[\w-]{2,5}$/", ""); if( !$lang || !in_array($lang,$image_locales) ) @@ -86,7 +87,7 @@ if($groupid) { $message = get_image($imagehref,$size[0],$size[1]); $page = array(); -$page['buttonCode'] = generate_button("",$lang,$style,$groupid,$message,$showhost,$forcesecure); +$page['buttonCode'] = generate_button("",$lang,$style,$groupid,$message,$showhost,$forcesecure,$modsecurity); $page['availableImages'] = array_keys($imageLocales); $page['availableLocales'] = $image_locales; $page['availableStyles'] = $stylelist; @@ -108,6 +109,7 @@ $page['formimage'] = $image; $page['formlang'] = $lang; $page['formhostname'] = $showhost; $page['formsecure'] = $forcesecure; +$page['formmodsecurity'] = $modsecurity; prepare_menu($operator); start_html_output(); diff --git a/src/messenger/webim/view/gen_button.php b/src/messenger/webim/view/gen_button.php index 32e34f10..9ba922c4 100644 --- a/src/messenger/webim/view/gen_button.php +++ b/src/messenger/webim/view/gen_button.php @@ -31,16 +31,16 @@ require_once('inc_errors.php');
-
+
- +
-
+
- +
@@ -77,6 +77,13 @@ require_once('inc_errors.php');
+
+
+
+ onchange="this.form.submit();"/> +
+
+