Browse Source

Merge branch '1.9.x' of github.com:chamilo/chamilo-lms into 1.9.x

Yannick Warnier 10 years ago
parent
commit
4d692c6aea

+ 75 - 49
main/exercice/exercise.class.php

@@ -3626,6 +3626,7 @@ class Exercise
             'open_answer'   => $arrans,
             'answer_type'   => $answerType
         );
+
         return $return_array;
     }
 
@@ -3633,15 +3634,21 @@ class Exercise
      * Sends a notification when a user ends an examn
      *
      */
-    function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id) {
+    public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id)
+    {
         if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
             return null;
         }
         // Email configuration settings
-        $courseCode     = api_get_course_id();
-        $courseInfo    = api_get_course_info($courseCode);
+        $courseCode = api_get_course_id();
+        $courseInfo = api_get_course_info($courseCode);
+        $sessionId = api_get_session_id();
 
-        $url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&id='.$exe_id.'&action=qualify';
+        if (empty($courseInfo)) {
+            return false;
+        }
+
+        $url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?'.api_get_cidreq().'&id_session='.$sessionId.'&id='.$exe_id.'&action=qualify';
         $user_info = UserManager::get_user_info_by_id(api_get_user_id());
 
         $msg = '<p>'.get_lang('ExerciseAttempted').' :</p>
@@ -3666,12 +3673,11 @@ class Exercise
                     </table>';
         $open_question_list = null;
 
-        $msg    = str_replace("#email#",       $user_info['email'],$msg);
-        $msg1   = str_replace("#exercise#",    $this->exercise, $msg);
-        $msg    = str_replace("#firstName#",   $user_info['firstname'],$msg1);
-        $msg1   = str_replace("#lastName#",    $user_info['lastname'],$msg);
-
-        $msg    = str_replace("#course#",      $courseInfo['name'],$msg1);
+        $msg = str_replace("#email#", $user_info['email'], $msg);
+        $msg1 = str_replace("#exercise#", $this->exercise, $msg);
+        $msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
+        $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg);
+        $msg = str_replace("#course#", $courseInfo['name'], $msg1);
 
         if ($origin != 'learnpath') {
             $msg.= get_lang('ClickToCommentAndGiveFeedback').', <br />
@@ -3681,32 +3687,35 @@ class Exercise
         $mail_content = $msg1;
         $subject = get_lang('ExerciseAttempted');
 
-        $teachers = array();
-        if (api_get_session_id()) {
-            $teachers = CourseManager::get_coach_list_from_course_code($coursecode, api_get_session_id());
+        if (!empty($sessionId)) {
+            $teachers = CourseManager::get_coach_list_from_course_code($courseCode, $sessionId);
         } else {
-            $teachers = CourseManager::get_teacher_list_from_course_code($courseInfo['code']);
+            $teachers = CourseManager::get_teacher_list_from_course_code($courseCode);
         }
 
         if (!empty($teachers)) {
             foreach ($teachers as $user_id => $teacher_data) {
-                MessageManager::send_message_simple($user_id, $subject, $mail_content);
+                MessageManager::send_message_simple(
+                    $user_id,
+                    $subject,
+                    $mail_content
+                );
             }
         }
-
     }
 
     /**
      * Sends a notification when a user ends an examn
      *
      */
-    function send_notification_for_open_questions($question_list_answers, $origin, $exe_id) {
+    function send_notification_for_open_questions($question_list_answers, $origin, $exe_id)
+    {
         if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
             return null;
         }
         // Email configuration settings
-        $coursecode     = api_get_course_id();
-        $course_info    = api_get_course_info(api_get_course_id());
+        $courseCode     = api_get_course_id();
+        $course_info    = api_get_course_info($courseCode);
 
         $url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&id='.$exe_id.'&action=qualify';
         $user_info = UserManager::get_user_info_by_id(api_get_user_id());
@@ -3770,33 +3779,36 @@ class Exercise
             $mail_content = $msg1;
             $subject = get_lang('OpenQuestionsAttempted');
 
-            $teachers = array();
             if (api_get_session_id()) {
-                $teachers = CourseManager::get_coach_list_from_course_code($coursecode, api_get_session_id());
+                $teachers = CourseManager::get_coach_list_from_course_code($courseCode, api_get_session_id());
             } else {
-                $teachers = CourseManager::get_teacher_list_from_course_code($coursecode);
+                $teachers = CourseManager::get_teacher_list_from_course_code($courseCode);
             }
 
             if (!empty($teachers)) {
                 foreach ($teachers as $user_id => $teacher_data) {
-                    MessageManager::send_message_simple($user_id, $subject, $mail_content);
+                    MessageManager::send_message_simple(
+                        $user_id,
+                        $subject,
+                        $mail_content
+                    );
                 }
             }
         }
     }
 
