Passed
Push — 1.10.x ( 51b3f0...0b3bd8 )
by Yannick
116:33 queued 61:35
created
main/inc/lib/social.lib.php 4 patches
Doc Comments   +14 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,6 +63,8 @@  discard block
 block discarded – undo
63 63
      * @param int user id
64 64
      * @param int user friend id
65 65
      * @param string
66
+     * @param integer $user_id
67
+     * @param integer $user_friend
66 68
      * @author isaac flores paz
67 69
      */
68 70
     public static function get_relation_between_contacts($user_id, $user_friend)
@@ -94,6 +96,8 @@  discard block
 block discarded – undo
94 96
      * @param int group id
95 97
      * @param string name to search
96 98
      * @param bool true will load firstname, lastname, and image name
99
+     * @param integer $user_id
100
+     * @param integer $id_group
97 101
      * @return array
98 102
      * @author Julio Montoya <[email protected]> Cleaning code, function renamed, $load_extra_info option added
99 103
      * @author isaac flores paz
@@ -170,6 +174,9 @@  discard block
 block discarded – undo
170 174
      * @param int user friend id
171 175
      * @param string title of the message
172 176
      * @param string content of the message
177
+     * @param integer $user_id
178
+     * @param string $message_title
179
+     * @param string $message_content
173 180
      * @return boolean
174 181
      * @author isaac flores paz
175 182
      * @author Julio Montoya <[email protected]> Cleaning code
@@ -241,6 +248,7 @@  discard block
 block discarded – undo
241 248
      * Get number messages of the inbox
242 249
      * @author isaac flores paz
243 250
      * @param int user receiver id
251
+     * @param integer $user_receiver_id
244 252
      * @return int
245 253
      */
246 254
     public static function get_message_number_invitation_by_user_id($user_receiver_id)
@@ -283,6 +291,7 @@  discard block
 block discarded – undo
283 291
      * Get invitation list sent by user
284 292
      * @author Julio Montoya <[email protected]>
285 293
      * @param int user id
294
+     * @param integer $user_id
286 295
      * @return array()
287 296
      */
288 297
     public static function get_list_invitation_sent_by_user_id($user_id)
@@ -325,6 +334,7 @@  discard block
 block discarded – undo
325 334
      * Denies invitation
326 335
      * @param int user sender id
327 336
      * @param int user receiver id
337
+     * @param integer $user_receiver_id
328 338
      * @author isaac flores paz
329 339
      * @author Julio Montoya <[email protected]> Cleaning code
330 340
      */
@@ -360,7 +370,7 @@  discard block
 block discarded – undo
360 370
      * @author Isaac Flores Paz <[email protected]>
361 371
      * @author Julio Montoya <[email protected]> Cleaning code
362 372
      * @param void
363
-     * @return string message invitation
373
+     * @return false|null message invitation
364 374
      */
365 375
     public static function send_invitation_friend_user($userfriend_id, $subject_message = '', $content_message = '')
366 376
     {
@@ -1229,7 +1239,7 @@  discard block
 block discarded – undo
1229 1239
      * @param string $messageContent of the message
1230 1240
      * @param int $messageId id parent
1231 1241
      * @param string $messageStatus status type of message
1232
-     * @return boolean
1242
+     * @return false|string
1233 1243
      * @author Yannick Warnier
1234 1244
      */
1235 1245
     public static function sendWallMessage($userId, $friendId, $messageContent, $messageId = 0, $messageStatus = '')
@@ -1318,7 +1328,7 @@  discard block
 block discarded – undo
1318 1328
      * Gets all messages from someone's wall (within specific limits)
1319 1329
      * @param int $userId id of wall shown
1320 1330
      * @param string $messageStatus status wall message
1321
-     * @param int|string $parentId id message (Post main)
1331
+     * @param integer|null $parentId id message (Post main)
1322 1332
      * @param date $start Date from which we want to show the messages, in UTC time
1323 1333
      * @param int $limit Limit for the number of parent messages we want to show
1324 1334
      * @param int $offset Wall message query offset
@@ -1647,7 +1657,7 @@  discard block
 block discarded – undo
1647 1657
     /**
1648 1658
     * Delete messages delete logic
1649 1659
     * @param int $id id message to delete.
1650
-    * @return bool status query
1660
+    * @return Statement|null status query
1651 1661
     */
1652 1662
     public static function deleteMessage($id)
1653 1663
     {
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
         if ($course_visibility != COURSE_VISIBILITY_HIDDEN &&
511 511
             ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)
512 512
         ) {
513
-           $result .= '<span class="title">' . $course_title . '<span>';
513
+            $result .= '<span class="title">' . $course_title . '<span>';
514 514
         } else {
515 515
             $result .= $course_title." "." ".get_lang('CourseClosed')."";
516 516
         }
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
             }
1415 1415
             $media .= '<div class="user-image">';
1416 1416
             $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] .
1417
-                       '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>';
1417
+                        '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>';
1418 1418
             $media .= '</div>';
1419 1419
             $media .= '<div class="user-data">';
1420 1420
             $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a></div>';
@@ -1645,10 +1645,10 @@  discard block
 block discarded – undo
1645 1645
         return $name;
1646 1646
     }
1647 1647
     /**
1648
-    * Delete messages delete logic
1649
-    * @param int $id id message to delete.
1650
-    * @return bool status query
1651
-    */
1648
+     * Delete messages delete logic
1649
+     * @param int $id id message to delete.
1650
+     * @return bool status query
1651
+     */
1652 1652
     public static function deleteMessage($id)
