Browse Source

Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
Scrutinizer Auto-Fixer 8 years ago
parent
commit
9ba150d7c1
100 changed files with 860 additions and 861 deletions
  1. 3 3
      main/admin/course_category.php
  2. 1 1
      main/admin/email_tester.php
  3. 12 12
      main/admin/skill_badge_create.php
  4. 3 3
      main/admin/skill_level.php
  5. 7 7
      main/admin/specific_fields_add.php
  6. 6 6
      main/attendance/attendance_controller.php
  7. 5 5
      main/badge/assign.php
  8. 11 11
      main/badge/issued.php
  9. 10 10
      main/badge/issued_all.php
  10. 1 1
      main/calendar/agenda.php
  11. 4 4
      main/chat/chat.php
  12. 5 5
      main/course_home/2column.php
  13. 12 12
      main/course_home/3column.php
  14. 2 2
      main/coursecopy/copy_course.php
  15. 3 3
      main/coursecopy/create_backup.php
  16. 1 1
      main/coursecopy/recycle_course.php
  17. 15 15
      main/document/create_paint.php
  18. 1 1
      main/document/download_scorm.php
  19. 45 45
      main/document/edit_paint.php
  20. 5 5
      main/document/show_content.php
  21. 50 50
      main/document/slideshow.php
  22. 1 1
      main/dropbox/recover_dropbox_files.php
  23. 13 13
      main/exercise/Draggable.php
  24. 1 1
      main/exercise/exercice.php
  25. 3 3
      main/exercise/exercise_reminder.php
  26. 3 3
      main/exercise/exercise_report.php
  27. 56 56
      main/exercise/export/scorm/scorm_classes.php
  28. 2 2
      main/exercise/freeanswer.class.php
  29. 3 3
      main/exercise/hotpotatoes.php
  30. 4 4
      main/exercise/hotspot_save.inc.php
  31. 6 6
      main/exercise/hotspot_savescore.inc.php
  32. 3 3
      main/gamification/my_progress.php
  33. 1 1
      main/glossary/glossary_ajax_request.php
  34. 4 4
      main/gradebook/certificate_report.php
  35. 3 3
      main/gradebook/get_badges.php
  36. 6 6
      main/gradebook/gradebook_add_cat.php
  37. 6 6
      main/gradebook/gradebook_add_link_select_course.php
  38. 4 4
      main/gradebook/gradebook_add_result.php
  39. 8 8
      main/gradebook/gradebook_add_user.php
  40. 5 5
      main/gradebook/gradebook_display_summary.php
  41. 7 7
      main/gradebook/gradebook_flatview.php
  42. 16 16
      main/gradebook/gradebook_statistics.php
  43. 21 21
      main/gradebook/lib/fe/exportgradebook.php
  44. 8 8
      main/group/group.php
  45. 4 4
      main/inc/ajax/record_audio_rtc.ajax.php
  46. 4 4
      main/inc/ajax/sequence.ajax.php
  47. 1 1
      main/inc/global_error_message.inc.php
  48. 1 1
      main/inc/lib/conditional_login.class.php
  49. 4 5
      main/inc/lib/formvalidator/Element/SelectAjax.php
  50. 5 5
      main/inc/lib/internationalization.lib.php
  51. 4 4
      main/inc/lib/timeline.lib.php
  52. 3 3
      main/inc/lib/zombie/zombie_manager.class.php
  53. 2 2
      main/inc/lib/zombie/zombie_report.class.php
  54. 7 7
      main/install/index.php
  55. 16 16
      main/install/install_files.inc.php
  56. 8 8
      main/lp/lp_add.php
  57. 1 1
      main/lp/lp_content.php
  58. 6 6
      main/lp/lp_edit.php
  59. 5 5
      main/lp/lp_impress.php
  60. 2 2
      main/lp/lp_report.php
  61. 3 3
      main/messages/download.php
  62. 9 9
      main/messages/view_message.php
  63. 15 15
      main/mySpace/company_reports.php
  64. 7 7
      main/mySpace/company_reports_resumed.php
  65. 10 10
      main/mySpace/session.php
  66. 143 143
      main/permissions/permissions_functions.inc.php
  67. 1 1
      main/portfolio/share.php
  68. 2 2
      main/session/session_user_edit.php
  69. 8 8
      main/social/message_for_group_form.inc.php
  70. 1 1
      main/social/my_skills_report.php
  71. 2 2
      main/survey/create_new_survey.php
  72. 2 2
      main/ticket/tutor_report.lib.php
  73. 2 2
      main/tracking/course_log_groups.php
  74. 6 6
      main/tracking/course_log_resources.php
  75. 5 5
      main/tracking/course_log_tools.php
  76. 16 16
      main/tracking/lp_results_by_user.php
  77. 8 8
      main/tracking/question_course_report.php
  78. 26 26
      main/tracking/userLog.php
  79. 15 15
      main/tracking/userlogCSV.php
  80. 2 2
      main/upload/index.php
  81. 16 16
      main/user/session_list.php
  82. 8 8
      main/user/user_import.php
  83. 56 56
      main/webservices/cm_webservice_course.php
  84. 1 1
      main/work/add_document.php
  85. 3 3
      main/work/downloadfolder.inc.php
  86. 1 1
      main/work/show_file.php
  87. 3 3
      main/work/work_list_all.php
  88. 3 3
      plugin/bbb/ajax.php
  89. 2 2
      plugin/buycourses/src/service_error.php
  90. 1 1
      plugin/buycourses/src/service_information.php
  91. 1 1
      plugin/google_maps/index.php
  92. 1 1
      plugin/google_maps/install.php
  93. 1 1
      plugin/share_buttons/index.php
  94. 2 2
      plugin/tour/ajax/steps.ajax.php
  95. 3 3
      plugin/tour/index.php
  96. 2 2
      plugin/tour/src/tour_plugin.class.php
  97. 8 8
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php
  98. 2 2
      src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php
  99. 1 1
      src/Chamilo/CoreBundle/DependencyInjection/ChamiloCoreExtension.php
  100. 3 3
      src/Chamilo/CoreBundle/Entity/SkillRelUser.php

+ 3 - 3
main/admin/course_category.php

@@ -26,7 +26,7 @@ if (!empty($action)) {
     if ($action == 'delete') {
         CourseCategory::deleteNode($categoryId);
         Display::addFlash(Display::return_message(get_lang('Deleted')));
-        header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
+        header('Location: '.api_get_self().'?category='.Security::remove_XSS($category));
         exit();
     } elseif (($action == 'add' || $action == 'edit') && isset($_POST['formSent']) && $_POST['formSent']) {
         if ($action == 'add') {
@@ -54,7 +54,7 @@ if (!empty($action)) {
         }
     } elseif ($action == 'moveUp') {
         CourseCategory::moveNodeUp($categoryId, $_GET['tree_pos'], $category);
-        header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
+        header('Location: '.api_get_self().'?category='.Security::remove_XSS($category));
         Display::addFlash(Display::return_message(get_lang('Updated')));
         exit();
     }
@@ -78,7 +78,7 @@ if ($action == 'add' || $action == 'edit') {
 
     $form_title = ($action == 'add') ? get_lang('AddACategory') : get_lang('EditNode');
     if (!empty($category)) {
-        $form_title .= ' ' . get_lang('Into') . ' ' . Security::remove_XSS($category);
+        $form_title .= ' '.get_lang('Into').' '.Security::remove_XSS($category);
     }
     $url = api_get_self().'?action='.Security::remove_XSS($action).'&category='.Security::remove_XSS($category).'&id='.Security::remove_XSS($categoryId);
     $form = new FormValidator('course_category', 'post', $url);

+ 1 - 1
main/admin/email_tester.php

@@ -55,7 +55,7 @@ if ($form->validate()) {
         Display::return_message(get_lang('MailingTestSent'), 'warning')
     );
 
-    header('Location: ' . api_get_self());
+    header('Location: '.api_get_self());
     exit;
 }
 

+ 12 - 12
main/admin/skill_badge_create.php

@@ -24,16 +24,16 @@ $skillId = intval($_GET['id']);
 $objSkill = new Skill();
 $skill = $objSkill->get($skillId);
 
-$htmlHeadXtra[] = '<link  href="'. api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/css/core.css" rel="stylesheet">';
+$htmlHeadXtra[] = '<link  href="'.api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/css/core.css" rel="stylesheet">';
 
 // Add badge studio paths
 
 $badgeStudio = [
-    'core' => api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/',
-    'media' => api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/',
-    'templates' => api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/images/templates/',
-    'masks' => api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/images/masks/',
-    'script_js' => '<script src="'. api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/js/studio.js?"></script>'
+    'core' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/',
+    'media' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/',
+    'templates' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/images/templates/',
+    'masks' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/images/masks/',
+    'script_js' => '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/js/studio.js?"></script>'
 ];
 
 
@@ -60,10 +60,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
 
         if ($existsBadgesDirectory) {
             if (!empty($skill['icon'])) {
-                $iconFileAbsolutePath = $badgePath . $skill['icon'];
+                $iconFileAbsolutePath = $badgePath.$skill['icon'];
 
                 if (Security::check_abs_path($iconFileAbsolutePath, $badgePath)) {
-                    unlink($badgePath . $skill['icon']);
+                    unlink($badgePath.$skill['icon']);
                 }
             }
 
@@ -93,24 +93,24 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
 
     $objSkill->update($params);
 
-    header('Location: ' . api_get_path(WEB_CODE_PATH) . 'admin/skill_badge_list.php');
+    header('Location: '.api_get_path(WEB_CODE_PATH).'admin/skill_badge_list.php');
     exit;
 }
 
 $interbreadcrumb = array(
     array(
-        'url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php',
+        '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',
+        'url' => api_get_path(WEB_CODE_PATH).'admin/skill_badge.php',
         'name' => get_lang('Badges')
     )
 );
 
 $toolbar = Display::toolbarButton(
     get_lang('ManageSkills'),
-    api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php',
+    api_get_path(WEB_CODE_PATH).'admin/skill_list.php',
     'list',
     'primary',
     ['title' => get_lang('ManageSkills')]

+ 3 - 3
main/admin/skill_level.php

@@ -20,7 +20,7 @@ $list = $em->getRepository('ChamiloSkillBundle:Level')->findAll();
 
 $listAction = api_get_self();
 
-$action =  '';
+$action = '';
 if (isset($_GET['action']) && in_array($_GET['action'], ['add', 'edit', 'delete', 'add_level'])) {
     $action = $_GET['action'];
 }
@@ -53,8 +53,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[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array('url' => api_get_self(), 'name' => get_lang('SkillProfile'));
 
 $tpl = new Template($action);
 switch ($action) {

+ 7 - 7
main/admin/specific_fields_add.php

@@ -32,18 +32,18 @@ if (isset($_GET['action']) && $_GET['action'] === 'edit') {
 // Create the form
 $form = new FormValidator('specific_fields_add');
 // Field variable name
-$form->addElement('hidden','field_id', $fieldId);
-$form->addElement('text','field_name',get_lang('FieldName'));
-$form->applyFilter('field_name','html_filter');
-$form->applyFilter('field_name','trim');
+$form->addElement('hidden', 'field_id', $fieldId);
+$form->addElement('text', 'field_name', get_lang('FieldName'));
+$form->applyFilter('field_name', 'html_filter');
+$form->applyFilter('field_name', 'trim');
 $form->addRule('field_name', get_lang('ThisFieldIsRequired'), 'required');
 $form->addRule('field_name', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
-$form->addRule('field_name', '', 'maxlength',20);
+$form->addRule('field_name', '', 'maxlength', 20);
 
 // Set default values (only not empty when editing)
 $defaults = array();
 if ($fieldId) {
-    $form_information = get_specific_field_list(array( 'id' => $fieldId ));
+    $form_information = get_specific_field_list(array('id' => $fieldId));
     $defaults['field_name'] = $form_information[0]['name'];
 }
 $form->setDefaults($defaults);
@@ -54,7 +54,7 @@ $form->addButtonCreate(get_lang('Add'), 'submit');
 if ($form->validate()) {
     $field = $form->exportValues();
     $field_name = $field['field_name'];
-    if (is_numeric($field['field_id']) && $field['field_id']<>0 && !empty($field['field_id'])) {
+    if (is_numeric($field['field_id']) && $field['field_id'] <> 0 && !empty($field['field_id'])) {
         edit_specific_field($field['field_id'], $field['field_name']);
         $message = get_lang('FieldEdited');
     } else {

+ 6 - 6
main/attendance/attendance_controller.php

@@ -550,17 +550,17 @@ class AttendanceController
             }
         }
         $max_cols_per_page = 12; //10 dates + 2 name and number
-        $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2;//10
+        $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2; //10
         $rows = count($data_table);
 
         if ($cols > $max_cols_per_page) {
-            $number_tables = round(($cols-2)/$max_dates_per_page);
+            $number_tables = round(($cols - 2) / $max_dates_per_page);
             $headers = $data_table[0];
             $all = array();
             $tables = array();
             $changed = 1;
 
-            for ($i= 0; $i <= $rows; $i++) {
+            for ($i = 0; $i <= $rows; $i++) {
                 $row = isset($data_table[$i]) ? $data_table[$i] : null;
                 $key = 1;
                 $max_dates_per_page = 10;
@@ -571,7 +571,7 @@ class AttendanceController
                     foreach ($item as $value) {
                         if ($count_j >= $max_dates_per_page) {
                             $key++;
-                            $max_dates_per_page = $max_dates_per_page_original*$key;
+                            $max_dates_per_page = $max_dates_per_page_original * $key;
                             //magic hack
                             $tables[$key][$i][] = $tables[1][$i][0];
                             $tables[$key][$i][] = $tables[1][$i][1];
@@ -628,8 +628,8 @@ class AttendanceController
             $form = new FormValidator(
                 'search',
                 'post',
-                api_get_self() . '?' . api_get_cidreq(
-                ) . '&action=calendar_logins'
+                api_get_self().'?'.api_get_cidreq(
+                ).'&action=calendar_logins'
             );
             $form->addDateRangePicker('range', get_lang('DateRange'));
             $form->addButton('submit', get_lang('Submit'));

+ 5 - 5
main/badge/assign.php

@@ -33,7 +33,7 @@ if (!$user) {
         Display::return_message(get_lang('NoUser'), 'error')
     );
 
-    header('Location: ' . api_get_path(WEB_PATH));
+    header('Location: '.api_get_path(WEB_PATH));
     exit;
 }
 
@@ -46,7 +46,7 @@ $url = api_get_path(WEB_CODE_PATH)."badge/assign.php?user=".$_REQUEST['user']."&
 $htmlHeadXtra[] = '<script>
 $( document ).ready(function() {
     $("#skill").on("change", function() {
-        $(location).attr("href", "'. $url .'"+$(this).val());
+        $(location).attr("href", "'. $url.'"+$(this).val());
     });
 });
 </script>';
@@ -131,7 +131,7 @@ if ($form->validate()) {
             Display::return_message(get_lang('SkillNotFound'), 'error')
         );
 
-        header('Location: ' . api_get_self() . '?' . http_build_query(['user' => $user->getId()]));
+        header('Location: '.api_get_self().'?'.http_build_query(['user' => $user->getId()]));
         exit;
     }
 
@@ -143,7 +143,7 @@ if ($form->validate()) {
             )
         );
 
-        header('Location: ' . api_get_self() . '?' . http_build_query(['user' => $user->getId()]));
+        header('Location: '.api_get_self().'?'.http_build_query(['user' => $user->getId()]));
         exit;
     }
 
@@ -167,7 +167,7 @@ if ($form->validate()) {
         )
     );
 
-    header('Location: ' . api_get_path(WEB_PATH) . "badge/{$skillUser->getId()}");
+    header('Location: '.api_get_path(WEB_PATH)."badge/{$skillUser->getId()}");
     exit;
 }
 

+ 11 - 11
main/badge/issued.php

@@ -12,7 +12,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 $issue = isset($_REQUEST['issue']) ? intval($_REQUEST['issue']) : 0;
 
 if (!$issue) {
-    header('Location: ' . api_get_path(WEB_PATH));
+    header('Location: '.api_get_path(WEB_PATH));
     exit;
 }
 
@@ -26,7 +26,7 @@ if (!$skillIssue) {
         Display::return_message(get_lang('TheUserXNotYetAchievedTheSkillX'), 'error')
     );
 
-    header('Location: ' . api_get_path(WEB_PATH));
+    header('Location: '.api_get_path(WEB_PATH));
     exit;
 }
 
@@ -38,7 +38,7 @@ if (!$user || !$skill) {
         Display::return_message(get_lang('NoResults'), 'error')
     );
 
-    header('Location: ' . api_get_path(WEB_PATH));
+    header('Location: '.api_get_path(WEB_PATH));
     exit;
 }
 
@@ -177,7 +177,7 @@ if ($formAcquiredLevel->validate() && $allowComment) {
     $entityManager->persist($skillIssue);
     $entityManager->flush();
 
-    header("Location: " . $skillIssue->getIssueUrl());
+    header("Location: ".$skillIssue->getIssueUrl());
     exit;
 }
 
@@ -208,7 +208,7 @@ if ($form->validate() && $allowComment) {
     $entityManager->persist($skillUserComment);
     $entityManager->flush();
 
-    header("Location: " . $skillIssue->getIssueUrl());
+    header("Location: ".$skillIssue->getIssueUrl());
     exit;
 }
 
@@ -224,11 +224,11 @@ if ($allowDownloadExport) {
         $backpack = $configBackpack;
     }
 
-    $htmlHeadXtra[] = '<script src="' . $backpack . 'issuer.js"></script>';
+    $htmlHeadXtra[] = '<script src="'.$backpack.'issuer.js"></script>';
     $objSkill = new Skill();
     $assertionUrl = $skillIssueInfo['badge_assertion'];
     $skills = $objSkill->get($skillId);
-    $unbakedBadge = api_get_path(SYS_UPLOAD_PATH) . "badges/".$skills['icon'];
+    $unbakedBadge = api_get_path(SYS_UPLOAD_PATH)."badges/".$skills['icon'];
     if (!is_file($unbakedBadge)) {
         $unbakedBadge = api_get_path(WEB_CODE_PATH).'img/icons/128/badges-default.png';
     }
@@ -246,12 +246,12 @@ if ($allowDownloadExport) {
             mkdir($bakedBadge, api_get_permissions_for_new_directories(), true);
         }
         $skillRelUserId = $skillIssueInfo['id'];
-        if (!file_exists($bakedBadge . "/badge_" . $skillRelUserId)) {
-            file_put_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png", $bakedInfo);
+        if (!file_exists($bakedBadge."/badge_".$skillRelUserId)) {
+            file_put_contents($bakedBadge."/badge_".$skillRelUserId.".png", $bakedInfo);
         }
 
         //Process to validate a baked badge
-        $badgeContent = file_get_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png");
+        $badgeContent = file_get_contents($bakedBadge."/badge_".$skillRelUserId.".png");
         $verifyBakedBadge = $png->extractBadgeInfo($badgeContent);
         if (!is_array($verifyBakedBadge)) {
             $badgeInfoError = true;
@@ -259,7 +259,7 @@ if ($allowDownloadExport) {
 
         if (!$badgeInfoError) {
             $personalBadge = UserManager::getUserPathById($userId, "web");
-            $personalBadge = $personalBadge."badges/badge_" . $skillRelUserId . ".png";
+            $personalBadge = $personalBadge."badges/badge_".$skillRelUserId.".png";
         }
     }
 }

+ 10 - 10
main/badge/issued_all.php

@@ -12,7 +12,7 @@ $userId = isset($_GET['user']) ? intval($_GET['user']) : 0;
 $skillId = isset($_GET['skill']) ? intval($_GET['skill']) : 0;
 
 if (!$userId || !$skillId) {
-    header('Location: ' . api_get_path(WEB_PATH));
+    header('Location: '.api_get_path(WEB_PATH));
     exit;
 }
 
@@ -30,7 +30,7 @@ if (!$user || !$skill) {
         Display::return_message(get_lang('NoResults'), 'error')
     );
 
-    header('Location: ' . api_get_path(WEB_PATH));
+    header('Location: '.api_get_path(WEB_PATH));
     exit;
 }
 
@@ -167,7 +167,7 @@ foreach ($userSkills as $index => $skillIssue) {
         $entityManager->persist($skillIssue);
         $entityManager->flush();
 
-        header("Location: " . $skillIssue->getIssueUrlAll());
+        header("Location: ".$skillIssue->getIssueUrlAll());
         exit;
     }
 
@@ -198,7 +198,7 @@ foreach ($userSkills as $index => $skillIssue) {
         $entityManager->persist($skillUserComment);
         $entityManager->flush();
 
-        header("Location: " . $skillIssue->getIssueUrlAll());
+        header("Location: ".$skillIssue->getIssueUrlAll());
         exit;
     }
 
@@ -214,11 +214,11 @@ foreach ($userSkills as $index => $skillIssue) {
             $backpack = $configBackpack;
         }
 
-        $htmlHeadXtra[] = '<script src="' . $backpack . 'issuer.js"></script>';
+        $htmlHeadXtra[] = '<script src="'.$backpack.'issuer.js"></script>';
         $objSkill = new Skill();
         $assertionUrl = $skillIssueInfo['badge_assertion'];
         $skills = $objSkill->get($skillId);
-        $unbakedBadge = api_get_path(SYS_UPLOAD_PATH) . "badges/".$skills['icon'];
+        $unbakedBadge = api_get_path(SYS_UPLOAD_PATH)."badges/".$skills['icon'];
         if (!is_file($unbakedBadge)) {
             $unbakedBadge = api_get_path(WEB_CODE_PATH).'img/icons/128/badges-default.png';
         }
@@ -236,12 +236,12 @@ foreach ($userSkills as $index => $skillIssue) {
                 mkdir($bakedBadge, api_get_permissions_for_new_directories(), true);
             }
             $skillRelUserId = $skillIssueInfo['id'];
-            if (!file_exists($bakedBadge . "/badge_" . $skillRelUserId)) {
-                file_put_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png", $bakedInfo);
+            if (!file_exists($bakedBadge."/badge_".$skillRelUserId)) {
+                file_put_contents($bakedBadge."/badge_".$skillRelUserId.".png", $bakedInfo);
             }
 
             //Process to validate a baked badge
-            $badgeContent = file_get_contents($bakedBadge . "/badge_" . $skillRelUserId . ".png");
+            $badgeContent = file_get_contents($bakedBadge."/badge_".$skillRelUserId.".png");
             $verifyBakedBadge = $png->extractBadgeInfo($badgeContent);
             if (!is_array($verifyBakedBadge)) {
                 $badgeInfoError = true;
@@ -249,7 +249,7 @@ foreach ($userSkills as $index => $skillIssue) {
 
             if (!$badgeInfoError) {
                 $personalBadge = UserManager::getUserPathById($userId, "web");
-                $personalBadge = $personalBadge."badges/badge_" . $skillRelUserId . ".png";
+                $personalBadge = $personalBadge."badges/badge_".$skillRelUserId.".png";
             }
         }
     }

+ 1 - 1
main/calendar/agenda.php

@@ -283,7 +283,7 @@ if ($allowToEdit) {
             $content = $form->returnForm();
             break;
         case "delete":
-            if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $eventId) )) {
+            if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $eventId))) {
                 // a coach can only delete an element belonging to his session
                 $content = $agenda->deleteEvent($eventId);
             }

+ 4 - 4
main/chat/chat.php

@@ -19,11 +19,11 @@ $externalCSS = [
 ];
 
 foreach ($externalCSS as $css) {
-    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH) . $css);
+    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).$css);
 }
 
-$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'chat.css');
-$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'markdown.css');
+$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css');
+$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'markdown.css');
 
 $externalJS = [
     'highlight/highlight.pack.js',
@@ -43,7 +43,7 @@ foreach (Emojione\Emojione::$shortcode_replace as $key => $icon) {
         continue;
     }
 
-    $iconList[$key] = strtoupper($icon) . '.png';
+    $iconList[$key] = strtoupper($icon).'.png';
 }
 
 $view = new Template(get_lang('Chat'), false, false, false, true, false);

+ 5 - 5
main/course_home/2column.php

