Completed
Push — 1.10.x ( 9d3ef5...048bd3 )
by José
53:13
created
main/admin/user_list.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
     if (isset($keyword_extra_data) && !empty($keyword_extra_data)) {
221 221
         $extra_info = UserManager::get_extra_field_information_by_name($keyword_extra_data);
222 222
         $field_id = $extra_info['id'];
223
-        $sql.= " INNER JOIN user_field_values ufv ON u.id=ufv.user_id AND ufv.field_id=$field_id ";
223
+        $sql .= " INNER JOIN user_field_values ufv ON u.id=ufv.user_id AND ufv.field_id=$field_id ";
224 224
     }
225 225
 
226 226
     if (isset($_GET['keyword']) && !empty($_GET['keyword'])) {
227
-        $keywordFiltered = Database::escape_string("%". $_GET['keyword'] ."%");
227
+        $keywordFiltered = Database::escape_string("%".$_GET['keyword']."%");
228 228
         $sql .= " WHERE (
229 229
                     u.firstname LIKE '$keywordFiltered' OR
230 230
                     u.lastname LIKE '$keywordFiltered' OR
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 
256 256
         $sql .= " $query_admin_table
257 257
                 WHERE (
258
-                    u.firstname LIKE '". Database::escape_string("%".$keywordListValues['keyword_firstname']."%")."' AND
258
+                    u.firstname LIKE '".Database::escape_string("%".$keywordListValues['keyword_firstname']."%")."' AND
259 259
                     u.lastname LIKE '". Database::escape_string("%".$keywordListValues['keyword_lastname']."%")."' AND
260 260
                     u.username LIKE '". Database::escape_string("%".$keywordListValues['keyword_username']."%")."' AND
261 261
                     u.email LIKE '". Database::escape_string("%".$keywordListValues['keyword_email']."%")."' AND
262 262
                     u.status LIKE '".Database::escape_string($keywordListValues['keyword_status'])."' ";
263 263
         if (!empty($keywordListValues['keyword_officialcode'])) {
264
-            $sql .= " AND u.official_code LIKE '" . Database::escape_string("%" . $keywordListValues['keyword_officialcode'] . "%") . "' ";
264
+            $sql .= " AND u.official_code LIKE '".Database::escape_string("%".$keywordListValues['keyword_officialcode']."%")."' ";
265 265
         }
266 266
         $sql .= "
267 267
             $keyword_admin
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
     $lastname = $userInfo['lastname'];
314 314
 
315 315
 	if (api_is_western_name_order()) {
316
-		$message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId);
316
+		$message = sprintf(get_lang('AttemptingToLoginAs'), $firstname, $lastname, $userId);
317 317
 	} else {
318 318
 		$message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId);
319 319
 	}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         Session::write('login_as', true);
348 348
 
349 349
         $target_url = api_get_path(WEB_PATH)."user_portal.php";
350
-        $message .= '<br />'.sprintf(get_lang('LoginSuccessfulGoToX'),'<a href="'.$target_url.'">'.$target_url.'</a>');
350
+        $message .= '<br />'.sprintf(get_lang('LoginSuccessfulGoToX'), '<a href="'.$target_url.'">'.$target_url.'</a>');
351 351
         Display :: display_header(get_lang('UserList'));
352 352
         Display :: display_normal_message($message, false);
353 353
         Display :: display_footer();
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
         $sql .= "AND password LIKE '$easyPassword' ";
392 392
     }*/
393 393
 
