Passed
Pull Request — 1.10.x (#986)
by
unknown
51:30
created
plugin/buycourses/src/recurring_payment_process.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Script to enable or disable autobilling in recurring payment in a service from a customer paypal account
4
- * @package chamilo.plugin.buycourses
5
- * @author Jose Loguercio Silva <[email protected]>
6
- */
3
+     * Script to enable or disable autobilling in recurring payment in a service from a customer paypal account
4
+     * @package chamilo.plugin.buycourses
5
+     * @author Jose Loguercio Silva <[email protected]>
6
+     */
7 7
 /**
8
- * Initialization
9
- */
8
+     * Initialization
9
+     */
10 10
 
11 11
 require_once '../../../main/inc/global.inc.php';
12 12
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             header('Location: service_catalog.php');
50 50
             exit;
51 51
         }
52
-        header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_panel.php');
52
+        header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_panel.php');
53 53
         exit;
54 54
         break;
55 55
     case 'disable_recurring_payment':
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             header('Location: service_catalog.php');
68 68
             exit;
69 69
         }
70
-        header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_panel.php');
70
+        header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_panel.php');
71 71
         exit;
72 72
         break;     
73 73
 }
74 74
\ No newline at end of file
Please login to merge, or discard this patch.
main/inc/lib/usermanager.lib.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1229,13 +1229,13 @@  discard block
 block discarded – undo
1229 1229
     }
1230 1230
 
1231 1231
     /**
1232
-    * Get the users by ID
1233
-    * @param array $ids student ids
1234
-    * @param string $active
1235
-    * @param string $order
1236
-    * @param string $limit
1237
-    * @return array $result student information
1238
-    */
1232
+     * Get the users by ID
1233
+     * @param array $ids student ids
1234
+     * @param string $active
1235
+     * @param string $order
1236
+     * @param string $limit
1237
+     * @return array $result student information
1238
+     */
1239 1239
     public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null)
1240 1240
     {
1241 1241
         if (empty($ids)) {
@@ -3332,12 +3332,12 @@  discard block
 block discarded – undo
3332 3332
         if ($tag_id == 0) {
3333 3333
             //the tag doesn't exist
3334 3334
             $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)";
3335
-             Database::query($sql);
3335
+                Database::query($sql);
3336 3336
             $last_insert_id = Database::insert_id();
3337 3337
         } else {
3338 3338
             //the tag exists we update it
3339 3339
             $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id  = $tag_id";
3340
-             Database::query($sql);
3340
+                Database::query($sql);
3341 3341
             $last_insert_id = $tag_id;
3342 3342
         }
3343 3343
 
@@ -3532,9 +3532,9 @@  discard block
 block discarded – undo
3532 3532
     }
3533 3533
 
3534 3534
     /**
3535
-      * Get extra filtrable user fields (only type select)
3536
-      * @return array
3537
-      */
3535
+     * Get extra filtrable user fields (only type select)
3536
+     * @return array
3537
+     */
3538 3538
     public static function get_extra_filtrable_fields()
3539 3539
     {
3540 3540
         $extraFieldList = UserManager::get_extra_fields();
@@ -3559,9 +3559,9 @@  discard block
 block discarded – undo
3559 3559
     }
3560 3560
 
3561 3561
     /**
3562
-      * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3563
-      * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3564
-      */
3562
+     * Get extra where clauses for finding users based on extra filtrable user fields (type select)
3563
+     * @return string With AND clauses based on user's ID which have the values to search in extra user fields
3564
+     */
3565 3565
     public static function get_search_form_where_extra_fields()
3566 3566
     {
3567 3567
         $useExtraFields = false;
@@ -3869,23 +3869,23 @@  discard block
 block discarded – undo
3869 3869
     }
3870 3870
 