1653 1653
     {
1654 1654
         $id = intval($id);
Please login to merge, or discard this patch.
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
                     friend_user_id<>'.((int) $user_id).' AND
110 110
                     user_id='.((int) $user_id);
111 111
         if (isset($id_group) && $id_group > 0) {
112
-            $sql.=' AND relation_type='.$id_group;
112
+            $sql .= ' AND relation_type='.$id_group;
113 113
         }
114 114
         if (isset($search_name)) {
115 115
             $search_name = trim($search_name);
116 116
             $search_name = str_replace(' ', '', $search_name);
117
-            $sql.=' AND friend_user_id IN (
117
+            $sql .= ' AND friend_user_id IN (
118 118
                 SELECT user_id FROM '.$tbl_my_user.'
119 119
                 WHERE
120 120
                     firstName LIKE "%'.Database::escape_string($search_name).'%" OR
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 
369 369
         $user_info = api_get_user_info($userfriend_id);
370 370
         $succes = get_lang('MessageSentTo');
371
-        $succes.= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
371
+        $succes .= ' : '.api_get_person_name($user_info['firstName'], $user_info['lastName']);
372 372
 
373 373
         if (isset($subject_message) && isset($content_message) && isset($userfriend_id)) {
374 374
             $send_message = MessageManager::send_message($userfriend_id, $subject_message, $content_message);
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
         $user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_code);
486 486
 
487 487
         //$valor = api_get_settings_params();
488
-        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory;   // course path
488
+        $course_path = api_get_path(SYS_COURSE_PATH).$course_directory; // course path
489 489
         if (api_get_setting('course_images_in_courses_list') === 'true') {
490 490
             if (file_exists($course_path.'/course-pic85x85.png')) {
491 491
                 $image = $my_course['course_info']['course_image'];
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
         if ($course_visibility != COURSE_VISIBILITY_HIDDEN &&
511 511
             ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER)
512 512
         ) {
513
-           $result .= '<span class="title">' . $course_title . '<span>';
513
+           $result .= '<span class="title">'.$course_title.'<span>';
514 514
         } else {
515 515
             $result .= $course_title." "." ".get_lang('CourseClosed')."";
516 516
         }
@@ -729,57 +729,57 @@  discard block
 block discarded – undo
729 729
             $links = '<ul class="nav nav-pills nav-stacked">';
730 730
             $active = $show == 'home' ? 'active' : null;
731 731
             $links .= '
732
-                <li class="home-icon ' . $active . '">
733
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
734
-                        ' . $homeIcon . ' ' . get_lang('Home') . '
732
+                <li class="home-icon ' . $active.'">
733
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
734
+                        ' . $homeIcon.' '.get_lang('Home').'
735 735
                     </a>
736 736
                 </li>';
737 737
             $active = $show == 'messages' ? 'active' : null;
738 738
             $links .= '
739
-                <li class="messages-icon ' . $active . '">
740
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
741
-                        ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
739
+                <li class="messages-icon ' . $active.'">
740
+                    <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
741
+                        ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
742 742
                     </a>
743 743
                 </li>';
744 744
 
745 745
             //Invitations
746 746
             $active = $show == 'invitations' ? 'active' : null;
747 747
             $links .= '
748
-                <li class="invitations-icon ' . $active . '">
749
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
750
-                        ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
748
+                <li class="invitations-icon ' . $active.'">
749
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
750
+                        ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
751 751
                     </a>
752 752
                 </li>';
753 753
 
754 754
             //Shared profile and groups
755 755
             $active = $show == 'shared_profile' ? 'active' : null;
756 756
             $links .= '
757
-                <li class="shared-profile-icon' . $active . '">
758
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
759
-                        ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
757
+                <li class="shared-profile-icon' . $active.'">
758
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
759
+                        ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
760 760
                     </a>
761 761
                 </li>';
762 762
             $active = $show == 'friends' ? 'active' : null;
763 763
             $links .= '
764
-                <li class="friends-icon ' . $active . '">
765
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
766
-                        ' . $friendsIcon . ' ' . get_lang('Friends') . '
764
+                <li class="friends-icon ' . $active.'">
765
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
766
+                        ' . $friendsIcon.' '.get_lang('Friends').'
767 767
                     </a>
768 768
                 </li>';
769 769
             $active = $show == 'browse_groups' ? 'active' : null;
770 770
             $links .= '
771
-                <li class="browse-groups-icon ' . $active . '">
772
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
773
-                        ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
771
+                <li class="browse-groups-icon ' . $active.'">
772
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
773
+                        ' . $groupsIcon.' '.get_lang('SocialGroups').'
774 774
                     </a>
775 775
                 </li>';
776 776
 
777 777
             //Search users
778 778
             $active = $show == 'search' ? 'active' : null;
779 779
             $links .= '
780
-                <li class="search-icon ' . $active . '">
781
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
782
-                        ' . $searchIcon . ' ' . get_lang('Search') . '
780
+                <li class="search-icon ' . $active.'">
781
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
782
+                        ' . $searchIcon.' '.get_lang('Search').'
783 783
                     </a>
784 784
                 </li>';
785 785
 
@@ -787,9 +787,9 @@  discard block
 block discarded – undo
787 787
             $active = $show == 'myfiles' ? 'active' : null;
788 788
 
789 789
             $myFiles = '
790
-                <li class="myfiles-icon ' . $active . '">
791
-                    <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
792
-                        ' . $filesIcon . ' ' . get_lang('MyFiles') . '
790
+                <li class="myfiles-icon ' . $active.'">
791
+                    <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
792
+                        ' . $filesIcon.' '.get_lang('MyFiles').'
793 793
                     </a>
794 794
                 </li>';
795 795
 
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
             }
799 799
             $links .= $myFiles;
800 800
 
801
-            $links .='</ul>';
801
+            $links .= '</ul>';
802 802
             
803 803
             $html .= Display::panelCollapse(
804 804
                     get_lang('SocialNetwork'),
@@ -819,57 +819,57 @@  discard block
 block discarded – undo
819 819
         }
820 820
 
821 821
         if ($show == 'shared_profile') {
822
-            $links =  '<ul class="nav nav-pills nav-stacked">';
822
+            $links = '<ul class="nav nav-pills nav-stacked">';
823 823
             // My own profile
824 824
             if ($show_full_profile && $user_id == intval(api_get_user_id())) {
825 825
                 $links .= '
826
-                    <li class="home-icon ' . $active . '">
827
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/home.php">
828
-                            ' . $homeIcon . ' ' . get_lang('Home') . '
826
+                    <li class="home-icon ' . $active.'">
827
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/home.php">
828
+                            ' . $homeIcon.' '.get_lang('Home').'
829 829
                         </a>
830 830
                     </li>
831
-                    <li class="messages-icon ' . $active . '">
832
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'messages/inbox.php?f=social">
833
-                            ' . $messagesIcon . ' ' . get_lang('Messages') . $count_unread_message . '
831
+                    <li class="messages-icon ' . $active.'">
832
+                        <a href="' . api_get_path(WEB_CODE_PATH).'messages/inbox.php?f=social">
833
+                            ' . $messagesIcon.' '.get_lang('Messages').$count_unread_message.'
834 834
                         </a>
835 835
                     </li>';
836 836
                 $active = $show == 'invitations' ? 'active' : null;
837 837
                 $links .= '
838
-                    <li class="invitations-icon' . $active . '">
839
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">
840
-                            ' . $invitationsIcon . ' ' . get_lang('Invitations') . $total_invitations . '
838
+                    <li class="invitations-icon' . $active.'">
839
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/invitations.php">
840
+                            ' . $invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
841 841
                         </a>
842 842
                     </li>';
843 843
 
844 844
                 $links .= '
845 845
                     <li class="shared-profile-icon active">
846
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php">
847
-                            ' . $sharedProfileIcon . ' ' . get_lang('ViewMySharedProfile') . '
846
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/profile.php">
847
+                            ' . $sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
848 848
                         </a>
849 849
                     </li>
850 850
                     <li class="friends-icon">
851
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
852
-                            ' . $friendsIcon . ' ' . get_lang('Friends') . '
851
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/friends.php">
852
+                            ' . $friendsIcon.' '.get_lang('Friends').'
853 853
                         </a>
854 854
                     </li>
855 855
                     <li class="browse-groups-icon">
856
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
857
-                            ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
856
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/groups.php">
857
+                            ' . $groupsIcon.' '.get_lang('SocialGroups').'
858 858
                         </a>
859 859
                     </li>';
860 860
                 $active = $show == 'search' ? 'active' : null;
861 861
                 $links .= '
862
-                    <li class="search-icon ' . $active . '">
863
-                        <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
864
-                            ' . $searchIcon . ' ' . get_lang('Search') . '
862
+                    <li class="search-icon ' . $active.'">
863
+                        <a href="' . api_get_path(WEB_CODE_PATH).'social/search.php">
864
+                            ' . $searchIcon.' '.get_lang('Search').'
865 865
                         </a>
866 866
                     </li>';
867 867
                 $active = $show == 'myfiles' ? 'active' : null;
868 868
 
869 869
                 $myFiles = '
870
-                    <li class="myfiles-icon ' . $active . '">
871
-                     <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
872
-                            ' . $filesIcon . ' ' . get_lang('MyFiles') . '
870
+                    <li class="myfiles-icon ' . $active.'">
871
+                     <a href="' . api_get_path(WEB_CODE_PATH).'social/myfiles.php">
872
+                            ' . $filesIcon.' '.get_lang('MyFiles').'
873 873
                         </a>
874 874
                     </li>';
875 875
 
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
                 $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>';
916 916
             } else {
917 917
                 if (!$show_full_profile) {
918
-                    $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>';
918
+                    $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>';
919 919
                 }
920 920
             }
921 921
 
@@ -1025,10 +1025,10 @@  discard block
 block discarded – undo
1025 1025
         foreach ($user_list as $uid) {
1026 1026
             $user_info = api_get_user_info($uid, $checkIfUserOnline = true);
1027 1027
             $lastname = $user_info['lastname'];
1028
-            $firstname =  $user_info['firstname'];
1028
+            $firstname = $user_info['firstname'];
1029 1029
             $completeName = $firstname.', '.$lastname;
1030 1030
 
1031
-            $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);
1031
+            $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);
1032 1032
             $status_icon_chat = null;
1033 1033
             if ($user_info['user_is_online_in_chat'] == 1) {
1034 1034
                 $status_icon_chat = Display::return_icon('online.png', get_lang('Online'));
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
             $userPicture = $user_info['avatar'];
1040 1040
             $img = '<img class="img-responsive img-circle" title="'.$completeName.'" alt="'.$completeName.'" src="'.$userPicture.'">';
1041 1041
 
1042
-            $url =  null;
1042
+            $url = null;
1043 1043
             // Anonymous users can't have access to the profile
1044 1044
             if (!api_is_anonymous()) {
1045 1045
                 if (api_get_setting('allow_social_tool') == 'true') {
@@ -1205,13 +1205,13 @@  discard block
 block discarded – undo
1205 1205
             case SOCIAL_CENTER_PLUGIN:
1206 1206
                 $social_plugins = array(1, 2);
1207 1207
                 if (is_array($social_plugins) && count($social_plugins) > 0) {
1208
-                    $content.= '<div id="social-plugins">';
1208
+                    $content .= '<div id="social-plugins">';
1209 1209
                     foreach ($social_plugins as $plugin) {
1210
-                        $content.= '<div class="social-plugin-item">';
1211
-                        $content.= $plugin;
1212
-                        $content.= '</div>';
1210
+                        $content .= '<div class="social-plugin-item">';
1211
+                        $content .= $plugin;
1212
+                        $content .= '</div>';
1213 1213
                     }
1214
-                    $content.= '</div>';
1214
+                    $content .= '</div>';
1215 1215
                 }
1216 1216
                 break;
1217 1217
             case SOCIAL_LEFT_PLUGIN:
@@ -1279,12 +1279,12 @@  discard block
 block discarded – undo
1279 1279
         if (!in_array($extension, $allowedTypes)) {
1280 1280
             $flag = false;
1281 1281
         } else {
1282
-            $newFileName = uniqid('') . '.' . $extension;
1282
+            $newFileName = uniqid('').'.'.$extension;
1283 1283
             if (!file_exists($pathMessageAttach)) {
1284 1284
                 @mkdir($pathMessageAttach, api_get_permissions_for_new_directories(), true);
1285 1285
             }
1286 1286
 
1287
-            $newPath = $pathMessageAttach . $newFileName;
1287
+            $newPath = $pathMessageAttach.$newFileName;
1288 1288
             if (is_uploaded_file($fileAttach['tmp_name'])) {
1289 1289
                 @copy($fileAttach['tmp_name'], $newPath);
1290 1290
             }
@@ -1293,9 +1293,9 @@  discard block
 block discarded – undo
1293 1293
             $medium = self::resize_picture($newPath, IMAGE_WALL_MEDIUM_SIZE);
1294 1294
 
1295 1295
             $big = new Image($newPath);
1296
-            $ok = $small && $small->send_image($pathMessageAttach . IMAGE_WALL_SMALL . '_' . $newFileName) &&
1297
-                $medium && $medium->send_image($pathMessageAttach . IMAGE_WALL_MEDIUM .'_' . $newFileName) &&
1298
-                $big && $big->send_image($pathMessageAttach . IMAGE_WALL_BIG . '_' . $newFileName);
1296
+            $ok = $small && $small->send_image($pathMessageAttach.IMAGE_WALL_SMALL.'_'.$newFileName) &&
1297
+                $medium && $medium->send_image($pathMessageAttach.IMAGE_WALL_MEDIUM.'_'.$newFileName) &&
1298
+                $big && $big->send_image($pathMessageAttach.IMAGE_WALL_BIG.'_'.$newFileName);
1299 1299
 
1300 1300
             // Insert
1301 1301
             $newFileName = $social.$newFileName;
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
             $start = '0000-00-00';
1387 1387
         }
1388 1388
 
1389
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
1389
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
1390 1390
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL, $idMessage, $start, $limit, $offset);
1391 1391
         $formattedList = '<div class="sub-mediapost">';
1392 1392
         $users = array();
@@ -1401,8 +1401,8 @@  discard block
 block discarded – undo
1401 1401
             }
1402 1402
 
1403 1403
             $nameComplete = api_is_western_name_order()
1404
-                ? $users[$userIdLoop]['firstname'] .' ' . $users[$userIdLoop]['lastname']
1405
-                : $users[$userIdLoop]['lastname'] . ' ' . $users[$userIdLoop]['firstname'];
1404
+                ? $users[$userIdLoop]['firstname'].' '.$users[$userIdLoop]['lastname']
1405
+                : $users[$userIdLoop]['lastname'].' '.$users[$userIdLoop]['firstname'];
1406 1406
             $url = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userIdLoop;
1407 1407
             $media = '';
1408 1408
             $media .= '<div class="rep-post">';
@@ -1413,11 +1413,11 @@  discard block
 block discarded – undo
1413 1413
                 $media .= '</div>';
1414 1414
             }
1415 1415
             $media .= '<div class="user-image">';
1416
-            $media .= '<a href="'.$url.'" ><img src="'. $users[$userIdLoop]['avatar'] .
1416
+            $media .= '<a href="'.$url.'" ><img src="'.$users[$userIdLoop]['avatar'].
1417 1417
                        '" alt="'.$users[$userIdLoop]['complete_name'].'" class="avatar-thumb"></a>';
1418 1418
             $media .= '</div>';
1419 1419
             $media .= '<div class="user-data">';
1420
-            $media .= '<div class="username">' . '<a href="'.$url.'">'.$nameComplete.'</a></div>';
1420
+            $media .= '<div class="username">'.'<a href="'.$url.'">'.$nameComplete.'</a></div>';
1421 1421
             $media .= '<div class="time timeago" title="'.$date.'">'.$date.'</div>';
1422 1422
             $media .= '</div>';
1423 1423
             $media .= '<div class="msg-content">';
@@ -1452,12 +1452,12 @@  discard block
 block discarded – undo
1452 1452
      * @param   int     $offset     Wall messages offset
1453 1453
      * @return  array   $data       return user's starting wall messages along with message extra data
1454 1454
      */
1455
-    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset= 0)
1455
+    public static function getWallMessagesPostHTML($userId, $friendId = 0, $start = null, $limit = 10, $offset = 0)
1456 1456
     {
1457 1457
         if (empty($start)) {
1458 1458
             $start = '0000-00-00';
1459 1459
         }
1460
-        $isOwnWall = (api_get_user_id() == $userId  && $userId == $friendId);
1460
+        $isOwnWall = (api_get_user_id() == $userId && $userId == $friendId);
1461 1461
         $messages = self::getWallMessages($userId, MESSAGE_STATUS_WALL_POST, null, $start, $limit, $offset);
1462 1462
         $users = array();
1463 1463
         $data = array();
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
 
1517 1517
         $htmlReceiver = '';
1518 1518
         if ($authorId != $receiverId) {
1519
-            $htmlReceiver = ' > <a href="'.$urlReceiver.'">' . $nameCompleteReceiver . '</a> ';
1519
+            $htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> ';
1520 1520
         }
1521 1521
 
1522 1522
         $wallImage = '';
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
         $html .= '<div class="img-post">';
1552 1552
         $html .= $wallImage;
1553 1553
         $html .= '</div>';
1554
-        $html .= '<p>'. Security::remove_XSS($message['content']).'</p>';
1554
+        $html .= '<p>'.Security::remove_XSS($message['content']).'</p>';
1555 1555
         $html .= '</div>';
1556 1556
         $html .= '</div>'; // end mediaPost
1557 1557
 
@@ -1574,11 +1574,11 @@  discard block
 block discarded – undo
1574 1574
         $domain = empty($url) ? parse_url($link) : parse_url($url);
1575 1575
         $domain = $domain['scheme'].'://'.$domain['host'];
1576 1576
         // Trick to verify if the Image Url Exist because of some bad metatag dev
1577
-        if (self::verifyUrl($image) == false){
1578
-            if (!($image[0] == '/')){
1579
-                $domain = $domain . '/';
1577
+        if (self::verifyUrl($image) == false) {
1578
+            if (!($image[0] == '/')) {
1579
+                $domain = $domain.'/';
1580 1580
             }
1581
-            $image = $domain . $image;
1581
+            $image = $domain.$image;
1582 1582
         }
1583 1583
         $title = $graph->title;
1584 1584
         
@@ -1630,16 +1630,16 @@  discard block
 block discarded – undo
1630 1630
         if (isset($array[2]) && !empty($array[2])) {
1631 1631
 
1632 1632
             if ($size == IMAGE_WALL_SMALL) {
1633
-                $name = IMAGE_WALL_SMALL. '_' . $array[2];
1634
-            }else if($size == IMAGE_WALL_MEDIUM){
1635
-                $name = IMAGE_WALL_MEDIUM. '_' . $array[2];
1636
-            }else if($size == IMAGE_WALL_BIG){
1637
-                $name = IMAGE_WALL_BIG. '_' . $array[2];
1638
-            }else {
1639
-                $name = IMAGE_WALL_SMALL. '_' . $array[2];
1633
+                $name = IMAGE_WALL_SMALL.'_'.$array[2];
1634
+            } else if ($size == IMAGE_WALL_MEDIUM) {
1635
+                $name = IMAGE_WALL_MEDIUM.'_'.$array[2];
1636
+            } else if ($size == IMAGE_WALL_BIG) {
1637
+                $name = IMAGE_WALL_BIG.'_'.$array[2];
1638
+            } else {
1639
+                $name = IMAGE_WALL_SMALL.'_'.$array[2];
1640 1640
             }
1641 1641
             $lessImage = str_replace($array[2], '', $path);
1642
-            $name = $lessImage . $name;
1642
+            $name = $lessImage.$name;
1643 1643
         }
1644 1644
 
1645 1645
         return $name;
@@ -1747,18 +1747,18 @@  discard block
 block discarded – undo
1747 1747
         if ($number_friends != 0) {
1748 1748
             if ($number_friends > $number_of_images) {
1749 1749
                 if (api_get_user_id() == $user_id) {
1750
-                    $friendHtml.= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
1750
+                    $friendHtml .= ' <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
1751 1751
                 } else {
1752
-                    $friendHtml.= ' <span>'
1752
+                    $friendHtml .= ' <span>'
1753 1753
                         .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
1754 1754
                         .'?view=friends&height=390&width=610&user_id='.$user_id.'"'
1755 1755
                         .'class="ajax" data-title="'.get_lang('SeeAll').'" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAll').'</a></span>';
1756 1756
                 }
1757 1757
             }
1758 1758
 
1759
-            $friendHtml.= '<ul class="nav nav-list">';
1759
+            $friendHtml .= '<ul class="nav nav-list">';
1760 1760
             $j = 1;
1761
-            for ($k=0; $k < $number_friends; $k++) {
1761
+            for ($k = 0; $k < $number_friends; $k++) {
1762 1762
                 if ($j > $number_of_images) break;
1763 1763
 
1764 1764
                 if (isset($friends[$k])) {
@@ -1772,26 +1772,26 @@  discard block
 block discarded – undo
1772 1772
                         $statusIcon = Display::span('', array('class' => 'offline_user_in_text'));
1773 1773
                     }
1774 1774
 
1775
-                    $friendHtml.= '<li>';
1776
-                    $friendHtml.= '<div>';
1775
+                    $friendHtml .= '<li>';
1776
+                    $friendHtml .= '<div>';
1777 1777
 
1778 1778
                     // the height = 92 must be the same in the image_friend_network span style in default.css
1779 1779
                     $friends_profile = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_SMALL);
1780
-                    $friendHtml.= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
1780
+                    $friendHtml .= '<img src="'.$friends_profile.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
1781 1781
                     $link_shared = (empty($link_shared)) ? '' : '&'.$link_shared;
1782
-                    $friendHtml.= $statusIcon .'<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '">' . $name_user .'</a>';
1783
-                    $friendHtml.= '</div>';
1784
-                    $friendHtml.= '</li>';
1782
+                    $friendHtml .= $statusIcon.'<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'">'.$name_user.'</a>';
1783
+                    $friendHtml .= '</div>';
1784
+                    $friendHtml .= '</li>';
1785 1785
                 }
1786 1786
                 $j++;
1787 1787
             }
1788
-            $friendHtml.='</ul>';
1788
+            $friendHtml .= '</ul>';
1789 1789
         } else {
1790
-            $friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
1791
-                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
1790
+            $friendHtml .= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
1791
+                .'<a class="btn btn-primary" href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
1792 1792
         }
1793 1793
 
1794
-        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' (' . $number_friends . ')' );
1794
+        $friendHtml = Display::panel($friendHtml, get_lang('SocialFriend').' ('.$number_friends.')');
1795 1795
 
1796 1796
         return $friendHtml;
1797 1797
     }
@@ -1812,9 +1812,9 @@  discard block
 block discarded – undo
1812 1812
 
