Passed
Push — 1.10.x ( 918f1f...c8b126 )
by Yannick
419:13 queued 372:02
created
main/admin/add_courses_to_usergroup.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -229,31 +229,31 @@  discard block
 block discarded – undo
229 229
   <td align="center">
230 230
   <div id="content_source">
231 231
       <?php
232
-      if (!($add_type=='multiple')) {
232
+        if (!($add_type=='multiple')) {
233 233
         ?>
234 234
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
235 235
         <div id="ajax_list_users_single"></div>
236 236
         <?php
237
-      } else {
238
-      ?>
237
+        } else {
238
+        ?>
239 239
       <div id="ajax_list_multiple">
240 240
         <?php echo Display::select('elements_not_in_name', $elements_not_in, '', array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?>
241 241
       </div>
242 242
     <?php
243
-      }
244
-     ?>
243
+        }
244
+        ?>
245 245
   </div>
246 246
   </td>
247 247
   <td width="10%" valign="middle" align="center">
248 248
   <?php
249
-  if ($ajax_search) {
250
-  ?>
249
+    if ($ajax_search) {
250
+    ?>
251 251
     <button class="btn bt-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" >
252 252
         <em class="fa fa-arrow-left"></em>
253 253
     </button>
254 254
   <?php
255
-  } else {
256
-  ?>
255
+    } else {
256
+    ?>
257 257
     <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))">
258 258
         <em class="fa fa-arrow-right"></em>
259 259
     </button>
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
         <em class="fa fa-arrow-left"></em>
263 263
     </button>
264 264
     <?php
265
-  }
266
-  ?>
265
+    }
266
+    ?>
267 267
     <br /><br /><br /><br /><br /><br />
268 268
   </td>
269 269
   <td align="center">
Please login to merge, or discard this patch.
main/admin/course_export.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         $courses = $course_list;
47 47
     }
48 48
 
49
-	if (!empty($courses)) {
49
+    if (!empty($courses)) {
50 50
 
51 51
         $archiveFile = 'export_courses_list_'.api_get_local_time();
52 52
 
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
                 Export::arrayToXls($listToExport, $archiveFile);
99 99
                 break;
100 100
         }
101
-	} else {
101
+    } else {
102 102
         Display::addFlash(
103 103
             Display::return_message(
104 104
                 get_lang('ThereAreNotSelectedCoursesOrCoursesListIsEmpty')
105 105
             )
106 106
         );
107
-	}
107
+    }
108 108
 }
109 109
 
110 110
 
@@ -114,29 +114,29 @@  discard block
 block discarded – undo
114 114
 $form->addHeader($tool_name);
115 115
 $form->addHidden('formSent', 1);
116 116
 $form->addElement(
117
-	'radio',
118
-	'select_type',
119
-	get_lang('Option'),
120
-	get_lang('ExportAllCoursesList'),
121
-	 '1',
122
-	 ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='none';}"]
117
+    'radio',
118
+    'select_type',
119
+    get_lang('Option'),
120
+    get_lang('ExportAllCoursesList'),
121
+        '1',
122
+        ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='none';}"]
123 123
 );
124 124
 
125 125
 $form->addElement(
126
-	'radio',
127
-	'select_type',
128
-	'',
129
-	get_lang('ExportSelectedCoursesFromCoursesList'),
130
-	'2',
131
-	['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='block';}"]
126
+    'radio',
127
+    'select_type',
128
+    '',
129
+    get_lang('ExportSelectedCoursesFromCoursesList'),
130
+    '2',
131
+    ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='block';}"]
132 132
 );
133 133
 
134 134
 if (!empty($course_list)) {
135
-	$form->addHtml('<div id="div-course-list" style="display:none">');
136
-	$coursesInList = [];
137
-	foreach ($course_list as $course) {
138
-		$coursesInList[$course['code']] = $course['title'].' ('.$course['code'].')';
139
-	}
135
+    $form->addHtml('<div id="div-course-list" style="display:none">');
136
+    $coursesInList = [];
137
+    foreach ($course_list as $course) {
138
+        $coursesInList[$course['code']] = $course['title'].' ('.$course['code'].')';
139
+    }
140 140
 
141 141
     $form->addSelect(
142 142
         'course_code',
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         ['multiple' => 'multiple']
146 146
     );
147 147
 
148
-	$form->addHtml('</div>');
148
+    $form->addHtml('</div>');
149 149
 }
150 150
 
151 151
 $form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV' , 'csv', null);
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
 /**
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 * @return string HTML-code with a mailto-link
451 451
 */
452 452
 function user_filter($name, $params, $row) {
453
-	return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>';
453
+    return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>';
454 454
 }
455 455
 
456 456
 /**
@@ -461,84 +461,84 @@  discard block
 block discarded – undo
461 461
  * @return string Some HTML-code with modify-buttons
462 462
  */
463 463
 function modify_filter($user_id, $url_params, $row) {
464
-	global $charset, $_admins_list;
465
-	$is_admin   = in_array($user_id,$_admins_list);
466
-	$statusname = api_get_status_langvars();
467
-	$user_is_anonymous = false;
464
+    global $charset, $_admins_list;
465
+    $is_admin   = in_array($user_id,$_admins_list);
466
+    $statusname = api_get_status_langvars();
467
+    $user_is_anonymous = false;
468 468
     $current_user_status_label = $row['7'];
469 469
 
470
-	if ($current_user_status_label == $statusname[ANONYMOUS]) {
471
-		$user_is_anonymous =true;
472
-	}
473
-	$result = '';
474
-	if (!$user_is_anonymous) {
475
-		$icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')'));
476
-		$result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" >
470
+    if ($current_user_status_label == $statusname[ANONYMOUS]) {
471
+        $user_is_anonymous =true;
472
+    }
473
+    $result = '';
474
+    if (!$user_is_anonymous) {
475
+        $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')'));
476
+        $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" >
477 477
 			        '.$icon.'
478 478
 					<div class="blackboard_hide" id="div_'.$user_id.'">&nbsp;&nbsp;</div>
479 479
 					</a>';
480 480
 
481 481
         $icon = Display::return_icon('session.png', get_lang('Sessions'), array('onmouseout' => 'clear_session_list (\'div_s_'.$user_id.'\')'));
482
-		$result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" >
482
+        $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" >
483 483
 					'.$icon.'
484 484
 					<div class="blackboard_hide" id="div_s_'.$user_id.'">&nbsp;&nbsp;</div>
485 485
 					</a>';
486
-	} else {
487
-		$result .= Display::return_icon('course_na.png',get_lang('Courses')).'&nbsp;&nbsp;';
488
-		$result .= Display::return_icon('course_na.png',get_lang('Sessions')).'&nbsp;&nbsp;';
489
-	}
486
+    } else {
487
+        $result .= Display::return_icon('course_na.png',get_lang('Courses')).'&nbsp;&nbsp;';
488
+        $result .= Display::return_icon('course_na.png',get_lang('Sessions')).'&nbsp;&nbsp;';
489
+    }
490 490
 
491
-	if (api_is_platform_admin()) {
492
-		if (!$user_is_anonymous) {
493
-			$result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;&nbsp;';
494
-		} else {
495
-			$result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).'&nbsp;&nbsp;';
496
-		}
497
-	}
491
+    if (api_is_platform_admin()) {
492
+        if (!$user_is_anonymous) {
493
+            $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a>&nbsp;&nbsp;';
494
+        } else {
495
+            $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).'&nbsp;&nbsp;';
496
+        }
497
+    }
498 498
 
499 499
     //only allow platform admins to login_as, or session admins only for students (not teachers nor other admins)
500 500
     if (api_is_platform_admin() || (api_is_session_admin() && $current_user_status_label == $statusname[STUDENT])) {
501
-    	if (!$user_is_anonymous) {
501
+        if (!$user_is_anonymous) {
502 502
             if (api_global_admin_can_edit_admin($user_id)) {
503 503
                 $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;';
504 504
             } else {
505 505
                 $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
506 506
             }
507
-    	} else {
508
-    		$result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
509
-    	}
507
+        } else {
508
+            $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
509
+        }
510 510
     } else {
511
-    	$result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
511
+        $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).'&nbsp;&nbsp;';
512 512
     }
513 513
 
514
-	if ($current_user_status_label != $statusname[STUDENT]) {
515
-		$result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).'&nbsp;&nbsp;';
516
-	} else {
517
-		$result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>&nbsp;&nbsp;';
518
-	}
514
+    if ($current_user_status_label != $statusname[STUDENT]) {
515
+        $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).'&nbsp;&nbsp;';
516
+    } else {
517
+        $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>&nbsp;&nbsp;';
518
+    }
519 519
 
520
-	if (api_is_platform_admin(true)) {
520
+    if (api_is_platform_admin(true)) {
521 521
         $editProfileUrl = Display::getProfileEditionLink($user_id, true);
522 522
 
523 523
         if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) {
524 524
             $result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
525
-		} else {
525
+        } else {
526 526
             $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;';
527
-		}
528
-	}
527
+        }
528
+    }
529 529
 
530
-	if ($is_admin) {
531
-		$result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL));
532
-	} else {
533
-		$result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator'));
534
-	}
530
+    if ($is_admin) {
531
+        $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL));
532
+    } else {
533
+        $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator'));
534
+    }
535 535
 
