Version 2.0.0-RC7

This commit is contained in:
dmzx
2016-10-16 17:25:31 +02:00
parent 233dc89a8a
commit 159d1d25b8
59 changed files with 1096 additions and 493 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 * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */

View File

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

View File

@@ -14,20 +14,31 @@
<form id="acp_mchat" method="post" action="{U_ACTION}"> <form id="acp_mchat" method="post" action="{U_ACTION}">
<fieldset> <fieldset>
<legend>{L_MCHAT_SETTINGS_INDEX}</legend> <legend>{L_MCHAT_SETTINGS_INDEX}</legend>
<!-- EVENT dmzx_mchat_acp_index_height_before -->
<dl> <dl>
<dt><label for="mchat_index_height">{L_MCHAT_INDEX_HEIGHT}{L_COLON}</label><br /> <dt><label for="mchat_index_height">{L_MCHAT_INDEX_HEIGHT}{L_COLON}</label><br />
<span>{L_MCHAT_INDEX_HEIGHT_EXPLAIN}</span></dt> <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>
<dl> <dl>
<dt><label for="mchat_message_num_index">{L_MCHAT_MESSAGE_NUM_INDEX}{L_COLON}</label><br /> <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> <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> </dl>
<!-- EVENT dmzx_mchat_acp_message_num_index_after -->
</fieldset> </fieldset>
<!-- EVENT acp_dmzx_mchat_globalsettings_index_after --> <!-- EVENT acp_dmzx_mchat_globalsettings_index_after -->
<fieldset> <fieldset>
<legend>{L_MCHAT_SETTINGS_CUSTOM}</legend> <legend>{L_MCHAT_SETTINGS_CUSTOM}</legend>
<!-- EVENT dmzx_mchat_acp_custom_page_before -->
<dl> <dl>
<dt><label for="mchat_custom_page">{L_MCHAT_CUSTOM_PAGE}{L_COLON}</label><br /> <dt><label for="mchat_custom_page">{L_MCHAT_CUSTOM_PAGE}{L_COLON}</label><br />
<span>{L_MCHAT_CUSTOM_PAGE_EXPLAIN}</span></dt> <span>{L_MCHAT_CUSTOM_PAGE_EXPLAIN}</span></dt>
@@ -37,12 +48,12 @@
<dl> <dl>
<dt><label for="mchat_custom_height">{L_MCHAT_CUSTOM_HEIGHT}{L_COLON}</label><br /> <dt><label for="mchat_custom_height">{L_MCHAT_CUSTOM_HEIGHT}{L_COLON}</label><br />
<span>{L_MCHAT_CUSTOM_HEIGHT_EXPLAIN}</span></dt> <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>
<dl> <dl>
<dt><label for="mchat_message_num_custom">{L_MCHAT_MESSAGE_NUM_CUSTOM}{L_COLON}</label><br /> <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> <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>
<dl> <dl>
<dt><label for="mchat_navbar_link">{L_MCHAT_NAVBAR_LINK}{L_COLON}</label></dt> <dt><label for="mchat_navbar_link">{L_MCHAT_NAVBAR_LINK}{L_COLON}</label></dt>
@@ -54,31 +65,43 @@
<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> <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> <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> </dl>
<!-- EVENT dmzx_mchat_acp_navbar_link_count_after -->
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>{L_MCHAT_SETTINGS_ARCHIVE}</legend> <legend>{L_MCHAT_SETTINGS_ARCHIVE}</legend>
<!-- EVENT dmzx_mchat_acp_message_num_archive_before -->
<dl> <dl>
<dt><label for="mchat_message_num_archive">{L_MCHAT_MESSAGE_NUM_ARCHIVE}{L_COLON}</label><br /> <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> <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> </dl>
<!-- EVENT dmzx_mchat_acp_message_num_archive_after -->
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>{L_MCHAT_SETTINGS_MESSAGES}</legend> <legend>{L_MCHAT_SETTINGS_MESSAGES}</legend>
<!-- EVENT dmzx_mchat_acp_timeout_before -->
<dl> <dl>
<dt><label for="mchat_timeout">{L_MCHAT_TIMEOUT}{L_COLON}</label><br /> <dt><label for="mchat_timeout">{L_MCHAT_TIMEOUT}{L_COLON}</label><br />
<span>{L_MCHAT_TIMEOUT_EXPLAIN}</span></dt> <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>
<dl> <dl>
<dt><label for="mchat_refresh">{L_MCHAT_REFRESH}{L_COLON}</label><br /> <dt><label for="mchat_refresh">{L_MCHAT_REFRESH}{L_COLON}</label><br />
<span>{L_MCHAT_REFRESH_EXPLAIN}</span></dt> <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>
<dl> <dl>
<dt><label for="mchat_edit_delete_limit">{L_MCHAT_EDIT_DELETE_LIMIT}{L_COLON}</label><br /> <dt><label for="mchat_edit_delete_limit">{L_MCHAT_EDIT_DELETE_LIMIT}{L_COLON}</label><br />
<span>{L_MCHAT_EDIT_DELETE_LIMIT_EXPLAIN}</span> <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>
<dl> <dl>
<dt><label for="mchat_live_updates">{L_MCHAT_LIVE_UPDATES}{L_COLON}</label><br /> <dt><label for="mchat_live_updates">{L_MCHAT_LIVE_UPDATES}{L_COLON}</label><br />
@@ -89,12 +112,12 @@
<dl> <dl>
<dt><label for="mchat_flood_time">{L_MCHAT_FLOOD_TIME}{L_COLON}</label><br /> <dt><label for="mchat_flood_time">{L_MCHAT_FLOOD_TIME}{L_COLON}</label><br />
<span>{L_MCHAT_FLOOD_TIME_EXPLAIN}</span></dt> <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>
<dl> <dl>
<dt><label for="mchat_max_message_lngth">{L_MCHAT_MAX_MESSAGE_LENGTH}{L_COLON}</label><br /> <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> <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>
<dl> <dl>
<dt><label for="mchat_override_min_post_chars">{L_MCHAT_OVERRIDE_MIN_POST_CHARS}{L_COLON}</label><br /> <dt><label for="mchat_override_min_post_chars">{L_MCHAT_OVERRIDE_MIN_POST_CHARS}{L_COLON}</label><br />
@@ -123,9 +146,15 @@
<span>{L_MCHAT_STATIC_MESSAGE_EXPLAIN}</span></dt> <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> <dd><textarea name="mchat_static_message" id="mchat_static_message" rows="5" cols="40">{MCHAT_STATIC_MESSAGE}</textarea></dd>
</dl> </dl>
<!-- EVENT dmzx_mchat_acp_static_message_after -->
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>{L_MCHAT_SETTINGS_POSTS}</legend> <legend>{L_MCHAT_SETTINGS_POSTS}</legend>
<!-- EVENT dmzx_mchat_acp_posts_topic_before -->
<dl> <dl>
<dt><label for="mchat_posts_topic">{L_MCHAT_POSTS_TOPIC}{L_COLON}</label></dt> <dt><label for="mchat_posts_topic">{L_MCHAT_POSTS_TOPIC}{L_COLON}</label></dt>
<dd> <dd>
@@ -161,28 +190,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> <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> </dd>
</dl> </dl>
<!-- EVENT dmzx_mchat_acp_posts_login_after -->
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>{L_MCHAT_SETTINGS_STATS}</legend> <legend>{L_MCHAT_SETTINGS_STATS}</legend>
<!-- EVENT dmzx_mchat_acp_whois_refresh_before -->
<dl> <dl>
<dt><label for="mchat_whois_refresh">{L_MCHAT_WHOIS_REFRESH}{L_COLON}</label><br /> <dt><label for="mchat_whois_refresh">{L_MCHAT_WHOIS_REFRESH}{L_COLON}</label><br />
<span>{L_MCHAT_WHOIS_REFRESH_EXPLAIN}</span></dt> <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> </dl>
<!-- EVENT dmzx_mchat_acp_whois_refresh_after -->
</fieldset> </fieldset>
<!-- IF MCHAT_FOUNDER --> <!-- IF MCHAT_FOUNDER -->
<fieldset> <fieldset>
<legend>{L_MCHAT_SETTINGS_PRUNE}</legend> <legend>{L_MCHAT_SETTINGS_PRUNE}</legend>
<!-- EVENT dmzx_mchat_acp_prune_before -->
<dl> <dl>
<dt><label for="mchat_prune">{L_MCHAT_PRUNE}{L_COLON}</label><br /> <dt><label for="mchat_prune">{L_MCHAT_PRUNE}{L_COLON}</label></dt>
<span>{L_MCHAT_PRUNE_EXPLAIN}</span></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> <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> <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>
<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> <dl>
<dt><label for="mchat_prune_num">{L_MCHAT_PRUNE_NUM}{L_COLON}</label><br /> <dt><label for="mchat_prune_num">{L_MCHAT_PRUNE_NUM}{L_COLON}</label><br />
<span>{L_MCHAT_PRUNE_NUM_EXPLAIN}</span></dt> <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>
<dl> <dl>
<dt><label for="mchat_prune_now">{L_MCHAT_PRUNE_NOW}{L_COLON}</label></dt> <dt><label for="mchat_prune_now">{L_MCHAT_PRUNE_NOW}{L_COLON}</label></dt>
@@ -202,9 +252,14 @@
<label><input type="radio" name="mchat_purge_confirm" value="0" id="mchat_purge_confirm" checked="checked" /> {L_NO}</label> <label><input type="radio" name="mchat_purge_confirm" value="0" id="mchat_purge_confirm" checked="checked" /> {L_NO}</label>
</dd> </dd>
</dl> </dl>
<!-- EVENT dmzx_mchat_acp_purge_after -->
</fieldset> </fieldset>
<!-- ENDIF --> <!-- ENDIF -->
<!-- EVENT acp_dmzx_mchat_globalsettings_after --> <!-- EVENT acp_dmzx_mchat_globalsettings_after -->
<p class="submit-buttons"> <p class="submit-buttons">
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp; <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}" /> <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}"> <form id="acp_mchat" method="post" action="{U_ACTION}">
<fieldset> <fieldset>
<legend>{L_ACP_MCHAT_GLOBALUSERSETTINGS}</legend> <legend>{L_ACP_MCHAT_GLOBALUSERSETTINGS}</legend>
<!-- INCLUDE acp_mchat_globalusersettings_content.html --> <!-- INCLUDE @dmzx_mchat/acp_mchat_globalusersettings_content.html -->
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>{L_MCHAT_GLOBALUSERSETTINGS_OVERWRITE}</legend> <legend>{L_MCHAT_GLOBALUSERSETTINGS_OVERWRITE}</legend>