394
-    if (!in_array($direction, array('ASC','DESC'))) {
394
+    if (!in_array($direction, array('ASC', 'DESC'))) {
395 395
     	$direction = 'ASC';
396 396
     }
397 397
     $column = intval($column);
398
-    $from 	= intval($from);
398
+    $from = intval($from);
399 399
     $number_of_items = intval($number_of_items);
400 400
 
401 401
     $preventSessionAdminsToManageAllUsers = api_get_setting('prevent_session_admins_to_manage_all_users');
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 
409 409
 	$res = Database::query($sql);
410 410
 
411
-	$users = array ();
411
+	$users = array();
412 412
     $t = time();
413 413
 	while ($user = Database::fetch_row($res)) {
414 414
 		$userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL);
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
  */
470 470
 function modify_filter($user_id, $url_params, $row) {
471 471
 	global $charset, $_admins_list;
472
-	$is_admin   = in_array($user_id,$_admins_list);
472
+	$is_admin   = in_array($user_id, $_admins_list);
473 473
 	$statusname = api_get_status_langvars();
474 474
 	$user_is_anonymous = false;
475 475
     $current_user_status_label = $row['7'];
476 476
 
477 477
 	if ($current_user_status_label == $statusname[ANONYMOUS]) {
478
-		$user_is_anonymous =true;
478
+		$user_is_anonymous = true;
479 479
 	}
480 480
 	$result = '';
481 481
 	if (!$user_is_anonymous) {
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 					<div class="blackboard_hide" id="div_s_'.$user_id.'">&nbsp;&nbsp;</div>
492 492
 					</a>';
493 493
 	} else {
494
-		$result .= Display::return_icon('course_na.png',get_lang('Courses')).'&nbsp;&nbsp;';
495
-		$result .= Display::return_icon('course_na.png',get_lang('Sessions')).'&nbsp;&nbsp;';
494
+		$result .= Display::return_icon('course_na.png', get_lang('Courses')).'&nbsp;&nbsp;';
495
+		$result .= Display::return_icon('course_na.png', get_lang('Sessions')).'&nbsp;&nbsp;';
496 496
 	}
497 497
 
498 498
 	if (api_is_platform_admin()) {
@@ -528,14 +528,14 @@  discard block
 block discarded – undo
528 528
         $editProfileUrl = Display::getProfileEditionLink($user_id, true);
529 529
 
530 530
         if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) {
531
-            $result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
531
+            $result .= '<a href="'.$editProfileUrl.'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
532 532
 		} else {
533 533
             $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
534 534
 		}
535 535
 	}
536 536
 
537 537
 	if ($is_admin) {
538
-		$result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL));
538
+		$result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'), array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL));
539 539
 	} else {
540 540
 		$result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator'));
541 541
 	}
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
                 api_global_admin_can_edit_admin($user_id)
588 588
             ) {
589 589
                 // 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.
590
-                $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>';
590
+                $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>';
591 591
             } else {
592 592
                 $result .= Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
593 593
             }
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
     if ($action == 'edit') {
627 627
         $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16);
628
-    } elseif ($row['0']<>$_user['user_id']) {
628
+    } elseif ($row['0'] <> $_user['user_id']) {
629 629
     	// 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.
630 630
 		$result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>';
631 631
 	}
@@ -647,11 +647,11 @@  discard block
 block discarded – undo
647 647
 }
648 648
 
649 649
 if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
650
-    $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
651
-    $interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList'));
650
+    $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
651
+    $interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList'));
652 652
     $tool_name = get_lang('SearchUsers');
653 653
 } else {
654
-    $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
654
+    $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
655 655
     $tool_name = get_lang('UserList');
656 656
 }
657 657
 
@@ -664,10 +664,10 @@  discard block
 block discarded – undo
664 664
             case 'add_user_to_my_url':
665 665
                 $user_id = $_REQUEST["user_id"];
666 666
                 $result = UrlManager::add_user_to_url($user_id, $current_access_url_id);
667
-                if ($result ) {
667
+                if ($result) {
668 668
                     $user_info = api_get_user_info($user_id);
669 669
                     $message = get_lang('UserAdded').' '.$user_info['firstname'].' '.$user_info['lastname'].' ('.$user_info['username'].')';
670
-                    $message  = Display::return_message($message, 'confirmation');
670
+                    $message = Display::return_message($message, 'confirmation');
671 671
                 }
672 672
                 break;
673 673
 			case 'delete_user':
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 							$message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error');
683 683
 						}
684 684
 					} else {
685
-						$message = Display :: return_message(get_lang('CannotDeleteUser'),'error');
685
+						$message = Display :: return_message(get_lang('CannotDeleteUser'), 'error');
686 686
 					}
687 687
 				}
688 688
 				break;
@@ -726,17 +726,17 @@  discard block
 block discarded – undo
726 726
     </a>'
727 727
 );
728 728
 
729
-$actions  = '';
729
+$actions = '';
730 730
 if (api_is_platform_admin()) {
731 731
 	$actions .= '<div style="float:right;">'.
732 732
 		 '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'.
733
-         Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'.
733
+         Display::return_icon('new_user.png', get_lang('AddUsers'), '', ICON_SIZE_MEDIUM).'</a>'.
734 734
 		 '</div>';
735 735
 }
736 736
 $actions .= $form->return_form();
737 737
 
