Completed
Push — 1.10.x ( 6662c6...ba75a2 )
by Angel Fernando Quiroz
43:43
created
main/social/profile.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $cidReset = true;
13 13
 require_once '../inc/global.inc.php';
14 14
 
15
-if (api_get_setting('allow_social_tool') !='true') {
15
+if (api_get_setting('allow_social_tool') != 'true') {
16 16
     $url = api_get_path(WEB_PATH).'whoisonline.php?id='.intval($_GET['u']);
17 17
     header('Location: '.$url);
18 18
     exit;
@@ -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
     }
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
 require_once $libpath.'magpierss/rss_fetch.inc';
155 155
 $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php';
156 156
 $socialAjaxUrl = api_get_path(WEB_AJAX_PATH).'social.ajax.php';
157
-$javascriptDir = api_get_path(LIBRARY_PATH) . 'javascript/';
157
+$javascriptDir = api_get_path(LIBRARY_PATH).'javascript/';
158 158
 api_block_anonymous_users();
159 159
 $locale = api_get_language_isocode();
160 160
 // Add Jquery scroll pagination plugin
161 161
 $htmlHeadXtra[] = api_get_js('jscroll/jquery.jscroll.js');
162 162
 // Add Jquery Time ago plugin
163 163
 $htmlHeadXtra[] = api_get_asset('jquery-timeago/jquery.timeago.js');
164
-$timeAgoLocaleDir = $javascriptDir . 'jquery-timeago/locales/jquery.timeago.' . $locale . '.js';
164
+$timeAgoLocaleDir = $javascriptDir.'jquery-timeago/locales/jquery.timeago.'.$locale.'.js';
165 165
 if (file_exists($timeAgoLocaleDir)) {
166
-    $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.' . $locale . '.js');
166
+    $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.'.$locale.'.js');
167 167
 }
168 168
 
169 169
 $htmlHeadXtra[] = '<script>
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 $(document).ready(function (){
172 172
     var container = $("#wallMessages");
173 173
     container.jscroll({
174
-        loadingHtml: "<div class=\"well_border\">' . get_lang('Loading') . ' </div>",
174
+        loadingHtml: "<div class=\"well_border\">' . get_lang('Loading').' </div>",
175 175
         nextSelector: "a.nextPage:last",
176 176
         contentSelector: "",
177 177
         callback: timeAgo
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 );
223 223
 
224 224
 if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id()) {
225
-    $info_user =   api_get_user_info($_GET['u']);
226
-    $interbreadcrumb[]= array(
225
+    $info_user = api_get_user_info($_GET['u']);
226
+    $interbreadcrumb[] = array(
227 227
         'url' => '#',
228 228
         'name' => $info_user['complete_name']
229 229
     );
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 $list = [];
248 248
 if (is_array($personal_course_list)) {
249 249
     foreach ($personal_course_list as $my_course) {
250
-        if ($i<=10) {
250
+        if ($i <= 10) {
251 251
             $list[] = SocialManager::get_logged_user_course_html($my_course, $i);
252 252
             $course_list_code[] = array('code' => $my_course['code']);
253 253
         } else {
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 $social_wall_block = $wallSocialAddPost;
286 286
 
287 287
 // Social Post Wall
288
-$posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId) ;
288
+$posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId);
289 289
 
290 290
 $posts = empty($posts) ? '<p>'.get_lang("NoPosts").'</p>' : $posts;
291 291
 $social_post_wall_block = Display::panel($posts, get_lang('Posts'));
292 292
 
293 293
 $socialAutoExtendLink = Display::url(
294 294
     get_lang('SeeMore'),
295
-    $socialAjaxUrl . '?u='. $my_user_id . '&a=listWallMessage&start=10&length=5',
295
+    $socialAjaxUrl.'?u='.$my_user_id.'&a=listWallMessage&start=10&length=5',
296 296
     array(
297 297
         'class' => 'nextPage next',
298 298
     )
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
                 $(".spinner").html("'.
312 312
                     '<div class=\'text-center\'>'.
313 313
                         '<em class=\'fa fa-spinner fa-pulse fa-1x\'></em>'.
314
-                        '<p>'. get_lang('Loading') . ' ' . get_lang('Preview') .'</p>'.
314
+                        '<p>'.get_lang('Loading').' '.get_lang('Preview').'</p>'.
315 315
                     '</div>'.
316 316
                 '");
317 317
             },
318 318
             type: "POST",
319
-            url: "'. api_get_path(WEB_AJAX_PATH) .'social.ajax.php?a=readUrlWithOpenGraph",
319
+            url: "'. api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=readUrlWithOpenGraph",
320 320
             data: "social_wall_new_msg_main=" + e.originalEvent.clipboardData.getData("text"),
321 321
             success: function(response) {
322 322
                 $("[name=\'wall_post_button\']").prop( "disabled", false );
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
     $extra_user_data = UserManager::get_extra_user_data($user_id, false, true);
344 344
 
345 345
     $extra_information = '';
346
-    if (is_array($extra_user_data) && count($extra_user_data)>0 ) {
346
+    if (is_array($extra_user_data) && count($extra_user_data) > 0) {
347 347
         $extra_information_value = '<ul class="list-group">';
348 348
         $extraField = new ExtraField('user');
349 349
         foreach ($extra_user_data as $key => $data) {
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
                                 .$tags['tag']
405 405
                                 .'</a>';
406 406
                         }
407
-                        if (is_array($user_tags) && count($user_tags)>0) {
407
+                        if (is_array($user_tags) && count($user_tags) > 0) {
408 408
                             $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']).': '
409 409
                                 .' '.implode('', $tag_tmp).'</li>';
410 410
                         }
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
                         $extra_information_value .= '<li class="list-group-item">'.$data.'</li>';
429 429
                         break;
430 430
                     default:
431
-                        $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']) . ': ' . $data . '</li>';
431
+                        $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']).': '.$data.'</li>';
432 432
                     break;
433 433
                 }
434 434
             }
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
                 );
484 484
             }
485 485
             $count_users_group = count($userGroup->get_all_users_by_group($id));
486
-            if ($count_users_group == 1 ) {
486
+            if ($count_users_group == 1) {
487 487
                 $count_users_group = $count_users_group.' '.get_lang('Member');
488 488
             } else {
489 489
                 $count_users_group = $count_users_group.' '.get_lang('Members');
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
     if (count($grid_my_groups) > 0) {
504 504
         $my_groups = '';
505 505
         $count_groups = 0;
506
-        if (count($results) == 1 ) {
506
+        if (count($results) == 1) {
507 507
             $count_groups = count($results);
508 508
         } else {
509 509
             $count_groups = count($results);
@@ -514,10 +514,10 @@  discard block
 block discarded – undo
514 514
 
515 515
         if ($i > $max_numbers_of_group) {
516 516
             if (api_get_user_id() == $user_id) {
517
-                $my_groups .=  '<div class="box_shared_profile_group_actions">'
517
+                $my_groups .= '<div class="box_shared_profile_group_actions">'
518 518
                     .'<a href="groups.php?#tab_browse-1">'.get_lang('SeeAllMyGroups').'</a></div>';
519 519
             } else {
520
-                $my_groups .=  '<div class="box_shared_profile_group_actions">'
520
+                $my_groups .= '<div class="box_shared_profile_group_actions">'
521 521
                     .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
522 522
                     .'?view=mygroups&height=390&width=610&user_id='.$user_id.'"'
523 523
                     .' class="ajax" title="'.get_lang('SeeAll').'" >'
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
         $i = 1;
531 531
         foreach ($grid_my_groups as $group) {
532 532
             $my_groups .= '<div class="panel-body">';
533
-            $my_groups .=  $group[0];
533
+            $my_groups .= $group[0];
534 534
             $my_groups .= '</div>';
535 535
             $i++;
536 536
         }
@@ -548,12 +548,12 @@  discard block
 block discarded – undo
548 548
         $i = 1;
549 549
 
550 550
         foreach ($list as $key => $value) {
551
-            if ( empty($value[2]) ) { //if out of any session
552
-                $my_courses .=  $value[1];
551
+            if (empty($value[2])) { //if out of any session
552
+                $my_courses .= $value[1];
553 553
                 $i++;
554 554
             }
555 555
         }
556
-        $social_course_block .=  $my_courses;
556
+        $social_course_block .= $my_courses;
557 557
         //$social_course_block = Display::panel($my_courses, get_lang('MyCourses'));
558 558
     }
559 559
 
@@ -571,19 +571,19 @@  discard block
 block discarded – undo
571 571
     }
572 572
 
573 573
     // Productions
574
-    $production_list =  UserManager::build_production_list($user_id);
574
+    $production_list = UserManager::build_production_list($user_id);
575 575
 
576 576
     // Images uploaded by course
577 577
     $file_list = '';
578
-    if (is_array($course_list_code) && count($course_list_code)>0) {
578
+    if (is_array($course_list_code) && count($course_list_code) > 0) {
579 579
         foreach ($course_list_code as $course) {
580
-            $file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code'],$resourcetype='images');
580
+            $file_list .= UserManager::get_user_upload_files_by_course($user_id, $course['code'], $resourcetype = 'images');
581 581
         }
582 582
     }
583 583
 
584 584
     $count_pending_invitations = 0;
585 585
     if (!isset($_GET['u']) ||
586
-        (isset($_GET['u']) && $_GET['u']==api_get_user_id())
586
+        (isset($_GET['u']) && $_GET['u'] == api_get_user_id())
587 587
     ) {
588 588
         $pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
589 589
         $list_get_path_web = SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
@@ -593,92 +593,92 @@  discard block
 block discarded – undo
593 593
     if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) {
594 594
 
595 595
         //Pending invitations
596
-        if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
596
+        if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u'] == api_get_user_id())) {
597 597
             if ($count_pending_invitations > 0) {
598
-                $invitations =  '<div><h3>'.get_lang('PendingInvitations').'</h3></div>';
599
-                for ($i=0;$i<$count_pending_invitations;$i++) {
598
+                $invitations = '<div><h3>'.get_lang('PendingInvitations').'</h3></div>';
599
+                for ($i = 0; $i < $count_pending_invitations; $i++) {
600 600
                     $user_invitation_id = $pending_invitations[$i]['user_sender_id'];
601
-                    $invitations .=  '<div id="dpending_'.$user_invitation_id.'" class="friend_invitations">';
602
-                        $invitations .=  '<div style="float:left;width:60px;" >';
603
-                            $invitations .=  '<img style="margin-bottom:5px;"'
601
+                    $invitations .= '<div id="dpending_'.$user_invitation_id.'" class="friend_invitations">';
602
+                        $invitations .= '<div style="float:left;width:60px;" >';
603
+                            $invitations .= '<img style="margin-bottom:5px;"'
604 604
                                 .' src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'"'
605 605
                                 .' width="60px">';
606
-                        $invitations .=  '</div>';
606
+                        $invitations .= '</div>';
607 607
 
608
-                        $invitations .=  '<div style="padding-left:70px;">';
608
+                        $invitations .= '<div style="padding-left:70px;">';
609 609
                             $user_invitation_info = api_get_user_info($user_invitation_id);
610
-                            $invitations .=  '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php'
610
+                            $invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php'
611 611
                                 .'?u='.$user_invitation_id.'">'
612 612
                                 .api_get_person_name(
613 613
                                     $user_invitation_info['firstname'],
614 614
                                     $user_invitation_info['lastname'])
615 615
                                 .'</a>';
616
-                            $invitations .=  '<br />';
617
-                            $invitations .=  Security::remove_XSS(
616
+                            $invitations .= '<br />';
617
+                            $invitations .= Security::remove_XSS(
618 618
                                 cut($pending_invitations[$i]['content'], 50),
619 619
                                 STUDENT,
620 620
                                 true
621 621
                             );
622
-                            $invitations .=  '<br />';
623
-                            $invitations .=  '<a id="btn_accepted_'.$user_invitation_id.'"'
622
+                            $invitations .= '<br />';
623
+                            $invitations .= '<a id="btn_accepted_'.$user_invitation_id.'"'
624 624
                                 .' class="btn btn-default" onclick="register_friend(this)" href="javascript:void(0)">'
625 625
                                 .get_lang('SocialAddToFriends')
626 626
                                 .'</a>';
627
-                            $invitations .=  '<div id="id_response"></div>';
628
-                        $invitations .=  '</div>';
629
-                    $invitations .=  '</div>';
627
+                            $invitations .= '<div id="id_response"></div>';
628
+                        $invitations .= '</div>';
629
+                    $invitations .= '</div>';
630 630
                 }
631
-                $socialRightInformation .=  SocialManager::social_wrapper_div($invitations, 4);
631
+                $socialRightInformation .= SocialManager::social_wrapper_div($invitations, 4);
632 632
             }
633 633
         }
634 634
 
635 635
         // Productions
636
-        $production_list =  UserManager::build_production_list($user_id);
636
+        $production_list = UserManager::build_production_list($user_id);
637 637
 
638
-        $product_content  = '';
638
+        $product_content = '';
639 639
         if (!empty($production_list)) {
640 640
             $product_content .= '<div><h3>'.get_lang('MyProductions').'</h3></div>';
641
-            $product_content .=  $production_list;
642
-            $socialRightInformation .=  SocialManager::social_wrapper_div($product_content, 4);
641
+            $product_content .= $production_list;
642
+            $socialRightInformation .= SocialManager::social_wrapper_div($product_content, 4);
643 643
         }
644 644
 
645 645
         $images_uploaded = null;
646 646
         // Images uploaded by course
647 647
         if (!empty($file_list)) {
648
-            $images_uploaded .=  '<div><h3>'.get_lang('ImagesUploaded').'</h3></div>';
649
-            $images_uploaded .=  '<div class="social-content-information">';
650
-            $images_uploaded .=  $file_list;
651
-            $images_uploaded .=  '</div>';
652
-            $socialRightInformation .=  SocialManager::social_wrapper_div($images_uploaded, 4);
648
+            $images_uploaded .= '<div><h3>'.get_lang('ImagesUploaded').'</h3></div>';
649
+            $images_uploaded .= '<div class="social-content-information">';
650
+            $images_uploaded .= $file_list;
651
+            $images_uploaded .= '</div>';
652
+            $socialRightInformation .= SocialManager::social_wrapper_div($images_uploaded, 4);
653 653
         }
654 654
     }
655 655
 
656 656
     if (!empty($user_info['competences']) || !empty($user_info['diplomas'])
657
-        || !empty($user_info['openarea']) || !empty($user_info['teach']) ) {
657
+        || !empty($user_info['openarea']) || !empty($user_info['teach'])) {
658 658
 
659
-        $more_info .=  '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
659
+        $more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
660 660
         if (!empty($user_info['competences'])) {
661
-            $more_info .=  '<br />';
662
-                $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
663
-                $more_info .=  '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
664
-            $more_info .=  '<br />';
661
+            $more_info .= '<br />';
662
+                $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
663
+                $more_info .= '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
664
+            $more_info .= '<br />';
665 665
         }
666 666
         if (!empty($user_info['diplomas'])) {
667
-            $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
668
-            $more_info .=  '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
669
-            $more_info .=  '<br />';
667
+            $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
668
+            $more_info .= '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
669
+            $more_info .= '<br />';
670 670
         }
671 671
         if (!empty($user_info['openarea'])) {
672
-            $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
673
-            $more_info .=  '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
674
-            $more_info .=  '<br />';
672
+            $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
673
+            $more_info .= '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
674
+            $more_info .= '<br />';
675 675
         }
676 676
         if (!empty($user_info['teach'])) {
677
-            $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
678
-            $more_info .=  '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
679
-            $more_info .=  '<br />';
677
+            $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
678
+            $more_info .= '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
679
+            $more_info .= '<br />';
680 680
         }
681
-        $socialRightInformation .=  SocialManager::social_wrapper_div($more_info, 4);
681
+        $socialRightInformation .= SocialManager::social_wrapper_div($more_info, 4);
682 682
     }
683 683
 }
684 684
 
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 $tpl->assign('social_right_information', $socialRightInformation);
700 700
 $tpl->assign('social_auto_extend_link', $socialAutoExtendLink);
701 701
 
702
-$formModalTpl =  new Template();
702
+$formModalTpl = new Template();
703 703
 //$formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message'));
704 704
 $formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation'));
705 705
 $formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
Please login to merge, or discard this patch.