1813 1813
         if ($number_friends != 0) {
1814 1814
 
1815
-            $friendHtml.= '<div class="list-group">';
1815
+            $friendHtml .= '<div class="list-group">';
1816 1816
             $j = 1;
1817
-            for ($k=0; $k < $number_friends; $k++) {
1817
+            for ($k = 0; $k < $number_friends; $k++) {
1818 1818
                 if ($j > $number_of_images) break;
1819 1819
 
1820 1820
                 if (isset($friends[$k])) {
@@ -1823,11 +1823,11 @@  discard block
 block discarded – undo
1823 1823
                     $user_info_friend = api_get_user_info($friend['friend_user_id'], true);
1824 1824
 
1825 1825
                     if ($user_info_friend['user_is_online']) {
1826
-                        $statusIcon = Display::return_icon('statusonline.png',get_lang('Online'));
1827
-                        $status=1;
1826
+                        $statusIcon = Display::return_icon('statusonline.png', get_lang('Online'));
1827
+                        $status = 1;
1828 1828
                     } else {
1829
-                        $statusIcon = Display::return_icon('statusoffline.png',get_lang('Offline'));
1830
-                        $status=0;
1829
+                        $statusIcon = Display::return_icon('statusoffline.png', get_lang('Offline'));
1830
+                        $status = 0;
1831 1831
                     }
1832 1832
 
1833 1833
                     $friendAvatarMedium = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_MEDIUM);
@@ -1836,24 +1836,24 @@  discard block
 block discarded – undo
1836 1836
                     $showLinkToChat = api_is_global_chat_enabled() &&
1837 1837
                         $friend['friend_user_id'] != api_get_user_id();
1838 1838
 
1839
-                    if ($showLinkToChat){
1839
+                    if ($showLinkToChat) {
1840 1840
                         $friendHtml .= '<a onclick="javascript:chatWith(\''.$friend['friend_user_id'].'\', \''.$name_user.'\', \''.$status.'\',\''.$friendAvatarSmall.'\')" href="javascript:void(0);" class="list-group-item">';
1841
-                        $friendHtml .=  $friend_avatar.' <span class="username">' . $name_user . '</span>';
1842
-                        $friendHtml .= '<span class="status">' . $statusIcon . '</span>';
1841
+                        $friendHtml .= $friend_avatar.' <span class="username">'.$name_user.'</span>';
1842
+                        $friendHtml .= '<span class="status">'.$statusIcon.'</span>';
1843 1843
                     } else {
1844 1844
                         $link_shared = (empty($link_shared)) ? '' : '&'.$link_shared;
1845
-                        $friendHtml .= '<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '" class="list-group-item">';
1846
-                        $friendHtml .=  $friend_avatar.' <span class="username-all">' . $name_user . '</span>';
1845
+                        $friendHtml .= '<a href="profile.php?'.'u='.$friend['friend_user_id'].$link_shared.'" class="list-group-item">';
1846
+                        $friendHtml .= $friend_avatar.' <span class="username-all">'.$name_user.'</span>';
1847 1847
                     }
1848 1848
 
1849 1849
                     $friendHtml .= '</a>';
1850 1850
                 }
1851 1851
                 $j++;
1852 1852
             }
1853
-            $friendHtml.='</div>';
1853
+            $friendHtml .= '</div>';
1854 1854
         } else {
1855
-            $friendHtml.= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
1856
-                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '. get_lang('TryAndFindSomeFriends').'</a></div>';
1855
+            $friendHtml .= '<div class="help">'.get_lang('NoFriendsInYourContactList').' '
1856
+                .'<a href="'.api_get_path(WEB_PATH).'whoisonline.php"><em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a></div>';
1857 1857
         }
1858 1858
 
1859 1859
         return $friendHtml;
@@ -1871,7 +1871,7 @@  discard block
 block discarded – undo
1871 1871
                 'post',
1872 1872
                 api_get_path(WEB_CODE_PATH).'social/profile.php'.$userId,
1873 1873
                 null,
1874
-                array('enctype' => 'multipart/form-data') ,
1874
+                array('enctype' => 'multipart/form-data'),
1875 1875
                 FormValidator::LAYOUT_HORIZONTAL    
1876 1876
             );
1877 1877
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1631,11 +1631,11 @@  discard block
 block discarded – undo
1631 1631
 
1632 1632
             if ($size == IMAGE_WALL_SMALL) {
1633 1633
                 $name = IMAGE_WALL_SMALL. '_' . $array[2];
1634
-            }else if($size == IMAGE_WALL_MEDIUM){
1634
+            } else if($size == IMAGE_WALL_MEDIUM){
1635 1635
                 $name = IMAGE_WALL_MEDIUM. '_' . $array[2];
1636
-            }else if($size == IMAGE_WALL_BIG){
1636
+            } else if($size == IMAGE_WALL_BIG){
1637 1637
                 $name = IMAGE_WALL_BIG. '_' . $array[2];
1638
-            }else {
1638
+            } else {
1639 1639
                 $name = IMAGE_WALL_SMALL. '_' . $array[2];
1640 1640
             }
1641 1641
             $lessImage = str_replace($array[2], '', $path);
@@ -1759,7 +1759,9 @@  discard block
 block discarded – undo
1759 1759
             $friendHtml.= '<ul class="nav nav-list">';
1760 1760
             $j = 1;