536
-	// actions for assigning sessions, courses or users
537
-	if (api_is_session_admin()) {
538
-		/*if ($row[0] == api_get_user_id()) {
536
+    // actions for assigning sessions, courses or users
537
+    if (api_is_session_admin()) {
538
+        /*if ($row[0] == api_get_user_id()) {
539 539
 			$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;';
540 540
 		}*/
541
-	} else {
541
+    } else {
542 542
         if ($current_user_status_label == $statusname[SESSIONADMIN]) {
543 543
             $result .= Display::url(
544 544
                 Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')),
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                 );
569 569
             }
570 570
         }
571
-	}
571
+    }
572 572
 
573 573
     if (api_is_platform_admin()) {
574 574
         $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">'.
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
             }
587 587
         }
588 588
     }
589
-	return $result;
589
+    return $result;
590 590
 }
591 591
 
592 592
 
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
     if ($action == 'edit') {
620 620
         $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16);
621 621
     } elseif ($row['0']<>$_user['user_id']) {
622
-    	// 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.
623
-		$result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>';
624
-	}
625
-	return $result;
622
+        // 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.
623
+        $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>';
624
+    }
625
+    return $result;
626 626
 }
627 627
 
628 628
 /**
@@ -635,8 +635,8 @@  discard block
 block discarded – undo
635 635
  * @author Patrick Cool <[email protected]>, Ghent University, Belgium
636 636
  */
637 637
 function status_filter($status) {
638
-	$statusname = api_get_status_langvars();
639
-	return $statusname[$status];
638
+    $statusname = api_get_status_langvars();
639
+    return $statusname[$status];
640 640
 }
641 641
 
642 642
 if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) {
@@ -652,8 +652,8 @@  discard block
 block discarded – undo
652 652
 
653 653
 if (!empty($action)) {
654 654
     $check = Security::check_token('get');
655
-	if ($check) {
656
-		switch ($action) {
655
+    if ($check) {
656
+        switch ($action) {
657 657
             case 'add_user_to_my_url':
658 658
                 $user_id = $_REQUEST["user_id"];
659 659
                 $result = UrlManager::add_user_to_url($user_id, $current_access_url_id);
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
                     $message  = Display::return_message($message, 'confirmation');
664 664
                 }
665 665
                 break;
666
-			case 'show_message' :
666
+            case 'show_message' :
667 667
                 if (!empty($_GET['warn'])) {
668 668
                     // to prevent too long messages
669 669
                     if ($_GET['warn'] == 'session_message') {
@@ -681,46 +681,46 @@  discard block
 block discarded – undo
681 681
                     $message .= Display::return_message(stripslashes($_GET['message']), 'confirmation');
682 682
                 }
683 683
 
684
-				break;
685
-			case 'delete_user' :
686
-				if (api_is_platform_admin()) {
684
+                break;
685
+            case 'delete_user' :
686
+                if (api_is_platform_admin()) {
687 687
                     $user_to_delete = $_GET['user_id'];
688 688
                     $current_user_id = api_get_user_id();
689 689
 
690
-					if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) {
691
-						if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) {
692
-							$message = Display :: return_message(get_lang('UserDeleted'), 'confirmation');
693
-						} else {
694
-							$message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error');
695
-						}
696
-					} else {
697
-						$message = Display :: return_message(get_lang('CannotDeleteUser'),'error');
698
-					}
699
-				}
700
-				break;
690
+                    if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) {
691
+                        if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) {
692
+                            $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation');
693
+                        } else {
694
+                            $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error');
695
+                        }
696
+                    } else {
697
+                        $message = Display :: return_message(get_lang('CannotDeleteUser'),'error');
698
+                    }
699
+                }
700
+                break;
701 701
             case 'delete' :
702
-				if (api_is_platform_admin()) {
703
-					$number_of_selected_users = count($_POST['id']);
704
-					$number_of_deleted_users = 0;
705
-					if (is_array($_POST['id'])) {
706
-						foreach ($_POST['id'] as $index => $user_id) {
707
-							if($user_id != $_user['user_id']) {
708
-								if(UserManager :: delete_user($user_id)) {
709
-									$number_of_deleted_users++;
710
-								}
711
-							}
712
-						}
713
-					}
714
-					if ($number_of_selected_users == $number_of_deleted_users) {
702
+                if (api_is_platform_admin()) {
703
+                    $number_of_selected_users = count($_POST['id']);
704
+                    $number_of_deleted_users = 0;
705
+                    if (is_array($_POST['id'])) {
706
+                        foreach ($_POST['id'] as $index => $user_id) {
707
+                            if($user_id != $_user['user_id']) {
708
+                                if(UserManager :: delete_user($user_id)) {
709
+                                    $number_of_deleted_users++;
710
+                                }
711
+                            }
712
+                        }
713
+                    }
714
+                    if ($number_of_selected_users == $number_of_deleted_users) {
715 715
                         $message = Display :: return_message(get_lang('SelectedUsersDeleted'), 'confirmation');
716
-					} else {
716
+                    } else {
717 717
                         $message = Display :: return_message(get_lang('SomeUsersNotDeleted'), 'error');
718
-					}
719
-				}
720
-				break;
721
-		}
722
-		Security::clear_token();
723
-	}
718
+                    }
719
+                }
720
+                break;
721
+        }
722
+        Security::clear_token();
723
+    }
724 724
 }
725 725
 
726 726
 // Create a search-box
@@ -740,24 +740,24 @@  discard block
 block discarded – undo
740 740
 
741 741
 $actions  = '';
742 742
 if (api_is_platform_admin()) {
743
-	$actions .= '<div style="float:right;">'.
744
-		 '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'.
745
-         Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'.
746
-		 '</div>';
743
+    $actions .= '<div style="float:right;">'.
744
+            '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'.
745
+            Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'.
746
+            '</div>';
747 747
 }
748 748
 $actions .= $form->return_form();
749 749
 
750 750
 if (isset ($_GET['keyword'])) {
751
-	$parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
751
+    $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword']));
752 752
 } elseif (isset ($_GET['keyword_firstname'])) {
753
-	$parameters['keyword_firstname'] 	= Security::remove_XSS($_GET['keyword_firstname']);
754
-	$parameters['keyword_lastname']	 	= Security::remove_XSS($_GET['keyword_lastname']);
755
-	$parameters['keyword_username']	 	= Security::remove_XSS($_GET['keyword_username']);
756
-	$parameters['keyword_email'] 	 	= Security::remove_XSS($_GET['keyword_email']);
757
-	$parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']);
758
-	$parameters['keyword_status'] 		= Security::remove_XSS($_GET['keyword_status']);
759
-	$parameters['keyword_active'] 		= Security::remove_XSS($_GET['keyword_active']);
760
-	$parameters['keyword_inactive'] 	= Security::remove_XSS($_GET['keyword_inactive']);
753
+    $parameters['keyword_firstname'] 	= Security::remove_XSS($_GET['keyword_firstname']);
754
+    $parameters['keyword_lastname']	 	= Security::remove_XSS($_GET['keyword_lastname']);
755
+    $parameters['keyword_username']	 	= Security::remove_XSS($_GET['keyword_username']);
756
+    $parameters['keyword_email'] 	 	= Security::remove_XSS($_GET['keyword_email']);
757
+    $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']);
758
+    $parameters['keyword_status'] 		= Security::remove_XSS($_GET['keyword_status']);
759
+    $parameters['keyword_active'] 		= Security::remove_XSS($_GET['keyword_active']);
760
+    $parameters['keyword_inactive'] 	= Security::remove_XSS($_GET['keyword_inactive']);
761 761
 }
762 762
 // Create a sortable table with user-data
763 763
 $parameters['sec_token'] = Security::get_token();
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 $res_admin = Database::query($sql_admin);
769 769
 $_admins_list = array();
770 770
 while ($row_admin = Database::fetch_row($res_admin)) {
771
-	$_admins_list[] = $row_admin[0];
771
+    $_admins_list[] = $row_admin[0];
772 772
 }
773 773
 
774 774
 // Display Advanced search form.
@@ -824,11 +824,11 @@  discard block
 block discarded – undo
824 824
 $table->set_header(2, get_lang('OfficialCode'));
825 825
 
826 826
 if (api_is_western_name_order()) {
827
-	$table->set_header(3, get_lang('FirstName'));
828
-	$table->set_header(4, get_lang('LastName'));
827
+    $table->set_header(3, get_lang('FirstName'));
828
+    $table->set_header(4, get_lang('LastName'));
829 829
 } else {
830
-	$table->set_header(3, get_lang('LastName'));
831
-	$table->set_header(4, get_lang('FirstName'));
830
+    $table->set_header(3, get_lang('LastName'));
831
+    $table->set_header(4, get_lang('FirstName'));
832 832
 }
833 833
 $table->set_header(5, get_lang('LoginName'));
834 834
 $table->set_header(6, get_lang('Email'));
Please login to merge, or discard this patch.
main/admin/dashboard_add_users_to_user.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 $add_type = 'multiple';
56 56
 if (isset($_GET['add_type']) && $_GET['add_type']!='') {
57
-	$add_type = Security::remove_XSS($_REQUEST['add_type']);
57
+    $add_type = Security::remove_XSS($_REQUEST['add_type']);
58 58
 }
