3 Commits

Author SHA1 Message Date
dmzx
6405c7c7ab Version 2.0.1 2017-04-28 08:00:39 +02:00
dmzx
28f847ecff Version 2.0.0 2016-12-30 11:05:29 +01:00
dmzx
159d1d25b8 Version 2.0.0-RC7 2016-10-16 17:25:31 +02:00
82 changed files with 1499 additions and 602 deletions

View File

@@ -1,60 +0,0 @@
language: php
matrix:
include:
- php: 5.4
env: DB=mysqli
- php: 5.4
env: DB=mysql
- php: 5.4
env: DB=mariadb
- php: 5.4
env: DB=postgres
- php: 5.4
env: DB=sqlite3
- php: 5.5
env: DB=mysqli
- php: 5.6
env: DB=mysqli
- php: hhvm
env: DB=mysqli
allow_failures:
- php: hhvm
fast_finish: true
env:
global:
- EXTNAME="dmzx/mChat-Extension" # CHANGE name of the extension HERE
- SNIFF="1" # Should we run code sniffer on your code?
- IMAGE_ICC="0" # Should we run icc profile sniffer on your images?
- EPV="1" # Should we run EPV (Extension Pre Validator) on your code?
- PHPBB_BRANCH="3.1.x"
branches:
only:
- master
- develop
- /^develop-.*$/
before_install:
- sudo mkdir travis
- git clone "https://github.com/nickvergessen/phpbb-ext-acme-demo.git"
- sudo cp phpbb-ext-acme-demo/phpunit.xml.dist ./
- sudo cp phpbb-ext-acme-demo/travis/prepare-phpbb.sh travis
- sudo rm -rf phpbb-ext-acme-demo
install:
- composer install --dev --no-interaction --prefer-source
- travis/prepare-phpbb.sh $EXTNAME $PHPBB_BRANCH
- cd ../../phpBB3
- travis/prepare-extension.sh $EXTNAME $PHPBB_BRANCH
- travis/setup-phpbb.sh $DB $TRAVIS_PHP_VERSION
before_script:
- travis/setup-database.sh $DB $TRAVIS_PHP_VERSION
script:
- sh -c "if [ '$SNIFF' != '0' ]; then travis/ext-sniff.sh $DB $TRAVIS_PHP_VERSION $EXTNAME; fi"
- sh -c "if [ '$IMAGE_ICC' != '0' ]; then travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION; fi"
- phpBB/vendor/bin/phpunit --configuration phpBB/ext/$EXTNAME/travis/phpunit-$DB-travis.xml --bootstrap ./tests/bootstrap.php
- sh -c "if [ '$EPV' != '0' ] && [ '$TRAVIS_PHP_VERSION' = '5.3.3' ] && [ '$DB' = 'mysqli' ]; then phpBB/ext/$EXTNAME/vendor/bin/EPV.php run --dir='phpBB/ext/$EXTNAME/'; fi"

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -14,35 +14,45 @@
<form id="acp_mchat" method="post" action="{U_ACTION}">
<fieldset>
<legend>{L_MCHAT_SETTINGS_INDEX}</legend>
<!-- EVENT dmzx_mchat_acp_index_height_before -->
<dl>
<dt><label for="mchat_index_height">{L_MCHAT_INDEX_HEIGHT}{L_COLON}</label><br />
<span>{L_MCHAT_INDEX_HEIGHT_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_index_height" id="mchat_index_height" size="10" maxlength="4" value="{MCHAT_INDEX_HEIGHT}" /></dd>
<dd><input type="text" name="mchat_index_height" id="mchat_index_height" size="10" maxlength="4" value="{MCHAT_INDEX_HEIGHT}" />&nbsp;<span>{L_PIXEL}</span></dd>
</dl>
<dl>
<dt><label for="mchat_message_num_index">{L_MCHAT_MESSAGE_NUM_INDEX}{L_COLON}</label><br />
<span>{L_MCHAT_MESSAGE_NUM_INDEX_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_message_num_index" id="mchat_message_num_index" size="10" maxlength="4" value="{MCHAT_MESSAGE_NUM_INDEX}" /></dd>
<dd><input type="text" name="mchat_message_num_index" id="mchat_message_num_index" size="10" maxlength="4" value="{MCHAT_MESSAGE_NUM_INDEX}" />&nbsp;<span>{L_MCHAT_ACP_MESSAGES}</span></dd>
</dl>
<!-- EVENT dmzx_mchat_acp_message_num_index_after -->
</fieldset>
<!-- EVENT acp_dmzx_mchat_globalsettings_index_after -->
<fieldset>
<legend>{L_MCHAT_SETTINGS_CUSTOM}</legend>
<!-- EVENT dmzx_mchat_acp_custom_page_before -->
<dl>
<dt><label for="mchat_custom_page">{L_MCHAT_CUSTOM_PAGE}{L_COLON}</label><br />
<span>{L_MCHAT_CUSTOM_PAGE_EXPLAIN}</span></dt>
<dt><label for="mchat_custom_page">{L_MCHAT_CUSTOM_PAGE}{L_COLON}</label></dt>
<dd><label><input type="radio" class="radio" name="mchat_custom_page" value="1"<!-- IF MCHAT_CUSTOM_PAGE --> id="mchat_custom_page" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" class="radio" name="mchat_custom_page" value="0"<!-- IF not MCHAT_CUSTOM_PAGE --> id="mchat_custom_page" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<dl>
<dt><label for="mchat_custom_height">{L_MCHAT_CUSTOM_HEIGHT}{L_COLON}</label><br />
<span>{L_MCHAT_CUSTOM_HEIGHT_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_custom_height" id="mchat_custom_height" size="10" maxlength="4" value="{MCHAT_CUSTOM_HEIGHT}" /></dd>
<dd><input type="text" name="mchat_custom_height" id="mchat_custom_height" size="10" maxlength="4" value="{MCHAT_CUSTOM_HEIGHT}" />&nbsp;<span>{L_PIXEL}</span></dd>
</dl>
<dl>
<dt><label for="mchat_message_num_custom">{L_MCHAT_MESSAGE_NUM_CUSTOM}{L_COLON}</label><br />
<span>{L_MCHAT_MESSAGE_NUM_CUSTOM_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_message_num_custom" id="mchat_message_num_custom" size="10" value="{MCHAT_MESSAGE_NUM_CUSTOM}" /></dd>
<dd><input type="text" name="mchat_message_num_custom" id="mchat_message_num_custom" size="10" value="{MCHAT_MESSAGE_NUM_CUSTOM}" />&nbsp;<span>{L_MCHAT_ACP_MESSAGES}</span></dd>
</dl>
<dl>
<dt><label for="mchat_navbar_link">{L_MCHAT_NAVBAR_LINK}{L_COLON}</label></dt>
@@ -54,31 +64,51 @@
<dd><label><input type="radio" class="radio" name="mchat_navbar_link_count" value="1"<!-- IF MCHAT_NAVBAR_LINK_COUNT --> id="mchat_navbar_link_count" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" class="radio" name="mchat_navbar_link_count" value="0"<!-- IF not MCHAT_NAVBAR_LINK_COUNT --> id="mchat_navbar_link_count" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<!-- EVENT dmzx_mchat_acp_navbar_link_count_after -->
</fieldset>
<fieldset>
<legend>{L_MCHAT_SETTINGS_ARCHIVE}</legend>
<!-- EVENT dmzx_mchat_acp_message_num_archive_before -->
<dl>
<dt><label for="mchat_message_num_archive">{L_MCHAT_MESSAGE_NUM_ARCHIVE}{L_COLON}</label><br />
<span>{L_MCHAT_MESSAGE_NUM_ARCHIVE_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_message_num_archive" id="mchat_message_num_archive" size="10" value="{MCHAT_MESSAGE_NUM_ARCHIVE}" /></dd>
<dd><input type="text" name="mchat_message_num_archive" id="mchat_message_num_archive" size="10" value="{MCHAT_MESSAGE_NUM_ARCHIVE}" />&nbsp;<span>{L_MCHAT_ACP_MESSAGES}</span></dd>
</dl>
<!-- EVENT dmzx_mchat_acp_message_num_archive_after -->
<dl>
<dt><label for="mchat_archive_sort">{L_MCHAT_ARCHIVE_SORT}{L_COLON}</label></dt>
<dd>
<label><input type="radio" class="radio" name="mchat_archive_sort" value="0"<!-- IF MCHAT_ARCHIVE_SORT == 0 --> id="mchat_archive_sort" checked="checked"<!-- ENDIF --> /> {L_MCHAT_ARCHIVE_SORT_TOP_BOTTOM}</label><br />
<label><input type="radio" class="radio" name="mchat_archive_sort" value="1"<!-- IF MCHAT_ARCHIVE_SORT == 1 --> id="mchat_archive_sort" checked="checked"<!-- ENDIF --> /> {L_MCHAT_ARCHIVE_SORT_BOTTOM_TOP}</label><br />
<label><input type="radio" class="radio" name="mchat_archive_sort" value="2"<!-- IF MCHAT_ARCHIVE_SORT == 2 --> id="mchat_archive_sort" checked="checked"<!-- ENDIF --> /> {L_MCHAT_ARCHIVE_SORT_USER}</label>
</dd>
</dl>
</fieldset>
<fieldset>
<legend>{L_MCHAT_SETTINGS_MESSAGES}</legend>
<!-- EVENT dmzx_mchat_acp_timeout_before -->
<dl>
<dt><label for="mchat_timeout">{L_MCHAT_TIMEOUT}{L_COLON}</label><br />
<span>{L_MCHAT_TIMEOUT_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_timeout" id="mchat_timeout" size="10" maxlength="4" value="{MCHAT_TIMEOUT}" /></dd>
<dd><input type="text" name="mchat_timeout" id="mchat_timeout" size="10" maxlength="4" value="{MCHAT_TIMEOUT}" />&nbsp;<span>{L_MCHAT_ACP_SECONDS}</span></dd>
</dl>
<dl>
<dt><label for="mchat_refresh">{L_MCHAT_REFRESH}{L_COLON}</label><br />
<span>{L_MCHAT_REFRESH_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_refresh" id="mchat_refresh" size="10" value="{MCHAT_REFRESH}" /></dd>
<dd><input type="text" name="mchat_refresh" id="mchat_refresh" size="10" value="{MCHAT_REFRESH}" />&nbsp;<span>{L_MCHAT_ACP_SECONDS}</dd>
</dl>
<dl>
<dt><label for="mchat_edit_delete_limit">{L_MCHAT_EDIT_DELETE_LIMIT}{L_COLON}</label><br />
<span>{L_MCHAT_EDIT_DELETE_LIMIT_EXPLAIN}</span>
<dd><input type="text" name="mchat_edit_delete_limit" id="mchat_edit_delete_limit" size="10" value="{MCHAT_EDIT_DELETE_LIMIT}" /></dd>
<dd><input type="text" name="mchat_edit_delete_limit" id="mchat_edit_delete_limit" size="10" value="{MCHAT_EDIT_DELETE_LIMIT}" />&nbsp;<span>{L_MCHAT_ACP_SECONDS}</dd>
</dl>
<dl>
<dt><label for="mchat_live_updates">{L_MCHAT_LIVE_UPDATES}{L_COLON}</label><br />
@@ -89,12 +119,12 @@
<dl>
<dt><label for="mchat_flood_time">{L_MCHAT_FLOOD_TIME}{L_COLON}</label><br />
<span>{L_MCHAT_FLOOD_TIME_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_flood_time" id="mchat_flood_time" size="10" value="{MCHAT_FLOOD_TIME}" /></dd>
<dd><input type="text" name="mchat_flood_time" id="mchat_flood_time" size="10" value="{MCHAT_FLOOD_TIME}" />&nbsp;<span>{L_MCHAT_ACP_SECONDS}</dd>
</dl>
<dl>
<dt><label for="mchat_max_message_lngth">{L_MCHAT_MAX_MESSAGE_LENGTH}{L_COLON}</label><br />
<span>{L_MCHAT_MAX_MESSAGE_LENGTH_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_max_message_lngth" id="mchat_max_message_lngth" size="10" value="{MCHAT_MAX_MESSAGE_LNGTH}" /></dd>
<dd><input type="text" name="mchat_max_message_lngth" id="mchat_max_message_lngth" size="10" value="{MCHAT_MAX_MESSAGE_LNGTH}" />&nbsp;<span>{L_MCHAT_ACP_CHARACTERS}</dd>
</dl>
<dl>
<dt><label for="mchat_override_min_post_chars">{L_MCHAT_OVERRIDE_MIN_POST_CHARS}{L_COLON}</label><br />
@@ -123,9 +153,15 @@
<span>{L_MCHAT_STATIC_MESSAGE_EXPLAIN}</span></dt>
<dd><textarea name="mchat_static_message" id="mchat_static_message" rows="5" cols="40">{MCHAT_STATIC_MESSAGE}</textarea></dd>
</dl>
<!-- EVENT dmzx_mchat_acp_static_message_after -->
</fieldset>
<fieldset>
<legend>{L_MCHAT_SETTINGS_POSTS}</legend>
<!-- EVENT dmzx_mchat_acp_posts_topic_before -->
<dl>
<dt><label for="mchat_posts_topic">{L_MCHAT_POSTS_TOPIC}{L_COLON}</label></dt>
<dd>
@@ -161,28 +197,49 @@
<label><input type="radio" name="mchat_posts_login" value="0"<!-- IF not MCHAT_POSTS_LOGIN --> id="mchat_posts_login" checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
<!-- EVENT dmzx_mchat_acp_posts_login_after -->
</fieldset>
<fieldset>
<legend>{L_MCHAT_SETTINGS_STATS}</legend>
<!-- EVENT dmzx_mchat_acp_whois_refresh_before -->
<dl>
<dt><label for="mchat_whois_refresh">{L_MCHAT_WHOIS_REFRESH}{L_COLON}</label><br />
<span>{L_MCHAT_WHOIS_REFRESH_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_whois_refresh" id="mchat_whois_refresh" size="10" value="{MCHAT_WHOIS_REFRESH}" /></dd>
<dd><input type="text" name="mchat_whois_refresh" id="mchat_whois_refresh" size="10" value="{MCHAT_WHOIS_REFRESH}" />&nbsp;<span>{L_MCHAT_ACP_SECONDS}</dd>
</dl>
<!-- EVENT dmzx_mchat_acp_whois_refresh_after -->
</fieldset>
<!-- IF MCHAT_FOUNDER -->
<fieldset>
<legend>{L_MCHAT_SETTINGS_PRUNE}</legend>
<!-- EVENT dmzx_mchat_acp_prune_before -->
<dl>
<dt><label for="mchat_prune">{L_MCHAT_PRUNE}{L_COLON}</label><br />
<span>{L_MCHAT_PRUNE_EXPLAIN}</span></dt>
<dt><label for="mchat_prune">{L_MCHAT_PRUNE}{L_COLON}</label></dt>
<dd><label><input type="radio" class="radio" name="mchat_prune" value="1"<!-- IF MCHAT_PRUNE --> id="mchat_prune" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" class="radio" name="mchat_prune" value="0"<!-- IF not MCHAT_PRUNE --> id="mchat_prune" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<dl>
<dt><label for="mchat_prune_gc">{L_MCHAT_PRUNE_GC}{L_COLON}</label><br />
<span>{L_MCHAT_PRUNE_GC_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_prune_gc" id="mchat_prune_gc" size="10" value="{MCHAT_PRUNE_GC}" />&nbsp;<span>{L_MCHAT_ACP_SECONDS}</dd>
</dl>
<dl>
<dt><label for="mchat_prune_num">{L_MCHAT_PRUNE_NUM}{L_COLON}</label><br />
<span>{L_MCHAT_PRUNE_NUM_EXPLAIN}</span></dt>
<dd><input type="text" name="mchat_prune_num" size="10" id="mchat_prune_num" value="{MCHAT_PRUNE_NUM}" /></dd>
<dd>
<input type="text" name="mchat_prune_num" size="10" id="mchat_prune_num" value="{MCHAT_PRUNE_NUM}" />
<select name="mchat_prune_mode" id="mchat_prune_mode" title="{L_MCHAT_PRUNE_NUM}">
{S_MCHAT_PRUNE_MODE_OPTIONS}
</select>
</dd>
</dl>
<dl>
<dt><label for="mchat_prune_now">{L_MCHAT_PRUNE_NOW}{L_COLON}</label></dt>
@@ -202,9 +259,14 @@
<label><input type="radio" name="mchat_purge_confirm" value="0" id="mchat_purge_confirm" checked="checked" /> {L_NO}</label>
</dd>
</dl>
<!-- EVENT dmzx_mchat_acp_purge_after -->
</fieldset>
<!-- ENDIF -->
<!-- EVENT acp_dmzx_mchat_globalsettings_after -->
<p class="submit-buttons">
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />

View File

@@ -16,7 +16,7 @@
<form id="acp_mchat" method="post" action="{U_ACTION}">
<fieldset>
<legend>{L_ACP_MCHAT_GLOBALUSERSETTINGS}</legend>
<!-- INCLUDE acp_mchat_globalusersettings_content.html -->
<!-- INCLUDE @dmzx_mchat/acp_mchat_globalusersettings_content.html -->
</fieldset>
<fieldset>
<legend>{L_MCHAT_GLOBALUSERSETTINGS_OVERWRITE}</legend>

View File

@@ -1,3 +1,5 @@
<!-- EVENT dmzx_mchat_acp_index_before -->
<dl>
<dt><label for="user_mchat_index">{L_MCHAT_INDEX}{L_COLON}</label></dt>
<dd>
@@ -26,7 +28,13 @@
<label><input type="radio" name="user_mchat_location" value="0"<!-- IF not MCHAT_LOCATION --> id="user_mchat_location" checked="checked"<!-- ENDIF --><!-- IF MCHAT_LOCATION_NOAUTH --> disabled<!-- ENDIF --> /> {L_MCHAT_BOTTOM}</label>
</dd>
</dl>
<!-- EVENT dmzx_mchat_acp_location_after -->
<hr />
<!-- EVENT dmzx_mchat_acp_message_top_before -->
<dl>
<dt><label for="user_mchat_message_top">{L_MCHAT_MESSAGE_TOP}{L_COLON}</label><br /><span>{L_MCHAT_MESSAGE_TOP_EXPLAIN}</span></dt>
<dd>
@@ -63,7 +71,7 @@
</dd>
</dl>
<dl>
<dt><label for="user_mchat_character_count">{L_MCHAT_CHARACTER_COUNT}{L_COLON}</label></dt>
<dt><label for="user_mchat_character_count">{L_MCHAT_DISPLAY_CHARACTER_COUNT}{L_COLON}</label></dt>
<dd>
<label><input type="radio" name="user_mchat_character_count" value="1"<!-- IF MCHAT_CHARACTER_COUNT --> id="user_mchat_character_count" checked="checked"<!-- ENDIF --><!-- IF MCHAT_CHARACTER_COUNT_NOAUTH --> disabled<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" name="user_mchat_character_count" value="0"<!-- IF not MCHAT_CHARACTER_COUNT --> id="user_mchat_character_count" checked="checked"<!-- ENDIF --><!-- IF MCHAT_CHARACTER_COUNT_NOAUTH --> disabled<!-- ENDIF --> /> {L_NO}</label>
@@ -92,7 +100,13 @@
<label><input type="radio" name="user_mchat_relative_time" value="0"<!-- IF not MCHAT_RELATIVE_TIME --> id="user_mchat_relative_time" checked="checked"<!-- ENDIF --><!-- IF MCHAT_RELATIVE_TIME_NOAUTH --> disabled<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
<!-- EVENT dmzx_mchat_acp_relative_time_after -->
<hr />
<!-- EVENT dmzx_mchat_acp_posts_before -->
<dl>
<dt><label for="user_mchat_posts"><!-- IF MCHAT_POSTS_ENABLED_LANG -->{MCHAT_POSTS_ENABLED_LANG}<!-- ELSE -->{L_MCHAT_POSTS}<!-- ENDIF -->{L_COLON}</label></dt>
<dd>
@@ -100,3 +114,5 @@
<label><input type="radio" name="user_mchat_posts" value="0"<!-- IF not MCHAT_POSTS --> id="user_mchat_posts" checked="checked"<!-- ENDIF --><!-- IF MCHAT_POSTS_NOAUTH --> disabled<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
<!-- EVENT dmzx_mchat_acp_posts_after -->

View File

@@ -1,5 +1,5 @@
<fieldset>
<p class="successbox notice">{L_MCHAT_ACP_USER_PREFS_EXPLAIN}</p>
<legend>{L_MCHAT_PREFERENCES}</legend>
<!-- INCLUDE acp_mchat_globalusersettings_content.html -->
<!-- INCLUDE @dmzx_mchat/acp_mchat_globalusersettings_content.html -->
</fieldset>

View File

@@ -3,8 +3,8 @@
"type": "phpbb-extension",
"description": "mChat",
"homepage": "https://github.com/kasimi/mChat",
"version": "2.0.0-RC6",
"time": "2016-09-18",
"version": "2.0.1",
"time": "2017-02-03",
"keywords": ["phpbb", "extension", "mchat"],
"license": "GPL-2.0",
"authors": [
@@ -12,13 +12,13 @@
"name": "kasimi",
"homepage": "https://kasimi.net",
"email": "mail@kasimi.net",
"role": "Extension Developer"
"role": "Lead Developer"
},
{
"name": "dmzx",
"homepage": "http://www.dmzx-web.net",
"email": "info@dmzx-web.net",
"role": "Extension Developer"
"role": "Former Developer"
},
{
"name": "RMcGirr83",
@@ -28,7 +28,7 @@
],
"require": {
"php": ">=5.3.3",
"phpbb/phpbb": ">=3.1.7-PL1,<3.3.0@dev"
"phpbb/phpbb": ">=3.1.8-RC1,<3.3.0@dev"
},
"require-dev": {
"phpbb/epv": "dev-master"
@@ -36,7 +36,12 @@
"extra": {
"display-name": "mChat",
"soft-require": {
"phpbb/phpbb": ">=3.1.7-PL1,<3.3.0@dev"
"phpbb/phpbb": ">=3.1.8-RC1,<3.3.0@dev"
},
"version-check": {
"host": "www.phpbb.com",
"directory": "/customise/db/extension/mchat_extension",
"filename": "version_check"
}
}
}

View File

@@ -10,8 +10,9 @@ services:
- '@log'
- '@user'
- '@dbal.conn'
- '@cache'
- '@cache.driver'
- '@request'
- '@dispatcher'
- '@dmzx.mchat.settings'
- '%dmzx.mchat.table.mchat%'
- '%dmzx.mchat.table.mchat_log%'
@@ -26,6 +27,7 @@ services:
- '@dbal.conn'
- '@request'
- '@dmzx.mchat.settings'
- '@dispatcher'
- '%core.root_path%'
- '%core.php_ext%'
dmzx.mchat.core:
@@ -43,6 +45,7 @@ services:
- '@ext.manager'
- '%core.root_path%'
- '%core.php_ext%'
- '@?text_formatter.s9e.parser'
- '@?phpbb.collapsiblecategories.operator'
dmzx.mchat.functions:
class: dmzx\mchat\core\functions
@@ -65,6 +68,7 @@ services:
- '@user'
- '@config'
- '@auth'
- '@dispatcher'
dmzx.mchat.acp.listener:
class: dmzx\mchat\event\acp_listener
arguments:
@@ -72,6 +76,7 @@ services:
- '@request'
- '@user'
- '@dmzx.mchat.settings'
- '@dmzx.mchat.functions'
- '%core.root_path%'
- '%core.php_ext%'
tags:

View File

@@ -4,37 +4,50 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\controller;
use dmzx\mchat\core\functions;
use dmzx\mchat\core\settings;
use phpbb\cache\driver\driver_interface as cache_interface;
use phpbb\db\driver\driver_interface as db_interface;
use phpbb\event\dispatcher_interface;
use phpbb\log\log_interface;
use phpbb\request\request_interface;
use phpbb\template\template;
use phpbb\user;
class acp_controller
{
/** @var \dmzx\mchat\core\functions */
/** @var functions */
protected $functions;
/** @var \phpbb\template\template */
/** @var template */
protected $template;
/** @var \phpbb\log\log_interface */
/** @var log_interface */
protected $log;
/** @var \phpbb\user */
/** @var user */
protected $user;
/** @var \phpbb\db\driver\driver_interface */
/** @var db_interface */
protected $db;
/** @var \phpbb\cache\service */
/** @var cache_interface */
protected $cache;
/** @var \phpbb\request\request */
/** @var request_interface */
protected $request;
/** @var \dmzx\mchat\core\settings */
/** @var dispatcher_interface */
protected $dispatcher;
/** @var settings */
protected $settings;
/** @var string */
@@ -52,20 +65,35 @@ class acp_controller
/**
* Constructor
*
* @param \dmzx\mchat\core\functions $functions
* @param \phpbb\template\template $template
* @param \phpbb\log\log_interface $log
* @param \phpbb\user $user
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\cache\service $cache
* @param \phpbb\request\request $request
* @param \dmzx\mchat\core\settings $settings
* @param string $mchat_table
* @param string $mchat_log_table
* @param string $root_path
* @param string $php_ext
* @param functions $functions
* @param template $template
* @param log_interface $log
* @param user $user
* @param db_interface $db
* @param cache_interface $cache
* @param request_interface $request
* @param dispatcher_interface $dispatcher
* @param settings $settings
* @param string $mchat_table
* @param string $mchat_log_table
* @param string $root_path
* @param string $php_ext
*/
public function __construct(\dmzx\mchat\core\functions $functions, \phpbb\template\template $template, \phpbb\log\log_interface $log, \phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\request\request $request, \dmzx\mchat\core\settings $settings, $mchat_table, $mchat_log_table, $root_path, $php_ext)
public function __construct(
functions $functions,
template $template,
log_interface $log,
user $user,
db_interface $db,
cache_interface $cache,
request_interface $request,
dispatcher_interface $dispatcher,
settings $settings,
$mchat_table,
$mchat_log_table,
$root_path,
$php_ext
)
{
$this->functions = $functions;
$this->template = $template;
@@ -74,6 +102,7 @@ class acp_controller
$this->db = $db;
$this->cache = $cache;
$this->request = $request;
$this->dispatcher = $dispatcher;
$this->settings = $settings;
$this->mchat_table = $mchat_table;
$this->mchat_log_table = $mchat_log_table;
@@ -98,7 +127,7 @@ class acp_controller
{
$mchat_new_config = array();
$validation = array();
foreach ($this->settings->global as $config_name => $config_data)
foreach ($this->settings->global_settings() as $config_name => $config_data)
{
$default = $this->settings->cfg($config_name);
settype($default, gettype($config_data['default']));
@@ -109,10 +138,15 @@ class acp_controller
}
}
// Remove leading & trailing | characters to not break allowed BBCodes
$mchat_new_config['mchat_bbcode_disallowed'] = trim($mchat_new_config['mchat_bbcode_disallowed'], '|');
// Don't allow changing pruning settings for non founders
if (!$is_founder)
{
unset($mchat_new_config['mchat_prune']);
unset($mchat_new_config['mchat_prune_gc']);
unset($mchat_new_config['mchat_prune_mode']);
unset($mchat_new_config['mchat_prune_num']);
}
@@ -128,6 +162,20 @@ class acp_controller
$error[] = 'FORM_INVALID';
}
/**
* Event to modify ACP global settings data before they are updated
*
* @event dmzx.mchat.acp_globalsettings_update_data
* @var array mchat_new_config Array containing the ACP settings data that is about to be sent to the database
* @var array error Array with error lang keys
* @since 2.0.0-RC7
*/
$vars = array(
'mchat_new_config',
'error',
);
extract($this->dispatcher->trigger_event('dmzx.mchat.acp_globalsettings_update_data', compact($vars)));
if (!$error)
{
// Set the options the user configured
@@ -150,8 +198,8 @@ class acp_controller
{
if ($is_founder && $this->request->is_set_post('mchat_purge') && $this->request->variable('mchat_purge_confirm', false) && check_form_key('acp_mchat'))
{
$this->db->sql_query('TRUNCATE TABLE ' . $this->mchat_table);
$this->db->sql_query('TRUNCATE TABLE ' . $this->mchat_log_table);
$this->db->sql_query('DELETE FROM ' . $this->mchat_table);
$this->db->sql_query('DELETE FROM ' . $this->mchat_log_table);
$this->cache->destroy('sql', $this->mchat_log_table);
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PURGED', false, array($this->user->data['username']));
trigger_error($this->user->lang('MCHAT_PURGED') . adm_back_link($u_action));
@@ -163,19 +211,36 @@ class acp_controller
}
}
foreach (array_keys($this->settings->global) as $key)
{
$this->template->assign_var(strtoupper($key), $this->settings->cfg($key));
}
$this->template->assign_vars(array(
$template_data = array(
'MCHAT_ERROR' => implode('<br />', $error),
'MCHAT_VERSION' => $this->settings->cfg('mchat_version'),
'MCHAT_FOUNDER' => $is_founder,
'S_MCHAT_PRUNE_MODE_OPTIONS' => $this->get_prune_mode_options($this->settings->cfg('mchat_prune_mode')),
'L_MCHAT_BBCODES_DISALLOWED_EXPLAIN' => $this->user->lang('MCHAT_BBCODES_DISALLOWED_EXPLAIN', '<a href="' . append_sid("{$this->root_path}adm/index.$this->php_ext", 'i=bbcodes', true, $this->user->session_id) . '">', '</a>'),
'L_MCHAT_TIMEOUT_EXPLAIN' => $this->user->lang('MCHAT_TIMEOUT_EXPLAIN','<a href="' . append_sid("{$this->root_path}adm/index.$this->php_ext", 'i=board&amp;mode=load', true, $this->user->session_id) . '">', '</a>', $this->settings->cfg('session_length')),
'U_ACTION' => $u_action,
));
);
foreach (array_keys($this->settings->global_settings()) as $key)
{
$template_data[strtoupper($key)] = $this->settings->cfg($key);
}
/**
* Event to modify ACP global settings template data
*
* @event dmzx.mchat.acp_globalsettings_modify_template_data
* @var array template_data Array containing the template data for the ACP settings
* @var array error Array with error lang keys
* @since 2.0.0-RC7
*/
$vars = array(
'template_data',
'error',
);
extract($this->dispatcher->trigger_event('dmzx.mchat.acp_globalsettings_modify_template_data', compact($vars)));
$this->template->assign_vars($template_data);
}
/**
@@ -185,15 +250,13 @@ class acp_controller
{
add_form_key('acp_mchat');
$this->user->add_lang_ext('dmzx/mchat', 'mchat_ucp');
$error = array();
if ($this->request->is_set_post('submit'))
{
$mchat_new_config = array();
$validation = array();
foreach ($this->settings->ucp as $config_name => $config_data)
foreach ($this->settings->ucp_settings() as $config_name => $config_data)
{
$default = $this->settings->cfg($config_name, true);
settype($default, gettype($config_data['default']));
@@ -217,16 +280,36 @@ class acp_controller
$error[] = 'FORM_INVALID';
}
$mchat_new_user_config = array();
if ($this->request->variable('mchat_overwrite', 0) && $this->request->variable('mchat_overwrite_confirm', 0))
{
foreach ($mchat_new_config as $config_name => $config_value)
{
$mchat_new_user_config['user_' . $config_name] = $config_value;
}
}
/**
* Event to modify ACP global user settings data before they are updated
*
* @event dmzx.mchat.acp_globalusersettings_update_data
* @var array mchat_new_config Array containing the ACP global user settings data that is about to be sent to the database
* @var array mchat_new_user_config Array containing the user settings data when overwriting all user settings
* @var array error Array with error lang keys
* @since 2.0.0-RC7
*/
$vars = array(
'mchat_new_config',
'mchat_new_user_config',
'error',
);
extract($this->dispatcher->trigger_event('dmzx.mchat.acp_globalusersettings_update_data', compact($vars)));
if (!$error)
{
if ($this->request->variable('mchat_overwrite', 0) && $this->request->variable('mchat_overwrite_confirm', 0))
if ($mchat_new_user_config)
{
$mchat_new_user_config = array();
foreach ($mchat_new_config as $config_name => $config_value)
{
$mchat_new_user_config['user_' . $config_name] = $config_value;
}
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $mchat_new_user_config);
$this->db->sql_query($sql);
}
@@ -247,23 +330,59 @@ class acp_controller
$error = array_map(array($this->user, 'lang'), $error);
}
foreach (array_keys($this->settings->ucp) as $key)
// Force global date format for $selected_date value, not user-specific
$selected_date = $this->settings->cfg('mchat_date', true);
$template_data = $this->settings->get_date_template_data($selected_date);
foreach (array_keys($this->settings->ucp_settings()) as $key)
{
$this->template->assign_var(strtoupper($key), $this->settings->cfg($key, true));
$template_data[strtoupper($key)] = $this->settings->cfg($key, true);
}
// Force global date format for $selected value, not user-specific
$selected = $this->settings->cfg('mchat_date', true);
$date_template_data = $this->settings->get_date_template_data($selected);
$this->template->assign_vars($date_template_data);
$notifications_template_data = $this->settings->get_enabled_post_notifications_lang();
$this->template->assign_var('MCHAT_POSTS_ENABLED_LANG', $notifications_template_data);
$this->template->assign_vars(array(
'MCHAT_ERROR' => implode('<br />', $error),
'MCHAT_VERSION' => $this->settings->cfg('mchat_version'),
'U_ACTION' => $u_action,
$template_data = array_merge($template_data, array(
'MCHAT_POSTS_ENABLED_LANG' => $this->settings->get_enabled_post_notifications_lang(),
'MCHAT_ERROR' => implode('<br />', $error),
'MCHAT_VERSION' => $this->settings->cfg('mchat_version'),
'U_ACTION' => $u_action,
));
/**
* Event to modify ACP global user settings template data
*
* @event dmzx.mchat.acp_globalusersettings_modify_template_data
* @var array template_data Array containing the template data for the ACP user settings
* @var array error Array with error lang keys
* @since 2.0.0-RC7
*/
$vars = array(
'template_data',
'error',
);
extract($this->dispatcher->trigger_event('dmzx.mchat.acp_globalusersettings_modify_template_data', compact($vars)));
$this->template->assign_vars($template_data);
}
/**
* @param $selected
* @return array
*/
protected function get_prune_mode_options($selected)
{
if (empty($this->settings->prune_modes[$selected]))
{
$selected = 0;
}
$prune_mode_options = '';
foreach ($this->settings->prune_modes as $i => $prune_mode)
{
$prune_mode_options .= '<option value="' . $i . '"' . (($i == $selected) ? ' selected="selected"' : '') . '>';
$prune_mode_options .= $this->user->lang('MCHAT_ACP_' . strtoupper($prune_mode));
$prune_mode_options .= '</option>';
}
return $prune_mode_options;
}
}

View File

@@ -4,33 +4,44 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\controller;
use dmzx\mchat\core\settings;
use phpbb\auth\auth;
use phpbb\db\driver\driver_interface as db_interface;
use phpbb\event\dispatcher_interface;
use phpbb\request\request_interface;
use phpbb\template\template;
use phpbb\user;
class ucp_controller
{
/** @var \phpbb\template\template */
/** @var template */
protected $template;
/** @var \phpbb\user */
/** @var user */
protected $user;
/** @var \phpbb\auth\auth */
/** @var auth */
protected $auth;
/** @var \phpbb\db\driver\driver_interface */
/** @var db_interface */
protected $db;
/** @var \phpbb\request\request */
/** @var request_interface */
protected $request;
/** @var \dmzx\mchat\core\settings */
/** @var settings */
protected $settings;
/** @var dispatcher_interface */
protected $dispatcher;
/** @var string */
protected $root_path;
@@ -40,16 +51,27 @@ class ucp_controller
/**
* Constructor
*
* @param \phpbb\template\template $template
* @param \phpbb\user $user
* @param \phpbb\auth\auth $auth
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\request\request $request
* @param \dmzx\mchat\core\settings $settings
* @param string $root_path
* @param string $php_ext
* @param template $template
* @param user $user
* @param auth $auth
* @param db_interface $db
* @param request_interface $request
* @param settings $settings
* @param dispatcher_interface $dispatcher
* @param string $root_path
* @param string $php_ext
*/
public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\request\request $request, \dmzx\mchat\core\settings $settings, $root_path, $php_ext)
public function __construct(
template $template,
user $user,
auth $auth,
db_interface $db,
request_interface $request,
settings $settings,
dispatcher_interface $dispatcher,
$root_path,
$php_ext
)
{
$this->template = $template;
$this->user = $user;
@@ -57,6 +79,7 @@ class ucp_controller
$this->db = $db;
$this->request = $request;
$this->settings = $settings;
$this->dispatcher = $dispatcher;
$this->root_path = $root_path;
$this->php_ext = $php_ext;
}
@@ -76,7 +99,7 @@ class ucp_controller
{
$mchat_new_config = array();
$validation = array();
foreach ($this->settings->ucp as $config_name => $config_data)
foreach ($this->settings->ucp_settings() as $config_name => $config_data)
{
if ($this->auth->acl_get('u_' . $config_name))
{
@@ -103,6 +126,20 @@ class ucp_controller
$error[] = 'FORM_INVALID';
}
/**
* Event to modify UCP settings data before they are updated
*
* @event dmzx.mchat.ucp_update_data
* @var array mchat_new_config Array containing the user settings data that are about to be sent to the database
* @var array error Array with error lang keys
* @since 2.0.0-RC7
*/
$vars = array(
'mchat_new_config',
'error',
);
extract($this->dispatcher->trigger_event('dmzx.mchat.ucp_update_data', compact($vars)));
if (!$error)
{
$sql = 'UPDATE ' . USERS_TABLE . '
@@ -119,17 +156,18 @@ class ucp_controller
$error = array_map(array($this->user, 'lang'), $error);
}
$selected_date = $this->settings->cfg('mchat_date');
$template_data = $this->settings->get_date_template_data($selected_date);
$auth_count = 0;
foreach (array_keys($this->settings->ucp) as $config_name)
foreach (array_keys($this->settings->ucp_settings()) as $config_name)
{
$upper = strtoupper($config_name);
$auth = $this->auth->acl_get('u_' . $config_name);
$this->template->assign_vars(array(
$upper => $this->settings->cfg($config_name),
$upper . '_AUTH' => $auth,
));
$template_data[$upper] = $this->settings->cfg($config_name);
$template_data[$upper . '_AUTH'] = $auth;
if ($auth)
{
@@ -137,17 +175,29 @@ class ucp_controller
}
}
$selected = $this->settings->cfg('mchat_date');
$date_template_data = $this->settings->get_date_template_data($selected);
$this->template->assign_vars($date_template_data);
$notifications_template_data = $this->settings->get_enabled_post_notifications_lang();
$this->template->assign_var('MCHAT_POSTS_ENABLED_LANG', $notifications_template_data);
$this->template->assign_vars(array(
$template_data = array_merge($template_data, array(
'MCHAT_POSTS_ENABLED_LANG' => $this->settings->get_enabled_post_notifications_lang(),
'ERROR' => sizeof($error) ? implode('<br />', $error) : '',
'MCHAT_AUTH_COUNT' => $auth_count,
'S_UCP_ACTION' => $u_action,
));
/**
* Event to modify UCP settings template data
*
* @event dmzx.mchat.ucp_modify_template_data
* @var array template_data Array containing the template data for the UCP settings
* @var int auth_count Number of settings the user is authorized do see & adjust
* @var array error Array with error lang keys
* @since 2.0.0-RC7
*/
$vars = array(
'template_data',
'auth_count',
'error',
);
extract($this->dispatcher->trigger_event('dmzx.mchat.ucp_modify_template_data', compact($vars)));
$this->template->assign_vars($template_data);
}
}

View File

@@ -4,34 +4,41 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\core;
use phpbb\auth\auth;
use phpbb\cache\driver\driver_interface as cache_interface;
use phpbb\db\driver\driver_interface as db_interface;
use phpbb\event\dispatcher_interface;
use phpbb\log\log_interface;
use phpbb\user;
class functions
{
/** @var \dmzx\mchat\core\settings */
/** @var settings */
protected $settings;
/** @var \phpbb\user */
/** @var user */
protected $user;
/** @var \phpbb\auth\auth */
/** @var auth */
protected $auth;
/** @var \phpbb\log\log */
/** @var log_interface */
protected $log;
/** @var \phpbb\db\driver\driver_interface */
/** @var db_interface */
protected $db;
/** @var \phpbb\cache\driver\driver_interface */
/** @var cache_interface */
protected $cache;
/** @var \phpbb\event\dispatcher_interface */
/** @var dispatcher_interface */
protected $dispatcher;
/** @var string */
@@ -70,33 +77,46 @@ class functions
/**
* Constructor
*
* @param \dmzx\mchat\core\settings $settings
* @param \phpbb\user $user
* @param \phpbb\auth\auth $auth
* @param \phpbb\log\log_interface $log
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\cache\driver\driver_interface $cache
* @param \phpbb\event\dispatcher_interface $dispatcher
* @param string $root_path
* @param string $php_ext
* @param string $mchat_table
* @param string $mchat_log_table
* @param string $mchat_sessions_table
* @param settings $settings
* @param user $user
* @param auth $auth
* @param log_interface $log
* @param db_interface $db
* @param cache_interface $cache
* @param dispatcher_interface $dispatcher
* @param string $root_path
* @param string $php_ext
* @param string $mchat_table
* @param string $mchat_log_table
* @param string $mchat_sessions_table
*/
function __construct(\dmzx\mchat\core\settings $settings, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, $root_path, $php_ext, $mchat_table, $mchat_log_table, $mchat_sessions_table)
function __construct(
settings $settings,
user $user,
auth $auth,
log_interface $log,
db_interface $db,
cache_interface $cache,
dispatcher_interface $dispatcher,
$root_path,
$php_ext,
$mchat_table,
$mchat_log_table,
$mchat_sessions_table
)
{
$this->settings = $settings;
$this->user = $user;
$this->auth = $auth;
$this->log = $log;
$this->db = $db;
$this->cache = $cache;
$this->dispatcher = $dispatcher;
$this->root_path = $root_path;
$this->php_ext = $php_ext;
$this->mchat_table = $mchat_table;
$this->mchat_log_table = $mchat_log_table;
$this->mchat_sessions_table = $mchat_sessions_table;
$this->settings = $settings;
$this->user = $user;
$this->auth = $auth;
$this->log = $log;
$this->db = $db;
$this->cache = $cache;
$this->dispatcher = $dispatcher;
$this->root_path = $root_path;
$this->php_ext = $php_ext;
$this->mchat_table = $mchat_table;
$this->mchat_log_table = $mchat_log_table;
$this->mchat_sessions_table = $mchat_sessions_table;
}
/**
@@ -288,39 +308,48 @@ class functions
/**
* Prune messages
*
* @param int|array $user_ids
* @return array
*/
public function mchat_prune()
public function mchat_prune($user_ids = array())
{
$sql_aray = array(
$prune_num = (int) $this->settings->cfg('mchat_prune_num');
$prune_mode = (int) $this->settings->cfg('mchat_prune_mode');
if (empty($this->settings->prune_modes[$prune_mode]))
{
return array();
}
$sql_array = array(
'SELECT' => 'message_id',
'FROM' => array($this->mchat_table => 'm'),
);
$prune_num = $this->settings->cfg('mchat_prune_num');
if (ctype_digit($prune_num))
if ($user_ids)
{
// Retain fixed number of messages
if (!is_array($user_ids))
{
$user_ids = array($user_ids);
}
$sql_array['WHERE'] = $this->db->sql_in_set('m.user_id', $user_ids);
$offset = 0;
}
else if ($this->settings->prune_modes[$prune_mode] === 'messages')
{
// Skip fixed number of messages, delete all others
$sql_array['ORDER_BY'] = 'm.message_id DESC';
$offset = $prune_num;
$sql_aray['ORDER_BY'] = 'message_id DESC';
}
else
{
// Retain messages of a time period
$time_period = strtotime($prune_num, 0);
if ($time_period === false)
{
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PRUNE_FAIL', false, array($this->user->data['username']));
return false;
}
// Delete messages older than time period
$sql_array['WHERE'] = 'm.message_time < ' . (int) strtotime($prune_num * $prune_mode . ' hours ago');
$offset = 0;
$sql_aray['WHERE'] = 'message_time < ' . (int) (time() - $time_period);
}
$sql = $this->db->sql_build_query('SELECT', $sql_aray);
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query_limit($sql, 0, $offset);
$rows = $this->db->sql_fetchrowset();
$this->db->sql_freeresult($result);
@@ -337,10 +366,13 @@ class functions
*
* @event dmzx.mchat.prune_before
* @var array prune_ids Array of message IDs that are about to be pruned
* @var array user_ids Array of user IDs that are being pruned
* @since 2.0.0-RC6
* @changed 2.0.1 Added user_ids
*/
$vars = array(
'prune_ids',
'user_ids',
);
extract($this->dispatcher->trigger_event('dmzx.mchat.prune_before', compact($vars)));
@@ -349,9 +381,13 @@ class functions
$this->db->sql_query('DELETE FROM ' . $this->mchat_table . ' WHERE ' . $this->db->sql_in_set('message_id', $prune_ids));
$this->db->sql_query('DELETE FROM ' . $this->mchat_log_table . ' WHERE ' . $this->db->sql_in_set('message_id', $prune_ids));
$this->cache->destroy('sql', $this->mchat_log_table);
}
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PRUNED', false, array($this->user->data['username'], count($prune_ids)));
// Only add a log entry if message pruning was not triggered by user pruning
if (!$user_ids)
{
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PRUNED', false, array($this->user->data['username'], count($prune_ids)));
}
}
return $prune_ids;
}
@@ -363,9 +399,12 @@ class functions
*/
public function mchat_total_message_count()
{
$sql_where_ary = $this->get_sql_where_for_notifcation_messages();
$sql_array = array(
'SELECT' => 'COUNT(*) AS rows_total',
'FROM' => array($this->mchat_table => 'm'),
'WHERE' => $sql_where_ary ? $this->db->sql_escape('(' . implode(') AND (', $sql_where_ary) . ')') : '',
);
/**
@@ -418,22 +457,11 @@ class functions
$sql_where_message_id[] = $this->db->sql_in_set('m.message_id', array_map('intval', $message_ids));
}
$sql_where_ary = $sql_where_message_id ? array(implode(' OR ', $sql_where_message_id)) : array();
$sql_where_ary = $this->get_sql_where_for_notifcation_messages();
if ($this->settings->cfg('mchat_posts'))
if ($sql_where_message_id)
{
// If the current user doesn't have permission to see hidden users, exclude their login posts
if (!$this->auth->acl_get('u_viewonline'))
{
$sql_where_ary[] = 'm.post_id <> ' . (int) self::LOGIN_HIDDEN . // Exclude all notifications that were created by hidden users ...
' OR m.user_id = ' . (int) $this->user->data['user_id'] . // ... but include all login notifications of the current user
' OR m.forum_id <> 0'; // ... and include all post notifications
}
}
else
{
// Exclude all post notifications
$sql_where_ary[] = 'm.post_id = 0';
$sql_where_ary[] = implode(' OR ', $sql_where_message_id);
}
$sql_array = array(
@@ -490,6 +518,35 @@ class functions
return $rows;
}
/**
* Generates SQL where conditions to include or exlude notifacation
* messages based on the current user's settings and permissions
*
* @return array
*/
protected function get_sql_where_for_notifcation_messages()
{
$sql_where_ary = array();
if ($this->settings->cfg('mchat_posts'))
{
// If the current user doesn't have permission to see hidden users, exclude their login posts
if (!$this->auth->acl_get('u_viewonline'))
{
$sql_where_ary[] = 'm.post_id <> ' . (int) self::LOGIN_HIDDEN . // Exclude all notifications that were created by hidden users ...
' OR m.user_id = ' . (int) $this->user->data['user_id'] . // ... but include all login notifications of the current user
' OR m.forum_id <> 0'; // ... and include all post notifications
}
}
else
{
// Exclude all post notifications
$sql_where_ary[] = 'm.post_id = 0';
}
return $sql_where_ary;
}
/**
* Fetches log entries from the database and sorts them
*
@@ -633,7 +690,7 @@ class functions
return array();
}
$sql = 'SELECT p.post_id, p.post_subject, f.forum_name
$sql = 'SELECT p.post_id, p.post_subject, f.forum_id, f.forum_name
FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f
WHERE p.forum_id = f.forum_id
AND ' . $this->db->sql_in_set('p.post_id', $post_ids);
@@ -646,14 +703,19 @@ class functions
foreach ($rows as $row)
{
// Skip deleted posts
if (isset($row['post_subject']))
{
$post_subjects[$row['post_id']] = array(
'post_subject' => $row['post_subject'],
'forum_name' => $row['forum_name'],
);
}
$post_subjects[$row['post_id']] = array(
'post_subject' => $row['post_subject'],
'forum_id' => $row['forum_id'],
'forum_name' => $row['forum_name'],
);
}
// Handle deleted posts
$non_existent_post_ids = array_diff($post_ids, array_keys($post_subjects));
foreach ($non_existent_post_ids as $post_id)
{
$post_subjects[$post_id] = null;
}
return $post_subjects;
@@ -769,14 +831,13 @@ class functions
/**
* Returns user ID & name of the specified message
*
* @param $message_id
* @param int $message_id
* @return array
*/
public function mchat_author_for_message($message_id)
{
$sql = 'SELECT u.user_id, u.username, m.message_time, m.forum_id, m.post_id
$sql = 'SELECT m.user_id, m.message_time, m.post_id
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);
$row = $this->db->sql_fetchrow($result);

View File

@@ -4,46 +4,56 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\core;
use Symfony\Component\HttpFoundation\JsonResponse;
use phpbb\auth\auth;
use phpbb\collapsiblecategories\operator\operator as cc_operator;
use phpbb\controller\helper;
use phpbb\event\dispatcher_interface;
use phpbb\exception\http_exception;
use phpbb\extension\manager;
use phpbb\pagination;
use phpbb\request\request_interface;
use phpbb\template\template;
use phpbb\textformatter\parser_interface;
use phpbb\user;
use Symfony\Component\HttpFoundation\JsonResponse;
class mchat
{
/** @var \dmzx\mchat\core\functions */
/** @var functions */
protected $functions;
/** @var \dmzx\mchat\core\settings */
/** @var settings */
protected $settings;
/** @var \phpbb\controller\helper */
/** @var helper */
protected $helper;
/** @var \phpbb\template\template */
/** @var template */
protected $template;
/** @var \phpbb\user */
/** @var user */
protected $user;
/** @var \phpbb\auth\auth */
/** @var auth */
protected $auth;
/** @var \phpbb\pagination */
/** @var pagination */
protected $pagination;
/** @var \phpbb\request\request */
/** @var request_interface */
protected $request;
/** @var \phpbb\event\dispatcher_interface */
/** @var dispatcher_interface */
protected $dispatcher;
/** @var \phpbb\extension\manager */
/** @var manager */
protected $extension_manager;
/** @var string */
@@ -52,7 +62,10 @@ class mchat
/** @var string */
protected $php_ext;
/** @var \phpbb\collapsiblecategories\operator\operator */
/** @var parser_interface */
protected $parser;
/** @var cc_operator */
protected $cc_operator;
/** @var boolean */
@@ -67,21 +80,37 @@ class mchat
/**
* Constructor
*
* @param \dmzx\mchat\core\functions $functions
* @param \dmzx\mchat\core\settings $settings
* @param \phpbb\controller\helper $helper
* @param \phpbb\template\template $template
* @param \phpbb\user $user
* @param \phpbb\auth\auth $auth
* @param \phpbb\pagination $pagination
* @param \phpbb\request\request $request
* @param \phpbb\event\dispatcher_interface $dispatcher
* @param \phpbb\extension\manager $extension_manager
* @param string $root_path
* @param string $php_ext
* @param \phpbb\collapsiblecategories\operator\operator $cc_operator
* @param functions $functions
* @param settings $settings
* @param helper $helper
* @param template $template
* @param user $user
* @param auth $auth
* @param pagination $pagination
* @param request_interface $request
* @param dispatcher_interface $dispatcher
* @param manager $extension_manager
* @param string $root_path
* @param string $php_ext
* @param parser_interface $parser
* @param cc_operator $cc_operator
*/
public function __construct(\dmzx\mchat\core\functions $functions, \dmzx\mchat\core\settings $settings, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\pagination $pagination, \phpbb\request\request $request, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\extension\manager $extension_manager, $root_path, $php_ext, \phpbb\collapsiblecategories\operator\operator $cc_operator = null)
public function __construct(
functions $functions,
settings $settings,
helper $helper,
template $template,
user $user,
auth $auth,
pagination $pagination,
request_interface $request,
dispatcher_interface $dispatcher,
manager $extension_manager,
$root_path,
$php_ext,
parser_interface $parser = null,
cc_operator $cc_operator = null
)
{
$this->functions = $functions;
$this->settings = $settings;
@@ -95,6 +124,7 @@ class mchat
$this->extension_manager = $extension_manager;
$this->root_path = $root_path;
$this->php_ext = $php_ext;
$this->parser = $parser;
$this->cc_operator = $cc_operator;
$this->template->assign_vars(array(
@@ -315,11 +345,18 @@ class mchat
$message = $this->request->variable('message', '', true);
$message_data = array(
'user_id' => $this->user->data['user_id'],
'user_ip' => $this->user->data['session_ip'],
'message_time' => time(),
);
if ($this->settings->cfg('mchat_capital_letter'))
{
$message = utf8_ucfirst($message);
}
$message_data = $this->process_message($message);
$message_data = array_merge($message_data, array(
'user_id' => $this->user->data['user_id'],
'user_ip' => $this->user->data['session_ip'],
'message_time' => time(),
));
/**
* Event to modify a new message before it is inserted in the database
@@ -335,14 +372,7 @@ class mchat
);
extract($this->dispatcher->trigger_event('dmzx.mchat.action_add_before', compact($vars)));
$sql_ary = array_merge($this->process_message($message), $message_data);
if ($this->settings->cfg('mchat_capital_letter'))
{
$sql_ary['message'] = utf8_ucfirst($sql_ary['message']);
}
$is_new_session = $this->functions->mchat_action('add', $sql_ary);
$is_new_session = $this->functions->mchat_action('add', $message_data);
$response = $this->action_refresh(true);
@@ -393,7 +423,13 @@ class mchat
$author = $this->functions->mchat_author_for_message($message_id);
if (!$author || $author['post_id'] || !$this->auth_message('edit', $author['user_id'], $author['message_time']))
if (!$author)
{
throw new http_exception(410, 'MCHAT_MESSAGE_DELETED');
}
// If post_id is not 0 it's a notification and notifications can't be edited
if ($author['post_id'] || !$this->auth_message('edit', $author['user_id'], $author['message_time']))
{
throw new http_exception(403, 'NO_AUTH_OPERATION');
}
@@ -453,7 +489,12 @@ class mchat
$author = $this->functions->mchat_author_for_message($message_id);
if (!$author || !$this->auth_message('delete', $author['user_id'], $author['message_time']))
if (!$author)
{
throw new http_exception(410, 'MCHAT_MESSAGE_DELETED');
}
if (!$this->auth_message('delete', $author['user_id'], $author['message_time']))
{
throw new http_exception(403, 'NO_AUTH_OPERATION');
}
@@ -767,7 +808,7 @@ class mchat
'MCHAT_ARCHIVE' => $this->auth->acl_get('u_mchat_archive'),
'MCHAT_RULES' => $this->user->lang('MCHAT_RULES_MESSAGE') || $this->settings->cfg('mchat_rules'),
'MCHAT_WHOIS_REFRESH_EXPLAIN' => $this->user->lang('MCHAT_WHO_IS_REFRESH_EXPLAIN', $this->settings->cfg('mchat_whois_refresh')),
'MCHAT_SESSION_TIMELEFT' => $this->user->lang('MCHAT_SESSION_ENDS', gmdate('H:i:s', (int) $this->settings->cfg('mchat_timeout'))),
'MCHAT_SESSION_TIMELEFT' => $this->user->lang('MCHAT_SESSION_ENDS', gmdate($this->settings->cfg('mchat_timeout') >= 3600 ? 'H:i:s' : 'i:s', $this->settings->cfg('mchat_timeout'))),
'MCHAT_LOG_ID' => $this->functions->get_latest_log_id(),
'MCHAT_STATIC_MESS' => htmlspecialchars_decode($static_message),
'A_MCHAT_MESS_LONG' => addslashes($this->user->lang('MCHAT_MESS_LONG', $this->settings->cfg('mchat_max_message_lngth'))),
@@ -805,7 +846,7 @@ class mchat
{
$this->template->assign_block_vars('mchaturl', array(
'ACTION' => $action,
'URL' => $this->helper->route('dmzx_mchat_action_' . $action . '_controller'),
'URL' => $this->helper->route('dmzx_mchat_action_' . $action . '_controller', array(), false),
'IS_LAST' => $i + 1 === count($actions),
));
}
@@ -815,7 +856,7 @@ class mchat
$rows = $this->functions->mchat_get_messages(array(), 0, $limit, $start);
$this->assign_global_template_data();
$this->assign_messages($rows);
$this->assign_messages($rows, $page);
// Render pagination
if ($page === 'archive')
@@ -896,19 +937,16 @@ class mchat
$md_manager = $this->extension_manager->create_extension_metadata_manager('dmzx/mchat', $this->template);
$meta = $md_manager->get_metadata();
$author_names = array();
$author_homepages = array();
foreach (array_slice($meta['authors'], 0, 2) as $author)
{
$author_names[] = $author['name'];
$author_homepages[] = sprintf('<a href="%1$s" title="%2$s">%2$s</a>', $author['homepage'], $author['name']);
}
$this->template->assign_vars(array(
'MCHAT_DISPLAY_NAME' => $meta['extra']['display-name'],
'MCHAT_AUTHOR_NAMES' => implode(' &bull; ', $author_names),
'MCHAT_AUTHOR_HOMEPAGES' => implode(' &bull; ', $author_homepages),
'MCHAT_AUTHOR_HOMEPAGES' => implode(' &amp; ', $author_homepages),
));
}
@@ -963,8 +1001,9 @@ class mchat
* Assigns all message rows to the template
*
* @param array $rows
* @param string $page
*/
public function assign_messages($rows)
public function assign_messages($rows, $page = '')
{
$rows = array_filter($rows, array($this, 'has_read_auth'));
@@ -973,8 +1012,24 @@ class mchat
return;
}
// Reverse the array if messages appear at the bottom
if (!$this->settings->cfg('mchat_message_top'))
// At this point the rows are sorted by ID bottom to top.
// We need to reverse the array if they need to be sorted top to bottom.
$reverse = false;
$mchat_message_top = $this->settings->cfg('mchat_message_top');
if ($page === 'archive')
{
$mchat_archive_sort = $this->settings->cfg('mchat_archive_sort');
if ($mchat_archive_sort == settings::ARCHIVE_SORT_TOP_BOTTOM || $mchat_archive_sort == settings::ARCHIVE_SORT_USER && !$mchat_message_top)
{
$reverse = true;
}
}
else if (!$mchat_message_top)
{
$reverse = true;
}
if ($reverse)
{
$rows = array_reverse($rows);
}
@@ -990,12 +1045,12 @@ class mchat
$user_avatars = array();
// Cache avatars
$display_avatar = $this->display_avatars();
foreach ($rows as $row)
{
if (!isset($user_avatars[$row['user_id']]))
{
$display_avatar = $this->display_avatars() && $row['user_avatar'];
$user_avatars[$row['user_id']] = !$display_avatar ? '' : phpbb_get_user_avatar(array(
$user_avatars[$row['user_id']] = !$display_avatar || !$row['user_avatar'] ? '' : phpbb_get_user_avatar(array(
'avatar' => $row['user_avatar'],
'avatar_type' => $row['user_avatar_type'],
'avatar_width' => $row['user_avatar_width'] >= $row['user_avatar_height'] ? 40 : 0,
@@ -1025,7 +1080,16 @@ class mchat
$message_age = time() - $row['message_time'];
$minutes_ago = $this->get_minutes_ago($message_age);
$datetime = $this->user->format_date($row['message_time'], $this->settings->cfg('mchat_date'), true);
$absolute_datetime = $this->user->format_date($row['message_time'], $this->settings->cfg('mchat_date'), true);
// If relative time is selected, also display "today" / "yesterday", else display absolute time.
if ($this->settings->cfg('mchat_relative_time'))
{
$datetime = $this->user->format_date($row['message_time'], $this->settings->cfg('mchat_date'), false);
}
else
{
$datetime = $this->user->format_date($row['message_time'], $this->settings->cfg('mchat_date'), true);
}
$is_poster = $row['user_id'] != ANONYMOUS && $this->user->data['user_id'] == $row['user_id'];
@@ -1049,7 +1113,7 @@ class mchat
'MCHAT_U_PERMISSIONS' => append_sid("{$board_url}{$this->root_path}adm/index.{$this->php_ext}", 'i=permissions&amp;mode=setting_user_global&amp;user_id%5B0%5D=' . $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' => $minutes_ago === -1 ? $datetime : $this->user->lang('MCHAT_MINUTES_AGO', $minutes_ago),
'MCHAT_DATETIME' => $datetime,
'MCHAT_DATETIME' => $absolute_datetime,
'MCHAT_MINUTES_AGO' => $minutes_ago,
'MCHAT_RELATIVE_UPDATE' => 60 - $message_age % 60,
'MCHAT_MESSAGE_TIME' => $row['message_time'],
@@ -1184,12 +1248,23 @@ class mchat
'#' => 'p' . $row['post_id'],
));
// We prefer $post_data because it was fetched from the forums table just now.
// $row might contain outdated data if a post was moved to a new forum.
$forum_id = isset($post_data['forum_id']) ? $post_data['forum_id'] : $row['forum_id'];
$viewforum_url = append_sid($board_url . 'viewforum.' . $this->php_ext, array(
'f' => $row['forum_id'],
'f' => $forum_id,
));
$args[] = '[url=' . $viewtopic_url . ']' . $post_data['post_subject'] . '[/url]';
$args[] = '[url=' . $viewforum_url . ']' . $post_data['forum_name'] . '[/url]';
if ($post_data)
{
$args[] = '[url=' . $viewtopic_url . ']' . $post_data['post_subject'] . '[/url]';
$args[] = '[url=' . $viewforum_url . ']' . $post_data['forum_name'] . '[/url]';
}
else
{
$args[0] .= '_DELETED';
}
}
else if ($row['post_id'] == functions::LOGIN_HIDDEN)
{
@@ -1328,7 +1403,7 @@ class mchat
*/
public function set_user_default_values($sql_ary)
{
foreach (array_keys($this->settings->ucp) as $config_name)
foreach (array_keys($this->settings->ucp_settings()) as $config_name)
{
$sql_ary['user_' . $config_name] = $this->settings->cfg($config_name, true);
}
@@ -1453,7 +1528,8 @@ class mchat
// Must not exceed character limit
if ($this->settings->cfg('mchat_max_message_lngth'))
{
if (utf8_strlen($message) > $this->settings->cfg('mchat_max_message_lngth'))
$message_without_entities = htmlspecialchars_decode($message, ENT_COMPAT);
if (utf8_strlen($message_without_entities) > $this->settings->cfg('mchat_max_message_lngth'))
{
throw new http_exception(400, 'MCHAT_MESS_LONG', array($this->settings->cfg('mchat_max_message_lngth')));
}
@@ -1469,22 +1545,34 @@ class mchat
$this->settings->set_cfg('max_post_smilies', 0, true);
}
$mchat_bbcode = $this->settings->cfg('allow_bbcode') && $this->auth->acl_get('u_mchat_bbcode');
$mchat_urls = $this->settings->cfg('allow_post_links') && $this->auth->acl_get('u_mchat_urls');
$mchat_smilies = $this->settings->cfg('allow_smilies') && $this->auth->acl_get('u_mchat_smilies');
$disallowed_bbcodes = array_filter(explode('|', $this->settings->cfg('mchat_bbcode_disallowed')));
// Add function part code from http://wiki.phpbb.com/Parsing_text
$uid = $bitfield = $options = '';
generate_text_for_storage($message, $uid, $bitfield, $options, $mchat_bbcode, $mchat_urls, $mchat_smilies);
$mchat_bbcode = $this->settings->cfg('allow_bbcode') && $this->auth->acl_get('u_mchat_bbcode');
$mchat_magic_urls = $this->settings->cfg('allow_post_links') && $this->auth->acl_get('u_mchat_urls');
$mchat_smilies = $this->settings->cfg('allow_smilies') && $this->auth->acl_get('u_mchat_smilies');
// Not allowed bbcodes
if (!$mchat_bbcode)
// These arguments for generate_text_for_storage() are ignored in 3.1.x
$mchat_img = $mchat_flash = $mchat_quote = $mchat_url = $mchat_bbcode;
// Disallowed bbcodes for 3.2.x
if ($disallowed_bbcodes && $this->parser !== null)
{
$message = preg_replace('#\[/?[^\[\]]+\]#Usi', '', $message);
$mchat_img &= !in_array('img', $disallowed_bbcodes);
$mchat_flash &= !in_array('flash', $disallowed_bbcodes);
$mchat_quote &= !in_array('quote', $disallowed_bbcodes);
$mchat_url &= !in_array('url', $disallowed_bbcodes);
foreach ($disallowed_bbcodes as $bbcode)
{
$this->parser->disable_bbcode($bbcode);
}
}
// Disallowed bbcodes
if ($this->settings->cfg('mchat_bbcode_disallowed'))
$uid = $bitfield = $options = '';
generate_text_for_storage($message, $uid, $bitfield, $options, $mchat_bbcode, $mchat_magic_urls, $mchat_smilies, $mchat_img, $mchat_flash, $mchat_quote, $mchat_url);
// Disallowed bbcodes for 3.1.x
if ($disallowed_bbcodes && $this->parser === null)
{
$bbcode_replace = array(
'#\[(' . str_replace('*', '\*', $this->settings->cfg('mchat_bbcode_disallowed')) . ')[^\[\]]+\]#Usi',

View File

@@ -4,31 +4,39 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\core;
use phpbb\auth\auth;
use phpbb\config\config;
use phpbb\event\dispatcher_interface;
use phpbb\user;
class settings
{
/** @var \phpbb\user */
/** @var user */
protected $user;
/** @var \phpbb\config\config */
/** @var config */
protected $config;
/** @var \phpbb\auth\auth */
/** @var auth */
protected $auth;
/** @var dispatcher_interface */
protected $dispatcher;
/**
* Keys for global settings that only the administrator is allowed to modify.
* The values are stored in the phpbb_config table.
*
* @var array
*/
public $global;
protected $global_settings;
/**
* Keys for user-specific settings for which the administrator can set default
@@ -39,7 +47,20 @@ class settings
*
* @var array
*/
public $ucp;
protected $ucp_settings;
/**
* Prune modes listed in the ACP. For values other than messages the key is the
* amount of hours that is later multiplied with the value that is set in the ACP.
*
* @var array
*/
public $prune_modes = array(
0 => 'messages',
1 => 'hours',
24 => 'days',
168 => 'weeks',
);
/** @var bool */
public $is_phpbb31;
@@ -47,20 +68,44 @@ class settings
/** @var bool */
public $is_phpbb32;
/**
* Possible values of the global setting mchat_archive_sort
*/
const ARCHIVE_SORT_TOP_BOTTOM = 0;
const ARCHIVE_SORT_BOTTOM_TOP = 1;
const ARCHIVE_SORT_USER = 2;
/**
* Constructor
*
* @param \phpbb\user $user
* @param \phpbb\config\config $config
* @param \phpbb\auth\auth $auth
* @param user $user
* @param config $config
* @param auth $auth
* @param dispatcher_interface $dispatcher
*/
public function __construct(\phpbb\user $user, \phpbb\config\config $config, \phpbb\auth\auth $auth)
public function __construct(
user $user,
config $config,
auth $auth,
dispatcher_interface $dispatcher
)
{
$this->user = $user;
$this->config = $config;
$this->auth = $auth;
$this->dispatcher = $dispatcher;
$this->global = array(
$this->is_phpbb31 = phpbb_version_compare(PHPBB_VERSION, '3.1.0@dev', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.2.0@dev', '<');
$this->is_phpbb32 = phpbb_version_compare(PHPBB_VERSION, '3.2.0@dev', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.3.0@dev', '<');
}
/**
* @return array
*/
public function initialize_global_settings()
{
$global_settings = array(
'mchat_archive_sort' => array('default' => self::ARCHIVE_SORT_BOTTOM_TOP),
'mchat_bbcode_disallowed' => array('default' => '', 'validation' => array('string', false, 0, 255)),
'mchat_custom_height' => array('default' => 350, 'validation' => array('num', false, 50, 1000)),
'mchat_custom_page' => array('default' => 1),
@@ -82,7 +127,9 @@ class settings
'mchat_posts_topic' => array('default' => 0),
'mchat_posts_login' => array('default' => 0),
'mchat_prune' => array('default' => 0),
'mchat_prune_num' => array('default' => '0'),
'mchat_prune_gc' => array('default' => strtotime('1 day', 0)),
'mchat_prune_mode' => array('default' => 0),
'mchat_prune_num' => array('default' => 0),
'mchat_refresh' => array('default' => 10, 'validation' => array('num', false, 5, 60)),
'mchat_rules' => array('default' => '', 'validation' => array('string', false, 0, 255)),
'mchat_static_message' => array('default' => '', 'validation' => array('string', false, 0, 255)),
@@ -90,7 +137,27 @@ class settings
'mchat_whois_refresh' => array('default' => 60, 'validation' => array('num', false, 10, 300)),
);
$this->ucp = array(
/**
* Event to modify global settings data
*
* @event dmzx.mchat.global_settings_modify
* @var array global_settings Array containing global settings data
* @since 2.0.0-RC7
*/
$vars = array(
'global_settings',
);
extract($this->dispatcher->trigger_event('dmzx.mchat.global_settings_modify', compact($vars)));
return $global_settings;
}
/**
* @return array
*/
public function initialize_ucp_settings()
{
$ucp_settings = array(
'mchat_avatars' => array('default' => 1),
'mchat_capital_letter' => array('default' => 1),
'mchat_character_count' => array('default' => 1),
@@ -107,8 +174,45 @@ class settings
'mchat_whois_index' => array('default' => 1),
);
$this->is_phpbb31 = phpbb_version_compare(PHPBB_VERSION, '3.1.0@dev', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.2.0@dev', '<');
$this->is_phpbb32 = phpbb_version_compare(PHPBB_VERSION, '3.2.0@dev', '>=') && phpbb_version_compare(PHPBB_VERSION, '3.3.0@dev', '<');
/**
* Event to modify UCP settings data
*
* @event dmzx.mchat.ucp_settings_modify
* @var array ucp_settings Array containing UCP settings data
* @since 2.0.0-RC7
*/
$vars = array(
'ucp_settings',
);
extract($this->dispatcher->trigger_event('dmzx.mchat.ucp_settings_modify', compact($vars)));
return $ucp_settings;
}
/**
* @return array
*/
public function global_settings()
{
if (empty($this->global_settings))
{
$this->global_settings = $this->initialize_global_settings();
}
return $this->global_settings;
}
/**
* @return array
*/
public function ucp_settings()
{
if (empty($this->ucp_settings))
{
$this->ucp_settings = $this->initialize_ucp_settings();
}
return $this->ucp_settings;
}
/**
@@ -124,13 +228,15 @@ class settings
/**
* @param string $config
* @param array $user_data
* @param \phpbb\auth\auth $auth
* @param auth $auth
* @param bool $force_global
* @return string
*/
public function cfg_user($config, $user_data, $auth, $force_global = false)
{
if (!$force_global && isset($this->ucp[$config]) && $auth->acl_get('u_' . $config))
$ucp_settings = $this->ucp_settings();
if (!$force_global && isset($ucp_settings[$config]) && $auth->acl_get('u_' . $config))
{
return $user_data['user_' . $config];
}
@@ -180,9 +286,11 @@ class settings
}
$dateformat_options .= '>' . $this->user->lang('MCHAT_CUSTOM_DATEFORMAT') . '</option>';
$ucp_settings = $this->ucp_settings();
return array(
'S_MCHAT_DATEFORMAT_OPTIONS' => $dateformat_options,
'A_MCHAT_DEFAULT_DATEFORMAT' => addslashes($this->ucp['mchat_date']['default']),
'A_MCHAT_DEFAULT_DATEFORMAT' => addslashes($ucp_settings['mchat_date']['default']),
'S_MCHAT_CUSTOM_DATEFORMAT' => $s_custom,
);
}

View File

@@ -4,31 +4,38 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\cron;
class mchat_prune extends \phpbb\cron\task\base
use dmzx\mchat\core\functions;
use dmzx\mchat\core\settings;
use phpbb\cron\task\base;
class mchat_prune extends base
{
/** @var \dmzx\mchat\core\functions */
/** @var functions */
protected $functions;
/** @var \dmzx\mchat\core\settings */
/** @var settings */
protected $settings;
/**
* Constructor
*
* @param \dmzx\mchat\core\functions $functions
* @param \dmzx\mchat\core\settings $settings
* @param functions $functions
* @param settings $settings
*/
public function __construct(\dmzx\mchat\core\functions $functions, \dmzx\mchat\core\settings $settings)
public function __construct(
functions $functions,
settings $settings
)
{
$this->functions = $functions;
$this->settings = $settings;
$this->functions = $functions;
$this->settings = $settings;
}
/**

View File

@@ -4,30 +4,39 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\event;
use dmzx\mchat\core\functions;
use dmzx\mchat\core\settings;
use phpbb\auth\auth;
use phpbb\request\request_interface;
use phpbb\template\template;
use phpbb\user;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class acp_listener implements EventSubscriberInterface
{
/** @var \phpbb\template\template */
/** @var template */
protected $template;
/** @var \phpbb\request\request */
/** @var request_interface */
protected $request;
/** @var \phpbb\user */
/** @var user */
protected $user;
/** @var \dmzx\mchat\core\settings */
/** @var settings */
protected $settings;
/** @var functions */
protected $functions;
/** @var string */
protected $root_path;
@@ -37,19 +46,29 @@ class acp_listener implements EventSubscriberInterface
/**
* Constructor
*
* @param \phpbb\template\template $template
* @param \phpbb\request\request $request
* @param \phpbb\user $user
* @param \dmzx\mchat\core\settings $settings
* @param string $root_path
* @param string $php_ext
* @param template $template
* @param request_interface $request
* @param user $user
* @param settings $settings
* @param functions $functions
* @param string $root_path
* @param string $php_ext
*/
public function __construct(\phpbb\template\template $template, \phpbb\request\request $request, \phpbb\user $user, \dmzx\mchat\core\settings $settings, $root_path, $php_ext)
public function __construct(
template $template,
request_interface $request,
user $user,
settings $settings,
functions $functions,
$root_path,
$php_ext
)
{
$this->template = $template;
$this->request = $request;
$this->user = $user;
$this->settings = $settings;
$this->functions = $functions;
$this->root_path = $root_path;
$this->php_ext = $php_ext;
}
@@ -63,6 +82,8 @@ class acp_listener implements EventSubscriberInterface
'core.permissions' => 'permissions',
'core.acp_users_prefs_modify_sql' => 'acp_users_prefs_modify_sql',
'core.acp_users_prefs_modify_template_data' => 'acp_users_prefs_modify_template_data',
'core.acp_users_overview_before' => 'acp_users_overview_before',
'core.delete_user_after' => 'delete_user_after',
);
}
@@ -73,7 +94,7 @@ class acp_listener implements EventSubscriberInterface
{
$ucp_configs = array();
foreach (array_keys($this->settings->ucp) as $config_name)
foreach (array_keys($this->settings->ucp_settings()) as $config_name)
{
$ucp_configs[] = 'u_' . $config_name;
}
@@ -131,11 +152,11 @@ class acp_listener implements EventSubscriberInterface
$user_id = $event['user_row']['user_id'];
$auth = new \phpbb\auth\auth();
$auth = new auth();
$userdata = $auth->obtain_user_data($user_id);
$auth->acl($userdata);
foreach ($this->settings->ucp as $config_name => $config_data)
foreach ($this->settings->ucp_settings() as $config_name => $config_data)
{
if ($auth->acl_get('u_' . $config_name))
{
@@ -168,7 +189,7 @@ class acp_listener implements EventSubscriberInterface
$user_id = $event['user_row']['user_id'];
$auth = new \phpbb\auth\auth();
$auth = new auth();
$userdata = $auth->obtain_user_data($user_id);
$auth->acl($userdata);
@@ -179,7 +200,7 @@ class acp_listener implements EventSubscriberInterface
$notifications_template_data = $this->settings->get_enabled_post_notifications_lang();
$this->template->assign_var('MCHAT_POSTS_ENABLED_LANG', $notifications_template_data);
foreach (array_keys($this->settings->ucp) as $config_name)
foreach (array_keys($this->settings->ucp_settings()) as $config_name)
{
$upper = strtoupper($config_name);
$this->template->assign_vars(array(
@@ -188,4 +209,28 @@ class acp_listener implements EventSubscriberInterface
));
}
}
/**
* @param Event $event
*/
public function acp_users_overview_before($event)
{
$this->user->add_lang_ext('dmzx/mchat', 'mchat_acp');
$this->template->assign_vars(array(
'L_RETAIN_POSTS' => $this->user->lang('MCHAT_RETAIN_MESSAGES', $this->user->lang('RETAIN_POSTS')),
'L_DELETE_POSTS' => $this->user->lang('MCHAT_DELETE_MESSAGES', $this->user->lang('DELETE_POSTS')),
));
}
/**
* @param Event $event
*/
public function delete_user_after($event)
{
if ($event['mode'] == 'remove')
{
$this->functions->mchat_prune($event['user_ids']);
}
}
}

View File

@@ -4,28 +4,32 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\event;
use dmzx\mchat\core\mchat;
use phpbb\controller\helper;
use phpbb\request\request_interface;
use phpbb\user;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class main_listener implements EventSubscriberInterface
{
/** @var \dmzx\mchat\core\mchat */
/** @var mchat */
protected $mchat;
/** @var \phpbb\controller\helper */
/** @var helper */
protected $helper;
/** @var \phpbb\user */
/** @var user */
protected $user;
/** @var \phpbb\request\request */
/** @var request_interface */
protected $request;
/** @var string */
@@ -34,13 +38,19 @@ class main_listener implements EventSubscriberInterface
/**
* Constructor
*
* @param \dmzx\mchat\core\mchat $mchat
* @param \phpbb\controller\helper $helper
* @param \phpbb\user $user
* @param \phpbb\request\request $request
* @param string $php_ext
* @param mchat $mchat
* @param helper $helper
* @param user $user
* @param request_interface $request
* @param string $php_ext
*/
public function __construct(\dmzx\mchat\core\mchat $mchat, \phpbb\controller\helper $helper, \phpbb\user $user, \phpbb\request\request $request, $php_ext)
public function __construct(
mchat $mchat,
helper $helper,
user $user,
request_interface $request,
$php_ext
)
{
$this->mchat = $mchat;
$this->helper = $helper;

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -15,6 +15,7 @@ class ext extends \phpbb\extension\base
{
/**
* Requires phpBB 3.1.7-PL1 due to usage of \phpbb\session:update_session_infos()
* Requires phpBB 3.1.8-RC1 due to HTTPS in version check
*
* @return bool
* @access public
@@ -36,9 +37,9 @@ class ext extends \phpbb\extension\base
if ($module_ids)
{
if (phpbb_version_compare($config['version'], '3.2.0-dev', '>='))
if (phpbb_version_compare(PHPBB_VERSION, '3.2.0-dev', '>='))
{
// For phpBB 3.2.x
// For phpBB >= 3.2.x
$lang = $this->container->get('language');
$lang->add_lang('mchat_acp', 'dmzx/mchat');
}
@@ -57,7 +58,7 @@ class ext extends \phpbb\extension\base
}
}
return phpbb_version_compare($config['version'], '3.1.7-PL1', '>=');
return phpbb_version_compare(PHPBB_VERSION, '3.1.8-RC1', '>=');
}
/**

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -61,8 +61,12 @@ $lang = array_merge($lang, array(
// Post notification messages (%1$s is replaced with a link to the new/edited post, %2$s is replaced with a link to the forum)
'MCHAT_NEW_POST' => 'posted a new topic: %1$s in %2$s',
'MCHAT_NEW_POST_DELETED' => 'posted a new topic that was deleted',
'MCHAT_NEW_REPLY' => 'posted a reply: %1$s in %2$s',
'MCHAT_NEW_REPLY_DELETED' => 'posted a reply that was deleted',
'MCHAT_NEW_QUOTE' => 'replied with a quote: %1$s in %2$s',
'MCHAT_NEW_QUOTE_DELETED' => 'posted a reply that was deleted',
'MCHAT_NEW_EDIT' => 'edited a post: %1$s in %2$s',
'MCHAT_NEW_EDIT_DELETED' => 'edited a post that was deleted',
'MCHAT_NEW_LOGIN' => 'just logged in',
));

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -44,7 +44,6 @@ $lang = array_merge($lang, array(
// Log entries (%1$s is replaced with the user name who triggered the event)
'LOG_MCHAT_CONFIG_UPDATE' => '<strong>mChat configuration updated</strong><br />» %1$s',
'LOG_MCHAT_TABLE_PRUNED' => '<strong>mChat messages pruned: %2$d</strong><br />» %1$s',
'LOG_MCHAT_TABLE_PRUNE_FAIL' => '<strong>mChat pruning failed: invalid time period</strong><br />» %1$s',
'LOG_MCHAT_TABLE_PURGED' => '<strong>mChat messages purged</strong><br />» %1$s',
'LOG_DELETED_MCHAT' => '<strong>mChat message deleted</strong><br />» %1$s',
'LOG_EDITED_MCHAT' => '<strong>mChat message edited</strong><br />» %1$s',

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -38,6 +38,7 @@ $lang = array_merge($lang, array(
'MCHAT_ADD' => 'Send',
'MCHAT_ARCHIVE' => 'Archive',
'MCHAT_ARCHIVE_PAGE' => 'mChat Archive',
'MCHAT_CUSTOM_PAGE' => 'mChat',
'MCHAT_BBCODES' => 'BBCodes',
'MCHAT_CUSTOM_BBCODES' => 'Custom BBCodes',
'MCHAT_DELCONFIRM' => 'Are you sure you want to delete this message?',
@@ -58,6 +59,7 @@ $lang = array_merge($lang, array(
'MCHAT_NOJAVASCRIPT' => 'Please enable JavaScript to use mChat.',
'MCHAT_NOMESSAGE' => 'No messages',
'MCHAT_NOMESSAGEINPUT' => 'You have not entered a message',
'MCHAT_MESSAGE_DELETED' => 'This message has been deleted.',
'MCHAT_OK' => 'OK',
'MCHAT_PAUSE' => 'Paused',
'MCHAT_PERMISSIONS' => 'Change users permissions',
@@ -82,6 +84,7 @@ $lang = array_merge($lang, array(
'MCHAT_CHARACTER_COUNT' => '<strong>{current}</strong> characters',
'MCHAT_CHARACTER_COUNT_LIMIT' => '<strong>{current}</strong> out of {max} characters',
'MCHAT_SESSION_ENDS_JS' => 'Chat session ends in {timeleft}',
'MCHAT_MENTION' => ' @{username} ',
// Custom translations for administrators
'MCHAT_RULES_MESSAGE' => '',

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -52,11 +52,17 @@ $lang = array_merge($lang, array(
'MCHAT_ACP_USER_PREFS_EXPLAIN' => 'Below are listed all mChat preferences of the selected user. Settings for which the selected user does not have permission to customise are disabled. These settings can be changed in the <em>Global user settings</em> mChat configuration section.',
// ACP settings
'MCHAT_ACP_CHARACTERS' => 'characters',
'MCHAT_ACP_MESSAGES' => 'messages',
'MCHAT_ACP_SECONDS' => 'seconds',
'MCHAT_ACP_HOURS' => 'hours',
'MCHAT_ACP_DAYS' => 'days',
'MCHAT_ACP_WEEKS' => 'weeks',
'MCHAT_ACP_GLOBALSETTINGS_TITLE' => 'mChat Global settings',
'MCHAT_ACP_GLOBALUSERSETTINGS_TITLE' => 'mChat Global user settings',
'MCHAT_VERSION' => 'Version',
'MCHAT_RULES' => 'Rules',
'MCHAT_RULES_EXPLAIN' => 'Enter the rules of the forum here. HTML code is allowed. <em>You are limited to 255 characters.</em><br />This message can be translated: edit the MCHAT_RULES_MESSAGE language key in /ext/dmzx/mchat/language/XX/mchat.php.',
'MCHAT_RULES_EXPLAIN' => 'Enter the rules here. HTML code is allowed. <em>You are limited to 255 characters.</em><br />This message can be translated: edit the MCHAT_RULES_MESSAGE language key in /ext/dmzx/mchat/language/XX/mchat.php.',
'MCHAT_CONFIG_SAVED' => 'mChat configuration has been updated',
'MCHAT_AVATARS' => 'Display avatars',
'MCHAT_AVATARS_EXPLAIN' => 'If set to yes, resized user avatars will be displayed',
@@ -70,9 +76,10 @@ $lang = array_merge($lang, array(
'MCHAT_LIVE_UPDATES' => 'Live updates of edited and deleted messages',
'MCHAT_LIVE_UPDATES_EXPLAIN' => 'When a user edits or deletes messages, the changes are updated live for all others, without them having to refresh the page. Disable this if you experience performance issues.',
'MCHAT_PRUNE' => 'Enable message pruning',
'MCHAT_PRUNE_EXPLAIN' => 'The messages table is pruned every 24 hours.',
'MCHAT_PRUNE_GC' => 'Message prune task interval',
'MCHAT_PRUNE_GC_EXPLAIN' => 'The time in seconds that needs to pass before the next message pruning is triggered. Note: this setting controls <em>when</em> messages are checked if they can be deleted. It does <em>not</em> control <em>which</em> messages are deleted. <em>Default is 86400 = 24 hours.</em>',
'MCHAT_PRUNE_NUM' => 'Messages to retain when pruning',
'MCHAT_PRUNE_NUM_EXPLAIN' => 'You can specify either a number to keep a fixed number of messages (example: <em>42</em>) or a time period (examples: <em>24 hours</em>, <em>5 days</em>, <em>2 weeks</em>, <em>1 month</em>). All messages older than the time period at the time of pruning will be deleted.',
'MCHAT_PRUNE_NUM_EXPLAIN' => 'When using messages a fixed number of messages will be kept. When using hours, days or weeks all messages older than the specified time period at the time of pruning will be deleted.',
'MCHAT_PRUNE_NOW' => 'Prune messages now',
'MCHAT_PRUNE_NOW_CONFIRM' => 'Confirm pruning messages',
'MCHAT_PRUNED' => '%1$d mChat messages have been pruned',
@@ -84,14 +91,17 @@ $lang = array_merge($lang, array(
'MCHAT_MESSAGE_NUM_INDEX_EXPLAIN' => '<em>You are limited from 5 to 50. Default is 10.</em>',
'MCHAT_MESSAGE_NUM_ARCHIVE' => 'Number of messages to display on the archive page',
'MCHAT_MESSAGE_NUM_ARCHIVE_EXPLAIN' => 'The maximum number of messages to show per page on the archive page.<br /><em>You are limited from 10 to 100. Default is 25.</em>',
'MCHAT_ARCHIVE_SORT' => 'Message sorting',
'MCHAT_ARCHIVE_SORT_TOP_BOTTOM' => 'Always sort messages top to bottom',
'MCHAT_ARCHIVE_SORT_BOTTOM_TOP' => 'Always sort messages bottom to top',
'MCHAT_ARCHIVE_SORT_USER' => 'Sort messages depending on the users <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 5 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 60 seconds. 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',
'MCHAT_MAX_MESSAGE_LENGTH_EXPLAIN' => 'Maximum number of characters allowed per message posted.<br /><em>You are limited from 0 to 1000. Default is 500. Set to 0 to disable.</em>',
'MCHAT_CUSTOM_PAGE' => 'Enable custom Page',
'MCHAT_CUSTOM_PAGE_EXPLAIN' => 'Allow the use of the custom page',
'MCHAT_CUSTOM_PAGE' => 'Enable custom page',
'MCHAT_CUSTOM_HEIGHT' => 'Custom page height',
'MCHAT_CUSTOM_HEIGHT_EXPLAIN' => 'The height of the chat box in pixels on the custom page.<br /><em>You are limited from 50 to 1000. Default is 350.</em>',
'MCHAT_BBCODES_DISALLOWED' => 'Disallowed bbcodes',
@@ -112,6 +122,10 @@ $lang = array_merge($lang, array(
'MCHAT_PURGE_CONFIRM' => 'Confirm deleting all messages',
'MCHAT_PURGED' => 'All mChat messages have been successfully deleted',
// '%1$s' contains 'Retain posts' and 'Delete posts' respectively
'MCHAT_RETAIN_MESSAGES' => '%1$s and retain mChat messages',
'MCHAT_DELETE_MESSAGES' => '%1$s and delete mChat messages',
// Error reporting
'TOO_LONG_MCHAT_BBCODE_DISALLOWED' => 'The disallowed bbcodes value is too long.',
'TOO_SMALL_MCHAT_CUSTOM_HEIGHT' => 'The custom height value is too small.',
@@ -138,5 +152,5 @@ $lang = array_merge($lang, array(
'TOO_SMALL_MCHAT_WHOIS_REFRESH' => 'The whois refresh value is too small.',
'TOO_LARGE_MCHAT_WHOIS_REFRESH' => 'The whois refresh value is too large.',
'MCHAT_30X_REMNANTS' => 'The installation as been aborted.<br />There are remnant modules from the mChat MOD for phpBB 3.0.x in the database. The mChat extension does not work correctly with these modules present.<br />You need to entirely uninstall the mChat MOD before being able to install the mChat extension. Specifically, the modules with the following IDs need to be deleted from the %1$smodules table: %2$s',
'MCHAT_30X_REMNANTS' => 'The installation has been aborted.<br />There are remnant modules from the mChat MOD for phpBB 3.0.x in the database. The mChat extension does not work correctly with these modules present.<br />You need to entirely uninstall the mChat MOD before being able to install the mChat extension. Specifically, the modules with the following IDs need to be deleted from the %1$smodules table: %2$s',
));

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -49,7 +49,7 @@ $lang = array_merge($lang, array(
'MCHAT_INPUT_AREA' => 'Input field',
'MCHAT_TEXT_AREA' => 'Text area',
'MCHAT_POSTS' => 'Display new posts (currently all disabled, can be enabled in the mChat Global Settings section in the ACP)',
'MCHAT_CHARACTER_COUNT' => 'Display number of characters when typing a message',
'MCHAT_DISPLAY_CHARACTER_COUNT' => 'Display number of characters when typing a message',
'MCHAT_RELATIVE_TIME' => 'Display relative time for new messages',
'MCHAT_RELATIVE_TIME_EXPLAIN' => 'Displays “just now”, “1 minute ago” and so on for each message. Set to <em>No</em> to always display the full date.',
'MCHAT_PAUSE_ON_INPUT' => 'Pause on input',

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -60,7 +60,7 @@ $lang = array_merge($lang, array(
'ACL_U_MCHAT_LOCATION' => 'Can customise <em>Location of mChat on the index page</em>',
'ACL_U_MCHAT_MESSAGE_TOP' => 'Can customise <em>Location of new chat messages</em>',
'ACL_U_MCHAT_PAUSE_ON_INPUT' => 'Can customise <em>Pause on input</em>',
'ACL_U_MCHAT_POSTS' => 'Can customise <em>Display new post</em>',
'ACL_U_MCHAT_POSTS' => 'Can customise <em>Display new posts</em>',
'ACL_U_MCHAT_RELATIVE_TIME' => 'Can customise <em>Display relative time</em>',
'ACL_U_MCHAT_SOUND' => 'Can customise <em>Play sounds</em>',
'ACL_U_MCHAT_WHOIS_INDEX' => 'Can customise <em>Display who is chatting below the chat</em>',

View File

@@ -0,0 +1,31 @@
<?php
/**
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 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_0_0 extends migration
{
static public function depends_on()
{
return array(
'\dmzx\mchat\migrations\mchat_2_0_0_rc7',
);
}
public function update_data()
{
return array(
array('config.update', array('mchat_version', '2.0.0')),
);
}
}

View File

@@ -4,14 +4,16 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\migrations;
class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
use phpbb\db\migration\migration;
class mchat_2_0_0_rc3 extends migration
{
static public function depends_on()
{
@@ -133,28 +135,39 @@ class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
array('module.add', array(
'acp',
'ACP_CAT_DOT_MODS',
'ACP_CAT_MCHAT'
'ACP_CAT_MCHAT',
)),
// Add ACP preferences module
array('module.add', array(
'acp',
'ACP_CAT_MCHAT',
array('module_basename' => '\dmzx\mchat\acp\acp_mchat_module'),
array(
'module_basename' => '\dmzx\mchat\acp\acp_mchat_module',
'modes' => array(
'globalsettings',
'globalusersettings',
),
),
)),
// Add UCP category
array('module.add', array(
'ucp',
0,
'UCP_MCHAT_CONFIG'
'UCP_MCHAT_CONFIG',
)),
// Add UCP preferences module
array('module.add', array(
'ucp',
'UCP_MCHAT_CONFIG',
array('module_basename' => '\dmzx\mchat\ucp\ucp_mchat_module'),
array(
'module_basename' => '\dmzx\mchat\ucp\ucp_mchat_module',
'modes' => array(
'configuration',
),
),
)),
);
}

View File

@@ -4,14 +4,16 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\migrations;
class mchat_2_0_0_rc4 extends \phpbb\db\migration\migration
use phpbb\db\migration\migration;
class mchat_2_0_0_rc4 extends migration
{
static public function depends_on()
{

View File

@@ -4,14 +4,16 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\migrations;
class mchat_2_0_0_rc5 extends \phpbb\db\migration\migration
use phpbb\db\migration\migration;
class mchat_2_0_0_rc5 extends migration
{
static public function depends_on()
{

View File

@@ -4,14 +4,16 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\migrations;
class mchat_2_0_0_rc6 extends \phpbb\db\migration\migration
use phpbb\db\migration\migration;
class mchat_2_0_0_rc6 extends migration
{
static public function depends_on()
{

View File

@@ -0,0 +1,67 @@
<?php
/**
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 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_0_0_rc7 extends migration
{
static public function depends_on()
{
return array(
'\dmzx\mchat\migrations\mchat_2_0_0_rc6',
);
}
public function update_data()
{
return array(
array('config.update', array('mchat_version', '2.0.0-RC7')),
array('config.add', array('mchat_prune_mode', 0)),
array('custom', array(array($this, 'fix_pruning_time_span'))),
);
}
/**
* In 2.0.0-RC6 it was possible to specify a time span like '45 minutes' or '4 days' to
* keep the messages from that time span when pruning messages. Since 2.0.0-RC7 it is
* only possible to specify the number of hours, days or weeks. If such a time span is
* defined in the mchat_prune_num config value it is converted here to the number of
* hours, rounded up to the next full hour.
*/
public function fix_pruning_time_span()
{
$prune_num = $this->config['mchat_prune_num'];
if (false === filter_var($prune_num, FILTER_VALIDATE_INT))
{
$time_span = strtotime($prune_num, 0);
if ($time_span !== false)
{
// A time span is specified. Convert it to number of hours.
$hours = ceil($time_span / 60 / 60);
$sql = 'UPDATE ' . CONFIG_TABLE . '
SET config_value = ' . (int) $hours . "
WHERE config_name = 'mchat_prune_num'";
$this->sql_query($sql);
// Set to 'hours' mode
$sql = 'UPDATE ' . CONFIG_TABLE . "
SET config_value = 1
WHERE config_name = 'mchat_prune_mode'";
$this->sql_query($sql);
}
}
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
*
* @package phpBB Extension - mChat
* @copyright (c) 2017 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace dmzx\mchat\migrations;
use dmzx\mchat\core\settings;
use phpbb\db\migration\migration;
class mchat_2_0_1 extends migration
{
static public function depends_on()
{
return array(
'\dmzx\mchat\migrations\mchat_2_0_0',
);
}
public function update_data()
{
return array(
array('config.update', array('mchat_version', '2.0.1')),
array('config.add', array('mchat_archive_sort', settings::ARCHIVE_SORT_BOTTOM_TOP)),
);
}
}

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1,2 @@
<!-- INCLUDECSS @dmzx_mchat/mchat.css -->
<!-- INCLUDECSS @dmzx_mchat/mchat_custom.css -->

View File

@@ -0,0 +1,11 @@
/**
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
.mchat-wrapper {
height: 100%;
}

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -1,10 +1,10 @@
/**
*
* @package phpBB Extension - mChat
* @copyright (c) 2009 By Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/
* @copyright (c) 2013 By Rich McGirr (RMcGirr83) http://rmcgirr83.org
* @copyright (c) 2015 By dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 By kasimi
* @copyright (c) 2009 Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/
* @copyright (c) 2013 Rich McGirr (RMcGirr83) http://rmcgirr83.org
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
@@ -72,11 +72,35 @@ jQuery.fn.reverse = function(reverse) {
return reverse === 'undefined' || reverse ? jQuery(this.toArray().reverse()) : this;
};
function StorageWrapper(storage, prefix) {
this.prefix = prefix;
try {
this.storage = window[storage];
this.storage.setItem(prefix, prefix);
this.storage.removeItem(prefix);
} catch (e) {
this.storage = false;
}
}
StorageWrapper.prototype.get = function(key) {
return this.storage && this.storage.getItem(this.prefix + key);
};
StorageWrapper.prototype.set = function(key, value) {
this.storage && this.storage.setItem(this.prefix + key, value);
};
StorageWrapper.prototype.remove = function(key) {
return this.storage && this.storage.removeItem(this.prefix + key);
};
jQuery(function($) {
"use strict";
$.extend(mChat, {
storage: new StorageWrapper('localStorage', mChat.cookie + 'mchat_'),
ajaxRequest: function(mode, sendHiddenFields, data) {
var deferred = $.Deferred();
if (sendHiddenFields) {
@@ -88,73 +112,77 @@ jQuery(function($) {
timeout: Math.min(mChat.refreshTime, 10000),
type: 'POST',
dataType: 'json',
data: data
}).done(function(json, status, xhr) {
var data = {
data: data,
additionalData: {
mode: mode,
json: json,
status: status,
xhr: xhr,
handle: true
};
$(mChat).trigger('mchat_ajax_done_before', [data]);
if (data.handle) {
if (json[mode]) {
deferred.resolve(data.json, data.status, data.xhr);
} else {
deferred.reject(data.xhr, data.status, mChat.lang.parserErr);
deferred: deferred
}
}).done(mChat.ajaxDone).fail(deferred.reject);
return deferred.promise().fail(mChat.ajaxFail);
},
ajaxDone: function(json, status, xhr) {
var data = {
mode: this.additionalData.mode,
json: json,
status: status,
xhr: xhr,
handle: true
};
$(mChat).trigger('mchat_ajax_done_before', [data]);
if (data.handle) {
if (json[this.additionalData.mode]) {
this.additionalData.deferred.resolve(data.json, data.status, data.xhr);
} else {
this.additionalData.deferred.reject(data.xhr, data.status, mChat.lang.parserErr);
}
}
},
ajaxFail: function(xhr, textStatus, errorThrown) {
if (mChat.pageIsUnloading) {
return;
}
if (typeof console !== 'undefined' && console.log) {
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown + ' (' + xhr.responseText + ')');
}
var data = {
mode: this.additionalData.mode,
xhr: xhr,
textStatus: textStatus,
errorThrown: errorThrown,
updateSession: function() {
if (this.xhr.status == 403) {
mChat.endSession(true);
} else if (this.xhr.status == 400) {
mChat.resetSession();
}
}
}).fail(function(xhr, status, error) {
deferred.reject(xhr, status, error);
});
return deferred.promise().fail(function(xhr, textStatus, errorThrown) {
if (mChat.pageIsUnloading) {
return;
}
if (typeof console !== 'undefined' && console.log) {
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown + ' (' + xhr.responseText + ')');
}
var data = {
mode: mode,
xhr: xhr,
textStatus: textStatus,
errorThrown: errorThrown,
updateSession: function(xhr) {
if (xhr.status == 403) {
mChat.endSession(true);
} else if (xhr.status == 400) {
mChat.resetSession();
}
}
};
$(mChat).trigger('mchat_ajax_fail_before', [data]);
mChat.sound('error');
mChat.cached('status-load', 'status-ok', 'status-paused').hide();
mChat.cached('status-error').show();
var responseText;
try {
responseText = xhr.responseJSON.message || errorThrown;
} catch (e) {
responseText = errorThrown;
}
};
$(mChat).trigger('mchat_ajax_fail_before', [data]);
mChat.sound('error');
mChat.cached('status-load', 'status-ok', 'status-paused').hide();
mChat.cached('status-error').show();
var responseText;
try {
responseText = data.xhr.responseJSON.message || data.errorThrown;
} catch (e) {
responseText = data.errorThrown;
}
if (responseText && responseText !== 'timeout') {
phpbb.alert(mChat.lang.err, responseText);
data.updateSession(data.xhr);
});
}
data.updateSession();
},
sound: function(file) {
if (!mChat.pageIsUnloading && !localStorage.getItem(mChat.cookie + 'mchat_no_sound')) {
var data = {
audio: mChat.cached('sound-' + file).get(0),
file: file,
play: true
};
$(mChat).trigger('mchat_sound_before', [data]);
if (data.play && data.audio.duration) {
data.audio.pause();
data.audio.currentTime = 0;
data.audio.play();
}
var data = {
audio: mChat.cached('sound-' + file).get(0),
file: file,
play: !mChat.pageIsUnloading && mChat.cached('user-sound').is(':checked')
};
$(mChat).trigger('mchat_sound_before', [data]);
if (data.play && data.audio && data.audio.duration) {
data.audio.pause();
data.audio.currentTime = 0;
data.audio.play();
}
},
titleAlert: function() {
@@ -169,11 +197,11 @@ jQuery(function($) {
},
toggle: function(name) {
var $elem = mChat.cached(name);
$elem.stop().slideToggle('fast', function() {
$elem.stop().slideToggle(200, function() {
if ($elem.is(':visible')) {
localStorage.setItem(mChat.cookie + 'mchat_show_' + name, 'yes');
mChat.storage.set('show_' + name, 'yes');
} else {
localStorage.removeItem(mChat.cookie + 'mchat_show_' + name);
mChat.storage.remove('show_' + name);
}
});
},
@@ -214,21 +242,15 @@ jQuery(function($) {
mChat.pauseSession();
var originalInputValue = mChat.cached('input').val();
var inputValue = originalInputValue;
var color = localStorage.getItem(mChat.cookie + 'mchat_color');
var color = mChat.storage.get('color');
if (color && inputValue.indexOf('[color=') === -1) {
inputValue = '[color=#' + color + '] ' + inputValue + ' [/color]';
}
mChat.cached('input').val('');
if (mChat.showCharCount) {
mChat.updateCharCount();
}
mChat.cached('input').val('').trigger('update.autogrow').focus();
mChat.refresh(inputValue).done(function() {
mChat.resetSession();
}).fail(function() {
mChat.cached('input').val(originalInputValue);
if (mChat.showCharCount) {
mChat.updateCharCount();
}
mChat.cached('input').val(originalInputValue).trigger('update.autogrow');
}).always(function() {
mChat.cached('add').prop('disabled', false);
setTimeout(function() {
@@ -326,7 +348,7 @@ jQuery(function($) {
handleWhoisResponse: function(json) {
var $whois = $(json.whois);
var $userlist = $whois.find('#mchat-userlist');
if (localStorage.getItem(mChat.cookie + 'mchat_show_userlist')) {
if (mChat.storage.get('show_userlist')) {
$userlist.show();
}
mChat.cached('whois').replaceWith($whois);
@@ -348,26 +370,25 @@ jQuery(function($) {
mChat.cached('messages').find('.mchat-no-messages').remove();
$messages.reverse(mChat.messageTop).hide().each(function(i) {
var $message = $(this);
var data = {
var dataAddMessageBefore = {
message: $message,
delay: mChat.refreshInterval ? 400 : 0,
abort: $.inArray($message.data('mchat-id'), mChat.messageIds) !== -1,
playSound: playSound
};
$(mChat).trigger('mchat_add_message_before', [data]);
if (data.abort) {
$(mChat).trigger('mchat_add_message_before', [dataAddMessageBefore]);
if (dataAddMessageBefore.abort) {
return;
}
if (data.playSound) {
if (dataAddMessageBefore.playSound) {
mChat.sound('add');
mChat.titleAlert();
playSound = false;
}
mChat.messageIds.push($message.data('mchat-id'));
setTimeout(function() {
var $container = mChat.cached('messages');
var data = {
container: $container,
var dataAddMessageAnimateBefore = {
container: mChat.cached('messages'),
message: $message,
add: function() {
if (mChat.messageTop) {
@@ -377,26 +398,38 @@ jQuery(function($) {
}
},
show: function() {
var scrollTop, scrollHeight = mChat.messageTop ? 0 : $container.get(0).scrollHeight;
if (mChat.messageTop && (scrollTop = this.container.scrollTop()) > 0) {
this.message.show();
this.container.scrollTop(scrollTop + this.message.outerHeight());
var container = this.container;
var scrollTop = container.scrollTop();
var scrollLeeway = 20;
if (mChat.messageTop && scrollTop <= scrollLeeway || !mChat.messageTop && scrollTop >= container.get(0).scrollHeight - container.height() - scrollLeeway) {
var animateOptions = {
duration: dataAddMessageBefore.delay - 10,
easing: 'swing'
};
this.message.slideDown(animateOptions);
if (mChat.messageTop) {
container.animate({scrollTop: 0}, animateOptions);
} else {
(animateOptions.complete = function() {
var scrollHeight = container.get(0).scrollHeight;
if (container.scrollTop() + container.height() < scrollHeight) {
container.animate({scrollTop: scrollHeight}, animateOptions);
}
})();
}
} else {
this.message.css('opacity', 0).slideDown('fast').animate({opacity: 1}, {duration: 'fast', queue: false});
}
if (!mChat.messageTop && this.container.scrollTop() >= scrollHeight - this.container.height()) {
this.container.animate({
scrollTop: scrollHeight,
easing: 'swing',
duration: 'slow'
});
this.message.show();
if (mChat.messageTop) {
this.container.scrollTop(scrollTop + this.message.outerHeight());
}
}
this.message.addClass('mchat-message-flash');
}
};
$(mChat).trigger('mchat_add_message_animate_before', [data]);
data.add();
data.show();
}, i * data.delay);
$(mChat).trigger('mchat_add_message_animate_before', [dataAddMessageAnimateBefore]);
dataAddMessageAnimateBefore.add();
dataAddMessageAnimateBefore.show();
}, i * dataAddMessageBefore.delay);
if (mChat.editDeleteLimit && $message.data('mchat-edit-delete-limit') && $message.find('[data-mchat-action="edit"], [data-mchat-action="del"]').length > 0) {
var id = $message.prop('id');
setTimeout(function() {
@@ -479,8 +512,9 @@ jQuery(function($) {
var selector = '.mchat-time[data-mchat-relative-update]';
clearInterval($message.find(selector).addBack(selector).data('mchat-relative-interval'));
},
timeLeftRegex: /\d\d:(\d\d:\d\d)/,
timeLeft: function(sessionTime) {
return (new Date(sessionTime * 1000)).toUTCString().match(/(\d\d:\d\d:\d\d)/)[0];
return (new Date(sessionTime * 1000)).toUTCString().match(mChat.timeLeftRegex)[mChat.timeout >= 3600000 ? 0 : 1];
},
countDown: function() {
mChat.sessionTime -= 1;
@@ -549,7 +583,7 @@ jQuery(function($) {
updateCharCount: function() {
var count = mChat.cached('input').val().length;
var charCount = mChat.lang.charCount.format({current: count, max: mChat.mssgLngth});
var $elem = mChat.cached('character-count').html(charCount).toggleClass('hidden', count === 0);
var $elem = mChat.cached('character-count').html(charCount).toggleClass('invisible', count === 0);
if (mChat.mssgLngth) {
$elem.toggleClass('error', count > mChat.mssgLngth);
}
@@ -557,25 +591,30 @@ jQuery(function($) {
mention: function() {
var $container = $(this).closest('.mchat-message');
var username = $container.data('mchat-username');
var usercolor = $container.data('mchat-usercolor');
if (usercolor) {
username = '[b][color=' + usercolor + ']' + username + '[/color][/b]';
} else if (mChat.allowBBCodes) {
username = '[b]' + username + '[/b]';
if (mChat.allowBBCodes) {
var usercolor = $container.data('mchat-usercolor');
var profileUrl = $container.find(".mchat-message-header a[class^='username']").prop('href');
if (usercolor) {
username = '[url=' + profileUrl + '][b][color=' + usercolor + ']' + username + '[/color][/b][/url]';
} else {
username = '[url=' + profileUrl + '][b]' + username + '[/b][/url]';
}
}
insert_text('@ ' + username + ', ');
insert_text(mChat.lang.mention.format({username: username}));
},
quote: function() {
var $container = $(this).closest('.mchat-message');
var username = $container.data('mchat-username');
var quote = $container.data('mchat-message');
insert_text('[quote="' + username + '"] ' + quote + '[/quote]');
mChat.cached('input').trigger('update.autogrow');
},
like: function() {
var $container = $(this).closest('.mchat-message');
var username = $container.data('mchat-username');
var quote = $container.data('mchat-message');
insert_text('[i]' + mChat.lang.likes + '[/i][quote="' + username + '"] ' + quote + '[/quote]');
mChat.cached('input').trigger('update.autogrow');
},
ip: function() {
popup(this.href, 750, 500);
@@ -608,16 +647,18 @@ jQuery(function($) {
mChat.resetSession();
if (!mChat.messageTop) {
mChat.cached('messages').animate({scrollTop: mChat.cached('messages')[0].scrollHeight, easing: 'swing', duration: 'slow'});
setTimeout(function() {
mChat.cached('messages').scrollTop(mChat.cached('messages')[0].scrollHeight);
}, 1);
}
mChat.cached('user-sound').prop('checked', mChat.playSound && !localStorage.getItem(mChat.cookie + 'mchat_no_sound')).change(function() {
mChat.cached('user-sound').prop('checked', mChat.playSound && !mChat.storage.get('no_sound')).change(function() {
if (this.checked) {
localStorage.removeItem(mChat.cookie + 'mchat_no_sound');
mChat.storage.remove('no_sound');
} else {
localStorage.setItem(mChat.cookie + 'mchat_no_sound', 'yes');
mChat.storage.set('no_sound', 'yes');
}
}).change();
});
$.each(mChat.removeBBCodes.split('|'), function(i, bbcode) {
var bbCodeClass = '.bbcode-' + bbcode.replaceMany({
@@ -632,7 +673,7 @@ jQuery(function($) {
$('#bbpalette,#abbc3_bbpalette,#color_wheel').prop('onclick', null).attr('data-mchat-toggle', 'colour');
$.each(['userlist', 'smilies', 'bbcodes', 'colour'], function(i, elem) {
if (localStorage.getItem(mChat.cookie + 'mchat_show_' + elem)) {
if (mChat.storage.get('show_' + elem)) {
mChat.cached(elem).toggle();
}
});
@@ -661,6 +702,11 @@ jQuery(function($) {
if (mChat.showCharCount) {
mChat.cached('form').on('input', mChat.updateCharCount);
mChat.cached('input').on('focus', function() {
setTimeout(function() {
mChat.updateCharCount();
}, 1);
});
}
mChat.cached('input').autogrow({
@@ -681,17 +727,17 @@ jQuery(function($) {
e.stopImmediatePropagation();
var $this = $(this);
var newColor = $this.data('color');
if (localStorage.getItem(mChat.cookie + 'mchat_color') === newColor) {
localStorage.removeItem(mChat.cookie + 'mchat_color');
if (mChat.storage.get('color') === newColor) {
mChat.storage.remove('color');
} else {
localStorage.setItem(mChat.cookie + 'mchat_color', newColor);
mChat.storage.set('color', newColor);
mChat.cached('colour').find('.colour-palette a').removeClass('remember-color');
}
$this.toggleClass('remember-color');
}
});
var color = localStorage.getItem(mChat.cookie + 'mchat_color');
var color = mChat.storage.get('color');
if (color) {
mChat.cached('colour').find('.colour-palette a[data-color="' + color + '"]').addClass('remember-color');
}

View File

@@ -2,9 +2,9 @@
<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js -->
<!-- ENDIF -->
<!-- INCLUDEJS javascript/jquery.autogrow-textarea.js -->
<!-- INCLUDEJS javascript/jquery.titlealert.min.js -->
<!-- INCLUDEJS javascript/mchat.js -->
<!-- INCLUDEJS @dmzx_mchat/javascript/jquery.autogrow-textarea.js -->
<!-- INCLUDEJS @dmzx_mchat/javascript/jquery.titlealert.min.js -->
<!-- INCLUDEJS @dmzx_mchat/javascript/mchat.js -->
<script type="text/javascript">
// <![CDATA[
@@ -53,6 +53,7 @@
delConfirm : '{LA_MCHAT_DELCONFIRM}',
sessOut : '{LA_MCHAT_SESSION_OUT}',
sessEnds : '{LA_MCHAT_SESSION_ENDS_JS}',
mention : '{LA_MCHAT_MENTION}',
refreshYes : '{A_MCHAT_REFRESH_YES}',
refreshNo : '{LA_MCHAT_REFRESH_NO}',
charCount : '<!-- IF MCHAT_MESSAGE_LNGTH -->{LA_MCHAT_CHARACTER_COUNT_LIMIT}<!-- ELSE -->{LA_MCHAT_CHARACTER_COUNT}<!-- ENDIF -->',

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1,3 @@
<!-- IF MCHAT_INDEX and MCHAT_LOCATION -->
<!-- INCLUDE @dmzx_mchat/mchat_body.html -->
<!-- ENDIF -->

View File

@@ -0,0 +1 @@
<!-- Leave empty -->

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -26,3 +26,15 @@ ul.mchat-buttons > li {
#mchat-panel #st_editor_buttons {
display: block !important;
}
.mchat-footer label {
padding-left: 3px;
}
@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {
#mchat-body {
overflow: auto;
}
}

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -1 +1,3 @@
<!-- IF MCHAT_INDEX and MCHAT_LOCATION --><!-- INCLUDE mchat_body.html --><!-- ENDIF -->
<!-- IF MCHAT_INDEX and MCHAT_LOCATION -->
<!-- INCLUDE @dmzx_mchat/mchat_body.html -->
<!-- ENDIF -->

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -19,3 +19,8 @@
#mChat + .forabg .collapse-box a:before {
content: '';
}
@keyframes flash-message {
0% { background-color: rgba(255, 155, 0, .5); }
100% { background-color: #D8D8D8; }
}

View File

@@ -2,11 +2,23 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
.forabg.mchat-wrapper {
padding: 0;
}
.mchat-wrapper .collapse-box h2 a {
color: #888;
}
.mchat-wrapper .collapse-box h2 a:before {
content: '' !important;
}
.icon-mchat > a:before {
content: '\f086';
font-family: 'FontAwesome';

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -1,3 +0,0 @@
<!-- IF MCHAT_CUSTOM_INCLUDE -->
<!-- INCLUDE mchat_body.html -->
<!-- ENDIF -->

View File

@@ -1 +1,3 @@
<!-- IF MCHAT_INDEX and not MCHAT_LOCATION --><!-- INCLUDE mchat_body.html --><!-- ENDIF -->
<!-- IF MCHAT_INDEX and not MCHAT_LOCATION -->
<!-- INCLUDE @dmzx_mchat/mchat_body.html -->
<!-- ENDIF -->

View File

@@ -1 +1,3 @@
<!-- IF MCHAT_INDEX and MCHAT_LOCATION --><!-- INCLUDE mchat_body.html --><!-- ENDIF -->
<!-- IF MCHAT_INDEX and MCHAT_LOCATION -->
<!-- INCLUDE @dmzx_mchat/mchat_body.html -->
<!-- ENDIF -->

View File

@@ -1,3 +1,3 @@
<!-- IF MCHAT_CUSTOM_PAGE and MCHAT_NAVBAR_LINK -->
<!-- INCLUDE mchat_navlink.html -->
<!-- INCLUDE @dmzx_mchat/mchat_navlink.html -->
<!-- ENDIF -->

View File

@@ -0,0 +1,7 @@
<!-- IF (MCHAT_CUSTOM_HEIGHT or MCHAT_INDEX_HEIGHT) and not MCHAT_IS_ARCHIVE_PAGE -->
<style>
#mchat-messages {
height: <!-- IF MCHAT_IS_CUSTOM_PAGE -->{MCHAT_CUSTOM_HEIGHT}<!-- ELSE -->{MCHAT_INDEX_HEIGHT}<!-- ENDIF -->px;
}
</style>
<!-- ENDIF -->

View File

@@ -2,7 +2,19 @@
<!-- INCLUDE overall_header.html -->
<!-- ENDIF -->
<!-- INCLUDE mchat_script_data.html -->
<!-- EVENT dmzx_mchat_overall_header_after -->
<!-- EVENT dmzx_mchat_header_before -->
<!-- IF MCHAT_IS_CUSTOM_PAGE -->
<h2>{L_MCHAT_CUSTOM_PAGE}</h2>
<!-- ELSEIF MCHAT_IS_ARCHIVE_PAGE -->
<h2>{L_MCHAT_ARCHIVE_PAGE}</h2>
<!-- ENDIF -->
<!-- EVENT dmzx_mchat_header_after -->
<!-- INCLUDE @dmzx_mchat/mchat_script_data.html -->
<!-- IF MCHAT_IS_ARCHIVE_PAGE and (.pagination or MCHAT_TOTAL_MESSAGES) -->
<div class="action-bar bar-top">
@@ -30,7 +42,7 @@
<div class="inner">
<ul class="topiclist">
<li class="header">
<!-- INCLUDE mchat_header.html -->
<!-- INCLUDE @dmzx_mchat/mchat_header.html -->
<!-- IF MCHAT_IS_COLLAPSIBLE -->
<a href="{U_MCHAT_COLLAPSE_URL}"
class="collapse-btn collapse-<!-- IF S_MCHAT_HIDDEN -->show<!-- ELSE -->hide<!-- ENDIF --> mchat-collapse"
@@ -64,7 +76,7 @@
</fieldset>
</div>
<div id="mchat-main">
<div id="mchat-main"<!-- IF MCHAT_MESSAGE_TOP --> class="mchat-messages-top"<!-- ENDIF -->>
<!-- IF MCHAT_STATIC_MESS and not MCHAT_IS_ARCHIVE_PAGE -->
<ul class="topiclist forums">
<li class="row mchat-static">{MCHAT_STATIC_MESS}</li>
@@ -73,9 +85,9 @@
<!-- EVENT dmzx_mchat_messages_container_before -->
<ul id="mchat-messages" class="topiclist forums"<!-- IF not MCHAT_IS_ARCHIVE_PAGE --> style="height:<!-- IF MCHAT_IS_CUSTOM_PAGE -->{MCHAT_CUSTOM_HEIGHT}<!-- ELSE -->{MCHAT_INDEX_HEIGHT}<!-- ENDIF -->px"<!-- ENDIF -->>
<ul id="mchat-messages" class="topiclist forums">
<!-- IF .mchatrow -->
<!-- INCLUDE mchat_messages.html -->
<!-- INCLUDE @dmzx_mchat/mchat_messages.html -->
<!-- ELSE -->
<li class="row mchat-static mchat-no-messages">{L_MCHAT_NOMESSAGE}</li>
<!-- ENDIF -->
@@ -84,7 +96,7 @@
<!-- EVENT dmzx_mchat_messages_container_after -->
</div>
<!-- INCLUDE mchat_panel.html -->
<!-- INCLUDE @dmzx_mchat/mchat_panel.html -->
</div>
<!-- EVENT dmzx_mchat_body_after -->
@@ -110,7 +122,7 @@
<!-- IF MCHAT_IS_CUSTOM_PAGE and MCHAT_WHOIS_REFRESH -->
<h3>{L_MCHAT_WHO_IS_CHATTING}</h3>
<!-- INCLUDE mchat_whois.html -->
<!-- INCLUDE @dmzx_mchat/mchat_whois.html -->
<div id="mchat-refresh">
<span id="mchat-refresh-explain">{MCHAT_WHOIS_REFRESH_EXPLAIN}</span>
<span id="mchat-refresh-pending" class="hidden">{L_MCHAT_REFRESHING}</span>
@@ -123,6 +135,8 @@
</div>
<!-- ENDIF -->
<!-- EVENT dmzx_mchat_overall_footer_before -->
<!-- IF MCHAT_IS_ARCHIVE_PAGE or MCHAT_IS_CUSTOM_PAGE -->
<!-- INCLUDE overall_footer.html -->
<!-- ENDIF -->

View File

@@ -11,9 +11,17 @@
</div>
<!-- ENDIF -->
<div class="mchat-message-wrapper">
<!-- INCLUDE mchat_messages_icons.html -->
<div class="mchat-message-header">{mchatrow.MCHAT_USERNAME_FULL} &bull; <span class="mchat-time" title="{mchatrow.MCHAT_DATETIME}"<!-- IF mchatrow.MCHAT_MINUTES_AGO != -1 --> data-mchat-minutes-ago="{mchatrow.MCHAT_MINUTES_AGO}" data-mchat-relative-update="{mchatrow.MCHAT_RELATIVE_UPDATE}"<!-- ENDIF -->>{mchatrow.MCHAT_TIME}</span></div>
<div class="mchat-text">{mchatrow.MCHAT_MESSAGE}</div>
<!-- INCLUDE @dmzx_mchat/mchat_messages_icons.html -->
<div class="mchat-message-header">
<!-- EVENT dmzx_mchat_messages_header_before -->
{mchatrow.MCHAT_USERNAME_FULL} &bull; <span class="mchat-time" title="{mchatrow.MCHAT_DATETIME}"<!-- IF mchatrow.MCHAT_MINUTES_AGO != -1 --> data-mchat-minutes-ago="{mchatrow.MCHAT_MINUTES_AGO}" data-mchat-relative-update="{mchatrow.MCHAT_RELATIVE_UPDATE}"<!-- ENDIF -->>{mchatrow.MCHAT_TIME}</span>
<!-- EVENT dmzx_mchat_messages_header_after -->
</div>
<div class="mchat-text">
<!-- EVENT dmzx_mchat_messages_text_before -->
{mchatrow.MCHAT_MESSAGE}
<!-- EVENT dmzx_mchat_messages_text_after -->
</div>
</div>
</li>
<!-- END mchatrow -->

View File

@@ -1,20 +1,28 @@
<!-- EVENT dmzx_mchat_messages_icons_before -->
<!-- IF not S_IS_BOT -->
<!-- DEFINE $MCHAT_ALLOW_MENTION = MCHAT_ALLOW_USE and not mchatrow.MCHAT_IS_POSTER and not MCHAT_IS_ARCHIVE_PAGE -->
<!-- DEFINE $MCHAT_ALLOW_QUOTE = MCHAT_ALLOW_USE and S_BBCODE_ALLOWED and MCHAT_ALLOW_QUOTE and not MCHAT_IS_ARCHIVE_PAGE -->
<!-- DEFINE $MCHAT_ALLOW_LIKE = MCHAT_ALLOW_USE and S_BBCODE_ALLOWED and MCHAT_ALLOW_LIKE and not MCHAT_IS_ARCHIVE_PAGE and not mchatrow.MCHAT_IS_POSTER -->
<!-- DEFINE $MCHAT_ALLOW_PM = MCHAT_ALLOW_PM and mchatrow.MCHAT_PM and mchatrow.U_VIEWPROFILE -->
<!-- DEFINE $MCHAT_ALLOW_IP = MCHAT_ALLOW_IP and TRUE -->
<!-- DEFINE $MCHAT_ALLOW_PERMISSIONS = MCHAT_ALLOW_PERMISSIONS and TRUE -->
<!-- DEFINE $MCHAT_ALLOW_EDIT = mchatrow.MCHAT_ALLOW_EDIT and not mchatrow.MCHAT_IS_NOTIFICATION -->
<!-- DEFINE $MCHAT_ALLOW_DEL = mchatrow.MCHAT_ALLOW_DEL -->
<!-- IF $MCHAT_ALLOW_MENTION or $MCHAT_ALLOW_QUOTE or $MCHAT_ALLOW_LIKE or $MCHAT_ALLOW_PM or MCHAT_ALLOW_IP or MCHAT_ALLOW_PERMISSIONS or $MCHAT_ALLOW_EDIT or $MCHAT_ALLOW_DEL -->
<!-- IF $MCHAT_ALLOW_MENTION or $MCHAT_ALLOW_QUOTE or $MCHAT_ALLOW_LIKE or $MCHAT_ALLOW_PM or MCHAT_ALLOW_IP or MCHAT_ALLOW_PERMISSIONS or $MCHAT_ALLOW_EDIT or $MCHAT_ALLOW_DEL or $MCHAT_ADD_CUSTOM_BUTTON -->
<ul class="mchat-buttons <!-- IF $MCHAT_USE_WHITE_MESSAGE_ICONS -->mchat-icons-white<!-- ELSE -->mchat-icons-black<!-- ENDIF -->">
<!-- EVENT dmzx_mchat_messages_icons_add_before -->
<!-- IF $MCHAT_ALLOW_MENTION --><li><a href="#" title="{L_MCHAT_RESPOND}" data-mchat-action="mention"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-mention<!-- ELSEIF IS_PHPBB32 -->fa fa-at<!-- ENDIF -->"><span>{L_MCHAT_RESPOND}</span></i></a></li><!-- ENDIF -->
<!-- IF $MCHAT_ALLOW_QUOTE --><li><a href="#" title="{L_REPLY_WITH_QUOTE}" data-mchat-action="quote"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-quote<!-- ELSEIF IS_PHPBB32 -->fa fa-quote-left<!-- ENDIF -->"><span>{L_REPLY_WITH_QUOTE}</span></i></a></li><!-- ENDIF -->
<!-- IF $MCHAT_ALLOW_LIKE --><li><a href="#" title="{L_MCHAT_LIKE}" data-mchat-action="like"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-like<!-- ELSEIF IS_PHPBB32 -->fa fa-thumbs-o-up<!-- ENDIF -->"><span>{L_MCHAT_LIKE}</span></i></a></li><!-- ENDIF -->
<!-- IF $MCHAT_ALLOW_PM --><li><a href="{mchatrow.MCHAT_PM}" title="{L_MCHAT_SEND_PM}"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-pm<!-- ELSEIF IS_PHPBB32 -->fa fa-envelope-o<!-- ENDIF -->"><span>{L_MCHAT_SEND_PM}</span></i></a></li><!-- ENDIF -->
<!-- IF MCHAT_ALLOW_IP --><li><a href="{mchatrow.MCHAT_U_IP}" title="{mchatrow.MCHAT_WHOIS_USER}" data-mchat-action="ip"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-ip<!-- ELSEIF IS_PHPBB32 -->fa fa-wifi<!-- ENDIF -->"><span>{mchatrow.MCHAT_WHOIS_USER}</span></i></a></li><!-- ENDIF -->
<!-- IF MCHAT_ALLOW_PERMISSIONS --><li><a href="{mchatrow.MCHAT_U_PERMISSIONS}" title="{L_MCHAT_PERMISSIONS}"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-permissions<!-- ELSEIF IS_PHPBB32 -->fa fa-exclamation-triangle<!-- ENDIF -->"><span>{L_MCHAT_PERMISSIONS}</span></i></a></li><!-- ENDIF -->
<!-- IF $MCHAT_ALLOW_IP --><li><a href="{mchatrow.MCHAT_U_IP}" title="{mchatrow.MCHAT_WHOIS_USER}" data-mchat-action="ip"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-ip<!-- ELSEIF IS_PHPBB32 -->fa fa-wifi<!-- ENDIF -->"><span>{mchatrow.MCHAT_WHOIS_USER}</span></i></a></li><!-- ENDIF -->
<!-- IF $MCHAT_ALLOW_PERMISSIONS --><li><a href="{mchatrow.MCHAT_U_PERMISSIONS}" title="{L_MCHAT_PERMISSIONS}"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-permissions<!-- ELSEIF IS_PHPBB32 -->fa fa-exclamation-triangle<!-- ENDIF -->"><span>{L_MCHAT_PERMISSIONS}</span></i></a></li><!-- ENDIF -->
<!-- IF $MCHAT_ALLOW_EDIT --><li><a href="#" title="{L_MCHAT_EDIT}" data-mchat-action="edit"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-edit<!-- ELSEIF IS_PHPBB32 -->fa fa-pencil<!-- ENDIF -->"><span>{L_MCHAT_EDIT}</span></i></a></li><!-- ENDIF -->
<!-- IF $MCHAT_ALLOW_DEL --><li><a href="#" title="{L_DELETE}" data-mchat-action="del"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-delete<!-- ELSEIF IS_PHPBB32 -->fa fa-trash-o<!-- ENDIF -->"><span>{L_DELETE}</span></i></a></li><!-- ENDIF -->
<!-- EVENT dmzx_mchat_messages_icons_add_after -->
</ul>
<!-- ENDIF -->
<!-- ENDIF -->
<!-- EVENT dmzx_mchat_messages_icons_after -->

View File

@@ -1,5 +1,6 @@
<li <!-- IF IS_PHPBB31 -->class="small-icon icon-mchat"<!-- ELSEIF IS_PHPBB32 -->data-last-responsive="true"<!-- ENDIF -->>
<li<!-- IF IS_PHPBB31 --> class="small-icon icon-mchat"<!-- ENDIF --> data-last-responsive="true">
<a href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" class="mchat-nav-link-title" role="menuitem">
<i<!-- IF IS_PHPBB32 --> class="icon fa fa-weixin"<!-- ENDIF --> aria-hidden="true"></i><span class="mchat-nav-link">{MCHAT_TITLE}</span>
<i<!-- IF IS_PHPBB32 --> class="icon fa fa-weixin"<!-- ENDIF --> aria-hidden="true"></i>
<span class="mchat-nav-link">{MCHAT_TITLE}</span>
</a>
</li>

View File

@@ -1,10 +1,10 @@
<div id="mchat-panel" class="panel cp-mini<!-- IF MCHAT_IS_ARCHIVE_PAGE --> hidden<!-- ENDIF -->">
<!-- IF MCHAT_IS_INDEX and MCHAT_WHOIS_REFRESH and MCHAT_WHOIS_INDEX -->
<!-- INCLUDE mchat_whois.html -->
<!-- INCLUDE @dmzx_mchat/mchat_whois.html -->
<!-- ENDIF -->
<!-- IF MCHAT_CHARACTER_COUNT and not MCHAT_IS_ARCHIVE_PAGE -->
<div id="mchat-character-count" class="hidden">{MCHAT_CHARACTER_COUNT}</div>
<div id="mchat-character-count" class="invisible">{MCHAT_CHARACTER_COUNT}</div>
<!-- ENDIF -->
<form id="mchat-form" name="postform" action="{U_MCHAT_CUSTOM_PAGE}" method="POST">
@@ -68,8 +68,7 @@
<span id="mchat-refresh-text">{MCHAT_REFRESH_YES}</span>
</li>
<!-- IF MCHAT_TIMEOUT --><li><span id="mchat-session">{MCHAT_SESSION_TIMELEFT}</span></li><!-- ENDIF -->
<!-- IF not MCHAT_SOUND_DISABLED --><li><label for="mchat-user-sound">{L_MCHAT_USESOUND} <input type="checkbox" id="mchat-user-sound"<!-- IF MCHAT_SOUND --> checked="checked"<!-- ENDIF --> /></label></li><!-- ENDIF -->
<li><span class="mchat-copyright" title="{MCHAT_AUTHOR_NAMES}">&copy;</span></li>
<!-- IF not MCHAT_SOUND_DISABLED --><li class="mchat-sound"><input type="checkbox" id="mchat-user-sound"<!-- IF MCHAT_SOUND --> checked="checked"<!-- ENDIF --> /><label for="mchat-user-sound">{L_MCHAT_USESOUND}</label></li><!-- ENDIF -->
</ul>
</div>
<!-- ENDIF -->

View File

@@ -15,6 +15,9 @@
<!-- IF MCHAT_AUTH_COUNT > 0 -->
<fieldset>
<!-- EVENT dmzx_mchat_ucp_index_before -->
<!-- IF MCHAT_INDEX_AUTH -->
<dl>
<dt><label for="user_mchat_index">{L_MCHAT_INDEX}{L_COLON}</label></dt>
@@ -51,7 +54,13 @@
</dd>
</dl>
<!-- ENDIF -->
<!-- EVENT dmzx_mchat_ucp_location_after -->
<hr />
<!-- EVENT dmzx_mchat_ucp_message_top_before -->
<!-- IF MCHAT_MESSAGE_TOP_AUTH -->
<dl>
<dt><label for="user_mchat_message_top">{L_MCHAT_MESSAGE_TOP}{L_COLON}</label><br /><span>{L_MCHAT_MESSAGE_TOP_EXPLAIN}</span></dt>
@@ -99,7 +108,7 @@
<!-- ENDIF -->
<!-- IF MCHAT_CHARACTER_COUNT_AUTH -->
<dl>
<dt><label for="user_mchat_character_count">{L_MCHAT_CHARACTER_COUNT}{L_COLON}</label></dt>
<dt><label for="user_mchat_character_count">{L_MCHAT_DISPLAY_CHARACTER_COUNT}{L_COLON}</label></dt>
<dd>
<label><input type="radio" name="user_mchat_character_count" value="1"<!-- IF MCHAT_CHARACTER_COUNT --> id="user_mchat_character_count" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" name="user_mchat_character_count" value="0"<!-- IF not MCHAT_CHARACTER_COUNT --> id="user_mchat_character_count" checked="checked"<!-- ENDIF --> /> {L_NO}</label>
@@ -135,7 +144,13 @@
</dd>
</dl>
<!-- ENDIF -->
<!-- EVENT dmzx_mchat_ucp_relative_time_after -->
<hr />
<!-- EVENT dmzx_mchat_ucp_posts_before -->
<!-- IF MCHAT_POSTS_AUTH and MCHAT_POSTS_ENABLED_LANG -->
<dl>
<dt><label for="user_mchat_posts">{MCHAT_POSTS_ENABLED_LANG}{L_COLON}</label></dt>
@@ -145,6 +160,9 @@
</dd>
</dl>
<!-- ENDIF -->
<!-- EVENT dmzx_mchat_ucp_posts_after -->
</fieldset>
<!-- ENDIF -->
</div>

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -12,7 +12,7 @@
visibility: hidden;
}
#mChat + .inner li.header dd {
.mchat-wrapper li.header dd {
width: 0;
}
@@ -21,6 +21,10 @@
width: 100%;
}
#mchat-main {
position: relative;
}
.icon-mchat {
background-image: url("./images/icon_mchat.png");
}
@@ -51,27 +55,30 @@
overflow: hidden;
}
.mchat-message-flash {
animation-name: flash-message;
animation-duration: .4s;
animation-timing-function: ease-out;
}
@keyframes flash-message {
0% {
background-color: #FFD070;
opacity: 0;
}
100% {
background-color: transparent;
opacity: 1;
}
}
.mchat-avatar {
float: left;
width: 40px;
padding-right: 5px;
}
@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {
#mchat-body {
overflow: visible;
}
.mchat-buttons > li {
padding: 0 6px !important;
}
#mchat-input {
width: 95% !important;
margin: 5px 0 !important;
}
margin-right: 5px;
}
.mchat-avatar a, .mchat-avatar img {
@@ -154,6 +161,10 @@
font-weight: bold !important;
}
.mchat-text img {
max-width: 100%;
}
.mchat-text li {
display: list-item !important;
list-style-type: inherit !important;
@@ -197,17 +208,17 @@
#mchat-character-count {
float: right;
padding: 5px 0 0;
margin-top: 5px;
}
#mchat-character-count.hidden {
#mchat-character-count.invisible {
visibility: hidden;
}
#mchat-panel {
text-align: center;
max-height: initial;
overflow-y: auto;
overflow: hidden;
padding: 0 5px 5px 5px;
margin: 0;
border-radius: 0;
@@ -221,10 +232,10 @@
cursor: text;
width: 50%;
min-width: 50%;
max-width: 90%;
max-width: 95%;
font-size: 1.1em;
padding: 5px 5px 4px;
margin: 5px 20px;
margin: 5px auto;
}
textarea#mchat-input {
@@ -232,7 +243,7 @@ textarea#mchat-input {
}
#mchat-buttons {
padding-bottom: 5px;
margin-bottom: 5px;
}
#mchat-bbcodes {
@@ -315,7 +326,6 @@ textarea#mchat-input {
.mchat-footer li {
display: inline;
padding-left: .1em;
white-space: nowrap;
}
@@ -323,10 +333,19 @@ textarea#mchat-input {
content: '\2022\A';
}
.mchat-footer li:first-child:before, .mchat-footer li:last-child:before {
.mchat-footer li:first-child:before {
content: '';
}
#mchat-user-sound {
margin: 0;
}
#mchat-user-sound + label {
padding-right: 0;
padding-left: 5px;
}
#mchat-legend {
clear: both;
}
@@ -357,6 +376,23 @@ textarea#mchat-input {
display: none;
}
@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {
#mchat-body {
overflow: visible;
}
.mchat-wrapper .mchat-buttons > li {
padding: 0 6px;
}
#mchat-input {
width: 95% !important;
font-size: 16px;
}
}
/* Compatibility with Advanced BBCode Box extension */
#mchat-panel #abbc3_buttons {

View File

@@ -0,0 +1 @@
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->

View File

@@ -2,7 +2,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -65,3 +65,8 @@
left: auto;
right: 8px;
}
@keyframes flash-message {
0% { background-color: #F6F4D0; }
100% { background-color: #F4F4F4; }
}

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

View File

@@ -4,7 +4,7 @@
*
* @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 kasimi
* @copyright (c) 2016 kasimi - https://kasimi.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/