738 738
 if (isset ($_GET['keyword'])) {
739
-	$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
739
+	$parameters = array('keyword' => Security::remove_XSS($_GET['keyword']));
740 740
 } elseif (isset ($_GET['keyword_firstname'])) {
741 741
 	$parameters['keyword_firstname'] 	= Security::remove_XSS($_GET['keyword_firstname']);
742 742
 	$parameters['keyword_lastname']	 	= Security::remove_XSS($_GET['keyword_lastname']);
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	$parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']);
746 746
 	$parameters['keyword_status'] 		= Security::remove_XSS($_GET['keyword_status']);
747 747
 	$parameters['keyword_active'] 		= Security::remove_XSS($_GET['keyword_active']);
748
-	$parameters['keyword_inactive'] 	= Security::remove_XSS($_GET['keyword_inactive']);
748
+	$parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']);
749 749
 }
750 750
 // Create a sortable table with user-data
751 751
 $parameters['sec_token'] = Security::get_token();
@@ -762,15 +762,15 @@  discard block
 block discarded – undo
762 762
 // Display Advanced search form.
763 763
 $form = new FormValidator('advanced_search', 'get', '', '', array(), FormValidator::LAYOUT_HORIZONTAL);
764 764
 
765
-$form->addElement('html','<div id="advanced_search_form" style="display:none;">');
765
+$form->addElement('html', '<div id="advanced_search_form" style="display:none;">');
766 766
 $form->addElement('header', get_lang('AdvancedSearch'));
767
-$form->addText('keyword_firstname',get_lang('FirstName'),false);
768
-$form->addText('keyword_lastname',get_lang('LastName'),false);
767
+$form->addText('keyword_firstname', get_lang('FirstName'), false);
768
+$form->addText('keyword_lastname', get_lang('LastName'), false);
769 769
 
770
-$form->addText('keyword_username',get_lang('LoginName'),false);
771
-$form->addText('keyword_email',get_lang('Email'),false);
770
+$form->addText('keyword_username', get_lang('LoginName'), false);
771
+$form->addText('keyword_email', get_lang('Email'), false);
772 772
 
773
-$form->addText('keyword_officialcode',get_lang('OfficialCode'),false);
773
+$form->addText('keyword_officialcode', get_lang('OfficialCode'), false);
774 774
 
775 775
 $status_options = array();
776 776
 $status_options['%'] = get_lang('All');
@@ -780,12 +780,12 @@  discard block
 block discarded – undo
780 780
 $status_options[SESSIONADMIN] = get_lang('SessionsAdmin');
781 781
 $status_options[PLATFORM_ADMIN] = get_lang('Administrator');
782 782
 
783
-$form->addElement('select','keyword_status',get_lang('Profile'), $status_options    );
783
+$form->addElement('select', 'keyword_status', get_lang('Profile'), $status_options);
784 784
 
785 785
 $active_group = array();
786
-$active_group[] = $form->createElement('checkbox','keyword_active','', get_lang('Active'));
787
-$active_group[] = $form->createElement('checkbox','keyword_inactive','', get_lang('Inactive'));
788
-$form->addGroup($active_group,'',get_lang('ActiveAccount'), '<br/>',false);
786
+$active_group[] = $form->createElement('checkbox', 'keyword_active', '', get_lang('Active'));
787
+$active_group[] = $form->createElement('checkbox', 'keyword_inactive', '', get_lang('Inactive'));
788
+$form->addGroup($active_group, '', get_lang('ActiveAccount'), '<br/>', false);
789 789
 
790 790
 $form->addElement('checkbox', 'check_easy_passwords', null, get_lang('CheckEasyPasswords'));
791 791
 
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 $defaults['keyword_active'] = 1;
797 797
 $defaults['keyword_inactive'] = 1;
798 798
 $form->setDefaults($defaults);
799
-$form->addElement('html','</div>');
799
+$form->addElement('html', '</div>');
800 800
 
801 801
 $form = $form->returnForm();
802 802
 
@@ -878,10 +878,10 @@  discard block
 block discarded – undo
878 878
                 }
879 879
                 if ($add_user) {
880 880
                     $row_table = array();
881
-                    $row_table[] =  api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].') ';
882
-                    $row_table[] =  $access_info_to_string;
881
+                    $row_table[] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].') ';
882
+                    $row_table[] = $access_info_to_string;
883 883
                     $url = api_get_self().'?action=add_user_to_my_url&user_id='.$user['id'].'&sec_token='.$_SESSION['sec_token'];
884
-                    $row_table[] =  Display::url(get_lang('AddUserToMyURL'), $url, array('class' => 'btn'));
884
+                    $row_table[] = Display::url(get_lang('AddUserToMyURL'), $url, array('class' => 'btn'));
885 885
 
886 886
                     foreach ($row_table as $cell) {
887 887
                         $table->setCellContents($row, $column, $cell);
Please login to merge, or discard this patch.