Completed
Pull Request — 1.10.x (#1224)
by Angel Fernando Quiroz
85:36 queued 42:07
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   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
         $extraCondition = null;
42 42
 
43 43
         if ($this->groupId) {
44
-            $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId);
44
+            $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId);
45 45
         } else {
46
-            $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId);
46
+            $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId);
47 47
         }
48 48
 
49 49
         return Database::getManager()
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             return '';
71 71
         }
72 72
 
73
-        Emojione\Emojione::$imagePathPNG = api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/png/';
73
+        Emojione\Emojione::$imagePathPNG = api_get_path(WEB_LIBRARY_PATH).'javascript/emojione/png/';
74 74
         Emojione\Emojione::$ascii = true;
75 75
 
76 76
         $message = trim($message);
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
         $user = $em->find('ChamiloUserBundle:User', $this->userId);
104 104
         $courseInfo = api_get_course_info_by_id($this->courseId);
105 105
         $isMaster = (bool) api_is_course_admin();
106
-        $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
106
+        $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
107 107
         $basepath_chat = '/chat_files';
108 108
 
109 109
         if (!$this->groupId) {
110 110
             $group_info = GroupManager::get_group_properties($this->groupId);
111
-            $basepath_chat = $group_info['directory'] . '/chat_files';
111
+            $basepath_chat = $group_info['directory'].'/chat_files';
112 112
         }
113 113
 
114
-        $chat_path = $document_path . $basepath_chat . '/';
114
+        $chat_path = $document_path.$basepath_chat.'/';
115 115
 
116 116
         if (!is_dir($chat_path)) {
117 117
             if (is_file($chat_path)) {
@@ -121,25 +121,25 @@  discard block
 block discarded – undo
121 121
 
122 122
         $date_now = date('Y-m-d');
123 123
         $timeNow = date('d/m/y H:i:s');
124
-        $basename_chat = 'messages-' . $date_now;
124
+        $basename_chat = 'messages-'.$date_now;
125 125
 
126 126
         if ($this->groupId && !$friendId) {
127
-            $basename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId;
127
+            $basename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId;
128 128
         } elseif ($this->sessionId && !$friendId) {
129
-            $basename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId;
129
+            $basename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId;
130 130
         } elseif ($friendId) {
131 131
             if ($this->userId < $friendId) {
132
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId;
132
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId;
133 133
             } else {
134
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId;
134
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId;
135 135
             }
136 136
         }
137 137
 
138 138
         $message = self::prepareMessage($message);
139 139
 
140
-        $fileTitle = $basename_chat . '.log.html';
141
-        $filePath = $basepath_chat . '/' . $fileTitle;
142
-        $absoluteFilePath = $chat_path . $fileTitle;
140
+        $fileTitle = $basename_chat.'.log.html';
141
+        $filePath = $basepath_chat.'/'.$fileTitle;
142
+        $absoluteFilePath = $chat_path.$fileTitle;
143 143
 
144 144
         if (!file_exists($absoluteFilePath)) {
145 145
             $doc_id = add_document($courseInfo, $filePath, 'file', 0, $fileTitle);
@@ -172,23 +172,23 @@  discard block
 block discarded – undo
172 172
             $fileContent = '
173 173
                 <div class="message-teacher">
174 174
                     <div class="content-message">
175
-                        <div class="chat-message-block-name">' . $user->getCompleteName() . '</div>
176
-                        <div class="chat-message-block-content">' . $message . '</div>
177
-                        <div class="message-date">' . $timeNow . '</div>
175
+                        <div class="chat-message-block-name">' . $user->getCompleteName().'</div>
176
+                        <div class="chat-message-block-content">' . $message.'</div>
177
+                        <div class="message-date">' . $timeNow.'</div>
178 178
                     </div>
179 179
                     <div class="icon-message"></div>
180
-                    <img class="chat-image" src="' . $userPhoto . '">
180
+                    <img class="chat-image" src="' . $userPhoto.'">
181 181
                 </div>
182 182
             ';
183 183
         } else {
184 184
             $fileContent = '
185 185
                 <div class="message-student">
186
-                    <img class="chat-image" src="' . $userPhoto . '">
186
+                    <img class="chat-image" src="' . $userPhoto.'">
187 187
                     <div class="icon-message"></div>
188 188
                     <div class="content-message">
189
-                        <div class="chat-message-block-name">' . $user->getCompleteName() . '</div>
190
-                        <div class="chat-message-block-content">' . $message . '</div>
191
-                        <div class="message-date">' . $timeNow . '</div>
189
+                        <div class="chat-message-block-name">' . $user->getCompleteName().'</div>
190
+                        <div class="chat-message-block-content">' . $message.'</div>
191
+                        <div class="message-date">' . $timeNow.'</div>
192 192
                     </div>
193 193
                 </div>
194 194
             ';
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
         $extraCondition = null;
284 284
 
285 285
         if ($this->groupId) {
286
-            $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId);
286
+            $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId);
287 287
         } else {
288
-            $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId);
288
+            $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId);
289 289
         }
