diff --git a/src/messenger/.idea/inspectionProfiles/Project_Default.xml b/src/messenger/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 00000000..c66df003
--- /dev/null
+++ b/src/messenger/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/messenger/.idea/inspectionProfiles/profiles_settings.xml b/src/messenger/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 00000000..3b312839
--- /dev/null
+++ b/src/messenger/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php
index dd7002d7..343f11d4 100644
--- a/src/messenger/webim/libs/common.php
+++ b/src/messenger/webim/libs/common.php
@@ -590,15 +590,14 @@ $settings = array(
$settingsloaded = false;
$settings_in_db = array();
-function loadsettings() {
+function loadsettings_($link) {
global $settingsloaded, $settings_in_db, $settings;
if($settingsloaded) {
return;
}
$settingsloaded = true;
- $link = connect();
- $sqlresult = mysql_query('select vckey,vcvalue from chatconfig',$link) or die(' Query failed: '.mysql_error().": ".$query);
+ $sqlresult = mysql_query("select vckey,vcvalue from chatconfig", $link) or die(' Query failed: '.mysql_error($link));
while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) {
$name = $row['vckey'];
@@ -606,7 +605,15 @@ function loadsettings() {
$settings_in_db[$name] = true;
}
mysql_free_result($sqlresult);
- mysql_close($link);
+}
+
+function loadsettings() {
+ global $settingsloaded;
+ if(!$settingsloaded) {
+ $link = connect();
+ loadsettings_($link);
+ mysql_close($link);
+ }
}
function getchatstyle() {
diff --git a/src/messenger/webim/libs/groups.php b/src/messenger/webim/libs/groups.php
index 71ce7972..58b0e4c5 100644
--- a/src/messenger/webim/libs/groups.php
+++ b/src/messenger/webim/libs/groups.php
@@ -47,4 +47,18 @@ function setup_group_settings_tabs($gid, $active) {
}
}
+function get_operator_groupslist($operatorid, $link) {
+ global $settings;
+ if($settings['enablegroups'] == '1') {
+ $groupids = array(0);
+ $allgroups = select_multi_assoc("select groupid from chatgroupoperator where operatorid = $operatorid order by groupid",$link);
+ foreach($allgroups as $g) {
+ $groupids[] = $g['groupid'];
+ }
+ return implode(",", $groupids);
+ } else {
+ return "";
+ }
+}
+
?>
\ No newline at end of file
diff --git a/src/messenger/webim/operator/users.php b/src/messenger/webim/operator/users.php
index 2f4c6270..a25ba5ec 100644
--- a/src/messenger/webim/operator/users.php
+++ b/src/messenger/webim/operator/users.php
@@ -21,25 +21,17 @@
require_once('../libs/common.php');
require_once('../libs/operator.php');
+require_once('../libs/groups.php');
$operator = check_login();
$status = isset($_GET['away']) ? 1 : 0;
notify_operator_alive($operator['operatorid'], $status);
-loadsettings();
-if($settings['enablegroups'] == '1') {
- $link = connect();
- $groupids = array(0);
- $allgroups = select_multi_assoc("select groupid from chatgroupoperator where operatorid = ".$operator['operatorid']." order by groupid",$link);
- foreach($allgroups as $g) {
- $groupids[] = $g['groupid'];
- }
- $_SESSION['operatorgroups'] = implode(",", $groupids);
- mysql_close($link);
-} else {
- $_SESSION['operatorgroups'] = "";
-}
+$link = connect();
+loadsettings_($link);
+$_SESSION['operatorgroups'] = get_operator_groupslist($operator['operatorid'], $link);
+mysql_close($link);
$page = array();
$page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1";