Completed
Push — master ( d9c5eb...f66491 )
by Yannick
95:38 queued 65:24
created
main/inc/lib/message.lib.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $sql = "SELECT COUNT(id) as count 
57 57
                         FROM $table
58 58
                         WHERE
59
-                            user_receiver_id=" . api_get_user_id() . " AND
59
+                            user_receiver_id=".api_get_user_id()." AND
60 60
                             msg_status = " . MESSAGE_STATUS_UNREAD;
61 61
         $result = Database::query($sql);
62 62
         $row = Database::fetch_assoc($result);
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $table_message = Database::get_main_table(TABLE_MESSAGE);
87 87
         if ($unread) {
88
-            $condition_msg_status = ' msg_status = ' . MESSAGE_STATUS_UNREAD . ' ';
88
+            $condition_msg_status = ' msg_status = '.MESSAGE_STATUS_UNREAD.' ';
89 89
         } else {
90
-            $condition_msg_status = ' msg_status IN(' . MESSAGE_STATUS_NEW . ',' . MESSAGE_STATUS_UNREAD . ') ';
90
+            $condition_msg_status = ' msg_status IN('.MESSAGE_STATUS_NEW.','.MESSAGE_STATUS_UNREAD.') ';
91 91
         }
92 92
 
93 93
         $keyword = Session::read('message_search_keyword');
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $sql = "SELECT COUNT(id) as number_messages
101 101
                 FROM $table_message
102 102
                 WHERE $condition_msg_status AND
103
-                    user_receiver_id=" . api_get_user_id() . "
103
+                    user_receiver_id=".api_get_user_id()."
104 104
                     $keywordCondition
105 105
                 ";
106 106
         $result = Database::query($sql);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                     msg_status as col4
149 149
                 FROM $table_message
150 150
                 WHERE
151
-                  user_receiver_id=" . api_get_user_id() . " AND
151
+                  user_receiver_id=".api_get_user_id()." AND
152 152
                   msg_status IN (0,1)
153 153
                   $keywordCondition
154 154
                 ORDER BY col$column $direction
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
                 $link = '&f=social';
174 174
             }
175 175
             $userInfo = api_get_user_info($result[1]);
176
-            $message[1] = '<a ' . $class . ' href="view_message.php?id=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . $userInfo['complete_name'];
177
-            $message[3] = '<a href="new_message.php?re_id=' . $result[0] . $link . '">' .
178
-                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a>' .
179
-                '&nbsp;&nbsp;<a onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" href="inbox.php?action=deleteone&id=' . $result[0] . $link . '">' . Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
176
+            $message[1] = '<a '.$class.' href="view_message.php?id='.$result[0].$link.'">'.$result[2].'</a><br />'.$userInfo['complete_name'];
177
+            $message[3] = '<a href="new_message.php?re_id='.$result[0].$link.'">'.
178
+                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a>'.
179
+                '&nbsp;&nbsp;<a onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" href="inbox.php?action=deleteone&id='.$result[0].$link.'">'.Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
180 180
 
181 181
             $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
