Remove unused code

pull/3924/head
Julio Montoya 4 years ago
parent c0d7c866da
commit 58ea36bca2
  1. 40
      public/main/inc/lib/message.lib.php
  2. 2
      public/main/inc/lib/notification.lib.php
  3. 1
      public/main/social/group_topics.php
  4. 4
      public/main/social/message_for_group_form.inc.php
  5. 6
      public/plugin/advanced_subscription/src/render_mail.php

@ -163,7 +163,6 @@ class MessageManager
* @param int $sender_id * @param int $sender_id
* @param bool $directMessage * @param bool $directMessage
* @param int $forwardId * @param int $forwardId
* @param array $smsParameters
* @param bool $checkCurrentAudioId * @param bool $checkCurrentAudioId
* @param bool $forceTitleWhenSendingEmail force the use of $title as subject instead of "You have a new message" * @param bool $forceTitleWhenSendingEmail force the use of $title as subject instead of "You have a new message"
* *
@ -182,7 +181,6 @@ class MessageManager
$sender_id = 0, $sender_id = 0,
$directMessage = false, $directMessage = false,
$forwardId = 0, $forwardId = 0,
$smsParameters = [],
$checkCurrentAudioId = false, $checkCurrentAudioId = false,
$forceTitleWhenSendingEmail = false, $forceTitleWhenSendingEmail = false,
) { ) {
@ -401,7 +399,6 @@ class MessageManager
$content, $content,
$sender_info, $sender_info,
$attachmentAddedByMail, $attachmentAddedByMail,
$smsParameters,
$forceTitleWhenSendingEmail $forceTitleWhenSendingEmail
); );
} else { } else {
@ -435,8 +432,7 @@ class MessageManager
$subject, $subject,
$content, $content,
$group_info, $group_info,
$attachmentAddedByMail, $attachmentAddedByMail
$smsParameters
); );
} }
} }
@ -870,9 +866,11 @@ class MessageManager
*/ */
public static function display_message_for_group($groupId, $topic_id) public static function display_message_for_group($groupId, $topic_id)
{ {
global $my_group_role; return '';
$main_message = Container::getMessageAttachmentRepository()::get_message_by_id($topic_id);
if (empty($main_message)) { /*global $my_group_role;
$message = Container::getMessageRepository()->find($topic_id);
if (null === $message) {
return false; return false;
} }
@ -897,9 +895,8 @@ class MessageManager
$html = ''; $html = '';
$items_page_nr = null; $items_page_nr = null;
$user_sender_info = api_get_user_info($main_message['user_sender_id']); $filesAttachments = self::getAttachmentLinkList($message);
$filesAttachments = self::getAttachmentLinkList($main_message['id'], 0); $name = UserManager::formatUserFullName($message->getSender());
$name = $user_sender_info['complete_name'];
$topic_page_nr = isset($_GET['topics_page_nr']) ? (int) $_GET['topics_page_nr'] : null; $topic_page_nr = isset($_GET['topics_page_nr']) ? (int) $_GET['topics_page_nr'] : null;
@ -907,19 +904,19 @@ class MessageManager
$links .= '<div class="btn-group btn-group-sm">'; $links .= '<div class="btn-group btn-group-sm">';
if ((GROUP_USER_PERMISSION_ADMIN == $my_group_role || GROUP_USER_PERMISSION_MODERATOR == $my_group_role) || if ((GROUP_USER_PERMISSION_ADMIN == $my_group_role || GROUP_USER_PERMISSION_MODERATOR == $my_group_role) ||
$main_message['user_sender_id'] == $current_user_id $message->getSender()->getId() == $current_user_id
) { ) {
$urlEdit = $webCodePath.'social/message_for_group_form.inc.php?' $urlEdit = $webCodePath.'social/message_for_group_form.inc.php?'
.http_build_query( .http_build_query(
[ [
'user_friend' => $current_user_id, 'user_friend' => $current_user_id,
'group_id' => $groupId, 'group_id' => $groupId,
'message_id' => $main_message['id'], 'message_id' => $message->getId(),
'action' => 'edit_message_group', 'action' => 'edit_message_group',
'anchor_topic' => 'topic_'.$main_message['id'], 'anchor_topic' => 'topic_'.$message->getId(),
'topics_page_nr' => $topic_page_nr, 'topics_page_nr' => $topic_page_nr,
'items_page_nr' => $items_page_nr, 'items_page_nr' => $items_page_nr,
'topic_id' => $main_message['id'], 'topic_id' => $message->getId(),
] ]
); );
@ -933,18 +930,18 @@ class MessageManager
); );
} }
$links .= self::getLikesButton($main_message['id'], $current_user_id, $groupId); $links .= self::getLikesButton($message->getId(), $current_user_id, $groupId);
$urlReply = $webCodePath.'social/message_for_group_form.inc.php?' $urlReply = $webCodePath.'social/message_for_group_form.inc.php?'
.http_build_query( .http_build_query(
[ [
'user_friend' => $current_user_id, 'user_friend' => $current_user_id,
'group_id' => $groupId, 'group_id' => $groupId,
'message_id' => $main_message['id'], 'message_id' => $message->getId(),
'action' => 'reply_message_group', 'action' => 'reply_message_group',
'anchor_topic' => 'topic_'.$main_message['id'], 'anchor_topic' => 'topic_'.$message->getId(),
'topics_page_nr' => $topic_page_nr, 'topics_page_nr' => $topic_page_nr,
'topic_id' => $main_message['id'], 'topic_id' => $message->getId(),
] ]
); );
@ -971,9 +968,8 @@ class MessageManager
$links .= '</div>'; $links .= '</div>';
$links .= '</div>'; $links .= '</div>';
$title = '<h4>'.Security::remove_XSS($main_message['title'], STUDENT, true).$links.'</h4>'; $title = '<h4>'.Security::remove_XSS($message->getTitle(), STUDENT, true).$links.'</h4>';
$userPicture = $user_sender_info['avatar'];
$main_content .= '<div class="row">'; $main_content .= '<div class="row">';
$main_content .= '<div class="col-md-2">'; $main_content .= '<div class="col-md-2">';
$main_content .= '<div class="avatar-author">'; $main_content .= '<div class="avatar-author">';
@ -1176,7 +1172,7 @@ class MessageManager
$style_class $style_class
); );
} }
} }*/
return $html; return $html;
} }

@ -217,7 +217,6 @@ class Notification extends Model
* @param string $content * @param string $content
* @param array $senderInfo result of api_get_user_info() or GroupPortalManager:get_group_data() * @param array $senderInfo result of api_get_user_info() or GroupPortalManager:get_group_data()
* @param array $attachments * @param array $attachments
* @param array $smsParameters
* @param bool $forceTitleWhenSendingEmail force the use of $title as subject instead of "You have a new message" * @param bool $forceTitleWhenSendingEmail force the use of $title as subject instead of "You have a new message"
*/ */
public function saveNotification( public function saveNotification(
@ -228,7 +227,6 @@ class Notification extends Model
$content, $content,
$senderInfo = [], $senderInfo = [],
$attachments = [], $attachments = [],
$smsParameters = [],
$forceTitleWhenSendingEmail = false $forceTitleWhenSendingEmail = false
) { ) {
$this->type = (int) $type; $this->type = (int) $type;

@ -76,7 +76,6 @@ if (isset($_POST['action'])) {
$group_id, $group_id,
$parent_id, $parent_id,
$edit_message_id, $edit_message_id,
0,
$topic_id $topic_id
); );
} else { } else {

@ -38,13 +38,13 @@ if (!empty($group_id) && $allowed_action) {
$to_group = $group_info['name']; $to_group = $group_info['name'];
if (!empty($message_id)) { if (!empty($message_id)) {
$message_info = MessageManager::get_message_by_id($message_id); /*$message_info = MessageManager::get_message_by_id($message_id);
if ('reply_message_group' === $allowed_action) { if ('reply_message_group' === $allowed_action) {
$subject = get_lang('Reply').': '.api_xml_http_response_encode($message_info['title']); $subject = get_lang('Reply').': '.api_xml_http_response_encode($message_info['title']);
} else { } else {
$subject = api_xml_http_response_encode($message_info['title']); $subject = api_xml_http_response_encode($message_info['title']);
$message = api_xml_http_response_encode($message_info['content']); $message = api_xml_http_response_encode($message_info['content']);
} }*/
} }
} }

@ -19,7 +19,7 @@ $data['queueId'] = (int) ($_REQUEST['q']);
$verified = $plugin->checkHash($data, $hash); $verified = $plugin->checkHash($data, $hash);
if ($verified) { if ($verified) {
// Render mail // Render mail
$message = MessageManager::get_message_by_id($data['queueId']); //$message = MessageManager::get_message_by_id($data['queueId']);
$message = str_replace(['<br /><hr>', '<br />', '<br/>'], '', $message['content']); //$message = str_replace(['<br /><hr>', '<br />', '<br/>'], '', $message['content']);
echo $message; //echo $message;
} }

Loading…
Cancel
Save