Completed
Pull Request — 1.10.x (#1225)
by Angel Fernando Quiroz
254:16 queued 215:09
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
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             return '';
63 63
         }
64 64
 
65
-        Emojione\Emojione::$imagePathPNG = api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/png/';
65
+        Emojione\Emojione::$imagePathPNG = api_get_path(WEB_LIBRARY_PATH).'javascript/emojione/png/';
66 66
         Emojione\Emojione::$ascii = true;
67 67
 
68 68
         $message = trim($message);
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
         $user = $em->find('ChamiloUserBundle:User', $this->userId);
96 96
         $courseInfo = api_get_course_info_by_id($this->courseId);
97 97
         $isMaster = (bool) api_is_course_admin();
98
-        $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
98
+        $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
99 99
         $basepath_chat = '/chat_files';
100 100
 
101 101
         if (!$this->groupId) {
102 102
             $group_info = GroupManager::get_group_properties($this->groupId);
103
-            $basepath_chat = $group_info['directory'] . '/chat_files';
103
+            $basepath_chat = $group_info['directory'].'/chat_files';
104 104
         }
105 105
 
106
-        $chat_path = $document_path . $basepath_chat . '/';
106
+        $chat_path = $document_path.$basepath_chat.'/';
107 107
 
108 108
         if (!is_dir($chat_path)) {
109 109
             if (is_file($chat_path)) {
@@ -113,25 +113,25 @@  discard block
 block discarded – undo
113 113
 
114 114
         $date_now = date('Y-m-d');
115 115
         $timeNow = date('d/m/y H:i:s');
116
-        $basename_chat = 'messages-' . $date_now;
116
+        $basename_chat = 'messages-'.$date_now;
117 117
 
118 118
         if ($this->groupId && !$friendId) {
119
-            $basename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId;
119
+            $basename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId;
120 120
         } elseif ($this->sessionId && !$friendId) {
121
-            $basename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId;
121
+            $basename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId;
122 122
         } elseif ($friendId) {
123 123
             if ($this->userId < $friendId) {
124
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId;
124
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId;
125 125
             } else {
126
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId;
126
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId;
127 127
             }
128 128
         }
129 129
 
130 130
         $message = self::prepareMessage($message);
131 131
 
132
-        $fileTitle = $basename_chat . '.log.html';
133
-        $filePath = $basepath_chat . '/' . $fileTitle;
134
-        $absoluteFilePath = $chat_path . $fileTitle;
132
+        $fileTitle = $basename_chat.'.log.html';
133
+        $filePath = $basepath_chat.'/'.$fileTitle;
134
+        $absoluteFilePath = $chat_path.$fileTitle;
135 135
 
136 136
         if (!file_exists($absoluteFilePath)) {
137 137
             $doc_id = add_document($courseInfo, $filePath, 'file', 0, $fileTitle);
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
             $fileContent = '
165 165
                 <div class="message-teacher">
166 166
                     <div class="content-message">
167
-                        <div class="chat-message-block-name">' . $user->getCompleteName() . '</div>
168
-                        <div class="chat-message-block-content">' . $message . '</div>
169
-                        <div class="message-date">' . $timeNow . '</div>
167
+                        <div class="chat-message-block-name">' . $user->getCompleteName().'</div>
168
+                        <div class="chat-message-block-content">' . $message.'</div>
169
+                        <div class="message-date">' . $timeNow.'</div>
170 170
                     </div>
171 171
                     <div class="icon-message"></div>
172
-                    <img class="chat-image" src="' . $userPhoto . '">
172
+                    <img class="chat-image" src="' . $userPhoto.'">
173 173
                 </div>
174 174
             ';
175 175
         } else {
176 176
             $fileContent = '
177 177
                 <div class="message-student">
178
-                    <img class="chat-image" src="' . $userPhoto . '">
178
+                    <img class="chat-image" src="' . $userPhoto.'">
179 179
                     <div class="icon-message"></div>
180 180
                     <div class="content-message">
181
-                        <div class="chat-message-block-name">' . $user->getCompleteName() . '</div>
182
-                        <div class="chat-message-block-content">' . $message . '</div>
183
-                        <div class="message-date">' . $timeNow . '</div>
181
+                        <div class="chat-message-block-name">' . $user->getCompleteName().'</div>
182
+                        <div class="chat-message-block-content">' . $message.'</div>
183
+                        <div class="message-date">' . $timeNow.'</div>
184 184
                     </div>
185 185
                 </div>
186 186
             ';
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
         $extraCondition = null;
276 276
 
277 277
         if ($this->groupId) {
278
-            $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId);
278
+            $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId);
279 279
         } else {
280
-            $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId);
280
+            $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId);
281 281
         }
