Completed
Push — 1.11.x ( 5cb77e...c87450 )
by José
367:19 queued 327:00
created
main/auth/ldap/authldap.php 1 patch
Indentation   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -46,10 +46,9 @@  discard block
 block discarded – undo
46 46
     - Universite Jean Monet (J Dubois / Michel Courbon)
47 47
     - Michel Panckoucke for reporting and fixing a bug
48 48
     - Patrick Cool: fixing security hole
49
-
50
-    *    @author Roan Embrechts
51
-    *    @version 3.0
52
-    *    @package chamilo.auth.ldap
49
+ *    @author Roan Embrechts
50
+ *    @version 3.0
51
+ *    @package chamilo.auth.ldap
53 52
  * Note:
54 53
  * If you are using a firewall, you might need to check port 389 is open in
55 54
  * order for Chamilo to communicate with the LDAP server.
@@ -211,8 +210,8 @@  discard block
 block discarded – undo
211 210
     $language = api_get_setting('platformLanguage');
212 211
     if (empty($language)) { $language = 'english'; }
213 212
     $_userId = UserManager::create_user($prenom, $nom, $status,
214
-                     $email, $uname, $password, $official_code,
215
-                     $language,'', '', 'ldap');
213
+                        $email, $uname, $password, $official_code,
214
+                        $language,'', '', 'ldap');
216 215
 
217 216
     //echo "new user added to Chamilo, id = $_userId";
218 217
 
@@ -271,7 +270,7 @@  discard block
 block discarded – undo
271 270
         // Open anonymous LDAP connection
272 271
         $result=false;
273 272
         $ldap_bind_res = ldap_handle_bind($ds,$result);
274
-	// Executing the search with the $filter parametr
273
+    // Executing the search with the $filter parametr
275 274
         //error_log('Searching for '.$filter.' on LDAP server',0);
276 275
         $sr=ldap_search($ds,$ldap_basedn,$filter);
277 276
         $info = ldap_get_entries($ds, $sr);
@@ -564,35 +563,35 @@  discard block
 block discarded – undo
564 563
         foreach ($UserList as $enreg_user) {
565 564
             $enreg_user = (int) $enreg_user;
566 565
             Database::query("INSERT IGNORE ".
567
-              " INTO $tbl_session_rel_course_rel_user ".
568
-              "(session_id,c_id,user_id) VALUES ".
569
-              "('$id_session','$enreg_course','$enreg_user')");
566
+                " INTO $tbl_session_rel_course_rel_user ".
567
+                "(session_id,c_id,user_id) VALUES ".
568
+                "('$id_session','$enreg_course','$enreg_user')");
570 569
         }
571 570
         $sql = "SELECT COUNT(user_id) as nbUsers ".
572
-               " FROM $tbl_session_rel_course_rel_user " .
573
-               " WHERE session_id='$id_session' ".
574
-               " AND c_id='$enreg_course'";
571
+                " FROM $tbl_session_rel_course_rel_user " .
572
+                " WHERE session_id='$id_session' ".
573
+                " AND c_id='$enreg_course'";
575 574
         $rs = Database::query($sql);
576 575
         list($nbr_users) = Database::fetch_array($rs);
577 576
         Database::query("UPDATE $tbl_session_rel_course  ".
578
-               " SET nbr_users=$nbr_users " .
579
-               " WHERE session_id='$id_session' ".
580
-               " AND c_id='$enreg_course'");
577
+                " SET nbr_users=$nbr_users " .
578
+                " WHERE session_id='$id_session' ".
579
+                " AND c_id='$enreg_course'");
581 580
     }
582 581
     foreach ($UserList as $enreg_user) {
583 582
         $enreg_user = (int) $enreg_user;
584 583
         Database::query("INSERT IGNORE INTO $tbl_session_rel_user ".
585
-               " (session_id, user_id, registered_at) " .
586
-               " VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')");
584
+                " (session_id, user_id, registered_at) " .
585
+                " VALUES('$id_session','$enreg_user', '" . api_get_utc_datetime() . "')");
587 586
     }
588 587
     // We update the number of users in the session
589 588
     $sql = "SELECT COUNT(user_id) as nbUsers FROM $tbl_session_rel_user ".
590
-           " WHERE session_id='$id_session' ".
591
-           " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." ";
589
+            " WHERE session_id='$id_session' ".
590
+            " AND relation_type<>".SESSION_RELATION_TYPE_RRHH." ";
592 591
     $rs = Database::query($sql);
593 592
     list($nbr_users) = Database::fetch_array($rs);
594 593
     Database::query("UPDATE $tbl_session SET nbr_users=$nbr_users ".
595
-           " WHERE id='$id_session'");
594
+            " WHERE id='$id_session'");
596 595
 }
597 596
 
598 597
 function syncro_users() {
Please login to merge, or discard this patch.
main/user/subscribe_user.php 1 patch
Indentation   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 // Access restriction
26 26
 if (!api_is_allowed_to_edit()) {
27
-	 api_not_allowed(true);
27
+        api_not_allowed(true);
28 28
 }
29 29
 
30 30
 $tool_name = get_lang("SubscribeUserToCourse");
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 $courseInfo = api_get_course_info();
35 35
 
36 36
 if ($type == COURSEMANAGER) {
37
-	$tool_name = get_lang("SubscribeUserToCourseAsTeacher");
37
+    $tool_name = get_lang("SubscribeUserToCourseAsTeacher");
38 38
 }
39 39
 
40 40
 //extra entries in breadcrumb
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         "url" => "subscribe_user.php?type=".$type.'&'.api_get_cidreq(),
48 48
         "name" => $tool_name,
49 49
     );
50
-	$tool_name = get_lang('SearchResults');
50
+    $tool_name = get_lang('SearchResults');
51 51
 }
52 52
 
53 53
 $current_session_id = api_get_session_id();
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         );
77 77
     }
78 78
 
79
-	$user_id_temp = $_SESSION['session_user_id'];
79
+    $user_id_temp = $_SESSION['session_user_id'];
80 80
 
81 81
     if (is_array($user_id_temp)) {
82 82
         $counter = count($user_id_temp);
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
 
170 170
             header('Location:'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'&type='.$type);
171 171
             exit;
172
-			break;
173
-	}
172
+            break;
173
+    }
174 174
 }
175 175
 
176 176
 if (!empty($_SESSION['session_user_id'])) {
177
-	unset($_SESSION['session_user_id']);
177
+    unset($_SESSION['session_user_id']);
178 178
 }
179 179
 
180 180
 if (!empty($_SESSION['session_user_name'])) {
181
-	unset($_SESSION['session_user_name']);
181
+    unset($_SESSION['session_user_name']);
182 182
 }
183 183
 
184 184
 $is_western_name_order = api_is_western_name_order();
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 
187 187
 // Build table
188 188
 $table = new SortableTable(
189
-	'subscribe_users',
190
-	'get_number_of_users',
191
-	'get_user_data',
192
-	($is_western_name_order xor $sort_by_first_name) ? 3 : 2
189
+    'subscribe_users',
190
+    'get_number_of_users',
191
+    'get_user_data',
192
+    ($is_western_name_order xor $sort_by_first_name) ? 3 : 2
193 193
 );
194 194
 $parameters['keyword'] = $keyword;
195 195
 $parameters['type'] = $type;
@@ -272,20 +272,20 @@  discard block
 block discarded – undo
272 272
  */
273 273
 function get_number_of_users()
