Version 0.3.3

This commit is contained in:
dmzx
2016-01-28 20:54:41 +01:00
parent 08b6b57225
commit 6a3cb1cd04
54 changed files with 1906 additions and 4475 deletions

View File

@@ -16,44 +16,34 @@ class listener implements EventSubscriberInterface
/** @var \dmzx\mchat\core\functions_mchat */
protected $functions_mchat;
/** @var \dmzx\mchat\core\render_helper */
protected $render_helper;
/** @var \phpbb\auth\auth */
protected $auth;
/** @var \dmzx\mchat\core\mchat */
protected $mchat;
/** @var \phpbb\controller\helper */
protected $controller_helper;
/** @var \phpbb\template\template */
protected $template;
protected $helper;
/** @var \phpbb\user */
protected $user;
/** @var string */
protected $phpEx;
protected $php_ext;
/**
* Constructor
*
* @param \dmzx\mchat\core\functions_mchat $functions_mchat
* @param \dmzx\mchat\core\render_helper $render_helper
* @param \phpbb\auth\auth $auth
* @param \phpbb\controller\helper $controller_helper
* @param \phpbb\template\template $template
* @param \dmzx\mchat\core\mchat $mchat
* @param \phpbb\controller\helper $helper
* @param \phpbb\user $user
* @param string $phpEx
* @param string $php_ext
*/
public function __construct(\dmzx\mchat\core\functions_mchat $functions_mchat, \dmzx\mchat\core\render_helper $render_helper, \phpbb\auth\auth $auth, \phpbb\controller\helper $controller_helper, \phpbb\template\template $template, \phpbb\user $user, $phpEx)
public function __construct(\dmzx\mchat\core\functions_mchat $functions_mchat, \dmzx\mchat\core\mchat $mchat, \phpbb\controller\helper $helper, \phpbb\user $user, $php_ext)
{
$this->functions_mchat = $functions_mchat;
$this->render_helper = $render_helper;
$this->auth = $auth;
$this->controller_helper = $controller_helper;
$this->template = $template;
$this->user = $user;
$this->phpEx = $phpEx;
$this->functions_mchat = $functions_mchat;
$this->mchat = $mchat;
$this->helper = $helper;
$this->user = $user;
$this->php_ext = $php_ext;
}
static public function getSubscribedEvents()
@@ -69,15 +59,21 @@ class listener implements EventSubscriberInterface
);
}
/**
*
*/
public function add_page_viewonline($event)
{
if (strrpos($event['row']['session_page'], 'app.' . $this->phpEx . '/mchat') === 0)
if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/mchat') === 0)
{
$event['location'] = $this->user->lang('MCHAT_TITLE');
$event['location_url'] = $this->controller_helper->route('dmzx_mchat_controller');
$event['location_url'] = $this->helper->route('dmzx_mchat_controller');
}
}
/**
*
*/
public function load_language_on_setup($event)
{
$lang_set_ext = $event['lang_set_ext'];
@@ -97,13 +93,7 @@ class listener implements EventSubscriberInterface
*/
public function add_page_header_link($event)
{
$allow_view = $this->auth->acl_get('u_mchat_view');
$config_mchat = $allow_view ? $this->functions_mchat->mchat_cache() : array();
$this->template->assign_vars(array(
'MCHAT_ALLOW_VIEW' => $this->auth->acl_get('u_mchat_view'),
'S_MCHAT_CUSTOM_PAGE' => !empty($config_mchat['custom_page']),
'U_MCHAT' => $this->controller_helper->route('dmzx_mchat_controller'),
));
$this->mchat->render_page_header_link();
}
/**
@@ -115,10 +105,12 @@ class listener implements EventSubscriberInterface
*/
public function display_mchat_on_index($event)
{
$this->render_helper->render_data_for_page(true);
$this->render_helper->assign_whois();
$this->mchat->page_index();
}
/**
*
*/
public function posting_modify_submit_post_after($event)
{
$this->functions_mchat->mchat_insert_posting($event['mode'], array(
@@ -129,6 +121,17 @@ class listener implements EventSubscriberInterface
));
}
/**
*
*/
public function display_custom_bbcodes_modify_sql($event)
{
$event['sql_ary'] = $this->mchat->remove_disallowed_bbcodes($event['sql_ary']);
}
/**
*
*/
public function permissions($event)
{
$event['permissions'] = array_merge($event['permissions'], array(
@@ -194,21 +197,4 @@ class listener implements EventSubscriberInterface
'mChat' => 'ACP_CAT_MCHAT',
));
}
public function display_custom_bbcodes_modify_sql($event)
{
// Add disallowed BBCodes to the template only if we're rendering for mChat
if ($this->render_helper->is_mchat_rendered)
{
$disallowed_bbcode_array = $this->functions_mchat->get_disallowed_bbcodes();
if (!empty($disallowed_bbcode_array))
{
$disallowed_bbcode_array = array_map('strtoupper', $disallowed_bbcode_array);
$sql_ary = $event['sql_ary'];
$sql_ary['WHERE'] .= " AND UPPER(b.bbcode_tag) NOT IN ('" . implode("','", $disallowed_bbcode_array) . "')";
$event['sql_ary'] = $sql_ary;
}
}
}
}