View File

@@ -1,3 +1,5 @@
<!-- EVENT dmzx_mchat_acp_index_before -->
<dl> <dl>
<dt><label for="user_mchat_index">{L_MCHAT_INDEX}{L_COLON}</label></dt> <dt><label for="user_mchat_index">{L_MCHAT_INDEX}{L_COLON}</label></dt>
<dd> <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> <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> </dd>
</dl> </dl>
<!-- EVENT dmzx_mchat_acp_location_after -->
<hr /> <hr />
<!-- EVENT dmzx_mchat_acp_message_top_before -->
<dl> <dl>
<dt><label for="user_mchat_message_top">{L_MCHAT_MESSAGE_TOP}{L_COLON}</label><br /><span>{L_MCHAT_MESSAGE_TOP_EXPLAIN}</span></dt> <dt><label for="user_mchat_message_top">{L_MCHAT_MESSAGE_TOP}{L_COLON}</label><br /><span>{L_MCHAT_MESSAGE_TOP_EXPLAIN}</span></dt>
<dd> <dd>
@@ -63,7 +71,7 @@
</dd> </dd>
</dl> </dl>
<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> <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="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> <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> <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> </dd>
</dl> </dl>
<!-- EVENT dmzx_mchat_acp_relative_time_after -->
<hr /> <hr />
<!-- EVENT dmzx_mchat_acp_posts_before -->
<dl> <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> <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> <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> <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> </dd>
</dl> </dl>
<!-- EVENT dmzx_mchat_acp_posts_after -->

View File

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

View File

