@ -725,18 +725,18 @@ class SocialManager extends UserManager
array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends')
array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends')
)) {
)) {
$html .= '< div class = "panel panel-default sidebar-nav" > ';
$htm l . = '< div class = "panel-body "> ';
$links = '< ul class = "nav nav-pills nav-stacked "> ';
$html .= '< ul class = "nav nav-pills nav-stacked" > ';
$active = $show == 'home' ? 'active' : null;
$active = $show == 'home' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "home-icon ' . $active . '" >
< li class = "home-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/home.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/home.php" >
' . $homeIcon . ' ' . get_lang('Home') . '
' . $homeIcon . ' ' . get_lang('Home') . '
< / a >
< / a >
< / li > ';
< / li > ';
$active = $show == 'messages' ? 'active' : null;
$active = $show == 'messages' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "messages-icon ' . $active . '" >
< li class = "messages-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social" >
' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
@ -745,7 +745,7 @@ class SocialManager extends UserManager
//Invitations
//Invitations
$active = $show == 'invitations' ? 'active' : null;
$active = $show == 'invitations' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "invitations-icon ' . $active . '" >
< li class = "invitations-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php" >
' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
@ -754,21 +754,21 @@ class SocialManager extends UserManager
//Shared profile and groups
//Shared profile and groups
$active = $show == 'shared_profile' ? 'active' : null;
$active = $show == 'shared_profile' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "shared-profile-icon' . $active . '" >
< li class = "shared-profile-icon' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/profile.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/profile.php" >
' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
< / a >
< / a >
< / li > ';
< / li > ';
$active = $show == 'friends' ? 'active' : null;
$active = $show == 'friends' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "friends-icon ' . $active . '" >
< li class = "friends-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/friends.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/friends.php" >
' . $friendsIcon . ' ' . get_lang('Friends') . '
' . $friendsIcon . ' ' . get_lang('Friends') . '
< / a >
< / a >
< / li > ';
< / li > ';
$active = $show == 'browse_groups' ? 'active' : null;
$active = $show == 'browse_groups' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "browse-groups-icon ' . $active . '" >
< li class = "browse-groups-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/groups.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/groups.php" >
' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
@ -777,7 +777,7 @@ class SocialManager extends UserManager
//Search users
//Search users
$active = $show == 'search' ? 'active' : null;
$active = $show == 'search' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "search-icon ' . $active . '" >
< li class = "search-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/search.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/search.php" >
' . $searchIcon . ' ' . get_lang('Search') . '
' . $searchIcon . ' ' . get_lang('Search') . '
@ -786,13 +786,22 @@ class SocialManager extends UserManager
//My files
//My files
$active = $show == 'myfiles' ? 'active' : null;
$active = $show == 'myfiles' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "myfiles-icon ' . $active . '" >
< li class = "myfiles-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php" >
' . $filesIcon . ' ' . get_lang('MyFiles') . '
' . $filesIcon . ' ' . get_lang('MyFiles') . '
< / a >
< / a >
< / li > ';
< / li > ';
$html .='< / ul > < / div > < / div > ';
$links .='< / ul > ';
$html .= Display::panelCollapse(
get_lang('SocialNetwork'),
$links,
'social-network-menu',
null,
'sn-sidebar',
'sn-sidebar-collapse'
);
}
}
if (in_array($show, $show_groups) & & !empty($group_id)) {
if (in_array($show, $show_groups) & & !empty($group_id)) {
@ -804,13 +813,12 @@ class SocialManager extends UserManager
}
}
if ($show == 'shared_profile') {
if ($show == 'shared_profile') {
$html .= '< div class = "panel panel-default sidebar-nav" > ';
$html .= '< div class = "panel-body" > ';
$links = '< ul class = "nav nav-pills nav-stacked" > ';
$html .= '< ul class = "nav nav-pills nav-stacked" > ';
// My own profile
// My own profile
if ($show_full_profile & & $user_id == intval(api_get_user_id())) {
if ($show_full_profile & & $user_id == intval(api_get_user_id())) {
$htm l .= '
$links .= '
< li class = "home-icon ' . $active . '" >
< li class = "home-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/home.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/home.php" >
' . $homeIcon . ' ' . get_lang('Home') . '
' . $homeIcon . ' ' . get_lang('Home') . '
@ -822,14 +830,14 @@ class SocialManager extends UserManager
< / a >
< / a >
< / li > ';
< / li > ';
$active = $show == 'invitations' ? 'active' : null;
$active = $show == 'invitations' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "invitations-icon' . $active . '" >
< li class = "invitations-icon' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php" >
' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
< / a >
< / a >
< / li > ';
< / li > ';
$htm l .= '
$links .= '
< li class = "shared-profile-icon active" >
< li class = "shared-profile-icon active" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/profile.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/profile.php" >
' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
@ -846,14 +854,14 @@ class SocialManager extends UserManager
< / a >
< / a >
< / li > ';
< / li > ';
$active = $show == 'search' ? 'active' : null;
$active = $show == 'search' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "search-icon ' . $active . '" >
< li class = "search-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/search.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/search.php" >
' . $searchIcon . ' ' . get_lang('Search') . '
' . $searchIcon . ' ' . get_lang('Search') . '
< / a >
< / a >
< / li > ';
< / li > ';
$active = $show == 'myfiles' ? 'active' : null;
$active = $show == 'myfiles' ? 'active' : null;
$htm l .= '
$links .= '
< li class = "myfiles-icon ' . $active . '" >
< li class = "myfiles-icon ' . $active . '" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php" >
< a href = "' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php" >
' . $filesIcon . ' ' . get_lang('MyFiles') . '
' . $filesIcon . ' ' . get_lang('MyFiles') . '
@ -875,8 +883,8 @@ class SocialManager extends UserManager
'user_id' => $user_id
'user_id' => $user_id
]);
]);
$htm l .= '< li > ';
$links .= '< li > ';
$htm l .= Display::url(
$links .= Display::url(
"$sendMessageIcon $sendMessageText",
"$sendMessageIcon $sendMessageText",
$sendMesssageUrl,
$sendMesssageUrl,
[
[
@ -885,59 +893,29 @@ class SocialManager extends UserManager
'data-title' => $sendMessageText
'data-title' => $sendMessageText
]
]
);
);
$htm l .= '< / li > ';
$links .= '< / li > ';
}
}
// Check if I already sent an invitation message
// Check if I already sent an invitation message
$invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
$invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
if (isset($invitation_sent_list[$user_id]) & & is_array($invitation_sent_list[$user_id]) & & count($invitation_sent_list[$user_id]) > 0) {
if (isset($invitation_sent_list[$user_id]) & & is_array($invitation_sent_list[$user_id]) & & count($invitation_sent_list[$user_id]) > 0) {
$htm l .= '< li > < a href = "'.api_get_path(WEB_CODE_PATH).'social/invitations.php" > '.Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')).' '.get_lang('YouAlreadySentAnInvitation').'< / a > < / li > ';
$links .= '< li > < a href = "'.api_get_path(WEB_CODE_PATH).'social/invitations.php" > '.Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')).' '.get_lang('YouAlreadySentAnInvitation').'< / a > < / li > ';
} else {
} else {
if (!$show_full_profile) {
if (!$show_full_profile) {
$htm l .= '< li > < a class = "btn-to-send-invitation" href = "#" data-send-to = "' . $user_id . '" title = "'.get_lang('SendInvitation').'" > '.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').'< / a > < / li > ';
$links .= '< li > < a class = "btn-to-send-invitation" href = "#" data-send-to = "' . $user_id . '" title = "'.get_lang('SendInvitation').'" > '.Display :: return_icon('invitation.png', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').'< / a > < / li > ';
}
}
}
}
// Chat
$links .= '< / ul > ';
//@todo check if user is online and if it's a friend to show the chat link
$html .= Display::panelCollapse(
/*if (api_is_global_chat_enabled()) {
get_lang('SocialNetwork'),
$user_name = $user_info['complete_name'];
$links,
'social-network-menu',
if ($user_friend_relation == USER_RELATION_TYPE_FRIEND) {
null,
if ($user_id != api_get_user_id()) {
'sn-sidebar',
//Only show chat if I'm available to talk
'sn-sidebar-collapse'
if ($current_user_info['user_is_online_in_chat'] == 1) {
$options = array('onclick' => "javascript:chatWith('".$user_id."', '".Security::remove_XSS($user_name)."', '".$user_info['user_is_online_in_chat']."')");
$chat_icon = $user_info['user_is_online_in_chat'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline'));
$html .= Display::tag('li',
Display::url(
$chat_icon.' '.get_lang('Chat'),
'javascript:void(0);',
$options
)
);
}
}
} else {
if ($user_id != api_get_user_id()) {
if ($current_user_info['user_is_online_in_chat'] == 1) {
$message = Security::remove_XSS(sprintf(get_lang("YouHaveToAddXAsAFriendFirst"), $user_name));
$options = array('onclick' => "javascript:chatNotYetWith('".$message."')");
$chat_icon = $user_info['user_is_online_in_chat'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline'));
$html .= Display::tag('li',
Display::url(
$chat_icon.' '.get_lang('Chat'),
'javascript:void(0);',
$options
)
);
);
}
}
}
}*/
$html .= '< / ul > < / div > < / div > ';
if ($show_full_profile & & $user_id == intval(api_get_user_id())) {
if ($show_full_profile & & $user_id == intval(api_get_user_id())) {
$personal_course_list = UserManager::get_personal_session_course_list($user_id);
$personal_course_list = UserManager::get_personal_session_course_list($user_id);
@ -1566,12 +1544,13 @@ class SocialManager extends UserManager
$regExUrl = "/(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
$regExUrl = "/(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
$newText = '';
$newText = '';
if (preg_match($regExUrl, $text, $url)) {
if (preg_match($regExUrl, $text, $url)) {
// make the urls hyper links
$newText .= preg_replace($regExUrl, "< a target = \"_blank\" href = " . $url[0] . " > ".$url[0]."< / a > ", $text);
// Comment this line to disable OpenGraph
// Comment this line to disable OpenGraph
$newText .= self::getHtmlByLink($url[0]);
$newText .= self::getHtmlByLink($url[0]);
// make the urls hyper links
//$newText .= preg_replace($regExUrl, "< a target = \"_blank\" href = " . $url[0] . " > ".$url[0]."< / a > ", $text);
} else {
} else {
$newText .= $text;
$newText = $text;
}
}
return $newText;
return $newText;
}
}
@ -1586,8 +1565,9 @@ class SocialManager extends UserManager
$graph = OpenGraph::fetch($link);
$graph = OpenGraph::fetch($link);
$url = $graph->url;
$url = $graph->url;
$image = $graph->image;
$image = $graph->image;
$domain = empty($url) ? parse_url($link) : parse_url($url);
$domain = empty($url) ? '' : parse_url($url);
$domain = $domain['scheme'].'://'.$domain['host'];
$domain = $domain['scheme'].'://'.$domain['host'];
$html = '';
// Trick to verify if the Image Url Exist because of some bad metatag dev
// Trick to verify if the Image Url Exist because of some bad metatag dev
if (self::verifyUrl($image) == false){
if (self::verifyUrl($image) == false){
if (!($image[0] == '/')){
if (!($image[0] == '/')){
@ -1596,10 +1576,11 @@ class SocialManager extends UserManager
$image = $domain . $image;
$image = $domain . $image;
}
}
$title = $graph->title;
$title = $graph->title;
$html = '< div class = "thumbnail" > ';
$html .= '< a target = "_blank" href = "'.$link.'" > < h3 > '.$title.'< / h3 > ';
$html .= '< div class = "post-open-graph" > ';
$html .= empty($image) ? '' : '< img alt = "" src = "'.$image.'" height = "160" > < / a > ';
$html .= '< h4 > < a target = "_blank" href = "'.$link.'" > '.$title.'< / a > < / h4 > ';
$html .= empty($graph->description) ? '' : '< div > '.$graph->description.'< / div > ';
$html .= empty($image) ? '' : '< img alt = "" src = "'.$image.'" / > ';
$html .= empty($graph->description) ? '' : '< p class = "description" > '.$graph->description.'< a href = "'.$link.'" > '.$link.'< / a > < / p > ';
$html .= "< / div > ";
$html .= "< / div > ";
return $html;
return $html;
}
}
@ -1865,7 +1846,8 @@ class SocialManager extends UserManager
'post',
'post',
api_get_path(WEB_CODE_PATH).'social/profile.php',
api_get_path(WEB_CODE_PATH).'social/profile.php',
null,
null,
array('enctype' => 'multipart/form-data')
array('enctype' => 'multipart/form-data') ,
FormValidator::LAYOUT_HORIZONTAL
);
);
$form->addTextarea(
$form->addTextarea(
@ -1873,12 +1855,12 @@ class SocialManager extends UserManager
null,
null,
[
[
'placeholder' => get_lang('SocialWallWhatAreYouThinkingAbout'),
'placeholder' => get_lang('SocialWallWhatAreYouThinkingAbout'),
'style' => 'width : 100%'
'cols-size' => [1, 10, 1]
]
]
);
);
$form->addHtml('< div class = "form-group " > < div class = " url_preview col-md-9 panel-body " > < / div > < / div > ');
$form->addHtml('< div class = "url_preview" > < / div > ');
$form->addHidden('url_content', '');
$form->addHidden('url_content', '');
$form->addButtonSend(get_lang('Post'));
$form->addButtonSend(get_lang('Post'), null, false, ['cols-size' => [1, 10, 1]] );
$html = Display::panel($form->returnForm(), get_lang('SocialWall'));
$html = Display::panel($form->returnForm(), get_lang('SocialWall'));
return $html;
return $html;