59 59
 
60 60
 if (!api_is_platform_admin()) {
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
             ";
121 121
         }
122 122
 
123
-		$rs	= Database::query($sql);
124
-		$xajax_response->addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
123
+        $rs	= Database::query($sql);
124
+        $xajax_response->addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return));
125 125
 
126 126
         if ($type == 'single') {
127 127
             $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                     $return .= '...<br />';
161 161
                 }
162 162
             }
163
-           $xajax_response->addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
163
+            $xajax_response->addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return));
164 164
         } else {
165 165
             $return .= '<select id="origin" class="form-control" name="NoAssignedUsersList[]" multiple="multiple" size="15" ">';
166 166
             while($user = Database :: fetch_array($rs)) {
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
             $return .= '</select>';
171 171
             $xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
172 172
         }
173
-	}
174
-	return $xajax_response;
173
+    }
174
+    return $xajax_response;
175 175
 }
176 176
 
177 177
 $xajax->processRequests();
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
 $msg = '';
286 286
 if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
287
-	$user_list = $_POST['UsersList'];
287
+    $user_list = $_POST['UsersList'];
288 288
 
289 289
     switch ($userStatus) {
290 290
         case DRH:
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
 $assigned_users_id = array_keys($assigned_users_to_hrm);
350 350
 $without_assigned_users = '';
351 351
 if (count($assigned_users_id) > 0) {
352
-	$without_assigned_users = " user.user_id NOT IN(".implode(',',$assigned_users_id).") AND ";
352
+    $without_assigned_users = " user.user_id NOT IN(".implode(',',$assigned_users_id).") AND ";
353 353
 }
354 354
 
355 355
 $search_user = '';
356 356
 if (!empty($firstLetterUser)) {
357
-	$needle = Database::escape_string($firstLetterUser);
358
-	$search_user ="AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'";
357
+    $needle = Database::escape_string($firstLetterUser);
358
+    $search_user ="AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%'";
359 359
 }
360 360
 
361 361
 $sqlConditions = null;
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 }
376 376
 
377 377
 if (api_is_multiple_url_enabled()) {
378
-	$sql = "SELECT user.user_id, username, lastname, firstname
378
+    $sql = "SELECT user.user_id, username, lastname, firstname
379 379
 	        FROM $tbl_user user  LEFT JOIN $tbl_access_url_rel_user au ON (au.user_id = user.user_id)
380 380
 			WHERE
381 381
                 $without_assigned_users
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                 $sqlConditions
386 386
             ORDER BY firstname";
387 387
 } else {
388
-	$sql = "SELECT user_id, username, lastname, firstname
388
+    $sql = "SELECT user_id, username, lastname, firstname
389 389
 	        FROM $tbl_user user
390 390
 			WHERE
391 391
 			    $without_assigned_users
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 <input type="hidden" name="formSent" value="1" />
402 402
 <?php
403 403
 if(!empty($msg)) {
404
-	Display::display_normal_message($msg); //main API
404
+    Display::display_normal_message($msg); //main API
405 405
 }
406 406
 ?>
407 407
 
@@ -454,26 +454,26 @@  discard block
 block discarded – undo
454 454
             </div>
455 455
             
456 456
           <?php
457
-          }
458
-          ?>
457
+            }
458
+            ?>
459 459
             <div class="separate-action">
460 460
                 <?php
461
-		echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>';
461
+        echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>';
462 462
             ?>
463 463
             </div>
464 464
         </div>
465 465
     </div>
466 466
     <div class="col-md-4">
467 467
         <?php
468
-	if (UserManager::is_admin($user_id)) {
469
-		echo get_lang('AssignedUsersListToPlatformAdministrator');
468
+    if (UserManager::is_admin($user_id)) {
469
+        echo get_lang('AssignedUsersListToPlatformAdministrator');
470 470
             } else if ($user_info['status'] == SESSIONADMIN) {
471 471
                     echo get_lang('AssignedUsersListToSessionsAdministrator');
472 472
             } else if ($user_info['status'] == STUDENT_BOSS) {
473 473
                     echo get_lang('AssignedUsersListToStudentBoss');
474 474
             } else {
475 475
                     echo get_lang('AssignedUsersListToHumanResourcesManager');
476
-	}
476
+    }
477 477
         ?>
478 478
         <div class="form-group">
479 479
             <div class="col-sm-12">
Please login to merge, or discard this patch.
main/admin/sub_language.php 1 patch
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -59,30 +59,30 @@  discard block
 block discarded – undo
59 59
 $sublanguage_folder_error = false;
60 60
 
61 61
 if (isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) {
62
-	$language_name              = SubLanguageManager::get_name_of_language_by_id ($_GET['id']);
63
-	$sub_language_name          = SubLanguageManager::get_name_of_language_by_id ($_GET['sub_language_id']);
64
-	$all_data_of_language       = SubLanguageManager::get_all_information_of_language($_GET['id']);
65
-	$all_data_of_sublanguage    = SubLanguageManager::get_all_information_of_language($_GET['sub_language_id']);
66
-	$sub_language_file          = api_get_path(SYS_LANG_PATH).$all_data_of_sublanguage['dokeos_folder'];
62
+    $language_name              = SubLanguageManager::get_name_of_language_by_id ($_GET['id']);
63
+    $sub_language_name          = SubLanguageManager::get_name_of_language_by_id ($_GET['sub_language_id']);
64
+    $all_data_of_language       = SubLanguageManager::get_all_information_of_language($_GET['id']);
65
+    $all_data_of_sublanguage    = SubLanguageManager::get_all_information_of_language($_GET['sub_language_id']);
66
+    $sub_language_file          = api_get_path(SYS_LANG_PATH).$all_data_of_sublanguage['dokeos_folder'];
67 67
 
68
-	if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) {
69
-		$sublanguage_folder_error = $sub_language_file.' '.get_lang('IsNotWritable');
70
-	}
71
-	if (SubLanguageManager::check_if_exist_language_by_id($_GET['id'])===true) {
72
-		$language_id_exist = true;
73
-	} else {
74
-		$language_id_exist = false;
75
-	}
68
+    if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) {
69
+        $sublanguage_folder_error = $sub_language_file.' '.get_lang('IsNotWritable');
70
+    }
71
+    if (SubLanguageManager::check_if_exist_language_by_id($_GET['id'])===true) {
72
+        $language_id_exist = true;
73
+    } else {
74
+        $language_id_exist = false;
75
+    }
76 76
 } else {
77
-	$language_name='';
78
-	$language_id_exist=false;
77
+    $language_name='';
78
+    $language_id_exist=false;
79 79
 }
80 80
 
81 81
 $intro = sprintf(get_lang('RegisterTermsOfSubLanguageForX'), strtolower($sub_language_name));
82 82
 $path_folder = api_get_path(SYS_LANG_PATH).$all_data_of_language['dokeos_folder'];
83 83
 
84 84
 if (!is_dir($path_folder) || strlen($all_data_of_language['dokeos_folder'])==0) {
85
-	api_not_allowed(true);
85
+    api_not_allowed(true);
86 86
 }
87 87
 
88 88
 Display :: display_header($language_name);
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 echo '</div>';
95 95
 
96 96
 if (!empty($_SESSION['msg'])) {
97
-	echo $_SESSION['msg'];
98
-	unset($_SESSION['msg']);
97
+    echo $_SESSION['msg'];
98
+    unset($_SESSION['msg']);
99 99
 } else {
100
-	echo '<br />';
100
+    echo '<br />';
101 101
 }
102 102
 
103 103
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 echo $html;
116 116
 echo '<br /><br /><br />';
117 117
 if (!empty($sublanguage_folder_error)) {
118
-	Display::display_warning_message($sublanguage_folder_error);
118
+    Display::display_warning_message($sublanguage_folder_error);
119 119
 }
120 120
 echo '<div id="div_message_information_id">&nbsp;</div>';
121 121
 
@@ -130,182 +130,182 @@  discard block
 block discarded – undo
130 130
  *
131 131
  */
