diff --git a/src/messenger/webim/client.php b/src/messenger/webim/client.php index ab122a2c..585f0be4 100644 --- a/src/messenger/webim/client.php +++ b/src/messenger/webim/client.php @@ -19,6 +19,7 @@ require_once('libs/expand.php'); if( !isset($_GET['token']) || !isset($_GET['thread']) ) { + $chatstyle = verifyparam( "style", "/^\w+$/", ""); $thread = NULL; if( isset($_SESSION['threadid']) ) { $thread = reopen_thread($_SESSION['threadid']); @@ -50,7 +51,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) { $threadid = $thread['threadid']; $token = $thread['ltoken']; $level = get_remote_level($_SERVER['HTTP_USER_AGENT']); - header("Location: $webimroot/client.php?thread=$threadid&token=$token&level=$level"); + header("Location: $webimroot/client.php?thread=$threadid&token=$token&level=$level".($chatstyle ? "&style=$chatstyle" : "")); exit; } diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php index 1b9730af..a02cba6e 100644 --- a/src/messenger/webim/libs/common.php +++ b/src/messenger/webim/libs/common.php @@ -461,6 +461,10 @@ function loadsettings() { function getchatstyle() { global $settings; + $chatstyle = verifyparam( "style", "/^\w+$/", ""); + if($chatstyle) { + return $chatstyle; + } loadsettings(); return $settings['chatstyle']; } diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php index 56ebabd4..4ac3e32c 100644 --- a/src/messenger/webim/libs/operator.php +++ b/src/messenger/webim/libs/operator.php @@ -112,8 +112,8 @@ function get_operator_name($operator) { return $operator['vccommonname']; } -function generate_button($title,$locale,$inner,$showhost,$forcesecure) { - $link = get_app_location($showhost,$forcesecure)."/client.php". ($locale?"?locale=".$locale : ""); +function generate_button($title,$locale,$style,$inner,$showhost,$forcesecure) { + $link = get_app_location($showhost,$forcesecure)."/client.php". ($locale?"?locale=$locale" : "").($style ? ($locale?"&":"?")."style=$style" : ""); $temp = get_popup($link, $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 f274ed6f..fe1d914a 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -230,6 +230,7 @@ menu.operator=You are {0} no_such_operator=No such operator page.gen_button.choose_image=Choose image page.gen_button.choose_locale=Target locale +page.gen_button.choose_style=Chat window style page.gen_button.include_site_name=Include host name into code page.gen_button.secure_links=Use secure links (https) page.preview.agentchat=Chat window (agent-mode) @@ -246,6 +247,7 @@ page.preview.nochat=List of supported browsers window page.preview.redirect=Redirect visitor to another operator window page.preview.redirected=Visitor is redirected window page.preview.showerr=Show errors +page.preview.style_default=-from general settings- page.preview.title=Site style page.preview.userchat=Chat window (user-mode) page_agent.create_new=Here you can create new operator diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index 6d6b31d9..6d55f146 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -230,6 +230,7 @@ menu.operator= no_such_operator=Запрашиваемая учетная запись не существует page.gen_button.choose_image=Выбор картинки page.gen_button.choose_locale=Для какой локали создавать кнопку +page.gen_button.choose_style=Стиль чат-окна page.gen_button.include_site_name=Включать имя сайта в код page.gen_button.secure_links=Использовать защищенное соединение (https) page.preview.agentchat=Chat window (agent-mode) @@ -246,6 +247,7 @@ page.preview.nochat=List of supported browsers window page.preview.redirect=Redirect visitor to another operator window page.preview.redirected=Visitor is redirected window page.preview.showerr=Отобразить ошибки +page.preview.style_default=-из настроек сайта- page.preview.title=Стиль мессенджера page.preview.userchat=Chat window (user-mode) page_agent.create_new=Создание нового оператора diff --git a/src/messenger/webim/operator/getcode.php b/src/messenger/webim/operator/getcode.php index 3b000d17..2a802b6d 100644 --- a/src/messenger/webim/operator/getcode.php +++ b/src/messenger/webim/operator/getcode.php @@ -38,6 +38,22 @@ foreach($available_locales as $curr) { $image = verifyparam("image","/^\w+$/", "webim"); $image_locales = $imageLocales[$image]; +$stylelist = array("" => getlocal("page.preview.style_default")); +$stylesfolder = "../styles"; +if($handle = opendir($stylesfolder)) { + while (false !== ($file = readdir($handle))) { + if (preg_match("/^\w+$/", $file) && is_dir("$stylesfolder/$file")) { + $stylelist[$file] = $file; + } + } + closedir($handle); +} + +$style = verifyparam("style","/^\w*$/", ""); +if($style && !in_array($style, $stylelist)) { + $style = ""; +} + $showhost = verifyparam("hostname","/^on$/", "") == "on"; $forcesecure = verifyparam("secure","/^on$/", "") == "on"; @@ -52,10 +68,12 @@ $message = get_image(get_app_location($showhost,$forcesecure)."/button.php?image $page = array(); $page['operator'] = topage(get_operator_name($operator)); -$page['buttonCode'] = generate_button("",$lang,$message,$showhost,$forcesecure); +$page['buttonCode'] = generate_button("",$lang,$style,$message,$showhost,$forcesecure); $page['availableImages'] = array_keys($imageLocales); $page['availableLocales'] = $image_locales; +$page['availableStyles'] = $stylelist; +$page['formstyle'] = $style; $page['formimage'] = $image; $page['formlang'] = $lang; $page['formhostname'] = $showhost; diff --git a/src/messenger/webim/view/gen_button.php b/src/messenger/webim/view/gen_button.php index 46102b28..ba2ab501 100644 --- a/src/messenger/webim/view/gen_button.php +++ b/src/messenger/webim/view/gen_button.php @@ -66,6 +66,16 @@