3871 3871
     /**
3872
-    * Get users followed by human resource manager
3873
-    * @param int $userId
3874
-    * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
3875
-    * @param bool $getOnlyUserId
3876
-    * @param bool $getSql
3877
-    * @param bool $getCount
3878
-    * @param int $from
3879
-    * @param int $numberItems
3880
-    * @param int $column
3881
-    * @param string $direction
3882
-    * @param int $active
3883
-    * @param string $lastConnectionDate
3884
-    * @param int $status the function is called by who? COURSEMANAGER, DRH?
3885
-    * @param string $keyword
3872
+     * Get users followed by human resource manager
3873
+     * @param int $userId
3874
+     * @param int  $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
3875
+     * @param bool $getOnlyUserId
3876
+     * @param bool $getSql
3877
+     * @param bool $getCount
3878
+     * @param int $from
3879
+     * @param int $numberItems
3880
+     * @param int $column
3881
+     * @param string $direction
3882
+     * @param int $active
3883
+     * @param string $lastConnectionDate
3884
+     * @param int $status the function is called by who? COURSEMANAGER, DRH?
3885
+     * @param string $keyword
3886 3886
      *
3887
-    * @return array user list
3888
-    */
3887
+     * @return array user list
3888
+     */
3889 3889
     public static function getUsersFollowedByUser(
3890 3890
         $userId,
3891 3891
         $userStatus = null,
@@ -5058,31 +5058,31 @@  discard block
 block discarded – undo
5058 5058
         return $users;
5059 5059
     }
5060 5060
     
5061
-   /**
5062
-    * Search a user by a keyword (like a part of a firstname or lastname or username)
5063
-    * 
5064
-    * @param string $keyword
5065
-    * @return array|null
5066
-    */
5067
-   function searchUserByKeyword($keyword)
5068
-   {
5069
-       if (empty($keyword)) {
5070
-           return null;
5071
-       }
5072
-
5073
-       $tableUser = Database::get_main_table(TABLE_MAIN_USER);
5074
-
5075
-       $keyword = Database::escape_string($keyword);
5076
-
5077
-       $sql = "SELECT *
5061
+    /**
5062
+     * Search a user by a keyword (like a part of a firstname or lastname or username)
5063
+     * 
5064
+     * @param string $keyword
5065
+     * @return array|null
5066
+     */
5067
+    function searchUserByKeyword($keyword)
5068
+    {
5069
+        if (empty($keyword)) {
5070
+            return null;
5071
+        }
5072
+
5073
+        $tableUser = Database::get_main_table(TABLE_MAIN_USER);
5074
+
5075
+        $keyword = Database::escape_string($keyword);
5076
+
5077
+        $sql = "SELECT *
5078 5078
                FROM $tableUser
5079 5079
                WHERE
5080 5080
                    (
5081 5081
                        username LIKE '%$keyword%' OR firstname LIKE '%$keyword%' OR lastname LIKE '%$keyword%'
5082 5082
                    )";
5083
-       $result = Database::query($sql);
5084
-       return Database::store_result($result, 'ASSOC');
5085
-   }
5083
+        $result = Database::query($sql);
5084
+        return Database::store_result($result, 'ASSOC');
5085
+    }
5086 5086
 
5087 5087
     /**
5088 5088
      * @param int $optionSelected
Please login to merge, or discard this patch.
main/admin/user_list.php 1 patch
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
         if (isset($keywordListValues['keyword_status']) &&
240 240
             $keywordListValues['keyword_status'] == PLATFORM_ADMIN
241 241
         ) {
242
-           $query_admin_table = " , $admin_table a ";
243
-           $keyword_admin = ' AND a.user_id = u.id ';
242
+            $query_admin_table = " , $admin_table a ";
243
+            $keyword_admin = ' AND a.user_id = u.id ';
244 244
             $keywordListValues['keyword_status'] = '%';
245 245
         }
246 246
 
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
     $firstname = $userInfo['firstname'];
307 307
     $lastname = $userInfo['lastname'];
308 308
 
309
-	if (api_is_western_name_order()) {
310
-		$message = sprintf(get_lang('AttemptingToLoginAs'),$firstname,$lastname, $userId);
311
-	} else {
312
-		$message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId);
313
-	}
309
+    if (api_is_western_name_order()) {
310
+        $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname,$lastname, $userId);
311
+    } else {
312
+        $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId);
313
+    }
314 314
 
315
-	if ($userId) {
315
+    if ($userId) {
316 316
 
317 317
         // Logout the current user
318 318
         LoginDelete(api_get_user_id());
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         Display :: display_footer();
348 348
         exit;
349 349
 
350
-	}
350
+    }
351 351
 }
352 352
 
353 353
 /**
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
     }*/
386 386
 
387 387
     if (!in_array($direction, array('ASC','DESC'))) {
388
-    	$direction = 'ASC';
388
+        $direction = 'ASC';
389 389
     }
390 390
     $column = intval($column);
391 391
     $from 	= intval($from);
@@ -396,23 +396,23 @@  discard block
 block discarded – undo
396 396
         $sql .= " WHERE u.creator_id = ".api_get_user_id();
397 397
     }
398 398
 