132 132
 function search_language_term(
133
-	$term,
134
-	$search_in_variable = true,
135
-	$search_in_english = true,
136
-	$search_in_parent = true,
137
-	$search_in_sub_language = true
133
+    $term,
134
+    $search_in_variable = true,
135
+    $search_in_english = true,
136
+    $search_in_parent = true,
137
+    $search_in_sub_language = true
138 138
 ) {
139
-	//These the $_REQUEST['id'] and the $_REQUEST['sub_language_id'] variables are process in global.inc.php (LOAD LANGUAGE FILES SECTION)
140
-	/*
139
+    //These the $_REQUEST['id'] and the $_REQUEST['sub_language_id'] variables are process in global.inc.php (LOAD LANGUAGE FILES SECTION)
140
+    /*
141 141
 		These 4 arrays are set in global.inc.php with the condition that will be load from sub_language.php or sub_language_ajax.inc.php
142 142
 		$english_language_array
143 143
 		$parent_language_array
144 144
 		$sub_language_array
145 145
 		$language_files_to_load
146 146
 	*/
147
-	global $language_files_to_load, $sub_language_array, $english_language_array, $parent_language_array;
148
-	$language_files_to_load_keys = array_flip($language_files_to_load);
149
-	$array_to_search = $parent_language_array;
150
-	$list_info = array();
151
-	$term='/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i';
152
-	//@todo optimize this foreach
153
-	foreach ($language_files_to_load as $lang_file) {
154
-		//searching in parent language of the sub language
155
-		if ($search_in_parent) {
156
-			$variables = $parent_language_array[$lang_file];
157
-			foreach ($variables as $parent_name_variable =>$parent_variable_value) {
158
-				//arrays are avoided
159
-				if (is_array($parent_variable_value)) {
160
-					continue;
161
-				}
162
-				$founded = false;
163
-				// searching the item in the parent tool
164
-				if (preg_match($term,$parent_variable_value)!==0) {
165
-					$founded = true;
166
-				}
167
-				if ($founded) {
168
-					//loading variable from the english array
169
-					$sub_language_name_variable = $sub_language_array[$lang_file][$parent_name_variable];
170
-					//loading variable from the english array
171
-					$english_name_variable = $english_language_array[$lang_file][$parent_name_variable];
147
+    global $language_files_to_load, $sub_language_array, $english_language_array, $parent_language_array;
148
+    $language_files_to_load_keys = array_flip($language_files_to_load);
149
+    $array_to_search = $parent_language_array;
150
+    $list_info = array();
151
+    $term='/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i';
152
+    //@todo optimize this foreach
153
+    foreach ($language_files_to_load as $lang_file) {
154
+        //searching in parent language of the sub language
155
+        if ($search_in_parent) {
156
+            $variables = $parent_language_array[$lang_file];
157
+            foreach ($variables as $parent_name_variable =>$parent_variable_value) {
158
+                //arrays are avoided
159
+                if (is_array($parent_variable_value)) {
160
+                    continue;
161
+                }
162
+                $founded = false;
163
+                // searching the item in the parent tool
164
+                if (preg_match($term,$parent_variable_value)!==0) {
165
+                    $founded = true;
166
+                }
167
+                if ($founded) {
168
+                    //loading variable from the english array
169
+                    $sub_language_name_variable = $sub_language_array[$lang_file][$parent_name_variable];
170
+                    //loading variable from the english array
171
+                    $english_name_variable = $english_language_array[$lang_file][$parent_name_variable];
172 172
 
173
-					//config buttons
174
-					/*if (strlen($english_name_variable)>1500) {
173
+                    //config buttons
174
+                    /*if (strlen($english_name_variable)>1500) {
175 175
 						$size =20;
176 176
 					} else {
177 177
 						$size =4;
178 178
 					}*/
179 179
 
180
-					$obj_text='<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>';
181
-					$obj_button='<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'"  />'.get_lang('Save').'</button>';
180
+                    $obj_text='<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>';
181
+                    $obj_button='<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'"  />'.get_lang('Save').'</button>';
182 182
 
183
-					$list_info[] = array(
184
-						$lang_file . '.inc.php',
185
-						$parent_name_variable,
186
-						$english_name_variable,
187
-						$parent_variable_value,
188
-						$obj_text,
189
-						$obj_button
190
-					);
191
-				}
192
-			}
193
-		}
183
+                    $list_info[] = array(
184
+                        $lang_file . '.inc.php',
185
+                        $parent_name_variable,
186
+                        $english_name_variable,
187
+                        $parent_variable_value,
188
+                        $obj_text,
189
+                        $obj_button
190
+                    );
191
+                }
192
+            }
193
+        }
194 194
 
195
-		//search in english
196
-		if ($search_in_english || $search_in_variable) {
197
-			$variables = $english_language_array[$lang_file];
198
-			foreach ($variables as $name_variable =>$variable_value) {
199
-				if (is_array($variable_value)) {
200
-					continue;
201
-				}
195
+        //search in english
196
+        if ($search_in_english || $search_in_variable) {
197
+            $variables = $english_language_array[$lang_file];
198
+            foreach ($variables as $name_variable =>$variable_value) {
199
+                if (is_array($variable_value)) {
200
+                    continue;
201
+                }
202 202
 
203
-				if (is_array($variable_value))
204
-					echo $lang_file;
205
-				$founded = false;
206
-				if ($search_in_english && $search_in_variable) {
207
-					// searching the item in the parent tool
208
-					if (preg_match($term,$variable_value)!==0 || preg_match($term,$name_variable)!==0 ) {
209
-						$founded = true;
210
-					}
211
-				} else {
212
-					if ($search_in_english) {
213
-						if (preg_match($term,$variable_value)!==0) {
214
-							$founded = true;
215
-						}
216
-					} else {
217
-						if (preg_match($term,$name_variable)!==0) {
218
-							$founded = true;
219
-						}
220
-					}
221
-				}
203
+                if (is_array($variable_value))
204
+                    echo $lang_file;
205
+                $founded = false;
206
+                if ($search_in_english && $search_in_variable) {
207
+                    // searching the item in the parent tool
208
+                    if (preg_match($term,$variable_value)!==0 || preg_match($term,$name_variable)!==0 ) {
209
+                        $founded = true;
210
+                    }
211
+                } else {
212
+                    if ($search_in_english) {
213
+                        if (preg_match($term,$variable_value)!==0) {
214
+                            $founded = true;
215
+                        }
216
+                    } else {
217
+                        if (preg_match($term,$name_variable)!==0) {
218
+                            $founded = true;
219
+                        }
220
+                    }
221
+                }
222 222
 
223
-				if ($founded) {
224
-					//loading variable from the english array
225
-					$sub_language_name_variable = null;
226
-					if (isset($sub_language_array[$lang_file][$name_variable])) {
227
-						$sub_language_name_variable = $sub_language_array[$lang_file][$name_variable];
228
-					}
229
-					$parent_variable_value = null;
230
-					if (isset($parent_language_array[$lang_file][$name_variable])) {
231
-						$parent_variable_value = $parent_language_array[$lang_file][$name_variable];
232
-					}
233
-					//config buttons
234
-					$obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.
235
-						$sub_language_name_variable.'
223
+                if ($founded) {
224
+                    //loading variable from the english array
225
+                    $sub_language_name_variable = null;
226
+                    if (isset($sub_language_array[$lang_file][$name_variable])) {
227
+                        $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable];
228
+                    }
229
+                    $parent_variable_value = null;
230
+                    if (isset($parent_language_array[$lang_file][$name_variable])) {
231
+                        $parent_variable_value = $parent_language_array[$lang_file][$name_variable];
232
+                    }
233
+                    //config buttons
234
+                    $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.
235
+                        $sub_language_name_variable.'
236 236
 						</textarea>';
237
-					$obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
237
+                    $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
238 238
 
239
-					//loading variable from the english array
240
-					$english_name_variable = $english_language_array[$lang_file][$name_variable];
239
+                    //loading variable from the english array
240
+                    $english_name_variable = $english_language_array[$lang_file][$name_variable];
241 241
 
242
-					$list_info[] = array(
243
-						$lang_file . '.inc.php',
244
-						$name_variable,
245
-						$english_name_variable,
246
-						$parent_variable_value,
247
-						$obj_text,
248
-						$obj_button
249
-					);
250
-				}
251
-			}
252
-		}
242
+                    $list_info[] = array(
243
+                        $lang_file . '.inc.php',
244
+                        $name_variable,
245
+                        $english_name_variable,
246
+                        $parent_variable_value,
247
+                        $obj_text,
248
+                        $obj_button
249
+                    );
250
+                }
251
+            }
252
+        }
253 253
 
254
-		// Search in sub language
255
-		if ($search_in_sub_language) {
256
-			$variables = $sub_language_array[$lang_file];
257
-			foreach ($variables as $name_variable =>$variable_value) {
258
-				if (is_array($parent_variable_value)) {
259
-					continue;
260
-				}
254
+        // Search in sub language
255
+        if ($search_in_sub_language) {
256
+            $variables = $sub_language_array[$lang_file];
257
+            foreach ($variables as $name_variable =>$variable_value) {
258
+                if (is_array($parent_variable_value)) {
259
+                    continue;
260
+                }
261 261
 
262
-				$founded = false;
263
-				// searching the item in the parent tool
264
-				if (preg_match($term,$variable_value)!==0) {
265
-					$founded = true;
266
-				}
267
-				if ($founded) {
268
-					//loading variable from the english array
269
-					$sub_language_name_variable = $sub_language_array[$lang_file][$name_variable];
270
-					$parent_variable_value = $parent_language_array[$lang_file][$name_variable];
271
-					//config buttons
272
-					$obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>';
273
-					$obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
262
+                $founded = false;
263
+                // searching the item in the parent tool
264
+                if (preg_match($term,$variable_value)!==0) {
265
+                    $founded = true;
266
+                }
267
+                if ($founded) {
268
+                    //loading variable from the english array
269
+                    $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable];
270
+                    $parent_variable_value = $parent_language_array[$lang_file][$name_variable];
271
+                    //config buttons
272
+                    $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>';
273
+                    $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'"  />'.get_lang('Save').'</button>';
274 274
 
275
-					//loading variable from the english array
276
-					$english_name_variable = $english_language_array[$lang_file][$name_variable];
277
-					$list_info[]=array($lang_file.'.inc.php',
278
-						$name_variable,
279
-						$english_name_variable,
280
-						$parent_variable_value,$obj_text,$obj_button);
281
-				}
282
-			}
283
-		}
284
-	}
275
+                    //loading variable from the english array
276
+                    $english_name_variable = $english_language_array[$lang_file][$name_variable];
277
+                    $list_info[]=array($lang_file.'.inc.php',
278
+                        $name_variable,
279
+                        $english_name_variable,
280
+                        $parent_variable_value,$obj_text,$obj_button);
281
+                }
282
+            }
283
+        }
284
+    }
285 285
 
