mod_security compatibility mode

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@595 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2009-07-24 08:06:24 +00:00
parent 65bb8f0f97
commit 19a5576539
4 changed files with 18 additions and 7 deletions

View File

@ -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 "<!-- webim button -->".$temp."<!-- / webim button -->";

View File

@ -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

View File

@ -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();

View File

@ -31,16 +31,16 @@ require_once('inc_errors.php');
<div class="fieldForm">
<div class="field">
<div class="flabel"><?php echo getlocal("page.gen_button.choose_image") ?></div>
<div class="flabel"><?php echo getlocal("page.gen_button.choose_locale") ?></div>
<div class="fvaluenodesc">
<select name="image" onchange="this.form.submit();"><?php foreach($page['availableImages'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("image") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
<select name="lang" onchange="this.form.submit();"><?php foreach($page['availableLocales'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("lang") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
</div>
</div>
<div class="field">
<div class="flabel"><?php echo getlocal("page.gen_button.choose_locale") ?></div>
<div class="flabel"><?php echo getlocal("page.gen_button.choose_image") ?></div>
<div class="fvaluenodesc">
<select name="lang" onchange="this.form.submit();"><?php foreach($page['availableLocales'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("lang") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
<select name="image" onchange="this.form.submit();"><?php foreach($page['availableImages'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("image") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
</div>
</div>
@ -77,6 +77,13 @@ require_once('inc_errors.php');
</div>
<?php } ?>
<div class="field">
<div class="flabel"><?php echo getlocal("page.gen_button.modsecurity") ?></div>
<div class="fvaluenodesc">
<input type="checkbox" name="modsecurity" value="on"<?php echo form_value_cb('modsecurity') ? " checked=\"checked\"" : "" ?> onchange="this.form.submit();"/>
</div>
</div>
<div class="field">
<div class="flabel"><?php echo getlocal("page.gen_button.code") ?></div>
<div class="fvaluewithta" dir="ltr">