diff --git a/acp/acp_mchat_module.php b/acp/acp_mchat_module.php index dcf3b2e..c93e0f8 100644 --- a/acp/acp_mchat_module.php +++ b/acp/acp_mchat_module.php @@ -11,263 +11,37 @@ namespace dmzx\mchat\acp; class acp_mchat_module { - /** @var \dmzx\mchat\core\functions_mchat */ - protected $functions_mchat; - /** @var \phpbb\config\config */ - protected $config; - - /** @var \phpbb\config\db_text */ - protected $config_text; - - /** @var \phpbb\db\driver\driver_interface */ - protected $db; - - /** @var \phpbb\cache\service */ - protected $cache; - - /** @var \phpbb\log\log */ - protected $log; - - /** @var \phpbb\request\request */ - protected $request; - - /** @var \phpbb\template\template */ - protected $template; - - /** @var \phpbb\user */ - protected $user; - - /** @var ContainerInterface */ - protected $phpbb_container; - - /** @var string */ - protected $phpbb_root_path; - - /** @var string */ - protected $php_ext; - - /** @var string */ - protected $table_prefix; - - /** @var string */ public $u_action; public function main($id, $mode) { - global $config, $db, $cache, $request, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $phpbb_log; - global $phpbb_container; + global $phpbb_container, $request, $user; - $this->functions_mchat = $phpbb_container->get('dmzx.mchat.functions_mchat'); - $this->config = $config; - $this->config_text = $phpbb_container->get('config_text'); - $this->db = $db; - $this->request = $request; - $this->template = $template; - $this->user = $user; - $this->cache = $cache; - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $phpEx; - $this->table_prefix = $phpbb_container->getParameter('core.table_prefix'); + // Get an instance of the admin controller + $admin_controller = $phpbb_container->get('dmzx.mchat.admin.controller'); + + // Requests + $action = $request->variable('action', ''); + if ($request->is_set_post('add')) + { + $action = 'add'; + } // Add the wpm ACP lang file $user->add_lang_ext('dmzx/mchat', 'info_acp_mchat'); + // Load the display settings handle in the admin controller + $admin_controller->display_options(); + // Load a template from adm/style for our ACP page $this->tpl_name = 'acp_mchat'; // Set the page title for our ACP page $this->page_title = 'MCHAT_TITLE'; - // Define the name of the form for use as a form key - $form_name = 'acp_mchat'; - add_form_key($form_name); + // Make the $u_action url available in the admin controller + $admin_controller->set_page_url($this->u_action); - // something was submitted - $submit = (isset($_POST['submit'])) ? true : false; - - $mchat_row = array( - 'location' => $request->variable('mchat_location', 0), - 'refresh' => $request->variable('mchat_refresh', 0), - 'message_limit' => $request->variable('mchat_message_limit', 0), - 'message_num' => $request->variable('mchat_message_num', 0), - 'archive_limit' => $request->variable('mchat_archive_limit', 0), - 'flood_time' => $request->variable('mchat_flood_time', 0), - 'max_message_lngth' => $request->variable('mchat_max_message_lngth', 0), - 'custom_page' => $request->variable('mchat_custom_page', 0), - 'date' => $request->variable('mchat_date', '', true), - 'whois' => $request->variable('mchat_whois', 0), - 'whois_refresh' => $request->variable('mchat_whois_refresh', 0), - 'bbcode_disallowed' => utf8_normalize_nfc($request->variable('mchat_bbcode_disallowed', '', true)), - 'prune_enable' => $request->variable('mchat_prune_enable', 0), - 'prune_num' => $request->variable('mchat_prune_num', 0), - 'index_height' => $request->variable('mchat_index_height', 0), - 'custom_height' => $request->variable('mchat_custom_height', 0), - 'static_message' => utf8_normalize_nfc($request->variable('mchat_static_message', '', true)), - 'override_min_post_chars' => $request->variable('mchat_override_min_post_chars', 0), - 'override_smilie_limit' => $request->variable('mchat_override_smilie_limit', 0), - 'timeout' => $request->variable('mchat_timeout', 0), - 'pause_on_input' => $request->variable('mchat_pause_on_input', 0), - 'rules' => utf8_normalize_nfc($request->variable('mchat_rules', '', true)), - 'avatars' => $request->variable('mchat_avatars', 0), - ); - - if ($submit) - { - if (!function_exists('validate_data')) - { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - } - - // validate the entries...most of them anyway - $mchat_array = array( - 'static_message' => array('string', false, 0, 255), - 'index_height' => array('num', false, 50, 1000), - 'custom_height' => array('num', false, 50, 1000), - 'whois_refresh' => array('num', false, 30, 300), - 'refresh' => array('num', false, 5, 60), - 'message_limit' => array('num', false, 10, 30), - 'message_num' => array('num', false, 10, 50), - 'archive_limit' => array('num', false, 25, 50), - 'flood_time' => array('num', false, 0, 30), - 'max_message_lngth' => array('num', false, 0, 500), - 'timeout' => array('num', false, 0, (int) $config['session_length']), - 'rules' => array('string', false, 0, 255), - ); - - $error = validate_data($mchat_row, $mchat_array); - - if (!check_form_key('acp_mchat')) - { - $error[] = 'FORM_INVALID'; - } - - // Replace "error" strings with their real, localised form - $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); - - if (!sizeof($error)) - { - foreach ($mchat_row as $config_name => $config_value) - { - $sql = 'UPDATE ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_CONFIG_TABLE . " - SET config_value = '" . $db->sql_escape($config_value) . "' - WHERE config_name = '" . $db->sql_escape($config_name) . "'"; - $db->sql_query($sql); - } - - //update setting in config table for mod enabled or not - $config->set('mchat_enable', $request->variable('mchat_enable', 0)); - // update setting in config table for allowing on index or not - $config->set('mchat_on_index', $request->variable('mchat_on_index', 0)); - // update setting in config table to enable posts to display or not - $config->set('mchat_new_posts', $request->variable('mchat_new_posts', 0)); - // update setting in config table to allow topic to display or not - $config->set('mchat_new_posts_topic', $request->variable('mchat_new_posts_topic', 0)); - // update setting in config table to allow replies to display or not - $config->set('mchat_new_posts_reply', $request->variable('mchat_new_posts_reply', 0)); - // update setting in config table to allow edit posts to display or not - $config->set('mchat_new_posts_edit', $request->variable('mchat_new_posts_edit', 0)); - // update setting in config table to allow quoted posts to display or not - $config->set('mchat_new_posts_quote', $request->variable('mchat_new_posts_quote', 0)); - // update setting in config table for stats on index - $config->set('mchat_stats_index', $request->variable('mchat_stats_index', 0)); - // update setting in config table for message on top - $config->set('mchat_message_top', $request->variable('mchat_message_top', 0)); - - // and an entry into the log table - $phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_CONFIG_UPDATE'); - - // purge the cache - $this->cache->destroy('_mchat_config'); - - // rebuild the cache - $this->functions_mchat->mchat_cache(); - - trigger_error($user->lang['MCHAT_CONFIG_SAVED'] . adm_back_link($this->u_action)); - } - } - - // let's get it on - $sql = 'SELECT * FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_CONFIG_TABLE; - $result = $db->sql_query($sql); - $mchat_config = array(); - while ($row = $db->sql_fetchrow($result)) - { - $mchat_config[$row['config_name']] = $row['config_value']; - } - $db->sql_freeresult($result); - - $mchat_enable = isset($config['mchat_enable']) ? $config['mchat_enable'] : 0; - $mchat_on_index = isset($config['mchat_on_index']) ? $config['mchat_on_index'] : 0; - $mchat_version = isset($config['mchat_version']) ? $config['mchat_version'] : ''; - $mchat_new_posts = isset($config['mchat_new_posts']) ? $config['mchat_new_posts'] : 0; - $mchat_new_posts_topic = isset($config['mchat_new_posts_topic']) ? $config['mchat_new_posts_topic'] : 0; - $mchat_new_posts_reply = isset($config['mchat_new_posts_reply']) ? $config['mchat_new_posts_reply'] : 0; - $mchat_new_posts_edit = isset($config['mchat_new_posts_edit']) ? $config['mchat_new_posts_edit'] : 0; - $mchat_new_posts_quote = isset($config['mchat_new_posts_quote']) ? $config['mchat_new_posts_quote'] : 0; - $mchat_stats_index = isset($config['mchat_stats_index']) ? $config['mchat_stats_index'] : 0; - $mchat_message_top = isset($config['mchat_message_top']) ? $config['mchat_message_top'] : 0; - - $dateformat_options = ''; - foreach ($user->lang['dateformats'] as $format => $null) - { - $dateformat_options .= ''; - } - - $s_custom = false; - $dateformat_options .= ''; - - $template->assign_vars(array( - 'MCHAT_ERROR' => isset($error) ? ((sizeof($error)) ? implode('
', $error) : '') : '', - 'MCHAT_VERSION' => $mchat_version, - 'MCHAT_PRUNE' => !empty($mchat_row['prune_enable']) ? $mchat_row['prune_enable'] : $mchat_config['prune_enable'], - 'MCHAT_PRUNE_NUM' => !empty($mchat_row['prune_num']) ? $mchat_row['prune_num'] : $mchat_config['prune_num'], - 'MCHAT_ENABLE' => ($mchat_enable) ? true : false, - 'MCHAT_ON_INDEX' => ($mchat_on_index) ? true : false, - 'MCHAT_MESSAGE_TOP' => ($mchat_message_top) ? true : false, - 'MCHAT_LOCATION' => !empty($mchat_row['location']) ? $mchat_row['location'] : $mchat_config['location'], - 'MCHAT_REFRESH' => !empty($mchat_row['refresh']) ? $mchat_row['refresh'] : $mchat_config['refresh'], - 'MCHAT_WHOIS_REFRESH' => !empty($mchat_row['whois_refresh']) ? $mchat_row['whois_refresh'] : $mchat_config['whois_refresh'], - 'MCHAT_MESSAGE_LIMIT' => !empty($mchat_row['message_limit']) ? $mchat_row['message_limit'] : $mchat_config['message_limit'], - 'MCHAT_MESSAGE_NUM' => !empty($mchat_row['message_num']) ? $mchat_row['message_num'] : $mchat_config['message_num'], - 'MCHAT_ARCHIVE_LIMIT' => !empty($mchat_row['archive_limit']) ? $mchat_row['archive_limit'] : $mchat_config['archive_limit'], - 'MCHAT_AVATARS' => !empty($mchat_row['avatars']) ? $mchat_row['avatars'] : $mchat_config['avatars'], - 'MCHAT_FLOOD_TIME' => !empty($mchat_row['flood_time']) ? $mchat_row['flood_time'] : $mchat_config['flood_time'], - 'MCHAT_MAX_MESSAGE_LNGTH' => !empty($mchat_row['max_message_lngth']) ? $mchat_row['max_message_lngth'] : $mchat_config['max_message_lngth'], - 'MCHAT_CUSTOM_PAGE' => !empty($mchat_row['custom_page']) ? $mchat_row['custom_page'] : $mchat_config['custom_page'], - 'MCHAT_DATE' => !empty($mchat_row['date']) ? $mchat_row['date'] : $mchat_config['date'], - 'MCHAT_DEFAULT_DATEFORMAT' => $config['default_dateformat'], - 'MCHAT_RULES' => !empty($mchat_row['rules']) ? $mchat_row['rules'] : $mchat_config['rules'], - 'MCHAT_WHOIS' => !empty($mchat_row['whois']) ? $mchat_row['whois'] : $mchat_config['whois'], - 'MCHAT_STATS_INDEX' => ($mchat_stats_index) ? true : false, - 'MCHAT_BBCODE_DISALLOWED' => !empty($mchat_row['bbcode_disallowed']) ? $mchat_row['bbcode_disallowed'] : $mchat_config['bbcode_disallowed'], - 'MCHAT_STATIC_MESSAGE' => !empty($mchat_row['static_message']) ? $mchat_row['static_message'] : $mchat_config['static_message'], - 'MCHAT_INDEX_HEIGHT' => !empty($mchat_row['index_height']) ? $mchat_row['index_height'] : $mchat_config['index_height'], - 'MCHAT_CUSTOM_HEIGHT' => !empty($mchat_row['custom_height']) ? $mchat_row['custom_height'] : $mchat_config['custom_height'], - 'MCHAT_OVERRIDE_SMILIE_LIMIT' => !empty($mchat_row['override_smilie_limit']) ? $mchat_row['override_smilie_limit'] : $mchat_config['override_smilie_limit'], - 'MCHAT_OVERRIDE_MIN_POST_CHARS' => !empty($mchat_row['override_min_post_chars']) ? $mchat_row['override_min_post_chars'] : $mchat_config['override_min_post_chars'], - 'MCHAT_TIMEOUT' => !empty($mchat_row['timeout']) ? $mchat_row['timeout'] : $mchat_config['timeout'], - 'MCHAT_NEW_POSTS' => ($mchat_new_posts) ? true : false, - 'MCHAT_NEW_POSTS_TOPIC' => ($mchat_new_posts_topic) ? true : false, - 'MCHAT_NEW_POSTS_REPLY' => ($mchat_new_posts_reply) ? true : false, - 'MCHAT_NEW_POSTS_EDIT' => ($mchat_new_posts_edit) ? true : false, - 'MCHAT_NEW_POSTS_QUOTE' => ($mchat_new_posts_quote) ? true : false, - 'MCHAT_PAUSE_ON_INPUT' => !empty($mchat_row['pause_on_input']) ? $mchat_row['pause_on_input'] : $mchat_config['pause_on_input'], - 'L_MCHAT_BBCODES_DISALLOWED_EXPLAIN' => sprintf($user->lang['MCHAT_BBCODES_DISALLOWED_EXPLAIN'], 'session_id) . '">', ''), - 'L_MCHAT_TIMEOUT_EXPLAIN' => sprintf($user->lang['MCHAT_USER_TIMEOUT_EXPLAIN'],'session_id) . '">', '', $config['session_length']), - 'S_MCHAT_DATEFORMAT_OPTIONS' => $dateformat_options, - 'S_CUSTOM_DATEFORMAT' => $s_custom, - - 'U_ACTION' => $this->u_action) - ); - - } + } } \ No newline at end of file diff --git a/composer.json b/composer.json index 9c40a40..75d7ebd 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.14", + "version": "0.1.0", "time": "2015-03-10", "keywords": ["phpbb", "extension", "mchat"], "license": "GPL-2.0", diff --git a/config/services.yml b/config/services.yml index 79bac80..794a9d3 100644 --- a/config/services.yml +++ b/config/services.yml @@ -1,4 +1,25 @@ +imports: + - { resource: tables.yml } + services: + dmzx.mchat.admin.controller: + class: dmzx\mchat\controller\admin_controller + arguments: + - @dmzx.mchat.functions_mchat + - @config + - @controller.helper + - @template + - @log + - @user + - @service_container + - @auth + - @dbal.conn + - @cache + - @request + - %core.root_path% + - %core.php_ext% + - %core.table_prefix% + - %dmzx.mchat.table.mchat_config% dmzx.mchat.controller: class: dmzx\mchat\controller\mchat arguments: @@ -17,10 +38,12 @@ services: - @auth - @dbal.conn - @cache + - @pagination - @request - %core.root_path% - %core.php_ext% - %core.table_prefix% + - %dmzx.mchat.table.mchat% dmzx.mchat.functions_mchat: class: dmzx\mchat\core\functions_mchat arguments: @@ -31,6 +54,9 @@ services: - @dbal.conn - @cache - %core.table_prefix% + - %dmzx.mchat.table.mchat% + - %dmzx.mchat.table.mchat_config% + - %dmzx.mchat.table.mchat_sessions% dmzx.mchat.listener: class: dmzx\mchat\event\listener arguments: @@ -44,5 +70,6 @@ services: - %core.root_path% - %core.php_ext% - %core.table_prefix% + - %dmzx.mchat.table.mchat% tags: - - { name: event.listener } + - { name: event.listener } \ No newline at end of file diff --git a/config/tables.yml b/config/tables.yml new file mode 100644 index 0000000..2e6748f --- /dev/null +++ b/config/tables.yml @@ -0,0 +1,4 @@ +parameters: + dmzx.mchat.table.mchat: %core.table_prefix%mchat + dmzx.mchat.table.mchat_config: %core.table_prefix%mchat_config + dmzx.mchat.table.mchat_sessions: %core.table_prefix%mchat_sessions \ No newline at end of file diff --git a/controller/admin_controller.php b/controller/admin_controller.php new file mode 100644 index 0000000..f0c9147 --- /dev/null +++ b/controller/admin_controller.php @@ -0,0 +1,294 @@ +functions_mchat = $container->get('dmzx.mchat.functions_mchat'); + $this->config = $config; + $this->config_text = $container->get('config_text'); + $this->db = $db; + $this->request = $request; + $this->template = $template; + $this->user = $user; + $this->container = $container; + $this->cache = $cache; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $phpEx; + $this->table_prefix = $container->getParameter('core.table_prefix'); + $this->mchat_config_table = $mchat_config_table; + } + + /** + * Display the options a user can configure for this extension + * + * @return null + * @access public + */ + public function display_options() + { + add_form_key('acp_mchat'); + + $mchat_row = array( + 'location' => $this->request->variable('mchat_location', 0), + 'refresh' => $this->request->variable('mchat_refresh', 0), + 'message_limit' => $this->request->variable('mchat_message_limit', 0), + 'message_num' => $this->request->variable('mchat_message_num', 0), + 'archive_limit' => $this->request->variable('mchat_archive_limit', 0), + 'flood_time' => $this->request->variable('mchat_flood_time', 0), + 'max_message_lngth' => $this->request->variable('mchat_max_message_lngth', 0), + 'custom_page' => $this->request->variable('mchat_custom_page', 0), + 'date' => $this->request->variable('mchat_date', '', true), + 'whois' => $this->request->variable('mchat_whois', 0), + 'whois_refresh' => $this->request->variable('mchat_whois_refresh', 0), + 'bbcode_disallowed' => utf8_normalize_nfc($this->request->variable('mchat_bbcode_disallowed', '', true)), + 'prune_enable' => $this->request->variable('mchat_prune_enable', 0), + 'prune_num' => $this->request->variable('mchat_prune_num', 0), + 'index_height' => $this->request->variable('mchat_index_height', 0), + 'custom_height' => $this->request->variable('mchat_custom_height', 0), + 'static_message' => utf8_normalize_nfc($this->request->variable('mchat_static_message', '', true)), + 'override_min_post_chars' => $this->request->variable('mchat_override_min_post_chars', 0), + 'override_smilie_limit' => $this->request->variable('mchat_override_smilie_limit', 0), + 'timeout' => $this->request->variable('mchat_timeout', 0), + 'pause_on_input' => $this->request->variable('mchat_pause_on_input', 0), + 'rules' => utf8_normalize_nfc($this->request->variable('mchat_rules', '', true)), + 'avatars' => $this->request->variable('mchat_avatars', 0), + ); + + if ($this->request->is_set_post('submit')) + { + if (!function_exists('validate_data')) + { + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + // validate the entries...most of them anyway + $mchat_array = array( + 'static_message' => array('string', false, 0, 255), + 'index_height' => array('num', false, 50, 1000), + 'custom_height' => array('num', false, 50, 1000), + 'whois_refresh' => array('num', false, 30, 300), + 'refresh' => array('num', false, 5, 60), + 'message_limit' => array('num', false, 10, 30), + 'message_num' => array('num', false, 10, 50), + 'archive_limit' => array('num', false, 25, 50), + 'flood_time' => array('num', false, 0, 30), + 'max_message_lngth' => array('num', false, 0, 500), + 'timeout' => array('num', false, 0, (int) $this->config['session_length']), + 'rules' => array('string', false, 0, 255), + ); + + $error = validate_data($mchat_row, $mchat_array); + + if (!check_form_key('acp_mchat')) + { + $error[] = 'FORM_INVALID'; + } + + // Replace "error" strings with their real, localised form + $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$this->user->lang['\\1'])) ? \$this->user->lang['\\1'] : '\\1'", $error); + + if (!sizeof($error)) + { + foreach ($mchat_row as $config_name => $config_value) + { + $sql = 'UPDATE ' . $this->mchat_config_table . " + SET config_value = '" . $this->db->sql_escape($config_value) . "' + WHERE config_name = '" . $this->db->sql_escape($config_name) . "'"; + $this->db->sql_query($sql); + } + + // Set the options the user configured + $this->set_options(); + + // and an entry into the log table + $log = $this->container->get('log'); + $log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_CONFIG_UPDATE'); + + // purge the cache + $this->cache->destroy('_mchat_config'); + + // rebuild the cache + $this->functions_mchat->mchat_cache(); + + trigger_error($this->user->lang['MCHAT_CONFIG_SAVED'] . adm_back_link($this->u_action)); + } + } + + // let's get it on + $sql = 'SELECT * FROM ' . $this->mchat_config_table; + $result = $this->db->sql_query($sql); + $mchat_config = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $mchat_config[$row['config_name']] = $row['config_value']; + } + $this->db->sql_freeresult($result); + + $mchat_enable = isset($this->config['mchat_enable']) ? $this->config['mchat_enable'] : 0; + $mchat_on_index = isset($this->config['mchat_on_index']) ? $this->config['mchat_on_index'] : 0; + $mchat_version = isset($this->config['mchat_version']) ? $this->config['mchat_version'] : ''; + $mchat_new_posts = isset($this->config['mchat_new_posts']) ? $this->config['mchat_new_posts'] : 0; + $mchat_new_posts_topic = isset($this->config['mchat_new_posts_topic']) ? $this->config['mchat_new_posts_topic'] : 0; + $mchat_new_posts_reply = isset($this->config['mchat_new_posts_reply']) ? $this->config['mchat_new_posts_reply'] : 0; + $mchat_new_posts_edit = isset($this->config['mchat_new_posts_edit']) ? $this->config['mchat_new_posts_edit'] : 0; + $mchat_new_posts_quote = isset($this->config['mchat_new_posts_quote']) ? $this->config['mchat_new_posts_quote'] : 0; + $mchat_stats_index = isset($this->config['mchat_stats_index']) ? $this->config['mchat_stats_index'] : 0; + $mchat_message_top = isset($this->config['mchat_message_top']) ? $this->config['mchat_message_top'] : 0; + + $dateformat_options = ''; + foreach ($this->user->lang['dateformats'] as $format => $null) + { + $dateformat_options .= ''; + } + + $s_custom = false; + $dateformat_options .= ''; + + $this->template->assign_vars(array( + 'MCHAT_ERROR' => isset($error) ? ((sizeof($error)) ? implode('
', $error) : '') : '', + 'MCHAT_VERSION' => $mchat_version, + 'MCHAT_PRUNE' => !empty($mchat_row['prune_enable']) ? $mchat_row['prune_enable'] : $mchat_config['prune_enable'], + 'MCHAT_PRUNE_NUM' => !empty($mchat_row['prune_num']) ? $mchat_row['prune_num'] : $mchat_config['prune_num'], + 'MCHAT_ENABLE' => ($mchat_enable) ? true : false, + 'MCHAT_ON_INDEX' => ($mchat_on_index) ? true : false, + 'MCHAT_MESSAGE_TOP' => ($mchat_message_top) ? true : false, + 'MCHAT_LOCATION' => !empty($mchat_row['location']) ? $mchat_row['location'] : $mchat_config['location'], + 'MCHAT_REFRESH' => !empty($mchat_row['refresh']) ? $mchat_row['refresh'] : $mchat_config['refresh'], + 'MCHAT_WHOIS_REFRESH' => !empty($mchat_row['whois_refresh']) ? $mchat_row['whois_refresh'] : $mchat_config['whois_refresh'], + 'MCHAT_MESSAGE_LIMIT' => !empty($mchat_row['message_limit']) ? $mchat_row['message_limit'] : $mchat_config['message_limit'], + 'MCHAT_MESSAGE_NUM' => !empty($mchat_row['message_num']) ? $mchat_row['message_num'] : $mchat_config['message_num'], + 'MCHAT_ARCHIVE_LIMIT' => !empty($mchat_row['archive_limit']) ? $mchat_row['archive_limit'] : $mchat_config['archive_limit'], + 'MCHAT_AVATARS' => !empty($mchat_row['avatars']) ? $mchat_row['avatars'] : $mchat_config['avatars'], + 'MCHAT_FLOOD_TIME' => !empty($mchat_row['flood_time']) ? $mchat_row['flood_time'] : $mchat_config['flood_time'], + 'MCHAT_MAX_MESSAGE_LNGTH' => !empty($mchat_row['max_message_lngth']) ? $mchat_row['max_message_lngth'] : $mchat_config['max_message_lngth'], + 'MCHAT_CUSTOM_PAGE' => !empty($mchat_row['custom_page']) ? $mchat_row['custom_page'] : $mchat_config['custom_page'], + 'MCHAT_DATE' => !empty($mchat_row['date']) ? $mchat_row['date'] : $mchat_config['date'], + 'MCHAT_DEFAULT_DATEFORMAT' => $this->config['default_dateformat'], + 'MCHAT_RULES' => !empty($mchat_row['rules']) ? $mchat_row['rules'] : $mchat_config['rules'], + 'MCHAT_WHOIS' => !empty($mchat_row['whois']) ? $mchat_row['whois'] : $mchat_config['whois'], + 'MCHAT_STATS_INDEX' => ($mchat_stats_index) ? true : false, + 'MCHAT_BBCODE_DISALLOWED' => !empty($mchat_row['bbcode_disallowed']) ? $mchat_row['bbcode_disallowed'] : $mchat_config['bbcode_disallowed'], + 'MCHAT_STATIC_MESSAGE' => !empty($mchat_row['static_message']) ? $mchat_row['static_message'] : $mchat_config['static_message'], + 'MCHAT_INDEX_HEIGHT' => !empty($mchat_row['index_height']) ? $mchat_row['index_height'] : $mchat_config['index_height'], + 'MCHAT_CUSTOM_HEIGHT' => !empty($mchat_row['custom_height']) ? $mchat_row['custom_height'] : $mchat_config['custom_height'], + 'MCHAT_OVERRIDE_SMILIE_LIMIT' => !empty($mchat_row['override_smilie_limit']) ? $mchat_row['override_smilie_limit'] : $mchat_config['override_smilie_limit'], + 'MCHAT_OVERRIDE_MIN_POST_CHARS' => !empty($mchat_row['override_min_post_chars']) ? $mchat_row['override_min_post_chars'] : $mchat_config['override_min_post_chars'], + 'MCHAT_TIMEOUT' => !empty($mchat_row['timeout']) ? $mchat_row['timeout'] : $mchat_config['timeout'], + 'MCHAT_NEW_POSTS' => ($mchat_new_posts) ? true : false, + 'MCHAT_NEW_POSTS_TOPIC' => ($mchat_new_posts_topic) ? true : false, + 'MCHAT_NEW_POSTS_REPLY' => ($mchat_new_posts_reply) ? true : false, + 'MCHAT_NEW_POSTS_EDIT' => ($mchat_new_posts_edit) ? true : false, + 'MCHAT_NEW_POSTS_QUOTE' => ($mchat_new_posts_quote) ? true : false, + 'MCHAT_PAUSE_ON_INPUT' => !empty($mchat_row['pause_on_input']) ? $mchat_row['pause_on_input'] : $mchat_config['pause_on_input'], + 'L_MCHAT_BBCODES_DISALLOWED_EXPLAIN' => sprintf($this->user->lang['MCHAT_BBCODES_DISALLOWED_EXPLAIN'], 'phpbb_root_path}index.$this->php_ext", 'i=bbcodes', true, $this->user->session_id) . '">', ''), + 'L_MCHAT_TIMEOUT_EXPLAIN' => sprintf($this->user->lang['MCHAT_USER_TIMEOUT_EXPLAIN'],'phpbb_root_path}index.$this->php_ext", 'i=board&mode=load', true, $this->user->session_id) . '">', '', $this->config['session_length']), + 'S_MCHAT_DATEFORMAT_OPTIONS' => $dateformat_options, + 'S_CUSTOM_DATEFORMAT' => $s_custom, + + 'U_ACTION' => $this->u_action) + ); + + } + /** + * Set the options a user can configure + * + * @return null + * @access protected + */ + protected function set_options() + { + + //update setting in config table for mod enabled or not + $this->config->set('mchat_enable', $this->request->variable('mchat_enable', 0)); + // update setting in config table for allowing on index or not + $this->config->set('mchat_on_index', $this->request->variable('mchat_on_index', 0)); + // update setting in config table to enable posts to display or not + $this->config->set('mchat_new_posts', $this->request->variable('mchat_new_posts', 0)); + // update setting in config table to allow topic to display or not + $this->config->set('mchat_new_posts_topic', $this->request->variable('mchat_new_posts_topic', 0)); + // update setting in config table to allow replies to display or not + $this->config->set('mchat_new_posts_reply', $this->request->variable('mchat_new_posts_reply', 0)); + // update setting in config table to allow edit posts to display or not + $this->config->set('mchat_new_posts_edit', $this->request->variable('mchat_new_posts_edit', 0)); + // update setting in config table to allow quoted posts to display or not + $this->config->set('mchat_new_posts_quote', $this->request->variable('mchat_new_posts_quote', 0)); + // update setting in config table for stats on index + $this->config->set('mchat_stats_index', $this->request->variable('mchat_stats_index', 0)); + // update setting in config table for message on top + $this->config->set('mchat_message_top', $this->request->variable('mchat_message_top', 0)); + + } + /** + * Set page url + * + * @param string $u_action Custom form action + * @return null + * @access public + */ + public function set_page_url($u_action) + { + $this->u_action = $u_action; + } +} \ No newline at end of file diff --git a/core/functions_mchat.php b/core/functions_mchat.php index b332ac2..82fdddb 100644 --- a/core/functions_mchat.php +++ b/core/functions_mchat.php @@ -11,18 +11,6 @@ namespace dmzx\mchat\core; class functions_mchat { - /** - * CONSTANTS SECTION - * - * To access them, you need to use the class. - * - */ - const MCHAT_CONFIG_TABLE = 'mchat_config'; - const MCHAT_TABLE = 'mchat'; - const MCHAT_SESSIONS_TABLE = 'mchat_sessions'; - /** - * End of constants - */ /** @var \phpbb\template\template */ protected $template; @@ -41,6 +29,17 @@ class functions_mchat protected $table_prefix; + /** + * The database tables + * + * @var string + */ + protected $mchat_table; + + protected $mchat_config_table; + + protected $mchat_sessions_table; + /** * Constructor * @@ -51,7 +50,7 @@ class functions_mchat * @param \phpbb\cache\service $cache * @param $table_prefix */ - public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $table_prefix) + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $table_prefix, $mchat_table, $mchat_config_table, $mchat_sessions_table) { $this->template = $template; $this->user = $user; @@ -60,6 +59,9 @@ class functions_mchat $this->cache = $cache; $this->phpbb_log = $log; $this->table_prefix = $table_prefix; + $this->mchat_table = $mchat_table; + $this->mchat_config_table = $mchat_config_table; + $this->mchat_sessions_table = $mchat_sessions_table; } // mchat_cache @@ -71,7 +73,7 @@ class functions_mchat // Grab the config entries in teh ACP...and cache em :P if (($config_mchat = $this->cache->get('_mchat_config')) === false) { - $sql = 'SELECT * FROM ' . $this->table_prefix . self::MCHAT_CONFIG_TABLE; + $sql = 'SELECT * FROM ' . $this->mchat_config_table; $result = $this->db->sql_query($sql); $config_mchat = array(); while ($row = $this->db->sql_fetchrow($result)) @@ -91,7 +93,7 @@ class functions_mchat */ function mchat_user_fix($user_id) { - $sql = 'UPDATE ' . $this->table_prefix . self::MCHAT_TABLE . ' + $sql = 'UPDATE ' . $this->mchat_table . ' SET user_id = ' . ANONYMOUS . ' WHERE user_id = ' . (int) $user_id; $this->db->sql_query($sql); @@ -142,7 +144,7 @@ class functions_mchat { $check_time = time() - (int) $session_time; - $sql = 'DELETE FROM ' . $this->table_prefix . self::MCHAT_SESSIONS_TABLE . ' WHERE user_lastupdate < ' . $check_time; + $sql = 'DELETE FROM ' . $this->mchat_sessions_table . ' WHERE user_lastupdate < ' . $check_time; $this->db->sql_query($sql); // add the user into the sessions upon first visit @@ -155,7 +157,7 @@ class functions_mchat $mchat_user_list = ''; $sql = 'SELECT m.user_id, u.username, u.user_type, u.user_allow_viewonline, u.user_colour - FROM ' . $this->table_prefix . self::MCHAT_SESSIONS_TABLE . ' m + FROM ' . $this->mchat_sessions_table . ' m LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id WHERE m.user_lastupdate > ' . $check_time . ' ORDER BY u.username ASC'; @@ -206,13 +208,13 @@ class functions_mchat function mchat_sessions($session_time) { $check_time = time() - (int) $session_time; - $sql = 'DELETE FROM ' . $this->table_prefix . self::MCHAT_SESSIONS_TABLE . ' WHERE user_lastupdate <' . $check_time; + $sql = 'DELETE FROM ' . $this->mchat_sessions_table . ' WHERE user_lastupdate <' . $check_time; $this->db->sql_query($sql); // insert user into the mChat sessions table if ($this->user->data['user_type'] == USER_FOUNDER || $this->user->data['user_type'] == USER_NORMAL) { - $sql = 'SELECT * FROM ' . $this->table_prefix . self::MCHAT_SESSIONS_TABLE . ' WHERE user_id =' . (int) $this->user->data['user_id']; + $sql = 'SELECT * FROM ' . $this->mchat_sessions_table . ' WHERE user_id =' . (int) $this->user->data['user_id']; $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); @@ -223,7 +225,7 @@ class functions_mchat 'user_id' => $this->user->data['user_id'], 'user_lastupdate' => time(), ); - $sql = 'INSERT INTO ' . $this->table_prefix . self::MCHAT_SESSIONS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); + $sql = 'INSERT INTO ' . $this->mchat_sessions_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); $this->db->sql_query($sql); } else @@ -231,7 +233,7 @@ class functions_mchat $sql_ary = array( 'user_lastupdate' => time(), ); - $sql = 'UPDATE ' . $this->table_prefix . self::MCHAT_SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id =' . (int) $this->user->data['user_id']; + $sql = 'UPDATE ' . $this->mchat_sessions_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id =' . (int) $this->user->data['user_id']; $this->db->sql_query($sql); } } @@ -249,7 +251,7 @@ class functions_mchat return; } - $sql = 'DELETE FROM ' . $this->table_prefix . self::MCHAT_TABLE . ' WHERE post_id = ' . (int) $post_id; + $sql = 'DELETE FROM ' . $this->mchat_table . ' WHERE post_id = ' . (int) $post_id; $this->db->sql_query($sql); return; @@ -263,7 +265,7 @@ class functions_mchat function mchat_prune($mchat_prune_amount) { // Run query to get the total message rows... - $sql = 'SELECT COUNT(message_id) AS total_messages FROM ' . $this->table_prefix . self::MCHAT_TABLE; + $sql = 'SELECT COUNT(message_id) AS total_messages FROM ' . $this->mchat_table; $result = $this->db->sql_query($sql); $mchat_total_messages = (int) $this->db->sql_fetchfield('total_messages'); $this->db->sql_freeresult($result); @@ -279,7 +281,7 @@ class functions_mchat if ($prune) { - $result = $this->db->sql_query_limit('SELECT * FROM '. $this->table_prefix . self::MCHAT_TABLE . ' ORDER BY message_id ASC', 1); + $result = $this->db->sql_query_limit('SELECT * FROM '. $this->mchat_table . ' ORDER BY message_id ASC', 1); $row = $this->db->sql_fetchrow($result); $first_id = (int) $row['message_id']; @@ -289,7 +291,7 @@ class functions_mchat $delete_id = $mchat_total_messages - $mchat_prune_amount + $first_id; // let's go delete them...if the message id is less than the delete id - $sql = 'DELETE FROM ' . $this->table_prefix . self::MCHAT_TABLE . ' + $sql = 'DELETE FROM ' . $this->mchat_table . ' WHERE message_id < ' . (int) $delete_id; $this->db->sql_query($sql); diff --git a/core/render_helper.php b/core/render_helper.php index e347d01..bda3e2d 100644 --- a/core/render_helper.php +++ b/core/render_helper.php @@ -41,6 +41,12 @@ class render_helper protected $phpbb_root_path; protected $phpEx; protected $table_prefix; + /** + * The database tables + * + * @var string + */ + protected $mchat_table; /** * Constructor @@ -58,7 +64,7 @@ class render_helper * @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\log\log_interface $log, \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\functions_mchat $functions_mchat, \phpbb\config\config $config, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\log\log_interface $log, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\pagination $pagination, \phpbb\request\request $request, $phpbb_root_path, $phpEx, $table_prefix, $mchat_table) { $this->functions_mchat = $functions_mchat; $this->config = $config; @@ -68,11 +74,13 @@ class render_helper $this->auth = $auth; $this->db = $db; $this->cache = $cache; + $this->pagination = $pagination; $this->request = $request; $this->phpbb_root_path = $phpbb_root_path; $this->phpEx = $phpEx; $this->phpbb_log = $log; $this->table_prefix = $table_prefix; + $this->mchat_table = $mchat_table; } /** @@ -160,7 +168,7 @@ class render_helper foreach ($mchat_rules as $mchat_rule) { - $mchat_rule = htmlspecialchars($mchat_rule); + $mchat_rule = utf8_htmlspecialchars($mchat_rule); $this->template->assign_block_vars('rule', array( 'MCHAT_RULE' => $mchat_rule, )); @@ -234,7 +242,7 @@ class render_helper if(confirm_box(true)) { // Run cleaner - $sql = 'TRUNCATE TABLE ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE; + $sql = 'TRUNCATE TABLE ' . $this->mchat_table; $this->db->sql_query($sql); meta_refresh(3, $mchat_redirect); @@ -264,7 +272,7 @@ class render_helper 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; + $sql = 'SELECT COUNT(message_id) AS messages FROM ' . $this->mchat_table; $result = $this->db->sql_query($sql); $mchat_total_messages = $this->db->sql_fetchfield('messages'); $this->db->sql_freeresult($result); @@ -279,7 +287,7 @@ class render_helper $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 + FROM ' . $this->mchat_table . ' m LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id ' . $sql_where . ' ORDER BY m.message_id DESC'; @@ -341,15 +349,19 @@ class render_helper } // 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; + $sql = 'SELECT COUNT(message_id) AS mess_id FROM ' . $this->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... + $pagination_url = $this->helper->route('dmzx_mchat_controller', array('mode' => 'archive')); + + $start = $this->request->variable('start', 0); + $this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $mchat_total_message, (int) $this->config_mchat['archive_limit'], $mchat_archive_start); + $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 @@ -382,7 +394,7 @@ class render_helper $mchat_message_last_id = $this->request->variable('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 + FROM ' . $this->mchat_table . ' m, ' . USERS_TABLE . ' u WHERE m.user_id = u.user_id AND m.message_id > ' . (int) $mchat_message_last_id . ' ' . $sql_and . ' @@ -532,7 +544,7 @@ class render_helper 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 . ' + $sql = 'SELECT message_time FROM ' . $this->mchat_table . ' WHERE user_id = ' . (int) $this->user->data['user_id'] . ' ORDER BY message_time DESC'; $result = $this->db->sql_query_limit($sql, 1); @@ -594,7 +606,7 @@ class render_helper '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); + $sql = 'INSERT INTO ' . $this->mchat_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); $this->db->sql_query($sql); // reset the config settings @@ -638,7 +650,7 @@ class render_helper // check for the correct user $sql = 'SELECT * - FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' + FROM ' . $this->mchat_table . ' WHERE message_id = ' . (int) $message_id; $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); @@ -717,13 +729,13 @@ class render_helper 'bbcode_options' => $options ); - $sql = 'UPDATE ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary).' + $sql = 'UPDATE ' . $this->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 + FROM ' . $this->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'; @@ -793,7 +805,7 @@ class render_helper } // 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 + FROM ' . $this->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); @@ -811,7 +823,7 @@ class render_helper } // Run delete! - $sql = 'DELETE FROM ' . $this->table_prefix . \dmzx\mchat\core\functions_mchat::MCHAT_TABLE . ' + $sql = 'DELETE FROM ' . $this->mchat_table . ' WHERE message_id = ' . (int) $message_id; $this->db->sql_query($sql); //adds a log @@ -857,7 +869,7 @@ class render_helper // user has permissions to view the custom chat? if (!$mchat_view && $mchat_custom_page) { - trigger_error($user->lang['NOT_AUTHORISED'], E_USER_NOTICE); + trigger_error('NOT_AUTHORISED', E_USER_NOTICE); } // if whois true @@ -917,7 +929,7 @@ class render_helper $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 + FROM ' . $this->mchat_table . ' m LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id ' . $sql_where . ' ORDER BY message_id DESC'; diff --git a/event/listener.php b/event/listener.php index 0894820..0ce8ca6 100644 --- a/event/listener.php +++ b/event/listener.php @@ -40,8 +40,14 @@ class listener implements EventSubscriberInterface /** @var \phpbb\controller\helper */ protected $controller_helper; + /** + * The database tables + * + * @var string + */ + protected $mchat_table; - 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, $phpEx, $table_prefix) + 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, $phpEx, $table_prefix,$mchat_table) { $this->render_helper = $render_helper; $this->auth = $auth; @@ -53,6 +59,7 @@ class listener implements EventSubscriberInterface $this->root_path = $root_path; $this->phpEx = $phpEx; $this->table_prefix = $table_prefix; + $this->mchat_table = $mchat_table; } @@ -156,8 +163,8 @@ class listener implements EventSubscriberInterface $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage generate_text_for_storage($message, $uid, $bitfield, $options, true, false, false); $sql_ary = array( - 'forum_id' => $event['forum_id'], - 'post_id' => $event['post_id'], + 'forum_id' => $event['forum_id'], + 'post_id' => $event['post_id'], 'user_id' => $this->user->data['user_id'], 'user_ip' => $this->user->data['session_ip'], 'message' => $message, @@ -166,9 +173,9 @@ class listener implements EventSubscriberInterface '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); + $sql = 'INSERT INTO ' . $this->mchat_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); $this->db->sql_query($sql); - } + } } diff --git a/language/pt/common.php b/language/pt/common.php new file mode 100644 index 0000000..1a23cc0 --- /dev/null +++ b/language/pt/common.php @@ -0,0 +1,135 @@ + 'Mini-Chat', + 'MCHAT_ADD' => 'Enviar', + 'MCHAT_IN' => 'em', + 'MCHAT_IN_SECTION' => 'seção', + 'MCHAT_LIKES' => 'Eu gosta desta mensagem', + 'MCHAT_ANNOUNCEMENT' => 'Anuncio', + 'MCHAT_ARCHIVE' => 'Arquivo', + 'MCHAT_ARCHIVE_PAGE' => 'Arquivo de Mini-Chat', + 'MCHAT_BBCODES' => 'BBCodes', + 'MCHAT_CLEAN' => 'Purgar', + 'MCHAT_CLEANED' => 'Todas as mensagens foram apagados', + 'MCHAT_CLEAR_INPUT' => 'Reset', + 'MCHAT_COPYRIGHT' => 'RMcGirr83 © dmzx', + 'MCHAT_CUSTOM_BBCODES' => 'BBCodes personalizados', + 'MCHAT_DELALLMESS' => 'Apagar todas as mensagens?', + 'MCHAT_DELCONFIRM' => 'Confirmar a eliminacão?', + 'MCHAT_DELITE' => 'Excluir', + 'MCHAT_EDIT' => 'Editar', + 'MCHAT_EDITINFO' => 'Editar a mensagem e clik em OK', + 'MCHAT_ENABLE' => 'Perdão, o Mini-Chat actualmente no está disponível', + 'MCHAT_ERROR' => 'Error', + 'MCHAT_FLOOD' => 'Você não pode enviar outra mensagem tão rapido, depois de enviar a última', + 'MCHAT_FOE' => 'Esta mensagem foi criada por %1$s que se encontra actualmente na sua lista de ignorados.', + 'MCHAT_HELP' => 'mChat Regras', + 'MCHAT_HIDE_LIST' => 'Ocultar lista', + 'MCHAT_HOUR' => 'hora ', + 'MCHAT_HOURS' => 'horas ', + 'MCHAT_IP' => 'IP whois para', + 'MCHAT_MINUTE' => 'minuto ', + 'MCHAT_MINUTES' => 'minutos ', + 'MCHAT_MESS_LONG' => 'Sua mensagem é muito longo.\nPor favor, o limite está em %s caracteres', + 'MCHAT_NO_CUSTOM_PAGE' => 'A página personalizada de mChat não está activada neste momento!', + 'MCHAT_NOACCESS' => 'Nâo tem permissões para enviar mensagens no mChat', + 'MCHAT_NO_RULES' => 'A página de regras mChat não é ativado neste momento!', + 'MCHAT_NOACCESS_ARCHIVE' => 'Não tem permissões para ver o arquivo', + 'MCHAT_NOJAVASCRIPT' => 'O seu navegador não suporta JavaScript o JavaScript esta desactivado', + 'MCHAT_NOMESSAGE' => 'Não há mensagens', + 'MCHAT_NOMESSAGEINPUT' => 'Você deve digitar uma mensagem', + 'MCHAT_NOSMILE' => 'Nenhum emoticons encontrados', + 'MCHAT_NOTINSTALLED_USER' => 'mChat não esta instalado. Por favor, avise o fundador do fórum.', + 'MCHAT_NOT_INSTALLED' => 'Faltam entradas na base de dados do mChat .
Por favor, corra o %sinstalador%s para criar mudanças de modificação na base de dados.', + 'MCHAT_OK' => 'OK', + 'MCHAT_PAUSE' => 'Pausado', + 'MCHAT_LOAD' => 'Cargando', + 'MCHAT_PERMISSIONS' => 'Alterar permissões de usuario', + 'MCHAT_REFRESHING' => 'Recarregar...', + 'MCHAT_REFRESH_NO' => 'Atualização automatica está desligada', + 'MCHAT_REFRESH_YES' => 'Atualizar a cada %d segundos', + 'MCHAT_RESPOND' => 'Responder ao usuario', + 'MCHAT_RESET_QUESTION' => 'Limpar a area de entrada?', + 'MCHAT_SESSION_OUT' => 'A sessão do Chat expirou', + 'MCHAT_SHOW_LIST' => 'Mostrar lista', + 'MCHAT_SECOND' => 'segundo ', + 'MCHAT_SECONDS' => 'segundos ', + 'MCHAT_SESSION_ENDS' => 'A sessão do Chat finaliza em', + 'MCHAT_SMILES' => 'Emoções', + 'MCHAT_TOTALMESSAGES' => 'Total mensagens: %s', + 'MCHAT_USESOUND' => 'Activar som', + 'MCHAT_ONLINE_USERS_TOTAL' => 'No total há %d usuarios conversando ', + 'MCHAT_ONLINE_USER_TOTAL' => 'No total há %d usuario conversando ', + 'MCHAT_NO_CHATTERS' => 'Ninguém conversando', + 'MCHAT_ONLINE_EXPLAIN' => '( baseada em usuários ativos nos últimos %s)', + 'WHO_IS_CHATTING' => 'Quem esta conversando', + 'WHO_IS_REFRESH_EXPLAIN' => 'Recarregar a cada %d segundos', + 'MCHAT_NEW_TOPIC' => 'Novo Tópico ', + 'MCHAT_NEW_REPLY' => 'Nova Resposta', + 'MCHAT_NEW_QUOTE' => 'Resposta Citando', + 'MCHAT_NEW_EDIT' => 'Editado', + // UCP + 'UCP_PROFILE_MCHAT' => 'Preferencias do mChat', + 'DISPLAY_MCHAT' => 'Mostrar mChat no índice', + 'SOUND_MCHAT' => 'Activar som no mChat', + 'DISPLAY_STATS_INDEX' => 'Mostrar estatísticas de quem esta conversando na página índice', + 'DISPLAY_NEW_TOPICS' => 'Mostrar novos topicos no Chat', + 'DISPLAY_AVATARS' => 'Mostrar avatars no Chat', + 'CHAT_AREA' => 'Tipo de entrada', + 'CHAT_AREA_EXPLAIN' => 'Escolher que tipo de área utilizada no bate-papo de entrada:
área de texto o
uma área de entrada (uma línha).', + 'INPUT_AREA' => 'Área de entrada (linha)', + 'TEXT_AREA' => 'Área de texto', + 'UCP_CAT_MCHAT' => 'mChat', + 'UCP_MCHAT_CONFIG' => 'mChat', + //Preferences + 'LOG_MCHAT_TABLE_PRUNED' => 'A tabela do mChat foi apagada', + 'ACP_USER_MCHAT' => 'Ajustes do mChat', + 'LOG_DELETED_MCHAT' => 'Mensagem do mChat apagado
» %1$s', + 'LOG_EDITED_MCHAT' => 'Mensagem do mChat editado
» %1$s', + 'MCHAT_MESSAGE_LNGTH_EXPLAIN' => 'Caracteres restantes: %d', + 'MCHAT_TOP_POSTERS' => 'Top Spammers', + 'MCHAT_NEW_CHAT' => 'Nova mensagem no Chat!', + 'MCHAT_SEND_PM' => 'Enviar mensagem privado', + 'MCHAT_PM' => '(MP)', + + //Custom edits + 'REPLY_WITH_LIKE' =>'Eu gosto desta mensagem', +)); diff --git a/language/pt/info_acp_mchat.php b/language/pt/info_acp_mchat.php new file mode 100644 index 0000000..77f5b13 --- /dev/null +++ b/language/pt/info_acp_mchat.php @@ -0,0 +1,173 @@ + 'Configuração', + 'ACP_CAT_MCHAT' => 'mChat', + 'ACP_MCHAT_TITLE' => 'Mini-Chat', + 'ACP_MCHAT_TITLE_EXPLAIN' => 'Um mini chat (aka “Caja de texto”) para o teu forum', + 'MCHAT_TABLE_DELETED' => 'A tabela mChat foi excluído com sucesso', + 'MCHAT_TABLE_CREATED' => 'A tabela mChat foi criado com sucesso', + 'MCHAT_TABLE_UPDATED' => 'A tabela mChat foi atualizado com sucesso', + 'MCHAT_NOTHING_TO_UPDATE' => 'Nada que ver... Contunia', + 'UCP_CAT_MCHAT' => 'Preferencias de mChat', + 'UCP_MCHAT_CONFIG' => 'Preferencias de usuario de mChat', + + // ACP entries + 'ACP_MCHAT_RULES' => 'Regras', + 'ACP_MCHAT_RULES_EXPLAIN' => 'Intruduzir as regras do forum aquí. Cada regra numa nova línha.
Está limitado a 255 caracteres.
Esta mensagem pode ser traduzida. (hay que editar el archivo mchat_lang.php y lea las instrucciones).', + 'LOG_MCHAT_CONFIG_UPDATE' => 'Atualizar configurações de mChat', + 'MCHAT_CONFIG_SAVED' => 'Configuração Mini Chat foi atualizado', + 'MCHAT_TITLE' => 'Mini-Chat', + 'MCHAT_VERSION' => 'Versión:', + 'MCHAT_ENABLE' => 'Activar mChat MOD', + 'MCHAT_ENABLE_EXPLAIN' => 'Activar o desactivar o mod a nivel global.', + 'MCHAT_AVATARS' => 'Mostrar avatars', + 'MCHAT_AVATARS_EXPLAIN' => 'Se marcar como sim, os avatars serão mostrados em modo pequeno', + 'MCHAT_ON_INDEX' => 'mChat no Index', + 'MCHAT_ON_INDEX_EXPLAIN' => 'Permitir a exibição do mChat na página de índice.', + 'MCHAT_INDEX_HEIGHT' => 'Altura da página índice', + 'MCHAT_INDEX_HEIGHT_EXPLAIN' => 'A altura da caixa de bate-papo em pixels na página de índice do fórum.
Está limitado de 50 a 1000.', + 'MCHAT_LOCATION' => 'Localização no Fórum', + 'MCHAT_LOCATION_EXPLAIN' => 'Escolha o local do mChat na página de índice.', + 'MCHAT_TOP_OF_FORUM' => 'Top do Forum', + 'MCHAT_BOTTOM_OF_FORUM' => 'Parte inferior do Forum', + 'MCHAT_REFRESH' => 'Recarregar', + 'MCHAT_REFRESH_EXPLAIN' => 'Número de segundos antes do chat se actualize automáticamente. Você está limitado a partir de 5 a 60 segundos.', + 'MCHAT_PRUNE' => 'Activar purga', + 'MCHAT_PRUNE_EXPLAIN' => 'Defina como sim para permitir la função purgar.
Só ocorre se o usuário visualiza as páginas personalizadas ou arquivo.', + 'MCHAT_PRUNE_NUM' => 'Numero de purga', + 'MCHAT_PRUNE_NUM_EXPLAIN' => 'O número de mensagens de reter no chat.', + 'MCHAT_MESSAGE_LIMIT' => 'Limite de mensagens', + 'MCHAT_MESSAGE_LIMIT_EXPLAIN' => 'O número máximo de mensagens para mostrar na área de bate-papo.
Recomendado de 10 a 30.', + 'MCHAT_MESSAGE_NUM' => 'Limite de mensagens página Index', + 'MCHAT_MESSAGE_NUM_EXPLAIN' => 'O número máximo de mensagens para mostrar na área de bate-papo na página de índice.
Recomendado de 10 a 50.', + 'MCHAT_ARCHIVE_LIMIT' => 'Limite de Archivo', + 'MCHAT_ARCHIVE_LIMIT_EXPLAIN' => 'O número máximo de mensagens para mostrar por página na página de arquivo.
Recomendado de 25 a 50.', + 'MCHAT_FLOOD_TIME' => 'Tiempo límite', + 'MCHAT_FLOOD_TIME_EXPLAIN' => 'O número de segundos que um usuário deve esperar antes de postar outra mensagem no chat.
Recomendado de 5 a 30, establecer em 0 para desabilitar.', + 'MCHAT_MAX_MESSAGE_LENGTH' => 'Maximo comprimento da mensagem', + 'MCHAT_MAX_MESSAGE_LENGTH_EXPLAIN' => 'Número máximo de caracteres permitidos por mensagem enviada.
Recomendado de 100 a 500, establece em 0 para desabilitar.', + 'MCHAT_CUSTOM_PAGE' => 'Página personalizada', + 'MCHAT_CUSTOM_PAGE_EXPLAIN' => 'Permitir o uso de de página personalizada.', + 'MCHAT_CUSTOM_HEIGHT' => 'Altura da página personalizada', + 'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => 'A altura da mini- chat, em pixels, da página personalizada mChat.
Está limitado de 50 a 1000.', + 'MCHAT_DATE_FORMAT' => 'Formato da data', + 'MCHAT_DATE_FORMAT_EXPLAIN' => 'A sintaxe utilizada é idêntica à do PHP date().', + 'MCHAT_CUSTOM_DATEFORMAT' => 'Personalizar...', + 'MCHAT_WHOIS' => 'Quem É', + 'MCHAT_WHOIS_EXPLAIN' => 'Permitir a visualização de usuários que estão conversando.', + 'MCHAT_WHOIS_REFRESH' => 'Actualizar Quem É', + 'MCHAT_WHOIS_REFRESH_EXPLAIN' => 'Número de segundos antes de actualizar a estatísticas Quem É.
Esta limitado de 30 a 300 segundos.', + 'MCHAT_BBCODES_DISALLOWED' => 'Desabilitar BBCodes', + 'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Aqui você pode inserir os bbcodes que não se vão utilizar na mensagem.
Separar BBcodes com uma barra vertical, por ejemplo:
b|i|u|code|list|list=|flash|quote and/or a %scustom bbcode tag name%s', + 'MCHAT_STATIC_MESSAGE' => 'Mensagem estática', + 'MCHAT_STATIC_MESSAGE_EXPLAIN' => 'Aquí pode definir uma mensagem estatica que se mostrara aos usuarios do chat. Código HTML é permitido
Coloque nada para desligar essa visualização. Está limitado a 255 caracteres.
Esta mensagem pode ser traduzida. (só precisa editar o arquivo mchat_lang.phpe leia as instruções).', + 'MCHAT_USER_TIMEOUT' => 'Timeout do usuario', + 'MCHAT_USER_TIMEOUT_EXPLAIN' => 'Defina a quantidade de tempo, em segundos , até que, uma sessão de usuários termina no chat. Defina como 0 para nenhum tempo limite.
Está limitado a %s Ajustes de configuración da sessões do forum%s que actualmente está en %s segundos', + 'MCHAT_OVERRIDE_SMILIE_LIMIT' => 'Substituir limite de emocões', + 'MCHAT_OVERRIDE_SMILIE_LIMIT_EXPLAIN' => 'Por em Sim, para sustituir o ajuste do limite de emoções do fórum para as mensagem do chat', + 'MCHAT_OVERRIDE_MIN_POST_CHARS' => 'Sustituir límite de caracteres minimos', + 'MCHAT_OVERRIDE_MIN_POST_CHARS_EXPLAIN' => 'Por em Sim, para sustituir os ajustes de caracteres minimos do forum, nas mensagem do chat', + 'MCHAT_NEW_POSTS' => 'Ativar exibir mensagens', + 'MCHAT_NEW_POSTS_EXPLAIN' => 'Por Sim, para permitir novas mensagens do forum na area de mensagens do chat.', + 'MCHAT_NEW_POSTS_TOPIC' => 'Exibir novas mensagens e topicos ', + 'MCHAT_NEW_POSTS_TOPIC_EXPLAIN' => 'Por Sim, para permitir novas mensagens do Topico do Fórum na area de mensagens do chat.', + 'MCHAT_NEW_POSTS_REPLY' => 'Exibir novas mensagens respondidas', + 'MCHAT_NEW_POSTS_REPLY_EXPLAIN' => 'Por sim, para permitir novas mensagens respondidas do forum na area de mensagens do chat.', + 'MCHAT_NEW_POSTS_EDIT' => 'exibir mensagens editadas', + 'MCHAT_NEW_POSTS_EDIT_EXPLAIN' => 'Por sim, para permitir mensagens editadas do forum na area de mensagens do chat.', + 'MCHAT_NEW_POSTS_QUOTE' => 'Mostrar mensagens citados', + 'MCHAT_NEW_POSTS_QUOTE_EXPLAIN' => 'Por sim, para permitir mensagens citados do forum na area de mensagens do chat.', + 'MCHAT_MAIN' => 'Configuracão principal', + 'MCHAT_STATS' => 'Quem esta conversando', + 'MCHAT_STATS_INDEX' => 'Estatísticas no Index', + 'MCHAT_STATS_INDEX_EXPLAIN' => 'Mostre quem está conversando com na seção de estatísticas do fórum', + 'MCHAT_MESSAGE_TOP' => 'Mantenha a mensagem na parte inferior/superior', + 'MCHAT_MESSAGE_TOP_EXPLAIN' => 'Este publicar a mensagem na parte inferior ou superior da area de mensagens do chat.', + 'MCHAT_BOTTOM' => 'Abaixo', + 'MCHAT_TOP' => 'Top', + 'MCHAT_MESSAGES' => 'Ajustes da mensagem', + 'MCHAT_PAUSE_ON_INPUT' => 'Pausa de entrada', + 'MCHAT_PAUSE_ON_INPUT_EXPLAIN' => 'Se colocar Sim, o Chat nao se actualizara automaticamente, mediante um utilizador introduza uma mensagem na área de entrada', + + // error reporting + 'MCHAT_NEEDS_UPDATING' => 'O MOD de mChat necesita de ser actualizado. Por favor, dê uma visita forum administrador desta seção para executar o instalador.', + 'MCHAT_WRONG_VERSION' => 'A versão do MOD instalado incorretamente. Por favor, execute o %sinstalador%s para a nova versão da modificação.', + 'WARNING' => 'Aviso', + 'TOO_LONG_DATE' => 'O formato da data que você inseriu é muito longa.', + 'TOO_SHORT_DATE' => 'O formato da data que você inseriu é muito curto.', + 'TOO_SMALL_REFRESH' => 'O valor de atualização é muito pequeno.', + 'TOO_LARGE_REFRESH' => 'O valor de atualização é muito grande.', + 'TOO_SMALL_MESSAGE_LIMIT' => 'O valor limite de mensagem é muito pequeno.', + 'TOO_LARGE_MESSAGE_LIMIT' => 'O valor limite de mensagem é muito longo.', + 'TOO_SMALL_ARCHIVE_LIMIT' => 'O valor limite do arquivo é muito curto.', + 'TOO_LARGE_ARCHIVE_LIMIT' => 'O valor limite do arquivo é muito longo.', + 'TOO_SMALL_FLOOD_TIME' => 'O valor do tempo limite é muito curto.', + 'TOO_LARGE_FLOOD_TIME' => 'O valor do tempo limite é muito longo.', + 'TOO_SMALL_MAX_MESSAGE_LNGTH' => 'O valor do máximo da mensagem é muito pequeno.', + 'TOO_LARGE_MAX_MESSAGE_LNGTH' => 'O valor do máximo da mensagem é muito longo.', + 'TOO_SMALL_MAX_WORDS_LNGTH' => 'O valor máximo de palavras é muito pequeno.', + 'TOO_LARGE_MAX_WORDS_LNGTH' => 'O valor máximo de palavras é muito grande.', + 'TOO_SMALL_WHOIS_REFRESH' => 'O valor de refresco de whois é demasiado corto.', + 'TOO_LARGE_WHOIS_REFRESH' => 'O valor de refresco de whois é demasiado largo.', + 'TOO_SMALL_INDEX_HEIGHT' => 'O valor da altura do índice é demasiado curto.', + 'TOO_LARGE_INDEX_HEIGHT' => 'O valor da altura do índice é demasiado largo.', + 'TOO_SMALL_CUSTOM_HEIGHT' => 'O valor da altura personalizada é demasiado curto.', + 'TOO_LARGE_CUSTOM_HEIGHT' => 'O valor da altura personalizada é demasiado largo.', + 'TOO_SHORT_STATIC_MESSAGE' => 'O valor da mensagem estatico é demasiado curto.', + 'TOO_LONG_STATIC_MESSAGE' => 'O valor da mensagem estatico é demasiado largo.', + 'TOO_SMALL_TIMEOUT' => 'O valor de tempo de espera do usuario é demasiado curto.', + 'TOO_LARGE_TIMEOUT' => 'O valor de tempo de espera do usuario é demasiado largo.', + + // User perms + 'ACL_U_MCHAT_USE' => 'Pode usar mChat', + 'ACL_U_MCHAT_VIEW' => 'Pode ver mChat', + 'ACL_U_MCHAT_EDIT' => 'Pode editar mensagens no mChat', + 'ACL_U_MCHAT_DELETE' => 'Pode apagar mensagens no mChat', + 'ACL_U_MCHAT_IP' => 'Pode ver Endereço IP no mChat', + 'ACL_U_MCHAT_PM' => 'Pode usar mensagens privadas no mChat', + 'ACL_U_MCHAT_LIKE' => 'Pode usar, Eu gosto da mensagem no mChat', + 'ACL_U_MCHAT_QUOTE' => 'Pode citar mensagens no mChat', + 'ACL_U_MCHAT_FLOOD_IGNORE' => 'Pode ignorar tiempo limite de mChat', + 'ACL_U_MCHAT_ARCHIVE' => 'Pode ver o Archivo do mChat', + 'ACL_U_MCHAT_BBCODE' => 'Pode usar BBCodes no mChat', + 'ACL_U_MCHAT_SMILIES' => 'Pode usar emocões no mChat', + 'ACL_U_MCHAT_URLS' => 'Pode colocár URLs no mChat', + + // Admin perms + 'ACL_A_MCHAT' => array('lang' => 'Pode gerir os ajustes do mChat', 'cat' => 'permissions'), // Using a phpBB category here + +)); diff --git a/migrations/mchat_schema.php b/migrations/mchat_schema.php index 2650dab..8d5537d 100644 --- a/migrations/mchat_schema.php +++ b/migrations/mchat_schema.php @@ -25,7 +25,7 @@ class mchat_schema extends \phpbb\db\migration\migration array('config.add', array('mchat_new_posts_quote', false)), array('config.add', array('mchat_message_top', true)), array('config.add', array('mchat_stats_index', false)), - array('config.add', array('mchat_version','0.0.14')), + array('config.add', array('mchat_version','0.1.0')), array('permission.add', array('u_mchat_use')), array('permission.add', array('u_mchat_view')), diff --git a/styles/prosilver/template/mchat_body.html b/styles/prosilver/template/mchat_body.html index a0e8353..1c7ab9e 100644 --- a/styles/prosilver/template/mchat_body.html +++ b/styles/prosilver/template/mchat_body.html @@ -21,9 +21,18 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */--> - + +
+ + +
@@ -219,9 +228,18 @@
- +
+ + + +

{L_WHO_IS_CHATTING}

diff --git a/styles/prosilver/theme/mchat.css b/styles/prosilver/theme/mchat.css index 778e74e..c9d4787 100644 --- a/styles/prosilver/theme/mchat.css +++ b/styles/prosilver/theme/mchat.css @@ -119,6 +119,14 @@ div.mChatMessage { } +div.mChatMessage li { + margin-left: 30px; +} + +div.mChatMessage blockquote { + margin: 2px 0; +} + a.mChatScriptLink { text-decoration:none; }