Browse Source

Merge pull request #412 from ilosada/5637-anibal-2

5637 anibal 2
Yannick Warnier 10 years ago
parent
commit
7faa7bc324
4 changed files with 25 additions and 18 deletions
  1. 3 3
      main/inc/lib/main_api.lib.php
  2. 13 5
      main/inc/lib/social.lib.php
  3. 4 5
      main/social/home.php
  4. 5 5
      main/social/profile.php

+ 3 - 3
main/inc/lib/main_api.lib.php

@@ -7553,10 +7553,10 @@ function api_get_configuration_value($variable)
 }
 
 /**
- * Returns supported image extensions
- * @return  array   Supported image extensions
+ * Returns supported image extensions in the portal
+ * @return  array   Supported image extensions in the portal
  */
-function getSupportedImageExtensions()
+function api_get_supported_image_extensions()
 {
     $supportedImageExtensions = array('jpg', 'jpeg', 'png', 'gif', 'svg');
     if (version_compare(PHP_VERSION, '5.5.0', '>=')) {

+ 13 - 5
main/inc/lib/social.lib.php

@@ -735,7 +735,7 @@ class SocialManager extends UserManager
         $total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) : '');
 
         $html = '';
-
+        $active = null;
         if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends'))) {
 
             $html .= '<div class="well sidebar-nav"><ul class="nav nav-list">';
@@ -1204,7 +1204,7 @@ class SocialManager extends UserManager
         $safeFileName = Database::escape_string($fileAttach['name']);
 
         $extension = strtolower(substr(strrchr($safeFileName, '.'), 1));
-        $allowedTypes = getSupportedImageExtensions();
+        $allowedTypes = api_get_supported_image_extensions();
         if (!in_array($extension, $allowedTypes)) {
             $flag = false;
         } else {
@@ -1413,7 +1413,15 @@ class SocialManager extends UserManager
         return $data;
     }
 
-
+    /**
+     * Returns the formatted header message post
+     * @param   int     $authorId   Author's id
+     * @param   int     $receiverId Receiver's id
+     * @param   array   $users      Author's and receiver's data
+     * @param   array   $message    Message data
+     * @param   boolean $isOwnWall  Determines if the author is in its own social wall or not
+     * @return  string  $html       The formatted header message post
+     */
     private  static function headerMessagePost($authorId, $receiverId, $users, $message, $isOwnWall = false)
     {
         $date = api_get_local_time($message['send_date']);
@@ -1493,7 +1501,7 @@ class SocialManager extends UserManager
      * @param   string  $text       Content text
      * @return  string  $newText    Content text with OpenGraph
      */
-    public function readContentWithOpenGraph($text)
+    public static function readContentWithOpenGraph($text)
     {
         // search link in first line
         $regExUrl = "/(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
@@ -1519,7 +1527,7 @@ class SocialManager extends UserManager
      * @param $link url
      * @return string data html
      */
-    public function getHtmlByLink($link)
+    public static function getHtmlByLink($link)
     {
         $graph = OpenGraph::fetch($link);
         $title = $graph->title;

+ 4 - 5
main/social/home.php

@@ -44,7 +44,7 @@ if (api_get_setting('profile', 'picture') == 'true') {
             get_lang('DelImage')
         );
     }
-    $allowed_picture_types = getSupportedImageExtensions();
+    $allowed_picture_types = api_get_supported_image_extensions();
     $form->addRule(
         'picture',
         get_lang('OnlyImagesAllowed') . ' (' . implode(
@@ -109,9 +109,9 @@ $socialRightContent .= '
         ' . get_lang('EditProfile') . '
     </a>
     </div></div></div>';
-
+$socialRightInformation = '<div class="span4">';
 if (api_get_setting('allow_skills_tool') == 'true') {
-    $socialRightInformation .= '<div><div class="well_border">';
+    $socialRightInformation .= '<div class="well_border">';
     $skill = new Skill();
     $ranking = $skill->get_user_skill_ranking(api_get_user_id());
     $url = api_get_path(WEB_CODE_PATH) . 'social/skills_ranking.php';
@@ -147,12 +147,11 @@ if (api_get_setting('allow_skills_tool') == 'true') {
     $socialRightInformation .= '</div>';
 }
 
-$socialRightInformation .= '</div>';
 
 //Search box
 $socialRightInformation .= '<div>';
 $socialRightInformation .= UserManager::get_search_form('');
-$socialRightInformation .= '<br />';
+$socialRightInformation .= '<br /></div>';
 
 //Group box by age
 $results = GroupPortalManager::get_groups_by_age(1, false);

+ 5 - 5
main/social/profile.php

@@ -384,7 +384,7 @@ foreach ($sessionList as $session) {
 
 // My friends
 $friend_html = listMyFriends($user_id, $link_shared ,$show_full_profile);
-$social_left_content.= '<div class="well sidebar-nav">' .$friend_html . '</div>';
+$social_left_content = '<div class="well sidebar-nav">' .$friend_html . '</div>';
 
 $personal_info = null;
 if (!empty($user_info['firstname']) || !empty($user_info['lastname'])) {
@@ -425,8 +425,8 @@ if ($show_full_profile) {
     $personal_info .=  '</dl>';
 }
 
-$wallSocialAddPost .= wallSocialAddPost();
-$social_right_content .= SocialManager::social_wrapper_div($wallSocialAddPost, 5);
+$wallSocialAddPost = wallSocialAddPost();
+$social_right_content = SocialManager::social_wrapper_div($wallSocialAddPost, 5);
 
 $social_right_content .= wallSocialPost($my_user_id, $friendId);
 $socialAutoExtendLink = Display::url(
@@ -437,7 +437,7 @@ $socialAutoExtendLink = Display::url(
     )
 );
 
-$socialRightInformation .=  SocialManager::social_wrapper_div($personal_info, 4);
+$socialRightInformation =  SocialManager::social_wrapper_div($personal_info, 4);
 
 //$social_right_content .= SocialManager::social_wrapper_div($wallSocial, 5);
 
@@ -654,7 +654,7 @@ if ($show_full_profile) {
     }
 
 
-    $sessions .=  '<div><h3>'.api_ucfirst(get_lang('MySessions')).'</h3></div>';
+    $sessions =  '<div><h3>'.api_ucfirst(get_lang('MySessions')).'</h3></div>';
     $sessions .=  "<div class='social-content-training'>$htmlSessionList</div>";
     $socialRightInformation .=  SocialManager::social_wrapper_div($sessions, 4);