diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php index 527651f9..11d2005a 100644 --- a/src/messenger/webim/libs/common.php +++ b/src/messenger/webim/libs/common.php @@ -431,7 +431,9 @@ $settings = array( 'title' => 'Company', 'hosturl' => 'http://webim.sourceforge.net', 'logo' => '', - 'enableban' => '0' + 'enableban' => '0', + 'usernamepattern' => '{name}', + 'usercanchangename' => true ); $settingsloaded = false; $settings_in_db = array(); diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index db2ae062..c4d093a5 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -250,5 +250,9 @@ settings.logo=Your company logo settings.logo.description=Enter http address of your company logo settings.no.title=Please enter your company title settings.title=Messenger settings +settings.usercanchangename=Allows users to change their names +settings.usercanchangename.description=Turn off to hide edit box from chat window +settings.usernamepattern=Presentable visitor name +settings.usernamepattern.description=How to build presentable visitor name from {name}, {id} or {addr}. Default: {name} settings.wrong.email=Enter proper email address typing.remote=Remote user is typing... diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index 5980055e..a0544403 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -250,5 +250,9 @@ settings.logo= settings.logo.description=Введите ссылку на логотип компании settings.no.title=Введите имя Вашей компании settings.title=Настройки мессенджера +settings.usercanchangename=Разрешить посетителям менять имена +settings.usercanchangename.description=Возможность убрать поле смены имени из чат окна +settings.usernamepattern=Отображаемое имя посетителя +settings.usernamepattern.description=Укажите как отобразить имя посетителя операторам. Можно использовать {name}, {id} и {addr}. По умолчанию: {name} settings.wrong.email=Введите правильный адрес электронной почты typing.remote=Ваш собеседник набирает текст... diff --git a/src/messenger/webim/operator/settings.php b/src/messenger/webim/operator/settings.php index fc7ac798..f418c73a 100644 --- a/src/messenger/webim/operator/settings.php +++ b/src/messenger/webim/operator/settings.php @@ -40,6 +40,8 @@ $title = $settings['title']; $logo = $settings['logo']; $hosturl = $settings['hosturl']; $enableban = $settings['enableban']; +$usernamepattern = $settings['usernamepattern']; +$usercanchangename = $settings['usercanchangename']; if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) { $email = getparam('email'); @@ -47,6 +49,8 @@ if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) { $logo = getparam('logo'); $hosturl = getparam('hosturl'); $enableban = verifyparam("enableban","/^on$/", "") == "on" ? "1" : "0"; + $usernamepattern = getparam('usernamepattern'); + $usercanchangename = verifyparam("usercanchangename", "/^on$/", "") == "on" ? "1" : "0"; if($email && !is_valid_email($email)) { $errors[] = getlocal("settings.wrong.email"); @@ -58,6 +62,8 @@ if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) { $settings['logo'] = $logo; $settings['hosturl'] = $hosturl; $settings['enableban'] = $enableban; + $settings['usernamepattern'] = $usernamepattern; + $settings['usercanchangename'] = $usercanchangename; update_settings(); header("Location: $webimroot/operator/index.php"); exit; @@ -70,6 +76,8 @@ $page['formtitle'] = topage($title); $page['formlogo'] = topage($logo); $page['formhosturl'] = topage($hosturl); $page['formenableban'] = $enableban == "1"; +$page['formusernamepattern'] = topage($usernamepattern); +$page['formusercanchangename'] = $usercanchangename == "1"; start_html_output(); require('../view/settings.php'); diff --git a/src/messenger/webim/view/settings.php b/src/messenger/webim/view/settings.php index 6257d54b..a16258ce 100644 --- a/src/messenger/webim/view/settings.php +++ b/src/messenger/webim/view/settings.php @@ -82,6 +82,14 @@