diff --git a/src/messenger/webim/images/dash/profile.gif b/src/messenger/webim/images/dash/profile.gif
new file mode 100644
index 00000000..8f9bf9b5
Binary files /dev/null and b/src/messenger/webim/images/dash/profile.gif differ
diff --git a/src/messenger/webim/libs/chat.php b/src/messenger/webim/libs/chat.php
index bd19939c..7845e9b7 100644
--- a/src/messenger/webim/libs/chat.php
+++ b/src/messenger/webim/libs/chat.php
@@ -625,4 +625,4 @@ function visitor_from_request() {
return array( 'id' => $userId, 'name' => $userName );
}
-?>
+?>
\ No newline at end of file
diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php
index c3504b90..dbef183d 100644
--- a/src/messenger/webim/libs/common.php
+++ b/src/messenger/webim/libs/common.php
@@ -436,7 +436,7 @@ function div($a,$b) {
return ($a-($a % $b)) / $b;
}
-function date_diff($seconds) {
+function date_diff_to_text($seconds) {
$minutes = div($seconds,60);
$seconds = $seconds % 60;
if( $minutes < 60 ) {
diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php
index 540da5ee..8aa14328 100644
--- a/src/messenger/webim/libs/operator.php
+++ b/src/messenger/webim/libs/operator.php
@@ -271,6 +271,7 @@ function prepare_menu($operator,$hasright=true) {
$page['showgroups'] = $settings['enablegroups'] == "1";
$page['showstat'] = $settings['enablestatistics'] == "1";
$page['showadmin'] = is_capable($can_administrate, $operator);
+ $page['currentopid'] = $operator['operatorid'];
}
}
diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties
index 327b7137..5862fb26 100644
--- a/src/messenger/webim/locales/en/properties
+++ b/src/messenger/webim/locales/en/properties
@@ -94,7 +94,7 @@ clients.title=List of awaiting visitors
common.asterisk_explanation=* - mandatory fields
company.title=Web Messenger Community
confirm.take.head=Change operator
-confirm.take.message=Visitor {0} already assisted by {1}.
Are your really sure you want to start chatting the visitor?
+confirm.take.message=Visitor {0} already assisted by {1}.
Are you really sure you want to start chatting the visitor?
confirm.take.no=No, close the window
confirm.take.yes=Yes, I'm sure
content.blocked=Here you can defend from malicious visitors.
@@ -205,6 +205,8 @@ menu.locale.content=Change locale.
menu.locale=Language
menu.main=Main
menu.operator=You are {0}
+menu.profile.content=You can change your personal information on this page.
+menu.profile=Profile
menu.translate=Localize
menu.updates.content=Check for news and updates.
menu.updates=Updates
@@ -271,6 +273,7 @@ page.translate.descr=If you don't like the translation, please send us an update
page.translate.done=Your translation is saved.
page.translate.one=Enter you translation.
page.translate.title=Localization wizard
+page_agent.cannot_modify=You are not allowed to change this person's profile.
page_agent.clear_avatar=Remove avatar
page_agent.create_new=Here you can create new operator
page_agent.error.duplicate_login=Please choose another login, because operator with entered login is already registered in the system.
diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties
index f499f454..feec1ebe 100644
--- a/src/messenger/webim/locales/ru/properties
+++ b/src/messenger/webim/locales/ru/properties
@@ -205,6 +205,8 @@ menu.locale.content=
menu.locale=Язык
menu.main=Главная
menu.operator=Вы {0}
+menu.profile.content=На этой странице вы можете отредактировать свою персональную информацию.
+menu.profile=Профиль
menu.translate=Локализация
menu.updates.content=Проверить наличие обновлений мессенджера.
menu.updates=Обновления
@@ -271,6 +273,7 @@ page.translate.descr=
page.translate.done=Ваш перевод сохранен.
page.translate.one=Введите ваш вариант перевода.
page.translate.title=Локализация
+page_agent.cannot_modify=Вы не можете изменять профиль этого оператора.
page_agent.clear_avatar=Удалить аватарку
page_agent.create_new=Создание нового оператора.
page_agent.error.duplicate_login=Выберите другой логин, т.к. оператор с введенным логином уже зарегистрирован в системе.
diff --git a/src/messenger/webim/operator/avatar.php b/src/messenger/webim/operator/avatar.php
index a09c16b4..e593a7a9 100644
--- a/src/messenger/webim/operator/avatar.php
+++ b/src/messenger/webim/operator/avatar.php
@@ -19,7 +19,7 @@ require_once('../libs/operator_settings.php');
$operator = check_login();
$opId = verifyparam( "op","/^\d{1,9}$/");
-$page = array('op' => $opId, 'avatar' => '');
+$page = array('opid' => $opId, 'avatar' => '');
$errors = array();
$op = operator_by_id($opId);
@@ -30,7 +30,10 @@ if( !$op ) {
} else if( isset($_POST['op']) ) {
$avatar = $op['vcavatar'];
- if( isset($_FILES['avatarFile']) && $_FILES['avatarFile']['name']) {
+ if($opId != $operator['operatorid'] && !is_capable($can_administrate, $operator)) {
+ $errors[] = getlocal('page_agent.cannot_modify');
+
+ } else if( isset($_FILES['avatarFile']) && $_FILES['avatarFile']['name']) {
$valid_types = array("gif","jpg", "png", "tif");
$orig_filename = $_FILES['avatarFile']['name'];
@@ -82,7 +85,7 @@ if( !$op ) {
$page['avatar'] = topage($op['vcavatar']);
}
-$page['currentop'] = topage(get_operator_name($op))." (".$op['vclogin'].")";
+$page['currentop'] = $op ? topage(get_operator_name($op))." (".$op['vclogin'].")" : "-not found-";
prepare_menu($operator);
setup_operator_settings_tabs($opId,1);
diff --git a/src/messenger/webim/operator/operator.php b/src/messenger/webim/operator/operator.php
index f16c2ef9..7cb6134e 100644
--- a/src/messenger/webim/operator/operator.php
+++ b/src/messenger/webim/operator/operator.php
@@ -52,7 +52,12 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
if( (!$opId && $existing_operator) ||
( $opId && $existing_operator && $opId != $existing_operator['operatorid']) )
$errors[] = getlocal("page_agent.error.duplicate_login");
-
+
+
+ if($opId != $operator['operatorid'] && !is_capable($can_administrate, $operator)) {
+ $errors[] = getlocal('page_agent.cannot_modify');
+ }
+
if( count($errors) == 0 ) {
if (!$opId) {
$newop = create_operator($login,$password,$localname,$commonname,"");
diff --git a/src/messenger/webim/operator/opgroups.php b/src/messenger/webim/operator/opgroups.php
index 9ccfd09c..4119eeda 100644
--- a/src/messenger/webim/operator/opgroups.php
+++ b/src/messenger/webim/operator/opgroups.php
@@ -28,7 +28,7 @@ function update_operator_groups($operatorid,$newvalue) {
}
$opId = verifyparam( "op","/^\d{1,9}$/");
-$page = array('op' => $opId);
+$page = array('opid' => $opId);
$page['groups'] = get_groups(false);
$errors = array();
@@ -39,22 +39,28 @@ if( !$op ) {
} else if( isset($_POST['op']) ) {
- $new_groups = array();
- foreach($page['groups'] as $group) {
- if( verifyparam("group".$group['groupid'],"/^on$/", "") == "on") {
- $new_groups[] = $group['groupid'];
- }
+ if($opId != $operator['operatorid'] && !is_capable($can_administrate, $operator)) {
+ $errors[] = getlocal('page_agent.cannot_modify');
}
- update_operator_groups($op['operatorid'],$new_groups);
- header("Location: $webimroot/operator/opgroups.php?op=$opId&stored");
- exit;
+ if(count($errors) == 0) {
+ $new_groups = array();
+ foreach($page['groups'] as $group) {
+ if( verifyparam("group".$group['groupid'],"/^on$/", "") == "on") {
+ $new_groups[] = $group['groupid'];
+ }
+ }
+
+ update_operator_groups($op['operatorid'],$new_groups);
+ header("Location: $webimroot/operator/opgroups.php?op=$opId&stored");
+ exit;
+ }
}
$page['formgroup'] = array();
-$page['currentop'] = $opId ? topage(get_operator_name($op))." (".$op['vclogin'].")" : "";
+$page['currentop'] = $op ? topage(get_operator_name($op))." (".$op['vclogin'].")" : "-not found-";
-if($opId) {
+if($op) {
foreach(get_operator_groupids($opId) as $rel) {
$page['formgroup'][] = $rel['groupid'];
}
diff --git a/src/messenger/webim/operator/permissions.php b/src/messenger/webim/operator/permissions.php
index a03ccfaa..eb7c109a 100644
--- a/src/messenger/webim/operator/permissions.php
+++ b/src/messenger/webim/operator/permissions.php
@@ -27,7 +27,7 @@ function update_operator_permissions($operatorid,$newvalue) {
}
$opId = verifyparam( "op","/^\d{1,9}$/");
-$page = array('op' => $opId);
+$page = array('opid' => $opId, 'canmodify' => is_capable($can_administrate, $operator) ? "1" : "");
$errors = array();
$op = operator_by_id($opId);
@@ -37,6 +37,10 @@ if( !$op ) {
} else if( isset($_POST['op']) ) {
+ if(!is_capable($can_administrate, $operator)) {
+ $errors[] = getlocal('page_agent.cannot_modify');
+ }
+
$new_permissions = isset($op['iperm']) ? $op['iperm'] : 0;
foreach($permission_ids as $perm => $id) {
@@ -61,11 +65,13 @@ if( !$op ) {
$page['permissionsList'] = get_permission_list();
$page['formpermissions'] = array("");
-$page['currentop'] = topage(get_operator_name($op))." (".$op['vclogin'].")";
+$page['currentop'] = $op ? topage(get_operator_name($op))." (".$op['vclogin'].")" : "-not found-";
-foreach($permission_ids as $perm => $id) {
- if(is_capable($perm,$op)) {
- $page['formpermissions'][] = $id;
+if($op) {
+ foreach($permission_ids as $perm => $id) {
+ if(is_capable($perm,$op)) {
+ $page['formpermissions'][] = $id;
+ }
}
}
diff --git a/src/messenger/webim/view/agent.php b/src/messenger/webim/view/agent.php
index 36fd875e..8361499f 100644
--- a/src/messenger/webim/view/agent.php
+++ b/src/messenger/webim/view/agent.php
@@ -14,7 +14,7 @@
require_once("inc_menu.php");
$page['title'] = getlocal("page_agent.title");
-$page['menuid'] = "operators";
+$page['menuid'] = $page['opid'] == $page['currentopid'] ? "profile" : "operators";
function tpl_content() { global $page, $webimroot, $errors;
?>
diff --git a/src/messenger/webim/view/avatar.php b/src/messenger/webim/view/avatar.php
index 2457ecee..ffa4ad22 100644
--- a/src/messenger/webim/view/avatar.php
+++ b/src/messenger/webim/view/avatar.php
@@ -14,7 +14,7 @@
require_once("inc_menu.php");
$page['title'] = getlocal("page_avatar.title");
-$page['menuid'] = "operators";
+$page['menuid'] = $page['opid'] == $page['currentopid'] ? "profile" : "operators";
function tpl_content() { global $page, $webimroot, $errors;
?>
@@ -27,7 +27,7 @@ require_once('inc_errors.php');
?>