399
-	$sql .= " ORDER BY col$column $direction ";
400
-	$sql .= " LIMIT $from,$number_of_items";
399
+    $sql .= " ORDER BY col$column $direction ";
400
+    $sql .= " LIMIT $from,$number_of_items";
401 401
 
402
-	$res = Database::query($sql);
402
+    $res = Database::query($sql);
403 403
 
404
-	$users = array ();
404
+    $users = array ();
405 405
     $t = time();
406
-	while ($user = Database::fetch_row($res)) {
407
-		$userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL);
408
-		$photo = '<img src="'.$userPicture.'" width="22" height="22" alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />';
406
+    while ($user = Database::fetch_row($res)) {
407
+        $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL);
408
+        $photo = '<img src="'.$userPicture.'" width="22" height="22" alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />';
409 409
 
410 410
         if ($user[7] == 1 && !empty($user[10])) {
411 411
             // check expiration date
412 412
             $expiration_time = convert_sql_date($user[10]);
413 413
             // if expiration date is passed, store a special value for active field
414 414
             if ($expiration_time < $t) {
415
-        	   $user[7] = '-1';
415
+                $user[7] = '-1';
416 416
             }
417 417
         }
418 418
 
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
             api_get_local_time($user[9]),
431 431
             $user[0]
432 432
         );
433
-	}
433
+    }
434 434
 
435
-	return $users;
435
+    return $users;
436 436
 }
437 437
 
438 438
 /**
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 * @return string HTML-code with a mailto-link
442 442
 */
443 443
 function email_filter($email) {
444
-	return Display :: encrypted_mailto_link($email, $email);
444
+    return Display :: encrypted_mailto_link($email, $email);
445 445
 }
446 446
 
447 447
 /**
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
             $class = 'serviceCheckFont';
461 461
         }
462 462
     }
463
-	return '<a class="'.$class.'"  href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>';
463
+    return '<a class="'.$class.'"  href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>';
464 464
 }
465 465
 
466 466
 /**
@@ -471,84 +471,84 @@  discard block
 block discarded – undo
471 471
  * @return string Some HTML-code with modify-buttons
472 472
  */
473 473
 function modify_filter($user_id, $url_params, $row) {
474
-	global $charset, $_admins_list;
475
-	$is_admin   = in_array($user_id,$_admins_list);
476
-	$statusname = api_get_status_langvars();
477
-	$user_is_anonymous = false;
474
+    global $charset, $_admins_list;
475
+    $is_admin   = in_array($user_id,$_admins_list);
476
+    $statusname = api_get_status_langvars();
477
+    $user_is_anonymous = false;
478 478
     $current_user_status_label = $row['7'];
479 479
 
480
-	if ($current_user_status_label == $statusname[ANONYMOUS]) {
481
-		$user_is_anonymous =true;
482
-	}
483
-	$result = '';
484
-	if (!$user_is_anonymous) {
485
-		$icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')'));
486
-		$result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" >
480
+    if ($current_user_status_label == $statusname[ANONYMOUS]) {
481
+        $user_is_anonymous =true;
482
+    }
483
+    $result = '';
484
+    if (!$user_is_anonymous) {
485
+        $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')'));
486
+        $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" >
487 487
 			        '.$icon.'
488 488
 					<div class="blackboard_hide" id="div_'.$user_id.'">&nbsp;&nbsp;</div>
489 489
 					</a>';
490 490
 
491 491
         $icon = Display::return_icon('session.png', get_lang('Sessions'), array('onmouseout' => 'clear_session_list (\'div_s_'.$user_id.'\')'));
492
-		$result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" >
492
+        $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" >
493 493
 					'.$icon.'
494 494
 					<div class="blackboard_hide" id="div_s_'.$user_id.'">&nbsp;&nbsp;</div>
495 495
 					</a>';
496
-	} else {
497
-		$result .= Display::return_icon('course_na.png',get_lang('Courses')).'&nbsp;&nbsp;';
498
-		$result .= Display::return_icon('course_na.png',get_lang('Sessions')).'&nbsp;&nbsp;';
499
-	}
496
+    } else {
497
+        $result .= Display::return_icon('course_na.png',get_lang('Courses')).'&nbsp;&nbsp;';
498
+        $result .= Display::return_icon('course_na.png',get_lang('Sessions')).'&nbsp;&nbsp;';
499
+    }
500 500
 