274 274
 {
275
-	// Database table definition
276
-	$user_table = Database::get_main_table(TABLE_MAIN_USER);
277
-	$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
278
-	$tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
279
-	$table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
275
+    // Database table definition
276
+    $user_table = Database::get_main_table(TABLE_MAIN_USER);
277
+    $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
278
+    $tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
279
+    $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
280 280
 
281 281
     $courseCode = api_get_course_id();
282 282
     $sessionId = api_get_session_id();
283 283
 
284
-	if (isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {
284
+    if (isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {
285 285
 
286
-		if (api_get_session_id() != 0) {
286
+        if (api_get_session_id() != 0) {
287 287
 
288
-			$sql = "SELECT COUNT(u.user_id)
288
+            $sql = "SELECT COUNT(u.user_id)
289 289
 					FROM $user_table u
290 290
 					LEFT JOIN $tbl_session_rel_course_user cu
291 291
 					ON
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 						u.status = 1 AND
298 298
 						(u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
299 299
 
300
-			if (api_is_multiple_url_enabled()) {
301
-				$url_access_id = api_get_current_access_url_id();
302
-				if ($url_access_id !=-1) {
303
-					$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
304
-					$sql = "SELECT COUNT(u.user_id)
300
+            if (api_is_multiple_url_enabled()) {
301
+                $url_access_id = api_get_current_access_url_id();
302
+                if ($url_access_id !=-1) {
303
+                    $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
304
+                    $sql = "SELECT COUNT(u.user_id)
305 305
 							FROM $user_table u
306 306
 							LEFT JOIN $tbl_session_rel_course_user cu
307 307
 							ON
@@ -315,34 +315,34 @@  discard block
 block discarded – undo
315 315
 								u.status = 1 AND
316 316
 								(u.official_code <> 'ADMIN' OR u.official_code IS NULL)
317 317
 							";
318
-				}
319
-			}
320
-		} else {
321
-			$sql = "SELECT COUNT(u.user_id)
318
+                }
319
+            }
320
+        } else {
321
+            $sql = "SELECT COUNT(u.user_id)
322 322
 					FROM $user_table u
323 323
 					LEFT JOIN $course_user_table cu
324 324
 					ON u.user_id = cu.user_id and c_id='".api_get_course_int_id()."'
325 325
 				    WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
326 326
 
327
-			if (api_is_multiple_url_enabled()) {
328
-				$url_access_id = api_get_current_access_url_id();
329
-				if ($url_access_id !=-1) {
330
-					$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
327
+            if (api_is_multiple_url_enabled()) {
328
+                $url_access_id = api_get_current_access_url_id();
329
+                if ($url_access_id !=-1) {
330
+                    $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
331 331
 
332
-					$sql = "SELECT COUNT(u.user_id)
332
+                    $sql = "SELECT COUNT(u.user_id)
333 333
 						FROM $user_table u
334 334
 						LEFT JOIN $course_user_table cu
335 335
 						ON u.user_id = cu.user_id AND c_id='".api_get_course_int_id()."'
336 336
 						INNER JOIN  $tbl_url_rel_user as url_rel_user
337 337
 						ON (url_rel_user.user_id = u.user_id)
338 338
 						WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
339
-				}
340
-			}
341
-		}
342
-	} else {
343
-		// students
344
-		if (api_get_session_id() != 0) {
345
-			$sql = "SELECT COUNT(u.user_id)
339
+                }
340
+            }
341
+        }
342
+    } else {
343
+        // students
344
+        if (api_get_session_id() != 0) {
345
+            $sql = "SELECT COUNT(u.user_id)
346 346
 					FROM $user_table u
347 347
 					LEFT JOIN $tbl_session_rel_course_user cu
348 348
 					ON
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 						u.status<>".DRH." AND
355 355
 						(u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
356 356
 
357
-			if (api_is_multiple_url_enabled()) {
358
-				$url_access_id = api_get_current_access_url_id();
359
-				if ($url_access_id !=-1) {
360
-					$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
361
-					$sql = "SELECT COUNT(u.user_id)
357
+            if (api_is_multiple_url_enabled()) {
358
+                $url_access_id = api_get_current_access_url_id();
359
+                if ($url_access_id !=-1) {
360
+                    $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
361
+                    $sql = "SELECT COUNT(u.user_id)
362 362
 							FROM $user_table u
363 363
 							LEFT JOIN $tbl_session_rel_course_user cu
364 364
 							ON
@@ -372,21 +372,21 @@  discard block
 block discarded – undo
372 372
 								u.status<>".DRH." AND
373 373
 								access_url_id= $url_access_id AND
374 374
 								(u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
375
-				}
376
-			}
377
-		} else {
378
-			$sql = "SELECT COUNT(u.user_id)
375
+                }
376
+            }
377
+        } else {
378
+            $sql = "SELECT COUNT(u.user_id)
379 379
 					FROM $user_table u
380 380
 					LEFT JOIN $course_user_table cu
381 381
 					ON u.user_id = cu.user_id AND c_id='".api_get_course_int_id()."'";
382 382
 
383
-			// we change the SQL when we have a filter
384
-			if (isset($_GET['subscribe_user_filter_value']) &&
383
+            // we change the SQL when we have a filter
384
+            if (isset($_GET['subscribe_user_filter_value']) &&
385 385
                 !empty($_GET['subscribe_user_filter_value']) &&
386 386
                 api_get_setting('ProfilingFilterAddingUsers') == 'true'
387 387
             ){
388
-				$field_identification = explode('*',$_GET['subscribe_user_filter_value']);
389
-				$sql .=	"
388
+                $field_identification = explode('*',$_GET['subscribe_user_filter_value']);
389
+                $sql .=	"
390 390
 					LEFT JOIN $table_user_field_values field_values
391 391
 					ON field_values.item_id = u.user_id
392 392
 					WHERE
@@ -395,32 +395,32 @@  discard block
 block discarded – undo
395 395
 						field_values.field_id = '".intval($field_identification[0])."' AND
396 396
 						field_values.value = '".Database::escape_string($field_identification[1])."'
397 397
 					";
398
-			} else	{
399
-				$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
400
-			}
398
+            } else	{
399
+                $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
400
+            }
401 401
 
402
-			if (api_is_multiple_url_enabled()) {
403
-				$url_access_id = api_get_current_access_url_id();
402
+            if (api_is_multiple_url_enabled()) {
403
+                $url_access_id = api_get_current_access_url_id();
404 404
 
405
-				if ($url_access_id !=-1) {
405
+                if ($url_access_id !=-1) {
406 406
 
407
-					$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
407
+                    $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
408 408
 
409
-					$sql = "SELECT COUNT(u.user_id)
409
+                    $sql = "SELECT COUNT(u.user_id)
410 410
 							FROM $user_table u
411 411
 							LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and c_id='".api_get_course_int_id()."'
412 412
 							INNER JOIN  $tbl_url_rel_user as url_rel_user
413 413
 							ON (url_rel_user.user_id = u.user_id)
414 414
 							WHERE cu.user_id IS NULL AND access_url_id= $url_access_id AND u.status<>".DRH." ";
415
-				}
416
-			}
417
-		}
418
-	}
419
-
420
-	// when there is a keyword then we are searching and we have to change the SQL statement
421
-	if (isset($_GET['keyword']) AND !empty($_GET['keyword'])) {
422
-		$keyword = Database::escape_string(trim($_REQUEST['keyword']));
423
-		$sql .= " AND (
415
+                }
416
+            }
417
+        }
418
+    }
419
+
420
+    // when there is a keyword then we are searching and we have to change the SQL statement
421
+    if (isset($_GET['keyword']) AND !empty($_GET['keyword'])) {
422
+        $keyword = Database::escape_string(trim($_REQUEST['keyword']));
423
+        $sql .= " AND (
424 424
 		    firstname LIKE '%".$keyword."%' OR
425 425
 		    lastname LIKE '%".$keyword."%' OR
426 426
 		    email LIKE '%".$keyword."%' OR
@@ -428,37 +428,37 @@  discard block
 block discarded – undo
428 428
 		    official_code LIKE '%".$keyword."%'
429 429
         )";
430 430
 
431
-		// we also want to search for users who have something in their profile fields that matches the keyword
432
-		if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {
433
-			$additional_users = search_additional_profile_fields($keyword);
434
-		}
431
+        // we also want to search for users who have something in their profile fields that matches the keyword
432
+        if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {
433
+            $additional_users = search_additional_profile_fields($keyword);
434
+        }
435 435
 
436
-		// getting all the users of the course (to make sure that we do not display users that are already in the course)
437
-		if (!empty($_SESSION["id_session"])) {
436
+        // getting all the users of the course (to make sure that we do not display users that are already in the course)
437
+        if (!empty($_SESSION["id_session"])) {
438 438
             $a_course_users = CourseManager:: get_user_list_from_course_code(
439 439
                 $courseCode,
440 440
                 $sessionId
441 441
             );
442
-		} else {
442
+        } else {
443 443
             $a_course_users = CourseManager:: get_user_list_from_course_code(
444 444
                 $courseCode,
445 445
                 0
446 446
             );
447
-	    }
448
-		foreach ($a_course_users as $user_id=>$course_user) {
449
-			$users_of_course[] = $course_user['user_id'];
450
-	    }
451
-	}
447
+        }
448
+        foreach ($a_course_users as $user_id=>$course_user) {
449
+            $users_of_course[] = $course_user['user_id'];
450
+        }
451
+    }
452 452
     $sql .=" AND u.status <> ".ANONYMOUS." ";
453
-	$res = Database::query($sql);
453
+    $res = Database::query($sql);
454 454
     $count_user = 0;
455 455
 
456 456
     if ($res) {
457
-	   $row = Database::fetch_row($res);
458
-	   $count_user = $row[0];
459
-	}
457
+        $row = Database::fetch_row($res);
458
+        $count_user = $row[0];
459
+    }
460 460
 
461
-	return $count_user;
461
+    return $count_user;
462 462
 }
463 463
 /**
464 464
  * Get the users to display on the current page.
@@ -468,17 +468,17 @@  discard block
 block discarded – undo
468 468
     $url_access_id = api_get_current_access_url_id();
469 469
     $course_code = api_get_course_id();
470 470
     $session_id = api_get_session_id();
471
-	$courseId = api_get_course_int_id();
471
+    $courseId = api_get_course_int_id();
472 472
 
473
-	// Database table definitions
474
-	$user_table = Database::get_main_table(TABLE_MAIN_USER);
475
-	$course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
476
-	$tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
477
-	$table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
473
+    // Database table definitions
474
+    $user_table = Database::get_main_table(TABLE_MAIN_USER);
475
+    $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
476
+    $tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
477
+    $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
478 478
     $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
479 479
 
480 480
     // adding teachers
481
-	$is_western_name_order = api_is_western_name_order();
481
+    $is_western_name_order = api_is_western_name_order();
482 482
 
483 483
     if (api_get_setting('show_email_addresses') == 'true') {
484 484
 
@@ -503,10 +503,10 @@  discard block
 block discarded – undo
503 503
                 u.active               AS col4,
504 504
                 u.user_id              AS col5";
505 505
     }
506
-	if (isset($_REQUEST['type']) && $_REQUEST['type'] == COURSEMANAGER) {
507
-		// adding a teacher through a session
508
-		if (!empty($session_id)) {
509
-			$sql = "SELECT $select_fields
506
+    if (isset($_REQUEST['type']) && $_REQUEST['type'] == COURSEMANAGER) {
507
+        // adding a teacher through a session
508
+        if (!empty($session_id)) {
509
+            $sql = "SELECT $select_fields
510 510
 					FROM $user_table u
511 511
 					LEFT JOIN $tbl_session_rel_course_user cu
512 512
 					ON
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
                     INNER JOIN  $tbl_url_rel_user as url_rel_user
517 517
                     ON (url_rel_user.user_id = u.user_id) ";
518 518
 
519
-			// applying the filter of the additional user profile fields
520
-			if (isset($_GET['subscribe_user_filter_value']) &&
521
-				!empty($_GET['subscribe_user_filter_value']) &&
522
-				api_get_setting('ProfilingFilterAddingUsers') == 'true'
523
-			) {
524
-				$field_identification = explode('*',$_GET['subscribe_user_filter_value']);
525
-				$sql .=	"
519
+            // applying the filter of the additional user profile fields
520
+            if (isset($_GET['subscribe_user_filter_value']) &&
521
+                !empty($_GET['subscribe_user_filter_value']) &&
522
+                api_get_setting('ProfilingFilterAddingUsers') == 'true'
523
+            ) {
524
+                $field_identification = explode('*',$_GET['subscribe_user_filter_value']);
525
+                $sql .=	"
526 526
 					LEFT JOIN $table_user_field_values field_values
527 527
 						ON field_values.item_id = u.user_id
528 528
 					WHERE
@@ -531,53 +531,53 @@  discard block
 block discarded – undo
531 531
 						(u.official_code <> 'ADMIN' OR u.official_code IS NULL) AND
532 532
 						field_values.field_id = '".intval($field_identification[0])."' AND
533 533
 						field_values.value = '".Database::escape_string($field_identification[1])."'";
534
-			} else {
535
-				$sql .=	"WHERE cu.user_id IS NULL AND u.status=1 AND (u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
536
-			}
534
+            } else {
535
+                $sql .=	"WHERE cu.user_id IS NULL AND u.status=1 AND (u.official_code <> 'ADMIN' OR u.official_code IS NULL) ";
536
+            }
537 537
 
538 538
             $sql .=	" AND access_url_id= $url_access_id";
539 539
 
540
-		} else {
541
-		     // adding a teacher NOT through a session
542
-			$sql = "SELECT $select_fields
540
+        } else {
541
+                // adding a teacher NOT through a session
542
+            $sql = "SELECT $select_fields
543 543
                     FROM $user_table u
544 544
                     LEFT JOIN $course_user_table cu
545 545
                     ON u.user_id = cu.user_id AND c_id = '".$courseId."'";
546 546
 
547
-				// applying the filter of the additional user profile fields
548
-				if (isset($_GET['subscribe_user_filter_value']) &&
549
-					!empty($_GET['subscribe_user_filter_value']) &&
550
-					api_get_setting('ProfilingFilterAddingUsers') == 'true'
551
-				) {
552
-					$field_identification = explode('*',$_GET['subscribe_user_filter_value']);
553
-					$sql .=	"
547
+                // applying the filter of the additional user profile fields
548
+                if (isset($_GET['subscribe_user_filter_value']) &&
549
+                    !empty($_GET['subscribe_user_filter_value']) &&
550
+                    api_get_setting('ProfilingFilterAddingUsers') == 'true'
551
+                ) {
552
+                    $field_identification = explode('*',$_GET['subscribe_user_filter_value']);
553
+                    $sql .=	"
554 554
 						LEFT JOIN $table_user_field_values field_values
555 555
 							ON field_values.item_id = u.user_id
556 556
 						WHERE
557 557
 							cu.user_id IS NULL AND u.status<>".DRH." AND
558 558
 							field_values.field_id = '".intval($field_identification[0])."' AND
559 559
 							field_values.value = '".Database::escape_string($field_identification[1])."'";
560
-				} else	{
561
-					$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
562
-				}
563
-
564
-				// adding a teacher NOT trough a session on a portal with multiple URLs
565
-				if (api_is_multiple_url_enabled()) {
566
-					if ($url_access_id !=-1) {
567
-						$sql = "SELECT $select_fields
560
+                } else	{
561
+                    $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
562
+                }
563
+
564
+                // adding a teacher NOT trough a session on a portal with multiple URLs
565
+                if (api_is_multiple_url_enabled()) {
566
+                    if ($url_access_id !=-1) {
567
+                        $sql = "SELECT $select_fields
568 568
 						FROM $user_table u
569 569
 						LEFT JOIN $course_user_table cu
570 570
 						ON u.user_id = cu.user_id and c_id='".$courseId."'
571 571
 						INNER JOIN  $tbl_url_rel_user as url_rel_user
572 572
 						ON (url_rel_user.user_id = u.user_id) ";
573 573
 
574
-					// applying the filter of the additional user profile fields
575
-					if (isset($_GET['subscribe_user_filter_value']) &&
576
-						!empty($_GET['subscribe_user_filter_value']) &&
577
-						api_get_setting('ProfilingFilterAddingUsers') == 'true'
578
-					){
579
-						$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
580
-						$sql .=	"
574
+                    // applying the filter of the additional user profile fields
575
+                    if (isset($_GET['subscribe_user_filter_value']) &&
576
+                        !empty($_GET['subscribe_user_filter_value']) &&
577
+                        api_get_setting('ProfilingFilterAddingUsers') == 'true'
578
+                    ){
579
+                        $field_identification = explode('*', $_GET['subscribe_user_filter_value']);
580
+                        $sql .=	"
581 581
 							LEFT JOIN $table_user_field_values field_values
582 582
 								ON field_values.item_id = u.user_id
583 583
 							WHERE
@@ -585,16 +585,16 @@  discard block
 block discarded – undo
585 585
 							 	u.status<>".DRH." AND
586 586
 							 	field_values.field_id = '".intval($field_identification[0])."' AND
587 587
 							 	field_values.value = '".Database::escape_string($field_identification[1])."'";
588
-					} else	{
589
-						$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
590
-					}
591
-				}
592
-			}
593
-		}
594
-	} else {
595
-		// adding a student
596
-		if (!empty($session_id)) {
597
-			$sql = "SELECT $select_fields
588
+                    } else	{
589
+                        $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
590
+                    }
591
+                }
592
+            }
593
+        }
594
+    } else {
595
+        // adding a student
596
+        if (!empty($session_id)) {
597
+            $sql = "SELECT $select_fields
598 598
                     FROM $user_table u
599 599
                     LEFT JOIN $tbl_session_rel_course_user cu
600 600
                     ON
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
                 $sql .=  "AND access_url_id = $url_access_id";
630 630
             }
631 631
 
632
-		} else {
632
+        } else {
633 633
             $sql = "SELECT $select_fields
634 634
                     FROM $user_table u
635 635
                     LEFT JOIN $course_user_table cu
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
                     	u.user_id = cu.user_id AND
638 638
                     	c_id ='".$courseId."'";
639 639
 
640
-			// applying the filter of the additional user profile fields
641
-			if (isset($_GET['subscribe_user_filter_value']) && !empty($_GET['subscribe_user_filter_value'])){
642
-				$field_identification = explode('*',$_GET['subscribe_user_filter_value']);
643
-				$sql .=	"
640
+            // applying the filter of the additional user profile fields
641
+            if (isset($_GET['subscribe_user_filter_value']) && !empty($_GET['subscribe_user_filter_value'])){
642
+                $field_identification = explode('*',$_GET['subscribe_user_filter_value']);
643
+                $sql .=	"
644 644
 					LEFT JOIN $table_user_field_values field_values
645 645
 						ON field_values.item_id = u.user_id
646 646
 					WHERE
@@ -648,28 +648,28 @@  discard block
 block discarded – undo
648 648
 						u.status<>".DRH." AND
649 649
 						field_values.field_id = '".intval($field_identification[0])."' AND
650 650
 						field_values.value = '".Database::escape_string($field_identification[1])."'";
651
-			} else	{
652
-				$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
653
-			}
651
+            } else	{
652
+                $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." ";
653
+            }
654 654
 
655
-			//showing only the courses of the current Chamilo access_url_id
655
+            //showing only the courses of the current Chamilo access_url_id
656 656
 
657
-			if (api_is_multiple_url_enabled()) {
658
-				if ($url_access_id !=-1) {
659
-					$sql = "SELECT $select_fields
657
+            if (api_is_multiple_url_enabled()) {
658
+                if ($url_access_id !=-1) {
659
+                    $sql = "SELECT $select_fields
660 660
 						FROM $user_table u
661 661
 						LEFT JOIN $course_user_table cu
662 662
 						ON u.user_id = cu.user_id AND c_id='".$courseId."'
663 663
 						INNER JOIN  $tbl_url_rel_user as url_rel_user
664 664
 						ON (url_rel_user.user_id = u.user_id) ";
665 665
 
666
-					// applying the filter of the additional user profile fields
667
-					if (isset($_GET['subscribe_user_filter_value']) &&
668
-						!empty($_GET['subscribe_user_filter_value']) &&
669
-						api_get_setting('ProfilingFilterAddingUsers') == 'true'
670
-					){
671
-						$field_identification = explode('*', $_GET['subscribe_user_filter_value']);
672
-						$sql .=	"
666
+                    // applying the filter of the additional user profile fields
667
+                    if (isset($_GET['subscribe_user_filter_value']) &&
668
+                        !empty($_GET['subscribe_user_filter_value']) &&
669
+                        api_get_setting('ProfilingFilterAddingUsers') == 'true'
670
+                    ){
671
+                        $field_identification = explode('*', $_GET['subscribe_user_filter_value']);
672
+                        $sql .=	"
673 673
 							LEFT JOIN $table_user_field_values field_values
674 674
 								ON field_values.item_id = u.user_id
675 675
 							WHERE
@@ -679,19 +679,19 @@  discard block
 block discarded – undo
679 679
 								field_values.value = '".Database::escape_string($field_identification[1])."' AND
680 680
 								access_url_id = $url_access_id
681 681
                             ";
682
-					} else	{
683
-						$sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
684
-					}
685
-				}
686
-			}
687
-		}
688
-	}
689
-
690
-	// adding additional WHERE statements to the SQL for the search functionality
682
+                    } else	{
683
+                        $sql .=	"WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id ";
684
+                    }
685
+                }
686
+            }
687
+        }
688
+    }
689
+
690
+    // adding additional WHERE statements to the SQL for the search functionality
691 691
     $additional_users = null;
692
-	if (isset($_REQUEST['keyword'])) {
693
-		$keyword = Database::escape_string(trim($_REQUEST['keyword']));
694
-		$sql .= " AND (
692
+    if (isset($_REQUEST['keyword'])) {
693
+        $keyword = Database::escape_string(trim($_REQUEST['keyword']));
694
+        $sql .= " AND (
695 695
 					firstname LIKE '%".$keyword."%' OR
696 696
 					lastname LIKE '%".$keyword."%' OR
697 697
 					email LIKE '%".$keyword."%' OR
@@ -700,46 +700,46 @@  discard block
 block discarded – undo
700 700
 					)
701 701
 				";
702 702
 
703
-		if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {
704
-			// we also want to search for users who have something in
705
-			// their profile fields that matches the keyword
706
-			$additional_users = search_additional_profile_fields($keyword);
707
-		}
708
-
709
-		// getting all the users of the course (to make sure that we do not
710
-		// display users that are already in the course)
711
-		if (!empty($session_id)) {
712
-			$a_course_users = CourseManager :: get_user_list_from_course_code($course_code, $session_id);
713
-		} else {
714
-			$a_course_users = CourseManager :: get_user_list_from_course_code($course_code, 0);
715
-	    }
716
-		foreach ($a_course_users as $user_id=>$course_user) {
717
-			$users_of_course[] = $course_user['user_id'];
718
-		}
719
-	}
720
-
721
-	$sql .=" AND u.status != ".ANONYMOUS." ";
722
-
723
-	// Sorting and pagination (used by the sortable table)
724
-	$sql .= " ORDER BY col$column $direction ";
725
-	$sql .= " LIMIT $from,$number_of_items";
726
-
727
-	$res = Database::query($sql);
728
-	$users = array ();
729
-	while ($user = Database::fetch_row($res)) {
730
-		$users[] = $user;
731
-		$_SESSION['session_user_id'][] = $user[0];
732
-		if ($is_western_name_order) {
733
-			$_SESSION['session_user_name'][] = api_get_person_name($user[2], $user[3]);
734
-		} else {
735
-			$_SESSION['session_user_name'][] = api_get_person_name($user[3], $user[2]);
736
-		}
737
-	}
738
-	// adding additional users based on the search on the additional profile fields
739
-	if (isset($_REQUEST['keyword'])){
740
-		if (is_array($additional_users)) {
741
-			foreach($additional_users as $additional_user_key=>$additional_user_value){
742
-				if (!in_array($additional_user_key, $_SESSION['session_user_id']) &&
703
+        if (api_get_setting('ProfilingFilterAddingUsers') == 'true') {
704
+            // we also want to search for users who have something in
705
+            // their profile fields that matches the keyword
706
+            $additional_users = search_additional_profile_fields($keyword);
707
+        }
708
+
709
+        // getting all the users of the course (to make sure that we do not
710
+        // display users that are already in the course)
711
+        if (!empty($session_id)) {
712
+            $a_course_users = CourseManager :: get_user_list_from_course_code($course_code, $session_id);
713
+        } else {
714
+            $a_course_users = CourseManager :: get_user_list_from_course_code($course_code, 0);
715
+        }
716
+        foreach ($a_course_users as $user_id=>$course_user) {
717
+            $users_of_course[] = $course_user['user_id'];
718
+        }
719
+    }
720
+
721
+    $sql .=" AND u.status != ".ANONYMOUS." ";
722
+
723
+    // Sorting and pagination (used by the sortable table)
724
+    $sql .= " ORDER BY col$column $direction ";
725
+    $sql .= " LIMIT $from,$number_of_items";
726
+
727
+    $res = Database::query($sql);
728
+    $users = array ();
729
+    while ($user = Database::fetch_row($res)) {
730
+        $users[] = $user;
731
+        $_SESSION['session_user_id'][] = $user[0];
732
+        if ($is_western_name_order) {
733
+            $_SESSION['session_user_name'][] = api_get_person_name($user[2], $user[3]);
734
+        } else {
735
+            $_SESSION['session_user_name'][] = api_get_person_name($user[3], $user[2]);
736
+        }
737
+    }
738
+    // adding additional users based on the search on the additional profile fields
739
+    if (isset($_REQUEST['keyword'])){
740
+        if (is_array($additional_users)) {
741
+            foreach($additional_users as $additional_user_key=>$additional_user_value){
742
+                if (!in_array($additional_user_key, $_SESSION['session_user_id']) &&
743 743
                     !in_array($additional_user_key,$users_of_course)
744 744
                 ){
745 745
                     $users[] = array(
@@ -751,11 +751,11 @@  discard block
 block discarded – undo
751 751
                         $additional_user_value['col5'],
752 752
                         $additional_user_value['col6'],
753 753
                     );
754
-				}
755
-			}
756
-		}
757
-	}
758
-	return $users;
754
+                }
755
+            }
756
+        }
757
+    }
758
+    return $users;
759 759
 }
760 760
 /**
761 761
 * Returns a mailto-link
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 * @return string HTML-code with a mailto-link
764 764
 */
765 765
 function email_filter($email) {
766
-	return Display :: encrypted_mailto_link($email, $email);
766
+    return Display :: encrypted_mailto_link($email, $email);
767 767
 }
768 768
 /**
769 769
  * Build the reg-column of the table
@@ -776,8 +776,8 @@  discard block
 block discarded – undo
776 776
     } else {
777 777
         $type = STUDENT;
778 778
     }
779
-	$result = '<a class="btn btn-small btn-primary" href="'.api_get_self().'?register=yes&type='.$type.'&user_id='.$user_id.'">'.get_lang("reg").'</a>';
780
-	return $result;
779
+    $result = '<a class="btn btn-small btn-primary" href="'.api_get_self().'?register=yes&type='.$type.'&user_id='.$user_id.'">'.get_lang("reg").'</a>';
780
+    return $result;
781 781
 }
782 782
 
783 783
 /**
@@ -791,23 +791,23 @@  discard block
 block discarded – undo
791 791
  */
792 792
 
793 793
 function active_filter($active, $url_params, $row) {
794
-	$_user = api_get_user_info();
795
-	if ($active=='1') {
796
-		$action='AccountActive';
797
-		$image='accept';
798
-	}
799
-
800
-	if ($active=='0') {
801
-		$action='AccountInactive';
802
-		$image='error';
803
-	}
794
+    $_user = api_get_user_info();
795
+    if ($active=='1') {
796
+        $action='AccountActive';
797
+        $image='accept';
798
+    }
799
+
800
+    if ($active=='0') {
801
+        $action='AccountInactive';
802
+        $image='error';
803
+    }
804 804
     $result = null;
805
-	if ($row['0']<>$_user['user_id']) {
806
-	// you cannot lock yourself out otherwise you could disable all the accounts
807
-	// including your own => everybody is locked out and nobody can change it anymore.
808
-		$result = Display::return_icon($image.'.png',  get_lang(ucfirst($action)), array() , ICON_SIZE_TINY);
809
-	}
810
-	return $result;
805
+    if ($row['0']<>$_user['user_id']) {
806
+    // you cannot lock yourself out otherwise you could disable all the accounts
807
+    // including your own => everybody is locked out and nobody can change it anymore.
808
+        $result = Display::return_icon($image.'.png',  get_lang(ucfirst($action)), array() , ICON_SIZE_TINY);
809
+    }
810
+    return $result;
811 811
 }
812 812
 
813 813
 /**
@@ -825,29 +825,29 @@  discard block
 block discarded – undo
825 825
  */
826 826
 function search_additional_profile_fields($keyword)
827 827
 {
828
-	// database table definitions
829
-	$table_user_field_options = Database :: get_main_table(TABLE_EXTRA_FIELD_OPTIONS);
830
-	$table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
828
+    // database table definitions
829
+    $table_user_field_options = Database :: get_main_table(TABLE_EXTRA_FIELD_OPTIONS);
830
+    $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
831 831
     $tableExtraField = Database::get_main_table(TABLE_EXTRA_FIELD);
832
-	$table_user = Database::get_main_table(TABLE_MAIN_USER);
832
+    $table_user = Database::get_main_table(TABLE_MAIN_USER);
833 833
 
834
-	// getting the field option text that match this keyword (for radio buttons and checkboxes)
835
-	$sql = "SELECT * FROM $table_user_field_options
834
+    // getting the field option text that match this keyword (for radio buttons and checkboxes)
835
+    $sql = "SELECT * FROM $table_user_field_options
836 836
 	        WHERE display_text LIKE '%".$keyword."%'";
837
-	$result_profiling = Database::query($sql);
838
-	while ($profiling_field_options = Database::fetch_array($result_profiling)) {
839
-		$profiling_field_options_exact_values[] = $profiling_field_options;
840
-	}
837
+    $result_profiling = Database::query($sql);
838
+    while ($profiling_field_options = Database::fetch_array($result_profiling)) {
839
+        $profiling_field_options_exact_values[] = $profiling_field_options;
840
+    }
841 841
     $profiling_field_options_exact_values_sql = '';
842
-	foreach ($profiling_field_options_exact_values as $profilingkey => $profilingvalue){
843
-		$profiling_field_options_exact_values_sql .= " OR (field_id = '".$profilingvalue['field_id']."' AND value='".$profilingvalue['option_value']."') ";
844
-	}
842
+    foreach ($profiling_field_options_exact_values as $profilingkey => $profilingvalue){
843
+        $profiling_field_options_exact_values_sql .= " OR (field_id = '".$profilingvalue['field_id']."' AND value='".$profilingvalue['option_value']."') ";
844
+    }
845 845
 
846 846
     $extraFieldType = \Chamilo\CoreBundle\Entity\ExtraField::USER_FIELD_TYPE;
847 847
 
848
-	// getting all the user ids of the users who have chosen on of the predefined fields that contain the keyword
849
-	// or all the users who have entered the keyword in a free-form field
850
-	$sql = "SELECT
848
+    // getting all the user ids of the users who have chosen on of the predefined fields that contain the keyword
849
+    // or all the users who have entered the keyword in a free-form field
850
+    $sql = "SELECT
851 851
 	            user.user_id as col0,
852 852
 	            user.official_code as col1,
853 853
 	            user.lastname as col2,
@@ -861,13 +861,13 @@  discard block
 block discarded – undo
861 861
                 user_values.field_id = e.id AND
862 862
                 e.extra_field_type = $extraFieldType AND
863 863
                 (value LIKE '%".$keyword."%'".$profiling_field_options_exact_values_sql.")";
864
-	$result = Database::query($sql);
864
+    $result = Database::query($sql);
865 865
     $additional_users = array();
866
-	while ($profiled_users = Database::fetch_array($result)) {
867
-		$additional_users[$profiled_users['col0']] = $profiled_users;
868
-	}
866
+    while ($profiled_users = Database::fetch_array($result)) {
867
+        $additional_users[$profiled_users['col0']] = $profiled_users;
868
+    }
869 869
 
870
-	return $additional_users;
870
+    return $additional_users;
871 871
 }
872 872
 
873 873
 /**
@@ -879,41 +879,41 @@  discard block
 block discarded – undo
879 879
  */
880 880
 function display_extra_profile_fields_filter()
881 881
 {
882
-	// getting all the additional user profile fields
883
-	$extra = UserManager::get_extra_fields(0,50,5,'ASC');
884
-
885
-	$return='<option value="">'.get_lang('SelectFilter').'</option>';
886
-
887
-	// looping through the additional user profile fields
888
-	foreach ($extra as $id => $field_details) {
889
-		// $field_details[2] contains the type of the additional user profile field
890
-		switch ($field_details[2]) {
891
-			// text fields cannot be used as a filter
892
-			case ExtraField::FIELD_TYPE_TEXT:
893
-				break;
894
-			// text area fields cannot be used as a filter
895
-			case ExtraField::FIELD_TYPE_TEXTAREA:
896
-				break;
897
-			case ExtraField::FIELD_TYPE_RADIO:
898
-			case ExtraField::FIELD_TYPE_SELECT:
899
-			case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
900
-				$return .= '<optgroup label="'.$field_details[3].'">';
901
-				foreach($field_details[9] as $option_id => $option_details) {
902
-					if ($_GET['subscribe_user_filter_value'] == $field_details[0].'*'.$option_details[1]) {
903
-						$selected = 'selected="selected"';
904
-					} else {
905
-						$selected = false;
906
-					}
907
-					$return .= '<option value="'.$field_details[0].'*'.$option_details[1].'" '.$selected.'>'.$option_details[2].'</option>';
908
-				}
909
-				$return .= '</optgroup>';
910
-				break;
911
-		}
912
-	}
913
-
914
-	echo '<form id="subscribe_user_filter" name="subscribe_user_filter" method="get" action="'.api_get_self().'?api_get_cidreq" style="float:left;">';
915
-	echo '	<input type="hidden" name="type" id="type" value="'.Security::remove_XSS($_REQUEST['type']).'" />';
916
-	echo   '<select name="subscribe_user_filter_value" id="subscribe_user_filter_value">'.$return.'</select>';
917
-	echo   '<button type="submit" name="submit_filter" id="submit_filter" value="" class="search">'.get_lang('Filter').'</button>';
918
-	echo '</form>';
882
+    // getting all the additional user profile fields
883
+    $extra = UserManager::get_extra_fields(0,50,5,'ASC');
884
+
885
+    $return='<option value="">'.get_lang('SelectFilter').'</option>';
886
+
887
+    // looping through the additional user profile fields
888
+    foreach ($extra as $id => $field_details) {
889
+        // $field_details[2] contains the type of the additional user profile field
890
+        switch ($field_details[2]) {
891
+            // text fields cannot be used as a filter
892
+            case ExtraField::FIELD_TYPE_TEXT:
893
+                break;
894
+            // text area fields cannot be used as a filter
895
+            case ExtraField::FIELD_TYPE_TEXTAREA:
896
+                break;
897
+            case ExtraField::FIELD_TYPE_RADIO:
898
+            case ExtraField::FIELD_TYPE_SELECT:
899
+            case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
900
+                $return .= '<optgroup label="'.$field_details[3].'">';
901
+                foreach($field_details[9] as $option_id => $option_details) {
902
+                    if ($_GET['subscribe_user_filter_value'] == $field_details[0].'*'.$option_details[1]) {
903
+                        $selected = 'selected="selected"';
904
+                    } else {
905
+                        $selected = false;
906
+                    }
907
+                    $return .= '<option value="'.$field_details[0].'*'.$option_details[1].'" '.$selected.'>'.$option_details[2].'</option>';
908
+                }
909
+                $return .= '</optgroup>';
910
+                break;
911
+        }
912
+    }
913
+
914
+    echo '<form id="subscribe_user_filter" name="subscribe_user_filter" method="get" action="'.api_get_self().'?api_get_cidreq" style="float:left;">';
915
+    echo '	<input type="hidden" name="type" id="type" value="'.Security::remove_XSS($_REQUEST['type']).'" />';
916
+    echo   '<select name="subscribe_user_filter_value" id="subscribe_user_filter_value">'.$return.'</select>';
917
+    echo   '<button type="submit" name="submit_filter" id="submit_filter" value="" class="search">'.get_lang('Filter').'</button>';
918
+    echo '</form>';
919 919
 }
Please login to merge, or discard this patch.
main/admin/cli.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@
 block discarded – undo
28 28
 switch ($_GET["cmd"]) {
29 29
     case "clear_stapi":
30 30
       echo "Are you sure you are willing to erease all storage api data (no backup)? <a href='cli.php?cmd=clear_stapi_confirm' >Yes</a>";
31
-      break;
31
+        break;
32 32
     case "clear_stapi_confirm":
33 33
       Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES));
34
-      Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK));
35
-      echo "Done";
36
-      break;
34
+        Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK));
35
+        echo "Done";
36
+        break;
37 37
     default:
