Version 2.1.2
This commit is contained in:
40
core/log.php
40
core/log.php
@@ -104,19 +104,48 @@ class log
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $log_type The log type, one of edit|del
|
||||
* @param string $log_type The log type, one of edit|del or a custom type
|
||||
* @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
|
||||
* @return int The ID of the newly added log row, or 0 if no log row was added
|
||||
*/
|
||||
public function add_log($log_type, $message_id)
|
||||
{
|
||||
$this->db->sql_query('INSERT INTO ' . $this->mchat_settings->get_table_mchat_log() . ' ' . $this->db->sql_build_array('INSERT', [
|
||||
$log_row = [
|
||||
'log_type' => $this->get_type_id($log_type),
|
||||
'user_id' => (int) $this->user->data['user_id'],
|
||||
'message_id' => (int) $message_id,
|
||||
'log_ip' => $this->user->ip,
|
||||
'log_time' => time(),
|
||||
]));
|
||||
];
|
||||
|
||||
$insert_log = true;
|
||||
|
||||
/**
|
||||
* Event that allows adding log types
|
||||
*
|
||||
* @event dmzx.mchat.log_add_before
|
||||
* @var string log_type The log type, one of edit|del or a custom type
|
||||
* @var int message_id ID of the message to which this log entry belongs
|
||||
* @var array log_row Array that is about to be added to the mchat_log table
|
||||
* @var bool insert_log Whether or not to add the log_row
|
||||
* @since 2.1.2
|
||||
*/
|
||||
$vars = [
|
||||
'log_type',
|
||||
'message_id',
|
||||
'log_row',
|
||||
'insert_log',
|
||||
];
|
||||
extract($this->dispatcher->trigger_event('dmzx.mchat.log_add_before', compact($vars)));
|
||||
|
||||
if (!$insert_log)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = 'INSERT INTO ' . $this->mchat_settings->get_table_mchat_log() . ' ' . $this->db->sql_build_array('INSERT', $log_row);
|
||||
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
$log_id = (int) $this->db->sql_nextid();
|
||||
|
||||
@@ -171,12 +200,11 @@ class log
|
||||
* Event that allows processing log messages
|
||||
*
|
||||
* @event dmzx.mchat.action_refresh_process_log_row
|
||||
* @var array response The data that is sent back to the user (still incomplete at this point)
|
||||
* @var array log_row The log data (read only)
|
||||
* @since 2.0.0-RC6
|
||||
* @changed 2.1.2 Removed response
|
||||
*/
|
||||
$vars = [
|
||||
'response',
|
||||
'log_row',
|
||||
];
|
||||
extract($this->dispatcher->trigger_event('dmzx.mchat.action_refresh_process_log_row', compact($vars)));
|
||||
|
||||
@@ -571,6 +571,7 @@ class mchat
|
||||
unset($logs['latest']);
|
||||
|
||||
$log_edit_del_ids = $logs;
|
||||
unset($logs);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -761,18 +762,17 @@ class mchat
|
||||
$is_archive = $page == 'archive';
|
||||
$jump_to_id = $is_archive ? $this->request->variable('jumpto', 0) : 0;
|
||||
|
||||
// If the static message is not empty in the language file, use it, else ise the static message in the database
|
||||
// If the static message is not empty in the language file, use it, else use the static message in the database
|
||||
$static_message = $this->lang->lang('MCHAT_STATIC_MESSAGE') ?: $this->mchat_settings->cfg('mchat_static_message');
|
||||
$whois_refresh = $this->mchat_settings->cfg('mchat_whois_index') || $this->mchat_settings->cfg('mchat_navbar_link_count');
|
||||
|
||||
$template_data = [
|
||||
'MCHAT_PAGE' => $page,
|
||||
'MCHAT_CURRENT_URL' => '.' . $this->user->page['script_path'] . $this->user->page['page'],
|
||||
'MCHAT_CURRENT_URL' => $this->mchat_settings->get_current_page(),
|
||||
'MCHAT_ALLOW_SMILES' => $this->mchat_settings->cfg('allow_smilies') && $this->auth->acl_get('u_mchat_smilies'),
|
||||
'MCHAT_MESSAGE_TOP' => $this->mchat_settings->cfg('mchat_message_top'),
|
||||
'MCHAT_INDEX_HEIGHT' => $this->mchat_settings->cfg('mchat_index_height'),
|
||||
'MCHAT_CUSTOM_HEIGHT' => $this->mchat_settings->cfg('mchat_custom_height'),
|
||||
'MCHAT_LIVE_UPDATES' => $this->mchat_settings->cfg('mchat_live_updates'),
|
||||
'MCHAT_LOCATION' => $this->mchat_settings->cfg('mchat_location'),
|
||||
'MCHAT_CHARACTER_COUNT' => $this->mchat_settings->cfg('mchat_character_count'),
|
||||
'MCHAT_SOUND' => $this->mchat_settings->cfg('mchat_sound'),
|
||||
@@ -1096,7 +1096,7 @@ class mchat
|
||||
'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->lang->lang('GUEST')),
|
||||
'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->lang->lang('GUEST')),
|
||||
'MCHAT_WHOIS_USER' => $this->lang->lang('MCHAT_WHOIS_USER', $row['user_ip']),
|
||||
'MCHAT_U_IP' => $this->helper->route('dmzx_mchat_page_whois_controller', ['ip' => $row['user_ip']]),
|
||||
'MCHAT_U_IP' => $this->auth->acl_get('u_mchat_ip') ? $this->helper->route('dmzx_mchat_page_whois_controller', ['ip' => $row['user_ip']]) : false,
|
||||
'MCHAT_U_PERMISSIONS' => append_sid($this->mchat_settings->url('adm/index', true), ['i' => 'permissions', 'mode' => 'setting_user_global', rawurlencode('user_id[0]') => $row['user_id']], true, $this->user->session_id),
|
||||
'MCHAT_MESSAGE' => generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']),
|
||||
'MCHAT_TIME' => $minutes_ago === -1 ? $datetime : $this->lang->lang('MCHAT_MINUTES_AGO', $minutes_ago),
|
||||
|
||||
@@ -168,10 +168,10 @@ class settings
|
||||
'mchat_live_updates' => ['default' => 1],
|
||||
'mchat_log_enabled' => ['default' => 1],
|
||||
'mchat_max_input_height' => ['default' => 150, 'validation' => ['num', false, 0, 1000]],
|
||||
'mchat_max_message_lngth' => ['default' => 500, 'validation' => ['num', false, 0, 1000]],
|
||||
'mchat_max_message_lngth' => ['default' => 500],
|
||||
'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_message_num_custom' => ['default' => 10],
|
||||
'mchat_message_num_index' => ['default' => 10],
|
||||
'mchat_navbar_link_count' => ['default' => 1],
|
||||
'mchat_override_min_post_chars' => ['default' => 0],
|
||||
'mchat_override_smilie_limit' => ['default' => 0],
|
||||
@@ -185,7 +185,7 @@ class settings
|
||||
'mchat_prune_gc' => ['default' => strtotime('1 day', 0)],
|
||||
'mchat_prune_mode' => ['default' => 0],
|
||||
'mchat_prune_num' => ['default' => 0],
|
||||
'mchat_refresh' => ['default' => 10, 'validation' => ['num', false, 5, 60]],
|
||||
'mchat_refresh' => ['default' => 10, 'validation' => ['num', false, 2, 3600]],
|
||||
'mchat_timeout' => ['default' => 0, 'validation' => ['num', false, 0, (int) $this->cfg('session_length')]],
|
||||
'mchat_whois_refresh' => ['default' => 60, 'validation' => ['num', false, 10, 300]],
|
||||
];
|
||||
@@ -479,6 +479,27 @@ class settings
|
||||
return implode($this->lang->lang('COMMA_SEPARATOR'), $enabled_notifications_lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function get_current_page()
|
||||
{
|
||||
$page = $this->user->page['page_name'];
|
||||
|
||||
// Remove app.php if URL rewriting is enabled in the ACP
|
||||
if ($this->config['enable_mod_rewrite'])
|
||||
{
|
||||
$app_php = 'app.' . $this->php_ext . '/';
|
||||
|
||||
if (($app_position = strpos($page, $app_php)) !== false)
|
||||
{
|
||||
$page = substr($page, $app_position + strlen($app_php));
|
||||
}
|
||||
}
|
||||
|
||||
return generate_board_url() . '/' . $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param bool $absolute_url
|
||||
|
||||
Reference in New Issue
Block a user