Completed
Pull Request — 1.11.x (#1118)
by José
125:55 queued 77:20
created
main/inc/ajax/social.ajax.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
         }
22 22
 
23 23
         if (isset($_GET['friend_id'])) {
24
-            $my_current_friend  = $_GET['friend_id'];
24
+            $my_current_friend = $_GET['friend_id'];
25 25
             UserManager::relate_users($current_user_id, $my_current_friend, $relation_type);
26 26
             UserManager::relate_users($my_current_friend, $current_user_id, $relation_type);
27 27
             SocialManager::invitation_accepted($my_current_friend, $current_user_id);
28 28
             Display::display_normal_message(api_xml_http_response_encode(get_lang('AddedContactToList')));
29 29
 
30
-            header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php');
30
+            header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php');
31 31
         }
32 32
         break;
33 33
     case 'deny_friend':
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
         }
38 38
 
39 39
         if (isset($_GET['is_my_friend'])) {
40
-            $relation_type = USER_RELATION_TYPE_FRIEND;//my friend
40
+            $relation_type = USER_RELATION_TYPE_FRIEND; //my friend
41 41
         } else {
42
-            $relation_type = USER_RELATION_TYPE_UNKNOW;//Contact unknown
42
+            $relation_type = USER_RELATION_TYPE_UNKNOW; //Contact unknown
43 43
         }
44 44
         if (isset($_GET['denied_friend_id'])) {
45 45
             SocialManager::invitation_denied($_GET['denied_friend_id'], $current_user_id);
46 46
             Display::display_confirmation_message(api_xml_http_response_encode(get_lang('InvitationDenied')));
47 47
             
48
-            header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php');
48
+            header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php');
49 49
         }
50 50
         break;
51 51
     case 'delete_friend':
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
             echo '';
64 64
             break;
65 65
         }
66
-        $user_id	= api_get_user_id();
67
-        $name_search= Security::remove_XSS($_POST['search_name_q']);
66
+        $user_id = api_get_user_id();
67
+        $name_search = Security::remove_XSS($_POST['search_name_q']);
68 68
         $number_friends = 0;
69 69
 
