Version 1.0.0-RC2
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
||||
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
|
||||
* @copyright (c) 2016 kasimi
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
@@ -14,6 +15,9 @@ use \Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class main_controller
|
||||
{
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \dmzx\mchat\core\mchat */
|
||||
protected $mchat;
|
||||
|
||||
@@ -23,11 +27,13 @@ class main_controller
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\user $user
|
||||
* @param \dmzx\mchat\core\mchat $mchat
|
||||
* @param \phpbb\request\request $request
|
||||
*/
|
||||
public function __construct(\dmzx\mchat\core\mchat $mchat, \phpbb\request\request $request)
|
||||
public function __construct(\phpbb\user $user, \dmzx\mchat\core\mchat $mchat, \phpbb\request\request $request)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->mchat = $mchat;
|
||||
$this->request = $request;
|
||||
}
|
||||
@@ -40,6 +46,7 @@ class main_controller
|
||||
*/
|
||||
public function page($page)
|
||||
{
|
||||
$this->user->add_lang_ext('dmzx/mchat', 'mchat');
|
||||
return call_user_func(array($this->mchat, 'page_' . $page));
|
||||
}
|
||||
|
||||
@@ -47,7 +54,7 @@ class main_controller
|
||||
* Controller for mChat actions called with Ajax requests
|
||||
*
|
||||
* @param string $action The action to perform, one of add|edit|del|refresh|whois
|
||||
* @return A Symfony JsonResponse object
|
||||
* @return \Symfony\Component\HttpFoundation\JsonResponse A Symfony JsonResponse object
|
||||
*/
|
||||
public function action($action)
|
||||
{
|
||||
@@ -56,6 +63,13 @@ class main_controller
|
||||
throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION');
|
||||
}
|
||||
|
||||
// Fix avatars & smilies
|
||||
if (!defined('PHPBB_USE_BOARD_URL_PATH'))
|
||||
{
|
||||
define('PHPBB_USE_BOARD_URL_PATH', true);
|
||||
}
|
||||
|
||||
$this->user->add_lang_ext('dmzx/mchat', 'mchat');
|
||||
$data = call_user_func(array($this->mchat, 'action_' . $action));
|
||||
|
||||
return new JsonResponse($data);
|
||||
|
||||
Reference in New Issue
Block a user