182 182
             foreach ($message as $key => $value) {
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
             //@todo it's possible to edit a message? yes, only for groups
282 282
             if ($edit_message_id) {
283 283
                 $query = " UPDATE $table_message SET
284
-                                update_date = '" . $now . "',
284
+                                update_date = '".$now."',
285 285
                                 content = '".Database::escape_string($content)."'
286 286
                            WHERE id = '$edit_message_id' ";
287 287
                 Database::query($query);
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                     $message = sprintf(
451 451
                             get_lang('CopyOfMessageSentToXUser'),
452 452
                             $userInfo['complete_name']
453
-                        ) . ' <br />' . $message;
453
+                        ).' <br />'.$message;
454 454
 
455 455
                     MessageManager::send_message_simple(
456 456
                         $drhInfo['user_id'],
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
         $row = Database::fetch_array($rs_msg_id);
499 499
 
500 500
         // update parent_id for other user receiver
501
-        $sql = "UPDATE $table_message SET parent_id = " . $row['id'] . "
501
+        $sql = "UPDATE $table_message SET parent_id = ".$row['id']."
502 502
                 WHERE id = $message_id";
503 503
         Database::query($sql);
504 504
     }
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
         $user_receiver_id = intval($user_receiver_id);
518 518
         $id = intval($id);
519 519
         $sql = "SELECT * FROM $table_message
520
-                WHERE id=" . $id . " AND msg_status<>4";
520
+                WHERE id=".$id." AND msg_status<>4";
521 521
         $rs = Database::query($sql);
522 522
 
523 523
         if (Database::num_rows($rs) > 0) {
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
             self::delete_message_attachment_file($id, $user_receiver_id);
526 526
             // delete message
527 527
             $query = "UPDATE $table_message SET msg_status=3
528
-                      WHERE user_receiver_id=" . $user_receiver_id . " AND id=" . $id;
528
+                      WHERE user_receiver_id=".$user_receiver_id." AND id=".$id;
529 529
             Database::query($query);
530 530
 
531 531
             return true;
@@ -614,13 +614,13 @@  discard block
 block discarded – undo
614 614
                 $path_user_info['dir'] = UserManager::getUserPathById($message_user_id, 'system');
615 615
             }
616 616
 
617
-            $path_message_attach = $path_user_info['dir'] . 'message_attachments/';
617
+            $path_message_attach = $path_user_info['dir'].'message_attachments/';
618 618
 
619 619
             // If this directory does not exist - we create it.
620 620
             if (!file_exists($path_message_attach)) {
621 621
                 @mkdir($path_message_attach, api_get_permissions_for_new_directories(), true);
622 622
             }
623
-            $new_path = $path_message_attach . $new_file_name;
623
+            $new_path = $path_message_attach.$new_file_name;
624 624
             if (is_uploaded_file($file_attach['tmp_name'])) {
625 625
                 @copy($file_attach['tmp_name'], $new_path);
626 626
             }
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
         while ($row = Database::fetch_array($rs)) {
656 656
             $path = $row['path'];
657 657
             $attach_id = $row['id'];
658
-            $new_path = $path . '_DELETED_' . $attach_id;
658
+            $new_path = $path.'_DELETED_'.$attach_id;
659 659
 
660 660
             if (!empty($group_id)) {
661 661
                 $userGroup = new UserGroup();
@@ -671,9 +671,9 @@  discard block
 block discarded – undo
671 671
                 );
672 672
             }
673 673
 
674
-            $path_message_attach = $path_user_info['dir'] . 'message_attachments/';
675
-            if (is_file($path_message_attach . $path)) {
676
-                if (rename($path_message_attach . $path, $path_message_attach . $new_path)) {
674
+            $path_message_attach = $path_user_info['dir'].'message_attachments/';
675
+            if (is_file($path_message_attach.$path)) {
676
+                if (rename($path_message_attach.$path, $path_message_attach.$new_path)) {
677 677
                     $sql = "UPDATE $table_message_attach set path='$new_path'
678 678
                             WHERE id ='$attach_id'";
679 679
                     Database::query($sql);
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
         $sql = "UPDATE $table_message SET msg_status = '0'
698 698
                 WHERE
699 699
                     msg_status<>4 AND
700
-                    user_receiver_id=" . intval($user_id) . " AND
701
-                    id='" . intval($message_id) . "'";
700
+                    user_receiver_id=".intval($user_id)." AND
701
+                    id='" . intval($message_id)."'";
702 702
         Database::query($sql);
703 703
     }
704 704
 
@@ -718,8 +718,8 @@  discard block
 block discarded – undo
718 718
         $sql = "UPDATE $table_message SET
719 719
                     msg_status = '$type'
720 720
                 WHERE
721
-                    user_receiver_id=" . intval($user_id) . " AND
722
-                    id='" . intval($message_id) . "'";
721
+                    user_receiver_id=".intval($user_id)." AND
722
+                    id='" . intval($message_id)."'";
723 723
         Database::query($sql);
724 724
     }
725 725
 
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
             return false;
736 736
         $table_message = Database::get_main_table(TABLE_MESSAGE);
737 737
         $query = "SELECT * FROM $table_message
738
-                  WHERE user_receiver_id=" . intval($user_id) . " AND id='" . intval($message_id) . "'";
738
+                  WHERE user_receiver_id=".intval($user_id)." AND id='".intval($message_id)."'";
739 739
         $result = Database::query($query);
740 740
 
741 741
         return $row = Database::fetch_array($result);
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
         $sql = "SELECT * FROM $table_message
758 758
                 WHERE
759 759
                     group_id= $group_id AND
760
-                    msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "')
760
+                    msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."')
761 761
                 ORDER BY id";
762 762
         $rs = Database::query($sql);
763 763
         $data = array();
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
         $sql = "SELECT * FROM $table_message
786 786
                 WHERE
787 787
                     group_id = $group_id AND
788
-                    msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "')
788
+                    msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."')
789 789
                 ORDER BY id ";
790 790
 
791 791
         $rs = Database::query($sql);
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
         $sql = "SELECT * FROM $table_message
835 835
                 WHERE
836 836
                     parent_id='$parent_id' AND
837
-                    msg_status <> " . MESSAGE_STATUS_OUTBOX . "
837
+                    msg_status <> ".MESSAGE_STATUS_OUTBOX."
838 838
                     $condition_group_id
839 839
                 ORDER BY send_date DESC $condition_limit ";
840 840
         $rs = Database::query($sql);
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
         $table_message = Database::get_main_table(TABLE_MESSAGE);
863 863
         $query = "SELECT id FROM $table_message
864 864
                   WHERE
865
-                    user_receiver_id = " . intval($user_id) . " AND
866
-                    id = '" . intval($id) . "'";
865
+                    user_receiver_id = ".intval($user_id)." AND
866
+                    id = '" . intval($id)."'";
867 867
         $result = Database::query($query);
868 868
         $num = Database::num_rows($result);
869 869
         if ($num > 0) {
@@ -911,8 +911,8 @@  discard block
 block discarded – undo
911 911
                     msg_status as col5
912 912
                 FROM $table_message
913 913
                 WHERE
914
-                    user_sender_id=" . api_get_user_id() . " AND
915
-                    msg_status=" . MESSAGE_STATUS_OUTBOX . "
914
+                    user_sender_id=".api_get_user_id()." AND
915
+                    msg_status=" . MESSAGE_STATUS_OUTBOX."
916 916
                     $keywordCondition
917 917
                 ORDER BY col$column $direction
918 918
                 LIMIT $from, $number_of_items";
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
         $message_list = array();
922 922
         while ($result = Database::fetch_row($sql_result)) {
923 923
             if ($request === true) {
924
-                $message[0] = '<input type="checkbox" value=' . $result[0] . ' name="out[]">';
924
+                $message[0] = '<input type="checkbox" value='.$result[0].' name="out[]">';
925 925
             } else {
926 926
                 $message[0] = ($result[0]);
927 927
             }
@@ -929,20 +929,20 @@  discard block
 block discarded – undo
929 929
             $result[2] = Security::remove_XSS($result[2]);
930 930
             $userInfo = api_get_user_info($result[4]);
931 931
             if ($request === true) {
932
-                $message[1] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . $userInfo['complete_name'] . '</a>';
933
-                $message[2] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . str_replace("\\", "", $result[2]) . '</a>';
932
+                $message[1] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.$userInfo['complete_name'].'</a>';
933
+                $message[2] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.str_replace("\\", "", $result[2]).'</a>';
934 934
                 $message[3] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
935
-                $message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox(' . $result[0] . ')" href="javascript:void(0)"  >' .
936
-                    Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
935
+                $message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox('.$result[0].')" href="javascript:void(0)"  >'.
936
+                    Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
937 937
             } else {
938 938
                 $link = '';
939 939
                 if (isset($_GET['f']) && $_GET['f'] == 'social') {
940 940
                     $link = '&f=social';
941 941
                 }
942
-                $message[1] = '<a ' . $class . ' onclick="show_sent_message (' . $result[0] . ')" href="../messages/view_message.php?id_send=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . $userInfo['complete_name'];
942
+                $message[1] = '<a '.$class.' onclick="show_sent_message ('.$result[0].')" href="../messages/view_message.php?id_send='.$result[0].$link.'">'.$result[2].'</a><br />'.$userInfo['complete_name'];
943 943
                 $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
944
-                $message[3] = '<a href="outbox.php?action=deleteone&id=' . $result[0] . '&' . $link . '"  onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" >' .
945
-                    Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
944
+                $message[3] = '<a href="outbox.php?action=deleteone&id='.$result[0].'&'.$link.'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" >'.
945
+                    Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
946 946
             }
947 947
 
948 948
             foreach ($message as $key => $value) {
@@ -975,8 +975,8 @@  discard block
 block discarded – undo
975 975
         $sql = "SELECT COUNT(id) as number_messages 
976 976
                 FROM $table_message
977 977
                 WHERE
978
-                  msg_status=" . MESSAGE_STATUS_OUTBOX . " AND
979
-                  user_sender_id=" . api_get_user_id() . "
978
+                  msg_status=".MESSAGE_STATUS_OUTBOX." AND
979
+                  user_sender_id=" . api_get_user_id()."
980 980
                   $keywordCondition
981 981
                 ";
982 982
         $result = Database::query($sql);
@@ -1001,25 +1001,25 @@  discard block
 block discarded – undo
1001 1001
             if (isset($message_id) && is_numeric($message_id)) {
1002 1002
                 $query = "SELECT * FROM $table_message
1003 1003
                           WHERE
1004
-                            user_sender_id = " . api_get_user_id() . " AND
1005
-                            id = " . $message_id . " AND
1004
+                            user_sender_id = ".api_get_user_id()." AND
1005
+                            id = " . $message_id." AND
1006 1006
                             msg_status = 4;";
1007 1007
                 $result = Database::query($query);
1008 1008
             }
1009 1009
         } else {
1010 1010
             if (is_numeric($message_id) && !empty($message_id)) {
1011 1011
                 $query = "UPDATE $table_message SET
1012
-                          msg_status = '" . MESSAGE_STATUS_NEW . "'
1012
+                          msg_status = '".MESSAGE_STATUS_NEW."'
1013 1013
                           WHERE
1014
-                            user_receiver_id=" . api_get_user_id() . " AND
1015
-                            id='" . $message_id . "'";
1014
+                            user_receiver_id=" . api_get_user_id()." AND
1015
+                            id='" . $message_id."'";
1016 1016
                 Database::query($query);
1017 1017
 
1018 1018
                 $query = "SELECT * FROM $table_message
1019 1019
                           WHERE
1020 1020
                             msg_status<>4 AND
1021
-                            user_receiver_id=" . api_get_user_id() . " AND
1022
-                            id='" . $message_id . "'";
1021
+                            user_receiver_id=".api_get_user_id()." AND
1022
+                            id='" . $message_id."'";
1023 1023
                 $result = Database::query($query);
1024 1024
             }
1025 1025
         }
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
                 $message_content .= '</div>';
1057 1057
 
1058 1058
                 $message_content .= '<div class="col-md-4">';
1059
-                $message_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> ';
1060
-                $message_content .= api_strtolower(get_lang('To')) . '&nbsp;<b>' . $receiverUserInfo['complete_name'];
1059
+                $message_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> ';
1060
+                $message_content .= api_strtolower(get_lang('To')).'&nbsp;<b>'.$receiverUserInfo['complete_name'];
1061 1061
                 $message_content .= '</div>';
1062 1062
 
1063 1063
                 $message_content .= '<div class="col-md-2 col-md-offset-5">';
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
                 $message_content .= '</div>';
1071 1071
 
1072 1072
                 $message_content .= '<div class="col-md-4">';
1073
-                $message_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> ';
1073
+                $message_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> ';
1074 1074
                 $message_content .= '</div>';
1075 1075
 
1076 1076
                 $message_content .= '<div class="col-md-2 col-md-offset-5">';
@@ -1080,9 +1080,9 @@  discard block
 block discarded – undo
1080 1080
             $message_content .= '</div>';
1081 1081
         } else {
1082 1082
             if ($source == 'outbox') {
1083
-                $message_content .= get_lang('From') . ':&nbsp;' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . $receiverUserInfo['complete_name'] . '</b>';
1083
+                $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.$receiverUserInfo['complete_name'].'</b>';
1084 1084
             } else {
1085
-                $message_content .= get_lang('From') . ':&nbsp;' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . get_lang('Me') . '</b>';
1085
+                $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b>';
1086 1086
             }
1087 1087
         }
1088 1088
         $message_content .= '
@@ -1090,26 +1090,26 @@  discard block
 block discarded – undo
1090 1090
 		        <hr style="color:#ddd" />
1091 1091
 		        <table width="100%">
1092 1092
 		            <tr>
1093
-		              <td valign=top class="view-message-content">' . str_replace("\\", "", $content) . '</td>
1093
+		              <td valign=top class="view-message-content">' . str_replace("\\", "", $content).'</td>
1094 1094
 		            </tr>
1095 1095
 		        </table>
1096
-		        <div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>
1096
+		        <div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>
1097 1097
 		        <div style="padding: 15px 0px 5px 0px">';
1098 1098
         $social_link = '';
1099 1099
         if (isset($_GET['f']) && $_GET['f'] == 'social') {
1100 1100
             $social_link = 'f=social';
1101 1101
         }
1102 1102
         if ($source == 'outbox') {
1103
-            $message_content .= '<a href="outbox.php?' . $social_link . '">' .
1104
-                Display::return_icon('back.png', get_lang('ReturnToOutbox')) . '</a> &nbsp';
1103
+            $message_content .= '<a href="outbox.php?'.$social_link.'">'.
1104
+                Display::return_icon('back.png', get_lang('ReturnToOutbox')).'</a> &nbsp';
1105 1105
         } else {
1106
-            $message_content .= '<a href="inbox.php?' . $social_link . '">' .
1107
-                Display::return_icon('back.png', get_lang('ReturnToInbox')) . '</a> &nbsp';
1108
-            $message_content .= '<a href="new_message.php?re_id=' . $message_id . '&' . $social_link . '">' .
1109
-                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a> &nbsp';
1106
+            $message_content .= '<a href="inbox.php?'.$social_link.'">'.
1107
+                Display::return_icon('back.png', get_lang('ReturnToInbox')).'</a> &nbsp';
1108
+            $message_content .= '<a href="new_message.php?re_id='.$message_id.'&'.$social_link.'">'.
1109
+                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a> &nbsp';
1110 1110
         }
1111
-        $message_content .= '<a href="inbox.php?action=deleteone&id=' . $message_id . '&' . $social_link . '" >' .
1112
-            Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>&nbsp';
1111
+        $message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'.
1112
+            Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp';
1113 1113
 
1114 1114
         $message_content .= '</div></td>
1115 1115
 		      <td width=10></td>
@@ -1127,8 +1127,8 @@  discard block
 block discarded – undo
1127 1127
     public static function get_user_id_by_email($user_email)
1128 1128
     {
1129 1129
         $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
1130
-        $sql = 'SELECT user_id FROM ' . $tbl_user . '
1131
-                WHERE email="' . Database::escape_string($user_email) . '";';
1130
+        $sql = 'SELECT user_id FROM '.$tbl_user.'
1131
+                WHERE email="' . Database::escape_string($user_email).'";';
1132 1132
         $rs = Database::query($sql);
1133 1133
         $row = Database::fetch_array($rs, 'ASSOC');
1134 1134
         if (isset($row['user_id'])) {
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 
1189 1189
                 $items = $topic['count'];
1190 1190
                 $reply_label = ($items == 1) ? get_lang('GroupReply') : get_lang('GroupReplies');
1191
-                $label = '<i class="fa fa-envelope"></i> ' . $items . ' ' . $reply_label;
1191
+                $label = '<i class="fa fa-envelope"></i> '.$items.' '.$reply_label;
1192 1192
                 $topic['title'] = trim($topic['title']);
1193 1193
 
1194 1194
                 if (empty($topic['title'])) {
@@ -1200,31 +1200,31 @@  discard block
 block discarded – undo
1200 1200
                     'h4',
1201 1201
                     Display::url(
1202 1202
                         Security::remove_XSS($topic['title'], STUDENT, true),
1203
-                        api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?id=' . $group_id . '&topic_id=' . $topic['id']
1203
+                        api_get_path(WEB_CODE_PATH).'social/group_topics.php?id='.$group_id.'&topic_id='.$topic['id']
1204 1204
                     ), array('class' => 'title')
1205 1205
                 );
1206 1206
                 $actions = '';
1207 1207
                 if ($my_group_role == GROUP_USER_PERMISSION_ADMIN ||
1208 1208
                     $my_group_role == GROUP_USER_PERMISSION_MODERATOR
1209 1209
                 ) {
1210
-                    $actions = '<br />' . Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic['id'], array('class' => 'btn btn-default'));
1210
+                    $actions = '<br />'.Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH).'social/group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic['id'], array('class' => 'btn btn-default'));
1211 1211
                 }
1212 1212
 
1213 1213
                 $date = '';
1214 1214
                 if ($topic['send_date'] != $topic['update_date']) {
1215 1215
                     if (!empty($topic['update_date'])) {
1216
-                        $date .= '<i class="fa fa-calendar"></i> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']);
1216
+                        $date .= '<i class="fa fa-calendar"></i> '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']);
1217 1217
                     }
1218 1218
                 } else {
1219
-                    $date .= '<i class="fa fa-calendar"></i> ' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']);
1219
+                    $date .= '<i class="fa fa-calendar"></i> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']);
1220 1220
                 }