@@ -56,7 +56,7 @@ if (api_is_platform_admin()) {
     // Show message to confirm that a tool it to be hidden from available tools
     // visibility 0,1->2
     if (!empty($_GET['askDelete'])) {
-        $content .='<div id="toolhide">'.get_lang('DelLk').'<br />&nbsp;&nbsp;&nbsp;
+        $content .= '<div id="toolhide">'.get_lang('DelLk').'<br />&nbsp;&nbsp;&nbsp;
             <a href="'.api_get_self().'">'.get_lang('No').'</a>&nbsp;|&nbsp;
             <a href="'.api_get_self().'?delete=yes&id='.intval($_GET['id']).'">'.get_lang('Yes').'</a>
         </div>';
@@ -92,7 +92,7 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
 
     /*	INACTIVE TOOLS - HIDDEN (GREY) LINKS */
 
-    $content .=	"<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n".
+    $content .= "<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n".
             "<tr>\n".
             "<td colspan=\"4\">\n".
             "<div style=\"margin-bottom: 10px;\"><font color=\"#808080\">\n".get_lang('InLnk')."</font></div>".
@@ -101,14 +101,14 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
 
     $content .= CourseHome::show_tool_2column(TOOL_PUBLIC_BUT_HIDDEN);
 
-    $content .=	"</table>";
-    $content .=	"</div> ";
+    $content .= "</table>";
+    $content .= "</div> ";
 }
 
 /*	Tools for platform admin only */
 
 if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
-    $content .='<div class="platformadminview">
+    $content .= '<div class="platformadminview">
     <span class="viewcaption">'.get_lang('PlatformAdminOnly').'</span>
     <table width="100%">
         '.CourseHome::show_tool_2column(TOOL_PLATFORM_ADMIN).'

+ 12 - 12
main/course_home/3column.php

@@ -126,14 +126,14 @@ elseif (isset($update) && $update) {
         "</td>\n".
         "<td>\n".
         "<select name=\"image\">\n".
-        "<option selected>". $image. "</option>\n";
+        "<option selected>".$image."</option>\n";
 
     if ($dir = @opendir($chemin)) {
         while ($file = readdir($dir)) {
             if ($file == '..' || $file == '.') {
                 unset($file);
             }
-            $content .= "<option>". $file. "</option>\n";
+            $content .= "<option>".$file."</option>\n";
         }
         closedir($dir);
     }
@@ -142,15 +142,15 @@ elseif (isset($update) && $update) {
         "</td>\n".
         "</tr>\n".
         "<tr>\n".
-        "<td>". get_lang('NameOfTheLink'). " : </td>\n".
-        "<td><input type=\"text\" name=\"name\" value=\"". $name. "\"></td>\n".
+        "<td>".get_lang('NameOfTheLink')." : </td>\n".
+        "<td><input type=\"text\" name=\"name\" value=\"".$name."\"></td>\n".
         "</tr>\n".
         "<tr>\n".
         "<td>Lien :</td>\n".
-        "<td><input type=\"text\" name=\"link\" value=\"". $link. "\"></td>\n".
+        "<td><input type=\"text\" name=\"link\" value=\"".$link."\"></td>\n".
         "</tr>\n".
         "<tr>\n".
-        "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"". get_lang('Ok'). "\"></td>\n".
+        "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"".get_lang('Ok')."\"></td>\n".
         "</tr>\n".
         "</form>\n".
         "</table>\n".
@@ -203,21 +203,21 @@ if (api_is_allowed_to_edit(null, true) && !api_is_coach()) {
         "<tr><td colspan=\"6\"><font color=\"#F66105\">\n".get_lang('CourseAdminOnly')."</font>
         </td></tr>\n";
     $content .= "<tr>\n<td colspan=\"6\">";
-    $content .=CourseHome::show_tool_3column('courseAdmin');
+    $content .= CourseHome::show_tool_3column('courseAdmin');
     $content .= "</td>\n</tr>\n";
 }
 
 /*	TOOLS FOR PLATFORM ADMIN ONLY */
 if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) {
-    $content .=  "<tr>"."<td colspan=\"6\">".
+    $content .= "<tr>"."<td colspan=\"6\">".
         "<hr noshade size=\"1\" />".
         "</td>"."</tr>\n".
         "<tr>\n"."<td colspan=\"6\">\n".
-        "<font color=\"#F66105\" >". get_lang('PlatformAdminOnly'). "</font>\n".
+        "<font color=\"#F66105\" >".get_lang('PlatformAdminOnly')."</font>\n".
         "</td>\n"."</tr>\n";
-    $content .=  "<tr>\n<td colspan=\"6\">";
+    $content .= "<tr>\n<td colspan=\"6\">";
     $content .= CourseHome::show_tool_3column('platformAdmin');
-    $content .=  "</td>\n</tr>\n";
+    $content .= "</td>\n</tr>\n";
 }
 
-$content .=  "</table>\n";
+$content .= "</table>\n";

+ 2 - 2
main/coursecopy/copy_course.php

@@ -12,7 +12,7 @@ use Chamilo\CourseBundle\Component\CourseCopy\CourseRestorer;
 
 // Setting the global file that gets the general configuration, the databases, the languages, ...
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_COURSE_MAINTENANCE;
+$current_course_tool = TOOL_COURSE_MAINTENANCE;
 api_protect_course_script(true);
 
 if (!api_is_allowed_to_edit()) {
@@ -122,7 +122,7 @@ if (Security::check_token('post') && (
         $form->addGroup($group, '', get_lang('SameFilename'));
         $form->addProgress();
         $form->addButtonSave(get_lang('CopyCourse'));
-        $form->setDefaults(array('copy_option' =>'select_items','same_file_name_option' => FILE_OVERWRITE));
+        $form->setDefaults(array('copy_option' =>'select_items', 'same_file_name_option' => FILE_OVERWRITE));
 
         // Add Security token
         $token = Security::get_token();

+ 3 - 3
main/coursecopy/create_backup.php

@@ -70,8 +70,8 @@ if (Security::check_token('post') && (
 
     $zip_file = CourseArchiver::createBackup($course);
     Display::display_confirmation_message(get_lang('BackupCreated'));
-    echo '<br /><a class="btn btn-primary btn-large" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/download.php?archive=' . $zip_file . '&' . api_get_cidreq() . '">
-    ' . get_lang('Download') . '</a>';
+    echo '<br /><a class="btn btn-primary btn-large" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.$zip_file.'&'.api_get_cidreq().'">
+    ' . get_lang('Download').'</a>';
 
 } elseif (Security::check_token('post') && (
         isset($_POST['backup_option']) &&
@@ -96,7 +96,7 @@ if (Security::check_token('post') && (
         $form = new FormValidator(
             'create_backup_form',
             'post',
-            api_get_self() . '?' . api_get_cidreq()
+            api_get_self().'?'.api_get_cidreq()
         );
         $form->addElement('header', get_lang('SelectOptionForBackup'));
         $form->addElement('radio', 'backup_option', '', get_lang('CreateFullBackup'), 'full_backup');

+ 1 - 1
main/coursecopy/recycle_course.php

@@ -13,7 +13,7 @@ use Chamilo\CourseBundle\Component\CourseCopy\CourseRecycler;
  */
 
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_COURSE_MAINTENANCE;
+$current_course_tool = TOOL_COURSE_MAINTENANCE;
 api_protect_course_script(true);
 
 // Check access rights (only teachers are allowed here)

+ 15 - 15
main/document/create_paint.php

@@ -131,27 +131,27 @@ echo '</div>';
 
 // pixlr
 // max size 1 Mb ??
-$title = urlencode(utf8_encode(get_lang('NewImage')));//TODO:check
+$title = urlencode(utf8_encode(get_lang('NewImage'))); //TODO:check
 //
 $image = Display::returnIconPath('canvas1024x768.png');
 //
 $pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
-$langpixlr  = api_get_language_isocode();
+$langpixlr = api_get_language_isocode();
 $langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr;
-$loc=$langpixlr;// deprecated ?? TODO:check pixlr read user browser
-
-$exit_path=api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
-$_SESSION['exit_pixlr']=$document_data['path'];
-$referrer="Chamilo";
-$target_path=api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
-$target=$target_path;
-$locktarget="true";
-$locktitle="false";
-
-if ($_SERVER['HTTP_HOST']=="localhost") {
-	$path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml';
+$loc = $langpixlr; // deprecated ?? TODO:check pixlr read user browser
+
+$exit_path = api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
+$_SESSION['exit_pixlr'] = $document_data['path'];
+$referrer = "Chamilo";
+$target_path = api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
+$target = $target_path;
+$locktarget = "true";
+$locktitle = "false";
+
+if ($_SERVER['HTTP_HOST'] == "localhost") {
+	$path_and_file = api_get_path(SYS_PATH).'/crossdomain.xml';
 	if (!file_exists($path_and_file)) {
-		$crossdomain='<?xml version="1.0"?>
+		$crossdomain = '<?xml version="1.0"?>
 			<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
 			<cross-domain-policy>
 				<allow-access-from domain="cdn.pixlr.com" />

+ 1 - 1
main/document/download_scorm.php

@@ -39,7 +39,7 @@ $doc_url = str_replace('///', '&', $doc_url);
 $doc_url = str_replace(' ', '+', $doc_url);
 $doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), $doc_url); //echo $doc_url;
 
-if (strpos($doc_url,'../') || strpos($doc_url,'/..')) {
+if (strpos($doc_url, '../') || strpos($doc_url, '/..')) {
     $doc_url = '';
 }
 

+ 45 - 45
main/document/edit_paint.php

@@ -37,26 +37,26 @@ if (empty($document_data)) {
     $my_cur_dir_path = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
 }
 
-$dir= str_replace('\\', '/', $dir);//and urlencode each url $curdirpath (hack clean $curdirpath under Windows - Bug #3261)
+$dir = str_replace('\\', '/', $dir); //and urlencode each url $curdirpath (hack clean $curdirpath under Windows - Bug #3261)
 
 /* Constants & Variables */
-$current_session_id=api_get_session_id();
+$current_session_id = api_get_session_id();
 //path for pixlr save
-$_SESSION['paint_dir']=Security::remove_XSS($dir);
-if($_SESSION['paint_dir']=='/'){
-    $_SESSION['paint_dir']='';
+$_SESSION['paint_dir'] = Security::remove_XSS($dir);
+if ($_SESSION['paint_dir'] == '/') {
+    $_SESSION['paint_dir'] = '';
 }
-$_SESSION['paint_file']=basename(Security::remove_XSS($file_path));
+$_SESSION['paint_file'] = basename(Security::remove_XSS($file_path));
 
 $get_file = Security::remove_XSS($file_path);
 
 $file = basename($get_file);
 
-$temp_file = explode(".",$file);
-$filename=$temp_file[0];
-$nameTools = get_lang('EditDocument') . ': '.$filename;
+$temp_file = explode(".", $file);
+$filename = $temp_file[0];
+$nameTools = get_lang('EditDocument').': '.$filename;
 
-$courseDir   = $_course['path'].'/document';
+$courseDir = $_course['path'].'/document';
 
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 
@@ -100,15 +100,15 @@ if (!empty($groupId)) {
 $is_certificate_mode = DocumentManager::is_certificate_mode($dir);
 
 if (!$is_certificate_mode)
-	$interbreadcrumb[]= array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
+	$interbreadcrumb[] = array("url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), "name"=> get_lang('Documents'));
 else
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
+	$interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
 
 // Interbreadcrumb for the current directory root path
 if (empty($document_data['parents'])) {
     $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
 } else {
-    foreach($document_data['parents'] as $document_sub_data) {
+    foreach ($document_data['parents'] as $document_sub_data) {
         if ($document_data['title'] == $document_sub_data['title']) {
             continue;
         }
@@ -128,33 +128,33 @@ Event::event_access_tool(TOOL_DOCUMENT);
 Display :: display_header($nameTools, 'Doc');
 echo '<div class="actions">';
 echo '<a href="document.php?id='.$parent_id.'&'.api_get_cidreq().'">'.
-    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&'.api_get_cidreq().'&origin=editpaint">'.
-    Display::return_icon('edit.png', get_lang('Rename').'/'.get_lang('Comment'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('edit.png', get_lang('Rename').'/'.get_lang('Comment'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 
 ///pixlr
-$title=$file;//disk name. No sql name because pixlr return this when save
+$title = $file; //disk name. No sql name because pixlr return this when save
 $pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
-$langpixlr  = api_get_language_isocode();
+$langpixlr = api_get_language_isocode();
 $langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr;
-$loc=$langpixlr;// deprecated ?? TODO:check pixlr read user browser
+$loc = $langpixlr; // deprecated ?? TODO:check pixlr read user browser
 
-$exit_path=api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
-$_SESSION['exit_pixlr']= Security::remove_XSS($parent_id);
+$exit_path = api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php';
+$_SESSION['exit_pixlr'] = Security::remove_XSS($parent_id);
 
-$referrer="Chamilo";
+$referrer = "Chamilo";
 
-$target_path=api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
-$target=$target_path;
+$target_path = api_get_path(WEB_CODE_PATH).'document/save_pixlr.php';
+$target = $target_path;
 
-$locktarget="true";
-$locktitle="false";
+$locktarget = "true";
+$locktitle = "false";
 
-if ($_SERVER['HTTP_HOST']=="localhost") {
-	$path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml';
+if ($_SERVER['HTTP_HOST'] == "localhost") {
+	$path_and_file = api_get_path(SYS_PATH).'/crossdomain.xml';
 	if (!file_exists($path_and_file)) {
-		$crossdomain='<?xml version="1.0"?>
+		$crossdomain = '<?xml version="1.0"?>
 			<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
 			<cross-domain-policy>
 				<allow-access-from domain="cdn.pixlr.com" />
@@ -163,23 +163,23 @@ if ($_SERVER['HTTP_HOST']=="localhost") {
 			</cross-domain-policy>';//more open domain="*"
 		@file_put_contents($path_and_file, $crossdomain);
 	}
-	$credentials="true";
+	$credentials = "true";
 }
 else {
-	$credentials="false";
+	$credentials = "false";
 }
 
 //make temp images
-$temp_folder=api_get_path(SYS_ARCHIVE_PATH).'temp/images';
+$temp_folder = api_get_path(SYS_ARCHIVE_PATH).'temp/images';
 if (!file_exists($temp_folder)) {
-    @mkdir($temp_folder, api_get_permissions_for_new_directories(), true);//TODO:check $permissions value, now empty;
+    @mkdir($temp_folder, api_get_permissions_for_new_directories(), true); //TODO:check $permissions value, now empty;
 }
 
 //make htaccess with allow from all, and file index.html into temp/images
-$htaccess=api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess';
+$htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess';
 if (!file_exists($htaccess)) {
 
-	$htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes";
+	$htaccess_content = "order deny,allow\r\nallow from all\r\nOptions -Indexes";
 
 	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/.htaccess', 'w');
 	if ($fp) {
@@ -188,9 +188,9 @@ if (!file_exists($htaccess)) {
 	}
 }
 
-$html_index=api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html';
+$html_index = api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html';
 if (!file_exists($html_index)) {
-	$html_index_content="<html><head></head><body></body></html>";
+	$html_index_content = "<html><head></head><body></body></html>";
 	$fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/images/index.html', 'w');
 	if ($fp) {
 		fwrite($fp, $html_index_content);
@@ -199,20 +199,20 @@ if (!file_exists($html_index)) {
 }
 
 //encript temp name file
-$name_crip=sha1(uniqid());//encript
-$findext= explode(".", $file);
-$extension= $findext[count($findext)-1];
-$file_crip=$name_crip.'.'.$extension;
+$name_crip = sha1(uniqid()); //encript
+$findext = explode(".", $file);
+$extension = $findext[count($findext) - 1];
+$file_crip = $name_crip.'.'.$extension;
 
 //copy file to temp/images directory
-$from=$filepath.$file;
-$to=api_get_path(SYS_ARCHIVE_PATH).'temp/images/'.$file_crip;
+$from = $filepath.$file;
+$to = api_get_path(SYS_ARCHIVE_PATH).'temp/images/'.$file_crip;
 copy($from, $to);
-$_SESSION['temp_realpath_image']=$to;
+$_SESSION['temp_realpath_image'] = $to;
 
 //load image to url
-$to_url=api_get_path(WEB_ARCHIVE_PATH).'temp/images/'.$file_crip;
-$image=urlencode($to_url);
+$to_url = api_get_path(WEB_ARCHIVE_PATH).'temp/images/'.$file_crip;
+$image = urlencode($to_url);
 $pixlr_url = api_get_protocol().'://pixlr.com/editor/?title='.$title.'&image='.$image.'&loc='.$loc.'&referrer='.$referrer.'&target='.$target.'&exit='.$exit_path.'&locktarget='.$locktarget.'&locktitle='.$locktitle.'&credentials='.$credentials;
 
 //make frame an send image

+ 5 - 5
main/document/show_content.php

@@ -98,12 +98,12 @@ $browser_display_title = 'Documents - '.Security::remove_XSS($_GET['cidReq']).'
 $file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file.'?'.api_get_cidreq();
 $pathinfo = pathinfo($header_file);
 
-if ($pathinfo['extension']=='swf') {
-	$width='83%';
-	$height='83%';
+if ($pathinfo['extension'] == 'swf') {
+	$width = '83%';
+	$height = '83%';
 } else {
-	$width='100%';
-	$height='100%';
+	$width = '100%';
+	$height = '100%';
 }
 
 echo '<iframe border="0" frameborder="0" scrolling="no" style="width:'.$width.'; height:'.$height.';background-color:#ffffff;" id="mainFrame" name="mainFrame" src="'.$file_url_web.'?'.api_get_cidreq().'&amp;rand='.mt_rand(1, 1000).'"></iframe>';

+ 50 - 50
main/document/slideshow.php

@@ -64,7 +64,7 @@ function MM_openBrWindow(theURL,winName,features) { //v2.0
 if ($slide_id != 'all') {
 	$image = null;
 	if (isset($image_files_only[$slide])) {
-		$image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide];
+		$image = $sys_course_path.$_course['path'].'/document'.$folder.$image_files_only[$slide];
 	}
 	if (file_exists($image)) {
 		echo '<div class="actions-pagination">';
@@ -105,7 +105,7 @@ if ($slide_id != 'all') {
             $last = Display::return_icon('action_last_na.png', get_lang('LastSlide'));
 		} else {
 			$imgn = 'action_next.png';
-			$last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'">
+			$last = '<a href="slideshow.php?slide_id='.($total_slides - 1).'&curdirpath='.$pathurl.'">
 			        '.Display::return_icon('action_last.png', get_lang('LastSlide')).'
                 </a>';
 		}
@@ -122,18 +122,18 @@ if ($slide_id != 'all') {
 
 // Exit the slideshow
 echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
-    Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
 
 // Show thumbnails
 if ($slide_id != 'all') {
 	echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
-        Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>';
+        Display::return_icon('thumbnails.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM).'</a>';
 } else {
-	echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM);
+	echo Display::return_icon('thumbnails_na.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM);
 }
 // Slideshow options
 echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
-    Display::return_icon('settings.png', get_lang('SetSlideshowOptions'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('settings.png', get_lang('SetSlideshowOptions'), '', ICON_SIZE_MEDIUM).'</a>';
 
 echo '</div>';
 echo '<br />';
@@ -157,7 +157,7 @@ if (isset($_POST['Submit'])) {
 }
 $target_width = $target_height = null;
 // The target height and width depends if we choose resizing or no resizing
-if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == "resizing") {
+if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") {
 	$target_width = $_SESSION["image_resizing_width"];
 	$target_height = $_SESSION["image_resizing_height"];
 }
@@ -165,7 +165,7 @@ if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == "resiz
 /*	THUMBNAIL VIEW */
 
 // This is for viewing all the images in the slideshow as thumbnails.
-$image_tag = array ();
+$image_tag = array();
 $html = '';
 if ($slide_id == 'all') {
 
@@ -173,16 +173,16 @@ if ($slide_id == 'all') {
     $allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png');
 	$max_thumbnail_width     = 250;
 	$max_thumbnail_height    = 250;
-	$png_compression	     = 0;//0(none)-9
-	$jpg_quality  	         = 75;//from 0 to 100 (default is 75). More quality less compression
+	$png_compression	     = 0; //0(none)-9
+	$jpg_quality = 75; //from 0 to 100 (default is 75). More quality less compression
 
 	$directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
 
 	//Other parameters only for show tumbnails
-	$row_items 			     = 4;//only in slideshow.php
-	$number_image 			 = 7;//num icons cols to show
-	$thumbnail_width_frame=$max_thumbnail_width;//optional $max_thumbnail_width+x
-	$thumbnail_height_frame=$max_thumbnail_height;
+	$row_items = 4; //only in slideshow.php
+	$number_image = 7; //num icons cols to show
+	$thumbnail_width_frame = $max_thumbnail_width; //optional $max_thumbnail_width+x
+	$thumbnail_height_frame = $max_thumbnail_height;
 
 	// Create the template_thumbnails folder (if no exist)
 
@@ -195,20 +195,20 @@ if ($slide_id == 'all') {
 
 		foreach ($image_files_only as $one_image_file) {
 			$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
-			$image_thumbnail= $directory_thumbnails.'.'.$one_image_file;
+			$image_thumbnail = $directory_thumbnails.'.'.$one_image_file;
 
 			if (file_exists($image)) {
 				//check thumbnail
 				$imagetype = explode(".", $image);
                 //or check $imagetype = image_type_to_extension(exif_imagetype($image), false);
-				$imagetype = strtolower($imagetype[count($imagetype)-1]);
+				$imagetype = strtolower($imagetype[count($imagetype) - 1]);
 
-				if(in_array($imagetype,$allowed_thumbnail_types)) {
-					if (!file_exists($image_thumbnail)){
+				if (in_array($imagetype, $allowed_thumbnail_types)) {
+					if (!file_exists($image_thumbnail)) {
                         //run each once we view thumbnails is too heavy, then need move into  !file_exists($image_thumbnail, and only run when haven't the thumbnail
 						$original_image_size = api_getimagesize($image);
 
-						switch($imagetype) {
+						switch ($imagetype) {
 							case 'gif':
 								$source_img = imagecreatefromgif($image);
 								break;
@@ -230,17 +230,17 @@ if ($slide_id == 'all') {
                             $max_thumbnail_height
                         );
 
-						if($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){
-							$new_thumbnail_size['width']=$original_image_size['width'];
-							$new_thumbnail_size['height']=$original_image_size['height'];
+						if ($max_thumbnail_width > $original_image_size['width'] && $max_thumbnail_height > $original_image_size['height']) {
+							$new_thumbnail_size['width'] = $original_image_size['width'];
+							$new_thumbnail_size['height'] = $original_image_size['height'];
 						}
 
 						$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
 
 						// preserve transparency
-						if($imagetype == "png"){
+						if ($imagetype == "png") {
 							imagesavealpha($crop, true);
-							$color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
+							$color = imagecolorallocatealpha($crop, 0x00, 0x00, 0x00, 127);
 							imagefill($crop, 0, 0, $color);
 						}
 
@@ -248,7 +248,7 @@ if ($slide_id == 'all') {
 							$transindex = imagecolortransparent($source_img);
                             $palletsize = imagecolorstotal($source_img);
 							 //GIF89a for transparent and anim (first clip), either GIF87a
-							 if ($transindex >= 0 && $transindex < $palletsize){
+							 if ($transindex >= 0 && $transindex < $palletsize) {
 								 $transcol = imagecolorsforindex($source_img, $transindex);
 								 $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
 								 imagefill($crop, 0, 0, $transindex);
@@ -272,16 +272,16 @@ if ($slide_id == 'all') {
 
 						switch ($imagetype) {
 							case 'gif':
-								imagegif($crop,$image_thumbnail);
+								imagegif($crop, $image_thumbnail);
 								break;
 							case 'jpg':
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
+								imagejpeg($crop, $image_thumbnail, $jpg_quality);
 								break;
 							case 'jpeg':
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
+								imagejpeg($crop, $image_thumbnail, $jpg_quality);
 								break;
 							case 'png':
-								imagepng($crop,$image_thumbnail,$png_compression);
+								imagepng($crop, $image_thumbnail, $png_compression);
 								break;
 						}
 
@@ -291,26 +291,26 @@ if ($slide_id == 'all') {
 
 					//show thumbnail and link
 
-					$one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
+					$one_image_thumbnail_file = '.thumbs/.'.$one_image_file; //get path thumbnail
 					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
 					$image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
 				} else {
 					//if images aren't support by gd (not gif, jpg, jpeg, png)
-					if ($imagetype=="bmp") {
+					if ($imagetype == "bmp") {
                         // use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy
 						$original_image_size = getimagesize($image);
-						if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){
-							$thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files
+						if ($max_thumbnail_width < $original_image_size[0] || $max_thumbnail_height < $original_image_size[1]) {
+							$thumbnail_size = api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height); //don't use resize_image because doesn't run with bmp files
 							$image_height = $thumbnail_size['height'];
 							$image_width  = $thumbnail_size['width'];
 						} else {
-							$image_height=$original_image_size[0];
-							$image_width=$original_image_size[1];
+							$image_height = $original_image_size[0];
+							$image_width = $original_image_size[1];
 						}
 					} else {
 						//example for svg files,...
-						$image_width=$max_thumbnail_width;
-						$image_height=$max_thumbnail_height;
+						$image_width = $max_thumbnail_width;
+						$image_height = $max_thumbnail_height;
 					}
 
 					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
@@ -326,7 +326,7 @@ if ($slide_id == 'all') {
 
 	$i = 0;
 	$count_image = count($image_tag);
-	$number_iteration = ceil($count_image/$number_image);
+	$number_iteration = ceil($count_image / $number_image);
 	$p = 0;
     $html = '';
     $html .= '<div class="gallery">';
@@ -338,7 +338,7 @@ if ($slide_id == 'all') {
                             $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">';
                             $html .= '<div class="frame">';
                             $html .= '<div class="photo">';
-                            $html .=  $image_tag[$p];
+                            $html .= $image_tag[$p];
                             $html .= '</div>';
                             $html .= '</div>';
                             $html .= '</a>';
@@ -393,7 +393,7 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
 
 		list($width, $height) = getimagesize($image);
 		// Auto resize
-		if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == 'resizing') {
+		if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') {
 		?>
 
 		<script type="text/javascript">
@@ -410,7 +410,7 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
 				start_height=initial_height;
 			}
 
-			document.write('<img id="image"  src="<?php echo  'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'"  border="0"  alt="<?php echo $image_files_only[$slide] ;?>">');
+			document.write('<img id="image"  src="<?php echo  'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'"  border="0"  alt="<?php echo $image_files_only[$slide]; ?>">');
 
 			function resizeImage() {
 
@@ -454,7 +454,7 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
 		echo '</a>';
         echo '<div class="caption text-center">';
         echo Display::tag('h3', $row['title']);
-        echo '<p>' . $row['comment'] . '</p>';
+        echo '<p>'.$row['comment'].'</p>';
         echo '</div>';
         echo '</div>';
 
@@ -467,7 +467,7 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
                 $resize_info = get_lang('Resizing').'<br />';
                 $resize_width = $_SESSION["image_resizing_width"].' x ';
                 $resize_height = $_SESSION['image_resizing_height'];
-            } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing'){
+            } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing') {
                 $resize_info = get_lang('Resizing').'<br />';
                 $resize_width = get_lang('Auto').' x ';
                 $resize_height = get_lang('Auto');
@@ -478,10 +478,10 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
             }
 
             echo '<li class="text-center">';
-            echo $image_files_only[$slide] . ' ';
+            echo $image_files_only[$slide].' ';
             echo Display::toolbarButton(
                 get_lang('Modify'),
-                'edit_document.php?' . api_get_cidreq() . '&' . http_build_query([
+                'edit_document.php?'.api_get_cidreq().'&'.http_build_query([
                     'id' => $row['id'],
                     'origin' => 'slideshow',
                     'origin_opt' => $edit_slide_id,
@@ -493,11 +493,11 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
                 false
             );
             echo '</li>';
-            echo '<li class="text-center">' . $width.' x '.$height . '</li>';
-			echo '<li class="text-center">' . round((filesize($image) / 1024), 2) . ' KB - ' . $ext . '</li>';
-            echo '<li class="text-center">' . $resize_info . '</li>';
-			echo '<li class="text-center">' . $resize_width . '</li>';
-			echo '<li class="text-center">' . $resize_height . '</li>';
+            echo '<li class="text-center">'.$width.' x '.$height.'</li>';
+			echo '<li class="text-center">'.round((filesize($image) / 1024), 2).' KB - '.$ext.'</li>';
+            echo '<li class="text-center">'.$resize_info.'</li>';
+			echo '<li class="text-center">'.$resize_width.'</li>';
+			echo '<li class="text-center">'.$resize_height.'</li>';
             echo '</ul>';
 		}
 

+ 1 - 1
main/dropbox/recover_dropbox_files.php

@@ -33,7 +33,7 @@ $sql = "SELECT * FROM $file_tbl
 $result = Database::query($sql);
 
 if (Database::num_rows($result)) {
-    $files  = Database::store_result($result);
+    $files = Database::store_result($result);
     $rows = array();
     foreach ($files as $file) {
         //Check if I have this file:

+ 13 - 13
main/exercise/Draggable.php

@@ -60,13 +60,13 @@ class Draggable extends Question
                 for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
                     if ($answer->isCorrect($i)) {
                         $nb_matches++;
-                        $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i);
-                        $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1);
+                        $defaults['answer['.$nb_matches.']'] = $answer->selectAnswer($i);
+                        $defaults['weighting['.$nb_matches.']'] = float_format($answer->selectWeighting($i), 1);
                         $answerInfo = $answer->getAnswerByAutoId($answer->correct[$i]);
-                        $defaults['matches[' . $nb_matches . ']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : '';
+                        $defaults['matches['.$nb_matches.']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : '';
                     } else {
                         $nb_options++;
-                        $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i);
+                        $defaults['option['.$nb_options.']'] = $answer->selectAnswer($i);
                     }
                 }
             }
@@ -89,9 +89,9 @@ class Draggable extends Question
         $html = '<table class="table table-striped table-hover">
             <thead>
                 <tr>
-                    <th width="85%">' . get_lang('Answer') . '</th>
-                    <th width="15%">' . get_lang('MatchesTo') . '</th>
-                    <th width="10">' . get_lang('Weighting') . '</th>
+                    <th width="85%">' . get_lang('Answer').'</th>
+                    <th width="15%">' . get_lang('MatchesTo').'</th>
+                    <th width="10">' . get_lang('Weighting').'</th>
                 </tr>
             </thead>
             <tbody>';
@@ -185,9 +185,9 @@ class Draggable extends Question
         for ($i = 1; $i <= $nb_matches; ++$i) {
             $position++;
 
-            $answer = $form->getSubmitValue('answer[' . $i . ']');
-            $matches = $form->getSubmitValue('matches[' . $i . ']');
-            $weighting = $form->getSubmitValue('weighting[' . $i . ']');
+            $answer = $form->getSubmitValue('answer['.$i.']');
+            $matches = $form->getSubmitValue('matches['.$i.']');
+            $weighting = $form->getSubmitValue('weighting['.$i.']');
             $this->weighting += $weighting;
             $objAnswer->createAnswer(
                 $answer,
@@ -212,10 +212,10 @@ class Draggable extends Question
     public function return_header($feedback_type = null, $counter = null, $score = null)
     {
         $header = parent::return_header($feedback_type, $counter, $score);
-        $header .= '<table class="' . $this->question_table_class . '">
+        $header .= '<table class="'.$this->question_table_class.'">
             <tr>
-                <th>' . get_lang('ElementList') . '</th>
-                <th>' . get_lang('Status') . '</th>
+                <th>' . get_lang('ElementList').'</th>
+                <th>' . get_lang('Status').'</th>
             </tr>';
 
         return $header;

+ 1 - 1
main/exercise/exercice.php

@@ -7,4 +7,4 @@
 // directly to exercise.php. This redirection is enabled for 1.10.x (2015-04-21)
 // The final goal of this file is to be removed in a few years time, if
 // considered realistically not harmful
-require __DIR__ . '/exercise.php';
+require __DIR__.'/exercise.php';

+ 3 - 3
main/exercise/exercise_reminder.php

@@ -17,7 +17,7 @@ $this_section = SECTION_COURSES;
 // notice for unauthorized people.
 api_protect_course_script(true);
 
-if ($debug>0) {
+if ($debug > 0) {
     error_log('Entered exercise_result.php: '.print_r($_POST, 1));
 }
 
@@ -100,7 +100,7 @@ if ($time_control) {
 if (isset($_SESSION['exe_id'])) {
     $exe_id = intval($_SESSION['exe_id']);
 }
-$exercise_stat_info	= $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
+$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
 if (!empty($exercise_stat_info['data_tracking'])) {
     $question_list = explode(',', $exercise_stat_info['data_tracking']);
 }
@@ -253,7 +253,7 @@ $exercise_actions .= '&nbsp;'.
     Display::url(
         get_lang('ReviewQuestions'),
         'javascript://',
-        array('onclick'=>'review_questions();','class'=>'btn btn-success')
+        array('onclick'=>'review_questions();', 'class'=>'btn btn-success')
     );
 
 echo Display::div('', array('class'=>'clear'));

+ 3 - 3
main/exercise/exercise_report.php

@@ -227,7 +227,7 @@ if (isset($_REQUEST['comments']) &&
             Display::addFlash(
                 Display::return_message(get_lang('MessageSent'))
             );
-            header('Location: ' . api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId);
+            header('Location: '.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId);
             exit;
         }
     }
@@ -258,8 +258,8 @@ if ($is_allowedToEdit && $origin != 'learnpath') {
         api_is_course_tutor() || api_is_course_coach()
     ) {
         $actions .= '<a href="admin.php?exerciseId='.intval($_GET['exerciseId']).'">'.Display :: return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
-        $actions .='<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>';
-        $actions .='<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>';
+        $actions .= '<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('activity_monitor.png', get_lang('LiveResults'), '', ICON_SIZE_MEDIUM).'</a>';
+        $actions .= '<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon('statistics.png', get_lang('ReportByQuestion'), '', ICON_SIZE_MEDIUM).'</a>';
 
         $actions .= '<a id="export_opener" href="'.api_get_self().'?export_report=1&exerciseId='.intval($_GET['exerciseId']).'" >'.
         Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>';

+ 56 - 56
main/exercise/export/scorm/scorm_classes.php

@@ -43,9 +43,9 @@ class ScormQuestion extends Question
 		$question->type = $qst->type;
 		$question->question = $qst->question;
 		$question->description = $qst->description;
-		$question->weighting=$qst->weighting;
-		$question->position=$qst->position;
-		$question->picture=$qst->picture;
+		$question->weighting = $qst->weighting;
+		$question->position = $qst->position;
+		$question->picture = $qst->picture;
 		$assessmentItem = new ScormAssessmentItem($question, $standalone);
 
 		return $assessmentItem->export();
@@ -227,7 +227,7 @@ class ScormAnswerMultipleChoice extends Answer
 					<input name="'.$identifier.'" id="'.$identifier.'" value="'.$i.'" type="checkbox" />
 					</td>
 					<td width="95%">
-					<label for="'.$identifier.'">' . Security::remove_XSS($this->answer[$i]) . '</label>
+					<label for="'.$identifier.'">'.Security::remove_XSS($this->answer[$i]).'</label>
 					</td>
 					</tr>';
 
@@ -239,7 +239,7 @@ class ScormAnswerMultipleChoice extends Answer
                 $jstmpw .= 'questions_answers_correct['.$this->questionJSId.']['.$i.'] = '.$this->correct[$i].';';
 				$id++;
 			}
-			$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n";
+			$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp, 0, -1).');'."\n";
             $js .= 'questions_types['.$this->questionJSId.'] = \'mcma\';'."\n";
 			$js .= $jstmpw;
 		} elseif ($type == MULTIPLE_ANSWER_COMBINATION) {
@@ -255,7 +255,7 @@ class ScormAnswerMultipleChoice extends Answer
 					<input name="'.$identifier.'" id="'.$identifier.'" value="'.$i.'" type="checkbox" />
 					</td>
 					<td width="95%">
-					<label for="'.$identifier.'">' . Security::remove_XSS($this->answer[$i]) . '</label>
+					<label for="'.$identifier.'">'.Security::remove_XSS($this->answer[$i]).'</label>
 					</td>
 					</tr>';
 
@@ -267,7 +267,7 @@ class ScormAnswerMultipleChoice extends Answer
                 $jstmpw .= 'questions_answers_correct['.$this->questionJSId.']['.$i.'] = '.$this->correct[$i].";";
                 $id++;
             }
-            $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');';
+            $js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp, 0, -1).');';
             $js .= 'questions_types['.$this->questionJSId.'] = "exact";';
             $js .= $jstmpw;
 		} else {
@@ -283,7 +283,7 @@ class ScormAnswerMultipleChoice extends Answer
 					<input name="'.$identifier_name.'" id="'.$identifier.'" value="'.$i.'" type="checkbox"/>
 					</td>
 					<td width="95%">
-					<label for="'.$identifier.'">' . Security::remove_XSS($this->answer[$i]) . '</label>
+					<label for="'.$identifier.'">'.Security::remove_XSS($this->answer[$i]).'</label>
 					</td>
 					</tr>';
 				$jstmp .= $i.',';
@@ -294,7 +294,7 @@ class ScormAnswerMultipleChoice extends Answer
                 $jstmpw .= 'questions_answers_correct['.$this->questionJSId.']['.$i.'] = '.$this->correct[$i].';';
 				$id++;
 			}
-			$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');';
+			$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp, 0, -1).');';
 			$js .= 'questions_types['.$this->questionJSId.'] = \'mcua\';';
 			$js .= $jstmpw;
 		}
@@ -329,7 +329,7 @@ class ScormAnswerTrueFalse extends Answer
 				<input name="'.$identifier_true.'" id="'.$identifier_true.'" value="'.$this->trueGrade.'" type="radio" />
 				</td>
 				<td width="95%">
-				<label for="'.$identifier_true.'">' . get_lang('True') . '</label>
+				<label for="'.$identifier_true.'">'.get_lang('True').'</label>
 				</td>
 				</tr>';
 		$html .=
@@ -338,7 +338,7 @@ class ScormAnswerTrueFalse extends Answer
 			<input name="'.$identifier_false.'" id="'.$identifier_false.'" value="'.$this->falseGrade.'" type="radio" />
 			</td>
 			<td width="95%">
-			<label for="'.$identifier_false.'">' . get_lang('False') . '</label>
+			<label for="'.$identifier_false.'">'.get_lang('False').'</label>
 			</td>
 			</tr></table></td></tr>';
 		$js .= 'questions_answers['.$this->questionJSId.'] = new Array(\'true\',\'false\');'."\n";
@@ -383,30 +383,30 @@ class ScormAnswerFillInBlanks extends Answer
 		}
 
 		// splits text and weightings that are joined with the character '::'
-		list($answer,$weight)=explode('::',$answer);
-		$weights = explode(',',$weight);
+		list($answer, $weight) = explode('::', $answer);
+		$weights = explode(',', $weight);
 		// because [] is parsed here we follow this procedure:
 		// 1. find everything between the [ and ] tags
-		$i=1;
+		$i = 1;
 		$jstmp = '';
 		$jstmpc = '';
 		$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
 		$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
-		$startlocations=api_strpos($answer,'[');
-		$endlocations=api_strpos($answer,']');
+		$startlocations = api_strpos($answer, '[');
+		$endlocations = api_strpos($answer, ']');
 		while ($startlocations !== false && $endlocations !== false) {
-			$texstring = api_substr($answer,$startlocations,($endlocations-$startlocations)+1);
+			$texstring = api_substr($answer, $startlocations, ($endlocations - $startlocations) + 1);
 			$answer = api_substr_replace(
                 $answer,
                 '<input type="text" name="question_'.$this->questionJSId.'_fib_'.$i.'" id="question_'.$this->questionJSId.'_fib_'.$i.'" size="10" value="" />',
                 $startlocations,
-                ($endlocations-$startlocations)+1
+                ($endlocations - $startlocations) + 1
             );
             $jstmp .= $i.',';
 			if (!empty($texstring)) {
 				$sub = api_substr($texstring, 1, -1);
 				if (!empty($sub)) {
-					$jstmpc .= "'" . api_htmlentities($sub, ENT_QUOTES, $charset) . "',";
+					$jstmpc .= "'".api_htmlentities($sub, ENT_QUOTES, $charset)."',";
 				}
 			}
             $my_weight = explode('@', $weights[$i - 1]);
@@ -426,12 +426,12 @@ class ScormAnswerFillInBlanks extends Answer
 			'.$answer.'
 			</td>
 			</tr></table></td></tr>';
-		$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.api_substr($jstmp,0,-1).');'."\n";
-		$js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.api_substr($jstmpc,0,-1).');'."\n";
+		$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.api_substr($jstmp, 0, -1).');'."\n";
+		$js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.api_substr($jstmpc, 0, -1).');'."\n";
 		$js .= 'questions_types['.$this->questionJSId.'] = \'fib\';'."\n";
 		$js .= $jstmpw;
 
-		return array($js,$html);
+		return array($js, $html);
 	}
 }
 
@@ -457,8 +457,8 @@ class ScormAnswerMatching extends Answer
 		// get max length of displayed array
 
 		$nbrAnswers = $this->selectNbrAnswers();
-		$cpt1='A';
-		$cpt2=1;
+		$cpt1 = 'A';
+		$cpt2 = 1;
 		$Select = array();
 		$qId = $this->questionJSId;
 		$s = '';
@@ -467,37 +467,37 @@ class ScormAnswerMatching extends Answer
 		$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
 		$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
 
-		for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
+		for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
 			$identifier = 'question_'.$qId.'_matching_';
-			$answer=$this->selectAnswer($answerId);
-			$answerCorrect=$this->isCorrect($answerId);
-			$weight=$this->selectWeighting($answerId);
+			$answer = $this->selectAnswer($answerId);
+			$answerCorrect = $this->isCorrect($answerId);
+			$weight = $this->selectWeighting($answerId);
 			$jstmp .= $answerId.',';
 
 			if (!$answerCorrect) {
 				// options (A, B, C, ...) that will be put into the list-box
-				$Select[$answerId]['Lettre']=$cpt1;
+				$Select[$answerId]['Lettre'] = $cpt1;
 				// answers that will be shown at the right side
 				$Select[$answerId]['Reponse'] = $answer;
 				$cpt1++;
 			} else {
-				$s.='<tr>';
-				$s.='<td width="40%" valign="top"><b>'.$cpt2.'</b>.&nbsp;'.$answer."</td>";
-				$s.='<td width="20%" align="center">&nbsp;&nbsp;<select name="'.$identifier.$cpt2.'" id="'.$identifier.$cpt2.'">';
-				$s.=' <option value="0">--</option>';
+				$s .= '<tr>';
+				$s .= '<td width="40%" valign="top"><b>'.$cpt2.'</b>.&nbsp;'.$answer."</td>";
+				$s .= '<td width="20%" align="center">&nbsp;&nbsp;<select name="'.$identifier.$cpt2.'" id="'.$identifier.$cpt2.'">';
+				$s .= ' <option value="0">--</option>';
 				// fills the list-box
                 foreach ($Select as $key => $val) {
                     $s .= '<option value="'.$key.'">'.$val['Lettre'].'</option>';
                 }  // end foreach()
 
-				$s.='</select>&nbsp;&nbsp;</td>';
-				$s.='<td width="40%" valign="top">';
+				$s .= '</select>&nbsp;&nbsp;</td>';
+				$s .= '<td width="40%" valign="top">';
                 if (isset($Select[$cpt2])) {
                     $s .= '<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse'];
                 } else {
                     $s .= '&nbsp;';
                 }
-				$s.="</td></tr>";
+				$s .= "</td></tr>";
 
 				$jstmpc .= '['.$answerCorrect.','.$cpt2.'],';
 
@@ -514,22 +514,22 @@ class ScormAnswerMatching extends Answer
 				if ($answerId == $nbrAnswers) {
 					// if there remain answers to be shown on the right side
 					while (isset($Select[$cpt2])) {
-						$s.= '<tr>';
-						$s.= '<td width="60%" colspan="2">&nbsp;</td>';
-						$s.= '<td width="40%" valign="top">';
-						$s.= '<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse'];
-						$s.= "</td></tr>";
+						$s .= '<tr>';
+						$s .= '<td width="60%" colspan="2">&nbsp;</td>';
+						$s .= '<td width="40%" valign="top">';
+						$s .= '<b>'.$Select[$cpt2]['Lettre'].'.</b> '.$Select[$cpt2]['Reponse'];
+						$s .= "</td></tr>";
 						$cpt2++;
 					}	// end while()
 				}  // end if()
 			}
 		}
-		$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp,0,-1).');'."\n";
-		$js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc,0,-1).');'."\n";
+		$js .= 'questions_answers['.$this->questionJSId.'] = new Array('.substr($jstmp, 0, -1).');'."\n";
+		$js .= 'questions_answers_correct['.$this->questionJSId.'] = new Array('.substr($jstmpc, 0, -1).');'."\n";
 		$js .= 'questions_types['.$this->questionJSId.'] = \'matching\';'."\n";
 		$js .= $jstmpw;
 		$html .= $s;
-		$html .= '</table></td></tr>' . "\n";
+		$html .= '</table></td></tr>'."\n";
 
 		return array($js, $html);
 	}
@@ -634,7 +634,7 @@ class ScormAnswerHotspot extends Answer
 		$html .= '';
 
 		// Get the answers, make a list
-		$nbrAnswers=$this->selectNbrAnswers();
+		$nbrAnswers = $this->selectNbrAnswers();
 
 		$answer_list = '<div style="padding: 10px; margin-left: -8px; border: 1px solid #4271b5; height: 448px; width: 200px;"><b>'.get_lang('HotspotZones').'</b><ol>';
         for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
@@ -698,7 +698,7 @@ class ScormAssessmentItem
 	{
 		$this->question = $question;
 		$this->question->setAnswer();
-		$this->questionIdent = "QST_" . $question->id ;
+		$this->questionIdent = "QST_".$question->id;
 		$this->standalone = $standalone;
 	}
 
@@ -798,7 +798,7 @@ class ScormAssessmentItem
 		$js .= 'var questions_answers = new Array();';
 		$js .= 'var questions_answers_correct = new Array();';
 		$js .= 'var questions_types = new Array();';
-		$js .= "\n" .
+		$js .= "\n".
 			'/**
              * Assigns any event handler to any element
              * @param	object	Element on which the event is added
@@ -1014,11 +1014,11 @@ class ScormSection
 	{
 		$js = file_get_contents('../inc/lib/javascript/hotspot/js/hotspot.js');
 
-		$js .= 'var questions = new Array();' . "\n";
-		$js .= 'var questions_answers = new Array();' . "\n";
-		$js .= 'var questions_answers_correct = new Array();' . "\n";
-		$js .= 'var questions_types = new Array();' . "\n";
-		$js .= "\n" .
+		$js .= 'var questions = new Array();'."\n";
+		$js .= 'var questions_answers = new Array();'."\n";
+		$js .= 'var questions_answers_correct = new Array();'."\n";
+		$js .= 'var questions_types = new Array();'."\n";
+		$js .= "\n".
 			'/**
              * Assigns any event handler to any element
              * @param	object	Element on which the event is added
@@ -1063,7 +1063,7 @@ class ScormSection
 
 		$js .= '';
 		$js .= 'addEvent(window,\'load\',addListeners,false);'."\n";
-		return $js. "\n";
+		return $js."\n";
 	}
 
 	/**
@@ -1110,8 +1110,8 @@ class ScormSection
 
 		$head = '';
 		if ($this->standalone) {
-			$head = '<?xml version = "1.0" encoding = "' . $charset . '" standalone = "no"?>' . "\n"
-				. '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n";
+			$head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>'."\n"
+				. '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">'."\n";
 		}
 
 		list($js, $html) = $this->export_questions();
@@ -1153,7 +1153,7 @@ class ScormSection
 		$js = $html = "";
 		$js_id = 0;
 		foreach ($this->exercise->selectQuestionList() as $q) {
-			list($jstmp, $htmltmp)= ScormQuestion::export_question($q, false, $js_id);
+			list($jstmp, $htmltmp) = ScormQuestion::export_question($q, false, $js_id);
 			$js .= $jstmp."\n";
 			$html .= $htmltmp."\n";
 			++$js_id;

+ 2 - 2
main/exercise/freeanswer.class.php

@@ -59,9 +59,9 @@ class FreeAnswer extends Question
             $score['revised'] = false;
         }
         $header = parent::return_header($feedback_type, $counter, $score);
-        $header .= '<table class="' . $this->question_table_class . '" >
+        $header .= '<table class="'.$this->question_table_class.'" >
         <tr>
-        <th>' . get_lang("Answer") . '</th>
+        <th>' . get_lang("Answer").'</th>
         </tr>';
 
         return $header;

+ 3 - 3
main/exercise/hotpotatoes.php

@@ -31,7 +31,7 @@ if (!empty($gradebook) && $gradebook == 'view') {
 }
 // The breadcrumbs.
 $interbreadcrumb[] = array(
-    'url' => api_get_path(WEB_CODE_PATH) . '.exercise/exercise.php?' . api_get_cidreq(),
+    'url' => api_get_path(WEB_CODE_PATH).'.exercise/exercise.php?'.api_get_cidreq(),
     'name' => get_lang('Exercises')
 );
 
@@ -151,7 +151,7 @@ if ((api_is_allowed_to_edit(null, true)) && (($finish == 0) || ($finish == 2)))
                 $_course,
                 $_FILES['userFile'],
                 $document_sys_path,
-                $uploadPath . '/' . $fld,
+                $uploadPath.'/'.$fld,
                 api_get_user_id(),
                 null,
                 null,
@@ -163,7 +163,7 @@ if ((api_is_allowed_to_edit(null, true)) && (($finish == 0) || ($finish == 2)))
                     $imgparams = $_POST['imgparams'];
                     $checked = CheckImageName($imgparams, $filename);
                     if ($checked) {
-                        $imgcount = $imgcount-1;
+                        $imgcount = $imgcount - 1;
                     } else {
                         $dialogBox .= $filename.' '.get_lang('NameNotEqual');
                         my_delete($document_sys_path.$uploadPath.'/'.$fld.'/'.$filename);

+ 4 - 4
main/exercise/hotspot_save.inc.php

@@ -12,7 +12,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 
 $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
 $questionId = intval($_GET['questionId']);
-$answerId 	= intval($_GET['answerId']);
+$answerId = intval($_GET['answerId']);
 
 if ($_GET['type'] == "square" || $_GET['type'] == "circle") {
 	$hotspot_type = $_GET['type'];
@@ -20,11 +20,11 @@ if ($_GET['type'] == "square" || $_GET['type'] == "circle") {
 }
 if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] == "oar") {
 	$hotspot_type = $_GET['type'];
-	$tmp_coord = explode(",",$_GET['co']);
+	$tmp_coord = explode(",", $_GET['co']);
 	$i = 0;
 	$hotspot_coordinates = "";
 	foreach ($tmp_coord as $coord) {
-		if ($i%2 == 0) {
+		if ($i % 2 == 0) {
 			$delimiter = ";";
 		} else {
 			$delimiter = "|";
@@ -32,7 +32,7 @@ if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] =
 		$hotspot_coordinates .= $coord.$delimiter;
 		$i++;
 	}
-	$hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
+	$hotspot_coordinates = api_substr($hotspot_coordinates, 0, -2);
 }
 $course_id = api_get_course_int_id();
 $sql = "UPDATE $TBL_ANSWER SET

+ 6 - 6
main/exercise/hotspot_savescore.inc.php

@@ -16,7 +16,7 @@ $coordinates = $_GET['coord'];
 $objExercise = Session::read('objExercise');
 $exerciseId = $objExercise->selectId();
 // Save clicking order
-$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1;
+$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids']) + 1;
 if ($_GET['answerId'] == "0") {
     // click is NOT on a hotspot
     $hit = 0;
@@ -24,18 +24,18 @@ if ($_GET['answerId'] == "0") {
 } else {
     // user clicked ON a hotspot
     $hit = 1;
-    $answerId = api_substr($_GET['answerId'],22,2);
+    $answerId = api_substr($_GET['answerId'], 22, 2);
 	// Save into session
 	$_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
 }
 //round-up the coordinates
-$coords = explode('/',$coordinates);
+$coords = explode('/', $coordinates);
 $coordinates = '';
 foreach ($coords as $coord) {
-    list($x,$y) = explode(';',$coord);
+    list($x, $y) = explode(';', $coord);
     $coordinates .= round($x).';'.round($y).'/';
 }
-$coordinates = substr($coordinates,0,-1);
+$coordinates = substr($coordinates, 0, -1);
 
 $TBL_TRACK_E_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
 // Save into db
@@ -45,7 +45,7 @@ $params = [
     'quiz_id' => $exerciseId,
     'question_id' => $questionId,
     'answer_id' =>  $answerId,
-    'correct' => $hit ,
+    'correct' => $hit,
     'coordinate' => $coordinates
 ];
 // Save insert id into session if users changes answer.

+ 3 - 3
main/gamification/my_progress.php

@@ -42,7 +42,7 @@ if (empty($sessionId)) {
     $UserIsSubscribedToSession = SessionManager::isUserSubscribedAsStudent($lastSessionId, $user->getId());
 
     if (!empty($lastSessionId) && $UserIsSubscribedToSession) {
-        $urlWithSession = api_get_self() . '?' . http_build_query([
+        $urlWithSession = api_get_self().'?'.http_build_query([
             'session_id' => $lastCourseAccess->getSessionId()
         ]);
 
@@ -116,13 +116,13 @@ if ($currentSession) {
         foreach ($learningPathList->list as $learningPathId => $learningPath) {
             $courseData['stats'][] = [
                 $learningPath['lp_name'],
-                'lp/lp_controller.php?' . http_build_query([
+                'lp/lp_controller.php?'.http_build_query([
                     'action' => 'stats',
                     'cidReq' => $course->getCode(),
                     'id_session' => $currentSession->getId(),
                     'gidReq' => 0,
                     'lp_id' => $learningPathId
-                ]) . api_get_cidreq()
+                ]).api_get_cidreq()
             ];
         }
 

+ 1 - 1
main/glossary/glossary_ajax_request.php

@@ -41,7 +41,7 @@ if (isset($_POST['glossary_id']) &&
         $glossary_all_data = implode('[|.|_|.|-|.|]', $glossary_all_data);
         echo api_xml_http_response_encode($glossary_all_data);
     }
-} elseif(isset($_POST['glossary_name'])) {
+} elseif (isset($_POST['glossary_name'])) {
     $my_glossary_name = Security::remove_XSS($_POST['glossary_name']);
     $my_glossary_name = api_convert_encoding($my_glossary_name, $charset, 'UTF-8');
     $my_glossary_name = trim($my_glossary_name);

+ 4 - 4
main/gradebook/certificate_report.php

@@ -18,7 +18,7 @@ $this_section = SECTION_TRACKING;
 api_block_anonymous_users();
 
 $interbreadcrumb[] = array(
-    "url" => api_is_student_boss()?"#":api_get_path(WEB_CODE_PATH) . "mySpace/index.php?".api_get_cidreq(),
+    "url" => api_is_student_boss() ? "#" : api_get_path(WEB_CODE_PATH)."mySpace/index.php?".api_get_cidreq(),
     "name" => get_lang("MySpace")
 );
 
@@ -111,7 +111,7 @@ if ($searchSessionAndCourse || $searchCourseOnly) {
     }
 
     if (!is_null($gradebook)) {
-        $exportAllLink = api_get_path(WEB_CODE_PATH) . "gradebook/gradebook_display_certificate.php?";
+        $exportAllLink = api_get_path(WEB_CODE_PATH)."gradebook/gradebook_display_certificate.php?";
         $exportAllLink .= http_build_query(array(
             "action" => "export_all_certificates",
             "cidReq" => $selectedCourseInfo['code'],
@@ -246,7 +246,7 @@ $template = new Template(get_lang('GradebookListOfStudentsCertificates'));
 $form = new FormValidator(
     'certificate_report_form',
     'post',
-    api_get_path(WEB_CODE_PATH) . 'gradebook/certificate_report.php'
+    api_get_path(WEB_CODE_PATH).'gradebook/certificate_report.php'
 );
 $form->addSelect('session', get_lang('Sessions'), $sessions, ['id' => 'session']);
 $form->addSelect('course', get_lang('Courses'), $courses, ['id' => 'course']);
@@ -285,7 +285,7 @@ if (api_is_student_boss()) {
     $searchForm = new FormValidator(
         'certificate_report_form',
         'post',
-        api_get_path(WEB_CODE_PATH) . 'gradebook/certificate_report.php'
+        api_get_path(WEB_CODE_PATH).'gradebook/certificate_report.php'
     );
     $searchForm->addSelect('student', get_lang('Students'), $students, ['id' => 'student']);
     $searchForm->addButtonSearch();

+ 3 - 3
main/gradebook/get_badges.php

@@ -33,7 +33,7 @@ $assertions = array();
 foreach ($userSkills as $skill) {
     $skillId = current($skill);
 
-    $assertionUrl = api_get_path(WEB_CODE_PATH) . "badge/assertion.php?";
+    $assertionUrl = api_get_path(WEB_CODE_PATH)."badge/assertion.php?";
     $assertionUrl .= http_build_query(array(
         'user' => $userId,
         'skill' => $skillId,
@@ -51,7 +51,7 @@ if (strcmp($backpack, $configBackpack) !== 0) {
     $backpack = $configBackpack;
 }
 
-$htmlHeadXtra[] = '<script src="' . $backpack . 'issuer.js"></script>';
+$htmlHeadXtra[] = '<script src="'.$backpack.'issuer.js"></script>';
 
 $tpl = new Template(get_lang('Badges'), false, false);
 
@@ -59,7 +59,7 @@ $tpl->assign(
     'content',
     "<script>
     $(document).on('ready', function (){ 
-        OpenBadges.issue_no_modal(" . json_encode($assertions) . "); 
+        OpenBadges.issue_no_modal(" . json_encode($assertions)."); 
     });
     </script>"
 );

+ 6 - 6
main/gradebook/gradebook_add_cat.php

@@ -8,7 +8,7 @@
 require_once __DIR__.'/../inc/global.inc.php';
 $_in_course = true;
 $course_code = api_get_course_id();
-if (empty($course_code )) {
+if (empty($course_code)) {
     $_in_course = false;
 }
 
@@ -23,7 +23,7 @@ $catadd = new Category();
 $my_user_id = api_get_user_id();
 $catadd->set_user_id($my_user_id);
 $catadd->set_parent_id($get_select_cat);
-$catcourse = Category :: load ($get_select_cat);
+$catcourse = Category :: load($get_select_cat);
 
 if ($_in_course) {
     $catadd->set_course_code($course_code);
@@ -37,12 +37,12 @@ $form = new CatForm(
     $catadd,
     'add_cat_form',
     null,
-    api_get_self() . '?selectcat='.$get_select_cat.'&'.api_get_cidreq()
+    api_get_self().'?selectcat='.$get_select_cat.'&'.api_get_cidreq()
 );
 
 if ($form->validate()) {
     $values = $form->exportValues();
-    $select_course=isset($values['select_course']) ? $values['select_course'] : array();
+    $select_course = isset($values['select_course']) ? $values['select_course'] : array();
     $cat = new Category();
     if ($values['hid_parent_id'] == '0') {
         if ($select_course == 'COURSEINDEPENDENT') {
@@ -89,12 +89,12 @@ if ($form->validate()) {
     }
     $cat->set_visible($visible);
     $result = $cat->add();
-    header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?addcat=&selectcat=' . $cat->get_parent_id().'&'.api_get_cidreq());
+    header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?addcat=&selectcat='.$cat->get_parent_id().'&'.api_get_cidreq());
     exit;
 }
 
 if (!$_in_course) {
-    $interbreadcrumb[] = array (
+    $interbreadcrumb[] = array(
         'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$get_select_cat.'&'.api_get_cidreq(),
         'name' => get_lang('Gradebook')
     );

+ 6 - 6
main/gradebook/gradebook_add_link_select_course.php

@@ -7,24 +7,24 @@
  */
 
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_GRADEBOOK;
+$current_course_tool = TOOL_GRADEBOOK;
 
 api_protect_course_script(true);
 api_block_anonymous_users();
 GradebookUtils::block_students();
 
-$selectCat =  isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
+$selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
 
 $catadd = new Category();
 $catadd->set_user_id(api_get_user_id());
 $catadd->set_parent_id($selectCat);
-$catcourse = Category :: load ($selectCat);
+$catcourse = Category :: load($selectCat);
 $form = new CatForm(
     CatForm :: TYPE_SELECT_COURSE,
     $catadd,
     'add_cat_form',
     null,
-    api_get_self() . '?selectcat=' . $selectCat.'&'.api_get_cidreq()
+    api_get_self().'?selectcat='.$selectCat.'&'.api_get_cidreq()
 );
 
 if ($form->validate()) {
@@ -32,11 +32,11 @@ if ($form->validate()) {
     $cat = new Category();
     $cat->set_course_code($values['select_course']);
     $cat->set_name($values['name']);
-    header('location: gradebook_add_link.php?selectcat=' .$selectCat.'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
+    header('location: gradebook_add_link.php?selectcat='.$selectCat.'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
     exit;
 }
 
-$interbreadcrumb[] = array (
+$interbreadcrumb[] = array(
     'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectCat.'&'.api_get_cidreq(),
     'name' => get_lang('Gradebook')
 );

+ 4 - 4
main/gradebook/gradebook_add_result.php

@@ -7,7 +7,7 @@
  */
 //$cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_GRADEBOOK;
+$current_course_tool = TOOL_GRADEBOOK;
 
 api_protect_course_script(true);
 api_block_anonymous_users();
@@ -25,14 +25,14 @@ $add_result_form = new EvalForm(
     $resultadd,
     'add_result_form',
     null,
-    api_get_self() . '?selectcat=' . Security::remove_XSS($category) . '&selecteval=' . $selectEval.'&'.api_get_cidreq()
+    api_get_self().'?selectcat='.Security::remove_XSS($category).'&selecteval='.$selectEval.'&'.api_get_cidreq()
 );
 $table = $add_result_form->toHtml();
 if ($add_result_form->validate()) {
     $values = $add_result_form->exportValues();
     $nr_users = $values['nr_users'];
     if ($nr_users == '0') {
-        header('Location: gradebook_view_result.php?addresultnostudents=&selecteval=' . $selectEval.'&'.api_get_cidreq());
+        header('Location: gradebook_view_result.php?addresultnostudents=&selecteval='.$selectEval.'&'.api_get_cidreq());
         exit;
     }
     $scores = ($values['score']);
@@ -47,7 +47,7 @@ if ($add_result_form->validate()) {
         $res->add();
         next($scores);
     }
-    header('Location: gradebook_view_result.php?addresult=&selecteval=' . $selectEval.'&'.api_get_cidreq());
+    header('Location: gradebook_view_result.php?addresult=&selecteval='.$selectEval.'&'.api_get_cidreq());
     exit;
 }
 $interbreadcrumb[] = array(

+ 8 - 8
main/gradebook/gradebook_add_user.php

@@ -14,11 +14,11 @@ $this_section = SECTION_MYGRADEBOOK;
 api_block_anonymous_users();
 GradebookUtils::block_students();
 
-$evaluation= Evaluation :: load($_GET['selecteval']);
+$evaluation = Evaluation :: load($_GET['selecteval']);
 $newstudents = $evaluation[0]->get_not_subscribed_students();
 
 if (count($newstudents) == '0') {
-	header('Location: gradebook_view_result.php?nouser=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
+	header('Location: gradebook_view_result.php?nouser=&selecteval='.Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
 	exit;
 }
 $add_user_form = new EvalForm(
@@ -65,16 +65,16 @@ if (isset($_POST['submit_button'])) {
     }
 }
 
-$interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('Gradebook'));
-$interbreadcrumb[]= array(
-	'url' => 'gradebook_view_result.php?selecteval=' .Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
+$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('Gradebook'));
+$interbreadcrumb[] = array(
+	'url' => 'gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
 	'name' => get_lang('ViewResult')
 );
 Display :: display_header(get_lang('AddUserToEval'));
-if (isset ($_GET['erroroneuser'])){
-	Display :: display_warning_message(get_lang('AtLeastOneUser'),false);
+if (isset ($_GET['erroroneuser'])) {
+	Display :: display_warning_message(get_lang('AtLeastOneUser'), false);
 }
-DisplayGradebook :: display_header_result($evaluation[0], null, 0,0);
+DisplayGradebook :: display_header_result($evaluation[0], null, 0, 0);
 echo '<div class="main">';
 echo $add_user_form->toHtml();
 echo '</div>';

+ 5 - 5
main/gradebook/gradebook_display_summary.php

@@ -9,7 +9,7 @@ use ChamiloSession as Session;
  */
 
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_GRADEBOOK;
+$current_course_tool = TOOL_GRADEBOOK;
 
 api_protect_course_script();
 
@@ -21,7 +21,7 @@ if (!api_is_allowed_to_edit()) {
     api_not_allowed(true);
 }
 
-$cat_id = isset($_GET['selectcat']) ? (int)$_GET['selectcat'] : null;
+$cat_id = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : null;
 $action = isset($_GET['action']) && $_GET['action'] ? $_GET['action'] : null;
 
 $userList = CourseManager::get_user_list_from_course_code(
@@ -111,8 +111,8 @@ switch ($action) {
 
 $course_code = api_get_course_id();
 
-$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?',	'name' => get_lang('Gradebook'));
-$interbreadcrumb[] = array('url' => '#','name' => get_lang('GradebookListOfStudentsReports'));
+$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?', 'name' => get_lang('Gradebook'));
+$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradebookListOfStudentsReports'));
 
 $this_section = SECTION_COURSES;
 
@@ -129,7 +129,7 @@ if (count($userList) > 0) {
 }
 echo '</div>';
 
-if (count($userList) == 0 ) {
+if (count($userList) == 0) {
     echo Display::display_warning_message(get_lang('NoResultsAvailable'));
 } else {
     echo '<br /><br /><table class="data_table">';

+ 7 - 7
main/gradebook/gradebook_flatview.php

@@ -8,7 +8,7 @@
 require_once __DIR__.'/../inc/global.inc.php';
 require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/fe/exportgradebook.php';
 
-$current_course_tool  = TOOL_GRADEBOOK;
+$current_course_tool = TOOL_GRADEBOOK;
 
 api_protect_course_script(true);
 
@@ -74,7 +74,7 @@ $simple_search_form = new UserForm(
     null,
     'simple_search_form',
     null,
-    api_get_self() . '?selectcat=' . $category_id
+    api_get_self().'?selectcat='.$category_id
 );
 $values = $simple_search_form->exportValues();
 
@@ -148,15 +148,15 @@ if (isset($_GET['export_pdf']) && $_GET['export_pdf'] == 'category') {
     }
 }
 
-if (isset($_GET['exportpdf']))	{
-    $interbreadcrumb[] = array (
-        'url' => api_get_self().'?selectcat=' . Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq(),
+if (isset($_GET['exportpdf'])) {
+    $interbreadcrumb[] = array(
+        'url' => api_get_self().'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq(),
         'name' => get_lang('FlatView')
     );
 
     $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : null;
     $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : null;
-    $url = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
+    $url = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
         'exportpdf' => '',
         'offset' => $offset,
         'selectcat' => intval($_GET['selectcat']),
@@ -195,7 +195,7 @@ if (isset($_GET['exportpdf']))	{
     }
 }
 
-if (isset($_GET['print']))	{
+if (isset($_GET['print'])) {
     $printable_data = GradebookUtils::get_printable_data(
         $cat[0],
         $users,

+ 16 - 16
main/gradebook/gradebook_statistics.php

@@ -9,21 +9,21 @@ require_once __DIR__.'/../inc/global.inc.php';
 
 api_block_anonymous_users();
 
-$eval= Evaluation :: load($_GET['selecteval']);
+$eval = Evaluation :: load($_GET['selecteval']);
 if ($eval[0]->get_category_id() < 0) {
     // if category id is negative, then the evaluation's origin is a link
-    $link= LinkFactory :: get_evaluation_link($eval[0]->get_id());
+    $link = LinkFactory :: get_evaluation_link($eval[0]->get_id());
     $currentcat = Category :: load($link->get_category_id());
 } else {
     $currentcat = Category :: load($eval[0]->get_category_id());
 }
 
-$interbreadcrumb[]= array (
-    'url' => $_SESSION['gradebook_dest'].'?selectcat=' . $currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook'));
+$interbreadcrumb[] = array(
+    'url' => $_SESSION['gradebook_dest'].'?selectcat='.$currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook'));
 
 if (api_is_allowed_to_edit()) {
-    $interbreadcrumb[]= array (
-        'url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
+    $interbreadcrumb[] = array(
+        'url' => 'gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
         'name' => get_lang('ViewResult')
     );
 }
@@ -45,7 +45,7 @@ if (!$displayscore->is_custom() || empty($displays)) {
         Display :: display_error_message(get_lang('PleaseEnableScoringSystem'), false);
     }
 } else {
-    $allresults = Result::load(null,null,$eval[0]->get_id());
+    $allresults = Result::load(null, null, $eval[0]->get_id());
     $nr_items = array();
     foreach ($displays as $itemsdisplay) {
         $nr_items[$itemsdisplay['display']] = 0;
@@ -78,19 +78,19 @@ if (!$displayscore->is_custom() || empty($displays)) {
     }
 
     // Generate table
-    $stattable= '<table class="data_table" cellspacing="0" cellpadding="3">';
-    $stattable .= '<tr><th>' . get_lang('ScoringSystem') . '</th>';
-    $stattable .= '<th>' . get_lang('Percentage') . '</th>';
-    $stattable .= '<th>' . get_lang('CountUsers') . '</th>';
+    $stattable = '<table class="data_table" cellspacing="0" cellpadding="3">';
+    $stattable .= '<tr><th>'.get_lang('ScoringSystem').'</th>';
+    $stattable .= '<th>'.get_lang('Percentage').'</th>';
+    $stattable .= '<th>'.get_lang('CountUsers').'</th>';
     //$stattable .= '<th>' . get_lang('Statistics') . '</th></tr>';
-    $counter=0;
+    $counter = 0;
     foreach ($keys as $key) {
-        $bar = ($highest_ratio > 0?($nr_items[$key] / $highest_ratio) * 100:0);
-        $stattable .= '<tr class="row_' . ($counter % 2 == 0 ? 'odd' : 'even') . '">';
-        $stattable .= '<td width="150">' . $key . '</td>';
+        $bar = ($highest_ratio > 0 ? ($nr_items[$key] / $highest_ratio) * 100 : 0);
+        $stattable .= '<tr class="row_'.($counter % 2 == 0 ? 'odd' : 'even').'">';
+        $stattable .= '<td width="150">'.$key.'</td>';
 
         $stattable .= '<td width="550">'.Display::bar_progress($bar).'</td>';
-        $stattable .= '<td align="right">' . $nr_items[$key] . '</td>';
+        $stattable .= '<td align="right">'.$nr_items[$key].'</td>';
         $counter++;
     }
     $stattable .= '</tr></table>';

+ 21 - 21
main/gradebook/lib/fe/exportgradebook.php

@@ -12,7 +12,7 @@
  * @param	string	View to print as a title for the table
  * @param	string	Course name to print as title for the table
  */
-function print_table($data_array,$header_names,$view,$coursename)
+function print_table($data_array, $header_names, $view, $coursename)
 {
 	$printdata = '<!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -161,7 +161,7 @@ function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $foote
 
 	$count_pages = ceil(count($data_table) / $items_per_page);
     $content_table = '';
-    for ($x = 0; $x<$count_pages; $x++) {
+    for ($x = 0; $x < $count_pages; $x++) {
         $content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
         // header table
         $content_table .= '<tr>';
@@ -170,7 +170,7 @@ function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $foote
 
             foreach ($headers_table as $head_table) {
                 if (!empty($head_table[0])) {
-                    $width = (!empty($head_table[1])?$head_table[1].'%':'');
+                    $width = (!empty($head_table[1]) ? $head_table[1].'%' : '');
                     $content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
                     $i++;
                 }
@@ -179,16 +179,16 @@ function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $foote
         $content_table .= '</tr>';
         // body table
         if (is_array($data_table) && count($data_table) > 0) {
-            $offset = $x*$items_per_page;
-            $data_table = array_slice ($data_table, $offset, count($data_table));
+            $offset = $x * $items_per_page;
+            $data_table = array_slice($data_table, $offset, count($data_table));
             $i = 1;
-            $item = $offset+1;
+            $item = $offset + 1;
             foreach ($data_table as $data) {
                 $content_table .= '<tr>';
-                $content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
+                $content_table .= '<td>'.($item < 10 ? '0'.$item : $item).'</td>';
                 foreach ($data as  $key => $content) {
                     if (isset($content)) {
-                        $key == 1 ? $align='align="left"':$align='align="center"';
+                        $key == 1 ? $align = 'align="left"' : $align = 'align="center"';
                         $content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
                     }
                 }
@@ -241,10 +241,10 @@ function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footer
                             <h1>'.$title_pdf.'</h1></td></tr>';
         foreach ($headers_pdf as $header_pdf) {
             if (!empty($header_pdf[0]) && !empty($header_pdf[1])) {
-                $header.= '<tr><td><strong>'.$header_pdf[0].'</strong> </td><td>'.$header_pdf[1].'</td></tr>';
+                $header .= '<tr><td><strong>'.$header_pdf[0].'</strong> </td><td>'.$header_pdf[1].'</td></tr>';
             }
         }
-        $header.='</table><br />';
+        $header .= '</table><br />';
     }
 
     // preparing footer pdf
@@ -268,7 +268,7 @@ function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footer
     }
     $items_per_page = 30;
     $count_pages = ceil(count($data_table) / $items_per_page);
-    for ($x = 0; $x<$count_pages; $x++) {
+    for ($x = 0; $x < $count_pages; $x++) {
         $content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
         // header table
         $content_table .= '<tr>';
@@ -276,7 +276,7 @@ function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footer
         if (is_array($headers_table)) {
             foreach ($headers_table as $head_table) {
                 if (!empty($head_table[0])) {
-                    $width = (!empty($head_table[1])?$head_table[1].'%':'');
+                    $width = (!empty($head_table[1]) ? $head_table[1].'%' : '');
                     $content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
                     $i++;
                 }
@@ -286,16 +286,16 @@ function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footer
         // body table
 
         if (is_array($data_table) && count($data_table) > 0) {
-            $offset = $x*$items_per_page;
-            $data_table = array_slice ($data_table, $offset, count($data_table));
+            $offset = $x * $items_per_page;
+            $data_table = array_slice($data_table, $offset, count($data_table));
             $i = 1;
-            $item = $offset+1;
+            $item = $offset + 1;
             foreach ($data_table as $data) {
                 $content_table .= '<tr>';
-                $content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
+                $content_table .= '<td>'.($item < 10 ? '0'.$item : $item).'</td>';
                 foreach ($data as  $key => $content) {
                     if (isset($content)) {
-                        $key == 1 ? $align='align="left"':$align='align="center"';
+                        $key == 1 ? $align = 'align="left"' : $align = 'align="center"';
                         $content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
                     }
                 }
@@ -313,7 +313,7 @@ function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footer
     $pdf = new PDF();
     $pdf->set_custom_footer($footer);
     $pdf->set_custom_header($headers_in_pdf);
-    $pdf->content_to_pdf($header.$content_table, $css, $title_pdf );
+    $pdf->content_to_pdf($header.$content_table, $css, $title_pdf);
     exit;
 
 }
@@ -328,8 +328,8 @@ function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footer
 function export_pdf($pdf, $newarray, $header_names, $format)
 {
 	$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
-	$pdf->ezSetCmMargins(0,0,0,0);
-	$pdf->ezSetY(($format=='portrait')?'820':'570');
+	$pdf->ezSetCmMargins(0, 0, 0, 0);
+	$pdf->ezSetY(($format == 'portrait') ? '820' : '570');
 	$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
     if ($format == 'portrait') {
         $pdf->line(40, 790, 540, 790);
@@ -338,7 +338,7 @@ function export_pdf($pdf, $newarray, $header_names, $format)
         $pdf->line(40, 540, 790, 540);
         $pdf->line(40, 40, 790, 40);
     }
-    $pdf->ezSetY(($format=='portrait')?'750':'520');
+    $pdf->ezSetY(($format == 'portrait') ? '750' : '520');
     $pdf->ezTable($newarray, $header_names, '', array(
         'showHeadings' => 1,
         'shaded' => 1,

+ 8 - 8
main/group/group.php

@@ -22,7 +22,7 @@ $is_allowed_in_course = api_is_allowed_in_course();
 $userId = api_get_user_id();
 
 $this_section = SECTION_COURSES;
-$current_course_tool  = TOOL_GROUP;
+$current_course_tool = TOOL_GROUP;
 
 // Notice for unauthorized people.
 api_protect_course_script(true);
@@ -186,7 +186,7 @@ if (api_is_allowed_to_edit(false, true)) {
         Display::return_icon('add-groups.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'</a>';
 
     if (api_get_setting('allow_group_categories') === 'true') {
-        $actionsLeft .=  '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.
+        $actionsLeft .= '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'.
             Display::return_icon('new_folder.png', get_lang('AddCategory'), '', ICON_SIZE_MEDIUM).'</a>';
     } else {
         $actionsLeft .= '<a href="group_category.php?'.api_get_cidreq().'&id=2">'.
@@ -240,7 +240,7 @@ if (api_get_setting('allow_group_categories') === 'true') {
         $actions = null;
         if (api_is_allowed_to_edit(false, true) && !empty($categoryId)) {
             $actions .= '<a href="group_category.php?'.api_get_cidreq().'&id='.$categoryId.'" title="'.get_lang('Edit').'">'.
-                Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>';
+                Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL).'</a>';
             $actions .=
                 Display::url(
                     Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL),
@@ -250,17 +250,17 @@ if (api_get_setting('allow_group_categories') === 'true') {
                     )
                 );
             if ($index != 0) {
-                $actions .=  ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index -1]['id'].'">'.
-                    Display::return_icon('up.png','&nbsp;','',ICON_SIZE_SMALL).'</a>';
+                $actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index - 1]['id'].'">'.
+                    Display::return_icon('up.png', '&nbsp;', '', ICON_SIZE_SMALL).'</a>';
             }
             if ($index != count($group_cats) - 1) {
-                $actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index +1]['id'].'">'.
-                    Display::return_icon('down.png','&nbsp;','',ICON_SIZE_SMALL).'</a>';
+                $actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index + 1]['id'].'">'.
+                    Display::return_icon('down.png', '&nbsp;', '', ICON_SIZE_SMALL).'</a>';
             }
         }
 
         echo Display::page_header(
-            Security::remove_XSS($category['title'].' '. $label.' ').$actions,
+            Security::remove_XSS($category['title'].' '.$label.' ').$actions,
             null,
             'h4',
             false

+ 4 - 4
main/inc/ajax/record_audio_rtc.ajax.php

@@ -27,16 +27,16 @@ $audioFileName = Security::remove_XSS($file['name']);
 $audioFileName = Database::escape_string($audioFileName);
 $audioFileName = api_replace_dangerous_char($audioFileName);
 $audioFileName = disable_dangerous_file($audioFileName);
-$audioDir  = Security::remove_XSS($audioDir);
+$audioDir = Security::remove_XSS($audioDir);
 
-$dirBaseDocuments = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document';
-$saveDir = $dirBaseDocuments . $audioDir;
+$dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document';
+$saveDir = $dirBaseDocuments.$audioDir;
 
 if (!is_dir($saveDir)) {
     DocumentManager::createDefaultAudioFolder($courseInfo);
 }
 
-$documentPath = $saveDir . '/' . $audioFileName;
+$documentPath = $saveDir.'/'.$audioFileName;
 
 $file['file'] = $file;
 

+ 4 - 4
main/inc/ajax/sequence.ajax.php

@@ -42,7 +42,7 @@ switch ($action) {
                     try {
                         $graphImage = $graphviz->createImageHtml($graph);
                     } catch (UnexpectedValueException $e) {
-                        error_log($e->getMessage() . ' - Graph could not be rendered in resources sequence because GraphViz command "dot" could not be executed - Make sure graphviz is installed.');
+                        error_log($e->getMessage().' - Graph could not be rendered in resources sequence because GraphViz command "dot" could not be executed - Make sure graphviz is installed.');
                         $graphImage = '<p class="text-center"><small>'.get_lang('MissingChartLibraryPleaseCheckLog').'</small></p>';
                     }
                     echo $graphImage;
@@ -88,11 +88,11 @@ switch ($action) {
                         );
                     }
 
-                    $link = '<div class="parent" data-id="' . $id . '">';
+                    $link = '<div class="parent" data-id="'.$id.'">';
                     $link .= '<div class="big-icon">';
                     $link .= $image;
-                    $link .= '<div class="sequence-course">' . $sessionInfo['name'] . '</div>';
-                    $link .= '<a href="#" class="sequence-id">' . $id . '</a>';
+                    $link .= '<div class="sequence-course">'.$sessionInfo['name'].'</div>';
+                    $link .= '<a href="#" class="sequence-id">'.$id.'</a>';
                     $link .= $linkDelete;
                     $link .= $linkUndo;
                     $link .= '</div></div>';

+ 1 - 1
main/inc/global_error_message.inc.php

@@ -98,7 +98,7 @@ if (is_int($global_error_code) && $global_error_code > 0) {
             $global_error_message['description'] = $IncorrectPhpVersionDescription;
             break;
         case 2:
-            require __DIR__ . '/../install/version.php';
+            require __DIR__.'/../install/version.php';
             $global_error_message['section'] = $SectionInstallation;
             $global_error_message['title'] = $InstallationTitle;
             if (($pos = strpos($InstallationDescription, '%s')) === false) {

+ 1 - 1
main/inc/lib/conditional_login.class.php

@@ -22,7 +22,7 @@ class ConditionalLogin
                     if (isset($condition['conditional_function']) && $condition['conditional_function']($user) == false) {
                         $_SESSION['conditional_login']['uid'] = $user['user_id'];
                         $_SESSION['conditional_login']['can_login'] = false;
-                        header("Location:". $condition['url']);
+                        header("Location:".$condition['url']);
                         exit();
                     }
                 }

+ 4 - 5
main/inc/lib/formvalidator/Element/SelectAjax.php

@@ -25,7 +25,7 @@ class SelectAjax extends HTML_QuickForm_select
         $iso = api_get_language_isocode(api_get_interface_language());
         $languageCondition = '';
 
-        if (file_exists(api_get_path(SYS_PATH) . "web/assets/select2/dist/js/i18n/$iso.js")) {
+        if (file_exists(api_get_path(SYS_PATH)."web/assets/select2/dist/js/i18n/$iso.js")) {
             $html .= api_get_asset("select2/dist/js/i18n/$iso.js");
             $languageCondition = "language: '$iso',";
         }
@@ -50,8 +50,7 @@ class SelectAjax extends HTML_QuickForm_select
 
         //Get the minimumInputLength for select2
         $minimumInputLength = $this->getAttribute('minimumInputLength') > 3 ?
-            $this->getAttribute('minimumInputLength') :
-            3
+            $this->getAttribute('minimumInputLength') : 3
         ;
 
         $plHolder = $this->getAttribute('placeholder');
@@ -84,7 +83,7 @@ class SelectAjax extends HTML_QuickForm_select
         $multiple = $multiple ? 'true' : 'false';
 
         $max = $this->getAttribute('maximumSelectionLength');
-        $max = !empty($max) ? "maximumSelectionLength: $max, ": '';
+        $max = !empty($max) ? "maximumSelectionLength: $max, " : '';
 
         $html .= <<<JS
             <script>
@@ -128,7 +127,7 @@ JS;
         $this->removeAttribute('url_function');
         $this->setAttribute('style', 'width: 100%;');
 
-        return parent::toHtml() . $html;
+        return parent::toHtml().$html;
     }
 
     /**

+ 5 - 5
main/inc/lib/internationalization.lib.php

@@ -646,10 +646,10 @@ function api_format_date($time, $format = null, $language = null)
         $date_format = str_replace(
             array('%A', '%a', '%B', '%b'),
             array(
-                $translated['days_long'][(int)strftime('%w', $time)],
-                $translated['days_short'][(int)strftime('%w', $time)],
-                $translated['months_long'][(int)strftime('%m', $time) - 1],
-                $translated['months_short'][(int)strftime('%m', $time) - 1],
+                $translated['days_long'][(int) strftime('%w', $time)],
+                $translated['days_short'][(int) strftime('%w', $time)],
+                $translated['months_long'][(int) strftime('%m', $time) - 1],
+                $translated['months_short'][(int) strftime('%m', $time) - 1],
             ),
             $date_format
         );
@@ -1611,7 +1611,7 @@ function api_natrsort(&$array, $language = null, $encoding = null)
  * @return string					Returns the encoding identificator modified in suitable for comparison way.
  */
 function api_refine_encoding_id($encoding) {
-    if (is_array($encoding)){
+    if (is_array($encoding)) {
         return array_map('api_refine_encoding_id', $encoding);
     }
     return strtoupper(str_replace('_', '-', $encoding));

+ 4 - 4
main/inc/lib/timeline.lib.php

@@ -27,7 +27,7 @@ class Timeline extends Model
 
 	public function __construct()
     {
-        $this->table =  Database::get_course_table(TABLE_TIMELINE);
+        $this->table = Database::get_course_table(TABLE_TIMELINE);
 	}
 
     /**
@@ -46,7 +46,7 @@ class Timeline extends Model
      */
     public function get_all($where_conditions = array())
     {
-        return Database::select('*',$this->table, array('where'=>$where_conditions,'order' =>'headline ASC'));
+        return Database::select('*', $this->table, array('where'=>$where_conditions, 'order' =>'headline ASC'));
     }
 
     /**
@@ -57,7 +57,7 @@ class Timeline extends Model
 		// action links
 		$html = '<div class="actions">';
         //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
-		$html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>';
+		$html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>';
 		$html .= '</div>';
         $html .= Display::grid_html('timelines');
         return $html;
@@ -244,7 +244,7 @@ class Timeline extends Model
         }
         unset($item['end_date']);
         // Assets
-        $item['asset'] = array( 'media'     => $item['media'],
+        $item['asset'] = array('media'     => $item['media'],
                                 'credit'    => $item['media_credit'],
                                 'caption'   => $item['media_caption'],
          );

+ 3 - 3
main/inc/lib/zombie/zombie_manager.class.php

@@ -79,7 +79,7 @@ class ZombieManager
         $count = intval($count);
         $from = intval($from);
 
-        $sql .=  " ORDER BY $column $direction";
+        $sql .= " ORDER BY $column $direction";
         $sql .= " LIMIT $count, $from ";
 
         $result = Database::query($sql);
@@ -93,8 +93,8 @@ class ZombieManager
     static function deactivate_zombies($ceiling)
     {
         $zombies = self::list_zombies($ceiling);
-        $ids  = array();
-        foreach($zombies as $zombie) {
+        $ids = array();
+        foreach ($zombies as $zombie) {
             $ids[] = $zombie['user_id'];
         }
         UserManager::deactivate_users($ids);

+ 2 - 2
main/inc/lib/zombie/zombie_report.class.php

@@ -167,7 +167,7 @@ class ZombieReport implements Countable
         }
 
         $action = $this->get_action();
-        $f = array($this, 'action_' . $action);
+        $f = array($this, 'action_'.$action);
         if (is_callable($f)) {
             return call_user_func($f, $ids);
         }
@@ -292,7 +292,7 @@ class ZombieReport implements Countable
             $text = get_lang('No');
         }
 
-        $result = Display::return_icon($image . '.png', $text);
+        $result = Display::return_icon($image.'.png', $text);
         return $result;
     }
 

+ 7 - 7
main/install/index.php

@@ -105,7 +105,7 @@ $charset = 'UTF-8';
 \Patchwork\Utf8\Bootup::initAll();
 
 // Page encoding initialization.
-header('Content-Type: text/html; charset='. $charset);
+header('Content-Type: text/html; charset='.$charset);
 
 // Setting the error reporting levels.
 error_reporting(E_ALL);
@@ -207,7 +207,7 @@ if ($installType == 'update' && in_array($my_old_version, $update_from_version_8
     // This is the main configuration file of the system before the upgrade.
     // Old configuration file.
     // Don't change to include_once
-    $oldConfigPath = api_get_path(SYS_CODE_PATH) . 'inc/conf/configuration.php';
+    $oldConfigPath = api_get_path(SYS_CODE_PATH).'inc/conf/configuration.php';
     if (file_exists($oldConfigPath)) {
         include $oldConfigPath;
     }
@@ -337,7 +337,7 @@ if ($encryptPassForm == '1') {
             //Blocking step6 button
             $("#button_step6").click(function() {
                 $("#button_step6").hide();
-                $("#button_please_wait").html('<?php echo addslashes(get_lang('PleaseWait'));?>');
+                $("#button_please_wait").html('<?php echo addslashes(get_lang('PleaseWait')); ?>');
                 $("#button_please_wait").show();
                 $("#button_please_wait").attr('disabled', true);
                 $("#is_executable").attr("value",'step6');
@@ -414,7 +414,7 @@ if ($encryptPassForm == '1') {
 
 $instalation_type_label = '';
 if ($installType == 'new') {
-    $instalation_type_label  = get_lang('NewInstallation');
+    $instalation_type_label = get_lang('NewInstallation');
 } elseif ($installType == 'update') {
     $update_from_version = isset($update_from_version) ? $update_from_version : null;
     $instalation_type_label = get_lang('UpdateFromLMSVersion').(is_array($update_from_version) ? implode('|', $update_from_version) : '');
@@ -584,8 +584,8 @@ if (@$_POST['step2']) {
 
     <?php
     if ($installType == 'new') {
-        echo get_lang('AdminLogin') . ' : <strong>' . $loginForm . '</strong><br />';
-        echo get_lang('AdminPass') . ' : <strong>' . $passForm . '</strong><br /><br />'; /* TODO: Maybe this password should be hidden too? */
+        echo get_lang('AdminLogin').' : <strong>'.$loginForm.'</strong><br />';
+        echo get_lang('AdminPass').' : <strong>'.$passForm.'</strong><br /><br />'; /* TODO: Maybe this password should be hidden too? */
     }
     $allowSelfRegistrationLiteral = ($allowSelfReg == 'true') ? get_lang('Yes') : ($allowSelfReg == 'approval' ? get_lang('Approval') : get_lang('No'));
     echo get_lang('AdminFirstName').' : '.$adminFirstName, '<br />', get_lang('AdminLastName').' : '.$adminLastName, '<br />';
@@ -597,7 +597,7 @@ if (@$_POST['step2']) {
     <?php echo get_lang('DBLogin').' : '.$dbUsernameForm; ?><br />
     <?php echo get_lang('DBPassword').' : '.str_repeat('*', api_strlen($dbPassForm)); ?><br />
     <?php echo get_lang('MainDB').' : <strong>'.$dbNameForm; ?></strong><br />
-    <?php echo get_lang('AllowSelfReg').' : '. $allowSelfRegistrationLiteral; ?><br />
+    <?php echo get_lang('AllowSelfReg').' : '.$allowSelfRegistrationLiteral; ?><br />
     <?php echo get_lang('EncryptMethodUserPass').' : ';
     echo $encryptPassForm;
     ?>

+ 16 - 16
main/install/install_files.inc.php

@@ -17,7 +17,7 @@
 if (defined('SYSTEM_INSTALLATION')) {
 
     // Write the system config file
-    write_system_config_file(api_get_path(CONFIGURATION_PATH) . 'configuration.php');
+    write_system_config_file(api_get_path(CONFIGURATION_PATH).'configuration.php');
 
     // Write a distribution file with the config as a backup for the admin
     //write_system_config_file(api_get_path(CONFIGURATION_PATH) . 'configuration.dist.php');
@@ -27,33 +27,33 @@ if (defined('SYSTEM_INSTALLATION')) {
 
     // Copy distribution files with renaming for being the actual system configuration files.
     copy(
-        api_get_path(CONFIGURATION_PATH) . 'add_course.conf.dist.php',
-        api_get_path(CONFIGURATION_PATH) . 'add_course.conf.php'
+        api_get_path(CONFIGURATION_PATH).'add_course.conf.dist.php',
+        api_get_path(CONFIGURATION_PATH).'add_course.conf.php'
     );
     copy(
-        api_get_path(CONFIGURATION_PATH) . 'course_info.conf.dist.php',
-        api_get_path(CONFIGURATION_PATH) . 'course_info.conf.php'
+        api_get_path(CONFIGURATION_PATH).'course_info.conf.dist.php',
+        api_get_path(CONFIGURATION_PATH).'course_info.conf.php'
     );
     copy(
-        api_get_path(CONFIGURATION_PATH) . 'mail.conf.dist.php',
-        api_get_path(CONFIGURATION_PATH) . 'mail.conf.php'
+        api_get_path(CONFIGURATION_PATH).'mail.conf.dist.php',
+        api_get_path(CONFIGURATION_PATH).'mail.conf.php'
     );
     copy(
-        api_get_path(CONFIGURATION_PATH) . 'profile.conf.dist.php',
-        api_get_path(CONFIGURATION_PATH) . 'profile.conf.php'
+        api_get_path(CONFIGURATION_PATH).'profile.conf.dist.php',
+        api_get_path(CONFIGURATION_PATH).'profile.conf.php'
     );
     copy(
-        api_get_path(CONFIGURATION_PATH) . 'events.conf.dist.php',
-        api_get_path(CONFIGURATION_PATH) . 'events.conf.php'
+        api_get_path(CONFIGURATION_PATH).'events.conf.dist.php',
+        api_get_path(CONFIGURATION_PATH).'events.conf.php'
     );
     copy(
-        api_get_path(CONFIGURATION_PATH) . 'auth.conf.dist.php',
-        api_get_path(CONFIGURATION_PATH) . 'auth.conf.php'
+        api_get_path(CONFIGURATION_PATH).'auth.conf.dist.php',
+        api_get_path(CONFIGURATION_PATH).'auth.conf.php'
     );
     copy(
-        api_get_path(CONFIGURATION_PATH) . 'portfolio.conf.dist.php',
-        api_get_path(CONFIGURATION_PATH) . 'portfolio.conf.php'
+        api_get_path(CONFIGURATION_PATH).'portfolio.conf.dist.php',
+        api_get_path(CONFIGURATION_PATH).'portfolio.conf.php'
     );
 } else {
-    echo 'You are not allowed here !' . __FILE__;
+    echo 'You are not allowed here !'.__FILE__;
 }

+ 8 - 8
main/lp/lp_add.php

@@ -59,7 +59,7 @@ if (isset($_SESSION['gradebook'])) {
 }
 
 if (!empty($gradebook) && $gradebook == 'view') {
-    $interbreadcrumb[]= array (
+    $interbreadcrumb[] = array(
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
         'name' => get_lang('ToolGradebook')
     );
@@ -83,7 +83,7 @@ if ($_POST && empty($_REQUEST['lp_name'])) {
 $form = new FormValidator(
     'lp_add',
     'post',
-    api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq()
+    api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq()
 );
 
 // Form title
@@ -112,17 +112,17 @@ $form->addElement(
 
 // Start date
 $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
-$form->addElement('html','<div id="start_date_div" style="display:block;">');
+$form->addElement('html', '<div id="start_date_div" style="display:block;">');
 $form->addDatePicker('publicated_on', get_lang('PublicationDate'));
-$form->addElement('html','</div>');
+$form->addElement('html', '</div>');
 
 //End date
 $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
-$form->addElement('html','<div id="end_date_div" style="display:none;">');
+$form->addElement('html', '<div id="end_date_div" style="display:none;">');
 $form->addDatePicker('expired_on', get_lang('ExpirationDate'));
-$form->addElement('html','</div>');
+$form->addElement('html', '</div>');
 
-$form->addElement('html','</div>');
+$form->addElement('html', '</div>');
 
 $defaults['activate_start_date_check']  = 1;
 
@@ -133,7 +133,7 @@ if (api_get_setting('scorm_cumulative_session_time') == 'true') {
 }
 
 $defaults['publicated_on'] = date('Y-m-d 08:00:00');
-$defaults['expired_on'] = date('Y-m-d 08:00:00',time()+86400);
+$defaults['expired_on'] = date('Y-m-d 08:00:00', time() + 86400);
 
 $form->setDefaults($defaults);
 $form->addButtonCreate(get_lang('CreateLearningPath'));

+ 1 - 1
main/lp/lp_content.php

@@ -104,7 +104,7 @@ if (!empty($gradebook) && $gradebook == 'view') {
 // Define the 'doc.inc.php' as language file.
 $nameTools = $_SESSION['oLP']->get_name();
 $interbreadcrumb[] = array(
-    'url' => api_get_path(WEB_CODE_PATH) . 'lp/lp_list.php?'.api_get_cidreq(),
+    'url' => api_get_path(WEB_CODE_PATH).'lp/lp_list.php?'.api_get_cidreq(),
     'name' => get_lang('Doc'),
 );
 // Update global setting to avoid displaying right menu.

+ 6 - 6
main/lp/lp_edit.php

@@ -20,7 +20,7 @@ if (isset($_SESSION['gradebook'])) {
 }
 
 if (!empty($gradebook) && $gradebook == 'view') {
-    $interbreadcrumb[] = array (
+    $interbreadcrumb[] = array(
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
         'name' => get_lang('ToolGradebook')
     );
@@ -76,7 +76,7 @@ $hide_toc_frame = $form->addElement(
 );
 if (api_get_setting('allow_course_theme') === 'true') {
     $mycourselptheme = api_get_course_setting('allow_learning_path_theme');
-    if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1) {
+    if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
         //LP theme picker
         $theme_select = $form->addElement('SelectTheme', 'lp_theme', get_lang('Theme'));
         $form->applyFilter('lp_theme', 'trim');
@@ -105,7 +105,7 @@ if (strlen($_SESSION['oLP']->get_preview_image()) > 0) {
 $label = ($_SESSION['oLP']->get_preview_image() != '' ? get_lang('UpdateImage') : get_lang('AddImage'));
 $form->addElement('file', 'lp_preview_image', array($label, get_lang('ImageWillResizeMsg')));
 
-$form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
+$form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif'));
 
 // Search terms (only if search is activated).
 if (api_get_setting('search_enabled') === 'true') {
@@ -134,7 +134,7 @@ $defaults['lp_name'] = Security::remove_XSS($_SESSION['oLP']->get_name());
 $defaults['lp_author'] = Security::remove_XSS($_SESSION['oLP']->get_author());
 $defaults['hide_toc_frame'] = Security::remove_XSS($_SESSION['oLP']->get_hide_toc_frame());
 $defaults['category_id'] = intval($_SESSION['oLP']->getCategoryId());
-$defaults['accumulate_scorm_time']  = $_SESSION['oLP']->getAccumulateScormTime();
+$defaults['accumulate_scorm_time'] = $_SESSION['oLP']->getAccumulateScormTime();
 
 $expired_on = $_SESSION['oLP']->expired_on;
 $publicated_on = $_SESSION['oLP']->publicated_on;
@@ -214,14 +214,14 @@ $form->addElement('hidden', 'lp_id', $_SESSION['oLP']->get_id());
 if ($enableLpExtraFields) {
     $htmlHeadXtra[] = '<script>
     $(function() {
-        ' . $extra['jquery_ready_content'] . '
+        ' . $extra['jquery_ready_content'].'
     });
     </script>';
 }
 
 
 $defaults['publicated_on'] = !empty($publicated_on) && $publicated_on !== '0000-00-00 00:00:00' ? api_get_local_time($publicated_on) : null;
-$defaults['expired_on'] = (!empty($expired_on) )? api_get_local_time($expired_on): date('Y-m-d 12:00:00', time()+84600);
+$defaults['expired_on'] = (!empty($expired_on)) ? api_get_local_time($expired_on) : date('Y-m-d 12:00:00', time() + 84600);
 $defaults['subscribe_users'] = $_SESSION['oLP']->getSubscribeUsers();
 $form->setDefaults($defaults);
 

+ 5 - 5
main/lp/lp_impress.php

@@ -35,7 +35,7 @@ $visibility = api_get_item_visibility(
     null,
     api_get_group_id()
 );
-if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
+if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0) {
      api_not_allowed();
 }
 
@@ -73,22 +73,22 @@ if ($is_allowed_to_edit) {
 $html = '';
 $step = 1;
 foreach ($list as $toc) {
-    $x = 1000*$step;
+    $x = 1000 * $step;
     $html .= '<div id="step-'.$step.'" class="step slide" data-x="'.$x.'" data-y="-1500"  >';
     $html .= '<div class="impress-content">';
     $src = $_SESSION['oLP']->get_link('http', $toc['id']);
     if ($toc['type'] !== 'dir') {
         //just showing the src in a iframe ...
         $html .= '<h2>'.$toc['title'].'</h2>';
-        $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>';
-    }else{
+        $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="'.$src.'"></iframe>';
+    } else {
         $html .= "<div class='impress-title'>";
         $html .= '<h1>'.$toc['title'].'</h1>';
         $html .= "</div>";
     }
     $html .= "</div>";
     $html .= "</div>";
-    $step ++;
+    $step++;
 }
 
 //Setting the template

+ 2 - 2
main/lp/lp_report.php

@@ -109,7 +109,7 @@ if (!empty($users)) {
 
 // View
 $interbreadcrumb[] = [
-    'url' => api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq(),
+    'url' => api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq(),
     'name' => get_lang('LearningPaths')
 ];
 
@@ -120,7 +120,7 @@ $actions = Display::url(
         array(),
         ICON_SIZE_MEDIUM
     ),
-    api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq()
+    api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq()
 );
 
 $template = new Template(get_lang('StudentScore'));

+ 3 - 3
main/messages/download.php

@@ -48,8 +48,8 @@ $current_uid = api_get_user_id();
 
 // get message user id for inbox/outbox
 $message_uid = '';
-$message_type = array('inbox','outbox');
-if (in_array($_GET['type'],$message_type)) {
+$message_type = array('inbox', 'outbox');
+if (in_array($_GET['type'], $message_type)) {
 	if ($_GET['type'] == 'inbox') {
 		$message_uid = $row_users['user_receiver_id'];
 	} else {
@@ -63,7 +63,7 @@ $userGroup = new UserGroup();
 
 if (!empty($row_users['group_id'])) {
 	$users_group = $userGroup->get_all_users_by_group($row_users['group_id']);
-	if (!in_array($current_uid,array_keys($users_group))) {
+	if (!in_array($current_uid, array_keys($users_group))) {
 		$not_allowed_to_edit = true;
 	}
 } else {

+ 9 - 9
main/messages/view_message.php

@@ -6,22 +6,22 @@
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 api_block_anonymous_users();
-if (api_get_setting('allow_message_tool')!='true') {
+if (api_get_setting('allow_message_tool') != 'true') {
 	api_not_allowed();
 }
 
 if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'social') {
 	$this_section = SECTION_SOCIAL;
-	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
-	$interbreadcrumb[]= array ('url' => 'inbox.php?f=social','name' => get_lang('Inbox'));
+	$interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'main/social/home.php', 'name' => get_lang('Social'));
+	$interbreadcrumb[] = array('url' => 'inbox.php?f=social', 'name' => get_lang('Inbox'));
 } else {
 	$this_section = SECTION_MYPROFILE;
-	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
+	$interbreadcrumb[] = array('url' => api_get_path(WEB_PATH).'main/auth/profile.php', 'name' => get_lang('Profile'));
 }
 
 $social_right_content = '';
 
-if (isset($_GET['f']) && $_GET['f']=='social') {
+if (isset($_GET['f']) && $_GET['f'] == 'social') {
 	$social_parameter = '?f=social';
 } else {
 	if (api_get_setting('extended_profile') == 'true') {
@@ -33,11 +33,11 @@ if (isset($_GET['f']) && $_GET['f']=='social') {
 		}
 		if (api_get_setting('allow_message_tool') === 'true') {
 		    $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
-                Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
+                Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>';
             $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
-                Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
+                Display::return_icon('inbox.png', get_lang('Inbox')).'</a>';
             $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
-                Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
+                Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
 		}
 		$social_right_content .= '</div>';
 	}
@@ -53,7 +53,7 @@ if (empty($_GET['id'])) {
     $show_menu = 'messages_inbox';
 }
 
-$message  = '';
+$message = '';
 
 // LEFT COLUMN
 if (api_get_setting('allow_social_tool') === 'true') {

+ 15 - 15
main/mySpace/company_reports.php

@@ -16,7 +16,7 @@ if ($userNotAllowed) {
     api_not_allowed(true);
 }
 
-$interbreadcrumb[] = array ('url' => api_is_student_boss()?'#':'index.php', 'name' => get_lang('MySpace'));
+$interbreadcrumb[] = array('url' => api_is_student_boss() ? '#' : 'index.php', 'name' => get_lang('MySpace'));
 $tool_name = get_lang('Report');
 
 $this_section = SECTION_TRACKING;
@@ -42,13 +42,13 @@ $columns = array(
 
 //Column config
 $column_model = array(
-    array('name'=>'course',         'index'=>'title',       'width'=>'180', 'align'=>'left', 'wrap_cell' => 'true'),
-    array('name'=>'user',           'index'=>'user',        'width'=>'100', 'align'=>'left','sortable'=>'false', 'wrap_cell' => 'true'),
-    array('name'=>'email',          'index'=>'email',       'width'=>'100', 'align'=>'left','sortable'=>'false', 'wrap_cell' => 'true'),
-    array('name'=>'time',           'index'=>'time',        'width'=>'50',  'align'=>'left','sortable'=>'false'),
-    array('name'=>'certificate',    'index'=>'certificate', 'width'=>'50',  'align'=>'left','sortable'=>'false'),
-    array('name'=>'progress_100',   'index'=>'progress_100',       'width'=>'50',  'align'=>'left','sortable'=>'false'),
-    array('name'=>'progress',       'index'=>'progress',    'width'=>'50',  'align'=>'left','sortable'=>'false')
+    array('name'=>'course', 'index'=>'title', 'width'=>'180', 'align'=>'left', 'wrap_cell' => 'true'),
+    array('name'=>'user', 'index'=>'user', 'width'=>'100', 'align'=>'left', 'sortable'=>'false', 'wrap_cell' => 'true'),
+    array('name'=>'email', 'index'=>'email', 'width'=>'100', 'align'=>'left', 'sortable'=>'false', 'wrap_cell' => 'true'),
+    array('name'=>'time', 'index'=>'time', 'width'=>'50', 'align'=>'left', 'sortable'=>'false'),
+    array('name'=>'certificate', 'index'=>'certificate', 'width'=>'50', 'align'=>'left', 'sortable'=>'false'),
+    array('name'=>'progress_100', 'index'=>'progress_100', 'width'=>'50', 'align'=>'left', 'sortable'=>'false'),
+    array('name'=>'progress', 'index'=>'progress', 'width'=>'50', 'align'=>'left', 'sortable'=>'false')
 );
 
 if (!empty($extra_fields)) {
@@ -67,7 +67,7 @@ if (!empty($extra_fields)) {
 }
 
 if (api_is_student_boss()) {
-    $column_model[] = array('name'=>'group', 'index'=>'group', 'width'=>'50', 'align'=>'left','sortable'=>'false');
+    $column_model[] = array('name'=>'group', 'index'=>'group', 'width'=>'50', 'align'=>'left', 'sortable'=>'false');
     $columns[] = get_lang('Group');
 }
 
@@ -78,7 +78,7 @@ $extra_params['height'] = 'auto';
 
 $htmlHeadXtra[] = '<script>
 $(function() {
-    '.Display::grid_js('user_course_report',  $url, $columns, $column_model, $extra_params, array(), null, true).'
+    '.Display::grid_js('user_course_report', $url, $columns, $column_model, $extra_params, array(), null, true).'
     jQuery("#user_course_report").jqGrid("navGrid","#user_course_report_pager",{
         view:false,
         edit:false,
@@ -102,11 +102,11 @@ $actions = null;
 if (api_is_student_boss()) {
     $actions .= Display::url(
         Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"
+        api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
     );
     $actions .= Display::url(
         Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . "mySpace/student.php"
+        api_get_path(WEB_CODE_PATH)."mySpace/student.php"
     );
     $actions .= Display::url(
         Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
@@ -119,7 +119,7 @@ if (api_is_student_boss()) {
             [],
             ICON_SIZE_MEDIUM
         ),
-        api_get_path(WEB_CODE_PATH) . "gradebook/certificate_report.php"
+        api_get_path(WEB_CODE_PATH)."gradebook/certificate_report.php"
     );
 }
 
@@ -130,13 +130,13 @@ if (!empty($actions)) {
 }
 $content .= Display::url(
     get_lang("CompanyReportResumed"),
-    api_get_path(WEB_CODE_PATH) . "mySpace/company_reports_resumed.php",
+    api_get_path(WEB_CODE_PATH)."mySpace/company_reports_resumed.php",
     array(
         'class' => 'btn btn-success'
     )
 );
 $content .= '</div>';
-$content .= '<h1 class="page-header">' . get_lang('CompanyReport') . '</h1>';
+$content .= '<h1 class="page-header">'.get_lang('CompanyReport').'</h1>';
 $content .= Display::grid_html('user_course_report');
 
 $tpl = new Template($tool_name);

+ 7 - 7
main/mySpace/company_reports_resumed.php

@@ -15,7 +15,7 @@ if ($userNotAllowed) {
     api_not_allowed(true);
 }
 
-$interbreadcrumb[] = array('url' => api_is_student_boss()?'#':'index.php', 'name' => get_lang('MySpace'));
+$interbreadcrumb[] = array('url' => api_is_student_boss() ? '#' : 'index.php', 'name' => get_lang('MySpace'));
 
 $tool_name = get_lang('Report');
 $this_section = SECTION_TRACKING;
@@ -89,15 +89,15 @@ $actions = null;
 if (api_is_student_boss()) {
     $actions .= Display::url(
         Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"
+        api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
     );
     $actions .= Display::url(
         Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . "mySpace/student.php"
+        api_get_path(WEB_CODE_PATH)."mySpace/student.php"
     );
     $actions .= Display::url(
         Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php"
+        api_get_path(WEB_CODE_PATH)."mySpace/company_reports.php"
     );
     $actions .= Display::url(
         Display::return_icon(
@@ -106,7 +106,7 @@ if (api_is_student_boss()) {
             [],
             ICON_SIZE_MEDIUM
         ),
-        api_get_path(WEB_CODE_PATH) . "gradebook/certificate_report.php"
+        api_get_path(WEB_CODE_PATH)."gradebook/certificate_report.php"
     );
 }
 
@@ -119,7 +119,7 @@ if (!empty($actions)) {
 if (!api_is_student_boss()) {
     $content .= Display::url(
         get_lang("CompanyReport"),
-        api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php",
+        api_get_path(WEB_CODE_PATH)."mySpace/company_reports.php",
         array(
             'class' => 'btn btn-success'
         )
@@ -127,7 +127,7 @@ if (!api_is_student_boss()) {
 }
 
 $content .= '</div>';
-$content .= '<h1 class="page-header">' . get_lang('CompanyReportResumed') . '</h1>';
+$content .= '<h1 class="page-header">'.get_lang('CompanyReportResumed').'</h1>';
 $content .= Display::grid_html('user_course_report');
 
 $tpl = new Template($tool_name);

+ 10 - 10
main/mySpace/session.php

@@ -16,7 +16,7 @@ $this_section = SECTION_TRACKING;
 
 api_block_anonymous_users();
 $htmlHeadXtra[] = api_get_jqgrid_js();
-$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
+$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
 Display::display_header(get_lang('Sessions'));
 
 $export_csv = false;
@@ -39,7 +39,7 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
     if (!api_is_session_admin()) {
         $menu_items[] = Display::url(
             Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
-            api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"
+            api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
         );
         $menu_items[] = Display::url(
             Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
@@ -61,11 +61,11 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
 
     $menu_items[] = Display::url(
         Display::return_icon('works.png', get_lang('WorksReport'), [], ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . 'mySpace/works_in_session_report.php'
+        api_get_path(WEB_CODE_PATH).'mySpace/works_in_session_report.php'
     );
     $menu_items[] = Display::url(
         Display::return_icon('clock.png', get_lang('TeacherTimeReportBySession'), [], ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . 'admin/teachers_time_by_session_report.php'
+        api_get_path(WEB_CODE_PATH).'admin/teachers_time_by_session_report.php'
     );
 
     $actionsLeft = '';
@@ -84,7 +84,7 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
         );
         $actionsRight .= Display::url(
             Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32),
-            api_get_self() . '?export=csv'
+            api_get_self().'?export=csv'
         );
     }
 
@@ -99,7 +99,7 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
 } elseif (api_is_teacher()) {
     $actionsRight = Display::url(
         Display::return_icon('clock.png', get_lang('TeacherTimeReportBySession'), [], ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . 'admin/teachers_time_by_session_report.php'
+        api_get_path(WEB_CODE_PATH).'admin/teachers_time_by_session_report.php'
     );
 
     $toolbar = Display::toolbarAction(
@@ -139,10 +139,10 @@ $columns = array(
 // Column config
 $columnModel = array(
     array('name'=>'name', 'index'=>'name', 'width'=>'255', 'align'=>'left'),
-    array('name'=>'date', 'index'=>'date', 'width'=>'150', 'align'=>'left','sortable'=>'false'),
-    array('name'=>'course_per_session', 'index'=>'course_per_session', 'width'=>'150','sortable'=>'false'),
-    array('name'=>'student_per_session', 'index'=>'student_per_session', 'width'=>'100','sortable'=>'false'),
-    array('name'=>'details', 'index'=>'details', 'width'=>'100','sortable'=>'false')
+    array('name'=>'date', 'index'=>'date', 'width'=>'150', 'align'=>'left', 'sortable'=>'false'),
+    array('name'=>'course_per_session', 'index'=>'course_per_session', 'width'=>'150', 'sortable'=>'false'),
+    array('name'=>'student_per_session', 'index'=>'student_per_session', 'width'=>'100', 'sortable'=>'false'),
+    array('name'=>'details', 'index'=>'details', 'width'=>'100', 'sortable'=>'false')
 );
 
 $extraParams = array(

+ 143 - 143
main/permissions/permissions_functions.inc.php

@@ -26,34 +26,34 @@ function store_permissions($content, $id) {
     $course_id = api_get_course_int_id();
     
 	// Which database are we using (depending on the $content parameter)
-	if ($content=='user')
+	if ($content == 'user')
 	{
-		$table=Database::get_course_table(TABLE_PERMISSION_USER);
+		$table = Database::get_course_table(TABLE_PERMISSION_USER);
 		$id_field = user_id;
 	}
-	if ($content=='group')
+	if ($content == 'group')
 	{
-		$table=Database::get_course_table(TABLE_PERMISSION_GROUP);
+		$table = Database::get_course_table(TABLE_PERMISSION_GROUP);
 		$id_field = group_id;
 	}
-	if ($content=='role')
+	if ($content == 'role')
 	{
-		$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
+		$table = Database::get_course_table(TABLE_ROLE_PERMISSION);
 		$id_field = role_id;
 	}
 
 	// We first delete all the existing permissions for that user/group/role
-	$sql="DELETE FROM $table  WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'";
-	$result=Database::query($sql);
+	$sql = "DELETE FROM $table  WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'";
+	$result = Database::query($sql);
 
 	// looping through the post values to find the permission (containing the string permission* )
 	foreach ($_POST as $key => $value)
 	{
-		if (strstr($key,"permission*"))
+		if (strstr($key, "permission*"))
 		{
-			list($brol,$tool,$action)=explode("*",$key);
-			$sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')";
-			$result=Database::query($sql);
+			list($brol, $tool, $action) = explode("*", $key);
+			$sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')";
+			$result = Database::query($sql);
 		}
 	}
 	return get_lang('PermissionsStored');
@@ -69,7 +69,7 @@ function store_permissions($content, $id) {
 * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
 * @version 1.0
 */
-function store_one_permission($content, $action, $id, $tool,$permission) {
+function store_one_permission($content, $action, $id, $tool, $permission) {
 	global $rights_full;
     $course_id = api_get_course_int_id();
 	// for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out.
@@ -82,35 +82,35 @@ function store_one_permission($content, $action, $id, $tool,$permission) {
 
 	// Which database are we using (depending on the $content parameter)
     
-	if ($content=='user') {
-		$table=Database::get_course_table(TABLE_PERMISSION_USER);
+	if ($content == 'user') {
+		$table = Database::get_course_table(TABLE_PERMISSION_USER);
 		$id_field = user_id;
 	}
-	if ($content=='group')
+	if ($content == 'group')
 	{
-		$table=Database::get_course_table(TABLE_PERMISSION_GROUP);
+		$table = Database::get_course_table(TABLE_PERMISSION_GROUP);
 		$id_field = group_id;
 	}
-	if ($content=='role')
+	if ($content == 'role')
 	{
-		$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
+		$table = Database::get_course_table(TABLE_ROLE_PERMISSION);
 		$id_field = role_id;
 	}
 
 	// grating a right
-	if ($action=='grant') {
-		$sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')";
-		$result=Database::query($sql);
-		if($result) {
-			$result_message=get_lang('PermissionGranted');
+	if ($action == 'grant') {
+		$sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')";
+		$result = Database::query($sql);
+		if ($result) {
+			$result_message = get_lang('PermissionGranted');
 		}
 	}
-	if ($action=='revoke')
+	if ($action == 'revoke')
 	{
-		$sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'";
-		$result=Database::query($sql);
-		if($result) {
-			$result_message=get_lang('PermissionRevoked');
+		$sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'";
+		$result = Database::query($sql);
+		if ($result) {
+			$result_message = get_lang('PermissionRevoked');
 		}
 	}
 	return $result_message;
@@ -125,44 +125,44 @@ function store_one_permission($content, $action, $id, $tool,$permission) {
 */
 function get_permissions($content, $id) {
     $course_id = api_get_course_int_id();
-	$currentpermissions=array();
+	$currentpermissions = array();
 	// Which database are we using (depending on the $content parameter)
     $course_id_condition = " c_id = $course_id AND ";
 	if ($content == 'user')
 	{
-		$table=Database::get_course_table(TABLE_PERMISSION_USER);
+		$table = Database::get_course_table(TABLE_PERMISSION_USER);
 		$id_field = 'user_id';
 	}
 	elseif ($content == 'group')
 	{
-		$table=Database::get_course_table(TABLE_PERMISSION_GROUP);
+		$table = Database::get_course_table(TABLE_PERMISSION_GROUP);
 		$id_field = 'group_id';
 	}
 	elseif ($content == 'role')
 	{
-		$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
+		$table = Database::get_course_table(TABLE_ROLE_PERMISSION);
 		$id_field = 'role_id';
 	}
 	elseif ($content == 'platform_role')
 	{
-		$table=Database::get_main_table(TABLE_ROLE_PERMISSION);
+		$table = Database::get_main_table(TABLE_ROLE_PERMISSION);
 		$id_field = 'role_id';
         $course_id_condition = '';
 	}
 	elseif ($content == 'task')
 	{
-		$table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
+		$table = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
 		$id_field = 'task_id';
 	}
 
 	// finding all the permissions. We store this in a multidimensional array
 	// where the first dimension is the tool.
-	$sql="
-		SELECT * FROM " . $table . "
-		WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'";
+	$sql = "
+		SELECT * FROM " . $table."
+		WHERE $course_id_condition ".$id_field."='".Database::escape_string($id)."'";
 	$result = Database::query($sql);
 
-	while($row = Database::fetch_array($result))
+	while ($row = Database::fetch_array($result))
 		$currentpermissions[$row['tool']][] = $row['action'];
 
 	return $currentpermissions;
@@ -179,7 +179,7 @@ function get_permissions($content, $id) {
 */
 function limited_or_full($current_permissions)
 {
-	if (api_get_setting('permissions')=='limited')
+	if (api_get_setting('permissions') == 'limited')
 	{
 		foreach ($current_permissions as $tool=>$tool_rights)
 		{
@@ -187,15 +187,15 @@ function limited_or_full($current_permissions)
 			// if it is visibility or move we have to grant the edit right
 			foreach ($tool_rights as $key=>$value)
 			{
-				if ($value=='View')
+				if ($value == 'View')
 				{
 					unset($current_permissions[$tool][$key]);
 				}
-				if ($value=='Visibility' OR $value=='Move')
+				if ($value == 'Visibility' OR $value == 'Move')
 				{
-					if (!in_array('Edit',$current_permissions[$tool]))
+					if (!in_array('Edit', $current_permissions[$tool]))
 					{
-						$current_permissions[$tool][]='Edit';
+						$current_permissions[$tool][] = 'Edit';
 					}
 					unset($current_permissions[$tool][$key]);
 				}
@@ -207,7 +207,7 @@ function limited_or_full($current_permissions)
 		}
 		return $current_permissions;
 	}
-	if (api_get_setting('permissions')=='full')
+	if (api_get_setting('permissions') == 'full')
 	{
 		return $current_permissions;
 	}
@@ -222,12 +222,12 @@ function limited_or_full($current_permissions)
 * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
 * @version 1.0
 */
-function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array())
+function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions = array())
 {
-	$checked="";
-	if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool]))
+	$checked = "";
+	if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool]))
 	{
-		$checked="checked";
+		$checked = "checked";
 	}
 	echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n";
 
@@ -243,28 +243,28 @@ function display_checkbox_matrix($permission_array, $tool, $permission, $inherit
 * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
 * @version 1.0
 */
-function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true)
+function display_image_matrix($permission_array, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true)
 {
 	if ($course_admin) {
 		echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
 	} else {
-		if (in_array($permission,$inherited_permissions[$tool])) {
+		if (in_array($permission, $inherited_permissions[$tool])) {
 			echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
 		} else {
-			if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) {
+			if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) {
 				if ($editable) {
-					$url=api_get_self();
+					$url = api_get_self();
 					$urlparameters = '';
-					foreach($_GET as $key=>$value) {
-						$parameter[$key]=$value;
+					foreach ($_GET as $key=>$value) {
+						$parameter[$key] = $value;
 					}
-					$parameter['action']='revoke';
-					$parameter['permission']=$permission;
-					$parameter['tool']=$tool;
+					$parameter['action'] = 'revoke';
+					$parameter['permission'] = $permission;
+					$parameter['tool'] = $tool;
 					foreach ($parameter as $key=>$value) {
-						$urlparameters.=$key.'='.$value.'&amp;';
+						$urlparameters .= $key.'='.$value.'&amp;';
 					}
-					$url=$url.'?'.$urlparameters;
+					$url = $url.'?'.$urlparameters;
 
 					echo "\t\t\t <a href=\"".$url."\">";
 				}
@@ -275,20 +275,20 @@ function display_image_matrix($permission_array, $tool, $permission,$inherited_p
 			} else {
 				if ($editable)
 				{
-					$url=api_get_self();
+					$url = api_get_self();
 					$urlparameters = '';
 					foreach ($_GET as $key=>$value)
 					{
-						$parameter[$key]=$value;
+						$parameter[$key] = $value;
 					}
-					$parameter['action']='grant';
-					$parameter['permission']=$permission;
-					$parameter['tool']=$tool;
+					$parameter['action'] = 'grant';
+					$parameter['permission'] = $permission;
+					$parameter['tool'] = $tool;
 					foreach ($parameter as $key=>$value)
 					{
-						$urlparameters.=$key.'='.$value.'&amp;';
+						$urlparameters .= $key.'='.$value.'&amp;';
 					}
-					$url=$url.'?'.$urlparameters;
+					$url = $url.'?'.$urlparameters;
 
 					//echo "\t\t\t <a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=grant&amp;permission=$permission&amp;tool=$tool\">";
 					echo "\t\t\t <a href=\"".$url."\">";
@@ -315,7 +315,7 @@ function display_image_matrix($permission_array, $tool, $permission,$inherited_p
 * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
 * @version 1.0
 */
-function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true)
+function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true)
 {
 
 	if ($course_admin)
@@ -324,32 +324,32 @@ function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $per
 	}
 	else
 	{
-		if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool]))
+		if (!empty($inherited_permissions) and in_array($permission, $inherited_permissions[$tool]))
 		{
 			echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">";
 		}
 		else
 		{
-			if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool]))
+			if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool]))
 			{
 				if ($editable)
 				{
 					$url = api_get_self();
 					$urlparameters = '';
-					foreach($_GET as $key => $value)
+					foreach ($_GET as $key => $value)
 					{
 						$parameter[$key] = $value;
 					}
-					$parameter['action']='manage_rights';
-					$parameter['do']='revoke';
-					$parameter['permission']=$permission;
-					$parameter['tool']=$tool;
-					$parameter['user_id']=$user_id;
+					$parameter['action'] = 'manage_rights';
+					$parameter['do'] = 'revoke';
+					$parameter['permission'] = $permission;
+					$parameter['tool'] = $tool;
+					$parameter['user_id'] = $user_id;
 					foreach ($parameter as $key=>$value)
 					{
-						$urlparameters .= $key . '=' . $value . '&amp;';
+						$urlparameters .= $key.'='.$value.'&amp;';
 					}
-					$url = $url . '?' . $urlparameters;
+					$url = $url.'?'.$urlparameters;
 
 					echo "\t\t\t <a href=\"".$url."\">";
 				}
@@ -362,17 +362,17 @@ function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $per
 					$url = api_get_self();
 					$urlparameters = '';
 					foreach ($_GET as $key=>$value) {
-						$parameter[$key]=$value;
+						$parameter[$key] = $value;
 					}
-					$parameter['action']='manage_rights';
-					$parameter['do']='grant';
-					$parameter['permission']=$permission;
-					$parameter['tool']=$tool;
-					$parameter['user_id']=$user_id;
+					$parameter['action'] = 'manage_rights';
+					$parameter['do'] = 'grant';
+					$parameter['permission'] = $permission;
+					$parameter['tool'] = $tool;
+					$parameter['user_id'] = $user_id;
 					foreach ($parameter as $key=>$value) {
-						$urlparameters .= $key . '=' . $value . '&amp;';
+						$urlparameters .= $key.'='.$value.'&amp;';
 					}
-					$url=$url.'?'.$urlparameters;
+					$url = $url.'?'.$urlparameters;
 
 					//echo "\t\t\t <a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=grant&amp;permission=$permission&amp;tool=$tool\">";
 					echo "\t\t\t <a href=\"".$url."\">";
@@ -397,30 +397,30 @@ function display_role_list($current_course_roles, $current_platform_roles)
 	global $setting_visualisation;
     $course_id = api_get_course_int_id();
 
-	$coures_roles_table=Database::get_course_table(TABLE_ROLE);
+	$coures_roles_table = Database::get_course_table(TABLE_ROLE);
 
 	// course roles
-	$sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id ";
-	$result=Database::query($sql);
-	while ($row=Database::fetch_array($result))
+	$sql = "SELECT * FROM $coures_roles_table WHERE c_id = $course_id ";
+	$result = Database::query($sql);
+	while ($row = Database::fetch_array($result))
 	{
 		if (in_array($row['role_id'], $current_course_roles))
 		{
-			$checked='checked';
-			$image='checkbox_on2.gif';
-			$action='revoke';
+			$checked = 'checked';
+			$image = 'checkbox_on2.gif';
+			$action = 'revoke';
 		}
 		else
 		{
-			$checked='';
-			$image='wrong.gif';
-			$action='grant';
+			$checked = '';
+			$image = 'wrong.gif';
+			$action = 'grant';
 		}
-		if ($setting_visualisation=='checkbox')
+		if ($setting_visualisation == 'checkbox')
 		{
 			echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>";
 		}
-		if ($setting_visualisation=='image')
+		if ($setting_visualisation == 'image')
 		{
 			echo "<a href=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."&amp;action=$action&amp;role=".$row['role_id']."&amp;scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>";
 		}
@@ -440,24 +440,24 @@ function display_role_list($current_course_roles, $current_platform_roles)
 * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
 * @version 1.0
 */
-function get_roles($content,$id, $scope='course') {
-    $course_id  = api_get_course_int_id();    
-	if ($content=='user') {
-		$table=Database::get_course_table(TABLE_ROLE_USER);
+function get_roles($content, $id, $scope = 'course') {
+    $course_id = api_get_course_int_id();    
+	if ($content == 'user') {
+		$table = Database::get_course_table(TABLE_ROLE_USER);
 		$id_field = user_id;
 	}
-	if ($content=='group') {
-		$table=Database::get_course_table(TABLE_ROLE_GROUP);
+	if ($content == 'group') {
+		$table = Database::get_course_table(TABLE_ROLE_GROUP);
 		$id_field = 'group_id';
 	}
-	$table_role=Database::get_course_table(TABLE_ROLE);
+	$table_role = Database::get_course_table(TABLE_ROLE);
 
-	$current_roles=array();
+	$current_roles = array();
 	//$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";
-	$sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'";
-	$result=Database::query($sql);
-	while ($row=Database::fetch_array($result)) {
-		$current_roles[]=$row['role_id'];
+	$sql = "SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'";
+	$result = Database::query($sql);
+	while ($row = Database::fetch_array($result)) {
+		$current_roles[] = $row['role_id'];
 	}
 	return $current_roles;
 }
@@ -468,26 +468,26 @@ function get_roles($content,$id, $scope='course') {
 * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
 * @version 1.0
 */
-function get_all_roles($content='course') {
+function get_all_roles($content = 'course') {
     $course_id = api_get_course_int_id();
     $course_id_condition = " WHERE c_id = $course_id ";
     
-	if ($content=='course')
+	if ($content == 'course')
 	{
-		$table_role=Database::get_course_table(TABLE_ROLE);
+		$table_role = Database::get_course_table(TABLE_ROLE);
 	}
-	if ($content=='platform')
+	if ($content == 'platform')
 	{
-		$table_role=Database::get_main_table(TABLE_ROLE);
+		$table_role = Database::get_main_table(TABLE_ROLE);
 		$course_id_condition = '';
 	}
 
-	$current_roles=array();
-	$sql="SELECT * FROM $table_role $course_id_condition ";
-	$result=Database::query($sql);
-	while ($row=Database::fetch_array($result))
+	$current_roles = array();
+	$sql = "SELECT * FROM $table_role $course_id_condition ";
+	$result = Database::query($sql);
+	while ($row = Database::fetch_array($result))
 	{
-		$roles[]=$row;
+		$roles[] = $row;
 	}
 
 	return $roles;
@@ -504,10 +504,10 @@ function get_all_roles($content='course') {
 * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
 * @version 1.0
 */
-function get_roles_permissions($content,$id, $scope='course') {
+function get_roles_permissions($content, $id, $scope = 'course') {
     $course_id = api_get_course_int_id();
 	if ($content == 'user') {
-		$table=Database::get_course_table(TABLE_ROLE_USER);
+		$table = Database::get_course_table(TABLE_ROLE_USER);
 		$id_field = 'user_id';
 	}
 
@@ -536,21 +536,21 @@ function get_roles_permissions($content,$id, $scope='course') {
 	$sql = "
 		SELECT *
 		FROM
-			" . $table . " role_group_user,
-			" . $table_role . " role,
-			" . $table_role_permissions . " role_permissions
+			" . $table." role_group_user,
+			" . $table_role." role,
+			" . $table_role_permissions." role_permissions
 		WHERE
 		    role_group_user.c_id = $course_id AND
 		    $role_condition
-			role_group_user.scope = '" . $scope . "' AND
-			role_group_user." . $id_field . " = '" . $id . "' AND
+			role_group_user.scope = '".$scope."' AND
+			role_group_user." . $id_field." = '".$id."' AND
 			role_group_user.role_id = role.role_id AND
 			role.role_id = role_permissions.role_id";
 
 	$result = Database::query($sql);
     $current_role_permissions = array();
-	while ($row=Database::fetch_array($result)) {
-		$current_role_permissions[$row['tool']][]=$row['action'];
+	while ($row = Database::fetch_array($result)) {
+		$current_role_permissions[$row['tool']][] = $row['action'];
     }
 	return $current_role_permissions;
 }
@@ -564,33 +564,33 @@ function get_roles_permissions($content,$id, $scope='course') {
 * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
 */
 
-function assign_role($content, $action, $id, $role_id, $scope='course') {
+function assign_role($content, $action, $id, $role_id, $scope = 'course') {
     $course_id = api_get_course_int_id();
 	// Which database are we using (depending on the $content parameter)
-	if ($content=='user') {
-		$table=Database::get_course_table(TABLE_ROLE_USER);
+	if ($content == 'user') {
+		$table = Database::get_course_table(TABLE_ROLE_USER);
 		$id_field = 'user_id';
-	} elseif($content=='group') {
-		$table=Database::get_course_table(TABLE_ROLE_GROUP);
+	} elseif ($content == 'group') {
+		$table = Database::get_course_table(TABLE_ROLE_GROUP);
 		$id_field = 'group_id';
 	} else {
 		return  get_lang('Error');
 	}
 
 	// grating a right
-	if ($action=='grant') {
-		$sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')";
-		$result=Database::query($sql);
+	if ($action == 'grant') {
+		$sql = "INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')";
+		$result = Database::query($sql);
 		if ($result) {
-			$result_message=get_lang('RoleGranted');
+			$result_message = get_lang('RoleGranted');
 		}
 	}
     
-	if ($action=='revoke') {
-		$sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'";
-		$result=Database::query($sql);
+	if ($action == 'revoke') {
+		$sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'";
+		$result = Database::query($sql);
 		if ($result) {
-			$result_message=get_lang('RoleRevoked');
+			$result_message = get_lang('RoleRevoked');
 		}
 	}
 	return $result_message;
@@ -607,7 +607,7 @@ function permission_array_merge($array1, $array2)
 	{
 		foreach ($permissions as $permissionkey=>$permissionvalue)
 		{
-			$array1[$tool][]=$permissionvalue;
+			$array1[$tool][] = $permissionvalue;
 		}
 	}
 	return $array1;

+ 1 - 1
main/portfolio/share.php

@@ -5,7 +5,7 @@
  * @license see /license.txt
  * @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
  */
-require_once __DIR__ . '/../inc/global.inc.php';
+require_once __DIR__.'/../inc/global.inc.php';
 
 $has_access = api_protect_course_script();
 if (!$has_access) {

+ 2 - 2
main/session/session_user_edit.php

@@ -28,7 +28,7 @@ if (empty($sessionId) || empty($userId)) {
 }
 
 
-$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
+$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
 $interbreadcrumb[] = array(
     'url' => "resume_session.php?id_session=".$sessionId,
     "name" => get_lang('SessionOverview')
@@ -60,7 +60,7 @@ if (count($userAccess) == 0) {
     if ($days > 0) {
         $msg = sprintf(get_lang('FirstAccessWasXSessionDurationYEndDateInZDays'), $firstAccessString, $duration, $days);
     } else {
-        $endDateInSeconds = $firstAccess + $duration * 24*60*60;
+        $endDateInSeconds = $firstAccess + $duration * 24 * 60 * 60;
         $last = api_convert_and_format_date($endDateInSeconds, DATE_FORMAT_SHORT);
         $msg = sprintf(get_lang('FirstAccessWasXSessionDurationYEndDateWasZ'), $firstAccessString, $duration, $last);
     }

+ 8 - 8
main/social/message_for_group_form.inc.php

@@ -17,8 +17,8 @@ if (api_get_setting('allow_social_tool') != 'true') {
 $tok = Security::get_token();
 
 if (isset($_REQUEST['user_friend'])) {
-    $info_user_friend=array();
-    $info_path_friend=array();
+    $info_user_friend = array();
+    $info_path_friend = array();
     $userfriend_id = intval($_REQUEST['user_friend']);
     $info_user_friend = api_get_user_info($userfriend_id);
     $info_path_friend = UserManager::get_user_picture_path_by_id($userfriend_id, 'web');
@@ -28,7 +28,7 @@ $group_id = isset($_GET['group_id']) ? intval($_GET['group_id']) : null;
 $message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : null;
 $actions = array('add_message_group', 'edit_message_group', 'reply_message_group');
 
-$allowed_action = isset($_GET['action']) && in_array($_GET['action'],$actions) ? Security::remove_XSS($_GET['action']):'';
+$allowed_action = isset($_GET['action']) && in_array($_GET['action'], $actions) ? Security::remove_XSS($_GET['action']) : '';
 
 $to_group = '';
 $subject = '';
@@ -54,13 +54,13 @@ if (!empty($group_id) && $allowed_action) {
     }
 }
 
-$page_item = !empty($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']):1;
-$param_item_page = isset($_GET['items_page_nr']) && isset($_GET['topic_id']) ? ('&items_'.intval($_GET['topic_id']).'_page_nr='.(!empty($_GET['topics_page_nr'])?intval($_GET['topics_page_nr']):1)):'';
+$page_item = !empty($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : 1;
+$param_item_page = isset($_GET['items_page_nr']) && isset($_GET['topic_id']) ? ('&items_'.intval($_GET['topic_id']).'_page_nr='.(!empty($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : 1)) : '';
 if (isset($_GET['topic_id'])) {
     $param_item_page .= '&topic_id='.intval($_GET['topic_id']);
 }
-$page_topic  = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : 1;
-$anchor_topic  = isset($_GET['anchor_topic']) ? Security::remove_XSS($_GET['anchor_topic']) : null;
+$page_topic = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : 1;
+$anchor_topic = isset($_GET['anchor_topic']) ? Security::remove_XSS($_GET['anchor_topic']) : null;
 
 $url = api_get_path(WEB_CODE_PATH).'social/group_topics.php?id='.$group_id.'&anchor_topic='.$anchor_topic.'&topics_page_nr='.$page_topic.$param_item_page;
 
@@ -96,7 +96,7 @@ if (api_get_setting('allow_message_tool') === 'true') {
         '
             <div id="link-more-attach">
                 <a class="btn btn-default" href="javascript://" onclick="return add_image_form()">
-                    ' . get_lang('AddOneMoreFile') . '
+                    ' . get_lang('AddOneMoreFile').'
                 </a>
             </div>
         '

+ 1 - 1
main/social/my_skills_report.php

@@ -14,7 +14,7 @@ $isStudentBoss = api_is_student_boss();
 $isDRH = api_is_drh();
 
 if (!$isStudent && !$isStudentBoss && !$isDRH) {
-    header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/skills_wheel.php');
+    header('Location: '.api_get_path(WEB_CODE_PATH).'social/skills_wheel.php');
     exit;
 }
 

+ 2 - 2
main/survey/create_new_survey.php

@@ -100,7 +100,7 @@ if ($_GET['action'] == 'edit' && isset($survey_id) && is_numeric($survey_id)) {
 $form = new FormValidator(
     'survey',
     'post',
-    api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$survey_id. '&' . api_get_cidreq()
+    api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$survey_id.'&'.api_get_cidreq()
 );
 
 $form->addElement('header', $tool_name);
@@ -216,7 +216,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'edit' && !empty($survey_id)) {
             foreach ($field_list as $key => & $field) {
                 if ($field['visibility'] == 1) {
                     $form->addElement('checkbox', 'profile_'.$key, ' ', '&nbsp;&nbsp;'.$field['name']);
-                    $input_name_list.= 'profile_'.$key.',';
+                    $input_name_list .= 'profile_'.$key.',';
                 }
             }
 

+ 2 - 2
main/ticket/tutor_report.lib.php

@@ -21,7 +21,7 @@ function initializeReport($course_code)
     $table_post = Database::get_course_table(TABLE_FORUM_POST);
     $table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
     $course_code = Database::escape_string($course_code);
-    $res = Database::query("SELECT COUNT(*) as cant FROM $table_reporte_semanas WHERE course_code = '" . $course_code . "'");
+    $res = Database::query("SELECT COUNT(*) as cant FROM $table_reporte_semanas WHERE course_code = '".$course_code."'");
     $sqlWeeks = "SELECT semanas FROM $table_semanas_curso WHERE course_code = '$course_code'";
     $resWeeks = Database::query($sqlWeeks);
     $weeks = Database::fetch_object($resWeeks);
@@ -167,7 +167,7 @@ function showResults($courseInfo, $weeksCount, $page)
         if ($row['week_id'] > (($page - 1) * 7) && $row['week_id'] <= (7 * $page)) {
             $results[$row['username']][$row['week_id']] = $row;
             if (count($results[$row['username']]) == 7) {
-                $html.= showStudentResult($results[$row['username']], $page);
+                $html .= showStudentResult($results[$row['username']], $page);
             }
         }
         if (count($resultadose[$row['username']]) == $weeksCount) {

+ 2 - 2
main/tracking/course_log_groups.php

@@ -99,7 +99,7 @@ $extra_params['height'] = 'auto';
 
 $action_links = '
 function action_formatter(cellvalue, options, rowObject) {
-    return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
+    return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
     '\';
 }';
 
@@ -109,7 +109,7 @@ $htmlHeadXtra[] = api_get_jqgrid_js();
 $htmlHeadXtra[] = '
 <script>
 $(function() {
-    '.Display::grid_js('group_users',$url, $columns, $column_model, $extra_params, array(), $action_links, true).'
+    '.Display::grid_js('group_users', $url, $columns, $column_model, $extra_params, array(), $action_links, true).'
 });
 </script>';
 

+ 6 - 6
main/tracking/course_log_resources.php

@@ -42,8 +42,8 @@ if (empty($session_id)) {
 
 // Breadcrumbs.
 if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
-    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'admin/index.php','name' => get_lang('PlatformAdmin'));
-    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'session/session_list.php','name' => get_lang('SessionList'));
+    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'admin/index.php', 'name' => get_lang('PlatformAdmin'));
+    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'session/session_list.php', 'name' => get_lang('SessionList'));
     $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.api_get_session_id(), 'name' => get_lang('SessionOverview'));
 }
 
@@ -73,21 +73,21 @@ echo Display::url(
 echo Display::return_icon('tools_na.png', get_lang('ResourcesTracking'), array(), ICON_SIZE_MEDIUM);
 echo '<span style="float:right; padding-top:0px;">';
 echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
-    Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).
+    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).
 '</a>';
 
 $addional_param = '';
 if (isset($_GET['additional_profile_field'])) {
-    $addional_param ='additional_profile_field='.intval($_GET['additional_profile_field']);
+    $addional_param = 'additional_profile_field='.intval($_GET['additional_profile_field']);
 }
 
 $users_tracking_per_page = '';
 if (isset($_GET['users_tracking_per_page'])) {
-    $users_tracking_per_page= '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
+    $users_tracking_per_page = '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
 }
 
 echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
-'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
+'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
 
 echo '</span>';
 echo '</div>';

+ 5 - 5
main/tracking/course_log_tools.php

@@ -62,8 +62,8 @@ $csv_content = array();
 
 // Breadcrumbs.
 if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
-    $interbreadcrumb[] = array('url' => '../admin/index.php','name' => get_lang('PlatformAdmin'));
-    $interbreadcrumb[] = array('url' => '../session/session_list.php','name' => get_lang('SessionList'));
+    $interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin'));
+    $interbreadcrumb[] = array('url' => '../session/session_list.php', 'name' => get_lang('SessionList'));
     $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session='.api_get_session_id(), 'name' => get_lang('SessionOverview'));
 }
 
@@ -131,10 +131,10 @@ echo Display::url(
 
 echo '<span style="float:right; padding-top:0px;">';
 echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
-    Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
 
 echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&id_session='.api_get_session_id().'&export=csv">
-	'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
+	'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
 
 echo '</span>';
 echo '</div>';
@@ -247,7 +247,7 @@ if ($exerciseReporting) {
             $quiz_avg_score = round(($quiz_avg_score / $studentCount), 2).'%';
             $url = api_get_path(
                     WEB_CODE_PATH
-                ) . 'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params;
+                ).'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params;
 
             echo '<tr><td>'.Display::url(
                     $quiz['title'],

+ 16 - 16
main/tracking/lp_results_by_user.php

@@ -26,7 +26,7 @@ if (isset($_GET['export'])) {
 	$export_to_csv = true;
 }
 
-if (api_is_platform_admin() ) {
+if (api_is_platform_admin()) {
 	$global = true;
 } else {
 	$global = false;
@@ -34,7 +34,7 @@ if (api_is_platform_admin() ) {
 
 if ($global) {
 	$temp_course_list = CourseManager :: get_courses_list();
-	foreach($temp_course_list  as $temp_course_item) {
+	foreach ($temp_course_list  as $temp_course_item) {
 		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
         $course_list[] = array(
             'code' => $course_item['code'],
@@ -47,14 +47,14 @@ if ($global) {
 }
 
 $new_course_select = array();
-foreach($course_list as $data) {
+foreach ($course_list as $data) {
     $new_course_select[$data['code']] = $data['title'];
 }
 
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
-$form->addElement('select','course_code',get_lang('Course'), $new_course_select);
+$form->addElement('select', 'course_code', get_lang('Course'), $new_course_select);
 if ($global) {
-	$form->addElement('hidden','view','admin');
+	$form->addElement('hidden', 'view', 'admin');
 } else {
 	//Get exam lists
     $course_id = api_get_course_int_id();
@@ -64,7 +64,7 @@ if ($global) {
 	                 ORDER BY quiz.title ASC";
 	$resultExercices = Database::query($sqlExercices);
 	$exercise_list[0] = get_lang('All');
-	while($a_exercices = Database::fetch_array($resultExercices)) {
+	while ($a_exercices = Database::fetch_array($resultExercices)) {
 		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
 	}
 	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
@@ -88,7 +88,7 @@ if (!$export_to_csv) {
 
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
                 '.Display::return_icon('csv.gif').'
-                &nbsp;'.get_lang('ExportAsCSV').'</a>' .
+                &nbsp;'.get_lang('ExportAsCSV').'</a>'.
                 '<a href="javascript: void(0);" onclick="javascript: window.print()">
                 '.Display::return_icon('printmgr.gif').'
                 &nbsp;'.get_lang('Print').'</a>
@@ -102,10 +102,10 @@ if (!$export_to_csv) {
         }
 		$menu_items[] = get_lang('ExamTracking');
 		$nb_menu_items = count($menu_items);
-		if($nb_menu_items>1) {
-			foreach($menu_items as $key=> $item) {
+		if ($nb_menu_items > 1) {
+			foreach ($menu_items as $key=> $item) {
 				echo $item;
-				if($key!=$nb_menu_items-1) {
+				if ($key != $nb_menu_items - 1) {
 					echo ' | ';
 				}
 			}
@@ -129,7 +129,7 @@ $main_result = array();
 $session_id = 0;
 $user_list = array();
 // Getting course list
-foreach ($course_list  as $current_course ) {
+foreach ($course_list  as $current_course) {
 	$course_info = api_get_course_info($current_course['code']);
 	$_course = $course_info;
 
@@ -163,7 +163,7 @@ foreach ($course_list  as $current_course ) {
 }
 
 if (!empty($user_list)) {
-    foreach($user_list as $user_id) {
+    foreach ($user_list as $user_id) {
         $user_data = api_get_user_info($user_id);
 		$user_list_name[$user_id] = api_get_person_name(
 			$user_data['firstname'],
@@ -171,7 +171,7 @@ if (!empty($user_list)) {
 		);
     }
 }
-$export_array =  array();
+$export_array = array();
 if (!empty($main_result)) {
 
     $html_result .= '<table  class="data_table">';
@@ -194,9 +194,9 @@ if (!empty($main_result)) {
 
             foreach ($exercises as $exercise_id => $exercise_data) {
                 $users = $exercise_data['users'];
-                foreach($users as $user_id => $attempts) {
+                foreach ($users as $user_id => $attempts) {
                     $attempt = 1;
-                    foreach($attempts as $exe_id => $attempt_data) {
+                    foreach ($attempts as $exe_id => $attempt_data) {
                         $html_result .= '<tr colspan="">';
                         $html_result .= Display::tag('td', $course_code);
                         $html_result .= Display::tag('td', $lp_list_name[$lp_id]);
@@ -223,7 +223,7 @@ if (!empty($main_result)) {
             }
         }
     }
-    $html_result .='</table>';
+    $html_result .= '</table>';
 }
 
 if (!$export_to_csv) {

+ 8 - 8
main/tracking/question_course_report.php

@@ -24,7 +24,7 @@ if (isset($_GET['export'])) {
 	$export_to_xls = true;
 }
 
-if (api_is_platform_admin() ) {
+if (api_is_platform_admin()) {
 	$global = true;
 } else {
 	$global = false;
@@ -52,7 +52,7 @@ if (empty($session_id)) {
 
 foreach ($temp_course_list  as $temp_course_item) {
 	$course_item = CourseManager ::get_course_information($temp_course_item['code']);
-	$course_select_list[$temp_course_item['code']]	= $course_item['title'];
+	$course_select_list[$temp_course_item['code']] = $course_item['title'];
 }
 
 //Get session list
@@ -90,7 +90,7 @@ if (empty($course_code)) {
     $course_code = 0;
 }
 
-$form->setDefaults(array('course_code'=>(string)$course_code));
+$form->setDefaults(array('course_code'=>(string) $course_code));
 
 $course_info = api_get_course_info($course_code);
 
@@ -125,9 +125,9 @@ if (!empty($course_info)) {
 
 				foreach ($exercise_stats as $stats) {
 					if (!empty($stats['question_list'])) {
-						foreach($stats['question_list'] as $my_question_stat) {
+						foreach ($stats['question_list'] as $my_question_stat) {
 							if ($question_id == $my_question_stat['question_id']) {
-								$question_result =  $question_result + $my_question_stat['marks'];
+								$question_result = $question_result + $my_question_stat['marks'];
 								$quantity_exercises++;
 							}
 						}
@@ -187,9 +187,9 @@ if (!empty($main_question_list) && is_array($main_question_list)) {
 
 	foreach ($main_question_list as $question) {
 		$total_student = 0;
-		$counter ++;
+		$counter++;
 		$s_css_class = 'row_even';
-		if ($counter % 2 ==0 ) {
+		if ($counter % 2 == 0) {
 			$s_css_class = 'row_odd';
 		}
 		$html_result .= "<tr class='$s_css_class'>
@@ -211,7 +211,7 @@ if (!empty($main_question_list) && is_array($main_question_list)) {
 		$html_result .= "</td>";
 	}
 
-	$html_result .="</tr>";
+	$html_result .= "</tr>";
 	$html_result .= '</table>';
 } else {
 	if (!empty($course_code)) {

+ 26 - 26
main/tracking/userLog.php

@@ -27,7 +27,7 @@ $is_allowed = true;
 require_once api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php';
 
 if (isset($uInfo)) {
-    $interbreadcrumb[]= array(
+    $interbreadcrumb[] = array(
         'url'=>'../user/userInfo.php?uInfo='.Security::remove_XSS($uInfo),
         "name"=> api_ucfirst(get_lang('Users'))
     );
@@ -48,7 +48,7 @@ td {border-bottom: thin dashed gray;}
 /*]]>*/
 </style>";
 
-Display::display_header($nameTools,"Tracking");
+Display::display_header($nameTools, "Tracking");
 
 /*	Constants and variables */
 
@@ -56,11 +56,11 @@ $is_allowedToTrack = $is_courseAdmin;
 $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $courseId);
 
 // Database Table Definitions
-$TABLECOURSUSER	        	= Database::get_main_table(TABLE_MAIN_COURSE_USER);
-$TABLEUSER	        		= Database::get_main_table(TABLE_MAIN_USER);
-$tbl_session_course_user 	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
-$tbl_session 				= Database::get_main_table(TABLE_MAIN_SESSION);
-$TABLECOURSE_GROUPSUSER 	= Database::get_course_table(TABLE_GROUP_USER);
+$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
+$TABLEUSER = Database::get_main_table(TABLE_MAIN_USER);
+$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
+$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
+$TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER);
 $now = api_get_utc_datetime();
 
 $sql = "SELECT 1
@@ -72,8 +72,8 @@ $sql = "SELECT 1
             OR (access_start_date IS NULL AND access_end_date IS NULL))
         WHERE session_id='".api_get_session_id()."' AND c_id = $courseId";
 //echo $sql;
-$result=Database::query($sql);
-if(!Database::num_rows($result)){
+$result = Database::query($sql);
+if (!Database::num_rows($result)) {
     $disabled = true;
 }
 
@@ -82,7 +82,7 @@ $tbl_learnpath_item = Database::get_course_table(TABLE_LP_ITEM);
 $tbl_learnpath_view = Database::get_course_table(TABLE_LP_VIEW);
 $tbl_learnpath_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
 
-$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
+$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
 
 // The variables for the days and the months
 $DaysShort = api_get_week_days_short();
@@ -107,7 +107,7 @@ $is_allowedToTrackEverybodyInCourse = $is_allowedToTrack; // allowed to track al
 <table width="100%" cellpadding="2" cellspacing="3" border="0">
 <?php
 // check if uid is tutor of this group
-if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
+if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
     if (!$uInfo && !isset($uInfo)) {
         /*
         *		Display list of user of this group
@@ -131,7 +131,7 @@ if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
         $step = 25; // number of student per page
         if ($userGroupNb > $step) {
             if (!isset($offset)) {
-                    $offset=0;
+                    $offset = 0;
             }
 
             $next     = $offset + $step;
@@ -184,13 +184,13 @@ if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
         $list_users = getManyResults3Col($sql);
         echo "<table width='100%' cellpadding='2' cellspacing='1' border='0'>\n"
                     ."<tr align='center' valign='top' bgcolor='#E6E6E6'>\n"
-                    ."<td align='left'>",get_lang('UserName'),"</td>\n"
+                    ."<td align='left'>", get_lang('UserName'), "</td>\n"
                     ."</tr>\n";
         for ($i = 0; $i < sizeof($list_users); $i++) {
             echo    "<tr valign='top' align='center'>\n"
                     ."<td align='left'>"
-                    ."<a href='".api_get_self()."?uInfo=",$list_users[$i][0],"'>"
-                    .$list_users[$i][1]," ",$list_users[$i][2]
+                    ."<a href='".api_get_self()."?uInfo=", $list_users[$i][0], "'>"
+                    .$list_users[$i][1], " ", $list_users[$i][2]
                     ."</a>".
                     "</td>\n";
         }
@@ -247,7 +247,7 @@ if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
             ";
 
             if (!isset($view)) {
-                $view ='0000000';
+                $view = '0000000';
             }
             //Logins
             TrackingUserLog::display_login_tracking_info($view, $uInfo, $courseId);
@@ -279,8 +279,8 @@ if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
                 </tr>";
 
             $sql = "SELECT id, name FROM $tbl_learnpath_main";
-            $result=Database::query($sql);
-            $ar=Database::fetch_array($result);
+            $result = Database::query($sql);
+            $ar = Database::fetch_array($result);
 
             echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
             echo "<table cellpadding='2' cellspacing='1' border='0' align='center'><tr>
@@ -297,14 +297,14 @@ if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
                     if ($ar['id'] == $scormcontopen) {
                         //have to list the students here
                         $contentId = intval($ar['id']);
-                        $sql3 = "SELECT iv.status, iv.score, i.title, iv.total_time " .
-                                "FROM $tbl_learnpath_item i " .
-                                "INNER JOIN $tbl_learnpath_item_view iv ON i.id=iv.lp_item_id " .
-                                "INNER JOIN $tbl_learnpath_view v ON iv.lp_view_id=v.id " .
+                        $sql3 = "SELECT iv.status, iv.score, i.title, iv.total_time ".
+                                "FROM $tbl_learnpath_item i ".
+                                "INNER JOIN $tbl_learnpath_item_view iv ON i.id=iv.lp_item_id ".
+                                "INNER JOIN $tbl_learnpath_view v ON iv.lp_view_id=v.id ".
                                 "WHERE (v.user_id=".intval($uInfo)." and v.lp_id=$contentId)
                                 ORDER BY v.id, i.id";
-                        $result3=Database::query($sql3);
-                        $ar3=Database::fetch_array($result3);
+                        $result3 = Database::query($sql3);
+                        $ar3 = Database::fetch_array($result3);
                         if (is_array($ar3)) {
                             echo "<tr><td>&nbsp;&nbsp;&nbsp;</td>
                                    <td class='secLine'>
@@ -326,7 +326,7 @@ if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
                                 echo "<tr><td>&nbsp;&nbsp;&nbsp;</td><td>";
                                 echo "$title</td><td align=right>{$ar3['status']}</td><td align=right>{$ar3['score']}</td><td align=right>$time</td>";
                                 echo "</tr>";
-                                $ar3=Database::fetch_array($result3);
+                                $ar3 = Database::fetch_array($result3);
                             }
                         } else {
                             echo "<tr>";
@@ -337,7 +337,7 @@ if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse )) {
                     $ar = Database::fetch_array($result);
                 }
             } else {
-                $noscorm=true;
+                $noscorm = true;
             }
 
             if ($noscorm) {

+ 15 - 15
main/tracking/userlogCSV.php

@@ -20,7 +20,7 @@ $courseId = api_get_course_int_id();
 //YW Hack security to quick fix RolesRights bug
 $is_allowed = true;
 
-require_once api_get_path(SYS_CODE_PATH) . 'exercise/hotpotatoes.lib.php';
+require_once api_get_path(SYS_CODE_PATH).'exercise/hotpotatoes.lib.php';
 
 /* Header */
 
@@ -64,7 +64,7 @@ $sql = "SELECT 1
             AND ((access_start_date <= '$now'
             AND access_end_date >= '$now')
             OR (access_start_date IS NULL AND access_end_date IS NULL))
-        WHERE session_id='" . api_get_session_id() . "' AND c_id = $courseId";
+        WHERE session_id='".api_get_session_id()."' AND c_id = $courseId";
 //echo $sql;
 $result = Database::query($sql);
 if (!Database::num_rows($result)) {
@@ -77,7 +77,7 @@ $tbl_learnpath_item = Database::get_course_table(TABLE_LP_ITEM);
 $tbl_learnpath_view = Database::get_course_table(TABLE_LP_VIEW);
 $tbl_learnpath_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
 
-$documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
+$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
 
 // The variables for the days and the months
 $DaysShort = api_get_week_days_short();
@@ -109,7 +109,7 @@ if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
             // if user can track everybody : list user of course
             $sql = "SELECT count(user_id)
                     FROM $TABLECOURSUSER
-                    WHERE c_id = '$courseId' AND relation_type<>" . COURSE_RELATION_TYPE_RRHH . "";
+                    WHERE c_id = '$courseId' AND relation_type<>".COURSE_RELATION_TYPE_RRHH."";
 
         } else {
             // if user can only track one group : list users of this group
@@ -147,7 +147,7 @@ if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
             // list of users in this course
             $sql = "SELECT u.user_id, u.firstname,u.lastname
                 FROM $TABLECOURSUSER cu , $TABLEUSER u
-                WHERE cu.user_id = u.user_id AND cu.relation_type<>" . COURSE_RELATION_TYPE_RRHH . "
+                WHERE cu.user_id = u.user_id AND cu.relation_type<>".COURSE_RELATION_TYPE_RRHH."
                 AND cu.c_id = '$courseId'
                 LIMIT $offset,$step";
         } else {
@@ -173,7 +173,7 @@ if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
             // check if user is in this course
             $tracking_is_accepted = $is_course_member;
             $tracked_user_info = api_get_user_info($uInfo);
-            $title[0] = $tracked_user_info[1] . '_' . $tracked_user_info[2];
+            $title[0] = $tracked_user_info[1].'_'.$tracked_user_info[2];
         } else {
             // check if user is in the group of this tutor
             $sql = "SELECT u.firstname,u.lastname, u.email
@@ -187,7 +187,7 @@ if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
                 $tracking_is_accepted = true;
             }
 
-            $title[0] = $tracked_user_info['firstname'] . '_' . $tracked_user_info['lastname'];
+            $title[0] = $tracked_user_info['firstname'].'_'.$tracked_user_info['lastname'];
         }
 
         if ($tracking_is_accepted) {
@@ -235,8 +235,8 @@ if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
                 $_cid
             );
 
-            $title_line = $title_line1 . $title_line2 . $title_line3 . $title_line4 . $title_line5;
-            $line = $line1 . $line2 . $line3 . $line4 . $line5;
+            $title_line = $title_line1.$title_line2.$title_line3.$title_line4.$title_line5;
+            $line = $line1.$line2.$line3.$line4.$line5;
         } else {
             echo get_lang('ErrorUserNotInGroup');
         }
@@ -303,22 +303,22 @@ if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
      * force the browser to save the file instead of opening it
      */
 
-    $len = strlen($title_line . $line);
+    $len = strlen($title_line.$line);
     header('Content-type: application/octet-stream');
     //header('Content-Type: application/force-download');
-    header('Content-length: ' . $len);
+    header('Content-length: '.$len);
     $filename = html_entity_decode(
         str_replace(
             ":",
             "",
-            str_replace(" ", "_", $title[0] . '_' . $title[1] . '.csv')
+            str_replace(" ", "_", $title[0].'_'.$title[1].'.csv')
         )
     );
     $filename = api_replace_dangerous_char($filename);
     if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
-        header('Content-Disposition: filename= ' . $filename);
+        header('Content-Disposition: filename= '.$filename);
     } else {
-        header('Content-Disposition: attachment; filename= ' . $filename);
+        header('Content-Disposition: attachment; filename= '.$filename);
     }
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
         header('Pragma: ');
@@ -327,7 +327,7 @@ if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
             'Cache-Control: public'
         ); // IE cannot download from sessions without a cache
     }
-    header('Content-Description: ' . $filename);
+    header('Content-Description: '.$filename);
     header('Content-transfer-encoding: binary');
 
     echo api_html_entity_decode($title_line, ENT_QUOTES, $charset);

+ 2 - 2
main/upload/index.php

@@ -40,9 +40,9 @@ if (!$is_allowed_to_edit) {
 	api_not_allowed(true);
 }
 
-$courseDir = $_course['path'] . "/document";
+$courseDir = $_course['path']."/document";
 $sys_course_path = api_get_path(SYS_COURSE_PATH);
-$base_work_dir = $sys_course_path . $courseDir;
+$base_work_dir = $sys_course_path.$courseDir;
 $noPHP_SELF = true;
 $max_filled_space = DocumentManager::get_course_quota();
 

+ 16 - 16
main/user/session_list.php

@@ -46,15 +46,15 @@ if ($allowTutors == 'true') {
     );
 
     //Column config
-    $column_model   = array(
-        array('name'=>'name',           'index'=>'name',          'width'=>'160',  'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
-        array('name'=>'nbr_courses',    'index'=>'nbr_courses',   'width'=>'30',   'align'=>'left', 'search' => 'true'),
-        array('name'=>'nbr_users',      'index'=>'nbr_users',     'width'=>'30',   'align'=>'left', 'search' => 'true'),
-        array('name'=>'category_name',  'index'=>'category_name', 'width'=>'70',   'align'=>'left', 'search' => 'true'),
-        array('name'=>'access_start_date',     'index'=>'access_start_date',    'width'=>'40',   'align'=>'left', 'search' => 'true'),
-        array('name'=>'access_end_date',       'index'=>'access_end_date',      'width'=>'40',   'align'=>'left', 'search' => 'true'),
-        array('name'=>'coach_name',     'index'=>'coach_name',    'width'=>'80',   'align'=>'left', 'search' => 'false'),
-        array('name'=>'status',         'index'=>'session_active','width'=>'40',   'align'=>'left', 'search' => 'true', 'stype'=>'select',
+    $column_model = array(
+        array('name'=>'name', 'index'=>'name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
+        array('name'=>'nbr_courses', 'index'=>'nbr_courses', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+        array('name'=>'nbr_users', 'index'=>'nbr_users', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
+        array('name'=>'category_name', 'index'=>'category_name', 'width'=>'70', 'align'=>'left', 'search' => 'true'),
+        array('name'=>'access_start_date', 'index'=>'access_start_date', 'width'=>'40', 'align'=>'left', 'search' => 'true'),
+        array('name'=>'access_end_date', 'index'=>'access_end_date', 'width'=>'40', 'align'=>'left', 'search' => 'true'),
+        array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'80', 'align'=>'left', 'search' => 'false'),
+        array('name'=>'status', 'index'=>'session_active', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'stype'=>'select',
           //for the bottom bar
             'searchoptions' => array(
                 'defaultValue' => '1',
@@ -62,8 +62,8 @@ if ($allowTutors == 'true') {
             ),
           //for the top bar
           'editoptions' => array('value' => ':'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive'))),
-        array('name'=>'visibility',     'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
-        array('name'=>'actions',        'index'=>'actions',         'width'=>'100',  'align'=>'left','formatter'=>'action_formatter','sortable'=>'false', 'search' => 'false')
+        array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
+        array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false', 'search' => 'false')
     );
     //Autowidth
     $extra_params['autowidth'] = 'true';
@@ -75,7 +75,7 @@ if ($allowTutors == 'true') {
 
     //With this function we can add actions to the jgrid (edit, delete, etc)
     $action_links = 'function action_formatter(cellvalue, options, rowObject) {
-         return \'&nbsp;<a href="add_users_to_session.php?page=session_list.php&id_session=\'+options.rowId+\'">'.Display::return_icon('user_subscribe_session.png',get_lang('SubscribeUsersToSession'),'',ICON_SIZE_SMALL).'</a>'.
+         return \'&nbsp;<a href="add_users_to_session.php?page=session_list.php&id_session=\'+options.rowId+\'">'.Display::return_icon('user_subscribe_session.png', get_lang('SubscribeUsersToSession'), '', ICON_SIZE_SMALL).'</a>'.
          '\';
     }';
     ?>
@@ -96,7 +96,7 @@ if ($allowTutors == 'true') {
 
     $(function() {
         <?php
-            echo Display::grid_js('sessions', $url,$columns,$column_model,$extra_params, array(), $action_links,true);
+            echo Display::grid_js('sessions', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
         ?>
 
         setSearchSelect("status");
@@ -138,9 +138,9 @@ if ($allowTutors == 'true') {
     <?php if (api_is_platform_admin()) {?>
         <div class="actions">
         <?php
-        echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'.Display::return_icon('new_session.png',get_lang('AddSession'),'',ICON_SIZE_MEDIUM).'</a>';
-        echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/add_many_session_to_category.php">'.Display::return_icon('session_to_category.png',get_lang('AddSessionsInCategories'),'',ICON_SIZE_MEDIUM).'</a>';
-        echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_category_list.php">'.Display::return_icon('folder.png',get_lang('ListSessionCategory'),'',ICON_SIZE_MEDIUM).'</a>';
+        echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'.Display::return_icon('new_session.png', get_lang('AddSession'), '', ICON_SIZE_MEDIUM).'</a>';
+        echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/add_many_session_to_category.php">'.Display::return_icon('session_to_category.png', get_lang('AddSessionsInCategories'), '', ICON_SIZE_MEDIUM).'</a>';
+        echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_category_list.php">'.Display::return_icon('folder.png', get_lang('ListSessionCategory'), '', ICON_SIZE_MEDIUM).'</a>';
         echo '</div>';
     }
 } else {

+ 8 - 8
main/user/user_import.php

@@ -15,8 +15,8 @@ if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'false'
 
 $tool_name = get_lang('ImportUsersToACourse');
 
-$interbreadcrumb[] = array ("url" => "user.php", "name" => get_lang("Users"));
-$interbreadcrumb[] = array ("url" => "#", "name" => get_lang("ImportUsersToACourse"));
+$interbreadcrumb[] = array("url" => "user.php", "name" => get_lang("Users"));
+$interbreadcrumb[] = array("url" => "#", "name" => get_lang("ImportUsersToACourse"));
 
 $form = new FormValidator('user_import', 'post', 'user_import.php');
 $form->addElement('header', $tool_name);
@@ -39,7 +39,7 @@ if ($form->validate()) {
     if (isset($_FILES['import_file']['size']) && $_FILES['import_file']['size'] !== 0) {
         $unsubscribe_users = isset($_POST['unsubscribe_users']) ? true : false;
         //@todo : csvToArray deprecated
-        $users  = Import::csvToArray($_FILES['import_file']['tmp_name']);
+        $users = Import::csvToArray($_FILES['import_file']['tmp_name']);
         $invalid_users  = array();
         $clean_users    = array();
 
@@ -76,7 +76,7 @@ if ($form->validate()) {
                         $user_ids = array();
                         foreach ($current_user_list as $user) {
                             if (!CourseManager::is_course_teacher($user['user_id'], $course_code)) {
-                                $user_ids[]= $user['user_id'];
+                                $user_ids[] = $user['user_id'];
                             }
                         }
                         CourseManager::unsubscribe_user($user_ids, $course_code, $session_id);
@@ -89,12 +89,12 @@ if ($form->validate()) {
                     if (empty($session_id)) {
                         //just to make sure
                         if (CourseManager :: is_user_subscribed_in_course($userId, $course_code)) {
-                            $user_to_show[]= $userInfo['complete_name'];
+                            $user_to_show[] = $userInfo['complete_name'];
                         }
                     } else {
                         //just to make sure
                         if (CourseManager::is_user_subscribed_in_course($userId, $course_code, true, $session_id)) {
-                            $user_to_show[]= $userInfo['complete_name'];
+                            $user_to_show[] = $userInfo['complete_name'];
                         }
                     }
                 }
@@ -102,7 +102,7 @@ if ($form->validate()) {
                 $message = get_lang('CheckUsersWithId');
                 $type = 'warning';
                 foreach ($invalid_users as $invalid_user) {
-                    $user_to_show[]= $invalid_user;
+                    $user_to_show[] = $invalid_user;
                 }
             }
         }
@@ -127,7 +127,7 @@ if (!empty($message)) {
             Display::display_warning_message($message.':  <br />'.$userMessage, false);
         }
     } else {
-        $empty_line_msg = ($empty_line == 0) ? get_lang('ErrorsWhenImportingFile'): get_lang('ErrorsWhenImportingFile').': '.get_lang('EmptyHeaderLine');
+        $empty_line_msg = ($empty_line == 0) ? get_lang('ErrorsWhenImportingFile') : get_lang('ErrorsWhenImportingFile').': '.get_lang('EmptyHeaderLine');
         Display::display_error_message($empty_line_msg);
     }
 }

+ 56 - 56
main/webservices/cm_webservice_course.php

@@ -22,7 +22,7 @@ class WSCMCourse extends WSCM
 	 */
 	protected function deleteCourseHelper($course_id_field_name, $course_id_value) {
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
-		if($course_id instanceof WSCMError) {
+		if ($course_id instanceof WSCMError) {
 			return $course_id;
 		} else {
 			$course_code = CourseManager::get_course_code_from_course_id($course_id);
@@ -40,11 +40,11 @@ class WSCMCourse extends WSCM
 	 */
 	public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) {
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSError) {
+		if ($verifKey instanceof WSError) {
 			$this->handleError($verifKey);
 		} else {
 			$result = $this->deleteCourseHelper($course_id_field_name, $course_id_value);
-			if($result instanceof WSError) {
+			if ($result instanceof WSError) {
 				$this->handleError($result);
 			}
 		}
@@ -60,15 +60,15 @@ class WSCMCourse extends WSCM
 	 */
 	public function DeleteCourses($secret_key, $courses) {
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSError) {
+		if ($verifKey instanceof WSError) {
 			$this->handleError($verifKey);
 		} else {
 			$results = array();
-			foreach($courses as $course) {
+			foreach ($courses as $course) {
 				$result_tmp = array();
 				$result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']);
 				$result_tmp['course_id_value'] = $course['course_id_value'];
-				if($result_op instanceof WSCMError) {
+				if ($result_op instanceof WSCMError) {
 					// Return the error in the results
 					$result_tmp['result'] = $result_op->toArray();
 				} else {
@@ -98,17 +98,17 @@ class WSCMCourse extends WSCM
 	protected function createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
 		// Add the original course id field name and value to the extra fields if needed
 		$extras_associative = array();
-		if($course_id_field_name != "chamilo_course_id") {
+		if ($course_id_field_name != "chamilo_course_id") {
 			$extras_associative[$course_id_field_name] = $course_id_value;
 		}
-		foreach($extras as $extra) {
+		foreach ($extras as $extra) {
 			$extras_associative[$extra['field_name']] = $extra['field_value'];
 		}
 		$course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value);
-		if($course_admin_id instanceof WSError) {
+		if ($course_admin_id instanceof WSError) {
 			return $course_admin_id;
 		}
-		if($wanted_code == '') {
+		if ($wanted_code == '') {
 			$wanted_code = CourseManager::generate_course_code($title);
 		}
 		$result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0);
@@ -116,7 +116,7 @@ class WSCMCourse extends WSCM
 			return new WSError(202, 'There was an error creating the course');
 		} else {
 			// Update extra fields
-			foreach($extras_associative as $fname => $fvalue) {
+			foreach ($extras_associative as $fname => $fvalue) {
 				CourseManager::update_course_extra_field_value($result, $fname, $fvalue);
 			}
 			// Get course id
@@ -144,11 +144,11 @@ class WSCMCourse extends WSCM
 	public function CreateCourse($secret_key, $title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
 		// First, verify the secret key
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSError) {
+		if ($verifKey instanceof WSError) {
 			$this->handleError($verifKey);
 		} else {
 			$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
-			if($result instanceof WSError) {
+			if ($result instanceof WSError) {
 				$this->handleError($result);
 			} else {
 				return $result;
@@ -166,17 +166,17 @@ class WSCMCourse extends WSCM
 	public function CreateCourses($secret_key, $courses) {
 		// First, verify the secret key
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSCMError) {
+		if ($verifKey instanceof WSCMError) {
 			$this->handleError($verifKey);
 		} else {
 			$results = array();
-			foreach($courses as $course) {
+			foreach ($courses as $course) {
 				$result_tmp = array();
 				//reinitialize variables just in case
 				$title = $category_code = $wanted_code = $tutor_name = $course_admin_user_id_field_name = $course_admin_user_id_value = $language = $course_id_field_name = $course_id_value = $extras = null;
 				extract($course);
 				$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
-				if($result instanceof WSCMError) {
+				if ($result instanceof WSCMError) {
 					$result_tmp['result'] = $result->toArray();
 					$result_tmp['course_id_value'] = $course_id_value;
 					$result_tmp['course_id_generated'] = 0;
@@ -210,47 +210,47 @@ class WSCMCourse extends WSCM
 	 */
 	protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
-		if($course_id instanceof WSCMError) {
+		if ($course_id instanceof WSCMError) {
 			return $course_id;
 		} else {
 			$attributes = array();
-			if(!empty($title)) {
+			if (!empty($title)) {
 				$attributes['title'] = $title;
 			}
-			if(!empty($category_code)) {
+			if (!empty($category_code)) {
 				$attributes['category_code'] = $category_code;
 			}
-			if(!empty($department_name)) {
+			if (!empty($department_name)) {
 				$attributes['department_name'] = $department_name;
 			}
-			if(!empty($department_url)) {
+			if (!empty($department_url)) {
 				$attributes['department_url'] = $department_url;
 			}
-			if(!empty($language)) {
+			if (!empty($language)) {
 				$attributes['course_language'] = $language;
 			}
-			if($visibility != '') {
-				$attributes['visibility'] = (int)$visibility;
+			if ($visibility != '') {
+				$attributes['visibility'] = (int) $visibility;
 			}
-			if($subscribe != '') {
-				$attributes['subscribe'] = (int)$subscribe;
+			if ($subscribe != '') {
+				$attributes['subscribe'] = (int) $subscribe;
 			}
-			if($unsubscribe != '') {
-				$attributes['unsubscribe'] = (int)$unsubscribe;
+			if ($unsubscribe != '') {
+				$attributes['unsubscribe'] = (int) $unsubscribe;
 			}
-			if(!empty($visual_code)) {
+			if (!empty($visual_code)) {
 				$attributes['visual_code'] = $visual_code;
 			}
-			if(!empty($attributes)) {
+			if (!empty($attributes)) {
 				CourseManager::update_attributes($course_id, $attributes);
 			}
-			if(!empty($extras)) {
+			if (!empty($extras)) {
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
 				$extras_associative = array();
-				foreach($extras as $extra) {
+				foreach ($extras as $extra) {
 					$extras_associative[$extra['field_name']] = $extra['field_value'];
 				}
-				foreach($extras_associative as $fname => $fvalue) {
+				foreach ($extras_associative as $fname => $fvalue) {
 					CourseManager::update_extra_field_value($course_code, $fname, $fvalue);
 				}
 			}
@@ -277,11 +277,11 @@ class WSCMCourse extends WSCM
 	 */
 	public function EditCourse($secret_key, $course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSCMError) {
+		if ($verifKey instanceof WSCMError) {
 			$this->handleError($verifKey);
 		} else {
 			$result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras);
-			if($result instanceof WSCMError) {
+			if ($result instanceof WSCMError) {
 				$this->handleError($result);
 			}
 		}
@@ -297,14 +297,14 @@ class WSCMCourse extends WSCM
 	 */
 	public function ListCourses($secret_key, $course_id_field_name) {
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSError) {
+		if ($verifKey instanceof WSError) {
 			$this->handleError($verifKey);
 		} else {
 			$courses_result = array();
 			$category_names = array();
 
 			$courses = CourseManager::get_courses_list();
-			foreach($courses as $course) {
+			foreach ($courses as $course) {
 				$course_tmp = array();
 				$course_tmp['id'] = $course['id'];
 				$course_tmp['code'] = $course['code'];
@@ -313,7 +313,7 @@ class WSCMCourse extends WSCM
 				$course_tmp['visibility'] = $course['visibility'];
 
 				// Determining category name
-				if($category_names[$course['category_code']]) {
+				if ($category_names[$course['category_code']]) {
 					$course_tmp['category_name'] = $category_names[$course['category_code']];
 				} else {
 					$category = CourseManager::get_course_category($course['category_code']);
@@ -349,21 +349,21 @@ class WSCMCourse extends WSCM
 	 */
 	protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) {
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
-		if($course_id instanceof WSError) {
+		if ($course_id instanceof WSError) {
 			return $course_id;
 		} else {
 			$user_id = $this->getUserId($user_id_field_name, $user_id_value);
-			if($user_id instanceof WSError) {
+			if ($user_id instanceof WSError) {
 				return $user_id;
 			} else {
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
-				if($state == 0) {
+				if ($state == 0) {
 					// Unsubscribe user
 					CourseManager::unsubscribe_user($user_id, $course_code);
 					return true;
 				} else {
 					// Subscribe user
-					if(CourseManager::subscribe_user($user_id, $course_code, $status)) {
+					if (CourseManager::subscribe_user($user_id, $course_code, $status)) {
 						return true;
 					} else {
 						return new WSError(203, 'An error occured subscribing to this course');
@@ -385,11 +385,11 @@ class WSCMCourse extends WSCM
 	 */
 	public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) {
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSError) {
+		if ($verifKey instanceof WSError) {
 			$this->handleError($verifKey);
 		} else {
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status);
-			if($result instanceof WSError) {
+			if ($result instanceof WSError) {
 				$this->handleError($result);
 			}
 		}
@@ -406,11 +406,11 @@ class WSCMCourse extends WSCM
 	 */
 	public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) {
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSError) {
+		if ($verifKey instanceof WSError) {
 			$this->handleError($verifKey);
 		} else {
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0);
-			if($result instanceof WSError) {
+			if ($result instanceof WSError) {
 				$this->handleError($result);
 			}
 		}
@@ -426,17 +426,17 @@ class WSCMCourse extends WSCM
 	 */
 	public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) {
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSError) {
+		if ($verifKey instanceof WSError) {
 			$this->handleError($verifKey);
 		} else {
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
-			if($course_id instanceof WSError) {
+			if ($course_id instanceof WSError) {
 				return $course_id;
 			} else {
 				// Course exists, get its descriptions
 				$descriptions = CourseDescription::get_descriptions($course_id);
 				$results = array();
-				foreach($descriptions as $description) {
+				foreach ($descriptions as $description) {
 					$results[] = array('course_desc_id' => $description->get_description_type(),
 						'course_desc_title' => $description->get_title(),
 						'course_desc_content' => $description->get_content());
@@ -459,11 +459,11 @@ class WSCMCourse extends WSCM
 	 */
 	public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) {
 		$verifKey = $this->verifyKey($secret_key);
-		if($verifKey instanceof WSError) {
+		if ($verifKey instanceof WSError) {
 			$this->handleError($verifKey);
 		} else {
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
-			if($course_id instanceof WSError) {
+			if ($course_id instanceof WSError) {
 				return $course_id;
 			} else {
 				// Create the new course description
@@ -480,8 +480,8 @@ class WSCMCourse extends WSCM
 				// Check if this course description exists
 				$descriptions = CourseDescription::get_descriptions($course_id);
 				$exists = false;
-				foreach($descriptions as $description) {
-					if($description->get_description_type() == $course_desc_id) {
+				foreach ($descriptions as $description) {
+					if ($description->get_description_type() == $course_desc_id) {
 						$exists = true;
 					}
 				}
@@ -497,7 +497,7 @@ class WSCMCourse extends WSCM
 	}
 	public function unreadMessage($username, $password)
 	{
-		if($this->verifyUserPass($username, $password) == "valid")
+		if ($this->verifyUserPass($username, $password) == "valid")
 		{
 			$table_message = Database::get_main_table(TABLE_MESSAGE);
 			$user_id = UserManager::get_user_id_from_username($username);
@@ -514,7 +514,7 @@ class WSCMCourse extends WSCM
 
 	public function get_message_data($username, $password)
 	{
-		if($this->verifyUserPass($username, $password) == "valid")
+		if ($this->verifyUserPass($username, $password) == "valid")
 		{
 			$user_id = get_user_id_from_username($username);
 
@@ -524,7 +524,7 @@ class WSCMCourse extends WSCM
 
 	public function nada($username, $password)
 	{
-		if($this->verifyUserPass($username, $password) == "valid")
+		if ($this->verifyUserPass($username, $password) == "valid")
 			return $username.$password;
 		return $username;
 	}

+ 1 - 1
main/work/add_document.php

@@ -4,7 +4,7 @@
 require_once __DIR__.'/../inc/global.inc.php';
 require_once 'work.lib.php';
 
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
+$current_course_tool = TOOL_STUDENTPUBLICATION;
 
 $workId = isset($_GET['id']) ? intval($_GET['id']) : null;
 $docId = isset($_GET['document_id']) ? intval($_GET['document_id']) : null;

+ 3 - 3
main/work/downloadfolder.inc.php

@@ -9,7 +9,7 @@
 
 $work_id = $_GET['id'];
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
+$current_course_tool = TOOL_STUDENTPUBLICATION;
 $_course = api_get_course_info();
 
 // Protection
@@ -185,10 +185,10 @@ while ($not_deleted_file = Database::fetch_assoc($query)) {
 if (!empty($files)) {
     $fileName = api_replace_dangerous_char($work_data['title']);
     // Logging
-    Event::event_download($fileName .'.zip (folder)');
+    Event::event_download($fileName.'.zip (folder)');
 
     //start download of created file
-    $name = $fileName .'.zip';
+    $name = $fileName.'.zip';
 
     if (Security::check_abs_path($temp_zip_file, api_get_path(SYS_ARCHIVE_PATH))) {
         DocumentManager::file_send_for_download($temp_zip_file, true, $name);

+ 1 - 1
main/work/show_file.php

@@ -12,7 +12,7 @@
 require_once __DIR__.'/../inc/global.inc.php';
 require_once 'work.lib.php';
 
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
+$current_course_tool = TOOL_STUDENTPUBLICATION;
 $this_section = SECTION_COURSES;
 
 // Course protection

+ 3 - 3
main/work/work_list_all.php

@@ -2,7 +2,7 @@
 /* For licensing terms, see /license.txt */
 
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_STUDENTPUBLICATION;
+$current_course_tool = TOOL_STUDENTPUBLICATION;
 
 api_protect_course_script(true);
 
@@ -172,7 +172,7 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !$isDrhOfC
     $actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_document.php?'.api_get_cidreq().'&id='.$workId.'">';
     $actionsLeft .= Display::return_icon('new_document.png', get_lang('AddDocument'), '', ICON_SIZE_MEDIUM).'</a>';
 
-    $actionsLeft .=  '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_user.php?'.api_get_cidreq().'&id='.$workId.'">';
+    $actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_user.php?'.api_get_cidreq().'&id='.$workId.'">';
     $actionsLeft .= Display::return_icon('addworkuser.png', get_lang('AddUsers'), '', ICON_SIZE_MEDIUM).'</a>';
 
     $actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId.'&action=export_pdf">';
@@ -192,7 +192,7 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !$isDrhOfC
     $actionsLeft .= $display_output;
     $url = api_get_path(WEB_CODE_PATH).'work/upload_corrections.php?'.api_get_cidreq().'&id='.$workId;
     $actionsLeft .= '<a class="btn-toolbar" href="'.$url.'">'.
-        Display::return_icon('upload_package.png', get_lang('UploadCorrectionsPackage'), '', ICON_SIZE_MEDIUM) . ' ' . get_lang('UploadCorrectionsPackage') . '</a>';
+        Display::return_icon('upload_package.png', get_lang('UploadCorrectionsPackage'), '', ICON_SIZE_MEDIUM).' '.get_lang('UploadCorrectionsPackage').'</a>';
     $url = api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId.'&action=delete_correction';
     $actionsLeft .= Display::toolbarButton(get_lang('DeleteCorrections'), $url, 'remove', 'danger');
 }

+ 3 - 3
plugin/bbb/ajax.php

@@ -7,7 +7,7 @@
 $course_plugin = 'bbb'; //needed in order to load the plugin lang variables
 $cidReset = true;
 
-require_once __DIR__ . '/../../main/inc/global.inc.php';
+require_once __DIR__.'/../../main/inc/global.inc.php';
 
 $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
 $meetingId = isset($_REQUEST['meeting']) ? intval($_REQUEST['meeting']) : 0;
@@ -33,10 +33,10 @@ switch ($action) {
                 'first'
             );
 
-            $url = $meetingInfo['video_url'] . '/capture.m4v';
+            $url = $meetingInfo['video_url'].'/capture.m4v';
             $link = Display::url(
                 Display::return_icon('save.png', get_lang('DownloadFile')),
-                $meetingInfo['video_url'] . '/capture.m4v',
+                $meetingInfo['video_url'].'/capture.m4v',
                 ['target' => '_blank']
             );
 

+ 2 - 2
plugin/buycourses/src/service_error.php

@@ -22,7 +22,7 @@ if (isset($_SESSION['bc_service_sale_id'])) {
         Display::return_message($plugin->get_lang('OrderCancelled'), 'error', false)
     );
 
-    header('Location: '. api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
+    header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
     exit;
 }
 
@@ -30,6 +30,6 @@ Display::addFlash(
     Display::return_message($plugin->get_lang('ErrorOccurred'), 'error', false)
 );
 
-header('Location: '. api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php');
+header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php');
 
 exit;

+ 1 - 1
plugin/buycourses/src/service_information.php

@@ -29,7 +29,7 @@ if (!$service['id']) {
 }
 
 $template = new Template(false);
-$template->assign('pageUrl', api_get_path(WEB_PATH) . "service/{$serviceId}/information/");
+$template->assign('pageUrl', api_get_path(WEB_PATH)."service/{$serviceId}/information/");
 $template->assign('service', $service);
 $template->assign('essence', Essence\Essence::instance());
 

+ 1 - 1
plugin/google_maps/index.php

@@ -5,7 +5,7 @@
  * @author José Loguercio Silva <jose.loguercio@beeznest.com>
  * @package chamilo.plugin.google_maps
  */
-require_once __DIR__ . '/config.php';
+require_once __DIR__.'/config.php';
 
 $googleMapsPlugin = GoogleMapsPlugin::create();
 

+ 1 - 1
plugin/google_maps/install.php

@@ -5,6 +5,6 @@
  * @author José Loguercio Silva <jose.loguercio@beeznest.com>
  * @package chamilo.plugin.google_maps
  */
-require_once __DIR__ . '/config.php';
+require_once __DIR__.'/config.php';
 
 GoogleMapsPlugin::create()->install();

+ 1 - 1
plugin/share_buttons/index.php

@@ -6,7 +6,7 @@
 echo '
 <div class="well well-sm">
     <!-- AddThis Button BEGIN -->
-    <div class="addthis_toolbox addthis_default_style ' . $plugin_info['icon_class'] . '">
+    <div class="addthis_toolbox addthis_default_style ' . $plugin_info['icon_class'].'">
         <a class="addthis_button_preferred_1"></a>
         <a class="addthis_button_preferred_2"></a>
         <a class="addthis_button_preferred_3"></a>

+ 2 - 2
plugin/tour/ajax/steps.ajax.php

@@ -6,8 +6,8 @@
  * @package chamilo.plugin.tour
  */
 require_once __DIR__.'/../../../main/inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
-require_once api_get_path(SYS_PLUGIN_PATH) . 'tour/src/tour_plugin.class.php';
+require_once api_get_path(LIBRARY_PATH).'plugin.class.php';
+require_once api_get_path(SYS_PLUGIN_PATH).'tour/src/tour_plugin.class.php';
 
 if (!api_is_anonymous()) {
     $currentPageClass = isset($_GET['page_class']) ? $_GET['page_class'] : '';

+ 3 - 3
plugin/tour/index.php

@@ -5,10 +5,10 @@
  * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
  * @package chamilo.plugin.tour
  */
-require_once __DIR__ . '/config.php';
+require_once __DIR__.'/config.php';
 
-$pluginPath = api_get_path(SYS_PLUGIN_PATH) . 'tour/';
-$pluginWebPath = api_get_path(WEB_PLUGIN_PATH) . 'tour/';
+$pluginPath = api_get_path(SYS_PLUGIN_PATH).'tour/';
+$pluginWebPath = api_get_path(WEB_PLUGIN_PATH).'tour/';
 
 $userId = api_get_user_id();
 

+ 2 - 2
plugin/tour/src/tour_plugin.class.php

@@ -129,8 +129,8 @@ class Tour extends Plugin
      */
     public function getTourConfig()
     {
-        $pluginPath = api_get_path(SYS_PLUGIN_PATH) . 'tour/';
-        $jsonContent = file_get_contents($pluginPath . 'config/tour.json');
+        $pluginPath = api_get_path(SYS_PLUGIN_PATH).'tour/';
+        $jsonContent = file_get_contents($pluginPath.'config/tour.json');
         $jsonData = json_decode($jsonContent, true);
 
         return $jsonData;

+ 8 - 8
src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php

@@ -55,7 +55,7 @@ class CkEditor extends Editor
     public function createHtmlStyle()
     {
         $style = '';
-        if (trim($this->value) == '<html><head><title></title></head><body></body></html>' || $this->value == '' ) {
+        if (trim($this->value) == '<html><head><title></title></head><body></body></html>' || $this->value == '') {
             $cssFile = api_get_path(SYS_CSS_PATH).'themes/'.api_get_visual_theme().'/editor.css';
             if (!is_file($cssFile)) {
                 $cssFile = api_get_path(WEB_CSS_PATH).'editor.css';
@@ -147,14 +147,14 @@ class CkEditor extends Editor
         return [[
             'title' => get_lang('EmptyTemplate'),
             'description' => null,
-            'image' => api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/empty.gif',
+            'image' => api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/empty.gif',
             'html' => '
                 <!DOCYTPE html>
                 <html>
                     <head>
-                        <meta charset="' . api_get_system_encoding() . '" />
+                        <meta charset="' . api_get_system_encoding().'" />
                     </head>
-                    <body  dir="' . api_get_text_direction() . '">
+                    <body  dir="' . api_get_text_direction().'">
                         <p>
                             <br/>
                         </p>
@@ -177,7 +177,7 @@ class CkEditor extends Editor
         $search = array('{CSS}', '{IMG_DIR}', '{REL_PATH}', '{COURSE_DIR}');
         $replace = array(
             '',
-            api_get_path(REL_CODE_PATH) . 'img/',
+            api_get_path(REL_CODE_PATH).'img/',
             api_get_path(REL_PATH),
             api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH),
             api_get_path(REL_DEFAULT_COURSE_DOCUMENT_PATH)
@@ -188,7 +188,7 @@ class CkEditor extends Editor
         foreach ($systemTemplates as $template) {
             $image = $template->getImage();
             $image = !empty($image) ? $image : 'empty.gif';
-            $image = api_get_path(WEB_APP_PATH) . 'home/default_platform_document/template_thumb/' . $image;
+            $image = api_get_path(WEB_APP_PATH).'home/default_platform_document/template_thumb/'.$image;
 
             /*$image = $this->urlGenerator->generate(
                 'get_document_template_action',
@@ -240,12 +240,12 @@ class CkEditor extends Editor
             $templateItem['image'] = api_get_path(WEB_APP_PATH)
                 . 'home/default_platform_document/template_thumb/noimage.gif';
             $templateItem['html'] = file_get_contents(api_get_path(SYS_COURSE_PATH)
-                . $courseDirectory . '/document' . $templateData['path']);
+                . $courseDirectory.'/document'.$templateData['path']);
 
             $image = $template->getImage();
             if (!empty($image)) {
                 $templateItem['image'] = api_get_path(WEB_COURSE_PATH)
-                    . $courseDirectory . '/upload/template_thumbnails/' . $template->getImage();
+                    . $courseDirectory.'/upload/template_thumbnails/'.$template->getImage();
             }
 
             $templateList[] = $templateItem;

+ 2 - 2
src/Chamilo/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php

@@ -61,7 +61,7 @@ class AllowIframes extends HTMLPurifier_Filter
         $vimeoMatch = preg_match('#://player.vimeo.com/#i', $matches[1]);
         $googleMapsMatch = preg_match('#src="https://maps.google.com/#i', $matches[1]);
         $slideShare = preg_match('#src="(https?:)?//www.slideshare.net/#', $matches[1]);
-        $platformDomain = preg_match('#src="https?://(.+\.)?' . $hostName[1] . '#i', $matches[1]);
+        $platformDomain = preg_match('#src="https?://(.+\.)?'.$hostName[1].'#i', $matches[1]);
 
         if ($youTubeMatch || $vimeoMatch || $googleMapsMatch || $slideShare || $platformDomain) {
             $extra = ' frameborder="0"';
@@ -70,7 +70,7 @@ class AllowIframes extends HTMLPurifier_Filter
             } elseif ($vimeoMatch) {
                 $extra .= ' webkitAllowFullScreen mozallowfullscreen allowFullScreen';
             }
-            return '<iframe ' . $matches[1] . $extra . '></iframe>';
+            return '<iframe '.$matches[1].$extra.'></iframe>';
         } else {
             return '';
         }

+ 1 - 1
src/Chamilo/CoreBundle/DependencyInjection/ChamiloCoreExtension.php

@@ -22,7 +22,7 @@ class ChamiloCoreExtension extends Extension
     {
         $loader = new Loader\YamlFileLoader(
             $container,
-            new FileLocator(__DIR__ . '/../Resources/config')
+            new FileLocator(__DIR__.'/../Resources/config')
         );
 
         $loader->load('services.yml');

+ 3 - 3
src/Chamilo/CoreBundle/Entity/SkillRelUser.php

@@ -339,7 +339,7 @@ class SkillRelUser
      */
     public function getIssueUrl()
     {
-        return api_get_path(WEB_PATH) . "badge/{$this->id}";
+        return api_get_path(WEB_PATH)."badge/{$this->id}";
     }
 
     /**
@@ -348,7 +348,7 @@ class SkillRelUser
      */
     public function getIssueUrlAll()
     {
-        return api_get_path(WEB_PATH) . "skill/{$this->skill->getId()}/user/{$this->user->getId()}";
+        return api_get_path(WEB_PATH)."skill/{$this->skill->getId()}/user/{$this->user->getId()}";
     }
 
     /**
@@ -357,7 +357,7 @@ class SkillRelUser
      */
     public function getAssertionUrl()
     {
-        $url = api_get_path(WEB_CODE_PATH) . "badge/assertion.php?";
+        $url = api_get_path(WEB_CODE_PATH)."badge/assertion.php?";
 
         $url .= http_build_query(array(
             'user' => $this->user->getId(),

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