From 4072aae2bbc82303b5dbafce3087ef36b2f1860b Mon Sep 17 00:00:00 2001 From: Michael Tunnell Date: Fri, 16 Sep 2016 23:53:51 -0500 Subject: [PATCH 1/2] created Operator Status controller for external integration --- src/mibew/configs/routing.yml | 4 ++ .../Mibew/Controller/OpStatusController.php | 58 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/mibew/libs/classes/Mibew/Controller/OpStatusController.php diff --git a/src/mibew/configs/routing.yml b/src/mibew/configs/routing.yml index 7f67e159..3acfa296 100644 --- a/src/mibew/configs/routing.yml +++ b/src/mibew/configs/routing.yml @@ -90,6 +90,10 @@ button: path: /b defaults: { _controller: Mibew\Controller\ButtonController::indexAction } +op_status: + path: /opstatus + defaults: { _controller: Mibew\Controller\OpStatusController::indexAction } + captcha: path: /captcha defaults: { _controller: Mibew\Controller\CaptchaController::drawAction } diff --git a/src/mibew/libs/classes/Mibew/Controller/OpStatusController.php b/src/mibew/libs/classes/Mibew/Controller/OpStatusController.php new file mode 100644 index 00000000..d1cc3985 --- /dev/null +++ b/src/mibew/libs/classes/Mibew/Controller/OpStatusController.php @@ -0,0 +1,58 @@ +query->get('group', ''); + if (!preg_match("/^\d{1,8}$/", $group_id)) { + $group_id = false; + } + if ($group_id) { + if (Settings::get('enablegroups') == '1') { + $group = group_by_id($group_id); + if (!$group) { + $group_id = false; + } + } else { + $group_id = false; + } + } + + // Get image file content + $op_status = has_online_operators($group_id) ? true : false; + + return $op_status; + } +} From 6d0fff91a8358344b110b5348ee227368bbf82e1 Mon Sep 17 00:00:00 2001 From: Michael Tunnell Date: Fri, 16 Sep 2016 23:59:37 -0500 Subject: [PATCH 2/2] fixed comments for Operator Status controller --- .../libs/classes/Mibew/Controller/OpStatusController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mibew/libs/classes/Mibew/Controller/OpStatusController.php b/src/mibew/libs/classes/Mibew/Controller/OpStatusController.php index d1cc3985..4863681b 100644 --- a/src/mibew/libs/classes/Mibew/Controller/OpStatusController.php +++ b/src/mibew/libs/classes/Mibew/Controller/OpStatusController.php @@ -23,12 +23,12 @@ use Mibew\Settings; use Symfony\Component\HttpFoundation\Request; /** - * Represents button-related actions + * Operator Status actions */ class OpStatusController extends AbstractController { /** - * Returns content of the chat button. + * Returns true or false of whether an operator is online or not. * * @param Request $request * @return string Rendered page content @@ -50,7 +50,7 @@ class OpStatusController extends AbstractController } } - // Get image file content + // Get status of operators in chat. (supports group based status) $op_status = has_online_operators($group_id) ? true : false; return $op_status;