38 38
       echo "UNKNOWN COMMAND";
39
-      break;
39
+        break;
40 40
 }
41 41
 /**
42 42
  * Footer 
Please login to merge, or discard this patch.
main/admin/user_update_import.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@
 block discarded – undo
60 60
                     $user['error'] = get_lang('UserNameNotAvailable');
61 61
                     $errors[] = $user;
62 62
                 }
63
-             }
64
-          }
63
+                }
64
+            }
65 65
 
66 66
         // 3. Check status.
67 67
         if (isset($user['Status']) && !api_status_exists($user['Status'])) {
Please login to merge, or discard this patch.
main/cron/lang/langstats.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -22,59 +22,59 @@
 block discarded – undo
22 22
 $output = false;
23 23
 $ls = new langstats();
24 24
 if ($ls === false) {
25
-  exit($ls->error);
25
+    exit($ls->error);
26 26
 }
27 27
 $list = $ls->get_popular_terms($x_most_popular);
28 28
 if ($_GET['output'] == 1) {
29
-  $output = true;
30
-  $variables_origin = $ls->get_variables_origin();
29
+    $output = true;
30
+    $variables_origin = $ls->get_variables_origin();
31 31
 }
32 32
 /**
33 33
  * Display
34 34
  */
35 35
 if (count($list)==0) { echo 'No terms loaded so far'; }