-    function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id) {
+    function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id)
+    {
         if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
             return null;
         }
         // Email configuration settings
-        $coursecode     = api_get_course_id();
-        $course_info    = api_get_course_info(api_get_course_id());
+        $courseCode     = api_get_course_id();
+        $course_info    = api_get_course_info($courseCode);
 
         $url_email = api_get_path(WEB_CODE_PATH).'exercice/exercise_show.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&id='.$exe_id.'&action=qualify';
         $user_info = UserManager::get_user_info_by_id(api_get_user_id());
 
-
         $oral_question_list = null;
         foreach ($question_list_answers as $item) {
             $question    = $item['question'];
@@ -3851,16 +3863,19 @@ class Exercise
             $mail_content = $msg1;
             $subject = get_lang('OralQuestionsAttempted');
 
-            $teachers = array();
             if (api_get_session_id()) {
-                $teachers = CourseManager::get_coach_list_from_course_code($coursecode, api_get_session_id());
+                $teachers = CourseManager::get_coach_list_from_course_code($courseCode, api_get_session_id());
             } else {
-                $teachers = CourseManager::get_teacher_list_from_course_code($coursecode);
+                $teachers = CourseManager::get_teacher_list_from_course_code($courseCode);
             }
 
             if (!empty($teachers)) {
                 foreach ($teachers as $user_id => $teacher_data) {
-                    MessageManager::send_message_simple($user_id, $subject, $mail_content);
+                    MessageManager::send_message_simple(
+                        $user_id,
+                        $subject,
+                        $mail_content
+                    );
                 }
             }
         }
@@ -3954,7 +3969,8 @@ class Exercise
         return $quiz_id;
     }
 