286
-	$list_info = array_unique_dimensional($list_info);
287
-	return $list_info;
286
+    $list_info = array_unique_dimensional($list_info);
287
+    return $list_info;
288 288
 }
289 289
 
290 290
 // Allow see data in sort table
291 291
 $list_info = array();
292 292
 if (isset($_REQUEST['txt_search_word'])) {
293
-	//@todo fix to accept a char with 1 char
294
-	if (strlen(trim($_REQUEST['txt_search_word']))>2) {
295
-		$list_info = search_language_term(
296
-			$_REQUEST['txt_search_word'],
297
-			true,
298
-			true,
299
-			true,
300
-			true
301
-		);
302
-	}
293
+    //@todo fix to accept a char with 1 char
294
+    if (strlen(trim($_REQUEST['txt_search_word']))>2) {
295
+        $list_info = search_language_term(
296
+            $_REQUEST['txt_search_word'],
297
+            true,
298
+            true,
299
+            true,
300
+            true
301
+        );
302
+    }
303 303
 }
304 304
 
305 305
 $parameters = array(
306
-	'id' => intval($_GET['id']),
307
-	'sub_language_id' => intval($_GET['sub_language_id']),
308
-	'txt_search_word' => $txt_search_word
306
+    'id' => intval($_GET['id']),
307
+    'sub_language_id' => intval($_GET['sub_language_id']),
308
+    'txt_search_word' => $txt_search_word
309 309
 );
310 310
 $table = new SortableTableFromArrayConfig($list_info, 1,20,'data_info');
311 311
 $table->set_additional_parameters($parameters);
Please login to merge, or discard this patch.
main/admin/user_add.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -149,27 +149,27 @@  discard block
 block discarded – undo
149 149
 $form = new FormValidator('user_add');
150 150
 $form->addElement('header', '', $tool_name);
151 151
 if (api_is_western_name_order()) {
152
-	// Firstname
153
-	$form->addElement('text', 'firstname', get_lang('FirstName'));
154
-	$form->applyFilter('firstname', 'html_filter');
155
-	$form->applyFilter('firstname', 'trim');
156
-	$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
157
-	// Lastname
158
-	$form->addElement('text', 'lastname', get_lang('LastName'));
159
-	$form->applyFilter('lastname', 'html_filter');
160
-	$form->applyFilter('lastname', 'trim');
161
-	$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
152
+    // Firstname
153
+    $form->addElement('text', 'firstname', get_lang('FirstName'));
154
+    $form->applyFilter('firstname', 'html_filter');
155
+    $form->applyFilter('firstname', 'trim');
156
+    $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
157
+    // Lastname
158
+    $form->addElement('text', 'lastname', get_lang('LastName'));
159
+    $form->applyFilter('lastname', 'html_filter');
160
+    $form->applyFilter('lastname', 'trim');
161
+    $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
162 162
 } else {
163
-	// Lastname
164
-	$form->addElement('text', 'lastname', get_lang('LastName'));
165
-	$form->applyFilter('lastname', 'html_filter');
166
-	$form->applyFilter('lastname', 'trim');
167
-	$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
168
-	// Firstname
169
-	$form->addElement('text', 'firstname', get_lang('FirstName'));
170
-	$form->applyFilter('firstname', 'html_filter');
171
-	$form->applyFilter('firstname', 'trim');
172
-	$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
163
+    // Lastname
164
+    $form->addElement('text', 'lastname', get_lang('LastName'));
165
+    $form->applyFilter('lastname', 'html_filter');
166
+    $form->applyFilter('lastname', 'trim');
167
+    $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
168
+    // Firstname
169
+    $form->addElement('text', 'firstname', get_lang('FirstName'));
170
+    $form->applyFilter('firstname', 'html_filter');
171
+    $form->applyFilter('firstname', 'trim');
172
+    $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
173 173
 }
174 174
 // Official code
175 175
 $form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => '40'));
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 $auth_sources = 0; //make available wider as we need it in case of form reset (see below)
225 225
 $nb_ext_auth_source_added = 0;
226 226
 if (isset($extAuthSource) && count($extAuthSource) > 0) {
227
-	$auth_sources = array();
227
+    $auth_sources = array();
228 228
     foreach ($extAuthSource as $key => $info) {
229 229
         // @todo : make uniform external authentification configuration (ex : cas and external_login ldap)
230 230
         // Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
             $nb_ext_auth_source_added++;
236 236
         }
237 237
     }
238
-	if ($nb_ext_auth_source_added > 0) {
239
-    	$group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2);
240
-    	$group[] = $form->createElement('select', 'auth_source', null, $auth_sources);
241
-    	$group[] = $form->createElement('static', '', '', '<br />');
238
+    if ($nb_ext_auth_source_added > 0) {
239
+        $group[] = $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2);
240
+        $group[] = $form->createElement('select', 'auth_source', null, $auth_sources);
241
+        $group[] = $form->createElement('static', '', '', '<br />');
242 242
     }
243 243
 }
244 244
 
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
 $form->addElement('html', '<div id="drh_list" style="display:'.$display.';">');
308 308
 
309 309
 if (isset($drh_list) && is_array($drh_list)) {
310
-	foreach ($drh_list as $drh) {
310
+    foreach ($drh_list as $drh) {
311 311
         $drh_select->addOption(
312 312
             api_get_person_name($drh['firstname'], $drh['lastname']),
313 313
             $drh['user_id']
314 314
         );
315
-	}
315
+    }
316 316
 }
317 317
 $form->addElement('html', '</div>');
