diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php
index fa61a0c7..ee986de1 100644
--- a/src/messenger/webim/libs/operator.php
+++ b/src/messenger/webim/libs/operator.php
@@ -214,4 +214,14 @@ function is_capable($perm,$operator) {
return $perm >= 0 && $perm < 32 && ($permissions & (1 << $perm)) != 0;
}
+function prepare_menu($operator,$hasright=true) {
+ global $page, $settings, $can_administrate;
+ $page['operator'] = topage(get_operator_name($operator));
+ if($hasright) {
+ loadsettings();
+ $page['showban'] = $settings['enableban'] == "1";
+ $page['showadmin'] = is_capable($can_administrate, $operator);
+ }
+}
+
?>
diff --git a/src/messenger/webim/operator/avatar.php b/src/messenger/webim/operator/avatar.php
index baba4295..7427295c 100644
--- a/src/messenger/webim/operator/avatar.php
+++ b/src/messenger/webim/operator/avatar.php
@@ -19,7 +19,6 @@ $operator = check_login();
$opId = verifyparam( "op","/^\d{1,9}$/");
$page = array('op' => $opId, 'avatar' => '');
-$page['operator'] = topage(get_operator_name($operator));
$errors = array();
$op = operator_by_id($opId);
@@ -89,6 +88,7 @@ $page['tabs'] = array(
);
$page['currentop'] = topage(get_operator_name($op))." (".$op['vclogin'].")";
+prepare_menu($operator);
start_html_output();
require('../view/avatar.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/ban.php b/src/messenger/webim/operator/ban.php
index c7784efd..b1ee86a0 100644
--- a/src/messenger/webim/operator/ban.php
+++ b/src/messenger/webim/operator/ban.php
@@ -18,7 +18,7 @@ require_once('../libs/operator.php');
require_once('../libs/pagination.php');
$operator = check_login();
-$page = array('banId' => '', 'operator' => topage(get_operator_name($operator)) );
+$page = array('banId' => '');
$page['saved'] = false;
$page['thread'] = '';
$page['threadid'] = '';
@@ -111,6 +111,7 @@ if( isset($_POST['address']) ) {
}
}
+prepare_menu($operator, false);
start_html_output();
require('../view/ban.php');
exit;
diff --git a/src/messenger/webim/operator/blocked.php b/src/messenger/webim/operator/blocked.php
index 401bbdac..2c2ea5b1 100644
--- a/src/messenger/webim/operator/blocked.php
+++ b/src/messenger/webim/operator/blocked.php
@@ -19,7 +19,6 @@ require_once('../libs/pagination.php');
$operator = check_login();
$page = array();
-$page['operator'] = topage(get_operator_name($operator));
$errors = array();
$link = connect();
@@ -51,6 +50,7 @@ mysql_close($link);
setup_pagination($blockedList);
+prepare_menu($operator);
start_html_output();
require('../view/blocked_visitors.php');
exit;
diff --git a/src/messenger/webim/operator/features.php b/src/messenger/webim/operator/features.php
index d747dee9..23d04154 100644
--- a/src/messenger/webim/operator/features.php
+++ b/src/messenger/webim/operator/features.php
@@ -38,12 +38,12 @@ if (isset($_POST['sent'])) {
exit;
}
-$page['operator'] = topage(get_operator_name($operator));
$page['stored'] = isset($_GET['stored']);
foreach($options as $opt) {
$page["form$opt"] = $params[$opt] == "1";
}
+prepare_menu($operator);
setup_settings_tabs(1);
start_html_output();
require('../view/features.php');
diff --git a/src/messenger/webim/operator/getcode.php b/src/messenger/webim/operator/getcode.php
index dbcd261e..327734b6 100644
--- a/src/messenger/webim/operator/getcode.php
+++ b/src/messenger/webim/operator/getcode.php
@@ -68,7 +68,6 @@ $size = get_gifimage_size($file);
$message = get_image(get_app_location($showhost,$forcesecure)."/button.php?image=$image&lang=$lang",$size[0],$size[1]);
$page = array();
-$page['operator'] = topage(get_operator_name($operator));
$page['buttonCode'] = generate_button("",$lang,$style,$message,$showhost,$forcesecure);
$page['availableImages'] = array_keys($imageLocales);
$page['availableLocales'] = $image_locales;
@@ -80,6 +79,7 @@ $page['formlang'] = $lang;
$page['formhostname'] = $showhost;
$page['formsecure'] = $forcesecure;
+prepare_menu($operator);
start_html_output();
require('../view/gen_button.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/history.php b/src/messenger/webim/operator/history.php
index fae58114..fc96c4cb 100644
--- a/src/messenger/webim/operator/history.php
+++ b/src/messenger/webim/operator/history.php
@@ -21,7 +21,7 @@ require_once('../libs/pagination.php');
$operator = check_login();
loadsettings();
-$page = array( 'operator' => topage(get_operator_name($operator)) );
+$page = array();
$query = isset($_GET['q']) ? myiconv(getoutputenc(), $webim_encoding, $_GET['q']) : false;
if($query !== false) {
@@ -53,6 +53,7 @@ if($query !== false) {
setup_empty_pagination();
}
+prepare_menu($operator);
start_html_output();
require('../view/thread_search.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/index.php b/src/messenger/webim/operator/index.php
index 2254c937..ca1d6aa6 100644
--- a/src/messenger/webim/operator/index.php
+++ b/src/messenger/webim/operator/index.php
@@ -19,15 +19,13 @@ $operator = check_login();
loadsettings();
$page = array(
- 'operator' => topage(get_operator_name($operator)),
'version' => $version,
'localeLinks' => get_locale_links("$webimroot/operator/index.php"),
- 'showban' => $settings['enableban'] == "1",
- 'showadmin' => is_capable($can_administrate, $operator),
'needUpdate' => $settings['dbversion'] != $dbversion,
'updateWizard' => "$webimroot/install/",
);
+prepare_menu($operator);
start_html_output();
require('../view/menu.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/operator.php b/src/messenger/webim/operator/operator.php
index fb5ae8e0..2792e65f 100644
--- a/src/messenger/webim/operator/operator.php
+++ b/src/messenger/webim/operator/operator.php
@@ -84,14 +84,13 @@ if( isset($_POST['login']) && isset($_POST['password']) ) {
}
}
-$page['operator'] = topage(get_operator_name($operator));
-
$page['tabs'] = $opId ? array(
getlocal("page_agent.tab.main") => "",
getlocal("page_agent.tab.avatar") => "$webimroot/operator/avatar.php?op=$opId",
getlocal("page_agent.tab.permissions") => "$webimroot/operator/permissions.php?op=$opId"
) : array();
+prepare_menu($operator);
start_html_output();
require('../view/agent.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/operators.php b/src/messenger/webim/operator/operators.php
index 17d7d596..8c6d2e46 100644
--- a/src/messenger/webim/operator/operators.php
+++ b/src/messenger/webim/operator/operators.php
@@ -19,8 +19,8 @@ $operator = check_login();
$page = array();
$page['allowedAgents'] = get_operators();
-$page['operator'] = topage(get_operator_name($operator));
+prepare_menu($operator);
start_html_output();
require('../view/agents.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/permissions.php b/src/messenger/webim/operator/permissions.php
index f7777a16..0b55b888 100644
--- a/src/messenger/webim/operator/permissions.php
+++ b/src/messenger/webim/operator/permissions.php
@@ -27,7 +27,6 @@ function update_operator_permissions($operatorid,$newvalue) {
$opId = verifyparam( "op","/^\d{1,9}$/");
$page = array('op' => $opId);
-$page['operator'] = topage(get_operator_name($operator));
$errors = array();
$op = operator_by_id($opId);
@@ -75,6 +74,7 @@ foreach($permission_ids as $perm => $id) {
}
}
+prepare_menu($operator);
start_html_output();
require('../view/permissions.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/preview.php b/src/messenger/webim/operator/preview.php
index d7b74f9f..cb6f9dc4 100644
--- a/src/messenger/webim/operator/preview.php
+++ b/src/messenger/webim/operator/preview.php
@@ -109,7 +109,6 @@ $page['availableTemplates'] = array(
"agentchat", "agentrochat",
"all");
-$page['operator'] = topage(get_operator_name($operator));
$page['showlink'] = "$webimroot/operator/preview.php?preview=$preview&".($showerrors?"showerr=on&":"")."show=";
$page['previewList'] = array();
@@ -119,6 +118,7 @@ foreach($templateList as $tpl) {
}
}
+prepare_menu($operator);
start_html_output();
setup_settings_tabs(2);
require('../view/preview.php');
diff --git a/src/messenger/webim/operator/settings.php b/src/messenger/webim/operator/settings.php
index 5b251bfb..23664a3e 100644
--- a/src/messenger/webim/operator/settings.php
+++ b/src/messenger/webim/operator/settings.php
@@ -79,7 +79,6 @@ if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) {
}
}
-$page['operator'] = topage(get_operator_name($operator));
$page['formemail'] = topage($params['email']);
$page['formtitle'] = topage($params['title']);
$page['formlogo'] = topage($params['logo']);
@@ -92,6 +91,7 @@ $page['formchattitle'] = topage($params['chattitle']);
$page['availableStyles'] = $stylelist;
$page['stored'] = isset($_GET['stored']);
+prepare_menu($operator);
setup_settings_tabs(0);
start_html_output();
require('../view/settings.php');
diff --git a/src/messenger/webim/operator/threadprocessor.php b/src/messenger/webim/operator/threadprocessor.php
index be0c2aed..772bacbd 100644
--- a/src/messenger/webim/operator/threadprocessor.php
+++ b/src/messenger/webim/operator/threadprocessor.php
@@ -19,7 +19,7 @@ require_once('../libs/userinfo.php');
$operator = check_login();
-$page = array( 'operator' => topage(get_operator_name($operator)) );
+$page = array();
if( isset($_GET['threadid'])) {
$threadid = verifyparam( "threadid", "/^(\d{1,9})?$/", "");
@@ -28,6 +28,7 @@ if( isset($_GET['threadid'])) {
$page['thread'] = thread_by_id($threadid);
}
+prepare_menu($operator, false);
start_html_output();
require('../view/thread_log.php');
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/translate.php b/src/messenger/webim/operator/translate.php
index 98cdbf3e..28fe2f18 100644
--- a/src/messenger/webim/operator/translate.php
+++ b/src/messenger/webim/operator/translate.php
@@ -108,7 +108,6 @@ $lang2 = $messages[$target];
$errors = array();
$page = array(
- 'operator' => topage(get_operator_name($operator)),
'lang1' => $source,
'lang2' => $target,
'title1' => isset($lang1["localeid"]) ? $lang1["localeid"] : $source,
@@ -131,6 +130,7 @@ if($stringid) {
save_message($target, $stringid, $translation);
$page['saved'] = true;
+ prepare_menu($operator, false);
start_html_output();
require('../view/translate.php');
exit;
@@ -142,6 +142,7 @@ if($stringid) {
$page['target'] = $target;
$page['formoriginal'] = isset($lang1[$stringid]) ? htmlspecialchars($lang1[$stringid]) : "