282 282
 
283 283
         $currentTime = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC'));
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
     {
1414 1414
         return [
1415 1415
             ':bowtie:',
1416
-            ':smile:'|
1416
+            ':smile:' |
1417 1417
             ':laughing:',
1418 1418
             ':blush:',
1419 1419
             ':smiley:',
@@ -1487,17 +1487,17 @@  discard block
 block discarded – undo
1487 1487
     {
1488 1488
         $date = date('Y-m-d');
1489 1489
 
1490
-        $base = 'messages-' . $date . '.log.html';
1490
+        $base = 'messages-'.$date.'.log.html';
1491 1491
 
1492 1492
         if ($this->groupId && !$friendId) {
1493
-            $base = 'messages-' . $date . '_gid-' . $this->groupId . '.log.html';
1493
+            $base = 'messages-'.$date.'_gid-'.$this->groupId.'.log.html';
1494 1494
         } elseif ($this->sessionId && !$friendId) {
1495
-            $base = 'messages-' . $date . '_sid-' . $this->sessionId . '.log.html';
1495
+            $base = 'messages-'.$date.'_sid-'.$this->sessionId.'.log.html';
1496 1496
         } elseif ($friendId) {
1497 1497
             if ($this->userId < $friendId) {
1498
-                $base = 'messages-' . $date . '_uid-' . $this->userId . '-' . $friendId . '.log.html';
1498
+                $base = 'messages-'.$date.'_uid-'.$this->userId.'-'.$friendId.'.log.html';
1499 1499
             } else {
1500
-                $base = 'messages-' . $date . '_uid-' . $friendId . '-' . $this->userId . '.log.html';
1500
+                $base = 'messages-'.$date.'_uid-'.$friendId.'-'.$this->userId.'.log.html';
1501 1501
             }
1502 1502
         }
1503 1503
 
@@ -1506,16 +1506,16 @@  discard block
 block discarded – undo
1506 1506
         }
1507 1507
 
1508 1508
         $courseInfo = api_get_course_info_by_id($this->courseId);
1509
-        $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
1509
+        $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
1510 1510
 
1511
-        $chatPath = $document_path . '/chat_files/';
1511
+        $chatPath = $document_path.'/chat_files/';
1512 1512
 
1513 1513
         if ($this->groupId) {
1514 1514
             $group_info = GroupManager::get_group_properties($this->groupId);
1515
-            $chatPath = $document_path . $group_info['directory'] . '/chat_files/';
1515
+            $chatPath = $document_path.$group_info['directory'].'/chat_files/';
1516 1516
         }
1517 1517
 
1518
-        return $chatPath . $base;
1518
+        return $chatPath.$base;
1519 1519
     }
1520 1520
 
1521 1521
     /**
@@ -1528,16 +1528,16 @@  discard block
 block discarded – undo
1528 1528
     {
1529 1529
         $courseInfo = api_get_course_info_by_id($this->courseId);
1530 1530
         $date_now = date('Y-m-d');
1531
-        $isMaster = (bool)api_is_course_admin();
1531
+        $isMaster = (bool) api_is_course_admin();
1532 1532
         $basepath_chat = '/chat_files';
1533
-        $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
1533
+        $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
1534 1534
 
1535 1535
         if ($this->groupId) {
1536 1536
             $group_info = GroupManager:: get_group_properties($this->groupId);
1537
-            $basepath_chat = $group_info['directory'] . '/chat_files';
1537
+            $basepath_chat = $group_info['directory'].'/chat_files';
1538 1538
         }
1539 1539
 
1540
-        $chat_path = $document_path . $basepath_chat . '/';
1540
+        $chat_path = $document_path.$basepath_chat.'/';
1541 1541
 
1542 1542
         if (!is_dir($chat_path)) {
1543 1543
             if (is_file($chat_path)) {
@@ -1564,24 +1564,24 @@  discard block
 block discarded – undo
1564 1564
             }
1565 1565
         }
1566 1566
 
1567
-        $filename_chat = 'messages-' . $date_now . '.log.html';
1567
+        $filename_chat = 'messages-'.$date_now.'.log.html';
1568 1568
 
1569 1569
         if ($this->groupId && !$friendId) {
1570
-            $filename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId . '.log.html';
1570
+            $filename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId.'.log.html';
1571 1571
         } else if ($this->sessionId && !$friendId) {
1572
-            $filename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId . '.log.html';
1572
+            $filename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId.'.log.html';
1573 1573
         } elseif ($friendId) {
1574 1574
             if ($this->userId < $friendId) {
1575
-                $filename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId . '.log.html';
1575
+                $filename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId.'.log.html';
1576 1576
             } else {
1577
-                $filename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId . '.log.html';
1577
+                $filename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId.'.log.html';
1578 1578
             }
1579 1579
         }
1580 1580
 
1581
-        if (!file_exists($chat_path . $filename_chat)) {
1582
-            @fclose(fopen($chat_path . $filename_chat, 'w'));
1581
+        if (!file_exists($chat_path.$filename_chat)) {
1582
+            @fclose(fopen($chat_path.$filename_chat, 'w'));
1583 1583
             if (!api_is_anonymous()) {
1584
-                $doc_id = add_document($courseInfo, $basepath_chat . '/' . $filename_chat, 'file', 0, $filename_chat);
1584
+                $doc_id = add_document($courseInfo, $basepath_chat.'/'.$filename_chat, 'file', 0, $filename_chat);
1585 1585
                 api_item_property_update(
1586 1586
                     $courseInfo,
1587 1587
                     TOOL_DOCUMENT,
@@ -1610,17 +1610,17 @@  discard block
 block discarded – undo
1610 1610
             }
1611 1611
         }
1612 1612
 
1613
-        $basename_chat = 'messages-' . $date_now;
1613
+        $basename_chat = 'messages-'.$date_now;
1614 1614
 
1615 1615
         if ($this->groupId && !$friendId) {
1616
-            $basename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId;
1616
+            $basename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId;
1617 1617
         } else if ($this->sessionId && !$friendId) {
1618
-            $basename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId;
1618
+            $basename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId;
1619 1619
         } elseif ($friendId) {
1620 1620
             if ($this->userId < $friendId) {
1621
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId;
1621
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId;
1622 1622
             } else {
1623
-                $basename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId;
1623
+                $basename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId;
1624 1624
             }
1625 1625
         }
1626 1626
 
@@ -1628,19 +1628,19 @@  discard block
 block discarded – undo
1628 1628
 
1629 1629
             $i = 1;
1630 1630
 
1631
-            while (file_exists($chat_path . $basename_chat . '-' . $i . '.log.html')) {
1631
+            while (file_exists($chat_path.$basename_chat.'-'.$i.'.log.html')) {
1632 1632
                 $i++;
1633 1633
             }
1634 1634
 
1635
-            @rename($chat_path . $basename_chat . '.log.html', $chat_path . $basename_chat . '-' . $i . '.log.html');
1636
-            @fclose(fopen($chat_path . $basename_chat . '.log.html', 'w'));
1635
+            @rename($chat_path.$basename_chat.'.log.html', $chat_path.$basename_chat.'-'.$i.'.log.html');
1636
+            @fclose(fopen($chat_path.$basename_chat.'.log.html', 'w'));
1637 1637
 
1638 1638
             $doc_id = add_document(
1639 1639
                 $courseInfo,
1640
-                $basepath_chat . '/' . $basename_chat . '-' . $i . '.log.html',
1640
+                $basepath_chat.'/'.$basename_chat.'-'.$i.'.log.html',
1641 1641
                 'file',
1642
-                filesize($chat_path . $basename_chat . '-' . $i . '.log.html'),
1643
-                $basename_chat . '-' . $i . '.log.html'
1642
+                filesize($chat_path.$basename_chat.'-'.$i.'.log.html'),
1643
+                $basename_chat.'-'.$i.'.log.html'
1644 1644
             );
1645 1645
 
1646 1646
             api_item_property_update(
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 
1672 1672
             $doc_id = DocumentManager::get_document_id(
1673 1673
                 $courseInfo,
1674
-                $basepath_chat . '/' . $basename_chat . '.log.html'
1674
+                $basepath_chat.'/'.$basename_chat.'.log.html'
1675 1675
             );
1676 1676
 
1677 1677
             update_existing_document($courseInfo, $doc_id, 0);
@@ -1680,8 +1680,8 @@  discard block
 block discarded – undo
1680 1680
         $remove = 0;
1681 1681
         $content = array();
1682 1682
 
1683
-        if (file_exists($chat_path . $basename_chat . '.log.html')) {
1684
-            $content = file($chat_path . $basename_chat . '.log.html');
1683
+        if (file_exists($chat_path.$basename_chat.'.log.html')) {
1684
+            $content = file($chat_path.$basename_chat.'.log.html');
1685 1685
             $nbr_lines = sizeof($content);
1686 1686
             $remove = $nbr_lines - 100;
1687 1687
         }
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
 
1695 1695
         if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonline') {
1696 1696
             //the caller
1697
-            $content[0] = get_lang('CallSent') . '<br />' . $content[0];
1697
+            $content[0] = get_lang('CallSent').'<br />'.$content[0];
1698 1698
         }
1699 1699
         if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonlinejoin') {
1700 1700
             //the joiner (we have to delete the chat request to him when he joins the chat)
@@ -1719,7 +1719,7 @@  discard block
 block discarded – undo
1719 1719
             $history .= '
1720 1720
                 <div id="clear-chat">
1721 1721
                     <button type="button" id="chat-reset" class="btn btn-danger btn-sm">
1722
-                        ' . get_lang('ClearList') . '
1722
+                        ' . get_lang('ClearList').'
1723 1723
                     </button>
1724 1724
                 </div>
1725 1725
             ';
@@ -1740,9 +1740,9 @@  discard block
 block discarded – undo
1740 1740
         $extraCondition = null;
1741 1741
 
1742 1742
         if ($this->groupId) {
1743
-            $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId);
1743
+            $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId);
1744 1744
         } else {
1745
-            $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId);
1745
+            $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId);
1746 1746
         }
1747 1747
 
1748 1748
         $number = Database::getManager()
@@ -1772,9 +1772,9 @@  discard block
 block discarded – undo
1772 1772
         $extraCondition = null;
1773 1773
 
1774 1774
         if ($this->groupId) {
1775
-            $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId);
1775
+            $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId);
1776 1776
         } else {
1777
-            $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId);
1777
+            $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId);
1778 1778
         }
1779 1779
 
1780 1780
         $number = Database::getManager()
@@ -1810,7 +1810,7 @@  discard block
 block discarded – undo
1810 1810
                 'lastname' => $user->getLastname(),
1811 1811
                 'status' => !$this->sessionId ? $subscription->getStatus() : $user->getStatus(),
1812 1812
                 'image_url' => UserManager::getUserPicture($user->getId(), USER_IMAGE_SIZE_MEDIUM),
1813
-                'profile_url' => api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $user->getId(),
1813
+                'profile_url' => api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user->getId(),
1814 1814
                 'complete_name' => $user->getCompleteName(),
1815 1815
                 'username' => $user->getUsername(),
1816 1816
                 '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.