-    function process_geometry() {
+    function process_geometry()
+    {
 
     }
 
@@ -3963,7 +3979,6 @@ class Exercise
      * @param 	int		attempt id
      * @return 	float 	exercise result
      */
-
     public function get_exercise_result($exe_id) {
         $result = array();
         $track_exercise_info = get_exercise_track_exercise_info($exe_id);
@@ -4125,7 +4140,8 @@ class Exercise
     public function added_in_lp()
     {
         $TBL_LP_ITEM	= Database::get_course_table(TABLE_LP_ITEM);
-        $sql = "SELECT max_score FROM $TBL_LP_ITEM WHERE c_id = ".$this->course_id." AND item_type = '".TOOL_QUIZ."' AND path = '".$this->id."'";
+        $sql = "SELECT max_score FROM $TBL_LP_ITEM
+                WHERE c_id = ".$this->course_id." AND item_type = '".TOOL_QUIZ."' AND path = '".$this->id."'";
         $result = Database::query($sql);
         if (Database::num_rows($result) > 0) {
             return true;
@@ -4133,7 +4149,8 @@ class Exercise
         return false;
     }
 
-    function get_media_list() {
+    function get_media_list()
+    {
         $media_questions = array();
         $question_list = $this->get_validated_question_list();
         if (!empty($question_list)) {
@@ -4150,7 +4167,8 @@ class Exercise
         return $media_questions;
     }
 
-    function media_is_activated($media_list) {
+    function media_is_activated($media_list)
+    {
         $active = false;
         if (isset($media_list) && !empty($media_list)) {
             $media_count = count($media_list);
@@ -4167,7 +4185,8 @@ class Exercise
         return $active;
     }
 
-    function get_validated_question_list() {
+    function get_validated_question_list()
+    {
         $tabres = array();
         $isRandomByCategory = $this->isRandomByCat();
         if ($isRandomByCategory == 0) {
@@ -4221,13 +4240,15 @@ class Exercise
         return $tabres;
     }
 
-    function get_question_list($expand_media_questions = false) {
+    function get_question_list($expand_media_questions = false)
+    {
         $question_list = $this->get_validated_question_list();
         $question_list = $this->transform_question_list_with_medias($question_list, $expand_media_questions);
         return $question_list;
     }
 
-    function transform_question_list_with_medias($question_list, $expand_media_questions = false) {
+    function transform_question_list_with_medias($question_list, $expand_media_questions = false)
+    {
         $new_question_list = array();
         if (!empty($question_list)) {
             $media_questions = $this->get_media_list();
@@ -4268,7 +4289,8 @@ class Exercise
         return $new_question_list;
     }
 
-    public function get_stat_track_exercise_info_by_exe_id($exe_id) {
+    public function get_stat_track_exercise_info_by_exe_id($exe_id)
+    {
         $track_exercises = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
         $exe_id = intval($exe_id);
         $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id ";
@@ -4298,7 +4320,8 @@ class Exercise
         return $new_array;
     }
 
-    public function edit_question_to_remind($exe_id, $question_id, $action = 'add') {
+    public function edit_question_to_remind($exe_id, $question_id, $action = 'add')
+    {
         $exercise_info = self::get_stat_track_exercise_info_by_exe_id($exe_id);
         $question_id = intval($question_id);
         $exe_id = intval($exe_id);
@@ -4340,18 +4363,20 @@ class Exercise
                 }
                 $remind_list_string = Database::escape_string($remind_list_string);
                 $sql = "UPDATE $track_exercises SET questions_to_check = '$remind_list_string' WHERE exe_id = $exe_id ";
-                $result = Database::query($sql);
+                Database::query($sql);
             }
         }
     }
 
-    public function fill_in_blank_answer_to_array($answer) {
+    public function fill_in_blank_answer_to_array($answer)
+    {
         api_preg_match_all('/\[[^]]+\]/', $answer, $teacher_answer_list);
         $teacher_answer_list = $teacher_answer_list[0];
         return $teacher_answer_list;
     }
 
-    public function fill_in_blank_answer_to_string($answer) {
+    public function fill_in_blank_answer_to_string($answer)
+    {
         $teacher_answer_list = $this->fill_in_blank_answer_to_array($answer);
         $result = '';
         if (!empty($teacher_answer_list)) {
@@ -4372,13 +4397,15 @@ class Exercise
         return $result;
     }
 
-    function return_time_left_div() {
+    function return_time_left_div()
+    {
         $html  = '<div id="clock_warning" style="display:none">'.Display::return_message(get_lang('ReachedTimeLimit'), 'warning').' '.sprintf(get_lang('YouWillBeRedirectedInXSeconds'), '<span id="counter_to_redirect" class="red_alert"></span>').'</div>';
         $html .= '<div id="exercise_clock_warning" class="well count_down"></div>';
         return $html;
     }
 
-    function get_count_question_list() {
+    function get_count_question_list()
+    {
         //Real question count
         $question_count = 0;
         $question_list = $this->get_question_list();
@@ -4388,7 +4415,8 @@ class Exercise
         return $question_count;
     }
 
-    function get_exercise_list_ordered() {
+    function get_exercise_list_ordered()
+    {
         $table_exercise_order = Database::get_course_table(TABLE_QUIZ_ORDER);
         $course_id = api_get_course_int_id();
         $session_id = api_get_session_id();
@@ -4403,7 +4431,6 @@ class Exercise
         return $list;
     }
 
-
     /**
      * Calculate the max_score of the quiz, depending of question inside, and quiz advanced option
      */
@@ -4480,7 +4507,6 @@ class Exercise
         return api_htmlentities($this->title);
     }
 
-
     /**
      * @param $in_title
      * @return string

+ 44 - 29
main/inc/lib/course.lib.php

@@ -7,7 +7,7 @@ require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
 /**
  * Class CourseManager
  *
- *  This is the course library for Chamilo.
+ * This is the course library for Chamilo.
  *
  * All main course functions should be placed here.
  *
@@ -24,7 +24,8 @@ require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php';
 class CourseManager
 {
     const MAX_COURSE_LENGTH_CODE = 40;
-    /** This constant is used to show separate user names in the course list (userportal), footer, etc */
+    /** This constant is used to show separate user names in the course
+     * list (userportal), footer, etc */
     const USER_SEPARATOR = ' |';
     const COURSE_FIELD_TYPE_CHECKBOX = 10;
     public $columns = array();
@@ -136,6 +137,7 @@ class CourseManager
      * Returns all the information of a given coursecode
      * @param   int     the course id
      * @return an array with all the fields of the course table
+     * @deprecated use api_get_course_info_by_id()
      * @assert ('') === false
      */
     public static function get_course_information_by_id($course_id)
@@ -271,8 +273,9 @@ class CourseManager
 
     /**
      * Returns the status of a user in a course, which is COURSEMANAGER or STUDENT.
-     * @param   int      User ID
-     * @param   string   Course code
+     * @param   int      $user_id
+     * @param   string   $course_code
+     *
      * @return int the status of the user in that course
      */
     public static function get_user_in_course_status($user_id, $course_code)
@@ -281,6 +284,7 @@ class CourseManager
             "SELECT status FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
             WHERE course_code = '".Database::escape_string($course_code)."' AND user_id = ".Database::escape_string($user_id))
         );
+
         return $result['status'];
     }
 
@@ -295,6 +299,7 @@ class CourseManager
                 "SELECT tutor_id FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
                 WHERE course_code = '".Database::escape_string($course_code)."' AND user_id = ".Database::escape_string($user_id))
         );
+
         return $result['tutor_id'];
     }
 
@@ -523,7 +528,8 @@ class CourseManager
             }
 
             // check if the user is registered in the session with other course
-            $sql = "SELECT id_user FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." WHERE id_session='".$session_id."' AND id_user='$user_id'";
+            $sql = "SELECT id_user FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)."
+                    WHERE id_session='".$session_id."' AND id_user='$user_id'";
             $rs = Database::query($sql);
             if (Database::num_rows($rs) == 0) {
                 // Check whether the user has not already been stored in the session_rel_user table
@@ -588,13 +594,14 @@ class CourseManager
     }
 
     /**
-     * Get the course id based on the original id and field name in the extra fields. Returns 0 if course was not found
-     *
-     * @param string Original course id
-     * @param string Original field name
-     * @return int Course id
-     * @assert ('', '') === false
-     */
+    * Get the course id based on the original id and field name in the
+    * extra fields. Returns 0 if course was not found
+    *
+    * @param string Original course id
+    * @param string Original field name
+    * @return int Course id
+    * @assert ('', '') === false
+    */
     public static function get_course_code_from_original_id($original_course_id_value, $original_course_id_name)
     {
         $t_cfv = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
@@ -719,8 +726,8 @@ class CourseManager
     }
 
     /**
-     *    @return true if there already are one or more courses
-     *    with the same code OR visual_code (visualcode), false otherwise
+     *  @return true if there already are one or more courses
+     *  with the same code OR visual_code (visualcode), false otherwise
      */
     public static function course_code_exists($wanted_course_code)
     {
@@ -732,7 +739,7 @@ class CourseManager
     }
 
     /**
-     *    @return an array with the course info of all real courses on the platform
+     * @return an array with the course info of all real courses on the platform
      */
     public static function get_real_course_list() {
         $sql_result = Database::query("SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE)."
@@ -776,10 +783,13 @@ class CourseManager
                 WHERE course.target_course_code IS NULL
                     AND course_user.user_id = '$user_id'
                     AND course_user.status = '1'");
-        if ($sql_result === false) { return $result_array; }
+        if ($sql_result === false) {
+            return $result_array;
+        }
         while ($result = Database::fetch_array($sql_result)) {
             $result_array[] = $result;
         }
+
         return $result_array;
     }
 
@@ -818,6 +828,7 @@ class CourseManager
                 }
             }
         }
+
         return $courseList;
     }
 
@@ -1635,17 +1646,18 @@ class CourseManager
      */
     public static function get_coach_list_from_course_code($course_code, $session_id)
     {
-        if ($session_id != strval(intval($session_id))) {
+        if (empty($course_code) OR empty($session_id)) {
             return array();
         }
 
         $course_code = Database::escape_string($course_code);
-
+        $session_id = intval($session_id);
         $users = array();
 
         // We get the coach for the given course in a given session.
-        $rs = Database::query('SELECT id_user FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).
-                ' WHERE id_session="'.$session_id.'" AND course_code="'.$course_code.'" AND status = 2');
+        $sql = 'SELECT id_user FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).
+               ' WHERE id_session="'.$session_id.'" AND course_code="'.$course_code.'" AND status = 2';
+        $rs = Database::query($sql);
         while ($user = Database::fetch_array($rs)) {
             $user_info = api_get_user_info($user['id_user']);
             $user_info['status'] = $user['status'];
@@ -1655,8 +1667,10 @@ class CourseManager
             $users[$user['id_user']] = $user_info;
         }
 
+        $table = Database::get_main_table(TABLE_MAIN_SESSION);
         // We get the session coach.
-        $rs = Database::query('SELECT id_coach FROM '.Database::get_main_table(TABLE_MAIN_SESSION).' WHERE id="'.$session_id.'"');
+        $sql = 'SELECT id_coach FROM '.$table.' WHERE id='.$session_id;
+        $rs = Database::query($sql);
         $session_id_coach = Database::result($rs, 0, 'id_coach');
         $user_info = api_get_user_info($session_id_coach);
         $user_info['status'] = $user['status'];
@@ -1669,15 +1683,15 @@ class CourseManager
     }
 
     /**
-     *    Return user info array of all users registered in the specified real or virtual course
-     *    This only returns the users that are registered in this actual course, not linked courses.
+     *  Return user info array of all users registered in the specified real or virtual course
+     *  This only returns the users that are registered in this actual course, not linked courses.
      *
-     *    @param string $course_code
-     *    @param boolean $with_session
-     *    @param integer $session_id
-     *    @param date $date_from
-     *    @param date $date_to
-     *    @return array with user id
+     *  @param string $course_code
+     *  @param boolean $with_session
+     *  @param integer $session_id
+     *  @param date $date_from
+     *  @param date $date_to
+     *  @return array with user id
      */
     public static function get_student_list_from_course_code(
         $course_code,
@@ -1730,6 +1744,7 @@ class CourseManager
                 $students[$student['id_user']] = $student;
             }
         }
+
         return $students;
     }
 

+ 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;

+ 10 - 7
main/inc/lib/text.lib.php

@@ -8,7 +8,7 @@
  * @package chamilo.library
  */
 
-define ('EXERCISE_NUMBER_OF_DECIMALS', 2);
+define('EXERCISE_NUMBER_OF_DECIMALS', 2);
 
 /**
  * This function strips all html-tags found in the input string and outputs a pure text.
@@ -16,7 +16,8 @@ define ('EXERCISE_NUMBER_OF_DECIMALS', 2);
  * @param  string $string    The input string with html-tags to be converted to plain text.
  * @return string            The returned plain text as a result.
  */
-function api_html_to_text($string) {
+function api_html_to_text($string)
+{
     // These purifications have been found experimentally, for nice looking output.
     $string = preg_replace('/<br[^>]*>/i', "\n", $string);
     $string = preg_replace('/<\/?(div|p|h[1-6]|table|ol|ul|blockquote)[^>]*>/i', "\n", $string);
@@ -729,12 +730,13 @@ function implode_with_key($glue, $array) {
 /**
  * Transform the file size in a human readable format.
  *
- * @param  int      Size of the file in bytes
+ * @param  int  $file_size    Size of the file in bytes
  * @return string A human readable representation of the file size
  */
-function format_file_size($file_size) {
+function format_file_size($file_size)
+{
     $file_size = intval($file_size);
-    if($file_size >= 1073741824) {
+    if ($file_size >= 1073741824) {
         $file_size = round($file_size / 1073741824 * 100) / 100 . 'G';
     } elseif($file_size >= 1048576) {
         $file_size = round($file_size / 1048576 * 100) / 100 . 'M';
@@ -746,7 +748,8 @@ function format_file_size($file_size) {
     return $file_size;
 }
 
-function return_datetime_from_array($array) {
+function return_datetime_from_array($array)
+{
     $year	 = '0000';
     $month = $day = $hours = $minutes = $seconds = '00';
     if (isset($array['Y']) && (isset($array['F']) || isset($array['M']))  && isset($array['d']) && isset($array['H']) && isset($array['i'])) {
@@ -782,4 +785,4 @@ function return_datetime_from_array($array) {
 function bracketsToArray($array)
 {
     return preg_split('/[\[\]]+/', $array, -1, PREG_SPLIT_NO_EMPTY);
-}
+}

+ 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);