diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index 5a9d2b049e..d03a8eac9c 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -1469,7 +1469,7 @@ class SocialManager extends UserManager * @param int $messageId id parent * @param string $messageStatus status type of message * - * @return bool + * @return int * * @author Yannick Warnier */ @@ -1481,9 +1481,13 @@ class SocialManager extends UserManager $messageStatus = '' ) { $tblMessage = Database::get_main_table(TABLE_MESSAGE); - $userId = intval($userId); - $friendId = intval($friendId); - $messageId = intval($messageId); + $userId = (int) $userId; + $friendId = (int) $friendId; + $messageId = (int) $messageId; + + if (empty($userId) || empty($friendId)) { + return 0; + } // Just in case we replace the and \n and \n\r while saving in the DB $messageContent = str_replace(["\n", "\n\r"], '
', $messageContent); @@ -1662,7 +1666,7 @@ class SocialManager extends UserManager $start = '0000-00-00'; } - $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId); + $isOwnWall = api_get_user_id() == $userId && $userId == $friendId; $messages = self::getWallMessages( $userId, MESSAGE_STATUS_WALL, @@ -1708,8 +1712,12 @@ class SocialManager extends UserManager if ($isOwnWall) { $media .= '
'; $media .= '
'; - $media .= 'x'; + $url = api_get_path(WEB_CODE_PATH).'social/profile.php?messageId='.$message['id']; + $media .= Display::url( + Display::returnFontAwesomeIcon('trash'), + $url, + ['title' => get_lang("SocialMessageDelete")] + ); $media .= '
'; $media .= '
'; } @@ -1816,7 +1824,8 @@ class SocialManager extends UserManager $description = $graph->description; $title = $graph->title; $html = '
'; - $html .= empty($image) ? '' : ''; + $html .= empty($image) ? '' : ' + '; $html .= '
'; $html .= ''; $html .= empty($description) ? '' : ''.$description.''; @@ -2011,8 +2020,9 @@ class SocialManager extends UserManager } $friendHtml .= ''; } else { - $friendHtml .= '
'.get_lang('NoFriendsInYourContactList').'
' - .' '.get_lang('TryAndFindSomeFriends').'
'; + $friendHtml .= '
'.get_lang('NoFriendsInYourContactList').'
+ + '.get_lang('TryAndFindSomeFriends').'
'; } $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')'); @@ -2087,8 +2097,9 @@ class SocialManager extends UserManager } $friendHtml .= '
'; } else { - $friendHtml .= '
'.get_lang('NoFriendsInYourContactList').' ' - .' '.get_lang('TryAndFindSomeFriends').'
'; + $friendHtml .= '
'.get_lang('NoFriendsInYourContactList').' + + '.get_lang('TryAndFindSomeFriends').'
'; } return $friendHtml; @@ -2226,8 +2237,12 @@ class SocialManager extends UserManager $htmlDelete = ''; if ($isOwnWall) { - $htmlDelete .= 'x'; + $url = api_get_path(WEB_CODE_PATH).'social/profile.php?messageId='.$message['id']; + $htmlDelete .= Display::url( + Display::returnFontAwesomeIcon('trash'), + $url, + ['title' => get_lang('SocialMessageDelete')] + ); } $html = ''; @@ -2238,7 +2253,8 @@ class SocialManager extends UserManager $html .= '
'; } $html .= '
'; - $html .= ''.''.$nameCompleteAuthor.''; + $html .= ' + '.$nameCompleteAuthor.''; $html .= '
'; $html .= '
'; $html .= '
'.$nameCompleteAuthor.''.$htmlReceiver.'
'; diff --git a/main/mySpace/index.php b/main/mySpace/index.php index 0b468fefba..1d72d4ae7b 100755 --- a/main/mySpace/index.php +++ b/main/mySpace/index.php @@ -154,7 +154,10 @@ $actionsRight .= Display::url( ); if (!empty($session_id) && - !in_array($display, ['accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview']) + !in_array( + $display, + ['accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview'] + ) ) { $actionsLeft .= Display::url( Display::return_icon( @@ -214,7 +217,10 @@ if (!empty($session_id) && // Actions menu $nb_menu_items = count($menu_items); if (empty($session_id) || - in_array($display, ['accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview']) + in_array( + $display, + ['accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview'] + ) ) { if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { @@ -261,14 +267,12 @@ $view->assign('numberTeachers', $numberTeachers); $view->assign('humanresources', $countHumanResourcesUsers); $view->assign( 'total_user', - $numberStudents + $numberStudentBosses + $numberTeachers + $countHumanResourcesUsers); + $numberStudents + $numberStudentBosses + $numberTeachers + $countHumanResourcesUsers +); $view->assign('studentboss', STUDENT_BOSS); $view->assign('drh', DRH); $view->assign('stats', $stats); - -//echo Display::page_subheader(get_lang('Students').' ('.$numberStudents.')'); - $form = new FormValidator( 'search_user', 'get', @@ -360,7 +364,6 @@ if ($skipData == false) { } } - $view->assign('header', $nameTools); $view->assign('form', $form->returnForm()); $view->assign('actions', Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]));