501
-	if (api_is_platform_admin()) {
502
-		if (!$user_is_anonymous) {
503
-			$result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;&nbsp;';
504
-		} else {
505
-			$result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).'&nbsp;&nbsp;';
506
-		}
507
-	}
501
+    if (api_is_platform_admin()) {
502
+        if (!$user_is_anonymous) {
503
+            $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;&nbsp;';
504
+        } else {
505
+            $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).'&nbsp;&nbsp;';
506
+        }
507
+    }
508 508
 
509 509
     //only allow platform admins to login_as, or session admins only for students (not teachers nor other admins)
510 510
     if (api_is_platform_admin() || (api_is_session_admin() && $current_user_status_label == $statusname[STUDENT])) {
511
-    	if (!$user_is_anonymous) {
511
+        if (!$user_is_anonymous) {
512 512
             if (api_global_admin_can_edit_admin($user_id)) {
513 513
                 $result .= '<a href="user_list.php?action=login_as&user_id='.$user_id.'&sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon('login_as.png', get_lang('LoginAs')).'</a>&nbsp;&nbsp;';
514 514
             } else {
515 515
                 $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
516 516
             }
517
-    	} else {
518
-    		$result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
519
-    	}
517
+        } else {
518
+            $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
519
+        }
520 520
     } else {
521
-    	$result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
521
+        $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
522 522
     }
523 523
 
524
-	if ($current_user_status_label != $statusname[STUDENT]) {
525
-		$result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).'&nbsp;&nbsp;';
526
-	} else {
527
-		$result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>&nbsp;&nbsp;';
528
-	}
524
+    if ($current_user_status_label != $statusname[STUDENT]) {
525
+        $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).'&nbsp;&nbsp;';
526
+    } else {
527
+        $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>&nbsp;&nbsp;';
528
+    }
529 529
 
530
-	if (api_is_platform_admin(true)) {
530
+    if (api_is_platform_admin(true)) {
531 531
         $editProfileUrl = Display::getProfileEditionLink($user_id, true);
532 532
 
533 533
         if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) {
534 534
             $result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
535
-		} else {
535
+        } else {
536 536
             $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
537
-		}
538
-	}
537
+        }
538
+    }
539 539
 
540
-	if ($is_admin) {
541
-		$result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL));
542
-	} else {
543
-		$result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator'));
544
-	}
540
+    if ($is_admin) {
541
+        $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL));
542
+    } else {
543
+        $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator'));
544
+    }
545 545
 
546
-	// actions for assigning sessions, courses or users
547
-	if (api_is_session_admin()) {
548
-		/*if ($row[0] == api_get_user_id()) {
546
+    // actions for assigning sessions, courses or users
547
+    if (api_is_session_admin()) {
548
+        /*if ($row[0] == api_get_user_id()) {
549 549
 			$result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a>&nbsp;&nbsp;';
550 550
 		}*/
551
-	} else {
551
+    } else {
552 552
         if ($current_user_status_label == $statusname[SESSIONADMIN]) {
553 553
             $result .= Display::url(
554 554
                 Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')),
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
                 );
579 579
             }
580 580
         }
581
-	}
581
+    }
582 582
 
583 583
     if (api_is_platform_admin()) {
584 584
         $result .= ' <a href="'.api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?a=get_user_agenda&user_id='.$user_id.'&modal_size=lg" class="agenda_opener ajax">'.
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
             }
597 597
         }
598 598
     }
599
-	return $result;
599
+    return $result;
600 600
 }
601 601
 
602 602
 
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
     if ($action == 'edit') {
630 630
         $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16);
631 631
     } elseif ($row['0']<>$_user['user_id']) {
632
-    	// you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
633
-		$result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>';
634
-	}
635
-	return $result;
632
+        // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
633
+        $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>';
634
+    }
635
+    return $result;
636 636
 }
637 637
 
638 638
 /**
@@ -645,8 +645,8 @@  discard block
 block discarded – undo
645 645
  * @author Patrick Cool <[email protected]>, Ghent University, Belgium
646 646
  */
647 647
 function status_filter($status) {
648
-	$statusname = api_get_status_langvars();
649
-	return $statusname[$status];
648
+    $statusname = api_get_status_langvars();
649
+    return $statusname[$status];
650 650
 }
651 651
 
652 652
 if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 