318 318
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 // Validate form
388 388
 if ($form->validate()) {
389
-	$check = Security::check_token('post');
389
+    $check = Security::check_token('post');
390 390
     if ($check) {
391 391
         $user = $form->exportValues();
392 392
         $lastname = $user['lastname'];
@@ -402,15 +402,15 @@  discard block
 block discarded – undo
402 402
         $send_mail = intval($user['mail']['send_mail']);
403 403
         $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : 0;
404 404
 
405
-		if (isset($extAuthSource) && count($extAuthSource) > 0 &&
405
+        if (isset($extAuthSource) && count($extAuthSource) > 0 &&
406 406
             $user['password']['password_auto'] == '2'
407 407
         ) {
408
-			$auth_source = $user['password']['auth_source'];
409
-			$password = 'PLACEHOLDER';
410
-		} else {
411
-			$auth_source = PLATFORM_AUTH_SOURCE;
412
-			$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
413
-		}
408
+            $auth_source = $user['password']['auth_source'];
409
+            $password = 'PLACEHOLDER';
410
+        } else {
411
+            $auth_source = PLATFORM_AUTH_SOURCE;
412
+            $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
413
+        }
414 414
 
415 415
         if ($user['radio_expiration_date'] == '1') {
416 416
             $expiration_date = $user['expiration_date'];
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
             $expiration_date = null;
419 419
         }
420 420
 
421
-		$active = intval($user['active']);
421
+        $active = intval($user['active']);
422 422
 
423 423
         if (api_get_setting('login_is_email') == 'true') {
424 424
             $username = $email;
@@ -449,21 +449,21 @@  discard block
 block discarded – undo
449 449
             $extra,
450 450
             null,
451 451
             $send_mail,
452
-			$platform_admin
452
+            $platform_admin
453 453
         );
454 454
 
455
-		Security::clear_token();
456
-		$tok = Security::get_token();
457
-		if ($user_id === false) {
458
-			//If any error ocurred during user creation, print it (api_failureList
459
-			// stores values as separate words, so rework it
460
-			$message = '';
461
-			$message_bits = explode(' ',api_get_last_failure());
462
-			foreach ($message_bits as $bit) {
463
-				$message .= ucfirst($bit);
464
-			}
465
-		} else {
466
- 			if (!empty($picture['name'])) {
455
+        Security::clear_token();
456
+        $tok = Security::get_token();
457
+        if ($user_id === false) {
458
+            //If any error ocurred during user creation, print it (api_failureList
459
+            // stores values as separate words, so rework it
460
+            $message = '';
461
+            $message_bits = explode(' ',api_get_last_failure());
462
+            foreach ($message_bits as $bit) {
463
+                $message .= ucfirst($bit);
464
+            }
465
+        } else {
466
+                if (!empty($picture['name'])) {
467 467
                 $picture_uri = UserManager::update_user_picture(
468 468
                     $user_id,
469 469
                     $_FILES['picture']['name'],
@@ -489,35 +489,35 @@  discard block
 block discarded – undo
489 489
                     null,
490 490
                     $language
491 491
                 );
492
-			}
492
+            }
493 493
 
494 494
             $extraFieldValues = new ExtraFieldValue('user');
495 495
             $user['item_id'] = $user_id;
496 496
             $extraFieldValues->saveFieldValues($user);
497 497
 
498
-			$message = get_lang('UserAdded');
499
-		}
500
-		if (isset($user['submit_plus'])) {
501
-			//we want to add more. Prepare report message and redirect to the same page (to clean the form)
502
-			header('Location: user_add.php?message='.urlencode($message).'&sec_token='.$tok);
503
-			exit ();
504
-		} else {
505
-			$tok = Security::get_token();
506
-			header('Location: user_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok);
507
-			exit ();
508
-		}
509
-	}
498
+            $message = get_lang('UserAdded');
499
+        }
500
+        if (isset($user['submit_plus'])) {
501
+            //we want to add more. Prepare report message and redirect to the same page (to clean the form)
502
+            header('Location: user_add.php?message='.urlencode($message).'&sec_token='.$tok);
503
+            exit ();
504
+        } else {
505
+            $tok = Security::get_token();
506
+            header('Location: user_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok);
507
+            exit ();
508
+        }
509
+    }
510 510
 } else {
511
-	if (isset($_POST['submit'])) {
512
-		Security::clear_token();
513
-	}
514
-	$token = Security::get_token();
515
-	$form->addElement('hidden', 'sec_token');
516
-	$form->setConstants(array('sec_token' => $token));
511
+    if (isset($_POST['submit'])) {
512
+        Security::clear_token();
513
+    }
514
+    $token = Security::get_token();
515
+    $form->addElement('hidden', 'sec_token');
516
+    $form->setConstants(array('sec_token' => $token));
517 517
 }
518 518
 
519 519
 if (!empty($message)){
520
-	$message = Display::return_message(stripslashes($message));
520
+    $message = Display::return_message(stripslashes($message));
521 521
 }
522 522
 $content = $form->returnForm();
523 523
 
Please login to merge, or discard this patch.
main/admin/add_sessions_to_usergroup.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     if (!empty($needle) && !empty($type)) {
127 127
         if ($type == 'single') {
128 128
             // search users where username or firstname or lastname begins likes $needle
129
-          /*  $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
129
+            /*  $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
130 130
                     WHERE (username LIKE "'.$needle.'%"
131 131
                     OR firstname LIKE "'.$needle.'%"
132 132
                 OR lastname LIKE "'.$needle.'%") AND user.user_id<>"'.$user_anonymous.'"   AND user.status<>'.DRH.''.
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
       <option value = "%">--</option>
232 232
       <?php
233 233
         echo Display :: get_alphabet_options();
234
-      ?>
234
+        ?>
235 235
      </select>
236 236
 <?php echo '<br />'; ?>
237 237
 </td>
@@ -242,31 +242,31 @@  discard block
 block discarded – undo
242 242
   <td align="center">
243 243
   <div id="content_source">
244 244
       <?php
245
-      if (!($add_type=='multiple')) {
245
+        if (!($add_type=='multiple')) {
246 246
         ?>
247 247
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
248 248
         <div id="ajax_list_users_single"></div>
249 249
         <?php
250
-      } else {
251
-      ?>
250
+        } else {
251
+        ?>
252 252
       <div id="ajax_list_multiple">
253 253
         <?php echo Display::select('elements_not_in_name',$elements_not_in, '',array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?>
254 254
       </div>
255 255
     <?php
256
-      }
257
-     ?>
256
+        }
257
+        ?>
258 258
   </div>
259 259
   </td>
260 260
   <td width="10%" valign="middle" align="center">
261 261
   <?php
262
-  if ($ajax_search) {
263
-  ?>
262
+    if ($ajax_search) {
263
+    ?>
264 264
     <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" >
265 265
         <em class="fa fa-arrow-left"></em>
266 266
     </button>
267 267
   <?php
268
-  } else {
269
-  ?>
268
+    } else {
269
+    ?>
270 270
     <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))">
271 271
         <em class="fa fa-arrow-right"></em>
272 272
     </button>
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
         <em class="fa fa-arrow-left"></em>
276 276
     </button>
277 277
     <?php
278
-  }
279
-  ?>
278
+    }
279
+    ?>
280 280
     <br /><br /><br /><br /><br /><br />
281 281
   </td>
282 282
   <td align="center">
Please login to merge, or discard this patch.
main/admin/sub_language_add.php 1 patch
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -62,43 +62,43 @@  discard block
 block discarded – undo
62 62
  *       inside the add_sub_language function.
63 63
  */
64 64
 function check_if_language_exist ($original_name, $english_name, $isocode, $sublanguage_available) {
65
-	$tbl_admin_languages 	= Database :: get_main_table(TABLE_MAIN_LANGUAGE);
66
-	$sql_original_name='SELECT count(*) AS count_original_name FROM '.$tbl_admin_languages.' WHERE original_name="'.Database::escape_string($original_name).'" ';
67
-	$sql_english_name='SELECT count(*) AS count_english_name FROM '.$tbl_admin_languages.' WHERE english_name="'.Database::escape_string($english_name).'" ';
68
-	//$sql_isocode='SELECT count(*) AS count_isocode FROM '.$tbl_admin_languages.' WHERE isocode="'.Database::escape_string($isocode).'" ';
69
-	$rs_original_name=Database::query($sql_original_name);
70
-	$rs_english_name=Database::query($sql_english_name);
71
-	//$rs_isocode=Database::query($sql_isocode);
72
-	$count_original_name=Database::result($rs_original_name,0,'count_original_name');
73
-	$count_english_name=Database::result($rs_english_name,0,'count_english_name');
74
-	//$count_isocode=Database::result($rs_isocode,0,'count_isocode');
75
-	$has_error=false;
76
-	$message_information=array();
65
+    $tbl_admin_languages 	= Database :: get_main_table(TABLE_MAIN_LANGUAGE);
66
+    $sql_original_name='SELECT count(*) AS count_original_name FROM '.$tbl_admin_languages.' WHERE original_name="'.Database::escape_string($original_name).'" ';
67
+    $sql_english_name='SELECT count(*) AS count_english_name FROM '.$tbl_admin_languages.' WHERE english_name="'.Database::escape_string($english_name).'" ';
68
+    //$sql_isocode='SELECT count(*) AS count_isocode FROM '.$tbl_admin_languages.' WHERE isocode="'.Database::escape_string($isocode).'" ';
69
+    $rs_original_name=Database::query($sql_original_name);
70
+    $rs_english_name=Database::query($sql_english_name);
71
+    //$rs_isocode=Database::query($sql_isocode);
72
+    $count_original_name=Database::result($rs_original_name,0,'count_original_name');
73
+    $count_english_name=Database::result($rs_english_name,0,'count_english_name');
74
+    //$count_isocode=Database::result($rs_isocode,0,'count_isocode');
75
+    $has_error=false;
76
+    $message_information=array();
77 77
 
78
-	if ($count_original_name==1) {
79
-		$has_error=true;
80
-		$message_information['original_name']=true;
81
-	}
82
-	if ($count_english_name==1) {
83
-		$has_error=true;
84
-		$message_information['english_name']=true;
85
-	}
78
+    if ($count_original_name==1) {
79
+        $has_error=true;
80
+        $message_information['original_name']=true;
81
+    }
82
+    if ($count_english_name==1) {
83
+        $has_error=true;
84
+        $message_information['english_name']=true;
85
+    }
86 86
 
87
-	$iso_list = api_get_platform_isocodes();
88
-	$iso_list = array_values($iso_list);
87
+    $iso_list = api_get_platform_isocodes();
88
+    $iso_list = array_values($iso_list);
89 89
 
90
-	if (!in_array($isocode, $iso_list)) {
91
-		$has_error=true;
92
-		$message_information['isocode']=true;
93
-	}
94
-	if ($has_error===true) {
95
-		$message_information['execute_add']=false;
96
-	}
97
-	if ($has_error===false) {
98
-		$message_information['execute_add']=true;
99
-	}
90
+    if (!in_array($isocode, $iso_list)) {
91
+        $has_error=true;
92
+        $message_information['isocode']=true;
93
+    }
94
+    if ($has_error===true) {
95
+        $message_information['execute_add']=false;
96
+    }
97
+    if ($has_error===false) {
98
+        $message_information['execute_add']=true;
99
+    }
100 100
 
101
-	return $message_information;
101
+    return $message_information;
102 102
 }
103 103
 
104 104
 /**
@@ -109,50 +109,50 @@  discard block
 block discarded – undo
109 109
  * @todo    deprecate this function and use the static method directly
110 110
  */
111 111
 function check_if_exist_language_by_id ($language_id) {
112
-	return SubLanguageManager::check_if_exist_language_by_id($language_id);
112
+    return SubLanguageManager::check_if_exist_language_by_id($language_id);
113 113
 }
114 114
 /**
115
- * Check if the given language is a parent of any sub-language
116
- * @param   int     Language ID of the presumed parent
117
- * @return  bool    True if this language has children, false otherwise
118
- */
115
+     * Check if the given language is a parent of any sub-language
116
+     * @param   int     Language ID of the presumed parent
117
+     * @return  bool    True if this language has children, false otherwise
118
+     */
119 119
 function ckeck_if_is_parent_of_sub_language ($parent_id) {
120
-	$sql='SELECT count(*) AS count FROM language WHERE parent_id= '.intval($parent_id).'';
121
-	$rs=Database::query($sql);
122
-	if (Database::num_rows($rs)>0 && Database::result($rs,0,'count')==1) {
123
-		return true;
124
-	} else {
125
-		return false;
126
-	}
120
+    $sql='SELECT count(*) AS count FROM language WHERE parent_id= '.intval($parent_id).'';
121
+    $rs=Database::query($sql);
122
+    if (Database::num_rows($rs)>0 && Database::result($rs,0,'count')==1) {
123
+        return true;
124
+    } else {
125
+        return false;
126
+    }
127 127
 }
128 128
 /**
129
- * Get all information of sub-language
130
- * @param   int     Parent language ID
131
- * @param   int     Child language ID
132
- * @return  array
133
- */
129
+     * Get all information of sub-language
130
+     * @param   int     Parent language ID
131
+     * @param   int     Child language ID
132
+     * @return  array
133
+     */
134 134
 function allow_get_all_information_of_sub_language ($parent_id,$sub_language_id) {
135
-	return SubLanguageManager::get_all_information_of_sub_language($parent_id,$sub_language_id);
135
+    return SubLanguageManager::get_all_information_of_sub_language($parent_id,$sub_language_id);
136 136
 }
137 137
 /*end declare functions*/
138 138
 
139 139
 //add data
140 140
 
141 141
 if (isset($_GET['sub_language_id']) && $_GET['sub_language_id']==strval(intval($_GET['sub_language_id']))) {
142
-	$language_name=SubLanguageManager::get_name_of_language_by_id($_GET['sub_language_id']);
143
-		if (check_if_exist_language_by_id ($_GET['sub_language_id'])===true) {
144
-			$sub_language_id=$_GET['sub_language_id'];
145
-			$sub_language_id_exist=true;
146
-		} else {
147
-			$sub_language_id_exist=false;
148
-		}
142
+    $language_name=SubLanguageManager::get_name_of_language_by_id($_GET['sub_language_id']);
143
+        if (check_if_exist_language_by_id ($_GET['sub_language_id'])===true) {
144
+            $sub_language_id=$_GET['sub_language_id'];
145
+            $sub_language_id_exist=true;
146
+        } else {
147
+            $sub_language_id_exist=false;
148
+        }
149 149
 
150 150
 }
151 151
 $language_details = array();
152 152
 $language_name='';
153 153
 if (isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) {
154 154
         $language_details = SubLanguageManager::get_all_information_of_language($_GET['id']);
155
-	$language_name = $language_details['original_name'];
155
+    $language_name = $language_details['original_name'];
156 156
         if (check_if_exist_language_by_id ($_GET['id'])===true) {
157 157
             $parent_id=$_GET['id'];
158 158
             $language_id_exist=true;
@@ -160,67 +160,67 @@  discard block
 block discarded – undo
160 160
             $language_id_exist=false;
161 161
         }
162 162
 } else {
163
-	$language_id_exist=false;
163
+    $language_id_exist=false;
164 164
 }
165 165
 
166 166
 //removed and register
167 167
 
168 168
 if ((isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) && (isset($_GET['sub_language_id']) && $_GET['sub_language_id']==strval(intval($_GET['sub_language_id'])))) {
169
-	if (check_if_exist_language_by_id($_GET['id'])===true && check_if_exist_language_by_id($_GET['sub_language_id'])===true) {
170
-	 	$get_all_information=allow_get_all_information_of_sub_language ($_GET['id'],$_GET['sub_language_id']);
171
-		$original_name=$get_all_information['original_name'];
172
-		$english_name=$get_all_information['english_name'];
173
-		$isocode=$get_all_information['isocode'];
169
+    if (check_if_exist_language_by_id($_GET['id'])===true && check_if_exist_language_by_id($_GET['sub_language_id'])===true) {
170
+            $get_all_information=allow_get_all_information_of_sub_language ($_GET['id'],$_GET['sub_language_id']);
171
+        $original_name=$get_all_information['original_name'];
172
+        $english_name=$get_all_information['english_name'];
173
+        $isocode=$get_all_information['isocode'];
174 174
 
175
-	}
175
+    }
176 176
 }
177 177
 
178 178
 $language_name=get_lang('CreateSubLanguageForLanguage').' ( '.strtolower($language_name).' )';
179 179
 
180 180
 if (ckeck_if_is_parent_of_sub_language($parent_id)===true && isset($_GET['action']) && $_GET['action']=='deletesublanguage') {
181
-	$language_name=get_lang('DeleteSubLanguage');
181
+    $language_name=get_lang('DeleteSubLanguage');
182 182
 }
183 183
 
184 184
 $msg = '';
185 185
 
186 186
 if (isset($_POST['SubmitAddNewLanguage'])) {
187
-	$original_name=$_POST['original_name'];
188
-	$english_name=$_POST['english_name'];
189
-	$isocode=$_POST['isocode'];
190
-	$english_name=str_replace(' ','_',$english_name);
191
-	$isocode=str_replace(' ','_',$isocode);
187
+    $original_name=$_POST['original_name'];
188
+    $english_name=$_POST['english_name'];
189
+    $isocode=$_POST['isocode'];
190
+    $english_name=str_replace(' ','_',$english_name);
191
+    $isocode=str_replace(' ','_',$isocode);
192 192
 
193
-	$sublanguage_available=$_POST['sub_language_is_visible'];
194
-	$check_information=array();
195
-	$check_information=check_if_language_exist($original_name,$english_name,$isocode,$sublanguage_available);
196
-	foreach ($check_information as $index_information => $value_information) {
197
-		$allow_insert_info=false;
198
-		if ($index_information=='original_name') {
199
-			$msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('OriginalName').'" '.'('.$original_name.')','error');
200
-		}
201
-		if ($index_information=='english_name') {
202
-			$msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('EnglishName').'" '.'('.$english_name.')','error');
203
-		}
204
-		if ($index_information=='isocode') {
205
-			$msg .= Display::return_message(get_lang('CodeDoesNotExists').': '.$isocode.'','error');
206
-		}
207
-		if ($index_information=='execute_add' && $value_information===true) {
208
-			$allow_insert_info=true;
209
-		}
210
-	}
193
+    $sublanguage_available=$_POST['sub_language_is_visible'];
194
+    $check_information=array();
195
+    $check_information=check_if_language_exist($original_name,$english_name,$isocode,$sublanguage_available);
196
+    foreach ($check_information as $index_information => $value_information) {
197
+        $allow_insert_info=false;
198
+        if ($index_information=='original_name') {
199
+            $msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('OriginalName').'" '.'('.$original_name.')','error');
200
+        }
201
+        if ($index_information=='english_name') {
202
+            $msg .= Display::return_message(get_lang('AlreadyExists').' "'.get_lang('EnglishName').'" '.'('.$english_name.')','error');
203
+        }
204
+        if ($index_information=='isocode') {
205
+            $msg .= Display::return_message(get_lang('CodeDoesNotExists').': '.$isocode.'','error');
206
+        }
207
+        if ($index_information=='execute_add' && $value_information===true) {
208
+            $allow_insert_info=true;
209
+        }
210
+    }
211 211
 
212
-	if (strlen($original_name)>0 && strlen($english_name)>0 && strlen($isocode)>0) {
213
-		if ($allow_insert_info===true && $language_id_exist===true) {
214
-			$english_name=str_replace(' ','_',$english_name);
212
+    if (strlen($original_name)>0 && strlen($english_name)>0 && strlen($isocode)>0) {
213
+        if ($allow_insert_info===true && $language_id_exist===true) {
214
+            $english_name=str_replace(' ','_',$english_name);
215 215
                         //Fixes BT#1636
216 216
                         $english_name=api_strtolower($english_name);
217 217
 
218
-			$isocode=str_replace(' ','_',$isocode);
219
-			$str_info='<br/>'.get_lang('OriginalName').' : '.$original_name.'<br/>'.get_lang('EnglishName').' : '.$english_name.'<br/>'.get_lang('PlatformCharsetTitle').' : '.$isocode;
218
+            $isocode=str_replace(' ','_',$isocode);
219
+            $str_info='<br/>'.get_lang('OriginalName').' : '.$original_name.'<br/>'.get_lang('EnglishName').' : '.$english_name.'<br/>'.get_lang('PlatformCharsetTitle').' : '.$isocode;
220 220
 
221
-			$mkdir_result=SubLanguageManager::add_language_directory($english_name);
222
-			if ($mkdir_result) {
223
-			  	$sl_id = add_sub_language($original_name,$english_name,$isocode,$sublanguage_available,$parent_id);
221
+            $mkdir_result=SubLanguageManager::add_language_directory($english_name);
222
+            if ($mkdir_result) {
223
+                    $sl_id = add_sub_language($original_name,$english_name,$isocode,$sublanguage_available,$parent_id);
224 224
                                 if ($sl_id === false) {
225 225
                                     SubLanguageManager::remove_language_directory($english_name);
226 226
                                     $msg .= Display::return_message(get_lang('LanguageDirectoryNotWriteableContactAdmin'),'error');
@@ -232,17 +232,17 @@  discard block
 block discarded – undo
232 232
                                     require 'sub_language.php';
233 233
                                     exit();
234 234
                                 }
235
-			} else {
236
-			    $msg .= Display::return_message(get_lang('LanguageDirectoryNotWriteableContactAdmin'),'error');
237
-			}
238
-		} else {
239
-			if ($language_id_exist===false) {
240
-				$msg .= Display::return_message(get_lang('LanguageParentNotExist'),'error');
241
-			}
242
-		}
243
-	} else {
235
+            } else {
236
+                $msg .= Display::return_message(get_lang('LanguageDirectoryNotWriteableContactAdmin'),'error');
237
+            }
238
+        } else {
239
+            if ($language_id_exist===false) {
240
+                $msg .= Display::return_message(get_lang('LanguageParentNotExist'),'error');
241
+            }
242
+        }
243
+    } else {
244 244
             $msg .= Display::return_message(get_lang('FormHasErrorsPleaseComplete'),'error');
245
-	}
245
+    }
246 246
 }