1221
-                $html .= '<div class="date">' . $label . ' - ' . $date . $actions . '</div>';
1221
+                $html .= '<div class="date">'.$label.' - '.$date.$actions.'</div>';
1222 1222
                 $html .= '</div>';
1223 1223
 
1224 1224
                 $image = $user_sender_info['avatar'];
1225 1225
 
1226
-                $user_info = '<div class="author"><img class="img-responsive img-circle" src="' . $image . '" alt="' . $name . '"  width="64" height="64" title="' . $name . '" /></div>';
1227
-                $user_info .= '<div class="name"><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . '&nbsp;</a></div>';
1226
+                $user_info = '<div class="author"><img class="img-responsive img-circle" src="'.$image.'" alt="'.$name.'"  width="64" height="64" title="'.$name.'" /></div>';
1227
+                $user_info .= '<div class="name"><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a></div>';
1228 1228
 
1229 1229
                 $html .= '<div class="col-xs-4 col-md-2">';
1230 1230
                 $html .= $user_info;
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
                 'group_id' => $group_id,
1303 1303
                 'message_id' => $main_message['id'],
1304 1304
                 'action' => 'edit_message_group',
1305
-                'anchor_topic' => 'topic_' . $main_message['id'],
1305
+                'anchor_topic' => 'topic_'.$main_message['id'],
1306 1306
                 'topics_page_nr' => $topic_page_nr,
