mirror of
https://github.com/Mibew/i18n.git
synced 2025-01-23 05:40:30 +03:00
extract get_operator_groupslist -> libs/groups.php; optimize db access (connect once); disable spelling inspection
This commit is contained in:
parent
f3d38642c6
commit
6bc85737cd
11
src/messenger/.idea/inspectionProfiles/Project_Default.xml
Normal file
11
src/messenger/.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0" is_locked="false">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<option name="myLocal" value="false" />
|
||||||
|
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||||
|
<option name="processCode" value="true" />
|
||||||
|
<option name="processLiterals" value="true" />
|
||||||
|
<option name="processComments" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
@ -0,0 +1,7 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
@ -590,15 +590,14 @@ $settings = array(
|
|||||||
$settingsloaded = false;
|
$settingsloaded = false;
|
||||||
$settings_in_db = array();
|
$settings_in_db = array();
|
||||||
|
|
||||||
function loadsettings() {
|
function loadsettings_($link) {
|
||||||
global $settingsloaded, $settings_in_db, $settings;
|
global $settingsloaded, $settings_in_db, $settings;
|
||||||
if($settingsloaded) {
|
if($settingsloaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$settingsloaded = true;
|
$settingsloaded = true;
|
||||||
|
|
||||||
$link = connect();
|
$sqlresult = mysql_query("select vckey,vcvalue from chatconfig", $link) or die(' Query failed: '.mysql_error($link));
|
||||||
$sqlresult = mysql_query('select vckey,vcvalue from chatconfig',$link) or die(' Query failed: '.mysql_error().": ".$query);
|
|
||||||
|
|
||||||
while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) {
|
while ($row = mysql_fetch_array($sqlresult, MYSQL_ASSOC)) {
|
||||||
$name = $row['vckey'];
|
$name = $row['vckey'];
|
||||||
@ -606,7 +605,15 @@ function loadsettings() {
|
|||||||
$settings_in_db[$name] = true;
|
$settings_in_db[$name] = true;
|
||||||
}
|
}
|
||||||
mysql_free_result($sqlresult);
|
mysql_free_result($sqlresult);
|
||||||
mysql_close($link);
|
}
|
||||||
|
|
||||||
|
function loadsettings() {
|
||||||
|
global $settingsloaded;
|
||||||
|
if(!$settingsloaded) {
|
||||||
|
$link = connect();
|
||||||
|
loadsettings_($link);
|
||||||
|
mysql_close($link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getchatstyle() {
|
function getchatstyle() {
|
||||||
|
@ -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 "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -21,25 +21,17 @@
|
|||||||
|
|
||||||
require_once('../libs/common.php');
|
require_once('../libs/common.php');
|
||||||
require_once('../libs/operator.php');
|
require_once('../libs/operator.php');
|
||||||
|
require_once('../libs/groups.php');
|
||||||
|
|
||||||
$operator = check_login();
|
$operator = check_login();
|
||||||
$status = isset($_GET['away']) ? 1 : 0;
|
$status = isset($_GET['away']) ? 1 : 0;
|
||||||
|
|
||||||
notify_operator_alive($operator['operatorid'], $status);
|
notify_operator_alive($operator['operatorid'], $status);
|
||||||
|
|
||||||
loadsettings();
|
$link = connect();
|
||||||
if($settings['enablegroups'] == '1') {
|
loadsettings_($link);
|
||||||
$link = connect();
|
$_SESSION['operatorgroups'] = get_operator_groupslist($operator['operatorid'], $link);
|
||||||
$groupids = array(0);
|
mysql_close($link);
|
||||||
$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'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$page = array();
|
$page = array();
|
||||||
$page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1";
|
$page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1";
|
||||||
|
Loading…
Reference in New Issue
Block a user