diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index ec8a76f70e..aef58e26a5 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -708,6 +708,18 @@ a.personal_agenda:hover, a.personal_agenda:hover { .social-home-anonymous-online { width: 200px; } +.social-thumbnail { + padding: 0px; +} +.social-title { + font-size: 18px; + font-family: helvetica, arial, sans-serif; + color: #000; +} +.social-description { + padding: 8px; + color: #000; +} .menulist { margin: 0px; diff --git a/main/inc/ajax/social.ajax.php b/main/inc/ajax/social.ajax.php index 2a44c40fa0..cf6680d181 100755 --- a/main/inc/ajax/social.ajax.php +++ b/main/inc/ajax/social.ajax.php @@ -225,13 +225,15 @@ switch ($action) { // Read the Url using OpenGraph and returns the hyperlinks content case 'readUrlWithOpenGraph': $url = isset($_POST['social_wall_new_msg_main']) ? $_POST['social_wall_new_msg_main'] : ''; + $url = trim($url); $html = ''; - if (SocialManager::verifyUrl($url) == true){ + if (SocialManager::verifyUrl($url) == true && !$_SESSION['ogSearch']) { + $_SESSION['ogSearch'] = true; $html = Security::remove_XSS( SocialManager::readContentWithOpenGraph($url) ); } - echo utf8_decode($html); + echo $html; break; default: echo ''; diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index dabfd84a90..584590312f 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -1565,16 +1565,21 @@ class SocialManager extends UserManager */ public static function readContentWithOpenGraph($link) { + $domain = parse_url($link); + $domain['scheme'] = isset($domain['scheme']) ? $domain['scheme'] : 'http'; + $domain['host'] = isset($domain['host']) ? $domain['host'] : $domain['path'] ? $domain['path'] : $link; + $graph = OpenGraph::fetch($link); if (!$graph) { return false; } + $url = $graph->url; $image = $graph->image; - $domain = empty($url) ? parse_url($link) : parse_url($url); + $description = $graph->description; $domain = $domain['scheme'].'://'.$domain['host']; // Trick to verify if the Image Url Exist because of some bad metatag dev - if (self::verifyUrl($image) == false){ + if (self::verifyUrl($image) == false && $image){ if (!($image[0] == '/')){ $domain = $domain . '/'; } @@ -1582,11 +1587,13 @@ class SocialManager extends UserManager } $title = $graph->title; - $html = '
'; - $html .= '

'.$title.'

'; - $html .= empty($image) ? '' : '
'; - $html .= empty($graph->description) ? '' : '

'.$graph->description.'

'; - $html .= ''.$link.''; + $html = '
'; + $html .= empty($image) ? '' : ''; + $html .= ''; $html .= '
'; return $html; diff --git a/main/social/profile.php b/main/social/profile.php index 687b7daad1..adbe69a578 100755 --- a/main/social/profile.php +++ b/main/social/profile.php @@ -27,6 +27,10 @@ $show_full_profile = true; //social tab $this_section = SECTION_SOCIAL; +//Default OpenGraph search time +unset($_SESSION['ogSearch']); +$_SESSION['ogSearch'] = false; + //Initialize blocks $social_extra_info_block = null; $social_course_block = null; @@ -301,8 +305,11 @@ $socialAutoExtendLink = Display::url( // Added a Jquery Function to return the Preview of OpenGraph URL Content $htmlHeadXtra[] = '';