1307 1307
                 'items_page_nr' => $items_page_nr,
1308 1308
                 'topic_id' => $main_message['id']
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
             if (api_is_platform_admin()) {
1311 1311
                 $links .= Display::url(
1312 1312
                     Display::returnFontAwesomeIcon('trash'),
1313
-                    'group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic_id,
1313
+                    'group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic_id,
1314 1314
                     [
1315 1315
                         'class' => 'btn btn-default'
1316 1316
                     ]
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
             'group_id' => $group_id,
1336 1336
             'message_id' => $main_message['id'],
1337 1337
             'action' => 'reply_message_group',
1338
-            'anchor_topic' => 'topic_' . $main_message['id'],
1338
+            'anchor_topic' => 'topic_'.$main_message['id'],
1339 1339
             'topics_page_nr' => $topic_page_nr,
1340 1340
             'topic_id' => $main_message['id']
1341 1341
         ]);
@@ -1353,31 +1353,31 @@  discard block
 block discarded – undo
1353 1353
         $links .= '</div>';
1354 1354
         $links .= '</div>';
1355 1355
 
1356
-        $title = '<h4>' . Security::remove_XSS($main_message['title'], STUDENT, true) . $links . '</h4>';
1356
+        $title = '<h4>'.Security::remove_XSS($main_message['title'], STUDENT, true).$links.'</h4>';
1357 1357
 
