usernamepattern, usercanchangename options in db, done

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@177 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-10-12 01:21:37 +00:00
parent 19b24bf50e
commit e0d80f3c61
5 changed files with 9 additions and 16 deletions

View File

@ -182,10 +182,11 @@ function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agen
} }
function get_user_name($username, $addr, $id) { function get_user_name($username, $addr, $id) {
global $presentable_name_pattern; global $settings;
loadsettings();
return str_replace("{addr}", $addr, return str_replace("{addr}", $addr,
str_replace("{id}", $id, str_replace("{id}", $id,
str_replace("{name}", $username, $presentable_name_pattern))); str_replace("{name}", $username, $settings['usernamepattern'])));
} }
function is_ajax_browser($browserid,$ver,$useragent) { function is_ajax_browser($browserid,$ver,$useragent) {
@ -254,7 +255,7 @@ function needsFramesrc() {
} }
function setup_chatview_for_user($thread,$level) { function setup_chatview_for_user($thread,$level) {
global $page, $webimroot, $user_can_change_name, $settings; global $page, $webimroot, $settings;
loadsettings(); loadsettings();
$page = array(); $page = array();
$page['agent'] = false; $page['agent'] = false;
@ -267,7 +268,7 @@ function setup_chatview_for_user($thread,$level) {
$page['ct.chatThreadId'] = $thread['threadid']; $page['ct.chatThreadId'] = $thread['threadid'];
$page['ct.token'] = $thread['ltoken']; $page['ct.token'] = $thread['ltoken'];
$page['ct.user.name'] = topage($thread['userName']); $page['ct.user.name'] = topage($thread['userName']);
$page['canChangeName'] = $user_can_change_name; $page['canChangeName'] = $settings['usercanchangename'] == "1";
$page['ct.company.name'] = topage($settings['title']); $page['ct.company.name'] = topage($settings['title']);
$page['ct.company.chatLogoURL'] = topage($settings['logo']); $page['ct.company.chatLogoURL'] = topage($settings['logo']);

View File

@ -433,7 +433,7 @@ $settings = array(
'logo' => '', 'logo' => '',
'enableban' => '0', 'enableban' => '0',
'usernamepattern' => '{name}', 'usernamepattern' => '{name}',
'usercanchangename' => true 'usercanchangename' => '1'
); );
$settingsloaded = false; $settingsloaded = false;
$settings_in_db = array(); $settings_in_db = array();

View File

@ -62,16 +62,6 @@ $available_locales = array("en", "ru");
$home_locale = "ru"; /* native name will be used in this locale */ $home_locale = "ru"; /* native name will be used in this locale */
$default_locale = "en"; /* if user does not provide known lang */ $default_locale = "en"; /* if user does not provide known lang */
/*
* Allows users to change their names
*/
$user_can_change_name = true;
/*
* How to build presentable visitor name from {name}, {id} or {addr}. Default: {name}
*/
$presentable_name_pattern = "{name}";
/* /*
* Method of getting information about remote user. For example, you could * Method of getting information about remote user. For example, you could
* have user name or id in session. Default value: visitor_from_request * have user name or id in session. Default value: visitor_from_request

View File

@ -144,6 +144,7 @@ function print_pending_threads($since) {
$since = verifyparam( "since", "/^\d{1,9}$/", 0); $since = verifyparam( "since", "/^\d{1,9}$/", 0);
loadsettings();
print_pending_threads($since); print_pending_threads($since);
notify_operator_alive($operator['operatorid']); notify_operator_alive($operator['operatorid']);
exit; exit;

View File

@ -74,7 +74,8 @@ if( $act == "refresh" ) {
} else if( $act == "rename" ) { } else if( $act == "rename" ) {
if( !$user_can_change_name ) { loadsettings();
if( $settings['usercanchangename'] != "1" ) {
show_error("server: forbidden to change name"); show_error("server: forbidden to change name");
} }