Completed
Pull Request — 1.11.x (#1432)
by José
162:44 queued 127:35
created
main/social/profile.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 
59 59
     Display::addFlash(Display::return_message(get_lang('MessageSent')));
60 60
 
61
-    $url = api_get_path(WEB_CODE_PATH) . 'social/profile.php';
61
+    $url = api_get_path(WEB_CODE_PATH).'social/profile.php';
62 62
     $url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
63
-    header('Location: ' . $url);
63
+    header('Location: '.$url);
64 64
     exit;
65 65
 
66 66
 } else if (!empty($_POST['social_wall_new_msg']) && !empty($_POST['messageId'])) {
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
         MESSAGE_STATUS_WALL
76 76
     );
77 77
     Display::addFlash(Display::return_message(get_lang('MessageSent')));
78
-    $url = api_get_path(WEB_CODE_PATH) . 'social/profile.php';
78
+    $url = api_get_path(WEB_CODE_PATH).'social/profile.php';
79 79
     $url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
80
-    header('Location: ' . $url);
80
+    header('Location: '.$url);
81 81
     exit;
82 82
 
83 83
 } else if (isset($_GET['messageId'])) {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $status = SocialManager::deleteMessage($messageId);
90 90
 
91 91
             Display::addFlash(Display::return_message(get_lang('MessageDeleted')));
92
-            header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/profile.php');
92
+            header('Location: '.api_get_path(WEB_CODE_PATH).'social/profile.php');
93 93
             exit;
94 94
         }
95 95
     }
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 
154 154
 $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php';
155 155
 $socialAjaxUrl = api_get_path(WEB_AJAX_PATH).'social.ajax.php';
156
-$javascriptDir = api_get_path(LIBRARY_PATH) . 'javascript/';
156
+$javascriptDir = api_get_path(LIBRARY_PATH).'javascript/';
157 157
 api_block_anonymous_users();
158 158
 $locale = api_get_language_isocode();
159 159
 // Add Jquery scroll pagination plugin
160 160
 $htmlHeadXtra[] = api_get_js('jscroll/jquery.jscroll.js');
161 161
 // Add Jquery Time ago plugin
162 162
 $htmlHeadXtra[] = api_get_asset('jquery-timeago/jquery.timeago.js');
163
-$timeAgoLocaleDir = $javascriptDir . 'jquery-timeago/locales/jquery.timeago.' . $locale . '.js';
163
+$timeAgoLocaleDir = $javascriptDir.'jquery-timeago/locales/jquery.timeago.'.$locale.'.js';
164 164
 if (file_exists($timeAgoLocaleDir)) {
165
-    $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.' . $locale . '.js');
165
+    $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.'.$locale.'.js');
166 166
 }
167 167
 