1358 1358
         $userPicture = $user_sender_info['avatar'];
1359 1359
         $main_content .= '<div class="row">';
1360 1360
         $main_content .= '<div class="col-md-2">';
1361 1361
         $main_content .= '<div class="avatar-author">';
1362
-        $main_content .= '<img width="60px" src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle" title="' . $name . '" />';
1362
+        $main_content .= '<img width="60px" src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" title="'.$name.'" />';
1363 1363
         $main_content .= '</div>';
1364 1364
         $main_content .= '</div>';
1365 1365
 
1366 1366
         $date = '';
1367 1367
         if ($main_message['send_date'] != $main_message['update_date']) {
1368 1368
             if (!empty($main_message['update_date'])) {
1369
-                $date = '<div class="date"> '. Display::returnFontAwesomeIcon('calendar') .' ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($main_message['update_date']) . '</div>';
1369
+                $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('LastUpdate').' '.date_to_str_ago($main_message['update_date']).'</div>';
1370 1370
             }
1371 1371
         } else {
1372
-            $date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') .' ' . get_lang('Created') . ' ' . date_to_str_ago($main_message['send_date']) . '</div>';
1372
+            $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>';
1373 1373
         }
1374
-        $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>';
1374
+        $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1375 1375
         $main_content .= '<div class="col-md-10">';
1376
-        $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $main_message['user_sender_id'] . '">' . $name . '</a>';
1376
+        $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'</a>';
1377 1377
         $main_content .= '<div class="message-content"> ';
1378
-        $main_content .= '<div class="username">' . $user_link . '</div>';
1379
-        $main_content .= $date ;
1380
-        $main_content .= '<div class="message">'. $main_message['content'] . $attachment . '</div></div>';
1378
+        $main_content .= '<div class="username">'.$user_link.'</div>';
1379
+        $main_content .= $date;
1380
+        $main_content .= '<div class="message">'.$main_message['content'].$attachment.'</div></div>';
1381 1381
         $main_content .= '</div>';
1382 1382
         $main_content .= '</div>';
1383 1383
 
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
                 if (empty($topic['id'])) {
1399 1399
                     continue;
1400 1400
                 }
1401
-                $items_page_nr = isset($_GET['items_' . $topic['id'] . '_page_nr']) ? intval($_GET['items_' . $topic['id'] . '_page_nr']) : null;
1401
+                $items_page_nr = isset($_GET['items_'.$topic['id'].'_page_nr']) ? intval($_GET['items_'.$topic['id'].'_page_nr']) : null;
1402 1402
                 $links = '';
1403 1403
                 $links .= '<div class="pull-right">';
1404 1404
                 $html_items = '';
@@ -1408,36 +1408,36 @@  discard block
 block discarded – undo
1408 1408
 
1409 1409
                 $links .= '<div class="btn-group btn-group-sm">';
1410 1410
                 if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) {
1411
-                    $links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=edit_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Edit') . '" title="' . get_lang('Edit') . '">' .
1412
-                        Display::returnFontAwesomeIcon('pencil') . '</a>';
1411
+                    $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
1412
+                        Display::returnFontAwesomeIcon('pencil').'</a>';
1413 1413
                 }
1414
-                $links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=reply_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Reply') . '" title="' . get_lang('Reply') . '">';
1415
-                $links .= Display::returnFontAwesomeIcon('commenting') . '</a>';
1414
+                $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
1415
+                $links .= Display::returnFontAwesomeIcon('commenting').'</a>';
1416 1416
                 $links .= '</div>';
1417 1417
                 $links .= '</div>';
1418 1418
 
1419 1419
                 $userPicture = $user_sender_info['avatar'];
1420
-                $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . '&nbsp</a>';
1420
+                $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp</a>';
1421 1421
                 $html_items .= '<div class="row">';
1422 1422
                 $html_items .= '<div class="col-md-2">';
1423
-                $html_items .= '<div class="avatar-author"><img width="60px" src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle" title="' . $name . '" /></div>';
1423
+                $html_items .= '<div class="avatar-author"><img width="60px" src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" title="'.$name.'" /></div>';
1424 1424
                 $html_items .= '</div>';
1425 1425
 
1426 1426
                 $date = '';
1427 1427
                 if ($topic['send_date'] != $topic['update_date']) {
1428 1428
                     if (!empty($topic['update_date'])) {
1429
-                        $date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') .' '. get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']) . '</div>';
1429
+                        $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</div>';
1430 1430
                     }
1431 1431
                 } else {
1432
-                    $date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']) . '</div>';
1432
+                    $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>';
1433 1433
                 }
1434
-                $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>';
1434
+                $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1435 1435
                 $html_items .= '<div class="col-md-10">';
1436 1436
                 $html_items .= '<div class="message-content">';
1437 1437
                 $html_items .= $links;
1438
-                $html_items .= '<div class="username">' . $user_link . '</div>';
1438
+                $html_items .= '<div class="username">'.$user_link.'</div>';
1439 1439
                 $html_items .= $date;
1440
-                $html_items .=  '<div class="message">' . Security::remove_XSS($topic['content'], STUDENT, true) . '</div>' . $attachment . '</div>';
1440
+                $html_items .= '<div class="message">'.Security::remove_XSS($topic['content'], STUDENT, true).'</div>'.$attachment.'</div>';
1441 1441
                 $html_items .= '</div>';