1761 1761
             for ($k=0; $k < $number_friends; $k++) {
1762
-                if ($j > $number_of_images) break;
1762
+                if ($j > $number_of_images) {
1763
+                    break;
1764
+                }
1763 1765
 
1764 1766
                 if (isset($friends[$k])) {
1765 1767
                     $friend = $friends[$k];
@@ -1815,7 +1817,9 @@  discard block
 block discarded – undo
1815 1817
             $friendHtml.= '<div class="list-group">';
1816 1818
             $j = 1;
1817 1819
             for ($k=0; $k < $number_friends; $k++) {
1818
-                if ($j > $number_of_images) break;
1820
+                if ($j > $number_of_images) {
1821
+                    break;
1822
+                }
1819 1823
 
1820 1824
                 if (isset($friends[$k])) {
1821 1825
                     $friend = $friends[$k];
Please login to merge, or discard this patch.
main/inc/lib/sortable_table.class.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -443,6 +443,7 @@
 block discarded – undo
443 443
      * @param bool       hide navigation optionally
444 444
      * @param int        content per page when show navigation (optional)
445 445
      * @param bool       sort data optionally
446
+     * @param boolean $visibility_options
446 447
      * @return string    grid html
447 448
      */
448 449
     public function display_simple_grid($visibility_options, $hide_navigation = true, $per_page = 20, $sort_data = true, $grid_class = array())
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
     }
340 340
 
341 341
     /**
342
-    * This function shows the content of a table in a grid.
343
-    * Should not be use to edit information (edit/delete rows) only.
344
-    **/
342
+     * This function shows the content of a table in a grid.
343
+     * Should not be use to edit information (edit/delete rows) only.
344
+     **/
345 345
     public function display_grid()
346 346
     {
347 347
 
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
                 //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction'];
791 791
                 $my_get_direction = $_GET[$tablename.'_direction'];
792 792
                 if (!in_array($my_get_direction, array('ASC', 'DESC'))) {
793
-                     $param[$tablename.'_direction'] =  'ASC';
793
+                        $param[$tablename.'_direction'] =  'ASC';
794 794
                 } else {
795 795
                     $param[$tablename.'_direction'] = $my_get_direction;
796 796
                 }
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
         if (is_array($row)) {
918 918
             foreach ($row as & $value) {
919 919
                 if (empty($value)) {
920
-                     $value = '-';
920
+                        $value = '-';
921 921
                 }
922 922
             }
923 923
         }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         $this->per_page = isset($_GET[$this->param_prefix.'per_page']) ? intval($_GET[$this->param_prefix.'per_page']) : $this->per_page;
176 176
 
177 177
         $_SESSION[$this->param_prefix.'per_page']  = $this->per_page;
178
-        $_SESSION[$this->param_prefix.'direction'] = $this->direction ;
178
+        $_SESSION[$this->param_prefix.'direction'] = $this->direction;
179 179
         $_SESSION[$this->param_prefix.'page_nr']   = $this->page_nr;
180 180
         $_SESSION[$this->param_prefix.'column']    = $this->column;
181 181
         $this->pager                               = null;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             $params['spacesBeforeSeparator'] = '';
216 216
             $params['spacesAfterSeparator']  = '';
217 217
             $query_vars = array_keys($_GET);
218
-            $query_vars_needed = array ($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page');
218
+            $query_vars_needed = array($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page');
219 219
             if (count($this->additional_parameters) > 0) {
220 220
                 $query_vars_needed = array_merge($query_vars_needed, array_keys($this->additional_parameters));
221 221
             }
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 
288 288
         if (!$empty_table) {
289 289
             if (!empty($this->additional_parameters)) {
290
-                foreach($this->additional_parameters as $key => $value) {
290
+                foreach ($this->additional_parameters as $key => $value) {
291 291
                     $html .= '<input type="hidden" name ="'.Security::remove_XSS($key).'" value ="'.Security::remove_XSS($value).'" />';
292 292
                 }
293 293
             }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                         $html .= '<li><a data-action ="'.$action.'" href="#" onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a></li>';
313 313
                     }
314 314
                     $html .= '</ul>';
315
-                    $html .= '</div>';//btn-group
315
+                    $html .= '</div>'; //btn-group
316 316
                 $html .= '</div>'; //toolbar
317 317
             } else {
318 318
                 $html .= $form;
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 
391 391
             $html .= '<div class="clear"></div>';
392 392
             if (count($this->form_actions) > 0) {
393
-                $script= '<script>
393
+                $script = '<script>
394 394
                             /*<![CDATA[*/
395 395
                             function setCheckbox(value) {
396 396
                                  d = document.form_'.$this->table_name.';
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
             }
413 413
         }
414 414
         // Getting the items of the table
415
-        $items = $this->get_clean_html(false);    //no sort
415
+        $items = $this->get_clean_html(false); //no sort
416 416
 
417 417
         // Generation of style classes must be improved. Maybe we need a a table name to create style on the fly:
418 418
         // i.e: .whoisonline_table_grid_container instead of  .grid_container
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 
481 481
             $html .= '<div class="clear"></div>';
482 482
             if (count($this->form_actions) > 0) {
483
-                $script= '<script>
483
+                $script = '<script>
484 484
                             /*<![CDATA[*/
485 485
                             function setCheckbox(value) {
486 486
                                  d = document.form_'.$this->table_name.';
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
                     $counter = 0;
587 587
                     foreach ($row as $index => $rowInfo) {
588 588
                         if (!isset($this->columnsToHide[$index])) {
589
-                            $newRow[$counter] = $rowInfo ;
589
+                            $newRow[$counter] = $rowInfo;
590 590
                             $counter++;
591 591
                         }
592 592
                     }
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
         }
602 602
 
603 603
         if ($this->odd_even_rows_enabled == true) {
604
-            $this->altRowAttributes(0, array ('class' => 'row_odd'), array ('class' => 'row_even'), true);
604
+            $this->altRowAttributes(0, array('class' => 'row_odd'), array('class' => 'row_even'), true);
605 605
         }
606 606
 
607 607
         foreach ($this->th_attributes as $column => $attributes) {
@@ -661,11 +661,11 @@  discard block
 block discarded – undo
661 661
         }
662 662
         $result[] = '<select name="'.$this->param_prefix.'per_page" onchange="javascript: this.form.submit();">';
663 663
         for ($nr = 10; $nr <= min(50, $total_number_of_items); $nr += 10) {
664
-            $result[] = '<option value="'.$nr.'" '. ($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>';
664
+            $result[] = '<option value="'.$nr.'" '.($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>';
665 665
         }
666 666
         // @todo no limits
667 667
         //if ($total_number_of_items < 500) {
668
-            $result[] = '<option value="'.$total_number_of_items.'" '. ($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>';
668
+            $result[] = '<option value="'.$total_number_of_items.'" '.($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>';
669 669
         //}
670 670
         $result[] = '</select>';
671 671
         $result[] = '<noscript>';
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
      */
778 778
     public function get_additional_url_paramstring()
779 779
     {
780
-        $param_string_parts = array ();
780
+        $param_string_parts = array();
781 781
         if (is_array($this->additional_parameters) && count($this->additional_parameters) > 0) {
782 782
             foreach ($this->additional_parameters as $key => & $value) {
783 783
                 $param_string_parts[] = urlencode($key).'='.urlencode($value);
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
                 //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction'];
791 791
                 $my_get_direction = $_GET[$tablename.'_direction'];
792 792
                 if (!in_array($my_get_direction, array('ASC', 'DESC'))) {
793
-                     $param[$tablename.'_direction'] =  'ASC';
793
+                     $param[$tablename.'_direction'] = 'ASC';
794 794
                 } else {
795 795
                     $param[$tablename.'_direction'] = $my_get_direction;
796 796
                 }
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
             if (isset($_GET[$tablename.'_column'])) {
805 805
                 $param[$tablename.'_column'] = intval($_GET[$tablename.'_column']);
806 806
             }
807
-            $param_string_parts = array ();
807
+            $param_string_parts = array();
808 808
             foreach ($param as $key => & $value) {
809 809
                 $param_string_parts[] = urlencode($key).'='.urlencode($value);
810 810
             }
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
         $param[$this->param_prefix.'page_nr'] = $this->page_nr;
825 825
         $param[$this->param_prefix.'per_page'] = $this->per_page;
826 826
         $param[$this->param_prefix.'column'] = $this->column;
827
-        $param_string_parts = array ();
827
+        $param_string_parts = array();
828 828
         foreach ($param as $key => & $value) {
829 829
             $param_string_parts[] = urlencode($key).'='.urlencode($value);
830 830
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -808,8 +808,9 @@
 block discarded – undo
808 808
             foreach ($param as $key => & $value) {
809 809
                 $param_string_parts[] = urlencode($key).'='.urlencode($value);
810 810
             }
811
-            if (count($param_string_parts) > 0)
812
-                $result .= '&amp;'.implode('&amp;', $param_string_parts);
811
+            if (count($param_string_parts) > 0) {
812
+                            $result .= '&amp;'.implode('&amp;', $param_string_parts);
813
+            }
813 814
         }
814 815
         return $result;
815 816
     }
Please login to merge, or discard this patch.
main/inc/lib/specific_fields_manager.lib.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
 /**
102 102
  * @param array $conditions a list of condition (exemple : status=>STUDENT)
103
- * @param array $order_by a list of fields on which sort
103
+ * @param string[] $order_by a list of fields on which sort
104 104
  * @return array An array with all users of the platform.
105 105
  */
106 106
 function get_specific_field_values_list(
@@ -235,6 +235,7 @@  discard block
 block discarded – undo
235 235
  * @param   string  Course code
236 236
  * @param   string  Tool ID
237 237
  * @param   int     Internal ID used in specific tool table
238
+ * @param string $tool_id
238 239
  */
239 240
 function delete_all_values_for_item($course_id, $tool_id, $ref_id) {
240 241
   $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
@@ -248,6 +249,7 @@  discard block
 block discarded – undo
248 249
  * Defaults to the first letter of the name, otherwise iterate through available
249 250
  * letters
250 251
  * @param   string  Name
252
+ * @param string $name
251 253
  * @return  string  One-letter code, upper-case
252 254
  */
253 255
 function get_specific_field_code_from_name($name) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 function delete_specific_field($id)
43 43
 {
44 44
     $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
45
-    $id = (int)$id;
45
+    $id = (int) $id;
46 46
     if (!is_numeric($id)) {
47 47
         return false;
48 48
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 function edit_specific_field($id, $name)
61 61
 {
62 62
     $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
63
-    $id = (int)$id;
63
+    $id = (int) $id;
64 64
     if (!is_numeric($id)) {
65 65
         return false;
66 66
     }
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -237,10 +237,10 @@
 block discarded – undo
237 237
  * @param   int     Internal ID used in specific tool table
238 238
  */
239 239
 function delete_all_values_for_item($course_id, $tool_id, $ref_id) {
240
-  $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
241
-  $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s';
242
-  $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id);
243
-  Database::query($sql);
240
+    $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
241
+    $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s';
242
+    $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id);
243
+    Database::query($sql);
244 244
 }
245 245
 
246 246
 /**
Please login to merge, or discard this patch.
main/inc/lib/statsUtils.lib.inc.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -85,6 +85,7 @@
 block discarded – undo
85 85
     /**
86 86
      * @author Sebastien Piraux <[email protected]>
87 87
      * @param sql : a sql query (as a string)
88
+     * @param integer $X
88 89
      * @desc Return many results of a query in a X column tab
89 90
      * in $resu[$i][0], $resu[$i][1],$resu[$i][2],...
90 91
      * this function is more 'standard' but use a little
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -107,14 +107,14 @@
 block discarded – undo
107 107
         return $resu;
108 108
     }
109 109
 
110
-	/**
111
-	 * @author Sebastien Piraux <[email protected]>
112
-	 * @param sql : a sql query (as a string)
113
-	 * @return hours_array
114
-	 * @desc        Return an assoc array.  Keys are the hours, values are
115
-	 * the number of time this hours was found.
116
-	 * key 'total' return the sum of all number of time hours
117
-	 * appear
110
+    /**
111
+     * @author Sebastien Piraux <[email protected]>
112
+     * @param sql : a sql query (as a string)
113
+     * @return hours_array
114
+     * @desc        Return an assoc array.  Keys are the hours, values are
115
+     * the number of time this hours was found.
116
+     * key 'total' return the sum of all number of time hours
117
+     * appear
118 118
      */
119 119
     public static function hoursTab($sql)
120 120
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             $last_day = -1;
156 156
             while ($row = Database::fetch_row($res)) {
157 157
                 $date_array = getdate($row[0]);
158
-                $display_date = $date_array['mday'] . ' ' . $MonthsShort[$date_array['mon'] - 1] . ' ' . $date_array['year'];
158
+                $display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon'] - 1].' '.$date_array['year'];
159 159
                 if ($date_array['mday'] == $last_day) {
160 160
                     $days_array[$display_date]++;
161 161
                 } else {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                     &nbsp;
222 222
                 </td>
223 223
                 <td width='10%'>
224
-                    <b>" . get_lang('Hits') . "</b>
224
+                    <b>".get_lang('Hits')."</b>
225 225
                 </td>
226 226
                 <td width='15%'>
227 227
                     <b>%</b>
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                     echo "<img src='../img/bar_1m.gif' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
250 250
                 }
251 251
                 if ($pourcent != 100) {
252
-                    echo "<img src='../img/bar_1r.gif' width='" . ($maxSize - $barwidth) . "' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
252
+                    echo "<img src='../img/bar_1r.gif' width='".($maxSize - $barwidth)."' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />";
253 253
                 }
254 254
                 echo "<img src='../img/bar_1.gif' width='1' height='12' alt='$periodPiece : $cpt hits &ndash; $pourcent %' />
255 255
                     </td>
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
         }
266 266
         echo "<tr bgcolor='#E6E6E6'>
267 267
                 <td width='15%' align='center'>
268
-                    " . get_lang('Total') . "
268
+                    " . get_lang('Total')."
269 269
                 </td>
270 270
                 <td align='right' width='60%'>
271 271
                     &nbsp;
272 272
                 </td>
273 273
                 <td align='center' width='10%'>
274
-                    " . $period_array['total'] . "
274
+                    " . $period_array['total']."
275 275
                 </td>
276 276
                 <td width='15%'>
277 277
                     &nbsp;
Please login to merge, or discard this patch.
main/inc/lib/sub_language.class.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,7 @@  discard block
 block discarded – undo
18 18
      * Get all files of lang folder (forum.inc.php,gradebook.inc.php,notebook.inc.php)
19 19
      * @param String The lang path folder  (/var/www/my_lms/main/lang/spanish)
20 20
      * @param bool true if we only want the "subname" trad4all instead of  trad4all.inc.php
21
+     * @param string $path
21 22
      *
22 23
      * @return Array All file of lang folder
23 24
      */
@@ -68,6 +69,7 @@  discard block
 block discarded – undo
68 69
     /**
69 70
      * Get all information of language
70 71
      * @param Integer The parent id(Language father id)
72
+     * @param integer $parent_id
71 73
      * @return Array All information about language
72 74
      */
73 75
     public static function get_all_information_of_language($parent_id)
@@ -86,6 +88,7 @@  discard block
 block discarded – undo
86 88
     /**
87 89
      * Get all information of chamilo file
88 90
      * @param String The chamilo path file (/var/www/chamilo/main/lang/spanish/gradebook.inc.php)
91
+     * @param string $system_path_file
89 92
      * @patam Bool Whether we want to remove the '$' prefix in the results or not
90 93
      * @return Array Contains all information of chamilo file
91 94
      */
@@ -345,7 +348,7 @@  discard block
 block discarded – undo
345 348
     /**
346 349
      * Make available the language
347 350
      * @param Integer The language id
348
-     * @return void
351
+     * @return boolean
349 352
      */
350 353
     public static function make_available_language($language_id)
351 354
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@
 block discarded – undo
29 29
                 while (($file = readdir($dh)) !== false) {
30 30
                     if ($file[0] <> '.' && substr($file, -4, strlen($file)) == '.php') {
31 31
                         if ($only_main_name) {
32
-                            if ($file != '' && strpos($file, '.inc.php'))
33
-                                $content_dir[] = substr($file, 0, strpos($file, '.inc.php'));
32
+                            if ($file != '' && strpos($file, '.inc.php')) {
33
+                                                            $content_dir[] = substr($file, 0, strpos($file, '.inc.php'));
34
+                            }
34 35
                         } else {
35 36
                             $content_dir[] = $file;
36 37
                         }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public static function getAllLanguages()
22 22
     {
23 23
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
24
-        $sql = 'SELECT * FROM ' . $table;
24
+        $sql = 'SELECT * FROM '.$table;
25 25
         $rs = Database::query($sql);
26 26
         $all_languages = [];
27 27
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
     public static function get_all_information_of_sub_language($parent_id, $sub_language_id)
71 71
     {
72 72
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
73
-        $sql = 'SELECT * FROM ' . $table . '
73
+        $sql = 'SELECT * FROM '.$table.'
74 74
                 WHERE
75 75
                     parent_id= ' . intval($parent_id).' AND
76
-                    id= ' . intval($sub_language_id) . '';
76
+                    id= ' . intval($sub_language_id).'';
77 77
         $rs = Database::query($sql);
78 78
         $all_information = array();
79 79
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public static function get_all_information_of_language($parent_id)
92 92
     {
93 93
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
94
-        $sql = 'SELECT * FROM ' . $table . ' WHERE id = "' . intval($parent_id) . '"';
94
+        $sql = 'SELECT * FROM '.$table.' WHERE id = "'.intval($parent_id).'"';
95 95
         $rs = Database::query($sql);
96 96
         $all_information = array();
97 97
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public static function add_file_in_language_directory($system_path_file)
139 139
     {
140
-        $return_value = @file_put_contents($system_path_file, '<?php' . PHP_EOL);
140
+        $return_value = @file_put_contents($system_path_file, '<?php'.PHP_EOL);
141 141
 
142 142
         return $return_value;
143 143
     }
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
     public static function write_data_in_file($path_file, $new_term, $new_variable)
153 153
     {
154 154
         $return_value = false;
155
-        $new_data = $new_variable . '=' . $new_term;
155
+        $new_data = $new_variable.'='.$new_term;
156 156
         $resource = @fopen($path_file, "a");
157 157
         if (file_exists($path_file) && $resource) {
158
-            if (fwrite($resource, $new_data . PHP_EOL) === false) {
158
+            if (fwrite($resource, $new_data.PHP_EOL) === false) {
159 159
                 //not allow to write
160 160
                 $return_value = false;
161 161
             } else {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         if (empty($sub_language_dir)) {
178 178
             return false;
179 179
         }
180
-        $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir;
180
+        $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir;
181 181
         if (is_dir($dir)) {
182 182
             return true;
183 183
         } //even if the dir already exists, we reach the objective of having the directory there
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
             return false;
202 202
         }
203 203
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
204
-        $sql = 'SELECT dokeos_folder FROM ' . $table . '
205
-                WHERE parent_id = ' . $parent_id . ' and id = ' . $sub_language_id;
204
+        $sql = 'SELECT dokeos_folder FROM '.$table.'
205
+                WHERE parent_id = ' . $parent_id.' and id = '.$sub_language_id;
206 206
         $res = Database::query($sql);
207 207
         if ($res === false or Database::num_rows($res) < 1) {
208 208
             return false;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         if ($res === false) {
213 213
             return false;
214 214
         } //can't delete dir, so do not delete language record
215
-        $sql = 'DELETE FROM ' . $table . '
215
+        $sql = 'DELETE FROM '.$table.'
216 216
                 WHERE id= ' . intval($sub_language_id);
217 217
         $res = Database::query($sql);
218 218
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         if (empty($sub_language_dir)) {
230 230
             return false;
231 231
         }
232
-        $dir = api_get_path(SYS_LANG_PATH) . $sub_language_dir;
232
+        $dir = api_get_path(SYS_LANG_PATH).$sub_language_dir;
233 233
         if (!is_dir($dir)) {
234 234
             return true;
235 235
         } //even if the dir does not exist, we reach the objective of not having the directory there
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
         if (count($content) > 0) {
239 239
             foreach ($content as $value_content) {
240
-                $path_file = $dir . '/' . $value_content;
240
+                $path_file = $dir.'/'.$value_content;
241 241
                 unlink($path_file);
242 242
             }
243 243
             return @rmdir($dir);
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
     {
256 256
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
257 257
         $sql = 'SELECT count(*) as count
258
-                FROM ' . $table . '
259
-                WHERE id="' . intval($language_id) . '"';
258
+                FROM ' . $table.'
259
+                WHERE id="' . intval($language_id).'"';
260 260
         $rs = Database::query($sql);
261 261
         if (Database::num_rows($rs) > 0) {
262 262
             if (Database::result($rs, 0, 'count') == 1) {
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
     {
279 279
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
280 280
         $sql = 'SELECT original_name
281
-                FROM ' . $table . '
282
-                WHERE id= ' . intval($language_id) . '';
281
+                FROM ' . $table.'
282
+                WHERE id= ' . intval($language_id).'';
283 283
         $rs = Database::query($sql);
284 284
         if (Database::num_rows($rs) > 0) {
285 285
             return Database::result($rs, 0, 'original_name');
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
     public static function check_if_language_is_sub_language($language_id)
298 298
     {
299 299
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
300
-        $sql = 'SELECT count(*) AS count FROM ' . $table . '
301
-                WHERE id = ' . intval($language_id) . ' AND NOT ISNULL(parent_id)';
300
+        $sql = 'SELECT count(*) AS count FROM '.$table.'
301
+                WHERE id = ' . intval($language_id).' AND NOT ISNULL(parent_id)';
302 302
         $rs = Database::query($sql);
303 303
 
304 304
         if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) {
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     {
317 317
         $language_info = self::get_all_information_of_language($language_id);
318 318
         $table = Database :: get_main_table(TABLE_MAIN_USER);
319
-        $sql = 'SELECT count(*) AS count FROM ' . $table . '
319
+        $sql = 'SELECT count(*) AS count FROM '.$table.'
320 320
                 WHERE language ="' . Database::escape_string($language_info['english_name']).'"';
321 321
         $rs = Database::query($sql);
322 322
         if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') >= 1) {
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
     public static function check_if_language_is_father($language_id)
335 335
     {
336 336
         $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
337
-        $sql = 'SELECT count(*) AS count FROM ' . $table . '
338
-                WHERE parent_id= ' . intval($language_id) . ' AND NOT ISNULL(parent_id);';
337
+        $sql = 'SELECT count(*) AS count FROM '.$table.'
338
+                WHERE parent_id= ' . intval($language_id).' AND NOT ISNULL(parent_id);';
339 339
         $rs = Database::query($sql);
340 340
 
341 341
         if (Database::num_rows($rs) > 0 && Database::result($rs, '0', 'count') == 1) {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
     {
355 355
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
356 356
         $sql = "UPDATE $tbl_admin_languages SET available='0'
357
-                WHERE id = " . intval($language_id) . "";
357
+                WHERE id = ".intval($language_id)."";
358 358
         $result = Database::query($sql);
359 359
 
360 360
         return $result !== false; //only return false on sql error
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     {
370 370
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
371 371
         $sql = "UPDATE $tbl_admin_languages SET available='1'
372
-                WHERE id = " . intval($language_id) . "";
372
+                WHERE id = ".intval($language_id)."";
373 373
         $result = Database::query($sql);
374 374
 
375 375
         return $result !== false; //only return false on sql error
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
         }
388 388
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
389 389
         $tbl_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
390
-        $sql = "SELECT english_name FROM " . $tbl_admin_languages . "
391
-                WHERE id= " . intval($language_id) . "";
390
+        $sql = "SELECT english_name FROM ".$tbl_admin_languages."
391
+                WHERE id= " . intval($language_id)."";
392 392
         $result = Database::query($sql);
393 393
         $lang = Database::fetch_array($result);
394
-        $sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "'
394
+        $sql_update_2 = "UPDATE ".$tbl_settings_current." SET selected_value='".$lang['english_name']."'
395 395
                          WHERE variable='platformLanguage'";
396 396
         $result_2 = Database::query($sql_update_2);
397 397
         Event::addEvent(
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
     {
412 412
         $name = api_get_setting('platformLanguage');
413 413
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
414
-        $sql = "SELECT id FROM " . $tbl_admin_languages . " WHERE english_name ='$name'";
414
+        $sql = "SELECT id FROM ".$tbl_admin_languages." WHERE english_name ='$name'";
415 415
         $res = Database::query($sql);
416 416
         if (Database::num_rows($res) < 1) {
417 417
             return false;
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
     {
431 431
         $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
432 432
         $sql = "SELECT dokeos_folder
433
-                FROM " . $tbl_admin_languages . "
433
+                FROM " . $tbl_admin_languages."
434 434
                 WHERE id = (
435
-                    SELECT parent_id FROM " . $tbl_admin_languages . "
436
-                    WHERE dokeos_folder = '" . Database::escape_string($language_path) . "'
435
+                    SELECT parent_id FROM " . $tbl_admin_languages."
436
+                    WHERE dokeos_folder = '" . Database::escape_string($language_path)."'
437 437
                 )
438 438
                 ";
439 439
         $result = Database::query($sql);
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
         $adminLanguagesTable = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
456 456
         // select language - if case several languages match, get the last (more recent) one
457 457
         $sql = "SELECT english_name
458
-                FROM " . $adminLanguagesTable . "
458
+                FROM " . $adminLanguagesTable."
459 459
                 WHERE
460 460
                     isocode ='$isocode' AND
461 461
                     available = 1
Please login to merge, or discard this patch.
main/inc/lib/system/session.class.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
14 14
 class Session implements \ArrayAccess
15 15
 {
16 16
 
17
+    /**
18
+     * @param string $variable
19
+     */
17 20
     static function read($variable, $default = null)
18 21
     {
19 22
         return isset($_SESSION[$variable]) ? $_SESSION[$variable] : $default;
Please login to merge, or discard this patch.
main/inc/lib/system/web/request.class.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -31,6 +31,10 @@
 block discarded – undo
31 31
         return $method == 'GET';
32 32
     }
33 33
 
34
+    /**
35
+     * @param string $key
36
+     * @param string $default
37
+     */
34 38
     public static function post($key, $default = null)
35 39
     {
36 40
         return isset($_POST[$key]) ? $_POST[$key] : $default;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default;
16 16
     }
17 17
 
18
-    public static function has($key){
18
+    public static function has($key) {
19 19
         return isset($_REQUEST[$key]);
20 20
     }
21 21
 
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
  * @author Patrick Cool
17 17
  * @author René Haentjens, added CSV file import (October 2004)
18 18
  * @package chamilo.link
19
-
20 19
  */
21 20
 
22 21
 // Including libraries
Please login to merge, or discard this patch.
main/inc/lib/system_announcements.lib.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * @param int    Whether the announcement should be visible to anonymous users (1) or not (0)
307 307
 	 * @param string The language for which the announvement should be shown. Leave null for all langages
308 308
 	 * @param int    Whether to send an e-mail to all users (1) or not (0)
309
-	 * @return mixed  insert_id on success, false on failure
309
+	 * @return false|string  insert_id on success, false on failure
310 310
 	 */
311 311
     public static function add_announcement(
312 312
         $title,
@@ -648,6 +648,8 @@  discard block
 block discarded – undo
648 648
 	 * @param	int		Whether to send to all teachers (1) or not (0)
649 649
 	 * @param	int		Whether to send to all students (1) or not (0)
650 650
 	 * @param	string	Language (optional, considered for all languages if left empty)
651
+	 * @param integer|null $teacher
652
+	 * @param integer|null $student
651 653
      * @return  bool    True if the message was sent or there was no destination matching. False on database or e-mail sending error.
652 654
 	 */
653 655
 	public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false)
Please login to merge, or discard this patch.
Indentation   +433 added lines, -433 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
     CONST VISIBLE_STUDENT = 2;
11 11
     CONST VISIBLE_TEACHER = 3;
12 12
 
13
-	/**
14
-	 * Displays all announcements
15
-	 * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER
16
-	 * @param int $id The identifier of the announcement to display
17
-	 */
18
-	public static function display_announcements($visible, $id = -1)
13
+    /**
14
+     * Displays all announcements
15
+     * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER
16
+     * @param int $id The identifier of the announcement to display
17
+     */
18
+    public static function display_announcements($visible, $id = -1)
19 19
     {
20
-		$user_selected_language = api_get_interface_language();
21
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
20
+        $user_selected_language = api_get_interface_language();
21
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
22 22
         $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
23
-		$userGroup = new UserGroup();
23
+        $userGroup = new UserGroup();
24 24
 
25 25
         $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
26 26
         $groups = array();
@@ -55,47 +55,47 @@  discard block
 block discarded – undo
55 55
                         WHERE group_id in $groups_string
56 56
                     ) ";
57 57
         }
58
-		$current_access_url_id = 1;
59
-		if (api_is_multiple_url_enabled()) {
60
-			$current_access_url_id = api_get_current_access_url_id();
61
-		}
62
-		$sql .= " AND access_url_id = '$current_access_url_id' ";
63
-		$sql .= " ORDER BY date_start DESC LIMIT 0,7";
64
-
65
-		$announcements = Database::query($sql);
66
-		if (Database::num_rows($announcements) > 0) {
67
-			$query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']);
68
-			$query_string = ereg_replace('&$', '', $query_string);
69
-			$url = api_get_self();
70
-			echo '<div class="system_announcements">';
71
-			echo '<h3>'.get_lang('SystemAnnouncements').'</h3>';
72
-			echo '<div style="margin:10px;text-align:right;"><a href="news_list.php">'.get_lang('More').'</a></div>';
73
-
74
-			while ($announcement = Database::fetch_object($announcements)) {
75
-				if ($id != $announcement->id) {
76
-					if (strlen($query_string) > 0) {
77
-						$show_url = 'news_list.php#'.$announcement->id;
78
-					} else {
79
-						$show_url = 'news_list.php#'.$announcement->id;
80
-					}
81
-			        $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
82
-					echo '<a name="'.$announcement->id.'"></a>
58
+        $current_access_url_id = 1;
59
+        if (api_is_multiple_url_enabled()) {
60
+            $current_access_url_id = api_get_current_access_url_id();
61
+        }
62
+        $sql .= " AND access_url_id = '$current_access_url_id' ";
63
+        $sql .= " ORDER BY date_start DESC LIMIT 0,7";
64
+
65
+        $announcements = Database::query($sql);
66
+        if (Database::num_rows($announcements) > 0) {
67
+            $query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']);
68
+            $query_string = ereg_replace('&$', '', $query_string);
69
+            $url = api_get_self();
70
+            echo '<div class="system_announcements">';
71
+            echo '<h3>'.get_lang('SystemAnnouncements').'</h3>';
72
+            echo '<div style="margin:10px;text-align:right;"><a href="news_list.php">'.get_lang('More').'</a></div>';
73
+
74
+            while ($announcement = Database::fetch_object($announcements)) {
75
+                if ($id != $announcement->id) {
76
+                    if (strlen($query_string) > 0) {
77
+                        $show_url = 'news_list.php#'.$announcement->id;
78
+                    } else {
79
+                        $show_url = 'news_list.php#'.$announcement->id;
80
+                    }
81
+                    $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
82
+                    echo '<a name="'.$announcement->id.'"></a>
83 83
 						<div class="system_announcement">
84 84
 							<div class="system_announcement_title"><a name="ann'.$announcement->id.'" href="'.$show_url.'">'.$announcement->title.'</a></div><div class="system_announcement_date">'.$display_date.'</div>
85 85
 					  	</div>';
86
-				} else {
87
-					echo '<div class="system_announcement">
86
+                } else {
87
+                    echo '<div class="system_announcement">
88 88
 							<div class="system_announcement_title">'
89
-								.$announcement->display_date.'
89
+                                .$announcement->display_date.'
90 90
 								<a name="ann'.$announcement->id.'" href="'.$url.'?'.$query_string.'#ann'.$announcement->id.'">'.$announcement->title.'</a>
91 91
 							</div>';
92
-				}
93
-				echo '<br />';
94
-			}
95
-			echo '</div>';
96
-		}
97
-		return;
98
-	}
92
+                }
93
+                echo '<br />';
94
+            }
95
+            echo '</div>';
96
+        }
97
+        return;
98
+    }
99 99
 
100 100
     /**
101 101
      * @param $visible
@@ -106,100 +106,100 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='')
108 108
     {
109
-		$user_selected_language = api_get_interface_language();
110
-		$start	= intval($start);
109
+        $user_selected_language = api_get_interface_language();
110
+        $start	= intval($start);
111 111
         $userGroup = new UserGroup();
112
-	    $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
113
-	    $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
112
+        $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
113
+        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
114 114
         $groups = array();
115
-	    foreach ($temp_user_groups as $user_group) {
116
-	        $groups = array_merge($groups, array($user_group['id']));
117
-	        $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id']));
118
-	    }
115
+        foreach ($temp_user_groups as $user_group) {
116
+            $groups = array_merge($groups, array($user_group['id']));
117
+            $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id']));
118
+        }
119 119
 
120
-	    // Checks if tables exists to not break platform not updated
121
-	    $groups_string = '('.implode($groups,',').')';
120
+        // Checks if tables exists to not break platform not updated
121
+        $groups_string = '('.implode($groups,',').')';
122 122
 
123
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
124
-		$now  = api_get_utc_datetime();
123
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
124
+        $now  = api_get_utc_datetime();
125 125
 
126
-		$sql = "SELECT * FROM ".$db_table."
126
+        $sql = "SELECT * FROM ".$db_table."
127 127
 				WHERE
128 128
 				    (lang = '$user_selected_language' OR lang IS NULL) AND
129 129
 				    ( '$now' >= date_start AND '$now' <= date_end) ";
130 130
 
131
-		switch ($visible) {
132
-			case self::VISIBLE_GUEST :
133
-				$sql .= " AND visible_guest = 1 ";
134
-				break;
135
-			case self::VISIBLE_STUDENT :
136
-				$sql .= " AND visible_student = 1 ";
137
-				break;
138
-			case self::VISIBLE_TEACHER :
139
-				$sql .= " AND visible_teacher = 1 ";
140
-				break;
141
-		}
142
-
143
-	    if (count($groups) > 0) {
131
+        switch ($visible) {
132
+            case self::VISIBLE_GUEST :
133
+                $sql .= " AND visible_guest = 1 ";
134
+                break;
135
+            case self::VISIBLE_STUDENT :
136
+                $sql .= " AND visible_student = 1 ";
137
+                break;
138
+            case self::VISIBLE_TEACHER :
139
+                $sql .= " AND visible_teacher = 1 ";
140
+                break;
141
+        }
142
+
143
+        if (count($groups) > 0) {
144 144
             $sql .= " OR id IN (
145 145
                     SELECT announcement_id FROM $tbl_announcement_group
146 146
                     WHERE group_id in $groups_string
147 147
                     ) ";
148
-	    }
148
+        }
149 149
 
150
-		if (api_is_multiple_url_enabled()) {
151
-			$current_access_url_id = api_get_current_access_url_id();
150
+        if (api_is_multiple_url_enabled()) {
151
+            $current_access_url_id = api_get_current_access_url_id();
152 152
             $sql .= " AND access_url_id IN ('1', '$current_access_url_id')";
153
-		}
154
-
155
-		if(!isset($_GET['start']) || $_GET['start'] == 0) {
156
-			$sql .= " ORDER BY date_start DESC LIMIT ".$start.",20";
157
-		} else {
158
-			$sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20";
159
-		}
160
-		$announcements = Database::query($sql);
161
-		$content = '';
162
-		if (Database::num_rows($announcements) > 0) {
163
-			$query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']);
164
-			$query_string = ereg_replace('&$', '', $query_string);
165
-			$url = api_get_self();
166
-			$content .= '<div class="system_announcements">';
167
-			$content .= '<h3>'.get_lang('SystemAnnouncements').'</h3>';
168
-			$content .= '<table align="center">';
169
-				$content .= '<tr>';
170
-					$content .= '<td>';
171
-						$content .= SystemAnnouncementManager :: display_arrow($user_id);
172
-					$content .= '</td>';
173
-				$content .= '</tr>';
174
-			$content .= '</table>';
175
-			$content .= '<table align="center" border="0" width="900px">';
176
-			while ($announcement = Database::fetch_object($announcements)) {
177
-				$display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
178
-				$content .= '<tr><td>';
179
-				$content .= '<a name="'.$announcement->id.'"></a>
153
+        }
154
+
155
+        if(!isset($_GET['start']) || $_GET['start'] == 0) {
156
+            $sql .= " ORDER BY date_start DESC LIMIT ".$start.",20";
157
+        } else {
158
+            $sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20";
159
+        }
160
+        $announcements = Database::query($sql);
161
+        $content = '';
162
+        if (Database::num_rows($announcements) > 0) {
163
+            $query_string = ereg_replace('announcement=[1-9]+', '', $_SERVER['QUERY_STRING']);
164
+            $query_string = ereg_replace('&$', '', $query_string);
165
+            $url = api_get_self();
166
+            $content .= '<div class="system_announcements">';
167
+            $content .= '<h3>'.get_lang('SystemAnnouncements').'</h3>';
168
+            $content .= '<table align="center">';
169
+                $content .= '<tr>';
170
+                    $content .= '<td>';
171
+                        $content .= SystemAnnouncementManager :: display_arrow($user_id);
172
+                    $content .= '</td>';
173
+                $content .= '</tr>';
174
+            $content .= '</table>';
175
+            $content .= '<table align="center" border="0" width="900px">';
176
+            while ($announcement = Database::fetch_object($announcements)) {
177
+                $display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG);
178
+                $content .= '<tr><td>';
179
+                $content .= '<a name="'.$announcement->id.'"></a>
180 180
 						<div class="system_announcement">
181 181
 						<h2>'.$announcement->title.'</h2><div class="system_announcement_date">'.$display_date.'</div>
182 182
 						<br />
183 183
 					  	<div class="system_announcement_content">'
184
-					  			.$announcement->content.'
184
+                                    .$announcement->content.'
185 185
 						</div>
186 186
 					  </div><br />';
187
-				$content .= '</tr></td>';
188
-			}
189
-			$content .= '</table>';
190
-
191
-			$content .= '<table align="center">';
192
-				$content .= '<tr>';
193
-					$content .= '<td>';
194
-						$content .= SystemAnnouncementManager :: display_arrow($user_id);
195
-					$content .= '</td>';
196
-				$content .= '</tr>';
197
-			$content .= '</table>';
198
-			$content .= '</div>';
199
-		}
200
-
201
-		return $content;
202
-	}
187
+                $content .= '</tr></td>';
188
+            }
189
+            $content .= '</table>';
190
+
191
+            $content .= '<table align="center">';
192
+                $content .= '<tr>';
193
+                    $content .= '<td>';
194
+                        $content .= SystemAnnouncementManager :: display_arrow($user_id);
195
+                    $content .= '</td>';
196
+                $content .= '</tr>';
197
+            $content .= '</table>';
198
+            $content .= '</div>';
199
+        }
200
+
201
+        return $content;
202
+    }
203 203
 
204 204
     /**
205 205
      * @param int $user_id
@@ -207,23 +207,23 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function display_arrow($user_id)
209 209
     {
210
-		$start = (int)$_GET['start'];
211
-		$nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id);
212
-		$next = ((int)$_GET['start']+19);
213
-		$prev = ((int)$_GET['start']-19);
214
-		$content = '';
215
-		if(!isset($_GET['start']) || $_GET['start'] == 0) {
216
-			if($nb_announcement > 20) {
217
-				$content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
218
-			}
219
-		} else {
220
-			echo '<a href="news_list.php?start='.$prev.'"> << '.get_lang('Prev').'</a>';
221
-			if ($nb_announcement > 20) {
222
-				$content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
223
-			}
224
-		}
225
-		return $content;
226
-	}
210
+        $start = (int)$_GET['start'];
211
+        $nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id);
212
+        $next = ((int)$_GET['start']+19);
213
+        $prev = ((int)$_GET['start']-19);
214
+        $content = '';
215
+        if(!isset($_GET['start']) || $_GET['start'] == 0) {
216
+            if($nb_announcement > 20) {
217
+                $content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
218
+            }
219
+        } else {
220
+            echo '<a href="news_list.php?start='.$prev.'"> << '.get_lang('Prev').'</a>';
221
+            if ($nb_announcement > 20) {
222
+                $content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
223
+            }
224
+        }
225
+        return $content;
226
+    }
227 227
 
228 228
     /**
229 229
      * @param int $start
@@ -232,82 +232,82 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public static function count_nb_announcement($start = 0, $user_id = '')
234 234
     {
235
-		$start = intval($start);
236
-		$visibility = api_is_allowed_to_create_course() ? self::VISIBLE_TEACHER : self::VISIBLE_STUDENT;
237
-		$user_selected_language = api_get_interface_language();
238
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
239
-		$sql = 'SELECT id FROM '.$db_table.'
235
+        $start = intval($start);
236
+        $visibility = api_is_allowed_to_create_course() ? self::VISIBLE_TEACHER : self::VISIBLE_STUDENT;
237
+        $user_selected_language = api_get_interface_language();
238
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
239
+        $sql = 'SELECT id FROM '.$db_table.'
240 240
 		        WHERE (lang="'.$user_selected_language.'" OR lang IS NULL) ';
241
-		if (isset($user_id)) {
242
-			switch ($visibility) {
243
-				case self::VISIBLE_GUEST :
244
-					$sql .= " AND visible_guest = 1 ";
245
-					break;
246
-				case self::VISIBLE_STUDENT :
247
-					$sql .= " AND visible_student = 1 ";
248
-					break;
249
-				case self::VISIBLE_TEACHER :
250
-					$sql .= " AND visible_teacher = 1 ";
251
-					break;
252
-			}
253
- 		}
254
-
255
-		$current_access_url_id = 1;
256
-		if (api_is_multiple_url_enabled()) {
257
-			$current_access_url_id = api_get_current_access_url_id();
258
-		}
259
-		$sql .= " AND access_url_id = '$current_access_url_id' ";
260
-
261
-
262
-		$sql .= 'LIMIT '.$start.', 21';
263
-		$announcements = Database::query($sql);
264
-		$i = 0;
265
-		while ($rows = Database::fetch_array($announcements)) {
266
-			$i++;
267
-		}
268
-		return $i;
269
-	}
270
-
271
-	/**
272
-	 * Get all announcements
273
-	 * @return array An array with all available system announcements (as php
274
-	 * objects)
275
-	 */
276
-	public static function get_all_announcements()
241
+        if (isset($user_id)) {
242
+            switch ($visibility) {
243
+                case self::VISIBLE_GUEST :
244
+                    $sql .= " AND visible_guest = 1 ";
245
+                    break;
246
+                case self::VISIBLE_STUDENT :
247
+                    $sql .= " AND visible_student = 1 ";
248
+                    break;
249
+                case self::VISIBLE_TEACHER :
250
+                    $sql .= " AND visible_teacher = 1 ";
251
+                    break;
252
+            }
253
+            }
254
+
255
+        $current_access_url_id = 1;
256
+        if (api_is_multiple_url_enabled()) {
257
+            $current_access_url_id = api_get_current_access_url_id();
258
+        }
259
+        $sql .= " AND access_url_id = '$current_access_url_id' ";
260
+
261
+
262
+        $sql .= 'LIMIT '.$start.', 21';
263
+        $announcements = Database::query($sql);
264
+        $i = 0;
265
+        while ($rows = Database::fetch_array($announcements)) {
266
+            $i++;
267
+        }
268
+        return $i;
269
+    }
270
+
271
+    /**
272
+     * Get all announcements
273
+     * @return array An array with all available system announcements (as php
274
+     * objects)
275
+     */
276
+    public static function get_all_announcements()
277 277
     {
278
-		$table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
279
-		$now = api_get_utc_datetime();
280
-		$sql = "SELECT *, IF ( '$now'  >= date_start AND '$now' <= date_end, '1', '0') AS visible
278
+        $table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
279
+        $now = api_get_utc_datetime();
280
+        $sql = "SELECT *, IF ( '$now'  >= date_start AND '$now' <= date_end, '1', '0') AS visible
281 281
 				FROM $table";
282 282
 
283
-		$current_access_url_id = 1;
284
-		if (api_is_multiple_url_enabled()) {
285
-			$current_access_url_id = api_get_current_access_url_id();
286
-		}
287
-		$sql .= " WHERE access_url_id = '$current_access_url_id' ";
288
-		$sql .= " ORDER BY date_start ASC";
289
-
290
-		$announcements = Database::query($sql);
291
-		$all_announcements = array();
292
-		while ($announcement = Database::fetch_object($announcements)) {
293
-			$all_announcements[] = $announcement;
294
-		}
295
-		return $all_announcements;
296
-	}
297
-
298
-	/**
299
-	 * Adds an announcement to the database
300
-	 * @param string Title of the announcement
301
-	 * @param string Content of the announcement
302
-	 * @param string Start date (YYYY-MM-DD HH:II: SS)
303
-	 * @param string End date (YYYY-MM-DD HH:II: SS)
304
-	 * @param int    Whether the announcement should be visible to teachers (1) or not (0)
305
-	 * @param int    Whether the announcement should be visible to students (1) or not (0)
306
-	 * @param int    Whether the announcement should be visible to anonymous users (1) or not (0)
307
-	 * @param string The language for which the announvement should be shown. Leave null for all langages
308
-	 * @param int    Whether to send an e-mail to all users (1) or not (0)
309
-	 * @return mixed  insert_id on success, false on failure
310
-	 */
283
+        $current_access_url_id = 1;
284
+        if (api_is_multiple_url_enabled()) {
285
+            $current_access_url_id = api_get_current_access_url_id();
286
+        }
287
+        $sql .= " WHERE access_url_id = '$current_access_url_id' ";
288
+        $sql .= " ORDER BY date_start ASC";
289
+
290
+        $announcements = Database::query($sql);
291
+        $all_announcements = array();
292
+        while ($announcement = Database::fetch_object($announcements)) {
293
+            $all_announcements[] = $announcement;
294
+        }
295
+        return $all_announcements;
296
+    }
297
+
298
+    /**
299
+     * Adds an announcement to the database
300
+     * @param string Title of the announcement
301
+     * @param string Content of the announcement
302
+     * @param string Start date (YYYY-MM-DD HH:II: SS)
303
+     * @param string End date (YYYY-MM-DD HH:II: SS)
304
+     * @param int    Whether the announcement should be visible to teachers (1) or not (0)
305
+     * @param int    Whether the announcement should be visible to students (1) or not (0)
306
+     * @param int    Whether the announcement should be visible to anonymous users (1) or not (0)
307
+     * @param string The language for which the announvement should be shown. Leave null for all langages
308
+     * @param int    Whether to send an e-mail to all users (1) or not (0)
309
+     * @return mixed  insert_id on success, false on failure
310
+     */
311 311
     public static function add_announcement(
312 312
         $title,
313 313
         $content,
@@ -321,112 +321,112 @@  discard block
 block discarded – undo
321 321
         $add_to_calendar = false,
322 322
         $sendEmailTest = false
323 323
     ) {
324
-		$original_content = $content;
325
-		$a_dateS = explode(' ',$date_start);
326
-		$a_arraySD = explode('-',$a_dateS[0]);
327
-		$a_arraySH = explode(':',$a_dateS[1]);
328
-		$date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
324
+        $original_content = $content;
325
+        $a_dateS = explode(' ',$date_start);
326
+        $a_arraySD = explode('-',$a_dateS[0]);
327
+        $a_arraySH = explode(':',$a_dateS[1]);
328
+        $date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
329 329
 
330
-		$a_dateE = explode(' ',$date_end);
331
-		$a_arrayED = explode('-',$a_dateE[0]);
332
-		$a_arrayEH = explode(':',$a_dateE[1]);
333
-		$date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
330
+        $a_dateE = explode(' ',$date_end);
331
+        $a_arrayED = explode('-',$a_dateE[0]);
332
+        $a_arrayEH = explode(':',$a_dateE[1]);
333
+        $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
334 334
 
335
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
335
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
336 336
 
337
-		if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
338
-			Display :: display_normal_message(get_lang('InvalidStartDate'));
339
-			return false;
340
-		}
337
+        if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
338
+            Display :: display_normal_message(get_lang('InvalidStartDate'));
339
+            return false;
340
+        }
341 341
 
342
-		if (($date_end_to_compare[1] ||
342
+        if (($date_end_to_compare[1] ||
343 343
             $date_end_to_compare[2] ||
344 344
             $date_end_to_compare[0]) &&
345 345
             !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])
346 346
         ) {
347
-			Display :: display_normal_message(get_lang('InvalidEndDate'));
348
-			return false;
349
-		}
350
-		if (strlen(trim($title)) == 0) {
351
-			Display::display_normal_message(get_lang('InvalidTitle'));
352
-			return false;
353
-		}
354
-
355
-		$start = api_get_utc_datetime($date_start);
347
+            Display :: display_normal_message(get_lang('InvalidEndDate'));
348
+            return false;
349
+        }
350
+        if (strlen(trim($title)) == 0) {
351
+            Display::display_normal_message(get_lang('InvalidTitle'));
352
+            return false;
353
+        }
354
+
355
+        $start = api_get_utc_datetime($date_start);
356 356
         $end = api_get_utc_datetime($date_end);
357 357
 
358
-		//Fixing urls that are sent by email
359
-		$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
360
-		$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
358
+        //Fixing urls that are sent by email
359
+        $content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
360
+        $content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
361 361
 
362 362
         $lang = is_null($lang) ? '' : $lang;
363 363
 
364
-		$current_access_url_id = 1;
365
-		if (api_is_multiple_url_enabled()) {
366
-			$current_access_url_id = api_get_current_access_url_id();
367
-		}
368
-
369
-		$params = [
370
-			'title' => $title,
371
-			'content' => $content,
372
-			'date_start' => $start,
373
-			'date_end' => $end,
374
-			'visible_teacher' => $visible_teacher,
375
-			'visible_student' => $visible_student,
376
-			'visible_guest' => $visible_guest,
377
-			'lang' => $lang,
378
-			'access_url_id' => $current_access_url_id,
379
-		];
380
-
381
-		$resultId = Database::insert($db_table, $params);
382
-
383
-		if ($resultId) {
384
-
385
-			if ($sendEmailTest) {
386
-				SystemAnnouncementManager::send_system_announcement_by_email(
387
-					$title,
388
-					$content,
389
-					$visible_teacher,
390
-					$visible_student,
391
-					$lang,
392
-					true
393
-				);
394
-			} else {
395
-				if ($send_mail == 1) {
396
-					SystemAnnouncementManager::send_system_announcement_by_email(
397
-						$title,
398
-						$content,
399
-						$visible_teacher,
400
-						$visible_student,
401
-						$lang
402
-					);
403
-				}
404
-			}
405
-
406
-			if ($add_to_calendar) {
407
-				$agenda = new Agenda();
408
-				$agenda->setType('admin');
409
-				$agenda->addEvent(
410
-					$date_start,
411
-					$date_end,
412
-					false,
413
-					$title,
414
-					$original_content
415
-				);
416
-			}
417
-
418
-			return $resultId;
419
-
420
-		}
421
-
422
-		return false;
423
-	}
364
+        $current_access_url_id = 1;
365
+        if (api_is_multiple_url_enabled()) {
366
+            $current_access_url_id = api_get_current_access_url_id();
367
+        }
368
+
369
+        $params = [
370
+            'title' => $title,
371
+            'content' => $content,
372
+            'date_start' => $start,
373
+            'date_end' => $end,
374
+            'visible_teacher' => $visible_teacher,
375
+            'visible_student' => $visible_student,
376
+            'visible_guest' => $visible_guest,
377
+            'lang' => $lang,
378
+            'access_url_id' => $current_access_url_id,
379
+        ];
380
+
381
+        $resultId = Database::insert($db_table, $params);
382
+
383
+        if ($resultId) {
384
+
385
+            if ($sendEmailTest) {
386
+                SystemAnnouncementManager::send_system_announcement_by_email(
387
+                    $title,
388
+                    $content,
389
+                    $visible_teacher,
390
+                    $visible_student,
391
+                    $lang,
392
+                    true
393
+                );
394
+            } else {
395
+                if ($send_mail == 1) {
396
+                    SystemAnnouncementManager::send_system_announcement_by_email(
397
+                        $title,
398
+                        $content,
399
+                        $visible_teacher,
400
+                        $visible_student,
401
+                        $lang
402
+                    );
403
+                }
404
+            }
405
+
406
+            if ($add_to_calendar) {
407
+                $agenda = new Agenda();
408
+                $agenda->setType('admin');
409
+                $agenda->addEvent(
410
+                    $date_start,
411
+                    $date_end,
412
+                    false,
413
+                    $title,
414
+                    $original_content
415
+                );
416
+            }
417
+
418
+            return $resultId;
419
+
420
+        }
421
+
422
+        return false;
423
+    }
424 424
 
425 425
     /**
426
-    * Makes the announcement id visible only for groups in groups_array
427
-    * @param int announcement id
428
-    * @param array array of group id
429
-    **/
426
+     * Makes the announcement id visible only for groups in groups_array
427
+     * @param int announcement id
428
+     * @param array array of group id
429
+     **/
430 430
     public static function announcement_for_groups($announcement_id, $group_array)
431 431
     {
432 432
         $tbl_announcement_group = Database:: get_main_table(
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
     }
461 461
 
462 462
     /**
463
-    * Gets the groups of this announce
464
-    * @param int announcement id
465
-    * @return array array of group id
466
-    **/
463
+     * Gets the groups of this announce
464
+     * @param int announcement id
465
+     * @return array array of group id
466
+     **/
467 467
     public static function get_announcement_groups($announcement_id)
468 468
     {
469 469
         $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
@@ -482,15 +482,15 @@  discard block
 block discarded – undo
482 482
         return $groups;
483 483
     }
484 484
 
485
-	/**
486
-	 * Updates an announcement to the database
487
-	 * @param integer $id      : id of the announcement
488
-	 * @param string  $title   : title of the announcement
489
-	 * @param string  $content : content of the announcement
490
-	 * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
491
-	 * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
492
-	 * @return	bool	True on success, false on failure
493
-	 */
485
+    /**
486
+     * Updates an announcement to the database
487
+     * @param integer $id      : id of the announcement
488
+     * @param string  $title   : title of the announcement
489
+     * @param string  $content : content of the announcement
490
+     * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
491
+     * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
492
+     * @return	bool	True on success, false on failure
493
+     */
494 494
     public static function update_announcement(
495 495
         $id,
496 496
         $title,
@@ -504,51 +504,51 @@  discard block
 block discarded – undo
504 504
         $send_mail = 0,
505 505
         $sendEmailTest = false
506 506
     ) {
507
-		$a_dateS = explode(' ',$date_start);
508
-		$a_arraySD = explode('-',$a_dateS[0]);
509
-		$a_arraySH = explode(':',$a_dateS[1]);
510
-		$date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
507
+        $a_dateS = explode(' ',$date_start);
508
+        $a_arraySD = explode('-',$a_dateS[0]);
509
+        $a_arraySH = explode(':',$a_dateS[1]);
510
+        $date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
511 511
 
512
-		$a_dateE = explode(' ',$date_end);
513
-		$a_arrayED = explode('-',$a_dateE[0]);
514
-		$a_arrayEH = explode(':',$a_dateE[1]);
515
-		$date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
512
+        $a_dateE = explode(' ',$date_end);
513
+        $a_arrayED = explode('-',$a_dateE[0]);
514
+        $a_arrayEH = explode(':',$a_dateE[1]);
515
+        $date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
516 516
 
517
-		$langsql = is_null($lang) ? 'NULL' : "'".Database::escape_string($lang)."'";
518
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
517
+        $langsql = is_null($lang) ? 'NULL' : "'".Database::escape_string($lang)."'";
518
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
519 519
 
520
-		if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
521
-			Display :: display_normal_message(get_lang('InvalidStartDate'));
522
-			return false;
523
-		}
520
+        if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
521
+            Display :: display_normal_message(get_lang('InvalidStartDate'));
522
+            return false;
523
+        }
524 524
 
525
-		if (($date_end_to_compare[1] ||
525
+        if (($date_end_to_compare[1] ||
526 526
             $date_end_to_compare[2] ||
527 527
             $date_end_to_compare[0]) &&
528 528
             !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])
529 529
         ) {
530
-			Display :: display_normal_message(get_lang('InvalidEndDate'));
531
-			return false;
532
-		}
530
+            Display :: display_normal_message(get_lang('InvalidEndDate'));
531
+            return false;
532
+        }
533 533
 
534
-		if (strlen(trim($title)) == 0) {
535
-			Display::display_normal_message(get_lang('InvalidTitle'));
536
-			return false;
537
-		}
534
+        if (strlen(trim($title)) == 0) {
535
+            Display::display_normal_message(get_lang('InvalidTitle'));
536
+            return false;
537
+        }
538 538
 
539
-	    $start    = api_get_utc_datetime($date_start);
539
+        $start    = api_get_utc_datetime($date_start);
540 540
         $end      = api_get_utc_datetime($date_end);
541 541
 
542
-		$title = Database::escape_string($title);
543
-		$content = Database::escape_string($content);
542
+        $title = Database::escape_string($title);
543
+        $content = Database::escape_string($content);
544 544
 
545
-		//Fixing urls that are sent by email
546
-		$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
547
-		$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
545
+        //Fixing urls that are sent by email
546
+        $content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
547
+        $content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
548 548
 
549
-		$id = intval($id);
550
-		$sql = "UPDATE ".$db_table." SET lang=$langsql,title='".$title."',content='".$content."',date_start='".$start."',date_end='".$end."', ";
551
-		$sql .= " visible_teacher = '".$visible_teacher."', visible_student = '".$visible_student."', visible_guest = '".$visible_guest."' , access_url_id = '".api_get_current_access_url_id()."'  WHERE id = ".$id;
549
+        $id = intval($id);
550
+        $sql = "UPDATE ".$db_table." SET lang=$langsql,title='".$title."',content='".$content."',date_start='".$start."',date_end='".$end."', ";
551
+        $sql .= " visible_teacher = '".$visible_teacher."', visible_student = '".$visible_student."', visible_guest = '".$visible_guest."' , access_url_id = '".api_get_current_access_url_id()."'  WHERE id = ".$id;
552 552
 
553 553
         if ($sendEmailTest) {
554 554
             SystemAnnouncementManager::send_system_announcement_by_email(
@@ -570,89 +570,89 @@  discard block
 block discarded – undo
570 570
                 );
571 571
             }
572 572
         }
573
-		$res = Database::query($sql);
574
-		if ($res === false) {
573
+        $res = Database::query($sql);
574
+        if ($res === false) {
575 575
 
576
-			return false;
577
-		}
578
-		return true;
579
-	}
576
+            return false;
577
+        }
578
+        return true;
579
+    }
580 580
 
581
-	/**
582
-	 * Deletes an announcement
583
-	 * @param 	int $id The identifier of the announcement that should be
584
-	 * @return	bool	True on success, false on failure
585
-	 */
586
-	public static function delete_announcement($id)
581
+    /**
582
+     * Deletes an announcement
583
+     * @param 	int $id The identifier of the announcement that should be
584
+     * @return	bool	True on success, false on failure
585
+     */
586
+    public static function delete_announcement($id)
587 587
     {
588
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
589
-		$id = intval($id);
590
-		$sql = "DELETE FROM ".$db_table." WHERE id =".$id;
591
-		$res = Database::query($sql);
592
-		if ($res === false) {
593
-
594
-			return false;
595
-		}
596
-		return true;
597
-	}
598
-
599
-	/**
600
-	 * Gets an announcement
601
-	 * @param 	int		$id The identifier of the announcement that should be
602
-	 * @return	object	Object of class StdClass or the required class, containing the query result row
603
-	 */
604
-	public static function get_announcement($id)
588
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
589
+        $id = intval($id);
590
+        $sql = "DELETE FROM ".$db_table." WHERE id =".$id;
591
+        $res = Database::query($sql);
592
+        if ($res === false) {
593
+
594
+            return false;
595
+        }
596
+        return true;
597
+    }
598
+
599
+    /**
600
+     * Gets an announcement
601
+     * @param 	int		$id The identifier of the announcement that should be
602
+     * @return	object	Object of class StdClass or the required class, containing the query result row
603
+     */
604
+    public static function get_announcement($id)
605 605
     {
606
-		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
607
-		$id = intval($id);
608
-		$sql = "SELECT * FROM ".$db_table." WHERE id = ".$id;
609
-		$announcement = Database::fetch_object(Database::query($sql));
610
-
611
-		return $announcement;
612
-	}
613
-
614
-	/**
615
-	 * Change the visibility of an announcement
616
-	 * @param 	int $announcement_id
617
-	 * @param 	int $user For who should the visibility be changed
606
+        $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
607
+        $id = intval($id);
608
+        $sql = "SELECT * FROM ".$db_table." WHERE id = ".$id;
609
+        $announcement = Database::fetch_object(Database::query($sql));
610
+
611
+        return $announcement;
612
+    }
613
+
614
+    /**
615
+     * Change the visibility of an announcement
616
+     * @param 	int $announcement_id
617
+     * @param 	int $user For who should the visibility be changed
618 618
      * (possible values are VISIBLE_TEACHER, VISIBLE_STUDENT, VISIBLE_GUEST)
619
-	 * @return 	bool	True on success, false on failure
620
-	 */
621
-	public static function set_visibility($announcement_id, $user, $visible)
619
+     * @return 	bool	True on success, false on failure
620
+     */
621
+    public static function set_visibility($announcement_id, $user, $visible)
622 622
     {
623
-		$db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
624
-		$visible = intval($visible);
625
-		$announcement_id = intval($announcement_id);
623
+        $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
624
+        $visible = intval($visible);
625
+        $announcement_id = intval($announcement_id);
626 626
 
627 627
         if (!in_array($user, array(self::VISIBLE_GUEST, self::VISIBLE_STUDENT, self::VISIBLE_TEACHER))) {
628 628
             return false;
629 629
         }
630 630
 
631
-		$field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest'));
631
+        $field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest'));
632 632
 
633
-		$sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."'
633
+        $sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."'
634 634
 		        WHERE id='".$announcement_id."'";
635
-		$res = Database::query($sql);
636
-
637
-		if ($res === false) {
638
-			return false;
639
-		}
640
-
641
-		return true;
642
-	}
643
-
644
-	/**
645
-	 * Send a system announcement by e-mail to all teachers/students depending on parameters
646
-	 * @param	string	Title
647
-	 * @param	string	Content
648
-	 * @param	int		Whether to send to all teachers (1) or not (0)
649
-	 * @param	int		Whether to send to all students (1) or not (0)
650
-	 * @param	string	Language (optional, considered for all languages if left empty)
635
+        $res = Database::query($sql);
636
+
637
+        if ($res === false) {
638
+            return false;
639
+        }
640
+
641
+        return true;
642
+    }
643
+
644
+    /**
645
+     * Send a system announcement by e-mail to all teachers/students depending on parameters
646
+     * @param	string	Title
647
+     * @param	string	Content
648
+     * @param	int		Whether to send to all teachers (1) or not (0)
649
+     * @param	int		Whether to send to all students (1) or not (0)
650
+     * @param	string	Language (optional, considered for all languages if left empty)
651 651
      * @return  bool    True if the message was sent or there was no destination matching. False on database or e-mail sending error.
652
-	 */
653
-	public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false)
652
+     */
653
+    public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false)
654 654
     {
655
-		global $charset;
655
+        global $charset;
656 656
 
657 657
         $title = api_html_entity_decode(stripslashes($title), ENT_QUOTES, $charset);
658 658
         $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'),'', $content)), ENT_QUOTES, $charset);
@@ -671,22 +671,22 @@  discard block
 block discarded – undo
671 671
         }
672 672
 
673 673
         if ($teacher <> 0 AND $student == 0) {
674
-			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '1' ";
675
-		}
674
+            $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '1' ";
675
+        }
676 676
 
677
-		if ($teacher == 0 AND $student <> 0) {
678
-			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' ";
679
-		}
677
+        if ($teacher == 0 AND $student <> 0) {
678
+            $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' ";
679
+        }
680 680
 
681
-		if ($teacher<> 0 AND $student <> 0) {
682
-			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 ";
683
-		}
681
+        if ($teacher<> 0 AND $student <> 0) {
682
+            $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 ";
683
+        }
684 684
 
685
-		if (!empty($language)) { //special condition because language was already treated for SQL insert before
686
-			$sql .= " AND language = '".Database::escape_string($language)."' ";
687
-		}
685
+        if (!empty($language)) { //special condition because language was already treated for SQL insert before
686
+            $sql .= " AND language = '".Database::escape_string($language)."' ";
687
+        }
688 688
 
689
-		if (api_is_multiple_url_enabled()) {
689
+        if (api_is_multiple_url_enabled()) {
690 690
             $sql .= " AND access_url_id = '".$current_access_url_id."' ";
691 691
         }
692 692
 
@@ -696,25 +696,25 @@  discard block
 block discarded – undo
696 696
         // Expiration date
697 697
         $sql .= " AND (expiration_date = '' OR expiration_date IS NULL OR expiration_date > '$now') ";
698 698
 
699
-		if ((empty($teacher) or $teacher == '0') AND  (empty($student) or $student == '0')) {
700
-			return true;
701
-		}
699
+        if ((empty($teacher) or $teacher == '0') AND  (empty($student) or $student == '0')) {
700
+            return true;
701
+        }
702 702
 
703
-		$result = Database::query($sql);
704
-		if ($result === false) {
705
-			return false;
706
-		}
703
+        $result = Database::query($sql);
704
+        if ($result === false) {
705
+            return false;
706
+        }
707 707
 
708 708
         $message_sent = false;
709 709
 
710
-		while ($row = Database::fetch_array($result,'ASSOC')) {
710
+        while ($row = Database::fetch_array($result,'ASSOC')) {
711 711
             MessageManager::send_message_simple($row['user_id'], $title, $content);
712 712
             $message_sent = true;
713
-		}
714
-		return $message_sent; //true if at least one e-mail was sent
715
-	}
713
+        }
714
+        return $message_sent; //true if at least one e-mail was sent
715
+    }
716 716
 
717
-	/**
717
+    /**
718 718
      * Displays announcements as an slideshow
719 719
      * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER
720 720
      * @param int $id The identifier of the announcement to display
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
         $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
23 23
 		$userGroup = new UserGroup();
24 24
 
25
-        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
25
+        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0);
26 26
         $groups = array();
27 27
         foreach ($temp_user_groups as $user_group) {
28 28
             $groups = array_merge($groups, array($user_group['id']));
29 29
             $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id']));
30 30
         }
31 31
 
32
-        $groups_string = '('.implode($groups,',').')';
32
+        $groups_string = '('.implode($groups, ',').')';
33 33
         $now = api_get_utc_datetime();
34 34
         $sql = "SELECT *, DATE_FORMAT(date_start,'%d-%m-%Y %h:%i:%s') AS display_date
35 35
 				FROM  $db_table
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
      * @param string $user_id
105 105
      * @return string
106 106
      */
107
-    public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='')
107
+    public static function display_all_announcements($visible, $id = -1, $start = 0, $user_id = '')
108 108
     {
109 109
 		$user_selected_language = api_get_interface_language();
110
-		$start	= intval($start);
110
+		$start = intval($start);
111 111
         $userGroup = new UserGroup();
112 112
 	    $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
113
-	    $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
113
+	    $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0);
114 114
         $groups = array();
115 115
 	    foreach ($temp_user_groups as $user_group) {
116 116
 	        $groups = array_merge($groups, array($user_group['id']));
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	    }
119 119
 
120 120
 	    // Checks if tables exists to not break platform not updated
121
-	    $groups_string = '('.implode($groups,',').')';
121
+	    $groups_string = '('.implode($groups, ',').')';
122 122
 
123 123
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
124
-		$now  = api_get_utc_datetime();
124
+		$now = api_get_utc_datetime();
125 125
 
126 126
 		$sql = "SELECT * FROM ".$db_table."
127 127
 				WHERE
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
             $sql .= " AND access_url_id IN ('1', '$current_access_url_id')";
153 153
 		}
154 154
 
155
-		if(!isset($_GET['start']) || $_GET['start'] == 0) {
155
+		if (!isset($_GET['start']) || $_GET['start'] == 0) {
156 156
 			$sql .= " ORDER BY date_start DESC LIMIT ".$start.",20";
157 157
 		} else {
158
-			$sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20";
158
+			$sql .= " ORDER BY date_start DESC LIMIT ".($start + 1).",20";
159 159
 		}
160 160
 		$announcements = Database::query($sql);
161 161
 		$content = '';
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function display_arrow($user_id)
209 209
     {
210
-		$start = (int)$_GET['start'];
211
-		$nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id);
212
-		$next = ((int)$_GET['start']+19);
213
-		$prev = ((int)$_GET['start']-19);
210
+		$start = (int) $_GET['start'];
211
+		$nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start, $user_id);
212
+		$next = ((int) $_GET['start'] + 19);
213
+		$prev = ((int) $_GET['start'] - 19);
214 214
 		$content = '';
215
-		if(!isset($_GET['start']) || $_GET['start'] == 0) {
216
-			if($nb_announcement > 20) {
215
+		if (!isset($_GET['start']) || $_GET['start'] == 0) {
216
+			if ($nb_announcement > 20) {
217 217
 				$content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
218 218
 			}
219 219
 		} else {
@@ -322,15 +322,15 @@  discard block
 block discarded – undo
322 322
         $sendEmailTest = false
323 323
     ) {
324 324
 		$original_content = $content;
325
-		$a_dateS = explode(' ',$date_start);
326
-		$a_arraySD = explode('-',$a_dateS[0]);
327
-		$a_arraySH = explode(':',$a_dateS[1]);
328
-		$date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
325
+		$a_dateS = explode(' ', $date_start);
326
+		$a_arraySD = explode('-', $a_dateS[0]);
327
+		$a_arraySH = explode(':', $a_dateS[1]);
328
+		$date_start_to_compare = array_merge($a_arraySD, $a_arraySH);
329 329
 
330
-		$a_dateE = explode(' ',$date_end);
331
-		$a_arrayED = explode('-',$a_dateE[0]);
332
-		$a_arrayEH = explode(':',$a_dateE[1]);
333
-		$date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
330
+		$a_dateE = explode(' ', $date_end);
331
+		$a_arrayED = explode('-', $a_dateE[0]);
332
+		$a_arrayEH = explode(':', $a_dateE[1]);
333
+		$date_end_to_compare = array_merge($a_arrayED, $a_arrayEH);
334 334
 
335 335
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
336 336
 
@@ -504,15 +504,15 @@  discard block
 block discarded – undo
504 504
         $send_mail = 0,
505 505
         $sendEmailTest = false
506 506
     ) {
507
-		$a_dateS = explode(' ',$date_start);
508
-		$a_arraySD = explode('-',$a_dateS[0]);
509
-		$a_arraySH = explode(':',$a_dateS[1]);
510
-		$date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
507
+		$a_dateS = explode(' ', $date_start);
508
+		$a_arraySD = explode('-', $a_dateS[0]);
509
+		$a_arraySH = explode(':', $a_dateS[1]);
510
+		$date_start_to_compare = array_merge($a_arraySD, $a_arraySH);
511 511
 
512
-		$a_dateE = explode(' ',$date_end);
513
-		$a_arrayED = explode('-',$a_dateE[0]);
514
-		$a_arrayEH = explode(':',$a_dateE[1]);
515
-		$date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
512
+		$a_dateE = explode(' ', $date_end);
513
+		$a_arrayED = explode('-', $a_dateE[0]);
514
+		$a_arrayEH = explode(':', $a_dateE[1]);
515
+		$date_end_to_compare = array_merge($a_arrayED, $a_arrayEH);
516 516
 
517 517
 		$langsql = is_null($lang) ? 'NULL' : "'".Database::escape_string($lang)."'";
518 518
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
@@ -536,8 +536,8 @@  discard block
 block discarded – undo
536 536
 			return false;
537 537
 		}
538 538
 
539
-	    $start    = api_get_utc_datetime($date_start);
540
-        $end      = api_get_utc_datetime($date_end);
539
+	    $start = api_get_utc_datetime($date_start);
540
+        $end = api_get_utc_datetime($date_end);
541 541
 
542 542
 		$title = Database::escape_string($title);
543 543
 		$content = Database::escape_string($content);
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                 $sendEmailTest
561 561
             );
562 562
         } else {
563
-            if ($send_mail==1) {
563
+            if ($send_mail == 1) {
564 564
                 SystemAnnouncementManager::send_system_announcement_by_email(
565 565
                     $title,
566 566
                     $content,
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 		global $charset;
656 656
 
657 657
         $title = api_html_entity_decode(stripslashes($title), ENT_QUOTES, $charset);
658
-        $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'),'', $content)), ENT_QUOTES, $charset);
658
+        $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'), '', $content)), ENT_QUOTES, $charset);
659 659
         $now = api_get_utc_datetime();
660 660
 
661 661
         if ($sendEmailTest) {
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' ";
679 679
 		}
680 680
 
681
-		if ($teacher<> 0 AND $student <> 0) {
681
+		if ($teacher <> 0 AND $student <> 0) {
682 682
 			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 ";
683 683
 		}
684 684
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
         // Expiration date
697 697
         $sql .= " AND (expiration_date = '' OR expiration_date IS NULL OR expiration_date > '$now') ";
698 698
 
699
-		if ((empty($teacher) or $teacher == '0') AND  (empty($student) or $student == '0')) {
699
+		if ((empty($teacher) or $teacher == '0') AND (empty($student) or $student == '0')) {
700 700
 			return true;
701 701
 		}
702 702
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 
708 708
         $message_sent = false;
709 709
 
710
-		while ($row = Database::fetch_array($result,'ASSOC')) {
710
+		while ($row = Database::fetch_array($result, 'ASSOC')) {
711 711
             MessageManager::send_message_simple($row['user_id'], $title, $content);
712 712
             $message_sent = true;
713 713
 		}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
         $cut_size = 500;
728 728
         $now = api_get_utc_datetime();
729 729
 
730
-        $sql = "SELECT * FROM " . $table . "
730
+        $sql = "SELECT * FROM ".$table."
731 731
 				WHERE
732 732
 				    (lang = '$user_selected_language' OR lang = '') AND
733 733
 				    ('$now' >= date_start AND '$now' <= date_end) ";
Please login to merge, or discard this patch.
main/inc/lib/table_sort.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 	 * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
81 81
 	 * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
82 82
 	 * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
83
-	 * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
83
+	 * @param integer $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
84 84
 	 * @return array The sorted dataset
85 85
 	 * @author [email protected]
86 86
 	 */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
                 $new_data_order = array();
159 159
                 if (!empty($docs_to_sort)) {
160
-                    foreach($docs_to_sort as $id => $document) {
160
+                    foreach ($docs_to_sort as $id => $document) {
161 161
                         if (isset($new_data[$id])) {
162 162
                             $new_data_order[] = $new_data[$id];
163 163
                         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 }
166 166
 
167 167
                 if (!empty($folder_to_sort)) {
168
-                    foreach($folder_to_sort as $id => $document) {
168
+                    foreach ($folder_to_sort as $id => $document) {
169 169
                         if (isset($new_data[$id])) {
170 170
                             $new_data_order[] = $new_data[$id];
171 171
                         }
Please login to merge, or discard this patch.
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
 class TableSort
16 16
 {
17 17
     /**
18
-    * Sorts 2-dimensional table.
19
-    * @param array $data The data to be sorted.
20
-    * @param int $column The column on which the data should be sorted (default = 0)
21
-    * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC)
22
-    * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC,
23
-    * SORT_STRING,SORT_DATE,SORT_IMAGE)
24
-    * @return array The sorted dataset
25
-    * @author [email protected]
26
-    */
27
-	public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR)
18
+     * Sorts 2-dimensional table.
19
+     * @param array $data The data to be sorted.
20
+     * @param int $column The column on which the data should be sorted (default = 0)
21
+     * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC)
22
+     * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC,
23
+     * SORT_STRING,SORT_DATE,SORT_IMAGE)
24
+     * @return array The sorted dataset
25
+     * @author [email protected]
26
+     */
27
+    public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR)
28 28
     {
29 29
         if (!is_array($data) || empty($data)) {
30 30
             return array();
@@ -71,20 +71,20 @@  discard block
 block discarded – undo
71 71
         usort($data, create_function('$a, $b', $compare_function));
72 72
 
73 73
         return $data;
74
-	}
74
+    }
75 75
 
76
-	/**
77
-	 * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted.
78
-	 * @param array $data The data to be sorted.
79
-	 * @param int $column The column on which the data should be sorted (default = 0)
80
-	 * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
81
-	 * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
82
-	 * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
83
-	 * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
84
-	 * @return array The sorted dataset
85
-	 * @author [email protected]
86
-	 */
87
-	public static function sort_table_config(
76
+    /**
77
+     * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted.
78
+     * @param array $data The data to be sorted.
79
+     * @param int $column The column on which the data should be sorted (default = 0)
80
+     * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC)
81
+     * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column.
82
+     * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3]
83
+     * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE)
84
+     * @return array The sorted dataset
85
+     * @author [email protected]
86
+     */
87
+    public static function sort_table_config(
88 88
         $data,
89 89
         $column = 0,
90 90
         $direction = SORT_ASC,
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
             if (!empty($data)) {
133 133
                 foreach ($data as $document) {
134 134
                     if ($document['type'] == 'folder') {
135
-                      $docs_to_sort[$document['id']]   = api_strtolower($document['name']);
135
+                        $docs_to_sort[$document['id']]   = api_strtolower($document['name']);
136 136
                     } else {
137
-                      $folder_to_sort[$document['id']] = api_strtolower($document['name']);
137
+                        $folder_to_sort[$document['id']] = api_strtolower($document['name']);
138 138
                     }
139 139
                     $new_data[$document['id']] = $document;
140 140
                 }
@@ -196,91 +196,91 @@  discard block
 block discarded – undo
196 196
             usort($data, create_function('$a, $b', $compare_function));
197 197
         }
198 198
 
199
-		if (is_array($column_show) && !empty($column_show)) {
199
+        if (is_array($column_show) && !empty($column_show)) {
200 200
 
201
-			// We show only the columns data that were set up on the $column_show array
202
-			$new_order_data = array();
203
-			$count_data = count($data);
204
-			$count_column_show = count($column_show);
205
-			for ($j = 0; $j < $count_data; $j++) {
206
-				$k = 0;
207
-				for ($i = 0; $i < $count_column_show; $i++) {
208
-					if ($column_show[$i]) {
209
-						$new_order_data[$j][$k] = $data[$j][$i];
210
-					}
211
-					$k++;
212
-				}
213
-			}
214
-			// Replace the multi-arrays
215
-			$data = $new_order_data;
216
-		}
201
+            // We show only the columns data that were set up on the $column_show array
202
+            $new_order_data = array();
203
+            $count_data = count($data);
204
+            $count_column_show = count($column_show);
205
+            for ($j = 0; $j < $count_data; $j++) {
206
+                $k = 0;
207
+                for ($i = 0; $i < $count_column_show; $i++) {
208
+                    if ($column_show[$i]) {
209
+                        $new_order_data[$j][$k] = $data[$j][$i];
210
+                    }
211
+                    $k++;
212
+                }
213
+            }
214
+            // Replace the multi-arrays
215
+            $data = $new_order_data;
216
+        }
217 217
 
218
-		return $data;
219
-	}
218
+        return $data;
219
+    }
220 220
 
221
-	/**
222
-	 * Checks whether a column of a 2D-array contains only numeric values
223
-	 * @param array $data		The data-array
224
-	 * @param int $column		The index of the column to check
225
-	 * @return bool				TRUE if column contains only dates, FALSE otherwise
226
-	 * @todo Take locale into account (eg decimal point or comma ?)
227
-	 * @author [email protected]
228
-	 */
229
-	private static function is_numeric_column(& $data, $column)
221
+    /**
222
+     * Checks whether a column of a 2D-array contains only numeric values
223
+     * @param array $data		The data-array
224
+     * @param int $column		The index of the column to check
225
+     * @return bool				TRUE if column contains only dates, FALSE otherwise
226
+     * @todo Take locale into account (eg decimal point or comma ?)
227
+     * @author [email protected]
228
+     */
229
+    private static function is_numeric_column(& $data, $column)
230 230
     {
231
-		$is_numeric = true;
232
-		foreach ($data as $index => & $row) {
233
-			$is_numeric &= is_numeric(strip_tags($row[$column]));
234
-			if (!$is_numeric) {
235
-				break;
236
-			}
237
-		}
238
-		return $is_numeric;
239
-	}
231
+        $is_numeric = true;
232
+        foreach ($data as $index => & $row) {
233
+            $is_numeric &= is_numeric(strip_tags($row[$column]));
234
+            if (!$is_numeric) {
235
+                break;
236
+            }
237
+        }
238
+        return $is_numeric;
239
+    }
240 240
 
241
-	/**
242
-	 * Checks whether a column of a 2D-array contains only dates (GNU date syntax)
243
-	 * @param array $data		The data-array
244
-	 * @param int $column		The index of the column to check
245
-	 * @return bool				TRUE if column contains only dates, FALSE otherwise
246
-	 * @author [email protected]
247
-	 */
248
-	private static function is_date_column(& $data, $column)
241
+    /**
242
+     * Checks whether a column of a 2D-array contains only dates (GNU date syntax)
243
+     * @param array $data		The data-array
244
+     * @param int $column		The index of the column to check
245
+     * @return bool				TRUE if column contains only dates, FALSE otherwise
246
+     * @author [email protected]
247
+     */
248
+    private static function is_date_column(& $data, $column)
249 249
     {
250
-		$is_date = true;
251
-		foreach ($data as $index => & $row) {
252
-			if (strlen(strip_tags($row[$column])) != 0) {
253
-				$check_date = strtotime(strip_tags($row[$column]));
254
-				// strtotime Returns a timestamp on success, FALSE otherwise.
255
-				// Previous to PHP 5.1.0, this function would return -1 on failure.
256
-				$is_date &= ($check_date != -1 && $check_date);
257
-			} else {
258
-				$is_date &= false;
259
-			}
260
-			if (!$is_date) {
261
-				break;
262
-			}
263
-		}
264
-		return $is_date;
265
-	}
250
+        $is_date = true;
251
+        foreach ($data as $index => & $row) {
252
+            if (strlen(strip_tags($row[$column])) != 0) {
253
+                $check_date = strtotime(strip_tags($row[$column]));
254
+                // strtotime Returns a timestamp on success, FALSE otherwise.
255
+                // Previous to PHP 5.1.0, this function would return -1 on failure.
256
+                $is_date &= ($check_date != -1 && $check_date);
257
+            } else {
258
+                $is_date &= false;
259
+            }
260
+            if (!$is_date) {
261
+                break;
262
+            }
263
+        }
264
+        return $is_date;
265
+    }
266 266
 
267
-	/**
268
-	 * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>)
269
-	 * @param array $data		The data-array
270
-	 * @param int $column		The index of the column to check
271
-	 * @return bool				TRUE if column contains only images, FALSE otherwise
272
-	 * @author [email protected]
273
-	 */
274
-	private static function is_image_column(& $data, $column)
267
+    /**
268
+     * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>)
269
+     * @param array $data		The data-array
270
+     * @param int $column		The index of the column to check
271
+     * @return bool				TRUE if column contains only images, FALSE otherwise
272
+     * @author [email protected]
273
+     */
274
+    private static function is_image_column(& $data, $column)
275 275
     {
276
-		$is_image = true;
277
-		foreach ($data as $index => & $row) {
278
-			$is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag
279
-			$is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values
280
-			if (!$is_image) {
281
-				break;
282
-			}
283
-		}
284
-		return $is_image;
285
-	}
276
+        $is_image = true;
277
+        foreach ($data as $index => & $row) {
278
+            $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag
279
+            $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values
280
+            if (!$is_image) {
281
+                break;
282
+            }
283
+        }
284
+        return $is_image;
285
+    }
286 286
 }
Please login to merge, or discard this patch.