From e160af13ef6c7fb222670b29910394002c05cdf6 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sat, 26 Feb 2011 14:43:30 +0100 Subject: [PATCH] use mysqlprefix in names of session vars --- src/messenger/.idea/projectCodeStyle.xml | 70 +++++ src/messenger/webim/libs/operator.php | 295 ++++++++++--------- src/messenger/webim/operator/avatar.php | 4 +- src/messenger/webim/operator/permissions.php | 39 +-- src/messenger/webim/operator/update.php | 10 +- src/messenger/webim/operator/users.php | 2 +- 6 files changed, 263 insertions(+), 157 deletions(-) create mode 100644 src/messenger/.idea/projectCodeStyle.xml diff --git a/src/messenger/.idea/projectCodeStyle.xml b/src/messenger/.idea/projectCodeStyle.xml new file mode 100644 index 00000000..2a025446 --- /dev/null +++ b/src/messenger/.idea/projectCodeStyle.xml @@ -0,0 +1,70 @@ + + + + + + + diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php index de34e4d2..205df16b 100644 --- a/src/messenger/webim/libs/operator.php +++ b/src/messenger/webim/libs/operator.php @@ -33,179 +33,197 @@ $permission_ids = array( $can_modifyprofile => "modifyprofile" ); -function operator_by_login($login) { - global $mysqlprefix; +function operator_by_login($login) +{ + global $mysqlprefix; $link = connect(); $operator = select_one_row( - "select * from ${mysqlprefix}chatoperator where vclogin = '".mysql_real_escape_string($login)."'", $link ); + "select * from ${mysqlprefix}chatoperator where vclogin = '" . mysql_real_escape_string($login) . "'", $link); mysql_close($link); return $operator; } -function operator_by_email($mail) { - global $mysqlprefix; +function operator_by_email($mail) +{ + global $mysqlprefix; $link = connect(); $operator = select_one_row( - "select * from ${mysqlprefix}chatoperator where vcemail = '".mysql_real_escape_string($mail)."'", $link ); + "select * from ${mysqlprefix}chatoperator where vcemail = '" . mysql_real_escape_string($mail) . "'", $link); mysql_close($link); return $operator; } -function operator_by_id_($id,$link) { - global $mysqlprefix; +function operator_by_id_($id, $link) +{ + global $mysqlprefix; return select_one_row( - "select * from ${mysqlprefix}chatoperator where operatorid = $id", $link ); + "select * from ${mysqlprefix}chatoperator where operatorid = $id", $link); } -function operator_by_id($id) { +function operator_by_id($id) +{ $link = connect(); - $operator = operator_by_id_($id,$link); + $operator = operator_by_id_($id, $link); mysql_close($link); return $operator; } -function operator_get_all() { - global $mysqlprefix; +function operator_get_all() +{ + global $mysqlprefix; $link = connect(); - $query = "select operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ". + $query = "select operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time " . "from ${mysqlprefix}chatoperator order by vclogin"; $operators = select_multi_assoc($query, $link); mysql_close($link); return $operators; } -function operator_is_online($operator) { +function operator_is_online($operator) +{ global $settings; return $operator['time'] < $settings['online_timeout']; } -function operator_is_available($operator) { +function operator_is_available($operator) +{ global $settings; - return $operator['istatus'] == 0 && $operator['time'] < $settings['online_timeout'] ? "1" : ""; + return $operator['istatus'] == 0 && $operator['time'] < $settings['online_timeout'] ? "1" : ""; } -function operator_is_away($operator) { +function operator_is_away($operator) +{ global $settings; - return $operator['istatus'] != 0 && $operator['time'] < $settings['online_timeout'] ? "1" : ""; + return $operator['istatus'] != 0 && $operator['time'] < $settings['online_timeout'] ? "1" : ""; } -function update_operator($operatorid,$login,$email,$password,$localename,$commonname) { - global $mysqlprefix; +function update_operator($operatorid, $login, $email, $password, $localename, $commonname) +{ + global $mysqlprefix; $link = connect(); $query = sprintf( - "update ${mysqlprefix}chatoperator set vclogin = '%s',%s vclocalename = '%s', vccommonname = '%s'". - ", vcemail = '%s', vcjabbername= '%s'". + "update ${mysqlprefix}chatoperator set vclogin = '%s',%s vclocalename = '%s', vccommonname = '%s'" . + ", vcemail = '%s', vcjabbername= '%s'" . " where operatorid = %s", mysql_real_escape_string($login), - ($password ? " vcpassword='".md5($password)."'," : ""), + ($password ? " vcpassword='" . md5($password) . "'," : ""), mysql_real_escape_string($localename), mysql_real_escape_string($commonname), mysql_real_escape_string($email), '', - $operatorid ); + $operatorid); - perform_query($query,$link); + perform_query($query, $link); mysql_close($link); } -function update_operator_avatar($operatorid,$avatar) { - global $mysqlprefix; +function update_operator_avatar($operatorid, $avatar) +{ + global $mysqlprefix; $link = connect(); $query = sprintf( "update ${mysqlprefix}chatoperator set vcavatar = '%s' where operatorid = %s", - mysql_real_escape_string($avatar), $operatorid ); + mysql_real_escape_string($avatar), $operatorid); - perform_query($query,$link); + perform_query($query, $link); mysql_close($link); } -function create_operator_($login,$email,$password,$localename,$commonname,$avatar,$link) { - global $mysqlprefix; +function create_operator_($login, $email, $password, $localename, $commonname, $avatar, $link) +{ + global $mysqlprefix; $query = sprintf( "insert into ${mysqlprefix}chatoperator (vclogin,vcpassword,vclocalename,vccommonname,vcavatar,vcemail,vcjabbername) values ('%s','%s','%s','%s','%s','%s','%s')", - mysql_real_escape_string($login), - md5($password), - mysql_real_escape_string($localename), - mysql_real_escape_string($commonname), - mysql_real_escape_string($avatar), - mysql_real_escape_string($email), ''); + mysql_real_escape_string($login), + md5($password), + mysql_real_escape_string($localename), + mysql_real_escape_string($commonname), + mysql_real_escape_string($avatar), + mysql_real_escape_string($email), ''); - perform_query($query,$link); + perform_query($query, $link); $id = mysql_insert_id($link); - return select_one_row("select * from ${mysqlprefix}chatoperator where operatorid = $id", $link ); + return select_one_row("select * from ${mysqlprefix}chatoperator where operatorid = $id", $link); } -function create_operator($login,$email,$password,$localename,$commonname,$avatar) { +function create_operator($login, $email, $password, $localename, $commonname, $avatar) +{ $link = connect(); - $newop = create_operator_($login,$email,$password,$localename,$commonname,$avatar,$link); + $newop = create_operator_($login, $email, $password, $localename, $commonname, $avatar, $link); mysql_close($link); return $newop; } -function notify_operator_alive($operatorid, $istatus) { - global $mysqlprefix; +function notify_operator_alive($operatorid, $istatus) +{ + global $mysqlprefix; $link = connect(); - perform_query("update ${mysqlprefix}chatoperator set istatus = $istatus, dtmlastvisited = CURRENT_TIMESTAMP where operatorid = $operatorid",$link); + perform_query("update ${mysqlprefix}chatoperator set istatus = $istatus, dtmlastvisited = CURRENT_TIMESTAMP where operatorid = $operatorid", $link); mysql_close($link); } -function has_online_operators($groupid="") { +function has_online_operators($groupid = "") +{ global $settings, $mysqlprefix; loadsettings(); $link = connect(); $query = "select count(*) as total, min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time from ${mysqlprefix}chatoperator"; - if($groupid) { + if ($groupid) { $query .= ", ${mysqlprefix}chatgroupoperator where groupid = $groupid and ${mysqlprefix}chatoperator.operatorid = ${mysqlprefix}chatgroupoperator.operatorid and istatus = 0"; } else { $query .= " where istatus = 0"; } - $row = select_one_row($query,$link); + $row = select_one_row($query, $link); mysql_close($link); return $row['time'] < $settings['online_timeout'] && $row['total'] > 0; } -function is_operator_online($operatorid, $link) { +function is_operator_online($operatorid, $link) +{ global $settings, $mysqlprefix; loadsettings_($link); - $query = "select count(*) as total, min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ". + $query = "select count(*) as total, min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time " . "from ${mysqlprefix}chatoperator where operatorid = $operatorid"; - $row = select_one_row($query,$link); + $row = select_one_row($query, $link); return $row['time'] < $settings['online_timeout'] && $row['total'] == 1; } -function get_operator_name($operator) { +function get_operator_name($operator) +{ global $home_locale, $current_locale; - if( $home_locale == $current_locale ) + if ($home_locale == $current_locale) return $operator['vclocalename']; else return $operator['vccommonname']; } -function append_query($link,$pv) { +function append_query($link, $pv) +{ $infix = '?'; - if( strstr($link,$infix) !== FALSE ) + if (strstr($link, $infix) !== FALSE) $infix = '&'; return "$link$infix$pv"; } -function check_login($redirect=true) { - global $webimroot; - if( !isset( $_SESSION['operator'] ) ) { - if( isset($_COOKIE['webim_lite']) ) { - list($login,$pwd) = preg_split("/,/", $_COOKIE['webim_lite'], 2); +function check_login($redirect = true) +{ + global $webimroot, $mysqlprefix; + if (!isset($_SESSION["${mysqlprefix}operator"])) { + if (isset($_COOKIE['webim_lite'])) { + list($login, $pwd) = preg_split("/,/", $_COOKIE['webim_lite'], 2); $op = operator_by_login($login); - if( $op && isset($pwd) && isset($op['vcpassword']) && md5($op['vcpassword']) == $pwd ) { - $_SESSION['operator'] = $op; + if ($op && isset($pwd) && isset($op['vcpassword']) && md5($op['vcpassword']) == $pwd) { + $_SESSION["${mysqlprefix}operator"] = $op; return $op; } } $requested = $_SERVER['PHP_SELF']; - if($_SERVER['REQUEST_METHOD'] == 'GET' && $_SERVER['QUERY_STRING']) { - $requested .= "?".$_SERVER['QUERY_STRING']; + if ($_SERVER['REQUEST_METHOD'] == 'GET' && $_SERVER['QUERY_STRING']) { + $requested .= "?" . $_SERVER['QUERY_STRING']; } - if($redirect) { + if ($redirect) { $_SESSION['backpath'] = $requested; header("Location: $webimroot/operator/login.php"); exit; @@ -213,35 +231,40 @@ function check_login($redirect=true) { return null; } } - return $_SESSION['operator']; + return $_SESSION["${mysqlprefix}operator"]; } -function get_logged_in() { - return isset( $_SESSION['operator'] ) ? $_SESSION['operator'] : FALSE; +function get_logged_in() +{ + global $mysqlprefix; + return isset($_SESSION["${mysqlprefix}operator"]) ? $_SESSION["${mysqlprefix}operator"] : FALSE; } -function login_operator($operator,$remember) { - global $webimroot; - $_SESSION['operator'] = $operator; - if( $remember ) { - $value = $operator['vclogin'].",".md5($operator['vcpassword']); - setcookie('webim_lite', $value, time()+60*60*24*1000, "$webimroot/"); +function login_operator($operator, $remember) +{ + global $webimroot, $mysqlprefix; + $_SESSION["${mysqlprefix}operator"] = $operator; + if ($remember) { + $value = $operator['vclogin'] . "," . md5($operator['vcpassword']); + setcookie('webim_lite', $value, time() + 60 * 60 * 24 * 1000, "$webimroot/"); - } else if( isset($_COOKIE['webim_lite']) ) { + } else if (isset($_COOKIE['webim_lite'])) { setcookie('webim_lite', '', time() - 3600, "$webimroot/"); } } -function logout_operator() { - global $webimroot; - unset($_SESSION['operator']); +function logout_operator() +{ + global $webimroot, $mysqlprefix; + unset($_SESSION["${mysqlprefix}operator"]); unset($_SESSION['backpath']); - if( isset($_COOKIE['webim_lite']) ) { + if (isset($_COOKIE['webim_lite'])) { setcookie('webim_lite', '', time() - 3600, "$webimroot/"); } } -function setup_redirect_links($threadid,$token) { +function setup_redirect_links($threadid, $token) +{ global $page, $webimroot, $settings, $mysqlprefix; loadsettings(); $link = connect(); @@ -249,59 +272,59 @@ function setup_redirect_links($threadid,$token) { $operatorscount = db_rows_count("${mysqlprefix}chatoperator", array(), "", $link); $groupscount = 0; - $groups = array(); - if($settings['enablegroups'] == "1") { - foreach(get_groups($link, true) as $group) { - if($group['inumofagents'] == 0) { + $groups = array(); + if ($settings['enablegroups'] == "1") { + foreach (get_groups($link, true) as $group) { + if ($group['inumofagents'] == 0) { continue; } $groups[] = $group; } $groupscount = count($groups); } - - prepare_pagination(max($operatorscount,$groupscount),8); + + prepare_pagination(max($operatorscount, $groupscount), 8); $p = $page['pagination']; $limit = $p['limit']; $operators = select_multi_assoc(db_build_select( - "operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time", - "${mysqlprefix}chatoperator", array(), "order by vclogin $limit"), $link); - - $groups = array_slice($groups, $p['start'], $p['end']-$p['start']); + "operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time", + "${mysqlprefix}chatoperator", array(), "order by vclogin $limit"), $link); + + $groups = array_slice($groups, $p['start'], $p['end'] - $p['start']); mysql_close($link); $agent_list = ""; $params = array('thread' => $threadid, 'token' => $token); - foreach($operators as $agent) { + foreach ($operators as $agent) { $params['nextAgent'] = $agent['operatorid']; $status = $agent['time'] < $settings['online_timeout'] - ? ($agent['istatus'] == 0 - ? getlocal("char.redirect.operator.online_suff") - : getlocal("char.redirect.operator.away_suff") - ) - : ""; - $agent_list .= "
  • ". - topage(get_operator_name($agent)). - " $status
  • "; + ? ($agent['istatus'] == 0 + ? getlocal("char.redirect.operator.online_suff") + : getlocal("char.redirect.operator.away_suff") + ) + : ""; + $agent_list .= "
  • " . + topage(get_operator_name($agent)) . + " $status
  • "; } $page['redirectToAgent'] = $agent_list; $group_list = ""; - if($settings['enablegroups'] == "1") { + if ($settings['enablegroups'] == "1") { $params = array('thread' => $threadid, 'token' => $token); - foreach($groups as $group) { + foreach ($groups as $group) { $params['nextGroup'] = $group['groupid']; - $status = $group['ilastseen'] !== NULL && $group['ilastseen'] < $settings['online_timeout'] - ? getlocal("char.redirect.operator.online_suff") + $status = $group['ilastseen'] !== NULL && $group['ilastseen'] < $settings['online_timeout'] + ? getlocal("char.redirect.operator.online_suff") : ($group['ilastseenaway'] !== NULL && $group['ilastseenaway'] < $settings['online_timeout'] - ? getlocal("char.redirect.operator.away_suff") - : ""); - $group_list .= "
  • ". - topage(get_group_name($group)). - " $status
  • "; + ? getlocal("char.redirect.operator.away_suff") + : ""); + $group_list .= "
  • " . + topage(get_group_name($group)) . + " $status
  • "; } } $page['redirectToGroup'] = $group_list; @@ -309,10 +332,11 @@ function setup_redirect_links($threadid,$token) { $permission_list = array(); -function get_permission_list() { +function get_permission_list() +{ global $permission_list, $permission_ids; - if(count($permission_list) == 0) { - foreach($permission_ids as $permid) { + if (count($permission_list) == 0) { + foreach ($permission_ids as $permid) { $permission_list[] = array( 'id' => $permid, 'descr' => getlocal("permission.$permid") @@ -322,15 +346,17 @@ function get_permission_list() { return $permission_list; } -function is_capable($perm,$operator) { +function is_capable($perm, $operator) +{ $permissions = $operator && isset($operator['iperm']) ? $operator['iperm'] : 0; return $perm >= 0 && $perm < 32 && ($permissions & (1 << $perm)) != 0; } -function prepare_menu($operator,$hasright=true) { +function prepare_menu($operator, $hasright = true) +{ global $page, $settings, $can_administrate; $page['operator'] = topage(get_operator_name($operator)); - if($hasright) { + if ($hasright) { loadsettings(); $page['showban'] = $settings['enableban'] == "1"; $page['showgroups'] = $settings['enablegroups'] == "1"; @@ -340,31 +366,34 @@ function prepare_menu($operator,$hasright=true) { } } -function get_all_groups($link) { - global $mysqlprefix; +function get_all_groups($link) +{ + global $mysqlprefix; $query = "select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname, vclocaldescription from ${mysqlprefix}chatgroup order by vclocalname"; return select_multi_assoc($query, $link); } -function get_groups($link,$checkaway) { - global $mysqlprefix; - $query = "select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname, vclocaldescription". - ", (SELECT count(*) from ${mysqlprefix}chatgroupoperator where ${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatgroupoperator.groupid) as inumofagents". - ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ". - "from ${mysqlprefix}chatgroupoperator, ${mysqlprefix}chatoperator where istatus = 0 and ${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatgroupoperator.groupid ". - "and ${mysqlprefix}chatgroupoperator.operatorid = ${mysqlprefix}chatoperator.operatorid) as ilastseen". - ($checkaway - ? ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ". - "from ${mysqlprefix}chatgroupoperator, ${mysqlprefix}chatoperator where istatus <> 0 and ${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatgroupoperator.groupid ". - "and ${mysqlprefix}chatgroupoperator.operatorid = ${mysqlprefix}chatoperator.operatorid) as ilastseenaway" - : "" - ). +function get_groups($link, $checkaway) +{ + global $mysqlprefix; + $query = "select ${mysqlprefix}chatgroup.groupid as groupid, vclocalname, vclocaldescription" . + ", (SELECT count(*) from ${mysqlprefix}chatgroupoperator where ${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatgroupoperator.groupid) as inumofagents" . + ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time " . + "from ${mysqlprefix}chatgroupoperator, ${mysqlprefix}chatoperator where istatus = 0 and ${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatgroupoperator.groupid " . + "and ${mysqlprefix}chatgroupoperator.operatorid = ${mysqlprefix}chatoperator.operatorid) as ilastseen" . + ($checkaway + ? ", (SELECT min(unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time " . + "from ${mysqlprefix}chatgroupoperator, ${mysqlprefix}chatoperator where istatus <> 0 and ${mysqlprefix}chatgroup.groupid = ${mysqlprefix}chatgroupoperator.groupid " . + "and ${mysqlprefix}chatgroupoperator.operatorid = ${mysqlprefix}chatoperator.operatorid) as ilastseenaway" + : "" + ) . " from ${mysqlprefix}chatgroup order by vclocalname"; return select_multi_assoc($query, $link); } -function get_operator_groupids($operatorid) { - global $mysqlprefix; +function get_operator_groupids($operatorid) +{ + global $mysqlprefix; $link = connect(); $query = "select groupid from ${mysqlprefix}chatgroupoperator where operatorid = $operatorid"; $result = select_multi_assoc($query, $link); diff --git a/src/messenger/webim/operator/avatar.php b/src/messenger/webim/operator/avatar.php index 3e78b916..10b48376 100644 --- a/src/messenger/webim/operator/avatar.php +++ b/src/messenger/webim/operator/avatar.php @@ -77,8 +77,8 @@ if( !$op ) { if(count($errors) == 0) { update_operator_avatar($op['operatorid'],$avatar); - if ($opId && $avatar && $_SESSION['operator'] && $operator['operatorid'] == $opId) { - $_SESSION['operator']['vcavatar'] = $avatar; + if ($opId && $avatar && $_SESSION["${mysqlprefix}operator"] && $operator['operatorid'] == $opId) { + $_SESSION["${mysqlprefix}operator"]['vcavatar'] = $avatar; } header("Location: $webimroot/operator/avatar.php?op=$opId"); exit; diff --git a/src/messenger/webim/operator/permissions.php b/src/messenger/webim/operator/permissions.php index 2e3abef7..308f3957 100644 --- a/src/messenger/webim/operator/permissions.php +++ b/src/messenger/webim/operator/permissions.php @@ -25,45 +25,46 @@ require_once('../libs/operator_settings.php'); $operator = check_login(); -function update_operator_permissions($operatorid,$newvalue) { - global $mysqlprefix; +function update_operator_permissions($operatorid, $newvalue) +{ + global $mysqlprefix; $link = connect(); $query = "update ${mysqlprefix}chatoperator set iperm = $newvalue where operatorid = $operatorid"; - perform_query($query,$link); + perform_query($query, $link); mysql_close($link); } -$opId = verifyparam( "op","/^\d{1,9}$/"); +$opId = verifyparam("op", "/^\d{1,9}$/"); $page = array('opid' => $opId, 'canmodify' => is_capable($can_administrate, $operator) ? "1" : ""); $errors = array(); $op = operator_by_id($opId); -if( !$op ) { +if (!$op) { $errors[] = getlocal("no_such_operator"); -} else if( isset($_POST['op']) ) { +} else if (isset($_POST['op'])) { - if(!is_capable($can_administrate, $operator)) { + 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) { - if( verifyparam("permissions$id","/^on$/", "") == "on") { + foreach ($permission_ids as $perm => $id) { + if (verifyparam("permissions$id", "/^on$/", "") == "on") { $new_permissions |= (1 << $perm); } else { - $new_permissions &= ~ (1 << $perm); + $new_permissions &= ~(1 << $perm); } } - if(count($errors) == 0) { - update_operator_permissions($op['operatorid'],$new_permissions); + if (count($errors) == 0) { + update_operator_permissions($op['operatorid'], $new_permissions); - if ($opId && $_SESSION['operator'] && $operator['operatorid'] == $opId) { - $_SESSION['operator']['iperm'] = $new_permissions; + if ($opId && $_SESSION["${mysqlprefix}operator"] && $operator['operatorid'] == $opId) { + $_SESSION["${mysqlprefix}operator"]['iperm'] = $new_permissions; } header("Location: $webimroot/operator/permissions.php?op=$opId&stored"); exit; @@ -73,11 +74,11 @@ if( !$op ) { $page['permissionsList'] = get_permission_list(); $page['formpermissions'] = array(""); -$page['currentop'] = $op ? topage(get_operator_name($op))." (".$op['vclogin'].")" : "-not found-"; +$page['currentop'] = $op ? topage(get_operator_name($op)) . " (" . $op['vclogin'] . ")" : "-not found-"; -if($op) { - foreach($permission_ids as $perm => $id) { - if(is_capable($perm,$op)) { +if ($op) { + foreach ($permission_ids as $perm => $id) { + if (is_capable($perm, $op)) { $page['formpermissions'][] = $id; } } @@ -85,7 +86,7 @@ if($op) { $page['stored'] = isset($_GET['stored']); prepare_menu($operator); -setup_operator_settings_tabs($opId,3); +setup_operator_settings_tabs($opId, 3); start_html_output(); require('../view/permissions.php'); ?> \ No newline at end of file diff --git a/src/messenger/webim/operator/update.php b/src/messenger/webim/operator/update.php index f57bfdd1..7d5b4a27 100644 --- a/src/messenger/webim/operator/update.php +++ b/src/messenger/webim/operator/update.php @@ -23,6 +23,7 @@ require_once('../libs/common.php'); require_once('../libs/chat.php'); require_once('../libs/userinfo.php'); require_once('../libs/operator.php'); +require_once('../libs/groups.php'); $operator = get_logged_in(); if( !$operator ) { @@ -167,8 +168,13 @@ $since = verifyparam( "since", "/^\d{1,9}$/", 0); $status = verifyparam( "status", "/^\d{1,2}$/", 0); $showonline = verifyparam( "showonline", "/^1$/", 0); -loadsettings(); -$groupids = $_SESSION['operatorgroups']; +$link = connect(); +loadsettings_($link); +if(!isset($_SESSION['operatorgroups'])) { + $_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link); +} +mysql_close($link); +$groupids = $_SESSION["${mysqlprefix}operatorgroups"]; start_xml_output(); echo ''; diff --git a/src/messenger/webim/operator/users.php b/src/messenger/webim/operator/users.php index a25ba5ec..dba8d1f4 100644 --- a/src/messenger/webim/operator/users.php +++ b/src/messenger/webim/operator/users.php @@ -30,7 +30,7 @@ notify_operator_alive($operator['operatorid'], $status); $link = connect(); loadsettings_($link); -$_SESSION['operatorgroups'] = get_operator_groupslist($operator['operatorid'], $link); +$_SESSION["${mysqlprefix}operatorgroups"] = get_operator_groupslist($operator['operatorid'], $link); mysql_close($link); $page = array();