mirror of
https://github.com/Mibew/mibew.git
synced 2025-06-01 15:02:34 +03:00
Merge 6d0fff91a8
into 47e7a81f6f
This commit is contained in:
commit
9558f98b6c
@ -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 }
|
||||
|
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is a part of Mibew Messenger.
|
||||
*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Mibew\Controller;
|
||||
|
||||
use Mibew\Settings;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Operator Status actions
|
||||
*/
|
||||
class OpStatusController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Returns true or false of whether an operator is online or not.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return string Rendered page content
|
||||
*/
|
||||
public function indexAction(Request $request)
|
||||
{
|
||||
$group_id = $request->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 status of operators in chat. (supports group based status)
|
||||
$op_status = has_online_operators($group_id) ? true : false;
|
||||
|
||||
return $op_status;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user