diff --git a/pandora_console/include/functions_messages.php b/pandora_console/include/functions_messages.php index 4cee825ecc..1ecb6dd186 100644 --- a/pandora_console/include/functions_messages.php +++ b/pandora_console/include/functions_messages.php @@ -339,14 +339,16 @@ function messages_get_message_sent(int $message_id) /** * Counts private messages * - * @param string $user Target user. - * @param boolean $incl_read Whether or not to include read messages. + * @param string $user Target user. + * @param boolean $incl_read Whether or not to include read messages. + * @param boolean $ignore_source Ignore source. * * @return integer The number of messages this user has */ function messages_get_count( string $user='', - bool $incl_read=false + bool $incl_read=false, + bool $ignore_source=false ) { if (empty($user)) { global $config; @@ -361,10 +363,19 @@ function messages_get_count( $read = 'where t.read is null'; } + if ($ignore_source === true) { + $source_sql = ''; + } else { + $source_sql = 'INNER JOIN tnotification_source ns + ON tm.id_source = ns.id + AND ns.enabled = 1'; + } + $sql = sprintf( 'SELECT count(*) FROM ( SELECT DISTINCT tm.*, utimestamp_read > 0 as "read" FROM tmensajes tm + %s LEFT JOIN tnotification_user nu ON tm.id_mensaje=nu.id_mensaje AND nu.id_user="%s" @@ -377,6 +388,7 @@ function messages_get_count( AND (nu.id_user="%s" OR (up.id_usuario="%s" AND ng.id_group=0)) ) t %s', + $source_sql, $user, $user, $user, diff --git a/pandora_console/operation/messages/message_edit.php b/pandora_console/operation/messages/message_edit.php index b284bc3d13..8e6173ca24 100644 --- a/pandora_console/operation/messages/message_edit.php +++ b/pandora_console/operation/messages/message_edit.php @@ -106,34 +106,69 @@ if ($read_message) { $dst_name = $message['id_usuario_destino']; } - $table = new stdClass(); - $table->width = '100%'; - $table->class = 'databox filters'; - $table->data = []; + // Parse message chain. + ?> - $table->data[0][0] = __('Sender'); - $table->data[0][1] = $user_name.' '.__('at').' '.ui_print_timestamp( - $message['timestamp'], - true, - ['prominent' => 'timestamp'] - ); +
'.$parsed_message.'
'; + echo ''.$date.''; + echo '