36 36
 if (count($list)>0) {
37
-  $i = 1;
38
-  $j = 1;
39
-  $k = 0;
40
-  $files = array();
41
-  $trans = array();
42
-  echo 'Number of records: '.count($list).'<br />';
43
-  echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output==1?'<th>Origin</th>':'').'<th>Count</th></tr>';
44
-  foreach($list as $elem) {
37
+    $i = 1;
38
+    $j = 1;
39
+    $k = 0;
40
+    $files = array();
41
+    $trans = array();
42
+    echo 'Number of records: '.count($list).'<br />';
43
+    echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output==1?'<th>Origin</th>':'').'<th>Count</th></tr>';
44
+    foreach($list as $elem) {
45 45
     if ($k > $terms_limit) { break; }
46 46
     $fixed_elem = $elem;
47 47
     if ($output) {
48
-      if (empty($variables_origin[$elem['term_name']]) && !empty($variables_origin['lang'.$elem['term_name']])) {
48
+        if (empty($variables_origin[$elem['term_name']]) && !empty($variables_origin['lang'.$elem['term_name']])) {
49 49
         $fixed_elem = array('id' => $elem['id'], 'term_name' => 'lang'.$elem['term_name'], 'term_count' => $elem['term_count']);
50
-      }
51
-      if (empty($variables_origin[$fixed_elem['term_name']])) {
50
+        }
51
+        if (empty($variables_origin[$fixed_elem['term_name']])) {
52 52
         continue; 
53
-      }
54
-      $files[$variables_origin[$fixed_elem['term_name']]][] = $fixed_elem['term_name'];
55
-      $translation = get_lang($fixed_elem['term_name']);
56
-      $k += str_word_count($translation);
57
-      $trans[$fixed_elem['term_name']] = $translation;
58
-      $j++;
53
+        }
54
+        $files[$variables_origin[$fixed_elem['term_name']]][] = $fixed_elem['term_name'];
55
+        $translation = get_lang($fixed_elem['term_name']);
56
+        $k += str_word_count($translation);
57
+        $trans[$fixed_elem['term_name']] = $translation;
58
+        $j++;
59 59
     }
60 60
     echo '<tr><td>',$i,
61
-      '</td><td>',$fixed_elem['id'],
62
-      '</td><td>',$fixed_elem['term_name'];
61
+        '</td><td>',$fixed_elem['id'],
62
+        '</td><td>',$fixed_elem['term_name'];
63 63
     if ($output) {
64
-      echo '</td><td>'.$variables_origin[$fixed_elem['term_name']];
64
+        echo '</td><td>'.$variables_origin[$fixed_elem['term_name']];
65 65
     }
66 66
     echo '</td><td>',$fixed_elem['term_count'],'</td></tr>';
67 67
     $i++;
68
-  }
69
-  echo '</table>';
70
-  if ($output) {
68
+    }
69
+    echo '</table>';
70
+    if ($output) {
71 71
     @mkdir('/tmp/lang');
72 72
     foreach ($files as $file => $terms) {
73
-      @touch('/tmp/lang/'.$file);
74
-      file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL);
75
-      foreach ($terms as $term) {
73
+        @touch('/tmp/lang/'.$file);
74
+        file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL);
75
+        foreach ($terms as $term) {
76 76
         file_put_contents('/tmp/lang/'.$file,'$'.$term.' = "'.str_replace('"','\"',$trans[$term]).'";'.PHP_EOL, FILE_APPEND);
77
-      }
77
+        }
78 78
     }  
