Completed
Pull Request — 1.10.x (#1225)
by Angel Fernando Quiroz
79:09 queued 38:30
created
main/inc/lib/CourseChatUtils.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
 
1416 1416
     /**
1417 1417
      * Get the emoji list to include in chat
1418
-     * @return array
1418
+     * @return string[]
1419 1419
      */
1420 1420
     public static function getEmojisToInclude()
1421 1421
     {
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
 
1739 1739
     /**
1740 1740
      * Get the number of users connected in chat
1741
-     * @return mixed
1741
+     * @return integer
1742 1742
      */
1743 1743
     public function countUsersOnline()
1744 1744
     {
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             return '';
70 70
         }
71 71
 
72
-        Emojione\Emojione::$imagePathPNG = api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/png/';
72
+        Emojione\Emojione::$imagePathPNG = api_get_path(WEB_LIBRARY_PATH).'javascript/emojione/png/';
73 73
         Emojione\Emojione::$ascii = true;
74 74
 
75 75
         $message = trim($message);
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
         $user = $em->find('ChamiloUserBundle:User', $this->userId);
103 103
         $courseInfo = api_get_course_info_by_id($this->courseId);
104 104
         $isMaster = (bool) api_is_course_admin();
105
-        $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
105
+        $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
106 106
         $basepath_chat = '/chat_files';
107 107
 
108 108
         if (!$this->groupId) {
109 109
             $group_info = GroupManager::get_group_properties($this->groupId);
110
-            $basepath_chat = $group_info['directory'] . '/chat_files';
110
+            $basepath_chat = $group_info['directory'].'/chat_files';
111 111
         }
112 112
 
113
-        $chat_path = $document_path . $basepath_chat . '/';
113
+        $chat_path = $document_path.$basepath_chat.'/';
114 114
 
115 115
         if (!is_dir($chat_path)) {
116 116
             if (is_file($chat_path)) {
@@ -120,25 +120,25 @@  discard block
 block discarded – undo
120 120
 
121 121
         $date_now = date('Y-m-d');
122 122
         $timeNow = date('d/m/y H:i:s');
123
-        $basename_chat = 'messages-' . $date_now;
123
+        $basename_chat = 'messages-'.$date_now;
124 124
 
125 125
         if ($this->groupId && !$friendId) {
126
-            $basename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId;
126
+            $basename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId;
127 127
         } elseif ($this->sessionId && !$friendId) {
128
-            $basename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId;
128
+            $basename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId;
129 129
         } elseif ($friendId) {
130 130
             if ($this->userId < $friendId) {
131
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId;
131
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId;
132 132
             } else {
133
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId;
133
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId;
134 134
             }
135 135
         }
136 136
 
137 137
         $message = self::prepareMessage($message);
138 138
 
139
-        $fileTitle = $basename_chat . '.log.html';
140
-        $filePath = $basepath_chat . '/' . $fileTitle;
141
-        $absoluteFilePath = $chat_path . $fileTitle;
139
+        $fileTitle = $basename_chat.'.log.html';
140
+        $filePath = $basepath_chat.'/'.$fileTitle;
141
+        $absoluteFilePath = $chat_path.$fileTitle;
142 142
 
143 143
         if (!file_exists($absoluteFilePath)) {
144 144
             $doc_id = add_document($courseInfo, $filePath, 'file', 0, $fileTitle);
@@ -171,23 +171,23 @@  discard block
 block discarded – undo
171 171
             $fileContent = '
172 172
                 <div class="message-teacher">
173 173
                     <div class="content-message">
174
-                        <div class="chat-message-block-name">' . $user->getCompleteName() . '</div>
175
-                        <div class="chat-message-block-content">' . $message . '</div>
176
-                        <div class="message-date">' . $timeNow . '</div>
174
+                        <div class="chat-message-block-name">' . $user->getCompleteName().'</div>
175
+                        <div class="chat-message-block-content">' . $message.'</div>
176
+                        <div class="message-date">' . $timeNow.'</div>
177 177
                     </div>
178 178
                     <div class="icon-message"></div>
179
-                    <img class="chat-image" src="' . $userPhoto . '">
179
+                    <img class="chat-image" src="' . $userPhoto.'">
180 180
                 </div>
181 181
             ';
182 182
         } else {
183 183
             $fileContent = '
184 184
                 <div class="message-student">
185
-                    <img class="chat-image" src="' . $userPhoto . '">
185
+                    <img class="chat-image" src="' . $userPhoto.'">
186 186
                     <div class="icon-message"></div>
187 187
                     <div class="content-message">
188
-                        <div class="chat-message-block-name">' . $user->getCompleteName() . '</div>
189
-                        <div class="chat-message-block-content">' . $message . '</div>
190
-                        <div class="message-date">' . $timeNow . '</div>
188
+                        <div class="chat-message-block-name">' . $user->getCompleteName().'</div>
189
+                        <div class="chat-message-block-content">' . $message.'</div>
190
+                        <div class="message-date">' . $timeNow.'</div>
191 191
                     </div>
192 192
                 </div>
193 193
             ';
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
         $extraCondition = null;
283 283
 
284 284
         if ($this->groupId) {
285
-            $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId);
285
+            $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId);
286 286
         } else {
287
-            $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId);
287
+            $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId);
288 288
         }
289 289
 
290 290
         $currentTime = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
     {
1421 1421
         return [
1422 1422
             ':bowtie:',
1423
-            ':smile:'|
1423
+            ':smile:' |
1424 1424
             ':laughing:',
1425 1425
             ':blush:',
1426 1426
             ':smiley:',
@@ -1494,17 +1494,17 @@  discard block
 block discarded – undo
1494 1494
     {
1495 1495
         $date = date('Y-m-d');
1496 1496
 
1497
-        $base = 'messages-' . $date . '.log.html';
1497
+        $base = 'messages-'.$date.'.log.html';
1498 1498
 
1499 1499
         if ($this->groupId && !$friendId) {
1500
-            $base = 'messages-' . $date . '_gid-' . $this->groupId . '.log.html';
1500
+            $base = 'messages-'.$date.'_gid-'.$this->groupId.'.log.html';
1501 1501
         } elseif ($this->sessionId && !$friendId) {
1502
-            $base = 'messages-' . $date . '_sid-' . $this->sessionId . '.log.html';
1502
+            $base = 'messages-'.$date.'_sid-'.$this->sessionId.'.log.html';
1503 1503
         } elseif ($friendId) {
1504 1504
             if ($this->userId < $friendId) {
1505
-                $base = 'messages-' . $date . '_uid-' . $this->userId . '-' . $friendId . '.log.html';
1505
+                $base = 'messages-'.$date.'_uid-'.$this->userId.'-'.$friendId.'.log.html';
1506 1506
             } else {
1507
-                $base = 'messages-' . $date . '_uid-' . $friendId . '-' . $this->userId . '.log.html';
1507
+                $base = 'messages-'.$date.'_uid-'.$friendId.'-'.$this->userId.'.log.html';
1508 1508
             }
1509 1509
         }
1510 1510
 
@@ -1513,16 +1513,16 @@  discard block
 block discarded – undo
1513 1513
         }
1514 1514
 
1515 1515
         $courseInfo = api_get_course_info_by_id($this->courseId);
1516
-        $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
1516
+        $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
1517 1517
 
1518
-        $chatPath = $document_path . '/chat_files/';
1518
+        $chatPath = $document_path.'/chat_files/';
1519 1519
 
1520 1520
         if ($this->groupId) {
1521 1521
             $group_info = GroupManager::get_group_properties($this->groupId);
1522
-            $chatPath = $document_path . $group_info['directory'] . '/chat_files/';
1522
+            $chatPath = $document_path.$group_info['directory'].'/chat_files/';
1523 1523
         }
1524 1524
 
1525
-        return $chatPath . $base;
1525
+        return $chatPath.$base;
1526 1526
     }
1527 1527
 
1528 1528
     /**
@@ -1535,16 +1535,16 @@  discard block
 block discarded – undo
1535 1535
     {
1536 1536
         $courseInfo = api_get_course_info_by_id($this->courseId);
1537 1537
         $date_now = date('Y-m-d');
1538
-        $isMaster = (bool)api_is_course_admin();
1538
+        $isMaster = (bool) api_is_course_admin();
1539 1539
         $basepath_chat = '/chat_files';
1540
-        $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
1540
+        $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
1541 1541
 
1542 1542
         if ($this->groupId) {
1543 1543
             $group_info = GroupManager:: get_group_properties($this->groupId);
1544
-            $basepath_chat = $group_info['directory'] . '/chat_files';
1544
+            $basepath_chat = $group_info['directory'].'/chat_files';
1545 1545
         }
1546 1546
 
1547
-        $chat_path = $document_path . $basepath_chat . '/';
1547
+        $chat_path = $document_path.$basepath_chat.'/';
1548 1548
 
1549 1549
         if (!is_dir($chat_path)) {
1550 1550
             if (is_file($chat_path)) {
@@ -1571,24 +1571,24 @@  discard block
 block discarded – undo
1571 1571
             }
1572 1572
         }
1573 1573
 
1574
-        $filename_chat = 'messages-' . $date_now . '.log.html';
1574
+        $filename_chat = 'messages-'.$date_now.'.log.html';
1575 1575
 
1576 1576
         if ($this->groupId && !$friendId) {
1577
-            $filename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId . '.log.html';
1577
+            $filename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId.'.log.html';
1578 1578
         } else if ($this->sessionId && !$friendId) {
1579
-            $filename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId . '.log.html';
1579
+            $filename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId.'.log.html';
1580 1580
         } elseif ($friendId) {
1581 1581
             if ($this->userId < $friendId) {
1582
-                $filename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId . '.log.html';
1582
+                $filename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId.'.log.html';
1583 1583
             } else {
1584
-                $filename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId . '.log.html';
1584
+                $filename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId.'.log.html';
1585 1585
             }
1586 1586
         }
1587 1587
 
1588
-        if (!file_exists($chat_path . $filename_chat)) {
1589
-            @fclose(fopen($chat_path . $filename_chat, 'w'));
1588
+        if (!file_exists($chat_path.$filename_chat)) {
1589
+            @fclose(fopen($chat_path.$filename_chat, 'w'));
1590 1590
             if (!api_is_anonymous()) {
1591
-                $doc_id = add_document($courseInfo, $basepath_chat . '/' . $filename_chat, 'file', 0, $filename_chat);
1591
+                $doc_id = add_document($courseInfo, $basepath_chat.'/'.$filename_chat, 'file', 0, $filename_chat);
1592 1592
                 api_item_property_update(
1593 1593
                     $courseInfo,
1594 1594
                     TOOL_DOCUMENT,
@@ -1617,17 +1617,17 @@  discard block
 block discarded – undo
1617 1617
             }
1618 1618
         }
1619 1619
 
1620
-        $basename_chat = 'messages-' . $date_now;
1620
+        $basename_chat = 'messages-'.$date_now;
1621 1621
 
1622 1622
         if ($this->groupId && !$friendId) {
1623
-            $basename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId;
1623
+            $basename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId;
1624 1624
         } else if ($this->sessionId && !$friendId) {
1625
-            $basename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId;
1625
+            $basename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId;
1626 1626
         } elseif ($friendId) {
1627 1627
             if ($this->userId < $friendId) {
1628
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId;
1628
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId;
1629 1629
             } else {
1630
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId;
1630
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId;
1631 1631
             }
1632 1632
         }
1633 1633
 
@@ -1635,19 +1635,19 @@  discard block
 block discarded – undo
1635 1635
 
1636 1636
             $i = 1;
1637 1637
 
1638
-            while (file_exists($chat_path . $basename_chat . '-' . $i . '.log.html')) {
1638
+            while (file_exists($chat_path.$basename_chat.'-'.$i.'.log.html')) {
1639 1639
                 $i++;
1640 1640
             }
1641 1641
 
1642
-            @rename($chat_path . $basename_chat . '.log.html', $chat_path . $basename_chat . '-' . $i . '.log.html');
1643
-            @fclose(fopen($chat_path . $basename_chat . '.log.html', 'w'));
1642
+            @rename($chat_path.$basename_chat.'.log.html', $chat_path.$basename_chat.'-'.$i.'.log.html');
1643
+            @fclose(fopen($chat_path.$basename_chat.'.log.html', 'w'));
1644 1644
 
1645 1645
             $doc_id = add_document(
1646 1646
                 $courseInfo,
1647
-                $basepath_chat . '/' . $basename_chat . '-' . $i . '.log.html',
1647
+                $basepath_chat.'/'.$basename_chat.'-'.$i.'.log.html',
1648 1648
                 'file',
1649
-                filesize($chat_path . $basename_chat . '-' . $i . '.log.html'),
1650
-                $basename_chat . '-' . $i . '.log.html'
1649
+                filesize($chat_path.$basename_chat.'-'.$i.'.log.html'),
1650
+                $basename_chat.'-'.$i.'.log.html'
1651 1651
             );
1652 1652
 
1653 1653
             api_item_property_update(
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
 
1679 1679
             $doc_id = DocumentManager::get_document_id(
1680 1680
                 $courseInfo,
1681
-                $basepath_chat . '/' . $basename_chat . '.log.html'
1681
+                $basepath_chat.'/'.$basename_chat.'.log.html'
1682 1682
             );
1683 1683
 
1684 1684
             update_existing_document($courseInfo, $doc_id, 0);
@@ -1687,8 +1687,8 @@  discard block
 block discarded – undo
1687 1687
         $remove = 0;
1688 1688
         $content = array();
1689 1689
 
1690
-        if (file_exists($chat_path . $basename_chat . '.log.html')) {
1691
-            $content = file($chat_path . $basename_chat . '.log.html');
1690
+        if (file_exists($chat_path.$basename_chat.'.log.html')) {
1691
+            $content = file($chat_path.$basename_chat.'.log.html');
1692 1692
             $nbr_lines = sizeof($content);
1693 1693
             $remove = $nbr_lines - 100;
1694 1694
         }
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
 
1702 1702
         if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonline') {
1703 1703
             //the caller
1704
-            $content[0] = get_lang('CallSent') . '<br />' . $content[0];
1704
+            $content[0] = get_lang('CallSent').'<br />'.$content[0];
1705 1705
         }
1706 1706
         if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonlinejoin') {
1707 1707
             //the joiner (we have to delete the chat request to him when he joins the chat)
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
             $history .= '
1727 1727
                 <div id="clear-chat">
1728 1728
                     <button type="button" id="chat-reset" class="btn btn-danger btn-sm">
1729
-                        ' . get_lang('ClearList') . '
1729
+                        ' . get_lang('ClearList').'
1730 1730
                     </button>
1731 1731
                 </div>
1732 1732
             ';
@@ -1747,9 +1747,9 @@  discard block
 block discarded – undo
1747 1747
         $extraCondition = null;
1748 1748
 
1749 1749
         if ($this->groupId) {
1750
-            $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId);
1750
+            $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId);
1751 1751
         } else {
1752
-            $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId);
1752
+            $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId);
1753 1753
         }
1754 1754
 
1755 1755
         $number = Database::getManager()
@@ -1779,9 +1779,9 @@  discard block
 block discarded – undo
1779 1779
         $extraCondition = null;
1780 1780
 
1781 1781
         if ($this->groupId) {
1782
-            $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId);
1782
+            $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId);
1783 1783
         } else {
1784
-            $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId);
1784
+            $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId);
1785 1785
         }
1786 1786
 
1787 1787
         $number = Database::getManager()
@@ -1817,7 +1817,7 @@  discard block
 block discarded – undo
1817 1817
                 'lastname' => $user->getLastname(),
1818 1818
                 'status' => !$this->sessionId ? $subscription->getStatus() : $user->getStatus(),
1819 1819
                 'image_url' => UserManager::getUserPicture($user->getId(), USER_IMAGE_SIZE_MEDIUM),
1820
-                'profile_url' => api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $user->getId(),
1820
+                'profile_url' => api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user->getId(),
1821 1821
                 'complete_name' => $user->getCompleteName(),
1822 1822
                 'username' => $user->getUsername(),
1823 1823
                 'email' => $user->getEmail(),
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
                 $userInfo['badges'][] = [
1851 1851
                     'id' => $skillInfo['id'],
1852 1852
                     'name' => $skillInfo['name'],
1853
-                    'url' => api_get_path(WEB_PATH) . 'badge/' . $skillInfo['id'] . '/user/' . $user->getId(),
1853
+                    'url' => api_get_path(WEB_PATH).'badge/'.$skillInfo['id'].'/user/'.$user->getId(),
1854 1854
                     'web_icon_thumb_path' => $skillInfo['icon'] ? $skillInfo['web_icon_thumb_path'] : Template::get_icon_path('badges-default.png')
1855 1855
                 ];
1856 1856
             }
Please login to merge, or discard this patch.
main/chat/chat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 ];
18 18
 
19 19
 foreach ($externalCSS as $css) {
20
-    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH) . $css);
20
+    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).$css);
21 21
 }
22 22
 
23
-$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'chat.css');
24
-$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'markdown.css');
23
+$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css');
24
+$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'markdown.css');
25 25
 
26 26
 $externalJS = [
27 27
     'highlight/highlight.pack.js',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         continue;
42 42
     }
43 43
 
44
-    $iconList[$key] = strtoupper($icon) . '.png';
44
+    $iconList[$key] = strtoupper($icon).'.png';
45 45
 }
46 46
 
47 47
 $view = new Template(get_lang('Chat'), false, false, false, true, false);
Please login to merge, or discard this patch.
main/inc/lib/online.inc.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
 
33 33
         $login_date = api_get_utc_datetime();
34 34
         $access_url_id = 1;
35
-        if (api_get_multiple_access_url() && api_get_current_access_url_id()!=-1) {
35
+        if (api_get_multiple_access_url() && api_get_current_access_url_id() != -1) {
36 36
             $access_url_id = api_get_current_access_url_id();
37 37
         }
38 38
         $session_id = api_get_session_id();
39 39
         // if the $_course array exists this means we are in a course and we have to store this in the who's online table also
40 40
         // to have the x users in this course feature working
41
-        if (is_array($_course) && count($_course)>0 && !empty($_course['id'])) {
42
-            $query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
41
+        if (is_array($_course) && count($_course) > 0 && !empty($_course['id'])) {
42
+            $query = "REPLACE INTO ".$online_table." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
43 43
                       VALUES ($uid,$uid,'$login_date','$user_ip', '".$_course['real_id']."' , '$session_id' , '$access_url_id' )";
44 44
         } else {
45
-            $query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
45
+            $query = "REPLACE INTO ".$online_table." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
46 46
                       VALUES ($uid,$uid,'$login_date','$user_ip', 0, '$session_id', '$access_url_id')";
47 47
         }
48 48
         Database::query($query);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $isFirstLogin = Session::read('first_user_login');
64 64
             if (empty($isFirstLogin)) {
65 65
                 $sql = "SELECT login_id FROM $table
66
-                        WHERE login_user_id = " . $userId . " LIMIT 1";
66
+                        WHERE login_user_id = ".$userId." LIMIT 1";
67 67
 
68 68
                 $result = Database::query($sql);
69 69
                 $loginData = array();
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
     		ORDER BY login_date DESC
118 118
     		LIMIT 0,1";
119 119
     $q_last_connection = Database::query($sql);
120
-    if (Database::num_rows($q_last_connection)>0) {
121
-        $i_id_last_connection = Database::result($q_last_connection,0,"login_id");
120
+    if (Database::num_rows($q_last_connection) > 0) {
121
+        $i_id_last_connection = Database::result($q_last_connection, 0, "login_id");
122 122
     }
123 123
 
124 124
     if (!isset($_SESSION['login_as'])) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 {
168 168
 	$online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
169 169
     $user_id = intval($user_id);
170
-	$query = "DELETE FROM " . $online_table . " WHERE login_user_id = $user_id";
170
+	$query = "DELETE FROM ".$online_table." WHERE login_user_id = $user_id";
171 171
 	Database::query($query);
172 172
 }
173 173
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	$access_url_id = api_get_current_access_url_id();
184 184
 	$time_limit = api_get_setting('time_limit_whosonline');
185 185
 
186
-    $online_time = time() - $time_limit*60;
186
+    $online_time = time() - $time_limit * 60;
187 187
     $limit_date = api_get_utc_datetime($online_time);
188 188
     $user_id = intval($user_id);
189 189
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     $current_date = api_get_utc_datetime($online_time);
241 241
 	$track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
242 242
 	$friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
243
-	$table_user	= Database::get_main_table(TABLE_MAIN_USER);
243
+	$table_user = Database::get_main_table(TABLE_MAIN_USER);
244 244
 
245 245
 	if ($friends) {
246 246
 		// 	who friends from social network is online
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
                   LIMIT $from, $number_of_items";
257 257
 	} else {
258 258
 		$query = "SELECT DISTINCT login_user_id, login_date
259
-                    FROM ".$track_online_table ." e
260
-		            INNER JOIN ".$table_user ." u ON (u.id = e.login_user_id)
259
+                    FROM ".$track_online_table." e
260
+		            INNER JOIN ".$table_user." u ON (u.id = e.login_user_id)
261 261
                   WHERE u.status != ".ANONYMOUS." AND login_date >= '".$current_date."'
262 262
                   ORDER BY $column $direction
263 263
                   LIMIT $from, $number_of_items";
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 			} else {
281 281
 				// all users online
282 282
 				$query = "SELECT login_user_id, login_date
283
-						  FROM ".$track_online_table ." track
284
-                          INNER JOIN ".$table_user ." u
283
+						  FROM ".$track_online_table." track
284
+                          INNER JOIN ".$table_user." u
285 285
                           ON (u.id=track.login_user_id)
286 286
 						  WHERE u.status != ".ANONYMOUS." AND track.access_url_id =  $access_url_id AND
287 287
                                 login_date >= '".$current_date."'
@@ -396,10 +396,10 @@  discard block
 block discarded – undo
396 396
         $time_limit = intval($time_limit);
397 397
     }
398 398
 
399
-    $online_time 		= time() - $time_limit*60;
399
+    $online_time 		= time() - $time_limit * 60;
400 400
     $current_date		= api_get_utc_datetime($online_time);
401 401
     $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
402
-    $course_code         = Database::escape_string($course_code);
402
+    $course_code = Database::escape_string($course_code);
403 403
 	$courseInfo = api_get_course_info($course_code);
404 404
 	$courseId = $courseInfo['real_id'];
405 405
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	if ($result) {
415 415
 		$users_online = array();
416 416
 
417
-		while(list($login_user_id, $login_date) = Database::fetch_row($result)) {
417
+		while (list($login_user_id, $login_date) = Database::fetch_row($result)) {
418 418
             $users_online[] = $login_user_id;
419 419
 		}
420 420
 		return $users_online;
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 	}
424 424
 }
425 425
 
426
-function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null)
426
+function who_is_online_in_this_course_count($uid, $time_limit, $coursecode = null)
427 427
 {
428 428
 	if (empty($coursecode)) {
429 429
 		return false;
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
 	$user_table = Database::get_main_table(TABLE_MAIN_USER);
465 465
 	$query = "SELECT firstname, lastname FROM ".$user_table." WHERE id=$uid";
466 466
 	$result = @Database::query($query);
467
-	if (count($result)>0) {
468
-		while(list($firstname,$lastname)= Database::fetch_array($result)) {
467
+	if (count($result) > 0) {
468
+		while (list($firstname, $lastname) = Database::fetch_array($result)) {
469 469
 			$str = str_replace(' ', '&nbsp;', api_get_person_name($firstname, $lastname));
470 470
 			return $str;
471 471
 		}
@@ -486,27 +486,27 @@  discard block
 block discarded – undo
486 486
 	}
487 487
     $userId = intval($_user['user_id']);
488 488
 	$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
489
-	$sql="SELECT chatcall_user_id, chatcall_date FROM $track_user_table
489
+	$sql = "SELECT chatcall_user_id, chatcall_date FROM $track_user_table
490 490
 	      WHERE ( id = $userId )";
491
-	$result=Database::query($sql);
492
-	$row=Database::fetch_array($result);
493
-
494
-	$login_date=$row['chatcall_date'];
495
-	$hour = substr($login_date,11,2);
496
-	$minute = substr($login_date,14,2);
497
-	$second = substr($login_date,17,2);
498
-	$month = substr($login_date,5,2);
499
-	$day = substr($login_date,8,2);
500
-	$year = substr($login_date,0,4);
501
-	$calltime = mktime($hour,$minute,$second,$month,$day,$year);
491
+	$result = Database::query($sql);
492
+	$row = Database::fetch_array($result);
493
+
494
+	$login_date = $row['chatcall_date'];
495
+	$hour = substr($login_date, 11, 2);
496
+	$minute = substr($login_date, 14, 2);
497
+	$second = substr($login_date, 17, 2);
498
+	$month = substr($login_date, 5, 2);
499
+	$day = substr($login_date, 8, 2);
500
+	$year = substr($login_date, 0, 4);
501
+	$calltime = mktime($hour, $minute, $second, $month, $day, $year);
502 502
 
503 503
 	$time = api_get_utc_datetime();
504
-	$minute_passed=5;  //within this limit, the chat call request is valid
505
-	$limittime = mktime(date("H"),date("i")-$minute_passed,date("s"),date("m"),date("d"),date("Y"));
504
+	$minute_passed = 5; //within this limit, the chat call request is valid
505
+	$limittime = mktime(date("H"), date("i") - $minute_passed, date("s"), date("m"), date("d"), date("Y"));
506 506
 
507
-	if (($row['chatcall_user_id']) and ($calltime>$limittime)) {
508
-		$webpath=api_get_path(WEB_CODE_PATH);
509
-		$message=get_lang('YouWereCalled').' : '.GetFullUserName($row['chatcall_user_id'],'').'<br>'.get_lang('DoYouAccept')
507
+	if (($row['chatcall_user_id']) and ($calltime > $limittime)) {
508
+		$webpath = api_get_path(WEB_CODE_PATH);
509
+		$message = get_lang('YouWereCalled').' : '.GetFullUserName($row['chatcall_user_id'], '').'<br>'.get_lang('DoYouAccept')
510 510
 							."<p>"
511 511
 				."<a href=\"".$webpath."chat/chat.php?cidReq=".$_cid."&origin=whoisonlinejoin\">"
512 512
 				. get_lang("Yes")
Please login to merge, or discard this patch.