Add validations if user exist.

pull/2487/head
jmontoyaa 7 years ago
parent 6329be3c7e
commit 7892ecf0d5
  1. 41
      main/inc/lib/message.lib.php

@ -1115,20 +1115,26 @@ class MessageManager
$title = Security::remove_XSS($row['title'], STUDENT, true);
$content = Security::remove_XSS($row['content'], STUDENT, true);
$from_user = api_get_user_info($user_sender_id);
$name = $from_user['complete_name_with_username'];
$message_content = Display::page_subheader(str_replace("\\", "", $title));
$user_image = '';
if (api_get_setting('allow_social_tool') == 'true') {
$user_image = Display::img(
$from_user['avatar_small'],
$name = get_lang('UnknownUser');
$userImage = '';
if (!empty($user_sender_id)) {
$fromUser = api_get_user_info($user_sender_id);
$name = $fromUser['complete_name_with_username'];
$userImage = Display::img(
$fromUser['avatar_small'],
$name,
array('title' => $name, 'class' => 'img-responsive img-circle', 'style' => 'max-width:35px'),
false
);
}
$message_content = Display::page_subheader(str_replace("\\", "", $title));
$receiverUserInfo = [];
if (!empty($row['user_receiver_id'])) {
$receiverUserInfo = api_get_user_info($row['user_receiver_id']);
}
$message_content .= '<tr>';
if (api_get_setting('allow_social_tool') == 'true') {
@ -1136,17 +1142,28 @@ class MessageManager
if ($source == 'outbox') {
$message_content .= '<div class="col-md-12">';
$message_content .= '<ul class="list-message">';
$message_content .= '<li>'.$user_image.'</li>';
$message_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> ';
$message_content .= '<li>'.$userImage.'</li>';
$message_content .= '<li>'.$name.'&nbsp;';
if (!empty($receiverUserInfo)) {
$message_content .= api_strtolower(get_lang('To')).'&nbsp;<b>'.$receiverUserInfo['complete_name_with_username'].'</b></li>';
} else {
$message_content .= api_strtolower(get_lang('To')).'&nbsp;<b>-</b></li>';
}
$message_content .= '<li>'.Display::dateToStringAgoAndLongDate($row['send_date']).'</li>';
$message_content .= '</ul>';
$message_content .= '</div>';
} else {
$message_content .= '<div class="col-md-12">';
$message_content .= '<ul class="list-message">';
$message_content .= '<li>'.$user_image.'</li>';
$message_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> </li>';
if (!empty($user_sender_id)) {
$message_content .= '<li>'.$userImage.'</li>';
$message_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a>';
} else {
$message_content .= '<li>'.$name;
}
$message_content .= '&nbsp;'.api_strtolower(get_lang('To')).'&nbsp;'.get_lang('Me');
$message_content .= '<li>'.Display::dateToStringAgoAndLongDate($row['send_date']).'</li>';
$message_content .= '</ul>';
$message_content .= '</div>';
@ -1155,7 +1172,7 @@ class MessageManager
} else {
if ($source == 'outbox') {
$message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.
$receiverUserInfo['complete_name'].'</b>';
$receiverUserInfo['complete_name_with_username'].'</b>';
} else {
$message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.
get_lang('Me').'</b>';

Loading…
Cancel
Save