79
-  }
79
+    }
80 80
 }
Please login to merge, or discard this patch.
main/cron/lang/langstats_file_builder.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
  * Code run
34 34
  */
35 35
 foreach ($terms as $row) {
36
-  if ($words_counter > 10000) { break; }
37
-  $words = str_word_count(get_lang($row['term_name'],null,$orig_lang));
38
-  $words_counter += $words;
39
-  $terms_in_limit[$row['term_name']] = $i;
40
-  //echo "Term <b>".$row['term_name']."</b> is <b>'".get_lang($row['term_name'],null,$orig_lang)."'</b> which means $words words<br /><br />\n";
41
-  //if ($words_counter%1000 >= 0) {
36
+    if ($words_counter > 10000) { break; }
37
+    $words = str_word_count(get_lang($row['term_name'],null,$orig_lang));
38
+    $words_counter += $words;
39
+    $terms_in_limit[$row['term_name']] = $i;
40
+    //echo "Term <b>".$row['term_name']."</b> is <b>'".get_lang($row['term_name'],null,$orig_lang)."'</b> which means $words words<br /><br />\n";
41
+    //if ($words_counter%1000 >= 0) {
42 42
     //echo "Reached $words_counter words at term $i (".$row['term_name']." used ".$row['term_count']." times)...<br />\n";
43
-  //}
44
-  $i++;
43
+    //}
44
+    $i++;
45 45
 }
