Browse Source

Merge pull request #2293 from chamilo/flintci-641

Applied fixes from FlintCI
Julio Montoya 7 years ago
parent
commit
0bbbe191a4
100 changed files with 1631 additions and 1542 deletions
  1. 1 1
      certificates/index.php
  2. 5 4
      custompages/first_login-dist.php
  3. 6 4
      custompages/index-unlogged-dist.php
  4. 1 1
      custompages/language.inc.php
  5. 6 7
      custompages/language.php
  6. 2 2
      custompages/registration-dist.php
  7. 21 13
      main/admin/access_url_add_courses_to_url.php
  8. 20 12
      main/admin/access_url_add_usergroup_to_url.php
  9. 14 10
      main/admin/access_url_add_users_to_url.php
  10. 4 4
      main/admin/access_url_check_user_session.php
  11. 5 5
      main/admin/access_url_edit.php
  12. 37 24
      main/admin/access_url_edit_course_category_to_url.php
  13. 12 12
      main/admin/access_url_edit_courses_to_url.php
  14. 33 20
      main/admin/access_url_edit_usergroup_to_url.php
  15. 25 19
      main/admin/access_url_edit_users_to_url.php
  16. 11 11
      main/admin/access_urls.php
  17. 30 26
      main/admin/add_courses_to_usergroup.php
  18. 25 20
      main/admin/add_sessions_to_promotion.php
  19. 29 23
      main/admin/add_sessions_to_usergroup.php
  20. 49 43
      main/admin/add_users_to_usergroup.php
  21. 2 2
      main/admin/archive_cleanup.php
  22. 21 21
      main/admin/career_dashboard.php
  23. 11 11
      main/admin/career_diagram.php
  24. 19 19
      main/admin/careers.php
  25. 1 1
      main/admin/cli.php
  26. 137 137
      main/admin/configure_extensions.php
  27. 36 37
      main/admin/configure_homepage.php
  28. 25 25
      main/admin/configure_inscription.php
  29. 9 9
      main/admin/configure_plugin.php
  30. 15 15
      main/admin/course_add.php
  31. 5 6
      main/admin/course_category.php
  32. 17 17
      main/admin/course_edit.php
  33. 3 3
      main/admin/course_export.php
  34. 9 9
      main/admin/course_import.php
  35. 11 11
      main/admin/course_information.php
  36. 6 6
      main/admin/course_intro_pdf_import.php
  37. 26 26
      main/admin/course_list.php
  38. 7 7
      main/admin/course_request_accepted.php
  39. 7 7
      main/admin/course_request_edit.php
  40. 11 11
      main/admin/course_request_rejected.php
  41. 9 9
      main/admin/course_request_review.php
  42. 11 12
      main/admin/course_user_import.php
  43. 9 9
      main/admin/course_user_import_by_email.php
  44. 14 11
      main/admin/dashboard_add_courses_to_user.php
  45. 19 11
      main/admin/dashboard_add_sessions_to_user.php
  46. 35 30
      main/admin/dashboard_add_users_to_user.php
  47. 12 12
      main/admin/event_controller.php
  48. 13 13
      main/admin/event_type.php
  49. 2 2
      main/admin/export_certificates.php
  50. 2 2
      main/admin/extra_field_list.php
  51. 32 32
      main/admin/extra_field_options.php
  52. 37 38
      main/admin/extra_field_workflow.php
  53. 4 4
      main/admin/extra_fields.php
  54. 2 2
      main/admin/filler.php
  55. 19 19
      main/admin/grade_models.php
  56. 3 3
      main/admin/gradebook_dependency.php
  57. 3 3
      main/admin/gradebook_list.php
  58. 128 128
      main/admin/index.php
  59. 11 12
      main/admin/languages.php
  60. 33 29
      main/admin/ldap_form_add_users_group.php
  61. 3 3
      main/admin/ldap_import_students.php
  62. 3 4
      main/admin/ldap_import_students_to_session.php
  63. 8 10
      main/admin/ldap_users_list.php
  64. 7 7
      main/admin/ldap_users_synchro.php
  65. 10 13
      main/admin/legal_add.php
  66. 3 3
      main/admin/legal_list.php
  67. 28 28
      main/admin/promotions.php
  68. 1 2
      main/admin/resource_sequence.php
  69. 68 70
      main/admin/settings.lib.php
  70. 38 38
      main/admin/settings.php
  71. 2 2
      main/admin/skill.php
  72. 4 4
      main/admin/skill_badge.php
  73. 7 7
      main/admin/skill_badge_create.php
  74. 6 6
      main/admin/skill_badge_list.php
  75. 2 2
      main/admin/skill_create.php
  76. 2 2
      main/admin/skill_edit.php
  77. 2 2
      main/admin/skill_level.php
  78. 1 2
      main/admin/skill_list.php
  79. 3 3
      main/admin/skill_profile.php
  80. 15 15
      main/admin/skills_gradebook.php
  81. 13 13
      main/admin/skills_import.php
  82. 12 12
      main/admin/skills_profile.php
  83. 4 4
      main/admin/special_exports.php
  84. 4 4
      main/admin/specific_fields.php
  85. 8 8
      main/admin/specific_fields_add.php
  86. 1 1
      main/admin/statistics.php
  87. 5 5
      main/admin/statistics/index.php
  88. 0 1
      main/admin/sub_language.class.php
  89. 12 12
      main/admin/sub_language.php
  90. 5 7
      main/admin/sub_language_add.php
  91. 1 2
      main/admin/sub_language_ajax.inc.php
  92. 31 24
      main/admin/subscribe_user2course.php
  93. 18 19
      main/admin/system_announcements.php
  94. 1 1
      main/admin/system_status.php
  95. 44 44
      main/admin/teacher_time_report.php
  96. 29 29
      main/admin/user_add.php
  97. 16 16
      main/admin/user_edit.php
  98. 8 8
      main/admin/user_export.php
  99. 30 23
      main/admin/user_import.php
  100. 64 64
      main/admin/user_information.php

+ 1 - 1
certificates/index.php

@@ -20,7 +20,7 @@ switch ($action) {
             api_not_allowed(true);
         }
 
