usernamepattern, usercanchangename options in db

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@176 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-10-12 01:11:51 +00:00
parent ded5ac9888
commit 19b24bf50e
5 changed files with 27 additions and 1 deletions

View File

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

View File

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

View File

@ -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=Âàø ñîáåñåäíèê íàáèðàåò òåêñò...

View File

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

View File

@ -82,6 +82,14 @@
<input type="text" name="hosturl" size="40" value="<?php echo form_value('hosturl') ?>" class="formauth"/>
</td><td></td><td class='formauth'><span class='formdescr'> &mdash; <?php echo getlocal('settings.host.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
<tr><td class='formauth'><?php echo getlocal('settings.usernamepattern') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
<input type="text" name="usernamepattern" size="40" value="<?php echo form_value('usernamepattern') ?>" class="formauth"/>
</td><td></td><td class='formauth'><span class='formdescr'> &mdash; <?php echo getlocal('settings.usernamepattern.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
<tr><td class='formauth'><?php echo getlocal('settings.usercanchangename') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
<input type="checkbox" name="usercanchangename" value="on"<?php echo form_value_cb('usercanchangename') ? " checked=\"checked\"" : "" ?>/>
</td><td></td><td class='formauth'><span class='formdescr'> &mdash; <?php echo getlocal('settings.usercanchangename.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>
<tr><td class='formauth'><?php echo getlocal('settings.enableban') ?></td><td width='10'><img width='10' height='1' border='0' alt='' src='<?php echo $webimroot ?>/images/free.gif'></td><td></td></tr><tr><td height='2' colspan='3'></td></tr><tr><td>
<input type="checkbox" name="enableban" value="on"<?php echo form_value_cb('enableban') ? " checked=\"checked\"" : "" ?>/>
</td><td></td><td class='formauth'><span class='formdescr'> &mdash; <?php echo getlocal('settings.enableban.description') ?></span></td></tr><tr><td colspan='3' height='10'></td></tr>