@@ -3,8 +3,8 @@
"type": "phpbb-extension", "type": "phpbb-extension",
"description": "mChat", "description": "mChat",
"homepage": "https://github.com/kasimi/mChat", "homepage": "https://github.com/kasimi/mChat",
"version": "2.0.0-RC6", "version": "2.0.0-RC7",
"time": "2016-09-18", "time": "2016-10-16",
"keywords": ["phpbb", "extension", "mchat"], "keywords": ["phpbb", "extension", "mchat"],
"license": "GPL-2.0", "license": "GPL-2.0",
"authors": [ "authors": [
@@ -28,7 +28,7 @@
], ],
"require": { "require": {
"php": ">=5.3.3", "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": { "require-dev": {
"phpbb/epv": "dev-master" "phpbb/epv": "dev-master"
@@ -36,7 +36,13 @@
"extra": { "extra": {
"display-name": "mChat", "display-name": "mChat",
"soft-require": { "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": "kasimi.github.io",
"directory": "/mChat",
"filename": "mchat_version.json",
"ssl": true
} }
} }
} }

View File

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

View File

@@ -4,37 +4,50 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\controller; 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 class acp_controller
{ {
/** @var \dmzx\mchat\core\functions */ /** @var functions */
protected $functions; protected $functions;
/** @var \phpbb\template\template */ /** @var template */
protected $template; protected $template;
/** @var \phpbb\log\log_interface */ /** @var log_interface */
protected $log; protected $log;
/** @var \phpbb\user */ /** @var user */
protected $user; protected $user;
/** @var \phpbb\db\driver\driver_interface */ /** @var db_interface */
protected $db; protected $db;
/** @var \phpbb\cache\service */ /** @var cache_interface */
protected $cache; protected $cache;
/** @var \phpbb\request\request */ /** @var request_interface */
protected $request; protected $request;
/** @var \dmzx\mchat\core\settings */ /** @var dispatcher_interface */
protected $dispatcher;
/** @var settings */
protected $settings; protected $settings;
/** @var string */ /** @var string */
@@ -52,20 +65,34 @@ class acp_controller
/** /**
* Constructor * Constructor
* *
* @param \dmzx\mchat\core\functions $functions * @param functions $functions
* @param \phpbb\template\template $template * @param template $template
* @param \phpbb\log\log_interface $log * @param log_interface $log
* @param \phpbb\user $user * @param user $user
* @param \phpbb\db\driver\driver_interface $db * @param db_interface $db
* @param \phpbb\cache\service $cache * @param cache_interface $cache
* @param \phpbb\request\request $request * @param request_interface $request
* @param \dmzx\mchat\core\settings $settings * @param dispatcher_interface $dispatcher
* @param string $mchat_table * @param settings $settings
* @param string $mchat_log_table * @param string $mchat_table
* @param string $root_path * @param string $mchat_log_table
* @param string $php_ext * @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->functions = $functions;
$this->template = $template; $this->template = $template;
@@ -74,6 +101,7 @@ class acp_controller
$this->db = $db; $this->db = $db;
$this->cache = $cache; $this->cache = $cache;
$this->request = $request; $this->request = $request;
$this->dispatcher = $dispatcher;
$this->settings = $settings; $this->settings = $settings;
$this->mchat_table = $mchat_table; $this->mchat_table = $mchat_table;
$this->mchat_log_table = $mchat_log_table; $this->mchat_log_table = $mchat_log_table;
@@ -98,7 +126,7 @@ class acp_controller
{ {
$mchat_new_config = array(); $mchat_new_config = array();
$validation = 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); $default = $this->settings->cfg($config_name);
settype($default, gettype($config_data['default'])); settype($default, gettype($config_data['default']));
@@ -113,6 +141,8 @@ class acp_controller
if (!$is_founder) if (!$is_founder)
{ {
unset($mchat_new_config['mchat_prune']); 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']); unset($mchat_new_config['mchat_prune_num']);
} }
@@ -128,6 +158,20 @@ class acp_controller
$error[] = 'FORM_INVALID'; $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) if (!$error)
{ {
// Set the options the user configured // Set the options the user configured
@@ -163,19 +207,36 @@ class acp_controller
} }
} }
foreach (array_keys($this->settings->global) as $key) $template_data = array(
{
$this->template->assign_var(strtoupper($key), $this->settings->cfg($key));
}
$this->template->assign_vars(array(
'MCHAT_ERROR' => implode('<br />', $error), 'MCHAT_ERROR' => implode('<br />', $error),
'MCHAT_VERSION' => $this->settings->cfg('mchat_version'), 'MCHAT_VERSION' => $this->settings->cfg('mchat_version'),
'MCHAT_FOUNDER' => $is_founder, '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_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')), '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, '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 +246,13 @@ class acp_controller
{ {
add_form_key('acp_mchat'); add_form_key('acp_mchat');
$this->user->add_lang_ext('dmzx/mchat', 'mchat_ucp');
$error = array(); $error = array();
if ($this->request->is_set_post('submit')) if ($this->request->is_set_post('submit'))
{ {
$mchat_new_config = array(); $mchat_new_config = array();
$validation = 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); $default = $this->settings->cfg($config_name, true);
settype($default, gettype($config_data['default'])); settype($default, gettype($config_data['default']));
@@ -217,16 +276,36 @@ class acp_controller
$error[] = 'FORM_INVALID'; $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 (!$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); $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $mchat_new_user_config);
$this->db->sql_query($sql); $this->db->sql_query($sql);
} }
@@ -247,23 +326,59 @@ class acp_controller
$error = array_map(array($this->user, 'lang'), $error); $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 $template_data = array_merge($template_data, array(
$selected = $this->settings->cfg('mchat_date', true); 'MCHAT_POSTS_ENABLED_LANG' => $this->settings->get_enabled_post_notifications_lang(),
$date_template_data = $this->settings->get_date_template_data($selected); 'MCHAT_ERROR' => implode('<br />', $error),
$this->template->assign_vars($date_template_data); 'MCHAT_VERSION' => $this->settings->cfg('mchat_version'),
'U_ACTION' => $u_action,
$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,
)); ));
/**
* 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 * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\controller; 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 class ucp_controller
{ {
/** @var \phpbb\template\template */ /** @var template */
protected $template; protected $template;
/** @var \phpbb\user */ /** @var user */
protected $user; protected $user;
/** @var \phpbb\auth\auth */ /** @var auth */
protected $auth; protected $auth;
/** @var \phpbb\db\driver\driver_interface */ /** @var db_interface */
protected $db; protected $db;
/** @var \phpbb\request\request */ /** @var request_interface */
protected $request; protected $request;
/** @var \dmzx\mchat\core\settings */ /** @var settings */
protected $settings; protected $settings;
/** @var dispatcher_interface */
protected $dispatcher;
/** @var string */ /** @var string */
protected $root_path; protected $root_path;
@@ -40,16 +51,27 @@ class ucp_controller
/** /**
* Constructor * Constructor
* *
* @param \phpbb\template\template $template * @param template $template
* @param \phpbb\user $user * @param user $user
* @param \phpbb\auth\auth $auth * @param auth $auth
* @param \phpbb\db\driver\driver_interface $db * @param db_interface $db
* @param \phpbb\request\request $request * @param request_interface $request
* @param \dmzx\mchat\core\settings $settings * @param settings $settings
* @param string $root_path * @param dispatcher_interface $dispatcher
* @param string $php_ext * @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->template = $template;
$this->user = $user; $this->user = $user;
@@ -57,6 +79,7 @@ class ucp_controller
$this->db = $db; $this->db = $db;
$this->request = $request; $this->request = $request;
$this->settings = $settings; $this->settings = $settings;
$this->dispatcher = $dispatcher;
$this->root_path = $root_path; $this->root_path = $root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
} }
@@ -76,7 +99,7 @@ class ucp_controller
{ {
$mchat_new_config = array(); $mchat_new_config = array();
$validation = 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)) if ($this->auth->acl_get('u_' . $config_name))
{ {
@@ -103,6 +126,20 @@ class ucp_controller
$error[] = 'FORM_INVALID'; $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) if (!$error)
{ {
$sql = 'UPDATE ' . USERS_TABLE . ' $sql = 'UPDATE ' . USERS_TABLE . '
@@ -119,17 +156,18 @@ class ucp_controller
$error = array_map(array($this->user, 'lang'), $error); $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; $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); $upper = strtoupper($config_name);
$auth = $this->auth->acl_get('u_' . $config_name); $auth = $this->auth->acl_get('u_' . $config_name);
$this->template->assign_vars(array( $template_data[$upper] = $this->settings->cfg($config_name);
$upper => $this->settings->cfg($config_name), $template_data[$upper . '_AUTH'] = $auth;
$upper . '_AUTH' => $auth,
));
if ($auth) if ($auth)
{ {
@@ -137,17 +175,29 @@ class ucp_controller
} }
} }
$selected = $this->settings->cfg('mchat_date'); $template_data = array_merge($template_data, array(
$date_template_data = $this->settings->get_date_template_data($selected); 'MCHAT_POSTS_ENABLED_LANG' => $this->settings->get_enabled_post_notifications_lang(),
$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(
'ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'ERROR' => sizeof($error) ? implode('<br />', $error) : '',
'MCHAT_AUTH_COUNT' => $auth_count, 'MCHAT_AUTH_COUNT' => $auth_count,
'S_UCP_ACTION' => $u_action, '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 * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\core; 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 class functions
{ {
/** @var \dmzx\mchat\core\settings */ /** @var settings */
protected $settings; protected $settings;
/** @var \phpbb\user */ /** @var user */
protected $user; protected $user;
/** @var \phpbb\auth\auth */ /** @var auth */
protected $auth; protected $auth;
/** @var \phpbb\log\log */ /** @var log_interface */
protected $log; protected $log;
/** @var \phpbb\db\driver\driver_interface */ /** @var db_interface */
protected $db; protected $db;
/** @var \phpbb\cache\driver\driver_interface */ /** @var cache_interface */
protected $cache; protected $cache;
/** @var \phpbb\event\dispatcher_interface */ /** @var dispatcher_interface */
protected $dispatcher; protected $dispatcher;
/** @var string */ /** @var string */
@@ -70,33 +77,46 @@ class functions
/** /**
* Constructor * Constructor
* *
* @param \dmzx\mchat\core\settings $settings * @param settings $settings
* @param \phpbb\user $user * @param user $user
* @param \phpbb\auth\auth $auth * @param auth $auth
* @param \phpbb\log\log_interface $log * @param log_interface $log
* @param \phpbb\db\driver\driver_interface $db * @param db_interface $db
* @param \phpbb\cache\driver\driver_interface $cache * @param cache_interface $cache
* @param \phpbb\event\dispatcher_interface $dispatcher * @param dispatcher_interface $dispatcher
* @param string $root_path * @param string $root_path
* @param string $php_ext * @param string $php_ext
* @param string $mchat_table * @param string $mchat_table
* @param string $mchat_log_table * @param string $mchat_log_table
* @param string $mchat_sessions_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->settings = $settings;
$this->user = $user; $this->user = $user;
$this->auth = $auth; $this->auth = $auth;
$this->log = $log; $this->log = $log;
$this->db = $db; $this->db = $db;
$this->cache = $cache; $this->cache = $cache;
$this->dispatcher = $dispatcher; $this->dispatcher = $dispatcher;
$this->root_path = $root_path; $this->root_path = $root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->mchat_table = $mchat_table; $this->mchat_table = $mchat_table;
$this->mchat_log_table = $mchat_log_table; $this->mchat_log_table = $mchat_log_table;
$this->mchat_sessions_table = $mchat_sessions_table; $this->mchat_sessions_table = $mchat_sessions_table;
} }
/** /**
@@ -292,35 +312,33 @@ class functions
*/ */
public function mchat_prune() public function mchat_prune()
{ {
$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', 'SELECT' => 'message_id',
'FROM' => array($this->mchat_table => 'm'), 'FROM' => array($this->mchat_table => 'm'),
); );
$prune_num = $this->settings->cfg('mchat_prune_num'); if ($this->settings->prune_modes[$prune_mode] === 'messages')
if (ctype_digit($prune_num))
{ {
// Retain fixed number of messages // Skip fixed number of messages, delete all others
$sql_array['ORDER_BY'] = 'm.message_id DESC';
$offset = $prune_num; $offset = $prune_num;
$sql_aray['ORDER_BY'] = 'message_id DESC';
} }
else else
{ {
// Retain messages of a time period // Delete messages older than time period
$time_period = strtotime($prune_num, 0); $sql_array['WHERE'] = 'm.message_time < ' . (int) strtotime($prune_num * $prune_mode . ' hours ago');
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;
}
$offset = 0; $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); $result = $this->db->sql_query_limit($sql, 0, $offset);
$rows = $this->db->sql_fetchrowset(); $rows = $this->db->sql_fetchrowset();
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);
@@ -349,9 +367,9 @@ 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_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->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->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))); $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; return $prune_ids;
} }
@@ -363,9 +381,12 @@ class functions
*/ */
public function mchat_total_message_count() public function mchat_total_message_count()
{ {
$sql_where_ary = $this->get_sql_where_for_notifcation_messages();
$sql_array = array( $sql_array = array(
'SELECT' => 'COUNT(*) AS rows_total', 'SELECT' => 'COUNT(*) AS rows_total',
'FROM' => array($this->mchat_table => 'm'), 'FROM' => array($this->mchat_table => 'm'),
'WHERE' => $sql_where_ary ? $this->db->sql_escape('(' . implode(') AND (', $sql_where_ary) . ')') : '',
); );
/** /**
@@ -418,22 +439,11 @@ class functions
$sql_where_message_id[] = $this->db->sql_in_set('m.message_id', array_map('intval', $message_ids)); $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 $sql_where_ary[] = implode(' OR ', $sql_where_message_id);
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_array = array( $sql_array = array(
@@ -490,6 +500,35 @@ class functions
return $rows; 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 * Fetches log entries from the database and sorts them
* *
@@ -646,14 +685,18 @@ class functions
foreach ($rows as $row) foreach ($rows as $row)
{ {
// Skip deleted posts $post_subjects[$row['post_id']] = array(
if (isset($row['post_subject'])) 'post_subject' => $row['post_subject'],
{ 'forum_name' => $row['forum_name'],
$post_subjects[$row['post_id']] = array( );
'post_subject' => $row['post_subject'], }
'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; return $post_subjects;

View File

@@ -4,46 +4,56 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\core; 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\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 class mchat
{ {
/** @var \dmzx\mchat\core\functions */ /** @var functions */
protected $functions; protected $functions;
/** @var \dmzx\mchat\core\settings */ /** @var settings */
protected $settings; protected $settings;
/** @var \phpbb\controller\helper */ /** @var helper */
protected $helper; protected $helper;
/** @var \phpbb\template\template */ /** @var template */
protected $template; protected $template;
/** @var \phpbb\user */ /** @var user */
protected $user; protected $user;
/** @var \phpbb\auth\auth */ /** @var auth */
protected $auth; protected $auth;
/** @var \phpbb\pagination */ /** @var pagination */
protected $pagination; protected $pagination;
/** @var \phpbb\request\request */ /** @var request_interface */
protected $request; protected $request;
/** @var \phpbb\event\dispatcher_interface */ /** @var dispatcher_interface */
protected $dispatcher; protected $dispatcher;
/** @var \phpbb\extension\manager */ /** @var manager */
protected $extension_manager; protected $extension_manager;
/** @var string */ /** @var string */
@@ -52,7 +62,10 @@ class mchat
/** @var string */ /** @var string */
protected $php_ext; protected $php_ext;
/** @var \phpbb\collapsiblecategories\operator\operator */ /** @var parser_interface */
protected $parser;
/** @var cc_operator */
protected $cc_operator; protected $cc_operator;
/** @var boolean */ /** @var boolean */
@@ -67,21 +80,37 @@ class mchat
/** /**
* Constructor * Constructor
* *
* @param \dmzx\mchat\core\functions $functions * @param functions $functions
* @param \dmzx\mchat\core\settings $settings * @param settings $settings
* @param \phpbb\controller\helper $helper * @param helper $helper
* @param \phpbb\template\template $template * @param template $template
* @param \phpbb\user $user * @param user $user
* @param \phpbb\auth\auth $auth * @param auth $auth
* @param \phpbb\pagination $pagination * @param pagination $pagination
* @param \phpbb\request\request $request * @param request_interface $request
* @param \phpbb\event\dispatcher_interface $dispatcher * @param dispatcher_interface $dispatcher
* @param \phpbb\extension\manager $extension_manager * @param manager $extension_manager
* @param string $root_path * @param string $root_path
* @param string $php_ext * @param string $php_ext
* @param \phpbb\collapsiblecategories\operator\operator $cc_operator * @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->functions = $functions;
$this->settings = $settings; $this->settings = $settings;
@@ -95,6 +124,7 @@ class mchat
$this->extension_manager = $extension_manager; $this->extension_manager = $extension_manager;
$this->root_path = $root_path; $this->root_path = $root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->parser = $parser;
$this->cc_operator = $cc_operator; $this->cc_operator = $cc_operator;
$this->template->assign_vars(array( $this->template->assign_vars(array(
@@ -315,11 +345,18 @@ class mchat
$message = $this->request->variable('message', '', true); $message = $this->request->variable('message', '', true);
$message_data = array( if ($this->settings->cfg('mchat_capital_letter'))
'user_id' => $this->user->data['user_id'], {
'user_ip' => $this->user->data['session_ip'], $message = utf8_ucfirst($message);
'message_time' => time(), }
);
$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 * 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))); extract($this->dispatcher->trigger_event('dmzx.mchat.action_add_before', compact($vars)));
$sql_ary = array_merge($this->process_message($message), $message_data); $is_new_session = $this->functions->mchat_action('add', $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);
$response = $this->action_refresh(true); $response = $this->action_refresh(true);
@@ -815,7 +845,7 @@ class mchat
$rows = $this->functions->mchat_get_messages(array(), 0, $limit, $start); $rows = $this->functions->mchat_get_messages(array(), 0, $limit, $start);
$this->assign_global_template_data(); $this->assign_global_template_data();
$this->assign_messages($rows); $this->assign_messages($rows, $page);
// Render pagination // Render pagination
if ($page === 'archive') if ($page === 'archive')
@@ -907,8 +937,8 @@ class mchat
$this->template->assign_vars(array( $this->template->assign_vars(array(
'MCHAT_DISPLAY_NAME' => $meta['extra']['display-name'], 'MCHAT_DISPLAY_NAME' => $meta['extra']['display-name'],
'MCHAT_AUTHOR_NAMES' => implode(' &bull; ', $author_names), 'MCHAT_AUTHOR_NAMES' => implode(' &amp; ', $author_names),
'MCHAT_AUTHOR_HOMEPAGES' => implode(' &bull; ', $author_homepages), 'MCHAT_AUTHOR_HOMEPAGES' => implode(' &amp; ', $author_homepages),
)); ));
} }
@@ -963,8 +993,9 @@ class mchat
* Assigns all message rows to the template * Assigns all message rows to the template
* *
* @param array $rows * @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')); $rows = array_filter($rows, array($this, 'has_read_auth'));
@@ -974,7 +1005,7 @@ class mchat
} }
// Reverse the array if messages appear at the bottom // Reverse the array if messages appear at the bottom
if (!$this->settings->cfg('mchat_message_top')) if ($page !== 'archive' && !$this->settings->cfg('mchat_message_top'))
{ {
$rows = array_reverse($rows); $rows = array_reverse($rows);
} }
@@ -1188,8 +1219,15 @@ class mchat
'f' => $row['forum_id'], 'f' => $row['forum_id'],
)); ));
$args[] = '[url=' . $viewtopic_url . ']' . $post_data['post_subject'] . '[/url]'; if ($post_data)
$args[] = '[url=' . $viewforum_url . ']' . $post_data['forum_name'] . '[/url]'; {
$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) else if ($row['post_id'] == functions::LOGIN_HIDDEN)
{ {
@@ -1328,7 +1366,7 @@ class mchat
*/ */
public function set_user_default_values($sql_ary) 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); $sql_ary['user_' . $config_name] = $this->settings->cfg($config_name, true);
} }
@@ -1469,22 +1507,34 @@ class mchat
$this->settings->set_cfg('max_post_smilies', 0, true); $this->settings->set_cfg('max_post_smilies', 0, true);
} }
$mchat_bbcode = $this->settings->cfg('allow_bbcode') && $this->auth->acl_get('u_mchat_bbcode'); $disallowed_bbcodes = array_filter(explode('|', $this->settings->cfg('mchat_bbcode_disallowed')));
$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');
// Add function part code from http://wiki.phpbb.com/Parsing_text $mchat_bbcode = $this->settings->cfg('allow_bbcode') && $this->auth->acl_get('u_mchat_bbcode');
$uid = $bitfield = $options = ''; $mchat_magic_urls = $this->settings->cfg('allow_post_links') && $this->auth->acl_get('u_mchat_urls');
generate_text_for_storage($message, $uid, $bitfield, $options, $mchat_bbcode, $mchat_urls, $mchat_smilies); $mchat_smilies = $this->settings->cfg('allow_smilies') && $this->auth->acl_get('u_mchat_smilies');
// Not allowed bbcodes // These arguments for generate_text_for_storage() are ignored in 3.1.x
if (!$mchat_bbcode) $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 $uid = $bitfield = $options = '';
if ($this->settings->cfg('mchat_bbcode_disallowed')) 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( $bbcode_replace = array(
'#\[(' . str_replace('*', '\*', $this->settings->cfg('mchat_bbcode_disallowed')) . ')[^\[\]]+\]#Usi', '#\[(' . str_replace('*', '\*', $this->settings->cfg('mchat_bbcode_disallowed')) . ')[^\[\]]+\]#Usi',

View File

@@ -4,31 +4,39 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\core; namespace dmzx\mchat\core;
use phpbb\auth\auth;
use phpbb\config\config;
use phpbb\event\dispatcher_interface;
use phpbb\user;
class settings class settings
{ {
/** @var \phpbb\user */ /** @var user */
protected $user; protected $user;
/** @var \phpbb\config\config */ /** @var config */
protected $config; protected $config;
/** @var \phpbb\auth\auth */ /** @var auth */
protected $auth; protected $auth;
/** @var dispatcher_interface */
protected $dispatcher;
/** /**
* Keys for global settings that only the administrator is allowed to modify. * Keys for global settings that only the administrator is allowed to modify.
* The values are stored in the phpbb_config table. * The values are stored in the phpbb_config table.
* *
* @var array * @var array
*/ */
public $global; protected $global_settings;
/** /**
* Keys for user-specific settings for which the administrator can set default * Keys for user-specific settings for which the administrator can set default
@@ -39,7 +47,20 @@ class settings
* *
* @var array * @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 */ /** @var bool */
public $is_phpbb31; public $is_phpbb31;
@@ -50,17 +71,33 @@ class settings
/** /**
* Constructor * Constructor
* *
* @param \phpbb\user $user * @param user $user
* @param \phpbb\config\config $config * @param config $config
* @param \phpbb\auth\auth $auth * @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->user = $user;
$this->config = $config; $this->config = $config;
$this->auth = $auth; $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_bbcode_disallowed' => array('default' => '', 'validation' => array('string', false, 0, 255)), '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_height' => array('default' => 350, 'validation' => array('num', false, 50, 1000)),
'mchat_custom_page' => array('default' => 1), 'mchat_custom_page' => array('default' => 1),
@@ -82,7 +119,9 @@ class settings
'mchat_posts_topic' => array('default' => 0), 'mchat_posts_topic' => array('default' => 0),
'mchat_posts_login' => array('default' => 0), 'mchat_posts_login' => array('default' => 0),
'mchat_prune' => 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_refresh' => array('default' => 10, 'validation' => array('num', false, 5, 60)),
'mchat_rules' => array('default' => '', 'validation' => array('string', false, 0, 255)), 'mchat_rules' => array('default' => '', 'validation' => array('string', false, 0, 255)),
'mchat_static_message' => array('default' => '', 'validation' => array('string', false, 0, 255)), 'mchat_static_message' => array('default' => '', 'validation' => array('string', false, 0, 255)),
@@ -90,7 +129,27 @@ class settings
'mchat_whois_refresh' => array('default' => 60, 'validation' => array('num', false, 10, 300)), '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_avatars' => array('default' => 1),
'mchat_capital_letter' => array('default' => 1), 'mchat_capital_letter' => array('default' => 1),
'mchat_character_count' => array('default' => 1), 'mchat_character_count' => array('default' => 1),
@@ -107,8 +166,45 @@ class settings
'mchat_whois_index' => array('default' => 1), '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 +220,15 @@ class settings
/** /**
* @param string $config * @param string $config
* @param array $user_data * @param array $user_data
* @param \phpbb\auth\auth $auth * @param auth $auth
* @param bool $force_global * @param bool $force_global
* @return string * @return string
*/ */
public function cfg_user($config, $user_data, $auth, $force_global = false) 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]; return $user_data['user_' . $config];
} }
@@ -180,9 +278,11 @@ class settings
} }
$dateformat_options .= '>' . $this->user->lang('MCHAT_CUSTOM_DATEFORMAT') . '</option>'; $dateformat_options .= '>' . $this->user->lang('MCHAT_CUSTOM_DATEFORMAT') . '</option>';
$ucp_settings = $this->ucp_settings();
return array( return array(
'S_MCHAT_DATEFORMAT_OPTIONS' => $dateformat_options, '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, 'S_MCHAT_CUSTOM_DATEFORMAT' => $s_custom,
); );
} }