247 247
 
248 248
 Display :: display_header($language_name);
@@ -250,51 +250,51 @@  discard block
 block discarded – undo
250 250
 echo $msg;
251 251
 
252 252
 if (isset($_POST['SubmitAddDeleteLanguage'])) {
253
-	$rs = SubLanguageManager::remove_sub_language($_GET['id'], $_GET['sub_language_id']);
254
-	if ($rs===true) {
255
-		Display::display_confirmation_message(get_lang('TheSubLanguageHasBeenRemoved'));
256
-	} else {
257
-		Display::display_error_message(get_lang('TheSubLanguageHasNotBeenRemoved'));
258
-	}
253
+    $rs = SubLanguageManager::remove_sub_language($_GET['id'], $_GET['sub_language_id']);
254
+    if ($rs===true) {
255
+        Display::display_confirmation_message(get_lang('TheSubLanguageHasBeenRemoved'));
256
+    } else {
257
+        Display::display_error_message(get_lang('TheSubLanguageHasNotBeenRemoved'));
258
+    }
259 259
 }
260 260
 // ckeck_if_is_parent_of_sub_language($parent_id)===false
261 261
 //
262 262
 if (isset($_GET['action']) && $_GET['action']=='definenewsublanguage') {
263
-	$text = $language_name;
264
-	$form = new FormValidator('addsublanguage', 'post', 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&action=definenewsublanguage');
265
-	$class='add';
266
-	$form->addElement('header', '', $text);
267
-	$form->addElement('text', 'original_name', get_lang('OriginalName'),'class="input_titles"');
268
-	$form->addRule('original_name', get_lang('ThisFieldIsRequired'), 'required');
269
-	$form->addElement('text', 'english_name', get_lang('EnglishName'),'class="input_titles"');
270
-	$form->addRule('english_name', get_lang('ThisFieldIsRequired'), 'required');
271
-	$form->addElement('text', 'isocode', get_lang('ISOCode'), 'class="input_titles"');
272
-	$form->addRule('isocode', get_lang('ThisFieldIsRequired'), 'required');
273
-	$form->addElement('static', null, '&nbsp;', '<i>en, es, fr</i>');
274
-	$form->addElement('checkbox', 'sub_language_is_visible', '', get_lang('Visibility'));
275
-	$form->addButtonCreate(get_lang('CreateSubLanguage'), 'SubmitAddNewLanguage');
263
+    $text = $language_name;
264
+    $form = new FormValidator('addsublanguage', 'post', 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&action=definenewsublanguage');
265
+    $class='add';
266
+    $form->addElement('header', '', $text);
267
+    $form->addElement('text', 'original_name', get_lang('OriginalName'),'class="input_titles"');
268
+    $form->addRule('original_name', get_lang('ThisFieldIsRequired'), 'required');
269
+    $form->addElement('text', 'english_name', get_lang('EnglishName'),'class="input_titles"');
270
+    $form->addRule('english_name', get_lang('ThisFieldIsRequired'), 'required');
271
+    $form->addElement('text', 'isocode', get_lang('ISOCode'), 'class="input_titles"');
272
+    $form->addRule('isocode', get_lang('ThisFieldIsRequired'), 'required');
273
+    $form->addElement('static', null, '&nbsp;', '<i>en, es, fr</i>');
274
+    $form->addElement('checkbox', 'sub_language_is_visible', '', get_lang('Visibility'));
275
+    $form->addButtonCreate(get_lang('CreateSubLanguage'), 'SubmitAddNewLanguage');
276 276
         //$values['original_name'] = $language_details['original_name'].'...'; -> cannot be used because of quickform filtering (freeze)
277 277
         $values['english_name'] = $language_details['english_name'].'2';
278 278
         $values['isocode'] = $language_details['isocode'];
279 279
         $form->setDefaults($values);
280
-	$form->display();
280
+    $form->display();
281 281
 } else {
282
-	if (isset($_GET['action']) && $_GET['action']=='deletesublanguage') {
283
-		$text=$language_name;
284
-		$form = new FormValidator('deletesublanguage', 'post', 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&sub_language_id='.Security::remove_XSS($_GET['sub_language_id']));
285
-		$class='minus';
286
-		$form->addElement('header', '', $text);
287
-		$form->addElement('static', '', get_lang('OriginalName'),$original_name);
288
-		$form->addElement('static', '', get_lang('EnglishName'),$english_name);
289
-		$form->addElement('static', '', get_lang('PlatformCharsetTitle'),$isocode);
290
-		$form->addButtonCreate(get_lang('DeleteSubLanguage'), 'SubmitAddDeleteLanguage');
291
-		$form->display();
292
-	}
293
-	if (isset($_GET['action']) && $_GET['action']=='definenewsublanguage') {
294
-		Display::display_normal_message(get_lang('TheSubLanguageForThisLanguageHasBeenAdded'));
295
-	}
282
+    if (isset($_GET['action']) && $_GET['action']=='deletesublanguage') {
283
+        $text=$language_name;
284
+        $form = new FormValidator('deletesublanguage', 'post', 'sub_language_add.php?id='.Security::remove_XSS($_GET['id']).'&sub_language_id='.Security::remove_XSS($_GET['sub_language_id']));
285
+        $class='minus';
286
+        $form->addElement('header', '', $text);
287
+        $form->addElement('static', '', get_lang('OriginalName'),$original_name);
288
+        $form->addElement('static', '', get_lang('EnglishName'),$english_name);
289
+        $form->addElement('static', '', get_lang('PlatformCharsetTitle'),$isocode);
290
+        $form->addButtonCreate(get_lang('DeleteSubLanguage'), 'SubmitAddDeleteLanguage');
291
+        $form->display();
292
+    }
293
+    if (isset($_GET['action']) && $_GET['action']=='definenewsublanguage') {
294
+        Display::display_normal_message(get_lang('TheSubLanguageForThisLanguageHasBeenAdded'));
295
+    }
296 296
 }
297 297
 /**
298
- * Footer
299
- */
298
+     * Footer
299
+     */
300 300
 Display :: display_footer();
Please login to merge, or discard this patch.
main/admin/course_create_content.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * This script allows a platform admin to add dummy content to a course.
5
- *
6
- * @author Bart Mollet <[email protected]>
7
- * @package chamilo.admin
8
- */
4
+     * This script allows a platform admin to add dummy content to a course.
5
+     *
6
+     * @author Bart Mollet <[email protected]>
7
+     * @package chamilo.admin
8
+     */
9 9
 include ('../inc/global.inc.php');
10 10
 $this_section=SECTION_PLATFORM_ADMIN;
11 11
 
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 Display::display_header($tool_name);
16 16
 //api_display_tool_title($tool_name);
17 17
 if (api_get_setting('server_type') != 'test') {
18
-	echo get_lang('DummyCourseOnlyOnTestServer');
18
+    echo get_lang('DummyCourseOnlyOnTestServer');
19 19
 } elseif( isset($_POST['action'])) {
20
-	require_once('../coursecopy/classes/DummyCourseCreator.class.php');
21
-	$dcc = new DummyCourseCreator();
22
-	$dcc->create_dummy_course($_POST['course_code']);
23
-	echo get_lang('Done');
20
+    require_once('../coursecopy/classes/DummyCourseCreator.class.php');
21
+    $dcc = new DummyCourseCreator();
22
+    $dcc->create_dummy_course($_POST['course_code']);
23
+    echo get_lang('Done');
24 24
 } else {
25
-	echo get_lang('DummyCourseDescription');
26
-	echo '<form method="post"><input type="hidden" name="course_code" value="'.Security::remove_XSS($_GET['course_code']).'"/><input type="submit" name="action" value="'.get_lang('Ok').'"/></form>';
25
+    echo get_lang('DummyCourseDescription');
26
+    echo '<form method="post"><input type="hidden" name="course_code" value="'.Security::remove_XSS($_GET['course_code']).'"/><input type="submit" name="action" value="'.get_lang('Ok').'"/></form>';
27 27
 }
28 28
 
29 29
 Display::display_footer();
Please login to merge, or discard this patch.