663 663
 if (!empty($action)) {
664 664
     $check = Security::check_token('get');
665
-	if ($check) {
666
-		switch ($action) {
665
+    if ($check) {
666
+        switch ($action) {
667 667
             case 'add_user_to_my_url':
668 668
                 $user_id = $_REQUEST["user_id"];
669 669
                 $result = UrlManager::add_user_to_url($user_id, $current_access_url_id);
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
                     $message  = Display::return_message($message, 'confirmation');
674 674
                 }
675 675
                 break;
676
-			case 'show_message' :
676
+            case 'show_message' :
677 677
                 if (!empty($_GET['warn'])) {
678 678
                     // to prevent too long messages
679 679
                     if ($_GET['warn'] == 'session_message') {
@@ -691,46 +691,46 @@  discard block
 block discarded – undo
691 691
                     $message .= Display::return_message(stripslashes($_GET['message']), 'confirmation');
692 692
                 }
693 693
 
694
-				break;
695
-			case 'delete_user' :
696
-				if (api_is_platform_admin()) {
694
+                break;
695
+            case 'delete_user' :
696
+                if (api_is_platform_admin()) {
697 697
                     $user_to_delete = $_GET['user_id'];
698 698
                     $current_user_id = api_get_user_id();
699 699
 
700
-					if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) {
701
-						if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) {
702
-							$message = Display :: return_message(get_lang('UserDeleted'), 'confirmation');
703
-						} else {
704
-							$message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error');
705
-						}
706
-					} else {
707
-						$message = Display :: return_message(get_lang('CannotDeleteUser'),'error');
708
-					}
709
-				}
710
-				break;
700
+                    if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) {
701
+                        if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) {
702
+                            $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation');
703
+                        } else {
704
+                            $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error');
705
+                        }
706
+                    } else {
707
+                        $message = Display :: return_message(get_lang('CannotDeleteUser'),'error');
708
+                    }
709
+                }
710
+                break;
711 711
             case 'delete' :
712
-				if (api_is_platform_admin()) {
713
-					$number_of_selected_users = count($_POST['id']);
714
-					$number_of_deleted_users = 0;
715
-					if (is_array($_POST['id'])) {
716
-						foreach ($_POST['id'] as $index => $user_id) {
717
-							if($user_id != $_user['user_id']) {
718
-								if(UserManager :: delete_user($user_id)) {
719
-									$number_of_deleted_users++;
720
-								}
721
-							}
722
-						}
723
-					}
724
-					if ($number_of_selected_users == $number_of_deleted_users) {
712
+                if (api_is_platform_admin()) {
713
+                    $number_of_selected_users = count($_POST['id']);
714
+                    $number_of_deleted_users = 0;
715
+                    if (is_array($_POST['id'])) {
716
+                        foreach ($_POST['id'] as $index => $user_id) {
717
+                            if($user_id != $_user['user_id']) {
718
+                                if(UserManager :: delete_user($user_id)) {
719
+                                    $number_of_deleted_users++;
720
+                                }
721
+                            }
722
+                        }
723
+                    }
724
+                    if ($number_of_selected_users == $number_of_deleted_users) {
725 725
                         $message = Display :: return_message(get_lang('SelectedUsersDeleted'), 'confirmation');
726
-					} else {
726
+                    } else {
727 727
                         $message = Display :: return_message(get_lang('SomeUsersNotDeleted'), 'error');
728
-					}
729
-				}
730
-				break;
731
-		}
732
-		Security::clear_token();
733
-	}
728
+                    }
729
+                }
730
+                break;
731
+        }
732
+        Security::clear_token();
733
+    }
734 734
 }
735 735
 
736 736
 // Create a search-box
@@ -750,24 +750,24 @@  discard block
 block discarded – undo
750 750
 
751 751
 $actions  = '';
752 752
 if (api_is_platform_admin()) {
753
-	$actions .= '<div style="float:right;">'.
754
-		 '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'.
755
-         Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'.
756
-		 '</div>';
753
+    $actions .= '<div style="float:right;">'.
754
+            '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'.
755
+            Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'.
756
+            '</div>';
757 757
 }
758 758
 $actions .= $form->return_form();
759 759
 
