Completed
Push — 1.11.x ( 78f130...f6f5c2 )
by José
50:40 queued 24:26
created
main/inc/ajax/exercise.ajax.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -488,7 +488,7 @@
 block discarded – undo
488 488
                     $remind_list
489 489
                 );
490 490
 
491
-                 // Destruction of the Question object
491
+                    // Destruction of the Question object
492 492
                 unset($objQuestionTmp);
493 493
                 if ($debug) {
494 494
                     error_log(" -- end question -- ");
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
         $exercise_id = intval($_GET['exercise_id']);
33 33
         $page = intval($_REQUEST['page']); //page
34 34
         $limit = intval($_REQUEST['rows']); //quantity of rows
35
-        $sidx = $_REQUEST['sidx'];         //index to filter
36
-        $sord = $_REQUEST['sord'];         //asc or desc
35
+        $sidx = $_REQUEST['sidx']; //index to filter
36
+        $sord = $_REQUEST['sord']; //asc or desc
37 37
 
38
-        if (!in_array($sord, array('asc','desc'))) {
38
+        if (!in_array($sord, array('asc', 'desc'))) {
39 39
             $sord = 'desc';
40 40
         }
41 41
         // get index row - i.e. user click to sort $sord = $_GET['sord'];
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $total_pages = 0;
65 65
         if ($count > 0) {
66 66
             if (!empty($limit)) {
67
-                $total_pages = ceil($count/$limit);
67
+                $total_pages = ceil($count / $limit);
68 68
             }
69 69
         }
70 70
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $response->page = $page;
127 127
         $response->total = $total_pages;
128 128
         $response->records = $count;
129
-        $i=0;
129
+        $i = 0;
130 130
 
131 131
         if (!empty($results)) {
132 132
             foreach ($results as $row) {
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
                             GROUP by question_id
141 141
                         ) as count_table";
142 142
                 $result_count = Database::query($sql);
143
-                $count_questions = Database::fetch_array($result_count,'ASSOC');
143
+                $count_questions = Database::fetch_array($result_count, 'ASSOC');
144 144
                 $count_questions = $count_questions['count_question_id'];
145 145
 
146 146
                 $row['count_questions'] = $count_questions;
147 147
 
148 148
                 $response->rows[$i]['id'] = $row['exe_id'];
149
-                $remaining = strtotime($row['start_date'])+($oExe->expired_time*60) - strtotime(api_get_utc_datetime(time()));
150
-                $h = floor($remaining/3600);
151
-                $m = floor(($remaining - ($h*3600))/60);
152
-                $s = ($remaining - ($h*3600) - ($m*60));
149
+                $remaining = strtotime($row['start_date']) + ($oExe->expired_time * 60) - strtotime(api_get_utc_datetime(time()));
150
+                $h = floor($remaining / 3600);
151
+                $m = floor(($remaining - ($h * 3600)) / 60);
152
+                $s = ($remaining - ($h * 3600) - ($m * 60));
153 153
                 $array = array(
154 154
                     $row['firstname'],
155 155
                     $row['lastname'],
156
-                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h>0?$h.':':'').sprintf("%02d",$m).':'.sprintf("%02d",$s).']',
156
+                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h > 0 ? $h.':' : '').sprintf("%02d", $m).':'.sprintf("%02d", $s).']',
157 157
                     $row['count_questions'],
158
-                    round($row['score']*100).'%'
158
+                    round($row['score'] * 100).'%'
159 159
                 );
160 160
                 $response->rows[$i]['cell'] = $array;
161 161
                 $i++;
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
                 $objQuestionTmp = Question::read($my_question_id, $course_id);
362 362
 
363 363
                 // Getting free choice data.
364
-                if ($objQuestionTmp->type  == FREE_ANSWER && $type == 'all') {
365
-                    $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id]: null;
364
+                if ($objQuestionTmp->type == FREE_ANSWER && $type == 'all') {
365
+                    $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id] : null;
366 366
                 }
367 367
 