-        $certificate->generate(array('hide_print_button' => true));
+        $certificate->generate(['hide_print_button' => true]);
 
         if ($certificate->isHtmlFileGenerated()) {
             $certificatePathList[] = $certificate->html_file;

+ 5 - 4
custompages/first_login-dist.php

@@ -11,8 +11,9 @@ require_once __DIR__.'/language.php';
 /**
  * Security checks
  */
-if (!isset($_SESSION['conditional_login']['uid']))
-  die("Not Authorised");
+if (!isset($_SESSION['conditional_login']['uid'])) {
+    die("Not Authorised");
+}
 
 if (isset($_POST['password'])) {
     $u = api_get_user_info($_SESSION['conditional_login']['uid']);
@@ -95,8 +96,8 @@ $www = api_get_path('WEB_PATH');
         <div id="changepassword-form-box" class="form-box">
       <div class="info"> <?php echo custompages_get_lang('FirstLoginChangePassword'); ?> </div>
         <?php if (isset($error_message)) {
-            echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>';
-        }?>
+    echo '<div id="changepassword-form-error" class="form-error">'.$error_message.'</div>';
+}?>
             <form id="changepassword-form" class="form" method="post">
                 <div>
           <label for="password">*<?php echo custompages_get_lang('Password'); ?></label>

+ 6 - 4
custompages/index-unlogged-dist.php

@@ -71,8 +71,8 @@ $rootWeb = api_get_path('WEB_PATH');
 		<div id="login-form-box" class="form-box">
             <div id="login-form-info" class="form-info">
             <?php if (isset($content['info']) && !empty($content['info'])) {
-                echo $content['info'];
-            }
+    echo $content['info'];
+}
             ?>
             </div>
             <?php if (isset($error_message)) {
@@ -92,11 +92,13 @@ $rootWeb = api_get_path('WEB_PATH');
             </div> <!-- #form-submit -->
 			<div id="links">
 
-                <?php if (api_get_setting('allow_registration') === 'true') { ?>
+                <?php if (api_get_setting('allow_registration') === 'true') {
+                ?>
                 <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/inscription.php?language=<?php echo api_get_interface_language(); ?>">
                     <?php echo custompages_get_lang('Registration')?>
                 </a><br />
-                <?php } ?>
+                <?php
+            } ?>
 
                 <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/lostPassword.php?language=<?php echo api_get_interface_language(); ?>">
                     <?php echo custompages_get_lang('LostPassword')?>

+ 1 - 1
custompages/language.inc.php

@@ -16,7 +16,7 @@
 function get_preferred_language($available_langs)
 {
     // Parsing the Accept-languages HTTP header
-    $langs = array();
+    $langs = [];
     foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $httplang) {
         $rawlang = explode(';q=', $httplang);
         if (strpos($rawlang[0], '-') !== false) {

+ 6 - 7
custompages/language.php

@@ -9,9 +9,9 @@
 require_once __DIR__.'/language.inc.php';
 
 // Define the languages you want to make available for auto-detection here
-$available_langs = array('en', 'fr', 'es', 'gl', 'eu');
+$available_langs = ['en', 'fr', 'es', 'gl', 'eu'];
 // Define the translation of these language codes to Chamilo languages
-$chamilo_langs = array(
+$chamilo_langs = [
     null => 'english',
     'en' => 'english',
     'fr' => 'french',
@@ -20,20 +20,20 @@ $chamilo_langs = array(
     'es' => 'spanish',
     'gl' => 'galician',
     'eu' => 'basque'
-);
+];
 $lang_match = $chamilo_langs[get_preferred_language($available_langs)];
 // recover previous value ...
 if (isset($_SESSION['user_language_choice'])) {
-	$lang_match = $_SESSION['user_language_choice'];
+    $lang_match = $_SESSION['user_language_choice'];
 }
 
 // Chamilo parameter, on logout
 if (isset($_REQUEST['language']) && !empty($_REQUEST['language']) && in_array($_REQUEST['language'], $chamilo_langs)) {
-	$lang_match = $_REQUEST['language'];
+    $lang_match = $_REQUEST['language'];
 }
 // Incoming link parameter
 if (isset($_REQUEST['lang']) && !empty($_REQUEST['lang']) && in_array($_REQUEST['lang'], $available_langs)) {
-	$lang_match = $chamilo_langs[$_REQUEST['lang']];
+    $lang_match = $chamilo_langs[$_REQUEST['lang']];
 }
 
 $detect = api_get_setting('auto_detect_language_custom_pages');
@@ -47,4 +47,3 @@ if ($detect === 'true') {
     $_user['language'] = $defaultLanguage;
     $_SESSION['user_language_choice'] = $defaultLanguage;
 }
-

+ 2 - 2
custompages/registration-dist.php

@@ -97,8 +97,8 @@ EOT;
                         <img src="/custompages/images/header.png">
                     </div>
                     <?php if (isset($content['error']) && !empty($content['error'])) {
-                        echo '<div id="registration-form-error" class="alert alert-danger">'.$content['error'].'</div>';
-                    }?>
+    echo '<div id="registration-form-error" class="alert alert-danger">'.$content['error'].'</div>';
+}?>
                     <div id="registration-form-box" class="form-box">
                         <div class="block-form-login">
                             <?php

+ 21 - 13
main/admin/access_url_add_courses_to_url.php

@@ -21,9 +21,9 @@ if (!api_get_multiple_access_url()) {
 
 $form_sent = 0;
 $first_letter_course = '';
-$courses = array();
-$url_list = array();
-$users = array();
+$courses = [];
+$url_list = [];
+$users = [];
 
 $tbl_access_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
 $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
@@ -32,8 +32,8 @@ $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
 
 /*	Header   */
 $tool_name = get_lang('AddCoursesToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 Display :: display_header($tool_name);
 
@@ -48,8 +48,8 @@ api_display_tool_title($tool_name);
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
-    $courses = is_array($_POST['course_list']) ? $_POST['course_list'] : array();
-    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
+    $courses = is_array($_POST['course_list']) ? $_POST['course_list'] : [];
+    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : [];
     $first_letter_course = $_POST['first_letter_course'];
 
     foreach ($users as $key => $value) {
@@ -118,11 +118,15 @@ unset($result);
    <tr>
     <td width="40%" align="center">
      <select name="course_list[]" multiple="multiple" size="20" style="width:400px;">
-		<?php foreach ($db_courses as $course) { ?>
-			<option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>>
+		<?php foreach ($db_courses as $course) {
+        ?>
+			<option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) {
+            echo 'selected="selected"';
+        } ?>>
                 <?php echo $course['title'].' ('.$course['code'].')'; ?>
             </option>
-        <?php } ?>
+        <?php
+    } ?>
     </select>
    </td>
    <td width="20%" valign="middle" align="center">
@@ -130,11 +134,15 @@ unset($result);
    </td>
    <td width="40%" align="center">
     <select name="url_list[]" multiple="multiple" size="20" style="width:300px;">
-    <?php foreach ($db_urls as $url_obj) { ?>
-    <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>>
+    <?php foreach ($db_urls as $url_obj) {
+        ?>
+    <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) {
+            echo 'selected="selected"';
+        } ?>>
         <?php echo $url_obj['url']; ?>
     </option>
-    <?php } ?>
+    <?php
+    } ?>
     </select>
    </td>
   </tr>

+ 20 - 12
main/admin/access_url_add_usergroup_to_url.php

@@ -20,8 +20,8 @@ if (!api_get_multiple_access_url()) {
 $userGroup = new UserGroup();
 $form_sent = 0;
 $firstLetterUserGroup = null;
-$courses = array();
-$url_list = array();
+$courses = [];
+$url_list = [];
 
 $tbl_access_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
 $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
@@ -29,8 +29,8 @@ $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
 $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
 
 $tool_name = get_lang('AddUserGroupToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 Display::display_header($tool_name);
 
@@ -45,8 +45,8 @@ api_display_tool_title($tool_name);
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
-    $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array();
-    $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
+    $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : [];
+    $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : [];
     $firstLetterUserGroup = $_POST['first_letter_user_group'];
 
     if ($form_sent == 1) {
@@ -97,10 +97,14 @@ $db_urls = Database::store_result($result);
    <tr>
         <td width="40%" align="center">
         <select name="user_group_list[]" multiple="multiple" size="20" style="width:400px;">
-		<?php foreach ($dbUserGroups as $item) { ?>
-			<option value="<?php echo $item['id']; ?>" <?php if (in_array($item['id'], $courses)) echo 'selected="selected"'; ?>><?php echo $item['name']; ?>
+		<?php foreach ($dbUserGroups as $item) {
+                    ?>
+			<option value="<?php echo $item['id']; ?>" <?php if (in_array($item['id'], $courses)) {
+                        echo 'selected="selected"';
+                    } ?>><?php echo $item['name']; ?>
             </option>
-        <?php } ?>
+        <?php
+                } ?>
     </select>
    </td>
    <td width="20%" valign="middle" align="center">
@@ -108,10 +112,14 @@ $db_urls = Database::store_result($result);
    </td>
    <td width="40%" align="center">
     <select name="url_list[]" multiple="multiple" size="20" style="width:300px;">
-        <?php foreach ($db_urls as $url_obj) { ?>
-        <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>><?php echo $url_obj['url']; ?>
+        <?php foreach ($db_urls as $url_obj) {
+                    ?>
+        <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) {
+                        echo 'selected="selected"';
+                    } ?>><?php echo $url_obj['url']; ?>
         </option>
-		<?php } ?>
+		<?php
+                } ?>
     </select>
    </td>
   </tr>

+ 14 - 10
main/admin/access_url_add_users_to_url.php

@@ -20,9 +20,9 @@ if (!api_get_multiple_access_url()) {
 $form_sent = 0;
 $first_letter_user = '';
 $first_letter_course = '';
-$courses = array();
-$url_list = array();
-$users = array();
+$courses = [];
+$url_list = [];
+$users = [];
 
 $tbl_access_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
 $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
@@ -30,8 +30,8 @@ $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
 
 /*	Header	*/
 $tool_name = get_lang('AddUsersToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 Display :: display_header($tool_name);
 
@@ -46,8 +46,8 @@ api_display_tool_title($tool_name);
 
 if ($_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
-    $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array();
-    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
+    $users = is_array($_POST['user_list']) ? $_POST['user_list'] : [];
+    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : [];
     $first_letter_user = $_POST['first_letter_user'];
     foreach ($users as $key => $value) {
         $users[$key] = intval($value);
@@ -120,8 +120,10 @@ unset($result);
      <select name="user_list[]" multiple="multiple" size="20" style="width:380px;">
         <?php
         foreach ($db_users as $user) {
-        ?>
-            <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
+            ?>
+            <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) {
+                echo 'selected="selected"';
+            } ?>>
             <?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?>
             </option>
         <?php
@@ -137,7 +139,9 @@ unset($result);
 		<?php
         foreach ($db_urls as $url_obj) {
             ?>
-			<option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>>
+			<option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) {
+                echo 'selected="selected"';
+            } ?>>
                 <?php echo $url_obj['url']; ?>
 			</option>
 			<?php

+ 4 - 4
main/admin/access_url_check_user_session.php

@@ -14,8 +14,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 $tool_name = get_lang('SessionOverview');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'session_list.php', 'name' => get_lang('SessionList')];
 
 // Database Table Definitions
 $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -92,8 +92,8 @@ foreach ($session_list as $session_item) {
             $link_to_add_user_in_url = '';
             if ($multiple_url_is_on) {
                 if ($user['access_url_id'] != $url_id) {
-                    $user_link .= ' '.Display::return_icon('warning.png', get_lang('UserNotAddedInURL'), array(), ICON_SIZE_MEDIUM);
-                    $add = Display::return_icon('add.png', get_lang('AddUsersToURL'), array(), ICON_SIZE_MEDIUM);
+                    $user_link .= ' '.Display::return_icon('warning.png', get_lang('UserNotAddedInURL'), [], ICON_SIZE_MEDIUM);
+                    $add = Display::return_icon('add.png', get_lang('AddUsersToURL'), [], ICON_SIZE_MEDIUM);
                     $link_to_add_user_in_url = '<a href="'.api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']).'&action=add_user_to_url&id_session='.$id_session.'&user_id='.$user['user_id'].'">'.$add.'</a>';
                 }
             }

+ 5 - 5
main/admin/access_url_edit.php

@@ -40,7 +40,7 @@ if ($form->validate()) {
             }
             // URL Images
             $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
-            $image_fields = array("url_image_1", "url_image_2", "url_image_3");
+            $image_fields = ["url_image_1", "url_image_2", "url_image_3"];
             foreach ($image_fields as $image_field) {
                 if ($_FILES[$image_field]['error'] == 0) {
                     // Hardcoded: only PNG files allowed
@@ -81,7 +81,7 @@ if ($form->validate()) {
             $url .= (substr($url, strlen($url) - 1, strlen($url)) == '/') ? '' : '/';
             $url_id = UrlManager::get_url_id($url);
             $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
-            $image_fields = array("url_image_1", "url_image_2", "url_image_3");
+            $image_fields = ["url_image_1", "url_image_2", "url_image_3"];
             foreach ($image_fields as $image_field) {
                 if ($_FILES[$image_field]['error'] == 0) {
                     // Hardcoded: only PNG files allowed
@@ -106,7 +106,7 @@ if ($form->validate()) {
     }
     $token = Security::get_token();
     $form->addElement('hidden', 'sec_token');
-    $form->setConstants(array('sec_token' => $token));
+    $form->setConstants(['sec_token' => $token]);
 }
 
 $form->addElement('text', 'url', 'URL');
@@ -142,8 +142,8 @@ if (!api_is_multiple_url_enabled()) {
 }
 
 $tool_name = get_lang('AddUrl');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array("url" => 'access_urls.php', "name" => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ["url" => 'access_urls.php', "name" => get_lang('MultipleAccessURLs')];
 
 Display :: display_header($tool_name);
 

+ 37 - 24
main/admin/access_url_edit_course_category_to_url.php

@@ -12,7 +12,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 
 $xajax = new xajax();
 $xajax->registerFunction(
-    array('searchCourseCategoryAjax', 'UrlManager', 'searchCourseCategoryAjax')
+    ['searchCourseCategoryAjax', 'UrlManager', 'searchCourseCategoryAjax']
 );
 
 // Setting the section (for the tabs)
@@ -27,8 +27,8 @@ if (!api_get_multiple_access_url()) {
 
 // Setting breadcrumbs
 $tool_name = get_lang('EditUserGroupToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 $add_type = 'multiple';
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
@@ -72,15 +72,15 @@ function remove_item(origin) {
 </script>';
 
 $form_sent = 0;
-$UserList = $SessionList = array();
-$users = $sessions = array();
+$UserList = $SessionList = [];
+$users = $sessions = [];
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $list = $_POST['course_list'];
 
     if (!is_array($list)) {
-        $list = array();
+        $list = [];
     }
 
     if ($form_sent == 1) {
@@ -99,7 +99,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 Display::display_header($tool_name);
 api_display_tool_title($tool_name);
 
-$noUserGroupList = $userGroupList = array();
+$noUserGroupList = $userGroupList = [];
 $ajax_search = $add_type == 'unique' ? true : false;
 
 if ($ajax_search) {
@@ -119,12 +119,12 @@ if ($ajax_search) {
 }
 
 if ($add_type == 'multiple') {
-	$link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
+    $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
         get_lang('SessionAddTypeUnique').'</a>';
-	$link_add_type_multiple = get_lang('SessionAddTypeMultiple');
+    $link_add_type_multiple = get_lang('SessionAddTypeMultiple');
 } else {
-	$link_add_type_unique = get_lang('SessionAddTypeUnique');
-	$link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
+    $link_add_type_unique = get_lang('SessionAddTypeUnique');
+    $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
         get_lang('SessionAddTypeMultiple').'</a>';
 }
 
@@ -138,7 +138,9 @@ $url_list = UrlManager::get_url_data();
     name="formulaire"
     method="post"
     action="<?php echo api_get_self(); ?>"
-    style="margin:0px;" <?php if ($ajax_search) { echo ' onsubmit="valide();"'; } ?>
+    style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+} ?>
 >
 <?php echo get_lang('SelectUrl').' : '; ?>
 <select name="access_url_id" onchange="javascript:send();">
@@ -153,7 +155,8 @@ $url_list = UrlManager::get_url_data();
                 $url_selected = $url_obj[1];
             }
         }
-        if ($url_obj['active'] == 1) { ?>
+        if ($url_obj['active'] == 1) {
+            ?>
             <option <?php echo $checked; ?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?>
             </option>
         <?php
@@ -176,24 +179,33 @@ $url_list = UrlManager::get_url_data();
 <tr>
   <td align="center">
   <div id="content_source">
-    <?php if ($ajax_search) { ?>
+    <?php if ($ajax_search) {
+    ?>
 		<input type="text" id="course_to_add" onkeyup="xajax_searchCourseCategoryAjax(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
 		<div id="ajax_list_courses"></div>
-    <?php } else { ?>
+    <?php
+} else {
+        ?>
 	  <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;">
-		<?php foreach ($noUserGroupList as $noItem) { ?>
+		<?php foreach ($noUserGroupList as $noItem) {
+            ?>
 			<option value="<?php echo $noItem['id']; ?>">
                 <?php echo $noItem['name']; ?>
             </option>
-		<?php } ?>
+		<?php
+        } ?>
 	  </select>
-    <?php } ?>
+    <?php
+    } ?>
   </div>
   </td>
   <td width="10%" valign="middle" align="center">
-  <?php if ($ajax_search) { ?>
+  <?php if ($ajax_search) {
+        ?>
 	<button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" ></button>
-  <?php } else { ?>
+  <?php
+    } else {
+        ?>
 	<button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" >
         <em class="fa fa-arrow-right"></em>
     </button>
@@ -201,19 +213,20 @@ $url_list = UrlManager::get_url_data();
 	<button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" >
         <em class="fa fa-arrow-left"></em>
     </button>
-   <?php } ?>
+   <?php
+    } ?>
 	<br /><br /><br /><br /><br /><br />
   </td>
   <td align="center">
   <select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;">
 <?php
 foreach ($userGroupList as $item) {
-?>
+        ?>
 	<option value="<?php echo $item['id']; ?>">
         <?php echo $item['name']; ?>
     </option>
 <?php
-}
+    }
 ?>
   </select>
   </td>
@@ -227,7 +240,7 @@ foreach ($userGroupList as $item) {
         } else {
             echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
         }
-		?>
+        ?>
 	</td>
 </tr>
 </table>

+ 12 - 12
main/admin/access_url_edit_courses_to_url.php

@@ -12,7 +12,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 
 $xajax = new xajax();
 $xajax->registerFunction(
-    array('search_courses', 'Accessurleditcoursestourl', 'search_courses')
+    ['search_courses', 'Accessurleditcoursestourl', 'search_courses']
 );
 
 // setting the section (for the tabs)
@@ -32,8 +32,8 @@ $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
 
 // setting breadcrumbs
 $tool_name = get_lang('EditCoursesToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 $add_type = 'multiple';
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
@@ -76,15 +76,15 @@ function remove_item(origin) {
 </script>';
 
 $form_sent = 0;
-$UserList = $SessionList = array();
-$users = $sessions = array();
+$UserList = $SessionList = [];
+$users = $sessions = [];
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $course_list = $_POST['course_list'];
 
     if (!is_array($course_list)) {
-        $course_list = array();
+        $course_list = [];
     }
 
     if ($form_sent == 1) {
@@ -111,7 +111,7 @@ echo '</div>';
 
 api_display_tool_title($tool_name);
 
-$no_course_list = $course_list = array();
+$no_course_list = $course_list = [];
 $ajax_search = $add_type == 'unique' ? true : false;
 
 if ($ajax_search) {
@@ -157,7 +157,9 @@ $url_list = UrlManager::get_url_data();
     <?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
 </div>
 <br /><br />
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?> >
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?> >
     <?php echo get_lang('SelectUrl').' : '; ?>
     <select name="access_url_id" onchange="javascript:send();">
         <option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option>
@@ -208,8 +210,7 @@ $url_list = UrlManager::get_url_data();
                                 <option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option>
                             <?php
                             }
-                            unset($no_course_list);
-                            ?>
+                        unset($no_course_list); ?>
                         </select>
                     <?php
                     }
@@ -242,8 +243,7 @@ $url_list = UrlManager::get_url_data();
                 <select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;">
                     <?php
                     foreach ($course_list as $course) {
-                        $courseInfo = api_get_course_info_by_id($course['id']);
-                        ?>
+                        $courseInfo = api_get_course_info_by_id($course['id']); ?>
                         <option value="<?php echo $course['id']; ?>">
                             <?php echo $course['title'].' ('.$courseInfo['code'].')'; ?>
                         </option>

+ 33 - 20
main/admin/access_url_edit_usergroup_to_url.php

@@ -10,7 +10,7 @@ $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
 $xajax = new xajax();
-$xajax->registerFunction(array('searchUserGroupAjax', 'UserGroup', 'searchUserGroupAjax'));
+$xajax->registerFunction(['searchUserGroupAjax', 'UserGroup', 'searchUserGroupAjax']);
 $userGroup = new UserGroup();
 
 // Setting the section (for the tabs)
@@ -25,8 +25,8 @@ if (!api_get_multiple_access_url()) {
 
 // setting breadcrumbs
 $tool_name = get_lang('EditUserGroupToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 $add_type = 'multiple';
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
@@ -71,15 +71,15 @@ function remove_item(origin) {
 
 $form_sent = 0;
 $errorMsg = '';
-$UserList = $SessionList = array();
-$users = $sessions = array();
+$UserList = $SessionList = [];
+$users = $sessions = [];
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $course_list = $_POST['course_list'];
 
     if (!is_array($course_list)) {
-        $course_list = array();
+        $course_list = [];
     }
 
     if ($form_sent == 1) {
@@ -106,7 +106,7 @@ echo '</div>';
 
 api_display_tool_title($tool_name);
 
-$noUserGroupList = $userGroupList = array();
+$noUserGroupList = $userGroupList = [];
 $ajax_search = $add_type == 'unique' ? true : false;
 
 if ($ajax_search) {
@@ -167,8 +167,8 @@ $url_list = UrlManager::get_url_data();
         method="post"
         action="<?php echo api_get_self(); ?>"
         style="margin:0px;" <?php if ($ajax_search) {
-        echo ' onsubmit="valide();"';
-    } ?>
+    echo ' onsubmit="valide();"';
+} ?>
     >
         <div class="row">
             <div class="col-xs-2">
@@ -187,7 +187,8 @@ $url_list = UrlManager::get_url_data();
                                 $url_selected = $url_obj[1];
                             }
                         }
-                        if ($url_obj['active'] == 1) { ?>
+                        if ($url_obj['active'] == 1) {
+                            ?>
                             <option <?php echo $checked; ?>
                                 value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?>
                             </option>
@@ -209,27 +210,36 @@ $url_list = UrlManager::get_url_data();
             <div class="col-sm-5">
                 <label for="<?php echo $ajax_search ? 'course_to_add' : 'origin_users' ?>"><?php echo get_lang('UserGroupListInPlatform') ?></label>
                 <div id="content_source">
-                    <?php if ($ajax_search) { ?>
+                    <?php if ($ajax_search) {
+            ?>
                         <input type="text" id="course_to_add" class="form-control"
                                onkeyup="xajax_searchUserGroupAjax(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)"/>
                         <div id="ajax_list_courses"></div>
-                    <?php } else { ?>
+                    <?php
+        } else {
+            ?>
                         <select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" class="form-control">
-                            <?php foreach ($noUserGroupList as $noItem) { ?>
+                            <?php foreach ($noUserGroupList as $noItem) {
+                ?>
                                 <option value="<?php echo $noItem['id']; ?>"><?php echo $noItem['name']; ?></option>
-                            <?php } ?>
+                            <?php
+            } ?>
                         </select>
-                    <?php } ?>
+                    <?php
+        } ?>
                 </div>
             </div>
             <div class="col-sm-2 text-center">
                 <br><br><br><br>
-                <?php if ($ajax_search) { ?>
+                <?php if ($ajax_search) {
+            ?>
                     <button class="btn btn-default" type="button"
                             onclick="remove_item(document.getElementById('destination_users'))">
                         <em class="fa fa-arrow-left"></em>
                     </button>
-                <?php } else { ?>
+                <?php
+        } else {
+            ?>
                     <button class="btn btn-default" type="button"
                             onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))">
                         <em class="fa fa-arrow-right"></em>
@@ -239,16 +249,19 @@ $url_list = UrlManager::get_url_data();
                             onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))">
                         <em class="fa fa-arrow-left"></em>
                     </button>
-                <?php } ?>
+                <?php
+        } ?>
             </div>
             <div class="col-sm-5">
                 <label for="destination_users"><?php printf(get_lang('UserGroupListInX'), $url_selected); ?></label>
                 <select id="destination_users" name="course_list[]" multiple="multiple" size="15" class="form-control">
-                    <?php foreach ($userGroupList as $item) { ?>
+                    <?php foreach ($userGroupList as $item) {
+            ?>
                         <option value="<?php echo $item['id']; ?>">
                             <?php echo $item['name']; ?>
                         </option>
-                    <?php } ?>
+                    <?php
+        } ?>
                 </select>
             </div>
         </div>

+ 25 - 19
main/admin/access_url_edit_users_to_url.php

@@ -9,7 +9,7 @@ $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
 $xajax = new xajax();
-$xajax->registerFunction(array('search_users', 'AccessUrlEditUsersToUrl', 'search_users'));
+$xajax->registerFunction(['search_users', 'AccessUrlEditUsersToUrl', 'search_users']);
 
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -29,8 +29,8 @@ $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
 
 // setting breadcrumbs
 $tool_name = get_lang('EditUsersToURL');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')];
 
 $add_type = 'multiple';
 if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
@@ -74,7 +74,7 @@ function remove_item(origin) {
 
 $form_sent = 0;
 $errorMsg = '';
-$UserList = array();
+$UserList = [];
 $message = '';
 
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
@@ -82,7 +82,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $UserList = $_POST['sessionUsersList'];
 
     if (!is_array($UserList)) {
-        $UserList = array();
+        $UserList = [];
     }
     if ($form_sent == 1) {
         if ($access_url_id == 0) {
@@ -99,7 +99,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
             if (!empty($result['users_added'])) {
                 $message .= '<h4>'.get_lang('UsersAdded').':</h4>';
                 $i = 1;
-                $user_added_list = array();
+                $user_added_list = [];
                 foreach ($result['users_added'] as $user) {
                     $user_info = api_get_user_info($user);
                     if (!empty($user_info)) {
@@ -114,7 +114,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 
             if (!empty($result['users_deleted'])) {
                 $message .= '<br /><h4>'.get_lang('UsersDeleted').': </h4>';
-                $user_deleted_list = array();
+                $user_deleted_list = [];
                 $i = 1;
                 foreach ($result['users_deleted'] as $user) {
                     $user_info = api_get_user_info($user);
@@ -146,7 +146,7 @@ echo '</div>';
 
 api_display_tool_title($tool_name);
 
-$nosessionUsersList = $sessionUsersList = array();
+$nosessionUsersList = $sessionUsersList = [];
 $ajax_search = $add_type == 'unique' ? true : false;
 
 if ($ajax_search) {
@@ -221,8 +221,8 @@ $url_list = UrlManager::get_url_data();
 
 <?php
 if (!empty($errorMsg)) {
-    echo Display::return_message($errorMsg, 'normal'); //main API
-}
+            echo Display::return_message($errorMsg, 'normal'); //main API
+        }
 ?>
 
 <table border="0" cellpadding="5" cellspacing="0" width="100%">
@@ -245,19 +245,21 @@ if (!empty($errorMsg)) {
 <tr>
   <td align="center">
   <div id="content_source">
-    <?php if ($ajax_search) { ?>
+    <?php if ($ajax_search) {
+        ?>
     <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
     <div id="ajax_list_users"></div>
-    <?php } else { ?>
+    <?php
+    } else {
+        ?>
     <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:380px;">
     <?php
         foreach ($nosessionUsersList as $enreg) {
-    ?>
+            ?>
     <option value="<?php echo $enreg['user_id']; ?>"><?php echo $enreg['username'].' - '.api_get_person_name($enreg['firstname'], $enreg['lastname']); ?></option>
     <?php
-     }
-    unset($nosessionUsersList);
-    ?>
+        }
+        unset($nosessionUsersList); ?>
     </select>
         <?php
     }
@@ -265,11 +267,14 @@ if (!empty($errorMsg)) {
   </div>
   </td>
   <td width="10%" valign="middle" align="center">
-    <?php if ($ajax_search) { ?>
+    <?php if ($ajax_search) {
+        ?>
         <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))">
             <em class="fa fa-arrow-left"></em>
         </button>
-    <?php } else { ?>
+    <?php
+    } else {
+        ?>
         <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" >
             <em class="fa fa-arrow-right"></em>
         </button>
@@ -278,7 +283,8 @@ if (!empty($errorMsg)) {
             <em class="fa fa-arrow-left"></em>
 
         </button>
-    <?php } ?>
+    <?php
+    } ?>
 	<br /><br /><br /><br /><br /><br />
   </td>
   <td align="center">

+ 11 - 11
main/admin/access_urls.php

@@ -19,7 +19,7 @@ if (!api_get_multiple_access_url()) {
     exit;
 }
 
-$interbreadcrumb[] = array("url" => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', 'name' => get_lang('PlatformAdmin')];
 $tool_name = get_lang('MultipleAccessURLs');
 Display :: display_header($tool_name);
 
@@ -111,38 +111,38 @@ if ($current_access_url_id == -1) {
 // action menu
 echo '<div class="actions">';
 echo Display::url(
-    Display::return_icon('new_link.png', get_lang('AddUrl'), array(), ICON_SIZE_MEDIUM),
+    Display::return_icon('new_link.png', get_lang('AddUrl'), [], ICON_SIZE_MEDIUM),
     api_get_path(WEB_CODE_PATH).'admin/access_url_edit.php'
 );
 echo Display::url(
-    Display::return_icon('user.png', get_lang('ManageUsers'), array(), ICON_SIZE_MEDIUM),
+    Display::return_icon('user.png', get_lang('ManageUsers'), [], ICON_SIZE_MEDIUM),
     api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php'
 );
 echo Display::url(
-    Display::return_icon('course.png', get_lang('ManageCourses'), array(), ICON_SIZE_MEDIUM),
+    Display::return_icon('course.png', get_lang('ManageCourses'), [], ICON_SIZE_MEDIUM),
     api_get_path(WEB_CODE_PATH).'admin/access_url_edit_courses_to_url.php'
 );
 
 $userGroup = new UserGroup();
 if ($userGroup->getUseMultipleUrl()) {
     echo Display::url(
-        Display::return_icon('class.png', get_lang('ManageUserGroup'), array(), ICON_SIZE_MEDIUM),
+        Display::return_icon('class.png', get_lang('ManageUserGroup'), [], ICON_SIZE_MEDIUM),
         api_get_path(WEB_CODE_PATH).'admin/access_url_edit_usergroup_to_url.php'
     );
 }
 
 echo Display::url(
-    Display::return_icon('folder.png', get_lang('ManageCourseCategories'), array(), ICON_SIZE_MEDIUM),
+    Display::return_icon('folder.png', get_lang('ManageCourseCategories'), [], ICON_SIZE_MEDIUM),
     api_get_path(WEB_CODE_PATH).'admin/access_url_edit_course_category_to_url.php'
 );
 
 echo '</div>';
 
 $sortable_data = UrlManager::get_url_data();
-$urls = array();
+$urls = [];
 foreach ($sortable_data as $row) {
     //title
-    $url = Display::url($row['url'], $row['url'], array('target'=>'_blank'));
+    $url = Display::url($row['url'], $row['url'], ['target'=>'_blank']);
     $description = $row['description'];
 
     //Status
@@ -164,12 +164,12 @@ foreach ($sortable_data as $row) {
     }
     // Actions
     $url_id = $row['id'];
-    $actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "access_url_edit.php?url_id=$url_id");
+    $actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL), "access_url_edit.php?url_id=$url_id");
     if ($url_id != '1') {
         $actions .= '<a href="access_urls.php?action=delete_url&amp;url_id='.$url_id.'" 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>';
+            Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL).'</a>';
     }
-    $urls[] = array($url, $description, $status, $actions);
+    $urls[] = [$url, $description, $status, $actions];
 }
 
 $table = new SortableTableFromArrayConfig($urls, 2, 50, 'urls');

+ 30 - 26
main/admin/add_courses_to_usergroup.php

@@ -20,8 +20,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // Setting breadcrumbs.
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'usergroups.php', 'name' => get_lang('Classes')];
 
 // Setting the name of the tool.
 $tool_name = get_lang('SubscribeClassToCourses');
@@ -47,7 +47,7 @@ function remove_item(origin) {
 
 $form_sent = 0;
 $errorMsg = '';
-$sessions = array();
+$sessions = [];
 $usergroup = new UserGroup();
 $id = intval($_GET['id']);
 
@@ -55,7 +55,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $elements_posted = $_POST['elements_in_name'];
     if (!is_array($elements_posted)) {
-        $elements_posted = array();
+        $elements_posted = [];
     }
     if ($form_sent == 1) {
         $usergroup->subscribe_courses_to_usergroup($id, $elements_posted);
@@ -66,10 +66,10 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 }
 
 // Filters
-$filters = array(
-    array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')),
-    array('type' => 'text', 'name' => 'title', 'label' => get_lang('Title'))
-);
+$filters = [
+    ['type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')],
+    ['type' => 'text', 'name' => 'title', 'label' => get_lang('Title')]
+];
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
 $searchForm->addHeader(get_lang('AdvancedSearch'));
@@ -80,12 +80,12 @@ foreach ($filters as $param) {
 }
 $searchForm->addButtonSearch();
 
-$filterData = array();
+$filterData = [];
 if ($searchForm->validate()) {
     $filterData = $searchForm->getSubmitValues();
 }
 
-$conditions = array();
+$conditions = [];
 if (!empty($filters) && !empty($filterData)) {
     foreach ($filters as $filter) {
         if (isset($filter['name']) && isset($filterData[$filter['name']])) {
@@ -111,7 +111,7 @@ $course_list = CourseManager::get_courses_list(
     $conditions
 );
 
-$elements_not_in = $elements_in = array();
+$elements_not_in = $elements_in = [];
 
 foreach ($course_list_in as $course) {
     $elements_in[$course['id']] = $course['title']." (".$course['visual_code'].")";
@@ -175,15 +175,19 @@ if ($add_type == 'multiple') {
 
 echo '<div class="actions">';
 echo '<a href="usergroups.php">';
-echo Display::return_icon('back.png', get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>';
-echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_options', 'id' => 'advanced_search'));
+echo Display::return_icon('back.png', get_lang('Back'), [], ICON_SIZE_MEDIUM).'</a>';
+echo Display::url(get_lang('AdvancedSearch'), '#', ['class' => 'advanced_options', 'id' => 'advanced_search']);
 echo '</div>';
 
 echo '<div id="advanced_search_options" style="display:none">';
 $searchForm->display();
 echo '</div>';
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) {
+    echo '&add=true';
+} ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
 <?php echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
 echo Display::input('hidden', 'id', $id);
 echo Display::input('hidden', 'form_sent', '1');
@@ -201,41 +205,41 @@ if (!empty($errorMsg)) {
   <td align="center"><b><?php echo get_lang('CoursesInGroup') ?> :</b></td>
 </tr>
 
-<?php if ($add_type == 'multiple') { ?>
+<?php if ($add_type == 'multiple') {
+    ?>
 <tr>
 <td align="center">
 <?php echo get_lang('FirstLetterCourseTitle'); ?> :
     <select name="firstLetterUser" onchange = "xajax_search(this.value,'multiple')" >
     <option value = "%">--</option>
     <?php
-    echo Display :: get_alphabet_options();
-    ?>
+    echo Display :: get_alphabet_options(); ?>
     </select>
 </td>
 <td align="center">&nbsp;</td>
 </tr>
-<?php } ?>
+<?php
+} ?>
 <tr>
   <td align="center">
   <div id="content_source">
       <?php
       if (!($add_type == 'multiple')) {
-        ?>
+          ?>
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
         <div id="ajax_list_users_single"></div>
         <?php
       } else {
-      ?>
+          ?>
       <div id="ajax_list_multiple">
         <?php
         echo Display::select(
             'elements_not_in_name',
             $elements_not_in,
             '',
-            array('style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_not_in', 'size' => '15px'),
+            ['style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_not_in', 'size' => '15px'],
             false
-        );
-        ?>
+        ); ?>
       </div>
     <?php
       }
@@ -245,13 +249,13 @@ if (!empty($errorMsg)) {
   <td width="10%" valign="middle" align="center">
   <?php
   if ($ajax_search) {
-  ?>
+      ?>
     <button class="btn bt-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" >
         <em class="fa fa-arrow-left"></em>
     </button>
   <?php
   } else {
-  ?>
+      ?>
     <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'))">
         <em class="fa fa-arrow-right"></em>
     </button>
@@ -270,7 +274,7 @@ echo Display::select(
     'elements_in_name[]',
     $elements_in,
     '',
-    array('style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_in', 'size' => '15px'),
+    ['style' => 'width:360px', 'multiple' => 'multiple', 'id' => 'elements_in', 'size' => '15px'],
     false
 );
 unset($sessionUsersList);

+ 25 - 20
main/admin/add_sessions_to_promotion.php

@@ -19,8 +19,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions')];
 
 // Setting the name of the tool
 $tool_name = get_lang('SubscribeSessionsToPromotions');
@@ -67,14 +67,14 @@ function validate_filter() {
 
 $form_sent = 0;
 $errorMsg = '';
-$users = $sessions = array();
+$users = $sessions = [];
 $promotion = new Promotion();
 $id = intval($_GET['id']);
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
     $session_in_promotion_posted = $_POST['session_in_promotion_name'];
     if (!is_array($session_in_promotion_posted)) {
-        $session_in_promotion_posted = array($session_in_promotion_posted);
+        $session_in_promotion_posted = [$session_in_promotion_posted];
     }
     if ($form_sent == 1) {
         // Added a parameter to send emails when registering a user
@@ -85,8 +85,8 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 }
 
 $promotion_data = $promotion->get($id);
-$session_list = SessionManager::get_sessions_list(array(), array('name'));
-$session_not_in_promotion = $session_in_promotion = array();
+$session_list = SessionManager::get_sessions_list([], ['name']);
+$session_not_in_promotion = $session_in_promotion = [];
 
 if (!empty($session_list)) {
     foreach ($session_list as $session) {
@@ -123,14 +123,18 @@ echo '<a href="promotions.php">'.Display::return_icon('back.png', get_lang('Back
 echo '</div>';
 ?>
 
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) {
+    echo '&add=true';
+} ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
 <?php echo '<legend>'.$tool_name.' '.$promotion_data['name'].'</legend>';
 
 
 if ($add_type == 'multiple') {
     $extraField = new \ExtraField('session');
     $extra_field_list = $extraField->get_all_extra_field_by_type(ExtraField::FIELD_TYPE_SELECT);
-    $new_field_list = array();
+    $new_field_list = [];
     if (is_array($extra_field_list) && (count($extra_field_list) > 0)) {
         echo '<h3>'.get_lang('FilterSessions').'</h3>';
         foreach ($extra_field_list as $new_field) {
@@ -170,33 +174,34 @@ if (!empty($errorMsg)) {
   <td align="center"><b><?php echo get_lang('SessionsInPromotion') ?> :</b></td>
 </tr>
 
-<?php if ($add_type == 'multiple') { ?>
+<?php if ($add_type == 'multiple') {
+    ?>
 <tr>
 <td align="center">
 <?php echo get_lang('FirstLetterSessions'); ?> :
      <select name="firstLetterUser" onchange = "xajax_search_sessions(this.value,'multiple')" >
       <option value = "%">--</option>
       <?php
-        echo Display :: get_alphabet_options();
-      ?>
+        echo Display :: get_alphabet_options(); ?>
      </select>
 </td>
 <td align="center">&nbsp;</td>
 </tr>
-<?php } ?>
+<?php
+} ?>
 <tr>
   <td align="center">
   <div id="content_source">
       <?php
       if (!($add_type == 'multiple')) {
-        ?>
+          ?>
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
         <div id="ajax_list_users_single"></div>
         <?php
       } else {
-      ?>
+          ?>
       <div id="ajax_list_multiple">
-        <?php echo Display::select('session_not_in_promotion_name', $session_not_in_promotion, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'session_not_in_promotion', 'size'=>'15px'), false); ?>
+        <?php echo Display::select('session_not_in_promotion_name', $session_not_in_promotion, '', ['style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'session_not_in_promotion', 'size'=>'15px'], false); ?>
       </div>
     <?php
       }
@@ -206,13 +211,13 @@ if (!empty($errorMsg)) {
   <td width="10%" valign="middle" align="center">
   <?php
   if ($ajax_search) {
-  ?>
+      ?>
     <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('session_in_promotion'))" >
         <em class="fa fa-arrow-left"></em>
     </button>
   <?php
   } else {
-  ?>
+      ?>
     <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))">
         <em class="fa fa-arrow-right"></em>
     </button>
@@ -231,7 +236,7 @@ if (!empty($errorMsg)) {
         'session_in_promotion_name[]',
         $session_in_promotion,
         '',
-        array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'session_in_promotion', 'size'=>'15px'),
+        ['style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'session_in_promotion', 'size'=>'15px'],
         false
     );
     unset($sessionUsersList);
@@ -332,7 +337,7 @@ function search_sessions($needle, $type)
     $return = '';
     if (!empty($needle) && !empty($type)) {
         $session_list = SessionManager::get_sessions_list(
-            array('s.name' => array('operator' => 'LIKE', 'value' => "$needle%"))
+            ['s.name' => ['operator' => 'LIKE', 'value' => "$needle%"]]
         );
         $return .= '<select id="session_not_in_promotion" name="session_not_in_promotion_name[]" multiple="multiple" size="15" style="width:360px;">';
         foreach ($session_list as $row) {
@@ -345,4 +350,4 @@ function search_sessions($needle, $type)
     }
 
     return $xajax_response;
-}
+}

+ 29 - 23
main/admin/add_sessions_to_usergroup.php

@@ -21,8 +21,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'usergroups.php', 'name' => get_lang('Classes')];
 
 // Database Table Definitions
 
@@ -65,10 +65,10 @@ function remove_item(origin) {
 function display_advanced_search () {
         if ($("#advancedSearch").css("display") == "none") {
                 $("#advancedSearch").css("display","block");
-                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
+                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), ['style'=>'vertical-align:middle']).'&nbsp;'.get_lang('AdvancedSearch').'\');
         } else {
                 $("#advancedSearch").css("display","none");
-                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
+                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), ['style'=>'vertical-align:middle']).'&nbsp;'.get_lang('AdvancedSearch').'\');
         }
 }
 
@@ -82,14 +82,14 @@ function validate_filter() {
 
 $form_sent  = 0;
 $errorMsg   = '';
-$sessions = array();
+$sessions = [];
 $usergroup = new UserGroup();
 $id = intval($_GET['id']);
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent          = $_POST['form_sent'];
     $elements_posted    = $_POST['elements_in_name'];
     if (!is_array($elements_posted)) {
-        $elements_posted = array();
+        $elements_posted = [];
     }
     if ($form_sent == 1) {
         //added a parameter to send emails when registering a user
@@ -100,8 +100,8 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 }
 $data = $usergroup->get($id);
 $session_list_in = $usergroup->get_sessions_by_usergroup($id);
-$session_list = SessionManager::get_sessions_list(array(), array('name'));
-$elements_not_in = $elements_in = array();
+$session_list = SessionManager::get_sessions_list([], ['name']);
+$elements_not_in = $elements_in = [];
 
 if (!empty($session_list)) {
     foreach ($session_list as $session) {
@@ -117,18 +117,19 @@ $ajax_search = $add_type == 'unique' ? true : false;
 
 //checking for extra field with filter on
 
-function search_usergroup_sessions($needle, $type) {
+function search_usergroup_sessions($needle, $type)
+{
     global $elements_in;
     $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
         if ($type == 'searchbox') {
             $session_list = SessionManager::get_sessions_list(
-                array('s.name' => array('operator' => 'LIKE', 'value' => "%$needle%"))
+                ['s.name' => ['operator' => 'LIKE', 'value' => "%$needle%"]]
             );
         } elseif ($type != 'single') {
             $session_list = SessionManager::get_sessions_list(
-                array('s.name' => array('operator' => 'LIKE', 'value' => "$needle%"))
+                ['s.name' => ['operator' => 'LIKE', 'value' => "$needle%"]]
             );
         }
         if ($type != 'single') {
@@ -167,12 +168,16 @@ if ($add_type == 'multiple') {
 echo '<div class="actions">';
 echo '<a href="usergroups.php">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '<a href="javascript://" class="advanced_parameters" style="margin-top: 8px" onclick="display_advanced_search();"><span id="img_plus_and_minus">&nbsp;'.
-    Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'</span></a>';
+    Display::return_icon('div_show.gif', get_lang('Show'), ['style'=>'vertical-align:middle']).' '.get_lang('AdvancedSearch').'</span></a>';
 echo '</div>';
 echo '<div id="advancedSearch" style="display: none">'.get_lang('SearchSessions'); ?> :
      <input name="SearchSession" onchange = "xajax_search_usergroup_sessions(this.value,'searchbox')" onkeyup="this.onchange()">
      </div>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) {
+    echo '&add=true';
+} ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
 <?php
 echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
 echo Display::input('hidden', 'id', $id);
@@ -191,34 +196,35 @@ if (!empty($errorMsg)) {
   <td align="center"><b><?php echo get_lang('SessionsInGroup') ?> :</b></td>
 </tr>
 
-<?php if ($add_type == 'multiple') { ?>
+<?php if ($add_type == 'multiple') {
+    ?>
 <tr>
 <td align="center">
 <?php echo get_lang('FirstLetterSessions'); ?> :
      <select name="firstLetterUser" onchange = "xajax_search_usergroup_sessions(this.value,'multiple')" >
       <option value = "%">--</option>
       <?php
-        echo Display :: get_alphabet_options();
-      ?>
+        echo Display :: get_alphabet_options(); ?>
      </select>
 <?php echo '<br />'; ?>
 </td>
 <td align="center">&nbsp;</td>
 </tr>
-<?php } ?>
+<?php
+} ?>
 <tr>
   <td align="center">
   <div id="content_source">
       <?php
       if (!($add_type == 'multiple')) {
-        ?>
+          ?>
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
         <div id="ajax_list_users_single"></div>
         <?php
       } else {
-      ?>
+          ?>
       <div id="ajax_list_multiple">
-        <?php echo Display::select('elements_not_in_name', $elements_not_in, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_not_in', 'size'=>'15px'), false); ?>
+        <?php echo Display::select('elements_not_in_name', $elements_not_in, '', ['style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_not_in', 'size'=>'15px'], false); ?>
       </div>
     <?php
       }
@@ -228,13 +234,13 @@ if (!empty($errorMsg)) {
   <td width="10%" valign="middle" align="center">
   <?php
   if ($ajax_search) {
-  ?>
+      ?>
     <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" >
         <em class="fa fa-arrow-left"></em>
     </button>
   <?php
   } else {
-  ?>
+      ?>
     <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'))">
         <em class="fa fa-arrow-right"></em>
     </button>
@@ -249,7 +255,7 @@ if (!empty($errorMsg)) {
   </td>
   <td align="center">
 <?php
-    echo Display::select('elements_in_name[]', $elements_in, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_in', 'size'=>'15px'), false);
+    echo Display::select('elements_in_name[]', $elements_in, '', ['style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_in', 'size'=>'15px'], false);
     unset($sessionUsersList);
 ?>
  </td>

+ 49 - 43
main/admin/add_users_to_usergroup.php

@@ -18,8 +18,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'usergroups.php', 'name' => get_lang('Classes')];
 
 // Database Table Definitions
 
@@ -90,15 +90,15 @@ function change_select(val) {
 $form_sent = 0;
 
 $extra_field_list = UserManager::get_extra_fields();
-$new_field_list = array();
+$new_field_list = [];
 if (is_array($extra_field_list)) {
     foreach ($extra_field_list as $extra_field) {
         //if is enabled to filter and is a "<select>" field type
         if ($extra_field[8] == 1 && $extra_field[2] == 4) {
-            $new_field_list[] = array(
+            $new_field_list[] = [
                 'name'=> $extra_field[3],
                 'variable' => $extra_field[1], 'data'=> $extra_field[9]
-            );
+            ];
         }
     }
 }
@@ -119,7 +119,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $first_letter_user = $_POST['firstLetterUser'];
 
     if (!is_array($elements_posted)) {
-        $elements_posted = array();
+        $elements_posted = [];
     }
 
     // If "social group" you need to select a role
@@ -144,11 +144,11 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
 if (isset($_GET['action']) && $_GET['action'] == 'export') {
     $users = $usergroup->getUserListByUserGroup($id);
     if (!empty($users)) {
-        $data = array(
-            array('UserName', 'ClassName')
-        );
+        $data = [
+            ['UserName', 'ClassName']
+        ];
         foreach ($users as $user) {
-            $data[] = array($user['username'], $groupInfo['name']);
+            $data[] = [$user['username'], $groupInfo['name']];
         }
         $filename = 'export_user_class_'.api_get_local_time();
         Export::arrayToCsv($data, $filename);
@@ -176,7 +176,7 @@ if (is_array($extra_field_list)) {
 }
 
 if ($use_extra_fields) {
-    $final_result = array();
+    $final_result = [];
     if (count($extra_field_result) > 1) {
         for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
             if (is_array($extra_field_result[$i + 1])) {
@@ -189,13 +189,13 @@ if ($use_extra_fields) {
 }
 
 // Filters
-$filters = array(
-    array('type' => 'text', 'name' => 'username', 'label' => get_lang('Username')),
-    array('type' => 'text', 'name' => 'firstname', 'label' => get_lang('FirstName')),
-    array('type' => 'text', 'name' => 'lastname', 'label' => get_lang('LastName')),
-    array('type' => 'text', 'name' => 'official_code', 'label' => get_lang('OfficialCode')),
-    array('type' => 'text', 'name' => 'email', 'label' => get_lang('Email'))
-);
+$filters = [
+    ['type' => 'text', 'name' => 'username', 'label' => get_lang('Username')],
+    ['type' => 'text', 'name' => 'firstname', 'label' => get_lang('FirstName')],
+    ['type' => 'text', 'name' => 'lastname', 'label' => get_lang('LastName')],
+    ['type' => 'text', 'name' => 'official_code', 'label' => get_lang('OfficialCode')],
+    ['type' => 'text', 'name' => 'email', 'label' => get_lang('Email')]
+];
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
 $searchForm->addHeader(get_lang('AdvancedSearch'));
@@ -207,7 +207,7 @@ foreach ($filters as $param) {
 }
 $searchForm->addButtonSearch();
 
-$filterData = array();
+$filterData = [];
 if ($searchForm->validate()) {
     $filterData = $searchForm->getSubmitValues();
 }
@@ -216,17 +216,17 @@ $data = $usergroup->get($id);
 $list_in = $usergroup->getUsersByUsergroupAndRelation($id, $relation);
 $list_all = $usergroup->get_users_by_usergroup();
 
-$order = array('lastname');
+$order = ['lastname'];
 if (api_is_western_name_order()) {
-    $order = array('firstname');
+    $order = ['firstname'];
 }
 
 $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code');
 if ($orderListByOfficialCode === 'true') {
-    $order = array('official_code', 'lastname');
+    $order = ['official_code', 'lastname'];
 }
 
-$conditions = array();
+$conditions = [];
 if (!empty($first_letter_user)) {
     $conditions['lastname'] = $first_letter_user;
 }
@@ -242,8 +242,8 @@ if (!empty($filters) && !empty($filterData)) {
     }
 }
 
-$elements_not_in = $elements_in = array();
-$complete_user_list = UserManager::get_user_list_like(array(), $order);
+$elements_not_in = $elements_in = [];
+$complete_user_list = UserManager::get_user_list_like([], $order);
 
 if (!empty($complete_user_list)) {
     foreach ($complete_user_list as $item) {
@@ -283,7 +283,7 @@ $user_with_any_group = isset($_REQUEST['user_with_any_group']) && !empty($_REQUE
 
 if ($user_with_any_group) {
     $user_list = UserManager::get_user_list_like($conditions, $order, true);
-    $new_user_list = array();
+    $new_user_list = [];
     foreach ($user_list as $item) {
         if (!in_array($item['user_id'], $list_all)) {
             $new_user_list[] = $item;
@@ -332,22 +332,24 @@ Display::display_header($tool_name);
 
 echo '<div class="actions">';
 echo '<a href="usergroups.php">'.
-    Display::return_icon('back.png', get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('back.png', get_lang('Back'), [], ICON_SIZE_MEDIUM).'</a>';
 
-echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_options', 'id' => 'advanced_search'));
+echo Display::url(get_lang('AdvancedSearch'), '#', ['class' => 'advanced_options', 'id' => 'advanced_search']);
 
 echo '<a href="usergroup_user_import.php">'.
-    Display::return_icon('import_csv.png', get_lang('Import'), array(), ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('import_csv.png', get_lang('Import'), [], ICON_SIZE_MEDIUM).'</a>';
 
 echo '<a href="'.api_get_self().'?id='.$id.'&action=export">'.
-    Display::return_icon('export_csv.png', get_lang('Export'), array(), ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('export_csv.png', get_lang('Export'), [], ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 
 echo '<div id="advanced_search_options" style="display:none">';
 $searchForm->display();
 echo '</div>';
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;">
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) {
+    echo '&add=true';
+} ?>" style="margin:0px;">
 <?php
 echo '<legend>'.$tool_name.': '.$data['name'].'</legend>';
 
@@ -383,21 +385,23 @@ echo Display::input('hidden', 'add_type', null);
 ?>
 <div class="row">
     <div class="col-md-5">
-        <?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) { ?>
+        <?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) {
+    ?>
         <select name="relation" id="relation">
             <option value=""><?php echo get_lang('SelectARelationType')?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN) ? 'selected=selected' : '') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('Admin') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER) ? 'selected=selected' : '') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo((isset($relation) && $relation == GROUP_USER_PERMISSION_READER) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('Reader') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION) ? 'selected=selected' : '') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('PendingInvitation') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR) ? 'selected=selected' : '') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('Moderator') ?></option>
-            <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM) ? 'selected=selected' : '') ?> >
+            <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM) ? 'selected=selected' : '') ?> >
                 <?php echo get_lang('Drh') ?></option>
         </select>
-        <?php } ?>
+        <?php
+} ?>
 
         <div class="multiple_select_header">
         <b><?php echo get_lang('UsersInPlatform') ?> :</b>
@@ -414,18 +418,20 @@ echo Display::input('hidden', 'add_type', null);
         'elements_not_in_name',
         $elements_not_in,
         '',
-        array(
+        [
             'class' => 'form-control',
             'multiple' => 'multiple',
             'id' => 'elements_not_in',
             'size' => '15px',
-        ),
+        ],
         false
     );
     ?>
     <br />
       <label class="control-label">
-          <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"'; ?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
+          <input type="checkbox" <?php if ($user_with_any_group) {
+        echo 'checked="checked"';
+    } ?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
           <?php echo get_lang('UsersRegisteredInAnyGroup'); ?>
       </label>
     </div>
@@ -449,12 +455,12 @@ echo Display::input('hidden', 'add_type', null);
             'elements_in_name[]',
             $elements_in,
             '',
-            array(
+            [
                 'class' => 'form-control',
                 'multiple' => 'multiple',
                 'id' => 'elements_in',
                 'size' => '15px'
-            ),
+            ],
             false
         );
         unset($sessionUsersList);

+ 2 - 2
main/admin/archive_cleanup.php

@@ -19,14 +19,14 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $form = new FormValidator(
     'archive_cleanup_form',
     'post',
     '',
     '',
-    array(),
+    [],
     FormValidator::LAYOUT_BOX
 );
 $form->addButtonSend(get_lang('ArchiveDirCleanupProceedButton'));

+ 21 - 21
main/admin/career_dashboard.php

@@ -19,14 +19,14 @@ $this_section = SECTION_PLATFORM_ADMIN;
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     'name' => get_lang('PlatformAdmin')
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => 'career_dashboard.php',
     'name' => get_lang('CareersAndPromotions')
-);
+];
 $tpl = new Template(get_lang('CareersAndPromotions'));
 
 $html = null;
@@ -34,17 +34,17 @@ $form = new FormValidator('filter_form', 'GET', api_get_self());
 
 $career = new Career();
 
-$condition = array('status = ?' => 1);
+$condition = ['status = ?' => 1];
 if ($form->validate()) {
     $data = $form->getSubmitValues();
     $filter = intval($data['filter']);
     if (!empty($filter)) {
-        $condition = array('status = ? AND id = ? ' => array(1, $filter));
+        $condition = ['status = ? AND id = ? ' => [1, $filter]];
     }
 }
 
-$careers = $career->get_all(array('status = ?' => 1)); //only status =1
-$career_select_list = array();
+$careers = $career->get_all(['status = ?' => 1]); //only status =1
+$career_select_list = [];
 $career_select_list[0] = ' -- '.get_lang('Select').' --';
 foreach ($careers as $item) {
     $career_select_list[$item['id']] = $item['name'];
@@ -54,7 +54,7 @@ $form->addSelect(
     'filter',
     get_lang('Career'),
     $career_select_list,
-    array('id' => 'filter_1')
+    ['id' => 'filter_1']
 );
 $form->addButtonSearch(get_lang('Filter'));
 
@@ -90,14 +90,14 @@ if (api_is_platform_admin()) {
     );
 }
 
-$actions = Display::toolbarAction('toolbar-career', array($actionLeft));
+$actions = Display::toolbarAction('toolbar-career', [$actionLeft]);
 $html .= $form->returnForm();
 $careers = $career->get_all($condition); //only status =1
 
 $column_count = 3;
 $i = 0;
 $grid_js = '';
-$career_array = array();
+$career_array = [];
 
 if (!empty($careers)) {
     foreach ($careers as $career_item) {
@@ -108,7 +108,7 @@ if (!empty($careers)) {
             'name ASC'
         );
         $career_content = '';
-        $promotion_array = array();
+        $promotion_array = [];
         if (!empty($promotions)) {
             foreach ($promotions as $promotion_item) {
                 if ($promotion_item['status'] == 0) {
@@ -119,30 +119,30 @@ if (!empty($careers)) {
                 $sessions = SessionManager::get_all_sessions_by_promotion(
                     $promotion_item['id']
                 );
-                $session_list = array();
+                $session_list = [];
                 foreach ($sessions as $session_item) {
                     $course_list = SessionManager::get_course_list_by_session_id(
                         $session_item['id']
                     );
-                    $session_list[] = array(
+                    $session_list[] = [
                         'data' => $session_item,
                         'courses' => $course_list,
-                    );
+                    ];
                 }
-                $promotion_array[$promotion_item['id']] = array(
+                $promotion_array[$promotion_item['id']] = [
                     'id' => $promotion_item['id'],
                     'name' => $promotion_item['name'],
                     'sessions' => $session_list,
-                );
+                ];
             }
         }
-        $career_array[$career_item['id']] = array(
+        $career_array[$career_item['id']] = [
             'name' => $career_item['name'],
             'promotions' => $promotion_array,
-        );
-        $careerList = array(
+        ];
+        $careerList = [
             'promotions' => $promotion_array,
-        );
+        ];
         $careers[$career_item['id']]['career'] = $careerList;
     }
 }

+ 11 - 11
main/admin/career_diagram.php

@@ -42,30 +42,30 @@ if (empty($careerInfo)) {
 }
 
 // setting breadcrumbs
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     'name' => get_lang('PlatformAdmin'),
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => 'career_dashboard.php',
     'name' => get_lang('CareersAndPromotions'),
-);
+];
 
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'careers.php',
     'name' => get_lang('Careers'),
-);
+];
 
 $action = isset($_GET['action']) ? $_GET['action'] : '';
 $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers'));
+    $interbreadcrumb[] = ['url' => 'careers.php', 'name' => get_lang('Careers')];
     $toolName = get_lang('Add');
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers'));
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    $interbreadcrumb[] = ['url' => 'careers.php', 'name' => get_lang('Careers')];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
     $toolName = get_lang('Edit');
 } else {
     $toolName = get_lang('Careers');
@@ -110,13 +110,13 @@ $html = Display::page_subheader2($careerInfo['name'].$urlToString);
 if (!empty($item) && isset($item['value']) && !empty($item['value'])) {
     $graph = unserialize($item['value']);
     $html .= Career::renderDiagram($careerInfo, $graph);
-
 } else {
     Display::addFlash(
         Display::return_message(
         sprintf(get_lang('CareerXDoesntHaveADiagram'), $careerInfo['name']),
         'warning'
-    ));
+    )
+    );
 }
 $tpl->assign('content', $html);
 $tpl->display_one_col_template();

+ 19 - 19
main/admin/careers.php

@@ -19,14 +19,14 @@ api_protect_admin_script($allowCareer);
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     'name' => get_lang('PlatformAdmin'),
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => 'career_dashboard.php',
     'name' => get_lang('CareersAndPromotions'),
-);
+];
 
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 
@@ -34,11 +34,11 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers'));
+    $interbreadcrumb[] = ['url' => 'careers.php', 'name' => get_lang('Careers')];
     $tool_name = get_lang('Add');
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers'));
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    $interbreadcrumb[] = ['url' => 'careers.php', 'name' => get_lang('Careers')];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
     $tool_name = get_lang('Edit');
 } else {
     $tool_name = get_lang('Careers');
@@ -48,32 +48,32 @@ if ($action == 'add') {
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_careers';
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(get_lang('Name'), get_lang('Description'), get_lang('Actions'));
+$columns = [get_lang('Name'), get_lang('Description'), get_lang('Actions')];
 
 // Column config
-$column_model = array(
-    array(
+$column_model = [
+    [
         'name' => 'name',
         'index' => 'name',
         'width' => '200',
         'align' => 'left',
-    ),
-    array(
+    ],
+    [
         'name' => 'description',
         'index' => 'description',
         'width' => '400',
         'align' => 'left',
         'sortable' => 'false',
-    ),
-    array(
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '100',
         'align' => 'left',
         'formatter' => 'action_formatter',
         'sortable' => 'false',
-    ),
-);
+    ],
+];
 //Autowidth
 $extra_params['autowidth'] = 'true';
 //height auto
@@ -140,7 +140,7 @@ switch ($action) {
                 Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
             $content .= '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $content .= $form->returnForm();
         }
         break;
@@ -187,7 +187,7 @@ switch ($action) {
             $content .= '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
             $content .= '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $content .= $form->returnForm();
         }
         break;
@@ -241,7 +241,7 @@ Display::display_header($tool_name);
             $columns,
             $column_model,
             $extra_params,
-            array(),
+            [],
             $actionLinks,
             true
         );

+ 1 - 1
main/admin/cli.php

@@ -18,7 +18,7 @@ api_protect_admin_script();
 // setting the name of the tool
 $tool_name = get_lang('CommandLineInterpreter');
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 // including the header file (which includes the banner itself)
 Display :: display_header($tool_name);
 switch ($_GET["cmd"]) {

+ 137 - 137
main/admin/configure_extensions.php

@@ -11,7 +11,7 @@ $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 // Database Table Definitions
 $tbl_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
 $message = '';
@@ -69,7 +69,7 @@ if (isset($_POST['activeExtension'])) {
     }
 }
 
-$listActiveServices = array();
+$listActiveServices = [];
 
 // get the list of active services
 $sql = 'SELECT variable FROM '.$tbl_settings_current.'
@@ -135,10 +135,10 @@ Display::display_header($nameTool);
 ?>
 <div id="message" style="display: none">
 	<?php
-	if (!empty($message)) {
+    if (!empty($message)) {
         echo Display::return_message($message, 'normal');
     }
-	?>
+    ?>
 </div>
 
 <div id="content" align="center">
@@ -151,7 +151,7 @@ Display::display_header($nameTool);
     </div>
         <div class="row">
             <div class="col-md-5">
-                <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); ?>
+                <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), ['class'=>'img-responsive']); ?>
             </div>
             <div class="col-md-7">
                 <form method="POST" class="form-horizontal" action="<?php echo api_get_self(); ?>">
@@ -171,7 +171,7 @@ Display::display_header($nameTool);
                     $form->addElement('select', 'size', get_lang('SlideSize'), $options);
                     $form->addElement('hidden', 'extension_code', 'ppt2lp');
 
-                    $defaults = array();
+                    $defaults = [];
                     $renderer = $form->defaultRenderer();
                     $renderer->setElementTemplate(
                         '<div style="text-align:left">{label}</div><div style="text-align:left">{element}</div>'
@@ -201,144 +201,144 @@ Display::display_header($nameTool);
         </div>
     </div>
 	<?php
-	/*
-	<!-- EPHORUS -->
-	<div id="main_ephorus">
-		<div id="extension_header_ephorus" class="accordion_header">
-			<a href="#"><?php echo get_lang('EphorusPlagiarismPrevention') ?></a>
-		</div>
-		<div id="extension_content_ephorus" style="display:none;padding:0;width:780px;" class="accordion_content">
-			<table width="100%" cellpadding="0" cellspacing="0">
-				<tr>
-					<td align="center">
-						<TABLE style="WIDTH: 750px" cellSpacing="0" cellPadding="0" align="middle" border="0">
-						<TBODY>
-							<TR>
-								<TD>
-									<TABLE style="WIDTH: 475px" cellSpacing="0" cellPadding="0" border="0">
-									<TBODY>
-										<TR>
-											<TD>
-												&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-												<a title="http://www.ephorus.com/dokeos_activate.html" href="http://www.ephorus.com/dokeos_activate.html" target="_blank">
-												<?php Display::display_icon('ephorus.gif','Ephorus'); ?>
-												</a>
-											</TD>
-											<TD>
-												<P align=center>
-													<FONT color="#669966" size="3"><?php echo get_lang('EphorusLeadersInAntiPlagiarism') ?></FONT>
-												</P>
-											</TD>
-										</TR>
-									</TBODY>
-									</TABLE>
-								</TD>
-							</TR>
-							<TR>
-								<TD>
-									<P>
-										<TABLE style="WIDTH: 85%" cellSpacing="0" cellPadding="0" border="0">
-										<TBODY>
-											<TR>
-												<TD width="50">&nbsp;
+    /*
+    <!-- EPHORUS -->
+    <div id="main_ephorus">
+        <div id="extension_header_ephorus" class="accordion_header">
+            <a href="#"><?php echo get_lang('EphorusPlagiarismPrevention') ?></a>
+        </div>
+        <div id="extension_content_ephorus" style="display:none;padding:0;width:780px;" class="accordion_content">
+            <table width="100%" cellpadding="0" cellspacing="0">
+                <tr>
+                    <td align="center">
+                        <TABLE style="WIDTH: 750px" cellSpacing="0" cellPadding="0" align="middle" border="0">
+                        <TBODY>
+                            <TR>
+                                <TD>
+                                    <TABLE style="WIDTH: 475px" cellSpacing="0" cellPadding="0" border="0">
+                                    <TBODY>
+                                        <TR>
+                                            <TD>
+                                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                                <a title="http://www.ephorus.com/dokeos_activate.html" href="http://www.ephorus.com/dokeos_activate.html" target="_blank">
+                                                <?php Display::display_icon('ephorus.gif','Ephorus'); ?>
+                                                </a>
+                                            </TD>
+                                            <TD>
+                                                <P align=center>
+                                                    <FONT color="#669966" size="3"><?php echo get_lang('EphorusLeadersInAntiPlagiarism') ?></FONT>
+                                                </P>
+                                            </TD>
+                                        </TR>
+                                    </TBODY>
+                                    </TABLE>
+                                </TD>
+                            </TR>
+                            <TR>
+                                <TD>
+                                    <P>
+                                        <TABLE style="WIDTH: 85%" cellSpacing="0" cellPadding="0" border="0">
+                                        <TBODY>
+                                            <TR>
+                                                <TD width="50">&nbsp;
 
-												</TD>
-												<TD>
-													<P>
-														<?php echo get_lang('EphorusDescription') ?>
-													</P>
-													<P>
-														<A title="http://www.ephorus.nl/demo_account_en.html" href="http://www.ephorus.nl/demo_account_en.html" target="_blank"><?php echo get_lang('EphorusClickHereForADemoAccount') ?></A>
-													</P>
-													<P>
-														<A title="http://www.ephorus.nl:80/dokeos_activate.html" href="http://www.ephorus.nl/dokeos_activate.html" target="_blank"><?php echo get_lang('EphorusClickHereForInformationsAndPrices') ?></A>.
-													</P>
-												</TD>
-											</TR>
-										</TBODY>
-										</TABLE>
-									</P>
-								</TD>
-							</TR>
-						</TBODY>
-						</TABLE>
+                                                </TD>
+                                                <TD>
+                                                    <P>
+                                                        <?php echo get_lang('EphorusDescription') ?>
+                                                    </P>
+                                                    <P>
+                                                        <A title="http://www.ephorus.nl/demo_account_en.html" href="http://www.ephorus.nl/demo_account_en.html" target="_blank"><?php echo get_lang('EphorusClickHereForADemoAccount') ?></A>
+                                                    </P>
+                                                    <P>
+                                                        <A title="http://www.ephorus.nl:80/dokeos_activate.html" href="http://www.ephorus.nl/dokeos_activate.html" target="_blank"><?php echo get_lang('EphorusClickHereForInformationsAndPrices') ?></A>.
+                                                    </P>
+                                                </TD>
+                                            </TR>
+                                        </TBODY>
+                                        </TABLE>
+                                    </P>
+                                </TD>
+                            </TR>
+                        </TBODY>
+                        </TABLE>
                     </td>
-				</tr>
-			</table>
-		</div>
-	</div>
-	*/
+                </tr>
+            </table>
+        </div>
+    </div>
+    */
     /*
 
-	<!-- SEARCH -->
-	<div id="main_search">
-		<div id="extension_header_search" class="accordion_header">
-			<a href="#"><?php echo get_lang('SearchEngine') ?></a>
-		</div>
-		<div id="extension_content_search" style="display:none" class="accordion_content">
-			<?php echo get_lang('SearchEngineDescription') ?><br /><br />
-			<table width="100%">
-				<tr>
-					<td width="50%">
-						<?php Display::display_icon('screenshot_search.jpg', get_lang('SearchEngine')); ?>
-					</td>
-					<td align="center" width="50%">
-						<form method="POST" action="<?php echo api_get_self(); ?>">
-						<input type="hidden" name="extension_code" value="search" />
-						<button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
-						</form>
-					</td>
-				</tr>
-			</table>
-		</div>
-	</div>
+    <!-- SEARCH -->
+    <div id="main_search">
+        <div id="extension_header_search" class="accordion_header">
+            <a href="#"><?php echo get_lang('SearchEngine') ?></a>
+        </div>
+        <div id="extension_content_search" style="display:none" class="accordion_content">
+            <?php echo get_lang('SearchEngineDescription') ?><br /><br />
+            <table width="100%">
+                <tr>
+                    <td width="50%">
+                        <?php Display::display_icon('screenshot_search.jpg', get_lang('SearchEngine')); ?>
+                    </td>
+                    <td align="center" width="50%">
+                        <form method="POST" action="<?php echo api_get_self(); ?>">
+                        <input type="hidden" name="extension_code" value="search" />
+                        <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
+                        </form>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>
 
-	<!-- SERVER STATS -->
-	<div id="main_serverstats">
-		<div id="extension_header_serverstats" class="accordion_header">
-			<a href="#"><?php echo get_lang('ServerStatistics') ?></a>
-		</div>
-		<div id="extension_content_serverstats" style="display:none" class="accordion_content">
-			<?php echo get_lang('ServerStatisticsDescription') ?><br /><br />
-			<table width="100%">
-				<tr>
-					<td width="50%">
-						<?php Display::display_icon('screenshot_serverstats.jpg', get_lang('ServerStatistics')); ?>
-					</td>
-					<td align="center" width="50%">
-						<form method="POST" action="<?php echo api_get_self(); ?>">
-						<input type="hidden" name="extension_code" value="serverstats" />
-						<button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
-						</form>
-					</td>
-				</tr>
-			</table>
-		</div>
-	</div>
+    <!-- SERVER STATS -->
+    <div id="main_serverstats">
+        <div id="extension_header_serverstats" class="accordion_header">
+            <a href="#"><?php echo get_lang('ServerStatistics') ?></a>
+        </div>
+        <div id="extension_content_serverstats" style="display:none" class="accordion_content">
+            <?php echo get_lang('ServerStatisticsDescription') ?><br /><br />
+            <table width="100%">
+                <tr>
+                    <td width="50%">
+                        <?php Display::display_icon('screenshot_serverstats.jpg', get_lang('ServerStatistics')); ?>
+                    </td>
+                    <td align="center" width="50%">
+                        <form method="POST" action="<?php echo api_get_self(); ?>">
+                        <input type="hidden" name="extension_code" value="serverstats" />
+                        <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
+                        </form>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>
 
-	<!-- BANDWIDTH STATS -->
-	<div id="main_bandwidthstats">
-		<div id="extension_header_bandwidthstats" class="accordion_header">
-			<a href="#"><?php echo get_lang('BandWidthStatistics') ?></a>
-		</div>
-		<div id="extension_content_bandwidthstats" style="display:none" class="accordion_content">
-			<?php echo get_lang('BandWidthStatisticsDescription') ?><br /><br />
-			<table width="100%">
-				<tr>
-					<td width="50%">
-						<?php Display::display_icon('screenshot_bandwidth.jpg', get_lang('BandWidthStatistics')); ?>
-					</td>
-					<td align="center" width="50%">
-						<form method="POST" action="<?php echo api_get_self(); ?>">
-						<input type="hidden" name="extension_code" value="bandwidthstats" />
-						<button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
-						</form>
+    <!-- BANDWIDTH STATS -->
+    <div id="main_bandwidthstats">
+        <div id="extension_header_bandwidthstats" class="accordion_header">
+            <a href="#"><?php echo get_lang('BandWidthStatistics') ?></a>
+        </div>
+        <div id="extension_content_bandwidthstats" style="display:none" class="accordion_content">
+            <?php echo get_lang('BandWidthStatisticsDescription') ?><br /><br />
+            <table width="100%">
+                <tr>
+                    <td width="50%">
+                        <?php Display::display_icon('screenshot_bandwidth.jpg', get_lang('BandWidthStatistics')); ?>
+                    </td>
+                    <td align="center" width="50%">
+                        <form method="POST" action="<?php echo api_get_self(); ?>">
+                        <input type="hidden" name="extension_code" value="bandwidthstats" />
+                        <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
+                        </form>
 
-					</td>
-				</tr>
-			</table>
-		</div>
-	</div>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>
      */ ?>
 </div><!-- /content -->
 

+ 36 - 37
main/admin/configure_homepage.php

@@ -21,8 +21,8 @@ function home_tabs($file_logged_in)
     if ($post !== false) {
         $file_logged_out = str_replace('_logged_in', '', $file_logged_in);
         //variables initialization
-        $data_logged_out = array();
-        $data_logged_in = array();
+        $data_logged_out = [];
+        $data_logged_in = [];
 
         //we read the file with all links
         $file = file($file_logged_in);
@@ -72,16 +72,16 @@ $tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY);
 $tool_name = get_lang('ConfigureHomePage');
 $_languages = api_get_languages();
 $selfUrl = api_get_self();
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     'name' => get_lang('PlatformAdmin')
-);
+];
 
 if (!empty($action)) {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'configure_homepage.php',
         'name' => get_lang('ConfigureHomePage')
-    );
+    ];
 
     switch ($action) {
         case 'edit_top':
@@ -170,7 +170,7 @@ $menutabs = 'home_tabs'; //menutabs for tabs Menu
 $mtloggedin = 'home_tabs_logged_in'; //menutabs for tabs Menu
 $ext = '.html'; //ext for HTML Extension - when used frequently, variables are
 // faster than hardcoded strings
-$homef = array($menuf, $newsf, $topf, $noticef, $menutabs, $mtloggedin);
+$homef = [$menuf, $newsf, $topf, $noticef, $menutabs, $mtloggedin];
 
 // If language-specific file does not exist, create it by copying default file
 foreach ($homef as $my_file) {
@@ -260,7 +260,7 @@ if (!empty($action)) {
                 }
 
                 if (EventsMail::check_if_using_class('portal_homepage_edited')) {
-                    EventsDispatcher::events('portal_homepage_edited', array('about_user' => api_get_user_id()));
+                    EventsDispatcher::events('portal_homepage_edited', ['about_user' => api_get_user_id()]);
                 }
                 Event::addEvent(
                     LOG_HOMEPAGE_CHANGED,
@@ -273,7 +273,7 @@ if (!empty($action)) {
             case 'edit_notice':
                 // Filter
                 $notice_title = trim(strip_tags(stripslashes($_POST['notice_title'])));
-                $notice_text = trim(str_replace(array("\r", "\n"), array('', '<br />'), strip_tags(stripslashes($_POST['notice_text']), '<a>')));
+                $notice_text = trim(str_replace(["\r", "\n"], ['', '<br />'], strip_tags(stripslashes($_POST['notice_text']), '<a>')));
                 if (empty($notice_title) || empty($notice_text)) {
                     $errorMsg = get_lang('NoticeWillBeNotDisplayed');
                 }
@@ -453,7 +453,7 @@ if (!empty($action)) {
                     }
                     // If the requested action is to edit a link, open the file and
                     // write to it (if the file doesn't exist, create it)
-                    if (in_array($action, array('edit_link')) && !empty($link_html)) {
+                    if (in_array($action, ['edit_link']) && !empty($link_html)) {
                         $fp = @fopen($homep.$filename, 'w');
                         if ($fp) {
                             fputs($fp, $link_html);
@@ -563,7 +563,7 @@ if (!empty($action)) {
                 $menuf = ($action == 'delete_tabs') ? $mtloggedin : $menuf;
                 $home_menu = @file($homep.$menuf.'_'.$lang.$ext);
                 if (empty($home_menu)) {
-                    $home_menu = array();
+                    $home_menu = [];
                 }
                 foreach ($home_menu as $key => $enreg) {
                     if ($key == $link_index) {
@@ -613,7 +613,7 @@ if (!empty($action)) {
                     $errorMsg = get_lang('HomePageFilesNotReadable');
                 }
                 if (empty($home_notice)) {
-                    $home_notice = array();
+                    $home_notice = [];
                 }
                 $notice_title = strip_tags($home_notice[0]);
                 $notice_title = api_to_system_encoding($notice_title, api_detect_encoding($notice_title));
@@ -644,7 +644,7 @@ if (!empty($action)) {
                     $errorMsg = get_lang('HomePageFilesNotReadable');
                 }
                 if (empty($home_menu)) {
-                    $home_menu = array();
+                    $home_menu = [];
                 }
                 if (!empty($home_menu)) {
                     $home_menu = implode("\n", $home_menu);
@@ -666,7 +666,7 @@ if (!empty($action)) {
                     $errorMsg = get_lang('HomePageFilesNotReadable');
                 }
                 if (empty($home_menu)) {
-                    $home_menu = array();
+                    $home_menu = [];
                 }
                 if (!empty($home_menu)) {
                     $home_menu = implode("\n", $home_menu);
@@ -695,7 +695,7 @@ if (!empty($action)) {
                 }
 
                 if (empty($home_menu)) {
-                    $home_menu = array();
+                    $home_menu = [];
                 }
                 if (!empty($home_menu)) {
                     $home_menu = implode("\n", $home_menu);
@@ -849,8 +849,8 @@ switch ($action) {
         if (!empty($errorMsg)) {
             echo Display::return_message($errorMsg, 'normal');
         }
-        $default = array();
-        $form = new FormValidator('configure_homepage_'.$action, 'post', $selfUrl.'?action='.$action, '', array('style' => 'margin: 0px;'));
+        $default = [];
+        $form = new FormValidator('configure_homepage_'.$action, 'post', $selfUrl.'?action='.$action, '', ['style' => 'margin: 0px;']);
         $renderer = & $form->defaultRenderer();
 
         $form->addElement('header', '', $tool_name);
@@ -858,15 +858,15 @@ switch ($action) {
         $form->addElement('hidden', 'link_index', ($action == 'edit_link' || $action == 'edit_tabs') ? $link_index : '0');
         $form->addElement('hidden', 'filename', ($action == 'edit_link' || $action == 'edit_tabs') ? (!empty($filename) ? $filename : '') : '');
 
-        $form->addElement('text', 'link_name', get_lang('LinkName'), array('size' => '30', 'maxlength' => '50'));
+        $form->addElement('text', 'link_name', get_lang('LinkName'), ['size' => '30', 'maxlength' => '50']);
         if (!empty($link_name)) {
             $default['link_name'] = $link_name;
         }
         $default['link_url'] = empty($link_url) ? 'http://' : api_htmlentities($link_url, ENT_QUOTES);
         $linkUrlComment = ($action == 'insert_tabs') ? get_lang('Optional').'<br />'.get_lang('GlobalLinkUseDoubleColumnPrivateToShowPrivately') : '';
-        $form->addElement('text', 'link_url', array(get_lang('LinkURL'), $linkUrlComment), array('size' => '30', 'maxlength' => '100', 'style' => 'width: 350px;'));
+        $form->addElement('text', 'link_url', [get_lang('LinkURL'), $linkUrlComment], ['size' => '30', 'maxlength' => '100', 'style' => 'width: 350px;']);
 
-        $options = array('-1' => get_lang('FirstPlace'));
+        $options = ['-1' => get_lang('FirstPlace')];
 
         $selected = '';
 
@@ -898,15 +898,14 @@ switch ($action) {
 
         if ($action == 'edit_link' && (empty($link_url) || $link_url == 'http://' || $link_url == 'https://')) {
             $default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : $link_html;
-            $form->addHtmlEditor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
+            $form->addHtmlEditor('link_html', get_lang('Content'), false, false, ['ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400']);
             $form->addButtonSave(get_lang('Save'), 'submit');
-
         } else {
-            if (in_array($action, array('edit_tabs', 'insert_tabs'))) {
+            if (in_array($action, ['edit_tabs', 'insert_tabs'])) {
                 $default['link_html'] = isset($_POST['link_html']) ? $_POST['link_html'] : (!empty($link_html) ? $link_html : '');
-                $form->addHtmlEditor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
+                $form->addHtmlEditor('link_html', get_lang('Content'), false, false, ['ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400']);
             }
-            $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs'));
+            $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), ['id' => 'all_langs']);
             $form->addElement('html', '<table id="table_langs" style="margin-left:159px;"><tr>');
             $i = 0;
             foreach ($_languages['name'] as $key => $value) {
@@ -943,13 +942,13 @@ switch ($action) {
             echo Display::return_message($errorMsg, 'normal'); //main API
         }
 
-        $default = array();
+        $default = [];
         $form = new FormValidator(
             'configure_homepage_'.$action,
             'post',
             $selfUrl.'?action='.$action,
             '',
-            array('style' => 'margin: 0px;')
+            ['style' => 'margin: 0px;']
         );
         $renderer = & $form->defaultRenderer();
         $renderer->setHeaderTemplate('');
@@ -976,8 +975,8 @@ switch ($action) {
         }
 
         $default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open);
-        $form->addHtmlEditor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400'));
-        $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs'));
+        $form->addHtmlEditor($name, '', true, false, ['ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400']);
+        $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), ['id' => 'all_langs']);
         $form->addElement('html', '<table id="table_langs" style="margin-left:5px;"><tr>');
 
         $currentLanguage = api_get_interface_language();
@@ -1047,7 +1046,7 @@ switch ($action) {
                                        href="#notice-list" aria-expanded="true" aria-controls="notice-list">
                                         <?php echo get_lang('Notice'); ?>
                                         <a class="pull-right"
-                                           href="<?php echo $selfUrl; ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>
+                                           href="<?php echo $selfUrl; ?>?action=edit_notice"><?php Display::display_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL); ?></a>
                                     </a>
                                 </h4>
                             </div>
@@ -1097,7 +1096,7 @@ switch ($action) {
                                             $home_menu = @file($homep.$menuf.$ext);
                                         }
                                         if (empty($home_menu)) {
-                                            $home_menu = array();
+                                            $home_menu = [];
                                         }
                                         if (!empty($home_menu)) {
                                             $home_menu = implode("\n", $home_menu);
@@ -1110,7 +1109,7 @@ switch ($action) {
                                             if (!empty($enreg)) {
                                                 $edit_link = '<a href="'.$selfUrl.'?action=edit_link&amp;link_index='.$i.'">'.Display::return_icon('edit.png', get_lang('Edit')).'</a>';
                                                 $delete_link = '<a href="'.$selfUrl.'?action=delete_link&amp;link_index='.$i.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>';
-                                                echo str_replace(array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'), array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.' '.$delete_link.'</li>'), $enreg);
+                                                echo str_replace(['href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'], ['href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.' '.$delete_link.'</li>'], $enreg);
                                                 $i++;
                                             }
                                         }
@@ -1196,7 +1195,7 @@ switch ($action) {
                         }
                     }
                     if (empty($home_menu)) {
-                        $home_menu = array();
+                        $home_menu = [];
                     }
                     if (!empty($home_menu)) {
                         $home_menu = implode("\n", $home_menu);
@@ -1211,13 +1210,13 @@ switch ($action) {
                             $edit_link = ' <a href="'.$selfUrl.'?action=edit_tabs&amp;link_index='.$tab_counter.'" ><span>'.Display::return_icon('edit.png', get_lang('Edit')).'</span></a>';
                             $delete_link = ' <a href="'.$selfUrl.'?action=delete_tabs&amp;link_index='.$tab_counter.'"  onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)).'\')) return false;"><span>'.Display::return_icon('delete.png', get_lang('Delete')).'</span></a>';
                             $tab_string = str_replace(
-                                array('href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'),
-                                array('href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.$delete_link.'</li>'),
+                                ['href="'.api_get_path(WEB_PATH).'index.php?include=', '</li>'],
+                                ['href="'.api_get_path(WEB_CODE_PATH).'admin/'.basename($selfUrl).'?action=open_link&link=', $edit_link.$delete_link.'</li>'],
                                 $enreg
                             );
                             $tab_string = str_replace([' class="hide_menu"', ' class="show_menu"'], '', $tab_string);
-                            $tab_string = str_replace(array('<li>', '</li>'), '', $tab_string);
-                            $link_list .= Display::tag('li', $tab_string, array('class' => 'list-group-item'));
+                            $tab_string = str_replace(['<li>', '</li>'], '', $tab_string);
+                            $link_list .= Display::tag('li', $tab_string, ['class' => 'list-group-item']);
                             $tab_counter++;
                         }
                     }

+ 25 - 25
main/admin/configure_inscription.php

@@ -42,10 +42,10 @@ if (api_get_setting('allow_terms_conditions') == 'true') {
 
 $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 $tool_name = get_lang('ConfigureInscription');
 if (!empty($action)) {
-    $interbreadcrumb[] = array('url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription'));
+    $interbreadcrumb[] = ['url' => 'configure_inscription.php', 'name' => get_lang('ConfigureInscription')];
     switch ($action) {
         case 'edit_top':
             $tool_name = get_lang('EditTopRegister');
@@ -89,7 +89,7 @@ if (api_is_multiple_url_enabled()) {
 
 $topf = 'register_top'; //topf for Top File
 $ext = '.html'; //ext for HTML Extension - when used frequently, variables are
-$homef = array($topf);
+$homef = [$topf];
 
 // If language-specific file does not exist, create it by copying default file
 foreach ($homef as $my_file) {
@@ -182,12 +182,12 @@ if (api_get_setting('allow_terms_conditions') === 'true') {
 if ($display_all_form) {
     if (api_is_western_name_order()) {
         //	FIRST NAME and LAST NAME
-        $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
-        $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
+        $form->addElement('text', 'firstname', get_lang('FirstName'), ['size' => 40, 'disabled' => 'disabled']);
+        $form->addElement('text', 'lastname', get_lang('LastName'), ['size' => 40, 'disabled' => 'disabled']);
     } else {
         //	LAST NAME and FIRST NAME
-        $form->addElement('text', 'lastname', get_lang('LastName'), array('size' => 40, 'disabled' => 'disabled'));
-        $form->addElement('text', 'firstname', get_lang('FirstName'), array('size' => 40, 'disabled' => 'disabled'));
+        $form->addElement('text', 'lastname', get_lang('LastName'), ['size' => 40, 'disabled' => 'disabled']);
+        $form->addElement('text', 'firstname', get_lang('FirstName'), ['size' => 40, 'disabled' => 'disabled']);
     }
     $form->applyFilter('firstname', 'trim');
     $form->applyFilter('lastname', 'trim');
@@ -195,32 +195,32 @@ if ($display_all_form) {
     $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
 
     //	EMAIL
-    $form->addElement('text', 'email', get_lang('Email'), array('size' => 40, 'disabled' => 'disabled'));
+    $form->addElement('text', 'email', get_lang('Email'), ['size' => 40, 'disabled' => 'disabled']);
     if (api_get_setting('registration', 'email') == 'true') {
         $form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
     }
     $form->addRule('email', get_lang('EmailWrong'), 'email');
     if (api_get_setting('openid_authentication') == 'true') {
-        $form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40, 'disabled' => 'disabled'));
+        $form->addElement('text', 'openid', get_lang('OpenIDURL'), ['size' => 40, 'disabled' => 'disabled']);
     }
 
     //	USERNAME
-    $form->addElement('text', 'username', get_lang('UserName'), array('size' => USERNAME_MAX_LENGTH, 'disabled' => 'disabled'));
+    $form->addElement('text', 'username', get_lang('UserName'), ['size' => USERNAME_MAX_LENGTH, 'disabled' => 'disabled']);
     $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('username', get_lang('UsernameWrong'), 'username');
     $form->addRule('username', get_lang('UserTaken'), 'username_available');
     $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
 
     //	PASSWORD
-    $form->addElement('password', 'pass1', get_lang('Pass'), array('size' => 40, 'disabled' => 'disabled'));
-    $form->addElement('password', 'pass2', get_lang('Confirmation'), array('size' => 40, 'disabled' => 'disabled'));
+    $form->addElement('password', 'pass1', get_lang('Pass'), ['size' => 40, 'disabled' => 'disabled']);
+    $form->addElement('password', 'pass2', get_lang('Confirmation'), ['size' => 40, 'disabled' => 'disabled']);
     $form->addRule('pass1', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('pass2', get_lang('ThisFieldIsRequired'), 'required');
-    $form->addRule(array('pass1', 'pass2'), get_lang('PassTwo'), 'compare');
+    $form->addRule(['pass1', 'pass2'], get_lang('PassTwo'), 'compare');
     $form->addPasswordRule('pass1');
 
     //	PHONE
-    $form->addElement('text', 'phone', get_lang('Phone'), array('size' => 40, 'disabled' => 'disabled'));
+    $form->addElement('text', 'phone', get_lang('Phone'), ['size' => 40, 'disabled' => 'disabled']);
     if (api_get_setting('registration', 'phone') == 'true') {
         $form->addRule('phone', get_lang('ThisFieldIsRequired'), 'required');
     }
@@ -231,39 +231,39 @@ if ($display_all_form) {
             'language',
             get_lang('Language'),
             '',
-            array('disabled' => 'disabled')
+            ['disabled' => 'disabled']
         );
     }
 
     //	STUDENT/TEACHER
     if (api_get_setting('allow_registration_as_teacher') != 'false') {
-        $form->addElement('radio', 'status', get_lang('Status'), get_lang('RegStudent'), STUDENT, array('disabled' => 'disabled'));
-        $form->addElement('radio', 'status', null, get_lang('RegAdmin'), COURSEMANAGER, array('disabled' => 'disabled'));
+        $form->addElement('radio', 'status', get_lang('Status'), get_lang('RegStudent'), STUDENT, ['disabled' => 'disabled']);
+        $form->addElement('radio', 'status', null, get_lang('RegAdmin'), COURSEMANAGER, ['disabled' => 'disabled']);
     }
 
     //	EXTENDED FIELDS
     if (api_get_setting('extended_profile') == 'true' &&
         api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true'
     ) {
-        $form->addHtmlEditor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('competences', get_lang('MyCompetences'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
     }
 
     if (api_get_setting('extended_profile') == 'true' &&
         api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true'
     ) {
-        $form->addHtmlEditor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('diplomas', get_lang('MyDiplomas'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
     }
 
     if (api_get_setting('extended_profile') == 'true' &&
         api_get_setting('extendedprofile_registration', 'myteach') == 'true'
     ) {
-        $form->addHtmlEditor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('teach', get_lang('MyTeach'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
     }
 
     if (api_get_setting('extended_profile') == 'true' &&
         api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true'
     ) {
-        $form->addHtmlEditor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
+        $form->addHtmlEditor('openarea', get_lang('MyPersonalOpenArea'), false, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
     }
 
     if (api_get_setting('extended_profile') == 'true') {
@@ -366,13 +366,13 @@ switch ($action) {
             echo Display::return_message($errorMsg, 'normal');
         }
 
-        $default = array();
+        $default = [];
         $form = new FormValidator(
             'configure_inscription_'.$action,
             'post',
             api_get_self().'?action='.$action,
             '',
-            array('style' => 'margin: 0px;')
+            ['style' => 'margin: 0px;']
         );
         $renderer = & $form->defaultRenderer();
         $renderer->setHeaderTemplate('');
@@ -386,11 +386,11 @@ switch ($action) {
             '',
             true,
             false,
-            array(
+            [
                 'ToolbarSet' => 'PortalHomePage',
                 'Width' => '100%',
                 'Height' => '400'
-            )
+            ]
         );
         $form->addButtonSave(get_lang('Save'));
         $form->setDefaults($default);

+ 9 - 9
main/admin/configure_plugin.php

@@ -30,7 +30,7 @@ if (isset($pluginInfo['settings_form'])) {
     $form = $pluginInfo['settings_form'];
     if (isset($form)) {
         // We override the form attributes
-        $attributes = array('action' => $currentUrl, 'method' => 'POST');
+        $attributes = ['action' => $currentUrl, 'method' => 'POST'];
         $form->updateAttributes($attributes);
         if (isset($pluginInfo['settings'])) {
             $form->setDefaults($pluginInfo['settings']);
@@ -57,15 +57,15 @@ if (isset($form)) {
 
         $accessUrlId = api_get_current_access_url_id();
         api_delete_settings_params(
-            array(
-                'category = ? AND access_url = ? AND subkey = ? AND type = ? and variable <> ?' => array(
+            [
+                'category = ? AND access_url = ? AND subkey = ? AND type = ? and variable <> ?' => [
                     'Plugins',
                     $accessUrlId,
                     $pluginName,
                     'setting',
                     'status'
-                )
-            )
+                ]
+            ]
         );
 
         foreach ($values as $key => $value) {
@@ -103,14 +103,14 @@ if (isset($form)) {
     }
 }
 
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
     'name' => get_lang('PlatformAdmin')
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins',
     'name' => get_lang('Plugins')
-);
+];
 
 $tpl = new Template($pluginName, true, true, false, true, false);
 $tpl->assign('content', $content);

+ 15 - 15
main/admin/course_add.php

@@ -15,8 +15,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 
 $tool_name = get_lang('AddCourse');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 
 $em = Database::getManager();
 /** @var CourseCategoryRepository $courseCategoriesRepo */
@@ -33,9 +33,9 @@ $form->addText(
     'title',
     get_lang('Title'),
     true,
-    array(
+    [
         'aria-label' => get_lang('Title')
-    )
+    ]
 );
 $form->applyFilter('title', 'html_filter');
 $form->applyFilter('title', 'trim');
@@ -43,10 +43,10 @@ $form->applyFilter('title', 'trim');
 // Code
 $form->addText(
     'visual_code',
-    array(
+    [
         get_lang('CourseCode'),
         get_lang('OnlyLettersAndNumbers')
-    ),
+    ],
     false,
     [
         'maxlength' => CourseManager::MAX_COURSE_LENGTH_CODE,
@@ -113,7 +113,7 @@ $form->addText(
     'department_name',
     get_lang('CourseDepartment'),
     false,
-    array('size' => '60', 'id' => 'department_name')
+    ['size' => '60', 'id' => 'department_name']
 );
 $form->applyFilter('department_name', 'html_filter');
 $form->applyFilter('department_name', 'trim');
@@ -123,7 +123,7 @@ $form->addText(
     'department_url',
     get_lang('CourseDepartmentURL'),
     false,
-    array('size' => '60', 'id' => 'department_url')
+    ['size' => '60', 'id' => 'department_url']
 );
 $form->applyFilter('department_url', 'html_filter');
 
@@ -136,8 +136,8 @@ if (count($languages['name']) === 1) {
     $form->addSelectLanguage(
         'course_language',
         get_lang('Ln'),
-        array(),
-        array('style' => 'width:150px')
+        [],
+        ['style' => 'width:150px']
     );
 }
 
@@ -156,7 +156,7 @@ if (api_get_setting('teacher_can_select_course_template') === 'true') {
 
 $form->addElement('checkbox', 'exemplary_content', '', get_lang('FillWithExemplaryContent'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
@@ -165,19 +165,19 @@ $group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVis
 
 $form->addGroup($group, '', get_lang('CourseAccess'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
 $group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
 $form->addGroup($group, '', get_lang('Subscription'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
 $group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
 $form->addGroup($group, '', get_lang('Unsubscription'));
 
-$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')), array(
+$form->addElement('text', 'disk_quota', [get_lang('CourseQuota'), null, get_lang('MB')], [
     'id' => 'disk_quota'
-));
+]);
 $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric');
 
 $obj = new GradeModel();

+ 5 - 6
main/admin/course_category.php

@@ -74,10 +74,10 @@ if (!empty($action)) {
 }
 
 $tool_name = get_lang('AdminCategories');
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     "name" => get_lang('PlatformAdmin'),
-);
+];
 
 Display::display_header($tool_name);
 
@@ -113,7 +113,7 @@ if ($action == 'add' || $action == 'edit') {
     }
 
     $form->addRule('code', get_lang('PleaseEnterCategoryInfo'), 'required');
-    $group = array(
+    $group = [
         $form->createElement(
             'radio',
             'auth_course_child',
@@ -128,7 +128,7 @@ if ($action == 'add' || $action == 'edit') {
             get_lang('No'),
             'FALSE'
         ),
-    );
+    ];
     $form->addGroup($group, null, get_lang("AllowCoursesInCategory"));
 
     if ($myCourseListAsCategory) {
@@ -162,11 +162,10 @@ if ($action == 'add' || $action == 'edit') {
     } else {
         $class = "add";
         $text = get_lang('AddCategory');
-        $form->setDefaults(array('auth_course_child' => 'TRUE'));
+        $form->setDefaults(['auth_course_child' => 'TRUE']);
         $form->addButtonCreate($text);
     }
     $form->display();
-
 } else {
     // If multiple URLs and not main URL, prevent deletion and inform user
     if ($action == 'delete' && api_get_multiple_access_url() && api_get_current_access_url_id() != 1) {

+ 17 - 17
main/admin/course_edit.php

@@ -37,8 +37,8 @@ if (empty($courseInfo)) {
 }
 
 $tool_name = get_lang('ModifyCourseInfo');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array("url" => "course_list.php", "name" => get_lang('CourseList'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ["url" => "course_list.php", "name" => get_lang('CourseList')];
 
 // Get all course categories
 $table_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -56,7 +56,7 @@ $sql = "SELECT user.user_id,lastname,firstname
             course_user.c_id ='".$courseId."'".
         $order_clause;
 $res = Database::query($sql);
-$course_teachers = array();
+$course_teachers = [];
 while ($obj = Database::fetch_object($res)) {
     $course_teachers[] = $obj->user_id;
 }
@@ -78,8 +78,8 @@ if (api_is_multiple_url_enabled()) {
 $courseInfo['tutor_name'] = null;
 
 $res = Database::query($sql);
-$teachers = array();
-$allTeachers = array();
+$teachers = [];
+$allTeachers = [];
 $platform_teachers[0] = '-- '.get_lang('NoManager').' --';
 while ($obj = Database::fetch_object($res)) {
     $allTeachers[$obj->user_id] = api_get_person_name($obj->firstname, $obj->lastname);
@@ -122,18 +122,18 @@ $form->applyFilter('title', 'trim');
 $element = $form->addElement(
     'text',
     'real_code',
-    array(get_lang('CourseCode'), get_lang('ThisValueCantBeChanged'))
+    [get_lang('CourseCode'), get_lang('ThisValueCantBeChanged')]
 );
 $element->freeze();
 
 // Visual code
 $form->addText(
     'visual_code',
-    array(
+    [
         get_lang('VisualCode'),
         get_lang('OnlyLettersAndNumbers'),
         get_lang('ThisValueIsUsedInTheCourseURL')
-    ),
+    ],
     true,
     [
         'maxlength' => CourseManager::MAX_COURSE_LENGTH_CODE,
@@ -214,7 +214,7 @@ if (!empty($coursesInSession) && $allowEditSessionCoaches) {
         );
         $teachers = $allTeachers;
 
-        $sessionTeachers = array();
+        $sessionTeachers = [];
         foreach ($coaches as $coachId) {
             $userInfo = api_get_user_info($coachId);
             $sessionTeachers[] = $coachId;
@@ -236,7 +236,7 @@ if (!empty($coursesInSession) && $allowEditSessionCoaches) {
             Display::url(
                 $session['name'],
                 $sessionUrl,
-                array('target' => '_blank')
+                ['target' => '_blank']
             ).' - '.get_lang('Coaches'),
             $allTeachers
         );
@@ -244,17 +244,17 @@ if (!empty($coursesInSession) && $allowEditSessionCoaches) {
     }
 }
 
-$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
+$form->addText('department_name', get_lang('CourseDepartment'), false, ['size' => '60']);
 $form->applyFilter('department_name', 'html_filter');
 $form->applyFilter('department_name', 'trim');
 
-$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60'));
+$form->addText('department_url', get_lang('CourseDepartmentURL'), false, ['size' => '60']);
 $form->applyFilter('department_url', 'html_filter');
 $form->applyFilter('department_url', 'trim');
 
 $form->addSelectLanguage('course_language', get_lang('CourseLanguage'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
@@ -262,17 +262,17 @@ $group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVis
 $group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
 $form->addGroup($group, '', get_lang('CourseAccess'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
 $group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
 $form->addGroup($group, '', get_lang('Subscription'));
 
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
 $group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
 $form->addGroup($group, '', get_lang('Unsubscription'));
 
-$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')));
+$form->addElement('text', 'disk_quota', [get_lang('CourseQuota'), null, get_lang('MB')]);
 $form->addRule('disk_quota', get_lang('ThisFieldIsRequired'), 'required');
 $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric');
 
@@ -456,7 +456,7 @@ Display::display_header($tool_name);
 
 echo '<div class="actions">';
 echo Display::url(Display::return_icon('back.png', get_lang('Back')), api_get_path(WEB_CODE_PATH).'admin/course_list.php');
-echo Display::url(Display::return_icon('course_home.png', get_lang('CourseHome')), $courseInfo['course_public_url'], array('target' => '_blank'));
+echo Display::url(Display::return_icon('course_home.png', get_lang('CourseHome')), $courseInfo['course_public_url'], ['target' => '_blank']);
 echo '</div>';
 
 echo "<script>

+ 3 - 3
main/admin/course_export.php

@@ -14,13 +14,13 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 
 $tool_name = get_lang('ExportCourses');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 
 $course_list = CourseManager::get_courses_list();
 $formSent = null;
-$courses = $selected_courses = array();
+$courses = $selected_courses = [];
 
 if (isset($_POST['formSent']) && $_POST['formSent']) {
     $formSent = $_POST['formSent'];
@@ -152,7 +152,7 @@ if (!empty($course_list)) {
 
 $form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV', 'csv', null);
 $form->addElement('radio', 'file_type', '', 'XLS', 'xls', null);
-$form->addElement('radio', 'file_type', null, 'XML', 'xml', null, array('id' => 'file_type_xml'));
+$form->addElement('radio', 'file_type', null, 'XML', 'xml', null, ['id' => 'file_type_xml']);
 
 $form->setDefaults(['select_type' => '1', 'file_type' => 'csv']);
 

+ 9 - 9
main/admin/course_import.php

@@ -15,13 +15,13 @@
  */
 function validate_courses_data($courses)
 {
-    $errors = array();
-    $coursecodes = array();
+    $errors = [];
+    $coursecodes = [];
     foreach ($courses as $index => $course) {
         $course['line'] = $index + 1;
 
         // 1. Check whether mandatory fields are set.
-        $mandatory_fields = array('Code', 'Title', 'CourseCategory');
+        $mandatory_fields = ['Code', 'Title', 'CourseCategory'];
         foreach ($mandatory_fields as $field) {
             if (empty($course[$field])) {
                 $course['error'] = get_lang($field.'Mandatory');
@@ -90,7 +90,7 @@ function getTeacherListInArray($teachers)
         return explode('|', $teachers);
     }
 
-    return array();
+    return [];
 }
 
 /**
@@ -103,7 +103,7 @@ function save_courses_data($courses)
     foreach ($courses as $course) {
         $course_language = $course['Language'];
         $teachers = getTeacherListInArray($course['Teacher']);
-        $teacherList = array();
+        $teacherList = [];
         $creatorId = api_get_user_id();
 
         if (!empty($teachers)) {
@@ -115,7 +115,7 @@ function save_courses_data($courses)
             }
         }
 
-        $params = array();
+        $params = [];
         $params['title'] = $course['Title'];
         $params['wanted_code'] = $course['Code'];
         $params['tutor_name'] = null;
@@ -172,7 +172,7 @@ if (isset($extAuthSource) && is_array($extAuthSource)) {
 
 $tool_name = get_lang('ImportCourses').' CSV';
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 Display::display_header($tool_name);
@@ -182,7 +182,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
         $error_message = get_lang('UplUploadFailed');
         echo Display::return_message($error_message, 'error', false);
     } else {
-        $allowed_file_mimetype = array('csv');
+        $allowed_file_mimetype = ['csv'];
 
         $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'], '.') + 1));
 
@@ -215,7 +215,7 @@ $form = new FormValidator(
     'post',
     api_get_self(),
     null,
-    array('enctype' => 'multipart/form-data')
+    ['enctype' => 'multipart/form-data']
 );
 $form->addHeader($tool_name);
 $form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));

+ 11 - 11
main/admin/course_information.php

@@ -80,24 +80,24 @@ function get_course_usage($course, $session_id = 0)
         $rs = Database::query($sql);
         $row = Database::fetch_array($rs);
 
-        $usage[] = array(
+        $usage[] = [
             $title,
             $row['count']
-        );
+        ];
     }
 
     return $usage;
 }
 
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array("url" => 'course_list.php', "name" => get_lang('Courses'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ["url" => 'course_list.php', "name" => get_lang('Courses')];
 $courseId = $courseInfo['real_id'];
 $tool_name = $courseInfo['title'].' ('.$courseInfo['visual_code'].')';
 Display::display_header($tool_name);
 ?>
     <div class="actions">
         <a href="<?php echo $courseInfo['course_public_url']; ?>">
-            <?php Display::display_icon('home.png', get_lang('CourseHomepage'), array(), ICON_SIZE_MEDIUM); ?>
+            <?php Display::display_icon('home.png', get_lang('CourseHomepage'), [], ICON_SIZE_MEDIUM); ?>
         </a>
     </div>
 <?php
@@ -110,8 +110,8 @@ $table = new SortableTableFromArray(
     20,
     'usage_table'
 );
-$table->set_additional_parameters(array('code' => $courseInfo['code']));
-$table->set_other_tables(array('user_table', 'class_table'));
+$table->set_additional_parameters(['code' => $courseInfo['code']]);
+$table->set_other_tables(['user_table', 'class_table']);
 $table->set_header(0, get_lang('Tool'), true);
 $table->set_header(1, get_lang('NumberOfItems'), true);
 $table->display();
@@ -138,9 +138,9 @@ $sql .= " WHERE
 $res = Database::query($sql);
 $is_western_name_order = api_is_western_name_order();
 if (Database::num_rows($res) > 0) {
-    $users = array();
+    $users = [];
     while ($obj = Database::fetch_object($res)) {
-        $user   = array();
+        $user   = [];
         $user[] = $obj->official_code;
         if ($is_western_name_order) {
             $user[] = $obj->firstname;
@@ -156,8 +156,8 @@ if (Database::num_rows($res) > 0) {
         $users[] = $user;
     }
     $table = new SortableTableFromArray($users, 0, 20, 'user_table');
-    $table->set_additional_parameters(array('code' => $courseInfo['code']));
-    $table->set_other_tables(array('usage_table', 'class_table'));
+    $table->set_additional_parameters(['code' => $courseInfo['code']]);
+    $table->set_other_tables(['usage_table', 'class_table']);
     $table->set_header(0, get_lang('OfficialCode'), true);
     if ($is_western_name_order) {
         $table->set_header(1, get_lang('FirstName'), true);

+ 6 - 6
main/admin/course_intro_pdf_import.php

@@ -15,7 +15,7 @@ $subDir = '';
 $tool_name = get_lang('ImportPDFIntroToCourses');
 $errors = [];
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 
@@ -24,7 +24,7 @@ if ($_POST['formSent']) {
         $error_message = get_lang('UplUploadFailed');
         Display::addFlash(Display::return_message($error_message, 'error', false));
     } else {
-        $allowed_file_mimetype = array('zip');
+        $allowed_file_mimetype = ['zip'];
         $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'], '.') + 1));
 
         if (!in_array($ext_import_file, $allowed_file_mimetype)) {
@@ -102,7 +102,7 @@ function import_pdfs($subDir = '/')
 {
     $baseDir = api_get_path(SYS_ARCHIVE_PATH);
     $uploadPath = 'pdfimport/';
-    $errors = array();
+    $errors = [];
     if (!is_dir($baseDir.$uploadPath)) {
         @mkdir($baseDir.$uploadPath);
     }
@@ -152,7 +152,7 @@ function import_pdfs($subDir = '/')
                 );
                 // Redo visibility
                 api_set_default_visibility($docId, TOOL_DOCUMENT);
-                $errors[] = array('Line' => 0, 'Code' => $course['code'], 'Title' => $course['title']);
+                $errors[] = ['Line' => 0, 'Code' => $course['code'], 'Title' => $course['title']];
                 // Now add a link to the file from the Course description tool
                 $link = '<p>Sílabo de la asignatura 
                  <a href="'.api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq_params($course['code']).'&action=download&id='.$docId.'" target="_blank">
@@ -169,12 +169,12 @@ function import_pdfs($subDir = '/')
             }
         } else {
             error_log($parts[0].' is not a course, apparently');
-            $errors[] = array('Line' => 0, 'Code' => $parts[0], 'Title' => $parts[0].' - '.get_lang('CodeDoesNotExists'));
+            $errors[] = ['Line' => 0, 'Code' => $parts[0], 'Title' => $parts[0].' - '.get_lang('CodeDoesNotExists')];
         }
         $i++; //found at least one entry that is not a dir or a .
     }
     if ($i == 0) {
-        $errors[] = array('Line' => 0, 'Code' => '.', 'Title' => get_lang('NoPDFFoundAtRoot'));
+        $errors[] = ['Line' => 0, 'Code' => '.', 'Title' => get_lang('NoPDFFoundAtRoot')];
     }
 
     return $errors;

+ 26 - 26
main/admin/course_list.php

@@ -147,7 +147,7 @@ function get_course_data($from, $number_of_items, $column, $direction)
     $sql .= " LIMIT $from, $number_of_items";
 
     $res = Database::query($sql);
-    $courses = array();
+    $courses = [];
     $languages = api_get_languages_to_array();
 
     $path = api_get_path(WEB_CODE_PATH);
@@ -176,13 +176,13 @@ function get_course_data($from, $number_of_items, $column, $direction)
             '<a href="'.$path.'tracking/courseLog.php?'.api_get_cidreq_params($courseCode).'">'.
             Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>&nbsp;'.
             '<a href="'.$path.'admin/course_edit.php?id='.$courseId.'">'.
-            Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>&nbsp;'.
+            Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>&nbsp;'.
             '<a href="'.$path.'coursecopy/create_backup.php?'.api_get_cidreq_params($courseCode).'">'.
             Display::return_icon('backup.gif', get_lang('CreateBackup')).'</a>&nbsp;'.
             '<a href="'.$path.'admin/course_list.php?delete_course='.$courseCode.'"  onclick="javascript: if (!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;">'.
-            Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>';
+            Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL).'</a>';
 
-        $courseItem = array(
+        $courseItem = [
             $course[0],
             $course[1],
             $course[2],
@@ -191,7 +191,7 @@ function get_course_data($from, $number_of_items, $column, $direction)
             $course[5],
             $course[6],
             $actions
-        );
+        ];
         $courses[] = $courseItem;
     }
 
@@ -282,35 +282,35 @@ function get_course_visibility_icon($visibility)
             return Display::return_icon(
                 'bullet_red.png',
                 get_lang('CourseVisibilityClosed'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         case 1:
             return Display::return_icon(
                 'bullet_orange.png',
                 get_lang('Private'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         case 2:
             return Display::return_icon(
                 'bullet_green.png',
                 get_lang('OpenToThePlatform'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         case 3:
             return Display::return_icon(
                 'bullet_blue.png',
                 get_lang('OpenToTheWorld'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         case 4:
             return Display::return_icon(
                 'bullet_grey.png',
                 get_lang('CourseVisibilityHidden'),
-                array('style' => $style)
+                ['style' => $style]
             );
             break;
         default:
@@ -339,14 +339,14 @@ $actions = '';
 
 if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
     // Get all course categories
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'index.php',
         'name' => get_lang('PlatformAdmin')
-    );
-    $interbreadcrumb[] = array(
+    ];
+    $interbreadcrumb[] = [
         'url' => 'course_list.php',
         'name' => get_lang('CourseList')
-    );
+    ];
     $tool_name = get_lang('SearchACourse');
     $form = new FormValidator('advanced_course_search', 'get');
     $form->addElement('header', $tool_name);
@@ -361,9 +361,9 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         'keyword_category',
         get_lang('CourseFaculty'),
         null,
-        array(
+        [
             'url' => $url
-        )
+        ]
     );
 
     $el = $form->addSelectLanguage('keyword_language', get_lang('CourseLanguage'));
@@ -388,10 +388,10 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
     $form->setDefaults($defaults);
     $content .= $form->returnForm();
 } else {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'index.php',
         'name' => get_lang('PlatformAdmin')
-    );
+    ];
     $tool_name = get_lang('CourseList');
     if (isset($_GET['delete_course'])) {
         CourseManager::delete_course($_GET['delete_course']);
@@ -404,14 +404,14 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         'get',
         '',
         '',
-        array(),
+        [],
         FormValidator::LAYOUT_INLINE
     );
     $form->addElement(
         'text',
         'keyword',
         null,
-        array('id' => 'course-search-keyword', 'aria-label' => get_lang('SearchCourse'))
+        ['id' => 'course-search-keyword', 'aria-label' => get_lang('SearchCourse')]
     );
     $form->addButtonSearch(get_lang('SearchCourse'));
     $advanced = '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/course_list.php?search=advanced">
@@ -424,7 +424,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         'get',
         '',
         '',
-        array(),
+        [],
         FormValidator::LAYOUT_INLINE
     );
     $url = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_session';
@@ -433,7 +433,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         'session_name',
         get_lang('SearchCourseBySession'),
         null,
-        array('url' => $url)
+        ['url' => $url]
     );
 
     if (!empty($sessionId)) {
@@ -515,7 +515,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
 
     $parameters = [];
     if (isset($_GET['keyword'])) {
-        $parameters = array('keyword' => Security::remove_XSS($_GET['keyword']));
+        $parameters = ['keyword' => Security::remove_XSS($_GET['keyword'])];
     } elseif (isset($_GET['keyword_code'])) {
         $parameters['keyword_code'] = Security::remove_XSS($_GET['keyword_code']);
         $parameters['keyword_title'] = Security::remove_XSS($_GET['keyword_title']);
@@ -529,7 +529,7 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
     $table->set_additional_parameters($parameters);
 
     $table->set_header(0, '', false, 'width="8px"');
-    $table->set_header(1, get_lang('Title'), true, null, array('class' => 'title'));
+    $table->set_header(1, get_lang('Title'), true, null, ['class' => 'title']);
     $table->set_header(2, get_lang('Code'));
     $table->set_header(3, get_lang('Language'), false, 'width="70px"');
     $table->set_header(4, get_lang('Category'));
@@ -540,10 +540,10 @@ if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
         get_lang('Action'),
         false,
         null,
-        array('class' => 'td_actions')
+        ['class' => 'td_actions']
     );
     $table->set_form_actions(
-        array('delete_courses' => get_lang('DeleteCourse')),
+        ['delete_courses' => get_lang('DeleteCourse')],
         'course'
     );
     $content .= $table->return_table();

+ 7 - 7
main/admin/course_request_accepted.php

@@ -110,7 +110,7 @@ function get_request_data($from, $number_of_items, $column, $direction)
     $sql .= " LIMIT $from,$number_of_items";
     $res = Database :: query($sql);
 
-    $course_requests = array();
+    $course_requests = [];
     while ($course_request = Database :: fetch_row($res)) {
         $course_request[5] = api_get_local_time($course_request[5]);
         $course_requests[] = $course_request;
@@ -126,23 +126,23 @@ function modify_filter($id)
 {
     $code = CourseRequestManager::get_course_request_code($id);
     $result = '<a href="course_request_edit.php?id='.$id.'&caller=1">'.
-        Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
+        Display::return_icon('edit.png', get_lang('Edit'), ['style' => 'vertical-align: middle;']).'</a>'.
         '&nbsp;<a href="?delete_course_request='.$id.'">'.
         Display::return_icon(
             'delete.png',
             get_lang('DeleteThisCourseRequest'),
-            array(
+            [
                 'style' => 'vertical-align: middle;',
                 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;',
-            )
+            ]
         ).
         '</a>';
 
     return $result;
 }
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 $tool_name = get_lang('AcceptedCourseRequests');
 
 // Display confirmation or error message.
@@ -189,7 +189,7 @@ $table->set_header(4, get_lang('Teacher'));
 $table->set_header(5, get_lang('CourseRequestDate'));
 $table->set_header(6, '', false);
 $table->set_column_filter(6, 'modify_filter');
-$table->set_form_actions(array('delete_course_requests' => get_lang('DeleteCourseRequests')), 'course_request');
+$table->set_form_actions(['delete_course_requests' => get_lang('DeleteCourseRequests')], 'course_request');
 $table->display();
 
 /* FOOTER */

+ 7 - 7
main/admin/course_request_edit.php

@@ -48,7 +48,7 @@ if ($course_validation_feature) {
         $form->addElement('header', $tool_name);
 
         // Title.
-        $form->addElement('text', 'title', get_lang('CourseName'), array('size' => '60', 'id' => 'title'));
+        $form->addElement('text', 'title', get_lang('CourseName'), ['size' => '60', 'id' => 'title']);
         $form->applyFilter('title', 'html_filter');
         $form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
 
@@ -60,7 +60,7 @@ if ($course_validation_feature) {
             'category_code',
             get_lang('CourseFaculty'),
             null,
-            array('url' => $url)
+            ['url' => $url]
         );
 
         if (!empty($course_request_info['category_code'])) {
@@ -69,13 +69,13 @@ if ($course_validation_feature) {
         }
 
         // Course code.
-        $form->addText('wanted_code', get_lang('Code'), false, array('size' => '$maxlength', 'maxlength' => $maxlength));
+        $form->addText('wanted_code', get_lang('Code'), false, ['size' => '$maxlength', 'maxlength' => $maxlength]);
         $form->applyFilter('wanted_code', 'html_filter');
         $form->addRule('wanted_code', get_lang('Max'), 'maxlength', $maxlength);
         $form->addRule('wanted_code', get_lang('ThisFieldIsRequired'), 'required');
 
         // The teacher.
-        $titular = $form->addText('tutor_name', get_lang('Professor'), null, array('size' => '60', 'disabled' => 'disabled'));
+        $titular = $form->addText('tutor_name', get_lang('Professor'), null, ['size' => '60', 'disabled' => 'disabled']);
 
         // Description of the requested course.
         $form->addElement('textarea', 'description', get_lang('Description'));
@@ -151,7 +151,7 @@ if ($course_validation_feature) {
                 : !CourseRequestManager::course_code_exists($course_request_values['wanted_code']);
 
             if ($course_code_ok) {
-                $message = array();
+                $message = [];
 
                 // Update the course request.
                 $update_ok = CourseRequestManager::update_course_request(
@@ -318,8 +318,8 @@ function get_caller_name($caller_id)
 }
 
 // The header.
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 
 Display :: display_header($tool_name);
 

+ 11 - 11
main/admin/course_request_rejected.php

@@ -141,7 +141,7 @@ function get_request_data($from, $number_of_items, $column, $direction)
     $sql .= " LIMIT $from,$number_of_items";
     $res = Database :: query($sql);
 
-    $course_requests = array();
+    $course_requests = [];
     while ($course_request = Database :: fetch_row($res)) {
         $course_request[5] = api_get_local_time($course_request[5]);
         $course_requests[] = $course_request;
@@ -157,15 +157,15 @@ function modify_filter($id)
 {
     $code = CourseRequestManager::get_course_request_code($id);
     $result = '<a href="course_request_edit.php?id='.$id.'&caller=2">'.
-        Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
+        Display::return_icon('edit.png', get_lang('Edit'), ['style' => 'vertical-align: middle;']).'</a>'.
         '&nbsp;<a href="?accept_course_request='.$id.'">'.
         Display::return_icon(
             'accept.png',
             get_lang('AcceptThisCourseRequest'),
-            array(
+            [
                 'style' => 'vertical-align: middle;',
                 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;',
-            )
+            ]
         ).
         '</a>';
     if (!CourseRequestManager::additional_info_asked($id)) {
@@ -173,10 +173,10 @@ function modify_filter($id)
             Display::return_icon(
                 'request_info.gif',
                 get_lang('AskAdditionalInfo'),
-                array(
+                [
                     'style' => 'vertical-align: middle;',
                     'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;',
-                )
+                ]
             ).
             '</a>';
     }
@@ -184,18 +184,18 @@ function modify_filter($id)
         Display::return_icon(
             'delete.png',
             get_lang('DeleteThisCourseRequest'),
-            array(
+            [
                 'style' => 'vertical-align: middle;',
                 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;',
-            )
+            ]
         ).
         '</a>';
 
     return $result;
 }
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 
 $tool_name = get_lang('RejectedCourseRequests');
 
@@ -245,7 +245,7 @@ $table->set_header(4, get_lang('Teacher'));
 $table->set_header(5, get_lang('CourseRequestDate'));
 $table->set_header(6, '', false);
 $table->set_column_filter(6, 'modify_filter');
-$table->set_form_actions(array('delete_course_requests' => get_lang('DeleteCourseRequests')), 'course_request');
+$table->set_form_actions(['delete_course_requests' => get_lang('DeleteCourseRequests')], 'course_request');
 $table->display();
 
 Display::display_footer();

+ 9 - 9
main/admin/course_request_review.php

@@ -160,7 +160,7 @@ function get_request_data($from, $number_of_items, $column, $direction)
     $sql .= " LIMIT $from,$number_of_items";
     $res = Database::query($sql);
 
-    $course_requests = array();
+    $course_requests = [];
     while ($course_request = Database::fetch_row($res)) {
         if (DELETE_ACTION_ENABLED) {
             $course_request[5] = api_get_local_time($course_request[5]);
@@ -192,25 +192,25 @@ function modify_filter($id)
 {
     $code = CourseRequestManager::get_course_request_code($id);
     $result = '<a href="course_request_edit.php?id='.$id.'&caller=0">'.
-        Display::return_icon('edit.png', get_lang('Edit'), array('style' => 'vertical-align: middle;')).'</a>'.
+        Display::return_icon('edit.png', get_lang('Edit'), ['style' => 'vertical-align: middle;']).'</a>'.
         '&nbsp;<a href="?accept_course_request='.$id.'">'.
-        Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'), 16).'</a>'.
+        Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), ['style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'], 16).'</a>'.
         '&nbsp;<a href="?reject_course_request='.$id.'">'.
-        Display::return_icon('error.png', get_lang('RejectThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeRejected'), $code), ENT_QUOTES)).'\')) return false;'), 16).'</a>';
+        Display::return_icon('error.png', get_lang('RejectThisCourseRequest'), ['style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeRejected'), $code), ENT_QUOTES)).'\')) return false;'], 16).'</a>';
     if (!CourseRequestManager::additional_info_asked($id)) {
         $result .= '&nbsp;<a href="?request_info='.$id.'">'.
-            Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
+            Display::return_icon('request_info.gif', get_lang('AskAdditionalInfo'), ['style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('AdditionalInfoWillBeAsked'), $code), ENT_QUOTES)).'\')) return false;']).'</a>';
     }
     if (DELETE_ACTION_ENABLED) {
         $result .= '&nbsp;<a href="?delete_course_request='.$id.'">'
-            .Display::return_icon('delete.png', get_lang('DeleteThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;')).'</a>';
+            .Display::return_icon('delete.png', get_lang('DeleteThisCourseRequest'), ['style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;']).'</a>';
     }
 
     return $result;
 }
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'course_list.php', 'name' => get_lang('CourseList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'course_list.php', 'name' => get_lang('CourseList')];
 
 $tool_name = get_lang('ReviewCourseRequests');
 
@@ -265,7 +265,7 @@ $table->set_header(5 + $offet, '', false);
 $table->set_column_filter(3 + $offet, 'email_filter');
 $table->set_column_filter(5 + $offet, 'modify_filter');
 if (DELETE_ACTION_ENABLED) {
-    $table->set_form_actions(array('delete_course_requests' => get_lang('DeleteCourseRequests')), 'course_request');
+    $table->set_form_actions(['delete_course_requests' => get_lang('DeleteCourseRequests')], 'course_request');
 }
 $table->display();
 

+ 11 - 12
main/admin/course_user_import.php

@@ -12,12 +12,12 @@
  */
 function validate_data($users_courses)
 {
-    $errors = array();
-    $coursecodes = array();
+    $errors = [];
+    $coursecodes = [];
     foreach ($users_courses as $index => $user_course) {
         $user_course['line'] = $index + 1;
         // 1. Check whether mandatory fields are set.
-        $mandatory_fields = array('UserName', 'CourseCode', 'Status');
+        $mandatory_fields = ['UserName', 'CourseCode', 'Status'];
         foreach ($mandatory_fields as $key => $field) {
             if (!isset($user_course[$field]) || strlen($user_course[$field]) == 0) {
                 $user_course['error'] = get_lang($field.'Mandatory');
@@ -70,8 +70,8 @@ function save_data($users_courses)
 {
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
-    $csv_data = array();
-    $inserted_in_course = array();
+    $csv_data = [];
+    $inserted_in_course = [];
     $courseListCache = [];
     $courseListById = [];
     foreach ($users_courses as $user_course) {
@@ -94,7 +94,7 @@ function save_data($users_courses)
         $sql = "SELECT * FROM $course_user_table cu
                 WHERE cu.user_id = $user_id AND cu.relation_type <> ".COURSE_RELATION_TYPE_RRHH." ";
         $res = Database::query($sql);
-        $db_subscriptions = array();
+        $db_subscriptions = [];
         while ($obj = Database::fetch_object($res)) {
             $db_subscriptions[$obj->c_id] = $obj->status;
         }
@@ -107,13 +107,12 @@ function save_data($users_courses)
                 $courseInfo = $courseListById[$courseId];
                 $courseCode = $courseInfo['code'];
 
-                    CourseManager::subscribe_user(
+                CourseManager::subscribe_user(
                         $user_id,
                         $courseCode,
                         $csv_subscriptions[$courseId]
                     );
-                    $inserted_in_course[$courseInfo['code']] = $courseInfo['title'];
-
+                $inserted_in_course[$courseInfo['code']] = $courseInfo['title'];
             }
         }
 
@@ -152,7 +151,7 @@ api_protect_admin_script();
 
 $tool_name = get_lang('AddUsersToACourse').' CSV';
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 
@@ -163,8 +162,8 @@ $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
 $form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
 $form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
 $form->addButtonImport(get_lang('Import'));
-$form->setDefaults(array('subscribe' => '1', 'unsubscribe' => 1));
-$errors = array();
+$form->setDefaults(['subscribe' => '1', 'unsubscribe' => 1]);
+$errors = [];
 
 if ($form->validate()) {
     $users_courses = parse_csv_data($_FILES['import_file']['tmp_name']);

+ 9 - 9
main/admin/course_user_import_by_email.php

@@ -11,12 +11,12 @@ exit;
  */
 function validate_data($users_courses)
 {
-    $errors = array();
-    $coursecodes = array();
+    $errors = [];
+    $coursecodes = [];
     foreach ($users_courses as $index => $user_course) {
         $user_course['line'] = $index + 1;
         // 1. Check whether mandatory fields are set.
-        $mandatory_fields = array('Email', 'CourseCode', 'Status');
+        $mandatory_fields = ['Email', 'CourseCode', 'Status'];
         foreach ($mandatory_fields as $key => $field) {
             if (!isset($user_course[$field]) || strlen($user_course[$field]) == 0) {
                 $user_course['error'] = get_lang($field.'Mandatory');
@@ -70,8 +70,8 @@ function save_data($users_courses)
 {
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
-    $csv_data = array();
-    $inserted_in_course = array();
+    $csv_data = [];
+    $inserted_in_course = [];
 
     foreach ($users_courses as $user_course) {
         $csv_data[$user_course['Email']][$user_course['CourseCode']] = $user_course['Status'];
@@ -87,7 +87,7 @@ function save_data($users_courses)
         $sql = "SELECT * FROM $course_user_table cu
                 WHERE cu.user_id = $user_id AND cu.relation_type <> ".COURSE_RELATION_TYPE_RRHH." ";
         $res = Database::query($sql);
-        $db_subscriptions = array();
+        $db_subscriptions = [];
         while ($obj = Database::fetch_object($res)) {
             $db_subscriptions[$obj->c_id] = $obj->status;
         }
@@ -153,7 +153,7 @@ api_protect_admin_script();
 
 $tool_name = get_lang('AddUsersToACourse').' CSV';
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 
@@ -164,8 +164,8 @@ $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
 $form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
 $form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
 $form->addButtonImport(get_lang('Import'));
-$form->setDefaults(array('subscribe' => '1', 'unsubscribe' => 1));
-$errors = array();
+$form->setDefaults(['subscribe' => '1', 'unsubscribe' => 1]);
+$errors = [];
 
 if ($form->validate()) {
     $users_courses = parse_csv_data($_FILES['import_file']['tmp_name']);

+ 14 - 11
main/admin/dashboard_add_courses_to_user.php

@@ -20,8 +20,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'user_list.php', 'name' => get_lang('UserList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'user_list.php', 'name' => get_lang('UserList')];
 
 // Database Table Definitions
 $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
@@ -153,7 +153,7 @@ function remove_item(origin) {
 
 $formSent = 0;
 $errorMsg = $firstLetterCourse = '';
-$UserList = array();
+$UserList = [];
 
 $msg = '';
 if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
@@ -173,7 +173,7 @@ $actionsLeft = '<a href="dashboard_add_users_to_user.php?user='.$user_id.'">'.
 $actionsLeft .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.
     Display::return_icon('session-add.png', get_lang('AssignSessions'), null, ICON_SIZE_MEDIUM).'</a>';
 
-echo $html = Display::toolbarAction('toolbar-dashboard', array($actionsLeft));
+echo $html = Display::toolbarAction('toolbar-dashboard', [$actionsLeft]);
 
 echo Display::page_header(
     sprintf(get_lang('AssignCoursesToX'), api_get_person_name($user_info['firstname'], $user_info['lastname'])),
@@ -208,7 +208,6 @@ if (api_is_multiple_url_enabled()) {
                 c.code LIKE '$needle' $without_assigned_courses AND
                 access_url_id = ".api_get_current_access_url_id()."
             ORDER BY c.title";
-
 } else {
     $sql = " SELECT c.code, c.title
             FROM $tbl_course c
@@ -233,22 +232,26 @@ if (!empty($msg)) {
 
         <div id="ajax_list_courses_multiple">
     <select id="origin" name="NoAssignedCoursesList[]" multiple="multiple" size="20" style="width:340px;">
-    <?php while ($enreg = Database::fetch_array($result)) { ?>
+    <?php while ($enreg = Database::fetch_array($result)) {
+    ?>
             <option value="<?php echo $enreg['code']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'], ENT_QUOTES).'"'; ?>><?php echo $enreg['title'].' ('.$enreg['code'].')'; ?></option>
-    <?php } ?>
+    <?php
+} ?>
     </select>
         </div>
 
     </div>
     <div class="col-md-4">
         <div class="code-course">
-        <?php if ($add_type == 'multiple') { ?>
+        <?php if ($add_type == 'multiple') {
+        ?>
         <p><?php echo get_lang('FirstLetterCourse'); ?> :</p>
         <select name="firstLetterCourse" class="selectpicker form-control" onchange = "xajax_search_courses(this.value,'multiple')">
             <option value="%">--</option>
             <?php  echo Display :: get_alphabet_options($firstLetter); ?>
         </select>
-        <?php } ?>
+        <?php
+    } ?>
         </div>
         <div class="control-course">
             <div class="separate-action">
@@ -281,11 +284,11 @@ if (!empty($msg)) {
             <?php
             if (is_array($assigned_courses_to_hrm)) {
                 foreach ($assigned_courses_to_hrm as $enreg) {
-            ?>
+                    ?>
                 <option value="<?php echo $enreg['code']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'], ENT_QUOTES).'"'; ?>><?php echo $enreg['title'].' ('.$enreg['code'].')'; ?></option>
             <?php
-                    }
                 }
+            }
             ?>
         </select>
     </div>

+ 19 - 11
main/admin/dashboard_add_sessions_to_user.php

@@ -21,8 +21,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'user_list.php', 'name' => get_lang('UserList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'user_list.php', 'name' => get_lang('UserList')];
 
 // Database Table Definitions
 $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
@@ -153,7 +153,7 @@ function remove_item(origin) {
 $formSent = 0;
 $firstLetterSession = isset($_POST['firstLetterSession']) ? $_POST['firstLetterSession'] : null;
 $errorMsg = '';
-$UserList = array();
+$UserList = [];
 
 if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
     $sessions_list = $_POST['SessionsList'];
@@ -179,7 +179,7 @@ if ($user_info['status'] != SESSIONADMIN) {
     $actionsLeft .= '<a href="dashboard_add_courses_to_user.php?user='.$user_id.'">'.
         Display::return_icon('course-add.png', get_lang('AssignCourses'), null, ICON_SIZE_MEDIUM).'</a>';
 
-    echo Display::toolbarAction('toolbar-dashboard', array($actionsLeft));
+    echo Display::toolbarAction('toolbar-dashboard', [$actionsLeft]);
 }
 
 echo Display::page_header(
@@ -216,7 +216,9 @@ if (api_is_multiple_url_enabled()) {
 }
 $result = Database::query($sql);
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" style="margin:0px;" <?php if ($ajax_search) { echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" style="margin:0px;" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
     <input type="hidden" name="formSent" value="1" />
 
     <div class="row">
@@ -226,23 +228,26 @@ $result = Database::query($sql);
                 <select id="origin" name="NoAssignedSessionsList[]" multiple="multiple" size="20" style="width:340px;">
                     <?php
                     while ($enreg = Database::fetch_array($result)) {
-                    ?>
+                        ?>
                         <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"'; ?>>
                             <?php echo $enreg['name']; ?>
                         </option>
-                    <?php } ?>
+                    <?php
+                    } ?>
                 </select>
             </div>
         </div>
         <div class="col-md-4">
             <div class="code-course">
-                <?php if ($add_type == 'multiple') { ?>
+                <?php if ($add_type == 'multiple') {
+                        ?>
                 <p><?php echo get_lang('FirstLetterSession'); ?> :</p>
                 <select class="selectpicker form-control" name="firstLetterSession" onchange = "xajax_search_sessions(this.value, 'multiple')">
                     <option value="%">--</option>
                         <?php  echo Display :: get_alphabet_options($firstLetterSession); ?>
                 </select>
-                <?php } ?>
+                <?php
+                    } ?>
             </div>
             <div class="control-course">
             <?php
@@ -253,7 +258,9 @@ $result = Database::query($sql);
                             <em class="fa fa-arrow-left"></em>
                         </button>
                     </div>
-                <?php } else { ?>
+                <?php
+                } else {
+                    ?>
                 <div class="separate-action">
                     <button class="btn btn-primary" type="button" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))">
                         <em class="fa fa-arrow-right"></em>
@@ -291,7 +298,8 @@ $result = Database::query($sql);
                         <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"'; ?>>
                             <?php echo $enreg['name'] ?>
                         </option>
-                <?php }
+                <?php
+                    }
                 }?>
             </select>
         </div>

+ 35 - 30
main/admin/dashboard_add_users_to_user.php

@@ -23,8 +23,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'user_list.php', 'name' => get_lang('UserList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'user_list.php', 'name' => get_lang('UserList')];
 
 // Database Table Definitions
 $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -69,11 +69,10 @@ function search_users($needle, $type)
     $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
-        $assigned_users_to_hrm = array();
+        $assigned_users_to_hrm = [];
 
         switch ($userStatus) {
             case DRH:
-                //no break;
             case PLATFORM_ADMIN:
                 $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
                 break;
@@ -108,7 +107,6 @@ function search_users($needle, $type)
                         access_url_id = ".api_get_current_access_url_id()."
                     $order_clause
                     ";
-
         } else {
             $sql = "SELECT user_id, username, lastname, firstname
                     FROM $tbl_user user
@@ -248,16 +246,16 @@ function remove_item(origin) {
 
 $formSent = 0;
 $errorMsg = '';
-$UserList = array();
+$UserList = [];
 
 // Filters
-$filters = array(
-    array('type' => 'text', 'name' => 'username', 'label' => get_lang('Username')),
-    array('type' => 'text', 'name' => 'firstname', 'label' => get_lang('FirstName')),
-    array('type' => 'text', 'name' => 'lastname', 'label' => get_lang('LastName')),
-    array('type' => 'text', 'name' => 'official_code', 'label' => get_lang('OfficialCode')),
-    array('type' => 'text', 'name' => 'email', 'label' => get_lang('Email'))
-);
+$filters = [
+    ['type' => 'text', 'name' => 'username', 'label' => get_lang('Username')],
+    ['type' => 'text', 'name' => 'firstname', 'label' => get_lang('FirstName')],
+    ['type' => 'text', 'name' => 'lastname', 'label' => get_lang('LastName')],
+    ['type' => 'text', 'name' => 'official_code', 'label' => get_lang('OfficialCode')],
+    ['type' => 'text', 'name' => 'email', 'label' => get_lang('Email')]
+];
 
 $searchForm = new FormValidator('search', 'get', api_get_self().'?user='.$user_id);
 $searchForm->addHeader(get_lang('AdvancedSearch'));
@@ -269,12 +267,12 @@ foreach ($filters as $param) {
 }
 $searchForm->addButtonSearch(get_lang('Search'));
 
-$filterData = array();
+$filterData = [];
 if ($searchForm->validate()) {
     $filterData = $searchForm->getSubmitValues();
 }
 
-$conditions = array();
+$conditions = [];
 if (!empty($filters) && !empty($filterData)) {
     foreach ($filters as $filter) {
         if (isset($filter['name']) && isset($filterData[$filter['name']])) {
@@ -290,7 +288,6 @@ if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) {
     $user_list = isset($_POST['UsersList']) ? $_POST['UsersList'] : null;
     switch ($userStatus) {
         case DRH:
-            //no break;
         case PLATFORM_ADMIN:
             $affected_rows = UserManager::subscribeUsersToHRManager($user_id, $user_list);
             break;
@@ -329,7 +326,7 @@ if ($userStatus != STUDENT_BOSS) {
 $actionsRight = Display::url(
     '<em class="fa fa-search"></em> '.get_lang('AdvancedSearch'),
     '#',
-    array('class' => 'btn btn-default advanced_options', 'id' => 'advanced_search')
+    ['class' => 'btn btn-default advanced_options', 'id' => 'advanced_search']
 );
 
 $toolbar = Display::toolbarAction('toolbar-dashboard', [$actionsLeft, $actionsRight]);
@@ -348,11 +345,10 @@ echo Display::page_header(
     'h3'
 );
 
-$assigned_users_to_hrm = array();
+$assigned_users_to_hrm = [];
 
 switch ($userStatus) {
     case DRH:
-        //no break;
     case PLATFORM_ADMIN:
         $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
         break;
@@ -375,7 +371,7 @@ if (!empty($firstLetterUser)) {
 
 $sqlConditions = null;
 if (!empty($conditions)) {
-    $temp_conditions = array();
+    $temp_conditions = [];
     foreach ($conditions as $field => $value) {
         $field = Database::escape_string($field);
         $value = Database::escape_string($value);
@@ -414,7 +410,9 @@ if (api_is_multiple_url_enabled()) {
 }
 $result = Database::query($sql);
 ?>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" class="form-horizontal" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?user=<?php echo $user_id ?>" class="form-horizontal" <?php if ($ajax_search) {
+    echo ' onsubmit="valide();"';
+}?>>
 <input type="hidden" name="formSent" value="1" />
 <div class="row">
     <div class="col-md-4">
@@ -429,7 +427,8 @@ $result = Database::query($sql);
                             <option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name, ENT_QUOTES).'"'; ?>>
                             <?php echo $person_name.' ('.$enreg['username'].')'; ?>
                             </option>
-                        <?php } ?>
+                        <?php
+                        } ?>
                     </select>
                 </div>
             </div>
@@ -437,20 +436,25 @@ $result = Database::query($sql);
     </div>
     <div class="col-md-4">
         <div class="code-course">
-            <?php if ($add_type == 'multiple') { ?>
+            <?php if ($add_type == 'multiple') {
+                            ?>
                 <p><?php echo get_lang('FirstLetterUser'); ?></p>
                 <select class="selectpicker show-tick form-control" name="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple')">
                     <option value="%">--</option>
                     <?php echo Display::get_alphabet_options($firstLetterUser); ?>
                 </select>
-            <?php } ?>
+            <?php
+                        } ?>
         </div>
         <div class="control-course">
-        <?php if ($ajax_search) { ?>
+        <?php if ($ajax_search) {
+                            ?>
             <div class="separate-action">
                 <button class="btn btn-primary" type="button" onclick="remove_item(document.getElementById('destination'))"></button>
             </div>
-        <?php } else { ?>
+        <?php
+                        } else {
+                            ?>
             <div class="separate-action">
                 <button id="add_user_button" class="btn btn-primary" type="button" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))">
                 <em class="fa fa-chevron-right"></em>
@@ -461,7 +465,8 @@ $result = Database::query($sql);
                 <em class="fa fa-chevron-left"></em>
                 </button>
             </div>
-        <?php } ?>
+        <?php
+                        } ?>
             <div class="separate-action">
         <?php
         echo '<button id="assign_user" class="btn btn-success" type="button" value="" onclick="valide()" >'.$tool_name.'</button>';
@@ -492,12 +497,12 @@ $result = Database::query($sql);
                     <?php
                     if (is_array($assigned_users_to_hrm)) {
                         foreach ($assigned_users_to_hrm as $enreg) {
-                            $person_name = api_get_person_name($enreg['firstname'], $enreg['lastname']);
-                    ?>
+                            $person_name = api_get_person_name($enreg['firstname'], $enreg['lastname']); ?>
                             <option value="<?php echo $enreg['user_id']; ?>" <?php echo 'title="'.htmlspecialchars($person_name, ENT_QUOTES).'"'; ?>>
                             <?php echo $person_name.' ('.$enreg['username'].')'; ?>
                             </option>
-                        <?php }
+                        <?php
+                        }
                     }?>
                 </select>
             </div>

+ 12 - 12
main/admin/event_controller.php

@@ -41,23 +41,23 @@ switch ($action) {
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_event_email_template';
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(
+$columns = [
     get_lang('Subject'),
     get_lang('EventTypeName'),
     get_lang('Language'),
     get_lang('Status'),
     get_lang('Actions'),
-);
+];
 
 //Column config
-$column_model = array(
-    array('name' => 'subject', 'index' => 'subject', 'width' => '80', 'align' => 'left'),
+$column_model = [
+    ['name' => 'subject', 'index' => 'subject', 'width' => '80', 'align' => 'left'],
 //                        array('name'=>'message',        'index'=>'message', 'width'=>'500',  'align'=>'left','sortable'=>'false'),
-    array('name' => 'event_type_name', 'index' => 'event_type_name', 'width' => '80', 'align' => 'left'),
-    array('name' => 'language_id', 'index' => 'language_id', 'width' => '80', 'align' => 'left'),
-    array('name' => 'activated', 'index' => 'activated', 'width' => '80', 'align' => 'left'),
-    array('name' => 'actions', 'index' => 'actions', 'width' => '100'),
-);
+    ['name' => 'event_type_name', 'index' => 'event_type_name', 'width' => '80', 'align' => 'left'],
+    ['name' => 'language_id', 'index' => 'language_id', 'width' => '80', 'align' => 'left'],
+    ['name' => 'activated', 'index' => 'activated', 'width' => '80', 'align' => 'left'],
+    ['name' => 'actions', 'index' => 'actions', 'width' => '100'],
+];
 //Autowidth
 $extra_params['autowidth'] = 'true';
 //height auto
@@ -66,12 +66,12 @@ $extra_params['height'] = 'auto';
 $htmlHeadXtra[] = api_get_jqgrid_js();
 $htmlHeadXtra[] = '<script>
 $(function() {
-    '.Display::grid_js('event_email_template', $url, $columns, $column_model, $extra_params, array(), $action_links, true).'
+    '.Display::grid_js('event_email_template', $url, $columns, $column_model, $extra_params, [], $action_links, true).'
 });
 </script>';
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Events'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Events')];
 
 $tpl = new Template($tool_name);
 $tpl->assign('message', $message);

+ 13 - 13
main/admin/event_type.php

@@ -30,7 +30,7 @@ if ($action == 'modEventType') {
     if ($eventUsers) {
         $users = explode(';', $eventUsers);
     } else {
-        $users = array();
+        $users = [];
     }
     if (!empty($event_name)) {
         $eventName = $event_name;
@@ -51,21 +51,21 @@ $ets = Event::get_all_event_types();
 $languages = api_get_languages();
 $ajaxPath = api_get_path(WEB_CODE_PATH).'inc/ajax/events.ajax.php';
 
-$action_array = array(
-    array(
+$action_array = [
+    [
         'url' => 'event_controller.php?action=listing',
         'content' => Display::return_icon(
             'view_text.png',
             get_lang('ListView'),
-            array(),
+            [],
             ICON_SIZE_MEDIUM
         ),
-    )
-);
+    ]
+];
 
 $key_lang = get_lang('YouHaveSomeUnsavedChanges');
-$users = UserManager::get_user_list(array(), array('firstname'));
-$new_user_list = array();
+$users = UserManager::get_user_list([], ['firstname']);
+$new_user_list = [];
 foreach ($users as $user) {
     if ($user['status'] == ANONYMOUS) {
         continue;
@@ -76,8 +76,8 @@ foreach ($users as $user) {
 /**
  * Header definition
  */
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'event_controller.php', 'name' => get_lang('Events'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'event_controller.php', 'name' => get_lang('Events')];
 $tool_name = get_lang('EventMessageManagement');
 
 Display::display_header($tool_name);
@@ -358,11 +358,12 @@ echo Display::actions($action_array);
     <br />
     <select id="languages" name="languages" style="margin-top:20px;" onclick='confirmMessage(this.name); return false;'>
 <?php foreach ($languages["name"] as $key => $value) {
-    $english_name = $languages['folder'][$key]; ?>
+            $english_name = $languages['folder'][$key]; ?>
     <option value="<?php echo $english_name; ?>" <?php echo ($english_name == api_get_interface_language()) ? "selected=selected" : ""; ?>>
         <?php echo $value; ?>
     </option>
-<?php } ?>
+<?php
+        } ?>
     </select>
 
     <input type="hidden" name="action" value="modEventType" />
@@ -403,4 +404,3 @@ echo Display::actions($action_array);
 </form>
 <?php
 Display :: display_footer();
-

+ 2 - 2
main/admin/export_certificates.php

@@ -11,7 +11,7 @@ Display::display_header(null);
 
 $form = new FormValidator('export_certificate');
 $courses = CourseManager::get_courses_list(0, 0, 'title');
-$options = array();
+$options = [];
 foreach ($courses as $course) {
     $options[$course['id']] = $course['title'];
 }
@@ -42,7 +42,7 @@ if ($form->validate()) {
 
         if (isset($cats[0])) {
             /** @var Category $cat */
-            $userList = array();
+            $userList = [];
             foreach ($users as $user) {
                 $userInfo = api_get_user_info_from_official_code(
                     $user['official_code']

+ 2 - 2
main/admin/extra_field_list.php

@@ -5,13 +5,13 @@ require_once __DIR__.'/../inc/global.inc.php';
 
 api_protect_global_admin_script();
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $template = new Template(get_lang('ExtraFields'));
 
 $types = ExtraField::getValidExtraFieldTypes();
 
-$table = new HTML_Table(array('class' => 'table'));
+$table = new HTML_Table(['class' => 'table']);
 $table->setHeaderContents(0, 0, get_lang('Type'));
 $table->setHeaderContents(0, 1, get_lang('Actions'));
 $url = api_get_path(WEB_CODE_PATH).'admin/extra_fields.php?type=';

+ 32 - 32
main/admin/extra_field_options.php

@@ -17,7 +17,7 @@ api_protect_admin_script();
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $tool_name = null;
 
@@ -38,34 +38,34 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName];
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
         'name' => $extra_field_info['display_text'],
-    );
-    $interbreadcrumb[] = array(
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'],
         'name' => get_lang('EditExtraFieldOptions'),
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName];
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
         'name' => $extra_field_info['display_text'],
-    );
-    $interbreadcrumb[] = array(
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'],
         'name' => get_lang('EditExtraFieldOptions'),
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
 } else {
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName];
+    $interbreadcrumb[] = [
         'url' =>  'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
         'name' => $extra_field_info['display_text']
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditExtraFieldOptions'));
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('EditExtraFieldOptions')];
 }
 
 //jqgrid will use this URL to do the selects
@@ -73,44 +73,44 @@ $params = 'field_id='.$field_id.'&type='.$extra_field->type;
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_extra_field_options&'.$params;
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(
+$columns = [
     get_lang('Name'),
     get_lang('Value'),
     get_lang('Order'),
     get_lang('Actions'),
-);
+];
 
 //Column config
-$column_model = array(
-    array(
+$column_model = [
+    [
         'name' => 'display_text',
         'index' => 'display_text',
         'width' => '180',
         'align' => 'left',
-    ),
-    array(
+    ],
+    [
         'name' => 'option_value',
         'index' => 'option_value',
         'width' => '',
         'align' => 'left',
         'sortable' => 'false',
-    ),
-    array(
+    ],
+    [
         'name' => 'option_order',
         'index' => 'option_order',
         'width' => '',
         'align' => 'left',
         'sortable' => 'false',
-    ),
-    array(
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '100',
         'align' => 'left',
         'formatter' => 'action_formatter',
         'sortable' => 'false',
-    ),
-);
+    ],
+];
 
 //Autowidth
 $extra_params['autowidth'] = 'true';
@@ -133,7 +133,7 @@ $(function() {
         $columns,
         $column_model,
         $extra_params,
-        array(),
+        [],
         $action_links,
         true
     ).'
@@ -167,7 +167,7 @@ switch ($action) {
             $obj->display();
         } else {
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;
@@ -190,7 +190,7 @@ switch ($action) {
             $obj->display();
         } else {
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;

+ 37 - 38
main/admin/extra_field_workflow.php

@@ -14,7 +14,7 @@ $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
 api_protect_admin_script();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $tool_name = null;
 
@@ -35,44 +35,44 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extraField->type, 'name' => $extraField->pageName);
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = ['url' => 'extra_fields.php?type='.$extraField->type, 'name' => $extraField->pageName];
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
         'name' => $extraFieldInfo['display_text']
-    );
-    $interbreadcrumb[] = array(
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_field_options.php?type='.$extraField->type.'&field_id='.$extraFieldInfo['id'],
         'name' => get_lang('EditExtraFieldOptions')
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type,
         'name' => $extraField->pageName
-    );
-    $interbreadcrumb[] = array(
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
         'name' => $extraFieldInfo['display_text']
-    );
-    $interbreadcrumb[] = array(
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_field_options.php?type='.$extraField->type.'&field_id='.$extraFieldInfo['id'],
         'name' => get_lang('EditExtraFieldOptions')
-    );
+    ];
 
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
 } else {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type,
         'name' => $extraField->pageName
-    );
-    $interbreadcrumb[] = array(
+    ];
+    $interbreadcrumb[] = [
         'url' => 'extra_fields.php?type='.$extraField->type.'&action=edit&id='.$extraFieldInfo['id'],
         'name' => $extraFieldInfo['display_text']
-    );
-    $interbreadcrumb[] = array(
+    ];
+    $interbreadcrumb[] = [
         'url' => '#',
         'name' => get_lang('EditExtraFieldOptions')
-    );
+    ];
 }
 
 $roleId = isset($_REQUEST['roleId']) ? $_REQUEST['roleId'] : null;
@@ -82,7 +82,7 @@ $params = 'field_id='.$field_id.'&type='.$extraField->type.'&roleId='.$roleId;
 $paramsNoRole = 'field_id='.$field_id.'&type='.$extraField->type;
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(get_lang('Name'), get_lang('Value'), get_lang('Order'), get_lang('Actions'));
+$columns = [get_lang('Name'), get_lang('Value'), get_lang('Order'), get_lang('Actions')];
 
 $htmlHeadXtra[] = '<script>
     function setHidden(obj) {
@@ -119,17 +119,17 @@ Display::display_header($tool_name);
 echo Display::page_header($extraFieldInfo['display_text']);
 
 $obj = new ExtraFieldOption($type);
-$columns = array('display_text', 'option_value', 'option_order');
+$columns = ['display_text', 'option_value', 'option_order'];
 $result = Database::select(
     '*',
     $obj->table,
-    array(
-        'where' => array("field_id = ? " => $field_id),
+    [
+        'where' => ["field_id = ? " => $field_id],
         'order' => "option_order ASC"
-    )
+    ]
 );
 
-$table = new HTML_Table(array('class' => 'data_table'));
+$table = new HTML_Table(['class' => 'data_table']);
 $column = 0;
 $row = 0;
 $table->setHeaderContents($row, $column, get_lang('CurrentStatus'));
@@ -144,12 +144,12 @@ $form = new FormValidator('workflow', 'post', api_get_self().'?'.$params);
 $options = api_get_user_roles();
 $options[0] = get_lang('SelectAnOption');
 ksort($options);
-$form->addElement('select', 'status', get_lang('SelectRole'), $options, array('onclick' => 'changeStatus(this)'));
+$form->addElement('select', 'status', get_lang('SelectRole'), $options, ['onclick' => 'changeStatus(this)']);
 
 $checks = $app['orm.em']->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption')->findBy(
-    array('fieldId' => $field_id, 'roleId' => $roleId)
+    ['fieldId' => $field_id, 'roleId' => $roleId]
 );
-$includedFields = array();
+$includedFields = [];
 if (!empty($checks)) {
     foreach ($checks as $availableField) {
         $includedFields[$availableField->getFieldOptionId()][] = $availableField->getRelatedFieldOptionId();
@@ -165,7 +165,7 @@ foreach ($result as $item) {
     foreach ($result as $itemCol) {
         $id = 'extra_field_status_'.$item['id'].'_'.$itemCol['id'];
         $idForm = 'extra_field_status['.$item['id'].']['.$itemCol['id'].']';
-        $attributes = array('onclick' => 'setHidden(this)');
+        $attributes = ['onclick' => 'setHidden(this)'];
         $value = 0;
 
         if (isset($includedFields[$itemCol['id']]) && in_array($item['id'], $includedFields[$itemCol['id']])) {
@@ -175,7 +175,7 @@ foreach ($result as $item) {
 
         $element = Display::input('checkbox', $id, null, $attributes);
         $table->setCellContents($row, $column, $element);
-        $form->addElement('hidden', 'hidden_'.$idForm, $value, array('id' => 'hidden_'.$id));
+        $form->addElement('hidden', 'hidden_'.$idForm, $value, ['id' => 'hidden_'.$id]);
         $column++;
     }
     $row++;
@@ -183,13 +183,13 @@ foreach ($result as $item) {
 
 if (!empty($roleId)) {
     $form->addElement('html', $table->toHtml());
-    $group = array();
+    $group = [];
     $group[] = $form->createElement('button', 'submit', get_lang('Save'));
-    $group[] = $form->createElement('button', 'select_all', get_lang('SelectAll'), array('class' => 'btn select_all'));
-    $group[] = $form->createElement('button', 'unselect_all', get_lang('UnSelectAll'), array('class' => 'btn unselect_all'));
+    $group[] = $form->createElement('button', 'select_all', get_lang('SelectAll'), ['class' => 'btn select_all']);
+    $group[] = $form->createElement('button', 'unselect_all', get_lang('UnSelectAll'), ['class' => 'btn unselect_all']);
     $form->addGroup($group, '', null, ' ');
 
-    $form->setDefaults(array('status' => $roleId));
+    $form->setDefaults(['status' => $roleId]);
 } else {
     $form->addButtonUpdate(get_lang('Edit'));
 }
@@ -203,12 +203,12 @@ if ($form->validate()) {
         foreach ($result as $id => $items) {
             foreach ($items as $subItemId => $value) {
                 $extraFieldOptionRelFieldOption = $app['orm.em']->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption')->findOneBy(
-                    array(
+                    [
                     'fieldId' => $field_id,
                     'fieldOptionId' => $subItemId,
                     'roleId' => $roleId,
                     'relatedFieldOptionId' => $id
-                    )
+                    ]
                 );
 
                 if ($value == 1) {
@@ -225,7 +225,6 @@ if ($form->validate()) {
                         $app['orm.ems']['db_write']->remove($extraFieldOptionRelFieldOption);
                     }
                 }
-
             }
         }
         $app['orm.ems']['db_write']->flush();

+ 4 - 4
main/admin/extra_fields.php

@@ -19,7 +19,7 @@ api_protect_admin_script();
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $tool_name = null;
 
@@ -61,7 +61,7 @@ $(function() {
         $columns,
         $column_model,
         $extra_params,
-        array(),
+        [],
         $action_links,
         true
     ).'
@@ -136,7 +136,7 @@ switch ($action) {
             Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;
@@ -161,7 +161,7 @@ switch ($action) {
             Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;

+ 2 - 2
main/admin/filler.php

@@ -22,12 +22,12 @@ api_protect_admin_script(true);
 $nameTools = get_lang('PlatformAdmin');
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => $nameTools);
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => $nameTools];
 
 // setting the name of the tool
 $nameTools = get_lang('DataFiller');
 
-$output = array();
+$output = [];
 if (!empty($_GET['fill'])) {
     switch ($_GET['fill']) {
         case 'users':

+ 19 - 19
main/admin/grade_models.php

@@ -20,7 +20,7 @@ if (api_get_setting('gradebook_enable_grade_model') != 'true') {
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 
@@ -28,13 +28,13 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action === 'add') {
-    $interbreadcrumb[] = array('url' => 'grade_models.php', 'name' => get_lang('GradeModel'));
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
+    $interbreadcrumb[] = ['url' => 'grade_models.php', 'name' => get_lang('GradeModel')];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array('url' => 'grade_models.php', 'name' => get_lang('GradeModel'));
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    $interbreadcrumb[] = ['url' => 'grade_models.php', 'name' => get_lang('GradeModel')];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
 } else {
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradeModel'));
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('GradeModel')];
 }
 
 $htmlHeadXtra[] = '<script>
@@ -74,36 +74,36 @@ Display::display_header();
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_grade_models';
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(
+$columns = [
     get_lang('Name'),
     get_lang('Description'),
     get_lang('Actions'),
-);
+];
 
 //Column config
-$column_model = array(
-    array(
+$column_model = [
+    [
         'name' => 'name',
         'index' => 'name',
         'width' => '80',
         'align' => 'left'
-    ),
-    array(
+    ],
+    [
         'name' => 'description',
         'index' => 'description',
         'width' => '500',
         'align' => 'left',
         'sortable' => 'false'
-    ),
-    array(
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '100',
         'align' => 'left',
         'formatter' => 'action_formatter',
         'sortable' => 'false'
-    )
-);
+    ]
+];
 
 //Autowidth
 $extra_params['autowidth'] = 'true';
@@ -127,7 +127,7 @@ $(function() {
         $columns,
         $column_model,
         $extra_params,
-        array(),
+        [],
         $action_links,
         true
     );
@@ -163,7 +163,7 @@ switch ($action) {
                 '</a>';
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;
@@ -187,7 +187,7 @@ switch ($action) {
                 '</a>';
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;

+ 3 - 3
main/admin/gradebook_dependency.php

@@ -34,10 +34,10 @@ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
 $currentUrl = api_get_self().'?';
 $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
 
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => api_get_path(WEB_CODE_PATH).'admin/gradebook_list.php',
     'name' => get_lang('Gradebook')
-);
+];
 
 $tpl = new Template(get_lang('CourseList'));
 $toolbar = Display::url(
@@ -137,7 +137,7 @@ foreach ($dependencyList as $courseId => $courseInfo) {
                 } else {
                     if ($userResult[$userId]['result_not_mandatory_80'] < 80 && $result) {
                         $userResult[$userId]['result_not_mandatory_80'] += 10;
-                      //  var_dump($userResult[$userId]['result_80'] );
+                        //  var_dump($userResult[$userId]['result_80'] );
                     }
                 }
             }

+ 3 - 3
main/admin/gradebook_list.php

@@ -50,10 +50,10 @@ $toolName = get_lang('Gradebook');
 switch ($action) {
     case 'add':
     case 'edit':
-        $interbreadcrumb[] = array(
+        $interbreadcrumb[] = [
             'url' => $currentUrl,
             'name' => get_lang('Gradebook')
-        );
+        ];
         $toolName = get_lang(ucfirst($action));
         break;
 }
@@ -293,7 +293,7 @@ $searchForm = new FormValidator(
     'get',
     '',
     '',
-    array(),
+    [],
     FormValidator::LAYOUT_INLINE
 );
 $searchForm->addText('keyword', '', false);

+ 128 - 128
main/admin/index.php

@@ -50,13 +50,13 @@ if (api_is_platform_admin()) {
     }
     $keyword_url = Security::remove_XSS((empty($_GET['keyword']) ? '' : $_GET['keyword']));
 }
-$blocks = array();
+$blocks = [];
 
 // Instantiate Hook Event for Admin Block
 $hook = HookAdminBlock::create();
 if (!empty($hook)) {
     // If not empty, then notify Pre process to Hook Observers for Admin Block
-    $hook->setEventData(array('blocks' => $blocks));
+    $hook->setEventData(['blocks' => $blocks]);
     $data = $hook->notifyAdminBlock(HOOK_EVENT_TYPE_PRE);
     // Check if blocks data is not null
     if (isset($data['blocks'])) {
@@ -69,7 +69,7 @@ if (!empty($hook)) {
 $blocks['users']['icon'] = Display::return_icon(
     'members.png',
     get_lang('Users'),
-    array(),
+    [],
     ICON_SIZE_MEDIUM,
     false
 );
@@ -96,33 +96,33 @@ $blocks['users']['search_form'] = $search_form;
 
 if (api_is_platform_admin()) {
     $blocks['users']['editable'] = true;
-    $items = array(
-        array('url' => 'user_list.php', 'label' => get_lang('UserList')),
-        array('url' => 'user_add.php', 'label' => get_lang('AddUsers')),
-        array('url' => 'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')),
-        array('url' => 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
-        array('url' => 'user_update_import.php', 'label' => get_lang('EditUserListCSV')),
-    );
+    $items = [
+        ['url' => 'user_list.php', 'label' => get_lang('UserList')],
+        ['url' => 'user_add.php', 'label' => get_lang('AddUsers')],
+        ['url' => 'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')],
+        ['url' => 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')],
+        ['url' => 'user_update_import.php', 'label' => get_lang('EditUserListCSV')],
+    ];
 
     if (isset($extAuthSource) && isset($extAuthSource['extldap']) && count($extAuthSource['extldap']) > 0) {
-        $items[] = array('url' => 'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
+        $items[] = ['url' => 'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform')];
     }
-    $items[] = array('url' => 'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields'));
-    $items[] = array('url'=>'usergroups.php', 'label' => get_lang('Classes'));
+    $items[] = ['url' => 'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields')];
+    $items[] = ['url'=>'usergroups.php', 'label' => get_lang('Classes')];
     if (api_get_configuration_value('show_link_request_hrm_user')) {
         $items[] = ['url' => 'user_linking_requests.php', 'label' => get_lang('UserLinkingRequests')];
     }
 } elseif (api_is_session_admin() && api_get_configuration_value('limit_session_admin_role')) {
-    $items = array(
-        array('url' => 'user_list.php', 'label' => get_lang('UserList')),
-        array('url' => 'user_add.php', 'label' => get_lang('AddUsers')),
-    );
+    $items = [
+        ['url' => 'user_list.php', 'label' => get_lang('UserList')],
+        ['url' => 'user_add.php', 'label' => get_lang('AddUsers')],
+    ];
 } else {
     $items = [
-        array('url' => 'user_list.php', 'label' => get_lang('UserList')),
-        array('url' => 'user_add.php', 'label' => get_lang('AddUsers')),
-        array('url' => 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')),
-        array('url' => 'usergroups.php', 'label' => get_lang('Classes')),
+        ['url' => 'user_list.php', 'label' => get_lang('UserList')],
+        ['url' => 'user_add.php', 'label' => get_lang('AddUsers')],
+        ['url' => 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')],
+        ['url' => 'usergroups.php', 'label' => get_lang('Classes')],
     ];
 }
 
@@ -134,7 +134,7 @@ if (api_is_platform_admin()) {
     $blocks['courses']['icon'] = Display::return_icon(
         'course.png',
         get_lang('Courses'),
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
@@ -159,32 +159,32 @@ if (api_is_platform_admin()) {
         </form>';
     $blocks['courses']['search_form'] = $search_form;
 
-    $items = array();
-    $items[] = array('url' => 'course_list.php', 'label' => get_lang('CourseList'));
-    $items[] = array('url' => 'course_add.php', 'label' => get_lang('AddCourse'));
+    $items = [];
+    $items[] = ['url' => 'course_list.php', 'label' => get_lang('CourseList')];
+    $items[] = ['url' => 'course_add.php', 'label' => get_lang('AddCourse')];
 
     if (api_get_setting('course_validation') == 'true') {
-        $items[] = array('url' => 'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
-        $items[] = array('url' => 'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
-        $items[] = array('url' => 'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
+        $items[] = ['url' => 'course_request_review.php', 'label' => get_lang('ReviewCourseRequests')];
+        $items[] = ['url' => 'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests')];
+        $items[] = ['url' => 'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests')];
     }
 
-    $items[] = array('url' => 'course_export.php', 'label' => get_lang('ExportCourses'));
-    $items[] = array('url' => 'course_import.php', 'label' => get_lang('ImportCourses'));
-    $items[] = array('url' => 'course_category.php', 'label' => get_lang('AdminCategories'));
-    $items[] = array('url' => 'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
-    $items[] = array('url' => 'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
+    $items[] = ['url' => 'course_export.php', 'label' => get_lang('ExportCourses')];
+    $items[] = ['url' => 'course_import.php', 'label' => get_lang('ImportCourses')];
+    $items[] = ['url' => 'course_category.php', 'label' => get_lang('AdminCategories')];
+    $items[] = ['url' => 'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse')];
+    $items[] = ['url' => 'course_user_import.php', 'label' => get_lang('ImportUsersToACourse')];
     //$items[] = array('url'=>'course_intro_pdf_import.php', 	'label' => get_lang('ImportPDFIntroToCourses'));
 
     if (api_get_setting('gradebook_enable_grade_model') == 'true') {
-        $items[] = array('url' => 'grade_models.php', 'label' => get_lang('GradeModel'));
+        $items[] = ['url' => 'grade_models.php', 'label' => get_lang('GradeModel')];
     }
 
     if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
-        $items[] = array('url' => 'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
+        $items[] = ['url' => 'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse')];
     }
 
-    $items[] = array('url' => 'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields'));
+    $items[] = ['url' => 'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields')];
 
     $blocks['courses']['items'] = $items;
     $blocks['courses']['extra'] = null;
@@ -193,7 +193,7 @@ if (api_is_platform_admin()) {
     $blocks['platform']['icon'] = Display::return_icon(
         'platform.png',
         get_lang('Platform'),
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
@@ -221,53 +221,53 @@ if (api_is_platform_admin()) {
         </form>';
     $blocks['platform']['search_form'] = $search_form;
 
-    $items = array();
-    $items[] = array('url' => 'settings.php', 'label' => get_lang('PlatformConfigSettings'));
-    $items[] = array('url' => 'languages.php', 'label' => get_lang('Languages'));
-    $items[] = array('url' => 'settings.php?category=Plugins', 'label' => get_lang('Plugins'));
-    $items[] = array('url' => 'settings.php?category=Regions', 'label' => get_lang('Regions'));
-    $items[] = array('url' => 'system_announcements.php', 'label' => get_lang('SystemAnnouncements'));
-    $items[] = array(
+    $items = [];
+    $items[] = ['url' => 'settings.php', 'label' => get_lang('PlatformConfigSettings')];
+    $items[] = ['url' => 'languages.php', 'label' => get_lang('Languages')];
+    $items[] = ['url' => 'settings.php?category=Plugins', 'label' => get_lang('Plugins')];
+    $items[] = ['url' => 'settings.php?category=Regions', 'label' => get_lang('Regions')];
+    $items[] = ['url' => 'system_announcements.php', 'label' => get_lang('SystemAnnouncements')];
+    $items[] = [
         'url' => api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=admin',
         'label' => get_lang('GlobalAgenda')
-    );
-    $items[] = array('url' => 'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
-    $items[] = array('url' => 'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
-    $items[] = array('url' => 'statistics/index.php', 'label' => get_lang('Statistics'));
-    $items[] = array(
+    ];
+    $items[] = ['url' => 'configure_homepage.php', 'label' => get_lang('ConfigureHomePage')];
+    $items[] = ['url' => 'configure_inscription.php', 'label' => get_lang('ConfigureInscription')];
+    $items[] = ['url' => 'statistics/index.php', 'label' => get_lang('Statistics')];
+    $items[] = [
         'url' => api_get_path(WEB_CODE_PATH).'mySpace/company_reports.php',
         'label' => get_lang('Reports')
-    );
-    $items[] = array(
+    ];
+    $items[] = [
         'url' => api_get_path(WEB_CODE_PATH).'admin/teacher_time_report.php',
         'label' => get_lang('TeacherTimeReport')
-    );
+    ];
 
     if (api_get_configuration_value('chamilo_cms')) {
-        $items[] = array(
+        $items[] = [
             'url' => api_get_path(WEB_PATH).'web/app_dev.php/administration/dashboard',
             'label' => get_lang('CMS')
-        );
+        ];
     }
 
     /* Event settings */
 
     if (api_get_setting('activate_email_template') == 'true') {
         // @deprecated to be removed in 2.x
-        $items[] = array('url' => 'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
+        $items[] = ['url' => 'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement')];
     }
 
-    $items[] = array('url' => 'extra_field_list.php', 'label' => get_lang('ExtraFields'));
+    $items[] = ['url' => 'extra_field_list.php', 'label' => get_lang('ExtraFields')];
 
     if (!empty($_configuration['multiple_access_urls'])) {
         if (api_is_global_platform_admin()) {
-            $items[] = array('url' => 'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
+            $items[] = ['url' => 'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs')];
         }
     }
 
 
     if (api_get_setting('allow_terms_conditions') == 'true') {
-        $items[] = array('url' => 'legal_add.php', 'label' => get_lang('TermsAndConditions'));
+        $items[] = ['url' => 'legal_add.php', 'label' => get_lang('TermsAndConditions')];
     }
     $blocks['platform']['items'] = $items;
     $blocks['platform']['extra'] = null;
@@ -277,7 +277,7 @@ if (api_is_platform_admin()) {
 $blocks['sessions']['icon'] = Display::return_icon(
     'session.png',
     get_lang('Sessions'),
-    array(),
+    [],
     ICON_SIZE_MEDIUM,
     false
 );
@@ -308,28 +308,28 @@ $search_form = ' <form method="GET" class="form-inline" action="'.$sessionPath.'
                     </div>
                 </form>';
 $blocks['sessions']['search_form'] = $search_form;
-$items = array();
-$items[] = array('url' => $sessionPath.'session_list.php', 'label' => get_lang('ListSession'));
-$items[] = array('url' => $sessionPath.'session_add.php', 'label' => get_lang('AddSession'));
-$items[] = array('url' => $sessionPath.'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
-$items[] = array('url' => $sessionPath.'session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
-$items[] = array('url' => $sessionPath.'session_import_drh.php', 'label' => get_lang('ImportSessionDrhList'));
+$items = [];
+$items[] = ['url' => $sessionPath.'session_list.php', 'label' => get_lang('ListSession')];
+$items[] = ['url' => $sessionPath.'session_add.php', 'label' => get_lang('AddSession')];
+$items[] = ['url' => $sessionPath.'session_category_list.php', 'label' => get_lang('ListSessionCategory')];
+$items[] = ['url' => $sessionPath.'session_import.php', 'label' => get_lang('ImportSessionListXMLCSV')];
+$items[] = ['url' => $sessionPath.'session_import_drh.php', 'label' => get_lang('ImportSessionDrhList')];
 if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
-    $items[] = array(
+    $items[] = [
         'url' => 'ldap_import_students_to_session.php',
         'label' => get_lang('ImportLDAPUsersIntoSession')
-    );
+    ];
 }
-$items[] = array(
+$items[] = [
     'url' => $sessionPath.'session_export.php',
     'label' => get_lang('ExportSessionListXMLCSV'),
-);
+];
 
 if (api_is_global_platform_admin()) {
-    $items[] = array(
+    $items[] = [
         'url' => '../coursecopy/copy_course_session.php',
         'label' => get_lang('CopyFromCourseInSessionToAnotherSession')
-    );
+    ];
 }
 
 $allowCareer = api_get_configuration_value('allow_session_admin_read_careers');
@@ -337,10 +337,10 @@ $allowCareer = api_get_configuration_value('allow_session_admin_read_careers');
 if (api_is_platform_admin() || ($allowCareer && api_is_session_admin())) {
     // option only visible in development mode. Enable through code if required
     if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
-        $items[] = array('url' => 'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
+        $items[] = ['url' => 'user_move_stats.php', 'label' => get_lang('MoveUserStats')];
     }
-    $items[] = array('url' => 'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
-    $items[] = array('url' => 'extra_fields.php?type=session', 'label' => get_lang('ManageSessionFields'));
+    $items[] = ['url' => 'career_dashboard.php', 'label' => get_lang('CareersAndPromotions')];
+    $items[] = ['url' => 'extra_fields.php?type=session', 'label' => get_lang('ManageSessionFields')];
 }
 
 $blocks['sessions']['items'] = $items;
@@ -351,7 +351,7 @@ if (api_is_platform_admin()) {
     $blocks['settings']['icon'] = Display::return_icon(
         'settings.png',
         get_lang('System'),
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
@@ -359,30 +359,30 @@ if (api_is_platform_admin()) {
     $blocks['settings']['class'] = 'block-admin-settings';
 
     $items = [];
-    $items[] = array(
+    $items[] = [
         'url' => 'archive_cleanup.php',
         'label' => get_lang('ArchiveDirCleanup')
-    );
+    ];
 
-    $items[] = array(
+    $items[] = [
         'url' => 'special_exports.php',
         'label' => get_lang('SpecialExports')
-    );
-    $items[] = array(
+    ];
+    $items[] = [
         'url' => 'system_status.php',
         'label' => get_lang('SystemStatus')
-    );
+    ];
     if (is_dir(api_get_path(SYS_TEST_PATH).'datafiller/')) {
-        $items[] = array(
+        $items[] = [
             'url' => 'filler.php',
             'label' => get_lang('DataFiller')
-        );
+        ];
     }
 
-    $items[] = array(
+    $items[] = [
         'url' => 'resource_sequence.php',
         'label' => get_lang('ResourcesSequencing')
-    );
+    ];
     if (is_dir(api_get_path(SYS_TEST_PATH))) {
         $items[] = [
             'url' => 'email_tester.php',
@@ -402,10 +402,10 @@ if (api_is_platform_admin()) {
         $username = $_configuration['db_user'];
         $databaseName = $_configuration['main_database'];
 
-        $items[] = array(
+        $items[] = [
             'url' => "db.php?username=$username&db=$databaseName&server=$host",
             'label' => get_lang('DatabaseManager')
-        );
+        ];
     }
 
     $blocks['settings']['items'] = $items;
@@ -417,39 +417,39 @@ if (api_is_platform_admin()) {
         $blocks['skills']['icon'] = Display::return_icon(
             'skill-badges.png',
             get_lang('Skills'),
-            array(),
+            [],
             ICON_SIZE_MEDIUM,
             false
         );
         $blocks['skills']['label'] = get_lang('Skills');
         $blocks['skills']['class'] = 'block-admin-skills';
 
-        $items = array();
-        $items[] = array(
+        $items = [];
+        $items[] = [
             'url' => 'skills_wheel.php',
             'label' => get_lang('SkillsWheel')
-        );
-        $items[] = array(
+        ];
+        $items[] = [
             'url' => 'skills_import.php',
             'label' => get_lang('SkillsImport')
-        );
-        $items[] = array(
+        ];
+        $items[] = [
             'url' => 'skill_list.php',
             'label' => get_lang('ManageSkills')
-        );
-        $items[] = array(
+        ];
+        $items[] = [
             'url' => 'skill.php',
             'label' => get_lang('ManageSkillsLevels')
-        );
+        ];
 
-        $items[] = array(
+        $items[] = [
             'url' => api_get_path(WEB_CODE_PATH).'social/skills_ranking.php',
             'label' => get_lang('SkillsRanking')
-        );
-        $items[] = array(
+        ];
+        $items[] = [
             'url' => 'skills_gradebook.php',
             'label' => get_lang('SkillsAndGradebooks')
-        );
+        ];
         /*$items[] = array(
             'url' => api_get_path(WEB_CODE_PATH).'admin/skill_badge.php',
             'label' => get_lang('Badges')
@@ -464,18 +464,18 @@ if (api_is_platform_admin()) {
         $blocks['gradebook']['icon'] = Display::return_icon(
             'gradebook.png',
             get_lang('Gradebook'),
-            array(),
+            [],
             ICON_SIZE_MEDIUM,
             false
         );
         $blocks['gradebook']['label'] = get_lang('Gradebook');
         $blocks['gradebook']['class'] = 'block-admin-gradebook';
 
-        $items = array();
-        $items[] = array(
+        $items = [];
+        $items[] = [
             'url' => 'gradebook_list.php',
             'label' => get_lang('List')
-        );
+        ];
         $blocks['gradebook']['items'] = $items;
         $blocks['gradebook']['extra'] = null;
         $blocks['gradebook']['search_form'] = null;
@@ -494,7 +494,7 @@ if (api_is_platform_admin()) {
             $blocks['plugins']['icon'] = Display::return_icon(
                 'plugins.png',
                 get_lang('Plugins'),
-                array(),
+                [],
                 ICON_SIZE_MEDIUM,
                 false
             );
@@ -503,7 +503,7 @@ if (api_is_platform_admin()) {
             $blocks['plugins']['editable'] = true;
 
             $plugin_obj = new AppPlugin();
-            $items = array();
+            $items = [];
 
             foreach ($menuAdministratorItems as $pluginName) {
                 $pluginInfo = $plugin_obj->getPluginInfo($pluginName, true);
@@ -515,10 +515,10 @@ if (api_is_platform_admin()) {
                     continue;
                 }
 
-                $items[] = array(
+                $items[] = [
                     'url' => $pluginUrl,
                     'label' => $pluginInfo['title']
-                );
+                ];
             }
 
             $blocks['plugins']['items'] = $items;
@@ -531,27 +531,27 @@ if (api_is_platform_admin()) {
     $blocks['chamilo']['icon'] = Display::return_icon(
         'platform.png',
         'Chamilo.org',
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
     $blocks['chamilo']['label'] = 'Chamilo.org';
     $blocks['chamilo']['class'] = 'block-admin-chamilo';
 
-    $items = array();
-    $items[] = array('url' => 'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage'));
-    $items[] = array('url' => 'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum'));
-
-    $items[] = array('url' => '../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide'));
-    $items[] = array('url' => '../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion'));
-    $items[] = array('url' => '../../documentation/credits.html', 'label' => get_lang('ContributorsList'));
-    $items[] = array('url' => '../../documentation/security.html', 'label' => get_lang('SecurityGuide'));
-    $items[] = array('url' => '../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide'));
-    $items[] = array('url' => 'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions'));
-    $items[] = array(
+    $items = [];
+    $items[] = ['url' => 'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage')];
+    $items[] = ['url' => 'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum')];
+
+    $items[] = ['url' => '../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide')];
+    $items[] = ['url' => '../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion')];
+    $items[] = ['url' => '../../documentation/credits.html', 'label' => get_lang('ContributorsList')];
+    $items[] = ['url' => '../../documentation/security.html', 'label' => get_lang('SecurityGuide')];
+    $items[] = ['url' => '../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide')];
+    $items[] = ['url' => 'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions')];
+    $items[] = [
         'url' => 'http://www.chamilo.org/en/providers',
         'label' => get_lang('ChamiloOfficialServicesProviders')
-    );
+    ];
 
     $blocks['chamilo']['items'] = $items;
     $blocks['chamilo']['extra'] = null;
@@ -561,7 +561,7 @@ if (api_is_platform_admin()) {
     $blocks['version_check']['icon'] = Display::return_icon(
         'platform.png',
         'Chamilo.org',
-        array(),
+        [],
         ICON_SIZE_MEDIUM,
         false
     );
@@ -574,7 +574,7 @@ if (api_is_platform_admin()) {
     // Check Hook Event for Admin Block Object
     if (!empty($hook)) {
         // If not empty, then notify Post process to Hook Observers for Admin Block
-        $hook->setEventData(array('blocks' => $blocks));
+        $hook->setEventData(['blocks' => $blocks]);
         $data = $hook->notifyAdminBlock(HOOK_EVENT_TYPE_POST);
         // Check if blocks data is not null
         if (isset($data['blocks'])) {
@@ -635,10 +635,10 @@ if (api_is_platform_admin()) {
         'post',
         '#',
         null,
-        array(
+        [
             'id' => 'block-extra-data',
             'class' => ''
-        ),
+        ],
         FormValidator::LAYOUT_BOX_NO_LABEL
     );
     $extraContentFormRenderer = $extraContentForm->getDefaultRenderer();
@@ -683,9 +683,9 @@ if (api_is_platform_admin()) {
         'hidden',
         'block',
         null,
-        array(
+        [
             'id' => 'extra-block'
-        )
+        ]
     );
     $extraContentForm->addButtonExport(
         get_lang('Save'),

+ 11 - 12
main/admin/languages.php

@@ -191,7 +191,6 @@ if ($action == 'disable_all_except_default') {
     if ($checkFailed) {
         $_SESSION['disabled_languages'] = $failedDisabledLanguages;
     }
-
 }
 
 if (isset($_POST['Submit']) && $_POST['Submit']) {
@@ -209,7 +208,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
     switch ($_POST['action']) {
         case 'makeavailable':
             if (count($_POST['id']) > 0) {
-                $ids = array();
+                $ids = [];
                 foreach ($_POST['id'] as $index => $id) {
                     $ids[] = intval($id);
                 }
@@ -219,7 +218,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
             break;
         case 'makeunavailable':
             if (count($_POST['id']) > 0) {
-                $ids = array();
+                $ids = [];
                 foreach ($_POST['id'] as $index => $id) {
                     $ids[] = intval($id);
                 }
@@ -234,7 +233,7 @@ if (isset($_POST['Submit']) && $_POST['Submit']) {
 $tool_name = get_lang('PlatformLanguages');
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 if (isset($_GET['action']) && $_GET['action'] == 'make_unavailable_confirmed') {
     $language_info = SubLanguageManager::get_all_information_of_language($_GET['id']);
@@ -263,9 +262,9 @@ $result_select_lang = Database::query($sql_select_lang);
 $row_lang = Database::fetch_array($result_select_lang);
 
 // the table data
-$language_data = array();
+$language_data = [];
 while ($row = Database::fetch_array($result_select)) {
-    $row_td = array();
+    $row_td = [];
     $row_td[] = $row['id'];
     // the first column is the original name of the language OR a form containing the original name
     if ($action == 'edit' and $row['id'] == $_GET['id']) {
@@ -298,7 +297,7 @@ while ($row = Database::fetch_array($result_select)) {
 
         if ($verified_if_is_sub_language === false) {
             $verified_if_is_father = SubLanguageManager::check_if_language_is_father($row['id']);
-            $allow_use_sub_language = "&nbsp;<a href='sub_language_add.php?action=definenewsublanguage&id=".$row['id']."'>".Display::return_icon('new_language.png', get_lang('CreateSubLanguage'), array(), ICON_SIZE_SMALL)."</a>";
+            $allow_use_sub_language = "&nbsp;<a href='sub_language_add.php?action=definenewsublanguage&id=".$row['id']."'>".Display::return_icon('new_language.png', get_lang('CreateSubLanguage'), [], ICON_SIZE_SMALL)."</a>";
             if ($verified_if_is_father === true) {
                 //$allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".$row['id']."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'),array('width'=>ICON_SIZE_SMALL,'height'=>ICON_SIZE_SMALL))."</a>";
                 $allow_add_term_sub_language = '';
@@ -308,8 +307,8 @@ while ($row = Database::fetch_array($result_select)) {
         } else {
             $allow_use_sub_language = '';
             $all_information_of_sub_language = SubLanguageManager::get_all_information_of_language($row['id']);
-            $allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL))."</a>";
-            $allow_delete_sub_language = "&nbsp;<a href='sub_language_add.php?action=deletesublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), array('width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL))."</a>";
+            $allow_add_term_sub_language = "&nbsp;<a href='sub_language.php?action=registersublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('2rightarrow.png', get_lang('AddWordForTheSubLanguage'), ['width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL])."</a>";
+            $allow_delete_sub_language = "&nbsp;<a href='sub_language_add.php?action=deletesublanguage&id=".Security::remove_XSS($all_information_of_sub_language['parent_id'])."&sub_language_id=".Security::remove_XSS($row['id'])."'>".Display::return_icon('delete.png', get_lang('DeleteSubLanguage'), ['width' => ICON_SIZE_SMALL, 'height' => ICON_SIZE_SMALL])."</a>";
         }
     } else {
         $allow_use_sub_language = '';
@@ -321,9 +320,9 @@ while ($row = Database::fetch_array($result_select)) {
                      &nbsp;" . $setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
     } else {
         if ($row['available'] == 1) {
-            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeunavailable&id=".$row['id']."'>".Display::return_icon('visible.png', get_lang('MakeUnavailable'), array('id' => 'imglinktool_'.$row['id']), ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
+            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeunavailable&id=".$row['id']."'>".Display::return_icon('visible.png', get_lang('MakeUnavailable'), ['id' => 'imglinktool_'.$row['id']], ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
         } else {
-            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeavailable&id=".$row['id']."'>".Display::return_icon('invisible.png', get_lang('MakeAvailable'), array('id' => 'imglinktool_'.$row['id']), ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
+            $row_td[] = "<a class=\"make_visible_and_invisible\" id=\"linktool_".$row['id']."\" href='".api_get_self()."?action=makeavailable&id=".$row['id']."'>".Display::return_icon('invisible.png', get_lang('MakeAvailable'), ['id' => 'imglinktool_'.$row['id']], ICON_SIZE_SMALL)."</a> <a href='".api_get_self()."?action=edit&id=".$row['id']."#value'>".Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL)."</a>&nbsp;".$setplatformlanguage.$allow_use_sub_language.$allow_add_term_sub_language.$allow_delete_sub_language;
         }
     }
     $language_data[] = $row_td;
@@ -335,7 +334,7 @@ $table->set_header(1, get_lang('OriginalName'));
 $table->set_header(2, get_lang('EnglishName'));
 $table->set_header(3, get_lang('LMSFolder'));
 $table->set_header(4, get_lang('Properties'));
-$form_actions = array();
+$form_actions = [];
 $form_actions['makeavailable'] = get_lang('MakeAvailable');
 $form_actions['makeunavailable'] = get_lang('MakeUnavailable');
 $table->set_form_actions($form_actions);

+ 33 - 29
main/admin/ldap_form_add_users_group.php

@@ -29,35 +29,39 @@ $is_western_name_order = api_is_western_name_order();
 echo '<input type="hidden" name="confirmed" value="yes">';
 echo '<table border="0" cellspacing="0" width="100%">';
 echo '<tr align="center" id="header3">'.
-		'<td width="15%"><input type="button" value="'.get_lang('AllSlashNone').'" onClick="checkAll();"></td>'.
-		'<td width="40%"><b>'.get_lang('Email').'</b></td>'.
-		($is_western_name_order
-			? '<td width="15%"><b>'.get_lang('FirstName').'</b></td>'.
-			'<td width="15%"><b>'.get_lang('Name').'</b></td>'
-			: '<td width="15%"><b>'.get_lang('Name').'</b></td>'.
-			'<td width="15%"><b>'.get_lang('FirstName').'</b></td>').
-		'<td width="15%"><b>'.get_lang('Login').'</b></td>'.
-	  '</tr>'."\n";
-while (list ($key, $val) = each($nom_form)) {
-	$nbre = $nbre + 1;
-	if ($nbre & 1) $ndiv = 2; else $ndiv = 3;
-	echo '<tr align="center" id="header'.$ndiv.'">';
-	echo '<td><input type="checkbox" name="checkboxes[]" value="'.$key.'" checked="checked"></td>';
-	echo '<td>'.$email_form[$key].'<input type="hidden" name="email_form['.$key.']" size="40" value="'.$email_form[$key].'"></td>';
-	if ($is_western_name_order) {
-		echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
-		echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
-	} else {
-		echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
-		echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
-	}
-	echo '<td>'.$username_form[$key].'<input type="hidden" name="username_form['.$key.']" size="10" value="'.$username_form[$key].'">';
-	echo '<input type="hidden" name="tutor_form['.$key.']" value="0">';
-	echo '<input type="hidden" name="admin_form['.$key.']" value="1">';
-	echo '<input type="hidden" name="password_form['.$key.']"  value="'.$password_form[$key].'">';
-	echo '<input type="hidden" name="statut['.$key.']"  value="'.$statut.'">';
-	echo '</td>';
-	echo '</tr>';
+        '<td width="15%"><input type="button" value="'.get_lang('AllSlashNone').'" onClick="checkAll();"></td>'.
+        '<td width="40%"><b>'.get_lang('Email').'</b></td>'.
+        ($is_western_name_order
+            ? '<td width="15%"><b>'.get_lang('FirstName').'</b></td>'.
+            '<td width="15%"><b>'.get_lang('Name').'</b></td>'
+            : '<td width="15%"><b>'.get_lang('Name').'</b></td>'.
+            '<td width="15%"><b>'.get_lang('FirstName').'</b></td>').
+        '<td width="15%"><b>'.get_lang('Login').'</b></td>'.
+      '</tr>'."\n";
+while (list($key, $val) = each($nom_form)) {
+    $nbre = $nbre + 1;
+    if ($nbre & 1) {
+        $ndiv = 2;
+    } else {
+        $ndiv = 3;
+    }
+    echo '<tr align="center" id="header'.$ndiv.'">';
+    echo '<td><input type="checkbox" name="checkboxes[]" value="'.$key.'" checked="checked"></td>';
+    echo '<td>'.$email_form[$key].'<input type="hidden" name="email_form['.$key.']" size="40" value="'.$email_form[$key].'"></td>';
+    if ($is_western_name_order) {
+        echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
+        echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
+    } else {
+        echo '<td>'.$nom_form[$key].'<input type="hidden" name="nom_form['.$key.']" size="20" value="'.$nom_form[$key].'"></td>';
+        echo '<td>'.$prenom_form[$key].'<input type="hidden" name="prenom_form['.$key.']" size="20" value="'.$prenom_form[$key].'"></td>';
+    }
+    echo '<td>'.$username_form[$key].'<input type="hidden" name="username_form['.$key.']" size="10" value="'.$username_form[$key].'">';
+    echo '<input type="hidden" name="tutor_form['.$key.']" value="0">';
+    echo '<input type="hidden" name="admin_form['.$key.']" value="1">';
+    echo '<input type="hidden" name="password_form['.$key.']"  value="'.$password_form[$key].'">';
+    echo '<input type="hidden" name="statut['.$key.']"  value="'.$statut.'">';
+    echo '</td>';
+    echo '</tr>';
 }
 echo '</table>';
 echo '<br />';

+ 3 - 3
main/admin/ldap_import_students.php

@@ -20,7 +20,7 @@ $annee_base = date('Y');
 
 $tool_name = get_lang('LDAPImport');
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $htmlHeadXtra[] = '<script>
 var buttoncheck = 1;
@@ -128,8 +128,8 @@ if (empty($annee) && empty($course)) {
     echo '</div>';
 } elseif (!empty($annee) && !empty($course) && ($_POST['confirmed'] == 'yes')) {
     $id = $_POST['username_form'];
-    $UserList = array();
-    $userid_match_login = array();
+    $UserList = [];
+    $userid_match_login = [];
     foreach ($id as $form_index => $user_id) {
         if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) {
             $tmp = ldap_add_user($user_id);

+ 3 - 4
main/admin/ldap_import_students_to_session.php

@@ -19,7 +19,7 @@ $annee_base = date('Y');
 
 $tool_name = get_lang('LDAPImport');
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
 var buttoncheck = 1;
@@ -59,7 +59,6 @@ if (empty($annee) && empty($id_session)) {
     echo '<input type="submit" value="'.get_lang('Submit').'">';
     echo '</form>';
     echo '</div>';
-
 } elseif (!empty($annee) && empty($id_session)) {
     Display::display_header($tool_name);
     echo '<div style="align:center">';
@@ -134,8 +133,8 @@ elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) {
     echo '</div>';
 } elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes')) {
     $id = $_POST['username_form'];
-    $UserList = array();
-    $userid_match_login = array();
+    $UserList = [];
+    $userid_match_login = [];
     foreach ($id as $form_index => $user_id) {
         if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) {
             $tmp = ldap_add_user($user_id);

+ 8 - 10
main/admin/ldap_users_list.php

@@ -15,8 +15,7 @@ $action = @$_GET["action"] ?: null;
 $login_as_user_id = @$_GET["user_id"] ?: null;
 
 // Login as ...
-if ($action == "login_as" && !empty ($login_as_user_id))
-{
+if ($action == "login_as" && !empty($login_as_user_id)) {
     login_user($login_as_user_id);
 }
 
@@ -27,13 +26,12 @@ if (($_GET['action']=="add_user") && ($_GET['id_session'] == strval(intval($_GET
 }
 */
 
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 $tool_name = get_lang('SearchLDAPUsers');
 //Display::display_header($tool_name); //cannot display now as we need to redirect
 //api_display_tool_title($tool_name);
 
-if (isset ($_GET['action']))
-{
+if (isset($_GET['action'])) {
     $check = Security::check_token('get');
     if ($check) {
         switch ($_GET['action']) {
@@ -61,8 +59,8 @@ if (isset ($_GET['action']))
                 break;
             case 'add_user':
                 $id = $_GET['id'];
-                $UserList = array();
-                $userid_match_login = array();
+                $UserList = [];
+                $userid_match_login = [];
                 foreach ($id as $user_id) {
                     $tmp = ldap_add_user($user_id);
                     $UserList[] = $tmp;
@@ -118,7 +116,7 @@ if (isset($_POST['action'])) {
             case 'add_user':
                 $number_of_selected_users = count($_POST['id']);
                 $number_of_added_users = 0;
-                $UserList = array();
+                $UserList = [];
                 foreach ($_POST['id'] as $index => $user_id) {
                     if ($user_id != $_user['user_id']) {
                         $UserList[] = ldap_add_user($user_id);
@@ -154,7 +152,7 @@ if (isset($_GET['id_session'])) {
     $form->addElement('hidden', 'id_session', $_GET['id_session']);
 }
 
-$type = array();
+$type = [];
 $type["all"] = get_lang('All');
 $type["employee"] = get_lang('Teacher');
 $type["student"] = get_lang('Student');
@@ -197,7 +195,7 @@ $table->set_header(5, get_lang('Actions'));
 //$table->set_column_filter(5, 'email_filter');
 //$table->set_column_filter(5, 'active_filter');
 $table->set_column_filter(5, 'modify_filter');
-$table->set_form_actions(array('add_user' => get_lang('AddLDAPUsers')));
+$table->set_form_actions(['add_user' => get_lang('AddLDAPUsers')]);
 $table->display();
 
 Display::display_footer();

+ 7 - 7
main/admin/ldap_users_synchro.php

@@ -19,8 +19,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => api_get_self(), "name" => get_lang('SessionsList'));
+$interbreadcrumb[] = ['url' => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => api_get_self(), "name" => get_lang('SessionsList')];
 
 // Database Table Definitions
 $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
@@ -39,8 +39,8 @@ $id_session = intval($_GET['id_session']);
 
 $formSent = 0;
 $errorMsg = $firstLetterUser = $firstLetterSession = '';
-$UserList = $SessionList = array();
-$users = $sessions = array();
+$UserList = $SessionList = [];
+$users = $sessions = [];
 $page = intval($_GET['page']);
 $action = $_REQUEST['action'];
 
@@ -58,9 +58,9 @@ Display::display_header($tool_name);
 
 <?php
 if (isset($action) && ($action == "synchro")) {
-	$included = true;
-	require('ldap_synchro.php');
-	echo Display::return_message($message, 'normal', false);
+    $included = true;
+    require('ldap_synchro.php');
+    echo Display::return_message($message, 'normal', false);
 }
 Display::display_footer();
 ?>

+ 10 - 13
main/admin/legal_add.php

@@ -18,12 +18,12 @@ if (api_get_setting('allow_terms_conditions') !== 'true') {
 // Create the form
 $form = new FormValidator('addlegal');
 
-$defaults = array();
-$term_preview = array(
+$defaults = [];
+$term_preview = [
     'type' => 0,
     'content' => '',
     'changes' => ''
-);
+];
 if ($form->validate()) {
     $check = Security::check_token('post');
     if ($check) {
@@ -104,20 +104,19 @@ $defaults['sec_token'] = $token;
 $form->addElement('header', get_lang('DisplayTermsConditions'));
 
 if (isset($_POST['language'])) {
-
-	$form->addElement('static', Security::remove_XSS($_POST['language']));
-	$form->addElement('hidden', 'language', Security::remove_XSS($_POST['language']));
+    $form->addElement('static', Security::remove_XSS($_POST['language']));
+    $form->addElement('hidden', 'language', Security::remove_XSS($_POST['language']));
     $form->addHtmlEditor(
         'content',
         get_lang('Content'),
         true,
         false,
-        array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250')
+        ['ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250']
     );
 
     $form->addElement('radio', 'type', '', get_lang('HTMLText'), '0');
     $form->addElement('radio', 'type', '', get_lang('PageLink'), '1');
-    $form->addElement('textarea', 'changes', get_lang('ExplainChanges'), array('width' => '20'));
+    $form->addElement('textarea', 'changes', get_lang('ExplainChanges'), ['width' => '20']);
 
     $preview = LegalManager::show_last_condition($term_preview);
 
@@ -135,15 +134,13 @@ if (isset($_POST['language'])) {
                 </div>
             </div>';
     $form->addElement('html', $buttons);
-
 } else {
-    $form->addSelectLanguage('language', get_lang('Language'), null, array());
-	$form->addButtonSearch(get_lang('Load'), 'send');
-
+    $form->addSelectLanguage('language', get_lang('Language'), null, []);
+    $form->addButtonSearch(get_lang('Load'), 'send');
 }
 
 $tool_name = get_lang('AddTermsAndConditions');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 Display :: display_header($tool_name);
 
 echo '<script>

+ 3 - 3
main/admin/legal_list.php

@@ -10,7 +10,7 @@ $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 $tool_name = get_lang('TermsAndConditions');
 Display :: display_header($tool_name);
 
@@ -42,12 +42,12 @@ $table->display();
 // this 2 "mask" function are here just because the SortableTable
 function get_legal_data_mask($id, $params = null, $row = null)
 {
-	return LegalManager::get_legal_data($id, $params, $row);
+    return LegalManager::get_legal_data($id, $params, $row);
 }
 
 function count_mask()
 {
-	return LegalManager::count();
+    return LegalManager::count();
 }
 
 Display :: display_footer();

+ 28 - 28
main/admin/promotions.php

@@ -16,8 +16,8 @@ api_protect_admin_script();
 $htmlHeadXtra[] = api_get_jqgrid_js();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions')];
 
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 
@@ -25,19 +25,19 @@ $check = Security::check_token('request');
 $token = Security::get_token();
 
 if ($action == 'add') {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'promotions.php',
         'name' => get_lang('Promotions'),
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Add')];
 } elseif ($action == 'edit') {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => 'promotions.php',
         'name' => get_lang('Promotions'),
-    );
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
+    ];
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Edit')];
 } else {
-    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Promotions'));
+    $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Promotions')];
 }
 
 // The header.
@@ -46,56 +46,56 @@ Display::display_header('');
 // Tool name
 if (isset($_GET['action']) && $_GET['action'] == 'add') {
     $tool = 'Add';
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => api_get_self(),
         'name' => get_lang('Promotion'),
-    );
+    ];
 }
 if (isset($_GET['action']) && $_GET['action'] == 'edit') {
     $tool = 'Modify';
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         'url' => api_get_self(),
         'name' => get_lang('Promotion'),
-    );
+    ];
 }
 
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_promotions';
 //The order is important you need to check the model.ajax.php the $column variable
-$columns = array(
+$columns = [
     get_lang('Name'),
     get_lang('Career'),
     get_lang('Description'),
     get_lang('Actions'),
-);
-$column_model = array(
-    array(
+];
+$column_model = [
+    [
         'name' => 'name',
         'index' => 'name',
         'width' => '180',
         'align' => 'left',
-    ),
-    array(
+    ],
+    [
         'name' => 'career',
         'index' => 'career',
         'width' => '100',
         'align' => 'left',
-    ),
-    array(
+    ],
+    [
         'name' => 'description',
         'index' => 'description',
         'width' => '500',
         'align' => 'left',
         'sortable' => 'false',
-    ),
-    array(
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '100',
         'align' => 'left',
         'formatter' => 'action_formatter',
         'sortable' => 'false',
-    ),
-);
+    ],
+];
 $extra_params['autowidth'] = 'true'; //use the width of the parent
 //$extra_params['editurl'] = $url; //use the width of the parent
 
@@ -112,7 +112,7 @@ $action_links = 'function action_formatter (cellvalue, options, rowObject) {
 <script>
 $(function() {
 <?php
-     echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
+     echo Display::grid_js('promotions', $url, $columns, $column_model, $extra_params, [], $action_links, true);
 ?>
 });
 </script>
@@ -153,7 +153,7 @@ switch ($action) {
             echo Display::url(Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM), api_get_self());
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;
@@ -186,7 +186,7 @@ switch ($action) {
             );
             echo '</div>';
             $form->addElement('hidden', 'sec_token');
-            $form->setConstants(array('sec_token' => $token));
+            $form->setConstants(['sec_token' => $token]);
             $form->display();
         }
         break;

+ 1 - 2
main/admin/resource_sequence.php

@@ -10,7 +10,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 api_protect_global_admin_script();
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 $tpl = new Template(get_lang('ResourcesSequencing'));
 
@@ -92,4 +92,3 @@ $tpl->assign('configure_sequence', $form->returnForm());
 $tpl->assign('save_sequence', $formSave->returnForm());
 $layout = $tpl->get_template('admin/resource_sequence.tpl');
 $tpl->display($layout);
-

+ 68 - 70
main/admin/settings.lib.php

@@ -54,7 +54,7 @@ function handleRegions()
     echo '</tr>';
 
     /* We display all the possible plugins and the checkboxes */
-    $plugin_region_list = array();
+    $plugin_region_list = [];
     $my_plugin_list = $plugin_obj->get_plugin_regions();
     foreach ($my_plugin_list as $plugin_item) {
         $plugin_region_list[$plugin_item] = $plugin_item;
@@ -67,7 +67,7 @@ function handleRegions()
         $plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$pluginName.'/plugin.php';
 
         if (file_exists($plugin_info_file)) {
-            $plugin_info = array();
+            $plugin_info = [];
             require $plugin_info_file;
             if (isset($_GET['name']) && $_GET['name'] === $pluginName) {
                 echo '<tr class="row_selected">';
@@ -98,7 +98,7 @@ function handleRegions()
                 'plugin_'.$pluginName.'[]',
                 $region_list,
                 $selected_plugins,
-                array('multiple' => 'multiple', 'style' => 'width:500px'),
+                ['multiple' => 'multiple', 'style' => 'width:500px'],
                 true,
                 get_lang('None')
             );
@@ -114,7 +114,6 @@ function handleExtensions()
 {
     echo Display::page_subheader(get_lang('ConfigureExtensions'));
     echo '<a class="btn btn-success" href="configure_extensions.php?display=ppt2lp" role="button">'.get_lang('Ppt2lp').'</a>';
-
 }
 
 /**
@@ -168,7 +167,7 @@ function handlePlugins()
     foreach ($all_plugins as $pluginName) {
         $plugin_info_file = api_get_path(SYS_PLUGIN_PATH).$pluginName.'/plugin.php';
         if (file_exists($plugin_info_file)) {
-            $plugin_info = array();
+            $plugin_info = [];
             require $plugin_info_file;
 
             $pluginRow = '';
@@ -195,12 +194,12 @@ function handlePlugins()
                 $pluginRow .= Display::url(
                     '<em class="fa fa-cogs"></em> '.get_lang('Configure'),
                     'configure_plugin.php?name='.$pluginName,
-                    array('class' => 'btn btn-default')
+                    ['class' => 'btn btn-default']
                 );
                 $pluginRow .= Display::url(
                     '<em class="fa fa-th-large"></em> '.get_lang('Regions'),
                     'settings.php?category=Regions&name='.$pluginName,
-                    array('class' => 'btn btn-default')
+                    ['class' => 'btn btn-default']
                 );
             }
 
@@ -273,7 +272,7 @@ function handleStylesheets()
         'text',
         'name_stylesheet',
         get_lang('NameStylesheet'),
-        array('size' => '40', 'maxlength' => '40')
+        ['size' => '40', 'maxlength' => '40']
     );
     $form->addRule(
         'name_stylesheet',
@@ -456,7 +455,7 @@ function handleStylesheets()
         'post',
         api_get_self().'?category=Stylesheets',
         null,
-        array('id' => 'stylesheets_id')
+        ['id' => 'stylesheets_id']
     );
 
     $styles = $form_change->addElement(
@@ -477,8 +476,8 @@ function handleStylesheets()
 
         if ($show_upload_form) {
             echo Display::tabs(
-                array(get_lang('Update'), get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')),
-                array($form_change->returnForm(), $logoForm->returnForm(), $form->returnForm())
+                [get_lang('Update'), get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')],
+                [$form_change->returnForm(), $logoForm->returnForm(), $form->returnForm()]
             );
         } else {
             $form_change->display();
@@ -536,7 +535,7 @@ function uploadStylesheet($values, $picture)
             $num_files = $zip->numFiles;
             $valid = true;
             $single_directory = true;
-            $invalid_files = array();
+            $invalid_files = [];
 
             $allowedFiles = getAllowedFileTypes();
 
@@ -634,7 +633,7 @@ function storeRegions()
 
     // Get a list of all current 'Plugins' settings
     $installed_plugins = $plugin_obj->get_installed_plugins();
-    $shortlist_installed = array();
+    $shortlist_installed = [];
     if (!empty($installed_plugins)) {
         foreach ($installed_plugins as $plugin) {
             if (isset($plugin['subkey'])) {
@@ -669,7 +668,7 @@ function storePlugins()
     $appPlugin = new AppPlugin();
     // Get a list of all current 'Plugins' settings
     $plugin_list = $appPlugin->read_plugins_from_path();
-    $installed_plugins = array();
+    $installed_plugins = [];
 
     foreach ($plugin_list as $plugin) {
         if (isset($_POST['plugin_'.$plugin])) {
@@ -747,7 +746,7 @@ function handleSearch()
     $form->addGroup(
         $group,
         'search_enabled',
-        array(get_lang('SearchEnabledTitle'), get_lang('SearchEnabledComment')),
+        [get_lang('SearchEnabledTitle'), get_lang('SearchEnabledComment')],
         null,
         false
     );
@@ -772,16 +771,16 @@ function handleSearch()
         $form->addGroup(
             $group,
             'search_show_unlinked_results',
-            array(
+            [
                 get_lang('SearchShowUnlinkedResultsTitle'),
                 get_lang('SearchShowUnlinkedResultsComment')
-            ),
+            ],
             null,
             false
         );
         $default_values['search_show_unlinked_results'] = api_get_setting('search_show_unlinked_results');
 
-        $sf_values = array();
+        $sf_values = [];
         foreach ($specific_fields as $sf) {
             $sf_values[$sf['code']] = $sf['name'];
         }
@@ -790,7 +789,7 @@ function handleSearch()
                 get_lang('AddSpecificSearchField'),
                 'specific_fields.php'
             ),
-            array('class' => 'sectioncomment')
+            ['class' => 'sectioncomment']
         );
         if (empty($sf_values)) {
             $form->addElement('label', [get_lang('SearchPrefilterPrefix'), $url]);
@@ -798,7 +797,7 @@ function handleSearch()
             $form->addElement(
                 'select',
                 'search_prefilter_prefix',
-                array(get_lang('SearchPrefilterPrefix'), $url),
+                [get_lang('SearchPrefilterPrefix'), $url],
                 $sf_values,
                 ''
             );
@@ -867,11 +866,11 @@ function handleSearch()
             $dir_is_writable = Display::return_icon('bullet_red.png', get_lang('Error'));
         }
 
-        $data = array();
-        $data[] = array(get_lang('XapianModuleInstalled'), $xapianLoaded);
-        $data[] = array(get_lang('DirectoryExists').' - '.$xapianPath, $dir_exists);
-        $data[] = array(get_lang('IsWritable').' - '.$xapianPath, $dir_is_writable);
-        $data[] = array(get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists);
+        $data = [];
+        $data[] = [get_lang('XapianModuleInstalled'), $xapianLoaded];
+        $data[] = [get_lang('DirectoryExists').' - '.$xapianPath, $dir_exists];
+        $data[] = [get_lang('IsWritable').' - '.$xapianPath, $dir_is_writable];
+        $data[] = [get_lang('SpecificSearchFieldsAvailable'), $specific_fields_exists];
 
         showSearchSettingsTable($data);
         showSearchToolsStatusTable();
@@ -947,11 +946,11 @@ function displayTemplates()
         1
     );
     $table->set_additional_parameters(
-        array('category' => Security::remove_XSS($_GET['category']))
+        ['category' => Security::remove_XSS($_GET['category'])]
     );
-    $table->set_header(0, get_lang('Image'), true, array('style' => 'width: 101px;'));
+    $table->set_header(0, get_lang('Image'), true, ['style' => 'width: 101px;']);
     $table->set_header(1, get_lang('Title'));
-    $table->set_header(2, get_lang('Actions'), false, array('style' => 'width:50px;'));
+    $table->set_header(2, get_lang('Actions'), false, ['style' => 'width:50px;']);
     $table->set_column_filter(2, 'actionsFilter');
     $table->set_column_filter(0, 'searchImageFilter');
     $table->display();
@@ -1003,7 +1002,7 @@ function getTemplateData($from, $number_of_items, $column, $direction)
     $sql .= " ORDER BY col$column $direction ";
     $sql .= " LIMIT $from,$number_of_items";
     $result = Database::query($sql);
-    $return = array();
+    $return = [];
     while ($row = Database::fetch_array($result)) {
         $row['1'] = get_lang($row['1']);
         $return[] = $row;
@@ -1223,7 +1222,7 @@ function addEditTemplate()
     } else {
         $token = Security::get_token();
         $form->addElement('hidden', 'sec_token');
-        $form->setConstants(array('sec_token' => $token));
+        $form->setConstants(['sec_token' => $token]);
         // Display the form.
         $form->display();
     }
@@ -1280,7 +1279,7 @@ function select_timezone_value()
  */
 function select_gradebook_number_decimals()
 {
-    return array('0', '1', '2');
+    return ['0', '1', '2'];
 }
 
 /**
@@ -1291,7 +1290,7 @@ function select_gradebook_default_grade_model_id()
 {
     $grade_model = new GradeModel();
     $models = $grade_model->get_all();
-    $options = array();
+    $options = [];
     $options[-1] = get_lang('None');
 
     if (!empty($models)) {
@@ -1340,7 +1339,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
         $form->addGroup($group, 'buttons_in_action_right');
     }*/
 
-    $default_values = array();
+    $default_values = [];
     $url_info = api_get_access_url($url_id);
     $i = 0;
     $addedSettings = [];
@@ -1391,14 +1390,14 @@ function generateSettingsForm($settings, $settings_by_access_list)
             }
         }
 
-        $hideme = array();
+        $hideme = [];
         $hide_element = false;
 
         if ($_configuration['access_url'] != 1) {
             if ($row['access_url_changeable'] == 0) {
                 // We hide the element in other cases (checkbox, radiobutton) we 'freeze' the element.
                 $hide_element = true;
-                $hideme = array('disabled');
+                $hideme = ['disabled'];
             } elseif ($url_info['active'] == 1) {
                 // We show the elements.
                 if (empty($row['variable'])) {
@@ -1429,12 +1428,12 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'text',
                         $row['variable'],
-                        array(
+                        [
                             get_lang($row['title']),
                             get_lang($row['comment']),
                             get_lang('MB')
-                        ),
-                        array('maxlength' => '8', 'aria-label' => get_lang($row['title']))
+                        ],
+                        ['maxlength' => '8', 'aria-label' => get_lang($row['title'])]
                     );
                     $form->applyFilter($row['variable'], 'html_filter');
                     $default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1);
@@ -1442,11 +1441,11 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'text',
                         $row['variable'],
-                        array(
+                        [
                             get_lang($row['title']),
                             get_lang($row['comment']),
-                        ),
-                        array('maxlength' => '5', 'aria-label' => get_lang($row['title']))
+                        ],
+                        ['maxlength' => '5', 'aria-label' => get_lang($row['title'])]
                     );
                     $form->applyFilter($row['variable'], 'html_filter');
                     $default_values[$row['variable']] = $row['selected_value'];
@@ -1460,10 +1459,10 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'text',
                         $row['variable'],
-                        array(
+                        [
                             get_lang($row['title']),
                             get_lang($row['comment'])
-                        ),
+                        ],
                         $hideme
                     );
                     $form->applyFilter($row['variable'], 'html_filter');
@@ -1480,8 +1479,8 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'textarea',
                         $row['variable'],
-                        array(get_lang($row['title']), get_lang($row['comment'])),
-                        array('rows' => '10', 'id' => $row['variable']),
+                        [get_lang($row['title']), get_lang($row['comment'])],
+                        ['rows' => '10', 'id' => $row['variable']],
                         $hideme
                     );
                     $default_values[$row['variable']] = $value;
@@ -1494,8 +1493,8 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'textarea',
                         $row['variable'],
-                        array(get_lang($row['title']), get_lang($row['comment'])),
-                        array('rows' => '10', 'id' => $row['variable']),
+                        [get_lang($row['title']), get_lang($row['comment'])],
+                        ['rows' => '10', 'id' => $row['variable']],
                         $hideme
                     );
                     $default_values[$row['variable']] = $value;
@@ -1503,9 +1502,9 @@ function generateSettingsForm($settings, $settings_by_access_list)
                     $form->addElement(
                         'textarea',
                         $row['variable'],
-                        array(get_lang($row['title']),
-                        get_lang($row['comment'])),
-                        array('rows' => '10', 'id' => $row['variable']),
+                        [get_lang($row['title']),
+                        get_lang($row['comment'])],
+                        ['rows' => '10', 'id' => $row['variable']],
                         $hideme
                     );
                     $default_values[$row['variable']] = $row['selected_value'];
@@ -1513,7 +1512,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 break;
             case 'radio':
                 $values = api_get_settings_options($row['variable']);
-                $group = array();
+                $group = [];
                 if (is_array($values)) {
                     foreach ($values as $key => $value) {
                         $element = &$form->createElement(
@@ -1532,7 +1531,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 $form->addGroup(
                     $group,
                     $row['variable'],
-                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    [get_lang($row['title']), get_lang($row['comment'])],
                     null,
                     false
                 );
@@ -1544,7 +1543,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                         WHERE variable='".$row['variable']."' AND access_url =  1";
 
                 $result = Database::query($sql);
-                $group = array();
+                $group = [];
                 while ($rowkeys = Database::fetch_array($result)) {
                     // Profile tab option should be hidden when the social tool is enabled.
                     if (api_get_setting('allow_social_tool') == 'true') {
@@ -1595,7 +1594,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 $form->addGroup(
                     $group,
                     $row['variable'],
-                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    [get_lang($row['title']), get_lang($row['comment'])],
                     null
                 );
                 break;
@@ -1603,7 +1602,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 $form->addElement(
                     'static',
                     null,
-                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    [get_lang($row['title']), get_lang($row['comment'])],
                     get_lang('CurrentValue').' : '.$row['selected_value'],
                     $hideme
                 );
@@ -1616,7 +1615,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 $form->addElement(
                     'select',
                     $row['variable'],
-                    array(get_lang($row['title']), get_lang($row['comment'])),
+                    [get_lang($row['title']), get_lang($row['comment'])],
                     call_user_func('select_'.$row['variable']),
                     $hideme
                 );
@@ -1654,7 +1653,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
                 }
 
                 $form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark'));
-                $allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif');
+                $allowed_picture_types = ['jpg', 'jpeg', 'png', 'gif'];
                 $form->addRule(
                     'pdf_export_watermark_path',
                     get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
@@ -1690,13 +1689,13 @@ function generateSettingsForm($settings, $settings_by_access_list)
 function searchSetting($search)
 {
     if (empty($search)) {
-        return array();
+        return [];
     }
     $table_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
     $sql = "SELECT * FROM $table_settings_current
             WHERE category <> 'Plugins' ORDER BY id ASC ";
     $result = Database::store_result(Database::query($sql), 'ASSOC');
-    $settings = array();
+    $settings = [];
 
     $search = api_strtolower($search);
 
@@ -1719,7 +1718,6 @@ function searchSetting($search)
                 } else {
                     $found = true;
                 }
-
             } else {
                 $found = true;
             }
@@ -1736,9 +1734,9 @@ function searchSetting($search)
  * @param array $values Values to browse through
  * @return array
  */
-function formGenerateElementsGroup($form, $values = array(), $elementName)
+function formGenerateElementsGroup($form, $values = [], $elementName)
 {
-    $group = array();
+    $group = [];
     if (is_array($values)) {
         foreach ($values as $key => $value) {
             $element = &$form->createElement('radio', $elementName, '', get_lang($value['display_text']), $value['value']);
@@ -1753,7 +1751,7 @@ function formGenerateElementsGroup($form, $values = array(), $elementName)
  */
 function getAllowedFileTypes()
 {
-    $allowedFiles = array(
+    $allowedFiles = [
         'css',
         'zip',
         'jpeg',
@@ -1767,7 +1765,7 @@ function getAllowedFileTypes()
         'webp',
         'woff',
         'woff2'
-    );
+    ];
     return $allowedFiles;
 }
 /**
@@ -1806,7 +1804,7 @@ function showSearchToolsStatusTable()
 {
     //@todo windows support
     if (api_is_windows_os() == false) {
-        $list_of_programs = array('pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv');
+        $list_of_programs = ['pdftotext', 'ps2pdf', 'catdoc', 'html2text', 'unrtf', 'catppt', 'xls2csv'];
         foreach ($list_of_programs as $program) {
             $output = [];
             $ret_val = null;
@@ -1820,7 +1818,7 @@ function showSearchToolsStatusTable()
             if (!empty($output[0])) {
                 $icon = Display::return_icon('bullet_green.png', get_lang('Installed'));
             }
-            $data2[] = array($program, $output[0], $icon);
+            $data2[] = [$program, $output[0], $icon];
         }
         echo Display::tag('h3', get_lang('ProgramsNeededToConvertFiles'));
         $table = new SortableTableFromArray($data2);
@@ -1891,7 +1889,7 @@ function isStyleChangeable()
 function getCategorySettings($category = '')
 {
     $url_id = api_get_current_access_url_id();
-    $settings_by_access_list = array();
+    $settings_by_access_list = [];
 
     if ($url_id == 1) {
         $settings = api_get_settings($category, 'group', $url_id);
@@ -1922,7 +1920,7 @@ function getCategorySettings($category = '')
                 if ($row['access_url_changeable'] == 1) {
                     $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = $row;
                 } else {
-                    $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = array();
+                    $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']] = [];
                 }
             }
         }
@@ -1934,8 +1932,8 @@ function getCategorySettings($category = '')
         }
     }
 
-    return array(
+    return [
         'settings' => $settings,
         'settings_by_access_list' => $settings_by_access_list
-    );
+    ];
 }

+ 38 - 38
main/admin/settings.php

@@ -32,19 +32,19 @@ if (isset($_POST['save']) && isset($_GET['category']) && $_GET['category'] === '
 }
 
 // Settings to avoid
-$settings_to_avoid = array(
+$settings_to_avoid = [
     'use_session_mode' => 'true',
     'gradebook_enable' => 'false',
     // ON by default - now we have this option when  we create a course
     'example_material_course_creation' => 'true'
-);
+];
 
-$convert_byte_to_mega_list = array(
+$convert_byte_to_mega_list = [
     'dropbox_max_filesize',
     'message_max_upload_filesize',
     'default_document_quotum',
     'default_group_quotum'
-);
+];
 
 if (isset($_POST['style'])) {
     Display::$preview_style = $_POST['style'];
@@ -54,7 +54,7 @@ if (isset($_POST['style'])) {
 $table_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
 
 // Setting breadcrumbs.
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 
 // Setting the name of the tool.
 $tool_name = get_lang('PlatformConfigSettings');
@@ -77,17 +77,17 @@ $form_search = new FormValidator(
     'get',
     api_get_self(),
     null,
-    array(),
+    [],
     FormValidator::LAYOUT_INLINE
 );
-$form_search->addElement('text', 'search_field', null, array(
+$form_search->addElement('text', 'search_field', null, [
     'id' => 'search_field',
     'aria-label' => get_lang('Search')
-));
+]);
 $form_search->addElement('hidden', 'category', 'search_setting');
 $form_search->addButtonSearch(get_lang('Search'), 'submit_button');
 $form_search->setDefaults(
-    array('search_field' => isset($_REQUEST['search_field']) ? $_REQUEST['search_field'] : null)
+    ['search_field' => isset($_REQUEST['search_field']) ? $_REQUEST['search_field'] : null]
 );
 
 $form_search_html = $form_search->returnForm();
@@ -98,7 +98,7 @@ $settings = null;
 
 // Build the form.
 if (!empty($_GET['category']) &&
-    !in_array($_GET['category'], array('Plugins', 'stylesheets', 'Search'))
+    !in_array($_GET['category'], ['Plugins', 'stylesheets', 'Search'])
 ) {
     $my_category = isset($_GET['category']) ? $_GET['category'] : null;
     $settings_array = getCategorySettings($my_category);
@@ -136,15 +136,15 @@ if (!empty($_GET['category']) &&
                             $changeable = 1;
                         }
 
-                        $params = array('variable = ?' => array($key));
+                        $params = ['variable = ?' => [$key]];
                         $data = api_get_settings_params($params);
 
                         if (!empty($data)) {
                             foreach ($data as $item) {
-                                $params = array(
+                                $params = [
                                     'id' => $item['id'],
                                     'access_url_changeable' => $changeable,
-                                );
+                                ];
                                 api_set_setting_simple($params);
                             }
                         }
@@ -211,7 +211,7 @@ if (!empty($_GET['category']) &&
         }
 
         // Save the settings.
-        $keys = array();
+        $keys = [];
 
         foreach ($values as $key => $value) {
             if (strcmp($key, 'MAX_FILE_SIZE') === 0) {
@@ -381,34 +381,34 @@ $action_images['facebook'] = 'facebook.png';
 $action_images['crons'] = 'crons.png';
 $action_images['webservices'] = 'webservices.png';
 
-$action_array = array();
-$resultcategories = array();
-
-$resultcategories[] = array('category' => 'Platform');
-$resultcategories[] = array('category' => 'Course');
-$resultcategories[] = array('category' => 'Session');
-$resultcategories[] = array('category' => 'Languages');
-$resultcategories[] = array('category' => 'User');
-$resultcategories[] = array('category' => 'Tools');
-$resultcategories[] = array('category' => 'Editor');
-$resultcategories[] = array('category' => 'Security');
-$resultcategories[] = array('category' => 'Tuning');
-$resultcategories[] = array('category' => 'Gradebook');
-$resultcategories[] = array('category' => 'Timezones');
-$resultcategories[] = array('category' => 'Tracking');
-$resultcategories[] = array('category' => 'Search');
-$resultcategories[] = array('category' => 'Stylesheets');
-$resultcategories[] = array('category' => 'Templates');
-$resultcategories[] = array('category' => 'Plugins');
-$resultcategories[] = array('category' => 'LDAP');
-$resultcategories[] = array('category' => 'CAS');
-$resultcategories[] = array('category' => 'Shibboleth');
-$resultcategories[] = array('category' => 'Facebook');
+$action_array = [];
+$resultcategories = [];
+
+$resultcategories[] = ['category' => 'Platform'];
+$resultcategories[] = ['category' => 'Course'];
+$resultcategories[] = ['category' => 'Session'];
+$resultcategories[] = ['category' => 'Languages'];
+$resultcategories[] = ['category' => 'User'];
+$resultcategories[] = ['category' => 'Tools'];
+$resultcategories[] = ['category' => 'Editor'];
+$resultcategories[] = ['category' => 'Security'];
+$resultcategories[] = ['category' => 'Tuning'];
+$resultcategories[] = ['category' => 'Gradebook'];
+$resultcategories[] = ['category' => 'Timezones'];
+$resultcategories[] = ['category' => 'Tracking'];
+$resultcategories[] = ['category' => 'Search'];
+$resultcategories[] = ['category' => 'Stylesheets'];
+$resultcategories[] = ['category' => 'Templates'];
+$resultcategories[] = ['category' => 'Plugins'];
+$resultcategories[] = ['category' => 'LDAP'];
+$resultcategories[] = ['category' => 'CAS'];
+$resultcategories[] = ['category' => 'Shibboleth'];
+$resultcategories[] = ['category' => 'Facebook'];
 $resultcategories[] = ['category' => 'Crons'];
 $resultcategories[] = ['category' => 'WebServices'];
 
 foreach ($resultcategories as $row) {
-    $url = array();
+    $url = [];
     $url['url'] = api_get_self()."?category=".$row['category'];
     $url['content'] = Display::return_icon(
         $action_images[strtolower($row['category'])],

+ 2 - 2
main/admin/skill.php

@@ -54,8 +54,8 @@ if (!empty($item)) {
 }
 $formToDisplay = $form->returnForm();
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => api_get_self(), 'name' => get_lang('ManageSkillsLevels'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => api_get_self(), 'name' => get_lang('ManageSkillsLevels')];
 
 $tpl = new Template($action);
 switch ($action) {

+ 4 - 4
main/admin/skill_badge.php

@@ -21,12 +21,12 @@ if (strcmp($backpack, $configBackpack) !== 0) {
     $backpack = $configBackpack;
 }
 
-$interbreadcrumb = array(
-    array(
+$interbreadcrumb = [
+    [
         'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
         'name' => get_lang('Administration')
-    )
-);
+    ]
+];
 
 $toolbar = Display::url(
     Display::return_icon(

+ 7 - 7
main/admin/skill_badge_create.php

@@ -34,9 +34,9 @@ $badgeStudio = [
 ];
 
 if ($_SERVER['REQUEST_METHOD'] === 'POST') {
-    $params = array(
+    $params = [
         'id' => $skillId
-    );
+    ];
 
     if ((isset($_FILES['image']) && $_FILES['image']['error'] == 0) ||
         !empty($_POST['badge_studio_image'])
@@ -90,13 +90,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
     exit;
 }
 
-$interbreadcrumb = array(
-    array(
+$interbreadcrumb = [
+    [
         'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
         'name' => get_lang('Administration')
-    )
-);
-$interbreadcrumb[] = array('url' => 'skill_list.php', 'name' => get_lang('ManageSkills'));
+    ]
+];
+$interbreadcrumb[] = ['url' => 'skill_list.php', 'name' => get_lang('ManageSkills')];
 
 $toolbar = $objSkill->getToolBar();
 

+ 6 - 6
main/admin/skill_badge_list.php

@@ -20,16 +20,16 @@ $this_section = SECTION_PLATFORM_ADMIN;
 $objSkill = new Skill();
 $skills = $objSkill->get_all();
 
-$interbreadcrumb = array(
-    array(
+$interbreadcrumb = [
+    [
         'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
         'name' => get_lang('Administration')
-    ),
-    array(
+    ],
+    [
         'url' => api_get_path(WEB_CODE_PATH).'admin/skill_badge.php',
         'name' => get_lang('Badges')
-    )
-);
+    ]
+];
 
 $toolbar = Display::url(
     Display::return_icon(

+ 2 - 2
main/admin/skill_create.php

@@ -16,8 +16,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 Skill::isAllowed();
 
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'skill_list.php', 'name' => get_lang('ManageSkills'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'skill_list.php', 'name' => get_lang('ManageSkills')];
 
 /* Process data */
 $skillParentId = isset($_GET['parent']) ? intval($_GET['parent']) : 0;

+ 2 - 2
main/admin/skill_edit.php

@@ -16,8 +16,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 Skill::isAllowed();
 
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'skill_list.php', 'name' => get_lang('ManageSkills'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'skill_list.php', 'name' => get_lang('ManageSkills')];
 
 /* Process data */
 $skillId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;

+ 2 - 2
main/admin/skill_level.php

@@ -52,8 +52,8 @@ if (!empty($item)) {
 }
 $formToDisplay = $form->returnForm();
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => api_get_self(), 'name' => get_lang('SkillProfile'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => api_get_self(), 'name' => get_lang('SkillProfile')];
 
 $tpl = new Template($action);
 switch ($action) {

+ 1 - 2
main/admin/skill_list.php

@@ -110,9 +110,8 @@ switch ($action) {
         exit;
         break;
     case 'list':
-        // no break
     default:
-        $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+        $interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 
         $toolbar = Display::url(
             Display::return_icon(

+ 3 - 3
main/admin/skill_profile.php

@@ -42,9 +42,9 @@ if (!empty($item)) {
 }
 $formToDisplay = $form->returnForm();
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'skill.php', 'name' => get_lang('ManageSkillsLevels'));
-$interbreadcrumb[] = array('url' =>  api_get_self(), 'name' => get_lang('SkillProfile'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'skill.php', 'name' => get_lang('ManageSkillsLevels')];
+$interbreadcrumb[] = ['url' =>  api_get_self(), 'name' => get_lang('SkillProfile')];
 
 $toolbar = null;
 

+ 15 - 15
main/admin/skills_gradebook.php

@@ -20,9 +20,9 @@ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'display';
 
 // setting breadcrumbs
 $tool_name = get_lang('SkillsAndGradebooks');
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 if ($action == 'add_skill') {
-    $interbreadcrumb[] = array('url' => 'skills_gradebook.php', 'name' => get_lang('SkillsAndGradebooks'));
+    $interbreadcrumb[] = ['url' => 'skills_gradebook.php', 'name' => get_lang('SkillsAndGradebooks')];
     $tool_name = get_lang('Add');
 }
 
@@ -53,44 +53,44 @@ Display::display_header($tool_name);
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_gradebooks';
 
 //The order is important you need to check the the $column variable in the model.ajax.php file
-$columns = array(
+$columns = [
     get_lang('Name'),
     get_lang('CertificatesFiles'),
     get_lang('Skills'),
     get_lang('Actions')
-);
+];
 
 //Column config
-$column_model = array(
-    array(
+$column_model = [
+    [
         'name' => 'name',
         'index' => 'name',
         'width' => '150',
         'align' => 'left'
-    ),
-    array(
+    ],
+    [
         'name' => 'certificate',
         'index' => 'certificate',
         'width' => '25',
         'align' => 'left',
         'sortable' => 'false'
-    ),
-    array(
+    ],
+    [
         'name' => 'skills',
         'index' => 'skills',
         'width' => '300',
         'align' => 'left',
         'sortable' => 'false'
-    ),
-    array(
+    ],
+    [
         'name' => 'actions',
         'index' => 'actions',
         'width' => '30',
         'align' => 'left',
         'formatter' => 'action_formatter',
         'sortable' => 'false'
-    )
-);
+    ]
+];
 //Autowidth
 $extra_params['autowidth'] = 'true';
 //height auto
@@ -116,7 +116,7 @@ $(function() {
         $columns,
         $column_model,
         $extra_params,
-        array(),
+        [],
         $action_links,
         true
     );

+ 13 - 13
main/admin/skills_import.php

@@ -17,9 +17,9 @@ require_once __DIR__.'/../inc/global.inc.php';
  */
 function validate_data($skills)
 {
-    $errors = array();
+    $errors = [];
     // 1. Check if mandatory fields are set.
-    $mandatory_fields = array('id', 'parent_id', 'name');
+    $mandatory_fields = ['id', 'parent_id', 'name'];
     foreach ($skills as $index => $skill) {
         foreach ($mandatory_fields as $field) {
             if (empty($skill[$field])) {
@@ -57,7 +57,7 @@ function validate_data($skills)
 function save_data($skills)
 {
     if (is_array($skills)) {
-        $parents = array();
+        $parents = [];
         foreach ($skills as $index => $skill) {
             if (isset($parents[$skill['parent_id']])) {
                 $skill['parent_id'] = $parents[$skill['parent_id']];
@@ -99,7 +99,7 @@ function element_start($parser, $data)
     global $current_tag;
     switch ($data) {
         case 'Skill':
-            $skill = array();
+            $skill = [];
             break;
         default:
             $current_tag = $data;
@@ -146,7 +146,7 @@ function parse_xml_data($file)
     global $current_value;
     global $skill;
     global $skills;
-    $skills = array();
+    $skills = [];
     $parser = xml_parser_create('UTF-8');
     xml_set_element_handler($parser, 'element_start', 'element_end');
     xml_set_character_data_handler($parser, 'character_data');
@@ -161,18 +161,18 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 $tool_name = get_lang('ImportSkillsListCSV');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
-$user_id_error = array();
+$user_id_error = [];
 $error_message = '';
 
 if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
     $file_type = $_POST['file_type'];
     Security::clear_token();
     $tok = Security::get_token();
-    $allowed_file_mimetype = array('csv', 'xml');
+    $allowed_file_mimetype = ['csv', 'xml'];
     $error_kind_file = false;
     $error_message = '';
 
@@ -195,7 +195,7 @@ if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
     }
 
     // List skill id with error.
-    $skills_to_insert = $skill_id_error = array();
+    $skills_to_insert = $skill_id_error = [];
     if (is_array($errors)) {
         foreach ($errors as $my_errors) {
             $skill_id_error[] = $my_errors['SkillName'];
@@ -238,7 +238,7 @@ if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) {
     }
 }
 
-$interbreadcrumb[] = array("url" => 'skill_list.php', "name" => get_lang('ManageSkills'));
+$interbreadcrumb[] = ["url" => 'skill_list.php', "name" => get_lang('ManageSkills')];
 
 Display :: display_header($tool_name);
 
@@ -256,7 +256,7 @@ $form = new FormValidator('user_import', 'post', 'skills_import.php');
 $form->addElement('header', '', $tool_name);
 $form->addElement('hidden', 'formSent');
 $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
-$group = array();
+$group = [];
 $group[] = $form->createElement(
     'radio',
     'file_type',
@@ -272,8 +272,8 @@ $defaults['file_type'] = 'csv';
 $form->setDefaults($defaults);
 $form->display();
 
-$list = array();
-$list_reponse = array();
+$list = [];
+$list_reponse = [];
 $result_xml = '';
 $i = 0;
 $count_fields = count($extra_fields);

+ 12 - 12
main/admin/skills_profile.php

@@ -14,10 +14,10 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script();
 Skill::isAllowed();
 
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     "name" => get_lang('PlatformAdmin'),
-);
+];
 
 $skill = new Skill();
 $skill_profile = new SkillProfile();
@@ -28,21 +28,21 @@ $tpl = new Template(get_lang('Skills'));
 $form = new FormValidator('profile_search');
 
 $form->addElement('header', get_lang('SearchSkills'));
-$form->addElement('select', 'skills', null, null, array('id'=>'skills'));
+$form->addElement('select', 'skills', null, null, ['id'=>'skills']);
 $form->addButtonSearch(get_lang('Search'));
 
 $profiles = $skill_profile->get_all();
 
 $tpl->assign('profiles', $profiles);
 
-$total_skills_to_search = array();
+$total_skills_to_search = [];
 
 if ($form->validate()) {
     $values = $form->getSubmitValues();
 
     $skills = $values['skills'];
     if (!empty($skills)) {
-        $hidden_skills = isset($values['hidden_skills']) ? $values['hidden_skills'] : array();
+        $hidden_skills = isset($values['hidden_skills']) ? $values['hidden_skills'] : [];
         $skills = array_merge($skills, $hidden_skills);
         $skills = array_filter($skills);
         $skills = array_unique($skills);
@@ -54,7 +54,7 @@ if ($form->validate()) {
     $skills = Session::read('skills', []);
 }
 
-$user_list = array();
+$user_list = [];
 $count_skills = count($skills);
 $users = $skill_rel_user->getUserBySkills($skills);
 
@@ -63,7 +63,7 @@ if (!empty($users)) {
         $user_info = api_get_user_info($user['user_id']);
         $user_list[$user['user_id']]['user'] = $user_info;
         $my_user_skills = $skill_rel_user->getUserSkills($user['user_id']);
-        $user_skills = array();
+        $user_skills = [];
         $found_counts = 0;
         foreach ($my_user_skills as $my_skill) {
             $found = false;
@@ -71,16 +71,16 @@ if (!empty($users)) {
                 $found = true;
                 $found_counts++;
             }
-            $user_skills[] = array(
+            $user_skills[] = [
                 'skill_id' => $my_skill['skill_id'],
                 'found' => $found,
-            );
+            ];
             $total_skills_to_search[$my_skill['skill_id']] = $my_skill['skill_id'];
         }
         $user_list[$user['user_id']]['skills'] = $user_skills;
         $user_list[$user['user_id']]['total_found_skills'] = $found_counts;
     }
-    $ordered_user_list = array();
+    $ordered_user_list = [];
     foreach ($user_list as $user_id => $user_data) {
         $ordered_user_list[$user_data['total_found_skills']][] = $user_data;
     }
@@ -112,7 +112,7 @@ $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
 
 switch ($action) {
     case 'remove_skill':
-        $new_skill = array();
+        $new_skill = [];
         foreach ($skills as $skill_id) {
             if ($id != $skill_id) {
                 $new_skill[] = $skill_id;
@@ -128,7 +128,7 @@ switch ($action) {
         break;
 }
 
-$skill_list = array();
+$skill_list = [];
 foreach ($total_skills_to_search as $skill_info) {
     $skill_list[$skill_info['id']] = $skill_info;
 }

+ 4 - 4
main/admin/special_exports.php

@@ -17,7 +17,7 @@ $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
 $this_section = SECTION_PLATFORM_ADMIN;
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 // Access restrictions
 api_protect_admin_script(true);
 $nameTools = get_lang('SpecialExports');
@@ -52,7 +52,7 @@ if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') ||
         $to_group_id = 0;
         $sql_session = "SELECT id, name FROM $tbl_session ";
         $query_session = Database::query($sql_session);
-        $ListSession = array();
+        $ListSession = [];
         while ($rows_session = Database::fetch_assoc($query_session)) {
             $ListSession[$rows_session['id']] = $rows_session['name'];
         }
@@ -192,13 +192,13 @@ function create_zip()
         closedir($handle);
     }
     $temp_zip_file = $temp_zip_dir."/".md5(time()).".zip"; //create zipfile of given directory
-    return array(
+    return [
         'PATH' => $path,
         'PATH_TEMP_ARCHIVE' => $temp_zip_dir,
         'PATH_COURSE' => $sys_course_path,
         'TEMP_FILE_ZIP' => $temp_zip_file,
         'PATH_REMOVE' => $remove_dir
-    );
+    ];
 }
 
 function rename_zip($FileZip)

+ 4 - 4
main/admin/specific_fields.php

@@ -15,8 +15,8 @@ require_once __DIR__.'/../inc/global.inc.php';
 api_protect_admin_script();
 
 // Breadcrumb
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')];
 
 $libpath = api_get_path(LIBRARY_PATH);
 
@@ -34,8 +34,8 @@ $form->addElement(
 );
 
 // Create a sortable table with specific fields data
-$column_show = array(1, 1, 1);
-$column_order = array(3, 2, 1);
+$column_show = [1, 1, 1];
+$column_order = [3, 2, 1];
 $extra_fields = get_specific_field_list();
 $number_of_extra_fields = count($extra_fields);
 

+ 8 - 8
main/admin/specific_fields_add.php

@@ -19,18 +19,18 @@ $this_section = SECTION_PLATFORM_ADMIN;
 // user permissions
 api_protect_admin_script();
 $fieldId = isset($_REQUEST['field_id']) ? intval($_REQUEST['field_id']) : 0;
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     'name' => get_lang('PlatformAdmin'),
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => 'settings.php?category=Search',
     'name' => get_lang('PlatformConfigSettings'),
-);
-$interbreadcrumb[] = array(
+];
+$interbreadcrumb[] = [
     'url' => 'specific_fields.php',
     'name' => get_lang('SpecificSearchFields'),
-);
+];
 
 $tool_name = get_lang('AddSpecificSearchField');
 
@@ -49,9 +49,9 @@ $form->addRule('field_name', get_lang('OnlyLettersAndNumbersAllowed'), 'username
 $form->addRule('field_name', '', 'maxlength', 20);
 
 // Set default values (only not empty when editing)
-$defaults = array();
+$defaults = [];
 if ($fieldId) {
-    $form_information = get_specific_field_list(array('id' => $fieldId));
+    $form_information = get_specific_field_list(['id' => $fieldId]);
     $defaults['field_name'] = $form_information[0]['name'];
 }
 $form->setDefaults($defaults);

+ 1 - 1
main/admin/statistics.php

@@ -11,7 +11,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', "name" => get_lang('PlatformAdmin')];
 $tool_name = get_lang('Statistics');
 Display::display_header($tool_name);
 Display::display_footer();

+ 5 - 5
main/admin/statistics/index.php

@@ -10,7 +10,7 @@ $cidReset = true;
 require_once __DIR__.'/../../inc/global.inc.php';
 api_protect_admin_script();
 
-$interbreadcrumb[] = array('url' => '../index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => '../index.php', 'name' => get_lang('PlatformAdmin')];
 
 $report = isset($_REQUEST['report']) ? $_REQUEST['report'] : '';
 
@@ -101,14 +101,14 @@ switch ($report) {
         break;
     case 'users':
         // total amount of users
-        $teachers = $students = array();
+        $teachers = $students = [];
         $countInvisible = isset($_GET['count_invisible_courses']) ? intval($_GET['count_invisible_courses']) : null;
         Statistics::printStats(
             get_lang('NumberOfUsers'),
-            array(
+            [
                 get_lang('Teachers') => Statistics::countUsers(COURSEMANAGER, null, $countInvisible),
                 get_lang('Students') => Statistics::countUsers(STUDENT, null, $countInvisible)
-            )
+            ]
         );
         foreach ($course_categories as $code => $name) {
             $name = str_replace(get_lang('Department'), "", $name);
@@ -136,7 +136,7 @@ switch ($report) {
         Statistics::printUsersNotLoggedInStats();
         break;
     case 'zombies':
-        ZombieReport::create(array('report' => 'zombies'))->display();
+        ZombieReport::create(['report' => 'zombies'])->display();
         break;
     case 'activities':
         Statistics::printActivitiesStats();

+ 0 - 1
main/admin/sub_language.class.php

@@ -2,4 +2,3 @@
 /*
  * File needed to overwrite file in 1.9.x
  */
-

+ 12 - 12
main/admin/sub_language.php

@@ -61,8 +61,8 @@ $htmlHeadXtra[] = '<script>
 // setting the name of the tool
 $tool_name = get_lang('CreateSubLanguage');
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'languages.php', 'name' => get_lang('PlatformLanguages'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'languages.php', 'name' => get_lang('PlatformLanguages')];
 
 $sublanguage_folder_error = false;
 
@@ -146,7 +146,7 @@ function search_language_term(
     global $language_files_to_load, $sub_language_array, $english_language_array, $parent_language_array;
     $language_files_to_load_keys = array_flip($language_files_to_load);
     $array_to_search = $parent_language_array;
-    $list_info = array();
+    $list_info = [];
     $term = '/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i';
     //@todo optimize this foreach
     foreach ($language_files_to_load as $lang_file) {
@@ -179,14 +179,14 @@ function search_language_term(
                     $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>';
                     $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>';
 
-                    $list_info[] = array(
+                    $list_info[] = [
                         $lang_file.'.inc.php',
                         $parent_name_variable,
                         $english_name_variable,
                         $parent_variable_value,
                         $obj_text,
                         $obj_button
-                    );
+                    ];
                 }
             }
         }
@@ -239,14 +239,14 @@ function search_language_term(
                     //loading variable from the english array
                     $english_name_variable = $english_language_array[$lang_file][$name_variable];
 
-                    $list_info[] = array(
+                    $list_info[] = [
                         $lang_file.'.inc.php',
                         $name_variable,
                         $english_name_variable,
                         $parent_variable_value,
                         $obj_text,
                         $obj_button
-                    );
+                    ];
                 }
             }
         }
@@ -278,10 +278,10 @@ function search_language_term(
 
                     //loading variable from the english array
                     $english_name_variable = $english_language_array[$lang_file][$name_variable];
-                    $list_info[] = array($lang_file.'.inc.php',
+                    $list_info[] = [$lang_file.'.inc.php',
                         $name_variable,
                         $english_name_variable,
-                        $parent_variable_value, $obj_text, $obj_button);
+                        $parent_variable_value, $obj_text, $obj_button];
                 }
             }
         }
@@ -292,7 +292,7 @@ function search_language_term(
 }
 
 // Allow see data in sort table
-$list_info = array();
+$list_info = [];
 if (isset($_REQUEST['txt_search_word'])) {
     //@todo fix to accept a char with 1 char
     if (strlen(trim($_REQUEST['txt_search_word'])) > 2) {
@@ -306,11 +306,11 @@ if (isset($_REQUEST['txt_search_word'])) {
     }
 }
 
-$parameters = array(
+$parameters = [
     'id' => intval($_GET['id']),
     'sub_language_id' => intval($_GET['sub_language_id']),
     'txt_search_word' => $txt_search_word
-);
+];
 $table = new SortableTableFromArrayConfig($list_info, 1, 20, 'data_info');
 $table->set_additional_parameters($parameters);
 $table->set_header(0, get_lang('LanguageFile'));

+ 5 - 7
main/admin/sub_language_add.php

@@ -18,8 +18,8 @@ api_protect_admin_script();
 $tool_name = get_lang('CreateSubLanguage');
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'languages.php', 'name' => get_lang('PlatformLanguages'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => 'languages.php', 'name' => get_lang('PlatformLanguages')];
 
 /**
  * Add sub-language
@@ -75,7 +75,7 @@ function check_if_language_exist($original_name, $english_name, $isocode, $subla
     $count_english_name = Database::result($rs_english_name, 0, 'count_english_name');
 
     $has_error = false;
-    $message_information = array();
+    $message_information = [];
 
     if ($count_original_name == 1) {
         $has_error = true;
@@ -154,9 +154,8 @@ if (isset($_GET['sub_language_id']) && $_GET['sub_language_id'] == strval(intval
     } else {
         $sub_language_id_exist = false;
     }
-
 }
-$language_details = array();
+$language_details = [];
 $language_name = '';
 if (isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) {
     $language_details = SubLanguageManager::get_all_information_of_language($_GET['id']);
@@ -181,7 +180,6 @@ if ((isset($_GET['id']) && $_GET['id'] == strval(intval($_GET['id']))) &&
         $original_name = $get_all_information['original_name'];
         $english_name = $get_all_information['english_name'];
         $isocode = $get_all_information['isocode'];
-
     }
 }
 
@@ -203,7 +201,7 @@ if (isset($_POST['SubmitAddNewLanguage'])) {
     $isocode = str_replace(' ', '_', $isocode);
 
     $sublanguage_available = $_POST['sub_language_is_visible'];
-    $check_information = array();
+    $check_information = [];
     $check_information = check_if_language_exist($original_name, $english_name, $isocode, $sublanguage_available);
     foreach ($check_information as $index_information => $value_information) {
         $allow_insert_info = false;

+ 1 - 2
main/admin/sub_language_ajax.inc.php

@@ -32,7 +32,7 @@ if (isset($new_language) && isset($language_variable) && isset($file_id)) {
     // Replace new line signs to avoid parse errors - see #6773
     $new_language = str_replace("\n", "\\n", $new_language);
     $all_file_of_directory[$language_variable] = "\"".$new_language."\";";
-    $result_array = array();
+    $result_array = [];
 
     foreach ($all_file_of_directory as $key_value => $value_info) {
         $result_array[$key_value] = SubLanguageManager::write_data_in_file($path_folder, $value_info, $key_value);
@@ -87,4 +87,3 @@ if (isset($new_language) && isset($language_variable) && isset($file_id)) {
         echo 1;
     }
 }
-

+ 31 - 24
main/admin/subscribe_user2course.php

@@ -22,15 +22,15 @@ api_protect_admin_script();
 $form_sent = 0;
 $first_letter_user = '';
 $first_letter_course = '';
-$courses = array();
-$users = array();
+$courses = [];
+$users = [];
 
 $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
 $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
 
 /* Header */
 $tool_name = get_lang('AddUsersToACourse');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 
 $htmlHeadXtra[] = '<script>
 function validate_filter() {
@@ -53,27 +53,27 @@ $form->display();
 //checking for extra field with filter on
 $extra_field_list = UserManager::get_extra_fields();
 
-$new_field_list = array();
+$new_field_list = [];
 if (is_array($extra_field_list)) {
     foreach ($extra_field_list as $extra_field) {
         //if is enabled to filter and is a "<select>" field type
         if ($extra_field[8] == 1 && $extra_field[2] == ExtraField::FIELD_TYPE_SELECT) {
-            $new_field_list[] = array(
+            $new_field_list[] = [
                 'name' => $extra_field[3],
                 'type' => $extra_field[2],
                 'variable' => $extra_field[1],
                 'data' => $extra_field[9],
-            );
+            ];
         }
         if ($extra_field[8] == 1 && $extra_field[2] == ExtraField::FIELD_TYPE_TAG) {
             $options = UserManager::get_extra_user_data_for_tags($extra_field[1]);
 
-            $new_field_list[] = array(
+            $new_field_list[] = [
                 'name' => $extra_field[3],
                 'type' => $extra_field[2],
                 'variable' => $extra_field[1],
                 'data' => $options['options'],
-            );
+            ];
         }
     }
 }
@@ -81,8 +81,8 @@ if (is_array($extra_field_list)) {
 /* React on POSTed request */
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
-    $users = isset($_POST['UserList']) && is_array($_POST['UserList']) ? $_POST['UserList'] : array();
-    $courses = isset($_POST['CourseList']) && is_array($_POST['CourseList']) ? $_POST['CourseList'] : array();
+    $users = isset($_POST['UserList']) && is_array($_POST['UserList']) ? $_POST['UserList'] : [];
+    $courses = isset($_POST['CourseList']) && is_array($_POST['CourseList']) ? $_POST['CourseList'] : [];
     $first_letter_user = $_POST['firstLetterUser'];
     $first_letter_course = $_POST['firstLetterCourse'];
 
@@ -134,7 +134,7 @@ $extra_field_result = [];
 $use_extra_fields = false;
 if (is_array($extra_field_list)) {
     if (is_array($new_field_list) && count($new_field_list) > 0) {
-        $result_list = array();
+        $result_list = [];
         foreach ($new_field_list as $new_field) {
             $varname = 'field_'.$new_field['variable'];
             $fieldtype = $new_field['type'];
@@ -160,7 +160,7 @@ if (is_array($extra_field_list)) {
 
 
 if ($use_extra_fields) {
-    $final_result = array();
+    $final_result = [];
     if (count($extra_field_result) > 1) {
         for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
             if (is_array($extra_field_result[$i + 1])) {
@@ -320,18 +320,21 @@ if (is_array($extra_field_list)) {
    <tr>
     <td width="40%" align="center">
      <select name="UserList[]" multiple="multiple" size="20" style="width:300px;">
-    <?php foreach ($db_users as $user) { ?>
-          <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
+    <?php foreach ($db_users as $user) {
+          ?>
+          <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) {
+              echo 'selected="selected"';
+          } ?>>
       <?php
         $userName = $user['lastname'].' '.$user['firstname'].' ('.$user['username'].')';
-        if ($showOfficialCode) {
-            $officialCode = !empty($user['official_code']) ? $user['official_code'].' - ' : '? - ';
-            $userName = $officialCode.$userName;
-        }
-        echo $userName;
-      ?>
+          if ($showOfficialCode) {
+              $officialCode = !empty($user['official_code']) ? $user['official_code'].' - ' : '? - ';
+              $userName = $officialCode.$userName;
+          }
+          echo $userName; ?>
           </option>
-    <?php } ?>
+    <?php
+      } ?>
     </select>
    </td>
    <td width="20%" valign="middle" align="center">
@@ -341,11 +344,15 @@ if (is_array($extra_field_list)) {
    </td>
    <td width="40%" align="center">
     <select name="CourseList[]" multiple="multiple" size="20" style="width:300px;">
-    <?php foreach ($db_courses as $course) { ?>
-         <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>>
+    <?php foreach ($db_courses as $course) {
+          ?>
+         <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) {
+              echo 'selected="selected"';
+          } ?>>
              <?php echo '('.$course['visual_code'].') '.$course['title']; ?>
          </option>
-    <?php } ?>
+    <?php
+      } ?>
     </select>
    </td>
   </tr>

+ 18 - 19
main/admin/system_announcements.php

@@ -23,10 +23,10 @@ $action_todo = false;
 api_protect_admin_script(true);
 
 // Setting breadcrumbs.
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     "url" => 'index.php',
     "name" => get_lang('PlatformAdmin'),
-);
+];
 
 $visibleList = SystemAnnouncementManager::getVisibilityList();
 
@@ -36,18 +36,18 @@ if (empty($_GET['lang'])) {
 }
 
 if (!empty($action)) {
-    $interbreadcrumb[] = array(
+    $interbreadcrumb[] = [
         "url" => "system_announcements.php",
         "name" => get_lang('SystemAnnouncements'),
-    );
+    ];
     if ($action == 'add') {
-        $interbreadcrumb[] = array(
+        $interbreadcrumb[] = [
             "url" => '#',
             "name" => get_lang('AddAnnouncement'),
-        );
+        ];
     }
     if ($action == 'edit') {
-        $interbreadcrumb[] = array("url" => '#', "name" => get_lang('Edit'));
+        $interbreadcrumb[] = ["url" => '#', "name" => get_lang('Edit')];
     }
 } else {
     $tool_name = get_lang('SystemAnnouncements');
@@ -57,7 +57,7 @@ if (!empty($action)) {
 Display :: display_header($tool_name);
 if ($action != 'add' && $action != 'edit') {
     echo '<div class="actions">';
-    echo '<a href="?action=add">'.Display::return_icon('add.png', get_lang('AddAnnouncement'), array(), 32).'</a>';
+    echo '<a href="?action=add">'.Display::return_icon('add.png', get_lang('AddAnnouncement'), [], 32).'</a>';
     echo '</div>';
 }
 
@@ -146,7 +146,7 @@ if ($action_todo) {
     $form->addElement('header', '', $form_title);
     $form->addText('title', get_lang('Title'), true);
 
-    $extraOption = array();
+    $extraOption = [];
     $extraOption['all'] = get_lang('All');
     $form->addSelectLanguage(
         'lang',
@@ -160,17 +160,17 @@ if ($action_todo) {
         get_lang('Content'),
         true,
         false,
-        array(
+        [
             'ToolbarSet' => 'PortalNews',
             'Width' => '100%',
             'Height' => '300',
-        )
+        ]
     );
     $form->addDateRangePicker(
         'range',
         get_lang('StartTimeWindow'),
         true,
-        array('id' => 'range')
+        ['id' => 'range']
     );
 
     $group = [];
@@ -207,7 +207,6 @@ if ($action_todo) {
         $text = get_lang('AddNews');
         $class = 'add';
         $form->addElement('hidden', 'action', 'add');
-
     } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {
         $text = get_lang('EditNews');
         $class = 'save';
@@ -251,7 +250,7 @@ if ($action_todo) {
                     if (isset($values['group'])) {
                         SystemAnnouncementManager::announcement_for_groups(
                             $announcement_id,
-                            array($values['group'])
+                            [$values['group']]
                         );
                         echo Display::return_message(
                             get_lang('AnnouncementAdded'),
@@ -280,7 +279,7 @@ if ($action_todo) {
                     if (isset($values['group'])) {
                         SystemAnnouncementManager::announcement_for_groups(
                             $values['id'],
-                            array($values['group'])
+                            [$values['group']]
                         );
                         echo Display::return_message(
                             get_lang('AnnouncementUpdated'),
@@ -304,9 +303,9 @@ if ($action_todo) {
 
 if ($show_announcement_list) {
     $announcements = SystemAnnouncementManager :: get_all_announcements();
-    $announcement_data = array();
+    $announcement_data = [];
     foreach ($announcements as $index => $announcement) {
-        $row = array();
+        $row = [];
         $row[] = $announcement->id;
         $row[] = Display::return_icon(($announcement->visible ? 'accept.png' : 'exclamation.png'), ($announcement->visible ? get_lang('AnnouncementAvailable') : get_lang('AnnouncementNotAvailable')));
         $row[] = $announcement->title;
@@ -326,7 +325,7 @@ if ($show_announcement_list) {
 
 
         $row[] = $announcement->lang;
-        $row[] = "<a href=\"?action=edit&id=".$announcement->id."\">".Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL)."</a> <a href=\"?action=delete&id=".$announcement->id."\"  onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL)."</a>";
+        $row[] = "<a href=\"?action=edit&id=".$announcement->id."\">".Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL)."</a> <a href=\"?action=delete&id=".$announcement->id."\"  onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL)."</a>";
         $announcement_data[] = $row;
     }
     $table = new SortableTableFromArray($announcement_data);
@@ -344,7 +343,7 @@ if ($show_announcement_list) {
 
     $table->set_header($count++, get_lang('Language'));
     $table->set_header($count++, get_lang('Modify'), false, 'width="50px"');
-    $form_actions = array();
+    $form_actions = [];
     $form_actions['delete_selected'] = get_lang('Delete');
     $table->set_form_actions($form_actions);
     $table->display();

+ 1 - 1
main/admin/system_status.php

@@ -11,7 +11,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 // User permissions
 api_protect_admin_script();
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
 Display::display_header(get_lang('SystemStatus'));
 $diag = new Diagnoser();
 $diag->show_html();

+ 44 - 44
main/admin/teacher_time_report.php

@@ -17,10 +17,10 @@ require_once __DIR__.'/../inc/global.inc.php';
 // Setting the section (for the tabs).
 $this_section = SECTION_PLATFORM_ADMIN;
 
-$interbreadcrumb[] = array(
+$interbreadcrumb[] = [
     'url' => 'index.php',
     'name' => get_lang('PlatformAdmin')
-);
+];
 $toolName = get_lang('TeacherTimeReport');
 
 // Access restrictions.
@@ -67,7 +67,7 @@ $courseList = CourseManager::get_courses_list(
     api_get_current_access_url_id()
 );
 
-$sessionList = SessionManager::get_sessions_list(array(), array('name'));
+$sessionList = SessionManager::get_sessions_list([], ['name']);
 $teacherList = UserManager::get_user_list(['status' => COURSEMANAGER]);
 
 foreach ($courseList as $courseItem) {
@@ -108,13 +108,13 @@ if (!empty($selectedCourse)) {
         );
         $formattedTime = api_format_time($totalTime);
 
-        $timeReport->data[] = array(
+        $timeReport->data[] = [
             'session' => null,
-            'course' => array(
+            'course' => [
                 'id' => $course['real_id'],
                 'name' => $course['title']
-            ),
-            'coach' => array(
+            ],
+            'coach' => [
                 'userId' => $teacher['user_id'],
                 'lastname' => $teacher['lastname'],
                 'firstname' => $teacher['firstname'],
@@ -123,9 +123,9 @@ if (!empty($selectedCourse)) {
                     $teacher['firstname'],
                     $teacher['lastname']
                 )
-            ),
+            ],
             'total_time' => $formattedTime
-        );
+        ];
     }
 
     $sessionsByCourse = SessionManager::get_session_by_course($course['real_id']);
@@ -147,16 +147,16 @@ if (!empty($selectedCourse)) {
                 );
                 $formattedTime = api_format_time($totalTime);
 
-                $timeReport->data[] = array(
-                    'session' => array(
+                $timeReport->data[] = [
+                    'session' => [
                         'id' => $session['id'],
                         'name' => $session['name']
-                    ),
-                    'course' => array(
+                    ],
+                    'course' => [
                         'id' => $course['real_id'],
                         'name' => $course['title']
-                    ),
-                    'coach' => array(
+                    ],
+                    'coach' => [
                         'userId' => $coach['user_id'],
                         'lastname' => $coach['lastname'],
                         'firstname' => $coach['firstname'],
@@ -165,9 +165,9 @@ if (!empty($selectedCourse)) {
                             $coach['firstname'],
                             $coach['lastname']
                         )
-                    ),
+                    ],
                     'total_time' => $formattedTime
-                );
+                ];
             }
         }
     }
@@ -177,19 +177,19 @@ if (!empty($selectedSession)) {
     $withFilter = true;
 
     $session = api_get_session_info($selectedSession);
-    $sessionData = array(
+    $sessionData = [
         'id' => $session['id'],
         'name' => $session['name']
-    );
+    ];
 
     $reportTitle = sprintf(get_lang('TimeReportForSessionX'), $session['name']);
     $courses = SessionManager::get_course_list_by_session_id($selectedSession);
 
     foreach ($courses as $course) {
-        $courseData = array(
+        $courseData = [
             'id' => $course['id'],
             'name' => $course['title']
-        );
+        ];
 
         $coaches = CourseManager::get_coachs_from_course(
             $selectedSession,
@@ -207,10 +207,10 @@ if (!empty($selectedSession)) {
                 );
                 $formattedTime = api_format_time($totalTime);
 
-                $timeReport->data[] = array(
+                $timeReport->data[] = [
                     'session' => $sessionData,
                     'course' => $courseData,
-                    'coach' => array(
+                    'coach' => [
                         'userId' => $coach['user_id'],
                         'lastname' => $coach['lastname'],
                         'firstname' => $coach['firstname'],
@@ -219,9 +219,9 @@ if (!empty($selectedSession)) {
                             $coach['firstname'],
                             $coach['lastname']
                         )
-                    ),
+                    ],
                     'total_time' => $formattedTime
-                );
+                ];
             }
         }
     }
@@ -230,13 +230,13 @@ if (!empty($selectedSession)) {
 if (!empty($selectedTeacher)) {
     $withFilter = true;
     $teacher = api_get_user_info();
-    $teacherData = array(
+    $teacherData = [
         'userId' => $teacher['user_id'],
         'lastname' => $teacher['lastname'],
         'firstname' => $teacher['firstname'],
         'username' => $teacher['username'],
         'complete_name' => $teacher['complete_name']
-    );
+    ];
 
     $reportTitle = sprintf(
         get_lang('TimeReportForTeacherX'),
@@ -260,15 +260,15 @@ if (!empty($selectedTeacher)) {
             );
             $formattedTime = api_format_time($totalTime);
 
-            $timeReport->data[] = array(
+            $timeReport->data[] = [
                 'session' => null,
-                'course' => array(
+                'course' => [
                     'id' => $courseInfo['real_id'],
                     'name' => $courseInfo['title']
-                ),
+                ],
                 'coach' => $teacherData,
                 'total_time' => $formattedTime
-            );
+            ];
         }
     }
 
@@ -287,18 +287,18 @@ if (!empty($selectedTeacher)) {
         );
         $formattedTime = api_format_time($totalTime);
 
-        $timeReport->data[] = array(
+        $timeReport->data[] = [
             'session' => [
                 'id' => $session->getId(),
                 'name' => $session->getName()
             ],
-            'course' => array(
+            'course' => [
                 'id' => $course->getId(),
                 'name' => $course->getTitle()
-            ),
+            ],
             'coach' => $teacherData,
             'total_time' => $formattedTime
-        );
+        ];
     }
 }
 
@@ -306,17 +306,17 @@ if (empty($selectedCourse) && empty($selectedSession) &&
     empty($selectedTeacher)
 ) {
     foreach ($teacherList as &$teacher) {
-        $timeReport->data[] = array(
-            'coach' => array(
+        $timeReport->data[] = [
+            'coach' => [
                 'username' => $teacher['username'],
                 'complete_name' => $teacher['complete_name'],
-            ),
+            ],
             'total_time' => SessionManager::getTotalUserTimeInPlatform(
                 $teacher['user_id'],
                 $selectedFrom,
                 $selectedUntil
             )
-        );
+        ];
     }
 }
 
@@ -328,24 +328,24 @@ if (isset($_GET['export'])) {
 
     switch ($_GET['export']) {
         case 'pdf':
-            $params = array(
+            $params = [
                 'filename' => $fileName,
                 'pdf_title' => "$reportTitle - $reportSubTitle",
                 'pdf_description' => get_lang('TeacherTimeReport'),
                 'format' => 'A4-L',
                 'orientation' => 'L'
-            );
+            ];
 
             $pdfContent = Export::convert_array_to_html($dataToExport);
 
             Export::export_html_to_pdf($pdfContent, $params);
             break;
         case 'xls':
-            array_unshift($dataToExport, array(
+            array_unshift($dataToExport, [
                 $reportTitle
-            ), array(
+            ], [
                 $reportSubTitle
-            ), array());
+            ], []);
 
             Export::export_table_xls_html($dataToExport, $fileName);
             break;

+ 29 - 29
main/admin/user_add.php

@@ -92,8 +92,8 @@ if (!empty($_GET['message'])) {
     $message = urldecode($_GET['message']);
 }
 
-$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList'));
+$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ["url" => 'user_list.php', "name" => get_lang('UserList')];
 $tool_name = get_lang('AddUsers');
 
 // Create the form
@@ -105,9 +105,9 @@ if (api_is_western_name_order()) {
         'text',
         'firstname',
         get_lang('FirstName'),
-        array(
+        [
             'id' => 'firstname'
-        )
+        ]
     );
     $form->applyFilter('firstname', 'html_filter');
     $form->applyFilter('firstname', 'trim');
@@ -117,9 +117,9 @@ if (api_is_western_name_order()) {
         'text',
         'lastname',
         get_lang('LastName'),
-        array(
+        [
             'id' => 'lastname'
-        )
+        ]
     );
     $form->applyFilter('lastname', 'html_filter');
     $form->applyFilter('lastname', 'trim');
@@ -130,9 +130,9 @@ if (api_is_western_name_order()) {
         'text',
         'lastname',
         get_lang('LastName'),
-        array(
+        [
             'id' => 'lastname'
-        )
+        ]
     );
     $form->applyFilter('lastname', 'html_filter');
     $form->applyFilter('lastname', 'trim');
@@ -142,9 +142,9 @@ if (api_is_western_name_order()) {
         'text',
         'firstname',
         get_lang('FirstName'),
-        array(
+        [
             'id' => 'firstname'
-        )
+        ]
     );
     $form->applyFilter('firstname', 'html_filter');
     $form->applyFilter('firstname', 'trim');
@@ -155,15 +155,15 @@ $form->addElement(
     'text',
     'official_code',
     get_lang('OfficialCode'),
-    array(
+    [
         'size' => '40',
         'id' => 'official_code'
-    )
+    ]
 );
 $form->applyFilter('official_code', 'html_filter');
 $form->applyFilter('official_code', 'trim');
 // Email
-$form->addElement('text', 'email', get_lang('Email'), array('size' => '40', 'autocomplete' => 'off', 'id' => 'email'));
+$form->addElement('text', 'email', get_lang('Email'), ['size' => '40', 'autocomplete' => 'off', 'id' => 'email']);
 $form->addRule('email', get_lang('EmailWrong'), 'email');
 if (api_get_setting('registration', 'email') == 'true') {
     $form->addRule('email', get_lang('EmailWrong'), 'required');
@@ -180,7 +180,7 @@ $form->addElement('text', 'phone', get_lang('PhoneNumber'), ['autocomplete' => '
 $form->addFile(
     'picture',
     get_lang('AddImage'),
-    array('id' => 'picture', 'class' => 'picture-form', 'crop_image' => true, 'crop_ratio' => '1 / 1')
+    ['id' => 'picture', 'class' => 'picture-form', 'crop_image' => true, 'crop_ratio' => '1 / 1']
 );
 $allowed_picture_types = api_get_supported_image_extensions(false);
 
@@ -188,7 +188,7 @@ $form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allow
 
 // Username
 if (api_get_setting('login_is_email') != 'true') {
-    $form->addElement('text', 'username', get_lang('LoginName'), array('id'=> 'username', 'maxlength' => USERNAME_MAX_LENGTH, 'autocomplete' => 'off'));
+    $form->addElement('text', 'username', get_lang('LoginName'), ['id'=> 'username', 'maxlength' => USERNAME_MAX_LENGTH, 'autocomplete' => 'off']);
     $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
     $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
@@ -196,11 +196,11 @@ if (api_get_setting('login_is_email') != 'true') {
 }
 
 // Password
-$group = array();
+$group = [];
 $auth_sources = 0; //make available wider as we need it in case of form reset (see below)
 $nb_ext_auth_source_added = 0;
 if (isset($extAuthSource) && count($extAuthSource) > 0) {
-    $auth_sources = array();
+    $auth_sources = [];
     foreach ($extAuthSource as $key => $info) {
         // @todo : make uniform external authentification configuration (ex : cas and external_login ldap)
         // Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
@@ -236,12 +236,12 @@ $group[] = $form->createElement(
     'password',
     'password',
     null,
-    array(
+    [
         'id' => 'password',
         'autocomplete' => 'off',
         'onkeydown' => 'javascript: password_switch_radio_button();',
         //'required' => 'required'
-    )
+    ]
 );
 
 $form->addGroup($group, 'password', get_lang('Password'));
@@ -258,7 +258,7 @@ if ($checkPass) {
 }
 
 // Status
-$status = array();
+$status = [];
 $status[COURSEMANAGER] = get_lang('Teacher');
 $status[STUDENT] = get_lang('Learner');
 $status[DRH] = get_lang('Drh');
@@ -271,10 +271,10 @@ $form->addElement(
     'status',
     get_lang('Profile'),
     $status,
-    array(
+    [
         'id' => 'status_select',
         'onchange' => 'javascript: display_drh_list();'
-    )
+    ]
 );
 
 //drh list (display only if student)
@@ -295,7 +295,7 @@ $form->addElement('html', '</div>');
 
 if (api_is_platform_admin()) {
     // Platform admin
-    $group = array();
+    $group = [];
     $group[] = $form->createElement('radio', 'platform_admin', 'id="id_platform_admin"', get_lang('Yes'), 1);
     $group[] = $form->createElement('radio', 'platform_admin', 'id="id_platform_admin"', get_lang('No'), 0);
     $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.';">');
@@ -306,21 +306,21 @@ if (api_is_platform_admin()) {
 $form->addSelectLanguage('language', get_lang('Language'), null);
 
 // Send email
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
 $group[] = $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
 $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'));
 // Expiration Date
 $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
 $group[] = $form->createElement(
     'DateTimePicker',
     'expiration_date',
     null,
-    array(
+    [
         'onchange' => 'javascript: enable_expiration_date();'
-    )
+    ]
 );
 $form->addGroup($group, 'max_member_group', null, null, false);
 // Active account or inactive account
@@ -406,7 +406,7 @@ if ($form->validate()) {
             $username = $email;
         }
 
-        $extra = array();
+        $extra = [];
         foreach ($user as $key => $value) {
             if (substr($key, 0, 6) == 'extra_') { //an extra field
                 $extra[substr($key, 6)] = $value;
@@ -493,7 +493,7 @@ if ($form->validate()) {
     }
     $token = Security::get_token();
     $form->addElement('hidden', 'sec_token');
-    $form->setConstants(array('sec_token' => $token));
+    $form->setConstants(['sec_token' => $token]);
 }
 
 if (!empty($message)) {

+ 16 - 16
main/admin/user_edit.php

@@ -78,8 +78,8 @@ $htmlHeadXtra[] = api_get_css_asset('cropper/dist/cropper.min.css');
 $htmlHeadXtra[] = api_get_asset('cropper/dist/cropper.min.js');
 $tool_name = get_lang('ModifyUserInfo');
 
-$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => "user_list.php", "name" => get_lang('UserList'));
+$interbreadcrumb[] = ['url' => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ['url' => "user_list.php", "name" => get_lang('UserList')];
 
 $table_user = Database::get_main_table(TABLE_MAIN_USER);
 $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
@@ -136,7 +136,7 @@ if (api_is_western_name_order()) {
 }
 
 // Official code
-$form->addElement('text', 'official_code', get_lang('OfficialCode'), array('size' => '40'));
+$form->addElement('text', 'official_code', get_lang('OfficialCode'), ['size' => '40']);
 $form->applyFilter('official_code', 'html_filter');
 $form->applyFilter('official_code', 'trim');
 
@@ -164,7 +164,7 @@ $form->addElement('text', 'phone', get_lang('PhoneNumber'));
 $form->addFile(
     'picture',
     get_lang('AddImage'),
-    array('id' => 'picture', 'class' => 'picture-form', 'crop_image' => true, 'crop_ratio' => '1 / 1')
+    ['id' => 'picture', 'class' => 'picture-form', 'crop_image' => true, 'crop_ratio' => '1 / 1']
 );
 $allowed_picture_types = api_get_supported_image_extensions(false);
 
@@ -180,7 +180,7 @@ if (strlen($user_data['picture_uri']) > 0) {
 
 // Username
 if (api_get_setting('login_is_email') != 'true') {
-    $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH));
+    $form->addElement('text', 'username', get_lang('LoginName'), ['maxlength' => USERNAME_MAX_LENGTH]);
     $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
     $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
@@ -198,7 +198,7 @@ if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0
 $form->addElement('radio', 'reset_password', get_lang('Password'), get_lang('DontResetPassword'), 0);
 $nb_ext_auth_source_added = 0;
 if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0) {
-    $auth_sources = array();
+    $auth_sources = [];
     foreach ($extAuthSource as $key => $info) {
         // @todo : make uniform external authentication configuration (ex : cas and external_login ldap)
         // Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
@@ -218,20 +218,20 @@ if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0
     }
 }
 $form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1);
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'reset_password', null, get_lang('EnterPassword'), 2);
 $group[] = $form->createElement(
     'password',
     'password',
     null,
-    array('onkeydown' => 'javascript: password_switch_radio_button();')
+    ['onkeydown' => 'javascript: password_switch_radio_button();']
 );
 
 $form->addGroup($group, 'password', null, null, false);
 $form->addPasswordRule('password', 'password');
 
 // Status
-$status = array();
+$status = [];
 $status[COURSEMANAGER] = get_lang('Teacher');
 $status[STUDENT] = get_lang('Learner');
 $status[DRH] = get_lang('Drh');
@@ -244,17 +244,17 @@ $form->addElement(
     'status',
     get_lang('Profile'),
     $status,
-    array(
+    [
         'id' => 'status_select',
         'onchange' => 'javascript: display_drh_list();'
-    )
+    ]
 );
 
 $display = isset($user_data['status']) && ($user_data['status'] == STUDENT || (isset($_POST['status']) && $_POST['status'] == STUDENT)) ? 'block' : 'none';
 
 // Platform admin
 if (api_is_platform_admin()) {
-    $group = array();
+    $group = [];
     $group[] = $form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1);
     $group[] = $form->createElement('radio', 'platform_admin', null, get_lang('No'), 0);
 
@@ -269,7 +269,7 @@ if (api_is_platform_admin()) {
 $form->addSelectLanguage('language', get_lang('Language'));
 
 // Send email
-$group = array();
+$group = [];
 $group[] = $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
 $group[] = $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
 $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), null, false);
@@ -282,13 +282,13 @@ $form->addElement('label', get_lang('RegistrationDate'), $date);
 if (!$user_data['platform_admin']) {
     // Expiration Date
     $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
-    $group = array();
+    $group = [];
     $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
     $group[] = $form->createElement(
         'DateTimePicker',
         'expiration_date',
         null,
-        array('onchange' => 'javascript: enable_expiration_date();')
+        ['onchange' => 'javascript: enable_expiration_date();']
     );
     $form->addGroup($group, 'max_member_group', null, null, false);
 
@@ -486,7 +486,7 @@ $actions = [
         Display::return_icon(
             'info.png',
             get_lang('Information'),
-            array(),
+            [],
             ICON_SIZE_MEDIUM
         ),
         api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.$user_id

+ 8 - 8
main/admin/user_export.php

@@ -19,7 +19,7 @@ $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
 $session_course_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
 
 $tool_name = get_lang('ExportUserListXMLCSV');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 $coursesSessions = [];
@@ -27,7 +27,7 @@ $coursesSessions[''] = '--';
 $allCoursesFromSessions = SessionManager::getAllCoursesFromAllSessions();
 $coursesSessions = array_merge($coursesSessions, $allCoursesFromSessions);
 
-$courses = array();
+$courses = [];
 $courses[''] = '--';
 $sql = "SELECT code,visual_code,title FROM $course_table ORDER BY visual_code";
 
@@ -58,7 +58,7 @@ $form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang
 $form->addElement('select', 'course_code', get_lang('OnlyUsersFromCourse'), $courses);
 $form->addElement('select', 'course_session', get_lang('OnlyUsersFromCourseSession'), $coursesSessions);
 $form->addButtonExport(get_lang('Export'));
-$form->setDefaults(array('file_type' => 'csv'));
+$form->setDefaults(['file_type' => 'csv']);
 
 if ($form->validate()) {
     $export = $form->exportValues();
@@ -125,13 +125,13 @@ if ($form->validate()) {
         }
         $filename = 'export_users_'.api_get_local_time();
     }
-    $data = array();
+    $data = [];
     $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false);
 
     if (!empty($export['addcsvheader'])) {
         if ($export['addcsvheader'] == '1' && ($export['file_type'] == 'csv' || $export['file_type'] == 'xls')) {
             if ($_configuration['password_encryption'] != 'none') {
-                $data[] = array(
+                $data[] = [
                     'UserId',
                     'LastName',
                     'FirstName',
@@ -142,9 +142,9 @@ if ($form->validate()) {
                     'OfficialCode',
                     'PhoneNumber',
                     'RegistrationDate',
-                );
+                ];
             } else {
-                $data[] = array(
+                $data[] = [
                     'UserId',
                     'LastName',
                     'FirstName',
@@ -156,7 +156,7 @@ if ($form->validate()) {
                     'OfficialCode',
                     'PhoneNumber',
                     'RegistrationDate',
-                );
+                ];
             }
 
             foreach ($extra_fields as $extra) {

+ 30 - 23
main/admin/user_import.php

@@ -19,17 +19,17 @@ $purification_option_for_usernames = false;
 function validate_data($users, $checkUniqueEmail = false)
 {
     global $defined_auth_sources;
-    $errors = array();
-    $usernames = array();
+    $errors = [];
+    $usernames = [];
 
     // 1. Check if mandatory fields are set.
-    $mandatory_fields = array('LastName', 'FirstName');
+    $mandatory_fields = ['LastName', 'FirstName'];
 
     if (api_get_setting('registration', 'email') == 'true' || $checkUniqueEmail) {
         $mandatory_fields[] = 'Email';
     }
 
-    $classExistList = array();
+    $classExistList = [];
     $usergroup = new UserGroup();
 
     foreach ($users as $user) {
@@ -179,7 +179,7 @@ function save_data($users)
     global $inserted_in_course;
     // Not all scripts declare the $inserted_in_course array (although they should).
     if (!isset($inserted_in_course)) {
-        $inserted_in_course = array();
+        $inserted_in_course = [];
     }
     $usergroup = new UserGroup();
     $send_mail = $_POST['sendMail'] ? true : false;
@@ -220,7 +220,7 @@ function save_data($users)
             if (!empty($user['ClassId'])) {
                 $classId = explode('|', trim($user['ClassId']));
                 foreach ($classId as $id) {
-                    $usergroup->subscribe_users_to_usergroup($id, array($user_id), false);
+                    $usergroup->subscribe_users_to_usergroup($id, [$user_id], false);
                 }
             }
 
@@ -281,7 +281,7 @@ function element_start($parser, $data)
     global $current_tag;
     switch ($data) {
         case 'Contact':
-            $user = array();
+            $user = [];
             break;
         default:
             $current_tag = $data;
@@ -336,7 +336,7 @@ function character_data($parser, $data)
 function parse_xml_data($file)
 {
     global $users;
-    $users = array();
+    $users = [];
     $parser = xml_parser_create('UTF-8');
     xml_set_element_handler($parser, 'element_start', 'element_end');
     xml_set_character_data_handler($parser, 'character_data');
@@ -358,25 +358,25 @@ if (isset($extAuthSource) && is_array($extAuthSource)) {
 }
 
 $tool_name = get_lang('ImportUserListXMLCSV');
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
 
 set_time_limit(0);
 $extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
-$user_id_error = array();
+$user_id_error = [];
 $error_message = '';
 
 if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['size'] !== 0) {
     $file_type = $_POST['file_type'];
     Security::clear_token();
     $tok = Security::get_token();
-    $allowed_file_mimetype = array('csv', 'xml');
+    $allowed_file_mimetype = ['csv', 'xml'];
     $error_kind_file = false;
 
     $checkUniqueEmail = isset($_POST['check_unique_email']) ? $_POST['check_unique_email'] : null;
 
     $uploadInfo = pathinfo($_FILES['import_file']['name']);
     $ext_import_file = $uploadInfo['extension'];
-    $users = array();
+    $users = [];
     if (in_array($ext_import_file, $allowed_file_mimetype)) {
         if (strcmp($file_type, 'csv') === 0 &&
             $ext_import_file == $allowed_file_mimetype[0]
@@ -396,7 +396,7 @@ if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['s
     }
 
     // List user id with error.
-    $users_to_insert = array();
+    $users_to_insert = [];
 
     $keyToCheck = 'UserName';
     if ($checkUniqueEmail || api_get_setting('registration', 'email') == 'true') {
@@ -417,7 +417,7 @@ if (isset($_POST['formSent']) && $_POST['formSent'] && $_FILES['import_file']['s
         }
     }
 
-    $inserted_in_course = array();
+    $inserted_in_course = [];
     if (strcmp($file_type, 'csv') === 0) {
         save_data($users_to_insert);
     } elseif (strcmp($file_type, 'xml') === 0) {
@@ -473,7 +473,7 @@ $form = new FormValidator('user_import', 'post', api_get_self());
 $form->addElement('header', '', $tool_name);
 $form->addElement('hidden', 'formSent');
 $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
-$group = array(
+$group = [
     $form->createElement(
         'radio',
         'file_type',
@@ -488,14 +488,14 @@ $group = array(
         'XML (<a href="example.xml" target="_blank">'.get_lang('ExampleXMLFile').'</a>)',
         'xml'
     )
-);
+];
 
 $form->addGroup($group, '', get_lang('FileType'));
 
-$group = array(
+$group = [
     $form->createElement('radio', 'sendMail', '', get_lang('Yes'), 1),
     $form->createElement('radio', 'sendMail', null, get_lang('No'), 0)
-);
+];
 $form->addGroup($group, '', get_lang('SendMailToUsers'));
 
 $form->addElement(
@@ -512,8 +512,8 @@ $defaults['file_type'] = 'csv';
 $form->setDefaults($defaults);
 $form->display();
 
-$list = array();
-$list_reponse = array();
+$list = [];
+$list_reponse = [];
 $result_xml = '';
 $i = 0;
 $count_fields = count($extra_fields);
@@ -533,8 +533,12 @@ if ($count_fields > 0) {
 <p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
 <blockquote>
 <pre>
-<b>LastName</b>;<b>FirstName</b>;<b>Email</b>;UserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;<span style="color:red;"><?php if (count($list) > 0) echo implode(';', $list).';'; ?></span>Courses;ClassId;
-<b>xxx</b>;<b>xxx</b>;<b>xxx</b>;xxx;xxx;<?php echo implode('/', $defined_auth_sources); ?>;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;<span style="color:red;"><?php if (count($list_reponse) > 0) echo implode(';', $list_reponse).';'; ?></span>xxx1|xxx2|xxx3;1;<br />
+<b>LastName</b>;<b>FirstName</b>;<b>Email</b>;UserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;<span style="color:red;"><?php if (count($list) > 0) {
+    echo implode(';', $list).';';
+} ?></span>Courses;ClassId;
+<b>xxx</b>;<b>xxx</b>;<b>xxx</b>;xxx;xxx;<?php echo implode('/', $defined_auth_sources); ?>;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;<span style="color:red;"><?php if (count($list_reponse) > 0) {
+    echo implode(';', $list_reponse).';';
+} ?></span>xxx1|xxx2|xxx3;1;<br />
 </pre>
 </blockquote>
 <p><?php echo get_lang('XMLMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p>
@@ -551,7 +555,10 @@ if ($count_fields > 0) {
         <b>&lt;Email&gt;xxx&lt;/Email&gt;</b>
         &lt;OfficialCode&gt;xxx&lt;/OfficialCode&gt;
         &lt;PhoneNumber&gt;xxx&lt;/PhoneNumber&gt;
-        &lt;Status&gt;user/teacher/drh<?php if ($result_xml != '') { echo '<br /><span style="color:red;">', $result_xml; echo '</span>'; } ?>&lt;/Status&gt;
+        &lt;Status&gt;user/teacher/drh<?php if ($result_xml != '') {
+    echo '<br /><span style="color:red;">', $result_xml;
+    echo '</span>';
+} ?>&lt;/Status&gt;
         &lt;Courses&gt;xxx1|xxx2|xxx3&lt;/Courses&gt;
         &lt;ClassId&gt;1&lt;/ClassId&gt;
         &lt;/Contact&gt;

+ 64 - 64
main/admin/user_information.php

@@ -38,8 +38,8 @@ if (!api_is_student_boss()) {
     }
 }
 
-$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList'));
+$interbreadcrumb[] = ["url" => 'index.php', "name" => get_lang('PlatformAdmin')];
+$interbreadcrumb[] = ["url" => 'user_list.php', "name" => get_lang('UserList')];
 
 $userId = $user['user_id'];
 
@@ -83,7 +83,7 @@ if (api_is_platform_admin()) {
         Display::return_icon(
             'edit.png',
             get_lang('Edit'),
-            array(),
+            [],
             ICON_SIZE_MEDIUM
         ),
         api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$userId
@@ -117,7 +117,7 @@ if (api_is_platform_admin()) {
             Display::return_icon(
                 'skill-badges.png',
                 get_lang('AddSkill'),
-                array(),
+                [],
                 ICON_SIZE_MEDIUM,
                 false
             ),
@@ -129,7 +129,7 @@ if (api_is_platform_admin()) {
 $studentBossList = UserManager::getStudentBossList($userId);
 $studentBossListToString = '';
 if (!empty($studentBossList)) {
-    $table = new HTML_Table(array('class' => 'data_table'));
+    $table = new HTML_Table(['class' => 'data_table']);
     $table->setHeaderContents(0, 0, get_lang('User'));
     $csvContent[] = [get_lang('StudentBoss')];
 
@@ -137,7 +137,7 @@ if (!empty($studentBossList)) {
     foreach ($studentBossList as $studentBossId) {
         $studentBoss = api_get_user_info($studentBossId['boss_id']);
         $table->setCellContents($row, 0, $studentBoss['complete_name_with_message_link']);
-        $csvContent[] = array($studentBoss['complete_name_with_username']);
+        $csvContent[] = [$studentBoss['complete_name_with_username']];
         $row++;
     }
     $studentBossListToString = $table->toHtml();
@@ -145,18 +145,18 @@ if (!empty($studentBossList)) {
 
 $registrationDate = $user['registration_date'];
 
-$table = new HTML_Table(array('class' => 'data_table'));
+$table = new HTML_Table(['class' => 'data_table']);
 $table->setHeaderContents(0, 0, get_lang('Information'));
 
 $csvContent[] = [get_lang('Information')];
-$data = array(
+$data = [
     get_lang('Name') => $user['complete_name'],
     get_lang('Email') => $user['email'],
     get_lang('Phone') => $user['phone'],
     get_lang('OfficialCode') => $user['official_code'],
     get_lang('Online') => !empty($user['user_is_online']) ? Display::return_icon('online.png') : Display::return_icon('offline.png'),
     get_lang('Status') => $user['status'] == 1 ? get_lang('Teacher') : get_lang('Student'),
-);
+];
 
 // Show info about who created this user and when
 $creatorId = $user['creator_id'];
@@ -176,18 +176,18 @@ foreach ($data as $label => $item) {
         $label = $label.': ';
     }
     $table->setCellContents($row, 0, $label.$item);
-    $csvContent[] = array($label, strip_tags($item));
+    $csvContent[] = [$label, strip_tags($item)];
     $row++;
 }
 $userInformation = $table->toHtml();
 
-$table = new HTML_Table(array('class' => 'data_table'));
+$table = new HTML_Table(['class' => 'data_table']);
 $table->setHeaderContents(0, 0, get_lang('Tracking'));
 $csvContent[] = [get_lang('Tracking')];
-$data = array(
+$data = [
     get_lang('FirstLogin') => Tracking::get_first_connection_date($userId),
     get_lang('LatestLogin') => Tracking::get_last_connection_date($userId, true)
-);
+];
 
 if (api_get_setting('allow_terms_conditions') === 'true') {
     $extraFieldValue = new ExtraFieldValue('user');
@@ -220,7 +220,7 @@ foreach ($data as $label => $item) {
         $label = $label.': ';
     }
     $table->setCellContents($row, 0, $label.$item);
-    $csvContent[] = array($label, strip_tags($item));
+    $csvContent[] = [$label, strip_tags($item)];
     $row++;
 }
 $trackingInformation = $table->toHtml();
@@ -262,33 +262,33 @@ if (api_get_setting('allow_social_tool') === 'true') {
  * Show the sessions in which this user is subscribed
  */
 $sessions = SessionManager::get_sessions_by_user($userId, true);
-$personal_course_list = array();
+$personal_course_list = [];
 $courseToolInformationTotal = null;
 $sessionInformation = '';
 if (count($sessions) > 0) {
-    $header = array(
-        array(get_lang('Code'), true),
-        array(get_lang('Title'), true),
-        array(get_lang('Status'), true),
-        array(get_lang('TimeSpentInTheCourse'), true),
-        array(get_lang('TotalPostsInAllForums'), true),
-        array('', false)
-    );
-
-    $headerList = array();
+    $header = [
+        [get_lang('Code'), true],
+        [get_lang('Title'), true],
+        [get_lang('Status'), true],
+        [get_lang('TimeSpentInTheCourse'), true],
+        [get_lang('TotalPostsInAllForums'), true],
+        ['', false]
+    ];
+
+    $headerList = [];
     foreach ($header as $item) {
         $headerList[] = $item[0];
     }
 
-    $csvContent[] = array();
-    $csvContent[] = array(get_lang('Sessions'));
+    $csvContent[] = [];
+    $csvContent[] = [get_lang('Sessions')];
 
     foreach ($sessions as $session_item) {
-        $data = array();
-        $personal_course_list = array();
+        $data = [];
+        $personal_course_list = [];
         $id_session = $session_item['session_id'];
 
-        $csvContent[] = array($session_item['session_name']);
+        $csvContent[] = [$session_item['session_name']];
         $csvContent[] = $headerList;
         foreach ($session_item['courses'] as $my_course) {
             $courseInfo = api_get_course_info_by_id($my_course['real_id']);
@@ -336,7 +336,7 @@ if (count($sessions) > 0) {
                 $id_session
             );
 
-            $row = array(
+            $row = [
                 Display::url(
                     $courseInfo['code'],
                     $courseInfo['course_public_url'].'?id_session='.$id_session
@@ -346,7 +346,7 @@ if (count($sessions) > 0) {
                 $timeSpent,
                 $totalForumMessages,
                 $tools
-            );
+            ];
 
             $csvContent[] = array_map('strip_tags', $row);
             $data[] = $row;
@@ -364,7 +364,7 @@ if (count($sessions) > 0) {
         }
 
         $dates = array_filter(
-            array($session_item['access_start_date'], $session_item['access_end_date'])
+            [$session_item['access_start_date'], $session_item['access_end_date']]
         );
 
         $sessionInformation .= Display::page_subheader(
@@ -376,9 +376,9 @@ if (count($sessions) > 0) {
         $sessionInformation .= Display::return_sortable_table(
             $header,
             $data,
-            array(),
-            array(),
-            array('user_id' => intval($_GET['user_id']))
+            [],
+            [],
+            ['user_id' => intval($_GET['user_id'])]
         );
         $sessionInformation .= $courseToolInformationTotal;
     }
@@ -397,24 +397,24 @@ $sql = 'SELECT * FROM '.$table_course_user.' cu, '.$table_course.' c
             cu.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' ';
 $res = Database::query($sql);
 if (Database::num_rows($res) > 0) {
-    $header = array(
-        array(get_lang('Code')),
-        array(get_lang('Title')),
-        array(get_lang('Status')),
-        array(get_lang('TimeSpentInTheCourse')),
-        array(get_lang('TotalPostsInAllForums')),
-        array('')
-    );
-
-    $headerList = array();
+    $header = [
+        [get_lang('Code')],
+        [get_lang('Title')],
+        [get_lang('Status')],
+        [get_lang('TimeSpentInTheCourse')],
+        [get_lang('TotalPostsInAllForums')],
+        ['']
+    ];
+
+    $headerList = [];
     foreach ($header as $item) {
         $headerList[] = $item[0];
     }
-    $csvContent[] = array();
-    $csvContent[] = array(get_lang('Courses'));
+    $csvContent[] = [];
+    $csvContent[] = [get_lang('Courses')];
     $csvContent[] = $headerList;
 
-    $data = array();
+    $data = [];
     $courseToolInformationTotal = null;
     while ($course = Database::fetch_object($res)) {
         $courseInfo = api_get_course_info_by_id($course->c_id);
@@ -450,14 +450,14 @@ if (Database::num_rows($res) > 0) {
             0
         );
 
-        $row = array(
+        $row = [
             Display::url($courseCode, $courseInfo['course_public_url']),
             $course->title,
             $course->status == STUDENT ? get_lang('Student') : get_lang('Teacher'),
             $timeSpent,
             $totalForumMessages,
             $tools,
-        );
+        ];
 
         $csvContent[] = array_map('strip_tags', $row);
         $data[] = $row;
@@ -474,9 +474,9 @@ if (Database::num_rows($res) > 0) {
     $courseInformation = Display::return_sortable_table(
         $header,
         $data,
-        array(),
-        array(),
-        array('user_id' => intval($_GET['user_id']))
+        [],
+        [],
+        ['user_id' => intval($_GET['user_id'])]
     );
     $courseInformation .= $courseToolInformationTotal;
 } else {
@@ -490,14 +490,14 @@ $urlInformation = '';
 if (api_is_multiple_url_enabled()) {
     $urlList = UrlManager::get_access_url_from_user($userId);
     if (count($urlList) > 0) {
-        $header = array();
-        $header[] = array('URL', true);
-        $data = array();
+        $header = [];
+        $header[] = ['URL', true];
+        $data = [];
 
-        $csvContent[] = array();
-        $csvContent[] = array('Url');
+        $csvContent[] = [];
+        $csvContent[] = ['Url'];
         foreach ($urlList as $url) {
-            $row = array();
+            $row = [];
             $row[] = Display::url($url['url'], $url['url']);
             $csvContent[] = array_map('strip_tags', $row);
             $data[] = $row;
@@ -507,9 +507,9 @@ if (api_is_multiple_url_enabled()) {
         $urlInformation .= Display::return_sortable_table(
             $header,
             $data,
-            array(),
-            array(),
-            array('user_id' => intval($_GET['user_id']))
+            [],
+            [],
+            ['user_id' => intval($_GET['user_id'])]
         );
     } else {
         $urlInformation = '<p>'.get_lang('NoUrlForThisUser').'</p>';
@@ -565,7 +565,7 @@ if (isset($_GET['action'])) {
             $sessionId = !empty($_GET['id_session']) ? (int) $_GET['id_session'] : 0;
 
             SessionManager::removeUsersFromCourseSession(
-                array($userId),
+                [$userId],
                 $sessionId,
                 api_get_course_info_by_id($courseId)
             );

Some files were not shown because too many files changed in this diff