Version 2.0.0-RC6
This commit is contained in:
16
README.md
16
README.md
@@ -1,21 +1,23 @@
|
||||
# mChat Extension
|
||||
phpBB Extension - mChat
|
||||
=====================
|
||||
|
||||
[](https://travis-ci.org/dmzx/mChat-Extension)
|
||||
[](https://travis-ci.org/kasimi/mChat)
|
||||
|
||||
## Install
|
||||
|
||||
1. Download the latest release.
|
||||
1. Download the [latest release](https://github.com/kasimi/mChat/releases).
|
||||
2. Unzip the downloaded release, and change the name of the folder to `mchat`.
|
||||
3. In the `ext` directory of your phpBB board, create a new directory named `dmzx` (if it does not already exist).
|
||||
4. Copy the `mchat` folder to `/ext/dmzx/` (if done correctly, you'll have the main extension class at (your forum root)/ext/dmzx/mchat/composer.json).
|
||||
3. In the `ext` directory of your phpBB board, create a new directory named `dmzx` if it does not already exist.
|
||||
4. Copy the `mchat` folder to `/ext/dmzx/`. If done correctly, the folder structure should look like this: `your forum root)/ext/dmzx/mchat/composer.json`.
|
||||
5. Navigate in the ACP to `Customise -> Manage extensions`.
|
||||
6. Look for `mChat Extension` under the Disabled Extensions list, and click its `Enable` link.
|
||||
6. Look for `mChat` under the `Disabled Extensions` list, and click its `Enable` link.
|
||||
|
||||
## Uninstall
|
||||
|
||||
1. Navigate in the ACP to `Customise -> Extension Management -> Extensions`.
|
||||
2. Look for `mChat Extension` under the Enabled Extensions list, and click its `Disable` link.
|
||||
2. Look for `mChat` under the `Enabled Extensions` list, and click its `Disable` link.
|
||||
3. To permanently uninstall, click `Delete Data` and then delete the `/ext/dmzx/mchat` folder.
|
||||
|
||||
## License
|
||||
|
||||
[GNU General Public License v2](http://opensource.org/licenses/GPL-2.0)
|
||||
|
||||
@@ -49,6 +49,11 @@
|
||||
<dd><label><input type="radio" class="radio" name="mchat_navbar_link" value="1"<!-- IF MCHAT_NAVBAR_LINK --> id="mchat_navbar_link" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label><input type="radio" class="radio" name="mchat_navbar_link" value="0"<!-- IF not MCHAT_NAVBAR_LINK --> id="mchat_navbar_link" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_navbar_link_count">{L_MCHAT_NAVBAR_LINK_COUNT}{L_COLON}</label></dt>
|
||||
<dd><label><input type="radio" class="radio" name="mchat_navbar_link_count" value="1"<!-- IF MCHAT_NAVBAR_LINK_COUNT --> id="mchat_navbar_link_count" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label><input type="radio" class="radio" name="mchat_navbar_link_count" value="0"<!-- IF not MCHAT_NAVBAR_LINK_COUNT --> id="mchat_navbar_link_count" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{L_MCHAT_SETTINGS_ARCHIVE}</legend>
|
||||
@@ -61,7 +66,7 @@
|
||||
<fieldset>
|
||||
<legend>{L_MCHAT_SETTINGS_MESSAGES}</legend>
|
||||
<dl>
|
||||
<dt><label for="mchat_timeout">{L_MCHAT_USER_TIMEOUT}{L_COLON}</label><br />
|
||||
<dt><label for="mchat_timeout">{L_MCHAT_TIMEOUT}{L_COLON}</label><br />
|
||||
<span>{L_MCHAT_TIMEOUT_EXPLAIN}</span></dt>
|
||||
<dd><input type="text" name="mchat_timeout" id="mchat_timeout" size="10" maxlength="4" value="{MCHAT_TIMEOUT}" /></dd>
|
||||
</dl>
|
||||
@@ -115,7 +120,7 @@
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_static_message">{L_MCHAT_STATIC_MESSAGE}{L_COLON}</label><br />
|
||||
<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>
|
||||
</dl>
|
||||
</fieldset>
|
||||
@@ -149,15 +154,23 @@
|
||||
<label><input type="radio" name="mchat_posts_quote" value="0"<!-- IF not MCHAT_POSTS_QUOTE --> id="mchat_posts_quote" checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_posts_login">{L_MCHAT_POSTS_LOGIN}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" name="mchat_posts_login" value="1"<!-- IF MCHAT_POSTS_LOGIN --> id="mchat_posts_login" checked="checked"<!-- ENDIF --> /> {L_YES}</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>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{L_MCHAT_SETTINGS_STATS}</legend>
|
||||
<dl>
|
||||
<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>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<!-- IF MCHAT_FOUNDER -->
|
||||
<fieldset>
|
||||
<legend>{L_MCHAT_SETTINGS_PRUNE}</legend>
|
||||
<dl>
|
||||
@@ -167,10 +180,19 @@
|
||||
<label><input type="radio" class="radio" name="mchat_prune" value="0"<!-- IF not MCHAT_PRUNE --> id="mchat_prune" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_prune_num">{L_MCHAT_PRUNE_NUM}{L_COLON}</label></dt>
|
||||
<dt><label for="mchat_prune_num">{L_MCHAT_PRUNE_NUM}{L_COLON}</label><br />
|
||||
<span>{L_MCHAT_PRUNE_NUM_EXPLAIN}</span></dt>
|
||||
<dd><input type="text" name="mchat_prune_num" size="10" id="mchat_prune_num" value="{MCHAT_PRUNE_NUM}" /></dd>
|
||||
</dl>
|
||||
<!-- IF MCHAT_FOUNDER -->
|
||||
<dl>
|
||||
<dt><label for="mchat_prune_now">{L_MCHAT_PRUNE_NOW}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<input class="button1" type="submit" id="mchat_prune_now" name="mchat_prune_now" value="{L_MCHAT_PRUNE_NOW}" />
|
||||
<label>{L_MCHAT_PRUNE_NOW_CONFIRM}{L_COLON}</label>
|
||||
<label><input type="radio" name="mchat_prune_now_confirm" value="1" /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_prune_now_confirm" value="0" id="mchat_prune_now_confirm" checked="checked" /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_purge">{L_MCHAT_PURGE}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
@@ -180,12 +202,12 @@
|
||||
<label><input type="radio" name="mchat_purge_confirm" value="0" id="mchat_purge_confirm" checked="checked" /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
<!-- EVENT acp_dmzx_mchat_globalsettings_after -->
|
||||
<p class="submit-buttons">
|
||||
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</p>
|
||||
</form>
|
||||
|
||||
@@ -1,45 +1,42 @@
|
||||
{
|
||||
"name": "dmzx/mchat",
|
||||
"type": "phpbb-extension",
|
||||
"description": "mChat Extension",
|
||||
"homepage": "http://www.dmzx-web.net",
|
||||
"version": "2.0.0-RC5",
|
||||
"time": "2016-04-03",
|
||||
"description": "mChat",
|
||||
"homepage": "https://github.com/kasimi/mChat",
|
||||
"version": "2.0.0-RC6",
|
||||
"time": "2016-09-18",
|
||||
"keywords": ["phpbb", "extension", "mchat"],
|
||||
"license": "GPL-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "kasimi",
|
||||
"homepage": "https://kasimi.net",
|
||||
"email": "mail@kasimi.net",
|
||||
"role": "Extension Developer"
|
||||
},
|
||||
{
|
||||
"name": "dmzx",
|
||||
"homepage": "http://www.dmzx-web.net",
|
||||
"email": "info@dmzx-web.net",
|
||||
"role": "Extension Developer"
|
||||
},
|
||||
{
|
||||
"name": "kasimi",
|
||||
"homepage": "https://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=1330603",
|
||||
"role": "Extension Co-Developer"
|
||||
},
|
||||
{
|
||||
"name": "RMcGirr83",
|
||||
"homepage": "http://rmcgirr83.org",
|
||||
"role": "Author"
|
||||
"role": "Original MOD author"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
"php": ">=5.3.3",
|
||||
"phpbb/phpbb": ">=3.1.7-PL1,<3.3.0@dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpbb/epv": "dev-master"
|
||||
},
|
||||
"extra": {
|
||||
"display-name": "mChat Extension",
|
||||
"display-name": "mChat",
|
||||
"soft-require": {
|
||||
"phpbb/phpbb": ">=3.1.7-PL1,<3.3.0@dev"
|
||||
},
|
||||
"version-check": {
|
||||
"host": "www.dmzx-web.net",
|
||||
"directory": "/versions",
|
||||
"filename": "mchat_version.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
parameters:
|
||||
# Global settings that only the administrator is allowed to modify.
|
||||
# The values are stored in the phpbb_config table and can be
|
||||
# accessed using the \phpbb\config\config $config class.
|
||||
dmzx.mchat.config_global:
|
||||
mchat_bbcode_disallowed:
|
||||
default: ''
|
||||
validation:
|
||||
- 'string'
|
||||
- false
|
||||
- 0
|
||||
- 255
|
||||
mchat_custom_height:
|
||||
default: 350
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 50
|
||||
- 1000
|
||||
mchat_custom_page:
|
||||
default: 1
|
||||
mchat_edit_delete_limit:
|
||||
default: 0
|
||||
mchat_flood_time:
|
||||
default: 0
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 0
|
||||
- 60
|
||||
mchat_index_height:
|
||||
default: 250
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 50
|
||||
- 1000
|
||||
mchat_live_updates:
|
||||
default: 1
|
||||
mchat_max_message_lngth:
|
||||
default: 500
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 0
|
||||
- 1000
|
||||
mchat_message_num_archive:
|
||||
default: 25
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 10
|
||||
- 100
|
||||
mchat_message_num_custom:
|
||||
default: 10
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 5
|
||||
- 50
|
||||
mchat_message_num_index:
|
||||
default: 10
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 5
|
||||
- 50
|
||||
mchat_navbar_link:
|
||||
default: 1
|
||||
mchat_override_min_post_chars:
|
||||
default: 0
|
||||
mchat_override_smilie_limit:
|
||||
default: 0
|
||||
mchat_posts_edit:
|
||||
default: 0
|
||||
mchat_posts_quote:
|
||||
default: 0
|
||||
mchat_posts_reply:
|
||||
default: 0
|
||||
mchat_posts_topic:
|
||||
default: 0
|
||||
mchat_prune:
|
||||
default: 0
|
||||
mchat_prune_num:
|
||||
default: 0
|
||||
mchat_refresh:
|
||||
default: 10
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 5
|
||||
- 60
|
||||
mchat_rules:
|
||||
default: ''
|
||||
validation:
|
||||
- 'string'
|
||||
- false
|
||||
- 0
|
||||
- 255
|
||||
mchat_static_message:
|
||||
default: ''
|
||||
validation:
|
||||
- 'string'
|
||||
- false
|
||||
- 0
|
||||
- 255
|
||||
mchat_timeout:
|
||||
default: 0
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 0
|
||||
- -1 # This value is replaced with $config['session_length'] in the \dmzx\mchat\core\settings class
|
||||
mchat_whois:
|
||||
default: 1
|
||||
mchat_whois_refresh:
|
||||
default: 60
|
||||
validation:
|
||||
- 'num'
|
||||
- false
|
||||
- 10
|
||||
- 300
|
||||
|
||||
# User-specific settings for which the administrator can set default
|
||||
# values as well as adjust permissions to allow users to customize them.
|
||||
# For each setting a new column is added to the phpbb_users table.
|
||||
dmzx.mchat.config_ucp:
|
||||
mchat_avatars:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_capital_letter:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_character_count:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_date:
|
||||
default: 'D M d, Y g:i a'
|
||||
type: 'VCHAR:64'
|
||||
validation:
|
||||
- 'string'
|
||||
- false
|
||||
- 0
|
||||
- 64
|
||||
mchat_index:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_input_area:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_location:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_message_top:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_pause_on_input:
|
||||
default: 0
|
||||
type: 'BOOL'
|
||||
mchat_posts:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_relative_time:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_sound:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
mchat_stats_index:
|
||||
default: 0
|
||||
type: 'BOOL'
|
||||
mchat_whois_index:
|
||||
default: 1
|
||||
type: 'BOOL'
|
||||
@@ -1,16 +1,37 @@
|
||||
dmzx_mchat_controller:
|
||||
dmzx_mchat_page_custom_controller:
|
||||
path: /mchat
|
||||
methods: [GET]
|
||||
defaults: { _controller: dmzx.mchat.main.controller:page, page: custom }
|
||||
dmzx_mchat_page_controller:
|
||||
path: /mchat/{page}
|
||||
defaults: { _controller: dmzx.mchat.core:page_custom }
|
||||
dmzx_mchat_page_archive_controller:
|
||||
path: /mchat/archive
|
||||
methods: [GET]
|
||||
defaults: { _controller: dmzx.mchat.main.controller:page }
|
||||
requirements:
|
||||
page: 'archive|rules|whois'
|
||||
dmzx_mchat_action_controller:
|
||||
path: /mchat/action-{action}
|
||||
defaults: { _controller: dmzx.mchat.core:page_archive }
|
||||
dmzx_mchat_page_rules_controller:
|
||||
path: /mchat/rules
|
||||
methods: [GET]
|
||||
defaults: { _controller: dmzx.mchat.core:page_rules }
|
||||
dmzx_mchat_page_whois_controller:
|
||||
path: /mchat/whois/{ip}
|
||||
methods: [GET]
|
||||
defaults: { _controller: dmzx.mchat.core:page_whois }
|
||||
|
||||
dmzx_mchat_action_add_controller:
|
||||
path: /mchat/action/add
|
||||
methods: [POST]
|
||||
defaults: { _controller: dmzx.mchat.main.controller:action }
|
||||
requirements:
|
||||
action: 'add|edit|del|refresh|whois'
|
||||
defaults: { _controller: dmzx.mchat.core:action_add }
|
||||
dmzx_mchat_action_edit_controller:
|
||||
path: /mchat/action/edit
|
||||
methods: [POST]
|
||||
defaults: { _controller: dmzx.mchat.core:action_edit }
|
||||
dmzx_mchat_action_del_controller:
|
||||
path: /mchat/action/del
|
||||
methods: [POST]
|
||||
defaults: { _controller: dmzx.mchat.core:action_del }
|
||||
dmzx_mchat_action_refresh_controller:
|
||||
path: /mchat/action/refresh
|
||||
methods: [POST]
|
||||
defaults: { _controller: dmzx.mchat.core:action_refresh }
|
||||
dmzx_mchat_action_whois_controller:
|
||||
path: /mchat/action/whois
|
||||
methods: [POST]
|
||||
defaults: { _controller: dmzx.mchat.core:action_whois }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
imports:
|
||||
- { resource: tables.yml }
|
||||
- { resource: config_2_0_0.yml }
|
||||
|
||||
services:
|
||||
dmzx.mchat.acp.controller:
|
||||
class: dmzx\mchat\controller\acp_controller
|
||||
arguments:
|
||||
- '@dmzx.mchat.functions'
|
||||
- '@template'
|
||||
- '@log'
|
||||
- '@user'
|
||||
@@ -14,7 +14,7 @@ services:
|
||||
- '@request'
|
||||
- '@dmzx.mchat.settings'
|
||||
- '%dmzx.mchat.table.mchat%'
|
||||
- '%dmzx.mchat.table.mchat_deleted_messages%'
|
||||
- '%dmzx.mchat.table.mchat_log%'
|
||||
- '%core.root_path%'
|
||||
- '%core.php_ext%'
|
||||
dmzx.mchat.ucp.controller:
|
||||
@@ -28,12 +28,6 @@ services:
|
||||
- '@dmzx.mchat.settings'
|
||||
- '%core.root_path%'
|
||||
- '%core.php_ext%'
|
||||
dmzx.mchat.main.controller:
|
||||
class: dmzx\mchat\controller\main_controller
|
||||
arguments:
|
||||
- '@user'
|
||||
- '@dmzx.mchat.core'
|
||||
- '@request'
|
||||
dmzx.mchat.core:
|
||||
class: dmzx\mchat\core\mchat
|
||||
arguments:
|
||||
@@ -59,10 +53,11 @@ services:
|
||||
- '@log'
|
||||
- '@dbal.conn'
|
||||
- '@cache.driver'
|
||||
- '@dispatcher'
|
||||
- '%core.root_path%'
|
||||
- '%core.php_ext%'
|
||||
- '%dmzx.mchat.table.mchat%'
|
||||
- '%dmzx.mchat.table.mchat_deleted_messages%'
|
||||
- '%dmzx.mchat.table.mchat_log%'
|
||||
- '%dmzx.mchat.table.mchat_sessions%'
|
||||
dmzx.mchat.settings:
|
||||
class: dmzx\mchat\core\settings
|
||||
@@ -70,8 +65,6 @@ services:
|
||||
- '@user'
|
||||
- '@config'
|
||||
- '@auth'
|
||||
- '%dmzx.mchat.config_global%'
|
||||
- '%dmzx.mchat.config_ucp%'
|
||||
dmzx.mchat.acp.listener:
|
||||
class: dmzx\mchat\event\acp_listener
|
||||
arguments:
|
||||
@@ -89,6 +82,16 @@ services:
|
||||
- '@dmzx.mchat.core'
|
||||
- '@controller.helper'
|
||||
- '@user'
|
||||
- '@request'
|
||||
- '%core.php_ext%'
|
||||
tags:
|
||||
- { name: event.listener }
|
||||
dmzx.mchat.cron.task.mchat_prune:
|
||||
class: dmzx\mchat\cron\mchat_prune
|
||||
arguments:
|
||||
- '@dmzx.mchat.functions'
|
||||
- '@dmzx.mchat.settings'
|
||||
calls:
|
||||
- [set_name, [cron.task.mchat_prune]]
|
||||
tags:
|
||||
- { name: cron.task }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
parameters:
|
||||
dmzx.mchat.table.mchat: %core.table_prefix%mchat
|
||||
dmzx.mchat.table.mchat_deleted_messages: %core.table_prefix%mchat_deleted_messages
|
||||
dmzx.mchat.table.mchat_log: %core.table_prefix%mchat_log
|
||||
dmzx.mchat.table.mchat_sessions: %core.table_prefix%mchat_sessions
|
||||
|
||||
@@ -13,6 +13,9 @@ namespace dmzx\mchat\controller;
|
||||
|
||||
class acp_controller
|
||||
{
|
||||
/** @var \dmzx\mchat\core\functions */
|
||||
protected $functions;
|
||||
|
||||
/** @var \phpbb\template\template */
|
||||
protected $template;
|
||||
|
||||
@@ -38,7 +41,7 @@ class acp_controller
|
||||
protected $mchat_table;
|
||||
|
||||
/** @var string */
|
||||
protected $mchat_deleted_messages_table;
|
||||
protected $mchat_log_table;
|
||||
|
||||
/** @var string */
|
||||
protected $root_path;
|
||||
@@ -49,6 +52,7 @@ class acp_controller
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \dmzx\mchat\core\functions $functions
|
||||
* @param \phpbb\template\template $template
|
||||
* @param \phpbb\log\log_interface $log
|
||||
* @param \phpbb\user $user
|
||||
@@ -57,23 +61,24 @@ class acp_controller
|
||||
* @param \phpbb\request\request $request
|
||||
* @param \dmzx\mchat\core\settings $settings
|
||||
* @param string $mchat_table
|
||||
* @param string $mchat_deleted_messages_table
|
||||
* @param string $mchat_log_table
|
||||
* @param string $root_path
|
||||
* @param string $php_ext
|
||||
*/
|
||||
public function __construct(\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_deleted_messages_table, $root_path, $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)
|
||||
{
|
||||
$this->template = $template;
|
||||
$this->log = $log;
|
||||
$this->user = $user;
|
||||
$this->db = $db;
|
||||
$this->cache = $cache;
|
||||
$this->request = $request;
|
||||
$this->settings = $settings;
|
||||
$this->mchat_table = $mchat_table;
|
||||
$this->mchat_deleted_messages_table = $mchat_deleted_messages_table;
|
||||
$this->root_path = $root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->functions = $functions;
|
||||
$this->template = $template;
|
||||
$this->log = $log;
|
||||
$this->user = $user;
|
||||
$this->db = $db;
|
||||
$this->cache = $cache;
|
||||
$this->request = $request;
|
||||
$this->settings = $settings;
|
||||
$this->mchat_table = $mchat_table;
|
||||
$this->mchat_log_table = $mchat_log_table;
|
||||
$this->root_path = $root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,15 +92,9 @@ class acp_controller
|
||||
|
||||
$error = array();
|
||||
|
||||
if ($this->request->is_set_post('mchat_purge') && $this->request->variable('mchat_purge_confirm', false) && check_form_key('acp_mchat') && $this->user->data['user_type'] == USER_FOUNDER)
|
||||
{
|
||||
$this->db->sql_query('TRUNCATE TABLE ' . $this->mchat_table);
|
||||
$this->db->sql_query('TRUNCATE TABLE ' . $this->mchat_deleted_messages_table);
|
||||
$this->cache->destroy('sql', $this->mchat_deleted_messages_table);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PURGED', false, array($this->user->data['username']));
|
||||
trigger_error($this->user->lang('MCHAT_PURGED') . adm_back_link($u_action));
|
||||
}
|
||||
else if ($this->request->is_set_post('submit'))
|
||||
$is_founder = $this->user->data['user_type'] == USER_FOUNDER;
|
||||
|
||||
if ($this->request->is_set_post('submit'))
|
||||
{
|
||||
$mchat_new_config = array();
|
||||
$validation = array();
|
||||
@@ -110,6 +109,13 @@ class acp_controller
|
||||
}
|
||||
}
|
||||
|
||||
// Don't allow changing pruning settings for non founders
|
||||
if (!$is_founder)
|
||||
{
|
||||
unset($mchat_new_config['mchat_prune']);
|
||||
unset($mchat_new_config['mchat_prune_num']);
|
||||
}
|
||||
|
||||
if (!function_exists('validate_data'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions_user.' . $this->php_ext);
|
||||
@@ -140,17 +146,34 @@ class acp_controller
|
||||
$error = array_map(array($this->user, 'lang'), $error);
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($is_founder && $this->request->is_set_post('mchat_purge') && $this->request->variable('mchat_purge_confirm', false) && check_form_key('acp_mchat'))
|
||||
{
|
||||
$this->db->sql_query('TRUNCATE TABLE ' . $this->mchat_table);
|
||||
$this->db->sql_query('TRUNCATE TABLE ' . $this->mchat_log_table);
|
||||
$this->cache->destroy('sql', $this->mchat_log_table);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PURGED', false, array($this->user->data['username']));
|
||||
trigger_error($this->user->lang('MCHAT_PURGED') . adm_back_link($u_action));
|
||||
}
|
||||
else if ($is_founder && $this->request->is_set_post('mchat_prune_now') && $this->request->variable('mchat_prune_now_confirm', false) && check_form_key('acp_mchat'))
|
||||
{
|
||||
$num_pruned_messages = count($this->functions->mchat_prune());
|
||||
trigger_error($this->user->lang('MCHAT_PRUNED', $num_pruned_messages) . adm_back_link($u_action));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array_keys($this->settings->global) as $key)
|
||||
{
|
||||
$this->template->assign_var(strtoupper($key), $this->settings->cfg($key));
|
||||
}
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
'MCHAT_ERROR' => $error ? implode('<br />', $error) : '',
|
||||
'MCHAT_ERROR' => implode('<br />', $error),
|
||||
'MCHAT_VERSION' => $this->settings->cfg('mchat_version'),
|
||||
'MCHAT_FOUNDER' => $this->user->data['user_type'] == USER_FOUNDER,
|
||||
'MCHAT_FOUNDER' => $is_founder,
|
||||
'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_USER_TIMEOUT_EXPLAIN','<a href="' . append_sid("{$this->root_path}adm/index.$this->php_ext", 'i=board&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&mode=load', true, $this->user->session_id) . '">', '</a>', $this->settings->cfg('session_length')),
|
||||
'U_ACTION' => $u_action,
|
||||
));
|
||||
}
|
||||
@@ -238,9 +261,9 @@ class acp_controller
|
||||
$this->template->assign_var('MCHAT_POSTS_ENABLED_LANG', $notifications_template_data);
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
'MCHAT_ERROR' => $error ? implode('<br />', $error) : '',
|
||||
'MCHAT_VERSION' => $this->settings->cfg('mchat_version'),
|
||||
'U_ACTION' => $u_action,
|
||||
'MCHAT_ERROR' => implode('<br />', $error),
|
||||
'MCHAT_VERSION' => $this->settings->cfg('mchat_version'),
|
||||
'U_ACTION' => $u_action,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
|
||||
* @copyright (c) 2016 kasimi
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\controller;
|
||||
|
||||
use \Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class main_controller
|
||||
{
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \dmzx\mchat\core\mchat */
|
||||
protected $mchat;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\user $user
|
||||
* @param \dmzx\mchat\core\mchat $mchat
|
||||
* @param \phpbb\request\request $request
|
||||
*/
|
||||
public function __construct(\phpbb\user $user, \dmzx\mchat\core\mchat $mchat, \phpbb\request\request $request)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->mchat = $mchat;
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller for mChat
|
||||
*
|
||||
* @param string $page The page to render, one of custom|archive|rules|whois
|
||||
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
|
||||
*/
|
||||
public function page($page)
|
||||
{
|
||||
$this->user->add_lang_ext('dmzx/mchat', 'mchat');
|
||||
return call_user_func(array($this->mchat, 'page_' . $page));
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller for mChat actions called with Ajax requests
|
||||
*
|
||||
* @param string $action The action to perform, one of add|edit|del|refresh|whois
|
||||
* @return A Symfony JsonResponse object.
|
||||
*/
|
||||
public function action($action)
|
||||
{
|
||||
if (!$this->request->is_ajax())
|
||||
{
|
||||
throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION');
|
||||
}
|
||||
|
||||
// Fix avatars & smilies
|
||||
if (!defined('PHPBB_USE_BOARD_URL_PATH'))
|
||||
{
|
||||
define('PHPBB_USE_BOARD_URL_PATH', true);
|
||||
}
|
||||
|
||||
$this->user->add_lang_ext('dmzx/mchat', 'mchat');
|
||||
$data = call_user_func(array($this->mchat, 'action_' . $action));
|
||||
|
||||
return new JsonResponse($data);
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,9 @@ class functions
|
||||
/** @var \phpbb\cache\driver\driver_interface */
|
||||
protected $cache;
|
||||
|
||||
/** @var \phpbb\event\dispatcher_interface */
|
||||
protected $dispatcher;
|
||||
|
||||
/** @var string */
|
||||
protected $root_path;
|
||||
|
||||
@@ -41,13 +44,28 @@ class functions
|
||||
protected $mchat_table;
|
||||
|
||||
/** @var string */
|
||||
protected $mchat_deleted_messages_table;
|
||||
protected $mchat_log_table;
|
||||
|
||||
/** @var string */
|
||||
protected $mchat_sessions_table;
|
||||
|
||||
/** @var array */
|
||||
protected $foes = null;
|
||||
public $log_types = array(
|
||||
1 => 'edit',
|
||||
2 => 'del',
|
||||
);
|
||||
|
||||
/**
|
||||
* Value of the phpbb_mchat.post_id field for login notification
|
||||
* messages if the user session is visible at the time of login
|
||||
*/
|
||||
const LOGIN_VISIBLE = 1;
|
||||
|
||||
/**
|
||||
* Value of the phpbb_mchat.post_id field for login notification
|
||||
* messages if the user session is hidden at the time of login
|
||||
*/
|
||||
const LOGIN_HIDDEN = 2;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -58,25 +76,27 @@ class functions
|
||||
* @param \phpbb\log\log_interface $log
|
||||
* @param \phpbb\db\driver\driver_interface $db
|
||||
* @param \phpbb\cache\driver\driver_interface $cache
|
||||
* @param \phpbb\event\dispatcher_interface $dispatcher
|
||||
* @param string $root_path
|
||||
* @param string $php_ext
|
||||
* @param string $mchat_table
|
||||
* @param string $mchat_deleted_messages_table
|
||||
* @param string $mchat_log_table
|
||||
* @param string $mchat_sessions_table
|
||||
*/
|
||||
function __construct(\dmzx\mchat\core\settings $settings, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, $root_path, $php_ext, $mchat_table, $mchat_deleted_messages_table, $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)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
$this->user = $user;
|
||||
$this->auth = $auth;
|
||||
$this->log = $log;
|
||||
$this->db = $db;
|
||||
$this->cache = $cache;
|
||||
$this->root_path = $root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->mchat_table = $mchat_table;
|
||||
$this->mchat_deleted_messages_table = $mchat_deleted_messages_table;
|
||||
$this->mchat_sessions_table = $mchat_sessions_table;
|
||||
$this->settings = $settings;
|
||||
$this->user = $user;
|
||||
$this->auth = $auth;
|
||||
$this->log = $log;
|
||||
$this->db = $db;
|
||||
$this->cache = $cache;
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->root_path = $root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->mchat_table = $mchat_table;
|
||||
$this->mchat_log_table = $mchat_log_table;
|
||||
$this->mchat_sessions_table = $mchat_sessions_table;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +135,7 @@ class functions
|
||||
/**
|
||||
* Returns the total session time in seconds
|
||||
*
|
||||
* @return string
|
||||
* @return int
|
||||
*/
|
||||
protected function mchat_session_time()
|
||||
{
|
||||
@@ -141,25 +161,52 @@ class functions
|
||||
*/
|
||||
public function mchat_active_users()
|
||||
{
|
||||
$mchat_users = array();
|
||||
|
||||
$check_time = time() - $this->mchat_session_time();
|
||||
|
||||
$sql = 'SELECT m.user_id, u.username, u.user_type, u.user_allow_viewonline, u.user_colour
|
||||
FROM ' . $this->mchat_sessions_table . ' m
|
||||
LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id
|
||||
WHERE m.user_lastupdate >= ' . (int) $check_time . '
|
||||
ORDER BY u.username ASC';
|
||||
$sql_array = array(
|
||||
'SELECT' => 'u.user_id, u.username, u.user_colour, s.session_viewonline',
|
||||
'FROM' => array(
|
||||
$this->mchat_sessions_table => 'ms'
|
||||
),
|
||||
'LEFT_JOIN' => array(
|
||||
array(
|
||||
'FROM' => array(SESSIONS_TABLE => 's'),
|
||||
'ON' => 'ms.user_id = s.session_user_id',
|
||||
),
|
||||
array(
|
||||
'FROM' => array(USERS_TABLE => 'u'),
|
||||
'ON' => 'ms.user_id = u.user_id',
|
||||
),
|
||||
),
|
||||
'WHERE' => 'u.user_id <> ' . ANONYMOUS . ' AND s.session_viewonline IS NOT NULL AND ms.user_lastupdate > ' . (int) $check_time,
|
||||
'ORDER_BY' => 'u.username ASC',
|
||||
);
|
||||
|
||||
/**
|
||||
* Event to modify the SQL query that fetches active mChat users
|
||||
*
|
||||
* @event dmzx.mchat.active_users_sql_before
|
||||
* @var array sql_array Array with SQL query data to fetch the current active sessions
|
||||
* @since 2.0.0-RC6
|
||||
*/
|
||||
$vars = array(
|
||||
'sql_array',
|
||||
);
|
||||
extract($this->dispatcher->trigger_event('dmzx.mchat.active_users_sql_before', compact($vars)));
|
||||
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query($sql);
|
||||
$rows = $this->db->sql_fetchrowset($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$mchat_users = array();
|
||||
$can_view_hidden = $this->auth->acl_get('u_viewonline');
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
if (!$row['user_allow_viewonline'])
|
||||
if (!$row['session_viewonline'])
|
||||
{
|
||||
if (!$can_view_hidden)
|
||||
if (!$can_view_hidden && $row['user_id'] !== $this->user->data['user_id'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -167,87 +214,146 @@ class functions
|
||||
$row['username'] = '<em>' . $row['username'] . '</em>';
|
||||
}
|
||||
|
||||
$mchat_users[] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang('GUEST'));
|
||||
$mchat_users[$row['user_id']] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang('GUEST'));
|
||||
}
|
||||
|
||||
return array(
|
||||
$active_users = array(
|
||||
'online_userlist' => implode($this->user->lang('COMMA_SEPARATOR'), $mchat_users),
|
||||
'mchat_users_count' => $this->user->lang('MCHAT_ONLINE_USERS_TOTAL', count($mchat_users)),
|
||||
'users_count_title' => $this->user->lang('MCHAT_TITLE_COUNT', count($mchat_users)),
|
||||
'users_total' => $this->user->lang('MCHAT_ONLINE_USERS_TOTAL', count($mchat_users)),
|
||||
'refresh_message' => $this->mchat_format_seconds($this->mchat_session_time()),
|
||||
);
|
||||
|
||||
/**
|
||||
* Event to modify collected data about active mChat users
|
||||
*
|
||||
* @event dmzx.mchat.active_users_after
|
||||
* @var array mchat_users Array containing all currently active mChat sessions, mapping from user ID to full username
|
||||
* @var array active_users Array containing info about currently active mChat users
|
||||
* @since 2.0.0-RC6
|
||||
*/
|
||||
$vars = array(
|
||||
'mchat_users',
|
||||
'active_users',
|
||||
);
|
||||
extract($this->dispatcher->trigger_event('dmzx.mchat.active_users_after', compact($vars)));
|
||||
|
||||
return $active_users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the current user into the mchat_sessions table
|
||||
*
|
||||
* @return bool
|
||||
* @return bool Returns true if a new session was created, otherwise false
|
||||
*/
|
||||
public function mchat_add_user_session()
|
||||
{
|
||||
// Remove expired sessions from the database
|
||||
$check_time = time() - $this->mchat_session_time();
|
||||
$sql = 'DELETE FROM ' . $this->mchat_sessions_table . '
|
||||
WHERE user_lastupdate < ' . $check_time;
|
||||
if (!$this->user->data['is_registered'] || $this->user->data['user_id'] == ANONYMOUS || $this->user->data['is_bot'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . $this->mchat_sessions_table . '
|
||||
SET user_lastupdate = ' . time() . '
|
||||
WHERE user_id = ' . (int) $this->user->data['user_id'];
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$is_new_session = false;
|
||||
$is_new_session = $this->db->sql_affectedrows() < 1;
|
||||
|
||||
if ($this->user->data['user_type'] == USER_FOUNDER || $this->user->data['user_type'] == USER_NORMAL && $this->user->data['user_id'] != ANONYMOUS && !$this->user->data['is_bot'])
|
||||
if ($is_new_session)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . $this->mchat_sessions_table . '
|
||||
WHERE user_id = ' . (int) $this->user->data['user_id'];
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
if ($row)
|
||||
{
|
||||
$sql = 'UPDATE ' . $this->mchat_sessions_table . '
|
||||
SET user_lastupdate = ' . time() . '
|
||||
WHERE user_id = ' . (int) $this->user->data['user_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_new_session = true;
|
||||
$sql = 'INSERT INTO ' . $this->mchat_sessions_table . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||
'user_id' => $this->user->data['user_id'],
|
||||
'user_ip' => $this->user->data['user_ip'],
|
||||
'user_lastupdate' => time(),
|
||||
));
|
||||
}
|
||||
|
||||
$sql = 'INSERT INTO ' . $this->mchat_sessions_table . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||
'user_id' => (int) $this->user->data['user_id'],
|
||||
'user_ip' => $this->user->data['user_ip'],
|
||||
'user_lastupdate' => time(),
|
||||
));
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
|
||||
return $is_new_session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove expired sessions from the database
|
||||
*/
|
||||
public function mchat_session_gc()
|
||||
{
|
||||
$check_time = time() - $this->mchat_session_time();
|
||||
|
||||
$sql = 'DELETE FROM ' . $this->mchat_sessions_table . '
|
||||
WHERE user_lastupdate <= ' . (int) $check_time;
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prune messages
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function mchat_prune()
|
||||
{
|
||||
if ($this->settings->cfg('mchat_prune'))
|
||||
$sql_aray = array(
|
||||
'SELECT' => 'message_id',
|
||||
'FROM' => array($this->mchat_table => 'm'),
|
||||
);
|
||||
|
||||
$prune_num = $this->settings->cfg('mchat_prune_num');
|
||||
|
||||
if (ctype_digit($prune_num))
|
||||
{
|
||||
$mchat_total_messages = $this->mchat_total_message_count();
|
||||
|
||||
if ($mchat_total_messages > $this->settings->cfg('mchat_prune_num'))
|
||||
{
|
||||
$sql = 'SELECT message_id
|
||||
FROM '. $this->mchat_table . '
|
||||
ORDER BY message_id ASC';
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$first_id = (int) $this->db->sql_fetchfield('message_id');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
// Compute new oldest message id
|
||||
$delete_id = $mchat_total_messages - $this->settings->cfg('mchat_prune_num') + $first_id;
|
||||
|
||||
// Delete older messages
|
||||
$this->mchat_action('prune', null, $delete_id);
|
||||
}
|
||||
// Retain fixed number of messages
|
||||
$offset = $prune_num;
|
||||
$sql_aray['ORDER_BY'] = 'message_id DESC';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Retain messages of a time period
|
||||
$time_period = strtotime($prune_num, 0);
|
||||
|
||||
if ($time_period === false)
|
||||
{
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PRUNE_FAIL', false, array($this->user->data['username']));
|
||||
return false;
|
||||
}
|
||||
|
||||
$offset = 0;
|
||||
$sql_aray['WHERE'] = 'message_time < ' . (int) (time() - $time_period);
|
||||
}
|
||||
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_aray);
|
||||
$result = $this->db->sql_query_limit($sql, 0, $offset);
|
||||
$rows = $this->db->sql_fetchrowset();
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$prune_ids = array();
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$prune_ids[] = (int) $row['message_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Event to modify messages that are about to be pruned
|
||||
*
|
||||
* @event dmzx.mchat.prune_before
|
||||
* @var array prune_ids Array of message IDs that are about to be pruned
|
||||
* @since 2.0.0-RC6
|
||||
*/
|
||||
$vars = array(
|
||||
'prune_ids',
|
||||
);
|
||||
extract($this->dispatcher->trigger_event('dmzx.mchat.prune_before', compact($vars)));
|
||||
|
||||
if ($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->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)));
|
||||
|
||||
return $prune_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,27 +363,77 @@ class functions
|
||||
*/
|
||||
public function mchat_total_message_count()
|
||||
{
|
||||
return $this->db->get_row_count($this->mchat_table);
|
||||
$sql_array = array(
|
||||
'SELECT' => 'COUNT(*) AS rows_total',
|
||||
'FROM' => array($this->mchat_table => 'm'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Event to modifying the SQL query that fetches the total number of mChat messages
|
||||
*
|
||||
* @event dmzx.mchat.total_message_count_modify_sql
|
||||
* @var array sql_array Array with SQL query data to fetch the total message count
|
||||
* @since 2.0.0-RC6
|
||||
*/
|
||||
$vars = array(
|
||||
'sql_array',
|
||||
);
|
||||
extract($this->dispatcher->trigger_event('dmzx.mchat.total_message_count_modify_sql', compact($vars)));
|
||||
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query($sql);
|
||||
$rows_total = $this->db->sql_fetchfield('rows_total');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return (int) $rows_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch messages from the database
|
||||
*
|
||||
* @param $sql_where
|
||||
* @param int|array $message_ids IDs of specific messages to fetch, e.g. for fetching edited messages
|
||||
* @param int $last_id The ID of the latest message that the user has, for fetching new messages
|
||||
* @param int $total
|
||||
* @param int $offset
|
||||
* @return array
|
||||
*/
|
||||
public function mchat_get_messages($sql_where, $total = 0, $offset = 0)
|
||||
public function mchat_get_messages($message_ids, $last_id = 0, $total = 0, $offset = 0)
|
||||
{
|
||||
// Exclude post notifications
|
||||
if (!$this->settings->cfg('mchat_posts'))
|
||||
$sql_where_message_id = array();
|
||||
|
||||
// Fetch new messages
|
||||
if ($last_id)
|
||||
{
|
||||
if (!empty($sql_where))
|
||||
$sql_where_message_id[] = 'm.message_id > ' . (int) $last_id;
|
||||
}
|
||||
|
||||
// Fetch edited messages
|
||||
if ($message_ids)
|
||||
{
|
||||
if (!is_array($message_ids))
|
||||
{
|
||||
$sql_where = '(' . $sql_where . ') AND ';
|
||||
$message_ids = array($message_ids);
|
||||
}
|
||||
$sql_where .= 'm.forum_id = 0';
|
||||
|
||||
$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();
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
$sql_array = array(
|
||||
@@ -290,13 +446,33 @@ class functions
|
||||
),
|
||||
array(
|
||||
'FROM' => array(POSTS_TABLE => 'p'),
|
||||
'ON' => 'm.post_id = p.post_id',
|
||||
)
|
||||
'ON' => 'm.post_id = p.post_id AND m.forum_id <> 0',
|
||||
),
|
||||
),
|
||||
'WHERE' => $sql_where,
|
||||
'WHERE' => $sql_where_ary ? $this->db->sql_escape('(' . implode(') AND (', $sql_where_ary) . ')') : '',
|
||||
'ORDER_BY' => 'm.message_id DESC',
|
||||
);
|
||||
|
||||
/**
|
||||
* Event to modify the SQL query that fetches mChat messages
|
||||
*
|
||||
* @event dmzx.mchat.get_messages_modify_sql
|
||||
* @var array message_ids IDs of specific messages to fetch, e.g. for fetching edited messages
|
||||
* @var int last_id The ID of the latest message that the user has, for fetching new messages
|
||||
* @var int total SQL limit
|
||||
* @var int offset SQL offset
|
||||
* @var array sql_array Array containing the SQL query data
|
||||
* @since 2.0.0-RC6
|
||||
*/
|
||||
$vars = array(
|
||||
'message_ids',
|
||||
'last_id',
|
||||
'total',
|
||||
'offset',
|
||||
'sql_array',
|
||||
);
|
||||
extract($this->dispatcher->trigger_event('dmzx.mchat.get_messages_modify_sql', compact($vars)));
|
||||
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query_limit($sql, $total, $offset);
|
||||
$rows = $this->db->sql_fetchrowset($result);
|
||||
@@ -314,6 +490,59 @@ class functions
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches log entries from the database and sorts them
|
||||
*
|
||||
* @param int $log_id The ID of the latest log entry that the user has
|
||||
* @return array
|
||||
*/
|
||||
public function mchat_get_logs($log_id)
|
||||
{
|
||||
$sql_array = array(
|
||||
'SELECT' => 'ml.*',
|
||||
'FROM' => array($this->mchat_log_table => 'ml'),
|
||||
'WHERE' => 'ml.log_id > ' . (int) $log_id,
|
||||
);
|
||||
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query($sql, 3600);
|
||||
$rows = $this->db->sql_fetchrowset($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$logs = array(
|
||||
'id' => $log_id,
|
||||
);
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$logs['id'] = max((int) $logs['id'], (int) $row['log_id']);
|
||||
$logs[] = $row;
|
||||
}
|
||||
|
||||
return $logs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the highest log ID
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function get_latest_log_id()
|
||||
{
|
||||
$sql_array = array(
|
||||
'SELECT' => 'ml.log_id',
|
||||
'FROM' => array($this->mchat_log_table => 'ml'),
|
||||
'ORDER_BY' => 'log_id DESC',
|
||||
);
|
||||
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query_limit($sql, 1);
|
||||
$max_log_id = (int) $this->db->sql_fetchfield('log_id');
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
return $max_log_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the user legend markup
|
||||
*
|
||||
@@ -323,23 +552,27 @@ class functions
|
||||
{
|
||||
// Grab group details for legend display for who is online on the custom page
|
||||
$order_legend = $this->settings->cfg('legend_sort_groupname') ? 'group_name' : 'group_legend';
|
||||
|
||||
$sql_array = array(
|
||||
'SELECT' => 'g.group_id, g.group_name, g.group_colour, g.group_type',
|
||||
'FROM' => array(GROUPS_TABLE => 'g'),
|
||||
'WHERE' => 'group_legend <> 0',
|
||||
'ORDER_BY' => 'g.' . $order_legend . ' ASC',
|
||||
);
|
||||
|
||||
if ($this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
||||
{
|
||||
$sql = 'SELECT group_id, group_name, group_colour, group_type
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_legend <> 0
|
||||
ORDER BY ' . $order_legend . ' ASC';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
|
||||
FROM ' . GROUPS_TABLE . ' g
|
||||
LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (g.group_id = ug.group_id AND ug.user_id = ' . $this->user->data['user_id'] . ' AND ug.user_pending = 0)
|
||||
WHERE g.group_legend <> 0
|
||||
AND (g.group_type <> ' . GROUP_HIDDEN . '
|
||||
OR ug.user_id = ' . (int) $this->user->data['user_id'] . ')
|
||||
ORDER BY g.' . $order_legend . ' ASC';
|
||||
$sql_array['LEFT_JOIN'] = array(
|
||||
array(
|
||||
'FROM' => array(USER_GROUP_TABLE => 'ug'),
|
||||
'ON' => 'g.group_id = ug.group_id AND ug.user_id = ' . (int) $this->user->data['user_id'] . ' AND ug.user_pending = 0',
|
||||
),
|
||||
);
|
||||
|
||||
$sql_array['WHERE'] .= ' AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . (int) $this->user->data['user_id'] . ')';
|
||||
}
|
||||
|
||||
$sql = $this->db->sql_build_query('SELECT', $sql_array);
|
||||
$result = $this->db->sql_query($sql);
|
||||
$rows = $this->db->sql_fetchrowset($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
@@ -369,23 +602,61 @@ class functions
|
||||
*/
|
||||
public function mchat_foes()
|
||||
{
|
||||
if (is_null($this->foes))
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . ZEBRA_TABLE . '
|
||||
WHERE foe = 1 AND user_id = ' . (int) $this->user->data['user_id'];
|
||||
$result = $this->db->sql_query($sql);
|
||||
$rows = $this->db->sql_fetchrowset($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
$sql = 'SELECT zebra_id
|
||||
FROM ' . ZEBRA_TABLE . '
|
||||
WHERE foe = 1
|
||||
AND user_id = ' . (int) $this->user->data['user_id'];
|
||||
$result = $this->db->sql_query($sql);
|
||||
$rows = $this->db->sql_fetchrowset($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$this->foes = array();
|
||||
foreach ($rows as $row)
|
||||
$foes = array();
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$foes[] = $row['zebra_id'];
|
||||
}
|
||||
|
||||
return $foes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches post subjects and their forum names
|
||||
*
|
||||
* @param array $post_ids
|
||||
* @return array
|
||||
*/
|
||||
public function mchat_get_post_data($post_ids)
|
||||
{
|
||||
if (!$post_ids)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.post_id, p.post_subject, f.forum_name
|
||||
FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f
|
||||
WHERE p.forum_id = f.forum_id
|
||||
AND ' . $this->db->sql_in_set('p.post_id', $post_ids);
|
||||
|
||||
$result = $this->db->sql_query($sql);
|
||||
$rows = $this->db->sql_fetchrowset($result);
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$post_subjects = array();
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
// Skip deleted posts
|
||||
if (isset($row['post_subject']))
|
||||
{
|
||||
$this->foes[] = $row['zebra_id'];
|
||||
$post_subjects[$row['post_id']] = array(
|
||||
'post_subject' => $row['post_subject'],
|
||||
'forum_name' => $row['forum_name'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->foes;
|
||||
return $post_subjects;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -409,43 +680,67 @@ class functions
|
||||
/**
|
||||
* Inserts a message with posting information into the database
|
||||
*
|
||||
* @param string $mode One of post|quote|edit|reply
|
||||
* @param $data The post data
|
||||
* @param string $mode One of post|quote|edit|reply|login
|
||||
* @param int $forum_id
|
||||
* @param int $post_id
|
||||
* @param bool $is_hidden_login
|
||||
*/
|
||||
public function mchat_insert_posting($mode, $data)
|
||||
public function mchat_insert_posting($mode, $forum_id, $post_id, $is_hidden_login)
|
||||
{
|
||||
$mode_config = array(
|
||||
'post' => 'mchat_posts_topic',
|
||||
'quote' => 'mchat_posts_quote',
|
||||
'edit' => 'mchat_posts_edit',
|
||||
'reply' => 'mchat_posts_reply',
|
||||
'login' => 'mchat_posts_login',
|
||||
);
|
||||
|
||||
if (empty($mode_config[$mode]) || !$this->settings->cfg($mode_config[$mode]))
|
||||
$is_mode_enabled = !empty($mode_config[$mode]) && $this->settings->cfg($mode_config[$mode]);
|
||||
|
||||
// Special treatment for login notifications
|
||||
if ($mode === 'login')
|
||||
{
|
||||
return;
|
||||
$forum_id = 0;
|
||||
$post_id = $is_hidden_login ? self::LOGIN_HIDDEN : self::LOGIN_VISIBLE;
|
||||
}
|
||||
|
||||
$board_url = generate_board_url();
|
||||
$topic_url = '[url=' . $board_url . '/viewtopic.' . $this->php_ext . '?p=' . $data['post_id'] . '#p' . $data['post_id'] . ']' . $data['post_subject'] . '[/url]';
|
||||
$forum_url = '[url=' . $board_url . '/viewforum.' . $this->php_ext . '?f=' . $data['forum_id'] . ']' . $data['forum_name'] . '[/url]';
|
||||
$message = $this->user->lang('MCHAT_NEW_' . strtoupper($mode), $topic_url, $forum_url);
|
||||
|
||||
$uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
|
||||
generate_text_for_storage($message, $uid, $bitfield, $options, true, false, false);
|
||||
$sql_ary = array(
|
||||
'forum_id' => $data['forum_id'],
|
||||
'post_id' => $data['post_id'],
|
||||
'user_id' => $this->user->data['user_id'],
|
||||
$sql_array = array(
|
||||
'forum_id' => (int) $forum_id,
|
||||
'post_id' => (int) $post_id,
|
||||
'user_id' => (int) $this->user->data['user_id'],
|
||||
'user_ip' => $this->user->data['session_ip'],
|
||||
'message' => utf8_normalize_nfc($message),
|
||||
'bbcode_bitfield' => $bitfield,
|
||||
'bbcode_uid' => $uid,
|
||||
'bbcode_options' => $options,
|
||||
'message' => 'MCHAT_NEW_' . strtoupper($mode),
|
||||
'message_time' => time(),
|
||||
);
|
||||
$sql = 'INSERT INTO ' . $this->mchat_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
/**
|
||||
* Event that allows to modify data of a posting notification before it is inserted in the database
|
||||
*
|
||||
* @event dmzx.mchat.insert_posting_before
|
||||
* @var string mode The posting mode, one of post|quote|edit|reply|login
|
||||
* @var int forum_id The ID of the forum where the post was made, or 0 if mode is login.
|
||||
* @var int post_id The ID of the post that was made. If mode is login this value is
|
||||
* one of the constants LOGIN_HIDDEN|LOGIN_VISIBLE
|
||||
* @var bool is_hidden_login Whether or not the user session is hidden. Only used if mode is login.
|
||||
* @var array is_mode_enabled Whether or not the posting should be added to the database.
|
||||
* @var array sql_array An array containing the data that is about to be inserted into the messages table.
|
||||
* @since 2.0.0-RC6
|
||||
*/
|
||||
$vars = array(
|
||||
'mode',
|
||||
'forum_id',
|
||||
'post_id',
|
||||
'is_hidden_login',
|
||||
'is_mode_enabled',
|
||||
'sql_array',
|
||||
);
|
||||
extract($this->dispatcher->trigger_event('dmzx.mchat.insert_posting_before', compact($vars)));
|
||||
|
||||
if ($is_mode_enabled)
|
||||
{
|
||||
$sql = 'INSERT INTO ' . $this->mchat_table . ' ' . $this->db->sql_build_array('INSERT', $sql_array);
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -479,7 +774,7 @@ class functions
|
||||
*/
|
||||
public function mchat_author_for_message($message_id)
|
||||
{
|
||||
$sql = 'SELECT u.user_id, u.username, m.message_time
|
||||
$sql = 'SELECT u.user_id, u.username, m.message_time, m.forum_id, m.post_id
|
||||
FROM ' . $this->mchat_table . ' m
|
||||
LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id
|
||||
WHERE m.message_id = ' . (int) $message_id;
|
||||
@@ -490,92 +785,97 @@ class functions
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of message IDs that have been deleted from the message table
|
||||
*
|
||||
* @param $start_id
|
||||
* @return array
|
||||
*/
|
||||
public function mchat_deleted_ids($start_id)
|
||||
{
|
||||
$sql = 'SELECT message_id
|
||||
FROM ' . $this->mchat_deleted_messages_table . '
|
||||
WHERE message_id >= ' . (int) $start_id . '
|
||||
ORDER BY message_id DESC';
|
||||
$result = $this->db->sql_query($sql, 3600);
|
||||
$rows = $this->db->sql_fetchrowset();
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$missing_ids = array();
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$missing_ids[] = (int) $row['message_id'];
|
||||
}
|
||||
|
||||
return $missing_ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs AJAX actions
|
||||
*
|
||||
* @param string $action One of add|edit|del|prune
|
||||
* @param string $action One of add|edit|del
|
||||
* @param array $sql_ary
|
||||
* @param int $message_id
|
||||
* @return bool
|
||||
*/
|
||||
public function mchat_action($action, $sql_ary = null, $message_id = 0)
|
||||
{
|
||||
$update_session_infos = true;
|
||||
|
||||
/**
|
||||
* Event to modify the SQL query that adds, edits or deletes an mChat message
|
||||
*
|
||||
* @event dmzx.mchat.action_before
|
||||
* @var string action The action that is being performed, one of add|edit|del
|
||||
* @var bool sql_ary Array containing SQL data, or null if a message is deleted
|
||||
* @var int message_id The ID of the message that is being edited or deleted, or 0 if a message is added
|
||||
* @var bool update_session_infos Whether or not to update the user session
|
||||
* @since 2.0.0-RC6
|
||||
*/
|
||||
$vars = array(
|
||||
'action',
|
||||
'sql_ary',
|
||||
'message_id',
|
||||
'update_session_infos',
|
||||
);
|
||||
extract($this->dispatcher->trigger_event('dmzx.mchat.action_before', compact($vars)));
|
||||
|
||||
$is_new_session = false;
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
// User adds a message
|
||||
case 'add':
|
||||
$this->user->update_session_infos();
|
||||
if ($update_session_infos)
|
||||
{
|
||||
$this->user->update_session_infos();
|
||||
}
|
||||
$is_new_session = $this->mchat_add_user_session();
|
||||
$this->db->sql_query('INSERT INTO ' . $this->mchat_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary));
|
||||
break;
|
||||
|
||||
// User edits a message
|
||||
case 'edit':
|
||||
$this->user->update_session_infos();
|
||||
if ($update_session_infos)
|
||||
{
|
||||
$this->user->update_session_infos();
|
||||
}
|
||||
$is_new_session = $this->mchat_add_user_session();
|
||||
$this->db->sql_query('UPDATE ' . $this->mchat_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE message_id = ' . (int) $message_id);
|
||||
$this->mchat_insert_log('edit', $message_id);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EDITED_MCHAT', false, array($this->user->data['username']));
|
||||
break;
|
||||
|
||||
// User deletes a message
|
||||
case 'del':
|
||||
$this->user->update_session_infos();
|
||||
if ($update_session_infos)
|
||||
{
|
||||
$this->user->update_session_infos();
|
||||
}
|
||||
$is_new_session = $this->mchat_add_user_session();
|
||||
$this->db->sql_query('DELETE FROM ' . $this->mchat_table . ' WHERE message_id = ' . (int) $message_id);
|
||||
$this->db->sql_query('INSERT INTO ' . $this->mchat_deleted_messages_table . ' ' . $this->db->sql_build_array('INSERT', array('message_id' => (int) $message_id)));
|
||||
$this->cache->destroy('sql', $this->mchat_deleted_messages_table);
|
||||
$this->mchat_insert_log('del', $message_id);
|
||||
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DELETED_MCHAT', false, array($this->user->data['username']));
|
||||
break;
|
||||
|
||||
// User triggers messages to be pruned
|
||||
case 'prune':
|
||||
$sql = 'SELECT message_id
|
||||
FROM ' . $this->mchat_table . '
|
||||
WHERE message_id < ' . (int) $message_id . '
|
||||
ORDER BY message_id DESC';
|
||||
$result = $this->db->sql_query($sql);
|
||||
$rows = $this->db->sql_fetchrowset();
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$prune_ids = array();
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$prune_ids[] = (int) $row['message_id'];
|
||||
}
|
||||
|
||||
$this->db->sql_query('DELETE FROM ' . $this->mchat_table . ' WHERE ' .$this->db->sql_in_set('message_id', $prune_ids));
|
||||
$this->db->sql_multi_insert($this->mchat_deleted_messages_table, $rows);
|
||||
$this->cache->destroy('sql', $this->mchat_deleted_messages_table);
|
||||
break;
|
||||
}
|
||||
|
||||
return $is_new_session;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $log_type The log type, one of edit|del
|
||||
* @param int $message_id The ID of the message to which this log entry belongs
|
||||
* @return int The ID of the newly added log row
|
||||
*/
|
||||
public function mchat_insert_log($log_type, $message_id)
|
||||
{
|
||||
$this->db->sql_query('INSERT INTO ' . $this->mchat_log_table . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||
'log_type' => array_search($log_type, $this->log_types),
|
||||
'user_id' => (int) $this->user->data['user_id'],
|
||||
'message_id' => (int) $message_id,
|
||||
'log_ip' => $this->user->ip,
|
||||
'log_time' => time(),
|
||||
)));
|
||||
|
||||
$log_id = (int) $this->db->sql_nextid();
|
||||
|
||||
$this->cache->destroy('sql', $this->mchat_log_table);
|
||||
|
||||
return $log_id;
|
||||
}
|
||||
}
|
||||
|
||||
937
core/mchat.php
937
core/mchat.php
File diff suppressed because it is too large
Load Diff
@@ -13,11 +13,6 @@ namespace dmzx\mchat\core;
|
||||
|
||||
class settings
|
||||
{
|
||||
const VALIDATE_TYPE = 0;
|
||||
const VALIDATE_IS_OPTIONAL = 1;
|
||||
const VALIDATE_MIN_VALUE = 2;
|
||||
const VALIDATE_MAX_VALUE = 3;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
@@ -27,10 +22,23 @@ class settings
|
||||
/** @var \phpbb\auth\auth */
|
||||
protected $auth;
|
||||
|
||||
/** @var array */
|
||||
/**
|
||||
* Keys for global settings that only the administrator is allowed to modify.
|
||||
* The values are stored in the phpbb_config table.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $global;
|
||||
|
||||
/** @var array */
|
||||
/**
|
||||
* Keys for user-specific settings for which the administrator can set default
|
||||
* values as well as adjust permissions to allow users to customize them.
|
||||
* The values are stored in the phpbb_users table as well as the phpbb_config table.
|
||||
* If a user has permission to customize a setting, the value in the phpbb_users
|
||||
* table is used, otherwise the value in the phpbb_config table is used.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $ucp;
|
||||
|
||||
/** @var bool */
|
||||
@@ -45,30 +53,62 @@ class settings
|
||||
* @param \phpbb\user $user
|
||||
* @param \phpbb\config\config $config
|
||||
* @param \phpbb\auth\auth $auth
|
||||
* @param array $global
|
||||
* @param array $ucp
|
||||
*/
|
||||
public function __construct(\phpbb\user $user, \phpbb\config\config $config, \phpbb\auth\auth $auth, $global, $ucp)
|
||||
public function __construct(\phpbb\user $user, \phpbb\config\config $config, \phpbb\auth\auth $auth)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->config = $config;
|
||||
$this->auth = $auth;
|
||||
$this->global = $global;
|
||||
$this->ucp = $ucp;
|
||||
|
||||
$this->is_phpbb31 = phpbb_version_compare($config['version'], '3.1.0@dev', '>=') && phpbb_version_compare($config['version'], '3.2.0@dev', '<');
|
||||
$this->is_phpbb32 = phpbb_version_compare($config['version'], '3.2.0@dev', '>=') && phpbb_version_compare($config['version'], '3.3.0@dev', '<');
|
||||
$this->global = array(
|
||||
'mchat_bbcode_disallowed' => array('default' => '', 'validation' => array('string', false, 0, 255)),
|
||||
'mchat_custom_height' => array('default' => 350, 'validation' => array('num', false, 50, 1000)),
|
||||
'mchat_custom_page' => array('default' => 1),
|
||||
'mchat_edit_delete_limit' => array('default' => 0),
|
||||
'mchat_flood_time' => array('default' => 0, 'validation' => array('num', false, 0, 60)),
|
||||
'mchat_index_height' => array('default' => 250, 'validation' => array('num', false, 50, 1000)),
|
||||
'mchat_live_updates' => array('default' => 1),
|
||||
'mchat_max_message_lngth' => array('default' => 500, 'validation' => array('num', false, 0, 1000)),
|
||||
'mchat_message_num_archive' => array('default' => 25, 'validation' => array('num', false, 10, 100)),
|
||||
'mchat_message_num_custom' => array('default' => 10, 'validation' => array('num', false, 5, 50)),
|
||||
'mchat_message_num_index' => array('default' => 10, 'validation' => array('num', false, 5, 50)),
|
||||
'mchat_navbar_link' => array('default' => 1),
|
||||
'mchat_navbar_link_count' => array('default' => 1),
|
||||
'mchat_override_min_post_chars' => array('default' => 0),
|
||||
'mchat_override_smilie_limit' => array('default' => 0),
|
||||
'mchat_posts_edit' => array('default' => 0),
|
||||
'mchat_posts_quote' => array('default' => 0),
|
||||
'mchat_posts_reply' => array('default' => 0),
|
||||
'mchat_posts_topic' => array('default' => 0),
|
||||
'mchat_posts_login' => array('default' => 0),
|
||||
'mchat_prune' => array('default' => 0),
|
||||
'mchat_prune_num' => array('default' => '0'),
|
||||
'mchat_refresh' => array('default' => 10, 'validation' => array('num', false, 5, 60)),
|
||||
'mchat_rules' => array('default' => '', 'validation' => array('string', false, 0, 255)),
|
||||
'mchat_static_message' => array('default' => '', 'validation' => array('string', false, 0, 255)),
|
||||
'mchat_timeout' => array('default' => 0, 'validation' => array('num', false, 0, (int) $this->cfg('session_length'))),
|
||||
'mchat_whois_refresh' => array('default' => 60, 'validation' => array('num', false, 10, 300)),
|
||||
);
|
||||
|
||||
$this->inject_core_config_values();
|
||||
}
|
||||
$this->ucp = array(
|
||||
'mchat_avatars' => array('default' => 1),
|
||||
'mchat_capital_letter' => array('default' => 1),
|
||||
'mchat_character_count' => array('default' => 1),
|
||||
'mchat_date' => array('default' => 'D M d, Y g:i a', 'validation' => array('string', false, 0, 64)),
|
||||
'mchat_index' => array('default' => 1),
|
||||
'mchat_input_area' => array('default' => 1),
|
||||
'mchat_location' => array('default' => 1),
|
||||
'mchat_message_top' => array('default' => 1),
|
||||
'mchat_pause_on_input' => array('default' => 0),
|
||||
'mchat_posts' => array('default' => 1),
|
||||
'mchat_relative_time' => array('default' => 1),
|
||||
'mchat_sound' => array('default' => 1),
|
||||
'mchat_stats_index' => array('default' => 0),
|
||||
'mchat_whois_index' => array('default' => 1),
|
||||
);
|
||||
|
||||
/**
|
||||
* Writes phpBB config values into the mChat config for validating input data
|
||||
*/
|
||||
protected function inject_core_config_values()
|
||||
{
|
||||
// Limit mChat session timeout to phpBB session length
|
||||
$this->global['mchat_timeout']['validation'][self::VALIDATE_MAX_VALUE] = (int) $this->cfg('session_length');
|
||||
$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', '<');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,10 +141,18 @@ class settings
|
||||
/**
|
||||
* @param $config
|
||||
* @param $value
|
||||
* @param bool $volatile
|
||||
*/
|
||||
public function set_cfg($config, $value)
|
||||
public function set_cfg($config, $value, $volatile = false)
|
||||
{
|
||||
$this->config->set($config, $value);
|
||||
if ($volatile)
|
||||
{
|
||||
$this->config[$config] = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->config->set($config, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +194,7 @@ class settings
|
||||
{
|
||||
$enabled_notifications_lang = array();
|
||||
|
||||
foreach (array('topic', 'reply', 'quote', 'edit') as $notification)
|
||||
foreach (array('topic', 'reply', 'quote', 'edit', 'login') as $notification)
|
||||
{
|
||||
if ($this->cfg('mchat_posts_' . $notification))
|
||||
{
|
||||
|
||||
67
cron/mchat_prune.php
Normal file
67
cron/mchat_prune.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
|
||||
* @copyright (c) 2016 kasimi
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\cron;
|
||||
|
||||
class mchat_prune extends \phpbb\cron\task\base
|
||||
{
|
||||
/** @var \dmzx\mchat\core\functions */
|
||||
protected $functions;
|
||||
|
||||
/** @var \dmzx\mchat\core\settings */
|
||||
protected $settings;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \dmzx\mchat\core\functions $functions
|
||||
* @param \dmzx\mchat\core\settings $settings
|
||||
*/
|
||||
public function __construct(\dmzx\mchat\core\functions $functions, \dmzx\mchat\core\settings $settings)
|
||||
{
|
||||
$this->functions = $functions;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs this cron task.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->functions->mchat_prune();
|
||||
$this->settings->set_cfg('mchat_prune_last_gc', time());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task can run, given current board configuration.
|
||||
*
|
||||
* If warnings are set to never expire, this cron task will not run.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_runnable()
|
||||
{
|
||||
return $this->settings->cfg('mchat_prune');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this cron task should run now, because enough time
|
||||
* has passed since it was last run (24 hours).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function should_run()
|
||||
{
|
||||
return $this->settings->cfg('mchat_prune_last_gc') < time() - $this->settings->cfg('mchat_prune_gc');
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace dmzx\mchat\event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
class acp_listener implements EventSubscriberInterface
|
||||
@@ -66,11 +67,16 @@ class acp_listener implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function permissions($event)
|
||||
{
|
||||
$mchat_permissions = array();
|
||||
$ucp_configs = array();
|
||||
|
||||
foreach (array_keys($this->settings->ucp) as $config_name)
|
||||
{
|
||||
$ucp_configs[] = 'u_' . $config_name;
|
||||
}
|
||||
|
||||
$permission_categories = array(
|
||||
'mchat' => array(
|
||||
@@ -78,6 +84,8 @@ class acp_listener implements EventSubscriberInterface
|
||||
'u_mchat_view',
|
||||
'u_mchat_edit',
|
||||
'u_mchat_delete',
|
||||
'u_mchat_moderator_edit',
|
||||
'u_mchat_moderator_delete',
|
||||
'u_mchat_ip',
|
||||
'u_mchat_pm',
|
||||
'u_mchat_like',
|
||||
@@ -89,9 +97,11 @@ class acp_listener implements EventSubscriberInterface
|
||||
'u_mchat_urls',
|
||||
'a_mchat',
|
||||
),
|
||||
'mchat_user_config' => array_map(function($key) { return 'u_' . $key; }, array_keys($this->settings->ucp)),
|
||||
'mchat_user_config' => $ucp_configs,
|
||||
);
|
||||
|
||||
$mchat_permissions = array();
|
||||
|
||||
foreach ($permission_categories as $cat => $permissions)
|
||||
{
|
||||
foreach ($permissions as $permission)
|
||||
@@ -107,12 +117,12 @@ class acp_listener implements EventSubscriberInterface
|
||||
|
||||
$event['categories'] = array_merge($event['categories'], array(
|
||||
'mchat' => 'ACP_CAT_MCHAT',
|
||||
'mchat_user_config' => 'ACP_CAT_MCHAT_USER_CONFIG'
|
||||
'mchat_user_config' => 'ACP_CAT_MCHAT_USER_CONFIG',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function acp_users_prefs_modify_sql($event)
|
||||
{
|
||||
@@ -150,7 +160,7 @@ class acp_listener implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function acp_users_prefs_modify_template_data($event)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace dmzx\mchat\event;
|
||||
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
class main_listener implements EventSubscriberInterface
|
||||
@@ -24,6 +25,9 @@ class main_listener implements EventSubscriberInterface
|
||||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
/** @var \phpbb\request\request */
|
||||
protected $request;
|
||||
|
||||
/** @var string */
|
||||
protected $php_ext;
|
||||
|
||||
@@ -33,14 +37,16 @@ class main_listener implements EventSubscriberInterface
|
||||
* @param \dmzx\mchat\core\mchat $mchat
|
||||
* @param \phpbb\controller\helper $helper
|
||||
* @param \phpbb\user $user
|
||||
* @param \phpbb\request\request $request
|
||||
* @param string $php_ext
|
||||
*/
|
||||
public function __construct(\dmzx\mchat\core\mchat $mchat, \phpbb\controller\helper $helper, \phpbb\user $user, $php_ext)
|
||||
public function __construct(\dmzx\mchat\core\mchat $mchat, \phpbb\controller\helper $helper, \phpbb\user $user, \phpbb\request\request $request, $php_ext)
|
||||
{
|
||||
$this->mchat = $mchat;
|
||||
$this->helper = $helper;
|
||||
$this->user = $user;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->mchat = $mchat;
|
||||
$this->helper = $helper;
|
||||
$this->user = $user;
|
||||
$this->request = $request;
|
||||
$this->php_ext = $php_ext;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,26 +59,28 @@ class main_listener implements EventSubscriberInterface
|
||||
'core.user_setup' => 'load_language_on_setup',
|
||||
'core.page_header' => 'add_page_header_link',
|
||||
'core.index_modify_page_title' => 'display_mchat_on_index',
|
||||
'core.posting_modify_submit_post_after' => 'posting_modify_submit_post_after',
|
||||
'core.display_custom_bbcodes_modify_sql' => 'display_custom_bbcodes_modify_sql',
|
||||
'core.submit_post_end' => 'insert_posting',
|
||||
'core.display_custom_bbcodes_modify_sql' => array(array('remove_disallowed_bbcodes'), array('pm_compose_add_quote')),
|
||||
'core.user_add_modify_data' => 'user_registration_set_default_values',
|
||||
'core.login_box_redirect' => 'user_login_success',
|
||||
'core.session_gc_after' => 'session_gc',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function add_page_viewonline($event)
|
||||
{
|
||||
if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/mchat') === 0)
|
||||
{
|
||||
$event['location'] = $this->user->lang('MCHAT_TITLE');
|
||||
$event['location_url'] = $this->helper->route('dmzx_mchat_controller');
|
||||
$event['location_url'] = $this->helper->route('dmzx_mchat_page_custom_controller');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function load_language_on_setup($event)
|
||||
{
|
||||
@@ -87,7 +95,7 @@ class main_listener implements EventSubscriberInterface
|
||||
/**
|
||||
* Create a URL to the mchat controller file for the header linklist
|
||||
*
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function add_page_header_link($event)
|
||||
{
|
||||
@@ -97,7 +105,7 @@ class main_listener implements EventSubscriberInterface
|
||||
/**
|
||||
* Check if mchat should be displayed on index.
|
||||
*
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function display_mchat_on_index($event)
|
||||
{
|
||||
@@ -105,31 +113,58 @@ class main_listener implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function posting_modify_submit_post_after($event)
|
||||
public function insert_posting($event)
|
||||
{
|
||||
$this->mchat->insert_posting($event['mode'], array(
|
||||
'forum_id' => $event['forum_id'],
|
||||
'forum_name' => $event['post_data']['forum_name'],
|
||||
'post_id' => $event['data']['post_id'],
|
||||
'post_subject' => $event['post_data']['post_subject'],
|
||||
));
|
||||
$this->mchat->insert_posting($event['mode'], $event['data']['forum_id'], $event['data']['post_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function display_custom_bbcodes_modify_sql($event)
|
||||
public function remove_disallowed_bbcodes($event)
|
||||
{
|
||||
$event['sql_ary'] = $this->mchat->remove_disallowed_bbcodes($event['sql_ary']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event The event object
|
||||
* @param Event $event
|
||||
*/
|
||||
public function user_registration_set_default_values($event)
|
||||
{
|
||||
$event['sql_ary'] = $this->mchat->set_user_default_values($event['sql_ary']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Event $event
|
||||
*/
|
||||
public function user_login_success($event)
|
||||
{
|
||||
if (!$event['admin'])
|
||||
{
|
||||
$this->mchat->insert_posting('login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Event $event
|
||||
*/
|
||||
public function pm_compose_add_quote($event)
|
||||
{
|
||||
$mchat_message_id = $this->request->variable('mchat_pm_quote_message', 0);
|
||||
|
||||
if ($mchat_message_id)
|
||||
{
|
||||
$this->mchat->quote_message_text($mchat_message_id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Event $event
|
||||
*/
|
||||
public function session_gc($event)
|
||||
{
|
||||
$this->mchat->session_gc();
|
||||
}
|
||||
}
|
||||
|
||||
71
ext.php
71
ext.php
@@ -22,6 +22,77 @@ class ext extends \phpbb\extension\base
|
||||
public function is_enableable()
|
||||
{
|
||||
$config = $this->container->get('config');
|
||||
|
||||
// Here we check if any modules from the mChat MOD for phpBB 3.0.x are still in the database.
|
||||
// This is_enableable() method is called multiple times during the installation but we only
|
||||
// need to do the following check once. Checking for the absence of the mchat_version value
|
||||
// in the config guarantees that we're in the very first step of the installation process.
|
||||
// Any later call of this method doesn't need to check this again and in fact will wrongly
|
||||
// detect the extension's modules as being remnants.
|
||||
if (empty($config['mchat_version']))
|
||||
{
|
||||
$table_prefix = $this->container->getParameter('core.table_prefix');
|
||||
$module_ids = $this->get_old_module_ids($table_prefix);
|
||||
|
||||
if ($module_ids)
|
||||
{
|
||||
if (phpbb_version_compare($config['version'], '3.2.0-dev', '>='))
|
||||
{
|
||||
// For phpBB 3.2.x
|
||||
$lang = $this->container->get('language');
|
||||
$lang->add_lang('mchat_acp', 'dmzx/mchat');
|
||||
}
|
||||
else
|
||||
{
|
||||
// For phpBB 3.1.x
|
||||
$user = $this->container->get('user');
|
||||
$user->add_lang_ext('dmzx/mchat', 'mchat_acp');
|
||||
$lang = $user;
|
||||
}
|
||||
|
||||
$php_ext = $this->container->getParameter('core.php_ext');
|
||||
$error_msg = $lang->lang('MCHAT_30X_REMNANTS', $table_prefix, implode(', ', $module_ids)) . adm_back_link(append_sid('index.' . $php_ext, 'i=acp_extensions&mode=main'));
|
||||
|
||||
trigger_error($error_msg, E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
return phpbb_version_compare($config['version'], '3.1.7-PL1', '>=');
|
||||
}
|
||||
|
||||
/**
|
||||
* This method checks whether the phpbb_modules table contains remnants of the 3.0 MOD.
|
||||
* It returns an array of the modules' IDs, or an empty array if no old modules are found.
|
||||
*
|
||||
* @var string $table_prefix
|
||||
* @return array
|
||||
*/
|
||||
protected function get_old_module_ids($table_prefix)
|
||||
{
|
||||
$db = $this->container->get('dbal.conn');
|
||||
|
||||
$mchat_30x_module_langnames = array(
|
||||
'ACP_CAT_MCHAT',
|
||||
'ACP_MCHAT_CONFIG',
|
||||
'ACP_USER_MCHAT',
|
||||
'UCP_CAT_MCHAT',
|
||||
'UCP_MCHAT_CONFIG',
|
||||
);
|
||||
|
||||
$sql = 'SELECT module_id
|
||||
FROM ' . $table_prefix . 'modules
|
||||
WHERE ' . $db->sql_in_set('module_langname', $mchat_30x_module_langnames);
|
||||
$result = $db->sql_query($sql);
|
||||
$rows = $db->sql_fetchrowset();
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$module_ids = array();
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
$module_ids[] = $row['module_id'];
|
||||
}
|
||||
|
||||
return $module_ids;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,14 @@ if (empty($lang) || !is_array($lang))
|
||||
|
||||
$lang = array_merge($lang, array(
|
||||
'MCHAT_TITLE' => 'mChat',
|
||||
'MCHAT_TITLE_COUNT' => 'mChat [<strong>%1$d</strong>]',
|
||||
|
||||
// Who is chatting
|
||||
'MCHAT_WHO_IS_CHATTING' => 'Who is chatting',
|
||||
'MCHAT_ONLINE_USERS_TOTAL' => array(
|
||||
0 => 'No one is chatting',
|
||||
1 => 'There is <strong>%1$d</strong> user chatting',
|
||||
2 => 'There are <strong>%1$d</strong> users chatting',
|
||||
1 => '<strong>%1$d</strong> user is chatting',
|
||||
2 => '<strong>%1$d</strong> users are chatting',
|
||||
),
|
||||
'MCHAT_ONLINE_EXPLAIN' => 'based on users active over the past %1$s',
|
||||
'MCHAT_HOURS' => array(
|
||||
@@ -63,4 +64,5 @@ $lang = array_merge($lang, array(
|
||||
'MCHAT_NEW_REPLY' => 'posted a reply: %1$s in %2$s',
|
||||
'MCHAT_NEW_QUOTE' => 'replied with a quote: %1$s in %2$s',
|
||||
'MCHAT_NEW_EDIT' => 'edited a post: %1$s in %2$s',
|
||||
'MCHAT_NEW_LOGIN' => 'just logged in',
|
||||
));
|
||||
|
||||
@@ -43,7 +43,8 @@ $lang = array_merge($lang, array(
|
||||
|
||||
// Log entries (%1$s is replaced with the user name who triggered the event)
|
||||
'LOG_MCHAT_CONFIG_UPDATE' => '<strong>mChat configuration updated</strong><br />» %1$s',
|
||||
'LOG_MCHAT_TABLE_PRUNED' => '<strong>mChat messages pruned</strong><br />» %1$s',
|
||||
'LOG_MCHAT_TABLE_PRUNED' => '<strong>mChat messages pruned: %2$d</strong><br />» %1$s',
|
||||
'LOG_MCHAT_TABLE_PRUNE_FAIL' => '<strong>mChat pruning failed: invalid time period</strong><br />» %1$s',
|
||||
'LOG_MCHAT_TABLE_PURGED' => '<strong>mChat messages purged</strong><br />» %1$s',
|
||||
'LOG_DELETED_MCHAT' => '<strong>mChat message deleted</strong><br />» %1$s',
|
||||
'LOG_EDITED_MCHAT' => '<strong>mChat message edited</strong><br />» %1$s',
|
||||
|
||||
@@ -40,23 +40,22 @@ $lang = array_merge($lang, array(
|
||||
'MCHAT_ARCHIVE_PAGE' => 'mChat Archive',
|
||||
'MCHAT_BBCODES' => 'BBCodes',
|
||||
'MCHAT_CUSTOM_BBCODES' => 'Custom BBCodes',
|
||||
'MCHAT_DELCONFIRM' => 'Do you confirm removal?',
|
||||
'MCHAT_DELCONFIRM' => 'Are you sure you want to delete this message?',
|
||||
'MCHAT_EDIT' => 'Edit',
|
||||
'MCHAT_EDITINFO' => 'Edit the message and click OK',
|
||||
'MCHAT_EDITINFO' => 'Edit the message below.',
|
||||
'MCHAT_NEW_CHAT' => 'New chat message!',
|
||||
'MCHAT_SEND_PM' => 'Send private message',
|
||||
'MCHAT_LIKE' => 'Like this post',
|
||||
'MCHAT_LIKES' => 'likes this post',
|
||||
'MCHAT_FLOOD' => 'You can not post another message so soon after your last',
|
||||
'MCHAT_LIKE' => 'Like this message',
|
||||
'MCHAT_LIKES' => 'likes this message',
|
||||
'MCHAT_FLOOD' => 'You can not post another message so soon after your last.',
|
||||
'MCHAT_FOE' => 'This message was made by <strong>%1$s</strong> who is currently on your ignore list.',
|
||||
'MCHAT_RULES' => 'Rules',
|
||||
'MCHAT_WHOIS_USER' => 'IP whois for %1$s',
|
||||
'MCHAT_MESS_LONG' => 'Your message is too long. Please limit it to %1$d characters',
|
||||
'MCHAT_NO_CUSTOM_PAGE' => 'The mChat custom page is not activated at this time!',
|
||||
'MCHAT_NO_RULES' => 'The mChat rules page is not activated at this time!',
|
||||
'MCHAT_NOACCESS' => 'You don’t have permission to post in the chat',
|
||||
'MCHAT_NOACCESS_ARCHIVE' => 'You don’t have permission to view the archive',
|
||||
'MCHAT_NOJAVASCRIPT' => 'Your browser does not support JavaScript or JavaScript is disabled',
|
||||
'MCHAT_MESS_LONG' => 'Your message is too long. Please limit it to %1$d characters.',
|
||||
'MCHAT_NO_CUSTOM_PAGE' => 'The mChat custom page is not activated at this time.',
|
||||
'MCHAT_NO_RULES' => 'The mChat rules page is not activated at this time.',
|
||||
'MCHAT_NOACCESS_ARCHIVE' => 'You don’t have permission to view the archive.',
|
||||
'MCHAT_NOJAVASCRIPT' => 'Please enable JavaScript to use mChat.',
|
||||
'MCHAT_NOMESSAGE' => 'No messages',
|
||||
'MCHAT_NOMESSAGEINPUT' => 'You have not entered a message',
|
||||
'MCHAT_OK' => 'OK',
|
||||
@@ -79,7 +78,7 @@ $lang = array_merge($lang, array(
|
||||
2 => '%1$d minutes ago',
|
||||
),
|
||||
|
||||
// These messages are formatted with JavaScript, hence {} and no $d
|
||||
// These messages are formatted with JavaScript, hence {} and no %d
|
||||
'MCHAT_CHARACTER_COUNT' => '<strong>{current}</strong> characters',
|
||||
'MCHAT_CHARACTER_COUNT_LIMIT' => '<strong>{current}</strong> out of {max} characters',
|
||||
'MCHAT_SESSION_ENDS_JS' => 'Chat session ends in {timeleft}',
|
||||
|
||||
@@ -41,7 +41,7 @@ $lang = array_merge($lang, array(
|
||||
'MCHAT_SETTINGS_ARCHIVE' => 'Archive page settings',
|
||||
'MCHAT_SETTINGS_POSTS' => 'New posts settings',
|
||||
'MCHAT_SETTINGS_MESSAGES' => 'Message settings',
|
||||
'MCHAT_SETTINGS_PRUNE' => 'Pruning settings',
|
||||
'MCHAT_SETTINGS_PRUNE' => 'Pruning settings (adjustable for founders only)',
|
||||
'MCHAT_SETTINGS_STATS' => 'Who is chatting settings',
|
||||
|
||||
'MCHAT_GLOBALUSERSETTINGS_EXPLAIN' => 'Settings for which a user does <strong>not</strong> have permission to customise are applied as configured below.<br />New user accounts will have initial settings as configured below.<br /><br />Go to the <em>mChat in UCP</em> tab of the user permissions section to adjust customisation permissions.<br />Go to the <em>Preferences</em> form in the <em>user management</em> section to see the status of each user’s settings.',
|
||||
@@ -70,9 +70,14 @@ $lang = array_merge($lang, array(
|
||||
'MCHAT_LIVE_UPDATES' => 'Live updates of edited and deleted messages',
|
||||
'MCHAT_LIVE_UPDATES_EXPLAIN' => 'When a user edits or deletes messages, the changes are updated live for all others, without them having to refresh the page. Disable this if you experience performance issues.',
|
||||
'MCHAT_PRUNE' => 'Enable message pruning',
|
||||
'MCHAT_PRUNE_EXPLAIN' => 'Only occurs if a user views the custom or archive pages.',
|
||||
'MCHAT_PRUNE_NUM' => 'Number of messages to retain when pruning',
|
||||
'MCHAT_PRUNE_EXPLAIN' => 'The messages table is pruned every 24 hours.',
|
||||
'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_NOW' => 'Prune messages now',
|
||||
'MCHAT_PRUNE_NOW_CONFIRM' => 'Confirm pruning messages',
|
||||
'MCHAT_PRUNED' => '%1$d mChat messages have been pruned',
|
||||
'MCHAT_NAVBAR_LINK' => 'Display link to the custom page in the navbar',
|
||||
'MCHAT_NAVBAR_LINK_COUNT' => 'Display number of active chat sessions in navbar link',
|
||||
'MCHAT_MESSAGE_NUM_CUSTOM' => 'Initial number of messages to display on the custom page',
|
||||
'MCHAT_MESSAGE_NUM_CUSTOM_EXPLAIN' => '<em>You are limited from 5 to 50. Default is 10.</em>',
|
||||
'MCHAT_MESSAGE_NUM_INDEX' => 'Initial number of messages to display on the index page',
|
||||
@@ -93,8 +98,8 @@ $lang = array_merge($lang, array(
|
||||
'MCHAT_BBCODES_DISALLOWED_EXPLAIN' => 'Here you can input the bbcodes that are <strong>not</strong> to be used in a message.<br />Separate bbcodes with a vertical bar, for example: <br />b|i|u|code|list|list=|flash|quote and/or a %1$scustom bbcode tag name%2$s',
|
||||
'MCHAT_STATIC_MESSAGE' => 'Static message',
|
||||
'MCHAT_STATIC_MESSAGE_EXPLAIN' => 'Here you can define a static message to display to users of the chat. HTML code is allowed.<br />Set to empty to disable the display. <em>You are limited to 255 characters.</em><br />This message can be translated: edit the MCHAT_STATIC_MESSAGE language key in /ext/dmzx/mchat/language/XX/mchat.php.',
|
||||
'MCHAT_USER_TIMEOUT' => 'User session timeout',
|
||||
'MCHAT_USER_TIMEOUT_EXPLAIN' => 'Set the amount of time in seconds until a user session in the chat ends.<br />Set to 0 for no timeout. Careful, the session of a user reading mChat will never expire!<br /><em>You are limited to the %1$sforum config setting for sessions%2$s which is currently set to %3$d seconds</em>',
|
||||
'MCHAT_TIMEOUT' => 'Session timeout',
|
||||
'MCHAT_TIMEOUT_EXPLAIN' => 'Set the number of seconds until a session in the chat ends.<br />Set to 0 for no timeout. Careful, the session of a user reading mChat will never expire!<br /><em>You are limited to the %1$sforum config setting for sessions%2$s which is currently set to %3$d seconds</em>',
|
||||
'MCHAT_OVERRIDE_SMILIE_LIMIT' => 'Override smilie limit',
|
||||
'MCHAT_OVERRIDE_SMILIE_LIMIT_EXPLAIN' => 'Set to yes to override the forums smilie limit setting for chat messages',
|
||||
'MCHAT_OVERRIDE_MIN_POST_CHARS' => 'Override minimum characters limit',
|
||||
@@ -132,4 +137,6 @@ $lang = array_merge($lang, array(
|
||||
'TOO_LARGE_MCHAT_TIMEOUT' => 'The user timeout value is too large.',
|
||||
'TOO_SMALL_MCHAT_WHOIS_REFRESH' => 'The whois refresh value is too small.',
|
||||
'TOO_LARGE_MCHAT_WHOIS_REFRESH' => 'The whois refresh value is too large.',
|
||||
|
||||
'MCHAT_30X_REMNANTS' => 'The installation as been aborted.<br />There are remnant modules from the mChat MOD for phpBB 3.0.x in the database. The mChat extension does not work correctly with these modules present.<br />You need to entirely uninstall the mChat MOD before being able to install the mChat extension. Specifically, the modules with the following IDs need to be deleted from the %1$smodules table: %2$s',
|
||||
));
|
||||
|
||||
@@ -51,7 +51,7 @@ $lang = array_merge($lang, array(
|
||||
'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_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_EXPLAIN' => 'Do not update mChat upon entering a message',
|
||||
'MCHAT_MESSAGE_TOP' => 'Location of new chat messages',
|
||||
@@ -64,6 +64,7 @@ $lang = array_merge($lang, array(
|
||||
'MCHAT_POSTS_REPLY' => 'Display new replies',
|
||||
'MCHAT_POSTS_EDIT' => 'Display edited posts',
|
||||
'MCHAT_POSTS_QUOTE' => 'Display quoted posts',
|
||||
'MCHAT_POSTS_LOGIN' => 'Display user logins',
|
||||
|
||||
'MCHAT_DATE_FORMAT' => 'Date format',
|
||||
'MCHAT_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP <a href="http://www.php.net/date">date()</a> function.',
|
||||
|
||||
@@ -37,8 +37,10 @@ if (empty($lang) || !is_array($lang))
|
||||
$lang = array_merge($lang, array(
|
||||
'ACL_U_MCHAT_USE' => 'Can use mChat',
|
||||
'ACL_U_MCHAT_VIEW' => 'Can view mChat',
|
||||
'ACL_U_MCHAT_EDIT' => 'Can edit messages',
|
||||
'ACL_U_MCHAT_DELETE' => 'Can delete messages',
|
||||
'ACL_U_MCHAT_EDIT' => 'Can edit own messages',
|
||||
'ACL_U_MCHAT_DELETE' => 'Can delete own messages',
|
||||
'ACL_U_MCHAT_MODERATOR_EDIT' => 'Can edit anyone’s messages',
|
||||
'ACL_U_MCHAT_MODERATOR_DELETE' => 'Can delete anyone’s messages',
|
||||
'ACL_U_MCHAT_IP' => 'Can view IP addresses',
|
||||
'ACL_U_MCHAT_PM' => 'Can use private message',
|
||||
'ACL_U_MCHAT_LIKE' => 'Can like messages',
|
||||
@@ -47,7 +49,7 @@ $lang = array_merge($lang, array(
|
||||
'ACL_U_MCHAT_ARCHIVE' => 'Can view the archive',
|
||||
'ACL_U_MCHAT_BBCODE' => 'Can use BBCodes',
|
||||
'ACL_U_MCHAT_SMILIES' => 'Can use smilies',
|
||||
'ACL_U_MCHAT_URLS' => 'Can post URLs',
|
||||
'ACL_U_MCHAT_URLS' => 'Can post automatically parsed URLs',
|
||||
|
||||
'ACL_U_MCHAT_AVATARS' => 'Can customise <em>Display avatars</em>',
|
||||
'ACL_U_MCHAT_CAPITAL_LETTER' => 'Can customise <em>Capital first letter</em>',
|
||||
|
||||
@@ -13,49 +13,60 @@ namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
|
||||
{
|
||||
/** @var array */
|
||||
protected $mchat_config = null;
|
||||
|
||||
static public function depends_on()
|
||||
{
|
||||
return array('\phpbb\db\migration\data\v31x\v317pl1');
|
||||
}
|
||||
|
||||
protected function get_config()
|
||||
{
|
||||
if ($this->mchat_config == null)
|
||||
{
|
||||
$yml_config_file = $this->phpbb_root_path . '/ext/dmzx/mchat/config/config_2_0_0.yml';
|
||||
$yml_data = \Symfony\Component\Yaml\Yaml::parse($yml_config_file);
|
||||
$this->mchat_config = $yml_data['parameters'];
|
||||
}
|
||||
|
||||
return $this->mchat_config;
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
$config = $this->get_config();
|
||||
$update_data = array();
|
||||
|
||||
// Add configs
|
||||
foreach (array('dmzx.mchat.config_global', 'dmzx.mchat.config_ucp') as $section)
|
||||
{
|
||||
foreach ($config[$section] as $key => $value)
|
||||
{
|
||||
$update_data[] = array('config.add', array($key, $value['default']));
|
||||
}
|
||||
}
|
||||
|
||||
// Add user permissions for customizing config values
|
||||
foreach ($config['dmzx.mchat.config_ucp'] as $key => $value)
|
||||
{
|
||||
$update_data[] = array('permission.add', array('u_' . $key, true));
|
||||
}
|
||||
|
||||
return array_merge($update_data, array(
|
||||
return array(
|
||||
array('config.add', array('mchat_version', '2.0.0-RC3')),
|
||||
|
||||
// Add global configs
|
||||
array('config.add', array('mchat_bbcode_disallowed', '')),
|
||||
array('config.add', array('mchat_custom_height', 350)),
|
||||
array('config.add', array('mchat_custom_page', 1)),
|
||||
array('config.add', array('mchat_edit_delete_limit', 0)),
|
||||
array('config.add', array('mchat_flood_time', 0)),
|
||||
array('config.add', array('mchat_index_height', 250)),
|
||||
array('config.add', array('mchat_live_updates', 1)),
|
||||
array('config.add', array('mchat_max_message_lngth', 500)),
|
||||
array('config.add', array('mchat_message_num_archive', 25)),
|
||||
array('config.add', array('mchat_message_num_custom', 10)),
|
||||
array('config.add', array('mchat_message_num_index', 10)),
|
||||
array('config.add', array('mchat_navbar_link', 1)),
|
||||
array('config.add', array('mchat_override_min_post_chars', 0)),
|
||||
array('config.add', array('mchat_override_smilie_limit', 0)),
|
||||
array('config.add', array('mchat_posts_edit', 0)),
|
||||
array('config.add', array('mchat_posts_quote', 0)),
|
||||
array('config.add', array('mchat_posts_reply', 0)),
|
||||
array('config.add', array('mchat_posts_topic', 0)),
|
||||
array('config.add', array('mchat_prune', 0)),
|
||||
array('config.add', array('mchat_prune_num', '0')),
|
||||
array('config.add', array('mchat_refresh', 10)),
|
||||
array('config.add', array('mchat_rules', '')),
|
||||
array('config.add', array('mchat_static_message', '')),
|
||||
array('config.add', array('mchat_timeout', 0)),
|
||||
array('config.add', array('mchat_whois', 1)),
|
||||
array('config.add', array('mchat_whois_refresh', 60)),
|
||||
|
||||
// Add global user configs
|
||||
array('config.add', array('mchat_avatars', 1)),
|
||||
array('config.add', array('mchat_capital_letter', 1)),
|
||||
array('config.add', array('mchat_character_count', 1)),
|
||||
array('config.add', array('mchat_date', 'D M d, Y g:i a')),
|
||||
array('config.add', array('mchat_index', 1)),
|
||||
array('config.add', array('mchat_input_area', 1)),
|
||||
array('config.add', array('mchat_location', 1)),
|
||||
array('config.add', array('mchat_message_top', 1)),
|
||||
array('config.add', array('mchat_pause_on_input', 0)),
|
||||
array('config.add', array('mchat_posts', 1)),
|
||||
array('config.add', array('mchat_relative_time', 1)),
|
||||
array('config.add', array('mchat_sound', 1)),
|
||||
array('config.add', array('mchat_stats_index', 0)),
|
||||
array('config.add', array('mchat_whois_index', 1)),
|
||||
|
||||
// Add user permissions
|
||||
array('permission.add', array('u_mchat_use', true)),
|
||||
array('permission.add', array('u_mchat_view', true)),
|
||||
@@ -71,6 +82,22 @@ class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
|
||||
array('permission.add', array('u_mchat_smilies', true)),
|
||||
array('permission.add', array('u_mchat_urls', true)),
|
||||
|
||||
// Add user permissions for customizing config values
|
||||
array('permission.add', array('u_mchat_avatars', true)),
|
||||
array('permission.add', array('u_mchat_capital_letter', true)),
|
||||
array('permission.add', array('u_mchat_character_count', true)),
|
||||
array('permission.add', array('u_mchat_date', true)),
|
||||
array('permission.add', array('u_mchat_index', true)),
|
||||
array('permission.add', array('u_mchat_input_area', true)),
|
||||
array('permission.add', array('u_mchat_location', true)),
|
||||
array('permission.add', array('u_mchat_message_top', true)),
|
||||
array('permission.add', array('u_mchat_pause_on_input', true)),
|
||||
array('permission.add', array('u_mchat_posts', true)),
|
||||
array('permission.add', array('u_mchat_relative_time', true)),
|
||||
array('permission.add', array('u_mchat_sound', true)),
|
||||
array('permission.add', array('u_mchat_stats_index', true)),
|
||||
array('permission.add', array('u_mchat_whois_index', true)),
|
||||
|
||||
// Add admin permissions
|
||||
array('permission.add', array('a_mchat', true)),
|
||||
|
||||
@@ -129,22 +156,14 @@ class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
|
||||
'UCP_MCHAT_CONFIG',
|
||||
array('module_basename' => '\dmzx\mchat\ucp\ucp_mchat_module'),
|
||||
)),
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
$config = $this->get_config();
|
||||
$user_columns = array();
|
||||
|
||||
foreach ($config['dmzx.mchat.config_ucp'] as $key => $value)
|
||||
{
|
||||
$user_columns['user_' . $key] = array($value['type'], $value['default']);
|
||||
}
|
||||
|
||||
return array(
|
||||
'add_tables' => array(
|
||||
$this->table_prefix . 'mchat' => array(
|
||||
'add_tables' => array(
|
||||
$this->table_prefix . 'mchat' => array(
|
||||
'COLUMNS' => array(
|
||||
'message_id' => array('UINT', null, 'auto_increment'),
|
||||
'user_id' => array('UINT', 0),
|
||||
@@ -163,7 +182,7 @@ class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
|
||||
|
||||
$this->table_prefix . 'mchat_deleted_messages' => array(
|
||||
'COLUMNS' => array(
|
||||
'message_id' => array('UINT', null),
|
||||
'message_id' => array('UINT', 0),
|
||||
),
|
||||
'PRIMARY_KEY' => 'message_id',
|
||||
),
|
||||
@@ -178,31 +197,53 @@ class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
|
||||
),
|
||||
),
|
||||
|
||||
'add_columns' => array(
|
||||
$this->table_prefix . 'users' => $user_columns,
|
||||
'add_columns' => array(
|
||||
$this->table_prefix . 'users' => array(
|
||||
'user_mchat_avatars' => array('BOOL', 1),
|
||||
'user_mchat_capital_letter' => array('BOOL', 1),
|
||||
'user_mchat_character_count' => array('BOOL', 1),
|
||||
'user_mchat_date' => array('VCHAR:64', 'D M d, Y g:i a'),
|
||||
'user_mchat_index' => array('BOOL', 1),
|
||||
'user_mchat_input_area' => array('BOOL', 1),
|
||||
'user_mchat_location' => array('BOOL', 1),
|
||||
'user_mchat_message_top' => array('BOOL', 1),
|
||||
'user_mchat_pause_on_input' => array('BOOL', 0),
|
||||
'user_mchat_posts' => array('BOOL', 1),
|
||||
'user_mchat_relative_time' => array('BOOL', 1),
|
||||
'user_mchat_sound' => array('BOOL', 1),
|
||||
'user_mchat_stats_index' => array('BOOL', 0),
|
||||
'user_mchat_whois_index' => array('BOOL', 1),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
$config = $this->get_config();
|
||||
$user_columns = array();
|
||||
|
||||
foreach (array_keys($config['dmzx.mchat.config_ucp']) as $key)
|
||||
{
|
||||
$user_columns[] = 'user_' . $key;
|
||||
}
|
||||
|
||||
return array(
|
||||
'drop_tables' => array(
|
||||
'drop_tables' => array(
|
||||
$this->table_prefix . 'mchat',
|
||||
$this->table_prefix . 'mchat_deleted_messages',
|
||||
$this->table_prefix . 'mchat_sessions',
|
||||
),
|
||||
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'users' => $user_columns,
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'users' => array(
|
||||
'user_mchat_avatars',
|
||||
'user_mchat_capital_letter',
|
||||
'user_mchat_character_count',
|
||||
'user_mchat_date',
|
||||
'user_mchat_index',
|
||||
'user_mchat_input_area',
|
||||
'user_mchat_location',
|
||||
'user_mchat_message_top',
|
||||
'user_mchat_pause_on_input',
|
||||
'user_mchat_posts',
|
||||
'user_mchat_relative_time',
|
||||
'user_mchat_sound',
|
||||
'user_mchat_stats_index',
|
||||
'user_mchat_whois_index',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
77
migrations/mchat_2_0_0_rc6.php
Normal file
77
migrations/mchat_2_0_0_rc6.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
|
||||
* @copyright (c) 2016 kasimi
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_2_0_0_rc6 extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\dmzx\mchat\migrations\mchat_2_0_0_rc5',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('mchat_version', '2.0.0-RC6')),
|
||||
|
||||
array('config.add', array('mchat_navbar_link_count', 1)),
|
||||
array('config.add', array('mchat_posts_login', 0)),
|
||||
|
||||
array('config.add', array('mchat_prune_gc', strtotime('1 day', 0))),
|
||||
array('config.add', array('mchat_prune_last_gc', 0, true)), // true => value is dynamic, do not cache
|
||||
|
||||
array('config.remove', array('mchat_whois')),
|
||||
|
||||
array('permission.add', array('u_mchat_moderator_edit', true)),
|
||||
array('permission.add', array('u_mchat_moderator_delete', true)),
|
||||
);
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'add_tables' => array(
|
||||
$this->table_prefix . 'mchat_log' => array(
|
||||
'COLUMNS' => array(
|
||||
'log_id' => array('UINT', null, 'auto_increment'),
|
||||
'log_type' => array('TINT:4', 0),
|
||||
'user_id' => array('UINT', 0),
|
||||
'message_id' => array('UINT', 0),
|
||||
'log_ip' => array('VCHAR:40', ''),
|
||||
'log_time' => array('INT:11', 0),
|
||||
),
|
||||
'PRIMARY_KEY' => 'log_id',
|
||||
),
|
||||
),
|
||||
'drop_tables' => array(
|
||||
$this->table_prefix . 'mchat_deleted_messages',
|
||||
),
|
||||
|
||||
'drop_columns' => array(
|
||||
$this->table_prefix . 'mchat' => array(
|
||||
'edit_time',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'drop_tables' => array(
|
||||
$this->table_prefix . 'mchat_log',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
6
sounds/README.txt
Normal file
6
sounds/README.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
Credits
|
||||
|
||||
add.mp3 UI Buttons and Whooshes Pack 1 by Narfstuff http://www.narfstuff.co.uk/
|
||||
edit.mp3 Scribble by TiesWijnen https://www.freesound.org/people/TiesWijnen/sounds/341738/
|
||||
del.mp3 Paper Throw http://www.soundjay.com/
|
||||
error.mp3 GUI Sound Effects by Lokif http://opengameart.org/content/gui-sound-effects
|
||||
BIN
sounds/add.mp3
BIN
sounds/add.mp3
Binary file not shown.
BIN
sounds/del.mp3
BIN
sounds/del.mp3
Binary file not shown.
BIN
sounds/edit.mp3
BIN
sounds/edit.mp3
Binary file not shown.
BIN
sounds/error.mp3
BIN
sounds/error.mp3
Binary file not shown.
@@ -0,0 +1 @@
|
||||
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = SOP_SKDARK_SW or FALSE -->
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- INCLUDECSS @dmzx_mchat/mchat.css -->
|
||||
<!-- INCLUDECSS @dmzx_mchat/mchat_custom.css -->
|
||||
1
styles/Subway/template/mchat_navlink.html
Normal file
1
styles/Subway/template/mchat_navlink.html
Normal file
@@ -0,0 +1 @@
|
||||
<li class="li-mchat"><a href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" class="mchat-nav-link-title"><i class="icon-mchat"></i><span class="mchat-nav-link">{MCHAT_TITLE}</span></a></li>
|
||||
16
styles/Subway/theme/mchat_custom.css
Normal file
16
styles/Subway/theme/mchat_custom.css
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
|
||||
* @copyright (c) 2016 kasimi
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
.icon-mchat {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.icon-mchat:before, #mChat + .inner li.header dt:before {
|
||||
content: '\e0e6';
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
jQuery autoGrowInput v1.0.3
|
||||
Copyright (c) 2014 Simon Steinberger / Pixabay
|
||||
Based on stackoverflow.com/questions/931207 (James Padolsey)
|
||||
GitHub: https://github.com/Pixabay/jQuery-autoGrowInput
|
||||
License: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
(function($){
|
||||
var event = 'oninput' in document.createElement('input') ? 'input' : 'keydown';
|
||||
|
||||
$.fn.autoGrowInput = function(options){
|
||||
var o = $.extend({ maxWidth: 500, minWidth: 20, comfortZone: 0 }, options);
|
||||
|
||||
this.each(function(){
|
||||
var input = $(this),
|
||||
val = ' ',
|
||||
comfortZone = (options && 'comfortZone' in options) ? o.comfortZone : parseInt(input.css('fontSize')),
|
||||
span = $('<span/>').css({
|
||||
position: 'absolute',
|
||||
top: -9999,
|
||||
left: -9999,
|
||||
width: 'auto',
|
||||
fontSize: input.css('fontSize'),
|
||||
fontFamily: input.css('fontFamily'),
|
||||
fontWeight: input.css('fontWeight'),
|
||||
letterSpacing: input.css('letterSpacing'),
|
||||
textTransform: input.css('textTransform'),
|
||||
whiteSpace: 'nowrap',
|
||||
ariaHidden: true
|
||||
}).appendTo('body'),
|
||||
check = function(e){
|
||||
if (val === (val = input.val()) && e.type !== 'autogrow') return;
|
||||
if (!val) val = input.attr('placeholder') || '';
|
||||
span.html(val.replace(/&/g, '&').replace(/\s/g, ' ').replace(/</g, '<').replace(/>/g, '>'));
|
||||
var newWidth = span.width() + comfortZone, mw = typeof(o.maxWidth) == "function" ? o.maxWidth() : o.maxWidth;
|
||||
if (newWidth > mw) newWidth = mw;
|
||||
else if (newWidth < o.minWidth) newWidth = o.minWidth;
|
||||
if (newWidth != input.width()) input.width(newWidth);
|
||||
};
|
||||
input.on(event+'.autogrow autogrow', check);
|
||||
// init on page load
|
||||
check();
|
||||
});
|
||||
return this;
|
||||
}
|
||||
}(jQuery));
|
||||
211
styles/all/template/javascript/jquery.autogrow-textarea.js
Normal file
211
styles/all/template/javascript/jquery.autogrow-textarea.js
Normal file
@@ -0,0 +1,211 @@
|
||||
// Based off https://code.google.com/p/gaequery/source/browse/trunk/src/static/scripts/jquery.autogrow-textarea.js?r=2
|
||||
// Modified by David Beck
|
||||
// Mofified by kasimi (c) 2016
|
||||
|
||||
( function( factory ) {
|
||||
// UMD wrapper
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( [ 'jquery' ], factory );
|
||||
} else if ( typeof exports !== 'undefined' ) {
|
||||
// Node/CommonJS
|
||||
module.exports = factory( require( 'jquery' ) );
|
||||
} else {
|
||||
// Browser globals
|
||||
factory( jQuery );
|
||||
}
|
||||
}( function( $ ) {
|
||||
|
||||
/*
|
||||
* Auto-growing textareas; technique ripped from Facebook
|
||||
*/
|
||||
$.fn.autogrow = function(options) {
|
||||
|
||||
options = $.extend( {
|
||||
vertical: true,
|
||||
horizontal: false,
|
||||
characterSlop: 0
|
||||
}, options);
|
||||
|
||||
this.filter('textarea,input').each(function() {
|
||||
|
||||
var $this = $(this),
|
||||
borderBox = $this.css( 'box-sizing' ) === 'border-box',
|
||||
// minHeight = borderBox ? $this.outerHeight() : $this.height(),
|
||||
maxHeight = $this.attr( "maxHeight" ),
|
||||
minWidth = typeof( $this.attr( "minWidth" ) ) == "undefined" ? 0 : $this.attr( "minWidth" );
|
||||
|
||||
if( typeof( maxHeight ) == "undefined" ) maxHeight = 1000000;
|
||||
|
||||
var shadow = $('<div class="autogrow-shadow"></div>').css( {
|
||||
position: 'absolute',
|
||||
top: -10000,
|
||||
left: -10000,
|
||||
fontSize: $this.css('fontSize'),
|
||||
fontFamily: $this.css('fontFamily'),
|
||||
fontWeight: $this.css('fontWeight'),
|
||||
lineHeight: $this.css('lineHeight'),
|
||||
paddingLeft: $this.css('paddingLeft'),
|
||||
paddingRight: $this.css('paddingRight'),
|
||||
paddingTop: $this.css('paddingTop'),
|
||||
paddingBottom: $this.css('paddingBottom'),
|
||||
borderTop: $this.css('borderTop'),
|
||||
borderBottom: $this.css('borderBottom'),
|
||||
borderLeft: $this.css('borderLeft'),
|
||||
borderRight: $this.css('borderRight'),
|
||||
whiteSpace: 'pre-wrap',
|
||||
resize: 'none'
|
||||
} ).appendTo(document.body);
|
||||
|
||||
shadow.html( 'a' );
|
||||
var characterWidth = shadow.width();
|
||||
shadow.html( '' );
|
||||
var isTextarea = $this.is('textarea');
|
||||
|
||||
var update = function( val ) {
|
||||
|
||||
var times = function(string, number) {
|
||||
for (var i = 0, r = ''; i < number; i ++) r += string;
|
||||
return r;
|
||||
};
|
||||
|
||||
if( typeof val === 'undefined' ) val = this.value;
|
||||
if( val === '' && $(this).attr("placeholder") ) val = $(this).attr("placeholder");
|
||||
|
||||
if( options.vertical )
|
||||
val = val.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/\n$/, '<br/> ')
|
||||
.replace(/\n/g, '<br/>')
|
||||
.replace(/ {2,}/g, function(space) { return times(' ', space.length -1) + ' '; });
|
||||
else
|
||||
val = escapeHtml( val );
|
||||
|
||||
//if( options.horizontal )
|
||||
// val = $.trim( val );
|
||||
|
||||
// if( $(this).prop( 'tagName' ).toUpperCase() === 'INPUT' )
|
||||
// shadow.text(val).css( "width", "auto" );
|
||||
// else
|
||||
shadow.html( val ).css( "width", "auto" ); // need to use html here otherwise no way to count spaces (with html we can use )
|
||||
|
||||
if( options.horizontal )
|
||||
{
|
||||
var slopWidth = options.characterSlop * characterWidth + 2;
|
||||
|
||||
var newWidth = Math.max( shadow.width() + slopWidth, minWidth );
|
||||
var maxWidth = options.maxWidth;
|
||||
//if( typeof( maxWidth ) === "undefined" ) maxWidth = $this.parent().width() - 12; // not sure why we were doing this but seems like a bad idea. doesn't work with inline-block parents for one thing, since it is the text area that should be "pushing" them to be wider
|
||||
if( maxWidth ) newWidth = Math.min( newWidth, maxWidth );
|
||||
// Take scrollbar into account
|
||||
if (isTextarea && shadow.get(0).scrollHeight > shadow.height()) {
|
||||
newWidth += 20;
|
||||
}
|
||||
$(this).css( "width", newWidth );
|
||||
}
|
||||
|
||||
if( options.vertical )
|
||||
{
|
||||
var shadowWidth = $(this).width();
|
||||
if( ! borderBox ) shadowWidth = shadowWidth - parseInt($this.css('paddingLeft'),10) - parseInt($this.css('paddingRight'),10);
|
||||
shadow.css( "width", shadowWidth );
|
||||
var shadowHeight = borderBox ? shadow.outerHeight() : shadow.height();
|
||||
|
||||
$(this).css( "height", "auto" );
|
||||
minHeight = borderBox ? $this.outerHeight() : $this.height();
|
||||
|
||||
var newHeight = Math.min( Math.max( shadowHeight, minHeight ), maxHeight );
|
||||
$(this).css( "height", newHeight );
|
||||
$(this).css( "overflow", newHeight == maxHeight ? "auto" : "hidden" );
|
||||
}
|
||||
};
|
||||
|
||||
$(this)
|
||||
.change(function(){update.call( this );return true;})
|
||||
.keyup(function(){update.call( this );return true;})
|
||||
.keypress(function( event ) {
|
||||
if( event.ctrlKey || event.metaKey ) return;
|
||||
|
||||
var val = this.value;
|
||||
var caretInfo = _getCaretInfo( this );
|
||||
|
||||
var typedChar = event.which === 13 ? "\n" : String.fromCharCode( event.which );
|
||||
var valAfterKeypress = val.slice( 0, caretInfo.start ) + typedChar + val.slice( caretInfo.end );
|
||||
update.call( this, valAfterKeypress );
|
||||
return true;
|
||||
})
|
||||
.bind( "update.autogrow", function(){ update.apply(this); } )
|
||||
.bind( "remove.autogrow", function() {
|
||||
shadow.remove();
|
||||
} );
|
||||
|
||||
update.apply(this);
|
||||
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// comes from https://github.com/madapaja/jquery.selection/blob/master/src/jquery.selection.js
|
||||
var _getCaretInfo = function(element){
|
||||
var res = {
|
||||
text: '',
|
||||
start: 0,
|
||||
end: 0
|
||||
};
|
||||
|
||||
if (!element.value) {
|
||||
/* no value or empty string */
|
||||
return res;
|
||||
}
|
||||
|
||||
try {
|
||||
if (window.getSelection) {
|
||||
/* except IE */
|
||||
res.start = element.selectionStart;
|
||||
res.end = element.selectionEnd;
|
||||
res.text = element.value.slice(res.start, res.end);
|
||||
} else if (doc.selection) {
|
||||
/* for IE */
|
||||
element.focus();
|
||||
|
||||
var range = doc.selection.createRange(),
|
||||
range2 = doc.body.createTextRange();
|
||||
|
||||
res.text = range.text;
|
||||
|
||||
try {
|
||||
range2.moveToElementText(element);
|
||||
range2.setEndPoint('StartToStart', range);
|
||||
} catch (e) {
|
||||
range2 = element.createTextRange();
|
||||
range2.setEndPoint('StartToStart', range);
|
||||
}
|
||||
|
||||
res.start = element.value.length - range2.text.length;
|
||||
res.end = res.start + range.text.length;
|
||||
}
|
||||
} catch (e) {
|
||||
/* give up */
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
var entityMap = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
"/": '/',
|
||||
" ": ' '
|
||||
};
|
||||
|
||||
function escapeHtml(string) {
|
||||
return String(string).replace(/[&<>"'\/\ ]/g, function (s) {
|
||||
return entityMap[s];
|
||||
} );
|
||||
}
|
||||
} ) );
|
||||
@@ -1,2 +0,0 @@
|
||||
/*! js-cookie v2.0.4 | MIT */
|
||||
!function(a){if("function"==typeof define&&define.amd)define(a);else if("object"==typeof exports)module.exports=a();else{var b=window.Cookies,c=window.Cookies=a();c.noConflict=function(){return window.Cookies=b,c}}}(function(){function a(){for(var a=0,b={};a<arguments.length;a++){var c=arguments[a];for(var d in c)b[d]=c[d]}return b}function b(c){function d(b,e,f){var g;if(arguments.length>1){if(f=a({path:"/"},d.defaults,f),"number"==typeof f.expires){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*f.expires),f.expires=h}try{g=JSON.stringify(e),/^[\{\[]/.test(g)&&(e=g)}catch(i){}return e=encodeURIComponent(String(e)),e=e.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),b=encodeURIComponent(String(b)),b=b.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),b=b.replace(/[\(\)]/g,escape),document.cookie=[b,"=",e,f.expires&&"; expires="+f.expires.toUTCString(),f.path&&"; path="+f.path,f.domain&&"; domain="+f.domain,f.secure?"; secure":""].join("")}b||(g={});for(var j=document.cookie?document.cookie.split("; "):[],k=/(%[0-9A-Z]{2})+/g,l=0;l<j.length;l++){var m=j[l].split("="),n=m[0].replace(k,decodeURIComponent),o=m.slice(1).join("=");'"'===o.charAt(0)&&(o=o.slice(1,-1));try{if(o=c&&c(o,n)||o.replace(k,decodeURIComponent),this.json)try{o=JSON.parse(o)}catch(i){}if(b===n){g=o;break}b||(g[n]=o)}catch(i){}}return g}return d.get=d.set=d,d.getJSON=function(){return d.apply({json:!0},[].slice.call(arguments))},d.defaults={},d.remove=function(b,c){d(b,"",a(c,{expires:-1}))},d.withConverter=b,d}return b()});
|
||||
@@ -28,95 +28,172 @@ if (!Array.prototype.min) {
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.format) {
|
||||
String.prototype.format = function() {
|
||||
var str = this.toString();
|
||||
if (!arguments.length) {
|
||||
return str;
|
||||
}
|
||||
var type = typeof arguments[0];
|
||||
var args = 'string' == type || 'number' == type ? arguments : arguments[0];
|
||||
jQuery.each(args, function(arg, value) {
|
||||
str = str.replace(RegExp('\\{' + arg + '\\}', 'gi'), value);
|
||||
});
|
||||
Array.prototype.removeValue = function(value) {
|
||||
var index = -1;
|
||||
var elementsRemoved = 0;
|
||||
while ((index = this.indexOf(value)) !== -1) {
|
||||
this.splice(index, 1);
|
||||
elementsRemoved++;
|
||||
}
|
||||
return elementsRemoved;
|
||||
};
|
||||
|
||||
String.prototype.format = function() {
|
||||
var str = this.toString();
|
||||
if (!arguments.length) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
var type = typeof arguments[0];
|
||||
var args = 'string' == type || 'number' == type ? arguments : arguments[0];
|
||||
for (var arg in args) {
|
||||
if (args.hasOwnProperty(arg)) {
|
||||
str = str.replace(new RegExp("\\{" + arg + "\\}", "gi"), args[arg]);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
String.prototype.replaceMany = function() {
|
||||
var result = this;
|
||||
var args = arguments[0];
|
||||
for (var arg in args) {
|
||||
if (args.hasOwnProperty(arg)) {
|
||||
result = result.replace(new RegExp(RegExp.escape(arg), "g"), args[arg]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
RegExp.escape = function(s) {
|
||||
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
};
|
||||
|
||||
jQuery.fn.reverse = function(reverse) {
|
||||
return reverse === 'undefined' || reverse ? jQuery(this.toArray().reverse()) : this;
|
||||
};
|
||||
|
||||
jQuery(function($) {
|
||||
var ajaxRequest = function(mode, sendHiddenFields, data) {
|
||||
var deferred = $.Deferred();
|
||||
if (sendHiddenFields) {
|
||||
$.extend(data, mChat.hiddenFields);
|
||||
}
|
||||
$.ajax({
|
||||
url: mChat.actionUrls[mode],
|
||||
timeout: Math.min(mChat.refreshTime, 10000),
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: data
|
||||
}).done(function(json, status, xhr) {
|
||||
if (json[mode]) {
|
||||
deferred.resolve(json, status, xhr);
|
||||
} else {
|
||||
deferred.reject(xhr, status, xhr.responseJSON ? 'session' : 'unexpected format');
|
||||
}
|
||||
}).fail(function(xhr, status, error) {
|
||||
deferred.reject(xhr, status, error);
|
||||
});
|
||||
return deferred.promise().fail(function(xhr, textStatus, errorThrown) {
|
||||
mChat.sound('error');
|
||||
mChat.cached('status-load', 'status-ok', 'status-paused').hide();
|
||||
mChat.cached('status-error').show();
|
||||
if (errorThrown == 'session') {
|
||||
mChat.endSession(true);
|
||||
alert(mChat.sessOut);
|
||||
} else if (xhr.status == 400) {
|
||||
mChat.resetSession();
|
||||
alert(mChat.flood);
|
||||
} else if (xhr.status == 403) {
|
||||
mChat.endSession(true);
|
||||
alert(mChat.noAccess);
|
||||
} else if (xhr.status == 413) {
|
||||
mChat.resetSession();
|
||||
alert(mChat.mssgLngthLong);
|
||||
} else if (xhr.status == 501) {
|
||||
mChat.resetSession();
|
||||
alert(mChat.noMessageInput);
|
||||
} else if (typeof console !== 'undefined' && console.log) {
|
||||
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
"use strict";
|
||||
|
||||
$.extend(mChat, {
|
||||
ajaxRequest: function(mode, sendHiddenFields, data) {
|
||||
var deferred = $.Deferred();
|
||||
if (sendHiddenFields) {
|
||||
$.extend(data, mChat.hiddenFields);
|
||||
}
|
||||
$(mChat).trigger('mchat_send_request_before', [mode, data]);
|
||||
$.ajax({
|
||||
url: mChat.actionUrls[mode],
|
||||
timeout: Math.min(mChat.refreshTime, 10000),
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: data
|
||||
}).done(function(json, status, xhr) {
|
||||
var data = {
|
||||
mode: mode,
|
||||
json: json,
|
||||
status: status,
|
||||
xhr: xhr,
|
||||
handle: true
|
||||
};
|
||||
$(mChat).trigger('mchat_ajax_done_before', [data]);
|
||||
if (data.handle) {
|
||||
if (json[mode]) {
|
||||
deferred.resolve(data.json, data.status, data.xhr);
|
||||
} else {
|
||||
deferred.reject(data.xhr, data.status, mChat.lang.parserErr);
|
||||
}
|
||||
}
|
||||
}).fail(function(xhr, status, error) {
|
||||
deferred.reject(xhr, status, error);
|
||||
});
|
||||
return deferred.promise().fail(function(xhr, textStatus, errorThrown) {
|
||||
if (mChat.pageIsUnloading) {
|
||||
return;
|
||||
}
|
||||
if (typeof console !== 'undefined' && console.log) {
|
||||
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown + ' (' + xhr.responseText + ')');
|
||||
}
|
||||
var data = {
|
||||
mode: mode,
|
||||
xhr: xhr,
|
||||
textStatus: textStatus,
|
||||
errorThrown: errorThrown,
|
||||
updateSession: function(xhr) {
|
||||
if (xhr.status == 403) {
|
||||
mChat.endSession(true);
|
||||
} else if (xhr.status == 400) {
|
||||
mChat.resetSession();
|
||||
}
|
||||
}
|
||||
};
|
||||
$(mChat).trigger('mchat_ajax_fail_before', [data]);
|
||||
mChat.sound('error');
|
||||
mChat.cached('status-load', 'status-ok', 'status-paused').hide();
|
||||
mChat.cached('status-error').show();
|
||||
var responseText;
|
||||
try {
|
||||
responseText = xhr.responseJSON.message || errorThrown;
|
||||
} catch (e) {
|
||||
responseText = errorThrown;
|
||||
}
|
||||
phpbb.alert(mChat.lang.err, responseText);
|
||||
data.updateSession(data.xhr);
|
||||
});
|
||||
},
|
||||
sound: function(file) {
|
||||
if (!mChat.pageIsUnloading && !Cookies.get('mchat_no_sound')) {
|
||||
var audio = mChat.cached('sound-' + file).get(0);
|
||||
if (audio.duration) {
|
||||
audio.pause();
|
||||
audio.currentTime = 0;
|
||||
audio.play();
|
||||
if (!mChat.pageIsUnloading && !localStorage.getItem(mChat.cookie + 'mchat_no_sound')) {
|
||||
var data = {
|
||||
audio: mChat.cached('sound-' + file).get(0),
|
||||
file: file,
|
||||
play: true
|
||||
};
|
||||
$(mChat).trigger('mchat_sound_before', [data]);
|
||||
if (data.play && data.audio.duration) {
|
||||
data.audio.pause();
|
||||
data.audio.currentTime = 0;
|
||||
data.audio.play();
|
||||
}
|
||||
}
|
||||
},
|
||||
notice: function() {
|
||||
if (!document.hasFocus()) {
|
||||
$.titleAlert(mChat.newMessageAlert, {interval: 1000});
|
||||
titleAlert: function() {
|
||||
var data = {
|
||||
doAlert: !document.hasFocus(),
|
||||
interval: 1000
|
||||
};
|
||||
$(mChat).trigger('mchat_titlealert_before', [data]);
|
||||
if (data.doAlert) {
|
||||
$.titleAlert(mChat.lang.newMessageAlert, data);
|
||||
}
|
||||
},
|
||||
toggle: function(name) {
|
||||
var $elem = mChat.cached(name);
|
||||
$elem.stop().slideToggle(function() {
|
||||
var cookieName = 'mchat_show_' + name;
|
||||
$elem.stop().slideToggle('fast', function() {
|
||||
if ($elem.is(':visible')) {
|
||||
Cookies.set(cookieName, 'yes');
|
||||
localStorage.setItem(mChat.cookie + 'mchat_show_' + name, 'yes');
|
||||
} else {
|
||||
Cookies.remove(cookieName);
|
||||
localStorage.removeItem(mChat.cookie + 'mchat_show_' + name);
|
||||
}
|
||||
});
|
||||
},
|
||||
confirm: function(data) {
|
||||
var $confirmFields = data.container.find('.mchat-confirm-fields');
|
||||
$confirmFields.children().hide();
|
||||
var fields = data.fields($confirmFields);
|
||||
$.each(fields, function() {
|
||||
$(this).show();
|
||||
});
|
||||
setTimeout(function() {
|
||||
var $input = $confirmFields.find(':input:visible:enabled:first');
|
||||
if ($input.length) {
|
||||
var value = $input.val();
|
||||
$input.focus().val('').val(value);
|
||||
}
|
||||
}, 1);
|
||||
phpbb.confirm(data.container.show(), function() {
|
||||
if (typeof data.confirm === 'function') {
|
||||
data.confirm.apply(this, fields);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -124,23 +201,34 @@ jQuery(function($) {
|
||||
if (mChat.cached('add').prop('disabled')) {
|
||||
return;
|
||||
}
|
||||
var messageLength = mChat.inputMessageLength();
|
||||
var messageLength = mChat.cached('input').val().length;
|
||||
if (!messageLength) {
|
||||
alert(mChat.noMessageInput);
|
||||
phpbb.alert(mChat.lang.err, mChat.lang.noMessageInput);
|
||||
return;
|
||||
}
|
||||
if (mChat.mssgLngth && messageLength > mChat.mssgLngth) {
|
||||
alert(mChat.mssgLngthLong);
|
||||
phpbb.alert(mChat.lang.err, mChat.lang.mssgLngthLong);
|
||||
return;
|
||||
}
|
||||
mChat.cached('add').prop('disabled', true);
|
||||
mChat.pauseSession();
|
||||
mChat.lastInputValue = mChat.cached('input').val();
|
||||
mChat.cached('input').val('').keyup().trigger('autogrow');
|
||||
mChat.refresh(mChat.lastInputValue).done(function() {
|
||||
var originalInputValue = mChat.cached('input').val();
|
||||
var inputValue = originalInputValue;
|
||||
var color = localStorage.getItem(mChat.cookie + 'mchat_color');
|
||||
if (color && inputValue.indexOf('[color=') === -1) {
|
||||
inputValue = '[color=#' + color + '] ' + inputValue + ' [/color]';
|
||||
}
|
||||
mChat.cached('input').val('');
|
||||
if (mChat.showCharCount) {
|
||||
mChat.updateCharCount();
|
||||
}
|
||||
mChat.refresh(inputValue).done(function() {
|
||||
mChat.resetSession();
|
||||
}).fail(function() {
|
||||
mChat.cached('input').val(mChat.lastInputValue).keyup().trigger('autogrow');
|
||||
mChat.cached('input').val(originalInputValue);
|
||||
if (mChat.showCharCount) {
|
||||
mChat.updateCharCount();
|
||||
}
|
||||
}).always(function() {
|
||||
mChat.cached('add').prop('disabled', false);
|
||||
setTimeout(function() {
|
||||
@@ -149,90 +237,65 @@ jQuery(function($) {
|
||||
});
|
||||
},
|
||||
edit: function() {
|
||||
var $container = $(this).closest('.mchat-message');
|
||||
var $message = mChat.cached('confirm').find('textarea').show().val($container.data('mchat-message'));
|
||||
mChat.cached('confirm').find('p').text(mChat.editInfo);
|
||||
phpbb.confirm(mChat.cached('confirm'), function() {
|
||||
ajaxRequest('edit', true, {
|
||||
message_id: $container.data('mchat-id'),
|
||||
message: $message.val(),
|
||||
archive: mChat.archivePage ? 1 : 0
|
||||
}).done(function(json) {
|
||||
mChat.updateMessages($(json.edit));
|
||||
mChat.resetSession();
|
||||
});
|
||||
var $message = $(this).closest('.mchat-message');
|
||||
mChat.confirm({
|
||||
container: mChat.cached('confirm'),
|
||||
fields: function($container) {
|
||||
return [
|
||||
$container.find('p').text(mChat.lang.editInfo),
|
||||
$container.find('textarea').val($message.data('mchat-message'))
|
||||
];
|
||||
},
|
||||
confirm: function($p, $textarea) {
|
||||
mChat.ajaxRequest('edit', true, {
|
||||
message_id: $message.data('mchat-id'),
|
||||
message: $textarea.val(),
|
||||
archive: mChat.archivePage ? 1 : 0
|
||||
}).done(function(json) {
|
||||
mChat.updateMessages($(json.edit));
|
||||
mChat.resetSession();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
del: function() {
|
||||
var $container = $(this).closest('.mchat-message');
|
||||
mChat.cached('confirm').find('textarea').hide();
|
||||
mChat.cached('confirm').find('p').text(mChat.delConfirm);
|
||||
phpbb.confirm(mChat.cached('confirm'), function() {
|
||||
var delId = $container.data('mchat-id');
|
||||
ajaxRequest('del', true, {
|
||||
message_id: delId
|
||||
}).done(function() {
|
||||
mChat.removeMessages([delId]);
|
||||
mChat.resetSession();
|
||||
});
|
||||
var delId = $(this).closest('.mchat-message').data('mchat-id');
|
||||
mChat.confirm({
|
||||
container: mChat.cached('confirm'),
|
||||
fields: function($container) {
|
||||
return [
|
||||
$container.find('p').text(mChat.lang.delConfirm)
|
||||
];
|
||||
},
|
||||
confirm: function($p) {
|
||||
mChat.ajaxRequest('del', true, {
|
||||
message_id: delId
|
||||
}).done(function() {
|
||||
mChat.removeMessages([delId]);
|
||||
mChat.resetSession();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
refresh: function(message) {
|
||||
if (mChat.isPaused && !message) {
|
||||
return false;
|
||||
}
|
||||
var $messages = mChat.cached('messages').children();
|
||||
var data = {
|
||||
message_last_id: mChat.messageIds.length ? mChat.messageIds.max() : 0
|
||||
last: mChat.messageIds.length ? mChat.messageIds.max() : 0
|
||||
};
|
||||
if (message) {
|
||||
data.message = message;
|
||||
}
|
||||
if (mChat.liveUpdates) {
|
||||
data.message_first_id = mChat.messageIds.length ? mChat.messageIds.min() : 0;
|
||||
data.message_edits = {};
|
||||
var now = Math.floor(Date.now() / 1000);
|
||||
$.each($messages, function() {
|
||||
var $message = $(this);
|
||||
var editTime = $message.data('mchat-edit-time');
|
||||
if (editTime && (!mChat.editDeleteLimit || $message.data('mchat-message-time') >= now - mChat.editDeleteLimit / 1000)) {
|
||||
data.message_edits[$message.data('mchat-id')] = editTime;
|
||||
}
|
||||
});
|
||||
data.log = mChat.logId;
|
||||
}
|
||||
mChat.cached('status-ok', 'status-error', 'status-paused').hide();
|
||||
mChat.cached('status-load').show();
|
||||
return ajaxRequest(message ? 'add' : 'refresh', !!message, data).done(function(json) {
|
||||
return mChat.ajaxRequest(message ? 'add' : 'refresh', !!message, data).done(function(json) {
|
||||
$(mChat).trigger('mchat_response_handle_data_before', [json]);
|
||||
if (json.add) {
|
||||
var $html = $(json.add);
|
||||
$('.mchat-no-messages').remove();
|
||||
$html.reverse(mChat.messageTop).hide().each(function(i) {
|
||||
var $message = $(this);
|
||||
if ($.inArray($message.data('mchat-id'), mChat.messageIds) !== -1) {
|
||||
return;
|
||||
}
|
||||
mChat.messageIds.push($message.data('mchat-id'));
|
||||
setTimeout(function() {
|
||||
if (mChat.messageTop) {
|
||||
mChat.cached('messages').prepend($message);
|
||||
} else {
|
||||
mChat.cached('messages').append($message);
|
||||
}
|
||||
$message.css('opacity', 0).slideDown().animate({opacity: 1}, {queue: false});
|
||||
mChat.cached('messages').animate({scrollTop: mChat.messageTop ? 0 : mChat.cached('messages')[0].scrollHeight});
|
||||
}, i * 400);
|
||||
if (mChat.editDeleteLimit && $message.data('mchat-edit-delete-limit') && $message.find('[data-mchat-action="edit"], [data-mchat-action="del"]').length > 0) {
|
||||
var id = $message.prop('id');
|
||||
setTimeout(function() {
|
||||
$('#' + id).find('[data-mchat-action="edit"], [data-mchat-action="del"]').fadeOut(function() {
|
||||
$(this).closest('li').remove();
|
||||
});
|
||||
}, mChat.editDeleteLimit);
|
||||
}
|
||||
mChat.startRelativeTimeUpdate($message);
|
||||
});
|
||||
mChat.sound('add');
|
||||
mChat.notice();
|
||||
mChat.addMessages($(json.add));
|
||||
}
|
||||
if (json.edit) {
|
||||
mChat.updateMessages($(json.edit));
|
||||
@@ -241,12 +304,16 @@ jQuery(function($) {
|
||||
mChat.removeMessages(json.del);
|
||||
}
|
||||
if (json.whois) {
|
||||
mChat.whois();
|
||||
mChat.handleWhoisResponse(json);
|
||||
}
|
||||
if (json.log) {
|
||||
mChat.logId = json.log;
|
||||
}
|
||||
if (mChat.refreshInterval) {
|
||||
mChat.cached('status-load', 'status-error', 'status-paused').hide();
|
||||
mChat.cached('status-ok').show();
|
||||
}
|
||||
$(mChat).trigger('mchat_response_handle_data_after', [json]);
|
||||
});
|
||||
},
|
||||
whois: function() {
|
||||
@@ -254,51 +321,133 @@ jQuery(function($) {
|
||||
mChat.cached('refresh-pending').show();
|
||||
mChat.cached('refresh-explain').hide();
|
||||
}
|
||||
ajaxRequest('whois', false, {}).done(function(json) {
|
||||
var $whois = $(json.whois);
|
||||
var $userlist = $whois.find('#mchat-userlist');
|
||||
if (Cookies.get('mchat_show_userlist')) {
|
||||
$userlist.show();
|
||||
mChat.ajaxRequest('whois', false, {}).done(mChat.handleWhoisResponse);
|
||||
},
|
||||
handleWhoisResponse: function(json) {
|
||||
var $whois = $(json.whois);
|
||||
var $userlist = $whois.find('#mchat-userlist');
|
||||
if (localStorage.getItem(mChat.cookie + 'mchat_show_userlist')) {
|
||||
$userlist.show();
|
||||
}
|
||||
mChat.cached('whois').replaceWith($whois);
|
||||
mChat.cache.whois = $whois;
|
||||
mChat.cache.userlist = $userlist;
|
||||
if (mChat.customPage) {
|
||||
mChat.cached('refresh-pending').hide();
|
||||
mChat.cached('refresh-explain').show();
|
||||
}
|
||||
if (json.navlink) {
|
||||
$('.mchat-nav-link').html(json.navlink);
|
||||
}
|
||||
if (json.navlink_title) {
|
||||
$('.mchat-nav-link-title').prop('title', json.navlink_title);
|
||||
}
|
||||
},
|
||||
addMessages: function($messages) {
|
||||
var playSound = true;
|
||||
mChat.cached('messages').find('.mchat-no-messages').remove();
|
||||
$messages.reverse(mChat.messageTop).hide().each(function(i) {
|
||||
var $message = $(this);
|
||||
var data = {
|
||||
message: $message,
|
||||
delay: mChat.refreshInterval ? 400 : 0,
|
||||
abort: $.inArray($message.data('mchat-id'), mChat.messageIds) !== -1,
|
||||
playSound: playSound
|
||||
};
|
||||
$(mChat).trigger('mchat_add_message_before', [data]);
|
||||
if (data.abort) {
|
||||
return;
|
||||
}
|
||||
mChat.cached('whois').replaceWith($whois);
|
||||
mChat.cache.whois = $whois;
|
||||
mChat.cache.userlist = $userlist;
|
||||
if (mChat.customPage) {
|
||||
mChat.cached('refresh-pending').hide();
|
||||
mChat.cached('refresh-explain').show();
|
||||
if (data.playSound) {
|
||||
mChat.sound('add');
|
||||
mChat.titleAlert();
|
||||
playSound = false;
|
||||
}
|
||||
mChat.messageIds.push($message.data('mchat-id'));
|
||||
setTimeout(function() {
|
||||
var $container = mChat.cached('messages');
|
||||
var data = {
|
||||
container: $container,
|
||||
message: $message,
|
||||
add: function() {
|
||||
if (mChat.messageTop) {
|
||||
this.container.prepend(this.message);
|
||||
} else {
|
||||
this.container.append(this.message);
|
||||
}
|
||||
},
|
||||
show: function() {
|
||||
var scrollTop, scrollHeight = mChat.messageTop ? 0 : $container.get(0).scrollHeight;
|
||||
if (mChat.messageTop && (scrollTop = this.container.scrollTop()) > 0) {
|
||||
this.message.show();
|
||||
this.container.scrollTop(scrollTop + this.message.outerHeight());
|
||||
} else {
|
||||
this.message.css('opacity', 0).slideDown('fast').animate({opacity: 1}, {duration: 'fast', queue: false});
|
||||
}
|
||||
if (!mChat.messageTop && this.container.scrollTop() >= scrollHeight - this.container.height()) {
|
||||
this.container.animate({
|
||||
scrollTop: scrollHeight,
|
||||
easing: 'swing',
|
||||
duration: 'slow'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
$(mChat).trigger('mchat_add_message_animate_before', [data]);
|
||||
data.add();
|
||||
data.show();
|
||||
}, i * data.delay);
|
||||
if (mChat.editDeleteLimit && $message.data('mchat-edit-delete-limit') && $message.find('[data-mchat-action="edit"], [data-mchat-action="del"]').length > 0) {
|
||||
var id = $message.prop('id');
|
||||
setTimeout(function() {
|
||||
$('#' + id).find('[data-mchat-action="edit"], [data-mchat-action="del"]').fadeOut(function() {
|
||||
$(this).closest('li').remove();
|
||||
});
|
||||
}, mChat.editDeleteLimit);
|
||||
}
|
||||
mChat.startRelativeTimeUpdate($message);
|
||||
});
|
||||
},
|
||||
updateMessages: function($messages) {
|
||||
var soundPlayed = false;
|
||||
var playSound = true;
|
||||
$messages.each(function() {
|
||||
var $newMessage = $(this);
|
||||
var $oldMessage = $('#mchat-message-' + $newMessage.data('mchat-id'));
|
||||
mChat.stopRelativeTimeUpdate($oldMessage);
|
||||
mChat.startRelativeTimeUpdate($newMessage);
|
||||
$oldMessage.fadeOut(function() {
|
||||
$oldMessage.replaceWith($newMessage.hide().fadeIn());
|
||||
var data = {
|
||||
newMessage: $newMessage,
|
||||
oldMessage: $('#mchat-message-' + $newMessage.data('mchat-id')),
|
||||
playSound: playSound
|
||||
};
|
||||
$(mChat).trigger('mchat_edit_message_before', [data]);
|
||||
mChat.stopRelativeTimeUpdate(data.oldMessage);
|
||||
mChat.startRelativeTimeUpdate(data.newMessage);
|
||||
data.oldMessage.fadeOut(function() {
|
||||
data.oldMessage.replaceWith(data.newMessage.hide().fadeIn());
|
||||
});
|
||||
if (!soundPlayed) {
|
||||
soundPlayed = true;
|
||||
if (data.playSound) {
|
||||
mChat.sound('edit');
|
||||
playSound = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
removeMessages: function(ids) {
|
||||
var soundPlayed = false;
|
||||
var playSound = true;
|
||||
$.each(ids, function(i, id) {
|
||||
var index = 0;
|
||||
while ((index = $.inArray(id, mChat.messageIds, index)) !== -1) {
|
||||
mChat.messageIds.splice(index, 1);
|
||||
var $message = $('#mchat-message-' + id);
|
||||
mChat.stopRelativeTimeUpdate($message);
|
||||
$message.fadeOut(function() {
|
||||
$message.remove();
|
||||
});
|
||||
if (!soundPlayed) {
|
||||
soundPlayed = true;
|
||||
if (mChat.messageIds.removeValue(id)) {
|
||||
var data = {
|
||||
id: id,
|
||||
message: $('#mchat-message-' + id),
|
||||
playSound: playSound
|
||||
};
|
||||
$(mChat).trigger('mchat_delete_message_before', [data]);
|
||||
mChat.stopRelativeTimeUpdate(data.message);
|
||||
(function($message) {
|
||||
$message.fadeOut(function() {
|
||||
$message.remove();
|
||||
});
|
||||
})(data.message);
|
||||
if (data.playSound) {
|
||||
mChat.sound('del');
|
||||
playSound = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -318,7 +467,7 @@ jQuery(function($) {
|
||||
},
|
||||
relativeTimeUpdate: function($time) {
|
||||
var minutesAgo = $time.data('mchat-minutes-ago') + 1;
|
||||
var langMinutesAgo = mChat.minutesAgo[minutesAgo];
|
||||
var langMinutesAgo = mChat.lang.minutesAgo[minutesAgo];
|
||||
if (langMinutesAgo) {
|
||||
$time.text(langMinutesAgo).data('mchat-minutes-ago', minutesAgo);
|
||||
} else {
|
||||
@@ -335,14 +484,14 @@ jQuery(function($) {
|
||||
},
|
||||
countDown: function() {
|
||||
mChat.sessionTime -= 1;
|
||||
mChat.cached('session').html(mChat.sessEnds.format({timeleft: mChat.timeLeft(mChat.sessionTime)}));
|
||||
mChat.cached('session').html(mChat.lang.sessEnds.format({timeleft: mChat.timeLeft(mChat.sessionTime)}));
|
||||
if (mChat.sessionTime < 1) {
|
||||
mChat.endSession();
|
||||
}
|
||||
},
|
||||
pauseSession: function() {
|
||||
clearInterval(mChat.refreshInterval);
|
||||
if (mChat.userTimeout) {
|
||||
if (mChat.timeout) {
|
||||
clearInterval(mChat.sessionCountdown);
|
||||
}
|
||||
if (mChat.whoisRefresh) {
|
||||
@@ -353,10 +502,10 @@ jQuery(function($) {
|
||||
if (!mChat.archivePage) {
|
||||
clearInterval(mChat.refreshInterval);
|
||||
mChat.refreshInterval = setInterval(mChat.refresh, mChat.refreshTime);
|
||||
if (mChat.userTimeout) {
|
||||
mChat.sessionTime = mChat.userTimeout / 1000;
|
||||
if (mChat.timeout) {
|
||||
mChat.sessionTime = mChat.timeout / 1000;
|
||||
clearInterval(mChat.sessionCountdown);
|
||||
mChat.cached('session').html(mChat.sessEnds.format({timeleft: mChat.timeLeft(mChat.sessionTime)}));
|
||||
mChat.cached('session').html(mChat.lang.sessEnds.format({timeleft: mChat.timeLeft(mChat.sessionTime)}));
|
||||
mChat.sessionCountdown = setInterval(mChat.countDown, 1000);
|
||||
}
|
||||
if (mChat.whoisRefresh) {
|
||||
@@ -365,15 +514,15 @@ jQuery(function($) {
|
||||
}
|
||||
mChat.cached('status-ok').show();
|
||||
mChat.cached('status-load', 'status-error', 'status-paused').hide();
|
||||
mChat.cached('refresh-text').html(mChat.refreshYes);
|
||||
mChat.cached('refresh-text').html(mChat.lang.refreshYes);
|
||||
}
|
||||
},
|
||||
endSession: function(skipUpdateWhois) {
|
||||
clearInterval(mChat.refreshInterval);
|
||||
mChat.refreshInterval = false;
|
||||
if (mChat.userTimeout) {
|
||||
if (mChat.timeout) {
|
||||
clearInterval(mChat.sessionCountdown);
|
||||
mChat.cached('session').html(mChat.sessOut);
|
||||
mChat.cached('session').html(mChat.lang.sessOut);
|
||||
}
|
||||
if (mChat.whoisRefresh) {
|
||||
clearInterval(mChat.whoisInterval);
|
||||
@@ -383,23 +532,31 @@ jQuery(function($) {
|
||||
}
|
||||
mChat.cached('status-load', 'status-ok', 'status-error').hide();
|
||||
mChat.cached('status-paused').show();
|
||||
mChat.cached('refresh-text').html(mChat.refreshNo);
|
||||
mChat.cached('refresh-text').html(mChat.lang.refreshNo);
|
||||
},
|
||||
pauseStart: function() {
|
||||
mChat.isPaused = true;
|
||||
mChat.cached('refresh-text').html(mChat.refreshNo);
|
||||
mChat.cached('refresh-text').html(mChat.lang.refreshNo);
|
||||
mChat.cached('status-load', 'status-ok', 'status-error').hide();
|
||||
mChat.cached('status-paused').show();
|
||||
},
|
||||
pauseEnd: function() {
|
||||
mChat.cached('refresh-text').html(mChat.refreshYes);
|
||||
mChat.cached('refresh-text').html(mChat.lang.refreshYes);
|
||||
mChat.cached('status-load', 'status-error', 'status-paused').hide();
|
||||
mChat.cached('status-ok').show();
|
||||
mChat.isPaused = false;
|
||||
},
|
||||
updateCharCount: function() {
|
||||
var count = mChat.cached('input').val().length;
|
||||
var charCount = mChat.lang.charCount.format({current: count, max: mChat.mssgLngth});
|
||||
var $elem = mChat.cached('character-count').html(charCount).toggleClass('hidden', count === 0);
|
||||
if (mChat.mssgLngth) {
|
||||
$elem.toggleClass('error', count > mChat.mssgLngth);
|
||||
}
|
||||
},
|
||||
mention: function() {
|
||||
var $container = $(this).closest('.mchat-message');
|
||||
var username = mChat.entityDecode($container.data('mchat-username'));
|
||||
var username = $container.data('mchat-username');
|
||||
var usercolor = $container.data('mchat-usercolor');
|
||||
if (usercolor) {
|
||||
username = '[b][color=' + usercolor + ']' + username + '[/color][/b]';
|
||||
@@ -410,32 +567,19 @@ jQuery(function($) {
|
||||
},
|
||||
quote: function() {
|
||||
var $container = $(this).closest('.mchat-message');
|
||||
var username = mChat.entityDecode($container.data('mchat-username'));
|
||||
var quote = mChat.entityDecode($container.data('mchat-message'));
|
||||
var username = $container.data('mchat-username');
|
||||
var quote = $container.data('mchat-message');
|
||||
insert_text('[quote="' + username + '"] ' + quote + '[/quote]');
|
||||
},
|
||||
like: function() {
|
||||
var $container = $(this).closest('.mchat-message');
|
||||
var username = mChat.entityDecode($container.data('mchat-username'));
|
||||
var quote = mChat.entityDecode($container.data('mchat-message'));
|
||||
insert_text(mChat.likes + '[quote="' + username + '"] ' + quote + '[/quote]');
|
||||
var username = $container.data('mchat-username');
|
||||
var quote = $container.data('mchat-message');
|
||||
insert_text('[i]' + mChat.lang.likes + '[/i][quote="' + username + '"] ' + quote + '[/quote]');
|
||||
},
|
||||
ip: function() {
|
||||
popup(this.href, 750, 500);
|
||||
},
|
||||
entityDecode: function(text) {
|
||||
var s = decodeURIComponent(text.toString().replace(/\+/g, ' '));
|
||||
s = s.replace(/</g, '<');
|
||||
s = s.replace(/>/g, '>');
|
||||
s = s.replace(/:/g, ':');
|
||||
s = s.replace(/./g, '.');
|
||||
s = s.replace(/&/g, '&');
|
||||
s = s.replace(/"/g, "'");
|
||||
return s;
|
||||
},
|
||||
inputMessageLength: function() {
|
||||
return $.trim(mChat.cached('input').val()).replace(/\[\/?[^\[\]]+\]/g, '').length;
|
||||
},
|
||||
cached: function() {
|
||||
return $($.map(arguments, function(name) {
|
||||
if (!mChat.cache[name]) {
|
||||
@@ -449,8 +593,6 @@ jQuery(function($) {
|
||||
});
|
||||
|
||||
mChat.cache = {};
|
||||
mChat.cached('confirm').detach().show();
|
||||
|
||||
mChat.messageIds = mChat.cached('messages').children().map(function() {
|
||||
return $(this).data('mchat-id');
|
||||
}).get();
|
||||
@@ -469,44 +611,43 @@ jQuery(function($) {
|
||||
mChat.cached('messages').animate({scrollTop: mChat.cached('messages')[0].scrollHeight, easing: 'swing', duration: 'slow'});
|
||||
}
|
||||
|
||||
if (!mChat.cached('user-sound').prop('checked')) {
|
||||
Cookies.set('mchat_no_sound', 'yes');
|
||||
}
|
||||
|
||||
mChat.cached('user-sound').prop('checked', mChat.playSound && !Cookies.get('mchat_no_sound')).change(function() {
|
||||
mChat.cached('user-sound').prop('checked', mChat.playSound && !localStorage.getItem(mChat.cookie + 'mchat_no_sound')).change(function() {
|
||||
if (this.checked) {
|
||||
Cookies.remove('mchat_no_sound');
|
||||
localStorage.removeItem(mChat.cookie + 'mchat_no_sound');
|
||||
} else {
|
||||
Cookies.set('mchat_no_sound', 'yes');
|
||||
localStorage.setItem(mChat.cookie + 'mchat_no_sound', 'yes');
|
||||
}
|
||||
});
|
||||
}).change();
|
||||
|
||||
$.each(mChat.removeBBCodes.split('|'), function(i, bbcode) {
|
||||
$('#format-buttons .bbcode-' + bbcode).remove();
|
||||
var bbCodeClass = '.bbcode-' + bbcode.replaceMany({
|
||||
'=': '-',
|
||||
'*': 'asterisk'
|
||||
});
|
||||
$('#format-buttons').find(bbCodeClass).remove();
|
||||
});
|
||||
|
||||
var $colourPalette = $('#colour_palette');
|
||||
$colourPalette.appendTo($colourPalette.parent()).wrap('<div id="mchat-colour"></div>').show();
|
||||
$('#bbpalette,#abbc3_bbpalette').prop('onclick', null).attr('data-mchat-toggle', 'colour');
|
||||
$('#bbpalette,#abbc3_bbpalette,#color_wheel').prop('onclick', null).attr('data-mchat-toggle', 'colour');
|
||||
|
||||
$.each(['userlist', 'smilies', 'bbcodes', 'colour'], function(i, elem) {
|
||||
if (Cookies.get('mchat_show_' + elem)) {
|
||||
if (localStorage.getItem(mChat.cookie + 'mchat_show_' + elem)) {
|
||||
mChat.cached(elem).toggle();
|
||||
}
|
||||
});
|
||||
|
||||
if (mChat.cached('input').is('input')) {
|
||||
mChat.cached('form').keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
mChat.add();
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
});
|
||||
}
|
||||
mChat.isTextarea = mChat.cached('input').is('textarea');
|
||||
mChat.cached('form').submit(function(e){
|
||||
e.preventDefault();
|
||||
}).keypress(function(e) {
|
||||
if ((e.which == 10 || e.which == 13) && (!mChat.isTextarea || e.ctrlKey || e.metaKey) && mChat.cached('input').is(e.target)) {
|
||||
mChat.add();
|
||||
}
|
||||
});
|
||||
|
||||
if (mChat.pause) {
|
||||
mChat.cached('form').keyup(function(e) {
|
||||
mChat.cached('form').on('input', function() {
|
||||
if (mChat.refreshInterval !== false) {
|
||||
var val = mChat.cached('input').val();
|
||||
if (mChat.isPaused && val === '') {
|
||||
@@ -519,21 +660,12 @@ jQuery(function($) {
|
||||
}
|
||||
|
||||
if (mChat.showCharCount) {
|
||||
mChat.cached('form').keyup(function(e) {
|
||||
var count = mChat.inputMessageLength();
|
||||
var $elem = mChat.cached('character-count');
|
||||
$elem.html(mChat.charCount.format({current: count, max: mChat.mssgLngth})).css('visibility', count > 0 ? 'visible' : 'hidden');
|
||||
if (mChat.mssgLngth) {
|
||||
$elem.toggleClass('error', count > mChat.mssgLngth);
|
||||
}
|
||||
});
|
||||
mChat.cached('form').on('input', mChat.updateCharCount);
|
||||
}
|
||||
|
||||
mChat.cached('form').one('keypress', function() {
|
||||
mChat.cached('input').autoGrowInput({
|
||||
minWidth: mChat.cached('input').width(),
|
||||
maxWidth: mChat.cached('form').width() - (mChat.cached('input').outerWidth(true) - mChat.cached('input').width())
|
||||
});
|
||||
mChat.cached('input').autogrow({
|
||||
vertical: false,
|
||||
horizontal: true
|
||||
});
|
||||
}
|
||||
|
||||
@@ -543,13 +675,34 @@ jQuery(function($) {
|
||||
mChat.pageIsUnloading = true;
|
||||
});
|
||||
|
||||
mChat.cached('colour').find('.colour-palette').on('click', 'a', function(e) {
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
var $this = $(this);
|
||||
var newColor = $this.data('color');
|
||||
if (localStorage.getItem(mChat.cookie + 'mchat_color') === newColor) {
|
||||
localStorage.removeItem(mChat.cookie + 'mchat_color');
|
||||
} else {
|
||||
localStorage.setItem(mChat.cookie + 'mchat_color', newColor);
|
||||
mChat.cached('colour').find('.colour-palette a').removeClass('remember-color');
|
||||
}
|
||||
$this.toggleClass('remember-color');
|
||||
}
|
||||
});
|
||||
|
||||
var color = localStorage.getItem(mChat.cookie + 'mchat_color');
|
||||
if (color) {
|
||||
mChat.cached('colour').find('.colour-palette a[data-color="' + color + '"]').addClass('remember-color');
|
||||
}
|
||||
|
||||
$('#phpbb').on('click', '[data-mchat-action]', function(e) {
|
||||
e.preventDefault();
|
||||
var action = $(this).data('mchat-action');
|
||||
mChat[action].call(this);
|
||||
e.preventDefault();
|
||||
}).on('click', '[data-mchat-toggle]', function(e) {
|
||||
e.preventDefault();
|
||||
var elem = $(this).data('mchat-toggle');
|
||||
mChat.toggle(elem);
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
<!-- IF MCHAT_IS_ARCHIVE_PAGE or not (MCHAT_ALLOW_USE and S_BBCODE_ALLOWED) -->
|
||||
<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js -->
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- INCLUDEJS javascript/jquery.autogrow-textarea.js -->
|
||||
<!-- INCLUDEJS javascript/jquery.titlealert.min.js -->
|
||||
<!-- INCLUDEJS javascript/mchat.js -->
|
||||
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
var form_name = 'postform';
|
||||
@@ -9,6 +17,8 @@
|
||||
{mchaturl.ACTION}: '{mchaturl.URL}'<!-- IF not mchaturl.IS_LAST -->,<!-- ENDIF -->
|
||||
<!-- END mchaturl -->
|
||||
},
|
||||
page : '{MCHAT_PAGE}',
|
||||
cookie : '{A_COOKIE_NAME}',
|
||||
customPage : <!-- IF MCHAT_IS_CUSTOM_PAGE -->true<!-- ELSE -->false<!-- ENDIF -->,
|
||||
archivePage : <!-- IF MCHAT_IS_ARCHIVE_PAGE -->true<!-- ELSE -->false<!-- ENDIF -->,
|
||||
pause : <!-- IF MCHAT_PAUSE_ON_INPUT -->true<!-- ELSE -->false<!-- ENDIF -->,
|
||||
@@ -22,31 +32,33 @@
|
||||
// Limits & timeouts
|
||||
refreshTime : {MCHAT_REFRESH_JS},
|
||||
whoisRefresh : {MCHAT_WHOIS_REFRESH},
|
||||
userTimeout : {MCHAT_USER_TIMEOUT},
|
||||
timeout : {MCHAT_TIMEOUT},
|
||||
mssgLngth : {MCHAT_MESSAGE_LNGTH},
|
||||
editDeleteLimit : {MCHAT_EDIT_DELETE_LIMIT},
|
||||
logId : {MCHAT_LOG_ID},
|
||||
removeBBCodes : '{A_MCHAT_DISALLOWED_BBCODES}',
|
||||
|
||||
// Language
|
||||
minutesAgo : {
|
||||
<!-- BEGIN mchattime -->
|
||||
{mchattime.KEY}: '{mchattime.A_LANG}'<!-- IF not mchattime.IS_LAST -->,<!-- ENDIF -->
|
||||
<!-- END mchattime -->
|
||||
},
|
||||
newMessageAlert : '{LA_MCHAT_NEW_CHAT}',
|
||||
noMessageInput : '{LA_MCHAT_NOMESSAGEINPUT}',
|
||||
noMessages : '{LA_MCHAT_NOMESSAGE}',
|
||||
editInfo : '{LA_MCHAT_EDITINFO}',
|
||||
noAccess : '{LA_NO_AUTH_OPERATION}',
|
||||
flood : '{LA_MCHAT_FLOOD}',
|
||||
delConfirm : '{LA_MCHAT_DELCONFIRM}',
|
||||
sessOut : '{LA_MCHAT_SESSION_OUT}',
|
||||
sessEnds : '{LA_MCHAT_SESSION_ENDS_JS}',
|
||||
refreshYes : '{A_MCHAT_REFRESH_YES}',
|
||||
refreshNo : '{LA_MCHAT_REFRESH_NO}',
|
||||
charCount : '<!-- IF MCHAT_MESSAGE_LNGTH -->{LA_MCHAT_CHARACTER_COUNT_LIMIT}<!-- ELSE -->{LA_MCHAT_CHARACTER_COUNT}<!-- ENDIF -->',
|
||||
mssgLngthLong : '{A_MCHAT_MESS_LONG}',
|
||||
likes : '{LA_MCHAT_LIKES}'
|
||||
lang: {
|
||||
minutesAgo : {
|
||||
<!-- BEGIN mchattime -->
|
||||
{mchattime.KEY}: '{mchattime.A_LANG}'<!-- IF not mchattime.IS_LAST -->,<!-- ENDIF -->
|
||||
<!-- END mchattime -->
|
||||
},
|
||||
err : '{LA_ERROR}',
|
||||
parserErr : '{LA_AJAX_ERROR_TEXT_PARSERERROR}',
|
||||
newMessageAlert : '{LA_MCHAT_NEW_CHAT}',
|
||||
noMessageInput : '{LA_MCHAT_NOMESSAGEINPUT}',
|
||||
editInfo : '{LA_MCHAT_EDITINFO}',
|
||||
delConfirm : '{LA_MCHAT_DELCONFIRM}',
|
||||
sessOut : '{LA_MCHAT_SESSION_OUT}',
|
||||
sessEnds : '{LA_MCHAT_SESSION_ENDS_JS}',
|
||||
refreshYes : '{A_MCHAT_REFRESH_YES}',
|
||||
refreshNo : '{LA_MCHAT_REFRESH_NO}',
|
||||
charCount : '<!-- IF MCHAT_MESSAGE_LNGTH -->{LA_MCHAT_CHARACTER_COUNT_LIMIT}<!-- ELSE -->{LA_MCHAT_CHARACTER_COUNT}<!-- ENDIF -->',
|
||||
mssgLngthLong : '{A_MCHAT_MESS_LONG}',
|
||||
likes : '{LA_MCHAT_LIKES}'
|
||||
}
|
||||
};
|
||||
// ]]>
|
||||
</script>
|
||||
@@ -1 +1 @@
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link" href="{U_MCHAT}" title="{L_MCHAT_TITLE}" role="menuitem">{L_MCHAT_TITLE}</a></li>
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link" href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" class="mchat-nav-link mchat-nav-link-title" role="menuitem">{MCHAT_TITLE}</a></li>
|
||||
|
||||
@@ -8,32 +8,32 @@
|
||||
*/
|
||||
|
||||
.icon-mchat {
|
||||
position: relative;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon-mchat:after {
|
||||
content: '\f086';
|
||||
font-family: 'FontAwesome';
|
||||
width: 18px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
height: 14px;
|
||||
margin-top: -7px;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
vertical-align: baseline;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
text-indent: 0;
|
||||
pointer-events: none;
|
||||
content: '\f086';
|
||||
font-family: 'FontAwesome';
|
||||
width: 18px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
height: 14px;
|
||||
margin-top: -7px;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
vertical-align: baseline;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
text-indent: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.navbar .nav-tabs .mchat .nav-link {
|
||||
position: relative;
|
||||
text-indent: 999px;
|
||||
text-indent: 999px;
|
||||
width: 15px;
|
||||
padding: 0 8px;
|
||||
overflow: hidden;
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
.navbar .nav-tabs .mchat .nav-link:after {
|
||||
content: '\f086';
|
||||
font-family: 'FontAwesome';
|
||||
font-family: 'FontAwesome';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
margin-top: -7.5px;
|
||||
@@ -51,18 +51,18 @@
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
text-indent: 0;
|
||||
text-align: center;
|
||||
text-align: center;
|
||||
font-size: 15px;
|
||||
left:8px
|
||||
}
|
||||
|
||||
.rtl .navbar .nav-tabs .mchat .nav-link {
|
||||
padding-left: 12px;
|
||||
padding-left: 12px;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
.rtl .navbar .nav-tabs .mchat .nav-link:after {
|
||||
left: auto;
|
||||
left: auto;
|
||||
right: 8px;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->
|
||||
@@ -1 +1 @@
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link" href="{U_MCHAT}" title="{L_MCHAT_TITLE}" role="menuitem">{L_MCHAT_TITLE}</a></li>
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link" href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" class="mchat-nav-link mchat-nav-link-title" role="menuitem">{MCHAT_TITLE}</a></li>
|
||||
|
||||
@@ -65,7 +65,3 @@
|
||||
left: auto;
|
||||
right: 8px;
|
||||
}
|
||||
|
||||
.mchat-button:before {
|
||||
background-image: url("./images/message_icons.png");
|
||||
}
|
||||
|
||||
3
styles/canvas/template/event/overall_footer_after.html
Normal file
3
styles/canvas/template/event/overall_footer_after.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<!-- IF MCHAT_ALLOW_USE -->
|
||||
<script>$.sceditor = false;</script>
|
||||
<!-- ENDIF -->
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- INCLUDECSS @dmzx_mchat/mchat.css -->
|
||||
<!-- INCLUDECSS @dmzx_mchat/mchat_custom.css -->
|
||||
28
styles/canvas/theme/mchat_custom.css
Normal file
28
styles/canvas/theme/mchat_custom.css
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
*
|
||||
* @package phpBB Extension - mChat
|
||||
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
|
||||
* @copyright (c) 2016 kasimi
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
ul#mchat-messages.topiclist li {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.mchat-text {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
ul.mchat-buttons > li {
|
||||
background: none !important;
|
||||
}
|
||||
|
||||
#mchat-panel.cp-mini .button2 {
|
||||
float: none;
|
||||
}
|
||||
|
||||
#mchat-panel #st_editor_buttons {
|
||||
display: block !important;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link" href="{U_MCHAT}" title="{L_MCHAT_TITLE}" role="menuitem">{L_MCHAT_TITLE}</a></li>
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link" href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" class="mchat-nav-link mchat-nav-link-title" role="menuitem">{MCHAT_TITLE}</a></li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link" href="{U_MCHAT}" title="{L_MCHAT_TITLE}" role="menuitem">{L_MCHAT_TITLE}</a></li>
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link" href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" class="mchat-nav-link mchat-nav-link-title" role="menuitem">{MCHAT_TITLE}</a></li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<li class="small-icon icon-mchat" data-last-responsive="true"><a href="{U_MCHAT}" title="{L_MCHAT_TITLE}" role="menuitem"><span>{L_MCHAT_TITLE}</span></a></li>
|
||||
<li class="small-icon icon-mchat" data-last-responsive="true"><a href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" class="mchat-nav-link-title" role="menuitem"><span class="mchat-nav-link">{MCHAT_TITLE}</span></a></li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<li class="small-icon icon-mchat"><a href="{U_MCHAT}" title="{L_MCHAT_TITLE}" role="menuitem">{L_MCHAT_TITLE}</a></li>
|
||||
<li class="small-icon icon-mchat"><a href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" class="mchat-nav-link mchat-nav-link-title" role="menuitem">{MCHAT_TITLE}</a></li>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
font-family: 'FontAwesome';
|
||||
}
|
||||
|
||||
#mchat-panel.cp-mini {
|
||||
#mchat-body .cp-mini {
|
||||
background-color: #E5E4E3;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = TRUE -->
|
||||
@@ -1 +1 @@
|
||||
<li class="small-icon icon-mchat"><a href="{U_MCHAT}" title="{L_MCHAT_TITLE}" role="menuitem">{L_MCHAT_TITLE}</a></li>
|
||||
<li class="small-icon icon-mchat"><a href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" class="mchat-nav-link mchat-nav-link-title" role="menuitem">{MCHAT_TITLE}</a></li>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -20,7 +20,3 @@
|
||||
content: '';
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.mchat-button:before {
|
||||
background-image: url("./images/message_icons.png");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<!-- IF MCHAT_CUSTOM_INCLUDE -->
|
||||
<!-- INCLUDE mchat_body.html -->
|
||||
<!-- ENDIF -->
|
||||
@@ -0,0 +1 @@
|
||||
<!-- DEFINE $MCHAT_USE_WHITE_MESSAGE_ICONS = FALSE -->
|
||||
@@ -3,5 +3,5 @@
|
||||
</div>
|
||||
<div class="stat-block online-list mchat-stats-index">
|
||||
<h3><a href="<!-- IF MCHAT_CUSTOM_PAGE and not MCHAT_INDEX -->{U_MCHAT}<!-- ENDIF -->#mChat">{L_MCHAT_WHO_IS_CHATTING}</a></h3>
|
||||
<p>{MCHAT_USERS_COUNT} {MCHAT_ONLINE_EXPLAIN}<br />{MCHAT_USERS_LIST}
|
||||
<p>{MCHAT_USERS_TOTAL} {MCHAT_ONLINE_EXPLAIN}<br />{MCHAT_USERS_LIST}
|
||||
<!-- ENDIF -->
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<!-- IF MCHAT_IS_INDEX or MCHAT_IS_ARCHIVE_PAGE or MCHAT_IS_CUSTOM_PAGE -->
|
||||
<div>{MCHAT_DISPLAY_NAME} © {L_POST_BY_AUTHOR} {MCHAT_AUTHOR_HOMEPAGES}</div>
|
||||
<br />
|
||||
<span>{MCHAT_DISPLAY_NAME} © {L_POST_BY_AUTHOR} {MCHAT_AUTHOR_HOMEPAGES}</span>
|
||||
<!-- ENDIF -->
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<!-- IF MCHAT_CUSTOM_PAGE and MCHAT_NAVBAR_LINK and MCHAT_ALLOW_VIEW -->
|
||||
<!-- IF MCHAT_CUSTOM_PAGE and MCHAT_NAVBAR_LINK -->
|
||||
<!-- INCLUDE mchat_navlink.html -->
|
||||
<!-- ENDIF -->
|
||||
|
||||
@@ -2,16 +2,11 @@
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF MCHAT_IS_ARCHIVE_PAGE or not (MCHAT_ALLOW_USE and S_BBCODE_ALLOWED) -->
|
||||
<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/editor.js -->
|
||||
<!-- ENDIF -->
|
||||
<!-- INCLUDEJS javascript/jquery.auto-grow-input.js -->
|
||||
<!-- INCLUDEJS javascript/jquery.titlealert.min.js -->
|
||||
<!-- INCLUDEJS javascript/js.cookie-2.0.4.min.js -->
|
||||
<!-- INCLUDEJS javascript/mchat.js -->
|
||||
<!-- INCLUDE mchat_script_data.html -->
|
||||
|
||||
<!-- IF MCHAT_IS_ARCHIVE_PAGE and (.pagination or MCHAT_TOTAL_MESSAGES) -->
|
||||
<div class="action-bar bar-top">
|
||||
<!-- EVENT dmzx_mchat_action_bar_top_before -->
|
||||
<div class="pagination">
|
||||
{MCHAT_TOTAL_MESSAGES}
|
||||
<!-- IF .pagination -->
|
||||
@@ -20,16 +15,17 @@
|
||||
• {PAGE_NUMBER}
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
<!-- EVENT dmzx_mchat_action_bar_top_after -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- EVENT dmzx_mchat_body_before -->
|
||||
<!-- EVENT dmzx_mchat_before -->
|
||||
|
||||
<!-- IF MCHAT_IS_COLLAPSIBLE -->
|
||||
<a class="category<!-- IF S_MCHAT_HIDDEN --> hidden-category<!-- ENDIF --> mchat-category"></a>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<div class="forabg">
|
||||
<div class="forabg mchat-wrapper">
|
||||
<a id="mChat"></a>
|
||||
<div class="inner">
|
||||
<ul class="topiclist">
|
||||
@@ -46,9 +42,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="mchat-body" class="postbody<!-- IF MCHAT_IS_COLLAPSIBLE --> collapsible<!-- ENDIF -->">
|
||||
<!-- INCLUDE mchat_script_data.html -->
|
||||
<!-- EVENT dmzx_mchat_body_before -->
|
||||
|
||||
<div id="mchat-body"<!-- IF MCHAT_IS_COLLAPSIBLE --> class="collapsible"<!-- ENDIF -->>
|
||||
<!-- IF not MCHAT_SOUND_DISABLED -->
|
||||
<audio id="mchat-sound-add" class="hidden" src="{EXT_URL}sounds/add.mp3" preload="auto"></audio>
|
||||
<audio id="mchat-sound-edit" class="hidden" src="{EXT_URL}sounds/edit.mp3" preload="auto"></audio>
|
||||
@@ -58,8 +54,10 @@
|
||||
|
||||
<div id="mchat-confirm" class="hidden">
|
||||
<h3>{L_CONFIRM}</h3>
|
||||
<p></p>
|
||||
<textarea></textarea>
|
||||
<div class="mchat-confirm-fields">
|
||||
<p></p>
|
||||
<textarea></textarea>
|
||||
</div>
|
||||
<fieldset class="submit-buttons">
|
||||
<input type="button" name="confirm" value="{L_MCHAT_OK}" class="button2" />
|
||||
<input type="button" name="cancel" value="{L_CANCEL}" class="button2" />
|
||||
@@ -73,6 +71,8 @@
|
||||
</ul>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- 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 -->>
|
||||
<!-- IF .mchatrow -->
|
||||
<!-- INCLUDE mchat_messages.html -->
|
||||
@@ -80,15 +80,22 @@
|
||||
<li class="row mchat-static mchat-no-messages">{L_MCHAT_NOMESSAGE}</li>
|
||||
<!-- ENDIF -->
|
||||
</ul>
|
||||
|
||||
<!-- EVENT dmzx_mchat_messages_container_after -->
|
||||
</div>
|
||||
|
||||
<!-- INCLUDE mchat_panel.html -->
|
||||
</div>
|
||||
|
||||
<!-- EVENT dmzx_mchat_body_after -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- EVENT dmzx_mchat_after -->
|
||||
|
||||
<!-- IF MCHAT_IS_ARCHIVE_PAGE -->
|
||||
<div class="action-bar bottom">
|
||||
<!-- EVENT dmzx_mchat_action_bar_bottom_before -->
|
||||
<div class="pagination">
|
||||
{MCHAT_TOTAL_MESSAGES}
|
||||
<!-- IF .pagination -->
|
||||
@@ -97,6 +104,7 @@
|
||||
• {PAGE_NUMBER}
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
<!-- EVENT dmzx_mchat_action_bar_top_after -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<dl class="row-item">
|
||||
<dt><!-- IF MCHAT_IS_ARCHIVE_PAGE -->{L_MCHAT_ARCHIVE_PAGE}<!-- ELSEIF MCHAT_CUSTOM_PAGE --><a href="{U_MCHAT_CUSTOM_PAGE}" title="{L_MCHAT_TITLE}">{L_MCHAT_TITLE}</a><!-- ELSE -->{L_MCHAT_TITLE}<!-- ENDIF --></dt>
|
||||
<dd style="border:none"> </dd>
|
||||
<dd></dd>
|
||||
</dl>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<!-- EVENT dmzx_mchat_messages_before -->
|
||||
<!-- EVENT dmzx_mchat_messages_define_icons -->
|
||||
|
||||
<!-- BEGIN mchatrow -->
|
||||
<li id="mchat-message-{mchatrow.MCHAT_MESSAGE_ID}" class="row mchat-message" data-mchat-id="{mchatrow.MCHAT_MESSAGE_ID}" data-mchat-username="{mchatrow.MCHAT_USERNAME}"<!-- IF mchatrow.MCHAT_USERNAME_COLOR --> data-mchat-usercolor="{mchatrow.MCHAT_USERNAME_COLOR}"<!-- ENDIF --> data-mchat-message="{mchatrow.MCHAT_MESSAGE_EDIT}" data-mchat-message-time="{mchatrow.MCHAT_MESSAGE_TIME}" data-mchat-edit-time="{mchatrow.MCHAT_EDIT_TIME}"<!-- IF MCHAT_EDIT_DELETE_LIMIT and not MCHAT_EDIT_DELETE_IGNORE and (mchatrow.MCHAT_ALLOW_EDIT or mchatrow.MCHAT_ALLOW_DEL) --> data-mchat-edit-delete-limit="1"<!-- ENDIF -->>
|
||||
<li id="mchat-message-{mchatrow.MCHAT_MESSAGE_ID}" class="row mchat-message<!-- IF mchatrow.MCHAT_IS_NOTIFICATION --> mchat-notification-message<!-- ENDIF -->" data-mchat-id="{mchatrow.MCHAT_MESSAGE_ID}" data-mchat-username="{mchatrow.MCHAT_USERNAME}"<!-- IF mchatrow.MCHAT_USERNAME_COLOR --> data-mchat-usercolor="{mchatrow.MCHAT_USERNAME_COLOR}"<!-- ENDIF --> data-mchat-message="{mchatrow.MCHAT_MESSAGE_EDIT}" data-mchat-message-time="{mchatrow.MCHAT_MESSAGE_TIME}"<!-- IF MCHAT_EDIT_DELETE_LIMIT and not MCHAT_EDIT_DELETE_IGNORE and (mchatrow.MCHAT_ALLOW_EDIT or mchatrow.MCHAT_ALLOW_DEL) --> data-mchat-edit-delete-limit="1"<!-- ENDIF --> <!-- EVENT dmzx_mchat_message_attributes -->>
|
||||
<!-- IF S_MCHAT_AVATARS -->
|
||||
<div class="mchat-avatar">
|
||||
<!-- IF mchatrow.U_VIEWPROFILE --><a href="{mchatrow.U_VIEWPROFILE}" title="{L_READ_PROFILE}"><!-- ENDIF -->
|
||||
@@ -14,3 +17,5 @@
|
||||
</div>
|
||||
</li>
|
||||
<!-- END mchatrow -->
|
||||
|
||||
<!-- EVENT dmzx_mchat_messages_after -->
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!-- IF not S_IS_BOT -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_MENTION = not mchatrow.MCHAT_IS_POSTER and not MCHAT_IS_ARCHIVE_PAGE -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_QUOTE = MCHAT_ALLOW_QUOTE and not MCHAT_IS_ARCHIVE_PAGE and not mchatrow.MCHAT_IS_POSTER -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_LIKE = MCHAT_ALLOW_LIKE and not MCHAT_IS_ARCHIVE_PAGE and not mchatrow.MCHAT_IS_POSTER -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_MENTION = MCHAT_ALLOW_USE and not mchatrow.MCHAT_IS_POSTER and not MCHAT_IS_ARCHIVE_PAGE -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_QUOTE = MCHAT_ALLOW_USE and S_BBCODE_ALLOWED and MCHAT_ALLOW_QUOTE and not MCHAT_IS_ARCHIVE_PAGE -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_LIKE = MCHAT_ALLOW_USE and S_BBCODE_ALLOWED and MCHAT_ALLOW_LIKE and not MCHAT_IS_ARCHIVE_PAGE and not mchatrow.MCHAT_IS_POSTER -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_PM = MCHAT_ALLOW_PM and mchatrow.MCHAT_PM and mchatrow.U_VIEWPROFILE -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_EDIT = mchatrow.MCHAT_ALLOW_EDIT -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_EDIT = mchatrow.MCHAT_ALLOW_EDIT and not mchatrow.MCHAT_IS_NOTIFICATION -->
|
||||
<!-- DEFINE $MCHAT_ALLOW_DEL = mchatrow.MCHAT_ALLOW_DEL -->
|
||||
<!-- IF $MCHAT_ALLOW_MENTION or $MCHAT_ALLOW_QUOTE or $MCHAT_ALLOW_LIKE or $MCHAT_ALLOW_PM or MCHAT_ALLOW_IP or MCHAT_ALLOW_PERMISSIONS or $MCHAT_ALLOW_EDIT or $MCHAT_ALLOW_DEL -->
|
||||
<ul class="mchat-buttons">
|
||||
<!-- IF $MCHAT_ALLOW_MENTION --><li><a href="#" title="{L_MCHAT_RESPOND}" data-mchat-action="mention"><i class="mchat-button <!-- 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="mchat-button <!-- 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="mchat-button <!-- 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="mchat-button <!-- 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="mchat-button <!-- 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="mchat-button <!-- 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="mchat-button <!-- 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="mchat-button <!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-delete<!-- ELSEIF IS_PHPBB32 -->fa fa-trash-o<!-- ENDIF -->"><span>{L_DELETE}</span></i></a></li><!-- ENDIF -->
|
||||
<ul class="mchat-buttons <!-- IF $MCHAT_USE_WHITE_MESSAGE_ICONS -->mchat-icons-white<!-- ELSE -->mchat-icons-black<!-- 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_LIKE --><li><a href="#" title="{L_MCHAT_LIKE}" data-mchat-action="like"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-like<!-- ELSEIF IS_PHPBB32 -->fa fa-thumbs-o-up<!-- ENDIF -->"><span>{L_MCHAT_LIKE}</span></i></a></li><!-- ENDIF -->
|
||||
<!-- IF $MCHAT_ALLOW_PM --><li><a href="{mchatrow.MCHAT_PM}" title="{L_MCHAT_SEND_PM}"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-pm<!-- ELSEIF IS_PHPBB32 -->fa fa-envelope-o<!-- ENDIF -->"><span>{L_MCHAT_SEND_PM}</span></i></a></li><!-- ENDIF -->
|
||||
<!-- IF MCHAT_ALLOW_IP --><li><a href="{mchatrow.MCHAT_U_IP}" title="{mchatrow.MCHAT_WHOIS_USER}" data-mchat-action="ip"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-ip<!-- ELSEIF IS_PHPBB32 -->fa fa-wifi<!-- ENDIF -->"><span>{mchatrow.MCHAT_WHOIS_USER}</span></i></a></li><!-- ENDIF -->
|
||||
<!-- IF MCHAT_ALLOW_PERMISSIONS --><li><a href="{mchatrow.MCHAT_U_PERMISSIONS}" title="{L_MCHAT_PERMISSIONS}"><i class="<!-- IF IS_PHPBB31 -->mchat-icon mchat-icon-permissions<!-- ELSEIF IS_PHPBB32 -->fa fa-exclamation-triangle<!-- ENDIF -->"><span>{L_MCHAT_PERMISSIONS}</span></i></a></li><!-- ENDIF -->
|
||||
<!-- IF $MCHAT_ALLOW_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 -->
|
||||
</ul>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<li <!-- IF IS_PHPBB31 -->class="small-icon icon-mchat"<!-- ELSEIF IS_PHPBB32 -->data-last-responsive="true"<!-- ENDIF -->>
|
||||
<a href="{U_MCHAT}" title="{L_MCHAT_TITLE}" role="menuitem">
|
||||
<i<!-- IF IS_PHPBB32 --> class="icon fa fa-weixin"<!-- ENDIF --> aria-hidden="true"></i><span>{L_MCHAT_TITLE}</span>
|
||||
<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>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF MCHAT_CHARACTER_COUNT and not MCHAT_IS_ARCHIVE_PAGE -->
|
||||
<div id="mchat-character-count">{MCHAT_CHARACTER_COUNT}</div>
|
||||
<div id="mchat-character-count" class="hidden">{MCHAT_CHARACTER_COUNT}</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="mchat-form" name="postform" action="{U_MCHAT_CUSTOM_PAGE}" method="POST">
|
||||
@@ -15,29 +15,31 @@
|
||||
<!-- IF MCHAT_INPUT_AREA -->
|
||||
<input id="mchat-input" type="text" name="message" class="inputbox medium" autocomplete="off" />
|
||||
<!-- ELSE -->
|
||||
<textarea id="mchat-input" name="message" class="inputbox no-auto-resize" cols="32" rows="5"></textarea>
|
||||
<textarea id="mchat-input" name="message" class="inputbox no-auto-resize"></textarea>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- EVENT dmzx_mchat_buttons_before -->
|
||||
<!-- EVENT dmzx_mchat_buttons_container_before -->
|
||||
<div id="mchat-buttons">
|
||||
<!-- EVENT dmzx_mchat_buttons_before -->
|
||||
<!-- IF MCHAT_ALLOW_USE -->
|
||||
<input id="mchat-add" type="button" class="button2" data-mchat-action="add" value="{L_MCHAT_ADD}" />
|
||||
<input id="mchat-add" class="<!-- IF IS_PHPBB31 -->button2<!-- ELSEIF IS_PHPBB32 -->button<!-- ENDIF -->" type="button" data-mchat-action="add" value="{L_MCHAT_ADD}" />
|
||||
<!-- IF MCHAT_ALLOW_SMILES and .smiley -->
|
||||
<input type="button" class="button2" data-mchat-toggle="smilies" value="{L_MCHAT_SMILES}" />
|
||||
<input type="button" class="<!-- IF IS_PHPBB31 -->button2<!-- ELSEIF IS_PHPBB32 -->button<!-- ENDIF -->" data-mchat-toggle="smilies" value="{L_MCHAT_SMILES}" />
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_BBCODE_ALLOWED -->
|
||||
<input type="button" class="button2" data-mchat-toggle="bbcodes" value="{L_MCHAT_BBCODES}" />
|
||||
<input type="button" class="<!-- IF IS_PHPBB31 -->button2<!-- ELSEIF IS_PHPBB32 -->button<!-- ENDIF -->" data-mchat-toggle="bbcodes" value="{L_MCHAT_BBCODES}" />
|
||||
<!-- ENDIF -->
|
||||
<!-- IF MCHAT_RULES -->
|
||||
<input type="button" class="button2" onclick="popup('{U_MCHAT_RULES}', 450, 275); return false;" value="{L_MCHAT_RULES}" />
|
||||
<input type="button" class="<!-- IF IS_PHPBB31 -->button2<!-- ELSEIF IS_PHPBB32 -->button<!-- ENDIF -->" onclick="popup('{U_MCHAT_RULES}', 450, 275); return false;" value="{L_MCHAT_RULES}" />
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
<!-- EVENT dmzx_mchat_buttons_mid -->
|
||||
<!-- IF MCHAT_ARCHIVE -->
|
||||
<input type="button" class="button2" onclick="window.location.href = '{U_MCHAT_ARCHIVE_URL}';" value="{L_MCHAT_ARCHIVE}" />
|
||||
<input type="button" class="<!-- IF IS_PHPBB31 -->button2<!-- ELSEIF IS_PHPBB32 -->button<!-- ENDIF -->" onclick="window.location.href = '{U_MCHAT_ARCHIVE_URL}';" value="{L_MCHAT_ARCHIVE}" />
|
||||
<!-- ENDIF -->
|
||||
<!-- EVENT dmzx_mchat_buttons_after -->
|
||||
</div>
|
||||
<!-- EVENT dmzx_mchat_buttons_container_after -->
|
||||
<!-- IF MCHAT_ALLOW_USE and S_BBCODE_ALLOWED -->
|
||||
<div id="mchat-bbcodes">
|
||||
<!-- INCLUDE posting_buttons.html -->
|
||||
@@ -55,16 +57,20 @@
|
||||
<!-- ENDIF -->
|
||||
<!-- EVENT dmzx_mchat_body_smiley_after -->
|
||||
<div id="mchat-status">
|
||||
<div id="mchat-status-icons">
|
||||
<i id="mchat-status-load" class="<!-- IF IS_PHPBB31 -->mchat-status-load<!-- ELSEIF IS_PHPBB32 -->fa fa-refresh fa-spin icon icon-blue<!-- ENDIF -->" title="{L_LOADING}"></i>
|
||||
<i id="mchat-status-ok" class="<!-- IF IS_PHPBB31 -->mchat-status-ok<!-- ELSEIF IS_PHPBB32 -->fa fa-check icon icon-green<!-- ENDIF -->" title="{L_MCHAT_OK}"></i>
|
||||
<i id="mchat-status-paused" class="<!-- IF IS_PHPBB31 -->mchat-status-paused<!-- ELSEIF IS_PHPBB32 -->fa fa-pause icon icon-orange<!-- ENDIF -->" title="{L_MCHAT_PAUSE}"></i>
|
||||
<i id="mchat-status-error" class="<!-- IF IS_PHPBB31 -->mchat-status-error<!-- ELSEIF IS_PHPBB32 -->fa fa-times icon icon-red<!-- ENDIF -->" title="{L_ERROR}"></i>
|
||||
</div>
|
||||
<span id="mchat-refresh-text">{MCHAT_REFRESH_YES}</span>
|
||||
<!-- IF MCHAT_USER_TIMEOUT --> • <span id="mchat-session">{MCHAT_SESSION_TIMELEFT}</span><!-- ENDIF -->
|
||||
<!-- IF not MCHAT_SOUND_DISABLED --> • <label for="mchat-user-sound">{L_MCHAT_USESOUND} <input type="checkbox" id="mchat-user-sound"<!-- IF MCHAT_SOUND --> checked="checked"<!-- ENDIF --> /></label><!-- ENDIF -->
|
||||
<span class="mchat-copyright" title="{MCHAT_AUTHOR_NAMES}">©</span>
|
||||
<ul class="mchat-footer">
|
||||
<li>
|
||||
<span id="mchat-status-icons">
|
||||
<i id="mchat-status-load" class="<!-- IF IS_PHPBB31 -->mchat-status-load<!-- ELSEIF IS_PHPBB32 -->fa fa-refresh fa-spin icon icon-blue<!-- ENDIF -->" title="{L_LOADING}"></i>
|
||||
<i id="mchat-status-ok" class="<!-- IF IS_PHPBB31 -->mchat-status-ok<!-- ELSEIF IS_PHPBB32 -->fa fa-check icon icon-green<!-- ENDIF -->" title="{L_MCHAT_OK}"></i>
|
||||
<i id="mchat-status-paused" class="<!-- IF IS_PHPBB31 -->mchat-status-paused<!-- ELSEIF IS_PHPBB32 -->fa fa-pause icon icon-orange<!-- ENDIF -->" title="{L_MCHAT_PAUSE}"></i>
|
||||
<i id="mchat-status-error" class="<!-- IF IS_PHPBB31 -->mchat-status-error<!-- ELSEIF IS_PHPBB32 -->fa fa-times icon icon-red<!-- ENDIF -->" title="{L_ERROR}"></i>
|
||||
</span>
|
||||
<span id="mchat-refresh-text">{MCHAT_REFRESH_YES}</span>
|
||||
</li>
|
||||
<!-- IF MCHAT_TIMEOUT --><li><span id="mchat-session">{MCHAT_SESSION_TIMELEFT}</span></li><!-- ENDIF -->
|
||||
<!-- IF not MCHAT_SOUND_DISABLED --><li><label for="mchat-user-sound">{L_MCHAT_USESOUND} <input type="checkbox" id="mchat-user-sound"<!-- IF MCHAT_SOUND --> checked="checked"<!-- ENDIF --> /></label></li><!-- ENDIF -->
|
||||
<li><span class="mchat-copyright" title="{MCHAT_AUTHOR_NAMES}">©</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
</form>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<div id="mchat-whois">
|
||||
<span title="{MCHAT_ONLINE_EXPLAIN}">
|
||||
<!-- IF MCHAT_USERS_LIST -->
|
||||
<a href="#" data-mchat-toggle="userlist">{MCHAT_USERS_COUNT}</a>
|
||||
<a href="#" data-mchat-toggle="userlist">{MCHAT_USERS_TOTAL}</a>
|
||||
<!-- ELSE -->
|
||||
{MCHAT_USERS_COUNT}
|
||||
{MCHAT_USERS_TOTAL}
|
||||
<!-- ENDIF -->
|
||||
</span>
|
||||
<div id="mchat-userlist" class="hidden">{MCHAT_USERS_LIST}</div>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@@ -16,6 +16,11 @@
|
||||
width: 0;
|
||||
}
|
||||
|
||||
#mchat-body {
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.icon-mchat {
|
||||
background-image: url("./images/icon_mchat.png");
|
||||
}
|
||||
@@ -24,10 +29,6 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mchat-body {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
#mchat-confirm textarea {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
@@ -35,7 +36,6 @@
|
||||
|
||||
#mchat-messages {
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mchat-message-wrapper {
|
||||
@@ -59,8 +59,17 @@
|
||||
|
||||
@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {
|
||||
|
||||
#mchat-body {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.mchat-buttons > li {
|
||||
padding: 0 8px !important;
|
||||
padding: 0 6px !important;
|
||||
}
|
||||
|
||||
#mchat-input {
|
||||
width: 95% !important;
|
||||
margin: 5px 0 !important;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -69,38 +78,34 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
.mchat-message .mchat-buttons li {
|
||||
.mchat-wrapper .mchat-buttons li {
|
||||
opacity: .3;
|
||||
}
|
||||
|
||||
.mchat-message:hover .mchat-buttons li {
|
||||
.mchat-wrapper li:hover .mchat-buttons li {
|
||||
opacity: .6;
|
||||
}
|
||||
|
||||
.mchat-message .mchat-buttons li:hover {
|
||||
.mchat-wrapper li:hover .mchat-buttons li:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.mchat-buttons {
|
||||
.mchat-wrapper .mchat-buttons {
|
||||
float: right;
|
||||
list-style: none;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.mchat-message-wrapper .mchat-buttons > li {
|
||||
.mchat-wrapper .mchat-buttons > li {
|
||||
float: left;
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
.mchat-button {
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.mchat-button.fa {
|
||||
.mchat-wrapper .mchat-buttons .fa {
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
.mchat-button span {
|
||||
.mchat-wrapper .mchat-buttons span {
|
||||
display: block;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
@@ -108,9 +113,16 @@
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
.mchat-icons-black .mchat-icon:before {
|
||||
background-image: url("./images/message_icons_black.png");
|
||||
}
|
||||
|
||||
.mchat-icons-white .mchat-icon:before {
|
||||
background-image: url("./images/message_icons_white.png");
|
||||
}
|
||||
|
||||
.mchat-icon:before {
|
||||
content: '';
|
||||
background-image: url("./images/message_icons.png");
|
||||
background-repeat: no-repeat;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
@@ -118,14 +130,14 @@
|
||||
float: right;
|
||||
}
|
||||
|
||||
.mchat-icon-mention:before { background-position: -2px -2px; }
|
||||
.mchat-icon-edit:before { background-position: -22px -2px; }
|
||||
.mchat-icon-pm:before { background-position: -42px -2px; }
|
||||
.mchat-icon-quote:before { background-position: -62px -2px; }
|
||||
.mchat-icon-like:before { background-position: -82px -2px; }
|
||||
.mchat-icon-delete:before { background-position: -102px -2px; }
|
||||
.mchat-icon-permissions:before { background-position: -122px -2px; }
|
||||
.mchat-icon-ip:before { background-position: -142px -2px; }
|
||||
.mchat-icon-mention:before { background-position: -2px -2px; }
|
||||
.mchat-icon-edit:before { background-position: -22px -2px; }
|
||||
.mchat-icon-pm:before { background-position: -42px -2px; }
|
||||
.mchat-icon-quote:before { background-position: -62px -2px; }
|
||||
.mchat-icon-like:before { background-position: -82px -2px; }
|
||||
.mchat-icon-delete:before { background-position: -102px -2px; }
|
||||
.mchat-icon-permissions:before { background-position: -122px -2px; }
|
||||
.mchat-icon-ip:before { background-position: -142px -2px; }
|
||||
|
||||
.mchat-text {
|
||||
clear: both;
|
||||
@@ -134,6 +146,10 @@
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.mchat-notification-message .mchat-text {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.mchat-text strong {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
@@ -160,12 +176,8 @@
|
||||
list-style-type: circle;
|
||||
}
|
||||
|
||||
.mchat-text blockquote {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.mchat-text blockquote, .mchat-text .codebox, .mchat-text ul, .mchat-text ol {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
@@ -185,10 +197,13 @@
|
||||
|
||||
#mchat-character-count {
|
||||
float: right;
|
||||
visibility: hidden;
|
||||
padding: 5px 0 0;
|
||||
}
|
||||
|
||||
#mchat-character-count.hidden {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#mchat-panel {
|
||||
text-align: center;
|
||||
max-height: initial;
|
||||
@@ -205,11 +220,17 @@
|
||||
#mchat-input {
|
||||
cursor: text;
|
||||
width: 50%;
|
||||
min-width: 50%;
|
||||
max-width: 90%;
|
||||
font-size: 1.1em;
|
||||
padding: 5px 5px 4px;
|
||||
margin: 5px 20px;
|
||||
}
|
||||
|
||||
textarea#mchat-input {
|
||||
height: 8em;
|
||||
}
|
||||
|
||||
#mchat-buttons {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
@@ -231,6 +252,10 @@
|
||||
margin: 0 auto 5px;
|
||||
}
|
||||
|
||||
#mchat-bbcodes #colour_palette td a.remember-color {
|
||||
box-shadow: 0 0 0 1px #F00;
|
||||
}
|
||||
|
||||
#mchat-smilies {
|
||||
padding: 0;
|
||||
}
|
||||
@@ -288,6 +313,20 @@
|
||||
background-image: url("./images/paused.gif");
|
||||
}
|
||||
|
||||
.mchat-footer li {
|
||||
display: inline;
|
||||
padding-left: .1em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mchat-footer li:before {
|
||||
content: '\2022\A';
|
||||
}
|
||||
|
||||
.mchat-footer li:first-child:before, .mchat-footer li:last-child:before {
|
||||
content: '';
|
||||
}
|
||||
|
||||
#mchat-legend {
|
||||
clear: both;
|
||||
}
|
||||
@@ -342,5 +381,5 @@
|
||||
}
|
||||
|
||||
.hidden-category + .forabg #mchat-body .topiclist.forums {
|
||||
display: block;
|
||||
display: block;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link" href="{U_MCHAT}" title="{L_MCHAT_TITLE}" role="menuitem">{L_MCHAT_TITLE}</a></li>
|
||||
<li class="tab mchat" data-select-match="mchat" data-responsive-class="tab small-icon icon-mchat"><a class="nav-link mchat-nav-link mchat-nav-link-title" href="{U_MCHAT}" title="{MCHAT_TITLE_HINT}" role="menuitem">{MCHAT_TITLE}</a></li>
|
||||
|
||||
@@ -24,7 +24,7 @@ class ucp_mchat_info
|
||||
'modes' => array(
|
||||
'configuration' => array(
|
||||
'title' => 'UCP_MCHAT_CONFIG',
|
||||
'auth' => 'ext_dmzx/mchat && acl_u_mchat_use',
|
||||
'auth' => 'ext_dmzx/mchat && acl_u_mchat_view',
|
||||
'cat' => array('UCP_MCHAT_CONFIG'),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -24,7 +24,7 @@ class ucp_mchat_module
|
||||
|
||||
// Set template
|
||||
$this->tpl_name = 'ucp_mchat';
|
||||
$this->page_title = 'UCP_PROFILE_MCHAT';
|
||||
$this->page_title = 'UCP_MCHAT_CONFIG';
|
||||
|
||||
// Get an instance of the UCP controller and display the options
|
||||
$controller = $phpbb_container->get('dmzx.mchat.ucp.controller');
|
||||
|
||||
Reference in New Issue
Block a user