diff --git a/composer.json b/composer.json
index 37cad17..d61c5b8 100644
--- a/composer.json
+++ b/composer.json
@@ -3,7 +3,7 @@
"type": "phpbb-extension",
"description": "mChat Extension for phpbb 3.1.x",
"homepage": "http://www.dmzx-web.net",
- "version": "0.0.4",
+ "version": "0.0.5",
"time": "2015-03-10",
"keywords": ["phpbb", "extension", "mchat"],
"license": "GPL-2.0",
diff --git a/config/services.yml b/config/services.yml
index ddeb325..c2d53f8 100644
--- a/config/services.yml
+++ b/config/services.yml
@@ -1,6 +1,12 @@
services:
dmzx.mchat.controller:
class: dmzx\mchat\controller\mchat
+ arguments:
+ - @dmzx.mchat.render_helper
+ - @controller.helper
+ - @request
+ dmzx.mchat.render_helper:
+ class: dmzx\mchat\core\render_helper
arguments:
- @dmzx.mchat.functions_mchat
- @config
@@ -26,6 +32,7 @@ services:
dmzx.mchat.listener:
class: dmzx\mchat\event\listener
arguments:
+ - @dmzx.mchat.render_helper
- @auth
- @config
- @controller.helper
diff --git a/controller/mchat.php b/controller/mchat.php
index fef7ec6..8a22c95 100644
--- a/controller/mchat.php
+++ b/controller/mchat.php
@@ -11,68 +11,27 @@ namespace dmzx\mchat\controller;
class mchat
{
- /** @var \dmzx\mchat\core\functions_mchat */
- protected $functions_mchat;
-
- /** @var \phpbb\config\config */
- protected $config;
+ /** @var \dmzx\mchat\core\render_helper */
+ protected $render_helper;
/** @var \phpbb\controller\helper */
protected $helper;
- /** @var \phpbb\template\template */
- protected $template;
-
- /** @var \phpbb\user */
- protected $user;
-
- /** @var \phpbb\auth\auth */
- protected $auth;
-
- /** @var \phpbb\db\driver\driver_interface */
- protected $db;
-
- /** @var \phpbb\cache\service */
- protected $cache;
-
/** @var \phpbb\request\request */
protected $request;
- protected $phpbb_root_path;
- protected $phpEx;
- protected $table_prefix;
-
/**
* Constructor
*
- * @param \dmzx\mchat\core\functions_mchat $functions_mchat
- * @param \phpbb\config\config $config
+ * @param \dmzx\mchat\core\render_helper $render_helper
* @param \phpbb\controller\helper $helper
- * @param \phpbb\template\template $template
- * @param \phpbb\user $user
- * @param \phpbb\auth\auth $auth
- * @param \phpbb\db\driver\driver_interface $db
- * @param \phpbb\cache\service $cache
* @param \phpbb\request\request $request
- * @param $phpbb_root_path
- * @param $phpEx
- * @param $table_prefix
*/
- public function __construct(\dmzx\mchat\core\functions_mchat $functions_mchat, \phpbb\config\config $config, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\request\request $request, $phpbb_root_path, $phpEx, $table_prefix)
+ public function __construct(\dmzx\mchat\core\render_helper $render_helper, \phpbb\controller\helper $helper, \phpbb\request\request $request)
{
- $this->functions_mchat = $functions_mchat;
- $this->config = $config;
+ $this->render_helper = $render_helper;
$this->helper = $helper;
- $this->template = $template;
- $this->user = $user;
- $this->auth = $auth;
- $this->db = $db;
- $this->cache = $cache;
$this->request = $request;
-
- $this->phpbb_root_path = $phpbb_root_path;
- $this->phpEx = $phpEx;
- $this->table_prefix = $table_prefix;
}
/**
@@ -82,972 +41,22 @@ class mchat
*/
public function handle()
{
- // Add lang file
- //$this->user->add_lang(array('mods/mchat_lang', 'viewtopic', 'posting'));
+ $ret = $this->render_helper->render_data_for_page();
- //chat enabled
- if (!$this->config['mchat_enable'])
+ // If this was an ajax request, we just create an json_response and return that. It's not ours to handle here.
+ if ($this->request->is_ajax() && is_array($ret) && isset($ret['json']) && $ret['json'] === true)
{
- $this->helper->error($this->user->lang['MCHAT_ENABLE'], E_USER_NOTICE);
+ return new \Symfony\Component\HttpFoundation\JsonResponse(
+ $ret
+ );
}
- // avatars
- if (!function_exists('get_user_avatar'))
+ // If error occured, render it
+ if (isset($ret['error']) && $ret['error'] == true)
{
- include($this->phpbb_root_path . 'includes/functions_display.' . $this->phpEx);
+ return $this->helper->error($ret['error_text'], $ret['error_type']);
}
- if (($this->config_mchat = $this->cache->get('_mchat_config')) === false)
- {
- $this->functions_mchat->mchat_cache();
- }
- $this->config_mchat = $this->cache->get('_mchat_config');
- // Access rights
- $mchat_allow_bbcode = ($this->config['allow_bbcode'] && $this->auth->acl_get('u_mchat_bbcode')) ? true : false;
- $mchat_smilies = ($this->config['allow_smilies'] && $this->auth->acl_get('u_mchat_smilies')) ? true : false;
- $mchat_urls = ($this->config['allow_post_links'] && $this->auth->acl_get('u_mchat_urls')) ? true : false;
- $mchat_ip = ($this->auth->acl_get('u_mchat_ip')) ? true : false;
- $mchat_add_mess = ($this->auth->acl_get('u_mchat_use')) ? true : false;
- $mchat_view = ($this->auth->acl_get('u_mchat_view')) ? true : false;
- $mchat_no_flood = ($this->auth->acl_get('u_mchat_flood_ignore')) ? true : false;
- $mchat_read_archive = ($this->auth->acl_get('u_mchat_archive')) ? true : false;
- $mchat_founder = ($this->user->data['user_type'] == USER_FOUNDER) ? true : false;
- $mchat_session_time = !empty($this->config_mchat['timeout']) ? $this->config_mchat['timeout'] : (!empty($this->config['load_online_time']) ? $this->config['load_online_time'] * 60 : $this->config['session_length']);
- $mchat_rules = (!empty($this->config_mchat['rules']) || isset($this->user->lang[strtoupper('mchat_rules')])) ? true : false;
- $mchat_avatars = (!empty($this->config_mchat['avatars']) && $this->user->optionget('viewavatars') && $this->user->data['user_mchat_avatars']) ? true : false;
-
- // needed variables
- // Request options.
- $mchat_mode = request_var('mode', '');
- $mchat_read_mode = $mchat_archive_mode = $mchat_custom_page = $mchat_no_message = false;
- // set redirect if on index or custom page
- $on_page = defined('MCHAT_INCLUDE') ? 'index' : 'mchat';
-
- // grab fools..uhmmm, foes the user has
- $foes_array = array();
- $sql = 'SELECT * FROM ' . ZEBRA_TABLE . '
- WHERE user_id = ' . $this->user->data['user_id'] . ' AND foe = 1';
- $result = $this->db->sql_query($sql);
- while ($row = $this->db->sql_fetchrow($result))
- {
- $foes_array[] = $row['zebra_id'];
- }
- $this->db->sql_freeresult($result);
-
- // Request mode...
- switch ($mchat_mode)
- {
- // rules popup..
- case 'rules':
- // If the rules are defined in the language file use them, else just use the entry in the database
- if ($mchat_rules || isset($this->user->lang[strtoupper('mchat_rules')]))
- {
- if(isset($this->user->lang[strtoupper('mchat_rules')]))
- {
- $this->template->assign_var('MCHAT_RULES', $this->user->lang[strtoupper('mchat_rules')]);
- }
- else
- {
- $mchat_rules = $this->config_mchat['rules'];
- $mchat_rules = explode("\n", $mchat_rules);
-
- foreach ($mchat_rules as $mchat_rule)
- {
- $mchat_rule = htmlspecialchars($mchat_rule);
- $this->template->assign_block_vars('rule', array(
- 'MCHAT_RULE' => $mchat_rule,
- ));
- }
- }
-
- // Output the page
- $this->helper->render('mchat_rules.html', $this->user->lang['MCHAT_HELP']);
- }
- else
- {
- // Show no rules
- $this->helper->error('NO_MCHAT_RULES', E_USER_NOTICE);
- }
-
- break;
- // whois function..
- case 'whois':
-
- // Must have auths
- if ($mchat_mode == 'whois' && $mchat_ip)
- {
- // function already exists..
- if (!function_exists('user_ipwhois'))
- {
- include($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx);
- }
-
- $this->user_ip = request_var('ip', '');
-
- $this->template->assign_var('WHOIS', user_ipwhois($this->user_ip));
-
- // Output the page
- $this->helper->render('viewonline_whois.html', $this->user->lang['WHO_IS_ONLINE']);
- }
- else
- {
- // Show not authorized
- $this->helper->error('NO_AUTH_OPERATION', E_USER_NOTICE);
- }
- break;
- // Clean function...
- case 'clean':
-
- // User logged in?
- if(!$this->user->data['is_registered'] || !$mchat_founder)
- {
- if(!$this->user->data['is_registered'])
- {
- // Login box...
- login_box('', $this->user->lang['LOGIN']);
- }
- else if (!$mchat_founder)
- {
- // Show not authorized
- $this->helper->error('NO_AUTH_OPERATION', E_USER_NOTICE);
- }
- }
-
- $mchat_redirect = request_var('redirect', '');
- $mchat_redirect = ($mchat_redirect == 'index') ? append_sid("{$this->phpbb_root_path}index.{$this->phpEx}") : $this->helper->route('dmzx_mchat_controller', array('#mChat'));
-
- if(confirm_box(true))
- {
- // Run cleaner
- $sql = 'TRUNCATE TABLE ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE;
- $this->db->sql_query($sql);
-
- meta_refresh(3, $mchat_redirect);
- $this->helper->error($this->user->lang['MCHAT_CLEANED'].'
'.sprintf($this->user->lang['RETURN_PAGE'], '', ''), E_USER_NOTICE);
- }
- else
- {
- // Display confirm box
- confirm_box(false, $this->user->lang['MCHAT_DELALLMESS']);
- }
- add_log('admin', 'LOG_MCHAT_TABLE_PRUNED');
- redirect($mchat_redirect);
- break;
-
- // Archive function...
- case 'archive':
-
- if (!$mchat_read_archive || !$mchat_view)
- {
- // redirect to correct page
- $mchat_redirect = append_sid("{$this->phpbb_root_path}index.{$this->phpEx}");
- // Redirect to previous page
- meta_refresh(3, $mchat_redirect);
- $this->helper->error($this->user->lang['MCHAT_NOACCESS_ARCHIVE'].'
'.sprintf($this->user->lang['RETURN_PAGE'], '', ''), E_USER_NOTICE);
- }
-
- if ($this->config['mchat_enable'] && $mchat_read_archive && $mchat_view)
- {
- // how many chats do we have?
- $sql = 'SELECT COUNT(message_id) AS messages FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE;
- $result = $this->db->sql_query($sql);
- $mchat_total_messages = $this->db->sql_fetchfield('messages');
- $this->db->sql_freeresult($result);
- // prune the chats if necessary and amount in ACP not empty
- if ($this->config_mchat['prune_enable'] && ($mchat_total_messages > $this->config_mchat['prune_num'] && $this->config_mchat['prune_num'] > 0))
- {
- $this->functions_mchat->mchat_prune((int) $this->config_mchat['prune_num']);
- }
-
- // Reguest...
- $mchat_archive_start = request_var('start', 0);
- $sql_where = $this->user->data['user_mchat_topics'] ? '' : 'WHERE m.forum_id = 0';
- // Message row
- $sql = 'SELECT m.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm
- FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m
- LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id
- ' . $sql_where . '
- ORDER BY m.message_id DESC';
- $result = $this->db->sql_query_limit($sql, (int) $this->config_mchat['archive_limit'], $mchat_archive_start);
- $rows = $this->db->sql_fetchrowset($result);
- $this->db->sql_freeresult($result);
-
- foreach($rows as $row)
- {
- // auth check
- if ($row['forum_id'] != 0 && !$this->auth->acl_get('f_read', $row['forum_id']))
- {
- continue;
- }
- // edit, delete and permission auths
- $mchat_ban = ($this->auth->acl_get('a_authusers') && $this->user->data['user_id'] != $row['user_id']) ? true : false;
- $mchat_edit = ($this->auth->acl_get('u_mchat_edit') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id'])) ? true : false;
- $mchat_del = ($this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id'])) ? true : false;
- $mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';
- $message_edit = $row['message'];
- decode_message($message_edit, $row['bbcode_uid']);
- $message_edit = str_replace('"', '"', $message_edit); // Edit Fix ;)
- if (sizeof($foes_array))
- {
- if (in_array($row['user_id'], $foes_array))
- {
- $row['message'] = sprintf($this->user->lang['MCHAT_FOE'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']));
- }
- }
- $row['username'] = mb_ereg_replace("'", "", $row['username']);
- $this->template->assign_block_vars('mchatrow', array(
- 'MCHAT_ALLOW_BAN' => $mchat_ban,
- 'MCHAT_ALLOW_EDIT' => $mchat_edit,
- 'MCHAT_ALLOW_DEL' => $mchat_del,
- 'MCHAT_USER_AVATAR' => $mchat_avatar,
- 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '',
- 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '55' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
- 'MCHAT_MESSAGE_EDIT' => $message_edit,
- 'MCHAT_MESSAGE_ID' => $row['message_id'],
- 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USER_IP' => $row['user_ip'],
- 'MCHAT_U_WHOIS' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'whois', 'ip' => $row['user_ip'])),
- 'MCHAT_U_BAN' => append_sid("{$this->phpbb_root_path}adm/index.{$this->phpEx}" ,'i=permissions&mode=setting_user_global&user_id[0]=' . $row['user_id'], true, $this->user->session_id),
- 'MCHAT_MESSAGE' => generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']),
- 'MCHAT_TIME' => $this->user->format_date($row['message_time'], $this->config_mchat['date']),
- 'MCHAT_CLASS' => ($row['message_id'] % 2) ? 1 : 2
- ));
- }
-
- // Write no message
- if (empty($rows))
- {
- $mchat_no_message = true;
- }
- }
-
- // Run query again to get the total message rows...
- $sql = 'SELECT COUNT(message_id) AS mess_id FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE;
- $result = $this->db->sql_query($sql);
- $mchat_total_message = $this->db->sql_fetchfield('mess_id');
- $this->db->sql_freeresult($result);
- // Page list function...
- $this->template->assign_vars(array(
- // 'MCHAT_PAGE_NUMBER' => $pagination->get_on_page($mchat_total_message, (int) $this->config_mchat['archive_limit'], $mchat_archive_start),
- 'MCHAT_TOTAL_MESSAGES' => sprintf($this->user->lang['MCHAT_TOTALMESSAGES'], $mchat_total_message),
- //\\ 'MCHAT_PAGINATION' => generate_pagination(append_sid("{$this->phpbb_root_path}mchat.{$this->phpEx}", 'mode=archive'), $mchat_total_message, (int) $this->config_mchat['archive_limit'], $mchat_archive_start, true)
- ));
-
- //add to navlinks
- $this->template->assign_block_vars('navlinks', array(
- 'FORUM_NAME' => $this->user->lang['MCHAT_ARCHIVE_PAGE'],
- 'U_VIEW_FORUM' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'archive')),
- ));
- // If archive mode request set true
- $mchat_archive_mode = true;
- $old_mode = 'archive';
-
- break;
-
- // Read function...
- case 'read':
-
- // If mChat disabled or user can't view the chat
- if (!$this->config['mchat_enable'] || !$mchat_view)
- {
- // Forbidden (for jQ AJAX request)
- throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
- }
- // if we're reading on the custom page, then we are chatting
- if ($mchat_custom_page)
- {
- // insert user into the mChat sessions table
- $this->functions_mchat->mchat_sessions($mchat_session_time, true);
- }
- // Request
- $mchat_message_last_id = request_var('message_last_id', 0);
- $sql_and = $this->user->data['user_mchat_topics'] ? '' : 'AND m.forum_id = 0';
- $sql = 'SELECT m.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm
- FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m, ' . USERS_TABLE . ' u
- WHERE m.user_id = u.user_id
- AND m.message_id > ' . (int) $mchat_message_last_id . '
- ' . $sql_and . '
- ORDER BY m.message_id DESC';
- $result = $this->db->sql_query_limit($sql, (int) $this->config_mchat['message_limit']);
- $rows = $this->db->sql_fetchrowset($result);
- $this->db->sql_freeresult($result);
- // Reverse the array wanting messages appear in reverse
- $rows = array_reverse($rows);
-
- foreach($rows as $row)
- {
- // auth check
- if ($row['forum_id'] != 0 && !$this->auth->acl_get('f_read', $row['forum_id']))
- {
- continue;
- }
- // edit auths
- if ($this->user->data['user_id'] == ANONYMOUS && $this->user->data['user_id'] == $row['user_id'])
- {
- $chat_auths = $this->user->data['session_ip'] == $row['user_ip'] ? true : false;
- }
- else
- {
- $chat_auths = $this->user->data['user_id'] == $row['user_id'] ? true : false;
- }
- // edit, delete and permission auths
- $mchat_ban = ($this->auth->acl_get('a_authusers') && $this->user->data['user_id'] != $row['user_id']) ? true : false;
- $mchat_edit = ($this->auth->acl_get('u_mchat_edit') && ($this->auth->acl_get('m_') || $chat_auths)) ? true : false;
- $mchat_del = ($this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $chat_auths)) ? true : false;
- $mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';
- $message_edit = $row['message'];
- decode_message($message_edit, $row['bbcode_uid']);
- $message_edit = str_replace('"', '"', $message_edit);
- $message_edit = mb_ereg_replace("'", "", $message_edit); // Edit Fix ;)
- if (sizeof($foes_array))
- {
- if (in_array($row['user_id'], $foes_array))
- {
- $row['message'] = sprintf($this->user->lang['MCHAT_FOE'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']));
- }
- }
- $row['username'] = mb_ereg_replace("'", "", $row['username']);
- $this->template->assign_block_vars('mchatrow', array(
- 'MCHAT_ALLOW_BAN' => $mchat_ban,
- 'MCHAT_ALLOW_EDIT' => $mchat_edit,
- 'MCHAT_ALLOW_DEL' => $mchat_del,
- 'MCHAT_USER_AVATAR' => $mchat_avatar,
- 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '',
- 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '55' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
- 'MCHAT_MESSAGE_EDIT' => $message_edit,
- 'MCHAT_MESSAGE_ID' => $row['message_id'],
- 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USER_IP' => $row['user_ip'],
- 'MCHAT_U_WHOIS' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'whois', 'ip' => $row['user_ip'])),
- 'MCHAT_U_BAN' => append_sid("{$this->phpbb_root_path}adm/index.{$this->phpEx}" ,'i=permissions&mode=setting_user_global&user_id[0]=' . $row['user_id'], true, $this->user->session_id),
- 'MCHAT_MESSAGE' => generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']),
- 'MCHAT_TIME' => $this->user->format_date($row['message_time'], $this->config_mchat['date']),
- 'MCHAT_CLASS' => ($row['message_id'] % 2) ? 1 : 2
- ));
- }
-
- // Write no message
- if (empty($rows))
- {
- $mchat_no_message = true;
- }
-
- // If read mode request set true
- $mchat_read_mode = true;
-
- break;
-
- // Stats function...
- case 'stats':
-
- // If mChat disabled or user can't view the chat
- if (!$this->config['mchat_enable'] || !$mchat_view || !$this->config_mchat['whois'])
- {
- // Forbidden (for jQ AJAX request)
- throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
- }
-
- $mchat_stats = $this->functions_mchat->mchat_users($mchat_session_time);
-
- if(!empty($mchat_stats['online_userlist']))
- {
- $message = '
';
- }
- else
- {
- $message = '' . $this->user->lang['MCHAT_NO_CHATTERS'] . ' (' . $mchat_stats['refresh_message'] . ')
';
- }
-
- if ($this->request->is_ajax())
- {
- return new \Symfony\Component\HttpFoundation\JsonResponse(array(
- 'message' => $message,
- ));
- }
- else
- {
- throw new \phpbb\exception\http_exception(501, 'MCHAT_ERROR_NOT_IMPLEMENTED');
- }
-
- break;
-
- // Add function...
- case 'add':
-
- // If mChat disabled
- if (!$this->config['mchat_enable'] || !$mchat_add_mess || !check_form_key('mchat_posting', -1))
- {
- // Forbidden (for jQ AJAX request)
- if ($this->request->is_ajax()) // FOR DEBUG
- throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
- }
-
- // Reguest...
- $message = utf8_normalize_nfc(request_var('message', '', true));
-
- // must have something other than bbcode in the message
- if (empty($mchatregex))
- {
- //let's strip all the bbcode
- $mchatregex = '#\[/?[^\[\]]+\]#mi';
- }
- $message_chars = preg_replace($mchatregex, '', $message);
- $message_chars = (utf8_strlen(trim($message_chars)) > 0) ? true : false;
-
- if (!$message || !$message_chars)
- {
- // Not Implemented (for jQ AJAX request)
- throw new \phpbb\exception\http_exception(501, 'MCHAT_ERROR_NOT_IMPLEMENTED');
- }
-
- // Flood control
- if (!$mchat_no_flood && $this->config_mchat['flood_time'])
- {
- $mchat_flood_current_time = time();
- $sql = 'SELECT message_time FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . '
- WHERE user_id = ' . (int) $this->user->data['user_id'] . '
- ORDER BY message_time DESC';
- $result = $this->db->sql_query_limit($sql, 1);
- $row = $this->db->sql_fetchrow($result);
- $this->db->sql_freeresult($result);
- if($row['message_time'] > 0 && ($mchat_flood_current_time - $row['message_time']) < (int) $this->config_mchat['flood_time'])
- {
- // Locked (for jQ AJAX request)
- throw new \phpbb\exception\http_exception(400, 'MCHAT_BAD_REQUEST');
- }
- }
- // insert user into the mChat sessions table
- $this->functions_mchat->mchat_sessions($mchat_session_time, true);
- // we override the $this->config['min_post_chars'] entry?
- if ($this->config_mchat['override_min_post_chars'])
- {
- $old_cfg['min_post_chars'] = $this->config['min_post_chars'];
- $this->config['min_post_chars'] = 0;
- }
- //we do the same for the max number of smilies?
- if ($this->config_mchat['override_smilie_limit'])
- {
- $old_cfg['max_post_smilies'] = $this->config['max_post_smilies'];
- $this->config['max_post_smilies'] = 0;
- }
-
- // Add function part code from http://wiki.phpbb.com/Parsing_text
- $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
- generate_text_for_storage($message, $uid, $bitfield, $options, $mchat_allow_bbcode, $mchat_urls, $mchat_smilies);
- // Not allowed bbcodes
- if (!$mchat_allow_bbcode || $this->config_mchat['bbcode_disallowed'])
- {
- if (!$mchat_allow_bbcode)
- {
- $bbcode_remove = '#\[/?[^\[\]]+\]#Usi';
- $message = preg_replace($bbcode_remove, '', $message);
- }
- // disallowed bbcodes
- else if ($this->config_mchat['bbcode_disallowed'])
- {
- if (empty($bbcode_replace))
- {
- $bbcode_replace = array('#\[(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
- '#\[/(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
- );
- }
- $message = preg_replace($bbcode_replace, '', $message);
- }
- }
-
- $sql_ary = array(
- 'forum_id' => 0,
- 'post_id' => 0,
- 'user_id' => $this->user->data['user_id'],
- 'user_ip' => $this->user->data['session_ip'],
- 'message' => str_replace('\'', '’', $message),
- 'bbcode_bitfield' => $bitfield,
- 'bbcode_uid' => $uid,
- 'bbcode_options' => $options,
- 'message_time' => time()
- );
- $sql = 'INSERT INTO ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
- $this->db->sql_query($sql);
-
- // reset the config settings
- if(isset($old_cfg['min_post_chars']))
- {
- $this->config['min_post_chars'] = $old_cfg['min_post_chars'];
- unset($old_cfg['min_post_chars']);
- }
- if(isset($old_cfg['max_post_smilies']))
- {
- $this->config['max_post_smilies'] = $old_cfg['max_post_smilies'];
- unset($old_cfg['max_post_smilies']);
- }
-
- // Stop run code!
- if ($this->request->is_ajax())
- {
- return new \Symfony\Component\HttpFoundation\JsonResponse(array(
- 'success' => true,
- ));
- }
- else
- {
- exit_handler();
- }
- break;
-
- // Edit function...
- case 'edit':
-
- $message_id = request_var('message_id', 0);
-
- // If mChat disabled and not edit
- if (!$this->config['mchat_enable'] || !$message_id)
- {
- // Forbidden (for jQ AJAX request)
- throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
- }
-
- // check for the correct user
- $sql = 'SELECT *
- FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . '
- WHERE message_id = ' . (int) $message_id;
- $result = $this->db->sql_query($sql);
- $row = $this->db->sql_fetchrow($result);
- $this->db->sql_freeresult($result);
- // edit and delete auths
- $mchat_edit = $this->auth->acl_get('u_mchat_edit')&& ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
- $mchat_del = $this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
- // If mChat disabled and not edit
- if (!$mchat_edit)
- {
- // Forbidden (for jQ AJAX request)
- throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
- }
- // Reguest...
- $message = request_var('message', '', true);
-
- // must have something other than bbcode in the message
- if (empty($mchatregex))
- {
- //let's strip all the bbcode
- $mchatregex = '#\[/?[^\[\]]+\]#mi';
- }
- $message_chars = preg_replace($mchatregex, '', $message);
- $message_chars = (utf8_strlen(trim($message_chars)) > 0) ? true : false;
- if (!$message || !$message_chars)
- {
- // Not Implemented (for jQ AJAX request)
- throw new \phpbb\exception\http_exception(501, 'MCHAT_ERROR_NOT_IMPLEMENTED');
- }
-
- // Message limit
- $message = ($this->config_mchat['max_message_lngth'] != 0 && utf8_strlen($message) >= $this->config_mchat['max_message_lngth'] + 3) ? utf8_substr($message, 0, $this->config_mchat['max_message_lngth']).'...' : $message;
-
- // we override the $this->config['min_post_chars'] entry?
- if ($this->config_mchat['override_min_post_chars'])
- {
- $old_cfg['min_post_chars'] = $this->config['min_post_chars'];
- $this->config['min_post_chars'] = 0;
- }
- //we do the same for the max number of smilies?
- if ($this->config_mchat['override_smilie_limit'])
- {
- $old_cfg['max_post_smilies'] = $this->config['max_post_smilies'];
- $this->config['max_post_smilies'] = 0;
- }
-
- // Edit function part code from http://wiki.phpbb.com/Parsing_text
- $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
- generate_text_for_storage($message, $uid, $bitfield, $options, $mchat_allow_bbcode, $mchat_urls, $mchat_smilies);
-
- // Not allowed bbcodes
- if (!$mchat_allow_bbcode || $this->config_mchat['bbcode_disallowed'])
- {
- if (!$mchat_allow_bbcode)
- {
- $bbcode_remove = '#\[/?[^\[\]]+\]#Usi';
- $message = preg_replace($bbcode_remove, '', $message);
- }
- // disallowed bbcodes
- else if ($this->config_mchat['bbcode_disallowed'])
- {
- if (empty($bbcode_replace))
- {
- $bbcode_replace = array('#\[(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
- '#\[/(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
- );
- }
- $message = preg_replace($bbcode_replace, '', $message);
- }
- }
-
- $sql_ary = array(
- 'message' => str_replace('\'', '’', $message),
- 'bbcode_bitfield' => $bitfield,
- 'bbcode_uid' => $uid,
- 'bbcode_options' => $options
- );
-
- $sql = 'UPDATE ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary).'
- WHERE message_id = ' . (int) $message_id;
- $this->db->sql_query($sql);
-
- // Message edited...now read it
- $sql = 'SELECT m.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm
- FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m, ' . USERS_TABLE . ' u
- WHERE m.user_id = u.user_id
- AND m.message_id = ' . (int) $message_id . '
- ORDER BY m.message_id DESC';
- $result = $this->db->sql_query($sql);
- $row = $this->db->sql_fetchrow($result);
- $this->db->sql_freeresult($result);
-
- $message_edit = $row['message'];
-
- decode_message($message_edit, $row['bbcode_uid']);
- $message_edit = str_replace('"', '"', $message_edit); // Edit Fix ;)
- $message_edit = mb_ereg_replace("'", "", $message_edit); // Edit Fix ;)
- $mchat_ban = ($this->auth->acl_get('a_authusers') && $this->user->data['user_id'] != $row['user_id']) ? true : false;
- $mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';
- $this->template->assign_block_vars('mchatrow', array(
- 'MCHAT_ALLOW_BAN' => $mchat_ban,
- 'MCHAT_ALLOW_EDIT' => $mchat_edit,
- 'MCHAT_ALLOW_DEL' => $mchat_del,
- 'MCHAT_MESSAGE_EDIT' => $message_edit,
- 'MCHAT_USER_AVATAR' => $mchat_avatar,
- 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '',
- 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '55' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
- 'MCHAT_MESSAGE_ID' => $row['message_id'],
- 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USER_IP' => $row['user_ip'],
- 'MCHAT_U_WHOIS' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'whois', 'ip' => $row['user_ip'])),
- 'MCHAT_U_BAN' => append_sid("{$this->phpbb_root_path}adm/index.{$this->phpEx}" ,'i=permissions&mode=setting_user_global&user_id[0]=' . $row['user_id'], true, $this->user->session_id),
- 'MCHAT_MESSAGE' => censor_text(generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options'])),
- 'MCHAT_TIME' => $this->user->format_date($row['message_time'], $this->config_mchat['date']),
- 'MCHAT_CLASS' => ($row['message_id'] % 2) ? 1 : 2
- ));
- // reset the config settings
- if(isset($old_cfg['min_post_chars']))
- {
- $this->config['min_post_chars'] = $old_cfg['min_post_chars'];
- unset($old_cfg['min_post_chars']);
- }
- if(isset($old_cfg['max_post_smilies']))
- {
- $this->config['max_post_smilies'] = $old_cfg['max_post_smilies'];
- unset($old_cfg['max_post_smilies']);
- }
- //adds a log
- $message_author = get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']);
- add_log('admin', 'LOG_EDITED_MCHAT', $message_author);
- // insert user into the mChat sessions table
- $this->functions_mchat->mchat_sessions($mchat_session_time, true);
- // If read mode request set true
- $mchat_read_mode = true;
-
- break;
-
- // Delete function...
- case 'delete':
-
- $message_id = request_var('message_id', 0);
- // If mChat disabled
- if (!$this->config['mchat_enable'] || !$message_id)
- {
- // Forbidden (for jQ AJAX request)
- throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
- }
- // check for the correct user
- $sql = 'SELECT m.*, u.username, u.user_colour
- FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m
- LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id
- WHERE m.message_id = ' . (int) $message_id;
- $result = $this->db->sql_query($sql);
- $row = $this->db->sql_fetchrow($result);
- $this->db->sql_freeresult($result);
- // edit and delete auths
- $mchat_edit = $this->auth->acl_get('u_mchat_edit')&& ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
- $mchat_del = $this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
-
- // If mChat disabled
- if (!$mchat_del)
- {
- // Forbidden (for jQ AJAX request)
- throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
- }
-
- // Run delete!
- $sql = 'DELETE FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . '
- WHERE message_id = ' . (int) $message_id;
- $this->db->sql_query($sql);
- //adds a log
- $message_author = get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']);
- add_log('admin', 'LOG_DELETED_MCHAT', $message_author);
- // insert user into the mChat sessions table
- $this->functions_mchat->mchat_sessions($mchat_session_time, true);
-
- // Stop running code
- if ($this->request->is_ajax())
- {
- return new \Symfony\Component\HttpFoundation\JsonResponse(array(
- 'success' => true,
- ));
- }
- else
- {
- exit_handler();
- }
- break;
-
- // Default function...
- default:
-
- // TODO: We are assuming there is no include on index at first
- $mchat_include_index = false;
-
- // If not include in index.php set mchat.php page true
- if (!$mchat_include_index)
- {
- // Yes its custom page...
- $mchat_custom_page = true;
-
- // If custom page false mchat.php page redirect to index...
- if (!$this->config_mchat['custom_page'] && $mchat_custom_page)
- {
- $mchat_redirect = append_sid("{$this->phpbb_root_path}index.{$this->phpEx}");
- // Redirect to previous page
- meta_refresh(3, $mchat_redirect);
- $this->helper->error($this->user->lang['MCHAT_NO_CUSTOM_PAGE'].'
'.sprintf($this->user->lang['RETURN_PAGE'], '', ''), E_USER_NOTICE);
- }
-
- // user has permissions to view the custom chat?
- if (!$mchat_view && $mchat_custom_page)
- {
- $this->helper->error($this->user->lang['NOT_AUTHORISED'], E_USER_NOTICE);
- }
-
- // if whois true
- if ($this->config_mchat['whois'])
- {
- // Grab group details for legend display for who is online on the custom page.
- if ($this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
- {
- $sql = 'SELECT group_id, group_name, group_colour, group_type FROM ' . GROUPS_TABLE . '
- WHERE group_legend = 1
- ORDER BY group_name ASC';
- }
- else
- {
- $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type FROM ' . GROUPS_TABLE . ' g
- LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (g.group_id = ug.group_id AND ug.user_id = ' . $this->user->data['user_id'] . ' AND ug.user_pending = 0)
- WHERE g.group_legend = 1
- AND (g.group_type <> ' . GROUP_HIDDEN . '
- OR ug.user_id = ' . (int) $this->user->data['user_id'] . ')
- ORDER BY g.group_name ASC';
- }
- $result = $this->db->sql_query($sql);
- $legend = array();
-
- while ($row = $this->db->sql_fetchrow($result))
- {
- $colour_text = ($row['group_colour']) ? ' style="color:#'.$row['group_colour'].'"' : '';
- $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_'.$row['group_name']] : $row['group_name'];
- if ($row['group_name'] == 'BOTS' || ($this->user->data['user_id'] != ANONYMOUS && !$this->auth->acl_get('u_viewprofile')))
- {
- $legend[] = ''.$group_name.'';
- }
- else
- {
- $legend[] = 'phpbb_root_path}memberlist.{$this->phpEx}", 'mode=group&g='.$row['group_id']).'">'.$group_name.'';
- }
- }
- $this->db->sql_freeresult($result);
- $legend = implode(', ', $legend);
-
- // Assign index specific vars
- $this->template->assign_vars(array(
- 'LEGEND' => $legend,
- ));
- }
- $this->template->assign_block_vars('navlinks', array(
- 'FORUM_NAME' => $this->user->lang['MCHAT_TITLE'],
- 'U_VIEW_FORUM' => $this->helper->route('dmzx_mchat_controller'),
- ));
- }
-
- // Run code...
- if ($mchat_view)
- {
- $message_number = $mchat_custom_page ? $this->config_mchat['message_limit'] : $this->config_mchat['message_num'];
- $sql_where = $this->user->data['user_mchat_topics'] ? '' : 'WHERE m.forum_id = 0';
- // Message row
- $sql = 'SELECT m.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm
- FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m
- LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id
- ' . $sql_where . '
- ORDER BY message_id DESC';
- $result = $this->db->sql_query_limit($sql, $message_number);
- $rows = $this->db->sql_fetchrowset($result);
- $this->db->sql_freeresult($result);
-
- $rows = array_reverse($rows, true);
-
- foreach($rows as $row)
- {
- // auth check
- if ($row['forum_id'] != 0 && !$this->auth->acl_get('f_read', $row['forum_id']))
- {
- continue;
- }
- // edit, delete and permission auths
- $mchat_ban = ($this->auth->acl_get('a_authusers') && $this->user->data['user_id'] != $row['user_id']) ? true : false;
- // edit auths
- if ($this->user->data['user_id'] == ANONYMOUS && $this->user->data['user_id'] == $row['user_id'])
- {
- $chat_auths = $this->user->data['session_ip'] == $row['user_ip'] ? true : false;
- }
- else
- {
- $chat_auths = $this->user->data['user_id'] == $row['user_id'] ? true : false;
- }
- $mchat_edit = ($this->auth->acl_get('u_mchat_edit') && ($this->auth->acl_get('m_') || $chat_auths)) ? true : false;
- $mchat_del = ($this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $chat_auths)) ? true : false;
- $mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';
- $message_edit = $row['message'];
- decode_message($message_edit, $row['bbcode_uid']);
- $message_edit = str_replace('"', '"', $message_edit); // Edit Fix ;)
- $message_edit = mb_ereg_replace("'", "", $message_edit);
- if (sizeof($foes_array))
- {
- if (in_array($row['user_id'], $foes_array))
- {
- $row['message'] = sprintf($this->user->lang['MCHAT_FOE'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']));
- }
- }
- $row['username'] = mb_ereg_replace("'", "", $row['username']);
- $message = str_replace('\'', '’', $row['message']);
- $this->template->assign_block_vars('mchatrow', array(
- 'MCHAT_ALLOW_BAN' => $mchat_ban,
- 'MCHAT_ALLOW_EDIT' => $mchat_edit,
- 'MCHAT_ALLOW_DEL' => $mchat_del,
- 'MCHAT_USER_AVATAR' => $mchat_avatar,
- 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '',
- 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '55' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
- 'MCHAT_MESSAGE_EDIT' => $message_edit,
- 'MCHAT_MESSAGE_ID' => $row['message_id'],
- 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
- 'MCHAT_USER_IP' => $row['user_ip'],
- 'MCHAT_U_WHOIS' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'whois', 'ip' => $row['user_ip'])),
- 'MCHAT_U_BAN' => append_sid("{$this->phpbb_root_path}adm/index.{$this->phpEx}" ,'i=permissions&mode=setting_user_global&user_id[0]=' . $row['user_id'], true, $this->user->session_id),
- 'MCHAT_MESSAGE' => generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']),
- 'MCHAT_TIME' => $this->user->format_date($row['message_time'], $this->config_mchat['date']),
- 'MCHAT_CLASS' => ($row['message_id'] % 2) ? 1 : 2
- ));
-
- }
-
- // Write no message
- if (empty($rows))
- {
- $mchat_no_message = true;
- }
- // display custom bbcodes
- if($mchat_allow_bbcode && $this->config['allow_bbcode'])
- {
- $this->functions_mchat->display_mchat_bbcodes();
- }
- // Smile row
- if ($mchat_smilies)
- {
- if (!function_exists('generate_smilies'))
- {
- include($this->phpbb_root_path . 'includes/functions_posting.' . $this->phpEx);
- }
- generate_smilies('inline', 0);
- }
- // If the static message is defined in the language file use it, else just use the entry in the database
- if (isset($this->user->lang[strtoupper('static_message')]) || !empty($this->config_mchat['static_message']))
- {
- $this->config_mchat['static_message'] = $this->config_mchat['static_message'];
- if(isset($this->user->lang[strtoupper('static_message')]))
- {
- $this->config_mchat['static_message'] = $this->user->lang[strtoupper('static_message')];
- }
- }
- // If the static message is defined in the language file use it, else just use the entry in the database
- if (isset($this->user->lang[strtoupper('mchat_rules')]) || !empty($this->config_mchat['rules']))
- {
- if(isset($this->user->lang[strtoupper('mchat_rules')]))
- {
- $this->config_mchat['rules'] = $this->user->lang[strtoupper('mchat_rules')];
- }
- }
- // a list of users using the chat
- if ($mchat_custom_page)
- {
- $mchat_users = $this->functions_mchat->mchat_users($mchat_session_time, true);
- }
- else
- {
- $mchat_users = $this->functions_mchat->mchat_users($mchat_session_time);
- }
- $this->template->assign_vars(array(
- 'MCHAT_USERS_COUNT' => $mchat_users['mchat_users_count'],
- 'MCHAT_USERS_LIST' => $mchat_users['online_userlist'],
- ));
- }
- break;
- }
- $copyright = base64_decode('PGEgaHJlZj0iaHR0cDovL3JtY2dpcnI4My5vcmciPlJNY0dpcnI4MzwvYT4gJmNvcHk7IDxhIGhyZWY9Imh0dHA6Ly93d3cuZG16eC13ZWIubmV0IiB0aXRsZT0id3d3LmRtengtd2ViLm5ldCI+ZG16eDwvYT4=');
- add_form_key('mchat_posting');
- // Template function...
- $this->template->assign_vars(array(
- 'MCHAT_FILE_NAME' => $this->helper->route('dmzx_mchat_controller'),
- 'MCHAT_REFRESH_JS' => 1000 * $this->config_mchat['refresh'],
- 'MCHAT_ADD_MESSAGE' => $mchat_add_mess,
- 'MCHAT_READ_MODE' => $mchat_read_mode,
- 'MCHAT_ARCHIVE_MODE' => $mchat_archive_mode,
- 'MCHAT_INPUT_TYPE' => $this->user->data['user_mchat_input_area'],
- 'MCHAT_RULES' => $mchat_rules,
- 'MCHAT_ALLOW_SMILES' => $mchat_smilies,
- 'MCHAT_ALLOW_IP' => $mchat_ip,
- 'MCHAT_NOMESSAGE_MODE' => $mchat_no_message,
- 'MCHAT_ALLOW_BBCODES' => ($mchat_allow_bbcode && $this->config['allow_bbcode']) ? true : false,
- 'MCHAT_ENABLE' => $this->config['mchat_enable'],
- 'MCHAT_ARCHIVE_URL' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'archive')),
- 'MCHAT_CUSTOM_PAGE' => $mchat_custom_page,
- 'MCHAT_INDEX_HEIGHT' => $this->config_mchat['index_height'],
- 'MCHAT_CUSTOM_HEIGHT' => $this->config_mchat['custom_height'],
- 'MCHAT_READ_ARCHIVE_BUTTON' => $mchat_read_archive,
- 'MCHAT_FOUNDER' => $mchat_founder,
- 'MCHAT_CLEAN_URL' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'clean', 'redirect' => $on_page)),
- 'MCHAT_STATIC_MESS' => !empty($this->config_mchat['static_message']) ? htmlspecialchars_decode($this->config_mchat['static_message']) : '',
- 'L_MCHAT_COPYRIGHT' => $copyright,
- 'MCHAT_WHOIS' => $this->config_mchat['whois'],
- 'MCHAT_MESSAGE_LNGTH' => $this->config_mchat['max_message_lngth'],
- 'L_MCHAT_MESSAGE_LNGTH_EXPLAIN' => (intval($this->config_mchat['max_message_lngth'])) ? sprintf($this->user->lang['MCHAT_MESSAGE_LNGTH_EXPLAIN'], intval($this->config_mchat['max_message_lngth'])) : '',
- 'MCHAT_MESS_LONG' => sprintf($this->user->lang['MCHAT_MESS_LONG'], $this->config_mchat['max_message_lngth']),
- 'MCHAT_USER_TIMEOUT' => $this->config_mchat['timeout'] ? 1000 * $this->config_mchat['timeout'] : false,
- 'MCHAT_WHOIS_REFRESH' => 1000 * $this->config_mchat['whois_refresh'],
- 'MCHAT_PAUSE_ON_INPUT' => $this->config_mchat['pause_on_input'] ? true : false,
- 'L_MCHAT_ONLINE_EXPLAIN' => $this->functions_mchat->mchat_session_time($mchat_session_time),
- 'MCHAT_REFRESH_YES' => sprintf($this->user->lang['MCHAT_REFRESH_YES'], $this->config_mchat['refresh']),
- 'L_MCHAT_WHOIS_REFRESH_EXPLAIN' => sprintf($this->user->lang['WHO_IS_REFRESH_EXPLAIN'], $this->config_mchat['whois_refresh']),
- 'S_MCHAT_AVATARS' => $mchat_avatars,
- 'S_MCHAT_LOCATION' => $this->config_mchat['location'],
- 'S_MCHAT_SOUND_YES' => $this->user->data['user_mchat_sound'],
- 'S_MCHAT_INDEX_STATS' => $this->user->data['user_mchat_stats_index'],
- 'U_MORE_SMILIES' => append_sid("{$this->phpbb_root_path}posting.{$this->phpEx}", 'mode=smilies'),
- 'U_MCHAT_RULES' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'rules')),
- ));
-
- return $this->helper->render('mchat_body.html', $this->user->lang['MCHAT_TITLE']);
+ return $this->helper->render($ret['filename'], $ret['lang_title']);
}
}
diff --git a/core/render_helper.php b/core/render_helper.php
new file mode 100644
index 0000000..613dc1f
--- /dev/null
+++ b/core/render_helper.php
@@ -0,0 +1,1111 @@
+functions_mchat = $functions_mchat;
+ $this->config = $config;
+ $this->helper = $helper;
+ $this->template = $template;
+ $this->user = $user;
+ $this->auth = $auth;
+ $this->db = $db;
+ $this->cache = $cache;
+ $this->request = $request;
+
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->phpEx = $phpEx;
+ $this->table_prefix = $table_prefix;
+ }
+
+ /**
+ * Method to render the page data
+ *
+ * @var bool Bool if the rendering is only for index
+ * @return array Data for page rendering
+ */
+ public function render_data_for_page($only_for_index = false)
+ {
+ $include_on_index = ($only_for_index === true);
+
+ // Add lang file
+ //$this->user->add_lang(array('mods/mchat_lang', 'viewtopic', 'posting'));
+
+ //chat enabled
+ if (!$this->config['mchat_enable'])
+ {
+ // Return for: $this->helper->error(error_text, error_type);
+ return array(
+ 'error' => true,
+ 'error_type' => E_USER_NOTICE,
+ 'error_text' => $this->user->lang['MCHAT_ENABLE'],
+ );
+ }
+
+ // avatars
+ if (!function_exists('get_user_avatar'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_display.' . $this->phpEx);
+ }
+
+ if (($this->config_mchat = $this->cache->get('_mchat_config')) === false)
+ {
+ $this->functions_mchat->mchat_cache();
+ }
+ $this->config_mchat = $this->cache->get('_mchat_config');
+ // Access rights
+ $mchat_allow_bbcode = ($this->config['allow_bbcode'] && $this->auth->acl_get('u_mchat_bbcode')) ? true : false;
+ $mchat_smilies = ($this->config['allow_smilies'] && $this->auth->acl_get('u_mchat_smilies')) ? true : false;
+ $mchat_urls = ($this->config['allow_post_links'] && $this->auth->acl_get('u_mchat_urls')) ? true : false;
+ $mchat_ip = ($this->auth->acl_get('u_mchat_ip')) ? true : false;
+ $mchat_add_mess = ($this->auth->acl_get('u_mchat_use')) ? true : false;
+ $mchat_view = ($this->auth->acl_get('u_mchat_view')) ? true : false;
+ $mchat_no_flood = ($this->auth->acl_get('u_mchat_flood_ignore')) ? true : false;
+ $mchat_read_archive = ($this->auth->acl_get('u_mchat_archive')) ? true : false;
+ $mchat_founder = ($this->user->data['user_type'] == USER_FOUNDER) ? true : false;
+ $mchat_session_time = !empty($this->config_mchat['timeout']) ? $this->config_mchat['timeout'] : (!empty($this->config['load_online_time']) ? $this->config['load_online_time'] * 60 : $this->config['session_length']);
+ $mchat_rules = (!empty($this->config_mchat['rules']) || isset($this->user->lang[strtoupper('mchat_rules')])) ? true : false;
+ $mchat_avatars = (!empty($this->config_mchat['avatars']) && $this->user->optionget('viewavatars') && $this->user->data['user_mchat_avatars']) ? true : false;
+
+ // needed variables
+ // Request options.
+ $mchat_mode = request_var('mode', '');
+ $mchat_read_mode = $mchat_archive_mode = $mchat_custom_page = $mchat_no_message = false;
+ // set redirect if on index or custom page
+ $on_page = $include_on_index ? 'index' : 'mchat';
+
+ // grab fools..uhmmm, foes the user has
+ $foes_array = array();
+ $sql = 'SELECT * FROM ' . ZEBRA_TABLE . '
+ WHERE user_id = ' . $this->user->data['user_id'] . ' AND foe = 1';
+ $result = $this->db->sql_query($sql);
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $foes_array[] = $row['zebra_id'];
+ }
+ $this->db->sql_freeresult($result);
+
+ // Request mode...
+ switch ($mchat_mode)
+ {
+ // rules popup..
+ case 'rules':
+ // If the rules are defined in the language file use them, else just use the entry in the database
+ if ($mchat_rules || isset($this->user->lang[strtoupper('mchat_rules')]))
+ {
+ if(isset($this->user->lang[strtoupper('mchat_rules')]))
+ {
+ $this->template->assign_var('MCHAT_RULES', $this->user->lang[strtoupper('mchat_rules')]);
+ }
+ else
+ {
+ $mchat_rules = $this->config_mchat['rules'];
+ $mchat_rules = explode("\n", $mchat_rules);
+
+ foreach ($mchat_rules as $mchat_rule)
+ {
+ $mchat_rule = htmlspecialchars($mchat_rule);
+ $this->template->assign_block_vars('rule', array(
+ 'MCHAT_RULE' => $mchat_rule,
+ ));
+ }
+ }
+
+ // Output the page
+ // Return for: \$this->helper->render(filename, lang_title);
+ return array(
+ 'filename' => 'mchat_rules.html',
+ 'lang_title' => $this->user->lang['MCHAT_HELP'],
+ );
+ }
+ else
+ {
+ // Show no rules
+ // Return for: \$this->helper->error(error_text, error_type);
+ return array(
+ 'error' => true,
+ 'error_type' => E_USER_NOTICE,
+ 'error_text' => 'NO_MCHAT_RULES',
+ );
+ }
+
+ break;
+ // whois function..
+ case 'whois':
+
+ // Must have auths
+ if ($mchat_mode == 'whois' && $mchat_ip)
+ {
+ // function already exists..
+ if (!function_exists('user_ipwhois'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_user.' . $this->phpEx);
+ }
+
+ $this->user_ip = request_var('ip', '');
+
+ $this->template->assign_var('WHOIS', user_ipwhois($this->user_ip));
+
+ // Output the page
+ // Return for: \$this->helper->render(filename, lang_title);
+ return array(
+ 'filename' => 'viewonline_whois.html',
+ 'lang_title' => $this->user->lang['WHO_IS_ONLINE'],
+ );
+ }
+ else
+ {
+ // Show not authorized
+ // Return for: \$this->helper->error(error_text, error_type);
+ return array(
+ 'error' => true,
+ 'error_type' => E_USER_NOTICE,
+ 'error_text' => 'NO_AUTH_OPERATION',
+ );
+ }
+ break;
+ // Clean function...
+ case 'clean':
+
+ // User logged in?
+ if(!$this->user->data['is_registered'] || !$mchat_founder)
+ {
+ if(!$this->user->data['is_registered'])
+ {
+ // Login box...
+ login_box('', $this->user->lang['LOGIN']);
+ }
+ else if (!$mchat_founder)
+ {
+ // Show not authorized
+ // Return for: \$this->helper->error(error_text, error_type);
+ return array(
+ 'error' => true,
+ 'error_type' => E_USER_NOTICE,
+ 'error_text' => 'NO_AUTH_OPERATION',
+ );
+ }
+ }
+
+ $mchat_redirect = request_var('redirect', '');
+ $mchat_redirect = ($mchat_redirect == 'index') ? append_sid("{$this->phpbb_root_path}index.{$this->phpEx}") : $this->helper->route('dmzx_mchat_controller', array('#mChat'));
+
+ if(confirm_box(true))
+ {
+ // Run cleaner
+ $sql = 'TRUNCATE TABLE ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE;
+ $this->db->sql_query($sql);
+
+ meta_refresh(3, $mchat_redirect);
+ // Return for: \$this->helper->error(error_text, error_type);
+ return array(
+ 'error' => true,
+ 'error_type' => E_USER_NOTICE,
+ 'error_text' => $this->user->lang['MCHAT_CLEANED'].'
'.sprintf($this->user->lang['RETURN_PAGE'], '', ''),
+ );
+ }
+ else
+ {
+ // Display confirm box
+ confirm_box(false, $this->user->lang['MCHAT_DELALLMESS']);
+ }
+ add_log('admin', 'LOG_MCHAT_TABLE_PRUNED');
+ redirect($mchat_redirect);
+ break;
+
+ // Archive function...
+ case 'archive':
+
+ if (!$mchat_read_archive || !$mchat_view)
+ {
+ // redirect to correct page
+ $mchat_redirect = append_sid("{$this->phpbb_root_path}index.{$this->phpEx}");
+ // Redirect to previous page
+ meta_refresh(3, $mchat_redirect);
+ // Return for: \$this->helper->error(error_text, error_type);
+ return array(
+ 'error' => true,
+ 'error_type' => E_USER_NOTICE,
+ 'error_text' => $this->user->lang['MCHAT_NOACCESS_ARCHIVE'].'
'.sprintf($this->user->lang['RETURN_PAGE'], '', ''),
+ );
+ }
+
+ if ($this->config['mchat_enable'] && $mchat_read_archive && $mchat_view)
+ {
+ // how many chats do we have?
+ $sql = 'SELECT COUNT(message_id) AS messages FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE;
+ $result = $this->db->sql_query($sql);
+ $mchat_total_messages = $this->db->sql_fetchfield('messages');
+ $this->db->sql_freeresult($result);
+ // prune the chats if necessary and amount in ACP not empty
+ if ($this->config_mchat['prune_enable'] && ($mchat_total_messages > $this->config_mchat['prune_num'] && $this->config_mchat['prune_num'] > 0))
+ {
+ $this->functions_mchat->mchat_prune((int) $this->config_mchat['prune_num']);
+ }
+
+ // Reguest...
+ $mchat_archive_start = request_var('start', 0);
+ $sql_where = $this->user->data['user_mchat_topics'] ? '' : 'WHERE m.forum_id = 0';
+ // Message row
+ $sql = 'SELECT m.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm
+ FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m
+ LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id
+ ' . $sql_where . '
+ ORDER BY m.message_id DESC';
+ $result = $this->db->sql_query_limit($sql, (int) $this->config_mchat['archive_limit'], $mchat_archive_start);
+ $rows = $this->db->sql_fetchrowset($result);
+ $this->db->sql_freeresult($result);
+
+ foreach($rows as $row)
+ {
+ // auth check
+ if ($row['forum_id'] != 0 && !$this->auth->acl_get('f_read', $row['forum_id']))
+ {
+ continue;
+ }
+ // edit, delete and permission auths
+ $mchat_ban = ($this->auth->acl_get('a_authusers') && $this->user->data['user_id'] != $row['user_id']) ? true : false;
+ $mchat_edit = ($this->auth->acl_get('u_mchat_edit') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id'])) ? true : false;
+ $mchat_del = ($this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id'])) ? true : false;
+ $mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';
+ $message_edit = $row['message'];
+ decode_message($message_edit, $row['bbcode_uid']);
+ $message_edit = str_replace('"', '"', $message_edit); // Edit Fix ;)
+ if (sizeof($foes_array))
+ {
+ if (in_array($row['user_id'], $foes_array))
+ {
+ $row['message'] = sprintf($this->user->lang['MCHAT_FOE'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']));
+ }
+ }
+ $row['username'] = mb_ereg_replace("'", "", $row['username']);
+ $this->template->assign_block_vars('mchatrow', array(
+ 'MCHAT_ALLOW_BAN' => $mchat_ban,
+ 'MCHAT_ALLOW_EDIT' => $mchat_edit,
+ 'MCHAT_ALLOW_DEL' => $mchat_del,
+ 'MCHAT_USER_AVATAR' => $mchat_avatar,
+ 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '',
+ 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '55' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
+ 'MCHAT_MESSAGE_EDIT' => $message_edit,
+ 'MCHAT_MESSAGE_ID' => $row['message_id'],
+ 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USER_IP' => $row['user_ip'],
+ 'MCHAT_U_WHOIS' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'whois', 'ip' => $row['user_ip'])),
+ 'MCHAT_U_BAN' => append_sid("{$this->phpbb_root_path}adm/index.{$this->phpEx}" ,'i=permissions&mode=setting_user_global&user_id[0]=' . $row['user_id'], true, $this->user->session_id),
+ 'MCHAT_MESSAGE' => generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']),
+ 'MCHAT_TIME' => $this->user->format_date($row['message_time'], $this->config_mchat['date']),
+ 'MCHAT_CLASS' => ($row['message_id'] % 2) ? 1 : 2
+ ));
+ }
+
+ // Write no message
+ if (empty($rows))
+ {
+ $mchat_no_message = true;
+ }
+ }
+
+ // Run query again to get the total message rows...
+ $sql = 'SELECT COUNT(message_id) AS mess_id FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE;
+ $result = $this->db->sql_query($sql);
+ $mchat_total_message = $this->db->sql_fetchfield('mess_id');
+ $this->db->sql_freeresult($result);
+ // Page list function...
+ $this->template->assign_vars(array(
+ // 'MCHAT_PAGE_NUMBER' => $pagination->get_on_page($mchat_total_message, (int) $this->config_mchat['archive_limit'], $mchat_archive_start),
+ 'MCHAT_TOTAL_MESSAGES' => sprintf($this->user->lang['MCHAT_TOTALMESSAGES'], $mchat_total_message),
+ //\\ 'MCHAT_PAGINATION' => generate_pagination(append_sid("{$this->phpbb_root_path}mchat.{$this->phpEx}", 'mode=archive'), $mchat_total_message, (int) $this->config_mchat['archive_limit'], $mchat_archive_start, true)
+ ));
+
+ //add to navlinks
+ $this->template->assign_block_vars('navlinks', array(
+ 'FORUM_NAME' => $this->user->lang['MCHAT_ARCHIVE_PAGE'],
+ 'U_VIEW_FORUM' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'archive')),
+ ));
+ // If archive mode request set true
+ $mchat_archive_mode = true;
+ $old_mode = 'archive';
+
+ break;
+
+ // Read function...
+ case 'read':
+
+ // If mChat disabled or user can't view the chat
+ if (!$this->config['mchat_enable'] || !$mchat_view)
+ {
+ // Forbidden (for jQ AJAX request)
+ throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
+ }
+ // if we're reading on the custom page, then we are chatting
+ if ($mchat_custom_page)
+ {
+ // insert user into the mChat sessions table
+ $this->functions_mchat->mchat_sessions($mchat_session_time, true);
+ }
+ // Request
+ $mchat_message_last_id = request_var('message_last_id', 0);
+ $sql_and = $this->user->data['user_mchat_topics'] ? '' : 'AND m.forum_id = 0';
+ $sql = 'SELECT m.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm
+ FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m, ' . USERS_TABLE . ' u
+ WHERE m.user_id = u.user_id
+ AND m.message_id > ' . (int) $mchat_message_last_id . '
+ ' . $sql_and . '
+ ORDER BY m.message_id DESC';
+ $result = $this->db->sql_query_limit($sql, (int) $this->config_mchat['message_limit']);
+ $rows = $this->db->sql_fetchrowset($result);
+ $this->db->sql_freeresult($result);
+ // Reverse the array wanting messages appear in reverse
+ $rows = array_reverse($rows);
+
+ foreach($rows as $row)
+ {
+ // auth check
+ if ($row['forum_id'] != 0 && !$this->auth->acl_get('f_read', $row['forum_id']))
+ {
+ continue;
+ }
+ // edit auths
+ if ($this->user->data['user_id'] == ANONYMOUS && $this->user->data['user_id'] == $row['user_id'])
+ {
+ $chat_auths = $this->user->data['session_ip'] == $row['user_ip'] ? true : false;
+ }
+ else
+ {
+ $chat_auths = $this->user->data['user_id'] == $row['user_id'] ? true : false;
+ }
+ // edit, delete and permission auths
+ $mchat_ban = ($this->auth->acl_get('a_authusers') && $this->user->data['user_id'] != $row['user_id']) ? true : false;
+ $mchat_edit = ($this->auth->acl_get('u_mchat_edit') && ($this->auth->acl_get('m_') || $chat_auths)) ? true : false;
+ $mchat_del = ($this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $chat_auths)) ? true : false;
+ $mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';
+ $message_edit = $row['message'];
+ decode_message($message_edit, $row['bbcode_uid']);
+ $message_edit = str_replace('"', '"', $message_edit);
+ $message_edit = mb_ereg_replace("'", "", $message_edit); // Edit Fix ;)
+ if (sizeof($foes_array))
+ {
+ if (in_array($row['user_id'], $foes_array))
+ {
+ $row['message'] = sprintf($this->user->lang['MCHAT_FOE'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']));
+ }
+ }
+ $row['username'] = mb_ereg_replace("'", "", $row['username']);
+ $this->template->assign_block_vars('mchatrow', array(
+ 'MCHAT_ALLOW_BAN' => $mchat_ban,
+ 'MCHAT_ALLOW_EDIT' => $mchat_edit,
+ 'MCHAT_ALLOW_DEL' => $mchat_del,
+ 'MCHAT_USER_AVATAR' => $mchat_avatar,
+ 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '',
+ 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '55' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
+ 'MCHAT_MESSAGE_EDIT' => $message_edit,
+ 'MCHAT_MESSAGE_ID' => $row['message_id'],
+ 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USER_IP' => $row['user_ip'],
+ 'MCHAT_U_WHOIS' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'whois', 'ip' => $row['user_ip'])),
+ 'MCHAT_U_BAN' => append_sid("{$this->phpbb_root_path}adm/index.{$this->phpEx}" ,'i=permissions&mode=setting_user_global&user_id[0]=' . $row['user_id'], true, $this->user->session_id),
+ 'MCHAT_MESSAGE' => generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']),
+ 'MCHAT_TIME' => $this->user->format_date($row['message_time'], $this->config_mchat['date']),
+ 'MCHAT_CLASS' => ($row['message_id'] % 2) ? 1 : 2
+ ));
+ }
+
+ // Write no message
+ if (empty($rows))
+ {
+ $mchat_no_message = true;
+ }
+
+ // If read mode request set true
+ $mchat_read_mode = true;
+
+ break;
+
+ // Stats function...
+ case 'stats':
+
+ // If mChat disabled or user can't view the chat
+ if (!$this->config['mchat_enable'] || !$mchat_view || !$this->config_mchat['whois'])
+ {
+ // Forbidden (for jQ AJAX request)
+ throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
+ }
+
+ $mchat_stats = $this->functions_mchat->mchat_users($mchat_session_time);
+
+ if(!empty($mchat_stats['online_userlist']))
+ {
+ $message = '';
+ }
+ else
+ {
+ $message = '' . $this->user->lang['MCHAT_NO_CHATTERS'] . ' (' . $mchat_stats['refresh_message'] . ')
';
+ }
+
+ if ($this->request->is_ajax())
+ {
+ // Return for: \Symfony\Component\HttpFoundation\JsonResponse
+ return array(
+ 'json' => true,
+ 'message' => $message,
+ );
+ }
+ else
+ {
+ throw new \phpbb\exception\http_exception(501, 'MCHAT_ERROR_NOT_IMPLEMENTED');
+ }
+
+ break;
+
+ // Add function...
+ case 'add':
+
+ // If mChat disabled
+ if (!$this->config['mchat_enable'] || !$mchat_add_mess || !check_form_key('mchat_posting', -1))
+ {
+ // Forbidden (for jQ AJAX request)
+ if ($this->request->is_ajax()) // FOR DEBUG
+ throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
+ }
+
+ // Reguest...
+ $message = utf8_normalize_nfc(request_var('message', '', true));
+
+ // must have something other than bbcode in the message
+ if (empty($mchatregex))
+ {
+ //let's strip all the bbcode
+ $mchatregex = '#\[/?[^\[\]]+\]#mi';
+ }
+ $message_chars = preg_replace($mchatregex, '', $message);
+ $message_chars = (utf8_strlen(trim($message_chars)) > 0) ? true : false;
+
+ if (!$message || !$message_chars)
+ {
+ // Not Implemented (for jQ AJAX request)
+ throw new \phpbb\exception\http_exception(501, 'MCHAT_ERROR_NOT_IMPLEMENTED');
+ }
+
+ // Flood control
+ if (!$mchat_no_flood && $this->config_mchat['flood_time'])
+ {
+ $mchat_flood_current_time = time();
+ $sql = 'SELECT message_time FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . '
+ WHERE user_id = ' . (int) $this->user->data['user_id'] . '
+ ORDER BY message_time DESC';
+ $result = $this->db->sql_query_limit($sql, 1);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+ if($row['message_time'] > 0 && ($mchat_flood_current_time - $row['message_time']) < (int) $this->config_mchat['flood_time'])
+ {
+ // Locked (for jQ AJAX request)
+ throw new \phpbb\exception\http_exception(400, 'MCHAT_BAD_REQUEST');
+ }
+ }
+ // insert user into the mChat sessions table
+ $this->functions_mchat->mchat_sessions($mchat_session_time, true);
+ // we override the $this->config['min_post_chars'] entry?
+ if ($this->config_mchat['override_min_post_chars'])
+ {
+ $old_cfg['min_post_chars'] = $this->config['min_post_chars'];
+ $this->config['min_post_chars'] = 0;
+ }
+ //we do the same for the max number of smilies?
+ if ($this->config_mchat['override_smilie_limit'])
+ {
+ $old_cfg['max_post_smilies'] = $this->config['max_post_smilies'];
+ $this->config['max_post_smilies'] = 0;
+ }
+
+ // Add function part code from http://wiki.phpbb.com/Parsing_text
+ $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
+ generate_text_for_storage($message, $uid, $bitfield, $options, $mchat_allow_bbcode, $mchat_urls, $mchat_smilies);
+ // Not allowed bbcodes
+ if (!$mchat_allow_bbcode || $this->config_mchat['bbcode_disallowed'])
+ {
+ if (!$mchat_allow_bbcode)
+ {
+ $bbcode_remove = '#\[/?[^\[\]]+\]#Usi';
+ $message = preg_replace($bbcode_remove, '', $message);
+ }
+ // disallowed bbcodes
+ else if ($this->config_mchat['bbcode_disallowed'])
+ {
+ if (empty($bbcode_replace))
+ {
+ $bbcode_replace = array('#\[(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
+ '#\[/(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
+ );
+ }
+ $message = preg_replace($bbcode_replace, '', $message);
+ }
+ }
+
+ $sql_ary = array(
+ 'forum_id' => 0,
+ 'post_id' => 0,
+ 'user_id' => $this->user->data['user_id'],
+ 'user_ip' => $this->user->data['session_ip'],
+ 'message' => str_replace('\'', '’', $message),
+ 'bbcode_bitfield' => $bitfield,
+ 'bbcode_uid' => $uid,
+ 'bbcode_options' => $options,
+ 'message_time' => time()
+ );
+ $sql = 'INSERT INTO ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
+ $this->db->sql_query($sql);
+
+ // reset the config settings
+ if(isset($old_cfg['min_post_chars']))
+ {
+ $this->config['min_post_chars'] = $old_cfg['min_post_chars'];
+ unset($old_cfg['min_post_chars']);
+ }
+ if(isset($old_cfg['max_post_smilies']))
+ {
+ $this->config['max_post_smilies'] = $old_cfg['max_post_smilies'];
+ unset($old_cfg['max_post_smilies']);
+ }
+
+ // Stop run code!
+ if ($this->request->is_ajax())
+ {
+ // Return for: \Symfony\Component\HttpFoundation\JsonResponse
+ return array(
+ 'json' => true,
+ 'success' => true,
+ );
+ }
+ else
+ {
+ exit_handler();
+ }
+ break;
+
+ // Edit function...
+ case 'edit':
+
+ $message_id = request_var('message_id', 0);
+
+ // If mChat disabled and not edit
+ if (!$this->config['mchat_enable'] || !$message_id)
+ {
+ // Forbidden (for jQ AJAX request)
+ throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
+ }
+
+ // check for the correct user
+ $sql = 'SELECT *
+ FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . '
+ WHERE message_id = ' . (int) $message_id;
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+ // edit and delete auths
+ $mchat_edit = $this->auth->acl_get('u_mchat_edit')&& ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
+ $mchat_del = $this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
+ // If mChat disabled and not edit
+ if (!$mchat_edit)
+ {
+ // Forbidden (for jQ AJAX request)
+ throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
+ }
+ // Reguest...
+ $message = request_var('message', '', true);
+
+ // must have something other than bbcode in the message
+ if (empty($mchatregex))
+ {
+ //let's strip all the bbcode
+ $mchatregex = '#\[/?[^\[\]]+\]#mi';
+ }
+ $message_chars = preg_replace($mchatregex, '', $message);
+ $message_chars = (utf8_strlen(trim($message_chars)) > 0) ? true : false;
+ if (!$message || !$message_chars)
+ {
+ // Not Implemented (for jQ AJAX request)
+ throw new \phpbb\exception\http_exception(501, 'MCHAT_ERROR_NOT_IMPLEMENTED');
+ }
+
+ // Message limit
+ $message = ($this->config_mchat['max_message_lngth'] != 0 && utf8_strlen($message) >= $this->config_mchat['max_message_lngth'] + 3) ? utf8_substr($message, 0, $this->config_mchat['max_message_lngth']).'...' : $message;
+
+ // we override the $this->config['min_post_chars'] entry?
+ if ($this->config_mchat['override_min_post_chars'])
+ {
+ $old_cfg['min_post_chars'] = $this->config['min_post_chars'];
+ $this->config['min_post_chars'] = 0;
+ }
+ //we do the same for the max number of smilies?
+ if ($this->config_mchat['override_smilie_limit'])
+ {
+ $old_cfg['max_post_smilies'] = $this->config['max_post_smilies'];
+ $this->config['max_post_smilies'] = 0;
+ }
+
+ // Edit function part code from http://wiki.phpbb.com/Parsing_text
+ $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
+ generate_text_for_storage($message, $uid, $bitfield, $options, $mchat_allow_bbcode, $mchat_urls, $mchat_smilies);
+
+ // Not allowed bbcodes
+ if (!$mchat_allow_bbcode || $this->config_mchat['bbcode_disallowed'])
+ {
+ if (!$mchat_allow_bbcode)
+ {
+ $bbcode_remove = '#\[/?[^\[\]]+\]#Usi';
+ $message = preg_replace($bbcode_remove, '', $message);
+ }
+ // disallowed bbcodes
+ else if ($this->config_mchat['bbcode_disallowed'])
+ {
+ if (empty($bbcode_replace))
+ {
+ $bbcode_replace = array('#\[(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
+ '#\[/(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
+ );
+ }
+ $message = preg_replace($bbcode_replace, '', $message);
+ }
+ }
+
+ $sql_ary = array(
+ 'message' => str_replace('\'', '’', $message),
+ 'bbcode_bitfield' => $bitfield,
+ 'bbcode_uid' => $uid,
+ 'bbcode_options' => $options
+ );
+
+ $sql = 'UPDATE ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary).'
+ WHERE message_id = ' . (int) $message_id;
+ $this->db->sql_query($sql);
+
+ // Message edited...now read it
+ $sql = 'SELECT m.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm
+ FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m, ' . USERS_TABLE . ' u
+ WHERE m.user_id = u.user_id
+ AND m.message_id = ' . (int) $message_id . '
+ ORDER BY m.message_id DESC';
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ $message_edit = $row['message'];
+
+ decode_message($message_edit, $row['bbcode_uid']);
+ $message_edit = str_replace('"', '"', $message_edit); // Edit Fix ;)
+ $message_edit = mb_ereg_replace("'", "", $message_edit); // Edit Fix ;)
+ $mchat_ban = ($this->auth->acl_get('a_authusers') && $this->user->data['user_id'] != $row['user_id']) ? true : false;
+ $mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';
+ $this->template->assign_block_vars('mchatrow', array(
+ 'MCHAT_ALLOW_BAN' => $mchat_ban,
+ 'MCHAT_ALLOW_EDIT' => $mchat_edit,
+ 'MCHAT_ALLOW_DEL' => $mchat_del,
+ 'MCHAT_MESSAGE_EDIT' => $message_edit,
+ 'MCHAT_USER_AVATAR' => $mchat_avatar,
+ 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '',
+ 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '55' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
+ 'MCHAT_MESSAGE_ID' => $row['message_id'],
+ 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USER_IP' => $row['user_ip'],
+ 'MCHAT_U_WHOIS' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'whois', 'ip' => $row['user_ip'])),
+ 'MCHAT_U_BAN' => append_sid("{$this->phpbb_root_path}adm/index.{$this->phpEx}" ,'i=permissions&mode=setting_user_global&user_id[0]=' . $row['user_id'], true, $this->user->session_id),
+ 'MCHAT_MESSAGE' => censor_text(generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options'])),
+ 'MCHAT_TIME' => $this->user->format_date($row['message_time'], $this->config_mchat['date']),
+ 'MCHAT_CLASS' => ($row['message_id'] % 2) ? 1 : 2
+ ));
+ // reset the config settings
+ if(isset($old_cfg['min_post_chars']))
+ {
+ $this->config['min_post_chars'] = $old_cfg['min_post_chars'];
+ unset($old_cfg['min_post_chars']);
+ }
+ if(isset($old_cfg['max_post_smilies']))
+ {
+ $this->config['max_post_smilies'] = $old_cfg['max_post_smilies'];
+ unset($old_cfg['max_post_smilies']);
+ }
+ //adds a log
+ $message_author = get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']);
+ add_log('admin', 'LOG_EDITED_MCHAT', $message_author);
+ // insert user into the mChat sessions table
+ $this->functions_mchat->mchat_sessions($mchat_session_time, true);
+ // If read mode request set true
+ $mchat_read_mode = true;
+
+ break;
+
+ // Delete function...
+ case 'delete':
+
+ $message_id = request_var('message_id', 0);
+ // If mChat disabled
+ if (!$this->config['mchat_enable'] || !$message_id)
+ {
+ // Forbidden (for jQ AJAX request)
+ throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
+ }
+ // check for the correct user
+ $sql = 'SELECT m.*, u.username, u.user_colour
+ FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m
+ LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id
+ WHERE m.message_id = ' . (int) $message_id;
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+ // edit and delete auths
+ $mchat_edit = $this->auth->acl_get('u_mchat_edit')&& ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
+ $mchat_del = $this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $this->user->data['user_id'] == $row['user_id']) ? true : false;
+
+ // If mChat disabled
+ if (!$mchat_del)
+ {
+ // Forbidden (for jQ AJAX request)
+ throw new \phpbb\exception\http_exception(403, 'MCHAT_ERROR_FORBIDDEN');
+ }
+
+ // Run delete!
+ $sql = 'DELETE FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . '
+ WHERE message_id = ' . (int) $message_id;
+ $this->db->sql_query($sql);
+ //adds a log
+ $message_author = get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']);
+ add_log('admin', 'LOG_DELETED_MCHAT', $message_author);
+ // insert user into the mChat sessions table
+ $this->functions_mchat->mchat_sessions($mchat_session_time, true);
+
+ // Stop running code
+ if ($this->request->is_ajax())
+ {
+ // Return for: \Symfony\Component\HttpFoundation\JsonResponse
+ return array(
+ 'json' => true,
+ 'success' => true,
+ );
+ }
+ else
+ {
+ exit_handler();
+ }
+ break;
+
+ // Default function...
+ default:
+
+ // If not include in index.php set mchat.php page true
+ if (!$include_on_index)
+ {
+ // Yes its custom page...
+ $mchat_custom_page = true;
+
+ // If custom page false mchat.php page redirect to index...
+ if (!$this->config_mchat['custom_page'] && $mchat_custom_page)
+ {
+ $mchat_redirect = append_sid("{$this->phpbb_root_path}index.{$this->phpEx}");
+ // Redirect to previous page
+ meta_refresh(3, $mchat_redirect);
+ // Return for: \$this->helper->error(error_text, error_type);
+ return array(
+ 'error' => true,
+ 'error_type' => E_USER_NOTICE,
+ 'error_text' => $this->user->lang['MCHAT_NO_CUSTOM_PAGE'].'
'.sprintf($this->user->lang['RETURN_PAGE'], '', ''),
+ );
+ }
+
+ // user has permissions to view the custom chat?
+ if (!$mchat_view && $mchat_custom_page)
+ {
+ // Return for: \$this->helper->error(error_text, error_type);
+ return array(
+ 'error' => true,
+ 'error_type' => E_USER_NOTICE,
+ 'error_text' => $this->user->lang['NOT_AUTHORISED'],
+ );
+ }
+
+ // if whois true
+ if ($this->config_mchat['whois'])
+ {
+ // Grab group details for legend display for who is online on the custom page.
+ if ($this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
+ {
+ $sql = 'SELECT group_id, group_name, group_colour, group_type FROM ' . GROUPS_TABLE . '
+ WHERE group_legend = 1
+ ORDER BY group_name ASC';
+ }
+ else
+ {
+ $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type FROM ' . GROUPS_TABLE . ' g
+ LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (g.group_id = ug.group_id AND ug.user_id = ' . $this->user->data['user_id'] . ' AND ug.user_pending = 0)
+ WHERE g.group_legend = 1
+ AND (g.group_type <> ' . GROUP_HIDDEN . '
+ OR ug.user_id = ' . (int) $this->user->data['user_id'] . ')
+ ORDER BY g.group_name ASC';
+ }
+ $result = $this->db->sql_query($sql);
+ $legend = array();
+
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $colour_text = ($row['group_colour']) ? ' style="color:#'.$row['group_colour'].'"' : '';
+ $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_'.$row['group_name']] : $row['group_name'];
+ if ($row['group_name'] == 'BOTS' || ($this->user->data['user_id'] != ANONYMOUS && !$this->auth->acl_get('u_viewprofile')))
+ {
+ $legend[] = ''.$group_name.'';
+ }
+ else
+ {
+ $legend[] = 'phpbb_root_path}memberlist.{$this->phpEx}", 'mode=group&g='.$row['group_id']).'">'.$group_name.'';
+ }
+ }
+ $this->db->sql_freeresult($result);
+ $legend = implode(', ', $legend);
+
+ // Assign index specific vars
+ $this->template->assign_vars(array(
+ 'LEGEND' => $legend,
+ ));
+ }
+ $this->template->assign_block_vars('navlinks', array(
+ 'FORUM_NAME' => $this->user->lang['MCHAT_TITLE'],
+ 'U_VIEW_FORUM' => $this->helper->route('dmzx_mchat_controller'),
+ ));
+ }
+
+ // Run code...
+ if ($mchat_view)
+ {
+ $message_number = $mchat_custom_page ? $this->config_mchat['message_limit'] : $this->config_mchat['message_num'];
+ $sql_where = $this->user->data['user_mchat_topics'] ? '' : 'WHERE m.forum_id = 0';
+ // Message row
+ $sql = 'SELECT m.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm
+ FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' m
+ LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id
+ ' . $sql_where . '
+ ORDER BY message_id DESC';
+ $result = $this->db->sql_query_limit($sql, $message_number);
+ $rows = $this->db->sql_fetchrowset($result);
+ $this->db->sql_freeresult($result);
+
+ $rows = array_reverse($rows, true);
+
+ foreach($rows as $row)
+ {
+ // auth check
+ if ($row['forum_id'] != 0 && !$this->auth->acl_get('f_read', $row['forum_id']))
+ {
+ continue;
+ }
+ // edit, delete and permission auths
+ $mchat_ban = ($this->auth->acl_get('a_authusers') && $this->user->data['user_id'] != $row['user_id']) ? true : false;
+ // edit auths
+ if ($this->user->data['user_id'] == ANONYMOUS && $this->user->data['user_id'] == $row['user_id'])
+ {
+ $chat_auths = $this->user->data['session_ip'] == $row['user_ip'] ? true : false;
+ }
+ else
+ {
+ $chat_auths = $this->user->data['user_id'] == $row['user_id'] ? true : false;
+ }
+ $mchat_edit = ($this->auth->acl_get('u_mchat_edit') && ($this->auth->acl_get('m_') || $chat_auths)) ? true : false;
+ $mchat_del = ($this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $chat_auths)) ? true : false;
+ $mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 40 : (40 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 40 : (40 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';
+ $message_edit = $row['message'];
+ decode_message($message_edit, $row['bbcode_uid']);
+ $message_edit = str_replace('"', '"', $message_edit); // Edit Fix ;)
+ $message_edit = mb_ereg_replace("'", "", $message_edit);
+ if (sizeof($foes_array))
+ {
+ if (in_array($row['user_id'], $foes_array))
+ {
+ $row['message'] = sprintf($this->user->lang['MCHAT_FOE'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']));
+ }
+ }
+ $row['username'] = mb_ereg_replace("'", "", $row['username']);
+ $message = str_replace('\'', '’', $row['message']);
+ $this->template->assign_block_vars('mchatrow', array(
+ 'MCHAT_ALLOW_BAN' => $mchat_ban,
+ 'MCHAT_ALLOW_EDIT' => $mchat_edit,
+ 'MCHAT_ALLOW_DEL' => $mchat_del,
+ 'MCHAT_USER_AVATAR' => $mchat_avatar,
+ 'U_VIEWPROFILE' => ($row['user_id'] != ANONYMOUS) ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '',
+ 'U_USER_ID' => ($row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '55' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_'))) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '',
+ 'MCHAT_MESSAGE_EDIT' => $message_edit,
+ 'MCHAT_MESSAGE_ID' => $row['message_id'],
+ 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']),
+ 'MCHAT_USER_IP' => $row['user_ip'],
+ 'MCHAT_U_WHOIS' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'whois', 'ip' => $row['user_ip'])),
+ 'MCHAT_U_BAN' => append_sid("{$this->phpbb_root_path}adm/index.{$this->phpEx}" ,'i=permissions&mode=setting_user_global&user_id[0]=' . $row['user_id'], true, $this->user->session_id),
+ 'MCHAT_MESSAGE' => generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']),
+ 'MCHAT_TIME' => $this->user->format_date($row['message_time'], $this->config_mchat['date']),
+ 'MCHAT_CLASS' => ($row['message_id'] % 2) ? 1 : 2
+ ));
+
+ }
+
+ // Write no message
+ if (empty($rows))
+ {
+ $mchat_no_message = true;
+ }
+ // display custom bbcodes
+ if($mchat_allow_bbcode && $this->config['allow_bbcode'])
+ {
+ $this->functions_mchat->display_mchat_bbcodes();
+ }
+ // Smile row
+ if ($mchat_smilies)
+ {
+ if (!function_exists('generate_smilies'))
+ {
+ include($this->phpbb_root_path . 'includes/functions_posting.' . $this->phpEx);
+ }
+ generate_smilies('inline', 0);
+ }
+ // If the static message is defined in the language file use it, else just use the entry in the database
+ if (isset($this->user->lang[strtoupper('static_message')]) || !empty($this->config_mchat['static_message']))
+ {
+ $this->config_mchat['static_message'] = $this->config_mchat['static_message'];
+ if(isset($this->user->lang[strtoupper('static_message')]))
+ {
+ $this->config_mchat['static_message'] = $this->user->lang[strtoupper('static_message')];
+ }
+ }
+ // If the static message is defined in the language file use it, else just use the entry in the database
+ if (isset($this->user->lang[strtoupper('mchat_rules')]) || !empty($this->config_mchat['rules']))
+ {
+ if(isset($this->user->lang[strtoupper('mchat_rules')]))
+ {
+ $this->config_mchat['rules'] = $this->user->lang[strtoupper('mchat_rules')];
+ }
+ }
+ // a list of users using the chat
+ if ($mchat_custom_page)
+ {
+ $mchat_users = $this->functions_mchat->mchat_users($mchat_session_time, true);
+ }
+ else
+ {
+ $mchat_users = $this->functions_mchat->mchat_users($mchat_session_time);
+ }
+ $this->template->assign_vars(array(
+ 'MCHAT_USERS_COUNT' => $mchat_users['mchat_users_count'],
+ 'MCHAT_USERS_LIST' => $mchat_users['online_userlist'],
+ ));
+ }
+ break;
+ }
+ $copyright = base64_decode('PGEgaHJlZj0iaHR0cDovL3JtY2dpcnI4My5vcmciPlJNY0dpcnI4MzwvYT4gJmNvcHk7IDxhIGhyZWY9Imh0dHA6Ly93d3cuZG16eC13ZWIubmV0IiB0aXRsZT0id3d3LmRtengtd2ViLm5ldCI+ZG16eDwvYT4=');
+ add_form_key('mchat_posting');
+ // Template function...
+ $this->template->assign_vars(array(
+ 'MCHAT_FILE_NAME' => $this->helper->route('dmzx_mchat_controller'),
+ 'MCHAT_REFRESH_JS' => 1000 * $this->config_mchat['refresh'],
+ 'MCHAT_ADD_MESSAGE' => $mchat_add_mess,
+ 'MCHAT_READ_MODE' => $mchat_read_mode,
+ 'MCHAT_ARCHIVE_MODE' => $mchat_archive_mode,
+ 'MCHAT_INPUT_TYPE' => $this->user->data['user_mchat_input_area'],
+ 'MCHAT_RULES' => $mchat_rules,
+ 'MCHAT_ALLOW_SMILES' => $mchat_smilies,
+ 'MCHAT_ALLOW_IP' => $mchat_ip,
+ 'MCHAT_NOMESSAGE_MODE' => $mchat_no_message,
+ 'MCHAT_ALLOW_BBCODES' => ($mchat_allow_bbcode && $this->config['allow_bbcode']) ? true : false,
+ 'MCHAT_ENABLE' => $this->config['mchat_enable'],
+ 'MCHAT_ARCHIVE_URL' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'archive')),
+ 'MCHAT_CUSTOM_PAGE' => $mchat_custom_page,
+ 'MCHAT_INDEX_HEIGHT' => $this->config_mchat['index_height'],
+ 'MCHAT_CUSTOM_HEIGHT' => $this->config_mchat['custom_height'],
+ 'MCHAT_READ_ARCHIVE_BUTTON' => $mchat_read_archive,
+ 'MCHAT_FOUNDER' => $mchat_founder,
+ 'MCHAT_CLEAN_URL' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'clean', 'redirect' => $on_page)),
+ 'MCHAT_STATIC_MESS' => !empty($this->config_mchat['static_message']) ? htmlspecialchars_decode($this->config_mchat['static_message']) : '',
+ 'L_MCHAT_COPYRIGHT' => $copyright,
+ 'MCHAT_WHOIS' => $this->config_mchat['whois'],
+ 'MCHAT_MESSAGE_LNGTH' => $this->config_mchat['max_message_lngth'],
+ 'L_MCHAT_MESSAGE_LNGTH_EXPLAIN' => (intval($this->config_mchat['max_message_lngth'])) ? sprintf($this->user->lang['MCHAT_MESSAGE_LNGTH_EXPLAIN'], intval($this->config_mchat['max_message_lngth'])) : '',
+ 'MCHAT_MESS_LONG' => sprintf($this->user->lang['MCHAT_MESS_LONG'], $this->config_mchat['max_message_lngth']),
+ 'MCHAT_USER_TIMEOUT' => $this->config_mchat['timeout'] ? 1000 * $this->config_mchat['timeout'] : false,
+ 'MCHAT_WHOIS_REFRESH' => 1000 * $this->config_mchat['whois_refresh'],
+ 'MCHAT_PAUSE_ON_INPUT' => $this->config_mchat['pause_on_input'] ? true : false,
+ 'L_MCHAT_ONLINE_EXPLAIN' => $this->functions_mchat->mchat_session_time($mchat_session_time),
+ 'MCHAT_REFRESH_YES' => sprintf($this->user->lang['MCHAT_REFRESH_YES'], $this->config_mchat['refresh']),
+ 'L_MCHAT_WHOIS_REFRESH_EXPLAIN' => sprintf($this->user->lang['WHO_IS_REFRESH_EXPLAIN'], $this->config_mchat['whois_refresh']),
+ 'S_MCHAT_AVATARS' => $mchat_avatars,
+ 'S_MCHAT_LOCATION' => $this->config_mchat['location'],
+ 'S_MCHAT_SOUND_YES' => $this->user->data['user_mchat_sound'],
+ 'S_MCHAT_INDEX_STATS' => $this->user->data['user_mchat_stats_index'],
+ 'U_MORE_SMILIES' => append_sid("{$this->phpbb_root_path}posting.{$this->phpEx}", 'mode=smilies'),
+ 'U_MCHAT_RULES' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'rules')),
+ ));
+
+ // Return for: \$this->helper->render(filename, lang_title);
+ return array(
+ 'filename' => 'mchat_body.html',
+ 'lang_title' => $this->user->lang['MCHAT_TITLE'],
+ );
+ }
+}
diff --git a/event/listener.php b/event/listener.php
index dbd610d..051f375 100644
--- a/event/listener.php
+++ b/event/listener.php
@@ -13,9 +13,12 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class listener implements EventSubscriberInterface
{
+ /** @var \dmzx\mchat\core\render_helper */
+ protected $render_helper;
protected $config;
+ /** @var \phpbb\template\template */
protected $template;
protected $user;
@@ -29,8 +32,9 @@ class listener implements EventSubscriberInterface
/** @var \phpbb\controller\helper */
protected $controller_helper;
- public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\controller\helper $controller_helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\db\driver\driver_interface $db, $root_path, $php_ext, $auth)
+ public function __construct(\dmzx\mchat\core\render_helper $render_helper, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\controller\helper $controller_helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\db\driver\driver_interface $db, $root_path, $php_ext, $auth)
{
+ $this->render_helper = $render_helper;
$this->config = $config;
$this->template = $template;
$this->controller_helper = $controller_helper;
@@ -44,8 +48,9 @@ class listener implements EventSubscriberInterface
static public function getSubscribedEvents()
{
return array(
- 'core.user_setup' => 'load_language_on_setup',
- 'core.page_header' => 'add_page_header_link',
+ 'core.user_setup' => 'load_language_on_setup',
+ 'core.page_header' => 'add_page_header_link',
+ 'core.index_modify_page_title' => 'display_mchat_on_index',
);
}
@@ -72,4 +77,23 @@ class listener implements EventSubscriberInterface
'U_MCHAT' => $this->controller_helper->route('dmzx_mchat_controller'),
));
}
+
+ /**
+ * Check if mchat should be displayed on index.
+ *
+ * @param object $event The event object
+ * @return null
+ * @access public
+ */
+ public function display_mchat_on_index($event)
+ {
+ $mchat_on_index = $this->config['mchat_on_index'];
+
+ if ($mchat_on_index)
+ {
+ $this->template->assign_var('S_MCHAT_ON_INDEX', true);
+
+ $this->render_helper->render_data_for_page(true);
+ }
+ }
}
\ No newline at end of file
diff --git a/language/pl/common.php b/language/pl/common.php
index 8ff30fb..cbd6c5e 100644
--- a/language/pl/common.php
+++ b/language/pl/common.php
@@ -7,7 +7,6 @@
*
*/
-
/**
* DO NOT CHANGE!
*/
@@ -42,8 +41,8 @@ $lang = array_merge($lang, array(
'MCHAT_TITLE' => 'Mini-Chat',
'MCHAT_ADD' => 'Wyślij',
'MCHAT_ANNOUNCEMENT' => 'Ogłoszenie',
- 'MCHAT_ARCHIVE' => 'Archiwum',
- 'MCHAT_ARCHIVE_PAGE' => 'Mini-Chat Archiwum',
+ 'MCHAT_ARCHIVE' => 'Archiwum',
+ 'MCHAT_ARCHIVE_PAGE' => 'Mini-Chat Archiwum',
'MCHAT_BBCODES' => 'BBCodes',
'MCHAT_CLEAN' => 'Wyczyść',
'MCHAT_CLEANED' => 'Wszystkie wiadomości zostały pomyślnie usunięte',
@@ -55,23 +54,23 @@ $lang = array_merge($lang, array(
'MCHAT_DELITE' => 'Usuń',
'MCHAT_EDIT' => 'Edytuj',
'MCHAT_EDITINFO' => 'Edytuj wiadomość i wciśnij OK',
- 'MCHAT_ENABLE' => 'Przepraszamy, Mini-Chat jest aktualnie niedostępny',
- 'MCHAT_ERROR' => 'Błąd',
- 'MCHAT_FLOOD' => 'Nie możesz wysłać kolejnej wiadomośći w tak krótkim czasie',
+ 'MCHAT_ENABLE' => 'Przepraszamy, Mini-Chat jest aktualnie niedostępny',
+ 'MCHAT_ERROR' => 'Błąd',
+ 'MCHAT_FLOOD' => 'Nie możesz wysłać kolejnej wiadomośći w tak krótkim czasie',
'MCHAT_FOE' => 'Wiadomośc została wysłana przez użytkownika %1$s który znajduje się na Twojej liście osób ignorowanych.',
'MCHAT_HELP' => 'mChat Reguamin',
- 'MCHAT_HIDE_LIST' => 'ukryj listę',
+ 'MCHAT_HIDE_LIST' => 'ukryj listę',
'MCHAT_HOUR' => 'godzina ',
'MCHAT_HOURS' => 'godziny',
'MCHAT_IP' => 'IP',
-
- 'MCHAT_MINUTE' => 'minut ',
- 'MCHAT_MINUTES' => 'minut ',
- 'MCHAT_MESS_LONG' => 'Twoja wiadomość jest za długa.\Proszę ogranicz ją do %s characters',
- 'MCHAT_NO_CUSTOM_PAGE' => 'mChat w osobnym oknie jest aktualnie niedostępny!',
+
+ 'MCHAT_MINUTE' => 'minuta ',
+ 'MCHAT_MINUTES' => 'minuty ',
+ 'MCHAT_MESS_LONG' => 'Twoja wiadomość jest za długa.\Proszę ogranicz ją do %s characters',
+ 'MCHAT_NO_CUSTOM_PAGE' => 'mChat w osobnym oknie jest aktualnie niedostępny!',
'MCHAT_NOACCESS' => 'Nie masz uprawnień do postowania na mChat',
- 'MCHAT_NOACCESS_ARCHIVE' => 'Nie masz uprawnień do przeglądania archiwum',
- 'MCHAT_NOJAVASCRIPT' => 'Twoja przeglądarka nie wspiera JavaScript albo JavaScript jest wyłączona',
+ 'MCHAT_NOACCESS_ARCHIVE' => 'Nie masz uprawnień do przeglądania archiwum',
+ 'MCHAT_NOJAVASCRIPT' => 'Twoja przeglądarka nie wspiera JavaScript albo JavaScript jest wyłączona',
'MCHAT_NOMESSAGE' => 'Nie ma wiadomości',
'MCHAT_NOMESSAGEINPUT' => 'Nie wprowadziłeś wiadomości',
'MCHAT_NOSMILE' => 'Nie znaleziono emotikona',
@@ -79,14 +78,14 @@ $lang = array_merge($lang, array(
'MCHAT_NOT_INSTALLED' => 'W bazie danych mChat brakuje.
Proszę uruchom %sinstalator%s aby wprowadzić zmiany w bazie danych rozszerzenia.',
'MCHAT_OK' => 'OK',
'MCHAT_PAUSE' => 'Wstrzymany',
- 'MCHAT_LOAD' => 'Wczytuję',
+ 'MCHAT_LOAD' => 'Wczytuję',
'MCHAT_PERMISSIONS' => 'Zmień uprawnienia użytkownika',
'MCHAT_REFRESHING' => 'Odświeżanie...',
'MCHAT_REFRESH_NO' => 'Auto-aktualizacja jest wyłączona',
'MCHAT_REFRESH_YES' => 'Automatycznie-aktualizuj co %d sekund',
'MCHAT_RESPOND' => 'Odpowiedz użytkownikowi',
'MCHAT_RESET_QUESTION' => 'Wyczyściuć tabelę wprowadzania tekstu ?',
- 'MCHAT_SESSION_OUT' => 'Sesja mChat wygasła',
+ 'MCHAT_SESSION_OUT' => 'Sesja mChat wygasła',
'MCHAT_SHOW_LIST' => 'Pokaż listę',
'MCHAT_SECOND' => 'sekunda ',
'MCHAT_SECONDS' => 'sekundy ',
@@ -95,30 +94,29 @@ $lang = array_merge($lang, array(
'MCHAT_TOTALMESSAGES' => 'Wszystkie wiadomości %s',
'MCHAT_USESOUND' => 'Włączyć dźwięk ?',
-
'MCHAT_ONLINE_USERS_TOTAL' => 'Aktualnie jest tutaj %d czatujących użytkowników ',
'MCHAT_ONLINE_USER_TOTAL' => 'Aktualnie %d osoba korzysta z mChatu ',
'MCHAT_NO_CHATTERS' => 'Nikt nie czatuje',
'MCHAT_ONLINE_EXPLAIN' => 'Bazuje na użytkownikach aktywnych w ciągu ostatnich %s',
-
+
'WHO_IS_CHATTING' => 'Kto czatuje',
'WHO_IS_REFRESH_EXPLAIN' => 'Odświeżaj co %d sekund',
- 'MCHAT_NEW_TOPIC' => 'Nowy Temat',
- 'MCHAT_NEW_REPLY' => 'Nowa Odpowiedź',
-
+ 'MCHAT_NEW_TOPIC' => 'Nowy Temat',
+ 'MCHAT_NEW_REPLY' => 'Nowa Odpowiedź',
+
// UCP
'UCP_PROFILE_MCHAT' => 'mChat Preferences',
-
+
'DISPLAY_MCHAT' => 'Wyświetlaj mChat na stronie głównej',
'SOUND_MCHAT' => 'Włącz dźwięk mChatu',
'DISPLAY_STATS_INDEX' => 'Wyświetlaj kto czatuje w statystykach strony głównej',
- 'DISPLAY_NEW_TOPICS' => 'Wyświetlaj nowe tematy na mChacie',
- 'DISPLAY_AVATARS' => 'Wyświetlaj avatary na mChacie',
+ 'DISPLAY_NEW_TOPICS' => 'Wyświetlaj nowe tematy na chacie',
+ 'DISPLAY_AVATARS' => 'Wyświetlaj avatary na chacie',
'CHAT_AREA' => 'Typ wprowadzania',
'CHAT_AREA_EXPLAIN' => 'Wybierz jaki typ obszaru wybrać do wprowadzania tekstu:
A text area or
an input area',
- 'INPUT_AREA' => 'Pasek',
- 'TEXT_AREA' => 'Okno',
+ 'INPUT_AREA' => 'Obszar wprowadzania',
+ 'TEXT_AREA' => 'Obszar tekstu',
// ACP
'ACP_MCHAT_RULES_EXPLAIN' => 'Tutaj wprowadź regulamin mChat. Każdy podpunkt w oddzielnej lini.
Limit znaków wynosi 255.
',
'LOG_MCHAT_CONFIG_UPDATE' => 'Aktualizuj konfigurację mChat ',
@@ -128,11 +126,11 @@ $lang = array_merge($lang, array(
'MCHAT_ENABLE' => 'Włącz rozszerzenie mChat',
'MCHAT_ENABLE_EXPLAIN' => 'Włącz lub wyłącz rozszerzenie globalnie.',
'MCHAT_AVATARS' => 'Wyświetlaj avatary',
- 'MCHAT_AVATARS_EXPLAIN' => 'Zaznacz TAK aby wyświetlać miniaturki avatarów',
+ 'MCHAT_AVATARS_EXPLAIN' => 'Zaznacz TAK aby wyświetlać miniaturki avatarów',
'MCHAT_ON_INDEX' => 'mChat na stronie głównej',
'MCHAT_ON_INDEX_EXPLAIN' => 'Zezwól na wyświetlanie mChat na stronie głównej.',
'MCHAT_INDEX_HEIGHT' => 'Wysokość na stronie głównej',
- 'MCHAT_INDEX_HEIGHT_EXPLAIN' => 'Wysokość okna rozmowy w pikselach na stronie głównej.
Limit wynosi od 50 do 1000.',
+ 'MCHAT_INDEX_HEIGHT_EXPLAIN' => 'Wysokość okna rozmowy w pikselach na głównej stronie.
Limit wynosi od 50 do 1000.',
'MCHAT_LOCATION' => 'Lokalizacja na forum',
'MCHAT_LOCATION_EXPLAIN' => 'Wybierz lokalizację mChat na stronie głównej.',
'MCHAT_TOP_OF_FORUM' => 'Góra',
@@ -142,9 +140,9 @@ $lang = array_merge($lang, array(
'MCHAT_PRUNE' => 'Włącz opcję wyczyszczenia wiadomości',
'MCHAT_PRUNE_EXPLAIN' => 'Jeśli zaznaczono tak, opcja wyczyszczenia wiadomości będzie dostępna.
Tylko wtedy, jeśli użytkownik wyświetli stronę niestandardową lub archiwum.',
'MCHAT_PRUNE_NUM' => 'Ilość wyczyszczonych wiadomości',
- 'MCHAT_PRUNE_NUM_EXPLAIN' => 'Wpisz liczbę.',
+ 'MCHAT_PRUNE_NUM_EXPLAIN' => 'Wpisz liczbę.',
'MCHAT_MESSAGE_LIMIT' => 'Limit wiadomości',
- 'MCHAT_MESSAGE_LIMIT_EXPLAIN' => 'Ilość wiadomości wyświetlana w oknie mChat.
Rekomendowane od 10 do 30.',
+ 'MCHAT_MESSAGE_LIMIT_EXPLAIN' => 'Maksymalna ilość wiadomości wyświetlana w oknie mChat.
Rekomendowane od 10 do 30.',
'MCHAT_MESSAGE_NUM' => 'Limit wiadomości na stronie głównej',
'MCHAT_MESSAGE_NUM_EXPLAIN' => 'Maksymalna ilość wiadomości wyświetlana w mChat na stronie głównej.
Rekomendowane od 10 do 30.',
'MCHAT_ARCHIVE_LIMIT' => 'Limit Archiwum',
@@ -156,20 +154,20 @@ $lang = array_merge($lang, array(
'MCHAT_CUSTOM_PAGE' => 'Strona niestandardowa',
'MCHAT_CUSTOM_PAGE_EXPLAIN' => 'Zewól na używanie strony niestandardowej',
'MCHAT_CUSTOM_HEIGHT' => 'Wysokość strony niestandardowej',
- 'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => 'Wysokość okna rozmowy w pikselach na osobnej stronie mChat.
Limit wynosi od 50 do 1000.',
+ 'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => 'Wysokość okna rozmowy w pikselach na on osobnej stronie mChat.
Limit wynosi od 50 do 1000.',
'MCHAT_DATE_FORMAT' => 'Format Daty',
- 'MCHAT_DATE_FORMAT_EXPLAIN' => 'Użyta składnia jest taka sama jak w PHP',
+ 'MCHAT_DATE_FORMAT_EXPLAIN' => 'Użyta składnia jest taka sama jak w PHP date() function.',
'MCHAT_CUSTOM_DATEFORMAT' => 'Niestandardowa…',
'MCHAT_WHOIS' => 'Kto aktualnie czatuje',
'MCHAT_WHOIS_EXPLAIN' => 'Pozwala na wyświetlanie użytkowników, którzy aktualnie korzystają z mChat',
'MCHAT_WHOIS_REFRESH' => 'Odświeżanie czatujących użytkowników',
'MCHAT_WHOIS_REFRESH_EXPLAIN' => 'Po ilu sekundach nastąpi automatyczne odświeżanie czatujących użytkowników.
Limit wynosi od 30 do 300 sekund.',
'MCHAT_BBCODES_DISALLOWED' => 'Niedozwolone bbcodes',
- 'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Tutaj umieść bbcodes których nie będzie można używać w wiadomościach.
Oddziel bbcodes pionową kreską, na przykład:
b|i|u|code|list|list=|flash|quote i/lub %wybierz z tych%s',
+ 'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Tutaj umieść bbcodes których nie będzie można używać w wiadomościach.
Oddzielne bbcodes z pionową kreską, na przykład:
b|i|u|code|list|list=|flash|quote i/lub %wybierz z tych%s',
'MCHAT_STATIC_MESSAGE' => 'Ogłoszenie',
- 'MCHAT_STATIC_MESSAGE_EXPLAIN' => 'Tutaj możesz umieścić ogłoszenie które wyświetli się osobą korzystającym z mChat. kod HTML jest dozwolony.
Zostaw puste aby wyłączyć wyświetlanie. Limit wynosi max 255 znaków.
',
+ 'MCHAT_STATIC_MESSAGE_EXPLAIN' => 'Tutaj możesz umieścić ogłoszenie które wyświetli się osobą czatującym. kod HTML jest dozwolony.
Zostaw puste aby wyłączyć wyświetlanie. Limit wynosi max 255 znaków.
',
'MCHAT_USER_TIMEOUT' => 'Limit czasu dla użytkownika',
- 'MCHAT_USER_TIMEOUT_EXPLAIN' => 'Ustaw czas w sekundach do zakończenia sesji użytkownika. Ustaw 0 aby wyłączyć.
Limit znajdziesz %stutaj%s aktualnie jest ustawione na %s sekund',
+ 'MCHAT_USER_TIMEOUT_EXPLAIN' => 'Ustaw czas w sekundach do zakończenia sesji użytkownika. Ustaw 0 sby wyłączyć.
Limit znajdziesz tutaj %sforum konfiguracja ustawień dla sessji%s aktualnie jest ustawione na %s sekund',
'MCHAT_OVERRIDE_SMILIE_LIMIT' => 'Limit emotikon',
'MCHAT_OVERRIDE_SMILIE_LIMIT_EXPLAIN' => 'Zaznacz TAK aby włączyć limit emotikon używanych w wiadmościach mChat',
'MCHAT_OVERRIDE_MIN_POST_CHARS' => 'Limit znaków',
@@ -179,11 +177,11 @@ $lang = array_merge($lang, array(
'MCHAT_MAIN' => 'Główne ustawienia',
'MCHAT_STATS' => 'Kto czatuje ?',
'MCHAT_STATS_INDEX' => 'Statystyki na stronie głównej',
- 'MCHAT_STATS_INDEX_EXPLAIN' => 'Pokaż kto korzysta z mChat w dziale statystyki na stronie głównej',
+ 'MCHAT_STATS_INDEX_EXPLAIN' => 'Pokaż kto korysta z mChat w dziale statystyki na forum',
'MCHAT_MESSAGES' => 'Ustawienia wiadomości',
'MCHAT_PAUSE_ON_INPUT' => 'Auto-aktuaizacja podczas pisania wiadomości',
'MCHAT_PAUSE_ON_INPUT_EXPLAIN' => 'Zaznacz TAK aby nie auto-aktualizować mChatu gdy użytkownik pisze wiadomość',
-
+
// error reporting
'MCHAT_NEEDS_UPDATING' => 'Rozszerzenie mChat musi zostać zaktualizowane. Proszę skontaktuj się z administratorem.',
'MCHAT_WRONG_VERSION' => 'Zainstalowano złą wersję rozszerzenia. Proszę uruchom %instalator%s aby zainstalować nową wersję rozszerzenia.',
@@ -203,24 +201,24 @@ $lang = array_merge($lang, array(
'TOO_SMALL_MAX_WORDS_LNGTH' => 'Ustawiona wartość długości słowa jest za mała.',
'TOO_LARGE_MAX_WORDS_LNGTH' => 'Ustawiona wartość długości słowa jest za duża.',
'TOO_SMALL_WHOIS_REFRESH' => 'Ustawiona wartość odświeżania osób czatujących jest za mała.',
- 'TOO_LARGE_WHOIS_REFRESH' => 'Ustawiona wartość odświeżania osób czatujących jest za duża.',
+ 'TOO_LARGE_WHOIS_REFRESH' => 'Ustawiona wartość odświeżania osób czatujących jest za duża.',
'TOO_SMALL_INDEX_HEIGHT' => 'Ustawiona wartość wysokości mChat na stronie głównej jest za mała.',
'TOO_LARGE_INDEX_HEIGHT' => 'Ustawiona wartość wysokości mChat na stronie głównej jest za duża.',
'TOO_SMALL_CUSTOM_HEIGHT' => 'Ustawiona wartość wysokości strony niestandardowej mChat jest za mała.',
'TOO_LARGE_CUSTOM_HEIGHT' => 'Ustawiona wartość wysokości strony niestandardowej mChat jest za duża.',
'TOO_SHORT_STATIC_MESSAGE' => 'Ustawiona wartość limitu czasu dla użytkownika jest za mała.',
- 'TOO_LONG_STATIC_MESSAGE' => 'Ustawiona wartość limitu czasu dla użytkownika jest za duża.',
+ 'TOO_LONG_STATIC_MESSAGE' => 'Ustawiona wartość limitu czasu dla użytkownika jest za duża.',
'TOO_SMALL_TIMEOUT' => 'Ustawiona wartość ogłoszenia jest za mała.',
'TOO_LARGE_TIMEOUT' => 'Ustawiona wartość ogłoszenia jest za duża.',
'UCP_CAT_MCHAT' => 'mChat',
'UCP_MCHAT_CONFIG' => 'mChat', //Preferences
'LOG_MCHAT_TABLE_PRUNED' => 'Tabela mChat została wyczyszczona',
'ACP_USER_MCHAT' => 'mChat Ustawienia',
- 'LOG_DELETED_MCHAT' => 'Usuń wiadomości mChat
» %1$s',
- 'LOG_EDITED_MCHAT' => 'Edytuj wiadomość mChat
» %1$s',
+ 'LOG_DELETED_MCHAT' => 'Usuń wiadomości mChat
» %1$s',
+ 'LOG_EDITED_MCHAT' => 'Edytuj wiadomość mChat
» %1$s',
'MCHAT_MESSAGE_LNGTH_EXPLAIN' => 'Pozostało znaków: %d',
- 'MCHAT_TOP_POSTERS' => 'Top Spammerzy',
- 'MCHAT_NEW_CHAT' => 'Nowa wiadomośc na mChacie!',
+ 'MCHAT_TOP_POSTERS' => 'Top Spammerzy',
+ 'MCHAT_NEW_CHAT' => 'Nowa wiadomośc na chacie!',
'FONT_COLOR' => 'Kolor czcionki',
'FONT_COLOR_HIDE' => 'Ukryj kolor czcionki',
'FONT_HUGE' => 'Ogromne',
@@ -229,7 +227,7 @@ $lang = array_merge($lang, array(
'FONT_SIZE' => 'Rozmiar czcionki',
'FONT_SMALL' => 'Mały',
'FONT_TINY' => 'Malutki',
- 'MCHAT_SEND_PM' => 'Wyślij prywatną wiadomość',
- 'MCHAT_PM' => '(PM)',
- 'MORE_SMILIES' => 'Więcej emotikon',
+ 'MCHAT_SEND_PM' => 'Wyślij prywatną wiadomość',
+ 'MCHAT_PM' => '(PM)',
+ 'MORE_SMILIES' => 'Więcej emotikon',
));
\ No newline at end of file
diff --git a/language/pl/info_acp_mchat.php b/language/pl/info_acp_mchat.php
index e37ee0c..60a7211 100644
--- a/language/pl/info_acp_mchat.php
+++ b/language/pl/info_acp_mchat.php
@@ -31,7 +31,6 @@ if (empty($lang) || !is_array($lang))
// Some characters for use
// ’ » “ ” …
-
$lang = array_merge($lang, array(
// UMIL stuff
@@ -56,11 +55,11 @@ $lang = array_merge($lang, array(
'MCHAT_ENABLE' => 'Włącz rozszerzenie mChat',
'MCHAT_ENABLE_EXPLAIN' => 'Włącz lub wyłącz rozszerzenie globalnie.',
'MCHAT_AVATARS' => 'Wyświetlaj avatary',
- 'MCHAT_AVATARS_EXPLAIN' => 'Zaznacz TAK aby wyświetlać miniaturki avatarów',
+ 'MCHAT_AVATARS_EXPLAIN' => 'Zaznacz TAK aby wyświetlać miniaturki avatarów',
'MCHAT_ON_INDEX' => 'mChat na stronie głównej',
'MCHAT_ON_INDEX_EXPLAIN' => 'Zezwól na wyświetlanie mChat na stronie głównej.',
'MCHAT_INDEX_HEIGHT' => 'Wysokość na stronie głównej',
- 'MCHAT_INDEX_HEIGHT_EXPLAIN' => 'Wysokość okna rozmowy w pikselach na stronie głównej.
Limit wynosi od 50 do 1000.',
+ 'MCHAT_INDEX_HEIGHT_EXPLAIN' => 'Wysokość okna rozmowy w pikselach na głównej stronie.
Limit wynosi od 50 do 1000.',
'MCHAT_LOCATION' => 'Lokalizacja na forum',
'MCHAT_LOCATION_EXPLAIN' => 'Wybierz lokalizację mChat na stronie głównej.',
'MCHAT_TOP_OF_FORUM' => 'Góra',
@@ -70,9 +69,9 @@ $lang = array_merge($lang, array(
'MCHAT_PRUNE' => 'Włącz opcję wyczyszczenia wiadomości',
'MCHAT_PRUNE_EXPLAIN' => 'Jeśli zaznaczono tak, opcja wyczyszczenia wiadomości będzie dostępna.
Tylko wtedy, jeśli użytkownik wyświetli stronę niestandardową lub archiwum.',
'MCHAT_PRUNE_NUM' => 'Ilość wyczyszczonych wiadomości',
- 'MCHAT_PRUNE_NUM_EXPLAIN' => 'Wpisz liczbę',
+ 'MCHAT_PRUNE_NUM_EXPLAIN' => 'Wpisz liczbę',
'MCHAT_MESSAGE_LIMIT' => 'Limit wiadomości',
- 'MCHAT_MESSAGE_LIMIT_EXPLAIN' => 'Ilość wiadomości wyświetlana w oknie mChat.
Rekomendowane od 10 do 30.',
+ 'MCHAT_MESSAGE_LIMIT_EXPLAIN' => 'Maksymalna ilość wiadomości wyświetlana w oknie mChat.
Rekomendowane od 10 do 30.',
'MCHAT_MESSAGE_NUM' => 'Limit wiadomości na stronie głównej',
'MCHAT_MESSAGE_NUM_EXPLAIN' => 'Maksymalna ilość wiadomości wyświetlana w mChat na stronie głównej.
Rekomendowane od 10 do 30.',
'MCHAT_ARCHIVE_LIMIT' => 'Limit Archiwum',
@@ -84,20 +83,20 @@ $lang = array_merge($lang, array(
'MCHAT_CUSTOM_PAGE' => 'Strona niestandardowa',
'MCHAT_CUSTOM_PAGE_EXPLAIN' => 'Zewól na używanie strony niestandardowej',
'MCHAT_CUSTOM_HEIGHT' => 'Wysokość strony niestandardowej',
- 'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => 'Wysokość okna rozmowy w pikselach na osobnej stronie mChat.
Limit wynosi od 50 do 1000.',
+ 'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => 'Wysokość okna rozmowy w pikselach na on osobnej stronie mChat.
Limit wynosi od 50 do 1000.',
'MCHAT_DATE_FORMAT' => 'Format Daty',
- 'MCHAT_DATE_FORMAT_EXPLAIN' => 'Użyta składnia jest taka sama jak w PHP.',
+ 'MCHAT_DATE_FORMAT_EXPLAIN' => 'Użyta składnia jest taka sama jak w PHP date() function.',
'MCHAT_CUSTOM_DATEFORMAT' => 'Niestandardowa…',
'MCHAT_WHOIS' => 'Kto aktualnie czatuje',
'MCHAT_WHOIS_EXPLAIN' => 'Pozwala na wyświetlanie użytkowników, którzy aktualnie korzystają z mChat',
'MCHAT_WHOIS_REFRESH' => 'Odświeżanie czatujących użytkowników',
'MCHAT_WHOIS_REFRESH_EXPLAIN' => 'Po ilu sekundach nastąpi automatyczne odświeżanie czatujących użytkowników.
Limit wynosi od 30 do 300 sekund.',
'MCHAT_BBCODES_DISALLOWED' => 'Niedozwolone bbcodes',
- 'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Tutaj umieść bbcodes których nie będzie można używać w wiadomościach.
Oddziel bbcodes pionową kreską, na przykład:
b|i|u|code|list|list=|flash|quote i/lub %wybierz z tych%s',
+ 'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Tutaj umieść bbcodes których nie będzie można używać w wiadomościach.
Oddzielne bbcodes z pionową kreską, na przykład:
b|i|u|code|list|list=|flash|quote i/lub %wybierz z tych%s',
'MCHAT_STATIC_MESSAGE' => 'Ogłoszenie',
- 'MCHAT_STATIC_MESSAGE_EXPLAIN' => 'Tutaj możesz umieścić ogłoszenie które wyświetli się osobą korzystającym z mChat. kod HTML jest dozwolony.
Zostaw puste aby wyłączyć wyświetlanie. Limit wynosi max 255 znaków.
',
+ 'MCHAT_STATIC_MESSAGE_EXPLAIN' => 'Tutaj możesz umieścić ogłoszenie które wyświetli się osobą czatującym. kod HTML jest dozwolony.
Zostaw puste aby wyłączyć wyświetlanie. Limit wynosi max 255 znaków.
',
'MCHAT_USER_TIMEOUT' => 'Limit czasu dla użytkownika',
- 'MCHAT_USER_TIMEOUT_EXPLAIN' => 'Ustaw czas w sekundach do zakończenia sesji użytkownika. Ustaw 0 aby wyłączyć.
Limit znajdziesz %stutaj%s aktualnie jest ustawione na %s sekund',
+ 'MCHAT_USER_TIMEOUT_EXPLAIN' => 'Ustaw czas w sekundach do zakończenia sesji użytkownika. Ustaw 0 sby wyłączyć.
Limit znajdziesz tutaj %sforum konfiguracja ustawień dla sessji%s aktualnie jest ustawione na %s sekund',
'MCHAT_OVERRIDE_SMILIE_LIMIT' => 'Limit emotikon',
'MCHAT_OVERRIDE_SMILIE_LIMIT_EXPLAIN' => 'Zaznacz TAK aby włączyć limit emotikon używanych w wiadmościach mChat',
'MCHAT_OVERRIDE_MIN_POST_CHARS' => 'Limit znaków',
@@ -107,11 +106,11 @@ $lang = array_merge($lang, array(
'MCHAT_MAIN' => 'Główne ustawienia',
'MCHAT_STATS' => 'Kto czatuje ?',
'MCHAT_STATS_INDEX' => 'Statystyki na stronie głównej',
- 'MCHAT_STATS_INDEX_EXPLAIN' => 'Pokaż kto korzysta z mChat w dziale statystyki na stronie głównej',
+ 'MCHAT_STATS_INDEX_EXPLAIN' => 'Pokaż kto korysta z mChat w dziale statystyki na forum',
'MCHAT_MESSAGES' => 'Ustawienia wiadomości',
'MCHAT_PAUSE_ON_INPUT' => 'Auto-aktuaizacja podczas pisania wiadomości',
'MCHAT_PAUSE_ON_INPUT_EXPLAIN' => 'Zaznacz TAK aby nie auto-aktualizować mChatu gdy użytkownik pisze wiadomość',
-
+
// error reporting
'MCHAT_NEEDS_UPDATING' => 'Rozszerzenie mChat musi zostać zaktualizowane. Proszę skontaktuj się z administratorem.',
'MCHAT_WRONG_VERSION' => 'Zainstalowano złą wersję rozszerzenia. Proszę uruchom %instalator%s aby zainstalować nową wersję rozszerzenia.',
@@ -131,16 +130,16 @@ $lang = array_merge($lang, array(
'TOO_SMALL_MAX_WORDS_LNGTH' => 'Ustawiona wartość długości słowa jest za mała.',
'TOO_LARGE_MAX_WORDS_LNGTH' => 'Ustawiona wartość długości słowa jest za duża.',
'TOO_SMALL_WHOIS_REFRESH' => 'Ustawiona wartość odświeżania osób czatujących jest za mała.',
- 'TOO_LARGE_WHOIS_REFRESH' => 'Ustawiona wartość odświeżania osób czatujących jest za duża.',
+ 'TOO_LARGE_WHOIS_REFRESH' => 'Ustawiona wartość odświeżania osób czatujących jest za duża.',
'TOO_SMALL_INDEX_HEIGHT' => 'Ustawiona wartość wysokości mChat na stronie głównej jest za mała.',
'TOO_LARGE_INDEX_HEIGHT' => 'Ustawiona wartość wysokości mChat na stronie głównej jest za duża.',
'TOO_SMALL_CUSTOM_HEIGHT' => 'Ustawiona wartość wysokości strony niestandardowej mChat jest za mała.',
'TOO_LARGE_CUSTOM_HEIGHT' => 'Ustawiona wartość wysokości strony niestandardowej mChat jest za duża.',
'TOO_SHORT_STATIC_MESSAGE' => 'Ustawiona wartość limitu czasu dla użytkownika jest za mała.',
- 'TOO_LONG_STATIC_MESSAGE' => 'Ustawiona wartość limitu czasu dla użytkownika jest za duża.',
+ 'TOO_LONG_STATIC_MESSAGE' => 'Ustawiona wartość limitu czasu dla użytkownika jest za duża.',
'TOO_SMALL_TIMEOUT' => 'Ustawiona wartość ogłoszenia jest za mała.',
'TOO_LARGE_TIMEOUT' => 'Ustawiona wartość ogłoszenia jest za duża.',
-
+
// User perms
'ACL_U_MCHAT_USE' => 'Może używać mChat',
'ACL_U_MCHAT_VIEW' => 'Może przeglądać mChat',
@@ -155,5 +154,5 @@ $lang = array_merge($lang, array(
// Admin perms
'ACL_A_MCHAT' => array('lang' => 'Może zarządzać ustawieniami Mchat', 'cat' => 'permissions'), // Using a phpBB category here
-
+
));
diff --git a/migrations/mchat_schema.php b/migrations/mchat_schema.php
index d7aad17..ca90b50 100644
--- a/migrations/mchat_schema.php
+++ b/migrations/mchat_schema.php
@@ -20,7 +20,7 @@ class mchat_schema extends \phpbb\db\migration\migration
array('config.add', array('mchat_on_index', true)),
array('config.add', array('mchat_new_posts', false)),
array('config.add', array('mchat_stats_index', false)),
- array('config.add', array('mchat_version','0.0.4')),
+ array('config.add', array('mchat_version','0.0.5')),
array('permission.add', array('u_mchat_use')),
array('permission.add', array('u_mchat_view')),
diff --git a/styles/prosilver/template/event/index_body_forumlist_body_after.html b/styles/prosilver/template/event/index_body_forumlist_body_after.html
deleted file mode 100644
index 528c5d7..0000000
--- a/styles/prosilver/template/event/index_body_forumlist_body_after.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/styles/prosilver/template/event/index_body_markforums_after.html b/styles/prosilver/template/event/index_body_markforums_after.html
deleted file mode 100644
index bf8d07f..0000000
--- a/styles/prosilver/template/event/index_body_markforums_after.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/styles/prosilver/template/event/index_body_markforums_before.html b/styles/prosilver/template/event/index_body_markforums_before.html
new file mode 100644
index 0000000..f91ac1a
--- /dev/null
+++ b/styles/prosilver/template/event/index_body_markforums_before.html
@@ -0,0 +1 @@
+
diff --git a/styles/prosilver/template/mchat_body.html b/styles/prosilver/template/mchat_body.html
index e8e0866..608eae6 100644
--- a/styles/prosilver/template/mchat_body.html
+++ b/styles/prosilver/template/mchat_body.html
@@ -1,5 +1,6 @@
+
@@ -8,7 +9,6 @@
-