368 368
                 if ($type == 'all') {
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
         $objQuestion = Question::read($questionId);
519 519
         $objQuestion->get_question_type_name();
520 520
 
521
-        echo '<p class="lead">' . $objQuestion->get_question_type_name() . '</p>';
521
+        echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
522 522
         //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
523 523
         ExerciseLib::showQuestion(
524 524
             $questionId,
Please login to merge, or discard this patch.
main/inc/ajax/course_home.ajax.php 3 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -121,8 +121,9 @@  discard block
 block discarded – undo
121 121
             $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
122 122
             $my_session_list  = array();
123 123
             foreach($new_session_list as $item) {
124
-                if (!empty($item['id_session']))
125
-                    $my_session_list[] = $item['id_session'];
124
+                if (!empty($item['id_session'])) {
125
+                                    $my_session_list[] = $item['id_session'];
126
+                }
126 127
             }
127 128
             if (!in_array($session_id, $my_session_list)) {
128 129
             	break;
@@ -254,8 +255,9 @@  discard block
 block discarded – undo
254 255
             $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
255 256
             $my_session_list  = array();
256 257
             foreach($new_session_list as $item) {
257
-                if (!empty($item['id_session']))
258
-                    $my_session_list[] = $item['id_session'];
258
+                if (!empty($item['id_session'])) {
259
+                                    $my_session_list[] = $item['id_session'];
260
+                }
259 261
             }
260 262
             if (!in_array($session_id, $my_session_list)) {
261 263
                 break;
@@ -384,8 +386,9 @@  discard block
 block discarded – undo
384 386
             $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
385 387
             $my_session_list  = array();
386 388
             foreach($new_session_list as $item) {
387
-                if (!empty($item['id_session']))
388
-                    $my_session_list[] = $item['id_session'];
389
+                if (!empty($item['id_session'])) {
390
+                                    $my_session_list[] = $item['id_session'];
391
+                }
389 392
             }
390 393
             if (!in_array($session_id, $my_session_list)) {
391 394
                 break;
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -445,7 +445,7 @@
 block discarded – undo
445 445
                     $date = '-';
446 446
                 }
447 447
 
448
-                 //Checking LP publicated and expired_on dates
448
+                    //Checking LP publicated and expired_on dates
449 449
                 if (!empty($lp_item['publicated_on']) && $lp_item['publicated_on'] != '0000-00-00 00:00:00') {
450 450
                     if ($now < api_strtotime($lp_item['publicated_on'], 'UTC')) {
451 451
                         continue;
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
                     null,
31 31
                     true
32 32
                 );
33
-                $na_image   = str_replace('.png', '_na.png', $tool_image);
33
+                $na_image = str_replace('.png', '_na.png', $tool_image);
34 34
             }
35 35
 
36 36
             if (isset($tool_info['custom_icon']) && !empty($tool_info['custom_icon'])) {
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
                 $na_image = CourseHome::getCustomWebIconPath().CourseHome::getDisableIcon($tool_info['custom_icon']);
39 39
             }
40 40
 
41
-            $requested_image = ($tool_visibility == 0 ) ? $tool_image : $na_image;
42
-            $requested_class = ($tool_visibility == 0 ) ? '' : 'text-muted';
43
-            $requested_message = ($tool_visibility == 0 ) ? 'is_active' : 'is_inactive';
44
-            $requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png';
45
-            $requested_visible = ($tool_visibility == 0 ) ? 1 : 0;
41
+            $requested_image = ($tool_visibility == 0) ? $tool_image : $na_image;
42
+            $requested_class = ($tool_visibility == 0) ? '' : 'text-muted';
43
+            $requested_message = ($tool_visibility == 0) ? 'is_active' : 'is_inactive';
44
+            $requested_view = ($tool_visibility == 0) ? 'visible.png' : 'invisible.png';
45
+            $requested_visible = ($tool_visibility == 0) ? 1 : 0;
46 46
 
47
-            $requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png';
48
-            $requested_visible = ($tool_visibility == 0 ) ? 1 : 0;
47
+            $requested_view = ($tool_visibility == 0) ? 'visible.png' : 'invisible.png';
48
+            $requested_visible = ($tool_visibility == 0) ? 1 : 0;
49 49
 
50 50
             // HIDE AND REACTIVATE TOOL
51 51
             if ($_GET["id"] == strval(intval($_GET["id"]))) {
52 52
                 $sql = "UPDATE $tool_table SET
53 53
                         visibility = $requested_visible
54
-                        WHERE c_id = $course_id AND id='" . intval($_GET['id']) . "'";
54
+                        WHERE c_id = $course_id AND id='".intval($_GET['id'])."'";
55 55
                 Database::query($sql);
56 56
             }
57 57
             $response_data = array(
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 WHERE c_id = ".$course_info['real_id']." AND session_id = 0
83 83
                 ORDER BY id";
84 84
         $result = Database::query($sql);
85
-        if (Database::num_rows($result) > 0 ) {
85
+        if (Database::num_rows($result) > 0) {
86 86
             while ($description = Database::fetch_object($result)) {
87 87
                 $descriptions[$description->id] = $description;
88 88
             }
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 
105 105
         require_once '../global.inc.php';
106 106
         $now = time();
107
-        $page  = intval($_REQUEST['page']);     //page
108
-        $limit = intval($_REQUEST['rows']);     // quantity of rows
107
+        $page  = intval($_REQUEST['page']); //page
108
+        $limit = intval($_REQUEST['rows']); // quantity of rows
109 109
         //index to filter
110 110
         $sidx  = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
111
-        $sord  = $_REQUEST['sord'];    //asc or desc
112
-        if (!in_array($sord, array('asc','desc'))) {
111
+        $sord  = $_REQUEST['sord']; //asc or desc
112
+        if (!in_array($sord, array('asc', 'desc'))) {
113 113
             $sord = 'desc';
114 114
         }
115 115
         $session_id  = intval($_REQUEST['session_id']);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         if (!api_is_platform_admin()) {
120 120
             $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
121 121
             $my_session_list  = array();
122
-            foreach($new_session_list as $item) {
122
+            foreach ($new_session_list as $item) {
123 123
                 if (!empty($item['id_session']))
124 124
                     $my_session_list[] = $item['id_session'];
125 125
             }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             }
129 129
         }
130 130
 
131
-        $start = $limit*$page - $limit;
131
+        $start = $limit * $page - $limit;
132 132
         $course_list = SessionManager::get_course_list_by_session_id($session_id);
133 133
         $count = 0;
134 134
         $temp = array();
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
             $item['title'] = Display::url($item['title'], $course_url, array('target' => SESSION_LINK_TARGET));
141 141
 
142 142
             foreach ($flat_list as $lp_id => $lp_item) {
143
-                $temp[$count]['id']= $lp_id;
143
+                $temp[$count]['id'] = $lp_id;
144 144
 
145 145
                 $lp = new learnpath($item['code'], $lp_id, api_get_user_id());
146 146
                 if ($lp->progress_db == 100) {
147 147
                     continue;
148 148
                 }
149 149
 
150
-                $lp_url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
150
+                $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
151 151
 
152 152
                 $last_date = Tracking::get_last_connection_date_on_the_course(
153 153
                     api_get_user_id(),
@@ -203,27 +203,27 @@  discard block
 block discarded – undo
203 203
         }
204 204
         $temp = msort($temp, $sidx, $sord);
205 205
 
206
-        $i =0;
206
+        $i = 0;
207 207
         $response = new stdClass();
208
-        foreach($temp as $key=>$row) {
208
+        foreach ($temp as $key=>$row) {
209 209
             $row = $row['cell'];
210 210
             if (!empty($row)) {
211
-                if ($key >= $start  && $key < ($start + $limit)) {
212
-                    $response->rows[$i]['id']= $key;
213
-                    $response->rows[$i]['cell']=array($row[0], $row[1], $row[2]);
211
+                if ($key >= $start && $key < ($start + $limit)) {
212
+                    $response->rows[$i]['id'] = $key;
213
+                    $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2]);
214 214
                     $i++;
215 215
                 }
216 216
             }
217 217
         }
218 218
 
219
-        if($count > 0 && $limit > 0) {
220
-            $total_pages = ceil($count/$limit);
219
+        if ($count > 0 && $limit > 0) {
220
+            $total_pages = ceil($count / $limit);
221 221
         } else {
222 222
             $total_pages = 0;
223 223
         }
224
-        $response->total    = $total_pages;
224
+        $response->total = $total_pages;
225 225
         if ($page > $total_pages) {
226
-            $response->page= $total_pages;
226
+            $response->page = $total_pages;
227 227
         } else {
228 228
             $response->page = $page;
229 229
         }
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
         require_once '../global.inc.php';
235 235
         $now = time();
236 236
 
237
-        $page  = intval($_REQUEST['page']);     //page
238
-        $limit = intval($_REQUEST['rows']);     // quantity of rows
237
+        $page  = intval($_REQUEST['page']); //page
238
+        $limit = intval($_REQUEST['rows']); // quantity of rows
239 239
         $sidx  = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'course';
240 240
         $sidx = str_replace(array('week desc,', ' '), '', $sidx);
241 241
 
242
-        $sord  = $_REQUEST['sord'];    //asc or desc
243
-        if (!in_array($sord, array('asc','desc'))) {
242
+        $sord  = $_REQUEST['sord']; //asc or desc
243
+        if (!in_array($sord, array('asc', 'desc'))) {
244 244
             $sord = 'desc';
245 245
         }
246 246
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         if (!api_is_platform_admin()) {
252 252
             $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
253 253
             $my_session_list  = array();
254
-            foreach($new_session_list as $item) {
254
+            foreach ($new_session_list as $item) {
255 255
                 if (!empty($item['id_session']))
256 256
                     $my_session_list[] = $item['id_session'];
257 257
             }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             }
261 261
         }
262 262
 
263
-        $start = $limit*$page - $limit;
263
+        $start = $limit * $page - $limit;
264 264
         $course_list = SessionManager::get_course_list_by_session_id($session_id);
265 265
 
266 266
         $count = 0;
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
             );
288 288
 
289 289
             foreach ($flat_list as $lp_id => $lp_item) {
290
-                $temp[$count]['id']= $lp_id;
291
-                $lp_url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
290
+                $temp[$count]['id'] = $lp_id;
291
+                $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
292 292
 
293 293
                 $last_date = Tracking::get_last_connection_date_on_the_course(
294 294
                     api_get_user_id(),
@@ -350,20 +350,20 @@  discard block
 block discarded – undo
350 350
         }
351 351
 
352 352
         $response = new stdClass();
353
-        $i =0;
354
-        foreach($temp as $key=>$row) {
353
+        $i = 0;
354
+        foreach ($temp as $key=>$row) {
355 355
             $row = $row['cell'];
356 356
             if (!empty($row)) {
357
-                if ($key >= $start  && $key < ($start + $limit)) {
358
-                    $response->rows[$i]['id']= $key;
359
-                    $response->rows[$i]['cell']=array($row[0], $row[1], $row[2],$row[3]);
357
+                if ($key >= $start && $key < ($start + $limit)) {
358
+                    $response->rows[$i]['id'] = $key;
359
+                    $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2], $row[3]);
360 360
                     $i++;
361 361
                 }
362 362
             }
363 363
         }
364 364
 
365 365
         if ($count > 0 && $limit > 0) {
366
-            $total_pages = ceil($count/$limit);
366
+            $total_pages = ceil($count / $limit);
367 367
         } else {
368 368
             $total_pages = 0;
369 369
         }
@@ -379,12 +379,12 @@  discard block
 block discarded – undo
379 379
     case 'session_courses_lp_by_course':
380 380
         require_once '../global.inc.php';
381 381
         $now = time();
382
-        $page  = intval($_REQUEST['page']);     //page
383
-        $limit = intval($_REQUEST['rows']);     // quantity of rows
382
+        $page  = intval($_REQUEST['page']); //page
383
+        $limit = intval($_REQUEST['rows']); // quantity of rows
384 384
         $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
385 385
         $sidx = str_replace(array('course asc,', ' '), '', $sidx);
386 386
 
387
-        $sord = $_REQUEST['sord'];    //asc or desc
387
+        $sord = $_REQUEST['sord']; //asc or desc
388 388
         if (!in_array($sord, array('asc', 'desc'))) {
389 389
             $sord = 'desc';
390 390
         }
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         if (!api_is_platform_admin()) {
396 396
             $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
397 397
             $my_session_list  = array();
398
-            foreach($new_session_list as $item) {
398
+            foreach ($new_session_list as $item) {
399 399
                 if (!empty($item['id_session']))
400 400
                     $my_session_list[] = $item['id_session'];
401 401
             }
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
             }
405 405
         }
406 406
 
407
-        $start = $limit*$page - $limit;
407
+        $start = $limit * $page - $limit;
408 408
         $course_list = SessionManager::get_course_list_by_session_id($session_id);
409 409
         $count = 0;
410 410
 
@@ -415,16 +415,16 @@  discard block
 block discarded – undo
415 415
                 }
416 416
             }
417 417
 
418
-            $list = new LearnpathList(api_get_user_id(),$item['code'],$session_id);
418
+            $list = new LearnpathList(api_get_user_id(), $item['code'], $session_id);
419 419
             $flat_list = $list->get_flat_list();
420 420
             $lps[$item['code']] = $flat_list;
421 421
             $item['title'] = Display::url(
422 422
                 $item['title'],
423 423
                 api_get_path(WEB_COURSE_PATH).$item['directory'].'/?id_session='.$session_id, array('target'=>SESSION_LINK_TARGET)
424 424
             );
425
-            foreach($flat_list as $lp_id => $lp_item) {
426
-                $temp[$count]['id']= $lp_id;
427
-                $lp_url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
425
+            foreach ($flat_list as $lp_id => $lp_item) {
426
+                $temp[$count]['id'] = $lp_id;
427
+                $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$item['code'].'&id_session='.$session_id.'&lp_id='.$lp_id.'&action=view';
428 428
                 $last_date = Tracking::get_last_connection_date_on_the_course(
429 429
                     api_get_user_id(),
430 430
                     $item,
@@ -477,13 +477,13 @@  discard block
 block discarded – undo
477 477
         $temp = msort($temp, $sidx, $sord);
478 478
 
479 479
         $response = new stdClass();
480
-        $i =0;
480
+        $i = 0;
481 481
         foreach ($temp as $key => $row) {
482 482
             $row = $row['cell'];
483 483
             if (!empty($row)) {
484
-                if ($key >= $start  && $key < ($start + $limit)) {
485
-                    $response->rows[$i]['id']= $key;
486
-                    $response->rows[$i]['cell']=array($row[0], $row[1], $row[2]);
484
+                if ($key >= $start && $key < ($start + $limit)) {
485
+                    $response->rows[$i]['id'] = $key;
486
+                    $response->rows[$i]['cell'] = array($row[0], $row[1], $row[2]);
487 487
                     $i++;
488 488
                 }
489 489
             }
Please login to merge, or discard this patch.
main/inc/ajax/chat.ajax.php 2 patches
Switch Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -55,56 +55,56 @@
 block discarded – undo
55 55
 }
56 56
 
57 57
 switch ($action) {
58
-    case 'chatheartbeat':
59
-        $chat->heartbeat();
60
-        break;
61
-    case 'closechat':
62
-        $chat->close();
63
-        break;
64
-    case 'sendchat':
65
-        $chat->send(api_get_user_id(), $to_user_id, $message);
66
-        break;
67
-    case 'startchatsession':
68
-        $chat->startSession();
69
-        break;
70
-    case 'set_status':
71
-        $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0;
72
-        $chat->setUserStatus($status);
73
-        break;
74
-    case 'create_room':
75
-        $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
76
-
77
-        if ($room === false) {
78
-            $createdRoom = VideoChat::createRoom(api_get_user_id(), $to_user_id);
79
-
80
-            if ($createdRoom === false) {
81
-                echo Display::return_message(get_lang('ChatRoomNotCreated'), 'error');
82
-                break;
58
+        case 'chatheartbeat':
59
+            $chat->heartbeat();
60
+            break;
61
+        case 'closechat':
62
+            $chat->close();
63
+            break;
64
+        case 'sendchat':
65
+            $chat->send(api_get_user_id(), $to_user_id, $message);
66
+            break;
67
+        case 'startchatsession':
68
+            $chat->startSession();
69
+            break;
70
+        case 'set_status':
71
+            $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0;
72
+            $chat->setUserStatus($status);
73
+            break;
74
+        case 'create_room':
75
+            $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
76
+
77
+            if ($room === false) {
78
+                $createdRoom = VideoChat::createRoom(api_get_user_id(), $to_user_id);
79
+
80
+                if ($createdRoom === false) {
81
+                    echo Display::return_message(get_lang('ChatRoomNotCreated'), 'error');
82
+                    break;
83
+                }
84
+
85
+                $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
83 86
             }
84 87
 
85
-            $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
86
-        }
87
-
88
-        $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}";
89
-        $videoChatLink = Display::url(
90
-            Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'),
91
-            $videoChatUrl
92
-        );
93
-
94
-        $chat->send(
95
-            api_get_user_id(),
96
-            $to_user_id,
97
-            $videoChatLink,
98
-            false,
99
-            false
100
-        );
101
-
102
-        echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
103
-        break;
104
-    case 'notify_not_support':
105
-        $chat->send(api_get_user_id(), $to_user_id, get_lang('TheXUserBrowserDoesNotSupportWebRTC'));
106
-        break;
107
-    default:
108
-        echo '';
88
+            $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}";
89
+            $videoChatLink = Display::url(
90
+                Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'),
91
+                $videoChatUrl
92
+            );
93
+
94
+            $chat->send(
95
+                api_get_user_id(),
96
+                $to_user_id,
97
+                $videoChatLink,
98
+                false,
99
+                false
100
+            );
101
+
102
+            echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
103
+            break;
104
+        case 'notify_not_support':
105
+            $chat->send(api_get_user_id(), $to_user_id, get_lang('TheXUserBrowserDoesNotSupportWebRTC'));
106
+            break;
107
+        default:
108
+            echo '';
109 109
 }
110 110
 exit;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * Responses to AJAX calls
6 6
  */
7 7
 
8
-$_dont_save_user_course_access  = true;
8
+$_dont_save_user_course_access = true;
9 9
 
10 10
 require_once '../global.inc.php';
11 11
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 }
35 35
 
36 36
 $to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null;
37
-$message	= isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
37
+$message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
38 38
 
39 39
 if (!isset($_SESSION['chatHistory'])) {
40 40
     $_SESSION['chatHistory'] = array();
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 $chat = new Chat();
48
-if (chat::disableChat()){
48
+if (chat::disableChat()) {
49 49
     exit;
50 50
 }
51 51
 if ($chat->is_chat_blocked_by_exercises()) {
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
             $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
86 86
         }
87 87
 
88
-        $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}";
88
+        $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH)."chat/video.php?room={$room['id']}";
89 89
         $videoChatLink = Display::url(
90
-            Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'),
90
+            Display::returnFontAwesomeIcon('video-camera').get_lang('StartVideoChat'),
91 91
             $videoChatUrl
92 92
         );
93 93
 
Please login to merge, or discard this patch.
main/inc/ajax/myspace.ajax.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@
 block discarded – undo
58 58
             $db['is_empty'] = false;
59 59
             $db['result'] = convert_to_string($sql_result);
60 60
             $rst = get_stats($user_id, $course_code, $start_date, $end_date);
61
-            $foo_stats = '<strong>' . get_lang('Total') . ': </strong>' . $rst['total'] . '<br />';
62
-            $foo_stats .= '<strong>' . get_lang('Average') . ': </strong>' . $rst['avg'] . '<br />';
63
-            $foo_stats .= '<strong>' . get_lang('Quantity') . ' : </strong>' . $rst['times'] . '<br />';
61
+            $foo_stats = '<strong>'.get_lang('Total').': </strong>'.$rst['total'].'<br />';
62
+            $foo_stats .= '<strong>'.get_lang('Average').': </strong>'.$rst['avg'].'<br />';
63
+            $foo_stats .= '<strong>'.get_lang('Quantity').' : </strong>'.$rst['times'].'<br />';
64 64
             $db['stats'] = $foo_stats;
65 65
             $db['graph_result'] = grapher($sql_result, $start_date, $end_date, $type);
66 66
         } else {
Please login to merge, or discard this patch.
main/inc/ajax/user_manager.ajax.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 <div class="row">
59 59
                     <div class="col-sm-10 col-sm-offset-2">
60 60
                         <a class="btn btn-primary" id="send_message_link">
61
-                            <em class="fa fa-envelope"></em> ' . get_lang('Send') . '
61
+                            <em class="fa fa-envelope"></em> ' . get_lang('Send').'
62 62
                         </a>
63 63
                     </div>
64 64
                 </div>
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
             if (!empty($user_id)) {
114 114
                 $user_table = Database :: get_main_table(TABLE_MAIN_USER);
115
-                $sql="UPDATE $user_table SET active='".$status."' WHERE user_id='".$user_id."'";
115
+                $sql = "UPDATE $user_table SET active='".$status."' WHERE user_id='".$user_id."'";
116 116
                 $result = Database::query($sql);
117 117
 
118 118
                 //Send and email if account is active
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
                     $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
123 123
                     $email_admin = api_get_setting('emailAdministrator');
124 124
                     $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
125
-                    $emailbody=get_lang('Dear')." ".stripslashes($recipient_name).",\n\n";
125
+                    $emailbody = get_lang('Dear')." ".stripslashes($recipient_name).",\n\n";
126 126
 
127
-                    $emailbody.=sprintf(get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'), api_get_setting('siteName'))."\n";
128
-                    $emailbody.=sprintf(get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'), api_get_path(WEB_PATH)).",\n\n";
129
-                    $emailbody.=get_lang('HaveFun')."\n\n";
127
+                    $emailbody .= sprintf(get_lang('YourAccountOnXHasJustBeenApprovedByOneOfOurAdministrators'), api_get_setting('siteName'))."\n";
128
+                    $emailbody .= sprintf(get_lang('YouCanNowLoginAtXUsingTheLoginAndThePasswordYouHaveProvided'), api_get_path(WEB_PATH)).",\n\n";
129
+                    $emailbody .= get_lang('HaveFun')."\n\n";
130 130
                     //$emailbody.=get_lang('Problem'). "\n\n". get_lang('SignatureFormula');
131
-                    $emailbody.=api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
131
+                    $emailbody .= api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator');
132 132
 
133 133
                     $additionalParameters = array(
134 134
                         'smsType' => SmsPlugin::ACCOUNT_APPROVED_CONNECT,
Please login to merge, or discard this patch.
main/inc/ajax/model.ajax.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
         }
732 732
 
733 733
         break;
734
-	case 'get_user_skill_ranking':
734
+    case 'get_user_skill_ranking':
735 735
         $columns = array('photo', 'firstname', 'lastname', 'skills_acquired', 'currently_learning', 'rank');
736 736
         $result = $skill->get_user_list_skill_ranking($start, $limit, $sidx, $sord, $whereCondition);
737 737
         $result = msort($result, 'skills_acquired', 'asc');
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
 
1282 1282
             if (!empty($item['certif_min_score']) && !empty($item['document_id'])) {
1283 1283
                 $item['certificates'] = Display::return_icon('accept.png', get_lang('WithCertificate'), array(), ICON_SIZE_SMALL);
1284
-                 $item['has_certificates'] = '1';
1284
+                    $item['has_certificates'] = '1';
1285 1285
             } else {
1286 1286
                 $item['certificates'] = Display::return_icon('warning.png', get_lang('NoCertificate'), array(), ICON_SIZE_SMALL);
1287 1287
                 $item['has_certificates'] = '0';
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 $action = $_GET['a'];
12 12
 $page = intval($_REQUEST['page']); //page
13 13
 $limit = intval($_REQUEST['rows']); //quantity of rows
14
-$sidx = $_REQUEST['sidx'];         //index (field) to filter
15
-$sord = $_REQUEST['sord'];         //asc or desc
14
+$sidx = $_REQUEST['sidx']; //index (field) to filter
15
+$sord = $_REQUEST['sord']; //asc or desc
16 16
 
17 17
 if (strpos(strtolower($sidx), 'asc') !== false) {
18 18
     $sidx = str_replace(array('asc', ','), '', $sidx);
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     $sord = 'desc';
25 25
 }
26 26
 
27
-if (!in_array($sord, array('asc','desc'))) {
27
+if (!in_array($sord, array('asc', 'desc'))) {
28 28
     $sord = 'desc';
29 29
 }
30 30
 
@@ -64,19 +64,19 @@  discard block
 block discarded – undo
64 64
 function getWhereClause($col, $oper, $val)
65 65
 {
66 66
     $ops = array(
67
-        'eq' => '=',        //equal
68
-        'ne' => '<>',       //not equal
69
-        'lt' => '<',        //less than
70
-        'le' => '<=',       //less than or equal
71
-        'gt' => '>',        //greater than
72
-        'ge' => '>=',       //greater than or equal
73
-        'bw' => 'LIKE',     //begins with
67
+        'eq' => '=', //equal
68
+        'ne' => '<>', //not equal
69
+        'lt' => '<', //less than
70
+        'le' => '<=', //less than or equal
71
+        'gt' => '>', //greater than
72
+        'ge' => '>=', //greater than or equal
73
+        'bw' => 'LIKE', //begins with
74 74
         'bn' => 'NOT LIKE', //doesn't begin with
75
-        'in' => 'LIKE',     //is in
75
+        'in' => 'LIKE', //is in
76 76
         'ni' => 'NOT LIKE', //is not in
77
-        'ew' => 'LIKE',     //ends with
77
+        'ew' => 'LIKE', //ends with
78 78
         'en' => 'NOT LIKE', //doesn't end with
79
-        'cn' => 'LIKE',     //contains
79
+        'cn' => 'LIKE', //contains
80 80
         'nc' => 'NOT LIKE'  //doesn't contain
81 81
     );
82 82
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 
101 101
 // If there is no search request sent by jqgrid, $where should be empty
102 102
 $whereCondition = '';
103
-$operation = isset($_REQUEST['oper'])  ? $_REQUEST['oper']  : false;
104
-$exportFormat = isset($_REQUEST['export_format'])  ? $_REQUEST['export_format']  : 'csv';
105
-$searchField = isset($_REQUEST['searchField'])  ? $_REQUEST['searchField']  : false;
106
-$searchOperator = isset($_REQUEST['searchOper'])   ? $_REQUEST['searchOper']   : false;
103
+$operation = isset($_REQUEST['oper']) ? $_REQUEST['oper'] : false;
104
+$exportFormat = isset($_REQUEST['export_format']) ? $_REQUEST['export_format'] : 'csv';
105
+$searchField = isset($_REQUEST['searchField']) ? $_REQUEST['searchField'] : false;
106
+$searchOperator = isset($_REQUEST['searchOper']) ? $_REQUEST['searchOper'] : false;
107 107
 $searchString = isset($_REQUEST['searchString']) ? $_REQUEST['searchString'] : false;
108 108
 $search = isset($_REQUEST['_search']) ? $_REQUEST['_search'] : false;
109 109
 $forceSearch = isset($_REQUEST['_force_search']) ? $_REQUEST['_force_search'] : false;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             foreach ($filters->rules as $key => $rule) {
172 172
                 $whereCondition .= getWhereClause($rule->field, $rule->op, $rule->data);
173 173
 
174
-                if ($counter < count($filters->rules) -1) {
174
+                if ($counter < count($filters->rules) - 1) {
175 175
                     $whereCondition .= $filters->groupOp;
176 176
                 }
177 177
                 $counter++;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $userId = api_get_user_id();
202 202
         $sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
203 203
         $courseCodeList = array();
204
-        $userIdList  = array();
204
+        $userIdList = array();
205 205
         $sessionIdList = [];
206 206
         $searchByGroups = false;
207 207
         if (api_is_drh()) {
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 $total_pages = 0;
586 586
 if ($count > 0) {
587 587
     if (!empty($limit)) {
588
-        $total_pages = ceil((float)$count/(float)$limit);
588
+        $total_pages = ceil((float) $count / (float) $limit);
589 589
     }
590 590
 }
591 591
 if ($page > $total_pages) {
@@ -865,10 +865,10 @@  discard block
 block discarded – undo
865 865
     case 'get_work_user_list_others':
866 866
         if (isset($_GET['type']) && $_GET['type'] === 'simple') {
867 867
             $columns = array(
868
-                'type', 'firstname', 'lastname',  'title', 'qualification', 'sent_date', 'qualificator_id', 'actions'
868
+                'type', 'firstname', 'lastname', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions'
869 869
             );
870 870
         } else {
871
-            $columns = array('type', 'firstname', 'lastname',  'title', 'sent_date', 'actions');
871
+            $columns = array('type', 'firstname', 'lastname', 'title', 'sent_date', 'actions');
872 872
         }
873 873
         $whereCondition .= " AND u.user_id <> ".api_get_user_id();
874 874
         $result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $whereCondition);
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
     case 'get_exercise_results':
903 903
         $course = api_get_course_info();
904 904
         // Used inside ExerciseLib::get_exam_results_data()
905
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
905
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
906 906
         if ($is_allowedToEdit || api_is_student_boss()) {
907 907
             $columns = array(
908 908
                 'firstname',
@@ -927,11 +927,11 @@  discard block
 block discarded – undo
927 927
         break;
928 928
     case 'get_hotpotatoes_exercise_results':
929 929
         $course = api_get_course_info();
930
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
930
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
931 931
         if (api_is_allowed_to_edit()) {
932
-            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date',  'score', 'actions');
932
+            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
933 933
         } else {
934
-            $columns = array('exe_date',  'score', 'actions');
934
+            $columns = array('exe_date', 'score', 'actions');
935 935
         }
936 936
         $result = ExerciseLib::get_exam_results_hotpotatoes_data(
937 937
             $start,
@@ -964,12 +964,12 @@  discard block
 block discarded – undo
964 964
         break;
965 965
     case 'get_hotpotatoes_exercise_results':
966 966
         $course = api_get_course_info();
967
-        $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
967
+        $documentPath = api_get_path(SYS_COURSE_PATH).$course['path']."/document";
968 968
 
969 969
         if (api_is_allowed_to_edit(null, true) || api_is_drh()) {
970
-            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date',  'score', 'actions');
970
+            $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_date', 'score', 'actions');
971 971
         } else {
972
-            $columns = array('exe_date',  'score', 'actions');
972
+            $columns = array('exe_date', 'score', 'actions');
973 973
         }
974 974
         $result = ExerciseLib::get_exam_results_hotpotatoes_data(
975 975
             $start,
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
             );
1006 1006
         }
1007 1007
 
1008
-        $columns =  array(
1008
+        $columns = array(
1009 1009
             'name',
1010 1010
             'date',
1011 1011
             'course_per_session',
@@ -1041,17 +1041,17 @@  discard block
 block discarded – undo
1041 1041
                 $detailButtons = [];
1042 1042
                 $detailButtons[] = Display::url(
1043 1043
                     Display::return_icon('works.png', get_lang('WorksReport')),
1044
-                    api_get_path(WEB_CODE_PATH) . 'mySpace/works_in_session_report.php?session=' . $session['id']
1044
+                    api_get_path(WEB_CODE_PATH).'mySpace/works_in_session_report.php?session='.$session['id']
1045 1045
                 );
1046 1046
                 $detailButtons[] = Display::url(
1047 1047
                     Display::return_icon('2rightarrow.png'),
1048
-                    api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id']
1048
+                    api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id']
1049 1049
                 );
1050 1050
 
1051 1051
                 $result[] = array(
1052 1052
                     'name' => Display::url(
1053 1053
                         $session['name'],
1054
-                        api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id']
1054
+                        api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id']
1055 1055
                     ),
1056 1056
                     'date' => $session_date_string,
1057 1057
                     'course_per_session' => $count_courses_in_session,
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
         $result = $new_result;
1364 1364
         break;
1365 1365
     case 'get_gradebooks':
1366
-        $columns = array('name', 'certificates','skills', 'actions', 'has_certificates');
1366
+        $columns = array('name', 'certificates', 'skills', 'actions', 'has_certificates');
1367 1367
         if (!in_array($sidx, $columns)) {
1368 1368
             $sidx = 'name';
1369 1369
         }
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
                     if (!empty($exercises[$cnt - 4]['title'])) {
1537 1537
                         $title = ucwords(strtolower(trim($exercises[$cnt - 4]['title'])));
1538 1538
                     }
1539
-                    $columns[] = 'exer' . $i;
1539
+                    $columns[] = 'exer'.$i;
1540 1540
                     $column_names[] = $title;
1541 1541
                     $i++;
1542 1542
                     break;
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
             $sessionInfo = SessionManager::fetch($listUserSess[$user['user_id']]['id_session']);
1570 1570
             $result[$i]['session'] = $sessionInfo['name'];
1571 1571
             $result[$i]['username'] = $user['username'];
1572
-            $result[$i]['name'] = $user['lastname'] . " " . $user['firstname'];
1572
+            $result[$i]['name'] = $user['lastname']." ".$user['firstname'];
1573 1573
             $j = 1;
1574 1574
             $finalScore = 0;
1575 1575
             foreach ($quizIds as $quizID) {
@@ -1577,7 +1577,7 @@  discard block
 block discarded – undo
1577 1577
                 if (!empty($arrGrade [$user['user_id']][$quizID]) || $arrGrade [$user['user_id']][$quizID] == 0) {
1578 1578
                     $finalScore += $grade = $arrGrade [$user['user_id']][$quizID];
1579 1579
                 }
1580
-                $result[$i]['exer' . $j] = $grade;
1580
+                $result[$i]['exer'.$j] = $grade;
1581 1581
                 $j++;
1582 1582
             }
1583 1583
 
@@ -1745,9 +1745,9 @@  discard block
 block discarded – undo
1745 1745
         foreach ($result as $row) {
1746 1746
             // if results tab give not id, set id to $i otherwise id="null" for all <tr> of the jqgrid - ref #4235
1747 1747
             if (!isset($row['id']) || isset($row['id']) && $row['id'] == '') {
1748
-                $response->rows[$i]['id']= $i;
1748
+                $response->rows[$i]['id'] = $i;
1749 1749
             } else {
1750
-                $response->rows[$i]['id']= $row['id'];
1750
+                $response->rows[$i]['id'] = $row['id'];
1751 1751
             }
1752 1752
             $array = array();
1753 1753
             foreach ($columns as $col) {
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
                     $array[] = isset($row[$col]) ? Security::remove_XSS($row[$col]) : '';
1758 1758
                 }
1759 1759
             }
1760
-            $response->rows[$i]['cell']=$array;
1760
+            $response->rows[$i]['cell'] = $array;
1761 1761
             $i++;
1762 1762
         }
1763 1763
     }
Please login to merge, or discard this patch.
main/inc/local.inc.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -758,7 +758,7 @@
 block discarded – undo
758 758
     //    $gidReset = true;
759 759
 } // end else
760 760
 
761
- // Now check for anonymous user mode
761
+    // Now check for anonymous user mode
762 762
 if (isset($use_anonymous) && $use_anonymous) {
763 763
     //if anonymous mode is set, then try to set the current user as anonymous
764 764
     //if he doesn't have a login yet
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
             // is necessary verify check
218 218
             if ($legal_type == 1) {
219
-                if ((isset($_POST['legal_accept']) && $_POST['legal_accept']=='1')) {
219
+                if ((isset($_POST['legal_accept']) && $_POST['legal_accept'] == '1')) {
220 220
                     $legal_option = true;
221 221
                 } else {
222 222
                     $legal_option = false;
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
                  * Process external authentication
506 506
                  * on the basis of the given login name
507 507
                  */
508
-                $loginFailed = true;  // Default initialisation. It could
508
+                $loginFailed = true; // Default initialisation. It could
509 509
                 // change after the external authentication
510 510
                 $key = $uData['auth_source']; //'ldap','shibboleth'...
511 511
                 /* >>>>>>>> External authentication modules <<<<<<<<< */
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
                      * Process external authentication
540 540
                      * on the basis of the given login name
541 541
                      */
542
-                    $loginFailed = true;  // Default initialisation. It could
542
+                    $loginFailed = true; // Default initialisation. It could
543 543
                     // change after the external authentication
544 544
                     $key = $uData['auth_source']; //'ldap','shibboleth'...
545 545
 
@@ -550,11 +550,11 @@  discard block
 block discarded – undo
550 550
             } else {
551 551
                 // change after the external authentication
552 552
                 // login failed, Database::num_rows($result) <= 0
553
-                $loginFailed = true;  // Default initialisation. It could
553
+                $loginFailed = true; // Default initialisation. It could
554 554
             }
555 555
 
556 556
             // login failed, Database::num_rows($result) <= 0
557
-            $loginFailed = true;  // Default initialisation. It could
557
+            $loginFailed = true; // Default initialisation. It could
558 558
             // change after the external authentication
559 559
 
560 560
             /*
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
                         include_once($thisAuthSource['newUser']);
581 581
                     } else {
582 582
                         error_log(
583
-                            'Chamilo Authentication external file' .
583
+                            'Chamilo Authentication external file'.
584 584
                             ' could not be found - this might prevent your system from using'.
585 585
                             ' the authentication process in the user creation process',
586 586
                             0
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
             online_logout(null, false);
693 693
             $osso->logout(); //redirects and exits
694 694
         }
695
-    } elseif (api_get_setting('openid_authentication')=='true') {
695
+    } elseif (api_get_setting('openid_authentication') == 'true') {
696 696
         if (!empty($_POST['openid_url'])) {
697 697
             include api_get_path(SYS_CODE_PATH).'auth/openid/login.php';
698 698
             openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php');
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
             if ($res['status'] == 'success') {
706 706
                 $id1 = Database::escape_string($res['openid.identity']);
707 707
                 //have another id with or without the final '/'
708
-                $id2 = (substr($id1, -1, 1)=='/'?substr($id1, 0, -1):$id1.'/');
708
+                $id2 = (substr($id1, -1, 1) == '/' ? substr($id1, 0, -1) : $id1.'/');
709 709
                 //lookup the user in the main database
710 710
                 $user_table = Database::get_main_table(TABLE_MAIN_USER);
711 711
                 $sql = "SELECT user_id, username, password, auth_source, active, expiration_date
@@ -714,14 +714,14 @@  discard block
 block discarded – undo
714 714
                         OR openid = '$id2' ";
715 715
                 $result = Database::query($sql);
716 716
                 if ($result !== false) {
717
-                    if (Database::num_rows($result)>0) {
717
+                    if (Database::num_rows($result) > 0) {
718 718
                         $uData = Database::fetch_array($result);
719 719
 
720 720
                         if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
721 721
                             //the authentification of this user is managed by Chamilo itself
722 722
 
723 723
                             // check if the account is active (not locked)
724
-                            if ($uData['active']=='1') {
724
+                            if ($uData['active'] == '1') {
725 725
                                 // check if the expiration date has not been reached
726 726
                                 if ($uData['expiration_date'] > date('Y-m-d H:i:s')
727 727
                                     || empty($uData['expiration_date'])
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
     (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid']))
801 801
 ) {
802 802
     $cidReset = true;
803
-    $gidReset = true;    // As groups depend from courses, group id is reset
803
+    $gidReset = true; // As groups depend from courses, group id is reset
804 804
 }
805 805
 
806 806
 /* USER INIT */
@@ -950,8 +950,8 @@  discard block
 block discarded – undo
950 950
             $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
951 951
 
952 952
             if (!empty($_GET['id_session'])) {
953
-                $sql = 'SELECT name FROM '.$tbl_session . '
954
-                        WHERE id="'.intval($_GET['id_session']) . '"';
953
+                $sql = 'SELECT name FROM '.$tbl_session.'
954
+                        WHERE id="'.intval($_GET['id_session']).'"';
955 955
                 $rs = Database::query($sql);
956 956
                 if (Database::num_rows($rs)) {
957 957
                     list($_SESSION['session_name']) = Database::fetch_array($rs);
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
         // Moreover, if we want to track a course with another session it can be usefull
1040 1040
         if (!empty($_GET['id_session']) && is_numeric($_GET['id_session'])) {
1041 1041
             $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
1042
-            $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_GET['id_session']). '"';
1042
+            $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_GET['id_session']).'"';
1043 1043
             $rs = Database::query($sql);
1044 1044
             if (Database::num_rows($rs)) {
1045 1045
                 list($_SESSION['session_name']) = Database::fetch_array($rs);
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
                     }
1165 1165
                 }
1166 1166
                 $url = api_get_path(WEB_CODE_PATH).'auth/inscription.php';
1167
-                header("Location:". $url);
1167
+                header("Location:".$url);
1168 1168
                 exit;
1169 1169
             }
1170 1170
         }
@@ -1185,8 +1185,8 @@  discard block
 block discarded – undo
1185 1185
         if (Database::num_rows($result) > 0) { // this  user have a recorded state for this course
1186 1186
             $cuData = Database::fetch_array($result, 'ASSOC');
1187 1187
 
1188
-            $is_courseAdmin = (bool)($cuData['status'] == 1);
1189
-            $is_courseTutor = (bool)($cuData['is_tutor'] == 1);
1188
+            $is_courseAdmin = (bool) ($cuData['status'] == 1);
1189
+            $is_courseTutor = (bool) ($cuData['is_tutor'] == 1);
1190 1190
             $is_courseMember = true;
1191 1191
         }
1192 1192
 
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
                 // This user has no status related to this course
1198 1198
                 // The user is subscribed in a session? The user is a Session coach a Session admin ?
1199 1199
 
1200
-                $tbl_session  = Database :: get_main_table(TABLE_MAIN_SESSION);
1200
+                $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
1201 1201
                 $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
1202 1202
                 $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1203 1203
 
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 
1311 1311
             //If I'm the admin platform i'm a teacher of the course
1312 1312
             if ($is_platformAdmin) {
1313
-                $is_courseAdmin     = true;
1313
+                $is_courseAdmin = true;
1314 1314
             }
1315 1315
         }
1316 1316
     } else { // keys missing => not anymore in the course - user relation
@@ -1468,12 +1468,12 @@  discard block
 block discarded – undo
1468 1468
     ($logging_in && exist_firstpage_parameter())
1469 1469
 ) {
1470 1470
     $redirectCourseDir = api_get_firstpage_parameter();
1471
-    api_delete_firstpage_parameter();    // delete the cookie
1471
+    api_delete_firstpage_parameter(); // delete the cookie
1472 1472
 
1473 1473
     if (!isset($_SESSION['request_uri'])) {
1474 1474
         if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
1475 1475
             $_SESSION['noredirection'] = false;
1476
-            $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
1476
+            $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
1477 1477
         }
1478 1478
     }
1479 1479
 } elseif (api_user_is_login() && exist_firstpage_parameter()) {
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
     api_delete_firstpage_parameter(); // delete the cookie
1482 1482
     if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
1483 1483
         $_SESSION['noredirection'] = false;
1484
-        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
1484
+        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
1485 1485
     }
1486 1486
 }
1487 1487
 
Please login to merge, or discard this patch.
main/inc/lib/AnnouncementEmail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -196,7 +196,7 @@
 block discarded – undo
196 196
      *
197 197
      * @return array
198 198
      */
199
-    public function sender($key = '',  $userId = '')
199
+    public function sender($key = '', $userId = '')
200 200
     {
201 201
         $_user = api_get_user_info($userId);
202 202
 
Please login to merge, or discard this patch.
main/inc/lib/custom_pages.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public static function path($name = '')
37 37
     {
38
-        return api_get_path(SYS_PATH) . 'custompages/' . $name;
38
+        return api_get_path(SYS_PATH).'custompages/'.$name;
39 39
     }
40 40
 
41 41
     /**
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
             return false;
51 51
         }
52 52
 
53
-        $file = self::path($page_name . '.php');
53
+        $file = self::path($page_name.'.php');
54 54
         if (file_exists($file)) {
55 55
             include($file);
56 56
             exit;
57 57
         } else {
58
-            error_log('CustomPages::displayPage : could not read file ' . $file);
58
+            error_log('CustomPages::displayPage : could not read file '.$file);
59 59
         }
60 60
     }
61 61
 
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
     public static function getURLImages($url_id = null)
70 70
     {
71 71
         if (is_null($url_id)) {
72
-            $url = 'http://' . $_SERVER['HTTP_HOST'] . '/';
72
+            $url = 'http://'.$_SERVER['HTTP_HOST'].'/';
73 73
             $url_id = UrlManager::get_url_id($url);
74 74
         }
75
-        $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
75
+        $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
76 76
         $images = array();
77 77
         for ($img_id = 1; $img_id <= 3; $img_id++) {
78
-            if (file_exists($url_images_dir . $url_id . '_url_image_' . $img_id . '.png')) {
79
-                $images[] = api_get_path(WEB_PATH) . 'custompages/url-images/' . $url_id . '_url_image_' . $img_id . '.png';
78
+            if (file_exists($url_images_dir.$url_id.'_url_image_'.$img_id.'.png')) {
79
+                $images[] = api_get_path(WEB_PATH).'custompages/url-images/'.$url_id.'_url_image_'.$img_id.'.png';
80 80
             }
81 81
         }
82 82
 
Please login to merge, or discard this patch.