46 46
 //echo $words_counter.'<br />';
47 47
 
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 
50 50
 echo "Scanning English files, trying to find these terms...<br />\n";
51 51
 if (!is_dir($arch_dir.'/langstats')) {
52
-  mkdir($arch_dir.'/langstats');
53
-  mkdir($arch_dir.'/langstats/'.$orig_lang);
52
+    mkdir($arch_dir.'/langstats');
53
+    mkdir($arch_dir.'/langstats/'.$orig_lang);
54 54
 }
55 55
 $list_files = scandir($lang_dir.'/'.$orig_lang);
56 56
 $j = 1;
@@ -59,35 +59,35 @@  discard block
 block discarded – undo
59 59
 $global_var = array(); //keep the combination of all vars
60 60
 $terms_in_limit = array_flip($terms_in_limit);
61 61
 foreach ($list_files as $file) {
62
-  if (substr($file,0,1) == '.') {continue;}
63
-  //echo "'".substr($file,0,-8)."',<br />"; //print in a PHP array format
64
-  $vars = file($lang_dir.'/'.$orig_lang.'/'.$file);
65
-  $local_var = array();
66
-  $file_string = '<?php'."\n";
67
-  foreach ($vars as $line) {
62
+    if (substr($file,0,1) == '.') {continue;}
63
+    //echo "'".substr($file,0,-8)."',<br />"; //print in a PHP array format
64
+    $vars = file($lang_dir.'/'.$orig_lang.'/'.$file);
65
+    $local_var = array();
66
+    $file_string = '<?php'."\n";
67
+    foreach ($vars as $line) {
68 68
     $var = array();
69 69
     $res = preg_match('/^(\$\w*)/',$line,$var);
70 70
     if ($res>0) {
71
-      //echo $var[1]."<br />";
71
+        //echo $var[1]."<br />";
72 72
       
73
-      if (in_array(substr($var[1],1),$terms_in_limit)) {
73
+        if (in_array(substr($var[1],1),$terms_in_limit)) {
74 74
         //echo "Var ".$var[1]." was in the limit<br />";
75 75
         $local_var[$var[1]] = $line;
76 76
         $file_string .= $line;
77 77
         $terms_found[] = substr($var[1],1); //e.g. store Tools
78 78
         $words_found += str_word_count(get_lang($var[1],null,$orig_lang));
79
-      } elseif (in_array(substr($var[1],5),$terms_in_limit)) {
79
+        } elseif (in_array(substr($var[1],5),$terms_in_limit)) {
80 80
         //echo "Var ".$var[1]." was in the limit<br />";
81 81
         $local_var[$var[1]] = $line;
82 82
         $file_string .= $line;
83 83
         $terms_found[] = substr($var[1],5); //e.g. store langTools
84 84
         $words_found += str_word_count(get_lang(substr($var[1],5),null,$orig_lang));
85
-      } //else do not care
85
+        } //else do not care
86 86
     }
87
-  }
88
-  echo "Writing ".$arch_dir.'/langstats/'.$orig_lang.'/'.$file."<br />\n";
89
-  file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file,$file_string); 
90
-  $global_var += $local_var;
87
+    }
88
+    echo "Writing ".$arch_dir.'/langstats/'.$orig_lang.'/'.$file."<br />\n";
89
+    file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file,$file_string); 
90
+    $global_var += $local_var;
91 91
 };
