Version 0.1.2
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"type": "phpbb-extension",
|
"type": "phpbb-extension",
|
||||||
"description": "mChat Extension for phpbb 3.1.x",
|
"description": "mChat Extension for phpbb 3.1.x",
|
||||||
"homepage": "http://www.dmzx-web.net",
|
"homepage": "http://www.dmzx-web.net",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"time": "2015-03-10",
|
"time": "2015-03-10",
|
||||||
"keywords": ["phpbb", "extension", "mchat"],
|
"keywords": ["phpbb", "extension", "mchat"],
|
||||||
"license": "GPL-2.0",
|
"license": "GPL-2.0",
|
||||||
@@ -27,6 +27,11 @@
|
|||||||
"display-name": "mChat Extension",
|
"display-name": "mChat Extension",
|
||||||
"soft-require": {
|
"soft-require": {
|
||||||
"phpbb/phpbb": "3.1.*"
|
"phpbb/phpbb": "3.1.*"
|
||||||
|
},
|
||||||
|
"version-check": {
|
||||||
|
"host": "www.dmzx-web.net",
|
||||||
|
"directory": "/versions",
|
||||||
|
"filename": "mchat_version.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,7 @@ services:
|
|||||||
- @cache
|
- @cache
|
||||||
- @pagination
|
- @pagination
|
||||||
- @request
|
- @request
|
||||||
|
- @dispatcher
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
- %core.table_prefix%
|
- %core.table_prefix%
|
||||||
@@ -53,6 +54,7 @@ services:
|
|||||||
- @log
|
- @log
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @cache
|
- @cache
|
||||||
|
- @service_container
|
||||||
- %core.table_prefix%
|
- %core.table_prefix%
|
||||||
- %dmzx.mchat.table.mchat%
|
- %dmzx.mchat.table.mchat%
|
||||||
- %dmzx.mchat.table.mchat_config%
|
- %dmzx.mchat.table.mchat_config%
|
||||||
@@ -67,6 +69,7 @@ services:
|
|||||||
- @template
|
- @template
|
||||||
- @user
|
- @user
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
|
- @service_container
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
- %core.table_prefix%
|
- %core.table_prefix%
|
||||||
|
|||||||
@@ -94,17 +94,17 @@ class admin_controller
|
|||||||
'date' => $this->request->variable('mchat_date', '', true),
|
'date' => $this->request->variable('mchat_date', '', true),
|
||||||
'whois' => $this->request->variable('mchat_whois', 0),
|
'whois' => $this->request->variable('mchat_whois', 0),
|
||||||
'whois_refresh' => $this->request->variable('mchat_whois_refresh', 0),
|
'whois_refresh' => $this->request->variable('mchat_whois_refresh', 0),
|
||||||
'bbcode_disallowed' => utf8_normalize_nfc($this->request->variable('mchat_bbcode_disallowed', '', true)),
|
'bbcode_disallowed' => $this->request->variable('mchat_bbcode_disallowed', '', true),
|
||||||
'prune_enable' => $this->request->variable('mchat_prune_enable', 0),
|
'prune_enable' => $this->request->variable('mchat_prune_enable', 0),
|
||||||
'prune_num' => $this->request->variable('mchat_prune_num', 0),
|
'prune_num' => $this->request->variable('mchat_prune_num', 0),
|
||||||
'index_height' => $this->request->variable('mchat_index_height', 0),
|
'index_height' => $this->request->variable('mchat_index_height', 0),
|
||||||
'custom_height' => $this->request->variable('mchat_custom_height', 0),
|
'custom_height' => $this->request->variable('mchat_custom_height', 0),
|
||||||
'static_message' => utf8_normalize_nfc($this->request->variable('mchat_static_message', '', true)),
|
'static_message' => $this->request->variable('mchat_static_message', '', true),
|
||||||
'override_min_post_chars' => $this->request->variable('mchat_override_min_post_chars', 0),
|
'override_min_post_chars' => $this->request->variable('mchat_override_min_post_chars', 0),
|
||||||
'override_smilie_limit' => $this->request->variable('mchat_override_smilie_limit', 0),
|
'override_smilie_limit' => $this->request->variable('mchat_override_smilie_limit', 0),
|
||||||
'timeout' => $this->request->variable('mchat_timeout', 0),
|
'timeout' => $this->request->variable('mchat_timeout', 0),
|
||||||
'pause_on_input' => $this->request->variable('mchat_pause_on_input', 0),
|
'pause_on_input' => $this->request->variable('mchat_pause_on_input', 0),
|
||||||
'rules' => utf8_normalize_nfc($this->request->variable('mchat_rules', '', true)),
|
'rules' => $this->request->variable('mchat_rules', '', true),
|
||||||
'avatars' => $this->request->variable('mchat_avatars', 0),
|
'avatars' => $this->request->variable('mchat_avatars', 0),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -169,7 +169,8 @@ class admin_controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// let's get it on
|
// let's get it on
|
||||||
$sql = 'SELECT * FROM ' . $this->mchat_config_table;
|
$sql = 'SELECT *
|
||||||
|
FROM ' . $this->mchat_config_table;
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$mchat_config = array();
|
$mchat_config = array();
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ class functions_mchat
|
|||||||
/** @var \phpbb\cache\service */
|
/** @var \phpbb\cache\service */
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
|
/** @var \phpbb\event\dispatcher_interface */
|
||||||
|
protected $dispatcher;
|
||||||
|
|
||||||
protected $table_prefix;
|
protected $table_prefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,13 +53,14 @@ class functions_mchat
|
|||||||
* @param \phpbb\cache\service $cache
|
* @param \phpbb\cache\service $cache
|
||||||
* @param $table_prefix
|
* @param $table_prefix
|
||||||
*/
|
*/
|
||||||
public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $table_prefix, $mchat_table, $mchat_config_table, $mchat_sessions_table)
|
public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $dispatcher, $table_prefix, $mchat_table, $mchat_config_table, $mchat_sessions_table)
|
||||||
{
|
{
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
|
$this->dispatcher = $dispatcher;
|
||||||
$this->phpbb_log = $log;
|
$this->phpbb_log = $log;
|
||||||
$this->table_prefix = $table_prefix;
|
$this->table_prefix = $table_prefix;
|
||||||
$this->mchat_table = $mchat_table;
|
$this->mchat_table = $mchat_table;
|
||||||
@@ -73,7 +77,8 @@ class functions_mchat
|
|||||||
// Grab the config entries in the ACP...and cache em :P
|
// Grab the config entries in the ACP...and cache em :P
|
||||||
if (($config_mchat = $this->cache->get('_mchat_config')) === false)
|
if (($config_mchat = $this->cache->get('_mchat_config')) === false)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT * FROM ' . $this->mchat_config_table;
|
$sql = 'SELECT *
|
||||||
|
FROM ' . $this->mchat_config_table;
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$config_mchat = array();
|
$config_mchat = array();
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
@@ -144,7 +149,8 @@ class functions_mchat
|
|||||||
{
|
{
|
||||||
$check_time = time() - (int) $session_time;
|
$check_time = time() - (int) $session_time;
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . $this->mchat_sessions_table . ' WHERE user_lastupdate < ' . $check_time;
|
$sql = 'DELETE FROM ' . $this->mchat_sessions_table . '
|
||||||
|
WHERE user_lastupdate < ' . $check_time;
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
// add the user into the sessions upon first visit
|
// add the user into the sessions upon first visit
|
||||||
@@ -214,7 +220,9 @@ class functions_mchat
|
|||||||
// insert user into the mChat sessions table
|
// insert user into the mChat sessions table
|
||||||
if ($this->user->data['user_type'] == USER_FOUNDER || $this->user->data['user_type'] == USER_NORMAL)
|
if ($this->user->data['user_type'] == USER_FOUNDER || $this->user->data['user_type'] == USER_NORMAL)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT * FROM ' . $this->mchat_sessions_table . ' WHERE user_id =' . (int) $this->user->data['user_id'];
|
$sql = 'SELECT *
|
||||||
|
FROM ' . $this->mchat_sessions_table . '
|
||||||
|
WHERE user_id =' . (int) $this->user->data['user_id'];
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$row = $this->db->sql_fetchrow($result);
|
$row = $this->db->sql_fetchrow($result);
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
@@ -251,7 +259,8 @@ class functions_mchat
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'DELETE FROM ' . $this->mchat_table . ' WHERE post_id = ' . (int) $post_id;
|
$sql = 'DELETE FROM ' . $this->mchat_table . '
|
||||||
|
WHERE post_id = ' . (int) $post_id;
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -265,7 +274,8 @@ class functions_mchat
|
|||||||
function mchat_prune($mchat_prune_amount)
|
function mchat_prune($mchat_prune_amount)
|
||||||
{
|
{
|
||||||
// Run query to get the total message rows...
|
// Run query to get the total message rows...
|
||||||
$sql = 'SELECT COUNT(message_id) AS total_messages FROM ' . $this->mchat_table;
|
$sql = 'SELECT COUNT(message_id) AS total_messages
|
||||||
|
FROM ' . $this->mchat_table;
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$mchat_total_messages = (int) $this->db->sql_fetchfield('total_messages');
|
$mchat_total_messages = (int) $this->db->sql_fetchfield('total_messages');
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
@@ -281,7 +291,9 @@ class functions_mchat
|
|||||||
if ($prune)
|
if ($prune)
|
||||||
{
|
{
|
||||||
|
|
||||||
$result = $this->db->sql_query_limit('SELECT * FROM '. $this->mchat_table . ' ORDER BY message_id ASC', 1);
|
$result = $this->db->sql_query_limit('SELECT *
|
||||||
|
FROM '. $this->mchat_table . '
|
||||||
|
ORDER BY message_id ASC', 1);
|
||||||
$row = $this->db->sql_fetchrow($result);
|
$row = $this->db->sql_fetchrow($result);
|
||||||
$first_id = (int) $row['message_id'];
|
$first_id = (int) $row['message_id'];
|
||||||
|
|
||||||
@@ -374,4 +386,16 @@ class functions_mchat
|
|||||||
}
|
}
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function functions_mchat_aft()
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Event functions_mchat_aft
|
||||||
|
*
|
||||||
|
* @event dmzx.mchat.core.functions_mchat_aft
|
||||||
|
* @since 0.1.2
|
||||||
|
*/
|
||||||
|
$this->dispatcher->trigger_event('dmzx.mchat.core.functions_mchat_aft');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,9 @@ class render_helper
|
|||||||
/** @var \phpbb\request\request */
|
/** @var \phpbb\request\request */
|
||||||
protected $request;
|
protected $request;
|
||||||
|
|
||||||
|
/** @var \phpbb\event\dispatcher_interface */
|
||||||
|
protected $dispatcher;
|
||||||
|
|
||||||
protected $phpbb_root_path;
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
protected $phpEx;
|
protected $phpEx;
|
||||||
@@ -66,7 +69,7 @@ class render_helper
|
|||||||
* @param $phpEx
|
* @param $phpEx
|
||||||
* @param $table_prefix
|
* @param $table_prefix
|
||||||
*/
|
*/
|
||||||
public function __construct(\dmzx\mchat\core\functions_mchat $functions_mchat, \phpbb\config\config $config, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\log\log_interface $log, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\pagination $pagination, \phpbb\request\request $request, $phpbb_root_path, $phpEx, $table_prefix, $mchat_table)
|
public function __construct(\dmzx\mchat\core\functions_mchat $functions_mchat, \phpbb\config\config $config, \phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\log\log_interface $log, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\pagination $pagination, \phpbb\request\request $request, \phpbb\event\dispatcher_interface $dispatcher, $phpbb_root_path, $phpEx, $table_prefix, $mchat_table)
|
||||||
{
|
{
|
||||||
$this->functions_mchat = $functions_mchat;
|
$this->functions_mchat = $functions_mchat;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
@@ -78,6 +81,7 @@ class render_helper
|
|||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
$this->pagination = $pagination;
|
$this->pagination = $pagination;
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
|
$this->dispatcher = $dispatcher;
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->phpEx = $phpEx;
|
$this->phpEx = $phpEx;
|
||||||
$this->phpbb_log = $log;
|
$this->phpbb_log = $log;
|
||||||
@@ -141,8 +145,10 @@ class render_helper
|
|||||||
|
|
||||||
// grab fools..uhmmm, foes the user has
|
// grab fools..uhmmm, foes the user has
|
||||||
$foes_array = array();
|
$foes_array = array();
|
||||||
$sql = 'SELECT * FROM ' . ZEBRA_TABLE . '
|
$sql = 'SELECT *
|
||||||
WHERE user_id = ' . $this->user->data['user_id'] . ' AND foe = 1';
|
FROM ' . ZEBRA_TABLE . '
|
||||||
|
WHERE user_id = ' . $this->user->data['user_id'] . '
|
||||||
|
AND foe = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
while ($row = $this->db->sql_fetchrow($result))
|
while ($row = $this->db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
@@ -273,7 +279,8 @@ class render_helper
|
|||||||
if ($this->config['mchat_enable'] && $mchat_read_archive && $mchat_view)
|
if ($this->config['mchat_enable'] && $mchat_read_archive && $mchat_view)
|
||||||
{
|
{
|
||||||
// how many chats do we have?
|
// how many chats do we have?
|
||||||
$sql = 'SELECT COUNT(message_id) AS messages FROM ' . $this->mchat_table;
|
$sql = 'SELECT COUNT(message_id) AS messages
|
||||||
|
FROM ' . $this->mchat_table;
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$mchat_total_messages = $this->db->sql_fetchfield('messages');
|
$mchat_total_messages = $this->db->sql_fetchfield('messages');
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
@@ -350,7 +357,8 @@ class render_helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run query again to get the total message rows...
|
// Run query again to get the total message rows...
|
||||||
$sql = 'SELECT COUNT(message_id) AS mess_id FROM ' . $this->mchat_table;
|
$sql = 'SELECT COUNT(message_id) AS mess_id
|
||||||
|
FROM ' . $this->mchat_table;
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
$mchat_total_message = $this->db->sql_fetchfield('mess_id');
|
$mchat_total_message = $this->db->sql_fetchfield('mess_id');
|
||||||
$this->db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
@@ -433,7 +441,7 @@ class render_helper
|
|||||||
$message_edit = $row['message'];
|
$message_edit = $row['message'];
|
||||||
decode_message($message_edit, $row['bbcode_uid']);
|
decode_message($message_edit, $row['bbcode_uid']);
|
||||||
$message_edit = str_replace('"', '"', $message_edit);
|
$message_edit = str_replace('"', '"', $message_edit);
|
||||||
$message_edit = mb_ereg_replace("'", "’", $message_edit); // Edit Fix ;)
|
$message_edit = mb_ereg_replace("'", "’", $message_edit);// Edit Fix ;)
|
||||||
if (sizeof($foes_array))
|
if (sizeof($foes_array))
|
||||||
{
|
{
|
||||||
if (in_array($row['user_id'], $foes_array))
|
if (in_array($row['user_id'], $foes_array))
|
||||||
@@ -524,7 +532,7 @@ class render_helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reguest...
|
// Reguest...
|
||||||
$message = utf8_ucfirst(utf8_normalize_nfc($this->request->variable('message', '', true)));
|
$message = utf8_ucfirst($this->request->variable('message', '', true));
|
||||||
|
|
||||||
// must have something other than bbcode in the message
|
// must have something other than bbcode in the message
|
||||||
if (empty($mchatregex))
|
if (empty($mchatregex))
|
||||||
@@ -545,7 +553,8 @@ class render_helper
|
|||||||
if (!$mchat_no_flood && $this->config_mchat['flood_time'])
|
if (!$mchat_no_flood && $this->config_mchat['flood_time'])
|
||||||
{
|
{
|
||||||
$mchat_flood_current_time = time();
|
$mchat_flood_current_time = time();
|
||||||
$sql = 'SELECT message_time FROM ' . $this->mchat_table . '
|
$sql = 'SELECT message_time
|
||||||
|
FROM ' . $this->mchat_table . '
|
||||||
WHERE user_id = ' . (int) $this->user->data['user_id'] . '
|
WHERE user_id = ' . (int) $this->user->data['user_id'] . '
|
||||||
ORDER BY message_time DESC';
|
ORDER BY message_time DESC';
|
||||||
$result = $this->db->sql_query_limit($sql, 1);
|
$result = $this->db->sql_query_limit($sql, 1);
|
||||||
@@ -588,13 +597,19 @@ class render_helper
|
|||||||
{
|
{
|
||||||
if (empty($bbcode_replace))
|
if (empty($bbcode_replace))
|
||||||
{
|
{
|
||||||
$bbcode_replace = array('#\[(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
|
$bbcode_replace = array('#\[(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi', '#\[/(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
|
||||||
'#\[/(' . $this->config_mchat['bbcode_disallowed'] . ')[^\[\]]+\]#Usi',
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$message = preg_replace($bbcode_replace, '', $message);
|
$message = preg_replace($bbcode_replace, '', $message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Event render_helper_add
|
||||||
|
*
|
||||||
|
* @event dmzx.mchat.core.render_helper_add
|
||||||
|
* @since 0.1.2
|
||||||
|
*/
|
||||||
|
$this->dispatcher->trigger_event('dmzx.mchat.core.render_helper_add');
|
||||||
|
|
||||||
$sql_ary = array(
|
$sql_ary = array(
|
||||||
'forum_id' => 0,
|
'forum_id' => 0,
|
||||||
@@ -783,9 +798,8 @@ class render_helper
|
|||||||
$this->config['max_post_smilies'] = $old_cfg['max_post_smilies'];
|
$this->config['max_post_smilies'] = $old_cfg['max_post_smilies'];
|
||||||
unset($old_cfg['max_post_smilies']);
|
unset($old_cfg['max_post_smilies']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//adds a log
|
//adds a log
|
||||||
// $message_author = get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']);
|
|
||||||
// add_log('admin', 'LOG_EDITED_MCHAT', $message_author);
|
|
||||||
$this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EDITED_MCHAT', false, array($row['username']));
|
$this->phpbb_log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EDITED_MCHAT', false, array($row['username']));
|
||||||
// insert user into the mChat sessions table
|
// insert user into the mChat sessions table
|
||||||
$this->functions_mchat->mchat_sessions($mchat_session_time, true);
|
$this->functions_mchat->mchat_sessions($mchat_session_time, true);
|
||||||
@@ -879,13 +893,15 @@ class render_helper
|
|||||||
$order_legend = ($this->config['legend_sort_groupname']) ? 'group_name' : 'group_legend';
|
$order_legend = ($this->config['legend_sort_groupname']) ? 'group_name' : 'group_legend';
|
||||||
if ($this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
if ($this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT group_id, group_name, group_colour, group_type FROM ' . GROUPS_TABLE . '
|
$sql = 'SELECT group_id, group_name, group_colour, group_type
|
||||||
|
FROM ' . GROUPS_TABLE . '
|
||||||
WHERE group_legend <> 0
|
WHERE group_legend <> 0
|
||||||
ORDER BY ' . $order_legend . ' ASC';
|
ORDER BY ' . $order_legend . ' ASC';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type FROM ' . GROUPS_TABLE . ' g
|
$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)
|
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
|
WHERE g.group_legend <> 0
|
||||||
AND (g.group_type <> ' . GROUP_HIDDEN . '
|
AND (g.group_type <> ' . GROUP_HIDDEN . '
|
||||||
@@ -1052,6 +1068,13 @@ class render_helper
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Event render_helper_aft
|
||||||
|
*
|
||||||
|
* @event dmzx.mchat.core.render_helper_aft
|
||||||
|
* @since 0.1.2
|
||||||
|
*/
|
||||||
|
$this->dispatcher->trigger_event('dmzx.mchat.core.render_helper_aft');
|
||||||
|
|
||||||
// show index stats
|
// show index stats
|
||||||
if (!empty($this->config['mchat_stats_index']) && !empty($this->user->data['user_mchat_stats_index']))
|
if (!empty($this->config['mchat_stats_index']) && !empty($this->user->data['user_mchat_stats_index']))
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ class listener implements EventSubscriberInterface
|
|||||||
/** @var \phpbb\db\driver\driver_interface */
|
/** @var \phpbb\db\driver\driver_interface */
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
|
/** @var ContainerInterface */
|
||||||
|
protected $phpbb_container;
|
||||||
|
|
||||||
protected $phpbb_root_path;
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
protected $phpEx;
|
protected $phpEx;
|
||||||
@@ -47,7 +50,7 @@ class listener implements EventSubscriberInterface
|
|||||||
*/
|
*/
|
||||||
protected $mchat_table;
|
protected $mchat_table;
|
||||||
|
|
||||||
public function __construct(\dmzx\mchat\core\render_helper $render_helper, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\controller\helper $controller_helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\db\driver\driver_interface $db, $root_path, $phpEx, $table_prefix,$mchat_table)
|
public function __construct(\dmzx\mchat\core\render_helper $render_helper, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\controller\helper $controller_helper, \phpbb\template\template $template, \phpbb\user $user, \phpbb\db\driver\driver_interface $db, $phpbb_container, $root_path, $phpEx, $table_prefix,$mchat_table)
|
||||||
{
|
{
|
||||||
$this->render_helper = $render_helper;
|
$this->render_helper = $render_helper;
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
@@ -56,6 +59,7 @@ class listener implements EventSubscriberInterface
|
|||||||
$this->controller_helper = $controller_helper;
|
$this->controller_helper = $controller_helper;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
$this->phpbb_container = $phpbb_container;
|
||||||
$this->root_path = $root_path;
|
$this->root_path = $root_path;
|
||||||
$this->phpEx = $phpEx;
|
$this->phpEx = $phpEx;
|
||||||
$this->table_prefix = $table_prefix;
|
$this->table_prefix = $table_prefix;
|
||||||
@@ -75,12 +79,10 @@ class listener implements EventSubscriberInterface
|
|||||||
|
|
||||||
public function add_page_viewonline($event)
|
public function add_page_viewonline($event)
|
||||||
{
|
{
|
||||||
global $user, $phpbb_container, $phpEx;
|
if (strrpos($event['row']['session_page'], 'app.' . $this->phpEx . '/chat') === 0)
|
||||||
|
|
||||||
if (strrpos($event['row']['session_page'], 'app.' . $phpEx . '/chat') === 0)
|
|
||||||
{
|
{
|
||||||
$event['location'] = $user->lang('MCHAT_TITLE');
|
$event['location'] = $this->user->lang('MCHAT_TITLE');
|
||||||
$event['location_url'] = $phpbb_container->get('controller.helper')->route('dmzx_mchat_controller');
|
$event['location_url'] = $this->phpbb_container->get('controller.helper')->route('dmzx_mchat_controller');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +149,7 @@ class listener implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
$mchat_new_data = $this->user->lang['MCHAT_NEW_EDIT'];
|
$mchat_new_data = $this->user->lang['MCHAT_NEW_EDIT'];
|
||||||
}
|
}
|
||||||
else if ($event['mode'] == 'reply'&& (isset($this->config['mchat_new_posts_reply']) && $this->config['mchat_new_posts_reply']))
|
else if ($event['mode'] == 'reply' && (isset($this->config['mchat_new_posts_reply']) && $this->config['mchat_new_posts_reply']))
|
||||||
{
|
{
|
||||||
$mchat_new_data = $this->user->lang['MCHAT_NEW_REPLY'];
|
$mchat_new_data = $this->user->lang['MCHAT_NEW_REPLY'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace dmzx\mchat\migrations;
|
namespace dmzx\mchat\migrations;
|
||||||
|
|
||||||
class mchat_module extends \phpbb\db\migration\migration
|
class mchat_module_acp extends \phpbb\db\migration\migration
|
||||||
{
|
{
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
@@ -9,13 +9,13 @@
|
|||||||
|
|
||||||
namespace dmzx\mchat\migrations;
|
namespace dmzx\mchat\migrations;
|
||||||
|
|
||||||
class mchat_schema_6 extends \phpbb\db\migration\migration
|
class mchat_module_cat extends \phpbb\db\migration\migration
|
||||||
{
|
{
|
||||||
|
|
||||||
static public function depends_on()
|
static public function depends_on()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'\dmzx\mchat\migrations\mchat_schema_5',
|
'\dmzx\mchat\migrations\mchat_schema',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace dmzx\mchat\migrations;
|
namespace dmzx\mchat\migrations;
|
||||||
|
|
||||||
class mchat_module1 extends \phpbb\db\migration\migration
|
class mchat_module_ucp extends \phpbb\db\migration\migration
|
||||||
{
|
{
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
@@ -11,6 +11,7 @@ namespace dmzx\mchat\migrations;
|
|||||||
|
|
||||||
class mchat_schema extends \phpbb\db\migration\migration
|
class mchat_schema extends \phpbb\db\migration\migration
|
||||||
{
|
{
|
||||||
|
var $ext_version = '0.1.2';
|
||||||
|
|
||||||
public function update_data()
|
public function update_data()
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,7 @@ class mchat_schema extends \phpbb\db\migration\migration
|
|||||||
array('config.add', array('mchat_new_posts_quote', false)),
|
array('config.add', array('mchat_new_posts_quote', false)),
|
||||||
array('config.add', array('mchat_message_top', true)),
|
array('config.add', array('mchat_message_top', true)),
|
||||||
array('config.add', array('mchat_stats_index', false)),
|
array('config.add', array('mchat_stats_index', false)),
|
||||||
array('config.add', array('mchat_version','0.1.1')),
|
array('config.add', array('mchat_version', $this->ext_version)),
|
||||||
|
|
||||||
// Add permissions
|
// Add permissions
|
||||||
array('permission.add', array('u_mchat_use')),
|
array('permission.add', array('u_mchat_use')),
|
||||||
@@ -78,6 +79,42 @@ class mchat_schema extends \phpbb\db\migration\migration
|
|||||||
),
|
),
|
||||||
'PRIMARY_KEY' => 'config_name',
|
'PRIMARY_KEY' => 'config_name',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
$this->table_prefix . 'mchat' => array(
|
||||||
|
'COLUMNS' => array(
|
||||||
|
'message_id' => array('UINT', NULL, 'auto_increment'),
|
||||||
|
'user_id' => array('UINT', 0),
|
||||||
|
'user_ip' => array('VCHAR:40', ''),
|
||||||
|
'message' => array('MTEXT_UNI', ''),
|
||||||
|
'bbcode_bitfield' => array('VCHAR', ''),
|
||||||
|
'bbcode_uid' => array('VCHAR:8', ''),
|
||||||
|
'bbcode_options' => array('BOOL', '7'),
|
||||||
|
'message_time' => array('INT:11', 0),
|
||||||
|
'forum_id' => array('UINT', 0),
|
||||||
|
'post_id' => array('UINT', 0),
|
||||||
|
),
|
||||||
|
'PRIMARY_KEY' => 'message_id',
|
||||||
|
),
|
||||||
|
|
||||||
|
$this->table_prefix . 'mchat_sessions' => array(
|
||||||
|
'COLUMNS' => array(
|
||||||
|
'user_id' => array('UINT', 0),
|
||||||
|
'user_lastupdate' => array('TIMESTAMP', 0),
|
||||||
|
'user_ip' => array('VCHAR:40', ''),
|
||||||
|
),
|
||||||
|
'PRIMARY_KEY' => 'user_id',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
'add_columns' => array(
|
||||||
|
$this->table_prefix . 'users' => array(
|
||||||
|
'user_mchat_index' => array('BOOL', '1'),
|
||||||
|
'user_mchat_sound' => array('BOOL', '1'),
|
||||||
|
'user_mchat_stats_index' => array('BOOL', '1'),
|
||||||
|
'user_mchat_topics' => array('BOOL', '1'),
|
||||||
|
'user_mchat_avatars' => array('BOOL', '1'),
|
||||||
|
'user_mchat_input_area' => array('BOOL', '1'),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -86,8 +123,21 @@ class mchat_schema extends \phpbb\db\migration\migration
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'drop_tables' => array(
|
'drop_tables' => array(
|
||||||
|
$this->table_prefix . 'mchat',
|
||||||
|
$this->table_prefix . 'mchat_sessions',
|
||||||
$this->table_prefix . 'mchat_config',
|
$this->table_prefix . 'mchat_config',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
'drop_columns' => array(
|
||||||
|
$this->table_prefix . 'users' => array(
|
||||||
|
'user_mchat_index',
|
||||||
|
'user_mchat_sound',
|
||||||
|
'user_mchat_stats_index',
|
||||||
|
'user_mchat_topics',
|
||||||
|
'user_mchat_avatars',
|
||||||
|
'user_mchat_input_area',
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package phpBB Extension - mChat
|
|
||||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace dmzx\mchat\migrations;
|
|
||||||
|
|
||||||
class mchat_schema_2 extends \phpbb\db\migration\migration
|
|
||||||
{
|
|
||||||
|
|
||||||
static public function depends_on()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'\dmzx\mchat\migrations\mchat_schema',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
public function update_schema()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'add_tables' => array(
|
|
||||||
$this->table_prefix . 'mchat' => array(
|
|
||||||
'COLUMNS' => array(
|
|
||||||
'message_id' => array('UINT', NULL, 'auto_increment'),
|
|
||||||
'user_id' => array('UINT', 0),
|
|
||||||
'user_ip' => array('VCHAR:40', ''),
|
|
||||||
'message' => array('MTEXT_UNI', ''),
|
|
||||||
'bbcode_bitfield' => array('VCHAR', ''),
|
|
||||||
'bbcode_uid' => array('VCHAR:8', ''),
|
|
||||||
'bbcode_options' => array('BOOL', '7'),
|
|
||||||
'message_time' => array('INT:11', 0),
|
|
||||||
'forum_id' => array('UINT', 0),
|
|
||||||
'post_id' => array('UINT', 0),
|
|
||||||
),
|
|
||||||
'PRIMARY_KEY' => 'message_id',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function revert_schema()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'drop_tables' => array(
|
|
||||||
$this->table_prefix . 'mchat',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package phpBB Extension - mChat
|
|
||||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace dmzx\mchat\migrations;
|
|
||||||
|
|
||||||
class mchat_schema_4 extends \phpbb\db\migration\migration
|
|
||||||
{
|
|
||||||
|
|
||||||
static public function depends_on()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'\dmzx\mchat\migrations\mchat_schema_3',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function update_schema()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'add_columns' => array(
|
|
||||||
$this->table_prefix . 'users' => array(
|
|
||||||
'user_mchat_index' => array('BOOL', '1'),
|
|
||||||
'user_mchat_sound' => array('BOOL', '1'),
|
|
||||||
'user_mchat_stats_index' => array('BOOL', '1'),
|
|
||||||
'user_mchat_topics' => array('BOOL', '1'),
|
|
||||||
'user_mchat_avatars' => array('BOOL', '1'),
|
|
||||||
'user_mchat_input_area' => array('BOOL', '1'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function revert_schema()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'drop_columns' => array(
|
|
||||||
$this->table_prefix . 'users' => array(
|
|
||||||
'user_mchat_index',
|
|
||||||
'user_mchat_sound',
|
|
||||||
'user_mchat_stats_index',
|
|
||||||
'user_mchat_topics',
|
|
||||||
'user_mchat_avatars',
|
|
||||||
'user_mchat_input_area',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package phpBB Extension - mChat
|
|
||||||
* @copyright (c) 2015 dmzx - http://www.dmzx-web.net
|
|
||||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace dmzx\mchat\migrations;
|
|
||||||
|
|
||||||
class mchat_schema_5 extends \phpbb\db\migration\migration
|
|
||||||
{
|
|
||||||
|
|
||||||
static public function depends_on()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'\dmzx\mchat\migrations\mchat_schema_4',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function update_schema()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'add_tables' => array(
|
|
||||||
$this->table_prefix . 'mchat_sessions' => array(
|
|
||||||
'COLUMNS' => array(
|
|
||||||
'user_id' => array('UINT', 0),
|
|
||||||
'user_lastupdate' => array('TIMESTAMP', 0),
|
|
||||||
'user_ip' => array('VCHAR:40', ''),
|
|
||||||
),
|
|
||||||
'PRIMARY_KEY' => 'user_id',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function revert_schema()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'drop_tables' => array(
|
|
||||||
$this->table_prefix . 'mchat_sessions',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,13 +9,13 @@
|
|||||||
|
|
||||||
namespace dmzx\mchat\migrations;
|
namespace dmzx\mchat\migrations;
|
||||||
|
|
||||||
class mchat_schema_3 extends \phpbb\db\migration\migration
|
class mchat_schema_sample_data extends \phpbb\db\migration\migration
|
||||||
{
|
{
|
||||||
|
|
||||||
static public function depends_on()
|
static public function depends_on()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'\dmzx\mchat\migrations\mchat_schema_2',
|
'\dmzx\mchat\migrations\mchat_schema',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,6 +182,7 @@
|
|||||||
<input type="button" class="button2" onclick="mChat.toggle('BBCodes');" value="{L_MCHAT_BBCODES}" />
|
<input type="button" class="button2" onclick="mChat.toggle('BBCodes');" value="{L_MCHAT_BBCODES}" />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
<!-- EVENT dmzx_mchat_buttons_mid -->
|
||||||
<!-- IF MCHAT_READ_ARCHIVE_BUTTON -->
|
<!-- IF MCHAT_READ_ARCHIVE_BUTTON -->
|
||||||
<input type="button" class="button2" onclick="window.location.href = '{MCHAT_ARCHIVE_URL}';" value="{L_MCHAT_ARCHIVE}" />
|
<input type="button" class="button2" onclick="window.location.href = '{MCHAT_ARCHIVE_URL}';" value="{L_MCHAT_ARCHIVE}" />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
@@ -192,6 +193,7 @@
|
|||||||
<!-- IF MCHAT_RULES -->
|
<!-- IF MCHAT_RULES -->
|
||||||
<input type="button" class="button2" onclick="popup('{U_MCHAT_RULES}', 450, 275); return false;" value="{L_MCHAT_HELP}" />
|
<input type="button" class="button2" onclick="popup('{U_MCHAT_RULES}', 450, 275); return false;" value="{L_MCHAT_HELP}" />
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
<!-- EVENT dmzx_mchat_buttons_after -->
|
||||||
<!-- IF MCHAT_ALLOW_BBCODES -->
|
<!-- IF MCHAT_ALLOW_BBCODES -->
|
||||||
<!-- INCLUDE mchat_bbcodes.html -->
|
<!-- INCLUDE mchat_bbcodes.html -->
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|||||||
@@ -13,10 +13,12 @@ class ucp_mchat_info
|
|||||||
{
|
{
|
||||||
function module()
|
function module()
|
||||||
{
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'filename' => '\dmzx\mchat\ucp\ucp_mchat_module',
|
'filename' => '\dmzx\mchat\ucp\ucp_mchat_module',
|
||||||
'title' => 'UCP_MCHAT_CONFIG',
|
'title' => 'UCP_MCHAT_CONFIG',
|
||||||
'version' => '1.3.8',
|
'version' => $config['mchat_version'],
|
||||||
'modes' => array(
|
'modes' => array(
|
||||||
'configuration' => array(
|
'configuration' => array(
|
||||||
'title' => 'UCP_MCHAT_CONFIG',
|
'title' => 'UCP_MCHAT_CONFIG',
|
||||||
|
|||||||
Reference in New Issue
Block a user