Version 2.0.0-RC4
This commit is contained in:
@@ -12,17 +12,6 @@
|
||||
<!-- ENDIF -->
|
||||
|
||||
<form id="acp_mchat" method="post" action="{U_ACTION}">
|
||||
<!-- IF MCHAT_PURGE and MCHAT_FOUNDER -->
|
||||
<fieldset>
|
||||
<legend>{L_CONFIRM}</legend>
|
||||
<span>{L_MCHAT_PURGE_CONFIRM}{L_COLON}</span>
|
||||
<p class="submit-buttons">
|
||||
<input class="button1" type="submit" name="mchat_purge_confirm" value="{L_YES}" />
|
||||
<input class="button2" type="submit" value="{L_NO}" />
|
||||
{S_FORM_TOKEN}
|
||||
</p>
|
||||
</fieldset>
|
||||
<!-- ELSE -->
|
||||
<fieldset>
|
||||
<legend>{L_MCHAT_SETTINGS_INDEX}</legend>
|
||||
<dl>
|
||||
@@ -135,29 +124,29 @@
|
||||
<dl>
|
||||
<dt><label for="mchat_posts_topic">{L_MCHAT_POSTS_TOPIC}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" name="mchat_posts_topic" value="1"<!-- IF MCHAT_POSTS_TOPIC --> id="mchat_posts_topic" checked="checked"<!-- ENDIF --><!-- IF MCHAT_POSTS_TOPIC_NOAUTH --> disabled<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_posts_topic" value="0"<!-- IF not MCHAT_POSTS_TOPIC --> id="mchat_posts_topic" checked="checked"<!-- ENDIF --><!-- IF MCHAT_POSTS_TOPIC_NOAUTH --> disabled<!-- ENDIF --> /> {L_NO}</label>
|
||||
<label><input type="radio" name="mchat_posts_topic" value="1"<!-- IF MCHAT_POSTS_TOPIC --> id="mchat_posts_topic" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_posts_topic" value="0"<!-- IF not MCHAT_POSTS_TOPIC --> id="mchat_posts_topic" checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_posts_reply">{L_MCHAT_POSTS_REPLY}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" name="mchat_posts_reply" value="1"<!-- IF MCHAT_POSTS_REPLY --> id="mchat_posts_reply" checked="checked"<!-- ENDIF --><!-- IF MCHAT_POSTS_REPLY_NOAUTH --> disabled<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_posts_reply" value="0"<!-- IF not MCHAT_POSTS_REPLY --> id="mchat_posts_reply" checked="checked"<!-- ENDIF --><!-- IF MCHAT_POSTS_REPLY_NOAUTH --> disabled<!-- ENDIF --> /> {L_NO}</label>
|
||||
<label><input type="radio" name="mchat_posts_reply" value="1"<!-- IF MCHAT_POSTS_REPLY --> id="mchat_posts_reply" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_posts_reply" value="0"<!-- IF not MCHAT_POSTS_REPLY --> id="mchat_posts_reply" checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_posts_edit">{L_MCHAT_POSTS_EDIT}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" name="mchat_posts_edit" value="1"<!-- IF MCHAT_POSTS_EDIT --> id="mchat_posts_edit" checked="checked"<!-- ENDIF --><!-- IF MCHAT_POSTS_EDIT_NOAUTH --> disabled<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_posts_edit" value="0"<!-- IF not MCHAT_POSTS_EDIT --> id="mchat_posts_edit" checked="checked"<!-- ENDIF --><!-- IF MCHAT_POSTS_EDIT_NOAUTH --> disabled<!-- ENDIF --> /> {L_NO}</label>
|
||||
<label><input type="radio" name="mchat_posts_edit" value="1"<!-- IF MCHAT_POSTS_EDIT --> id="mchat_posts_edit" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_posts_edit" value="0"<!-- IF not MCHAT_POSTS_EDIT --> id="mchat_posts_edit" checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_posts_quote">{L_MCHAT_POSTS_QUOTE}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" name="mchat_posts_quote" value="1"<!-- IF MCHAT_POSTS_QUOTE --> id="mchat_posts_quote" checked="checked"<!-- ENDIF --><!-- IF MCHAT_POSTS_QUOTE_NOAUTH --> disabled<!-- ENDIF --> /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_posts_quote" value="0"<!-- IF not MCHAT_POSTS_QUOTE --> id="mchat_posts_quote" checked="checked"<!-- ENDIF --><!-- IF MCHAT_POSTS_QUOTE_NOAUTH --> disabled<!-- ENDIF --> /> {L_NO}</label>
|
||||
<label><input type="radio" name="mchat_posts_quote" value="1"<!-- IF MCHAT_POSTS_QUOTE --> id="mchat_posts_quote" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
|
||||
<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>
|
||||
</fieldset>
|
||||
@@ -184,7 +173,12 @@
|
||||
<!-- IF MCHAT_FOUNDER -->
|
||||
<dl>
|
||||
<dt><label for="mchat_purge">{L_MCHAT_PURGE}{L_COLON}</label></dt>
|
||||
<dd><input class="button1" type="submit" id="mchat_purge" name="mchat_purge" value="{L_MCHAT_PURGE}" /></dd>
|
||||
<dd>
|
||||
<input class="button1" type="submit" id="mchat_purge" name="mchat_purge" value="{L_MCHAT_PURGE}" />
|
||||
<label>{L_MCHAT_PURGE_CONFIRM}{L_COLON}</label>
|
||||
<label><input type="radio" name="mchat_purge_confirm" value="1" /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_purge_confirm" value="0" id="mchat_purge_confirm" checked="checked" /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
</fieldset>
|
||||
@@ -194,7 +188,6 @@
|
||||
<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
|
||||
{S_FORM_TOKEN}
|
||||
</p>
|
||||
<!-- ENDIF -->
|
||||
</form>
|
||||
|
||||
<!-- INCLUDE overall_footer.html -->
|
||||
|
||||
@@ -15,9 +15,26 @@
|
||||
|
||||
<form id="acp_mchat" method="post" action="{U_ACTION}">
|
||||
<fieldset>
|
||||
<legend>{L_MCHAT_ACP_GLOBALUSERSETTINGS_TITLE}</legend>
|
||||
<legend>{L_ACP_MCHAT_GLOBALUSERSETTINGS}</legend>
|
||||
<!-- INCLUDE acp_mchat_globalusersettings_content.html -->
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{L_MCHAT_GLOBALUSERSETTINGS_OVERWRITE}</legend>
|
||||
<dl>
|
||||
<dt><label for="mchat_overwrite">{L_MCHAT_GLOBALUSERSETTINGS_OVERWRITE}{L_COLON}</label><br /><span>{L_MCHAT_GLOBALUSERSETTINGS_OVERWRITE_EXPLAIN}</span></dt>
|
||||
<dd>
|
||||
<label><input type="radio" name="mchat_overwrite" value="1" /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_overwrite" value="0" id="mchat_overwrite" checked="checked" /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="mchat_overwrite_confirm">{L_MCHAT_GLOBALUSERSETTINGS_OVERWRITE_CONFIRM}{L_COLON}</label></dt>
|
||||
<dd>
|
||||
<label><input type="radio" name="mchat_overwrite_confirm" value="1" /> {L_YES}</label>
|
||||
<label><input type="radio" name="mchat_overwrite_confirm" value="0" id="mchat_overwrite_confirm" checked="checked" /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
<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}" />
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"type": "phpbb-extension",
|
||||
"description": "mChat Extension",
|
||||
"homepage": "http://www.dmzx-web.net",
|
||||
"version": "2.0.0-RC3",
|
||||
"time": "2016-03-24",
|
||||
"version": "2.0.0-RC4",
|
||||
"time": "2016-03-31",
|
||||
"keywords": ["phpbb", "extension", "mchat"],
|
||||
"license": "GPL-2.0",
|
||||
"authors": [
|
||||
|
||||
@@ -49,6 +49,7 @@ services:
|
||||
- '@ext.manager'
|
||||
- '%core.root_path%'
|
||||
- '%core.php_ext%'
|
||||
- '@?phpbb.collapsiblecategories.operator'
|
||||
dmzx.mchat.functions:
|
||||
class: dmzx\mchat\core\functions
|
||||
arguments:
|
||||
|
||||
@@ -87,13 +87,7 @@ class acp_controller
|
||||
|
||||
$error = array();
|
||||
|
||||
if ($this->request->is_set_post('mchat_purge'))
|
||||
{
|
||||
$this->template->assign_var('MCHAT_PURGE', true);
|
||||
}
|
||||
else if ($this->request->is_set_post('mchat_purge_confirm'))
|
||||
{
|
||||
if (check_form_key('acp_mchat') && $this->user->data['user_type'] == USER_FOUNDER)
|
||||
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);
|
||||
@@ -101,7 +95,6 @@ class acp_controller
|
||||
$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'))
|
||||
{
|
||||
$mchat_new_config = array();
|
||||
@@ -203,6 +196,18 @@ class acp_controller
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($this->request->variable('mchat_overwrite', 0) && $this->request->variable('mchat_overwrite_confirm', 0))
|
||||
{
|
||||
$mchat_new_user_config = array();
|
||||
foreach ($mchat_new_config as $config_name => $config_value)
|
||||
{
|
||||
$mchat_new_user_config['user_' . $config_name] = $config_value;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $mchat_new_user_config);
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
|
||||
// Set the options the user configured
|
||||
foreach ($mchat_new_config as $config_name => $config_value)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ class main_controller
|
||||
* 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
|
||||
* @return \Symfony\Component\HttpFoundation\JsonResponse A Symfony JsonResponse object
|
||||
*/
|
||||
public function action($action)
|
||||
{
|
||||
|
||||
@@ -49,6 +49,9 @@ class mchat
|
||||
/** @var string */
|
||||
protected $php_ext;
|
||||
|
||||
/** @var \phpbb\collapsiblecategories\operator\operator */
|
||||
protected $cc_operator;
|
||||
|
||||
/** @var boolean */
|
||||
protected $remove_disallowed_bbcodes = false;
|
||||
|
||||
@@ -67,8 +70,9 @@ class mchat
|
||||
* @param \phpbb\extension\manager $extension_manager
|
||||
* @param string $root_path
|
||||
* @param string $php_ext
|
||||
* @param \phpbb\collapsiblecategories\operator\operator $cc_operator
|
||||
*/
|
||||
public function __construct(\dmzx\mchat\core\functions $functions, \dmzx\mchat\core\settings $settings, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\pagination $pagination, \phpbb\request\request $request, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\extension\manager $extension_manager, $root_path, $php_ext)
|
||||
public function __construct(\dmzx\mchat\core\functions $functions, \dmzx\mchat\core\settings $settings, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\pagination $pagination, \phpbb\request\request $request, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\extension\manager $extension_manager, $root_path, $php_ext, \phpbb\collapsiblecategories\operator\operator $cc_operator = null)
|
||||
{
|
||||
$this->functions = $functions;
|
||||
$this->settings = $settings;
|
||||
@@ -82,6 +86,7 @@ class mchat
|
||||
$this->extension_manager = $extension_manager;
|
||||
$this->root_path = $root_path;
|
||||
$this->php_ext = $php_ext;
|
||||
$this->cc_operator = $cc_operator;
|
||||
|
||||
$this->template->assign_vars(array(
|
||||
'IS_PHPBB31' => $this->settings->is_phpbb31,
|
||||
@@ -307,8 +312,7 @@ class mchat
|
||||
throw new \phpbb\exception\http_exception(403, 'MCHAT_NOACCESS');
|
||||
}
|
||||
|
||||
$is_archive = $this->request->variable('archive', 0);
|
||||
$this->template->assign_var('MCHAT_IS_ARCHIVE_PAGE', $is_archive);
|
||||
$this->template->assign_var('MCHAT_IS_ARCHIVE_PAGE', $this->request->variable('archive', false));
|
||||
|
||||
$message = $this->request->variable('message', '', true);
|
||||
|
||||
@@ -330,7 +334,7 @@ class mchat
|
||||
$rows = $this->functions->mchat_get_messages($sql_where, 1);
|
||||
|
||||
$this->assign_global_template_data();
|
||||
$this->assign_messages($rows, $is_archive ? 'archive' : '');
|
||||
$this->assign_messages($rows);
|
||||
|
||||
return array('edit' => $this->render_template('mchat_messages.html'));
|
||||
}
|
||||
@@ -520,22 +524,22 @@ class mchat
|
||||
'MCHAT_WHOIS_REFRESH_EXPLAIN' => $this->user->lang('MCHAT_WHO_IS_REFRESH_EXPLAIN', $this->settings->cfg('mchat_whois_refresh')),
|
||||
'MCHAT_SESSION_TIMELEFT' => $this->user->lang('MCHAT_SESSION_ENDS', gmdate('H:i:s', (int) $this->settings->cfg('mchat_timeout'))),
|
||||
'MCHAT_STATIC_MESS' => htmlspecialchars_decode($static_message),
|
||||
'MCHAT_MESS_LONG' => addslashes($this->user->lang('MCHAT_MESS_LONG', $this->settings->cfg('mchat_max_message_lngth'))),
|
||||
'MCHAT_REFRESH_YES' => addslashes($this->user->lang('MCHAT_REFRESH_YES', $this->settings->cfg('mchat_refresh'))),
|
||||
'A_MCHAT_MESS_LONG' => addslashes($this->user->lang('MCHAT_MESS_LONG', $this->settings->cfg('mchat_max_message_lngth'))),
|
||||
'A_MCHAT_REFRESH_YES' => addslashes($this->user->lang('MCHAT_REFRESH_YES', $this->settings->cfg('mchat_refresh'))),
|
||||
'U_MCHAT_CUSTOM_PAGE' => $this->helper->route('dmzx_mchat_controller'),
|
||||
'U_MCHAT_RULES' => $this->helper->route('dmzx_mchat_page_controller', array('page' => 'rules')),
|
||||
'U_MCHAT_ARCHIVE_URL' => $this->helper->route('dmzx_mchat_page_controller', array('page' => 'archive')),
|
||||
));
|
||||
|
||||
// The template needs some language variables if we display relative time for messages
|
||||
if ($this->settings->cfg('mchat_relative_time') && $page != 'archive')
|
||||
if ($this->settings->cfg('mchat_relative_time'))
|
||||
{
|
||||
$minutes_limit = $this->get_relative_minutes_limit();
|
||||
for ($i = 0; $i < $minutes_limit; $i++)
|
||||
{
|
||||
$this->template->assign_block_vars('mchattime', array(
|
||||
'KEY' => $i,
|
||||
'LANG' => addslashes($this->user->lang('MCHAT_MINUTES_AGO', $i)),
|
||||
'A_LANG' => addslashes($this->user->lang('MCHAT_MINUTES_AGO', $i)),
|
||||
'IS_LAST' => $i + 1 === $minutes_limit,
|
||||
));
|
||||
}
|
||||
@@ -545,9 +549,9 @@ class mchat
|
||||
$actions = array_keys(array_filter(array(
|
||||
'edit' => $this->auth_message('u_mchat_edit', true, time()),
|
||||
'del' => $this->auth_message('u_mchat_delete', true, time()),
|
||||
'refresh' => $page != 'archive' && $this->auth->acl_get('u_mchat_view'),
|
||||
'add' => $page != 'archive' && $u_mchat_use,
|
||||
'whois' => $page != 'archive' && $this->settings->cfg('mchat_whois'),
|
||||
'refresh' => $page !== 'archive' && $this->auth->acl_get('u_mchat_view'),
|
||||
'add' => $page !== 'archive' && $u_mchat_use,
|
||||
'whois' => $page !== 'archive' && $this->settings->cfg('mchat_whois'),
|
||||
)));
|
||||
|
||||
foreach ($actions as $i => $action)
|
||||
@@ -560,14 +564,14 @@ class mchat
|
||||
}
|
||||
|
||||
$limit = $this->settings->cfg('mchat_message_num_' . $page);
|
||||
$start = $page == 'archive' ? $this->request->variable('start', 0) : 0;
|
||||
$start = $page === 'archive' ? $this->request->variable('start', 0) : 0;
|
||||
$rows = $this->functions->mchat_get_messages('', $limit, $start);
|
||||
|
||||
$this->assign_global_template_data();
|
||||
$this->assign_messages($rows, $page);
|
||||
$this->assign_messages($rows);
|
||||
|
||||
// Render pagination
|
||||
if ($page == 'archive')
|
||||
if ($page === 'archive')
|
||||
{
|
||||
$archive_url = $this->helper->route('dmzx_mchat_page_controller', array('page' => 'archive'));
|
||||
$total_messages = $this->functions->mchat_total_message_count();
|
||||
@@ -576,12 +580,26 @@ class mchat
|
||||
}
|
||||
|
||||
// Render legend
|
||||
if ($page != 'index' && $this->settings->cfg('mchat_whois'))
|
||||
if ($page !== 'index' && $this->settings->cfg('mchat_whois'))
|
||||
{
|
||||
$legend = $this->functions->mchat_legend();
|
||||
$this->template->assign_var('LEGEND', implode($this->user->lang('COMMA_SEPARATOR'), $legend));
|
||||
}
|
||||
|
||||
// Make mChat collapsible
|
||||
if ($page === 'index' && $this->cc_operator !== null)
|
||||
{
|
||||
$cc_fid = 'mchat';
|
||||
$this->template->assign_vars(array(
|
||||
'MCHAT_IS_COLLAPSIBLE' => true,
|
||||
'S_MCHAT_HIDDEN' => in_array($cc_fid, $this->cc_operator->get_user_categories()),
|
||||
'U_MCHAT_COLLAPSE_URL' => $this->helper->route('phpbb_collapsiblecategories_main_controller', array(
|
||||
'forum_id' => $cc_fid,
|
||||
'hash' => generate_link_hash('collapsible_' . $cc_fid),
|
||||
)),
|
||||
));
|
||||
}
|
||||
|
||||
$this->assign_authors();
|
||||
|
||||
if ($u_mchat_use)
|
||||
@@ -657,9 +675,8 @@ class mchat
|
||||
* Assigns all message rows to the template
|
||||
*
|
||||
* @param array $rows
|
||||
* @param string $page
|
||||
*/
|
||||
protected function assign_messages($rows, $page = '')
|
||||
protected function assign_messages($rows)
|
||||
{
|
||||
if (!$rows)
|
||||
{
|
||||
@@ -718,7 +735,7 @@ class mchat
|
||||
}
|
||||
|
||||
$message_age = time() - $row['message_time'];
|
||||
$minutes_ago = $this->get_minutes_ago($message_age, $page);
|
||||
$minutes_ago = $this->get_minutes_ago($message_age);
|
||||
$datetime = $this->user->format_date($row['message_time'], $this->settings->cfg('mchat_date'));
|
||||
|
||||
$is_poster = $row['user_id'] != ANONYMOUS && $this->user->data['user_id'] == $row['user_id'];
|
||||
@@ -754,12 +771,11 @@ class mchat
|
||||
* or the message is older than 59 minutes or we render for the archive, -1 is returned.
|
||||
*
|
||||
* @param int $message_age
|
||||
* @param string $page
|
||||
* @return int
|
||||
*/
|
||||
protected function get_minutes_ago($message_age, $page)
|
||||
protected function get_minutes_ago($message_age)
|
||||
{
|
||||
if ($this->settings->cfg('mchat_relative_time') && $page != 'archive')
|
||||
if ($this->settings->cfg('mchat_relative_time'))
|
||||
{
|
||||
$minutes_ago = floor($message_age / 60);
|
||||
if ($minutes_ago < $this->get_relative_minutes_limit())
|
||||
@@ -779,12 +795,12 @@ class mchat
|
||||
* @return int
|
||||
*/
|
||||
protected function get_relative_minutes_limit()
|
||||
{
|
||||
$timeout = $this->settings->cfg('session_length');
|
||||
|
||||
if ($this->settings->cfg('mchat_timeout'))
|
||||
{
|
||||
$timeout = $this->settings->cfg('mchat_timeout');
|
||||
|
||||
if (!$timeout)
|
||||
{
|
||||
$timeout = $this->settings->cfg('session_length');
|
||||
}
|
||||
|
||||
return min(max((int) ceil($timeout / 60), 1), 60);
|
||||
@@ -823,7 +839,7 @@ class mchat
|
||||
$this->template->assign_var($option['template_var'], !$is_disallowed);
|
||||
}
|
||||
|
||||
$this->template->assign_var('MCHAT_DISALLOWED_BBCODES', addslashes(str_replace('=', '-', $this->settings->cfg('mchat_bbcode_disallowed'))));
|
||||
$this->template->assign_var('A_MCHAT_DISALLOWED_BBCODES', addslashes(str_replace('=', '-', $this->settings->cfg('mchat_bbcode_disallowed'))));
|
||||
|
||||
if (!function_exists('display_custom_bbcodes'))
|
||||
{
|
||||
@@ -863,6 +879,22 @@ class mchat
|
||||
return $sql_ary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default values when a user registers a new account as configured in the global user settings
|
||||
*
|
||||
* @param array $sql_ary
|
||||
* @return array
|
||||
*/
|
||||
public function set_user_default_values($sql_ary)
|
||||
{
|
||||
foreach (array_keys($this->settings->ucp) as $config_name)
|
||||
{
|
||||
$sql_ary['user_' . $config_name] = $this->settings->cfg($config_name, true);
|
||||
}
|
||||
|
||||
return $sql_ary;
|
||||
}
|
||||
|
||||
/** Inserts a message with posting information into the database
|
||||
*
|
||||
* @param string $mode One of post|quote|edit|reply
|
||||
@@ -910,7 +942,7 @@ class mchat
|
||||
return true;
|
||||
}
|
||||
|
||||
$can_edit_delete = $this->settings->cfg('mchat_edit_delete_limit') == 0 || $message_time >= time() - $this->settings->cfg('mchat_edit_delete_limit');
|
||||
$can_edit_delete = !$this->settings->cfg('mchat_edit_delete_limit') || $message_time >= time() - $this->settings->cfg('mchat_edit_delete_limit');
|
||||
return $can_edit_delete && $this->user->data['user_id'] == $author_id && $this->user->data['is_registered'];
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ class acp_listener implements EventSubscriberInterface
|
||||
*/
|
||||
public function acp_users_prefs_modify_template_data($event)
|
||||
{
|
||||
$this->user->add_lang_ext('dmzx/mchat', 'mchat_ucp');
|
||||
$this->user->add_lang_ext('dmzx/mchat', array('mchat_acp', 'mchat_ucp'));
|
||||
|
||||
$user_id = $event['user_row']['user_id'];
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ class main_listener implements EventSubscriberInterface
|
||||
'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.user_add_modify_data' => 'user_registration_set_default_values',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -123,4 +124,12 @@ class main_listener implements EventSubscriberInterface
|
||||
{
|
||||
$event['sql_ary'] = $this->mchat->remove_disallowed_bbcodes($event['sql_ary']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $event The event object
|
||||
*/
|
||||
public function user_registration_set_default_values($event)
|
||||
{
|
||||
$event['sql_ary'] = $this->mchat->set_user_default_values($event['sql_ary']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,6 @@ $lang = array_merge($lang, array(
|
||||
'ACP_MCHAT_GLOBALSETTINGS' => 'Global settings',
|
||||
'ACP_MCHAT_GLOBALUSERSETTINGS' => 'Global user settings',
|
||||
|
||||
'MCHAT_ACP_USER_PREFS_EXPLAIN' => 'Below are listed all mChat preferences of the selected user. Settings for which the selected user does not have permission to customise are disabled. These settings can be changed in the <em>Global user settings</em> mChat configuration section.',
|
||||
|
||||
// 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',
|
||||
|
||||
@@ -66,12 +66,12 @@ $lang = array_merge($lang, array(
|
||||
'MCHAT_REFRESH_NO' => 'Update is off',
|
||||
'MCHAT_REFRESH_YES' => 'Updates every <strong>%1$d</strong> seconds',
|
||||
'MCHAT_RESPOND' => 'Respond to user',
|
||||
'MCHAT_RESET_QUESTION' => 'Clear the input area?',
|
||||
'MCHAT_SESSION_ENDS' => 'Chat session ends in %1$s',
|
||||
'MCHAT_SESSION_OUT' => 'Chat session has expired',
|
||||
'MCHAT_SMILES' => 'Smilies',
|
||||
'MCHAT_TOTALMESSAGES' => 'Total messages: <strong>%1$d</strong>',
|
||||
'MCHAT_USESOUND' => 'Play sound',
|
||||
'MCHAT_COLLAPSE_TITLE' => 'Toggle visibility of mChat',
|
||||
'MCHAT_WHO_IS_REFRESH_EXPLAIN' => 'Refreshes every <strong>%1$d</strong> seconds',
|
||||
'MCHAT_MINUTES_AGO' => array(
|
||||
0 => 'just now',
|
||||
|
||||
@@ -44,7 +44,12 @@ $lang = array_merge($lang, array(
|
||||
'MCHAT_SETTINGS_PRUNE' => 'Pruning settings',
|
||||
'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 />Go to the <em>mChat 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.',
|
||||
'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.',
|
||||
'MCHAT_GLOBALUSERSETTINGS_OVERWRITE' => 'Overwrite settings for all users',
|
||||
'MCHAT_GLOBALUSERSETTINGS_OVERWRITE_EXPLAIN' => 'Applies the settings as defined above to <em>all</em> user accounts.',
|
||||
'MCHAT_GLOBALUSERSETTINGS_OVERWRITE_CONFIRM' => 'Confirm overwriting mChat settings for all users',
|
||||
|
||||
'MCHAT_ACP_USER_PREFS_EXPLAIN' => 'Below are listed all mChat preferences of the selected user. Settings for which the selected user does not have permission to customise are disabled. These settings can be changed in the <em>Global user settings</em> mChat configuration section.',
|
||||
|
||||
// ACP settings
|
||||
'MCHAT_ACP_GLOBALSETTINGS_TITLE' => 'mChat Global settings',
|
||||
|
||||
@@ -13,9 +13,6 @@ namespace dmzx\mchat\migrations;
|
||||
|
||||
class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
|
||||
{
|
||||
/** @const string */
|
||||
const MCHAT_VERSION = '2.0.0-RC3';
|
||||
|
||||
/** @var array */
|
||||
protected $mchat_config = null;
|
||||
|
||||
@@ -24,11 +21,6 @@ class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
|
||||
return array('\phpbb\db\migration\data\v31x\v317pl1');
|
||||
}
|
||||
|
||||
public function effectively_installed()
|
||||
{
|
||||
return isset($this->config['mchat_version']) && version_compare($this->config['mchat_version'], self::MCHAT_VERSION, '>=');
|
||||
}
|
||||
|
||||
protected function get_config()
|
||||
{
|
||||
if ($this->mchat_config == null)
|
||||
@@ -62,7 +54,7 @@ class mchat_2_0_0_rc3 extends \phpbb\db\migration\migration
|
||||
}
|
||||
|
||||
return array_merge($update_data, array(
|
||||
array('config.add', array('mchat_version', self::MCHAT_VERSION)),
|
||||
array('config.add', array('mchat_version', '2.0.0-RC3')),
|
||||
|
||||
// Add user permissions
|
||||
array('permission.add', array('u_mchat_use', true)),
|
||||
|
||||
29
migrations/mchat_2_0_0_rc4.php
Normal file
29
migrations/mchat_2_0_0_rc4.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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_rc4 extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array(
|
||||
'\dmzx\mchat\migrations\mchat_2_0_0_rc3',
|
||||
);
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.update', array('mchat_version', '2.0.0-RC4')),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -94,17 +94,6 @@ jQuery(function($) {
|
||||
};
|
||||
|
||||
$.extend(mChat, {
|
||||
clear: function() {
|
||||
if (mChat.cached('input').val() !== '') {
|
||||
if (confirm(mChat.clearConfirm)) {
|
||||
mChat.resetSession();
|
||||
mChat.cached('input').val('').keyup().trigger('autogrow');
|
||||
}
|
||||
setTimeout(function() {
|
||||
mChat.cached('input').focus();
|
||||
}, 1);
|
||||
}
|
||||
},
|
||||
sound: function(file) {
|
||||
if (!mChat.pageIsUnloading && !Cookies.get('mchat_no_sound')) {
|
||||
var audio = mChat.cached('sound-' + file).get(0);
|
||||
@@ -189,6 +178,9 @@ jQuery(function($) {
|
||||
});
|
||||
},
|
||||
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
|
||||
@@ -371,9 +363,6 @@ jQuery(function($) {
|
||||
clearInterval(mChat.whoisInterval);
|
||||
mChat.whoisInterval = setInterval(mChat.whois, mChat.whoisRefresh);
|
||||
}
|
||||
if (mChat.pause) {
|
||||
mChat.cached('input').one('keypress', mChat.endSession);
|
||||
}
|
||||
mChat.cached('status-ok').show();
|
||||
mChat.cached('status-load', 'status-error', 'status-paused').hide();
|
||||
mChat.cached('refresh-text').html(mChat.refreshYes);
|
||||
@@ -396,6 +385,18 @@ jQuery(function($) {
|
||||
mChat.cached('status-paused').show();
|
||||
mChat.cached('refresh-text').html(mChat.refreshNo);
|
||||
},
|
||||
pauseStart: function() {
|
||||
mChat.isPaused = true;
|
||||
mChat.cached('refresh-text').html(mChat.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('status-load', 'status-error', 'status-paused').hide();
|
||||
mChat.cached('status-ok').show();
|
||||
mChat.isPaused = false;
|
||||
},
|
||||
mention: function() {
|
||||
var $container = $(this).closest('.mchat-message');
|
||||
var username = mChat.entityDecode($container.data('mchat-username'));
|
||||
@@ -455,10 +456,12 @@ jQuery(function($) {
|
||||
}).get();
|
||||
|
||||
mChat.hiddenFields = {};
|
||||
$('#mchat-form').find('input[type=hidden]').each(function() {
|
||||
mChat.cached('form').find('input[type=hidden]').each(function() {
|
||||
mChat.hiddenFields[this.name] = this.value;
|
||||
});
|
||||
|
||||
mChat.isPaused = false;
|
||||
|
||||
if (!mChat.archivePage) {
|
||||
mChat.resetSession();
|
||||
|
||||
@@ -492,10 +495,8 @@ jQuery(function($) {
|
||||
}
|
||||
});
|
||||
|
||||
mChat.startRelativeTimeUpdate(mChat.cached('messages'));
|
||||
|
||||
if (mChat.cached('input').is('input')) {
|
||||
$('#mchat-form').keypress(function(e) {
|
||||
mChat.cached('form').keypress(function(e) {
|
||||
if (e.which == 13) {
|
||||
mChat.add();
|
||||
e.preventDefault();
|
||||
@@ -504,8 +505,21 @@ jQuery(function($) {
|
||||
});
|
||||
}
|
||||
|
||||
if (mChat.pause) {
|
||||
mChat.cached('form').keyup(function(e) {
|
||||
if (mChat.refreshInterval !== false) {
|
||||
var val = mChat.cached('input').val();
|
||||
if (mChat.isPaused && val === '') {
|
||||
mChat.pauseEnd();
|
||||
} else if (!mChat.isPaused && val !== '') {
|
||||
mChat.pauseStart();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (mChat.showCharCount) {
|
||||
$('#mchat-form').keyup(function(e) {
|
||||
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');
|
||||
@@ -515,12 +529,16 @@ jQuery(function($) {
|
||||
});
|
||||
}
|
||||
|
||||
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.startRelativeTimeUpdate(mChat.cached('messages'));
|
||||
|
||||
$(window).on('beforeunload', function() {
|
||||
mChat.pageIsUnloading = true;
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<!-- Leave empty -->
|
||||
|
||||
@@ -24,16 +24,29 @@
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- EVENT dmzx_mchat_body_before -->
|
||||
|
||||
<!-- IF MCHAT_IS_COLLAPSIBLE -->
|
||||
<a class="category<!-- IF S_MCHAT_HIDDEN --> hidden-category<!-- ENDIF --> mchat-category"></a>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<div class="forabg">
|
||||
<a id="mChat"></a>
|
||||
<div class="inner">
|
||||
<ul class="topiclist">
|
||||
<li class="header">
|
||||
<!-- INCLUDE mchat_header.html -->
|
||||
<!-- IF MCHAT_IS_COLLAPSIBLE -->
|
||||
<a href="{U_MCHAT_COLLAPSE_URL}"
|
||||
class="collapse-btn collapse-<!-- IF S_MCHAT_HIDDEN -->show<!-- ELSE -->hide<!-- ENDIF --> mchat-collapse"
|
||||
data-hidden="{S_MCHAT_HIDDEN}"
|
||||
data-ajax="phpbb_collapse"
|
||||
data-overlay="true"
|
||||
title="{L_MCHAT_COLLAPSE_TITLE}"></a>
|
||||
<!-- ENDIF -->
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="mchat-body" class="postbody">
|
||||
<div id="mchat-body" class="postbody<!-- IF MCHAT_IS_COLLAPSIBLE --> collapsible<!-- ENDIF -->">
|
||||
<!-- INCLUDE mchat_script_data.html -->
|
||||
|
||||
<!-- IF not MCHAT_SOUND_DISABLED -->
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<noscript><div class="error">{L_MCHAT_NOJAVASCRIPT}</div></noscript>
|
||||
<!-- IF MCHAT_ALLOW_USE -->
|
||||
<!-- IF MCHAT_INPUT_AREA -->
|
||||
<input id="mchat-input" type="text" name="message" class="inputbox medium" />
|
||||
<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>
|
||||
<!-- ENDIF -->
|
||||
@@ -22,9 +22,6 @@
|
||||
<div id="mchat-buttons">
|
||||
<!-- IF MCHAT_ALLOW_USE -->
|
||||
<input id="mchat-add" type="button" class="button2" data-mchat-action="add" value="{L_MCHAT_ADD}" />
|
||||
<!-- IF MCHAT_USER_TIMEOUT or MCHAT_PAUSE_ON_INPUT -->
|
||||
<input id="mchat-clear" type="button" class="button2" data-mchat-action="clear" value="{L_RESET}" />
|
||||
<!-- ENDIF -->
|
||||
<!-- IF MCHAT_ALLOW_SMILES and .smiley -->
|
||||
<input type="button" class="button2" data-mchat-toggle="smilies" value="{L_MCHAT_SMILES}" />
|
||||
<!-- ENDIF -->
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
userTimeout : {MCHAT_USER_TIMEOUT},
|
||||
mssgLngth : {MCHAT_MESSAGE_LNGTH},
|
||||
editDeleteLimit : {MCHAT_EDIT_DELETE_LIMIT},
|
||||
removeBBCodes : '{MCHAT_DISALLOWED_BBCODES}',
|
||||
removeBBCodes : '{A_MCHAT_DISALLOWED_BBCODES}',
|
||||
|
||||
// Language
|
||||
minutesAgo : {
|
||||
<!-- BEGIN mchattime -->
|
||||
{mchattime.KEY}: '{mchattime.LANG}'<!-- IF not mchattime.IS_LAST -->,<!-- ENDIF -->
|
||||
{mchattime.KEY}: '{mchattime.A_LANG}'<!-- IF not mchattime.IS_LAST -->,<!-- ENDIF -->
|
||||
<!-- END mchattime -->
|
||||
},
|
||||
newMessageAlert : '{LA_MCHAT_NEW_CHAT}',
|
||||
@@ -40,13 +40,12 @@
|
||||
noAccess : '{LA_NO_AUTH_OPERATION}',
|
||||
flood : '{LA_MCHAT_FLOOD}',
|
||||
delConfirm : '{LA_MCHAT_DELCONFIRM}',
|
||||
clearConfirm : '{LA_MCHAT_RESET_QUESTION}',
|
||||
sessOut : '{LA_MCHAT_SESSION_OUT}',
|
||||
sessEnds : '{LA_MCHAT_SESSION_ENDS_JS}',
|
||||
refreshYes : '{MCHAT_REFRESH_YES}',
|
||||
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 : '{MCHAT_MESS_LONG}',
|
||||
mssgLngthLong : '{A_MCHAT_MESS_LONG}',
|
||||
likes : '{LA_MCHAT_LIKES}'
|
||||
};
|
||||
// ]]>
|
||||
|
||||
@@ -130,10 +130,14 @@
|
||||
.mchat-text {
|
||||
clear: both;
|
||||
overflow: hidden;
|
||||
padding: 0 5px 2px;
|
||||
padding: 2px 5px;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.mchat-text strong {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.mchat-text li {
|
||||
display: list-item !important;
|
||||
list-style-type: inherit !important;
|
||||
@@ -324,3 +328,19 @@
|
||||
#mchat-panel #abbc3_buttons .abbc3_buttons_row {
|
||||
margin: 0 auto !important;
|
||||
}
|
||||
|
||||
/* Compatibility with Collapsible Categories extension */
|
||||
|
||||
.mchat-category {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.mchat-collapse {
|
||||
display: none;
|
||||
line-height: 0;
|
||||
}
|
||||
|
||||
.hidden-category + .forabg #mchat-body .topiclist.forums {
|
||||
display: block;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user