1442 1442
                 $html_items .= '</div>';
1443 1443
 
@@ -1449,8 +1449,8 @@  discard block
 block discarded – undo
1449 1449
                     $indent = intval($topic['indent_cnt']) * $base_padding + $base_padding;
1450 1450
                 }
1451 1451
 
1452
-                $html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_' . $topic['id']));
1453
-                $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:' . $indent . 'px'));
1452
+                $html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_'.$topic['id']));
1453
+                $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:'.$indent.'px'));
1454 1454
                 $array_html_items[] = array($html_items);
1455 1455
             }
1456 1456
             // grids for items with paginations
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
             );
1464 1464
             if (!empty($array_html_items)) {
1465 1465
                 $html .= Display::return_sortable_grid(
1466
-                    'items_' . $topic['id'],
1466
+                    'items_'.$topic['id'],
1467 1467
                     array(),
1468 1468
                     $array_html_items,
1469 1469
                     $options,
@@ -1554,14 +1554,14 @@  discard block
 block discarded – undo
1554 1554
             $rs_file = Database::query($sql);
1555 1555
             if (Database::num_rows($rs_file) > 0) {
1556 1556
                 $attach_icon = Display::return_icon('attachment.gif', '');
1557
-                $archiveURL = api_get_path(WEB_CODE_PATH) . 'messages/download.php?type=' . $type . '&file=';
1557
+                $archiveURL = api_get_path(WEB_CODE_PATH).'messages/download.php?type='.$type.'&file=';
1558 1558
                 while ($row_file = Database::fetch_array($rs_file)) {
1559 1559
                     $archiveFile = $row_file['path'];
1560 1560
                     $filename = $row_file['filename'];
1561 1561
                     $filesize = format_file_size($row_file['size']);
1562 1562
                     $filecomment = Security::remove_XSS($row_file['comment']);
1563 1563
                     $filename = Security::remove_XSS($filename);
1564
-                    $links_attach_file[] = $attach_icon . '&nbsp;<a href="' . $archiveURL . $archiveFile . '">' . $filename . '</a>&nbsp;(' . $filesize . ')' . (!empty($filecomment) ? '&nbsp;-&nbsp;<i>' . $filecomment . '</i>' : '');
1564
+                    $links_attach_file[] = $attach_icon.'&nbsp;<a href="'.$archiveURL.$archiveFile.'">'.$filename.'</a>&nbsp;('.$filesize.')'.(!empty($filecomment) ? '&nbsp;-&nbsp;<i>'.$filecomment.'</i>' : '');
1565 1565
                 }
1566 1566
             }
1567 1567
         }
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
         $sql = "SELECT * FROM $tbl_message
1581 1581
                 WHERE 
1582 1582
                     id = '$message_id' AND 
1583
-                    msg_status <> '" . MESSAGE_STATUS_DELETED . "' ";
1583
+                    msg_status <> '".MESSAGE_STATUS_DELETED."' ";
1584 1584
         $res = Database::query($sql);
1585 1585
         $item = array();
1586 1586
         if (Database::num_rows($res) > 0) {
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 
1709 1709
         Session::write('message_sent_search_keyword', $keyword);
1710 1710
 
1711
-        $success = get_lang('SelectedMessagesDeleted') . '&nbsp</b><br /><a href="outbox.php?' . $social_link . '">' . get_lang('BackToOutbox') . '</a>';
1711
+        $success = get_lang('SelectedMessagesDeleted').'&nbsp</b><br /><a href="outbox.php?'.$social_link.'">'.get_lang('BackToOutbox').'</a>';
1712 1712
 
1713 1713
         $html = null;
1714 1714
         if (isset($_REQUEST['action'])) {
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
                 ON m.user_sender_id = u.user_id
1817 1817
                 WHERE
1818 1818
                     m.user_receiver_id = $userId AND
1819
-                    m.msg_status = " . MESSAGE_STATUS_UNREAD . "
1819
+                    m.msg_status = ".MESSAGE_STATUS_UNREAD."
1820 1820
                     AND m.id > $lastId
1821 1821
                 ORDER BY m.send_date DESC";
1822 1822
 
@@ -1888,11 +1888,11 @@  discard block
 block discarded – undo
1888 1888
         $tplMailBody = new Template(null, false, false, false, false, false, false);
1889 1889
         $tplMailBody->assign('user', $user);
1890 1890
         $tplMailBody->assign('is_western_name_order', api_is_western_name_order());
1891
-        $tplMailBody->assign('manageUrl', api_get_path(WEB_CODE_PATH) . 'admin/user_edit.php?user_id=' . $user->getId());
1891
+        $tplMailBody->assign('manageUrl', api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user->getId());
1892 1892
 
1893 1893
         $layoutContent = $tplMailBody->get_template('mail/new_user_mail_to_admin.tpl');
1894 1894
 
1895
-        $emailsubject = '[' . get_lang('UserRegistered') . '] ' . $user->getUsername();
1895
+        $emailsubject = '['.get_lang('UserRegistered').'] '.$user->getUsername();
1896 1896
         $emailbody = $tplMailBody->fetch($layoutContent);
1897 1897
 
1898 1898
         $admins = UserManager::get_all_administrators();
@@ -1923,8 +1923,8 @@  discard block
 block discarded – undo
1923 1923
      */
1924 1924
     public static function failedSentMailErrors()
1925 1925
     {
1926
-        $base = api_get_path(SYS_ARCHIVE_PATH) . 'mail/';
1927
-        $mailq = $base . 'mailq';
1926
+        $base = api_get_path(SYS_ARCHIVE_PATH).'mail/';
1927
+        $mailq = $base.'mailq';
1928 1928
 
1929 1929
         if (!file_exists($mailq) || !is_readable($mailq)) {
1930 1930
             return false;
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
                 $mail_queue[$i]['code'] = $codeMatches[2];
1946 1946
             }
1947 1947
 
1948
-            $fullMail = $base . $mail_queue[$i]['code'];
1948
+            $fullMail = $base.$mail_queue[$i]['code'];
1949 1949
             $mailFile = fopen($fullMail, 'r');
1950 1950
 
1951 1951
             //Get the reason of mail fail
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
 
1969 1969
             //Get the time of mail fail
1970 1970
             if (preg_match('/^\s?(\d+)(\D+)\s+(.*)$/', $line, $timeMatches)) {
1971
-                $mail_queue[$i]['time'] = $timeMatches[1] . $timeMatches[2];
1971
+                $mail_queue[$i]['time'] = $timeMatches[1].$timeMatches[2];
1972 1972
             } elseif (preg_match('/^(\s+)((.*)@(.*))\s+(.*)$/', $line, $emailMatches)) {
1973 1973
                 $mail_queue[$i]['mail'] = $emailMatches[2];
1974 1974
                 $i++;
Please login to merge, or discard this patch.
main/inc/lib/banner.lib.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
     // My Profile
53
-    $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
53
+    $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '');
54 54
     $navigation['myprofile']['title'] = get_lang('ModifyProfile');
55 55
     $navigation['myprofile']['key'] = 'profile';
56 56
     $navigation['myprofile']['icon'] = 'profile.png';
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 	// Gradebook
64 64
 	if (api_get_setting('gradebook_enable') == 'true') {
65
-        $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '' );
65
+        $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&amp;courseCode='.$_course['official_code'] : '');
66 66
         $navigation['mygradebook']['title'] = get_lang('MyGradebook');
67 67
         $navigation['mygradebook']['key'] = 'gradebook';
68 68
         $navigation['mygradebook']['icon'] = 'gradebook.png';
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 	// Reporting
72 72
 	if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) {
73 73
         // Link to my space
74
-        $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh()?'session.php':'');
74
+        $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh() ? 'session.php' : '');
75 75
         $navigation['session_my_space']['title'] = get_lang('MySpace');
76 76
         $navigation['session_my_space']['key'] = 'my-space';
77 77
         $navigation['session_my_space']['icon'] = 'my-space.png';
78 78
     } else if (api_is_student_boss()) {
79
-        $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH) . 'mySpace/student.php';
79
+        $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/student.php';
80 80
         $navigation['session_my_space']['title'] = get_lang('MySpace');
81 81
         $navigation['session_my_space']['key'] = 'my-space';
82 82
         $navigation['session_my_space']['icon'] = 'my-space.png';
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     }
98 98
 