760 760
 if (isset ($_GET['keyword'])) {
761
-	$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
761
+    $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
762 762
 } elseif (isset ($_GET['keyword_firstname'])) {
763
-	$parameters['keyword_firstname'] 	= Security::remove_XSS($_GET['keyword_firstname']);
764
-	$parameters['keyword_lastname']	 	= Security::remove_XSS($_GET['keyword_lastname']);
765
-	$parameters['keyword_username']	 	= Security::remove_XSS($_GET['keyword_username']);
766
-	$parameters['keyword_email'] 	 	= Security::remove_XSS($_GET['keyword_email']);
767
-	$parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']);
768
-	$parameters['keyword_status'] 		= Security::remove_XSS($_GET['keyword_status']);
769
-	$parameters['keyword_active'] 		= Security::remove_XSS($_GET['keyword_active']);
770
-	$parameters['keyword_inactive'] 	= Security::remove_XSS($_GET['keyword_inactive']);
763
+    $parameters['keyword_firstname'] 	= Security::remove_XSS($_GET['keyword_firstname']);
764
+    $parameters['keyword_lastname']	 	= Security::remove_XSS($_GET['keyword_lastname']);
765
+    $parameters['keyword_username']	 	= Security::remove_XSS($_GET['keyword_username']);
766
+    $parameters['keyword_email'] 	 	= Security::remove_XSS($_GET['keyword_email']);
767
+    $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']);
768
+    $parameters['keyword_status'] 		= Security::remove_XSS($_GET['keyword_status']);
769
+    $parameters['keyword_active'] 		= Security::remove_XSS($_GET['keyword_active']);
770
+    $parameters['keyword_inactive'] 	= Security::remove_XSS($_GET['keyword_inactive']);
771 771
 }
772 772
 // Create a sortable table with user-data
773 773
 $parameters['sec_token'] = Security::get_token();
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 $res_admin = Database::query($sql_admin);
779 779
 $_admins_list = array();
780 780
 while ($row_admin = Database::fetch_row($res_admin)) {
781
-	$_admins_list[] = $row_admin[0];
781
+    $_admins_list[] = $row_admin[0];
782 782
 }
783 783
 
784 784
 // Display Advanced search form.
@@ -834,11 +834,11 @@  discard block
 block discarded – undo
834 834
 $table->set_header(2, get_lang('OfficialCode'));
835 835
 
836 836
 if (api_is_western_name_order()) {
837
-	$table->set_header(3, get_lang('FirstName'));
838
-	$table->set_header(4, get_lang('LastName'));
837
+    $table->set_header(3, get_lang('FirstName'));
838
+    $table->set_header(4, get_lang('LastName'));
839 839
 } else {
840
-	$table->set_header(3, get_lang('LastName'));
841
-	$table->set_header(4, get_lang('FirstName'));
840
+    $table->set_header(3, get_lang('LastName'));
841
+    $table->set_header(4, get_lang('FirstName'));
842 842
 }
843 843
 $table->set_header(5, get_lang('LoginName'));
844 844
 $table->set_header(6, get_lang('Email'));
Please login to merge, or discard this patch.
main/template/default/auth/courses_categories.php 1 patch
Spacing   +26 added lines, -31 removed lines patch added patch discarded remove patch
@@ -15,17 +15,12 @@  discard block
 block discarded – undo
15 15
 
16 16
 $showCourses = CoursesAndSessionsCatalog::showCourses();
17 17
 $showSessions = CoursesAndSessionsCatalog::showSessions();
18
-$pageCurrent = isset($pageCurrent) ? $pageCurrent :
19
-    isset($_GET['pageCurrent']) ? intval($_GET['pageCurrent']) :
20
-        1;
21
-$pageLength = isset($pageLength) ? $pageLength :
22
-    isset($_GET['pageLength']) ? intval($_GET['pageLength']) :
23
-        10;
18
+$pageCurrent = isset($pageCurrent) ? $pageCurrent : isset($_GET['pageCurrent']) ? intval($_GET['pageCurrent']) : 1;
19
+$pageLength = isset($pageLength) ? $pageLength : isset($_GET['pageLength']) ? intval($_GET['pageLength']) : 10;
24 20
 $pageTotal = intval(ceil(intval($countCoursesInCategory) / $pageLength));
25 21
 $cataloguePagination = $pageTotal > 1 ?
26
-    getCataloguePagination($pageCurrent, $pageLength, $pageTotal) :
27
-    '';
28
-$search_term = isset($search_term) ? $search_term :null;
22
+    getCataloguePagination($pageCurrent, $pageLength, $pageTotal) : '';
23
+$search_term = isset($search_term) ? $search_term : null;
29 24
 