168 168
 $htmlHeadXtra[] = '<script>
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 $(document).ready(function (){
171 171
     var container = $("#wallMessages");
172 172
     container.jscroll({
173
-        loadingHtml: "<div class=\"well_border\">' . get_lang('Loading') . ' </div>",
173
+        loadingHtml: "<div class=\"well_border\">' . get_lang('Loading').' </div>",
174 174
         nextSelector: "a.nextPage:last",
175 175
         contentSelector: "",
176 176
         callback: timeAgo
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 );
201 201
 
202 202
 if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id()) {
203
-    $info_user =   api_get_user_info($_GET['u']);
204
-    $interbreadcrumb[]= array(
203
+    $info_user = api_get_user_info($_GET['u']);
204
+    $interbreadcrumb[] = array(
205 205
         'url' => '#',
206 206
         'name' => $info_user['complete_name']
207 207
     );
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 $list = [];
226 226
 if (is_array($personal_course_list)) {
227 227
     foreach ($personal_course_list as $my_course) {
228
-        if ($i<=10) {
228
+        if ($i <= 10) {
229 229
             $list[] = SocialManager::get_logged_user_course_html($my_course, $i);
230 230
             $course_list_code[] = array('code' => $my_course['code']);
231 231
         } else {
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
 $social_wall_block = $wallSocialAddPost;
264 264
 
265 265
 // Social Post Wall
266
-$posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId) ;
266
+$posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId);
267 267
 
268 268
 $social_post_wall_block = empty($posts) ? '<p>'.get_lang("NoPosts").'</p>' : $posts;
269 269
 
270 270
 $socialAutoExtendLink = Display::url(
271 271
     get_lang('SeeMore'),
272
-    $socialAjaxUrl . '?u='. $my_user_id . '&a=listWallMessage&start=10&length=5',
272
+    $socialAjaxUrl.'?u='.$my_user_id.'&a=listWallMessage&start=10&length=5',
273 273
     array(
274 274
         'class' => 'nextPage next',
275 275
     )
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
                 $(".spinner").html("'.
292 292
                     '<div class=\'text-center\'>'.
293 293
                         '<em class=\'fa fa-spinner fa-pulse fa-1x\'></em>'.
294
-                        '<p>'. get_lang('Loading') . ' ' . get_lang('Preview') .'</p>'.
294
+                        '<p>'.get_lang('Loading').' '.get_lang('Preview').'</p>'.
295 295
                     '</div>'.
296 296
                 '");
297 297
             },
298 298
             type: "POST",
299
-            url: "'. api_get_path(WEB_AJAX_PATH) .'social.ajax.php?a=readUrlWithOpenGraph",
299
+            url: "'. api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=readUrlWithOpenGraph",
300 300
             data: "social_wall_new_msg_main=" + e.originalEvent.clipboardData.getData("text"),
301 301
             success: function(response) {
302 302
                 $("[name=\'wall_post_button\']").prop( "disabled", false );
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                                 .$tags['tag']
386 386
                                 .'</a>';
387 387
                         }
388
-                        if (is_array($user_tags) && count($user_tags)>0) {
388
+                        if (is_array($user_tags) && count($user_tags) > 0) {
389 389
                             $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']).': '
390 390
                                 .' '.implode('', $tag_tmp).'</li>';
391 391
                         }
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
                         $extra_information_value .= '<li class="list-group-item">'.$data.'</li>';
410 410
                         break;
411 411
                     default:
412
-                        $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']) . ': ' . $data . '</li>';
412
+                        $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']).': '.$data.'</li>';
413 413
                         break;
414 414
                 }
415 415
             }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         // if there are information to show
419 419
         if (!empty($extra_information_value)) {
420 420
 
421
-            $extra_information_value = '<ul class="list-group">' . $extra_information_value . '</ul>';
421
+            $extra_information_value = '<ul class="list-group">'.$extra_information_value.'</ul>';
422 422
 
423 423
             $extra_information .= Display::panelCollapse(
424 424
                 get_lang('ExtraInformation'),
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
 
499 499
         if ($i > $max_numbers_of_group) {
500 500
             if (api_get_user_id() == $user_id) {
501
-                $my_groups .=  '<div class="box_shared_profile_group_actions">'
501
+                $my_groups .= '<div class="box_shared_profile_group_actions">'
502 502
                     .'<a href="groups.php?#tab_browse-1">'.get_lang('SeeAllMyGroups').'</a></div>';
503 503
             } else {
504
-                $my_groups .=  '<div class="box_shared_profile_group_actions">'
504
+                $my_groups .= '<div class="box_shared_profile_group_actions">'
505 505
                     .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
506 506
                     .'?view=mygroups&height=390&width=610&user_id='.$user_id.'"'
507 507
                     .' class="ajax" title="'.get_lang('SeeAll').'" >'
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         $i = 1;
515 515
         foreach ($grid_my_groups as $group) {
516 516
             $my_groups .= '<div class="panel-body">';
517
-            $my_groups .=  $group[0];
517
+            $my_groups .= $group[0];
518 518
             $my_groups .= '</div>';
519 519
             $i++;
520 520
         }
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                 $i++;
538 538
             }
539 539
         }
540
-        $social_course_block .=  $my_courses;
540
+        $social_course_block .= $my_courses;
541 541
         //$social_course_block = Display::panel($my_courses, get_lang('MyCourses'));
542 542
     }
543 543
 
@@ -555,11 +555,11 @@  discard block
 block discarded – undo
555 555
     }
556 556
 
557 557
     // Productions
558
-    $production_list =  UserManager::build_production_list($user_id);
558
+    $production_list = UserManager::build_production_list($user_id);
559 559
 
560 560
     // Images uploaded by course
561 561
     $file_list = '';
562
-    if (is_array($course_list_code) && count($course_list_code)>0) {
562
+    if (is_array($course_list_code) && count($course_list_code) > 0) {
563 563
         foreach ($course_list_code as $course) {
564 564
             $file_list .= UserManager::get_user_upload_files_by_course(
565 565
                 $user_id,
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 
572 572
     $count_pending_invitations = 0;
573 573
     if (!isset($_GET['u']) ||
574
-        (isset($_GET['u']) && $_GET['u']==api_get_user_id())
574
+        (isset($_GET['u']) && $_GET['u'] == api_get_user_id())
575 575
     ) {
576 576
         $pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
577 577
         $list_get_path_web = SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
@@ -580,23 +580,23 @@  discard block
 block discarded – undo
580 580
 
581 581
     if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) {
582 582
         // Pending invitations
583
-        if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
583
+        if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u'] == api_get_user_id())) {
584 584
             if ($count_pending_invitations > 0) {
585
-                $invitations =  '<ul class="list-group">';
585
+                $invitations = '<ul class="list-group">';
586 586
                 for ($i = 0; $i < $count_pending_invitations; $i++) {
587 587
                     $user_invitation_id = $pending_invitations[$i]['user_sender_id'];
588
-                    $invitations .=  '<li id="dpending_'.$user_invitation_id.'" class="list-group-item">';
589
-                    $invitations .=  '<img class="img-rounded" '
588
+                    $invitations .= '<li id="dpending_'.$user_invitation_id.'" class="list-group-item">';
589
+                    $invitations .= '<img class="img-rounded" '
590 590
                                 .' src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'"'
591 591
                                 .' width="40px">';
592 592
                     $userInfo = api_get_user_info($user_invitation_id);
593 593
                     $invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">'
594
-                                 .api_get_person_name($userInfo['firstname'],$userInfo['lastname']).'</a>';
594
+                                 .api_get_person_name($userInfo['firstname'], $userInfo['lastname']).'</a>';
595 595
 
596
-                    $invitations .='<div class="pull-right">';
596
+                    $invitations .= '<div class="pull-right">';
597 597
                     $invitations .= Display::toolbarButton(
598 598
                         get_lang('SocialAddToFriends'),
599
-                        api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?' . http_build_query([
599
+                        api_get_path(WEB_AJAX_PATH).'social.ajax.php?'.http_build_query([
600 600
                             'a' => 'add_friend',
601 601
                             'friend_id' => $user_invitation_id,
602 602
                             'is_my_friend' => 'friend'
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
                         false
608 608
                     );
609 609
                     $invitations .= '</div>';
610
-                    $invitations .=  '<div id="id_response"></div>';
611
-                    $invitations .=  '</li>';
610
+                    $invitations .= '<div id="id_response"></div>';
611
+                    $invitations .= '</li>';
612 612
                 }
613 613
                 $invitations .= '</ul>';
614 614
                 $listInvitations = Display::panelCollapse(
@@ -623,51 +623,51 @@  discard block
 block discarded – undo
623 623
         }
624 624
 
625 625
         // Productions
626
-        $production_list =  UserManager::build_production_list($user_id);
626
+        $production_list = UserManager::build_production_list($user_id);
627 627
         $product_content = '';
628 628
         if (!empty($production_list)) {
629 629
             $product_content .= '<div><h3>'.get_lang('MyProductions').'</h3></div>';
630
-            $product_content .=  $production_list;
631
-            $socialRightInformation .=  SocialManager::social_wrapper_div($product_content, 4);
630
+            $product_content .= $production_list;
631
+            $socialRightInformation .= SocialManager::social_wrapper_div($product_content, 4);
632 632
         }
633 633
 
634 634
         $images_uploaded = null;
635 635
         // Images uploaded by course
636 636
         if (!empty($file_list)) {
637
-            $images_uploaded .=  '<div><h3>'.get_lang('ImagesUploaded').'</h3></div>';
638
-            $images_uploaded .=  '<div class="social-content-information">';
639
-            $images_uploaded .=  $file_list;
640
-            $images_uploaded .=  '</div>';
641
-            $socialRightInformation .=  SocialManager::social_wrapper_div($images_uploaded, 4);
637
+            $images_uploaded .= '<div><h3>'.get_lang('ImagesUploaded').'</h3></div>';
638
+            $images_uploaded .= '<div class="social-content-information">';
639
+            $images_uploaded .= $file_list;
640
+            $images_uploaded .= '</div>';
641
+            $socialRightInformation .= SocialManager::social_wrapper_div($images_uploaded, 4);
642 642
         }
643 643
     }
644 644
 
645 645
     if (!empty($user_info['competences']) || !empty($user_info['diplomas'])
646
-        || !empty($user_info['openarea']) || !empty($user_info['teach']) ) {
646
+        || !empty($user_info['openarea']) || !empty($user_info['teach'])) {
647 647
 
648
-        $more_info .=  '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
648
+        $more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
649 649
         if (!empty($user_info['competences'])) {
650
-            $more_info .=  '<br />';
651
-                $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
652
-                $more_info .=  '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
653
-            $more_info .=  '<br />';
650
+            $more_info .= '<br />';
651
+                $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
652
+                $more_info .= '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
653
+            $more_info .= '<br />';
654 654
         }
655 655
         if (!empty($user_info['diplomas'])) {
656
-            $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
657
-            $more_info .=  '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
658
-            $more_info .=  '<br />';
656
+            $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
657
+            $more_info .= '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
658
+            $more_info .= '<br />';
659 659
         }
660 660
         if (!empty($user_info['openarea'])) {
661
-            $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
662
-            $more_info .=  '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
663
-            $more_info .=  '<br />';
661
+            $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
662
+            $more_info .= '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
663
+            $more_info .= '<br />';
664 664
         }
665 665
         if (!empty($user_info['teach'])) {
666
-            $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
667
-            $more_info .=  '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
668
-            $more_info .=  '<br />';
666
+            $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
667
+            $more_info .= '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
668
+            $more_info .= '<br />';
669 669
         }
670
-        $socialRightInformation .=  SocialManager::social_wrapper_div($more_info, 4);
670
+        $socialRightInformation .= SocialManager::social_wrapper_div($more_info, 4);
671 671
     }
672 672
 }
673 673
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 $tpl->assign('social_right_information', $socialRightInformation);
690 690
 $tpl->assign('social_auto_extend_link', $socialAutoExtendLink);
691 691
 
692
-$formModalTpl =  new Template();
692
+$formModalTpl = new Template();
693 693
 //$formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message'));
694 694
 $formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation'));
695 695
 $formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
Please login to merge, or discard this patch.