Version 2.0.0-RC5
This commit is contained in:
@@ -281,12 +281,16 @@ class functions
|
||||
}
|
||||
|
||||
$sql_array = array(
|
||||
'SELECT' => 'm.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm',
|
||||
'SELECT' => 'm.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm, p.post_visibility',
|
||||
'FROM' => array($this->mchat_table => 'm'),
|
||||
'LEFT_JOIN' => array(
|
||||
array(
|
||||
'FROM' => array(USERS_TABLE => 'u'),
|
||||
'ON' => 'm.user_id = u.user_id',
|
||||
),
|
||||
array(
|
||||
'FROM' => array(POSTS_TABLE => 'p'),
|
||||
'ON' => 'm.post_id = p.post_id',
|
||||
)
|
||||
),
|
||||
'WHERE' => $sql_where,
|
||||
|
||||
@@ -678,6 +678,25 @@ class mchat
|
||||
*/
|
||||
protected function assign_messages($rows)
|
||||
{
|
||||
// Auth checks
|
||||
foreach ($rows as $i => $row)
|
||||
{
|
||||
if ($row['forum_id'])
|
||||
{
|
||||
// No permission to read forum
|
||||
if (!$this->auth->acl_get('f_read', $row['forum_id']))
|
||||
{
|
||||
unset($rows[$i]);
|
||||
}
|
||||
|
||||
// Post is not approved and no approval permission
|
||||
if ($row['post_visibility'] !== ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id']))
|
||||
{
|
||||
unset($rows[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$rows)
|
||||
{
|
||||
return;
|
||||
@@ -713,19 +732,8 @@ class mchat
|
||||
|
||||
foreach ($rows as $i => $row)
|
||||
{
|
||||
// Auth checks
|
||||
if ($row['forum_id'] && !$this->auth->acl_get('f_read', $row['forum_id']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$message_for_edit = generate_text_for_edit($row['message'], $row['bbcode_uid'], $row['bbcode_options']);
|
||||
|
||||
if (in_array($row['user_id'], $foes))
|
||||
{
|
||||
$row['message'] = $this->user->lang('MCHAT_FOE', get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang('GUEST')));
|
||||
}
|
||||
|
||||
$username_full = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang('GUEST'));
|
||||
|
||||
// Fix profile link root path by replacing relative paths with absolute board URL
|
||||
@@ -734,6 +742,11 @@ class mchat
|
||||
$username_full = preg_replace('#(?<=href=")[\./]+?/(?=\w)#', $board_url, $username_full);
|
||||
}
|
||||
|
||||
if (in_array($row['user_id'], $foes))
|
||||
{
|
||||
$row['message'] = $this->user->lang('MCHAT_FOE', $username_full);
|
||||
}
|
||||
|
||||
$message_age = time() - $row['message_time'];
|
||||
$minutes_ago = $this->get_minutes_ago($message_age);
|
||||
$datetime = $this->user->format_date($row['message_time'], $this->settings->cfg('mchat_date'));
|
||||
|
||||
Reference in New Issue
Block a user