30 25
 if ($showSessions && isset($_POST['date'])) {
31 26
     $date = $_POST['date'];
@@ -66,7 +61,7 @@  discard block
 block discarded – undo
66 61
             $el.prepend('<?php echo Display::display_icon('nolines_minus.gif'); ?>');
67 62
 
68 63
             $.ajax({
69
-                url: '<?php echo api_get_path(WEB_AJAX_PATH) . 'course.ajax.php' ?>',
64
+                url: '<?php echo api_get_path(WEB_AJAX_PATH).'course.ajax.php' ?>',
70 65
                 type: 'GET',
71 66
                 dataType: 'json',
72 67
                 data: {
@@ -130,13 +125,13 @@  discard block
 block discarded – undo
130 125
         <?php
131 126
 
132 127
             $webAction = api_get_path(WEB_CODE_PATH).'auth/courses.php';
133
-            $action = (!empty($_REQUEST['action'])?Security::remove_XSS($_REQUEST['action']):'display_courses');
134
-            $pageLength = (!empty($_REQUEST['pageLength'])?intval($_REQUEST['pageLength']):10);
135
-            $pageCurrent = (!empty($_REQUEST['pageCurrent'])?intval($_REQUEST['pageCurrent']):1);
128
+            $action = (!empty($_REQUEST['action']) ? Security::remove_XSS($_REQUEST['action']) : 'display_courses');
129
+            $pageLength = (!empty($_REQUEST['pageLength']) ? intval($_REQUEST['pageLength']) : 10);
130
+            $pageCurrent = (!empty($_REQUEST['pageCurrent']) ? intval($_REQUEST['pageCurrent']) : 1);
136 131
             $form = '<form action="'.$webAction.'" method="GET" class="form-horizontal">';
137
-            $form .= '<input type="hidden" name="action" value="' . $action . '">';
138
-            $form .= '<input type="hidden" name="pageCurrent" value="' . $pageCurrent . '">';
139
-            $form .= '<input type="hidden" name="pageLength" value="' . $pageLength . '">';
132
+            $form .= '<input type="hidden" name="action" value="'.$action.'">';
133
+            $form .= '<input type="hidden" name="pageCurrent" value="'.$pageCurrent.'">';
134
+            $form .= '<input type="hidden" name="pageLength" value="'.$pageLength.'">';
140 135
             $form .= '<div class="form-group">';
141 136
             $form .= '<div class="col-sm-12">';
142 137
             $form .= '<select name="category_code" onchange="submit();" class="selectpicker show-tick form-control">';
@@ -145,11 +140,11 @@  discard block
 block discarded – undo
145 140
                 $categoryCode = $category['code'];
146 141
                 $countCourse = $category['count_courses'];
147 142
 
148
-                $form .= '<option '. ($categoryCode == $codeType? 'selected="selected" ':'') .' value="' . $category['code'] . '">' . $category['name'] . ' ( '. $countCourse .' ) </option>';
143
+                $form .= '<option '.($categoryCode == $codeType ? 'selected="selected" ' : '').' value="'.$category['code'].'">'.$category['name'].' ( '.$countCourse.' ) </option>';
149 144
                 if (!empty($browse_course_categories[$categoryCode])) {
150
-                    foreach ($browse_course_categories[$categoryCode] as $subCategory){
145
+                    foreach ($browse_course_categories[$categoryCode] as $subCategory) {
151 146
                         $subCategoryCode = $subCategory['code'];
152
-                        $form .= '<option '. ($subCategoryCode == $codeType ? 'selected="selected" ':'') .' value="' . $subCategory['code'] . '"> ---' . $subCategory['name'] . ' ( '. $subCategory['count_courses'] .' ) </option>';
147
+                        $form .= '<option '.($subCategoryCode == $codeType ? 'selected="selected" ' : '').' value="'.$subCategory['code'].'"> ---'.$subCategory['name'].' ( '.$subCategory['count_courses'].' ) </option>';
153 148
                     }
154 149
                 }
155 150
             }
@@ -212,7 +207,7 @@  discard block
 block discarded – undo
212 207
             $course_subscribe_allowed = ($course['subscribe'] == 1);
213 208
             $course_unsubscribe_allowed = ($course['unsubscribe'] == 1);
214 209
             $count_connections = $course['count_connections'];
215
-            $creation_date = substr($course['creation_date'],0,10);
210
+            $creation_date = substr($course['creation_date'], 0, 10);
216 211
             
217 212
             $plugin = BuyCoursesPlugin::create();
218 213
             $includeServices = $plugin->get('include_services') === 'true';
@@ -365,9 +360,9 @@  discard block
 block discarded – undo
365 360
     $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
366 361
     $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
367 362
     $rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&course_id='.$course['real_id'], $course['point_info']);
368
-    $html .= $serviceNode ? '<h4 class="title"><a class="serviceCheckFont" href="' . $linkCourse . '">' . cut($title, 60) . ' <em class="fa fa-diamond"></em></a></h4>' : '<h4 class="title"><a href="' . $linkCourse . '">' . cut($title, 60) . '</a></h4>';
363
+    $html .= $serviceNode ? '<h4 class="title"><a class="serviceCheckFont" href="'.$linkCourse.'">'.cut($title, 60).' <em class="fa fa-diamond"></em></a></h4>' : '<h4 class="title"><a href="'.$linkCourse.'">'.cut($title, 60).'</a></h4>';
369 364
     $html .= '<div class="teachers">'.$teachers.'</div>';
370
-    $html .= '<div class="ranking">'. $rating . '</div>';
365
+    $html .= '<div class="ranking">'.$rating.'</div>';
371 366
 
372 367
     return $html;
373 368
 }
@@ -382,8 +377,8 @@  discard block
 block discarded – undo
382 377
     $title = $course['title'];
383 378
     $html = '';
384 379
     if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
385
-        $html = '<a data-title="' . $title . '" class="ajax btn btn-default btn-sm" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="' . get_lang('Description') . '">' .
386
-        Display::returnFontAwesomeIcon('info-circle') . '</a>';
380
+        $html = '<a data-title="'.$title.'" class="ajax btn btn-default btn-sm" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&code='.$course['code'].'" title="'.get_lang('Description').'">'.
381
+        Display::returnFontAwesomeIcon('info-circle').'</a>';
387 382
     }
388 383
 
389 384
     return $html;
@@ -395,7 +390,7 @@  discard block
 block discarded – undo
395 390
  */
396 391
 function return_goto_button($course)
397 392
 {
398
-    $html = ' <a class="btn btn-default btn-sm" title="' . get_lang('GoToCourse') . '" href="'.api_get_course_url($course['code']).'">'.
393
+    $html = ' <a class="btn btn-default btn-sm" title="'.get_lang('GoToCourse').'" href="'.api_get_course_url($course['code']).'">'.
399 394
     Display::returnFontAwesomeIcon('share').'</a>';
400 395
 
401 396
     return $html;
@@ -429,8 +424,8 @@  discard block
 block discarded – undo
429 424
  */
430 425
 function return_register_button($course, $stok, $code, $search_term)
431 426
 {
432
-    $html = ' <a class="btn btn-success btn-sm" title="' . get_lang('Subscribe') . '" href="'.api_get_self().'?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">' .
433
-    Display::returnFontAwesomeIcon('sign-in') . '</a>';
427
+    $html = ' <a class="btn btn-success btn-sm" title="'.get_lang('Subscribe').'" href="'.api_get_self().'?action=subscribe_course&sec_token='.$stok.'&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'.
428
+    Display::returnFontAwesomeIcon('sign-in').'</a>';
434 429
     return $html;
435 430
 }
436 431
 
@@ -442,8 +437,8 @@  discard block
 block discarded – undo
442 437
 {
443 438
     $plugin = BuyCoursesPlugin::create();
444 439
     $id_course = intval($id_course);
445
-    $html = ' <a class="btn btn-warning btn-sm" title="' . $plugin->get_lang('Services') . '"  role="button" data-toggle="popover" id="course-'.$id_course.'-services">' .
446
-    Display::returnFontAwesomeIcon('tags') . '</a>';
440
+    $html = ' <a class="btn btn-warning btn-sm" title="'.$plugin->get_lang('Services').'"  role="button" data-toggle="popover" id="course-'.$id_course.'-services">'.
441
+    Display::returnFontAwesomeIcon('tags').'</a>';
447 442
     return $html;
448 443
 }
449 444
 
@@ -456,7 +451,7 @@  discard block
 block discarded – undo
456 451
  */
457 452
 function return_unregister_button($course, $stok, $search_term, $code)
458 453
 {
459
-    $html = ' <a class="btn btn-danger btn-sm" title="' . get_lang('Unsubscribe') . '" href="'. api_get_self().'?action=unsubscribe&sec_token='.$stok.'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">' .
460
-    Display::returnFontAwesomeIcon('sign-out') . '</a>';
454
+    $html = ' <a class="btn btn-danger btn-sm" title="'.get_lang('Unsubscribe').'" href="'.api_get_self().'?action=unsubscribe&sec_token='.$stok.'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code.'">'.
455
+    Display::returnFontAwesomeIcon('sign-out').'</a>';
461 456
     return $html;
462 457
 }
Please login to merge, or discard this patch.