290 290
 
291 291
         $currentTime = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
     {
1422 1422
         return [
1423 1423
             ':bowtie:',
1424
-            ':smile:'|
1424
+            ':smile:' |
1425 1425
             ':laughing:',
1426 1426
             ':blush:',
1427 1427
             ':smiley:',
@@ -1495,17 +1495,17 @@  discard block
 block discarded – undo
1495 1495
     {
1496 1496
         $date = date('Y-m-d');
1497 1497
 
1498
-        $base = 'messages-' . $date . '.log.html';
1498
+        $base = 'messages-'.$date.'.log.html';
1499 1499
 
1500 1500
         if ($this->groupId && !$friendId) {
1501
-            $base = 'messages-' . $date . '_gid-' . $this->groupId . '.log.html';
1501
+            $base = 'messages-'.$date.'_gid-'.$this->groupId.'.log.html';
1502 1502
         } elseif ($this->sessionId && !$friendId) {
1503
-            $base = 'messages-' . $date . '_sid-' . $this->sessionId . '.log.html';
1503
+            $base = 'messages-'.$date.'_sid-'.$this->sessionId.'.log.html';
1504 1504
         } elseif ($friendId) {
1505 1505
             if ($this->userId < $friendId) {
1506
-                $base = 'messages-' . $date . '_uid-' . $this->userId . '-' . $friendId . '.log.html';
1506
+                $base = 'messages-'.$date.'_uid-'.$this->userId.'-'.$friendId.'.log.html';
1507 1507
             } else {
1508
-                $base = 'messages-' . $date . '_uid-' . $friendId . '-' . $this->userId . '.log.html';
1508
+                $base = 'messages-'.$date.'_uid-'.$friendId.'-'.$this->userId.'.log.html';
1509 1509
             }
1510 1510
         }
1511 1511
 
@@ -1514,16 +1514,16 @@  discard block
 block discarded – undo
1514 1514
         }
1515 1515
 
1516 1516
         $courseInfo = api_get_course_info_by_id($this->courseId);
1517
-        $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
1517
+        $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
1518 1518
 
1519
-        $chatPath = $document_path . '/chat_files/';
1519
+        $chatPath = $document_path.'/chat_files/';
1520 1520
 
1521 1521
         if ($this->groupId) {
1522 1522
             $group_info = GroupManager::get_group_properties($this->groupId);
1523
-            $chatPath = $document_path . $group_info['directory'] . '/chat_files/';
1523
+            $chatPath = $document_path.$group_info['directory'].'/chat_files/';
1524 1524
         }
1525 1525
 
1526
-        return $chatPath . $base;
1526
+        return $chatPath.$base;
1527 1527
     }
1528 1528
 
1529 1529
     /**
@@ -1536,16 +1536,16 @@  discard block
 block discarded – undo
1536 1536
     {
1537 1537
         $courseInfo = api_get_course_info_by_id($this->courseId);
1538 1538
         $date_now = date('Y-m-d');
1539
-        $isMaster = (bool)api_is_course_admin();
1539
+        $isMaster = (bool) api_is_course_admin();
1540 1540
         $basepath_chat = '/chat_files';
1541
-        $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
1541
+        $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
1542 1542
 
1543 1543
         if ($this->groupId) {
1544 1544
             $group_info = GroupManager:: get_group_properties($this->groupId);
1545
-            $basepath_chat = $group_info['directory'] . '/chat_files';
1545
+            $basepath_chat = $group_info['directory'].'/chat_files';
1546 1546
         }
1547 1547
 
1548
-        $chat_path = $document_path . $basepath_chat . '/';
1548
+        $chat_path = $document_path.$basepath_chat.'/';
1549 1549
 
1550 1550
         if (!is_dir($chat_path)) {
1551 1551
             if (is_file($chat_path)) {
@@ -1572,24 +1572,24 @@  discard block
 block discarded – undo
1572 1572
             }
1573 1573
         }
1574 1574
 
1575
-        $filename_chat = 'messages-' . $date_now . '.log.html';
1575
+        $filename_chat = 'messages-'.$date_now.'.log.html';
1576 1576
 
1577 1577
         if ($this->groupId && !$friendId) {
1578
-            $filename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId . '.log.html';
1578
+            $filename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId.'.log.html';
1579 1579
         } else if ($this->sessionId && !$friendId) {
1580
-            $filename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId . '.log.html';
1580
+            $filename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId.'.log.html';
1581 1581
         } elseif ($friendId) {
1582 1582
             if ($this->userId < $friendId) {
1583
-                $filename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId . '.log.html';
1583
+                $filename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId.'.log.html';
1584 1584
             } else {
1585
-                $filename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId . '.log.html';
1585
+                $filename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId.'.log.html';
1586 1586
             }
1587 1587
         }
1588 1588
 
1589
-        if (!file_exists($chat_path . $filename_chat)) {
1590
-            @fclose(fopen($chat_path . $filename_chat, 'w'));
1589
+        if (!file_exists($chat_path.$filename_chat)) {
1590
+            @fclose(fopen($chat_path.$filename_chat, 'w'));
1591 1591
             if (!api_is_anonymous()) {
1592
-                $doc_id = add_document($courseInfo, $basepath_chat . '/' . $filename_chat, 'file', 0, $filename_chat);
1592
+                $doc_id = add_document($courseInfo, $basepath_chat.'/'.$filename_chat, 'file', 0, $filename_chat);
1593 1593
                 api_item_property_update(
1594 1594
                     $courseInfo,
1595 1595
                     TOOL_DOCUMENT,
@@ -1618,17 +1618,17 @@  discard block
 block discarded – undo
1618 1618
             }
1619 1619
         }
1620 1620
 
1621
-        $basename_chat = 'messages-' . $date_now;
1621
+        $basename_chat = 'messages-'.$date_now;
1622 1622
 
1623 1623
         if ($this->groupId && !$friendId) {
1624
-            $basename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId;
1624
+            $basename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId;
1625 1625
         } else if ($this->sessionId && !$friendId) {
1626
-            $basename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId;
1626
+            $basename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId;
1627 1627
         } elseif ($friendId) {
1628 1628
             if ($this->userId < $friendId) {
1629
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId;
1629
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId;
1630 1630
             } else {
1631
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId;
1631
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId;
1632 1632
             }
1633 1633
         }
1634 1634
 
@@ -1636,19 +1636,19 @@  discard block
 block discarded – undo
1636 1636
 
1637 1637
             $i = 1;
1638 1638
 
1639
-            while (file_exists($chat_path . $basename_chat . '-' . $i . '.log.html')) {
1639
+            while (file_exists($chat_path.$basename_chat.'-'.$i.'.log.html')) {
1640 1640
                 $i++;
1641 1641
             }
1642 1642
 
1643
-            @rename($chat_path . $basename_chat . '.log.html', $chat_path . $basename_chat . '-' . $i . '.log.html');
1644
-            @fclose(fopen($chat_path . $basename_chat . '.log.html', 'w'));
1643
+            @rename($chat_path.$basename_chat.'.log.html', $chat_path.$basename_chat.'-'.$i.'.log.html');
1644
+            @fclose(fopen($chat_path.$basename_chat.'.log.html', 'w'));
1645 1645
 
1646 1646
             $doc_id = add_document(
1647 1647
                 $courseInfo,
1648
-                $basepath_chat . '/' . $basename_chat . '-' . $i . '.log.html',
1648
+                $basepath_chat.'/'.$basename_chat.'-'.$i.'.log.html',
1649 1649
                 'file',
1650
-                filesize($chat_path . $basename_chat . '-' . $i . '.log.html'),
1651
-                $basename_chat . '-' . $i . '.log.html'
1650
+                filesize($chat_path.$basename_chat.'-'.$i.'.log.html'),
1651
+                $basename_chat.'-'.$i.'.log.html'
1652 1652
             );
1653 1653
 
1654 1654
             api_item_property_update(
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 
1680 1680
             $doc_id = DocumentManager::get_document_id(
1681 1681
                 $courseInfo,
1682
-                $basepath_chat . '/' . $basename_chat . '.log.html'
1682
+                $basepath_chat.'/'.$basename_chat.'.log.html'
1683 1683
             );
1684 1684
 
1685 1685
             update_existing_document($courseInfo, $doc_id, 0);
@@ -1688,8 +1688,8 @@  discard block
 block discarded – undo
1688 1688
         $remove = 0;
1689 1689
         $content = array();
1690 1690
 
1691
-        if (file_exists($chat_path . $basename_chat . '.log.html')) {
1692
-            $content = file($chat_path . $basename_chat . '.log.html');
1691
+        if (file_exists($chat_path.$basename_chat.'.log.html')) {
1692
+            $content = file($chat_path.$basename_chat.'.log.html');
1693 1693
             $nbr_lines = sizeof($content);
1694 1694
             $remove = $nbr_lines - 100;
1695 1695
         }
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
 
1703 1703
         if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonline') {
1704 1704
             //the caller
1705
-            $content[0] = get_lang('CallSent') . '<br />' . $content[0];
1705
+            $content[0] = get_lang('CallSent').'<br />'.$content[0];
1706 1706
         }
1707 1707
         if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonlinejoin') {
1708 1708
             //the joiner (we have to delete the chat request to him when he joins the chat)
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
             $history .= '
1728 1728
                 <div id="clear-chat">
1729 1729
                     <button type="button" id="chat-reset" class="btn btn-danger btn-sm">
1730
-                        ' . get_lang('ClearList') . '
1730
+                        ' . get_lang('ClearList').'
1731 1731
                     </button>
1732 1732
                 </div>
1733 1733
             ';
@@ -1748,9 +1748,9 @@  discard block
 block discarded – undo
1748 1748
         $extraCondition = null;
1749 1749
 
1750 1750
         if ($this->groupId) {
1751
-            $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId);
1751
+            $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId);
1752 1752
         } else {
1753
-            $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId);
1753
+            $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId);
1754 1754
         }
1755 1755
 
1756 1756
         $number = Database::getManager()
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
                 'lastname' => $user->getLastname(),
1793 1793
                 'status' => $userStatus,
1794 1794
                 'image_url' => UserManager::getUserPicture($user->getId(), USER_IMAGE_SIZE_MEDIUM),
1795
-                'profile_url' => api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $user->getId(),
1795
+                'profile_url' => api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user->getId(),
1796 1796
                 'complete_name' => $user->getCompleteName(),
1797 1797
                 'username' => $user->getUsername(),
1798 1798
                 'email' => $user->getEmail()
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.