92 92
 $terms_diff = count($global_var)-count($terms_in_limit);
93 93
 echo count($global_var)." terms found in English files (summing up to $words_found words). Some terms ($terms_diff in this case) might have appeared in two different files<br />";
Please login to merge, or discard this patch.
main/inc/lib/api.lib.php 1 patch
Indentation   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -625,7 +625,6 @@  discard block
 block discarded – undo
625 625
  * The other configuration parameters have not been changed.
626 626
  *
627 627
  * This is how we can get most used paths, for common purpose:
628
-
629 628
  * api_get_path(REL_PATH)                       /chamilo/
630 629
  * api_get_path(REL_COURSE_PATH)                /chamilo/courses/
631 630
  * api_get_path(REL_CODE_PATH)                  /chamilo/main/
@@ -1803,7 +1802,6 @@  discard block
 block discarded – undo
1803 1802
 
1804 1803
 /**
1805 1804
  * Returns the current course info array.
1806
-
1807 1805
  * Now if the course_code is given, the returned array gives info about that
1808 1806
  * particular course, not specially the current one.
1809 1807
  * @param int $id Numeric ID of the course
@@ -2734,7 +2732,7 @@  discard block
 block discarded – undo
2734 2732
         switch ($session_user_status) {
2735 2733
             case 0:
2736 2734
                 $session_status['status'] = 'student';
2737
-               break;
2735
+                break;
2738 2736
             case 2:
2739 2737
                 $session_status['status'] = 'coach';
2740 2738
             break;
@@ -6492,7 +6490,7 @@  discard block
 block discarded – undo
6492 6490
 function api_get_jquery_ui_js($include_jqgrid = false) {
6493 6491
     $libraries = array();
6494 6492
     if ($include_jqgrid) {
6495
-       $libraries[]='jqgrid';
6493
+        $libraries[]='jqgrid';
6496 6494
     }
6497 6495
     return api_get_jquery_libraries_js($libraries);
6498 6496
 }
Please login to merge, or discard this patch.
main/install/install.lib.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
         $html .= '<label class="checkbox-inline">
1683 1683
                         <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
1684 1684
                     </label>';
1685
-         $html .= '<label class="checkbox-inline">
1685
+            $html .= '<label class="checkbox-inline">
1686 1686
                     <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .'
1687 1687
                 </label>';
1688 1688
         $html .= '</div>';
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
     </div>';
1717 1717
 
1718 1718
     echo panel($html, get_lang('Platform'), 'platform');
1719
- ?>
1719
+    ?>
1720 1720
     <div class='form-group'>
1721 1721
         <div class="col-sm-6">
1722 1722
             <button type="submit" class="btn btn-default pull-right" name="step3" value="&lt; <?php echo get_lang('Previous'); ?>" ><em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?></button>
Please login to merge, or discard this patch.
main/course_home/course_home.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             if (Database::num_rows($result) ==  0) {
214 214
                 $condition = '';
215 215
             } else {
216
-            	//great, there is an specific auto launch for this session we leave the $condition
216
+                //great, there is an specific auto launch for this session we leave the $condition
217 217
             }
218 218
         }
219 219
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
             $lp_data = Database::fetch_array($result,'ASSOC');
226 226
             if (!empty($lp_data['id'])) {
227 227
                 if (api_is_platform_admin() || api_is_allowed_to_edit()) {
228
-                	$show_autolaunch_lp_warning = true;
228
+                    $show_autolaunch_lp_warning = true;
229 229
                 } else {
230 230
                     $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id();
231 231
                     if (!isset($_SESSION[$session_key])) {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         //if (!isset($_SESSION[$forumKey])) {
255 255
             //redirecting to the LP
256 256
             $url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&id_session='.$session_id;
257
-          //  $_SESSION[$forumKey] = true;
257
+            //  $_SESSION[$forumKey] = true;
258 258
             header("Location: $url");
259 259
             exit;
260 260
         //}
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
 if (api_get_setting('course.homepage_view') == 'activity' ||
281 281
     api_get_setting('course.homepage_view') == 'activity_big'
282 282
 ) {
283
-	require 'activity.php';
283
+    require 'activity.php';
284 284
 } elseif (api_get_setting('course.homepage_view') == '2column') {
285
-	require '2column.php';
285
+    require '2column.php';
286 286
 } elseif (api_get_setting('course.homepage_view') == '3column') {
287
-	require '3column.php';
287
+    require '3column.php';
288 288
 } elseif (api_get_setting('course.homepage_view') == 'vertical_activity') {
289
-	require 'vertical_activity.php';
289
+    require 'vertical_activity.php';
290 290
 }
291 291
 
292 292
 $content = '<div id="course_tools">'.$content.'</div>';
Please login to merge, or discard this patch.