From 4ccd67e28af3bc9e63e55da631b21cf2858c0d3b Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Tue, 5 Aug 2014 11:39:44 +0000 Subject: [PATCH] Do not work directly with session in "notify_operator_alive" func Fixes #57 --- .../libs/classes/Mibew/Controller/UsersController.php | 2 ++ .../libs/classes/Mibew/RequestProcessor/UsersProcessor.php | 6 ++++++ src/mibew/libs/operator.php | 7 +------ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mibew/libs/classes/Mibew/Controller/UsersController.php b/src/mibew/libs/classes/Mibew/Controller/UsersController.php index affab2db..8e65104c 100644 --- a/src/mibew/libs/classes/Mibew/Controller/UsersController.php +++ b/src/mibew/libs/classes/Mibew/Controller/UsersController.php @@ -39,6 +39,8 @@ class UsersController extends AbstractController $status = $request->query->has('away') ? 1 : 0; notify_operator_alive($operator['operatorid'], $status); + $operator['istatus'] = $status; + $this->getAuthenticationManager()->setOperator($operator); $_SESSION[SESSION_PREFIX . "operatorgroups"] = get_operator_groups_list($operator['operatorid']); diff --git a/src/mibew/libs/classes/Mibew/RequestProcessor/UsersProcessor.php b/src/mibew/libs/classes/Mibew/RequestProcessor/UsersProcessor.php index 88b271c8..b371f2ff 100644 --- a/src/mibew/libs/classes/Mibew/RequestProcessor/UsersProcessor.php +++ b/src/mibew/libs/classes/Mibew/RequestProcessor/UsersProcessor.php @@ -155,6 +155,9 @@ class UsersProcessor extends ClientSideProcessor implements AuthenticationManage { $operator = $this->checkOperator($args['agentId']); notify_operator_alive($operator['operatorid'], 1); + // Update operator's data thus they will be sent with the response. + $operator['istatus'] = 1; + $this->getAuthenticationManager()->setOperator($operator); } /** @@ -168,6 +171,9 @@ class UsersProcessor extends ClientSideProcessor implements AuthenticationManage { $operator = $this->checkOperator($args['agentId']); notify_operator_alive($operator['operatorid'], 0); + // Update operator's data thus they will be sent with the response. + $operator['istatus'] = 0; + $this->getAuthenticationManager()->setOperator($operator); } /** diff --git a/src/mibew/libs/operator.php b/src/mibew/libs/operator.php index af130671..cac04a21 100644 --- a/src/mibew/libs/operator.php +++ b/src/mibew/libs/operator.php @@ -435,7 +435,7 @@ function delete_operator($operator_id) /** * Set current status of the operator('available' or 'away') * - * @param int $operatorid Id of the operator + * @param int $operator_id Id of the operator * @param int $istatus Operator status: '0' means 'available' and '1' means * 'away' */ @@ -451,11 +451,6 @@ function notify_operator_alive($operator_id, $istatus) ':operatorid' => $operator_id, ) ); - if (isset($_SESSION[SESSION_PREFIX . "operator"])) { - if ($_SESSION[SESSION_PREFIX . "operator"]['operatorid'] == $operator_id) { - $_SESSION[SESSION_PREFIX . "operator"]['istatus'] = $istatus; - } - } } /**