70 70
         if (isset($name_search) && $name_search != 'undefined') {
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 
79 79
         $number_friends = count($friends);
80 80
         if ($number_friends != 0) {
81
-            $number_loop   = ($number_friends/$number_of_images);
81
+            $number_loop   = ($number_friends / $number_of_images);
82 82
             $loop_friends  = ceil($number_loop);
83
-            $j=0;
84
-            for ($k=0; $k<$loop_friends; $k++) {
85
-                if ($j==$number_of_images) {
86
-                    $number_of_images=$number_of_images*2;
83
+            $j = 0;
84
+            for ($k = 0; $k < $loop_friends; $k++) {
85
+                if ($j == $number_of_images) {
86
+                    $number_of_images = $number_of_images * 2;
87 87
                 }
88
-                while ($j<$number_of_images) {
88
+                while ($j < $number_of_images) {
89 89
                     if (isset($friends[$j])) {
90 90
                         $friend = $friends[$j];
91 91
                         $user_name = api_xml_http_response_encode($friend['firstName'].' '.$friend['lastName']);
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 
94 94
                         $friend_html .= '
95 95
                             <div class="col-md-3">
96
-                                <div class="thumbnail text-center" id="div_' . $friends[$j]['friend_user_id'] . '">
97
-                                    <img src="' . $userPicture . '" class="img-responsive" id="imgfriend_' . $friend['friend_user_id'] . '" title="$user_name">
96
+                                <div class="thumbnail text-center" id="div_' . $friends[$j]['friend_user_id'].'">
97
+                                    <img src="' . $userPicture.'" class="img-responsive" id="imgfriend_'.$friend['friend_user_id'].'" title="$user_name">
98 98
                                     <div class="caption">
99 99
                                         <h3>
100
-                                            <a href="profile.php?u=' . $friend['friend_user_id'] . '">' . $user_name . '</a>
100
+                                            <a href="profile.php?u=' . $friend['friend_user_id'].'">'.$user_name.'</a>
101 101
                                         </h3>
102 102
                                         <p>
103
-                                            <button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'] . '>
104
-                                                ' . get_lang('Delete') . '
103
+                                            <button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'].'>
104
+                                                ' . get_lang('Delete').'
105 105
                                             </button>
106 106
                                         </p>
107 107
                                     </div>
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
         switch ($action) {
132 132
             case 'load_course':
133
-                $course_id =  intval($_POST['course_code']); // the int course id
133
+                $course_id = intval($_POST['course_code']); // the int course id
134 134
                 $course_info = api_get_course_info_by_id($course_id);
135 135
                 $course_code = $course_info['code'];
136 136
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                     //------Forum messages
139 139
                     $forum_result = get_all_post_from_user($user_id, $course_code);
140 140
                     $all_result_data = 0;
141
-                    if ($forum_result !='') {
141
+                    if ($forum_result != '') {
142 142
                         echo '<div id="social-forum-main-title">';
143 143
                         echo api_xml_http_response_encode(get_lang('Forum'));
144 144
                         echo '</div>';
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         if (!empty($array)) {
202 202
             ksort($array);
203 203
             $html = '';
204
-            for($i = 0; $i < count($array); $i++) {
204
+            for ($i = 0; $i < count($array); $i++) {
205 205
                 $post = $array[$i]['html'];
206 206
                 $comment = SocialManager::getWallMessagesHTML($userId, $friendId, $array[$i]['id']);
207 207
                 $html .= '<div class="panel panel-info"><div class="panel-body">'.$post.$comment.'</div></div>';
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
             $html .= Display::div(
210 210
                 Display::url(
211 211
                     get_lang('SeeMore'),
212
-                    api_get_self() . '?u=' . $userId . '&a=listWallMessage&start=' .
213
-                    ($start + $length + 1) . '&length=' . $length,
212
+                    api_get_self().'?u='.$userId.'&a=listWallMessage&start='.
213
+                    ($start + $length + 1).'&length='.$length,
214 214
                     array(
215 215
                         'class' => 'nextPage',
216 216
                     )
Please login to merge, or discard this patch.
main/inc/lib/social.lib.php 2 patches
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
                     friend_user_id<>'.((int) $user_id).' AND
113 113
                     user_id='.((int) $user_id);
114 114
         if (isset($id_group) && $id_group > 0) {
115
-            $sql.=' AND relation_type='.$id_group;
115
+            $sql .= ' AND relation_type='.$id_group;
116 116
         }
117 117
         if (isset($search_name)) {
118 118
             $search_name = trim($search_name);
119 119
             $search_name = str_replace(' ', '', $search_name);
120
-            $sql.=' AND friend_user_id IN (
120
+            $sql .= ' AND friend_user_id IN (
121 121
                 SELECT user_id FROM '.$tbl_my_user.'
122 122
                 WHERE
123 123
                     firstName LIKE "%'.Database::escape_string($search_name).'%" OR
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
         $user_info = api_get_user_info($userfriend_id);
376 376
         $succes = get_lang('MessageSentTo');
377
-        $succes.= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
377
+        $succes .= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
378 378
 
379 379
         if (isset($subject_message) && isset($content_message) && isset($userfriend_id)) {
380 380
             $send_message = MessageManager::send_message($userfriend_id, $subject_message, $content_message);
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
         $user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_code);
494 494
 
495 495
         //$valor = api_get_settings_params();
496
-        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory;   // course path
496
+        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory; // course path
497 497
         if (api_get_setting('course_images_in_courses_list') === 'true') {
498 498
             if (file_exists($course_path.'/course-pic85x85.png')) {
499 499
                 $image = $my_course['course_info']['course_image'];
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
         if ($course_visibility != COURSE_VISIBILITY_HIDDEN &&
519 519
             ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)
520 520
         ) {
521
-           $result .= '<span class="title">' . $course_title . '<span>';
521
+           $result .= '<span class="title">'.$course_title.'<span>';
522 522
         } else {
523 523
             $result .= $course_title." "." ".get_lang('CourseClosed')."";
524 524
         }
@@ -737,57 +737,57 @@  discard block
 block discarded – undo
737 737
             $links = '<ul class="nav nav-pills nav-stacked">';
738 738
             $active = $show == 'home' ? 'active' : null;
739 739
             $links .= '
740
-                <li class="home-icon ' . $active . '">
741
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
742
-                        ' . $homeIcon . ' ' . get_lang('Home') . '
740
+                <li class="home-icon ' . $active.'">
741
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
742
+                        ' . $homeIcon.' '.get_lang('Home').'
743 743
                     </a>
744 744
                 </li>';
745 745
             $active = $show == 'messages' ? 'active' : null;
746 746
             $links .= '
747
-                <li class="messages-icon ' . $active . '">
748
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
749
-                        ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
747
+                <li class="messages-icon ' . $active.'">
748
+                    <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
749
+                        ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
750 750
                     </a>
751 751
                 </li>';
752 752
 
753 753
             //Invitations
754 754
             $active = $show == 'invitations' ? 'active' : null;
755 755
             $links .= '
756
-                <li class="invitations-icon ' . $active . '">
757
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
758
-                        ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
756
+                <li class="invitations-icon ' . $active.'">
757
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
758
+                        ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
759 759
                     </a>
760 760
                 </li>';
761 761
 
762 762
             //Shared profile and groups
763 763
             $active = $show == 'shared_profile' ? 'active' : null;
764 764
             $links .= '
765
-                <li class="shared-profile-icon' . $active . '">
766
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
767
-                        ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
765
+                <li class="shared-profile-icon' . $active.'">
766
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
767
+                        ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
768 768
                     </a>
769 769
                 </li>';
770 770
             $active = $show == 'friends' ? 'active' : null;
771 771
             $links .= '
772
-                <li class="friends-icon ' . $active . '">
773
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
774
-                        ' . $friendsIcon . ' ' . get_lang('Friends') . '
772
+                <li class="friends-icon ' . $active.'">
773
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
774
+                        ' . $friendsIcon.' '.get_lang('Friends').'
775 775
                     </a>
776 776
                 </li>';
777 777
             $active = $show == 'browse_groups' ? 'active' : null;
778 778
             $links .= '
779
-                <li class="browse-groups-icon ' . $active . '">
780
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
781
-                        ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
779
+                <li class="browse-groups-icon ' . $active.'">
780
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
781
+                        ' . $groupsIcon.' '.get_lang('SocialGroups').'
782 782
                     </a>
783 783
                 </li>';
784 784
 
785 785
             //Search users
786 786
             $active = $show == 'search' ? 'active' : null;
787 787
             $links .= '
788
-                <li class="search-icon ' . $active . '">
789
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
790
-                        ' . $searchIcon . ' ' . get_lang('Search') . '
788
+                <li class="search-icon ' . $active.'">
789
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
790
+                        ' . $searchIcon.' '.get_lang('Search').'
791 791
                     </a>
792 792
                 </li>';
793 793
 
@@ -795,9 +795,9 @@  discard block
 block discarded – undo
795 795
             $active = $show == 'myfiles' ? 'active' : null;
796 796
 
797 797
             $myFiles = '
798
-                <li class="myfiles-icon ' . $active . '">
799
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
800
-                        ' . $filesIcon . ' ' . get_lang('MyFiles') . '
798
+                <li class="myfiles-icon ' . $active.'">
799
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
800
+                        ' . $filesIcon.' '.get_lang('MyFiles').'
801 801
                     </a>
802 802
                 </li>';
803 803
 
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
             }
807 807
             $links .= $myFiles;
808 808
 
809
-            $links .='</ul>';
809
+            $links .= '</ul>';
810 810
 
811 811
             $html .= Display::panelCollapse(
812 812
                     get_lang('SocialNetwork'),
@@ -827,57 +827,57 @@  discard block
 block discarded – undo
827 827
         }
828 828
 
829 829
         if ($show == 'shared_profile') {
830
-            $links =  '<ul class="nav nav-pills nav-stacked">';
830
+            $links = '<ul class="nav nav-pills nav-stacked">';
831 831
             // My own profile
832 832
             if ($show_full_profile && $user_id == intval(api_get_user_id())) {
833 833
                 $links .= '
834
-                    <li class="home-icon ' . $active . '">
835
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
836
-                            ' . $homeIcon . ' ' . get_lang('Home') . '
834
+                    <li class="home-icon ' . $active.'">
835
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
836
+                            ' . $homeIcon.' '.get_lang('Home').'
837 837
                         </a>
838 838
                     </li>
839
-                    <li class="messages-icon ' . $active . '">
840
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
841
-                            ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
839
+                    <li class="messages-icon ' . $active.'">
840
+                        <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
841
+                            ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
842 842
                         </a>
843 843
                     </li>';
844 844
                 $active = $show == 'invitations' ? 'active' : null;
845 845
                 $links .= '
846
-                    <li class="invitations-icon' . $active . '">
847
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
848
-                            ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
846
+                    <li class="invitations-icon' . $active.'">
847
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
848
+                            ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
849 849
                         </a>
850 850
                     </li>';
851 851
 
852 852
                 $links .= '
853 853
                     <li class="shared-profile-icon active">
854
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
855
-                            ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
854
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
855
+                            ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
856 856
                         </a>
857 857
                     </li>
858 858
                     <li class="friends-icon">
859
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
860
-                            ' . $friendsIcon . ' ' . get_lang('Friends') . '
859
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
860
+                            ' . $friendsIcon.' '.get_lang('Friends').'
861 861
                         </a>
862 862
                     </li>
863 863
                     <li class="browse-groups-icon">
864
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
865
-                            ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
864
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
865
+                            ' . $groupsIcon.' '.get_lang('SocialGroups').'
866 866
                         </a>
867 867
                     </li>';
868 868
                 $active = $show == 'search' ? 'active' : null;
869 869
                 $links .= '
870
-                    <li class="search-icon ' . $active . '">
871
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
872
-                            ' . $searchIcon . ' ' . get_lang('Search') . '
870
+                    <li class="search-icon ' . $active.'">
871
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
872
+                            ' . $searchIcon.' '.get_lang('Search').'
873 873
                         </a>
874 874
                     </li>';
875 875
                 $active = $show == 'myfiles' ? 'active' : null;
876 876
 
877 877
                 $myFiles = '
878
-                    <li class="myfiles-icon ' . $active . '">
879
-                     <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
880
-                            ' . $filesIcon . ' ' . get_lang('MyFiles') . '
878
+                    <li class="myfiles-icon ' . $active.'">
879
+                     <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
880
+                            ' . $filesIcon.' '.get_lang('MyFiles').'
881 881
                         </a>
882 882
                     </li>';
883 883
 
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
                 $links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">'.Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')).'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
924 924
             } else {
925 925
                 if (!$show_full_profile) {
926
-                    $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')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
926
+                    $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')).'&nbsp;'.get_lang('SendInvitation').'</a></li>';
927 927
                 }
928 928
             }
929 929
 
@@ -1035,10 +1035,10 @@  discard block
 block discarded – undo
1035 1035
         foreach ($user_list as $uid) {
1036 1036
             $user_info = api_get_user_info($uid, $checkIfUserOnline = true);
1037 1037
             $lastname = $user_info['lastname'];
1038
-            $firstname =  $user_info['firstname'];
1038
+            $firstname = $user_info['firstname'];
1039 1039
             $completeName = $firstname.', '.$lastname;
1040 1040
 
1041
-            $user_rol = $user_info['status'] == 1 ? Display::return_icon('teacher.png',get_lang('Teacher'),null,ICON_SIZE_TINY) : Display::return_icon('user.png',get_lang('Student'),null,ICON_SIZE_TINY);
1041
+            $user_rol = $user_info['status'] == 1 ? Display::return_icon('teacher.png', get_lang('Teacher'), null, ICON_SIZE_TINY) : Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY);
1042 1042
             $status_icon_chat = null;
1043 1043
             if ($user_info['user_is_online_in_chat'] == 1) {
1044 1044
                 $status_icon_chat = Display::return_icon('online.png', get_lang('Online'));
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
             $userPicture = $user_info['avatar'];
1050 1050
             $img = '<img class="img-responsive img-circle" title="'.$completeName.'" alt="'.$completeName.'" src="'.$userPicture.'">';
1051 1051
 
1052
-            $url =  null;
1052
+            $url = null;
1053 1053
             // Anonymous users can't have access to the profile
1054 1054
             if (!api_is_anonymous()) {
1055 1055
                 if (api_get_setting('allow_social_tool') == 'true') {
@@ -1215,13 +1215,13 @@  discard block
 block discarded – undo
1215 1215
             case SOCIAL_CENTER_PLUGIN:
1216 1216
                 $social_plugins = array(1, 2);
1217 1217
                 if (is_array($social_plugins) && count($social_plugins) > 0) {
1218
-                    $content.= '<div id="social-plugins">';
1218
+                    $content .= '<div id="social-plugins">';
1219 1219
                     foreach ($social_plugins as $plugin) {
1220
-                        $content.= '<div class="social-plugin-item">';
1221
-                        $content.= $plugin;
1222
-                        $content.= '</div>';
1220
+                        $content .= '<div class="social-plugin-item">';
1221
+                        $content .= $plugin;
1222
+                        $content .= '</div>';
1223 1223
                     }
1224
-                    $content.= '</div>';
1224
+                    $content .= '</div>';
1225 1225
                 }
1226 1226
                 break;
1227 1227
             case SOCIAL_LEFT_PLUGIN:
@@ -1292,12 +1292,12 @@  discard block
 block discarded – undo
1292 1292
         if (!in_array($extension, $allowedTypes)) {
1293 1293
             $flag = false;
1294 1294
         } else {
1295
-            $newFileName = uniqid('') . '.' . $extension;
1295
+            $newFileName = uniqid('').'.'.$extension;
1296 1296
             if (!file_exists($pathMessageAttach)) {
1297 1297
                 @mkdir($pathMessageAttach, api_get_permissions_for_new_directories(), true);
1298 1298
             }
1299 1299
 
1300
-            $newPath = $pathMessageAttach . $newFileName;
1300
+            $newPath = $pathMessageAttach.$newFileName;
1301 1301
             if (is_uploaded_file($fileAttach['tmp_name'])) {
1302 1302
                 @copy($fileAttach['tmp_name'], $newPath);
1303 1303
             }
@@ -1306,9 +1306,9 @@  discard block
 block discarded – undo
1306 1306
             $medium = self::resize_picture($newPath, IMAGE_WALL_MEDIUM_SIZE);
1307 1307
 
1308 1308
             $big = new Image($newPath);
1309
-            $ok = $small && $small->send_image($pathMessageAttach . IMAGE_WALL_SMALL . '_' . $newFileName) &&
1310
-                $medium && $medium->send_image($pathMessageAttach . IMAGE_WALL_MEDIUM .'_' . $newFileName) &&
1311
-                $big && $big->send_image($pathMessageAttach . IMAGE_WALL_BIG . '_' . $newFileName);
1309
+            $ok = $small && $small->send_image($pathMessageAttach.IMAGE_WALL_SMALL.'_'.$newFileName) &&
1310
+                $medium && $medium->send_image($pathMessageAttach.IMAGE_WALL_MEDIUM.'_'.$newFileName) &&
1311
+                $big && $big->send_image($pathMessageAttach.IMAGE_WALL_BIG.'_'.$newFileName);
1312 1312
 
1313 1313
             // Insert
1314 1314
             $newFileName = $social.$newFileName;
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
             $start = '0000-00-00';
1400 1400
         }
1401 1401
 
1402
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
1402
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
1403 1403
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL, $idMessage, $start, $limit, $offset);
1404 1404
         $formattedList = '<div class="sub-mediapost">';
1405 1405
         $users = array();
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
             }
1415 1415
 
1416 1416
             $nameComplete = api_is_western_name_order()
1417
-                ? $users[$userIdLoop]['firstname'] .' ' . $users[$userIdLoop]['lastname']
1418
-                : $users[$userIdLoop]['lastname'] . ' ' . $users[$userIdLoop]['firstname'];
1417
+                ? $users[$userIdLoop]['firstname'].' '.$users[$userIdLoop]['lastname']
1418
+                : $users[$userIdLoop]['lastname'].' '.$users[$userIdLoop]['firstname'];
1419 1419
             $url = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userIdLoop;
1420 1420
             $media = '';
1421 1421
             $media .= '<div class="rep-post">';
@@ -1426,11 +1426,11 @@  discard block
 block discarded – undo
1426 1426
                 $media .= '</div>';
1427 1427
             }
1428 1428
             $media .= '<div class="user-image">';
1429
-            $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] .
1429
+            $media .= '<a href="'.$url.'" ><img src="'.$users[$userIdLoop]['avatar'].
1430 1430
                        '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>';
1431 1431
             $media .= '</div>';
1432 1432
             $media .= '<div class="user-data">';
1433
-            $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a></div>';
1433
+            $media .= '<div class="username">'.'<a href="'.$url.'">'.$nameComplete.'</a></div>';
1434 1434
             $media .= '<div class="time timeago" title="'.$date.'">'.$date.'</div>';
1435 1435
             $media .= '</div>';
1436 1436
             $media .= '<div class="msg-content">';
@@ -1465,12 +1465,12 @@  discard block
 block discarded – undo
1465 1465
      * @param   int     $offset     Wall messages offset
1466 1466
      * @return  array   $data       return user's starting wall messages along with message extra data
1467 1467
      */
1468
-    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset= 0)
1468
+    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset = 0)
1469 1469
     {
1470 1470
         if (empty($start)) {
1471 1471
             $start = '0000-00-00';
1472 1472
         }
1473
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
1473
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
1474 1474
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL_POST, null, $start, $limit, $offset);
1475 1475
         $users = array();
1476 1476
         $data = array();
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 
1530 1530
         $htmlReceiver = '';
1531 1531
         if ($authorId != $receiverId) {
1532
-            $htmlReceiver = ' > <a href="'.$urlReceiver.'">' . $nameCompleteReceiver . '</a> ';
1532
+            $htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> ';
1533 1533
         }
1534 1534
 
1535 1535
         $wallImage = '';
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
         $html .= '<div class="img-post">';
1565 1565
         $html .= $wallImage;
1566 1566
         $html .= '</div>';
1567
-        $html .= '<p>'. Security::remove_XSS($message['content']).'</p>';
1567
+        $html .= '<p>'.Security::remove_XSS($message['content']).'</p>';
1568 1568
         $html .= '</div>';
1569 1569
         $html .= '</div>'; // end mediaPost
1570 1570
         $html .= '<div class="popularity-mediapost"><em class="fa fa-star-o"></em><em class="fa fa-star-o"></em><em class="fa fa-star-o"></em><em class="fa fa-star-o"></em><em class="fa fa-star-o"></em>  0 '.get_lang('Votes').'</div>';
@@ -1579,7 +1579,7 @@  discard block
 block discarded – undo
1579 1579
      */
1580 1580
     public static function readContentWithOpenGraph($link)
1581 1581
     {
1582
-        if(strpos($link,"://")===false && substr($link,0,1)!="/") $link = "http://".$link;
1582
+        if (strpos($link, "://") === false && substr($link, 0, 1) != "/") $link = "http://".$link;
1583 1583
         $graph = OpenGraph::fetch($link);
1584 1584
         $link = parse_url($link);
1585 1585
         $host = $link['host'] ? strtoupper($link['host']) : $link['path'];
@@ -1640,16 +1640,16 @@  discard block
 block discarded – undo
1640 1640
         if (isset($array[2]) && !empty($array[2])) {
1641 1641
 
1642 1642
             if ($size == IMAGE_WALL_SMALL) {
1643
-                $name = IMAGE_WALL_SMALL. '_' . $array[2];
1644
-            }else if($size == IMAGE_WALL_MEDIUM){
1645
-                $name = IMAGE_WALL_MEDIUM. '_' . $array[2];
1646
-            }else if($size == IMAGE_WALL_BIG){
1647
-                $name = IMAGE_WALL_BIG. '_' . $array[2];
1648
-            }else {
1649
-                $name = IMAGE_WALL_SMALL. '_' . $array[2];
1643
+                $name = IMAGE_WALL_SMALL.'_'.$array[2];
1644
+            } else if ($size == IMAGE_WALL_MEDIUM) {
1645
+                $name = IMAGE_WALL_MEDIUM.'_'.$array[2];
1646
+            } else if ($size == IMAGE_WALL_BIG) {
1647
+                $name = IMAGE_WALL_BIG.'_'.$array[2];
1648
+            } else {
1649
+                $name = IMAGE_WALL_SMALL.'_'.$array[2];
1650 1650
             }
1651 1651
             $lessImage = str_replace($array[2], '', $path);
1652
-            $name = $lessImage . $name;
1652
+            $name = $lessImage.$name;
1653 1653
         }
1654 1654
 
1655 1655
         return $name;
@@ -1757,18 +1757,18 @@  discard block
 block discarded – undo
1757 1757
         if ($number_friends != 0) {
1758 1758
             if ($number_friends > $number_of_images) {
1759 1759
                 if (api_get_user_id() == $user_id) {
1760
-                    $friendHtml.= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
1760
+                    $friendHtml .= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
1761 1761
                 } else {
1762
-                    $friendHtml.= ' <span>'
1762
+                    $friendHtml .= ' <span>'
1763 1763
                         .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
1764 1764
                         .'?view=friends&height=390&width=610&user_id='.$user_id.'"'
1765 1765
                         .'class="ajax" data-title="'.get_lang('SeeAll').'" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAll').'</a></span>';
1766 1766
                 }
1767 1767
             }
1768 1768
 
1769
-            $friendHtml.= '<ul class="nav nav-list">';
1769
+            $friendHtml .= '<ul class="nav nav-list">';
1770 1770
             $j = 1;
1771
-            for ($k=0; $k < $number_friends; $k++) {
1771
+            for ($k = 0; $k < $number_friends; $k++) {
1772 1772
                 if ($j > $number_of_images) break;
1773 1773
 
1774 1774
                 if (isset($friends[$k])) {
@@ -1782,26 +1782,26 @@  discard block
 block discarded – undo
1782 1782
                         $statusIcon = Display::span('', array('class' => 'offline_user_in_text'));
1783 1783
                     }
1784 1784
 
1785
-                    $friendHtml.= '<li>';
1786
-                    $friendHtml.= '<div>';
1785
+                    $friendHtml .= '<li>';
1786
+                    $friendHtml .= '<div>';
1787 1787
 
1788 1788
                     // the height = 92 must be the same in the image_friend_network span style in default.css
1789 1789
                     $friends_profile = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_SMALL);
1790
-                    $friendHtml.= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
1790
+                    $friendHtml .= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
1791 1791
                     $link_shared = (empty($link_shared)) ? '' : '&'.$link_shared;
1792
-                    $friendHtml.= $statusIcon .'<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '">' . $name_user .'</a>';
1793
-                    $friendHtml.= '</div>';
1794
-                    $friendHtml.= '</li>';
1792
+                    $friendHtml .= $statusIcon.'<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'">'.$name_user.'</a>';
1793
+                    $friendHtml .= '</div>';
1794
+                    $friendHtml .= '</li>';
1795 1795
                 }
1796 1796
                 $j++;
1797 1797
             }
1798
-            $friendHtml.='</ul>';
1798
+            $friendHtml .= '</ul>';
1799 1799
         } else {
1800
-            $friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
1801
-                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
1800
+            $friendHtml .= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
1801
+                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
1802 1802
         }
1803 1803
 
1804
-        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' (' . $number_friends . ')' );
1804
+        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')');
1805 1805
 
1806 1806
         return $friendHtml;
1807 1807
     }
@@ -1822,9 +1822,9 @@  discard block
 block discarded – undo
1822 1822
 
1823 1823
         if ($number_friends != 0) {
1824 1824
 
1825
-            $friendHtml.= '<div class="list-group">';
1825
+            $friendHtml .= '<div class="list-group">';
1826 1826
             $j = 1;
1827
-            for ($k=0; $k < $number_friends; $k++) {
1827
+            for ($k = 0; $k < $number_friends; $k++) {
1828 1828
                 if ($j > $number_of_images) {
1829 1829
                     break;
1830 1830
                 }
@@ -1834,11 +1834,11 @@  discard block
 block discarded – undo
1834 1834
                     $user_info_friend = api_get_user_info($friend['friend_user_id'], true);
1835 1835
 
1836 1836
                     if ($user_info_friend['user_is_online']) {
1837
-                        $statusIcon = Display::return_icon('statusonline.png',get_lang('Online'));
1838
-                        $status=1;
1837
+                        $statusIcon = Display::return_icon('statusonline.png', get_lang('Online'));
1838
+                        $status = 1;
1839 1839
                     } else {
1840
-                        $statusIcon = Display::return_icon('statusoffline.png',get_lang('Offline'));
1841
-                        $status=0;
1840
+                        $statusIcon = Display::return_icon('statusoffline.png', get_lang('Offline'));
1841
+                        $status = 0;
1842 1842
                     }
1843 1843
 
1844 1844
                     $friendAvatarMedium = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_MEDIUM);
@@ -1847,24 +1847,24 @@  discard block
 block discarded – undo
1847 1847
                     $showLinkToChat = api_is_global_chat_enabled() &&
1848 1848
                         $friend['friend_user_id'] != api_get_user_id();
1849 1849
 
1850
-                    if ($showLinkToChat){
1850
+                    if ($showLinkToChat) {
1851 1851
                         $friendHtml .= '<a onclick="javascript:chatWith(\''.$friend['friend_user_id'].'\', \''.$name_user.'\', \''.$status.'\',\''.$friendAvatarSmall.'\')" href="javascript:void(0);" class="list-group-item">';
1852
-                        $friendHtml .=  $friend_avatar.' <span class="username">' . $name_user . '</span>';
1853
-                        $friendHtml .= '<span class="status">' . $statusIcon . '</span>';
1852
+                        $friendHtml .= $friend_avatar.' <span class="username">'.$name_user.'</span>';
1853
+                        $friendHtml .= '<span class="status">'.$statusIcon.'</span>';
1854 1854
                     } else {
1855 1855
                         $link_shared = empty($link_shared) ? '' : '&'.$link_shared;
1856
-                        $friendHtml .= '<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '" class="list-group-item">';
1857
-                        $friendHtml .=  $friend_avatar.' <span class="username-all">' . $name_user . '</span>';
1856
+                        $friendHtml .= '<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'" class="list-group-item">';
1857
+                        $friendHtml .= $friend_avatar.' <span class="username-all">'.$name_user.'</span>';
1858 1858
                     }
1859 1859
 
1860 1860
                     $friendHtml .= '</a>';
1861 1861
                 }
1862 1862
                 $j++;
1863 1863
             }
1864
-            $friendHtml.='</div>';
1864
+            $friendHtml .= '</div>';
1865 1865
         } else {
1866
-            $friendHtml.= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
1867
-                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
1866
+            $friendHtml .= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
1867
+                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
1868 1868
         }
1869 1869
 
1870 1870
         return $friendHtml;
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
                 'post',
1883 1883
                 api_get_path(WEB_CODE_PATH).'social/profile.php'.$userId,
1884 1884
                 null,
1885
-                array('enctype' => 'multipart/form-data') ,
1885
+                array('enctype' => 'multipart/form-data'),
1886 1886
                 FormValidator::LAYOUT_HORIZONTAL
1887 1887
             );
1888 1888
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1579,7 +1579,9 @@  discard block
 block discarded – undo
1579 1579
      */
1580 1580
     public static function readContentWithOpenGraph($link)
1581 1581
     {
1582
-        if(strpos($link,"://")===false && substr($link,0,1)!="/") $link = "http://".$link;
1582
+        if(strpos($link,"://")===false && substr($link,0,1)!="/") {
1583
+            $link = "http://".$link;
1584
+        }
1583 1585
         $graph = OpenGraph::fetch($link);
1584 1586
         $link = parse_url($link);
1585 1587
         $host = $link['host'] ? strtoupper($link['host']) : $link['path'];
@@ -1641,11 +1643,11 @@  discard block
 block discarded – undo
1641 1643
 
1642 1644
             if ($size == IMAGE_WALL_SMALL) {
1643 1645
                 $name = IMAGE_WALL_SMALL. '_' . $array[2];
1644
-            }else if($size == IMAGE_WALL_MEDIUM){
1646
+            } else if($size == IMAGE_WALL_MEDIUM){
1645 1647
                 $name = IMAGE_WALL_MEDIUM. '_' . $array[2];
1646
-            }else if($size == IMAGE_WALL_BIG){
1648
+            } else if($size == IMAGE_WALL_BIG){
1647 1649
                 $name = IMAGE_WALL_BIG. '_' . $array[2];
1648
-            }else {
1650
+            } else {
1649 1651
                 $name = IMAGE_WALL_SMALL. '_' . $array[2];
1650 1652
             }
1651 1653
             $lessImage = str_replace($array[2], '', $path);
@@ -1769,7 +1771,9 @@  discard block
 block discarded – undo
1769 1771
             $friendHtml.= '<ul class="nav nav-list">';
1770 1772
             $j = 1;
1771 1773
             for ($k=0; $k < $number_friends; $k++) {
1772
-                if ($j > $number_of_images) break;
1774
+                if ($j > $number_of_images) {
1775
+                    break;
1776
+                }
1773 1777
 
1774 1778
                 if (isset($friends[$k])) {
1775 1779
                     $friend = $friends[$k];
Please login to merge, or discard this patch.