Version 2.1.3
This commit is contained in:
@@ -117,6 +117,11 @@
|
||||
<span>{{ lang('MCHAT_FLOOD_TIME_EXPLAIN') }}</span></dt>
|
||||
<dd><input type="text" name="mchat_flood_time" id="mchat_flood_time" size="10" value="{{ MCHAT_FLOOD_TIME }}"> <span>{{ lang('MCHAT_ACP_SECONDS') }}</span></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_flood_messages">{{ lang('MCHAT_FLOOD_MESSAGES') ~ lang('COLON') }}</label><br>
|
||||
<span>{{ lang('MCHAT_FLOOD_MESSAGES_EXPLAIN') }}</span></dt>
|
||||
<dd><input type="text" name="mchat_flood_messages" id="mchat_flood_messages" size="10" value="{{ MCHAT_FLOOD_MESSAGES }}"> <span>{{ lang('MCHAT_ACP_MESSAGES') }}</span></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_max_message_lngth">{{ lang('MCHAT_MAX_MESSAGE_LENGTH') ~ lang('COLON') }}</label><br>
|
||||
<span>{{ lang('MCHAT_MAX_MESSAGE_LENGTH_EXPLAIN') }}</span></dt>
|
||||
|
||||
100
composer.json
100
composer.json
@@ -1,52 +1,52 @@
|
||||
{
|
||||
"name": "dmzx/mchat",
|
||||
"type": "phpbb-extension",
|
||||
"description": "mChat",
|
||||
"homepage": "https://www.phpbb.com/customise/db/extension/mchat_extension/",
|
||||
"version": "2.1.2",
|
||||
"time": "2018-12-25",
|
||||
"keywords": [
|
||||
"phpbb",
|
||||
"extension",
|
||||
"mchat"
|
||||
],
|
||||
"license": "GPL-2.0-only",
|
||||
"authors": [
|
||||
{
|
||||
"name": "kasimi",
|
||||
"homepage": "https://kasimi.net",
|
||||
"email": "mail@kasimi.net",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "dmzx",
|
||||
"homepage": "http://www.dmzx-web.net",
|
||||
"email": "info@dmzx-web.net",
|
||||
"role": "Former Developer"
|
||||
},
|
||||
{
|
||||
"name": "RMcGirr83",
|
||||
"homepage": "http://rmcgirr83.org",
|
||||
"role": "Original MOD author"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.4.7",
|
||||
"composer/installers": "~1.0.0",
|
||||
"phpbb/phpbb": ">=3.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpbb/epv": "dev-master"
|
||||
},
|
||||
"extra": {
|
||||
"display-name": "mChat",
|
||||
"soft-require": {
|
||||
"phpbb/phpbb": ">=3.2.0"
|
||||
},
|
||||
"version-check": {
|
||||
"host": "www.phpbb.com",
|
||||
"directory": "/customise/db/extension/mchat_extension",
|
||||
"filename": "version_check"
|
||||
}
|
||||
}
|
||||
"name": "dmzx/mchat",
|
||||
"type": "phpbb-extension",
|
||||
"description": "mChat",
|
||||
"homepage": "https://www.phpbb.com/customise/db/extension/mchat_extension/",
|
||||
"version": "2.1.3",
|
||||
"time": "2019-06-06",
|
||||
"keywords": [
|
||||
"phpbb",
|
||||
"extension",
|
||||
"mchat"
|
||||
],
|
||||
"license": "GPL-2.0-only",
|
||||
"authors": [
|
||||
{
|
||||
"name": "kasimi",
|
||||
"homepage": "https://kasimi.net",
|
||||
"email": "mail@kasimi.net",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "dmzx",
|
||||
"homepage": "http://www.dmzx-web.net",
|
||||
"email": "info@dmzx-web.net",
|
||||
"role": "Former Developer"
|
||||
},
|
||||
{
|
||||
"name": "RMcGirr83",
|
||||
"homepage": "http://rmcgirr83.org",
|
||||
"role": "Original MOD author"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.4.7",
|
||||
"composer/installers": "~1.0.0",
|
||||
"phpbb/phpbb": ">=3.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpbb/epv": "dev-master"
|
||||
},
|
||||
"extra": {
|
||||
"display-name": "mChat",
|
||||
"soft-require": {
|
||||
"phpbb/phpbb": ">=3.2.0"
|
||||
},
|
||||
"version-check": {
|
||||
"host": "www.phpbb.com",
|
||||
"directory": "/customise/db/extension/mchat_extension",
|
||||
"filename": "version_check"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,6 @@ services:
|
||||
- '@cache.driver'
|
||||
- '@dispatcher'
|
||||
- '@group_helper'
|
||||
- '@text_formatter.parser'
|
||||
|
||||
dmzx.mchat.settings:
|
||||
class: dmzx\mchat\core\settings
|
||||
|
||||
@@ -631,24 +631,62 @@ class functions
|
||||
*/
|
||||
public function mchat_is_user_flooding()
|
||||
{
|
||||
if (!$this->mchat_settings->cfg('mchat_flood_time') || $this->auth->acl_get('u_mchat_flood_ignore'))
|
||||
if ($this->auth->acl_get('u_mchat_flood_ignore'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql_queries = [];
|
||||
|
||||
$sql_array = [
|
||||
'SELECT' => 'm.message_time',
|
||||
'SELECT' => 'm.user_id',
|
||||
'FROM' => [$this->mchat_settings->get_table_mchat() => 'm'],
|
||||
'WHERE' => 'm.user_id = ' . (int) $this->user->data['user_id'],
|
||||
'ORDER_BY' => 'm.message_time DESC',
|
||||
'ORDER_BY' => 'm.message_time DESC, m.message_id DESC',
|
||||
];
|
||||
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$message_time = (int) $this->db->sql_fetchfield('message_time');
|
||||
$this->db->sql_freeresult($result);
|
||||
if ($this->mchat_settings->cfg('mchat_flood_time'))
|
||||
{
|
||||
$sql = $this->db->sql_build_query('SELECT', array_merge($sql_array, [
|
||||
'WHERE' => implode(' AND ', [
|
||||
'm.user_id = ' . (int) $this->user->data['user_id'],
|
||||
'message_time > ' . time() . ' - ' . (int) $this->mchat_settings->cfg('mchat_flood_time'),
|
||||
$this->mchat_notifications->get_sql_where('exclude'),
|
||||
]),
|
||||
]));
|
||||
|
||||
return $message_time && time() - $message_time < $this->mchat_settings->cfg('mchat_flood_time');
|
||||
$sql_queries[$sql] = 1;
|
||||
}
|
||||
|
||||
if ($this->mchat_settings->cfg('mchat_flood_messages'))
|
||||
{
|
||||
$sql = $this->db->sql_build_query('SELECT', array_merge($sql_array, [
|
||||
'WHERE' => $this->mchat_notifications->get_sql_where('exclude'),
|
||||
]));
|
||||
|
||||
$sql_queries[$sql] = $this->mchat_settings->cfg('mchat_flood_messages');
|
||||
}
|
||||
|
||||
foreach ($sql_queries as $sql => $limit)
|
||||
{
|
||||
$result = $this->db->sql_query_limit($sql, $limit);
|
||||
$rows = $this->db->sql_fetchrowset($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if ($rows)
|
||||
{
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
if ($row['user_id'] != $this->user->data['user_id'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -208,6 +208,7 @@ class notifications
|
||||
return $post_subjects + $missing_post_subjects;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts the message field of the post row so that it can be passed to generate_text_for_display()
|
||||
*
|
||||
@@ -374,12 +375,14 @@ class notifications
|
||||
* Generates an SQL WHERE condition to include or exlude notifacation
|
||||
* messages based on the current user's settings and permissions
|
||||
*
|
||||
* @param string $mode One of user|exclude. user mode uses the current user's settings to decide which notifications
|
||||
* to exclude. exclude mode always excludes all notifications.
|
||||
* @return string
|
||||
*/
|
||||
public function get_sql_where()
|
||||
public function get_sql_where($mode = 'user')
|
||||
{
|
||||
// Exclude all post notifications
|
||||
if (!$this->mchat_settings->cfg('mchat_posts'))
|
||||
if ($mode == 'exclude' || !$this->mchat_settings->cfg('mchat_posts'))
|
||||
{
|
||||
return 'm.post_id = 0';
|
||||
}
|
||||
|
||||
@@ -163,7 +163,8 @@ class settings
|
||||
'mchat_custom_height' => ['default' => 350, 'validation' => ['num', false, 50, 1000]],
|
||||
'mchat_custom_page' => ['default' => 1],
|
||||
'mchat_edit_delete_limit' => ['default' => 0],
|
||||
'mchat_flood_time' => ['default' => 0, 'validation' => ['num', false, 0, 60]],
|
||||
'mchat_flood_time' => ['default' => 0, 'validation' => ['num', false, 0, 3600]],
|
||||
'mchat_flood_messages' => ['default' => 0, 'validation' => ['num', false, 0, 100]],
|
||||
'mchat_index_height' => ['default' => 250, 'validation' => ['num', false, 50, 1000]],
|
||||
'mchat_live_updates' => ['default' => 1],
|
||||
'mchat_log_enabled' => ['default' => 1],
|
||||
|
||||
@@ -96,7 +96,9 @@ $lang = array_merge($lang, [
|
||||
'MCHAT_ARCHIVE_SORT_BOTTOM_TOP' => 'Always sort messages newest to oldest',
|
||||
'MCHAT_ARCHIVE_SORT_USER' => 'Sort messages depending on the user’s <em>Location of new messages</em> preference',
|
||||
'MCHAT_FLOOD_TIME' => 'Flood time',
|
||||
'MCHAT_FLOOD_TIME_EXPLAIN' => 'The number of seconds a user must wait before posting another message in the chat.<br><em>You are limited from 0 to 60 seconds. Default is 0. Set to 0 to disable.</em>',
|
||||
'MCHAT_FLOOD_TIME_EXPLAIN' => 'The number of seconds a user must wait before posting another message in the chat.<br><em>You are limited from 0 to 3600 seconds (1 hour). Default is 0. Set to 0 to disable.</em>',
|
||||
'MCHAT_FLOOD_MESSAGES' => 'Flood messages',
|
||||
'MCHAT_FLOOD_MESSAGES_EXPLAIN' => 'The number of messages a user can send consecutively before another user is required to post in the chat.<br><em>You are limited from 0 to 100 messages. Default is 0. Set to 0 to disable.</em>',
|
||||
'MCHAT_EDIT_DELETE_LIMIT' => 'Time limit for editing and deleting messages',
|
||||
'MCHAT_EDIT_DELETE_LIMIT_EXPLAIN' => 'Messages older than the specified number of seconds cannot be edited or deleted by the author any more.<br>Users who have <em>edit/delete permission as well as moderator permission are exempt</em> from this time limit.<br>Set to 0 to allow unlimited editing and deleting.',
|
||||
'MCHAT_MAX_MESSAGE_LENGTH' => 'Maximum message length',
|
||||
@@ -106,7 +108,7 @@ $lang = array_merge($lang, [
|
||||
'MCHAT_CUSTOM_PAGE' => 'Enable mChat page',
|
||||
'MCHAT_CUSTOM_HEIGHT' => 'mChat page height',
|
||||
'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => '<em>You are limited from 50 to 1000. Default is 350.</em>',
|
||||
'MCHAT_BBCODES_DISALLOWED' => 'Disallowed BBCdes',
|
||||
'MCHAT_BBCODES_DISALLOWED' => 'Disallowed BBCodes',
|
||||
'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Here you can input the BBCodes that are <strong>not</strong> to be used in a message.<br>Separate BBCodes with a vertical bar, for example:<br>b|i|u|code|list|list=|flash|quote and/or a %1$scustom BBCode tag name%2$s.',
|
||||
'MCHAT_STATIC_MESSAGE' => 'Static message',
|
||||
'MCHAT_STATIC_MESSAGE_EXPLAIN' => 'Here you can define a static message. HTML code is allowed. Set to empty to disable the display.<br>This message can be translated: edit the MCHAT_STATIC_MESSAGE language key in /ext/dmzx/mchat/language/XX/mchat.php.',
|
||||
@@ -140,6 +142,7 @@ $lang = array_merge($lang, [
|
||||
'TOO_LONG_MCHAT_DATE' => 'The date format you entered is too long.',
|
||||
'TOO_SHORT_MCHAT_DATE' => 'The date format you entered is too short.',
|
||||
'TOO_LARGE_MCHAT_FLOOD_TIME' => 'The flood time value is too large.',
|
||||
'TOO_LARGE_MCHAT_FLOOD_MESSAGES' => 'The flood messages value is too large.',
|
||||
'TOO_SMALL_MCHAT_INDEX_HEIGHT' => 'The index height value is too small.',
|
||||
'TOO_LARGE_MCHAT_INDEX_HEIGHT' => 'The index height value is too large.',
|
||||
'TOO_LARGE_MCHAT_MAX_INPUT_HEIGHT' => 'The max input height value is too large.',
|
||||
|
||||
@@ -45,7 +45,7 @@ $lang = array_merge($lang, [
|
||||
'ACL_U_MCHAT_PM' => 'Can use private message',
|
||||
'ACL_U_MCHAT_LIKE' => 'Can see like icon (requires BBCode permission)',
|
||||
'ACL_U_MCHAT_QUOTE' => 'Can see quote icon (requires BBCode permission)',
|
||||
'ACL_U_MCHAT_FLOOD_IGNORE' => 'Can ignore flood limit',
|
||||
'ACL_U_MCHAT_FLOOD_IGNORE' => 'Can ignore flood limits',
|
||||
'ACL_U_MCHAT_ARCHIVE' => 'Can view the archive',
|
||||
'ACL_U_MCHAT_BBCODE' => 'Can use BBCodes',
|
||||
'ACL_U_MCHAT_SMILIES' => 'Can use smilies',
|
||||
|
||||
31
migrations/mchat_2_1_3.php
Normal file
31
migrations/mchat_2_1_3.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2019 kasimi - https://kasimi.net
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
use phpbb\db\migration\migration;
|
||||
|
||||
class mchat_2_1_3 extends migration
|
||||
{
|
||||
public static function depends_on()
|
||||
{
|
||||
return [
|
||||
'\dmzx\mchat\migrations\mchat_2_1_2',
|
||||
];
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return [
|
||||
['config.update', ['mchat_version', '2.1.3']],
|
||||
['config.add', ['mchat_flood_messages', 0]],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{%- EVENT dmzx_mchat_messages_before -%}
|
||||
|
||||
{%- for mchatrow in loops.mchatrow -%}
|
||||
<li id="mchat-message-{{ mchatrow.MCHAT_MESSAGE_ID }}" class="row mchat-message{% if mchatrow.MCHAT_IS_NOTIFICATION %} mchat-notification-message{% endif %}" data-mchat-id="{{ mchatrow.MCHAT_MESSAGE_ID }}" data-mchat-user-id="{{ mchatrow.MCHAT_USER_ID }}" data-mchat-username="{{ mchatrow.MCHAT_USERNAME }}"{% if mchatrow.MCHAT_USERNAME_COLOR %} data-mchat-usercolor="{{ mchatrow.MCHAT_USERNAME_COLOR }}"{% endif %} data-mchat-message="{{ mchatrow.MCHAT_MESSAGE_EDIT }}" data-mchat-message-time="{{ mchatrow.MCHAT_MESSAGE_TIME }}"{% if MCHAT_EDIT_DELETE_LIMIT and not MCHAT_EDIT_DELETE_IGNORE and (mchatrow.MCHAT_ALLOW_EDIT or mchatrow.MCHAT_ALLOW_DEL) %} data-mchat-edit-delete-limit="1"{% endif %} {% EVENT dmzx_mchat_message_attributes %}>
|
||||
<li id="mchat-message-{{ mchatrow.MCHAT_MESSAGE_ID }}" class="row mchat-message{% if mchatrow.MCHAT_IS_NOTIFICATION %} mchat-notification-message{% endif %}" data-mchat-id="{{ mchatrow.MCHAT_MESSAGE_ID }}" data-mchat-user-id="{{ mchatrow.MCHAT_USER_ID }}" data-mchat-username="{{ mchatrow.MCHAT_USERNAME | striptags }}"{% if mchatrow.MCHAT_USERNAME_COLOR %} data-mchat-usercolor="{{ mchatrow.MCHAT_USERNAME_COLOR }}"{% endif %} data-mchat-message="{{ mchatrow.MCHAT_MESSAGE_EDIT }}" data-mchat-message-time="{{ mchatrow.MCHAT_MESSAGE_TIME }}"{% if MCHAT_EDIT_DELETE_LIMIT and not MCHAT_EDIT_DELETE_IGNORE and (mchatrow.MCHAT_ALLOW_EDIT or mchatrow.MCHAT_ALLOW_DEL) %} data-mchat-edit-delete-limit="1"{% endif %} {% EVENT dmzx_mchat_message_attributes %}>
|
||||
{% if S_MCHAT_AVATARS %}
|
||||
<div class="mchat-avatar">
|
||||
{% if mchatrow.U_VIEWPROFILE %}<a href="{{ mchatrow.U_VIEWPROFILE }}" title="{{ lang('READ_PROFILE') }}">{% endif %}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{% EVENT dmzx_mchat_controls_before %}
|
||||
<div class="mchat-controls">
|
||||
<div class="mchat-input-container inputbox">
|
||||
<textarea id="mchat-input" name="message" class="no-auto-resize {{ MCHAT_MAX_INPUT_HEIGHT ? 'mchat-multi-line' : 'mchat-single-line' }}" rows="1" autocomplete="off"></textarea>
|
||||
<textarea id="mchat-input" name="message" class="no-auto-resize {{ MCHAT_MAX_INPUT_HEIGHT ? 'mchat-multi-line' : 'mchat-single-line' }}" rows="1" autocomplete="on" spellcheck="true"></textarea>
|
||||
<div class="mchat-input-control">
|
||||
<button type="button" class="mchat-button-add" id="mchat-add" data-mchat-action="add" title="{{ lang('MCHAT_ADD') }}">
|
||||
<i class="icon icon-lightgray fa fa-chevron-right fa-fw" aria-hidden="true"></i><span class="sr-only">{{ lang('MCHAT_ADD') }}</span>
|
||||
@@ -46,7 +46,7 @@
|
||||
{% if MCHAT_ALLOW_SMILES and loops.smiley|length %}
|
||||
<div id="mchat-smilies" class="hidden">
|
||||
{% for smiley in loops.smiley %}
|
||||
<a href="#" data-smiley-code="{{ smiley.A_SMILEY_CODE }}" data-mchat-action="smiley">
|
||||
<a href="#" data-smiley-code="{{ smiley.SMILEY_CODE }}" data-mchat-action="smiley">
|
||||
<img src="{{ smiley.SMILEY_IMG }}" width="{{ smiley.SMILEY_WIDTH }}" height="{{ smiley.SMILEY_HEIGHT }}" alt="{{ smiley.SMILEY_CODE }}" title="{{ smiley.SMILEY_DESC }}">
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user