99 99
 	// Social
100
-	if (api_get_setting('allow_social_tool')=='true') {
100
+	if (api_get_setting('allow_social_tool') == 'true') {
101 101
         $navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/home.php';
102 102
         $navigation['social']['title'] = get_lang('SocialNetwork');
103 103
         $navigation['social']['key'] = 'social-network';
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     $_course = api_get_course_info();
194 194
     $course_id = 0;
195 195
     if (!empty($_course)) {
196
-        $course_id  = $_course['code'];
196
+        $course_id = $_course['code'];
197 197
     }
198 198
 
199 199
     $user_id = api_get_user_id();
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function return_navigation_array()
247 247
 {
248
-    return ;
248
+    return;
249 249
     $navigation = array();
250 250
     $menu_navigation = array();
251 251
     $possible_tabs = get_tabs();
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
     $pageContent = '';
420 420
     // Get the extra page content, containing the links to add to the tabs
421 421
     if (is_file($homepath.$menuTabs.'_'.$lang.$ext) && is_readable($homepath.$menuTabs.'_'.$lang.$ext)) {
422
-        $pageContent = @(string) file_get_contents($homepath . $menuTabs . '_' . $lang . $ext);
422
+        $pageContent = @(string) file_get_contents($homepath.$menuTabs.'_'.$lang.$ext);
423 423
     } elseif (is_file($homepath.$menuTabs.$lang.$ext) && is_readable($homepath.$menuTabs.$lang.$ext)) {
424
-        $pageContent = @(string) file_get_contents($homepath . $menuTabs . $lang . $ext);
424
+        $pageContent = @(string) file_get_contents($homepath.$menuTabs.$lang.$ext);
425 425
     }
426 426
     // Sanitize page content
427 427
     $pageContent = api_to_system_encoding($pageContent, api_detect_encoding(strip_tags($pageContent)));
@@ -431,22 +431,22 @@  discard block
 block discarded – undo
431 431
     //  that are only for users already logged in
432 432
     $openMenuTabsLoggedIn = '';
433 433
     if (api_get_user_id() && !api_is_anonymous()) {
434
-        if (is_file($homepath . $menuTabsLoggedIn . '_' . $lang . $ext) && is_readable($homepath . $menuTabsLoggedIn . '_' . $lang . $ext)) {
435
-            $pageContent = @(string) file_get_contents($homepath . $menuTabsLoggedIn . '_' . $lang . $ext);
434
+        if (is_file($homepath.$menuTabsLoggedIn.'_'.$lang.$ext) && is_readable($homepath.$menuTabsLoggedIn.'_'.$lang.$ext)) {
435
+            $pageContent = @(string) file_get_contents($homepath.$menuTabsLoggedIn.'_'.$lang.$ext);
436 436
             $pageContent = str_replace('::private', '', $pageContent);
437
-        } elseif (is_file($homepath . $menuTabsLoggedIn . $lang . $ext) && is_readable($homepath . $menuTabsLoggedIn . $lang . $ext)) {
438
-            $pageContent = @(string) file_get_contents($homepath . $menuTabsLoggedIn . $lang . $ext);
437
+        } elseif (is_file($homepath.$menuTabsLoggedIn.$lang.$ext) && is_readable($homepath.$menuTabsLoggedIn.$lang.$ext)) {
438
+            $pageContent = @(string) file_get_contents($homepath.$menuTabsLoggedIn.$lang.$ext);
439 439
             $pageContent = str_replace('::private', '', $pageContent);
440 440
         }
441 441
 
442 442
         $pageContent = api_to_system_encoding($pageContent, api_detect_encoding(strip_tags($pageContent)));
443
-        $openMenuTabsLoggedIn = str_replace('{rel_path}',api_get_path(REL_PATH), $pageContent);
443
+        $openMenuTabsLoggedIn = str_replace('{rel_path}', api_get_path(REL_PATH), $pageContent);
444 444
         $openMenuTabsLoggedIn = api_to_system_encoding($openMenuTabsLoggedIn, api_detect_encoding(strip_tags($openMenuTabsLoggedIn)));
445 445
     }
446 446
     if (!empty($open) || !empty($openMenuTabsLoggedIn)) {
447 447
         if (strpos($open.$openMenuTabsLoggedIn, 'show_menu') === false) {
448 448
             if (api_is_anonymous()) {
449
-                $mainNavigation['navigation'][SECTION_CAMPUS]  = null;
449
+                $mainNavigation['navigation'][SECTION_CAMPUS] = null;
450 450
             }
451 451
         } else {
452 452
             if (api_get_user_id() && !api_is_anonymous()) {
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
                             'url' => $matches[1],
460 460
                             'target' => $matches[2],
461 461
                             'title' => $matches[3],
462
-                            'key' => 'page-' . str_replace(' ', '-', strtolower($matches[3]))
462
+                            'key' => 'page-'.str_replace(' ', '-', strtolower($matches[3]))
463 463
                         );
464 464
                     }
465 465
                 }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
                             'url' => $matches[1],
474 474
                             'target' => $matches[2],
475 475
                             'title' => $matches[3],
476
-                            'key' => 'page-' . str_replace(' ', '-', strtolower($matches[3]))
476
+                            'key' => 'page-'.str_replace(' ', '-', strtolower($matches[3]))
477 477
                         );
478 478
                     }
479 479
                 }
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
         //$pre_lis = '';
486 486
         $activeSection = '';
487 487
         foreach ($mainNavigation['navigation'] as $section => $navigation_info) {
488
-            $key = (!empty($navigation_info['key'])?'tab-'.$navigation_info['key']:'');
488
+            $key = (!empty($navigation_info['key']) ? 'tab-'.$navigation_info['key'] : '');
489 489
 
490 490
             if (isset($GLOBALS['this_section'])) {
491 491
                 $tempSection = $section;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
                 // loaded
500 500
                 if ($GLOBALS['this_section'] == SECTION_CAMPUS) {
501 501
                     if (!empty($_GET['include'])) {
502
-                        $name = str_replace(' ', '-', strtolower($navigation_info['title'])) . '_' . $lang . $ext;
502
+                        $name = str_replace(' ', '-', strtolower($navigation_info['title'])).'_'.$lang.$ext;
503 503
                         if (strtolower($_GET['include']) == $name) {
504 504
                             $activeSection = $section;
505 505
                         }
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 
552 552
     if (!empty($_course) && !isset($_GET['hide_course_breadcrumb'])) {
553 553
 
554
-        $navigation_item['url'] = $web_course_path . $_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
554
+        $navigation_item['url'] = $web_course_path.$_course['path'].'/index.php'.(!empty($session_id) ? '?id_session='.$session_id : '');
555 555
         $_course['name'] = api_htmlentities($_course['name']);
556 556
         $course_title = cut($_course['name'], MAX_LENGTH_BREADCRUMB);
557 557
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                 $navigation_item['title'] = Display::img(api_get_path(WEB_IMG_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
567 567
                 break;
568 568
             default:
569
-                if (api_get_session_id() != -1 ) {
569
+                if (api_get_session_id() != -1) {
570 570
                     $navigation_item['title'] = Display::img(api_get_path(WEB_IMG_PATH).'home.png', $_course['name'].$my_session_name).' '.$course_title.$my_session_name;
571 571
                 } else {
572 572
                     $navigation_item['title'] = Display::img(api_get_path(WEB_IMG_PATH).'home.png', $_course['name']).' '.$course_title;
@@ -686,35 +686,35 @@  discard block
 block discarded – undo
686 686
         if (!empty($final_navigation)) {
687 687
             // $home_link.= '<span class="divider">/</span>';
688 688
             if (!empty($home_link)) {
689
-                $lis.= Display::tag('li', $home_link);
689
+                $lis .= Display::tag('li', $home_link);
690 690
             }
691 691
 
692 692
             foreach ($final_navigation as $bread) {
693 693
                 $bread_check = trim(strip_tags($bread));
694 694
                 if (!empty($bread_check)) {
695
-                    if ($final_navigation_count-1 > $i) {
695
+                    if ($final_navigation_count - 1 > $i) {
696 696
                         $bread .= '';
697 697
                     }
698
-                    $lis.= Display::tag('li', $bread, array('class'=>'active'));
698
+                    $lis .= Display::tag('li', $bread, array('class'=>'active'));
699 699
                     $i++;
700 700
                 }
701 701
             }
702 702
         } else {
703 703
             if (!empty($home_link)) {
704
-                $lis.= Display::tag('li', $home_link);
704
+                $lis .= Display::tag('li', $home_link);
705 705
             }
706 706
         }
707 707
 
708 708
         // View as student/teacher link
709 709
         $view = null;
710 710
         if (!empty($view_as_student_link)) {
711
-            $view .= Display::tag('div', $view_as_student_link, array('id' => 'view_as_link','class' => 'pull-right'));
711
+            $view .= Display::tag('div', $view_as_student_link, array('id' => 'view_as_link', 'class' => 'pull-right'));
712 712
         }
713 713
 
714 714
         if (!empty($navigation_right)) {
715
-            foreach($navigation_right as $item) {
715
+            foreach ($navigation_right as $item) {
716 716
                 $extra_class = isset($item['class']) ? $item['class'] : null;
717
-                $lis.= Display::tag('li', $item['title'], array('class' => $extra_class.' pull-right'));
717
+                $lis .= Display::tag('li', $item['title'], array('class' => $extra_class.' pull-right'));
718 718
             }
719 719
         }
720 720
 
Please login to merge, or discard this patch.