View File

@@ -4,31 +4,38 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\cron; 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; protected $functions;
/** @var \dmzx\mchat\core\settings */ /** @var settings */
protected $settings; protected $settings;
/** /**
* Constructor * Constructor
* *
* @param \dmzx\mchat\core\functions $functions * @param functions $functions
* @param \dmzx\mchat\core\settings $settings * @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->functions = $functions;
$this->settings = $settings; $this->settings = $settings;
} }
/** /**

View File

@@ -4,28 +4,33 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\event; namespace dmzx\mchat\event;
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\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class acp_listener implements EventSubscriberInterface class acp_listener implements EventSubscriberInterface
{ {
/** @var \phpbb\template\template */ /** @var template */
protected $template; protected $template;
/** @var \phpbb\request\request */ /** @var request_interface */
protected $request; protected $request;
/** @var \phpbb\user */ /** @var user */
protected $user; protected $user;
/** @var \dmzx\mchat\core\settings */ /** @var settings */
protected $settings; protected $settings;
/** @var string */ /** @var string */
@@ -37,14 +42,21 @@ class acp_listener implements EventSubscriberInterface
/** /**
* Constructor * Constructor
* *
* @param \phpbb\template\template $template * @param template $template
* @param \phpbb\request\request $request * @param request_interface $request
* @param \phpbb\user $user * @param user $user
* @param \dmzx\mchat\core\settings $settings * @param settings $settings
* @param string $root_path * @param string $root_path
* @param string $php_ext * @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,
$root_path,
$php_ext
)
{ {
$this->template = $template; $this->template = $template;
$this->request = $request; $this->request = $request;
@@ -73,7 +85,7 @@ class acp_listener implements EventSubscriberInterface
{ {
$ucp_configs = array(); $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; $ucp_configs[] = 'u_' . $config_name;
} }
@@ -131,11 +143,11 @@ class acp_listener implements EventSubscriberInterface
$user_id = $event['user_row']['user_id']; $user_id = $event['user_row']['user_id'];
$auth = new \phpbb\auth\auth(); $auth = new auth();
$userdata = $auth->obtain_user_data($user_id); $userdata = $auth->obtain_user_data($user_id);
$auth->acl($userdata); $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)) if ($auth->acl_get('u_' . $config_name))
{ {
@@ -168,7 +180,7 @@ class acp_listener implements EventSubscriberInterface
$user_id = $event['user_row']['user_id']; $user_id = $event['user_row']['user_id'];
$auth = new \phpbb\auth\auth(); $auth = new auth();
$userdata = $auth->obtain_user_data($user_id); $userdata = $auth->obtain_user_data($user_id);
$auth->acl($userdata); $auth->acl($userdata);
@@ -179,7 +191,7 @@ class acp_listener implements EventSubscriberInterface
$notifications_template_data = $this->settings->get_enabled_post_notifications_lang(); $notifications_template_data = $this->settings->get_enabled_post_notifications_lang();
$this->template->assign_var('MCHAT_POSTS_ENABLED_LANG', $notifications_template_data); $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); $upper = strtoupper($config_name);
$this->template->assign_vars(array( $this->template->assign_vars(array(

View File

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

View File

@@ -4,7 +4,7 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @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.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 * @return bool
* @access public * @access public
@@ -36,9 +37,9 @@ class ext extends \phpbb\extension\base
if ($module_ids) 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 = $this->container->get('language');
$lang->add_lang('mchat_acp', 'dmzx/mchat'); $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 * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @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) // 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' => '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' => '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' => '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' => 'edited a post: %1$s in %2$s',
'MCHAT_NEW_EDIT_DELETED' => 'edited a post that was deleted',
'MCHAT_NEW_LOGIN' => 'just logged in', 'MCHAT_NEW_LOGIN' => 'just logged in',
)); ));

View File

@@ -4,7 +4,7 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @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 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_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_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_MCHAT_TABLE_PURGED' => '<strong>mChat messages purged</strong><br />» %1$s',
'LOG_DELETED_MCHAT' => '<strong>mChat message deleted</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', 'LOG_EDITED_MCHAT' => '<strong>mChat message edited</strong><br />» %1$s',

View File

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

View File

@@ -4,7 +4,7 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @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_ADD' => 'Send',
'MCHAT_ARCHIVE' => 'Archive', 'MCHAT_ARCHIVE' => 'Archive',
'MCHAT_ARCHIVE_PAGE' => 'mChat Archive', 'MCHAT_ARCHIVE_PAGE' => 'mChat Archive',
'MCHAT_CUSTOM_PAGE' => 'mChat',
'MCHAT_BBCODES' => 'BBCodes', 'MCHAT_BBCODES' => 'BBCodes',
'MCHAT_CUSTOM_BBCODES' => 'Custom BBCodes', 'MCHAT_CUSTOM_BBCODES' => 'Custom BBCodes',
'MCHAT_DELCONFIRM' => 'Are you sure you want to delete this message?', 'MCHAT_DELCONFIRM' => 'Are you sure you want to delete this message?',

View File

@@ -4,7 +4,7 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
@@ -52,6 +52,12 @@ $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.', '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 // 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_GLOBALSETTINGS_TITLE' => 'mChat Global settings',
'MCHAT_ACP_GLOBALUSERSETTINGS_TITLE' => 'mChat Global user settings', 'MCHAT_ACP_GLOBALUSERSETTINGS_TITLE' => 'mChat Global user settings',
'MCHAT_VERSION' => 'Version', 'MCHAT_VERSION' => 'Version',
@@ -70,9 +76,10 @@ $lang = array_merge($lang, array(
'MCHAT_LIVE_UPDATES' => 'Live updates of edited and deleted messages', '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_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' => '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' => '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' => 'Prune messages now',
'MCHAT_PRUNE_NOW_CONFIRM' => 'Confirm pruning messages', 'MCHAT_PRUNE_NOW_CONFIRM' => 'Confirm pruning messages',
'MCHAT_PRUNED' => '%1$d mChat messages have been pruned', 'MCHAT_PRUNED' => '%1$d mChat messages have been pruned',
@@ -85,7 +92,7 @@ $lang = array_merge($lang, array(
'MCHAT_MESSAGE_NUM_ARCHIVE' => 'Number of messages to display on the archive page', '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_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_FLOOD_TIME' => 'Flood time', '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' => '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_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' => 'Maximum message length',

View File

@@ -4,7 +4,7 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @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_INPUT_AREA' => 'Input field',
'MCHAT_TEXT_AREA' => 'Text area', '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_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' => '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_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', 'MCHAT_PAUSE_ON_INPUT' => 'Pause on input',

View File

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

View File

@@ -4,14 +4,16 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\migrations; 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() static public function depends_on()
{ {

View File

@@ -4,14 +4,16 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\migrations; 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() static public function depends_on()
{ {

View File

@@ -4,14 +4,16 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\migrations; 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() static public function depends_on()
{ {

View File

@@ -4,14 +4,16 @@
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
namespace dmzx\mchat\migrations; 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() 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

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

View File

@@ -1,10 +1,10 @@
/** /**
* *
* @package phpBB Extension - mChat * @package phpBB Extension - mChat
* @copyright (c) 2009 By Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/ * @copyright (c) 2009 Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/
* @copyright (c) 2013 By Rich McGirr (RMcGirr83) http://rmcgirr83.org * @copyright (c) 2013 Rich McGirr (RMcGirr83) http://rmcgirr83.org
* @copyright (c) 2015 By dmzx - http://www.dmzx-web.net * @copyright (c) 2015 dmzx - http://www.dmzx-web.net
* @copyright (c) 2016 By kasimi * @copyright (c) 2016 kasimi - mail@kasimi.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* *
*/ */
@@ -105,9 +105,7 @@ jQuery(function($) {
deferred.reject(data.xhr, data.status, mChat.lang.parserErr); deferred.reject(data.xhr, data.status, mChat.lang.parserErr);
} }
} }
}).fail(function(xhr, status, error) { }).fail(deferred.reject);
deferred.reject(xhr, status, error);
});
return deferred.promise().fail(function(xhr, textStatus, errorThrown) { return deferred.promise().fail(function(xhr, textStatus, errorThrown) {
if (mChat.pageIsUnloading) { if (mChat.pageIsUnloading) {
return; return;
@@ -120,10 +118,10 @@ jQuery(function($) {
xhr: xhr, xhr: xhr,
textStatus: textStatus, textStatus: textStatus,
errorThrown: errorThrown, errorThrown: errorThrown,
updateSession: function(xhr) { updateSession: function() {
if (xhr.status == 403) { if (this.xhr.status == 403) {
mChat.endSession(true); mChat.endSession(true);
} else if (xhr.status == 400) { } else if (this.xhr.status == 400) {
mChat.resetSession(); mChat.resetSession();
} }
} }
@@ -134,12 +132,14 @@ jQuery(function($) {
mChat.cached('status-error').show(); mChat.cached('status-error').show();
var responseText; var responseText;
try { try {
responseText = xhr.responseJSON.message || errorThrown; responseText = data.xhr.responseJSON.message || data.errorThrown;
} catch (e) { } catch (e) {
responseText = errorThrown; responseText = data.errorThrown;
} }
phpbb.alert(mChat.lang.err, responseText); if (responseText && responseText !== 'timeout') {
data.updateSession(data.xhr); phpbb.alert(mChat.lang.err, responseText);
}
data.updateSession();
}); });
}, },
sound: function(file) { sound: function(file) {
@@ -169,7 +169,7 @@ jQuery(function($) {
}, },
toggle: function(name) { toggle: function(name) {
var $elem = mChat.cached(name); var $elem = mChat.cached(name);
$elem.stop().slideToggle('fast', function() { $elem.stop().slideToggle(200, function() {
if ($elem.is(':visible')) { if ($elem.is(':visible')) {
localStorage.setItem(mChat.cookie + 'mchat_show_' + name, 'yes'); localStorage.setItem(mChat.cookie + 'mchat_show_' + name, 'yes');
} else { } else {
@@ -218,17 +218,11 @@ jQuery(function($) {
if (color && inputValue.indexOf('[color=') === -1) { if (color && inputValue.indexOf('[color=') === -1) {
inputValue = '[color=#' + color + '] ' + inputValue + ' [/color]'; inputValue = '[color=#' + color + '] ' + inputValue + ' [/color]';
} }
mChat.cached('input').val(''); mChat.cached('input').val('').focus();
if (mChat.showCharCount) {
mChat.updateCharCount();
}
mChat.refresh(inputValue).done(function() { mChat.refresh(inputValue).done(function() {
mChat.resetSession(); mChat.resetSession();
}).fail(function() { }).fail(function() {
mChat.cached('input').val(originalInputValue); mChat.cached('input').val(originalInputValue);
if (mChat.showCharCount) {
mChat.updateCharCount();
}
}).always(function() { }).always(function() {
mChat.cached('add').prop('disabled', false); mChat.cached('add').prop('disabled', false);
setTimeout(function() { setTimeout(function() {
@@ -348,26 +342,25 @@ jQuery(function($) {
mChat.cached('messages').find('.mchat-no-messages').remove(); mChat.cached('messages').find('.mchat-no-messages').remove();
$messages.reverse(mChat.messageTop).hide().each(function(i) { $messages.reverse(mChat.messageTop).hide().each(function(i) {
var $message = $(this); var $message = $(this);
var data = { var dataAddMessageBefore = {
message: $message, message: $message,
delay: mChat.refreshInterval ? 400 : 0, delay: mChat.refreshInterval ? 400 : 0,
abort: $.inArray($message.data('mchat-id'), mChat.messageIds) !== -1, abort: $.inArray($message.data('mchat-id'), mChat.messageIds) !== -1,
playSound: playSound playSound: playSound
}; };
$(mChat).trigger('mchat_add_message_before', [data]); $(mChat).trigger('mchat_add_message_before', [dataAddMessageBefore]);
if (data.abort) { if (dataAddMessageBefore.abort) {
return; return;
} }
if (data.playSound) { if (dataAddMessageBefore.playSound) {
mChat.sound('add'); mChat.sound('add');
mChat.titleAlert(); mChat.titleAlert();
playSound = false; playSound = false;
} }
mChat.messageIds.push($message.data('mchat-id')); mChat.messageIds.push($message.data('mchat-id'));
setTimeout(function() { setTimeout(function() {
var $container = mChat.cached('messages'); var dataAddMessageAnimateBefore = {
var data = { container: mChat.cached('messages'),
container: $container,
message: $message, message: $message,
add: function() { add: function() {
if (mChat.messageTop) { if (mChat.messageTop) {
@@ -377,26 +370,38 @@ jQuery(function($) {
} }
}, },
show: function() { show: function() {
var scrollTop, scrollHeight = mChat.messageTop ? 0 : $container.get(0).scrollHeight; var container = this.container;
if (mChat.messageTop && (scrollTop = this.container.scrollTop()) > 0) { var scrollTop = container.scrollTop();
this.message.show(); var scrollLeeway = 20;
this.container.scrollTop(scrollTop + this.message.outerHeight()); 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 { } else {
this.message.css('opacity', 0).slideDown('fast').animate({opacity: 1}, {duration: 'fast', queue: false}); this.message.show();
} if (mChat.messageTop) {
if (!mChat.messageTop && this.container.scrollTop() >= scrollHeight - this.container.height()) { this.container.scrollTop(scrollTop + this.message.outerHeight());
this.container.animate({ }
scrollTop: scrollHeight,
easing: 'swing',
duration: 'slow'
});
} }
this.message.addClass('mchat-message-flash');
} }
}; };
$(mChat).trigger('mchat_add_message_animate_before', [data]); $(mChat).trigger('mchat_add_message_animate_before', [dataAddMessageAnimateBefore]);
data.add(); dataAddMessageAnimateBefore.add();
data.show(); dataAddMessageAnimateBefore.show();
}, i * data.delay); }, i * dataAddMessageBefore.delay);
if (mChat.editDeleteLimit && $message.data('mchat-edit-delete-limit') && $message.find('[data-mchat-action="edit"], [data-mchat-action="del"]').length > 0) { 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'); var id = $message.prop('id');
setTimeout(function() { setTimeout(function() {
@@ -549,7 +554,7 @@ jQuery(function($) {
updateCharCount: function() { updateCharCount: function() {
var count = mChat.cached('input').val().length; var count = mChat.cached('input').val().length;
var charCount = mChat.lang.charCount.format({current: count, max: mChat.mssgLngth}); 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) { if (mChat.mssgLngth) {
$elem.toggleClass('error', count > mChat.mssgLngth); $elem.toggleClass('error', count > mChat.mssgLngth);
} }
@@ -608,7 +613,9 @@ jQuery(function($) {
mChat.resetSession(); mChat.resetSession();
if (!mChat.messageTop) { 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 && !localStorage.getItem(mChat.cookie + 'mchat_no_sound')).change(function() {
@@ -661,6 +668,11 @@ jQuery(function($) {
if (mChat.showCharCount) { if (mChat.showCharCount) {
mChat.cached('form').on('input', mChat.updateCharCount); mChat.cached('form').on('input', mChat.updateCharCount);
mChat.cached('input').on('focus', function() {
setTimeout(function() {
mChat.updateCharCount();
}, 1);
});
} }
mChat.cached('input').autogrow({ mChat.cached('input').autogrow({

View File

@@ -2,9 +2,9 @@
<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js --> <!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js -->
<!-- ENDIF --> <!-- ENDIF -->
<!-- INCLUDEJS javascript/jquery.autogrow-textarea.js --> <!-- INCLUDEJS @dmzx_mchat/javascript/jquery.autogrow-textarea.js -->
<!-- INCLUDEJS javascript/jquery.titlealert.min.js --> <!-- INCLUDEJS @dmzx_mchat/javascript/jquery.titlealert.min.js -->
<!-- INCLUDEJS javascript/mchat.js --> <!-- INCLUDEJS @dmzx_mchat/javascript/mchat.js -->
<script type="text/javascript"> <script type="text/javascript">
// <![CDATA[ // <![CDATA[

View File

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

View File

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

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 * @package phpBB Extension - mChat
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net * @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 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
@@ -26,3 +26,7 @@ ul.mchat-buttons > li {
#mchat-panel #st_editor_buttons { #mchat-panel #st_editor_buttons {
display: block !important; display: block !important;
} }
.mchat-footer label {
padding-left: 3px;
}

View File

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

View File

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

View File

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

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

View File

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

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 --> <!-- IF MCHAT_CUSTOM_PAGE and MCHAT_NAVBAR_LINK -->
<!-- INCLUDE mchat_navlink.html --> <!-- INCLUDE @dmzx_mchat/mchat_navlink.html -->
<!-- ENDIF --> <!-- ENDIF -->

View File

@@ -0,0 +1,7 @@
<!-- IF 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 --> <!-- INCLUDE overall_header.html -->
<!-- ENDIF --> <!-- 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) --> <!-- IF MCHAT_IS_ARCHIVE_PAGE and (.pagination or MCHAT_TOTAL_MESSAGES) -->
<div class="action-bar bar-top"> <div class="action-bar bar-top">
@@ -30,7 +42,7 @@
<div class="inner"> <div class="inner">
<ul class="topiclist"> <ul class="topiclist">
<li class="header"> <li class="header">
<!-- INCLUDE mchat_header.html --> <!-- INCLUDE @dmzx_mchat/mchat_header.html -->
<!-- IF MCHAT_IS_COLLAPSIBLE --> <!-- IF MCHAT_IS_COLLAPSIBLE -->
<a href="{U_MCHAT_COLLAPSE_URL}" <a href="{U_MCHAT_COLLAPSE_URL}"
class="collapse-btn collapse-<!-- IF S_MCHAT_HIDDEN -->show<!-- ELSE -->hide<!-- ENDIF --> mchat-collapse" class="collapse-btn collapse-<!-- IF S_MCHAT_HIDDEN -->show<!-- ELSE -->hide<!-- ENDIF --> mchat-collapse"
@@ -73,9 +85,9 @@
<!-- EVENT dmzx_mchat_messages_container_before --> <!-- 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 --> <!-- IF .mchatrow -->
<!-- INCLUDE mchat_messages.html --> <!-- INCLUDE @dmzx_mchat/mchat_messages.html -->
<!-- ELSE --> <!-- ELSE -->
<li class="row mchat-static mchat-no-messages">{L_MCHAT_NOMESSAGE}</li> <li class="row mchat-static mchat-no-messages">{L_MCHAT_NOMESSAGE}</li>
<!-- ENDIF --> <!-- ENDIF -->
@@ -84,7 +96,7 @@
<!-- EVENT dmzx_mchat_messages_container_after --> <!-- EVENT dmzx_mchat_messages_container_after -->
</div> </div>
<!-- INCLUDE mchat_panel.html --> <!-- INCLUDE @dmzx_mchat/mchat_panel.html -->
</div> </div>
<!-- EVENT dmzx_mchat_body_after --> <!-- EVENT dmzx_mchat_body_after -->
@@ -110,7 +122,7 @@
<!-- IF MCHAT_IS_CUSTOM_PAGE and MCHAT_WHOIS_REFRESH --> <!-- IF MCHAT_IS_CUSTOM_PAGE and MCHAT_WHOIS_REFRESH -->
<h3>{L_MCHAT_WHO_IS_CHATTING}</h3> <h3>{L_MCHAT_WHO_IS_CHATTING}</h3>
<!-- INCLUDE mchat_whois.html --> <!-- INCLUDE @dmzx_mchat/mchat_whois.html -->
<div id="mchat-refresh"> <div id="mchat-refresh">
<span id="mchat-refresh-explain">{MCHAT_WHOIS_REFRESH_EXPLAIN}</span> <span id="mchat-refresh-explain">{MCHAT_WHOIS_REFRESH_EXPLAIN}</span>
<span id="mchat-refresh-pending" class="hidden">{L_MCHAT_REFRESHING}</span> <span id="mchat-refresh-pending" class="hidden">{L_MCHAT_REFRESHING}</span>
@@ -123,6 +135,8 @@
</div> </div>
<!-- ENDIF --> <!-- ENDIF -->
<!-- EVENT dmzx_mchat_overall_footer_before -->
<!-- IF MCHAT_IS_ARCHIVE_PAGE or MCHAT_IS_CUSTOM_PAGE --> <!-- IF MCHAT_IS_ARCHIVE_PAGE or MCHAT_IS_CUSTOM_PAGE -->
<!-- INCLUDE overall_footer.html --> <!-- INCLUDE overall_footer.html -->
<!-- ENDIF --> <!-- ENDIF -->

View File

@@ -11,7 +11,7 @@
</div> </div>
<!-- ENDIF --> <!-- ENDIF -->
<div class="mchat-message-wrapper"> <div class="mchat-message-wrapper">
<!-- INCLUDE mchat_messages_icons.html --> <!-- INCLUDE @dmzx_mchat/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-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> <div class="mchat-text">{mchatrow.MCHAT_MESSAGE}</div>
</div> </div>

View File

@@ -1,20 +1,25 @@
<!-- EVENT dmzx_mchat_messages_icons_before -->
<!-- IF not S_IS_BOT --> <!-- 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_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_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_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_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_EDIT = mchatrow.MCHAT_ALLOW_EDIT and not mchatrow.MCHAT_IS_NOTIFICATION -->
<!-- DEFINE $MCHAT_ALLOW_DEL = mchatrow.MCHAT_ALLOW_DEL --> <!-- 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 -->"> <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_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_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_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_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_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_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_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 --> <!-- 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> </ul>
<!-- ENDIF --> <!-- ENDIF -->
<!-- ENDIF --> <!-- ENDIF -->

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"> <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> </a>
</li> </li>

View File

@@ -1,10 +1,10 @@
<div id="mchat-panel" class="panel cp-mini<!-- IF MCHAT_IS_ARCHIVE_PAGE --> hidden<!-- ENDIF -->"> <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 --> <!-- IF MCHAT_IS_INDEX and MCHAT_WHOIS_REFRESH and MCHAT_WHOIS_INDEX -->
<!-- INCLUDE mchat_whois.html --> <!-- INCLUDE @dmzx_mchat/mchat_whois.html -->
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF MCHAT_CHARACTER_COUNT and not MCHAT_IS_ARCHIVE_PAGE --> <!-- 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 --> <!-- ENDIF -->
<form id="mchat-form" name="postform" action="{U_MCHAT_CUSTOM_PAGE}" method="POST"> <form id="mchat-form" name="postform" action="{U_MCHAT_CUSTOM_PAGE}" method="POST">
@@ -68,7 +68,7 @@
<span id="mchat-refresh-text">{MCHAT_REFRESH_YES}</span> <span id="mchat-refresh-text">{MCHAT_REFRESH_YES}</span>
</li> </li>
<!-- IF MCHAT_TIMEOUT --><li><span id="mchat-session">{MCHAT_SESSION_TIMELEFT}</span></li><!-- ENDIF --> <!-- 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 --> <!-- 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 -->
<li><span class="mchat-copyright" title="{MCHAT_AUTHOR_NAMES}">&copy;</span></li> <li><span class="mchat-copyright" title="{MCHAT_AUTHOR_NAMES}">&copy;</span></li>
</ul> </ul>
</div> </div>

View File

@@ -15,6 +15,9 @@
<!-- IF MCHAT_AUTH_COUNT > 0 --> <!-- IF MCHAT_AUTH_COUNT > 0 -->
<fieldset> <fieldset>
<!-- EVENT dmzx_mchat_ucp_index_before -->
<!-- IF MCHAT_INDEX_AUTH --> <!-- IF MCHAT_INDEX_AUTH -->
<dl> <dl>
<dt><label for="user_mchat_index">{L_MCHAT_INDEX}{L_COLON}</label></dt> <dt><label for="user_mchat_index">{L_MCHAT_INDEX}{L_COLON}</label></dt>
@@ -51,7 +54,13 @@
</dd> </dd>
</dl> </dl>
<!-- ENDIF --> <!-- ENDIF -->
<!-- EVENT dmzx_mchat_ucp_location_after -->
<hr /> <hr />
<!-- EVENT dmzx_mchat_ucp_message_top_before -->
<!-- IF MCHAT_MESSAGE_TOP_AUTH --> <!-- IF MCHAT_MESSAGE_TOP_AUTH -->
<dl> <dl>
<dt><label for="user_mchat_message_top">{L_MCHAT_MESSAGE_TOP}{L_COLON}</label><br /><span>{L_MCHAT_MESSAGE_TOP_EXPLAIN}</span></dt> <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 --> <!-- ENDIF -->
<!-- IF MCHAT_CHARACTER_COUNT_AUTH --> <!-- IF MCHAT_CHARACTER_COUNT_AUTH -->
<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> <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="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> <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> </dd>
</dl> </dl>
<!-- ENDIF --> <!-- ENDIF -->
<!-- EVENT dmzx_mchat_ucp_relative_time_after -->
<hr /> <hr />
<!-- EVENT dmzx_mchat_ucp_posts_before -->
<!-- IF MCHAT_POSTS_AUTH and MCHAT_POSTS_ENABLED_LANG --> <!-- IF MCHAT_POSTS_AUTH and MCHAT_POSTS_ENABLED_LANG -->
<dl> <dl>
<dt><label for="user_mchat_posts">{MCHAT_POSTS_ENABLED_LANG}{L_COLON}</label></dt> <dt><label for="user_mchat_posts">{MCHAT_POSTS_ENABLED_LANG}{L_COLON}</label></dt>
@@ -145,6 +160,9 @@
</dd> </dd>
</dl> </dl>
<!-- ENDIF --> <!-- ENDIF -->
<!-- EVENT dmzx_mchat_ucp_posts_after -->
</fieldset> </fieldset>
<!-- ENDIF --> <!-- ENDIF -->
</div> </div>

View File

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

View File

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

View File

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

View File

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