@@ -308,13 +308,13 @@ discard block |
||
| 308 | 308 | $firstname = $userInfo['firstname']; |
| 309 | 309 | $lastname = $userInfo['lastname']; |
| 310 | 310 | |
| 311 | - if (api_is_western_name_order()) { |
|
| 312 | - $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId); |
|
| 313 | - } else { |
|
| 314 | - $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
| 315 | - } |
|
| 311 | + if (api_is_western_name_order()) { |
|
| 312 | + $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId); |
|
| 313 | + } else { |
|
| 314 | + $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | - if ($userId) { |
|
| 317 | + if ($userId) { |
|
| 318 | 318 | |
| 319 | 319 | // Logout the current user |
| 320 | 320 | LoginDelete(api_get_user_id()); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | Display :: display_footer(); |
| 350 | 350 | exit; |
| 351 | 351 | |
| 352 | - } |
|
| 352 | + } |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | }*/ |
| 389 | 389 | |
| 390 | 390 | if (!in_array($direction, array('ASC','DESC'))) { |
| 391 | - $direction = 'ASC'; |
|
| 391 | + $direction = 'ASC'; |
|
| 392 | 392 | } |
| 393 | 393 | $column = intval($column); |
| 394 | 394 | $from = intval($from); |
@@ -399,23 +399,23 @@ discard block |
||
| 399 | 399 | $sql .= " WHERE u.creator_id = ".api_get_user_id(); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - $sql .= " ORDER BY col$column $direction "; |
|
| 403 | - $sql .= " LIMIT $from,$number_of_items"; |
|
| 402 | + $sql .= " ORDER BY col$column $direction "; |
|
| 403 | + $sql .= " LIMIT $from,$number_of_items"; |
|
| 404 | 404 | |
| 405 | - $res = Database::query($sql); |
|
| 405 | + $res = Database::query($sql); |
|
| 406 | 406 | |
| 407 | - $users = array (); |
|
| 407 | + $users = array (); |
|
| 408 | 408 | $t = time(); |
| 409 | - while ($user = Database::fetch_row($res)) { |
|
| 410 | - $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
| 411 | - $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 | + while ($user = Database::fetch_row($res)) { |
|
| 410 | + $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
| 411 | + $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]).'" />'; |
|
| 412 | 412 | |
| 413 | 413 | if ($user[7] == 1 && !empty($user[10])) { |
| 414 | 414 | // check expiration date |
| 415 | 415 | $expiration_time = convert_sql_date($user[10]); |
| 416 | 416 | // if expiration date is passed, store a special value for active field |
| 417 | 417 | if ($expiration_time < $t) { |
| 418 | - $user[7] = '-1'; |
|
| 418 | + $user[7] = '-1'; |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | |
@@ -433,9 +433,9 @@ discard block |
||
| 433 | 433 | api_get_local_time($user[9]), |
| 434 | 434 | $user[0] |
| 435 | 435 | ); |
| 436 | - } |
|
| 436 | + } |
|
| 437 | 437 | |
| 438 | - return $users; |
|
| 438 | + return $users; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | * @return string HTML-code with a mailto-link |
| 445 | 445 | */ |
| 446 | 446 | function email_filter($email) { |
| 447 | - return Display :: encrypted_mailto_link($email, $email); |
|
| 447 | + return Display :: encrypted_mailto_link($email, $email); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * @return string HTML-code with a mailto-link |
| 454 | 454 | */ |
| 455 | 455 | function user_filter($name, $params, $row) { |
| 456 | - return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
| 456 | + return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -464,84 +464,84 @@ discard block |
||
| 464 | 464 | * @return string Some HTML-code with modify-buttons |
| 465 | 465 | */ |
| 466 | 466 | function modify_filter($user_id, $url_params, $row) { |
| 467 | - global $charset, $_admins_list; |
|
| 468 | - $is_admin = in_array($user_id,$_admins_list); |
|
| 469 | - $statusname = api_get_status_langvars(); |
|
| 470 | - $user_is_anonymous = false; |
|
| 467 | + global $charset, $_admins_list; |
|
| 468 | + $is_admin = in_array($user_id,$_admins_list); |
|
| 469 | + $statusname = api_get_status_langvars(); |
|
| 470 | + $user_is_anonymous = false; |
|
| 471 | 471 | $current_user_status_label = $row['7']; |
| 472 | 472 | |
| 473 | - if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
| 474 | - $user_is_anonymous =true; |
|
| 475 | - } |
|
| 476 | - $result = ''; |
|
| 477 | - if (!$user_is_anonymous) { |
|
| 478 | - $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')')); |
|
| 479 | - $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
| 473 | + if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
| 474 | + $user_is_anonymous =true; |
|
| 475 | + } |
|
| 476 | + $result = ''; |
|
| 477 | + if (!$user_is_anonymous) { |
|
| 478 | + $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')')); |
|
| 479 | + $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
| 480 | 480 | '.$icon.' |
| 481 | 481 | <div class="blackboard_hide" id="div_'.$user_id.'"> </div> |
| 482 | 482 | </a>'; |
| 483 | 483 | |
| 484 | 484 | $icon = Display::return_icon('session.png', get_lang('Sessions'), array('onmouseout' => 'clear_session_list (\'div_s_'.$user_id.'\')')); |
| 485 | - $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
| 485 | + $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
| 486 | 486 | '.$icon.' |
| 487 | 487 | <div class="blackboard_hide" id="div_s_'.$user_id.'"> </div> |
| 488 | 488 | </a>'; |
| 489 | - } else { |
|
| 490 | - $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
| 491 | - $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
| 492 | - } |
|
| 489 | + } else { |
|
| 490 | + $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
| 491 | + $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
| 492 | + } |
|
| 493 | 493 | |
| 494 | - if (api_is_platform_admin()) { |
|
| 495 | - if (!$user_is_anonymous) { |
|
| 496 | - $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a> '; |
|
| 497 | - } else { |
|
| 498 | - $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).' '; |
|
| 499 | - } |
|
| 500 | - } |
|
| 494 | + if (api_is_platform_admin()) { |
|
| 495 | + if (!$user_is_anonymous) { |
|
| 496 | + $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a> '; |
|
| 497 | + } else { |
|
| 498 | + $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).' '; |
|
| 499 | + } |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | 502 | //only allow platform admins to login_as, or session admins only for students (not teachers nor other admins) |
| 503 | 503 | if (api_is_platform_admin() || (api_is_session_admin() && $current_user_status_label == $statusname[STUDENT])) { |
| 504 | - if (!$user_is_anonymous) { |
|
| 504 | + if (!$user_is_anonymous) { |
|
| 505 | 505 | if (api_global_admin_can_edit_admin($user_id)) { |
| 506 | 506 | $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> '; |
| 507 | 507 | } else { |
| 508 | 508 | $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
| 509 | 509 | } |
| 510 | - } else { |
|
| 511 | - $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 512 | - } |
|
| 510 | + } else { |
|
| 511 | + $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 512 | + } |
|
| 513 | 513 | } else { |
| 514 | - $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 514 | + $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if ($current_user_status_label != $statusname[STUDENT]) { |
|
| 518 | - $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).' '; |
|
| 519 | - } else { |
|
| 520 | - $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a> '; |
|
| 521 | - } |
|
| 517 | + if ($current_user_status_label != $statusname[STUDENT]) { |
|
| 518 | + $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).' '; |
|
| 519 | + } else { |
|
| 520 | + $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a> '; |
|
| 521 | + } |
|
| 522 | 522 | |
| 523 | - if (api_is_platform_admin(true)) { |
|
| 523 | + if (api_is_platform_admin(true)) { |
|
| 524 | 524 | $editProfileUrl = Display::getProfileEditionLink($user_id, true); |
| 525 | 525 | |
| 526 | 526 | if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) { |
| 527 | 527 | $result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
| 528 | - } else { |
|
| 528 | + } else { |
|
| 529 | 529 | $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
| 530 | - } |
|
| 531 | - } |
|
| 530 | + } |
|
| 531 | + } |
|
| 532 | 532 | |
| 533 | - if ($is_admin) { |
|
| 534 | - $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 535 | - } else { |
|
| 536 | - $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
| 537 | - } |
|
| 533 | + if ($is_admin) { |
|
| 534 | + $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 535 | + } else { |
|
| 536 | + $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
| 537 | + } |
|
| 538 | 538 | |
| 539 | - // actions for assigning sessions, courses or users |
|
| 540 | - if (api_is_session_admin()) { |
|
| 541 | - /*if ($row[0] == api_get_user_id()) { |
|
| 539 | + // actions for assigning sessions, courses or users |
|
| 540 | + if (api_is_session_admin()) { |
|
| 541 | + /*if ($row[0] == api_get_user_id()) { |
|
| 542 | 542 | $result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a> '; |
| 543 | 543 | }*/ |
| 544 | - } else { |
|
| 544 | + } else { |
|
| 545 | 545 | if ($current_user_status_label == $statusname[SESSIONADMIN]) { |
| 546 | 546 | $result .= Display::url( |
| 547 | 547 | Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')), |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | ); |
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | - } |
|
| 574 | + } |
|
| 575 | 575 | |
| 576 | 576 | if (api_is_platform_admin()) { |
| 577 | 577 | $result .= ' <a data-title="'.get_lang('FreeBusyCalendar').'" 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">'. |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | - return $result; |
|
| 592 | + return $result; |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | |
@@ -622,10 +622,10 @@ discard block |
||
| 622 | 622 | if ($action == 'edit') { |
| 623 | 623 | $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16); |
| 624 | 624 | } elseif ($row['0']<>$_user['user_id']) { |
| 625 | - // 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. |
|
| 626 | - $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
|
| 627 | - } |
|
| 628 | - return $result; |
|
| 625 | + // 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. |
|
| 626 | + $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
|
| 627 | + } |
|
| 628 | + return $result; |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | /** |
@@ -638,8 +638,8 @@ discard block |
||
| 638 | 638 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
| 639 | 639 | */ |
| 640 | 640 | function status_filter($status) { |
| 641 | - $statusname = api_get_status_langvars(); |
|
| 642 | - return $statusname[$status]; |
|
| 641 | + $statusname = api_get_status_langvars(); |
|
| 642 | + return $statusname[$status]; |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) { |
@@ -655,8 +655,8 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | if (!empty($action)) { |
| 657 | 657 | $check = Security::check_token('get'); |
| 658 | - if ($check) { |
|
| 659 | - switch ($action) { |
|
| 658 | + if ($check) { |
|
| 659 | + switch ($action) { |
|
| 660 | 660 | case 'add_user_to_my_url': |
| 661 | 661 | $user_id = $_REQUEST["user_id"]; |
| 662 | 662 | $result = UrlManager::add_user_to_url($user_id, $current_access_url_id); |
@@ -666,45 +666,45 @@ discard block |
||
| 666 | 666 | $message = Display::return_message($message, 'confirmation'); |
| 667 | 667 | } |
| 668 | 668 | break; |
| 669 | - case 'delete_user': |
|
| 670 | - if (api_is_platform_admin()) { |
|
| 669 | + case 'delete_user': |
|
| 670 | + if (api_is_platform_admin()) { |
|
| 671 | 671 | $user_to_delete = $_GET['user_id']; |
| 672 | 672 | $current_user_id = api_get_user_id(); |
| 673 | 673 | |
| 674 | - if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
| 675 | - if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
| 676 | - $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation'); |
|
| 677 | - } else { |
|
| 678 | - $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
| 679 | - } |
|
| 680 | - } else { |
|
| 681 | - $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
| 682 | - } |
|
| 683 | - } |
|
| 684 | - break; |
|
| 674 | + if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
| 675 | + if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
| 676 | + $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation'); |
|
| 677 | + } else { |
|
| 678 | + $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
| 679 | + } |
|
| 680 | + } else { |
|
| 681 | + $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
| 682 | + } |
|
| 683 | + } |
|
| 684 | + break; |
|
| 685 | 685 | case 'delete': |
| 686 | - if (api_is_platform_admin()) { |
|
| 687 | - $number_of_selected_users = count($_POST['id']); |
|
| 688 | - $number_of_deleted_users = 0; |
|
| 689 | - if (is_array($_POST['id'])) { |
|
| 690 | - foreach ($_POST['id'] as $index => $user_id) { |
|
| 691 | - if ($user_id != $_user['user_id']) { |
|
| 692 | - if (UserManager::delete_user($user_id)) { |
|
| 693 | - $number_of_deleted_users++; |
|
| 694 | - } |
|
| 695 | - } |
|
| 696 | - } |
|
| 697 | - } |
|
| 698 | - if ($number_of_selected_users == $number_of_deleted_users) { |
|
| 686 | + if (api_is_platform_admin()) { |
|
| 687 | + $number_of_selected_users = count($_POST['id']); |
|
| 688 | + $number_of_deleted_users = 0; |
|
| 689 | + if (is_array($_POST['id'])) { |
|
| 690 | + foreach ($_POST['id'] as $index => $user_id) { |
|
| 691 | + if ($user_id != $_user['user_id']) { |
|
| 692 | + if (UserManager::delete_user($user_id)) { |
|
| 693 | + $number_of_deleted_users++; |
|
| 694 | + } |
|
| 695 | + } |
|
| 696 | + } |
|
| 697 | + } |
|
| 698 | + if ($number_of_selected_users == $number_of_deleted_users) { |
|
| 699 | 699 | $message = Display :: return_message(get_lang('SelectedUsersDeleted'), 'confirmation'); |
| 700 | - } else { |
|
| 700 | + } else { |
|
| 701 | 701 | $message = Display :: return_message(get_lang('SomeUsersNotDeleted'), 'error'); |
| 702 | - } |
|
| 703 | - } |
|
| 704 | - break; |
|
| 705 | - } |
|
| 706 | - Security::clear_token(); |
|
| 707 | - } |
|
| 702 | + } |
|
| 703 | + } |
|
| 704 | + break; |
|
| 705 | + } |
|
| 706 | + Security::clear_token(); |
|
| 707 | + } |
|
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | // Create a search-box |
@@ -724,24 +724,24 @@ discard block |
||
| 724 | 724 | |
| 725 | 725 | $actions = ''; |
| 726 | 726 | if (api_is_platform_admin()) { |
| 727 | - $actions .= '<div style="float:right;">'. |
|
| 728 | - '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
| 729 | - Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
| 730 | - '</div>'; |
|
| 727 | + $actions .= '<div style="float:right;">'. |
|
| 728 | + '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
| 729 | + Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
| 730 | + '</div>'; |
|
| 731 | 731 | } |
| 732 | 732 | $actions .= $form->return_form(); |
| 733 | 733 | |
| 734 | 734 | if (isset ($_GET['keyword'])) { |
| 735 | - $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 735 | + $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 736 | 736 | } elseif (isset ($_GET['keyword_firstname'])) { |
| 737 | - $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
|
| 738 | - $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
|
| 739 | - $parameters['keyword_username'] = Security::remove_XSS($_GET['keyword_username']); |
|
| 740 | - $parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']); |
|
| 741 | - $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
|
| 742 | - $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
|
| 743 | - $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
|
| 744 | - $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 737 | + $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
|
| 738 | + $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
|
| 739 | + $parameters['keyword_username'] = Security::remove_XSS($_GET['keyword_username']); |
|
| 740 | + $parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']); |
|
| 741 | + $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
|
| 742 | + $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
|
| 743 | + $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
|
| 744 | + $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 745 | 745 | } |
| 746 | 746 | // Create a sortable table with user-data |
| 747 | 747 | $parameters['sec_token'] = Security::get_token(); |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | $res_admin = Database::query($sql_admin); |
| 753 | 753 | $_admins_list = array(); |
| 754 | 754 | while ($row_admin = Database::fetch_row($res_admin)) { |
| 755 | - $_admins_list[] = $row_admin[0]; |
|
| 755 | + $_admins_list[] = $row_admin[0]; |
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | // Display Advanced search form. |
@@ -808,11 +808,11 @@ discard block |
||
| 808 | 808 | $table->set_header(2, get_lang('OfficialCode')); |
| 809 | 809 | |
| 810 | 810 | if (api_is_western_name_order()) { |
| 811 | - $table->set_header(3, get_lang('FirstName')); |
|
| 812 | - $table->set_header(4, get_lang('LastName')); |
|
| 811 | + $table->set_header(3, get_lang('FirstName')); |
|
| 812 | + $table->set_header(4, get_lang('LastName')); |
|
| 813 | 813 | } else { |
| 814 | - $table->set_header(3, get_lang('LastName')); |
|
| 815 | - $table->set_header(4, get_lang('FirstName')); |
|
| 814 | + $table->set_header(3, get_lang('LastName')); |
|
| 815 | + $table->set_header(4, get_lang('FirstName')); |
|
| 816 | 816 | } |
| 817 | 817 | $table->set_header(5, get_lang('LoginName')); |
| 818 | 818 | $table->set_header(6, get_lang('Email')); |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | function display_advanced_search_form () { |
| 108 | 108 | if ($("#advanced_search_form").css("display") == "none") { |
| 109 | 109 | $("#advanced_search_form").css("display","block"); |
| 110 | - $("#img_plus_and_minus").html(\' '.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'\'); |
|
| 110 | + $("#img_plus_and_minus").html(\' '.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'\'); |
|
| 111 | 111 | } else { |
| 112 | 112 | $("#advanced_search_form").css("display","none"); |
| 113 | - $("#img_plus_and_minus").html(\' '.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'\'); |
|
| 113 | + $("#img_plus_and_minus").html(\' '.Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'\'); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // adding the filter to see the user's only of the current access_url |
| 189 | 189 | if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) { |
| 190 | 190 | $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
| 191 | - $sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.id=url_rel_user.user_id)"; |
|
| 191 | + $sql .= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.id=url_rel_user.user_id)"; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $keywordList = array( |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | if (isset($keyword_extra_data) && !empty($keyword_extra_data)) { |
| 220 | 220 | $extra_info = UserManager::get_extra_field_information_by_name($keyword_extra_data); |
| 221 | 221 | $field_id = $extra_info['id']; |
| 222 | - $sql.= " INNER JOIN user_field_values ufv ON u.id=ufv.user_id AND ufv.field_id=$field_id "; |
|
| 222 | + $sql .= " INNER JOIN user_field_values ufv ON u.id=ufv.user_id AND ufv.field_id=$field_id "; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if (isset($_GET['keyword']) && !empty($_GET['keyword'])) { |
| 226 | - $keywordFiltered = Database::escape_string("%". $_GET['keyword'] ."%"); |
|
| 226 | + $keywordFiltered = Database::escape_string("%".$_GET['keyword']."%"); |
|
| 227 | 227 | $sql .= " WHERE ( |
| 228 | 228 | u.firstname LIKE '$keywordFiltered' OR |
| 229 | 229 | u.lastname LIKE '$keywordFiltered' OR |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | $sql .= " $query_admin_table |
| 256 | 256 | WHERE ( |
| 257 | - u.firstname LIKE '". Database::escape_string("%".$keywordListValues['keyword_firstname']."%")."' AND |
|
| 257 | + u.firstname LIKE '".Database::escape_string("%".$keywordListValues['keyword_firstname']."%")."' AND |
|
| 258 | 258 | u.lastname LIKE '". Database::escape_string("%".$keywordListValues['keyword_lastname']."%")."' AND |
| 259 | 259 | u.username LIKE '". Database::escape_string("%".$keywordListValues['keyword_username']."%")."' AND |
| 260 | 260 | u.email LIKE '". Database::escape_string("%".$keywordListValues['keyword_email']."%")."' AND |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $lastname = $userInfo['lastname']; |
| 310 | 310 | |
| 311 | 311 | if (api_is_western_name_order()) { |
| 312 | - $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId); |
|
| 312 | + $message = sprintf(get_lang('AttemptingToLoginAs'), $firstname, $lastname, $userId); |
|
| 313 | 313 | } else { |
| 314 | 314 | $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
| 315 | 315 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | Session::write('login_as', true); |
| 344 | 344 | |
| 345 | 345 | $target_url = api_get_path(WEB_PATH)."user_portal.php"; |
| 346 | - $message .= '<br />'.sprintf(get_lang('LoginSuccessfulGoToX'),'<a href="'.$target_url.'">'.$target_url.'</a>'); |
|
| 346 | + $message .= '<br />'.sprintf(get_lang('LoginSuccessfulGoToX'), '<a href="'.$target_url.'">'.$target_url.'</a>'); |
|
| 347 | 347 | Display :: display_header(get_lang('UserList')); |
| 348 | 348 | Display :: display_normal_message($message, false); |
| 349 | 349 | Display :: display_footer(); |
@@ -387,11 +387,11 @@ discard block |
||
| 387 | 387 | $sql .= "AND password LIKE '$easyPassword' "; |
| 388 | 388 | }*/ |
| 389 | 389 | |
| 390 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
| 390 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
| 391 | 391 | $direction = 'ASC'; |
| 392 | 392 | } |
| 393 | 393 | $column = intval($column); |
| 394 | - $from = intval($from); |
|
| 394 | + $from = intval($from); |
|
| 395 | 395 | $number_of_items = intval($number_of_items); |
| 396 | 396 | |
| 397 | 397 | $preventSessionAdminsToManageAllUsers = api_get_setting('prevent_session_admins_to_manage_all_users'); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | $res = Database::query($sql); |
| 406 | 406 | |
| 407 | - $users = array (); |
|
| 407 | + $users = array(); |
|
| 408 | 408 | $t = time(); |
| 409 | 409 | while ($user = Database::fetch_row($res)) { |
| 410 | 410 | $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
@@ -465,13 +465,13 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | function modify_filter($user_id, $url_params, $row) { |
| 467 | 467 | global $charset, $_admins_list; |
| 468 | - $is_admin = in_array($user_id,$_admins_list); |
|
| 468 | + $is_admin = in_array($user_id, $_admins_list); |
|
| 469 | 469 | $statusname = api_get_status_langvars(); |
| 470 | 470 | $user_is_anonymous = false; |
| 471 | 471 | $current_user_status_label = $row['7']; |
| 472 | 472 | |
| 473 | 473 | if ($current_user_status_label == $statusname[ANONYMOUS]) { |
| 474 | - $user_is_anonymous =true; |
|
| 474 | + $user_is_anonymous = true; |
|
| 475 | 475 | } |
| 476 | 476 | $result = ''; |
| 477 | 477 | if (!$user_is_anonymous) { |
@@ -487,8 +487,8 @@ discard block |
||
| 487 | 487 | <div class="blackboard_hide" id="div_s_'.$user_id.'"> </div> |
| 488 | 488 | </a>'; |
| 489 | 489 | } else { |
| 490 | - $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
| 491 | - $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
| 490 | + $result .= Display::return_icon('course_na.png', get_lang('Courses')).' '; |
|
| 491 | + $result .= Display::return_icon('course_na.png', get_lang('Sessions')).' '; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | if (api_is_platform_admin()) { |
@@ -524,14 +524,14 @@ discard block |
||
| 524 | 524 | $editProfileUrl = Display::getProfileEditionLink($user_id, true); |
| 525 | 525 | |
| 526 | 526 | if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) { |
| 527 | - $result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
|
| 527 | + $result .= '<a href="'.$editProfileUrl.'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
|
| 528 | 528 | } else { |
| 529 | 529 | $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | if ($is_admin) { |
| 534 | - $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 534 | + $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'), array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 535 | 535 | } else { |
| 536 | 536 | $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
| 537 | 537 | } |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | api_global_admin_can_edit_admin($user_id) |
| 584 | 584 | ) { |
| 585 | 585 | // 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. |
| 586 | - $result .= ' <a href="user_list.php?action=delete_user&user_id='.$user_id.'&'.$url_params.'&sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 586 | + $result .= ' <a href="user_list.php?action=delete_user&user_id='.$user_id.'&'.$url_params.'&sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 587 | 587 | } else { |
| 588 | 588 | $result .= Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); |
| 589 | 589 | } |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | |
| 622 | 622 | if ($action == 'edit') { |
| 623 | 623 | $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16); |
| 624 | - } elseif ($row['0']<>$_user['user_id']) { |
|
| 624 | + } elseif ($row['0'] <> $_user['user_id']) { |
|
| 625 | 625 | // 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. |
| 626 | 626 | $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
| 627 | 627 | } |
@@ -643,11 +643,11 @@ discard block |
||
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) { |
| 646 | - $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
| 647 | - $interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList')); |
|
| 646 | + $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
| 647 | + $interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList')); |
|
| 648 | 648 | $tool_name = get_lang('SearchUsers'); |
| 649 | 649 | } else { |
| 650 | - $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
| 650 | + $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
| 651 | 651 | $tool_name = get_lang('UserList'); |
| 652 | 652 | } |
| 653 | 653 | |
@@ -660,10 +660,10 @@ discard block |
||
| 660 | 660 | case 'add_user_to_my_url': |
| 661 | 661 | $user_id = $_REQUEST["user_id"]; |
| 662 | 662 | $result = UrlManager::add_user_to_url($user_id, $current_access_url_id); |
| 663 | - if ($result ) { |
|
| 663 | + if ($result) { |
|
| 664 | 664 | $user_info = api_get_user_info($user_id); |
| 665 | 665 | $message = get_lang('UserAdded').' '.$user_info['firstname'].' '.$user_info['lastname'].' ('.$user_info['username'].')'; |
| 666 | - $message = Display::return_message($message, 'confirmation'); |
|
| 666 | + $message = Display::return_message($message, 'confirmation'); |
|
| 667 | 667 | } |
| 668 | 668 | break; |
| 669 | 669 | case 'delete_user': |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
| 679 | 679 | } |
| 680 | 680 | } else { |
| 681 | - $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
| 681 | + $message = Display :: return_message(get_lang('CannotDeleteUser'), 'error'); |
|
| 682 | 682 | } |
| 683 | 683 | } |
| 684 | 684 | break; |
@@ -722,17 +722,17 @@ discard block |
||
| 722 | 722 | </a>' |
| 723 | 723 | ); |
| 724 | 724 | |
| 725 | -$actions = ''; |
|
| 725 | +$actions = ''; |
|
| 726 | 726 | if (api_is_platform_admin()) { |
| 727 | 727 | $actions .= '<div style="float:right;">'. |
| 728 | 728 | '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
| 729 | - Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
| 729 | + Display::return_icon('new_user.png', get_lang('AddUsers'), '', ICON_SIZE_MEDIUM).'</a>'. |
|
| 730 | 730 | '</div>'; |
| 731 | 731 | } |
| 732 | 732 | $actions .= $form->return_form(); |
| 733 | 733 | |
| 734 | 734 | if (isset ($_GET['keyword'])) { |
| 735 | - $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 735 | + $parameters = array('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 736 | 736 | } elseif (isset ($_GET['keyword_firstname'])) { |
| 737 | 737 | $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
| 738 | 738 | $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
| 742 | 742 | $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
| 743 | 743 | $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
| 744 | - $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 744 | + $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 745 | 745 | } |
| 746 | 746 | // Create a sortable table with user-data |
| 747 | 747 | $parameters['sec_token'] = Security::get_token(); |
@@ -758,15 +758,15 @@ discard block |
||
| 758 | 758 | // Display Advanced search form. |
| 759 | 759 | $form = new FormValidator('advanced_search', 'get', '', '', array(), FormValidator::LAYOUT_HORIZONTAL); |
| 760 | 760 | |
| 761 | -$form->addElement('html','<div id="advanced_search_form" style="display:none;">'); |
|
| 761 | +$form->addElement('html', '<div id="advanced_search_form" style="display:none;">'); |
|
| 762 | 762 | $form->addElement('header', get_lang('AdvancedSearch')); |
| 763 | -$form->addText('keyword_firstname',get_lang('FirstName'),false); |
|
| 764 | -$form->addText('keyword_lastname',get_lang('LastName'),false); |
|
| 763 | +$form->addText('keyword_firstname', get_lang('FirstName'), false); |
|
| 764 | +$form->addText('keyword_lastname', get_lang('LastName'), false); |
|
| 765 | 765 | |
| 766 | -$form->addText('keyword_username',get_lang('LoginName'),false); |
|
| 767 | -$form->addText('keyword_email',get_lang('Email'),false); |
|
| 766 | +$form->addText('keyword_username', get_lang('LoginName'), false); |
|
| 767 | +$form->addText('keyword_email', get_lang('Email'), false); |
|
| 768 | 768 | |
| 769 | -$form->addText('keyword_officialcode',get_lang('OfficialCode'),false); |
|
| 769 | +$form->addText('keyword_officialcode', get_lang('OfficialCode'), false); |
|
| 770 | 770 | |
| 771 | 771 | $status_options = array(); |
| 772 | 772 | $status_options['%'] = get_lang('All'); |
@@ -776,12 +776,12 @@ discard block |
||
| 776 | 776 | $status_options[SESSIONADMIN] = get_lang('SessionsAdmin'); |
| 777 | 777 | $status_options[PLATFORM_ADMIN] = get_lang('Administrator'); |
| 778 | 778 | |
| 779 | -$form->addElement('select','keyword_status',get_lang('Profile'), $status_options ); |
|
| 779 | +$form->addElement('select', 'keyword_status', get_lang('Profile'), $status_options); |
|
| 780 | 780 | |
| 781 | 781 | $active_group = array(); |
| 782 | -$active_group[] = $form->createElement('checkbox','keyword_active','', get_lang('Active')); |
|
| 783 | -$active_group[] = $form->createElement('checkbox','keyword_inactive','', get_lang('Inactive')); |
|
| 784 | -$form->addGroup($active_group,'',get_lang('ActiveAccount'), '<br/>',false); |
|
| 782 | +$active_group[] = $form->createElement('checkbox', 'keyword_active', '', get_lang('Active')); |
|
| 783 | +$active_group[] = $form->createElement('checkbox', 'keyword_inactive', '', get_lang('Inactive')); |
|
| 784 | +$form->addGroup($active_group, '', get_lang('ActiveAccount'), '<br/>', false); |
|
| 785 | 785 | |
| 786 | 786 | $form->addElement('checkbox', 'check_easy_passwords', null, get_lang('CheckEasyPasswords')); |
| 787 | 787 | |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | $defaults['keyword_active'] = 1; |
| 793 | 793 | $defaults['keyword_inactive'] = 1; |
| 794 | 794 | $form->setDefaults($defaults); |
| 795 | -$form->addElement('html','</div>'); |
|
| 795 | +$form->addElement('html', '</div>'); |
|
| 796 | 796 | |
| 797 | 797 | $form = $form->returnForm(); |
| 798 | 798 | |
@@ -874,10 +874,10 @@ discard block |
||
| 874 | 874 | } |
| 875 | 875 | if ($add_user) { |
| 876 | 876 | $row_table = array(); |
| 877 | - $row_table[] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].') '; |
|
| 878 | - $row_table[] = $access_info_to_string; |
|
| 877 | + $row_table[] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].') '; |
|
| 878 | + $row_table[] = $access_info_to_string; |
|
| 879 | 879 | $url = api_get_self().'?action=add_user_to_my_url&user_id='.$user['id'].'&sec_token='.$_SESSION['sec_token']; |
| 880 | - $row_table[] = Display::url(get_lang('AddUserToMyURL'), $url, array('class' => 'btn')); |
|
| 880 | + $row_table[] = Display::url(get_lang('AddUserToMyURL'), $url, array('class' => 'btn')); |
|
| 881 | 881 | |
| 882 | 882 | foreach ($row_table as $cell) { |
| 883 | 883 | $table->setCellContents($row, $column, $cell); |